diff options
author | Mathias Gumz <akira at fluxbox dot org> | 2008-08-14 05:52:39 (GMT) |
---|---|---|
committer | Mathias Gumz <akira at fluxbox dot org> | 2008-08-14 05:52:39 (GMT) |
commit | e169d33552c8e7070aa6e13da0187f2013b4cfc3 (patch) | |
tree | ae9e92c7e885791c7f47645184070cbcd441ab94 /src/TooltipWindow.hh | |
parent | c82e7c0080f8a5c14dcf95ec92dc42f59ea9dd8b (diff) | |
parent | 91ca3bc5c8e2b892a9a81b18246f72aba7deebfd (diff) | |
download | fluxbox-e169d33552c8e7070aa6e13da0187f2013b4cfc3.zip fluxbox-e169d33552c8e7070aa6e13da0187f2013b4cfc3.tar.bz2 |
Merge branch 'master' into to_push
Diffstat (limited to 'src/TooltipWindow.hh')
-rw-r--r-- | src/TooltipWindow.hh | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/src/TooltipWindow.hh b/src/TooltipWindow.hh new file mode 100644 index 0000000..401e442 --- /dev/null +++ b/src/TooltipWindow.hh | |||
@@ -0,0 +1,65 @@ | |||
1 | // TooltipWindow.hh | ||
2 | // Copyright (c) 2008 Fluxbox Team (fluxgen at fluxbox dot org) | ||
3 | // | ||
4 | // Permission is hereby granted, free of charge, to any person obtaining a | ||
5 | // copy of this software and associated documentation files (the "Software"), | ||
6 | // to deal in the Software without restriction, including without limitation | ||
7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | // and/or sell copies of the Software, and to permit persons to whom the | ||
9 | // Software is furnished to do so, subject to the following conditions: | ||
10 | // | ||
11 | // The above copyright notice and this permission notice shall be included in | ||
12 | // all copies or substantial portions of the Software. | ||
13 | // | ||
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
20 | // DEALINGS IN THE SOFTWARE. | ||
21 | |||
22 | #ifndef TOOLTIPWINDOW_HH | ||
23 | #define TOOLTIPWINDOW_HH | ||
24 | |||
25 | #include "OSDWindow.hh" | ||
26 | #include "FbTk/Command.hh" | ||
27 | #include "FbTk/RefCount.hh" | ||
28 | #include "FbTk/Timer.hh" | ||
29 | #include "FbTk/SimpleCommand.hh" | ||
30 | |||
31 | /** | ||
32 | * Displays a tooltip window | ||
33 | */ | ||
34 | class TooltipWindow : public OSDWindow { | ||
35 | public: | ||
36 | TooltipWindow(const FbTk::FbWindow &parent, BScreen &screen, | ||
37 | FbTk::ThemeProxy<FbWinFrameTheme> &theme); | ||
38 | /** | ||
39 | * Sets the text in the window and starts the display timer. | ||
40 | * @param text the text to show in the window. | ||
41 | */ | ||
42 | void showText(const std::string &text); | ||
43 | /// updates the text directly without any delay | ||
44 | void updateText(const std::string &text); | ||
45 | |||
46 | /// Sets the delay before the window pops up | ||
47 | void setDelay(int delay) { | ||
48 | m_delay = delay; | ||
49 | m_timer.setTimeout(delay); | ||
50 | } | ||
51 | |||
52 | void hide(); | ||
53 | |||
54 | |||
55 | private: | ||
56 | void raiseTooltip(); | ||
57 | void show(); | ||
58 | int m_delay; ///< delay time for the timer | ||
59 | std::string m_lastText; ///< last text to be displayed | ||
60 | FbTk::Timer m_timer; ///< delay timer before the tooltip will show | ||
61 | }; | ||
62 | |||
63 | |||
64 | |||
65 | #endif // TOOLTIPWINDOW_HH_ | ||