aboutsummaryrefslogtreecommitdiff
path: root/src/IconbarTheme.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/IconbarTheme.cc')
-rw-r--r--src/IconbarTheme.cc114
1 files changed, 114 insertions, 0 deletions
diff --git a/src/IconbarTheme.cc b/src/IconbarTheme.cc
new file mode 100644
index 0000000..69e0a7b
--- /dev/null
+++ b/src/IconbarTheme.cc
@@ -0,0 +1,114 @@
1// IconbarTheme.cc
2// Copyright (c) 2003 Henrik Kinnunen (fluxgen at users.sourceforge.net)
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: IconbarTheme.cc,v 1.8 2004/01/13 14:41:32 rathnor Exp $
24
25#include "IconbarTheme.hh"
26#include "FbTk/App.hh"
27
28IconbarTheme::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"),
40 m_name(name),
41 m_alpha(*this, name+".alpha", altname+".Alpha") {
42
43 FbTk::ThemeManager::instance().loadTheme(*this);
44
45}
46IconbarTheme::~IconbarTheme() {
47
48}
49
50
51void IconbarTheme::reconfigTheme() {
52 m_focused_text.update();
53 m_unfocused_text.update();
54}
55
56void IconbarTheme::setAntialias(bool value) {
57 m_focused_text.setAntialias(value);
58 m_unfocused_text.setAntialias(value);
59}
60
61// fallback resources
62bool IconbarTheme::fallback(FbTk::ThemeItem_base &item) {
63 using namespace FbTk;
64 ThemeManager &tm = ThemeManager::instance();
65
66 if (&m_focused_texture == &item) {
67 // special case for textures since they're using .load()
68 FbTk::ThemeItem<FbTk::Texture> tmp_item(m_focused_texture.theme(),
69 "window.label.focus", "Window.Title.Focus");
70 tmp_item.load();
71 // copy texture
72 *m_focused_texture = *tmp_item;
73 return true;
74 } else if (&m_unfocused_texture == &item) {
75 // special case for textures since they're using .load()
76 FbTk::ThemeItem<FbTk::Texture> tmp_item(m_unfocused_texture.theme(),
77 "window.label.unfocus", "Window.Label.Unfocus");
78 tmp_item.load();
79 // copy texture
80 *m_unfocused_texture = *tmp_item;
81 return true;
82 } else if (&m_empty_texture == &item) {
83 return (tm.loadItem(item, m_focused_texture.name(), m_focused_texture.altName()) ?
84 true :
85 tm.loadItem(item, "toolbar.windowLabel", "toolbar.windowLabel"));
86 } else if (item.name() == m_name + ".borderWidth" ||
87 item.name() == m_name + ".focused.borderWidth" ||
88 item.name() == m_name + ".unfocused.borderWidth")
89
90 return tm.loadItem(item, "borderWidth", "BorderWidth");
91
92 else if (item.name() == m_name + ".borderColor" ||
93 item.name() == m_name + ".focused.borderColor" ||
94 item.name() == m_name + ".unfocused.borderColor")
95
96 return tm.loadItem(item, "borderColor", "BorderColor");
97
98 else if (item.name() == m_name + ".focused.font" ||
99 item.name() == m_name + ".unfocused.font")
100
101 return tm.loadItem(item, "window.font", "Window.Font");
102
103 else if (item.name() == m_name + ".focused.textColor") {
104
105 return tm.loadItem(item, "window.label.focus.textColor", "Window.Label.Focus.TextColor");
106
107 } else if (item.name() == m_name + ".unfocused.textColor") {
108 return tm.loadItem(item, "window.label.unfocus.textColor", "Window.Label.Unfocus.TextColor");
109 } else if (item.name() == m_name + ".alpha") {
110 return tm.loadItem(item, "toolbar.alpha", "Toolbar.Alpha");
111 }
112
113 return false;
114}