[the-board] [ui] Add api to set active button in ToolBox



commit e747902f24a23462544a5ddfb0abd48877afcf89
Author: Lucas Rocha <lucasr gnome org>
Date:   Tue Nov 16 23:40:22 2010 +0000

    [ui] Add api to set active button in ToolBox
    
    Only possible when ToolBox is a button group.

 src/js/ui/toolBox.js |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/js/ui/toolBox.js b/src/js/ui/toolBox.js
index a6bce71..50a6967 100644
--- a/src/js/ui/toolBox.js
+++ b/src/js/ui/toolBox.js
@@ -158,6 +158,17 @@ ToolBox.prototype = {
         return button;
     },
 
+    setActiveButton : function(activeButton) {
+        if (!this._isButtonGroup) {
+            throw new Error("Can't set active button on " +
+                            "non-button group tool box");
+        }
+
+        if (this._buttons.indexOf(activeButton) != -1) {
+            this._buttonGroup.set_active_button(activeButton);
+        }
+    },
+
     setActive : function(active) {
         if (this._active === active) {
             return;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]