aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathias Gumz <akira at fluxbox dot org>2011-02-22 21:17:11 (GMT)
committerMathias Gumz <akira at fluxbox dot org>2011-02-22 21:17:11 (GMT)
commit4f921f77f459a983a75edb8bd3fb7b0bb2015298 (patch)
treeabac675a3c5d91a303009e7abe738a3c03c70648
parentd11aa42ace928efc3dd1eebc8988b6bbbc005b2b (diff)
downloadfluxbox_pavel-4f921f77f459a983a75edb8bd3fb7b0bb2015298.zip
fluxbox_pavel-4f921f77f459a983a75edb8bd3fb7b0bb2015298.tar.bz2
don't use hardcoded references to positions in the menu
-rw-r--r--src/AlphaMenu.cc20
-rw-r--r--src/AlphaMenu.hh7
2 files changed, 16 insertions, 11 deletions
diff --git a/src/AlphaMenu.cc b/src/AlphaMenu.cc
index 03aca47..f15c9d1 100644
--- a/src/AlphaMenu.cc
+++ b/src/AlphaMenu.cc
@@ -51,18 +51,18 @@ AlphaMenu::AlphaMenu(FbTk::ThemeProxy<FbTk::MenuTheme> &tm,
51 "Focused Window Alpha", 51 "Focused Window Alpha",
52 "Transparency level of the focused window"); 52 "Transparency level of the focused window");
53 53
54 FbTk::MenuItem *focused_alpha_item = 54 m_focused_alpha_item =
55 new FbTk::IntMenuItem(focused_alpha_label, m_focused_alpha, 0, 255, *this); 55 new FbTk::IntMenuItem(focused_alpha_label, m_focused_alpha, 0, 255, *this);
56 insert(focused_alpha_item); 56 insert(m_focused_alpha_item);
57 57
58 const FbTk::FbString unfocused_alpha_label = 58 const FbTk::FbString unfocused_alpha_label =
59 _FB_XTEXT(Configmenu, UnfocusedAlpha, 59 _FB_XTEXT(Configmenu, UnfocusedAlpha,
60 "Unfocused Window Alpha", 60 "Unfocused Window Alpha",
61 "Transparency level of unfocused windows"); 61 "Transparency level of unfocused windows");
62 62
63 FbTk::MenuItem *unfocused_alpha_item = 63 m_unfocused_alpha_item =
64 new FbTk::IntMenuItem(unfocused_alpha_label, m_unfocused_alpha, 0, 255, *this); 64 new FbTk::IntMenuItem(unfocused_alpha_label, m_unfocused_alpha, 0, 255, *this);
65 insert(unfocused_alpha_item); 65 insert(m_unfocused_alpha_item);
66 66
67 const FbTk::FbString usedefault_label = _FB_XTEXT(Windowmenu, DefaultAlpha, 67 const FbTk::FbString usedefault_label = _FB_XTEXT(Windowmenu, DefaultAlpha,
68 "Use Defaults", 68 "Use Defaults",
@@ -79,18 +79,16 @@ void AlphaMenu::move(int x, int y) {
79 FbTk::Menu::move(x, y); 79 FbTk::Menu::move(x, y);
80 80
81 if (isVisible()) { 81 if (isVisible()) {
82 // TODO: hardcoding the indices is a bad idea 82 m_focused_alpha_item->updateLabel();
83 ((FbTk::IntMenuItem *)find(0))->updateLabel(); 83 m_unfocused_alpha_item->updateLabel();
84 ((FbTk::IntMenuItem *)find(1))->updateLabel();
85 frameWindow().updateBackground(false); 84 frameWindow().updateBackground(false);
86 FbTk::Menu::clearWindow(); 85 FbTk::Menu::clearWindow();
87 } 86 }
88} 87}
89 88
90void AlphaMenu::show() { 89void AlphaMenu::show() {
91 // TODO: hardcoding the indices is a bad idea 90 m_focused_alpha_item->updateLabel();
92 ((FbTk::IntMenuItem *)find(0))->updateLabel(); 91 m_unfocused_alpha_item->updateLabel();
93 ((FbTk::IntMenuItem *)find(1))->updateLabel();
94 frameWindow().updateBackground(false); 92 frameWindow().updateBackground(false);
95 FbTk::Menu::clearWindow(); 93 FbTk::Menu::clearWindow();
96 94
diff --git a/src/AlphaMenu.hh b/src/AlphaMenu.hh
index 833b0d2..27f26dd 100644
--- a/src/AlphaMenu.hh
+++ b/src/AlphaMenu.hh
@@ -28,6 +28,10 @@
28#include "WindowMenuAccessor.hh" 28#include "WindowMenuAccessor.hh"
29#include "FbTk/MenuItem.hh" 29#include "FbTk/MenuItem.hh"
30 30
31namespace FbTk {
32 class IntMenuItem;
33}
34
31class AlphaMenu : public ToggleMenu { 35class AlphaMenu : public ToggleMenu {
32public: 36public:
33 AlphaMenu(FbTk::ThemeProxy<FbTk::MenuTheme> &tm, 37 AlphaMenu(FbTk::ThemeProxy<FbTk::MenuTheme> &tm,
@@ -36,6 +40,9 @@ public:
36 // we override these to update the menu when the active window changes 40 // we override these to update the menu when the active window changes
37 void move(int x, int y); 41 void move(int x, int y);
38 void show(); 42 void show();
43private:
44 FbTk::IntMenuItem* m_focused_alpha_item;
45 FbTk::IntMenuItem* m_unfocused_alpha_item;
39}; 46};
40 47
41class AlphaMenuSelectItem : public FbTk::MenuItem { 48class AlphaMenuSelectItem : public FbTk::MenuItem {