aboutsummaryrefslogtreecommitdiff
path: root/src/ButtonTheme.cc
blob: 225bbb76477a5648db6a57e211f9888539a5dfdb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "ButtonTheme.hh"
#include "FbTk/App.hh"

//!! TODO: still missing *.pressed.picColor
ButtonTheme::ButtonTheme(int screen_num, 
                         const std::string &name, 
                         const std::string &alt_name):
    ToolTheme(screen_num, name, alt_name),
    m_pic_color(*this, name + ".picColor", alt_name + ".PicColor"),
    m_pressed_texture(*this, name + ".pressed", alt_name + ".Pressed"),
    m_gc(RootWindow(FbTk::App::instance()->display(), screen_num)) {

}

bool ButtonTheme::fallback(FbTk::ThemeItem_base &item) {

    if (item.name().find(".borderWidth") != std::string::npos) {
        return FbTk::ThemeManager::instance().loadItem(item, "borderWidth", "BorderWidth");
    }

    if (item.name().find(".borderColor") != std::string::npos) {
        return FbTk::ThemeManager::instance().loadItem(item, "borderColor", "BorderColor");
    }

    return ToolTheme::fallback(item);
}

void ButtonTheme::reconfigTheme() {
    m_gc.setForeground(*m_pic_color);
}