From be89656dea556f9d62d855180b34f42dd10c28d8 Mon Sep 17 00:00:00 2001 From: fluxgen Date: Tue, 19 Aug 2003 21:26:45 +0000 Subject: fixed fallback items --- src/IconbarTheme.cc | 38 ++++++++++++++++++++++++++++++++++++-- src/IconbarTheme.hh | 4 +++- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/src/IconbarTheme.cc b/src/IconbarTheme.cc index 2689083..ed320e4 100644 --- a/src/IconbarTheme.cc +++ b/src/IconbarTheme.cc @@ -20,7 +20,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: IconbarTheme.cc,v 1.4 2003/08/13 10:03:06 fluxgen Exp $ +// $Id: IconbarTheme.cc,v 1.5 2003/08/19 21:26:45 fluxgen Exp $ #include "IconbarTheme.hh" #include "FbTk/App.hh" @@ -36,7 +36,8 @@ IconbarTheme::IconbarTheme(int screen_num, m_unfocused_border(*this, name + ".unfocused", altname + ".Unfocused"), m_border(*this, name, altname), m_focused_text(*this, name + ".focused", altname + ".Focused"), - m_unfocused_text(*this, name + ".unfocused", altname + ".Unfocused") { + m_unfocused_text(*this, name + ".unfocused", altname + ".Unfocused"), + m_name(name) { FbTk::ThemeManager::instance().loadTheme(*this); @@ -56,3 +57,36 @@ void IconbarTheme::setAntialias(bool value) { m_unfocused_text.setAntialias(value); } +// fallback resources +bool IconbarTheme::fallback(FbTk::ThemeItem_base &item) { + using namespace FbTk; + ThemeManager &tm = ThemeManager::instance(); + + if (&m_focused_texture == &item) + return tm.loadItem(item, "window.title.focus", "Window.Title.Focus"); + else if (&m_unfocused_texture == &item) { + return (tm.loadItem(item, m_focused_texture.name(), m_focused_texture.altName()) ? + true : + tm.loadItem(item, "window.title.unfocus", "Window.Title.Unfocus")); + } else if (&m_empty_texture == &item) { + return (tm.loadItem(item, m_focused_texture.name(), m_focused_texture.altName()) ? + true : + tm.loadItem(item, "toolbar.windowLabel", "toolbar.windowLabel")); + } else if (item.name() == m_name + ".borderWidth" || + item.name() == m_name + ".focused.borderWidth" || + item.name() == m_name + ".unfocused.borderWidth") + return tm.loadItem(item, "borderWidth", "BorderWidth"); + else if (item.name() == m_name + ".borderColor" || + item.name() == m_name + ".focused.borderColor" || + item.name() == m_name + ".unfocused.borderColor") + return tm.loadItem(item, "borderColor", "BorderColor"); + else if (item.name() == m_name + ".focused.font" || + item.name() == m_name + ".unfocused.font") + return tm.loadItem(item, "window.font", "Window.Font"); + else if (item.name() == m_name + ".focused.textColor") + return tm.loadItem(item, "window.label.focus.textColor", "Window.Label.Focus.TextColor"); + else if (item.name() == m_name + ".unfocused.textColor") + return tm.loadItem(item, "window.label.unfocus.textColor", "Window.Label.Unfocus.TextColor"); + + return false; +} diff --git a/src/IconbarTheme.hh b/src/IconbarTheme.hh index 18ec0cd..7545454 100644 --- a/src/IconbarTheme.hh +++ b/src/IconbarTheme.hh @@ -20,7 +20,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: IconbarTheme.hh,v 1.4 2003/08/13 10:03:06 fluxgen Exp $ +// $Id: IconbarTheme.hh,v 1.5 2003/08/19 21:26:45 fluxgen Exp $ #ifndef ICONBARTHEME_HH #define ICONBARTHEME_HH @@ -37,6 +37,7 @@ public: virtual ~IconbarTheme(); void reconfigTheme(); + bool fallback(FbTk::ThemeItem_base &item); void setAntialias(bool antialias); @@ -55,6 +56,7 @@ private: FbTk::ThemeItem m_focused_texture, m_unfocused_texture, m_empty_texture; BorderTheme m_focused_border, m_unfocused_border, m_border; TextTheme m_focused_text, m_unfocused_text; + std::string m_name; }; #endif // ICONBARTHEME_HH -- cgit v0.11.2