diff options
Diffstat (limited to 'src/WinButton.cc')
-rw-r--r-- | src/WinButton.cc | 81 |
1 files changed, 23 insertions, 58 deletions
diff --git a/src/WinButton.cc b/src/WinButton.cc index 5c6c99c..e8cf0bd 100644 --- a/src/WinButton.cc +++ b/src/WinButton.cc | |||
@@ -34,11 +34,13 @@ | |||
34 | 34 | ||
35 | WinButton::WinButton(const FluxboxWindow &listen_to, | 35 | WinButton::WinButton(const FluxboxWindow &listen_to, |
36 | FbTk::ThemeProxy<WinButtonTheme> &theme, | 36 | FbTk::ThemeProxy<WinButtonTheme> &theme, |
37 | FbTk::ThemeProxy<WinButtonTheme> &pressed, | ||
37 | Type buttontype, const FbTk::FbWindow &parent, | 38 | Type buttontype, const FbTk::FbWindow &parent, |
38 | int x, int y, | 39 | int x, int y, |
39 | unsigned int width, unsigned int height): | 40 | unsigned int width, unsigned int height): |
40 | FbTk::Button(parent, x, y, width, height), | 41 | FbTk::Button(parent, x, y, width, height), |
41 | m_type(buttontype), m_listen_to(listen_to), m_theme(theme), | 42 | m_type(buttontype), m_listen_to(listen_to), |
43 | m_theme(theme), m_pressed_theme(pressed), | ||
42 | m_icon_pixmap(0), m_icon_mask(0), | 44 | m_icon_pixmap(0), m_icon_mask(0), |
43 | overrode_bg(false), overrode_pressed(false) { | 45 | overrode_bg(false), overrode_pressed(false) { |
44 | theme.reconfigSig().attach(this); | 46 | theme.reconfigSig().attach(this); |
@@ -108,64 +110,30 @@ void WinButton::setPressedColor(const FbTk::Color &color) { | |||
108 | } | 110 | } |
109 | 111 | ||
110 | Pixmap WinButton::getBackgroundPixmap() const { | 112 | Pixmap WinButton::getBackgroundPixmap() const { |
111 | bool focused = m_listen_to.isFocused(); | ||
112 | switch(m_type) { | 113 | switch(m_type) { |
113 | case MAXIMIZE: | 114 | case MAXIMIZE: |
114 | if (focused) | 115 | return m_theme->maximizePixmap().pixmap().drawable(); |
115 | return m_theme->maximizePixmap().pixmap().drawable(); | ||
116 | else | ||
117 | return m_theme->maximizeUnfocusPixmap().pixmap().drawable(); | ||
118 | break; | 116 | break; |
119 | case MINIMIZE: | 117 | case MINIMIZE: |
120 | if (focused) | 118 | return m_theme->iconifyPixmap().pixmap().drawable(); |
121 | return m_theme->iconifyPixmap().pixmap().drawable(); | ||
122 | else | ||
123 | return m_theme->iconifyUnfocusPixmap().pixmap().drawable(); | ||
124 | break; | 119 | break; |
125 | case STICK: | 120 | case STICK: |
126 | if (m_listen_to.isStuck()) { | 121 | if (m_listen_to.isStuck()) |
127 | if (focused) | 122 | return m_theme->stuckPixmap().pixmap().drawable(); |
128 | return m_theme->stuckPixmap().pixmap().drawable(); | 123 | return m_theme->stickPixmap().pixmap().drawable(); |
129 | else | ||
130 | return m_theme->stuckUnfocusPixmap().pixmap().drawable(); | ||
131 | } else { | ||
132 | if (focused) | ||
133 | return m_theme->stickPixmap().pixmap().drawable(); | ||
134 | else | ||
135 | return m_theme->stickUnfocusPixmap().pixmap().drawable(); | ||
136 | } | ||
137 | break; | 124 | break; |
138 | case CLOSE: | 125 | case CLOSE: |
139 | if (focused) | 126 | return m_theme->closePixmap().pixmap().drawable(); |
140 | return m_theme->closePixmap().pixmap().drawable(); | ||
141 | else | ||
142 | return m_theme->closeUnfocusPixmap().pixmap().drawable(); | ||
143 | break; | 127 | break; |
144 | case SHADE: | 128 | case SHADE: |
145 | if (m_listen_to.isShaded()) { | 129 | if (m_listen_to.isShaded()) |
146 | if (focused) | 130 | return m_theme->unshadePixmap().pixmap().drawable(); |
147 | return m_theme->unshadePixmap().pixmap().drawable(); | 131 | return m_theme->shadePixmap().pixmap().drawable(); |
148 | else | ||
149 | return m_theme->unshadeUnfocusPixmap().pixmap().drawable(); | ||
150 | } else { | ||
151 | if (focused) | ||
152 | return m_theme->shadePixmap().pixmap().drawable(); | ||
153 | else | ||
154 | return m_theme->shadeUnfocusPixmap().pixmap().drawable(); | ||
155 | } | ||
156 | break; | 132 | break; |
157 | case MENUICON: | 133 | case MENUICON: |
158 | if (m_icon_pixmap.drawable()) { | 134 | if (m_icon_pixmap.drawable()) |
159 | if (focused) | 135 | return m_theme->titlePixmap().pixmap().drawable(); |
160 | return m_theme->titleFocusPixmap().pixmap().drawable(); | 136 | return m_theme->menuiconPixmap().pixmap().drawable(); |
161 | else | ||
162 | return m_theme->titleUnfocusPixmap().pixmap().drawable(); | ||
163 | } else { | ||
164 | if (focused) | ||
165 | return m_theme->menuiconPixmap().pixmap().drawable(); | ||
166 | else | ||
167 | return m_theme->menuiconUnfocusPixmap().pixmap().drawable(); | ||
168 | } | ||
169 | break; | 137 | break; |
170 | } | 138 | } |
171 | return None; | 139 | return None; |
@@ -174,26 +142,23 @@ Pixmap WinButton::getBackgroundPixmap() const { | |||
174 | Pixmap WinButton::getPressedPixmap() const { | 142 | Pixmap WinButton::getPressedPixmap() const { |
175 | switch(m_type) { | 143 | switch(m_type) { |
176 | case MAXIMIZE: | 144 | case MAXIMIZE: |
177 | return m_theme->maximizePressedPixmap().pixmap().drawable(); | 145 | return m_pressed_theme->maximizePixmap().pixmap().drawable(); |
178 | case MINIMIZE: | 146 | case MINIMIZE: |
179 | return m_theme->iconifyPressedPixmap().pixmap().drawable(); | 147 | return m_pressed_theme->iconifyPixmap().pixmap().drawable(); |
180 | case STICK: | 148 | case STICK: |
181 | return m_theme->stickPressedPixmap().pixmap().drawable(); | 149 | return m_pressed_theme->stickPixmap().pixmap().drawable(); |
182 | case CLOSE: | 150 | case CLOSE: |
183 | return m_theme->closePressedPixmap().pixmap().drawable(); | 151 | return m_pressed_theme->closePixmap().pixmap().drawable(); |
184 | case SHADE: | 152 | case SHADE: |
185 | if (m_listen_to.isShaded()) | 153 | if (m_listen_to.isShaded()) |
186 | return m_theme->unshadePressedPixmap().pixmap().drawable(); | 154 | return m_pressed_theme->unshadePixmap().pixmap().drawable(); |
187 | else | 155 | else |
188 | return m_theme->shadePressedPixmap().pixmap().drawable(); | 156 | return m_pressed_theme->shadePixmap().pixmap().drawable(); |
189 | case MENUICON: | 157 | case MENUICON: |
190 | if (m_icon_pixmap.drawable()) | 158 | if (m_icon_pixmap.drawable()) |
191 | if (m_listen_to.isFocused()) | 159 | return m_theme->titlePixmap().pixmap().drawable(); |
192 | return m_theme->titleFocusPixmap().pixmap().drawable(); | ||
193 | else | ||
194 | return m_theme->titleUnfocusPixmap().pixmap().drawable(); | ||
195 | else | 160 | else |
196 | return m_theme->menuiconPressedPixmap().pixmap().drawable(); | 161 | return m_pressed_theme->menuiconPixmap().pixmap().drawable(); |
197 | } | 162 | } |
198 | return None; | 163 | return None; |
199 | } | 164 | } |