From 4586bf0fccc12328f6f876c527648f9260c406dc Mon Sep 17 00:00:00 2001
From: Michael R Sweet
Date: Tue, 9 Apr 2002 17:20:24 +0000
Subject: [PATCH] Tooltip fixes: ignore keyboard events, immediately disable
new tooltips, show tooltips for box widgets.
Add docos for Fl_Widget::tooltip() methods.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2060 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
---
CHANGES | 5 +
FL/Fl_Tooltip.H | 14 +-
documentation/Fl_Widget.html | 392 +++++++++++++++++++++++------------
src/Fl_Box.cxx | 6 +-
src/Fl_Group.cxx | 12 +-
src/Fl_Tooltip.cxx | 51 ++++-
src/Fl_Widget.cxx | 9 +-
7 files changed, 326 insertions(+), 163 deletions(-)
diff --git a/CHANGES b/CHANGES
index f5812e467..b9d68dd0f 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,10 @@
CHANGES IN FLTK 1.1.0b13
+ - Tooltips now appear for inactive and output widgets.
+ - Tooltips no longer steal keyboard events other than
+ ESCape.
+ - Tooltips are no longer delayed when moving between
+ adjacent widgets.
- fl_beep(FL_BEEP_DEFAULT) now uses the PC speaker under
Windows (0xFFFFFFFF) rather than an event sound.
- The configure script didn't include the -mwindows or
diff --git a/FL/Fl_Tooltip.H b/FL/Fl_Tooltip.H
index a7dea7cb6..11858d4f4 100644
--- a/FL/Fl_Tooltip.H
+++ b/FL/Fl_Tooltip.H
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Tooltip.H,v 1.16.2.5 2002/01/01 15:11:28 easysw Exp $"
+// "$Id: Fl_Tooltip.H,v 1.16.2.6 2002/04/09 17:20:23 easysw Exp $"
//
// Tooltip header file for the Fast Light Tool Kit (FLTK).
//
@@ -30,17 +30,17 @@
#include
-class Fl_TooltipBox;
-class Fl_Menu_Window;
+class Fl_Tooltip_Box;
+class Fl_Tooltip_Window;
class FL_EXPORT Fl_Tooltip {
- friend class Fl_TooltipBox;
+ friend class Fl_Tooltip_Box;
friend class Fl_Widget;
static float delay_;
- static Fl_TooltipBox *box;
- static Fl_Menu_Window *window;
+ static Fl_Tooltip_Box *box;
+ static Fl_Tooltip_Window *window;
static Fl_Widget *widget;
static int shown;
static unsigned color_;
@@ -76,5 +76,5 @@ public:
#endif
//
-// End of "$Id: Fl_Tooltip.H,v 1.16.2.5 2002/01/01 15:11:28 easysw Exp $".
+// End of "$Id: Fl_Tooltip.H,v 1.16.2.6 2002/04/09 17:20:23 easysw Exp $".
//
diff --git a/documentation/Fl_Widget.html b/documentation/Fl_Widget.html
index 7e4a55425..559e1f5fe 100644
--- a/documentation/Fl_Widget.html
+++ b/documentation/Fl_Widget.html
@@ -69,10 +69,10 @@ to call redraw() after these.
labelsize
labeltype
output
-parent
|
|
-Returns a pointer to the primary Fl_Window widget.
+Returns NULL if no window is associated with this
+widget. Note: for an Fl_Window widget, this returns
+its parent window (if any), not this window.
+
Fl_Boxtype Fl_Widget::box() const
void Fl_Widget::box(Fl_Boxtype)
- The box() identifies a routine that draws the background of
-the widget. See Box Types for the
-available types. The default depends on the widget, but is usually
-FL_NO_BOX or FL_UP_BOX.
+
+Gets or sets the box type for the widget, which identifies a
+routine that draws the background of the widget. See Box Types for the available
+types. The default depends on the widget, but is usually
+FL_NO_BOX or FL_UP_BOX.
+
Fl_Color Fl_Widget::color() const
-
void Fl_Widget::color(Fl_Color)
- This color is passed to the box routine. Color is an index into an
-internal table of rgb colors. For most widgets this defaults to
-FL_GRAY. See the
-enumeration list for predefined colors. Use
-Fl::set_color() to redefine colors.
+
void Fl_Widget::color(Fl_Color)
+
void Fl_Widget::color(Fl_Color, Fl_Color)
+
+Gets or sets the background color of the widget. The color is
+passed to the box routine. The color is either an index into an
+internal table of RGB colors or an RGB color value generated
+using fl_rgb_color(). The default for most widgets is
+FL_GRAY. See the enumeration list for
+predefined colors. Use Fl::set_color() to
+redefine colors.
+
+
The two color form sets both the background and selection
+colors. See the description of the selection_color()
+method for more information.
+
Fl_Color
Fl_Widget::selection_color() const
-
void Fl_Widget::selection_color(Fl_Color)
-
void Fl_Widget::color(Fl_Color, Fl_Color)
- For Forms compatibility a second color is defined. This is usually
-used to color the widget when it is selected, although some widgets use
-this color for other purposes. You can set both colors at once with
-color(a,b).
+
void Fl_Widget::selection_color(Fl_Color)
+
+Gets or sets the selection color, which is defined for Forms
+compatibility and is usually used to color the widget when it is
+selected, although some widgets use this color for other
+purposes. You can set both colors at once with
+color(a,b).
+
const char* Fl_Widget::label() const
void Fl_Widget::label(const char*)
- The label is printed somewhere on the widget or next to it. The
-string is not copied, the passed pointer is stored unchanged in
-the widget.
+
+Get or set the current label pointer. The label is shown
+somewhere on or next to the widget. The passed pointer is stored
+unchanged in the widget (the string is not copied), so if
+you need to set the label to a formatted value, make sure the
+buffer is static, global, or allocated.
+
void Fl_Widget::label(Fl_Labeltype,
const char*)
uchar Fl_Widget::labeltype() const
void Fl_Widget::labeltype(Fl_Labeltype)
- A labeltype identifies a routine that
-draws the label of the widget. This can be used for special effects
-such as emboss, or to use the label() pointer as another form
-of data such as a bitmap. The value FL_NORMAL_LABEL prints
-the label as text.
+
+Gets or sets the labeltype which
+identifies the function that draws the label of the widget. This
+is generally used for special effects such as embossing or for
+using the label() pointer as another form of data such
+as an icon. The value FL_NORMAL_LABEL prints the label
+as plain text.
+
Fl_Align Fl_Widget::align() const
void Fl_Widget::align(Fl_Align)
- How the label is printed next to or inside the widget. The default
-value is FL_ALIGN_CENTER, which centers the label. The value
-can be any of these constants or'd together:
+
+Gets or sets the label alignment, which controls how the
+label is displayed next to or inside the widget. The default
+value is FL_ALIGN_CENTER, which centers the label
+inside the widget. The value can be any of these constants
+bitwise-OR'd together:
+
-- FL_ALIGN_CENTER
-- FL_ALIGN_TOP
-- FL_ALIGN_BOTTOM
-- FL_ALIGN_LEFT
-- FL_ALIGN_RIGHT
-- FL_ALIGN_INSIDE
-- FL_ALIGN_CLIP
-- FL_ALIGN_WRAP
+ - FL_ALIGN_BOTTOM
+ - FL_ALIGN_CENTER
+ - FL_ALIGN_CLIP
+ - FL_ALIGN_INSIDE
+ - FL_ALIGN_LEFT
+ - FL_ALIGN_RIGHT
+ - FL_ALIGN_TEXT_OVER_IMAGE
+ - FL_ALIGN_TOP
+ - FL_ALIGN_WRAP
+
Fl_Color Fl_Widget::labelcolor() const
void Fl_Widget::labelcolor(Fl_Color)
- This color is passed to the labeltype routine, and is typically the
-color of the label text. This defaults to FL_BLACK.
+
+Gets or sets the label color. The default color is FL_BLACK.
+
Fl_Font Fl_Widget::labelfont() const
void Fl_Widget::labelfont(Fl_Font)
- Fonts are identified by small 8-bit indexes into a table. See the
-enumeration list for predefined typefaces. The default value uses a
-Helvetica typeface (Arial for Microsoft® Windows®). The function
-Fl::set_font() can define new typefaces.
+
+Gets or sets the font to use. Fonts are identified by small
+8-bit indexes into a table. See the enumeration list for
+predefined typefaces. The default value uses a Helvetica
+typeface (Arial for Microsoft® Windows®). The function
+Fl::set_font() can
+define new typefaces.
+
uchar Fl_Widget::labelsize() const
-
void Fl_Widget::labelsize(uchar)
- Fonts are further identified by a point size. The default is 14.
-typedef void (Fl_Callback)(Fl_Widget*,
-void*)
-
Fl_Callback* Fl_Widget::callback() const
-
void Fl_Widget::callback(Fl_Callback*, void* = 0)
- Each widget has a single callback. You can set it or examine it with
-these methods.
+
void Fl_Widget::labelsize(uchar)
+
+Gets or sets the font size in pixels. The default size is 14
+pixels.
+
+
typedef void (Fl_Callback)(Fl_Widget*, void*)
+
Fl_Callback* Fl_Widget::callback() const
+
void Fl_Widget::callback(Fl_Callback*, void* = 0)
+
void Fl_Widget::callback(void (*)(Fl_Widget*, long), long = 0)
+
void Fl_Widget::callback(void (*)(Fl_Widget*))
+
+Gets or sets the current callback function for the widget.
+Each widget has a single callback.
+
void* Fl_Widget::user_data() const
-
void Fl_Widget::user_data(void*)
- You can also just change the void * second argument to the
-callback with the user_data methods.
-void Fl_Widget::callback(void
-(*)(Fl_Widget*, long), long = 0)
-
long Fl_Widget::argument() const
+
void Fl_Widget::user_data(void*)
+
+Gets or sets the current user data (void *) argument
+that is passed to the callback function.
+
+
long Fl_Widget::argument() const
void Fl_Widget::argument(long)
- For convenience you can also define the callback as taking a long
-argument. This is implemented by casting this to a Fl_Callback
- and casting the long to a void * and may not be
-portable to some machines.
-void Fl_Widget::callback(void (*)(Fl_Widget*))
- For convenience you can also define the callback as taking only one
-argument. This is implemented by casting this to a Fl_Callback
- and may not be portable to some machines.
+
+Gets or sets the current user data (long) argument
+that is passed to the callback function.
+
+
+
+ Note:
+
+ This is implemented by casting the long
+ value to a void * and may not be portable on
+ some machines.
+
+ |
+
+
+
void Fl_Widget::do_callback()
void Fl_Widget::do_callback(Fl_Widget*, void* = 0)
void Fl_Widget::do_callback(Fl_Widget*, long)
- You can cause a widget to do its callback at any time, and even pass
-arbitrary arguments.
+
+Causes a widget to invoke its callback function, optionally
+with arbitrary arguments.
+
int Fl_Widget::changed() const
void Fl_Widget::set_changed()
void Fl_Widget::clear_changed()
-Fl_Widget::changed() is a flag that is turned on when the user
-changes the value stored in the widget. This is only used by
-subclasses of Fl_Widget that store values, but is in the base
-class so it is easier to scan all the widgets in a panel and
-do_callback() on the changed ones in response to an "OK" button.
+
+Fl_Widget::changed() is a flag that is turned on
+when the user changes the value stored in the widget. This is
+only used by subclasses of Fl_Widget that store values,
+but is in the base class so it is easier to scan all the widgets
+in a panel and do_callback() on the changed ones in
+response to an "OK" button.
+
Most widgets turn this flag off when they do the callback, and when
the program sets the stored value.
+
Fl_When Fl_Widget::when() const
void Fl_Widget::when(Fl_When)
-Fl_Widget::when() is a set of bitflags used by subclasses of
-Fl_Widget to decide when to do the callback. If the value is zero
-then the callback is never done. Other values are described in the
-individual widgets. This field is in the base class so that you can
-scan a panel and do_callback() on all the ones that don't do
-their own callbacks in response to an "OK" button.
+
+Fl_Widget::when() is a set of bitflags used by
+subclasses of Fl_Widget to decide when to do the
+callback. If the value is zero then the callback is never
+done. Other values are described in the individual widgets.
+This field is in the base class so that you can scan a panel and
+do_callback() on all the ones that don't do their own
+callbacks in response to an "OK" button.
+
static void
Fl_Widget::default_callback(Fl_Widget*, void*)
- The default callback, which puts a pointer to the widget on the queue
-returned by Fl::readqueue()
-. You may want to call this from your own callback.
+
+The default callback, which puts a pointer to the widget on
+the queue returned by Fl::readqueue(). You
+may want to call this from your own callback.
+
int Fl_Widget::visible() const
int Fl_Widget::visible_r() const
void Fl_Widget::show()
void Fl_Widget::hide()
-An invisible widget never gets redrawn and does not get events. The
-visible() method returns true if the widget is set to be
-visible.The visible_r() method returns true if the widget and
-all of its parents are visible. A widget is only visible if
-visible() is true on it and all of its parents.
+
+An invisible widget never gets redrawn and does not get
+events. The visible() method returns true if the
+widget is set to be visible.The visible_r() method
+returns true if the widget and all of its parents are visible. A
+widget is only visible if visible() is true on it
+and all of its parents.
+
Changing it will send FL_SHOW or FL_HIDE
events to the widget. Do not change it if the parent is not
visible, as this will send false FL_SHOW or FL_HIDE
events to the widget. redraw() is called if necessary on
this or the parent.
+
int Fl_Widget::active() const
int Fl_Widget::active_r() const
void Fl_Widget::activate()
void Fl_Widget::deactivate()
-Fl_Widget::active() returns whether the widget is active.
-Fl_Widget::active_r() returns whether the widget and all of
-its parents are active. An inactive widget does not get any events,
-but it does get redrawn. A widget is only active if active() is
-true on it and all of its parents.
+
+Fl_Widget::active() returns whether the widget is
+active. Fl_Widget::active_r() returns whether the
+widget and all of its parents are active. An inactive widget
+does not get any events, but it does get redrawn. A widget is
+only active if active() is true on it and all of its
+parents.
+
Changing this value will send FL_ACTIVATE or
FL_DEACTIVATE to the widget if active_r() is true.
Currently you cannot deactivate Fl_Window widgets.
@@ -277,34 +368,47 @@ FL_DEACTIVATE to the widget if active_r() is true.
int Fl_Widget::output() const
void Fl_Widget::set_output()
void Fl_Widget::clear_output()
-output() means the same as !active() except it does
-not change how the widget is drawn. The widget will not receive any
-events. This is useful for making scrollbars or buttons that work as
-displays rather than input devices.
-int Fl_Widget::takesevents() const
-
-This is the same as (active() && visible() &&
+output() means the same as !active() except
+it does not change how the widget is drawn. The widget will not
+receive any events. This is useful for making scrollbars or
+buttons that work as displays rather than input devices.
+
+
int Fl_Widget::takesevents() const
+
+This is the same as (active() && visible() &&
!output()) but is faster.
+
void Fl_Widget::redraw()
- Mark the widget as needing its draw() routine called.
+
+Marks the widget as needing its draw() routine called.
+
uchar Fl_Widget::damage() const
- Non-zero if draw() needs to be called. Actually this is a
-bit field that the widget subclass can use to figure out what parts to
-draw.
+
+Non-zero if draw() needs to be
+called. The damage value is actually a bit field that the widget
+subclass can use to figure out what parts to draw.
+
Fl_Group *Fl_Widget::parent() const
-Returns a pointer to the parent widget. Usually this is a Returns a pointer to the parent widget. Usually this is a Fl_Group or Fl_Window. Returns
-NULL if none.
+HREF="Fl_Window.html#Fl_Window">Fl_Window. Returns
+NULL if the widget has no parent.
int Fl_Widget::contains(Fl_Widget* b) const
-Returns true if b is a child of this widget, or is equal to
-this widget. Returns false if b is NULL.
+
+Returns 1 if b is a child of this widget, or is
+equal to this widget. Returns 0 if b is NULL.
+
int Fl_Widget::inside(const Fl_Widget* a)
const
- Returns true if this is a child of a, or is equal to a
-. Returns false if a is NULL.
+
+Returns 1 if this widget is a child of a, or is
+equal to a. Returns 0 if a is NULL.
+
int Fl_Widget::take_focus()
Tries to make this widget be the Fl::focus() widget, by first
sending it an FL_FOCUS event, and if it returns non-zero,
@@ -316,10 +420,30 @@ accepted the focus.
void Fl_Widget::deimage(Fl_Image* a)
void Fl_Widget::deimage(Fl_Image& a)
+Gets or sets the image to use as part of the widget label.
+This image is used when drawing the widget in the inactive
+state.
+
Fl_Image* Fl_Widget::image()
void Fl_Widget::image(Fl_Image* a)
void Fl_Widget::image(Fl_Image& a)
-int Fl_Widget::handle(int)
+Gets or sets the image to use as part of the widget label.
+This image is used when drawing the widget in the active state.
-