diff options
Diffstat (limited to 'src/FbTk/MenuTheme.cc')
-rw-r--r-- | src/FbTk/MenuTheme.cc | 75 |
1 files changed, 26 insertions, 49 deletions
diff --git a/src/FbTk/MenuTheme.cc b/src/FbTk/MenuTheme.cc index c83c480..2ecb38b 100644 --- a/src/FbTk/MenuTheme.cc +++ b/src/FbTk/MenuTheme.cc | |||
@@ -19,7 +19,7 @@ | |||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. | 20 | // DEALINGS IN THE SOFTWARE. |
21 | 21 | ||
22 | // $Id: MenuTheme.cc,v 1.9 2003/08/16 12:23:17 fluxgen Exp $ | 22 | // $Id: MenuTheme.cc,v 1.10 2003/08/27 14:12:45 fluxgen Exp $ |
23 | 23 | ||
24 | #include "MenuTheme.hh" | 24 | #include "MenuTheme.hh" |
25 | 25 | ||
@@ -51,41 +51,33 @@ MenuTheme::MenuTheme(int screen_num): | |||
51 | m_border_width(*this, "borderWidth", "BorderWidth"), | 51 | m_border_width(*this, "borderWidth", "BorderWidth"), |
52 | m_bevel_width(*this, "bevelWidth", "BevelWidth"), | 52 | m_bevel_width(*this, "bevelWidth", "BevelWidth"), |
53 | m_border_color(*this, "borderColor", "BorderColor"), | 53 | m_border_color(*this, "borderColor", "BorderColor"), |
54 | m_bullet_pixmap(*this, "menu.submenu.pixmap", "Menu.Submenu.Pixmap"), | ||
55 | m_selected_pixmap(*this, "menu.selected.pixmap", "Menu.Selected.Pixmap"), | ||
56 | m_unselected_pixmap(*this, "menu.unselected.pixmap", "Menu.Unselected.Pixmap"), | ||
54 | m_display(FbTk::App::instance()->display()), | 57 | m_display(FbTk::App::instance()->display()), |
55 | m_alpha(255) | 58 | t_text_gc(RootWindow(m_display, screen_num)), |
56 | { | 59 | f_text_gc(RootWindow(m_display, screen_num)), |
60 | h_text_gc(RootWindow(m_display, screen_num)), | ||
61 | d_text_gc(RootWindow(m_display, screen_num)), | ||
62 | hilite_gc(RootWindow(m_display, screen_num)), | ||
63 | m_alpha(255) { | ||
64 | |||
57 | // set default values | 65 | // set default values |
58 | *m_border_width = 0; | 66 | *m_border_width = 0; |
59 | *m_bevel_width = 0; | 67 | *m_bevel_width = 0; |
60 | 68 | ||
61 | Window rootwindow = RootWindow(m_display, screen_num); | 69 | Window rootwindow = RootWindow(m_display, screen_num); |
62 | 70 | ||
63 | XGCValues gcv; | 71 | t_text_gc.setForeground(*t_text); |
64 | unsigned long gc_value_mask = GCForeground; | 72 | f_text_gc.setForeground(*f_text); |
65 | gcv.foreground = t_text->pixel(); | 73 | h_text_gc.setForeground(*h_text); |
66 | 74 | d_text_gc.setForeground(*d_text); | |
67 | t_text_gc = XCreateGC(m_display, rootwindow, gc_value_mask, &gcv); | 75 | hilite_gc.setForeground(hilite->color()); |
68 | |||
69 | gcv.foreground = f_text->pixel(); | ||
70 | |||
71 | f_text_gc = XCreateGC(m_display, rootwindow, gc_value_mask, &gcv); | ||
72 | 76 | ||
73 | gcv.foreground = h_text->pixel(); | ||
74 | h_text_gc = XCreateGC(m_display, rootwindow, gc_value_mask, &gcv); | ||
75 | |||
76 | gcv.foreground = d_text->pixel(); | ||
77 | d_text_gc = XCreateGC(m_display, rootwindow, gc_value_mask, &gcv); | ||
78 | |||
79 | gcv.foreground = hilite->color().pixel(); | ||
80 | hilite_gc = XCreateGC(m_display, rootwindow, gc_value_mask, &gcv); | ||
81 | } | 77 | } |
82 | 78 | ||
83 | MenuTheme::~MenuTheme() { | 79 | MenuTheme::~MenuTheme() { |
84 | XFreeGC(m_display, t_text_gc); | 80 | |
85 | XFreeGC(m_display, f_text_gc); | ||
86 | XFreeGC(m_display, h_text_gc); | ||
87 | XFreeGC(m_display, d_text_gc); | ||
88 | XFreeGC(m_display, hilite_gc); | ||
89 | } | 81 | } |
90 | 82 | ||
91 | void MenuTheme::reconfigTheme() { | 83 | void MenuTheme::reconfigTheme() { |
@@ -95,30 +87,15 @@ void MenuTheme::reconfigTheme() { | |||
95 | if (*m_border_width > 20) | 87 | if (*m_border_width > 20) |
96 | *m_border_width = 20; | 88 | *m_border_width = 20; |
97 | 89 | ||
98 | XGCValues gcv; | 90 | m_bullet_pixmap->scale(frameFont().height(), frameFont().height()); |
99 | unsigned long gc_value_mask = GCForeground; | 91 | m_selected_pixmap->scale(frameFont().height(), frameFont().height()); |
100 | 92 | m_unselected_pixmap->scale(frameFont().height(), frameFont().height()); | |
101 | gcv.foreground = t_text->pixel(); | 93 | |
102 | 94 | t_text_gc.setForeground(*t_text); | |
103 | XChangeGC(m_display, t_text_gc, | 95 | f_text_gc.setForeground(*f_text); |
104 | gc_value_mask, &gcv); | 96 | h_text_gc.setForeground(*h_text); |
105 | 97 | d_text_gc.setForeground(*d_text); | |
106 | gcv.foreground = f_text->pixel(); | 98 | hilite_gc.setForeground(hilite->color()); |
107 | |||
108 | XChangeGC(m_display, f_text_gc, | ||
109 | gc_value_mask, &gcv); | ||
110 | |||
111 | gcv.foreground = h_text->pixel(); | ||
112 | XChangeGC(m_display, h_text_gc, | ||
113 | gc_value_mask, &gcv); | ||
114 | |||
115 | gcv.foreground = d_text->pixel(); | ||
116 | XChangeGC(m_display, d_text_gc, | ||
117 | gc_value_mask, &gcv); | ||
118 | |||
119 | gcv.foreground = hilite->color().pixel(); | ||
120 | XChangeGC(m_display, hilite_gc, | ||
121 | gc_value_mask, &gcv); | ||
122 | 99 | ||
123 | // notify any listeners | 100 | // notify any listeners |
124 | m_theme_change_sig.notify(); | 101 | m_theme_change_sig.notify(); |