diff options
Diffstat (limited to 'src/ToolbarTheme.hh')
-rw-r--r-- | src/ToolbarTheme.hh | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/src/ToolbarTheme.hh b/src/ToolbarTheme.hh new file mode 100644 index 0000000..cbe9c90 --- /dev/null +++ b/src/ToolbarTheme.hh | |||
@@ -0,0 +1,92 @@ | |||
1 | // ToolbarTheme.hh 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.hh,v 1.2 2003/02/15 01:58:52 fluxgen Exp $ | ||
23 | |||
24 | #ifndef TOOLBARTHEME_HH | ||
25 | #define TOOLBARTHEME_HH | ||
26 | |||
27 | #include "FbTk/Theme.hh" | ||
28 | #include "Font.hh" | ||
29 | #include "Texture.hh" | ||
30 | #include "Color.hh" | ||
31 | #include "Text.hh" | ||
32 | #include "Subject.hh" | ||
33 | |||
34 | /// toolbar theme class container | ||
35 | class ToolbarTheme: public FbTk::Theme { | ||
36 | public: | ||
37 | explicit ToolbarTheme(int screen_num); | ||
38 | virtual ~ToolbarTheme(); | ||
39 | |||
40 | void reconfigTheme(); | ||
41 | |||
42 | /** | ||
43 | @name colors | ||
44 | */ | ||
45 | ///@{ | ||
46 | const FbTk::Color &labelTextColor() const { return *m_label_textcolor; } | ||
47 | const FbTk::Color &windowTextColor() const { return *m_window_textcolor; } | ||
48 | const FbTk::Color &clockTextColor() const { return *m_clock_textcolor; } | ||
49 | const FbTk::Color &buttonColor() const { return *m_button_color; } | ||
50 | ///@} | ||
51 | /** | ||
52 | @name textures | ||
53 | */ | ||
54 | ///@{ | ||
55 | const FbTk::Texture &toolbar() const { return *m_toolbar; } | ||
56 | const FbTk::Texture &label() const { return *m_label; } | ||
57 | const FbTk::Texture &window() const { return *m_window; } | ||
58 | const FbTk::Texture &button() const { return *m_button; } | ||
59 | const FbTk::Texture &pressedButton() const { return *m_pressed_button; } | ||
60 | const FbTk::Texture &clock() const { return *m_clock; } | ||
61 | ///@} | ||
62 | const FbTk::Font &font() const { return *m_font; } | ||
63 | FbTk::Font &font() { return *m_font; } | ||
64 | /** | ||
65 | @name graphic context | ||
66 | */ | ||
67 | ///@{ | ||
68 | GC labelTextGC() const { return m_label_text_gc; } | ||
69 | GC windowTextGC() const { return m_window_text_gc; } | ||
70 | GC clockTextGC() const { return m_clock_text_gc; } | ||
71 | GC buttonPicGC() const { return m_button_pic_gc; } | ||
72 | ///@} | ||
73 | FbTk::Justify justify() const { return *m_justify; } | ||
74 | |||
75 | void addListener(FbTk::Observer &obs) { m_theme_change_sig.attach(&obs); } | ||
76 | void removeListener(FbTk::Observer &obs) { m_theme_change_sig.detach(&obs); } | ||
77 | private: | ||
78 | // text colors | ||
79 | FbTk::ThemeItem<FbTk::Color> m_label_textcolor, m_window_textcolor, m_clock_textcolor; | ||
80 | FbTk::ThemeItem<FbTk::Color> m_button_color; | ||
81 | // textures | ||
82 | FbTk::ThemeItem<FbTk::Texture> m_toolbar, m_label, m_window, m_button, m_pressed_button, m_clock; | ||
83 | FbTk::ThemeItem<FbTk::Font> m_font; | ||
84 | FbTk::ThemeItem<FbTk::Justify> m_justify; | ||
85 | // graphic context | ||
86 | GC m_label_text_gc, m_window_text_gc, m_clock_text_gc, m_button_pic_gc; | ||
87 | Display *m_display; | ||
88 | |||
89 | FbTk::Subject m_theme_change_sig; | ||
90 | }; | ||
91 | |||
92 | #endif // TOOLBARTHEME_HH | ||