diff options
author | rathnor <rathnor> | 2003-04-16 13:43:50 (GMT) |
---|---|---|
committer | rathnor <rathnor> | 2003-04-16 13:43:50 (GMT) |
commit | 06e830812e143c6fbf6838bc222ba6171f1a64e7 (patch) | |
tree | 55d92a3624bd8047b52f1e0693658e932a0c029c /src/LayerMenu.hh | |
parent | b47337fca633bac22443b2a156a755e45971f6f0 (diff) | |
download | fluxbox-06e830812e143c6fbf6838bc222ba6171f1a64e7.zip fluxbox-06e830812e143c6fbf6838bc222ba6171f1a64e7.tar.bz2 |
fix saving of toolbar + slit layers - simon
Diffstat (limited to 'src/LayerMenu.hh')
-rw-r--r-- | src/LayerMenu.hh | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/src/LayerMenu.hh b/src/LayerMenu.hh index 1a48878..3eafa3f 100644 --- a/src/LayerMenu.hh +++ b/src/LayerMenu.hh | |||
@@ -20,13 +20,16 @@ | |||
20 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 20 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
21 | // DEALINGS IN THE SOFTWARE. | 21 | // DEALINGS IN THE SOFTWARE. |
22 | 22 | ||
23 | // $Id: LayerMenu.hh,v 1.1 2003/02/18 22:09:02 rathnor Exp $ | 23 | // $Id: LayerMenu.hh,v 1.2 2003/04/16 13:43:41 rathnor Exp $ |
24 | 24 | ||
25 | #ifndef LAYERMENU_HH | 25 | #ifndef LAYERMENU_HH |
26 | #define LAYERMENU_HH | 26 | #define LAYERMENU_HH |
27 | 27 | ||
28 | #include "MenuItem.hh" | 28 | #include "MenuItem.hh" |
29 | #include "FbMenu.hh" | 29 | #include "FbMenu.hh" |
30 | #include "FbCommands.hh" | ||
31 | #include "RefCount.hh" | ||
32 | #include "SimpleCommand.hh" | ||
30 | 33 | ||
31 | class Fluxbox; | 34 | class Fluxbox; |
32 | 35 | ||
@@ -36,12 +39,16 @@ class Fluxbox; | |||
36 | template <typename ItemType> | 39 | template <typename ItemType> |
37 | class LayerMenuItem : public FbTk::MenuItem { | 40 | class LayerMenuItem : public FbTk::MenuItem { |
38 | public: | 41 | public: |
42 | LayerMenuItem(const char *label, ItemType *object, int layernum, | ||
43 | FbTk::RefCount<FbTk::Command> &cmd): | ||
44 | FbTk::MenuItem(label,cmd), m_object(object), m_layernum(layernum) {} | ||
39 | LayerMenuItem(const char *label, ItemType *object, int layernum): | 45 | LayerMenuItem(const char *label, ItemType *object, int layernum): |
40 | FbTk::MenuItem(label), m_object(object), m_layernum(layernum) {} | 46 | FbTk::MenuItem(label), m_object(object), m_layernum(layernum) {} |
41 | 47 | ||
42 | bool isEnabled() const { return m_object->getLayerItem().getLayerNum() != m_layernum; } ; | 48 | bool isEnabled() const { return m_object->getLayerItem().getLayerNum() != m_layernum; } ; |
43 | void click(int button, int time) { | 49 | void click(int button, int time) { |
44 | m_object->moveToLayer(m_layernum); | 50 | m_object->moveToLayer(m_layernum); |
51 | FbTk::MenuItem::click(button, time); | ||
45 | } | 52 | } |
46 | 53 | ||
47 | private: | 54 | private: |
@@ -55,7 +62,7 @@ template <typename ItemType> | |||
55 | class LayerMenu : public FbMenu { | 62 | class LayerMenu : public FbMenu { |
56 | public: | 63 | public: |
57 | LayerMenu(FbTk::MenuTheme &tm, int screen_num, FbTk::ImageControl &imgctrl, | 64 | LayerMenu(FbTk::MenuTheme &tm, int screen_num, FbTk::ImageControl &imgctrl, |
58 | FbTk::XLayer &layer, ItemType *item); | 65 | FbTk::XLayer &layer, ItemType *item, bool save_rc); |
59 | 66 | ||
60 | private: | 67 | private: |
61 | ItemType *m_object; | 68 | ItemType *m_object; |
@@ -64,7 +71,7 @@ private: | |||
64 | 71 | ||
65 | template <typename ItemType> | 72 | template <typename ItemType> |
66 | LayerMenu<ItemType>::LayerMenu(FbTk::MenuTheme &tm, int screen_num, FbTk::ImageControl &imgctrl, | 73 | LayerMenu<ItemType>::LayerMenu(FbTk::MenuTheme &tm, int screen_num, FbTk::ImageControl &imgctrl, |
67 | FbTk::XLayer &layer, ItemType *item): | 74 | FbTk::XLayer &layer, ItemType *item, bool save_rc): |
68 | FbMenu(tm, screen_num, imgctrl, layer), | 75 | FbMenu(tm, screen_num, imgctrl, layer), |
69 | m_object(item) | 76 | m_object(item) |
70 | { | 77 | { |
@@ -86,11 +93,21 @@ LayerMenu<ItemType>::LayerMenu(FbTk::MenuTheme &tm, int screen_num, FbTk::ImageC | |||
86 | {0, 0, "Desktop", fluxbox->getDesktopLayer()}, | 93 | {0, 0, "Desktop", fluxbox->getDesktopLayer()}, |
87 | }; | 94 | }; |
88 | 95 | ||
96 | FbTk::RefCount<FbTk::Command> saverc_cmd(new FbTk::SimpleCommand<Fluxbox>( | ||
97 | *Fluxbox::instance(), | ||
98 | &Fluxbox::save_rc)); | ||
99 | |||
89 | for (size_t i=0; i < 6; ++i) { | 100 | for (size_t i=0; i < 6; ++i) { |
90 | // TODO: fetch nls string | 101 | // TODO: fetch nls string |
91 | insert(new LayerMenuItem<ItemType>( | 102 | if (save_rc) { |
92 | layer_menuitems[i].default_str, | 103 | insert(new LayerMenuItem<ItemType>( |
93 | m_object, layer_menuitems[i].layernum)); | 104 | layer_menuitems[i].default_str, |
105 | m_object, layer_menuitems[i].layernum, saverc_cmd)); | ||
106 | } else { | ||
107 | insert(new LayerMenuItem<ItemType>( | ||
108 | layer_menuitems[i].default_str, | ||
109 | m_object, layer_menuitems[i].layernum)); | ||
110 | } | ||
94 | } | 111 | } |
95 | update(); | 112 | update(); |
96 | } | 113 | } |