aboutsummaryrefslogtreecommitdiff
path: root/src/ClockTool.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/ClockTool.cc')
-rw-r--r--src/ClockTool.cc17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/ClockTool.cc b/src/ClockTool.cc
index a8348ed..8a5077b 100644
--- a/src/ClockTool.cc
+++ b/src/ClockTool.cc
@@ -215,9 +215,13 @@ void ClockTool::update(FbTk::Subject *subj) {
215 // + 2 to make the entire text fit inside 215 // + 2 to make the entire text fit inside
216 std::string text(m_button.text().size() + 2, '0'); 216 std::string text(m_button.text().size() + 2, '0');
217 217
218 int new_width = m_theme.font().textWidth(text.c_str(), text.size()); 218 unsigned int new_width = m_button.width();
219 if (new_width != m_button.width()) { 219 unsigned int new_height = m_button.height();
220 resize(new_width, m_button.height()); 220 translateSize(orientation(), new_width, new_height);
221 new_width = m_theme.font().textWidth(text.c_str(), text.size());
222 translateSize(orientation(), new_width, new_height);
223 if (new_width != m_button.width() || new_height != m_button.height()) {
224 resize(new_width, new_height);
221 resizeSig().notify(); 225 resizeSig().notify();
222 } 226 }
223 227
@@ -272,7 +276,7 @@ void ClockTool::reRender() {
272 276
273 if (m_theme.texture().usePixmap()) { 277 if (m_theme.texture().usePixmap()) {
274 m_pixmap = m_screen.imageControl().renderImage(width(), height(), 278 m_pixmap = m_screen.imageControl().renderImage(width(), height(),
275 m_theme.texture()); 279 m_theme.texture(), orientation());
276 m_button.setBackgroundPixmap(m_pixmap); 280 m_button.setBackgroundPixmap(m_pixmap);
277 } else { 281 } else {
278 m_pixmap = 0; 282 m_pixmap = 0;
@@ -291,3 +295,8 @@ void ClockTool::renderTheme(unsigned char alpha) {
291 m_button.setBorderColor(m_theme.border().color()); 295 m_button.setBorderColor(m_theme.border().color());
292 m_button.clear(); 296 m_button.clear();
293} 297}
298
299void ClockTool::setOrientation(FbTk::Orientation orient) {
300 m_button.setOrientation(orient);
301 ToolbarItem::setOrientation(orient);
302}