news download themes documentation links










IconbarTheme.cc

00001 // IconbarTheme.cc
00002 // Copyright (c) 2003 Henrik Kinnunen (fluxgen at users.sourceforge.net)
00003 //                and Simon Bowden    (rathnor at users.sourceforge.net)
00004 //
00005 // Permission is hereby granted, free of charge, to any person obtaining a
00006 // copy of this software and associated documentation files (the "Software"),
00007 // to deal in the Software without restriction, including without limitation
00008 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
00009 // and/or sell copies of the Software, and to permit persons to whom the
00010 // Software is furnished to do so, subject to the following conditions:
00011 //
00012 // The above copyright notice and this permission notice shall be included in
00013 // all copies or substantial portions of the Software.
00014 //
00015 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00016 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00017 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
00018 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00019 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
00020 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
00021 // DEALINGS IN THE SOFTWARE.
00022 
00023 // $Id: IconbarTheme.cc,v 1.8 2004/01/13 14:41:32 rathnor Exp $
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 // fallback resources
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         // special case for textures since they're using .load()
00068         FbTk::ThemeItem<FbTk::Texture> tmp_item(m_focused_texture.theme(),
00069                                                 "window.label.focus", "Window.Title.Focus");
00070         tmp_item.load();
00071         // copy texture
00072         *m_focused_texture = *tmp_item;
00073         return true;
00074     } else if (&m_unfocused_texture == &item) {
00075         // special case for textures since they're using .load()
00076         FbTk::ThemeItem<FbTk::Texture> tmp_item(m_unfocused_texture.theme(),
00077                                                 "window.label.unfocus", "Window.Label.Unfocus");
00078         tmp_item.load();
00079         // copy texture
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 }

Fluxbox CVS-Jan-2003




      



Got comments about the page? Send them to webmaster.
If you have general Fluxbox related questions ask them on our irc channel or mailing lists.

Show Source








Designed by aLEczapKA