summaryrefslogtreecommitdiff
path: root/src/FbTk
diff options
context:
space:
mode:
authorsimonb <simonb>2005-05-03 13:53:25 (GMT)
committersimonb <simonb>2005-05-03 13:53:25 (GMT)
commit7d4f711204ab0b51d45eaff332708f529c11c9f5 (patch)
tree57488fc9d10740f0501396f68b4e061b0cec8810 /src/FbTk
parent575578d810733e0ca8d970f5923594a9d1930216 (diff)
downloadfluxbox_lack-7d4f711204ab0b51d45eaff332708f529c11c9f5.zip
fluxbox_lack-7d4f711204ab0b51d45eaff332708f529c11c9f5.tar.bz2
fix some menu drawing issues
Diffstat (limited to 'src/FbTk')
-rw-r--r--src/FbTk/Menu.cc7
-rw-r--r--src/FbTk/MenuItem.hh22
2 files changed, 25 insertions, 4 deletions
diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc
index fbf7e45..e0e3e7f 100644
--- a/src/FbTk/Menu.cc
+++ b/src/FbTk/Menu.cc
@@ -475,7 +475,7 @@ void Menu::updateMenu(int active_index) {
475 } 475 }
476 476
477 menu.frame.moveResize(0, ((m_title_vis) ? menu.title.y() + menu.title.height() + 477 menu.frame.moveResize(0, ((m_title_vis) ? menu.title.y() + menu.title.height() +
478 menu.title.borderWidth()*2 : 1), 478 menu.title.borderWidth()*2 : 0),
479 width(), menu.frame_h); 479 width(), menu.frame_h);
480 480
481 if (m_title_vis && m_need_update) { 481 if (m_title_vis && m_need_update) {
@@ -927,6 +927,8 @@ void Menu::motionNotifyEvent(XMotionEvent &me) {
927 } 927 }
928 928
929 m_moving = m_torn = true; 929 m_moving = m_torn = true;
930 // clear current highlighted item
931 clearItem(m_active_index);
930 932
931 if (m_which_sub >= 0) 933 if (m_which_sub >= 0)
932 drawSubmenu(m_which_sub); 934 drawSubmenu(m_which_sub);
@@ -1238,7 +1240,8 @@ void Menu::clearItem(int index, bool clear) {
1238 int item_x = (sbl * item_w), item_y = (i * item_h); 1240 int item_x = (sbl * item_w), item_y = (i * item_h);
1239 bool highlight = (index == m_active_index); 1241 bool highlight = (index == m_active_index);
1240 1242
1241 if (highlight) { 1243 // don't highlight if moving, doesn't work with alpha on
1244 if (highlight && !m_moving) {
1242 highlightItem(index); 1245 highlightItem(index);
1243 return; 1246 return;
1244 } else if (clear) 1247 } else if (clear)
diff --git a/src/FbTk/MenuItem.hh b/src/FbTk/MenuItem.hh
index 20da8f7..b3b2f6b 100644
--- a/src/FbTk/MenuItem.hh
+++ b/src/FbTk/MenuItem.hh
@@ -42,6 +42,7 @@ class MenuItem {
42public: 42public:
43 MenuItem() 43 MenuItem()
44 : m_label(""), 44 : m_label(""),
45 m_menu(0),
45 m_submenu(0), 46 m_submenu(0),
46 m_enabled(true), 47 m_enabled(true),
47 m_selected(false), 48 m_selected(false),
@@ -50,14 +51,25 @@ public:
50 explicit MenuItem( 51 explicit MenuItem(
51 const char *label) 52 const char *label)
52 : m_label(label ? label : ""), 53 : m_label(label ? label : ""),
54 m_menu(0),
55 m_submenu(0),
56 m_enabled(true),
57 m_selected(false),
58 m_toggle_item(false)
59 { }
60
61 MenuItem(const char *label, Menu &host_menu)
62 : m_label(label ? label : ""),
63 m_menu(&host_menu),
53 m_submenu(0), 64 m_submenu(0),
54 m_enabled(true), 65 m_enabled(true),
55 m_selected(false), 66 m_selected(false),
56 m_toggle_item(false) 67 m_toggle_item(false)
57 { } 68 { }
58 /// create a menu item with a specific command to be executed on click 69 /// create a menu item with a specific command to be executed on click
59 MenuItem(const char *label, RefCount<Command> &cmd): 70 MenuItem(const char *label, RefCount<Command> &cmd, Menu *menu = 0):
60 m_label(label ? label : ""), 71 m_label(label ? label : ""),
72 m_menu(menu),
61 m_submenu(0), 73 m_submenu(0),
62 m_command(cmd), 74 m_command(cmd),
63 m_enabled(true), 75 m_enabled(true),
@@ -66,8 +78,9 @@ public:
66 78
67 } 79 }
68 80
69 MenuItem(const char *label, Menu *submenu) 81 MenuItem(const char *label, Menu *submenu, Menu *host_menu = 0)
70 : m_label(label ? label : "") 82 : m_label(label ? label : "")
83 , m_menu(host_menu)
71 , m_submenu(submenu) 84 , m_submenu(submenu)
72 , m_enabled(true) 85 , m_enabled(true)
73 , m_selected(false), 86 , m_selected(false),
@@ -110,9 +123,13 @@ public:
110 RefCount<Command> &command() { return m_command; } 123 RefCount<Command> &command() { return m_command; }
111 const RefCount<Command> &command() const { return m_command; } 124 const RefCount<Command> &command() const { return m_command; }
112 //@} 125 //@}
126
127 void setMenu(Menu &menu) { m_menu = &menu; }
128 Menu *menu() { return m_menu; }
113 129
114private: 130private:
115 std::string m_label; ///< label of this item 131 std::string m_label; ///< label of this item
132 Menu *m_menu; ///< the menu we live in
116 Menu *m_submenu; ///< a submenu, 0 if we don't have one 133 Menu *m_submenu; ///< a submenu, 0 if we don't have one
117 RefCount<Command> m_command; ///< command to be executed 134 RefCount<Command> m_command; ///< command to be executed
118 bool m_enabled, m_selected; 135 bool m_enabled, m_selected;
@@ -123,6 +140,7 @@ private:
123 std::string filename; 140 std::string filename;
124 }; 141 };
125 std::auto_ptr<Icon> m_icon; 142 std::auto_ptr<Icon> m_icon;
143
126}; 144};
127 145
128} // end namespace FbTk 146} // end namespace FbTk