00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "IconbarTheme.hh"
00026 #include "FbTk/App.hh"
00027
00028 IconbarTheme::IconbarTheme(int screen_num,
00029 const std::string &name,
00030 const std::string &altname):
00031 FbTk::Theme(screen_num),
00032 m_focused_texture(*this, name + ".focused", altname + ".Focused"),
00033 m_unfocused_texture(*this, name + ".unfocused", altname + ".Unfocused"),
00034 m_empty_texture(*this, name + ".empty", altname + ".Empty"),
00035 m_focused_border(*this, name + ".focused", altname + ".Focused"),
00036 m_unfocused_border(*this, name + ".unfocused", altname + ".Unfocused"),
00037 m_border(*this, name, altname),
00038 m_focused_text(*this, name + ".focused", altname + ".Focused"),
00039 m_unfocused_text(*this, name + ".unfocused", altname + ".Unfocused"),
00040 m_name(name),
00041 m_alpha(*this, name+".alpha", altname+".Alpha") {
00042
00043 FbTk::ThemeManager::instance().loadTheme(*this);
00044
00045 }
00046 IconbarTheme::~IconbarTheme() {
00047
00048 }
00049
00050
00051 void IconbarTheme::reconfigTheme() {
00052 m_focused_text.update();
00053 m_unfocused_text.update();
00054 }
00055
00056 void IconbarTheme::setAntialias(bool value) {
00057 m_focused_text.setAntialias(value);
00058 m_unfocused_text.setAntialias(value);
00059 }
00060
00061
00062 bool IconbarTheme::fallback(FbTk::ThemeItem_base &item) {
00063 using namespace FbTk;
00064 ThemeManager &tm = ThemeManager::instance();
00065
00066 if (&m_focused_texture == &item) {
00067
00068 FbTk::ThemeItem<FbTk::Texture> tmp_item(m_focused_texture.theme(),
00069 "window.label.focus", "Window.Title.Focus");
00070 tmp_item.load();
00071
00072 *m_focused_texture = *tmp_item;
00073 return true;
00074 } else if (&m_unfocused_texture == &item) {
00075
00076 FbTk::ThemeItem<FbTk::Texture> tmp_item(m_unfocused_texture.theme(),
00077 "window.label.unfocus", "Window.Label.Unfocus");
00078 tmp_item.load();
00079
00080 *m_unfocused_texture = *tmp_item;
00081 return true;
00082 } else if (&m_empty_texture == &item) {
00083 return (tm.loadItem(item, m_focused_texture.name(), m_focused_texture.altName()) ?
00084 true :
00085 tm.loadItem(item, "toolbar.windowLabel", "toolbar.windowLabel"));
00086 } else if (item.name() == m_name + ".borderWidth" ||
00087 item.name() == m_name + ".focused.borderWidth" ||
00088 item.name() == m_name + ".unfocused.borderWidth")
00089
00090 return tm.loadItem(item, "borderWidth", "BorderWidth");
00091
00092 else if (item.name() == m_name + ".borderColor" ||
00093 item.name() == m_name + ".focused.borderColor" ||
00094 item.name() == m_name + ".unfocused.borderColor")
00095
00096 return tm.loadItem(item, "borderColor", "BorderColor");
00097
00098 else if (item.name() == m_name + ".focused.font" ||
00099 item.name() == m_name + ".unfocused.font")
00100
00101 return tm.loadItem(item, "window.font", "Window.Font");
00102
00103 else if (item.name() == m_name + ".focused.textColor") {
00104
00105 return tm.loadItem(item, "window.label.focus.textColor", "Window.Label.Focus.TextColor");
00106
00107 } else if (item.name() == m_name + ".unfocused.textColor") {
00108 return tm.loadItem(item, "window.label.unfocus.textColor", "Window.Label.Unfocus.TextColor");
00109 } else if (item.name() == m_name + ".alpha") {
00110 return tm.loadItem(item, "toolbar.alpha", "Toolbar.Alpha");
00111 }
00112
00113 return false;
00114 }