~ubuntu-branches/ubuntu/trusty/fluxbox/trusty-proposed

« back to all changes in this revision

Viewing changes to src/IconbarTheme.cc

  • Committer: Bazaar Package Importer
  • Author(s): Dmitry E. Oboukhov
  • Date: 2008-07-01 10:38:14 UTC
  • mfrom: (2.1.12 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080701103814-khx2b6il152x9p93
Tags: 1.0.0+deb1-8
* x-dev has been removed from build-depends (out-of-date package).
* Standards-Version bumped to 3.8.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// IconbarTheme.cc
2
 
// Copyright (c) 2003 - 2005 Henrik Kinnunen (fluxgen at fluxbox dot org)
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 4043 2005-06-03 07:25:48Z mathias $
24
 
 
25
 
#include "IconbarTheme.hh"
26
 
#include "FbTk/App.hh"
27
 
 
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"),
40
 
    m_name(name),
41
 
    m_alpha(*this, name+".alpha", altname+".Alpha") {
42
 
 
43
 
    FbTk::ThemeManager::instance().loadTheme(*this);
44
 
 
45
 
}
46
 
IconbarTheme::~IconbarTheme() {
47
 
 
48
 
}
49
 
 
50
 
 
51
 
void IconbarTheme::reconfigTheme() {
52
 
    m_focused_text.update();
53
 
    m_unfocused_text.update();
54
 
}
55
 
 
56
 
// fallback resources
57
 
bool IconbarTheme::fallback(FbTk::ThemeItem_base &item) {
58
 
    using namespace FbTk;
59
 
    ThemeManager &tm = ThemeManager::instance();
60
 
 
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"));
64
 
 
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")
72
 
            ); 
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");
77
 
 
78
 
    else if (item.name() == m_name + ".focused.borderColor" ||
79
 
             item.name() == m_name + ".unfocused.borderColor")
80
 
 
81
 
        return tm.loadItem(item, "borderColor", "BorderColor");
82
 
 
83
 
    else if (item.name() == m_name + ".focused.font" ||
84
 
             item.name() == m_name + ".unfocused.font")
85
 
 
86
 
        return tm.loadItem(item, "window.font", "Window.Font");
87
 
 
88
 
    else if (item.name() == m_name + ".focused.textColor") {
89
 
 
90
 
        return tm.loadItem(item, "window.label.focus.textColor", "Window.Label.Focus.TextColor");        
91
 
 
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")) {
96
 
            *m_alpha = 255;
97
 
        }
98
 
        return true;
99
 
    }
100
 
 
101
 
    return false;
102
 
}