diff options
author | Pavel Labath <pavelo@centrum.sk> | 2011-04-30 09:32:10 (GMT) |
---|---|---|
committer | Pavel Labath <pavelo@centrum.sk> | 2011-05-10 11:00:45 (GMT) |
commit | fa15400cc24ddcfd6e361bd068ae1986b9f9e561 (patch) | |
tree | ce137e8ce4486e42451b3f4921ba519a13270469 /src | |
parent | f7d7dfd2a8047207dbe90bc77592c25acf4ca15c (diff) | |
download | fluxbox-fa15400cc24ddcfd6e361bd068ae1986b9f9e561.zip fluxbox-fa15400cc24ddcfd6e361bd068ae1986b9f9e561.tar.bz2 |
Remove the Observer dependency from FbTk::Menu
Diffstat (limited to 'src')
-rw-r--r-- | src/ClientMenu.cc | 9 | ||||
-rw-r--r-- | src/ClientMenu.hh | 4 | ||||
-rw-r--r-- | src/FbTk/Menu.cc | 2 | ||||
-rw-r--r-- | src/FbTk/Menu.hh | 8 |
4 files changed, 8 insertions, 15 deletions
diff --git a/src/ClientMenu.cc b/src/ClientMenu.cc index faa1d3f..4a3dacd 100644 --- a/src/ClientMenu.cc +++ b/src/ClientMenu.cc | |||
@@ -153,13 +153,11 @@ void ClientMenu::titleChanged(Focusable& win) { | |||
153 | // find correct menu item | 153 | // find correct menu item |
154 | ClientMenuItem* cl_item = getMenuItem(*this, win); | 154 | ClientMenuItem* cl_item = getMenuItem(*this, win); |
155 | if (cl_item) | 155 | if (cl_item) |
156 | FbTk::Menu::update(0); | 156 | themeReconfigured(); |
157 | } | 157 | } |
158 | 158 | ||
159 | void ClientMenu::update(FbTk::Subject *subj) { | 159 | void ClientMenu::update(FbTk::Subject *subj) { |
160 | if (subj && typeid(*subj) == typeid(Focusable::FocusSubject)) { | 160 | if (Focusable::FocusSubject *fsubj = dynamic_cast<Focusable::FocusSubject *>(subj)) { |
161 | |||
162 | Focusable::FocusSubject *fsubj = static_cast<Focusable::FocusSubject *>(subj); | ||
163 | Focusable &win = fsubj->win(); | 161 | Focusable &win = fsubj->win(); |
164 | 162 | ||
165 | // find correct menu item | 163 | // find correct menu item |
@@ -169,6 +167,5 @@ void ClientMenu::update(FbTk::Subject *subj) { | |||
169 | if (cl_item && fsubj == &win.dieSig()) { | 167 | if (cl_item && fsubj == &win.dieSig()) { |
170 | remove(cl_item->getIndex()); | 168 | remove(cl_item->getIndex()); |
171 | } | 169 | } |
172 | } else | 170 | } |
173 | FbTk::Menu::update(subj); | ||
174 | } | 171 | } |
diff --git a/src/ClientMenu.hh b/src/ClientMenu.hh index 6b59e71..61fd198 100644 --- a/src/ClientMenu.hh +++ b/src/ClientMenu.hh | |||
@@ -25,7 +25,7 @@ | |||
25 | #include "FbMenu.hh" | 25 | #include "FbMenu.hh" |
26 | 26 | ||
27 | #include "FbTk/Signal.hh" | 27 | #include "FbTk/Signal.hh" |
28 | #include "FbTk/Subject.hh" | 28 | #include "FbTk/Observer.hh" |
29 | 29 | ||
30 | class BScreen; | 30 | class BScreen; |
31 | class FluxboxWindow; | 31 | class FluxboxWindow; |
@@ -35,7 +35,7 @@ class Focusable; | |||
35 | * A menu holding a set of client menus. | 35 | * A menu holding a set of client menus. |
36 | * @see WorkspaceMenu | 36 | * @see WorkspaceMenu |
37 | */ | 37 | */ |
38 | class ClientMenu: public FbMenu { | 38 | class ClientMenu: public FbMenu, public FbTk::Observer { |
39 | public: | 39 | public: |
40 | 40 | ||
41 | typedef std::list<FluxboxWindow *> Focusables; | 41 | typedef std::list<FluxboxWindow *> Focusables; |
diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc index da5760d..40f81c8 100644 --- a/src/FbTk/Menu.cc +++ b/src/FbTk/Menu.cc | |||
@@ -1233,7 +1233,7 @@ void Menu::stopHide() { | |||
1233 | m_hide_timer.stop(); | 1233 | m_hide_timer.stop(); |
1234 | } | 1234 | } |
1235 | 1235 | ||
1236 | void Menu::update(FbTk::Subject *subj) { | 1236 | void Menu::themeReconfigured() { |
1237 | 1237 | ||
1238 | m_need_update = true; | 1238 | m_need_update = true; |
1239 | 1239 | ||
diff --git a/src/FbTk/Menu.hh b/src/FbTk/Menu.hh index 7b59cf7..bd830b4 100644 --- a/src/FbTk/Menu.hh +++ b/src/FbTk/Menu.hh | |||
@@ -31,7 +31,6 @@ | |||
31 | #include "FbString.hh" | 31 | #include "FbString.hh" |
32 | #include "FbWindow.hh" | 32 | #include "FbWindow.hh" |
33 | #include "EventHandler.hh" | 33 | #include "EventHandler.hh" |
34 | #include "Observer.hh" | ||
35 | #include "MenuTheme.hh" | 34 | #include "MenuTheme.hh" |
36 | #include "Timer.hh" | 35 | #include "Timer.hh" |
37 | #include "TypeAhead.hh" | 36 | #include "TypeAhead.hh" |
@@ -44,8 +43,7 @@ class ImageControl; | |||
44 | template <typename T> class RefCount; | 43 | template <typename T> class RefCount; |
45 | 44 | ||
46 | /// Base class for menus | 45 | /// Base class for menus |
47 | class Menu: public FbTk::EventHandler, FbTk::FbWindowRenderer, | 46 | class Menu: public FbTk::EventHandler, FbTk::FbWindowRenderer { |
48 | public FbTk::Observer { | ||
49 | public: | 47 | public: |
50 | enum Alignment{ ALIGNDONTCARE = 1, ALIGNTOP, ALIGNBOTTOM }; | 48 | enum Alignment{ ALIGNDONTCARE = 1, ALIGNTOP, ALIGNBOTTOM }; |
51 | enum { RIGHT = 1, LEFT }; | 49 | enum { RIGHT = 1, LEFT }; |
@@ -168,6 +166,7 @@ public: | |||
168 | 166 | ||
169 | protected: | 167 | protected: |
170 | 168 | ||
169 | void themeReconfigured(); | ||
171 | void setTitleVisibility(bool b) { | 170 | void setTitleVisibility(bool b) { |
172 | m_title_vis = b; m_need_update = true; | 171 | m_title_vis = b; m_need_update = true; |
173 | if (!b) | 172 | if (!b) |
@@ -187,15 +186,12 @@ protected: | |||
187 | 186 | ||
188 | virtual void internal_hide(bool first = true); | 187 | virtual void internal_hide(bool first = true); |
189 | 188 | ||
190 | virtual void update(FbTk::Subject *); | ||
191 | |||
192 | private: | 189 | private: |
193 | 190 | ||
194 | void openSubmenu(); | 191 | void openSubmenu(); |
195 | void closeMenu(); | 192 | void closeMenu(); |
196 | void startHide(); | 193 | void startHide(); |
197 | void stopHide(); | 194 | void stopHide(); |
198 | void themeReconfigured() { update(NULL); } | ||
199 | 195 | ||
200 | FbTk::ThemeProxy<MenuTheme> &m_theme; | 196 | FbTk::ThemeProxy<MenuTheme> &m_theme; |
201 | Menu *m_parent; | 197 | Menu *m_parent; |