aboutsummaryrefslogtreecommitdiff
path: root/src/ConfigMenu.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/ConfigMenu.cc')
-rw-r--r--src/ConfigMenu.cc37
1 files changed, 25 insertions, 12 deletions
diff --git a/src/ConfigMenu.cc b/src/ConfigMenu.cc
index e4be129..cfce697 100644
--- a/src/ConfigMenu.cc
+++ b/src/ConfigMenu.cc
@@ -20,12 +20,14 @@
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22#include "ConfigMenu.hh" 22#include "ConfigMenu.hh"
23#include "MenuCreator.hh"
23#include "Screen.hh" 24#include "Screen.hh"
24#include "fluxbox.hh" 25#include "fluxbox.hh"
25 26
26#include "FocusModelMenuItem.hh" 27#include "FocusModelMenuItem.hh"
27#include "ScreenPlacement.hh" 28#include "ScreenPlacement.hh"
28#include "FbMenu.hh" 29#include "FbMenu.hh"
30#include "ToggleMenu.hh"
29#include "FbTk/Menu.hh" 31#include "FbTk/Menu.hh"
30#include "FbTk/BoolMenuItem.hh" 32#include "FbTk/BoolMenuItem.hh"
31#include "FbTk/IntMenuItem.hh" 33#include "FbTk/IntMenuItem.hh"
@@ -67,19 +69,30 @@ private:
67 69
68typedef FbTk::RefCount<FbTk::Command<void> > _Cmd; 70typedef FbTk::RefCount<FbTk::Command<void> > _Cmd;
69 71
70enum {
71 L_ALPHA = 0,
72 L_PSEUDO_TRANS,
73 L_FOCUS_ALPHA,
74 L_UNFOCUS_ALPHA,
75 L_MENU_ALPHA,
76};
77 72
73// NOTE: might also be placed into MenuCreator; for now it ends up here
74// because it's just used here
75FbMenu *createToggleMenu(const std::string &label, BScreen& screen) {
76 FbTk::Layer* layer = screen.layerManager().getLayer(ResourceLayer::MENU);
77 FbMenu *menu = new ToggleMenu(screen.menuTheme(), screen.imageControl(), *layer);
78 if (!label.empty())
79 menu->setLabel(label);
80
81 return menu;
82}
78 83
79void setupAlphaMenu(FbTk::Menu& parent, ConfigMenu::SetupHelper& sh, _Cmd& save_reconf) { 84void setupAlphaMenu(FbTk::Menu& parent, ConfigMenu::SetupHelper& sh, _Cmd& save_reconf) {
80#ifdef HAVE_XRENDER 85#ifdef HAVE_XRENDER
81 _FB_USES_NLS; 86 _FB_USES_NLS;
82 87
88 enum {
89 L_ALPHA = 0,
90 L_PSEUDO_TRANS,
91 L_FOCUS_ALPHA,
92 L_UNFOCUS_ALPHA,
93 L_MENU_ALPHA,
94 };
95
83 static const FbTk::FbString _labels[] = { 96 static const FbTk::FbString _labels[] = {
84 _FB_XTEXT(Configmenu, Transparency, "Transparency", "Menu containing various transparency options"), 97 _FB_XTEXT(Configmenu, Transparency, "Transparency", "Menu containing various transparency options"),
85 _FB_XTEXT(Configmenu, ForcePseudoTrans, "Force Pseudo-Transparency", "When composite is available, still use old pseudo-transparency"), 98 _FB_XTEXT(Configmenu, ForcePseudoTrans, "Force Pseudo-Transparency", "When composite is available, still use old pseudo-transparency"),
@@ -90,7 +103,7 @@ void setupAlphaMenu(FbTk::Menu& parent, ConfigMenu::SetupHelper& sh, _Cmd& save_
90 103
91 104
92 FbTk::FbString label = _labels[L_ALPHA]; 105 FbTk::FbString label = _labels[L_ALPHA];
93 FbTk::Menu* menu = sh.screen.createMenu(label); 106 FbTk::Menu* menu = MenuCreator::createMenu(label, sh.screen);
94 107
95 if (FbTk::Transparent::haveComposite(true)) { 108 if (FbTk::Transparent::haveComposite(true)) {
96 static FbTk::SimpleAccessor<bool> s_pseudo = Fluxbox::instance()->getPseudoTrans(); 109 static FbTk::SimpleAccessor<bool> s_pseudo = Fluxbox::instance()->getPseudoTrans();
@@ -131,7 +144,7 @@ void setupFocusMenu(FbTk::Menu& menu, ConfigMenu::SetupHelper& sh, _Cmd& save_rc
131 // we don't set this to internal menu so will 144 // we don't set this to internal menu so will
132 // be deleted toghether with the parent 145 // be deleted toghether with the parent
133 FbTk::FbString label = _FB_XTEXT(Configmenu, FocusModel, "Focus Model", "Method used to give focus to windows"); 146 FbTk::FbString label = _FB_XTEXT(Configmenu, FocusModel, "Focus Model", "Method used to give focus to windows");
134 FbMenu* fm = sh.screen.createMenu(label); 147 FbMenu* fm = MenuCreator::createMenu(label, sh.screen);
135 148
136#define _FOCUSITEM(a, b, c, d, e) \ 149#define _FOCUSITEM(a, b, c, d, e) \
137 fm->insertItem(new FocusModelMenuItem(_FB_XTEXT(a, b, c, d), sh.screen.focusControl(), \ 150 fm->insertItem(new FocusModelMenuItem(_FB_XTEXT(a, b, c, d), sh.screen.focusControl(), \
@@ -197,7 +210,7 @@ void setupMaximizeMenu(FbTk::Menu& menu, ConfigMenu::SetupHelper& sh, _Cmd& save
197 210
198 FbTk::FbString label = _FB_XTEXT(Configmenu, MaxMenu, 211 FbTk::FbString label = _FB_XTEXT(Configmenu, MaxMenu,
199 "Maximize Options", "heading for maximization options"); 212 "Maximize Options", "heading for maximization options");
200 FbTk::Menu* mm = sh.screen.createMenu(label); 213 FbTk::Menu* mm = MenuCreator::createMenu(label, sh.screen);
201 214
202 _BOOLITEM(*mm, Configmenu, FullMax, 215 _BOOLITEM(*mm, Configmenu, FullMax,
203 "Full Maximization", "Maximise over slit, toolbar, etc", 216 "Full Maximization", "Maximise over slit, toolbar, etc",
@@ -224,8 +237,8 @@ void setupTabMenu(FbTk::Menu& parent, ConfigMenu::SetupHelper& sh, _Cmd& save_re
224 FbTk::FbString label = _FB_XTEXT(Configmenu, TabMenu, "Tab Options", "heading for tab-related options"); 237 FbTk::FbString label = _FB_XTEXT(Configmenu, TabMenu, "Tab Options", "heading for tab-related options");
225 // TODO: main-category is 'Menu'?? should be 'ConfigMenu'??? 238 // TODO: main-category is 'Menu'?? should be 'ConfigMenu'???
226 FbTk::FbString p_label = _FB_XTEXT(Menu, Placement, "Placement", "Title of Placement menu"); 239 FbTk::FbString p_label = _FB_XTEXT(Menu, Placement, "Placement", "Title of Placement menu");
227 FbTk::Menu* menu = sh.screen.createMenu(label); 240 FbTk::Menu* menu = MenuCreator::createMenu(label, sh.screen);
228 FbTk::Menu* p_menu = sh.screen.createToggleMenu(p_label); 241 FbTk::Menu* p_menu = createToggleMenu(p_label, sh.screen);
229 242
230 menu->insertSubmenu(p_label, p_menu); 243 menu->insertSubmenu(p_label, p_menu);
231 244