1 | // "$Id: Tooltip.h 4218 2005-03-31 05:14:08Z spitzak $" |
---|
2 | // |
---|
3 | // Copyright 1998-2005 by Bill Spitzak and others. |
---|
4 | // |
---|
5 | // This library is free software; you can redistribute it and/or |
---|
6 | // modify it under the terms of the GNU Library General Public |
---|
7 | // License as published by the Free Software Foundation; either |
---|
8 | // version 2 of the License, or (at your option) any later version. |
---|
9 | // |
---|
10 | // This library is distributed in the hope that it will be useful, |
---|
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
13 | // Library General Public License for more details. |
---|
14 | // |
---|
15 | // You should have received a copy of the GNU Library General Public |
---|
16 | // License along with this library; if not, write to the Free Software |
---|
17 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
---|
18 | // USA. |
---|
19 | // |
---|
20 | // Please report all bugs and problems to "fltk-bugs@fltk.org". |
---|
21 | |
---|
22 | #ifndef fltk_Tooltip_h |
---|
23 | #define fltk_Tooltip_h |
---|
24 | |
---|
25 | #include "MenuWindow.h" |
---|
26 | |
---|
27 | namespace fltk { |
---|
28 | |
---|
29 | class FL_API Tooltip : public MenuWindow { |
---|
30 | public: |
---|
31 | Tooltip(); |
---|
32 | void draw(); |
---|
33 | void layout(); |
---|
34 | |
---|
35 | static float delay() { return delay_; } |
---|
36 | static void delay(float f) { delay_ = f; } |
---|
37 | static bool enabled() { return enabled_; } |
---|
38 | static void enable(bool b = true) { enabled_ = b; } |
---|
39 | static void disable() { enabled_ = false; } |
---|
40 | |
---|
41 | typedef const char* (*Generator)(Widget*, void*); |
---|
42 | static void enter(Widget*, const Rectangle&, Generator, void* = 0); |
---|
43 | static void enter(Widget*, const Rectangle&, const char* text); |
---|
44 | static void enter(Widget*); |
---|
45 | static void current(Widget*); |
---|
46 | static void exit(); |
---|
47 | |
---|
48 | static Widget* current_widget() { return current_widget_; } |
---|
49 | static const Rectangle& current_rectangle() { return current_rectangle_; } |
---|
50 | static Generator current_generator() { return current_generator_; } |
---|
51 | static void* current_data() { return current_data_; } |
---|
52 | static Tooltip* instance() { return instance_; } |
---|
53 | |
---|
54 | static NamedStyle* default_style; |
---|
55 | #ifdef FLTK_1_WIDGET // back-compatability section: |
---|
56 | static Widget* current() { return current_widget_; } |
---|
57 | static Font* font() { return default_style->textfont(); } |
---|
58 | static void font(Font* i) { default_style->textfont(i); } |
---|
59 | static float size() { return default_style->labelsize(); } |
---|
60 | static void size(float s) { default_style->labelsize(s); } |
---|
61 | static void textcolor(Color c){ default_style->labelcolor(c); } |
---|
62 | static Color textcolor() { return default_style->labelcolor(); } |
---|
63 | static void color(Color c) { default_style->color(c); } |
---|
64 | static Color color() { return default_style->color(); } |
---|
65 | static void box(Box* b) { default_style->box(b); } |
---|
66 | static Box* box() { return default_style->box(); } |
---|
67 | #endif |
---|
68 | |
---|
69 | private: |
---|
70 | static float delay_; |
---|
71 | static bool enabled_; |
---|
72 | static Widget* current_widget_; |
---|
73 | static Rectangle current_rectangle_; |
---|
74 | static Generator current_generator_; |
---|
75 | static void* current_data_; |
---|
76 | static Tooltip* instance_; |
---|
77 | static void tooltip_timeout(void*); |
---|
78 | }; |
---|
79 | |
---|
80 | } |
---|
81 | |
---|
82 | #endif |
---|
83 | |
---|
84 | // |
---|
85 | // End of "$Id: Tooltip.h 4218 2005-03-31 05:14:08Z spitzak $". |
---|
86 | // |
---|