aboutsummaryrefslogtreecommitdiff
path: root/src/MenuCreator.cc
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/MenuCreator.cc
parent1f5cd12facc662de240b36bf3c5c14f40adf391b (diff)
downloadfluxbox-b5c354b994bc06667abe35e2d528c0f025703c4e.zip
fluxbox-b5c354b994bc06667abe35e2d528c0f025703c4e.tar.bz2
architecture astronomy
Diffstat (limited to 'src/MenuCreator.cc')
-rw-r--r--src/MenuCreator.cc55
1 files changed, 9 insertions, 46 deletions
diff --git a/src/MenuCreator.cc b/src/MenuCreator.cc
index 48f3151..df6f829 100644
--- a/src/MenuCreator.cc
+++ b/src/MenuCreator.cc
@@ -37,7 +37,6 @@
37#include "SendToMenu.hh" 37#include "SendToMenu.hh"
38#include "AlphaMenu.hh" 38#include "AlphaMenu.hh"
39#include "Layer.hh" 39#include "Layer.hh"
40#include "BoolMenuItem.hh"
41 40
42#include "FbMenuParser.hh" 41#include "FbMenuParser.hh"
43#include "StyleMenuItem.hh" 42#include "StyleMenuItem.hh"
@@ -45,6 +44,7 @@
45 44
46#include "FbTk/I18n.hh" 45#include "FbTk/I18n.hh"
47#include "FbTk/MultiButtonMenuItem.hh" 46#include "FbTk/MultiButtonMenuItem.hh"
47#include "FbTk/BoolMenuItem.hh"
48#include "FbTk/RefCount.hh" 48#include "FbTk/RefCount.hh"
49#include "FbTk/MacroCommand.hh" 49#include "FbTk/MacroCommand.hh"
50#include "FbTk/SimpleCommand.hh" 50#include "FbTk/SimpleCommand.hh"
@@ -157,7 +157,7 @@ private:
157 FbTk::Menu *m_menu; 157 FbTk::Menu *m_menu;
158}; 158};
159 159
160class MenuContext: public LayerObject, public AlphaObject { 160class MenuContext: public LayerObject {
161public: 161public:
162 void moveToLayer(int layer_number) { 162 void moveToLayer(int layer_number) {
163 if (WindowCmd<void>::window() == 0) 163 if (WindowCmd<void>::window() == 0)
@@ -170,42 +170,6 @@ public:
170 return WindowCmd<void>::window()->layerItem().getLayerNum(); 170 return WindowCmd<void>::window()->layerItem().getLayerNum();
171 } 171 }
172 172
173 int getFocusedAlpha() const {
174 if (WindowCmd<void>::window() == 0)
175 return 255;
176 return WindowCmd<void>::window()->getFocusedAlpha();
177 }
178
179 int getUnfocusedAlpha() const {
180 if (WindowCmd<void>::window() == 0)
181 return 255;
182 return WindowCmd<void>::window()->getUnfocusedAlpha();
183 }
184
185 bool getUseDefaultAlpha() const {
186 if (WindowCmd<void>::window() == 0)
187 return true;
188 return WindowCmd<void>::window()->getUseDefaultAlpha();
189 }
190
191 void setFocusedAlpha(int alpha) {
192 if (WindowCmd<void>::window() == 0)
193 return;
194 WindowCmd<void>::window()->setFocusedAlpha(alpha);
195 }
196
197 void setUnfocusedAlpha(int alpha) {
198 if (WindowCmd<void>::window() == 0)
199 return;
200 WindowCmd<void>::window()->setUnfocusedAlpha(alpha);
201 }
202
203 void setDefaultAlpha() {
204 if (WindowCmd<void>::window() == 0)
205 return;
206 WindowCmd<void>::window()->setDefaultAlpha();
207 }
208
209}; 173};
210 174
211static void translateMenuItem(Parser &parse, ParseItem &item, FbTk::StringConvertor &labelconvertor); 175static void translateMenuItem(Parser &parse, ParseItem &item, FbTk::StringConvertor &labelconvertor);
@@ -551,8 +515,8 @@ bool MenuCreator::createWindowMenuItem(const string &type,
551 static MenuContext context; 515 static MenuContext context;
552 516
553 if (type == "shade") { 517 if (type == "shade") {
554 static ObjectResource<FluxboxWindow, bool> res(&WindowCmd<void>::window, &FluxboxWindow::isShaded, &FluxboxWindow::shade, false); 518 static WindowAccessor<bool> res(&FluxboxWindow::isShaded, &FluxboxWindow::setShaded, false);
555 menu.insert(new BoolResMenuItem<ObjectResource<FluxboxWindow, bool> >( 519 menu.insert(new FbTk::BoolMenuItem(
556 label.empty()?_FB_XTEXT(Windowmenu, Shade, "Shade", "Shade the window"):label, 520 label.empty()?_FB_XTEXT(Windowmenu, Shade, "Shade", "Shade the window"):label,
557 res)); 521 res));
558 522
@@ -575,8 +539,8 @@ bool MenuCreator::createWindowMenuItem(const string &type,
575 maximize_item->setCommand(3, maximize_horiz_cmd); 539 maximize_item->setCommand(3, maximize_horiz_cmd);
576 menu.insert(maximize_item); 540 menu.insert(maximize_item);
577 } else if (type == "iconify") { 541 } else if (type == "iconify") {
578 static ObjectResource<FluxboxWindow, bool> res(&WindowCmd<void>::window, &FluxboxWindow::isIconic, &FluxboxWindow::toggleIconic, false); 542 static WindowAccessor<bool> res(&FluxboxWindow::isIconic, &FluxboxWindow::setIconic, false);
579 menu.insert(new BoolResMenuItem<ObjectResource<FluxboxWindow, bool> >( 543 menu.insert(new FbTk::BoolMenuItem(
580 label.empty() ? 544 label.empty() ?
581 _FB_XTEXT(Windowmenu, Iconify, 545 _FB_XTEXT(Windowmenu, Iconify,
582 "Iconify", "Iconify the window") : 546 "Iconify", "Iconify the window") :
@@ -607,8 +571,8 @@ bool MenuCreator::createWindowMenuItem(const string &type,
607 label, raise_cmd); 571 label, raise_cmd);
608 572
609 } else if (type == "stick") { 573 } else if (type == "stick") {
610 static ObjectResource<FluxboxWindow, bool> res(&WindowCmd<void>::window, &FluxboxWindow::isStuck, &FluxboxWindow::stick, false); 574 static WindowAccessor<bool> res(&FluxboxWindow::isStuck, &FluxboxWindow::setStuck, false);
611 menu.insert(new BoolResMenuItem<ObjectResource<FluxboxWindow, bool> >( 575 menu.insert(new FbTk::BoolMenuItem(
612 label.empty() ? 576 label.empty() ?
613 _FB_XTEXT(Windowmenu, Stick, 577 _FB_XTEXT(Windowmenu, Stick,
614 "Stick", "Stick the window"): 578 "Stick", "Stick the window"):
@@ -625,8 +589,7 @@ bool MenuCreator::createWindowMenuItem(const string &type,
625 "Menu containing various transparency options"): label, 589 "Menu containing various transparency options"): label,
626 new AlphaMenu(screen->menuTheme(), 590 new AlphaMenu(screen->menuTheme(),
627 screen->imageControl(), 591 screen->imageControl(),
628 *screen->layerManager().getLayer(Layer::MENU), 592 *screen->layerManager().getLayer(Layer::MENU)));
629 context));
630 } 593 }
631#endif // HAVE_XRENDER 594#endif // HAVE_XRENDER
632 } else if (type == "extramenus") { 595 } else if (type == "extramenus") {