From 657bdeeb7eee0a86dad2bde4817a593382e641e0 Mon Sep 17 00:00:00 2001
From: Rene Saarsoo <nene@triin.net>
Date: Wed, 25 Jan 2012 20:06:22 -0800
Subject: [PATCH] Replace 3 buttons with menu of check-items.

---
 template/app/view/Comments.js    |  2 +-
 template/app/view/cls/Toolbar.js | 36 +++++++++++++++++++-------------
 2 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/template/app/view/Comments.js b/template/app/view/Comments.js
index 48c1a9e7..71f5f2b8 100644
--- a/template/app/view/Comments.js
+++ b/template/app/view/Comments.js
@@ -303,7 +303,7 @@ Ext.define('Docs.view.Comments', {
      */
     renderClassCommentContainers: function(cls) {
         // Add comment button to class toolbar
-        Ext.ComponentQuery.query('classoverview toolbar')[0].insert(-4, {
+        Ext.ComponentQuery.query('classoverview toolbar')[0].insert(-2, {
             xtype: 'container',
             id: 'classCommentToolbarBtn',
             width: 24,
diff --git a/template/app/view/cls/Toolbar.js b/template/app/view/cls/Toolbar.js
index 25b67d57..62cc9fb4 100644
--- a/template/app/view/cls/Toolbar.js
+++ b/template/app/view/cls/Toolbar.js
@@ -106,9 +106,15 @@ Ext.define('Docs.view.cls.Toolbar', {
                 }
             }),
             { xtype: 'tbfill' },
-            this.hideInherited = this.createButton("Inh", "Show inherited", "inherited"),
-            this.hideAccessors = this.createButton("Acc", "Show accessors (getters/setters)", "accessors"),
-            this.hidePrivates = this.createButton("Pri", "Show private", "privates"),
+            {
+                xtype: 'button',
+                text: 'Show',
+                menu: [
+                    this.hideInherited = this.createCb("Inherited", "inherited"),
+                    this.hideAccessors = this.createCb("Accessors", "accessors"),
+                    this.hidePrivates  = this.createCb("Private", "privates")
+                ]
+            },
             {
                 xtype: 'button',
                 iconCls: 'expand-all-members',
@@ -127,22 +133,22 @@ Ext.define('Docs.view.cls.Toolbar', {
 
     getHideFlags: function() {
         return {
-            inherited: !this.hideInherited.pressed,
-            accessors: !this.hideAccessors.pressed,
-            privates: !this.hidePrivates.pressed
+            inherited: !this.hideInherited.checked,
+            accessors: !this.hideAccessors.checked,
+            privates: !this.hidePrivates.checked
         };
     },
 
-    createButton: function(text, title, type) {
-        return Ext.widget('button', {
+    createCb: function(text, type) {
+        return Ext.widget('menucheckitem', {
             text: text,
-            tooltip: title,
-            enableToggle: true,
-            pressed: !Docs.Settings.get("hide")[type],
-            toggleHandler: function(btn, pressed) {
-                this.fireEvent("filter", this.filterField.getValue(), this.getHideFlags());
-            },
-            scope: this
+            checked: !Docs.Settings.get("hide")[type],
+            listeners: {
+                checkchange: function() {
+                    this.fireEvent("filter", this.filterField.getValue(), this.getHideFlags());
+                },
+                scope: this
+            }
         });
     },
 
-- 
GitLab