diff options
author | Matteo Galiazzo <matteo@maltesenarrazioni.it> | 2008-05-05 12:05:52 (GMT) |
---|---|---|
committer | Mark Tiefenbruck <mark@fluxbox.org> | 2008-05-05 12:05:52 (GMT) |
commit | 4a3be045b28edac4953be9f195640654f8b5a1a1 (patch) | |
tree | 4b2e6466b54a5fb4bb6406ff9cf38c420be032df /src/FbTk/TextButton.cc | |
parent | ba604ac821b7c1c89d10b0e8c9f85fde948856ef (diff) | |
download | fluxbox_pavel-4a3be045b28edac4953be9f195640654f8b5a1a1.zip fluxbox_pavel-4a3be045b28edac4953be9f195640654f8b5a1a1.tar.bz2 |
add tooltips for iconbar buttons when title is too long to fit
Diffstat (limited to 'src/FbTk/TextButton.cc')
-rw-r--r-- | src/FbTk/TextButton.cc | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/FbTk/TextButton.cc b/src/FbTk/TextButton.cc index 561fe21..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,6 +181,23 @@ 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 | |||
185 | bool 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 | |||
186 | void TextButton::exposeEvent(XExposeEvent &event) { | 201 | void 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 | } |