aboutsummaryrefslogtreecommitdiff
path: root/src/ClockTool.cc
diff options
context:
space:
mode:
authorsimonb <simonb>2005-04-27 15:15:36 (GMT)
committersimonb <simonb>2005-04-27 15:15:36 (GMT)
commit9970dd11c7f9c0d9d91601c9e9785a857ca2c6d8 (patch)
tree5c2ed44be50661b590b7a2771a1fad6d4e845177 /src/ClockTool.cc
parent8a43bec0e8da33da4b8147658af0516c536a3309 (diff)
downloadfluxbox-9970dd11c7f9c0d9d91601c9e9785a857ca2c6d8.zip
fluxbox-9970dd11c7f9c0d9d91601c9e9785a857ca2c6d8.tar.bz2
fix a few more bugs with recent reworking stuff
Some fixes could incidentally fix a few other bugs... the flaws were pre-existing, I've just been weeding out a lot of duplication
Diffstat (limited to 'src/ClockTool.cc')
-rw-r--r--src/ClockTool.cc32
1 files changed, 15 insertions, 17 deletions
diff --git a/src/ClockTool.cc b/src/ClockTool.cc
index 6b23ee7..ce50132 100644
--- a/src/ClockTool.cc
+++ b/src/ClockTool.cc
@@ -46,8 +46,6 @@
46 #include <time.h> 46 #include <time.h>
47#endif 47#endif
48#include <string> 48#include <string>
49#include <iostream>
50using namespace std;
51 49
52class ClockMenuItem: public FbTk::MenuItem { 50class ClockMenuItem: public FbTk::MenuItem {
53public: 51public:
@@ -220,6 +218,10 @@ void ClockTool::update(FbTk::Subject *subj) {
220 resize(new_width, m_button.height()); 218 resize(new_width, m_button.height());
221 resizeSig().notify(); 219 resizeSig().notify();
222 } 220 }
221
222 if (subj != 0 && typeid(*subj) == typeid(ToolTheme))
223 renderTheme(m_button.alpha());
224
223} 225}
224 226
225unsigned int ClockTool::borderWidth() const { 227unsigned int ClockTool::borderWidth() const {
@@ -249,13 +251,10 @@ void ClockTool::updateTime() {
249 if (!strftime(time_string, 255, m_timeformat->c_str(), time_type) || m_button.text() == time_string) 251 if (!strftime(time_string, 255, m_timeformat->c_str(), time_type) || m_button.text() == time_string)
250 return; 252 return;
251 m_button.setText(time_string); 253 m_button.setText(time_string);
252 m_button.parentMoved();
253#else // dont have strftime so we have to set it to hour:minut 254#else // dont have strftime so we have to set it to hour:minut
254 // sprintf(time_string, "%d:%d", ); 255 // sprintf(time_string, "%d:%d", );
255#endif // HAVE_STRFTIME 256#endif // HAVE_STRFTIME
256 } 257 }
257
258 m_button.clear();
259} 258}
260 259
261// Just change things that affect the size 260// Just change things that affect the size
@@ -266,28 +265,27 @@ void ClockTool::updateSizing() {
266} 265}
267 266
268void ClockTool::reRender() { 267void ClockTool::reRender() {
268 if (m_pixmap)
269 m_screen.imageControl().removeImage(m_pixmap);
270
269 if (m_theme.texture().usePixmap()) { 271 if (m_theme.texture().usePixmap()) {
270 if (m_pixmap)
271 m_screen.imageControl().removeImage(m_pixmap);
272 m_pixmap = m_screen.imageControl().renderImage(width(), height(), 272 m_pixmap = m_screen.imageControl().renderImage(width(), height(),
273 m_theme.texture()); 273 m_theme.texture());
274 m_button.setBackgroundPixmap(m_pixmap); 274 m_button.setBackgroundPixmap(m_pixmap);
275 } 275 } else {
276}
277
278void ClockTool::renderTheme(unsigned char alpha) {
279 if (!m_theme.texture().usePixmap()) {
280 if (m_pixmap)
281 m_screen.imageControl().removeImage(m_pixmap);
282 m_pixmap = 0; 276 m_pixmap = 0;
283 m_button.setBackgroundColor(m_theme.texture().color()); 277 m_button.setBackgroundColor(m_theme.texture().color());
284 } else {
285 reRender();
286 } 278 }
279}
287 280
281
282void ClockTool::renderTheme(unsigned char alpha) {
283 m_button.setAlpha(alpha);
288 m_button.setJustify(m_theme.justify()); 284 m_button.setJustify(m_theme.justify());
285
286 reRender();
287
289 m_button.setBorderWidth(m_theme.border().width()); 288 m_button.setBorderWidth(m_theme.border().width());
290 m_button.setBorderColor(m_theme.border().color()); 289 m_button.setBorderColor(m_theme.border().color());
291 m_button.setAlpha(alpha);
292 m_button.clear(); 290 m_button.clear();
293} 291}