aboutsummaryrefslogtreecommitdiff
path: root/src/FbWinFrameTheme.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbWinFrameTheme.cc')
-rw-r--r--src/FbWinFrameTheme.cc110
1 files changed, 110 insertions, 0 deletions
diff --git a/src/FbWinFrameTheme.cc b/src/FbWinFrameTheme.cc
new file mode 100644
index 0000000..7f6720b
--- /dev/null
+++ b/src/FbWinFrameTheme.cc
@@ -0,0 +1,110 @@
1// FbWinFrameTheme.cc for Fluxbox Window Manager
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: FbWinFrameTheme.cc,v 1.11 2003/08/27 17:52:08 fluxgen Exp $
23
24#include "FbWinFrameTheme.hh"
25#include "App.hh"
26
27#include <X11/cursorfont.h>
28
29#include <iostream>
30
31FbWinFrameTheme::FbWinFrameTheme(int screen_num):
32 FbTk::Theme(screen_num),
33 m_label_focus(*this, "window.label.focus", "Window.Label.Focus"),
34 m_label_unfocus(*this, "window.label.unfocus", "Window.Label.Unfocus"),
35
36 m_title_focus(*this, "window.title.focus", "Window.Title.Focus"),
37 m_title_unfocus(*this, "window.title.unfocus", "Window.Title.Unfocus"),
38
39 m_handle_focus(*this, "window.handle.focus", "Window.Handle.Focus"),
40 m_handle_unfocus(*this, "window.handle.unfocus", "Window.Handle.Unfocus"),
41
42 m_button_focus(*this, "window.button.focus", "Window.Button.Focus"),
43 m_button_unfocus(*this, "window.button.unfocus", "Window.Button.Unfocus"),
44 m_button_pressed(*this, "window.button.pressed", "Window.Button.Pressed"),
45
46 m_grip_focus(*this, "window.grip.focus", "Window.Grip.Focus"),
47 m_grip_unfocus(*this, "window.grip.unfocus", "Window.Grip.Unfocus"),
48
49 m_label_focus_color(*this, "window.label.focus.textColor", "Window.Label.Focus.TextColor"),
50 m_label_unfocus_color(*this, "window.label.unfocus.textColor", "Window.Label.Unfocus.TextColor"),
51
52 m_frame_focus_color(*this, "window.frame.focusColor", "Window.Frame.FocusColor"),
53 m_frame_unfocus_color(*this, "window.frame.unfocusColor", "Window.Frame.UnfocusColor"),
54
55 m_button_focus_color(*this, "window.button.focus.picColor", "Window.Button.Focus.PicColor"),
56 m_button_unfocus_color(*this, "window.button.unfocus.picColor", "Window.Button.Unfocus.PicColor"),
57
58 m_font(*this, "window.font", "Window.Font"),
59 m_textjustify(*this, "window.justify", "Window.Justify"),
60 m_shape_place(*this, "window.roundCorners", "Window.RoundCorners"),
61
62 m_alpha(*this, "window.alpha", "Window.Alpha"),
63 m_title_height(*this, "window.title.height", "Window.Title.Height"),
64 m_border(*this, "window", "Window"), // for window.border*
65 m_label_text_focus_gc(RootWindow(FbTk::App::instance()->display(), screen_num)),
66 m_label_text_unfocus_gc(RootWindow(FbTk::App::instance()->display(), screen_num)),
67 m_button_pic_focus_gc(RootWindow(FbTk::App::instance()->display(), screen_num)),
68 m_button_pic_unfocus_gc(RootWindow(FbTk::App::instance()->display(), screen_num)) {
69
70 *m_title_height = 0;
71 // set defaults
72 m_font->load("fixed");
73 *m_alpha = 255;
74
75 // create cursors
76 Display *disp = FbTk::App::instance()->display();
77 m_cursor_move = XCreateFontCursor(disp, XC_fleur);
78 m_cursor_lower_left_angle = XCreateFontCursor(disp, XC_ll_angle);
79 m_cursor_lower_right_angle = XCreateFontCursor(disp, XC_lr_angle);
80
81}
82
83FbWinFrameTheme::~FbWinFrameTheme() {
84
85}
86
87bool FbWinFrameTheme::fallback(FbTk::ThemeItem_base &item) {
88 if (item.name() == "window.borderWidth")
89 return FbTk::ThemeManager::instance().loadItem(item, "borderWidth", "BorderWidth");
90 else if (item.name() == "window.borderColor")
91 return FbTk::ThemeManager::instance().loadItem(item, "borderColor", "BorderColor");
92
93 return false;
94}
95
96void FbWinFrameTheme::reconfigTheme() {
97 if (*m_alpha > 255)
98 *m_alpha = 255;
99 else if (*m_alpha < 0)
100 *m_alpha = 0;
101
102 m_label_text_focus_gc.setForeground(*m_label_focus_color);
103 m_label_text_unfocus_gc.setForeground(*m_label_unfocus_color);
104 m_button_pic_focus_gc.setForeground(*m_button_focus_color);
105 m_button_pic_unfocus_gc.setForeground(*m_button_unfocus_color);
106
107 // notify listeners
108 m_theme_change.notify();
109}
110