diff options
Diffstat (limited to 'src/FbWinFrameTheme.cc')
-rw-r--r-- | src/FbWinFrameTheme.cc | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/src/FbWinFrameTheme.cc b/src/FbWinFrameTheme.cc new file mode 100644 index 0000000..7d439f3 --- /dev/null +++ b/src/FbWinFrameTheme.cc | |||
@@ -0,0 +1,106 @@ | |||
1 | // FbWinFrameTheme.cc for Fluxbox Window Manager | ||
2 | // Copyright (c) 2003 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: FbWinFrameTheme.cc,v 1.6 2003/07/10 14:17:18 fluxgen Exp $ | ||
23 | |||
24 | #include "FbWinFrameTheme.hh" | ||
25 | #include "App.hh" | ||
26 | |||
27 | #include <X11/cursorfont.h> | ||
28 | |||
29 | #include <iostream> | ||
30 | |||
31 | FbWinFrameTheme::FbWinFrameTheme(int screen_num): | ||
32 | FbTk::Theme(screen_num), | ||
33 | m_label_focus(*this, "window.label.focus", "Window.Label.Focus"), | ||
34 | m_label_unfocus(*this, "window.label.unfocus", "Window.Label.Unfocus"), | ||
35 | |||
36 | m_title_focus(*this, "window.title.focus", "Window.Title.Focus"), | ||
37 | m_title_unfocus(*this, "window.title.unfocus", "Window.Title.Unfocus"), | ||
38 | |||
39 | m_handle_focus(*this, "window.handle.focus", "Window.Handle.Focus"), | ||
40 | m_handle_unfocus(*this, "window.handle.unfocus", "Window.Handle.Unfocus"), | ||
41 | |||
42 | m_button_focus(*this, "window.button.focus", "Window.Button.Focus"), | ||
43 | m_button_unfocus(*this, "window.button.unfocus", "Window.Button.Unfocus"), | ||
44 | m_button_pressed(*this, "window.button.pressed", "Window.Button.Pressed"), | ||
45 | |||
46 | m_grip_focus(*this, "window.grip.focus", "Window.Grip.Focus"), | ||
47 | m_grip_unfocus(*this, "window.grip.unfocus", "Window.Grip.Unfocus"), | ||
48 | |||
49 | m_label_focus_color(*this, "window.label.focus.textColor", "Window.Label.Focus.TextColor"), | ||
50 | m_label_unfocus_color(*this, "window.label.unfocus.textColor", "Window.Label.Unfocus.TextColor"), | ||
51 | |||
52 | m_frame_focus_color(*this, "window.frame.focusColor", "Window.Frame.FocusColor"), | ||
53 | m_frame_unfocus_color(*this, "window.frame.unfocusColor", "Window.Frame.UnfocusColor"), | ||
54 | |||
55 | m_button_focus_color(*this, "window.button.focus.picColor", "Window.Button.Focus.PicColor"), | ||
56 | m_button_unfocus_color(*this, "window.button.unfocus.picColor", "Window.Button.Unfocus.PicColor"), | ||
57 | |||
58 | m_font(*this, "window.font", "Window.Font"), | ||
59 | m_textjustify(*this, "window.justify", "Window.Justify"), | ||
60 | m_shape_place(*this, "window.roundCorners", "Window.RoundCorners") { | ||
61 | |||
62 | // create GCs | ||
63 | Display *disp = FbTk::App::instance()->display(); | ||
64 | Window rootwin = RootWindow(disp, screen_num); | ||
65 | m_label_text_focus_gc = XCreateGC(disp, rootwin, 0, 0); | ||
66 | m_label_text_unfocus_gc = XCreateGC(disp, rootwin, 0, 0); | ||
67 | m_button_pic_focus_gc = XCreateGC(disp, rootwin, 0, 0); | ||
68 | m_button_pic_unfocus_gc = XCreateGC(disp, rootwin, 0, 0); | ||
69 | // create cursors | ||
70 | m_cursor_move = XCreateFontCursor(disp, XC_fleur); | ||
71 | m_cursor_lower_left_angle = XCreateFontCursor(disp, XC_ll_angle); | ||
72 | m_cursor_lower_right_angle = XCreateFontCursor(disp, XC_lr_angle); | ||
73 | |||
74 | } | ||
75 | |||
76 | FbWinFrameTheme::~FbWinFrameTheme() { | ||
77 | // destroy GCs | ||
78 | Display *disp = FbTk::App::instance()->display(); | ||
79 | XFreeGC(disp, m_label_text_focus_gc); | ||
80 | XFreeGC(disp, m_label_text_unfocus_gc); | ||
81 | XFreeGC(disp, m_button_pic_focus_gc); | ||
82 | XFreeGC(disp, m_button_pic_unfocus_gc); | ||
83 | } | ||
84 | |||
85 | void FbWinFrameTheme::reconfigTheme() { | ||
86 | |||
87 | XGCValues gcv; | ||
88 | unsigned long gc_value_mask = GCForeground; | ||
89 | Display *disp = FbTk::App::instance()->display(); | ||
90 | |||
91 | gcv.foreground = m_label_focus_color->pixel(); | ||
92 | XChangeGC(disp, m_label_text_focus_gc, gc_value_mask, &gcv); | ||
93 | |||
94 | gcv.foreground = m_label_unfocus_color->pixel(); | ||
95 | XChangeGC(disp, m_label_text_unfocus_gc, gc_value_mask, &gcv); | ||
96 | |||
97 | gcv.foreground = m_button_focus_color->pixel(); | ||
98 | XChangeGC(disp, m_button_pic_focus_gc, gc_value_mask, &gcv); | ||
99 | |||
100 | gcv.foreground = m_button_unfocus_color->pixel(); | ||
101 | XChangeGC(disp, m_button_pic_unfocus_gc, gc_value_mask, &gcv); | ||
102 | |||
103 | // notify listeners | ||
104 | m_theme_change.notify(); | ||
105 | } | ||
106 | |||