summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2005-06-23 02:57:24 (GMT)
committerfluxgen <fluxgen>2005-06-23 02:57:24 (GMT)
commit18cf5862495aa6f37110c90286bb6c315a145526 (patch)
treef3c87373e0ce215ec4cbe7fb854859a78c2bb3cf /src
parentc912f7a32aae713f24ab32464cd1f443043ad59f (diff)
downloadfluxbox_lack-18cf5862495aa6f37110c90286bb6c315a145526.zip
fluxbox_lack-18cf5862495aa6f37110c90286bb6c315a145526.tar.bz2
new files
Diffstat (limited to 'src')
-rw-r--r--src/LayerMenu.cc46
-rw-r--r--src/Makefile.am3
-rw-r--r--src/WindowCmd.cc3
-rw-r--r--src/WindowCmd.hh32
4 files changed, 83 insertions, 1 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
9LayerMenu::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}
diff --git a/src/Makefile.am b/src/Makefile.am
index f49d2ae..9e15d8b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -100,7 +100,7 @@ fluxbox_SOURCES = AtomHandler.hh ArrowButton.hh ArrowButton.cc \
100 WinButtonTheme.hh WinButtonTheme.cc \ 100 WinButtonTheme.hh WinButtonTheme.cc \
101 Window.cc Window.hh \ 101 Window.cc Window.hh \
102 Workspace.cc Workspace.hh \ 102 Workspace.cc Workspace.hh \
103 FbCommands.hh FbCommands.cc LayerMenu.hh \ 103 FbCommands.hh FbCommands.cc LayerMenu.hh LayerMenu.cc \
104 IntResMenuItem.hh IntResMenuItem.cc FbMenu.hh FbMenu.cc \ 104 IntResMenuItem.hh IntResMenuItem.cc FbMenu.hh FbMenu.cc \
105 WinClient.hh WinClient.cc \ 105 WinClient.hh WinClient.cc \
106 Strut.hh \ 106 Strut.hh \
@@ -128,6 +128,7 @@ fluxbox_SOURCES = AtomHandler.hh ArrowButton.hh ArrowButton.cc \
128 ToggleMenu.hh \ 128 ToggleMenu.hh \
129 HeadArea.hh HeadArea.cc \ 129 HeadArea.hh HeadArea.cc \
130 Resources.cc \ 130 Resources.cc \
131 WindowCmd.hh WindowCmd.cc \
131 ${newwmspec_SOURCE} ${gnome_SOURCE} \ 132 ${newwmspec_SOURCE} ${gnome_SOURCE} \
132 ${REMEMBER_SOURCE} ${REGEXP_SOURCE} ${TOOLBAR_SOURCE} 133 ${REMEMBER_SOURCE} ${REGEXP_SOURCE} ${TOOLBAR_SOURCE}
133 134
diff --git a/src/WindowCmd.cc b/src/WindowCmd.cc
new file mode 100644
index 0000000..c84849f
--- /dev/null
+++ b/src/WindowCmd.cc
@@ -0,0 +1,3 @@
1#include "WindowCmd.hh"
2
3FluxboxWindow *WindowCmd_base::s_win = 0;
diff --git a/src/WindowCmd.hh b/src/WindowCmd.hh
new file mode 100644
index 0000000..309e62b
--- /dev/null
+++ b/src/WindowCmd.hh
@@ -0,0 +1,32 @@
1#ifndef WINDOWCMD_HH
2#define WINDOWCMD_HH
3
4#include "FbTk/Command.hh"
5#include "Window.hh"
6
7/// holds context for WindowCmd
8class WindowCmd_base {
9public:
10 static void setWindow(FluxboxWindow *win) { s_win = win; }
11 static FluxboxWindow *window() { return s_win; }
12protected:
13 static FluxboxWindow *s_win;
14};
15
16
17/// executes action for a dynamic context set in WindowCmd_base
18template <typename ReturnType=void>
19class WindowCmd: public WindowCmd_base, public FbTk::Command {
20public:
21 typedef ReturnType (FluxboxWindow::* Action)();
22 WindowCmd(Action a):m_action(a) {}
23 void execute() {
24 if (window() != 0)
25 (*window().*m_action)();
26 }
27private:
28 Action m_action;
29};
30
31
32#endif // WINDOWCMD_HH