diff options
Diffstat (limited to 'src/FocusModelMenuItem.hh')
-rw-r--r-- | src/FocusModelMenuItem.hh | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/src/FocusModelMenuItem.hh b/src/FocusModelMenuItem.hh index 0c62a09..6121432 100644 --- a/src/FocusModelMenuItem.hh +++ b/src/FocusModelMenuItem.hh | |||
@@ -25,48 +25,54 @@ | |||
25 | #ifndef FOCUSMODELMENUITEM_HH | 25 | #ifndef FOCUSMODELMENUITEM_HH |
26 | #define FOCUSMODELMENUITEM_HH | 26 | #define FOCUSMODELMENUITEM_HH |
27 | 27 | ||
28 | #include "Screen.hh" | ||
29 | 28 | ||
30 | #include "FbTk/MenuItem.hh" | 29 | #include "FbTk/MenuItem.hh" |
31 | #include "FbTk/RefCount.hh" | 30 | #include "FbTk/RefCount.hh" |
32 | #include "FbTk/Command.hh" | 31 | #include "FbTk/Command.hh" |
33 | 32 | ||
33 | #include "FocusControl.hh" | ||
34 | |||
34 | class FocusModelMenuItem : public FbTk::MenuItem { | 35 | class FocusModelMenuItem : public FbTk::MenuItem { |
35 | public: | 36 | public: |
36 | FocusModelMenuItem(const char *label, BScreen &screen, | 37 | FocusModelMenuItem(const char *label, FocusControl &focus_control, |
37 | BScreen::FocusModel model, | 38 | FocusControl::FocusModel model, |
38 | FbTk::RefCount<FbTk::Command> &cmd): | 39 | FbTk::RefCount<FbTk::Command> &cmd): |
39 | FbTk::MenuItem(label, cmd), m_screen(screen), m_focusmodel(model) { | 40 | FbTk::MenuItem(label, cmd), |
40 | } | 41 | m_focus_control(focus_control), |
41 | bool isEnabled() const { return m_screen.getFocusModel() != m_focusmodel; } | 42 | m_focusmodel(model) { } |
43 | |||
44 | bool isEnabled() const { return m_focus_control.focusModel() != m_focusmodel; } | ||
42 | 45 | ||
43 | void click(int button, int time) { | 46 | void click(int button, int time) { |
44 | m_screen.saveFocusModel(m_focusmodel); | 47 | m_focus_control.setFocusModel(m_focusmodel); |
45 | FbTk::MenuItem::click(button, time); | 48 | FbTk::MenuItem::click(button, time); |
46 | } | 49 | } |
47 | 50 | ||
48 | private: | 51 | private: |
49 | BScreen &m_screen; | 52 | FocusControl &m_focus_control; |
50 | BScreen::FocusModel m_focusmodel; | 53 | FocusControl::FocusModel m_focusmodel; |
51 | }; | 54 | }; |
52 | 55 | ||
53 | class TabFocusModelMenuItem : public FbTk::MenuItem { | 56 | class TabFocusModelMenuItem : public FbTk::MenuItem { |
54 | public: | 57 | public: |
55 | TabFocusModelMenuItem(const char *label, BScreen &screen, | 58 | TabFocusModelMenuItem(const char *label, |
56 | BScreen::TabFocusModel model, | 59 | FocusControl &focus_control, |
57 | FbTk::RefCount<FbTk::Command> &cmd): | 60 | FocusControl::TabFocusModel model, |
58 | FbTk::MenuItem(label, cmd), m_screen(screen), m_tabfocusmodel(model) { | 61 | FbTk::RefCount<FbTk::Command> &cmd): |
59 | } | 62 | FbTk::MenuItem(label, cmd), |
60 | bool isEnabled() const { return m_screen.getTabFocusModel() != m_tabfocusmodel; } | 63 | m_focus_control(focus_control), |
64 | m_tabfocusmodel(model) { } | ||
65 | |||
66 | bool isEnabled() const { return m_focus_control.tabFocusModel() != m_tabfocusmodel; } | ||
61 | 67 | ||
62 | void click(int button, int time) { | 68 | void click(int button, int time) { |
63 | m_screen.saveTabFocusModel(m_tabfocusmodel); | 69 | m_focus_control.setTabFocusModel(m_tabfocusmodel); |
64 | FbTk::MenuItem::click(button, time); | 70 | FbTk::MenuItem::click(button, time); |
65 | } | 71 | } |
66 | 72 | ||
67 | private: | 73 | private: |
68 | BScreen &m_screen; | 74 | FocusControl &m_focus_control; |
69 | BScreen::TabFocusModel m_tabfocusmodel; | 75 | FocusControl::TabFocusModel m_tabfocusmodel; |
70 | }; | 76 | }; |
71 | 77 | ||
72 | 78 | ||