aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-12-02 19:56:38 (GMT)
committerfluxgen <fluxgen>2002-12-02 19:56:38 (GMT)
commit3633489dbffbb798cfe0ce948cdf933e3fdb31a1 (patch)
tree712075bf14615795d072e54addf1bdeacff3b2f1 /src
parentbf2642c831a55dc212dda03ba3d9410049ec1d2a (diff)
downloadfluxbox_pavel-3633489dbffbb798cfe0ce948cdf933e3fdb31a1.zip
fluxbox_pavel-3633489dbffbb798cfe0ce948cdf933e3fdb31a1.tar.bz2
toolbar theme
Diffstat (limited to 'src')
-rw-r--r--src/ToolbarTheme.cc109
-rw-r--r--src/ToolbarTheme.hh87
2 files changed, 196 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>
28using namespace std;
29
30ToolbarTheme::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
81ToolbarTheme::~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
88void 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}
diff --git a/src/ToolbarTheme.hh b/src/ToolbarTheme.hh
new file mode 100644
index 0000000..f40ed19
--- /dev/null
+++ b/src/ToolbarTheme.hh
@@ -0,0 +1,87 @@
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.1 2002/12/02 19:56:08 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/**
33 Toolbar theme class container
34*/
35class ToolbarTheme: public FbTk::Theme {
36public:
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; }
74private:
75 // text colors
76 FbTk::ThemeItem<FbTk::Color> m_label_textcolor, m_window_textcolor, m_clock_textcolor;
77 FbTk::ThemeItem<FbTk::Color> m_button_color;
78 // textures
79 FbTk::ThemeItem<FbTk::Texture> m_toolbar, m_label, m_window, m_button, m_pressed_button, m_clock;
80 FbTk::ThemeItem<FbTk::Font> m_font;
81 FbTk::ThemeItem<FbTk::Justify> m_justify;
82 // graphic context
83 GC m_label_text_gc, m_window_text_gc, m_clock_text_gc, m_button_pic_gc;
84 Display *m_display;
85};
86
87#endif // TOOLBARTHEME_HH