diff options
author | rathnor <rathnor> | 2004-08-27 14:14:42 (GMT) |
---|---|---|
committer | rathnor <rathnor> | 2004-08-27 14:14:42 (GMT) |
commit | f2599d87f61ac4d2028698195024e082ed6f513a (patch) | |
tree | 5615c94f2b11262d26be54d573efaecde35246ee /src/ButtonTheme.cc | |
parent | 6ce5a31ea8bb6dbf6f64260c62d9af153e9d7f30 (diff) | |
download | fluxbox_pavel-f2599d87f61ac4d2028698195024e082ed6f513a.zip fluxbox_pavel-f2599d87f61ac4d2028698195024e082ed6f513a.tar.bz2 |
add a special fallback for toolbar button style
Diffstat (limited to 'src/ButtonTheme.cc')
-rw-r--r-- | src/ButtonTheme.cc | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/src/ButtonTheme.cc b/src/ButtonTheme.cc index abd8c24..f3bed1f 100644 --- a/src/ButtonTheme.cc +++ b/src/ButtonTheme.cc | |||
@@ -4,12 +4,16 @@ | |||
4 | //!! TODO: still missing *.pressed.picColor | 4 | //!! TODO: still missing *.pressed.picColor |
5 | ButtonTheme::ButtonTheme(int screen_num, | 5 | ButtonTheme::ButtonTheme(int screen_num, |
6 | const std::string &name, | 6 | const std::string &name, |
7 | const std::string &alt_name): | 7 | const std::string &alt_name, |
8 | const std::string &extra_fallback, | ||
9 | const std::string &extra_fallback_alt): | ||
8 | ToolTheme(screen_num, name, alt_name), | 10 | ToolTheme(screen_num, name, alt_name), |
9 | m_pic_color(*this, name + ".picColor", alt_name + ".PicColor"), | 11 | m_pic_color(*this, name + ".picColor", alt_name + ".PicColor"), |
10 | m_pressed_texture(*this, name + ".pressed", alt_name + ".Pressed"), | 12 | m_pressed_texture(*this, name + ".pressed", alt_name + ".Pressed"), |
11 | m_gc(RootWindow(FbTk::App::instance()->display(), screen_num)), | 13 | m_gc(RootWindow(FbTk::App::instance()->display(), screen_num)), |
12 | m_scale(*this, name + ".scale", alt_name + ".Scale") { | 14 | m_scale(*this, name + ".scale", alt_name + ".Scale"), |
15 | m_name(name), | ||
16 | m_fallbackname(extra_fallback), m_altfallbackname(extra_fallback_alt) { | ||
13 | 17 | ||
14 | } | 18 | } |
15 | 19 | ||
@@ -24,9 +28,31 @@ bool ButtonTheme::fallback(FbTk::ThemeItem_base &item) { | |||
24 | return FbTk::ThemeManager::instance().loadItem(item, "borderColor", "BorderColor"); | 28 | return FbTk::ThemeManager::instance().loadItem(item, "borderColor", "BorderColor"); |
25 | } | 29 | } |
26 | */ | 30 | */ |
27 | if (item.name().find(".pressed") != std::string::npos) { | 31 | if (item.name() == name()) { |
32 | // default to the toolbar label style | ||
33 | return FbTk::ThemeManager::instance().loadItem(item, | ||
34 | m_fallbackname, | ||
35 | m_altfallbackname); | ||
36 | |||
37 | } else if (item.name().find(".picColor") != std::string::npos) { | ||
38 | // if we've fallen back to alternate name, and it doesn't have a picColor, | ||
39 | // try its text color instead | ||
40 | return FbTk::ThemeManager::instance().loadItem(item, | ||
41 | m_fallbackname + ".picColor", | ||
42 | m_altfallbackname + ".picColor") || | ||
43 | FbTk::ThemeManager::instance().loadItem(item, | ||
44 | m_fallbackname + ".textColor", | ||
45 | m_altfallbackname + ".TextColor"); | ||
46 | } else if (item.name().find(".pressed") != std::string::npos) { | ||
28 | // copy texture | 47 | // copy texture |
29 | *m_pressed_texture = texture(); | 48 | *m_pressed_texture = texture(); |
49 | // invert the bevel if it has one! | ||
50 | unsigned long type = m_pressed_texture->type(); | ||
51 | unsigned long bevels = (FbTk::Texture::SUNKEN | FbTk::Texture::RAISED); | ||
52 | if ((type & bevels) != 0) { | ||
53 | type ^= bevels; | ||
54 | m_pressed_texture->setType(type); | ||
55 | } | ||
30 | return true; | 56 | return true; |
31 | } | 57 | } |
32 | 58 | ||