diff options
author | fluxgen <fluxgen> | 2002-12-02 19:56:38 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2002-12-02 19:56:38 (GMT) |
commit | 3633489dbffbb798cfe0ce948cdf933e3fdb31a1 (patch) | |
tree | 712075bf14615795d072e54addf1bdeacff3b2f1 /src/ToolbarTheme.cc | |
parent | bf2642c831a55dc212dda03ba3d9410049ec1d2a (diff) | |
download | fluxbox-3633489dbffbb798cfe0ce948cdf933e3fdb31a1.zip fluxbox-3633489dbffbb798cfe0ce948cdf933e3fdb31a1.tar.bz2 |
toolbar theme
Diffstat (limited to 'src/ToolbarTheme.cc')
-rw-r--r-- | src/ToolbarTheme.cc | 109 |
1 files changed, 109 insertions, 0 deletions
diff --git a/src/ToolbarTheme.cc b/src/ToolbarTheme.cc new file mode 100644 index 0000000..138104f --- /dev/null +++ b/src/ToolbarTheme.cc | |||
@@ -0,0 +1,109 @@ | |||
1 | // ToolbarTheme.cc a theme class for Toolbar | ||
2 | // Copyright (c) 2002 Henrik Kinnunen (fluxgen at users.sourceforge.net) | ||
3 | // | ||
4 | // Permission is hereby granted, free of charge, to any person obtaining a | ||
5 | // copy of this software and associated documentation files (the "Software"), | ||
6 | // to deal in the Software without restriction, including without limitation | ||
7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | // and/or sell copies of the Software, and to permit persons to whom the | ||
9 | // Software is furnished to do so, subject to the following conditions: | ||
10 | // | ||
11 | // The above copyright notice and this permission notice shall be included in | ||
12 | // all copies or substantial portions of the Software. | ||
13 | // | ||
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
20 | // DEALINGS IN THE SOFTWARE. | ||
21 | |||
22 | // $Id: ToolbarTheme.cc,v 1.1 2002/12/02 19:56:38 fluxgen Exp $ | ||
23 | |||
24 | #include "ToolbarTheme.hh" | ||
25 | |||
26 | #include "App.hh" | ||
27 | #include <iostream> | ||
28 | using namespace std; | ||
29 | |||
30 | ToolbarTheme::ToolbarTheme(int screen_num): | ||
31 | FbTk::Theme(screen_num), | ||
32 | m_label_textcolor(*this, | ||
33 | "toolbar.label.textColor", "Toolbar.Label.TextColor"), | ||
34 | m_window_textcolor(*this, | ||
35 | "toolbar.windowLabel.textColor", | ||
36 | "Toolbar.WindowLabel.TextColor"), | ||
37 | m_clock_textcolor(*this, | ||
38 | "toolbar.clock.textColor", "Toolbar.Clock.TextColor"), | ||
39 | m_button_color(*this, | ||
40 | "toolbar.button.picColor", "Toolbar.Button.PicColor"), | ||
41 | m_toolbar(*this, "toolbar", "Toolbar"), | ||
42 | m_label(*this, "toolbar.label", "Toolbar.Label"), | ||
43 | m_window(*this, "toolbar.windowLabel", "Toolbar.WindowLabel"), | ||
44 | m_button(*this, "toolbar.button", "Toolbar.Button"), | ||
45 | m_pressed_button(*this, | ||
46 | "toolbar.button.pressed", "Toolbar.Button.Pressed"), | ||
47 | m_clock(*this, "toolbar.clock", "Toolbar.Clock"), | ||
48 | m_font(*this, "toolbar.font", "Toolbar.Font"), | ||
49 | m_justify(*this, "toolbar.justify", "Toolbar.Justify"), | ||
50 | m_display(FbTk::App::instance()->display()){ | ||
51 | |||
52 | Window rootwindow = RootWindow(m_display, screen_num); | ||
53 | |||
54 | XGCValues gcv; | ||
55 | unsigned long gc_value_mask = GCForeground; | ||
56 | |||
57 | gcv.foreground = m_label_textcolor->pixel(); | ||
58 | |||
59 | m_label_text_gc = | ||
60 | XCreateGC(m_display, rootwindow, | ||
61 | gc_value_mask, &gcv); | ||
62 | |||
63 | gcv.foreground = m_window_textcolor->pixel(); | ||
64 | m_window_text_gc = | ||
65 | XCreateGC(m_display, rootwindow, | ||
66 | gc_value_mask, &gcv); | ||
67 | |||
68 | gcv.foreground = m_clock_textcolor->pixel(); | ||
69 | m_clock_text_gc = | ||
70 | XCreateGC(m_display, rootwindow, | ||
71 | gc_value_mask, &gcv); | ||
72 | |||
73 | gcv.foreground = m_button_color->pixel(); | ||
74 | m_button_pic_gc = | ||
75 | XCreateGC(m_display, rootwindow, | ||
76 | gc_value_mask, &gcv); | ||
77 | // load from current database | ||
78 | FbTk::ThemeManager::instance().loadTheme(*this); | ||
79 | } | ||
80 | |||
81 | ToolbarTheme::~ToolbarTheme() { | ||
82 | XFreeGC(m_display, m_button_pic_gc); | ||
83 | XFreeGC(m_display, m_clock_text_gc); | ||
84 | XFreeGC(m_display, m_label_text_gc); | ||
85 | XFreeGC(m_display, m_window_text_gc); | ||
86 | } | ||
87 | |||
88 | void ToolbarTheme::reconfigTheme() { | ||
89 | |||
90 | XGCValues gcv; | ||
91 | unsigned long gc_value_mask = GCForeground; | ||
92 | |||
93 | |||
94 | gcv.foreground = m_label_textcolor->pixel(); | ||
95 | XChangeGC(m_display, m_label_text_gc, | ||
96 | gc_value_mask, &gcv); | ||
97 | |||
98 | gcv.foreground = m_window_textcolor->pixel(); | ||
99 | XChangeGC(m_display, m_window_text_gc, | ||
100 | gc_value_mask, &gcv); | ||
101 | |||
102 | gcv.foreground = m_clock_textcolor->pixel(); | ||
103 | XChangeGC(m_display, m_clock_text_gc, | ||
104 | gc_value_mask, &gcv); | ||
105 | |||
106 | gcv.foreground = m_button_color->pixel(); | ||
107 | XChangeGC(m_display, m_button_pic_gc, | ||
108 | gc_value_mask, &gcv); | ||
109 | } | ||