summaryrefslogtreecommitdiff
path: root/src/AlphaMenu.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/AlphaMenu.cc')
-rw-r--r--src/AlphaMenu.cc29
1 files changed, 16 insertions, 13 deletions
diff --git a/src/AlphaMenu.cc b/src/AlphaMenu.cc
index 8cd225a..fdea426 100644
--- a/src/AlphaMenu.cc
+++ b/src/AlphaMenu.cc
@@ -25,24 +25,27 @@
25#include "AlphaMenu.hh" 25#include "AlphaMenu.hh"
26 26
27#include "Window.hh" 27#include "Window.hh"
28#include "WindowCmd.hh"
28#include "Screen.hh" 29#include "Screen.hh"
29#include "Workspace.hh" 30#include "Workspace.hh"
30#include "WindowCmd.hh" 31#include "WindowCmd.hh"
31#include "fluxbox.hh" 32#include "fluxbox.hh"
32#include "Layer.hh" 33#include "Layer.hh"
33#include "IntResMenuItem.hh" 34#include "FbTk/IntMenuItem.hh"
34 35
35#include "FbTk/I18n.hh" 36#include "FbTk/I18n.hh"
36#include "Window.hh" 37#include "Window.hh"
37#include "WindowCmd.hh"
38 38
39AlphaMenu::AlphaMenu(MenuTheme &tm, FbTk::ImageControl &imgctrl, 39AlphaMenu::AlphaMenu(MenuTheme &tm, FbTk::ImageControl &imgctrl,
40 FbTk::XLayer &layer, AlphaObject &object): 40 FbTk::XLayer &layer):
41 ToggleMenu(tm, imgctrl, layer), 41 ToggleMenu(tm, imgctrl, layer)
42 m_focused_alpha_resource(&object, &AlphaObject::getFocusedAlpha, &AlphaObject::setFocusedAlpha, 255),
43 m_unfocused_alpha_resource(&object, &AlphaObject::getUnfocusedAlpha, &AlphaObject::setUnfocusedAlpha, 255)
44{ 42{
45 43
44 static WindowAccessor<int> m_focused_alpha((WindowAccessor<int>::Getter)&FluxboxWindow::getFocusedAlpha,
45 (WindowAccessor<int>::Setter)&FluxboxWindow::setFocusedAlpha, 255);
46 static WindowAccessor<int> m_unfocused_alpha((WindowAccessor<int>::Getter)&FluxboxWindow::getUnfocusedAlpha,
47 (WindowAccessor<int>::Setter)&FluxboxWindow::setUnfocusedAlpha, 255);
48
46 _FB_USES_NLS; 49 _FB_USES_NLS;
47 50
48 // build menu... 51 // build menu...
@@ -53,7 +56,7 @@ AlphaMenu::AlphaMenu(MenuTheme &tm, FbTk::ImageControl &imgctrl,
53 "Transparency level of the focused window"); 56 "Transparency level of the focused window");
54 57
55 FbTk::MenuItem *focused_alpha_item = 58 FbTk::MenuItem *focused_alpha_item =
56 new IntResMenuItem< ObjectResource<AlphaObject, int> >(focused_alpha_label, m_focused_alpha_resource, 0, 255, *this); 59 new FbTk::IntMenuItem(focused_alpha_label, m_focused_alpha, 0, 255, *this);
57 insert(focused_alpha_item); 60 insert(focused_alpha_item);
58 61
59 const FbTk::FbString unfocused_alpha_label = 62 const FbTk::FbString unfocused_alpha_label =
@@ -62,14 +65,14 @@ AlphaMenu::AlphaMenu(MenuTheme &tm, FbTk::ImageControl &imgctrl,
62 "Transparency level of unfocused windows"); 65 "Transparency level of unfocused windows");
63 66
64 FbTk::MenuItem *unfocused_alpha_item = 67 FbTk::MenuItem *unfocused_alpha_item =
65 new IntResMenuItem< ObjectResource<AlphaObject, int> >(unfocused_alpha_label, m_unfocused_alpha_resource, 0, 255, *this); 68 new FbTk::IntMenuItem(unfocused_alpha_label, m_unfocused_alpha, 0, 255, *this);
66 insert(unfocused_alpha_item); 69 insert(unfocused_alpha_item);
67 70
68 const FbTk::FbString usedefault_label = _FB_XTEXT(Windowmenu, DefaultAlpha, 71 const FbTk::FbString usedefault_label = _FB_XTEXT(Windowmenu, DefaultAlpha,
69 "Use Defaults", 72 "Use Defaults",
70 "Default transparency settings for this window"); 73 "Default transparency settings for this window");
71 FbTk::MenuItem *usedefault_item = 74 FbTk::MenuItem *usedefault_item =
72 new AlphaMenuSelectItem(usedefault_label, &object, *this); 75 new AlphaMenuSelectItem(usedefault_label, *this);
73 insert(usedefault_item); 76 insert(usedefault_item);
74 77
75 updateMenu(); 78 updateMenu();
@@ -81,8 +84,8 @@ void AlphaMenu::move(int x, int y) {
81 84
82 if (isVisible()) { 85 if (isVisible()) {
83 // TODO: hardcoding the indices is a bad idea 86 // TODO: hardcoding the indices is a bad idea
84 ((IntResMenuItem< ObjectResource<AlphaObject, int> >*)find(0))->updateLabel(); 87 ((FbTk::IntMenuItem *)find(0))->updateLabel();
85 ((IntResMenuItem< ObjectResource<AlphaObject, int> >*)find(1))->updateLabel(); 88 ((FbTk::IntMenuItem *)find(1))->updateLabel();
86 frameWindow().updateBackground(false); 89 frameWindow().updateBackground(false);
87 FbTk::Menu::clearWindow(); 90 FbTk::Menu::clearWindow();
88 } 91 }
@@ -90,8 +93,8 @@ void AlphaMenu::move(int x, int y) {
90 93
91void AlphaMenu::show() { 94void AlphaMenu::show() {
92 // TODO: hardcoding the indices is a bad idea 95 // TODO: hardcoding the indices is a bad idea
93 ((IntResMenuItem< ObjectResource<AlphaObject, int> >*)find(0))->updateLabel(); 96 ((FbTk::IntMenuItem *)find(0))->updateLabel();
94 ((IntResMenuItem< ObjectResource<AlphaObject, int> >*)find(1))->updateLabel(); 97 ((FbTk::IntMenuItem *)find(1))->updateLabel();
95 frameWindow().updateBackground(false); 98 frameWindow().updateBackground(false);
96 FbTk::Menu::clearWindow(); 99 FbTk::Menu::clearWindow();
97 100