diff options
Diffstat (limited to 'src/TooltipWindow.hh')
-rw-r--r-- | src/TooltipWindow.hh | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/src/TooltipWindow.hh b/src/TooltipWindow.hh index 03abc1d..401e442 100644 --- a/src/TooltipWindow.hh +++ b/src/TooltipWindow.hh | |||
@@ -17,9 +17,10 @@ | |||
17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | 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 | 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 | 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE.#ifndef TOOLTIPWINDOW_HH_ | 20 | // DEALINGS IN THE SOFTWARE. |
21 | #ifndef TOOLTIPWINDOW_HH_ | 21 | |
22 | #define TOOLTIPWINDOW_HH_ | 22 | #ifndef TOOLTIPWINDOW_HH |
23 | #define TOOLTIPWINDOW_HH | ||
23 | 24 | ||
24 | #include "OSDWindow.hh" | 25 | #include "OSDWindow.hh" |
25 | #include "FbTk/Command.hh" | 26 | #include "FbTk/Command.hh" |
@@ -27,27 +28,38 @@ | |||
27 | #include "FbTk/Timer.hh" | 28 | #include "FbTk/Timer.hh" |
28 | #include "FbTk/SimpleCommand.hh" | 29 | #include "FbTk/SimpleCommand.hh" |
29 | 30 | ||
30 | 31 | /** | |
32 | * Displays a tooltip window | ||
33 | */ | ||
31 | class TooltipWindow : public OSDWindow { | 34 | class TooltipWindow : public OSDWindow { |
32 | public: | 35 | public: |
33 | TooltipWindow(const FbTk::FbWindow &parent, BScreen &screen, | 36 | TooltipWindow(const FbTk::FbWindow &parent, BScreen &screen, |
34 | FbTk::ThemeProxy<FbWinFrameTheme> &theme); | 37 | FbTk::ThemeProxy<FbWinFrameTheme> &theme); |
35 | 38 | /** | |
39 | * Sets the text in the window and starts the display timer. | ||
40 | * @param text the text to show in the window. | ||
41 | */ | ||
36 | void showText(const std::string &text); | 42 | void showText(const std::string &text); |
37 | void setDelay(int iDelay) { | 43 | /// updates the text directly without any delay |
38 | delay = iDelay; | 44 | void updateText(const std::string &text); |
39 | timer.setTimeout(delay); | 45 | |
46 | /// Sets the delay before the window pops up | ||
47 | void setDelay(int delay) { | ||
48 | m_delay = delay; | ||
49 | m_timer.setTimeout(delay); | ||
40 | } | 50 | } |
41 | void hide() ; | 51 | |
52 | void hide(); | ||
53 | |||
42 | 54 | ||
43 | private: | 55 | private: |
44 | void raiseTooltip(); | 56 | void raiseTooltip(); |
45 | void show(); | 57 | void show(); |
46 | int delay; | 58 | int m_delay; ///< delay time for the timer |
47 | std::string lastText; | 59 | std::string m_lastText; ///< last text to be displayed |
48 | FbTk::Timer timer; | 60 | FbTk::Timer m_timer; ///< delay timer before the tooltip will show |
49 | }; | 61 | }; |
50 | 62 | ||
51 | 63 | ||
52 | 64 | ||
53 | #endif /*TOOLTIPWINDOW_HH_*/ | 65 | #endif // TOOLTIPWINDOW_HH_ |