aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/FbTk/TextButton.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/FbTk/TextButton.cc b/src/FbTk/TextButton.cc
index 611580c..a177f25 100644
--- a/src/FbTk/TextButton.cc
+++ b/src/FbTk/TextButton.cc
@@ -143,11 +143,17 @@ void TextButton::drawText(int x_offset, int y_offset, FbDrawable *drawable) {
143 unsigned int textlen = visual.size(); 143 unsigned int textlen = visual.size();
144 unsigned int button_width = width(); 144 unsigned int button_width = width();
145 unsigned int button_height = height(); 145 unsigned int button_height = height();
146 const int max_width = static_cast<int>(button_width) - x_offset -
147 m_left_padding - m_right_padding;
148
149 if (max_width <= bevel()) {
150 return;
151 }
146 152
147 translateSize(m_orientation, button_width, button_height); 153 translateSize(m_orientation, button_width, button_height);
148 154
149 // horizontal alignment, cut off text if needed 155 // horizontal alignment, cut off text if needed
150 int align_x = FbTk::doAlignment(button_width - x_offset - m_left_padding - m_right_padding, 156 int align_x = FbTk::doAlignment(max_width,
151 bevel(), justify(), font(), 157 bevel(), justify(), font(),
152 visual.data(), visual.size(), 158 visual.data(), visual.size(),
153 textlen); // return new text len 159 textlen); // return new text len