aboutsummaryrefslogtreecommitdiff
path: root/src/AlphaMenu.cc
diff options
context:
space:
mode:
authorsimonb <simonb>2007-01-07 14:20:31 (GMT)
committersimonb <simonb>2007-01-07 14:20:31 (GMT)
commit93ec253f0d6790e79017f74ae5413ef0363b5cb1 (patch)
treebb6ae26d09275b5a73503cebc052b30ff8735bb6 /src/AlphaMenu.cc
parent440c69afa436150f2a797aa8f192d68090832c5c (diff)
downloadfluxbox-93ec253f0d6790e79017f74ae5413ef0363b5cb1.zip
fluxbox-93ec253f0d6790e79017f74ae5413ef0363b5cb1.tar.bz2
forgot to svn add the files
Diffstat (limited to 'src/AlphaMenu.cc')
-rw-r--r--src/AlphaMenu.cc99
1 files changed, 99 insertions, 0 deletions
diff --git a/src/AlphaMenu.cc b/src/AlphaMenu.cc
new file mode 100644
index 0000000..8985fc7
--- /dev/null
+++ b/src/AlphaMenu.cc
@@ -0,0 +1,99 @@
1// AlphaMenu.cc for Fluxbox
2// Copyright (c) 2007 Henrik Kinnunen (fluxgen at fluxbox dot org)
3// and Simon Bowden (rathnor at users.sourceforge.net)
4//
5// Permission is hereby granted, free of charge, to any person obtaining a
6// copy of this software and associated documentation files (the "Software"),
7// to deal in the Software without restriction, including without limitation
8// the rights to use, copy, modify, merge, publish, distribute, sublicense,
9// and/or sell copies of the Software, and to permit persons to whom the
10// Software is furnished to do so, subject to the following conditions:
11//
12// The above copyright notice and this permission notice shall be included in
13// all copies or substantial portions of the Software.
14//
15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21// DEALINGS IN THE SOFTWARE.
22
23// $Id$
24
25#include "AlphaMenu.hh"
26
27#include "Window.hh"
28#include "Screen.hh"
29#include "Workspace.hh"
30#include "WindowCmd.hh"
31#include "fluxbox.hh"
32#include "Layer.hh"
33#include "IntResMenuItem.hh"
34
35#include "FbTk/I18n.hh"
36#include "Window.hh"
37#include "WindowCmd.hh"
38
39AlphaMenu::AlphaMenu(MenuTheme &tm, FbTk::ImageControl &imgctrl,
40 FbTk::XLayer &layer, AlphaObject &object):
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{
45
46 _FB_USES_NLS;
47
48 // build menu...
49
50 const FbTk::FbString usedefault_label = _FB_XTEXT(Windowmenu, DefaultAlpha,
51 "Use Defaults",
52 "Default transparency settings for this window");
53 FbTk::MenuItem *usedefault_item =
54 new AlphaMenuSelectItem(usedefault_label, &object, *this);
55 insert(usedefault_item);
56
57 const FbTk::FbString focused_alpha_label =
58 _FB_XTEXT(Configmenu, FocusedAlpha,
59 "Focused Window Alpha",
60 "Transparency level of the focused window");
61
62 FbTk::MenuItem *focused_alpha_item =
63 new IntResMenuItem< ObjectResource<AlphaObject, int> >(focused_alpha_label, m_focused_alpha_resource, 0, 255, *this);
64 insert(focused_alpha_item);
65
66 const FbTk::FbString unfocused_alpha_label =
67 _FB_XTEXT(Configmenu, UnfocusedAlpha,
68 "Unfocused Window Alpha",
69 "Transparency level of unfocused windows");
70
71 FbTk::MenuItem *unfocused_alpha_item =
72 new IntResMenuItem< ObjectResource<AlphaObject, int> >(unfocused_alpha_label, m_unfocused_alpha_resource, 0, 255, *this);
73 insert(unfocused_alpha_item);
74
75 updateMenu();
76}
77
78
79void AlphaMenu::move(int x, int y) {
80 FbTk::Menu::move(x, y);
81
82 if (isVisible()) {
83 ((AlphaMenuSelectItem *)find(0))->updateLabel();
84 ((IntResMenuItem< ObjectResource<AlphaObject, int> >*)find(1))->updateLabel();
85 ((IntResMenuItem< ObjectResource<AlphaObject, int> >*)find(2))->updateLabel();
86 frameWindow().updateBackground(false);
87 FbTk::Menu::clearWindow();
88 }
89}
90
91void AlphaMenu::show() {
92 ((AlphaMenuSelectItem *)find(0))->updateLabel();
93 ((IntResMenuItem< ObjectResource<AlphaObject, int> >*)find(1))->updateLabel();
94 ((IntResMenuItem< ObjectResource<AlphaObject, int> >*)find(2))->updateLabel();
95 frameWindow().updateBackground(false);
96 FbTk::Menu::clearWindow();
97
98 FbTk::Menu::show();
99}