summaryrefslogtreecommitdiff
path: root/src/FbTk/TextButton.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/TextButton.cc')
-rw-r--r--src/FbTk/TextButton.cc25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/FbTk/TextButton.cc b/src/FbTk/TextButton.cc
index 5a7afa6..f259d89 100644
--- a/src/FbTk/TextButton.cc
+++ b/src/FbTk/TextButton.cc
@@ -158,11 +158,9 @@ void TextButton::drawText(int x_offset, int y_offset, FbDrawable *drawable) {
158 translateSize(m_orientation, textw, texth); 158 translateSize(m_orientation, textw, texth);
159 159
160 int align_x = FbTk::doAlignment(textw - x_offset - m_left_padding - m_right_padding, 160 int align_x = FbTk::doAlignment(textw - x_offset - m_left_padding - m_right_padding,
161 bevel(), 161 bevel(), justify(), font(),
162 justify(),
163 font(),
164 text().data(), text().size(), 162 text().data(), text().size(),
165 textlen); // return new text lne 163 textlen); // return new text len
166 164
167 // center text by default 165 // center text by default
168 int center_pos = texth/2 + font().ascent()/2 - 1; 166 int center_pos = texth/2 + font().ascent()/2 - 1;
@@ -183,8 +181,25 @@ void TextButton::drawText(int x_offset, int y_offset, FbDrawable *drawable) {
183 textx, texty, m_orientation); // position 181 textx, texty, m_orientation); // position
184} 182}
185 183
184
185bool TextButton::textExceeds(int x_offset) {
186
187 unsigned int textlen = text().size();
188 // do text alignment
189
190 unsigned int textw = width(), texth = height();
191 translateSize(m_orientation, textw, texth);
192
193 FbTk::doAlignment(textw - x_offset - m_left_padding - m_right_padding,
194 bevel(), justify(), font(), text().data(), text().size(),
195 textlen); // return new text len
196
197 return text().size()>textlen;
198
199}
200
186void TextButton::exposeEvent(XExposeEvent &event) { 201void TextButton::exposeEvent(XExposeEvent &event) {
187 clearArea(event.x, event.y, event.width, event.height, false); 202 clearArea(event.x, event.y, event.width, event.height, false);
188} 203}
189 204
190}; // end namespace FbTk 205} // end namespace FbTk