2
// Copyright (c) 2003 - 2005 Henrik Kinnunen (fluxgen at fluxbox dot org)
3
// and Simon Bowden (rathnor at users.sourceforge.net)
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:
12
// The above copyright notice and this permission notice shall be included in
13
// all copies or substantial portions of the Software.
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.
23
// $Id: IconbarTheme.cc 4043 2005-06-03 07:25:48Z mathias $
25
#include "IconbarTheme.hh"
26
#include "FbTk/App.hh"
28
IconbarTheme::IconbarTheme(int screen_num,
29
const std::string &name,
30
const std::string &altname):
31
FbTk::Theme(screen_num),
32
m_focused_texture(*this, name + ".focused", altname + ".Focused"),
33
m_unfocused_texture(*this, name + ".unfocused", altname + ".Unfocused"),
34
m_empty_texture(*this, name + ".empty", altname + ".Empty"),
35
m_focused_border(*this, name + ".focused", altname + ".Focused"),
36
m_unfocused_border(*this, name + ".unfocused", altname + ".Unfocused"),
37
m_border(*this, name, altname),
38
m_focused_text(*this, name + ".focused", altname + ".Focused"),
39
m_unfocused_text(*this, name + ".unfocused", altname + ".Unfocused"),
41
m_alpha(*this, name+".alpha", altname+".Alpha") {
43
FbTk::ThemeManager::instance().loadTheme(*this);
46
IconbarTheme::~IconbarTheme() {
51
void IconbarTheme::reconfigTheme() {
52
m_focused_text.update();
53
m_unfocused_text.update();
57
bool IconbarTheme::fallback(FbTk::ThemeItem_base &item) {
59
ThemeManager &tm = ThemeManager::instance();
61
if (&m_focused_texture == &item) {
62
return (tm.loadItem(item, "window.label.focus", "Window.Label.Focus") ||
63
tm.loadItem(item, "toolbar.windowLabel", "toolbar.windowLabel"));
65
} else if (&m_unfocused_texture == &item) {
66
return (tm.loadItem(item, "window.label.unfocus", "Window.Label.Unfocus") ||
67
tm.loadItem(item, "toolbar.windowLabel", "toolbar.windowLabel"));
68
} else if (&m_empty_texture == &item) {
69
return (tm.loadItem(item, m_focused_texture.name(), m_focused_texture.altName()) ||
70
tm.loadItem(item, "toolbar.windowLabel", "toolbar.windowLabel") ||
71
tm.loadItem(item, "toolbar", "toolbar")
73
} else if (item.name() == m_name + ".focused.borderWidth" ||
74
item.name() == m_name + ".unfocused.borderWidth")
75
// don't fallback for base border, for theme backwards compatibility
76
return tm.loadItem(item, "borderWidth", "BorderWidth");
78
else if (item.name() == m_name + ".focused.borderColor" ||
79
item.name() == m_name + ".unfocused.borderColor")
81
return tm.loadItem(item, "borderColor", "BorderColor");
83
else if (item.name() == m_name + ".focused.font" ||
84
item.name() == m_name + ".unfocused.font")
86
return tm.loadItem(item, "window.font", "Window.Font");
88
else if (item.name() == m_name + ".focused.textColor") {
90
return tm.loadItem(item, "window.label.focus.textColor", "Window.Label.Focus.TextColor");
92
} else if (item.name() == m_name + ".unfocused.textColor") {
93
return tm.loadItem(item, "window.label.unfocus.textColor", "Window.Label.Unfocus.TextColor");
94
} else if (item.name() == m_name + ".alpha") {
95
if (!tm.loadItem(item, "toolbar.alpha", "Toolbar.Alpha")) {