aboutsummaryrefslogtreecommitdiff
path: root/src/RootTheme.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/RootTheme.cc')
-rw-r--r--src/RootTheme.cc70
1 files changed, 70 insertions, 0 deletions
diff --git a/src/RootTheme.cc b/src/RootTheme.cc
new file mode 100644
index 0000000..f3695dd
--- /dev/null
+++ b/src/RootTheme.cc
@@ -0,0 +1,70 @@
1// RootTheme.cc
2// Copyright (c) 2003 Henrik Kinnunen (fluxgen(at)users.sourceforge.net)
3//
4// Permission is hereby granted, free of charge, to any person obtaining a
5// copy of this software and associated documentation files (the "Software"),
6// to deal in the Software without restriction, including without limitation
7// the rights to use, copy, modify, merge, publish, distribute, sublicense,
8// and/or sell copies of the Software, and to permit persons to whom the
9// Software is furnished to do so, subject to the following conditions:
10//
11// The above copyright notice and this permission notice shall be included in
12// all copies or substantial portions of the Software.
13//
14// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE.
21
22// $Id: RootTheme.cc,v 1.4 2003/08/25 16:02:24 fluxgen Exp $
23
24#include "RootTheme.hh"
25
26#include "FbCommands.hh"
27#include "App.hh"
28
29RootTheme::RootTheme(int screen_num, std::string &screen_root_command):
30 FbTk::Theme(screen_num),
31 m_root_command(*this, "rootCommand", "RootCommand"),
32 m_bevel_width(*this, "bevelWidth", "BevelWidth"),
33 m_handle_width(*this, "handleWidth", "HandleWidth"),
34 m_screen_root_command(screen_root_command) {
35
36 *m_bevel_width = 0;
37 *m_handle_width = 0;
38
39 XGCValues gcv;
40 Display *disp = FbTk::App::instance()->display();
41 gcv.foreground = WhitePixel(disp, screen_num)^BlackPixel(disp, screen_num);
42 gcv.function = GXxor;
43 gcv.subwindow_mode = IncludeInferiors;
44 m_opgc = XCreateGC(disp,
45 RootWindow(disp, screen_num),
46 GCForeground | GCFunction | GCSubwindowMode, &gcv);
47}
48
49RootTheme::~RootTheme() {
50 if (m_opgc != 0)
51 XFreeGC(FbTk::App::instance()->display(), m_opgc);
52}
53
54void RootTheme::reconfigTheme() {
55 if (*m_bevel_width > 20)
56 *m_bevel_width = 20;
57
58 if (*m_handle_width > 20)
59 *m_handle_width = 20;
60
61 // override resource root command?
62 if (m_screen_root_command == "") {
63 // do root command
64 FbCommands::ExecuteCmd cmd(*m_root_command, screenNum());
65 cmd.execute();
66 } else {
67 FbCommands::ExecuteCmd cmd(m_screen_root_command, screenNum());
68 cmd.execute();
69 }
70}