diff options
author | fluxgen <fluxgen> | 2003-08-11 15:49:56 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2003-08-11 15:49:56 (GMT) |
commit | 334a78fa7ad59941e7aeb261113dbcb72635b534 (patch) | |
tree | c51042facbd363c2bf10846d5016c9960682607f /src/IconButtonTheme.cc | |
parent | 86f934e73e528938122aff549bdefa9756ff80be (diff) | |
download | fluxbox-334a78fa7ad59941e7aeb261113dbcb72635b534.zip fluxbox-334a78fa7ad59941e7aeb261113dbcb72635b534.tar.bz2 |
theme item for iconbutton
Diffstat (limited to 'src/IconButtonTheme.cc')
-rw-r--r-- | src/IconButtonTheme.cc | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/src/IconButtonTheme.cc b/src/IconButtonTheme.cc new file mode 100644 index 0000000..d881329 --- /dev/null +++ b/src/IconButtonTheme.cc | |||
@@ -0,0 +1,68 @@ | |||
1 | // IconButtonTheme.cc | ||
2 | // Copyright (c) 2003 Henrik Kinnunen (fluxgen at users.sourceforge.net) | ||
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: IconButtonTheme.cc,v 1.1 2003/08/11 15:49:56 fluxgen Exp $ | ||
24 | |||
25 | #include "IconButtonTheme.hh" | ||
26 | |||
27 | #include "FbTk/App.hh" | ||
28 | |||
29 | IconButtonTheme::IconButtonTheme(int screen_num): | ||
30 | FbTk::Theme(screen_num), | ||
31 | m_selected_texture(*this, "iconButton.selected", "IconButton.Selected"), | ||
32 | m_unselected_texture(*this, "iconButton.unselected", "IconButton.Unselected"), | ||
33 | m_selected_font(*this, "iconButton.selectedFont", "IconButton.SelectedFont"), | ||
34 | m_unselected_font(*this, "iconButton.unselectedFont", "IconButton.UnselectedFont"), | ||
35 | m_selected_color(*this, "iconButton.selectedTextColor", "IconButton.SelectedTextColor"), | ||
36 | m_unselected_color(*this, "iconButton.unselectedTextColor", "IconButton.UnselectedTextColor") { | ||
37 | |||
38 | // load default font | ||
39 | selectedFont().load("fixed"); | ||
40 | unselectedFont().load("fixed"); | ||
41 | |||
42 | // create graphic context | ||
43 | Display *disp = FbTk::App::instance()->display(); | ||
44 | m_selected_gc = XCreateGC(disp, RootWindow(disp, screen_num), 0, 0); | ||
45 | m_unselected_gc = XCreateGC(disp, RootWindow(disp, screen_num), 0, 0); | ||
46 | } | ||
47 | |||
48 | IconButtonTheme::~IconButtonTheme() { | ||
49 | Display *disp = FbTk::App::instance()->display(); | ||
50 | XFreeGC(disp, m_selected_gc); | ||
51 | XFreeGC(disp, m_unselected_gc); | ||
52 | } | ||
53 | |||
54 | void IconButtonTheme::reconfigTheme() { | ||
55 | |||
56 | XGCValues gcv; | ||
57 | unsigned long gc_value_mask = GCForeground; | ||
58 | Display *disp = FbTk::App::instance()->display(); | ||
59 | |||
60 | gcv.foreground = m_selected_color->pixel(); | ||
61 | XChangeGC(disp, m_selected_gc, gc_value_mask, &gcv); | ||
62 | |||
63 | gcv.foreground = m_unselected_color->pixel(); | ||
64 | XChangeGC(disp, m_unselected_gc, gc_value_mask, &gcv); | ||
65 | |||
66 | m_theme_change.notify(); | ||
67 | } | ||
68 | |||