diff options
author | Mark Tiefenbruck <mark@fluxbox.org> | 2008-01-07 10:26:32 (GMT) |
---|---|---|
committer | Mark Tiefenbruck <mark@fluxbox.org> | 2008-01-07 10:26:32 (GMT) |
commit | dbfddf8e0bcf8e7abbba671eff64c9679332a774 (patch) | |
tree | 37cefce75eef2f7e0c749c3489008608e71dcd6c /src/IconButton.cc | |
parent | ac1bd7e0981222bf340ce7defb2bb8307d42a0a2 (diff) | |
download | fluxbox-dbfddf8e0bcf8e7abbba671eff64c9679332a774.zip fluxbox-dbfddf8e0bcf8e7abbba671eff64c9679332a774.tar.bz2 |
added new ThemeProxy for automatically handling focused vs. unfocused ThemeItems
Diffstat (limited to 'src/IconButton.cc')
-rw-r--r-- | src/IconButton.cc | 61 |
1 files changed, 19 insertions, 42 deletions
diff --git a/src/IconButton.cc b/src/IconButton.cc index d64e23c..2df741a 100644 --- a/src/IconButton.cc +++ b/src/IconButton.cc | |||
@@ -25,7 +25,6 @@ | |||
25 | #include "IconbarTheme.hh" | 25 | #include "IconbarTheme.hh" |
26 | 26 | ||
27 | #include "Screen.hh" | 27 | #include "Screen.hh" |
28 | #include "Focusable.hh" | ||
29 | 28 | ||
30 | #include "FbTk/App.hh" | 29 | #include "FbTk/App.hh" |
31 | #include "FbTk/Command.hh" | 30 | #include "FbTk/Command.hh" |
@@ -47,15 +46,15 @@ | |||
47 | 46 | ||
48 | 47 | ||
49 | IconButton::IconButton(const FbTk::FbWindow &parent, | 48 | IconButton::IconButton(const FbTk::FbWindow &parent, |
50 | FbTk::ThemeProxy<IconbarTheme> &theme, Focusable &win): | 49 | FbTk::ThemeProxy<IconbarTheme> &focused_theme, |
51 | FbTk::TextButton(parent, theme->focusedText().font(), win.title()), | 50 | FbTk::ThemeProxy<IconbarTheme> &unfocused_theme, Focusable &win): |
51 | FbTk::TextButton(parent, focused_theme->text().font(), win.title()), | ||
52 | m_win(win), | 52 | m_win(win), |
53 | m_icon_window(*this, 1, 1, 1, 1, | 53 | m_icon_window(*this, 1, 1, 1, 1, |
54 | ExposureMask | ButtonPressMask | ButtonReleaseMask), | 54 | ExposureMask | ButtonPressMask | ButtonReleaseMask), |
55 | m_use_pixmap(true), | 55 | m_use_pixmap(true), |
56 | m_theme(theme), | 56 | m_theme(win, focused_theme, unfocused_theme), |
57 | m_focused_pm(win.screen().imageControl()), | 57 | m_pm(win.screen().imageControl()) { |
58 | m_unfocused_pm(win.screen().imageControl()) { | ||
59 | 58 | ||
60 | m_win.titleSig().attach(this); | 59 | m_win.titleSig().attach(this); |
61 | m_win.focusSig().attach(this); | 60 | m_win.focusSig().attach(this); |
@@ -118,47 +117,25 @@ void IconButton::setPixmap(bool use) { | |||
118 | 117 | ||
119 | void IconButton::reconfigTheme() { | 118 | void IconButton::reconfigTheme() { |
120 | 119 | ||
121 | if (m_theme->focusedTexture().usePixmap()) | 120 | if (m_theme->texture().usePixmap()) |
122 | m_focused_pm.reset(m_win.screen().imageControl().renderImage( | 121 | m_pm.reset(m_win.screen().imageControl().renderImage( |
123 | width(), height(), m_theme->focusedTexture(), | 122 | width(), height(), m_theme->texture(), |
124 | orientation())); | 123 | orientation())); |
125 | else | 124 | else |
126 | m_focused_pm.reset(0); | 125 | m_pm.reset(0); |
127 | |||
128 | if (m_theme->unfocusedTexture().usePixmap()) | ||
129 | m_unfocused_pm.reset(m_win.screen().imageControl().renderImage( | ||
130 | width(), height(), m_theme->unfocusedTexture(), | ||
131 | orientation())); | ||
132 | else | ||
133 | m_unfocused_pm.reset(0); | ||
134 | 126 | ||
135 | setAlpha(parent()->alpha()); | 127 | setAlpha(parent()->alpha()); |
136 | 128 | ||
137 | if (m_win.isFocused() || m_win.getAttentionState()) { | 129 | if (m_pm != 0) |
138 | if (m_focused_pm != 0) | 130 | setBackgroundPixmap(m_pm); |
139 | setBackgroundPixmap(m_focused_pm); | 131 | else |
140 | else | 132 | setBackgroundColor(m_theme->texture().color()); |
141 | setBackgroundColor(m_theme->focusedTexture().color()); | ||
142 | |||
143 | setGC(m_theme->focusedText().textGC()); | ||
144 | setFont(m_theme->focusedText().font()); | ||
145 | setJustify(m_theme->focusedText().justify()); | ||
146 | setBorderWidth(m_theme->focusedBorder().width()); | ||
147 | setBorderColor(m_theme->focusedBorder().color()); | ||
148 | |||
149 | } else { | ||
150 | if (m_unfocused_pm != 0) | ||
151 | setBackgroundPixmap(m_unfocused_pm); | ||
152 | else | ||
153 | setBackgroundColor(m_theme->unfocusedTexture().color()); | ||
154 | |||
155 | setGC(m_theme->unfocusedText().textGC()); | ||
156 | setFont(m_theme->unfocusedText().font()); | ||
157 | setJustify(m_theme->unfocusedText().justify()); | ||
158 | setBorderWidth(m_theme->unfocusedBorder().width()); | ||
159 | setBorderColor(m_theme->unfocusedBorder().color()); | ||
160 | 133 | ||
161 | } | 134 | setGC(m_theme->text().textGC()); |
135 | setFont(m_theme->text().font()); | ||
136 | setJustify(m_theme->text().justify()); | ||
137 | setBorderWidth(m_theme->border().width()); | ||
138 | setBorderColor(m_theme->border().color()); | ||
162 | 139 | ||
163 | updateBackground(false); | 140 | updateBackground(false); |
164 | 141 | ||