aboutsummaryrefslogtreecommitdiff
path: root/src/AlphaMenu.hh
diff options
context:
space:
mode:
authorMark Tiefenbruck <mark@fluxbox.org>2007-12-27 21:55:24 (GMT)
committerMark Tiefenbruck <mark@fluxbox.org>2007-12-27 21:55:24 (GMT)
commitb5c354b994bc06667abe35e2d528c0f025703c4e (patch)
tree081fd3207053a06cb50931ccec3237bc614f10eb /src/AlphaMenu.hh
parent1f5cd12facc662de240b36bf3c5c14f40adf391b (diff)
downloadfluxbox-b5c354b994bc06667abe35e2d528c0f025703c4e.zip
fluxbox-b5c354b994bc06667abe35e2d528c0f025703c4e.tar.bz2
architecture astronomy
Diffstat (limited to 'src/AlphaMenu.hh')
-rw-r--r--src/AlphaMenu.hh36
1 files changed, 10 insertions, 26 deletions
diff --git a/src/AlphaMenu.hh b/src/AlphaMenu.hh
index 70f9c50..19df646 100644
--- a/src/AlphaMenu.hh
+++ b/src/AlphaMenu.hh
@@ -26,56 +26,40 @@
26#define ALPHAMENU_HH 26#define ALPHAMENU_HH
27 27
28#include "ToggleMenu.hh" 28#include "ToggleMenu.hh"
29#include "WindowCmd.hh"
29#include "FbTk/MenuItem.hh" 30#include "FbTk/MenuItem.hh"
30#include "ObjectResource.hh"
31
32class AlphaObject {
33public:
34
35 virtual int getFocusedAlpha() const = 0;
36 virtual int getUnfocusedAlpha() const = 0;
37 virtual bool getUseDefaultAlpha() const = 0;
38
39 virtual void setFocusedAlpha(int alpha) = 0;
40 virtual void setUnfocusedAlpha(int alpha) = 0;
41 virtual void setDefaultAlpha() = 0;
42
43 virtual ~AlphaObject() {};
44};
45
46 31
47class AlphaMenu : public ToggleMenu { 32class AlphaMenu : public ToggleMenu {
48public: 33public:
49 AlphaMenu(MenuTheme &tm, FbTk::ImageControl &imgctrl, 34 AlphaMenu(MenuTheme &tm, FbTk::ImageControl &imgctrl,
50 FbTk::XLayer &layer, AlphaObject &object); 35 FbTk::XLayer &layer);
51 36
52 // we override these to update the menu when the active window changes 37 // we override these to update the menu when the active window changes
53 void move(int x, int y); 38 void move(int x, int y);
54 void show(); 39 void show();
55
56 ObjectResource<AlphaObject, int> m_focused_alpha_resource;
57 ObjectResource<AlphaObject, int> m_unfocused_alpha_resource;
58
59}; 40};
60 41
61class AlphaMenuSelectItem : public FbTk::MenuItem { 42class AlphaMenuSelectItem : public FbTk::MenuItem {
62 43
63public: 44public:
64 AlphaMenuSelectItem(const FbTk::FbString &label, AlphaObject *object, AlphaMenu &parent): 45 AlphaMenuSelectItem(const FbTk::FbString &label, AlphaMenu &parent):
65 FbTk::MenuItem(label), m_object(object), m_parent(parent) { 46 FbTk::MenuItem(label), m_parent(parent) {
66 setToggleItem(true); 47 setToggleItem(true);
67 setCloseOnClick(false); 48 setCloseOnClick(false);
68 } 49 }
69 50
70 bool isSelected() const { return m_object->getUseDefaultAlpha(); } 51 bool isSelected() const {
52 static ConstWindowAccessor<bool> s_is_default(&FluxboxWindow::getUseDefaultAlpha, true);
53 return s_is_default;
54 }
71 void click(int button, int time, unsigned int mods) { 55 void click(int button, int time, unsigned int mods) {
72 m_object->setDefaultAlpha(); 56 static WindowCmd<void> s_set_default(&FluxboxWindow::setDefaultAlpha);
57 s_set_default.execute();
73 m_parent.show(); // cheat to refreshing the window 58 m_parent.show(); // cheat to refreshing the window
74 FbTk::MenuItem::click(button, time, mods); 59 FbTk::MenuItem::click(button, time, mods);
75 } 60 }
76 61
77private: 62private:
78 AlphaObject *m_object;
79 AlphaMenu &m_parent; 63 AlphaMenu &m_parent;
80}; 64};
81 65