1
// FbWinFrameTheme.cc for Fluxbox Window Manager
2
// Copyright (c) 2003 - 2005 Henrik Kinnunen (fluxgen at fluxbox dot org)
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:
11
// The above copyright notice and this permission notice shall be included in
12
// all copies or substantial portions of the Software.
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.
22
// $Id: FbWinFrameTheme.cc 3865 2005-01-24 18:34:57Z mathias $
24
#include "FbWinFrameTheme.hh"
27
#include <X11/cursorfont.h>
32
FbWinFrameTheme::FbWinFrameTheme(int screen_num):
33
FbTk::Theme(screen_num),
34
m_label_focus(*this, "window.label.focus", "Window.Label.Focus"),
35
m_label_unfocus(*this, "window.label.unfocus", "Window.Label.Unfocus"),
36
m_label_active(*this, "window.label.active", "Window.Label.Active"),
38
m_title_focus(*this, "window.title.focus", "Window.Title.Focus"),
39
m_title_unfocus(*this, "window.title.unfocus", "Window.Title.Unfocus"),
41
m_handle_focus(*this, "window.handle.focus", "Window.Handle.Focus"),
42
m_handle_unfocus(*this, "window.handle.unfocus", "Window.Handle.Unfocus"),
44
m_button_focus(*this, "window.button.focus", "Window.Button.Focus"),
45
m_button_unfocus(*this, "window.button.unfocus", "Window.Button.Unfocus"),
46
m_button_pressed(*this, "window.button.pressed", "Window.Button.Pressed"),
48
m_grip_focus(*this, "window.grip.focus", "Window.Grip.Focus"),
49
m_grip_unfocus(*this, "window.grip.unfocus", "Window.Grip.Unfocus"),
51
m_label_focus_color(*this, "window.label.focus.textColor", "Window.Label.Focus.TextColor"),
52
m_label_unfocus_color(*this, "window.label.unfocus.textColor", "Window.Label.Unfocus.TextColor"),
53
m_label_active_color(*this, "window.label.active.textColor", "Window.Label.Active.TextColor"),
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"),
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
m_title_height(*this, "window.title.height", "Window.Title.Height"),
62
m_bevel_width(*this, "window.bevelWidth", "Window.BevelWidth"),
63
m_handle_width(*this, "window.handleWidth", "Window.handleWidth"),
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_label_text_active_gc(RootWindow(FbTk::App::instance()->display(), screen_num)),
68
m_button_pic_focus_gc(RootWindow(FbTk::App::instance()->display(), screen_num)),
69
m_button_pic_unfocus_gc(RootWindow(FbTk::App::instance()->display(), screen_num)),
71
m_unfocused_alpha(255) {
75
m_font->load("fixed");
78
Display *disp = FbTk::App::instance()->display();
79
m_cursor_move = XCreateFontCursor(disp, XC_fleur);
80
m_cursor_lower_left_angle = XCreateFontCursor(disp, XC_ll_angle);
81
m_cursor_lower_right_angle = XCreateFontCursor(disp, XC_lr_angle);
82
m_cursor_upper_right_angle = XCreateFontCursor(disp, XC_ur_angle);
83
m_cursor_upper_left_angle = XCreateFontCursor(disp, XC_ul_angle);
88
FbWinFrameTheme::~FbWinFrameTheme() {
92
bool FbWinFrameTheme::fallback(FbTk::ThemeItem_base &item) {
93
if (item.name() == "window.borderWidth")
94
return FbTk::ThemeManager::instance().loadItem(item, "borderWidth", "BorderWidth");
95
else if (item.name() == "window.borderColor")
96
return FbTk::ThemeManager::instance().loadItem(item, "borderColor", "BorderColor");
97
else if (item.name() == "window.bevelWidth")
98
return FbTk::ThemeManager::instance().loadItem(item, "bevelWidth", "bevelWidth");
99
else if (item.name() == "window.handleWidth")
100
return FbTk::ThemeManager::instance().loadItem(item, "handleWidth", "HandleWidth");
101
else if (item.name() == "window.label.active") {
103
*m_label_active = *m_label_unfocus;
105
} else if (item.name() == "window.label.active.textColor") {
106
return FbTk::ThemeManager::instance().loadItem(item, "window.label.unfocus.textColor",
107
"Window.Label.Unfocus.TextColor");
113
void FbWinFrameTheme::reconfigTheme() {
114
if (*m_bevel_width > 20)
116
else if (*m_bevel_width < 0)
119
if (*m_handle_width > 200)
120
*m_handle_width = 200;
121
else if (*m_handle_width < 0)
124
m_label_text_focus_gc.setForeground(*m_label_focus_color);
125
m_label_text_unfocus_gc.setForeground(*m_label_unfocus_color);
126
m_label_text_active_gc.setForeground(*m_label_active_color);
127
m_button_pic_focus_gc.setForeground(*m_button_focus_color);
128
m_button_pic_unfocus_gc.setForeground(*m_button_unfocus_color);