aboutsummaryrefslogtreecommitdiff
path: root/src/IconButton.cc
diff options
context:
space:
mode:
authorMatteo Galiazzo <matteo@maltesenarrazioni.it>2008-05-05 12:05:52 (GMT)
committerMark Tiefenbruck <mark@fluxbox.org>2008-05-05 12:05:52 (GMT)
commit4a3be045b28edac4953be9f195640654f8b5a1a1 (patch)
tree4b2e6466b54a5fb4bb6406ff9cf38c420be032df /src/IconButton.cc
parentba604ac821b7c1c89d10b0e8c9f85fde948856ef (diff)
downloadfluxbox-4a3be045b28edac4953be9f195640654f8b5a1a1.zip
fluxbox-4a3be045b28edac4953be9f195640654f8b5a1a1.tar.bz2
add tooltips for iconbar buttons when title is too long to fit
Diffstat (limited to 'src/IconButton.cc')
-rw-r--r--src/IconButton.cc17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/IconButton.cc b/src/IconButton.cc
index 09791c8..6b8118e 100644
--- a/src/IconButton.cc
+++ b/src/IconButton.cc
@@ -52,7 +52,8 @@ IconButton::IconButton(const FbTk::FbWindow &parent,
52 FbTk::TextButton(parent, focused_theme->text().font(), win.title()), 52 FbTk::TextButton(parent, focused_theme->text().font(), win.title()),
53 m_win(win), 53 m_win(win),
54 m_icon_window(*this, 1, 1, 1, 1, 54 m_icon_window(*this, 1, 1, 1, 1,
55 ExposureMask | ButtonPressMask | ButtonReleaseMask), 55 ExposureMask |EnterWindowMask | LeaveWindowMask |
56 ButtonPressMask | ButtonReleaseMask),
56 m_use_pixmap(true), 57 m_use_pixmap(true),
57 m_theme(win, focused_theme, unfocused_theme), 58 m_theme(win, focused_theme, unfocused_theme),
58 m_pm(win.screen().imageControl()) { 59 m_pm(win.screen().imageControl()) {
@@ -79,6 +80,20 @@ void IconButton::exposeEvent(XExposeEvent &event) {
79 FbTk::TextButton::exposeEvent(event); 80 FbTk::TextButton::exposeEvent(event);
80} 81}
81 82
83void IconButton::enterNotifyEvent(XCrossingEvent &ev) {
84
85 int xoffset = 1;
86 if (m_icon_pixmap.drawable() != 0)
87 xoffset = m_icon_window.x() + m_icon_window.width() + 1;
88
89 if (FbTk::TextButton::textExceeds(xoffset))
90 m_win.screen().showTooltip(m_win.title());
91}
92
93void IconButton::leaveNotifyEvent(XCrossingEvent &ev) {
94 m_win.screen().hideTooltip();
95}
96
82void IconButton::moveResize(int x, int y, 97void IconButton::moveResize(int x, int y,
83 unsigned int width, unsigned int height) { 98 unsigned int width, unsigned int height) {
84 99