diff options
Diffstat (limited to 'src/LayerMenu.cc')
-rw-r--r-- | src/LayerMenu.cc | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/LayerMenu.cc b/src/LayerMenu.cc new file mode 100644 index 0000000..afcd4ac --- /dev/null +++ b/src/LayerMenu.cc | |||
@@ -0,0 +1,46 @@ | |||
1 | #include "LayerMenu.hh" | ||
2 | |||
3 | #include "fluxbox.hh" | ||
4 | |||
5 | #include "FbTk/RefCount.hh" | ||
6 | #include "FbTk/SimpleCommand.hh" | ||
7 | #include "FbTk/I18n.hh" | ||
8 | |||
9 | LayerMenu::LayerMenu(MenuTheme &tm, FbTk::ImageControl &imgctrl, | ||
10 | FbTk::XLayer &layer, LayerObject *object, bool save_rc): | ||
11 | ToggleMenu(tm, imgctrl, layer) { | ||
12 | _FB_USES_NLS; | ||
13 | |||
14 | Fluxbox *fluxbox = Fluxbox::instance(); | ||
15 | |||
16 | struct { | ||
17 | int set; | ||
18 | int base; | ||
19 | const char *default_str; | ||
20 | int layernum; | ||
21 | } layer_menuitems[] = { | ||
22 | //TODO: nls | ||
23 | {0, 0, _FBTEXT(Layer, AboveDock, "Above Dock", "Layer above dock"), fluxbox->getAboveDockLayer()}, | ||
24 | {0, 0, _FBTEXT(Layer, Dock, "Dock", "Layer dock"), fluxbox->getDockLayer()}, | ||
25 | {0, 0, _FBTEXT(Layer, Top, "Top", "Layer top"), fluxbox->getTopLayer()}, | ||
26 | {0, 0, _FBTEXT(Layer, Normal, "Normal", "Layer normal"), fluxbox->getNormalLayer()}, | ||
27 | {0, 0, _FBTEXT(Layer, Bottom, "Bottom", "Layer bottom"), fluxbox->getBottomLayer()}, | ||
28 | {0, 0, _FBTEXT(Layer, Desktop, "Desktop", "Layer desktop"), fluxbox->getDesktopLayer()}, | ||
29 | }; | ||
30 | |||
31 | FbTk::RefCount<FbTk::Command> saverc_cmd(new FbTk::SimpleCommand<Fluxbox>( | ||
32 | *Fluxbox::instance(), | ||
33 | &Fluxbox::save_rc)); | ||
34 | |||
35 | for (size_t i=0; i < 6; ++i) { | ||
36 | // TODO: fetch nls string | ||
37 | if (save_rc) { | ||
38 | insert(new LayerMenuItem(layer_menuitems[i].default_str, | ||
39 | object, layer_menuitems[i].layernum, saverc_cmd)); | ||
40 | } else { | ||
41 | insert(new LayerMenuItem(layer_menuitems[i].default_str, | ||
42 | object, layer_menuitems[i].layernum)); | ||
43 | } | ||
44 | } | ||
45 | updateMenu(); | ||
46 | } | ||