FLTK 1.3.3
|
Fl_Widget is the base class for all widgets in FLTK. More...
#include <Fl_Widget.H>
Public Member Functions | |
void | _clear_fullscreen () |
void | _set_fullscreen () |
void | activate () |
Activates the widget. More... | |
unsigned int | active () const |
Returns whether the widget is active. More... | |
int | active_r () const |
Returns whether the widget and all of its parents are active. More... | |
Fl_Align | align () const |
Gets the label alignment. More... | |
void | align (Fl_Align alignment) |
Sets the label alignment. More... | |
long | argument () const |
Gets the current user data (long) argument that is passed to the callback function. | |
void | argument (long v) |
Sets the current user data (long) argument that is passed to the callback function. More... | |
virtual class Fl_Gl_Window * | as_gl_window () |
Returns an Fl_Gl_Window pointer if this widget is an Fl_Gl_Window. More... | |
virtual Fl_Group * | as_group () |
Returns an Fl_Group pointer if this widget is an Fl_Group. More... | |
virtual Fl_Window * | as_window () |
Returns an Fl_Window pointer if this widget is an Fl_Window. More... | |
Fl_Boxtype | box () const |
Gets the box type of the widget. More... | |
void | box (Fl_Boxtype new_box) |
Sets the box type for the widget. More... | |
Fl_Callback_p | callback () const |
Gets the current callback function for the widget. More... | |
void | callback (Fl_Callback *cb, void *p) |
Sets the current callback function for the widget. More... | |
void | callback (Fl_Callback *cb) |
Sets the current callback function for the widget. More... | |
void | callback (Fl_Callback0 *cb) |
Sets the current callback function for the widget. More... | |
void | callback (Fl_Callback1 *cb, long p=0) |
Sets the current callback function for the widget. More... | |
unsigned int | changed () const |
Checks if the widget value changed since the last callback. More... | |
void | clear_active () |
Marks the widget as inactive without sending events or changing focus. More... | |
void | clear_changed () |
Marks the value of the widget as unchanged. More... | |
void | clear_damage (uchar c=0) |
Clears or sets the damage flags. More... | |
void | clear_output () |
Sets a widget to accept input. More... | |
void | clear_visible () |
Hides the widget. More... | |
void | clear_visible_focus () |
Disables keyboard focus navigation with this widget. More... | |
Fl_Color | color () const |
Gets the background color of the widget. More... | |
void | color (Fl_Color bg) |
Sets the background color of the widget. More... | |
void | color (Fl_Color bg, Fl_Color sel) |
Sets the background and selection color of the widget. More... | |
Fl_Color | color2 () const |
For back compatibility only. More... | |
void | color2 (unsigned a) |
For back compatibility only. More... | |
int | contains (const Fl_Widget *w) const |
Checks if w is a child of this widget. More... | |
void | copy_label (const char *new_label) |
Sets the current label. More... | |
void | copy_tooltip (const char *text) |
Sets the current tooltip text. More... | |
uchar | damage () const |
Returns non-zero if draw() needs to be called. More... | |
void | damage (uchar c) |
Sets the damage bits for the widget. More... | |
void | damage (uchar c, int x, int y, int w, int h) |
Sets the damage bits for an area inside the widget. More... | |
int | damage_resize (int, int, int, int) |
Internal use only. More... | |
void | deactivate () |
Deactivates the widget. More... | |
Fl_Image * | deimage () |
Gets the image that is used as part of the widget label. More... | |
const Fl_Image * | deimage () const |
void | deimage (Fl_Image *img) |
Sets the image to use as part of the widget label. More... | |
void | deimage (Fl_Image &img) |
Sets the image to use as part of the widget label. More... | |
void | do_callback () |
Calls the widget callback. More... | |
void | do_callback (Fl_Widget *o, long arg) |
Calls the widget callback. More... | |
void | do_callback (Fl_Widget *o, void *arg=0) |
Calls the widget callback. More... | |
virtual void | draw ()=0 |
Draws the widget. More... | |
void | draw_label (int, int, int, int, Fl_Align) const |
Draws the label in an arbitrary bounding box with an arbitrary alignment. More... | |
int | h () const |
Gets the widget height. More... | |
virtual int | handle (int event) |
Handles the specified event. More... | |
virtual void | hide () |
Makes a widget invisible. More... | |
Fl_Image * | image () |
Gets the image that is used as part of the widget label. More... | |
const Fl_Image * | image () const |
void | image (Fl_Image *img) |
Sets the image to use as part of the widget label. More... | |
void | image (Fl_Image &img) |
Sets the image to use as part of the widget label. More... | |
int | inside (const Fl_Widget *wgt) const |
Checks if this widget is a child of wgt . More... | |
const char * | label () const |
Gets the current label text. More... | |
void | label (const char *text) |
Sets the current label pointer. More... | |
void | label (Fl_Labeltype a, const char *b) |
Shortcut to set the label text and type in one call. More... | |
Fl_Color | labelcolor () const |
Gets the label color. More... | |
void | labelcolor (Fl_Color c) |
Sets the label color. More... | |
Fl_Font | labelfont () const |
Gets the font to use. More... | |
void | labelfont (Fl_Font f) |
Sets the font to use. More... | |
Fl_Fontsize | labelsize () const |
Gets the font size in pixels. More... | |
void | labelsize (Fl_Fontsize pix) |
Sets the font size in pixels. More... | |
Fl_Labeltype | labeltype () const |
Gets the label type. More... | |
void | labeltype (Fl_Labeltype a) |
Sets the label type. More... | |
void | measure_label (int &ww, int &hh) const |
Sets width ww and height hh accordingly with the label size. More... | |
unsigned int | output () const |
Returns if a widget is used for output only. More... | |
Fl_Group * | parent () const |
Returns a pointer to the parent widget. More... | |
void | parent (Fl_Group *p) |
Internal use only - "for hacks only". More... | |
void | position (int X, int Y) |
Repositions the window or widget. More... | |
void | redraw () |
Schedules the drawing of the widget. More... | |
void | redraw_label () |
Schedules the drawing of the label. More... | |
virtual void | resize (int x, int y, int w, int h) |
Changes the size or position of the widget. More... | |
Fl_Color | selection_color () const |
Gets the selection color. More... | |
void | selection_color (Fl_Color a) |
Sets the selection color. More... | |
void | set_active () |
Marks the widget as active without sending events or changing focus. More... | |
void | set_changed () |
Marks the value of the widget as changed. More... | |
void | set_output () |
Sets a widget to output only. More... | |
void | set_visible () |
Makes the widget visible. More... | |
void | set_visible_focus () |
Enables keyboard focus navigation with this widget. More... | |
virtual void | show () |
Makes a widget visible. More... | |
void | size (int W, int H) |
Changes the size of the widget. More... | |
int | take_focus () |
Gives the widget the keyboard focus. More... | |
unsigned int | takesevents () const |
Returns if the widget is able to take events. More... | |
int | test_shortcut () |
Returns true if the widget's label contains the entered '&x' shortcut. More... | |
const char * | tooltip () const |
Gets the current tooltip text. More... | |
void | tooltip (const char *text) |
Sets the current tooltip text. More... | |
Fl_Window * | top_window () const |
Returns a pointer to the top-level window for the widget. More... | |
Fl_Window * | top_window_offset (int &xoff, int &yoff) const |
Finds the x/y offset of the current widget relative to the top-level window. More... | |
uchar | type () const |
Gets the widget type. More... | |
void | type (uchar t) |
Sets the widget type. More... | |
int | use_accents_menu () |
Returns non zero if MAC_USE_ACCENTS_MENU flag is set, 0 otherwise. | |
void * | user_data () const |
Gets the user data for this widget. More... | |
void | user_data (void *v) |
Sets the user data for this widget. More... | |
unsigned int | visible () const |
Returns whether a widget is visible. More... | |
void | visible_focus (int v) |
Modifies keyboard focus navigation. More... | |
unsigned int | visible_focus () |
Checks whether this widget has a visible focus. More... | |
int | visible_r () const |
Returns whether a widget and all its parents are visible. More... | |
int | w () const |
Gets the widget width. More... | |
Fl_When | when () const |
Returns the conditions under which the callback is called. More... | |
void | when (uchar i) |
Sets the flags used to decide when a callback is called. More... | |
Fl_Window * | window () const |
Returns a pointer to the nearest parent window up the widget hierarchy. More... | |
int | x () const |
Gets the widget position in its window. More... | |
int | y () const |
Gets the widget position in its window. More... | |
virtual | ~Fl_Widget () |
Destroys the widget. More... | |
Static Public Member Functions | |
static void | default_callback (Fl_Widget *cb, void *d) |
Sets the default callback for all widgets. More... | |
static unsigned int | label_shortcut (const char *t) |
Returns the Unicode value of the '&x' shortcut in a given text. More... | |
static int | test_shortcut (const char *, const bool require_alt=false) |
Returns true if the given text t contains the entered '&x' shortcut. More... | |
Protected Types | |
enum | { INACTIVE = 1<<0, INVISIBLE = 1<<1, OUTPUT = 1<<2, NOBORDER = 1<<3, FORCE_POSITION = 1<<4, NON_MODAL = 1<<5, SHORTCUT_LABEL = 1<<6, CHANGED = 1<<7, OVERRIDE = 1<<8, VISIBLE_FOCUS = 1<<9, COPIED_LABEL = 1<<10, CLIP_CHILDREN = 1<<11, MENU_WINDOW = 1<<12, TOOLTIP_WINDOW = 1<<13, MODAL = 1<<14, NO_OVERLAY = 1<<15, GROUP_RELATIVE = 1<<16, COPIED_TOOLTIP = 1<<17, FULLSCREEN = 1<<18, MAC_USE_ACCENTS_MENU = 1<<19, USERFLAG3 = 1<<29, USERFLAG2 = 1<<30, USERFLAG1 = 1<<31 } |
flags possible values enumeration. More... | |
Protected Member Functions | |
void | clear_flag (unsigned int c) |
Clears a flag in the flags mask. | |
void | draw_backdrop () const |
If FL_ALIGN_IMAGE_BACKDROP is set, the image or deimage will be drawn. | |
void | draw_box () const |
Draws the widget box according its box style. | |
void | draw_box (Fl_Boxtype t, Fl_Color c) const |
Draws a box of type t, of color c at the widget's position and size. More... | |
void | draw_box (Fl_Boxtype t, int x, int y, int w, int h, Fl_Color c) const |
Draws a box of type t, of color c at the position X,Y and size W,H. More... | |
void | draw_focus () |
draws a focus rectangle around the widget | |
void | draw_focus (Fl_Boxtype t, int x, int y, int w, int h) const |
Draws a focus box for the widget at the given position and size. | |
void | draw_label () const |
Draws the widget's label at the defined label position. More... | |
void | draw_label (int, int, int, int) const |
Draws the label in an arbitrary bounding box. More... | |
Fl_Widget (int x, int y, int w, int h, const char *label=0L) | |
Creates a widget at the given position and size. More... | |
unsigned int | flags () const |
Gets the widget flags mask. | |
void | h (int v) |
Internal use only. More... | |
void | set_flag (unsigned int c) |
Sets a flag in the flags mask. | |
void | w (int v) |
Internal use only. More... | |
void | x (int v) |
Internal use only. More... | |
void | y (int v) |
Internal use only. More... | |
Friends | |
class | Fl_Group |
Fl_Widget is the base class for all widgets in FLTK.
You can't create one of these because the constructor is not public. However you can subclass it.
All "property" accessing methods, such as color(), parent(), or argument() are implemented as trivial inline functions and thus are as fast and small as accessing fields in a structure. Unless otherwise noted, the property setting methods such as color(n) or label(s) are also trivial inline functions, even if they change the widget's appearance. It is up to the user code to call redraw() after these.
|
protected |
flags possible values enumeration.
See activate(), output(), visible(), changed(), set_visible_focus()
Enumerator | |
---|---|
INACTIVE |
the widget can't receive focus, and is disabled but potentially visible |
INVISIBLE |
the widget is not drawn, but can receive a few special events |
OUTPUT |
for output only |
NOBORDER |
don't draw a decoration (Fl_Window) |
FORCE_POSITION |
don't let the window manager position the window (Fl_Window) |
NON_MODAL |
this is a hovering toolbar window (Fl_Window) |
SHORTCUT_LABEL |
the label contains a shortcut we need to draw |
CHANGED |
the widget value changed |
OVERRIDE |
position window on top (Fl_Window) |
VISIBLE_FOCUS |
accepts keyboard focus navigation if the widget can have the focus |
COPIED_LABEL |
the widget label is internally copied, its destruction is handled by the widget |
CLIP_CHILDREN |
all drawing within this widget will be clipped (Fl_Group) |
MENU_WINDOW |
a temporary popup window, dismissed by clicking outside (Fl_Window) |
TOOLTIP_WINDOW |
a temporary popup, transparent to events, and dismissed easily (Fl_Window) |
MODAL |
a window blocking input to all other winows (Fl_Window) |
NO_OVERLAY |
window not using a hardware overlay plane (Fl_Menu_Window) |
GROUP_RELATIVE |
position this widget relative to the parent group, not to the window |
COPIED_TOOLTIP |
the widget tooltip is internally copied, its destruction is handled by the widget |
FULLSCREEN |
a fullscreen window (Fl_Window) |
MAC_USE_ACCENTS_MENU |
On the Mac OS platform, pressing and holding a key on the keyboard opens an accented-character menu window (Fl_Input_, Fl_Text_Editor) |
USERFLAG3 |
reserved for 3rd party extensions |
USERFLAG2 |
reserved for 3rd party extensions |
USERFLAG1 |
reserved for 3rd party extensions |
|
protected |
Creates a widget at the given position and size.
The Fl_Widget is a protected constructor, but all derived widgets have a matching public constructor. It takes a value for x(), y(), w(), h(), and an optional value for label().
[in] | x,y | the position of the widget relative to the enclosing window |
[in] | w,h | size of the widget in pixels |
[in] | label | optional text for the widget label |
|
virtual |
Destroys the widget.
Destroys the widget, taking care of throwing focus before if any.
Destroying single widgets is not very common. You almost always want to destroy the parent group instead, which will destroy all of the child widgets and groups in that group.
Destruction removes the widget from any parent group! And groups when destroyed destroy all their children. This is convenient and fast.
void Fl_Widget::activate | ( | ) |
Activates the widget.
Changing this value will send FL_ACTIVATE to the widget if active_r() is true.
|
inline |
Returns whether the widget is active.
0 | if the widget is inactive |
int Fl_Widget::active_r | ( | ) | const |
Returns whether the widget and all of its parents are active.
0 | if this or any of the parent widgets are inactive |
|
inline |
|
inline |
|
inline |
Sets the current user data (long) argument that is passed to the callback function.
|
inlinevirtual |
Returns an Fl_Gl_Window pointer if this widget is an Fl_Gl_Window.
Use this method if you have a widget (pointer) and need to know whether this widget is derived from Fl_Gl_Window. If it returns non-NULL, then the widget in question is derived from Fl_Gl_Window.
NULL | if this widget is not derived from Fl_Gl_Window. |
Reimplemented in Fl_Gl_Window.
|
inlinevirtual |
Returns an Fl_Group pointer if this widget is an Fl_Group.
Use this method if you have a widget (pointer) and need to know whether this widget is derived from Fl_Group. If it returns non-NULL, then the widget in question is derived from Fl_Group, and you can use the returned pointer to access its children or other Fl_Group-specific methods.
Example:
NULL | if this widget is not derived from Fl_Group. |
Reimplemented in Fl_Group.
|
inlinevirtual |
Returns an Fl_Window pointer if this widget is an Fl_Window.
Use this method if you have a widget (pointer) and need to know whether this widget is derived from Fl_Window. If it returns non-NULL, then the widget in question is derived from Fl_Window, and you can use the returned pointer to access its children or other Fl_Window-specific methods.
NULL | if this widget is not derived from Fl_Window. |
Reimplemented in Fl_Window.
|
inline |
|
inline |
Sets the box type for the widget.
This identifies a routine that draws the background of the widget. See Fl_Boxtype for the available types. The default depends on the widget, but is usually FL_NO_BOX or FL_UP_BOX.
[in] | new_box | the new box type |
|
inline |
Gets the current callback function for the widget.
Each widget has a single callback.
|
inline |
Sets the current callback function for the widget.
Each widget has a single callback.
[in] | cb | new callback |
[in] | p | user data |
|
inline |
Sets the current callback function for the widget.
Each widget has a single callback.
[in] | cb | new callback |
|
inline |
Sets the current callback function for the widget.
Each widget has a single callback.
[in] | cb | new callback |
|
inline |
Sets the current callback function for the widget.
Each widget has a single callback.
[in] | cb | new callback |
[in] | p | user data |
|
inline |
Checks if the widget value changed since the last callback.
"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.
0 | if the value did not change |
|
inline |
Marks the widget as inactive without sending events or changing focus.
This is mainly for specialized use, for normal cases you want deactivate().
|
inline |
Marks the value of the widget as unchanged.
|
inline |
Clears or sets the damage flags.
Damage flags are cleared when parts of the widget drawing is repaired.
The optional argument c
specifies the bits that are set after the call (default: 0) and not the bits that are cleared!
[in] | c | new bitmask of damage flags (default: 0) |
|
inline |
Sets a widget to accept input.
|
inline |
Hides the widget.
You must still redraw the parent to see a change in the window. Normally you want to use the hide() method instead.
|
inline |
Disables keyboard focus navigation with this widget.
Normally, all widgets participate in keyboard focus navigation.
|
inline |
Gets the background color of the widget.
|
inline |
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_BACKGROUND_COLOR. Use Fl::set_color() to redefine colors in the color map.
[in] | bg | background color |
Sets the background and selection color of the widget.
The two color form sets both the background and selection colors.
[in] | bg | background color |
[in] | sel | selection color |
|
inline |
For back compatibility only.
|
inline |
For back compatibility only.
int Fl_Widget::contains | ( | const Fl_Widget * | w | ) | const |
Checks if w is a child of this widget.
[in] | w | potential child widget |
w
is a child of this widget, or is equal to this widget. Returns 0 if w
is NULL. void Fl_Widget::copy_label | ( | const char * | new_label | ) |
Sets the current label.
Unlike label(), this method allocates a copy of the label string instead of using the original string pointer.
The internal copy will automatically be freed whenever you assign a new label or when the widget is destroyed.
[in] | new_label | the new label text |
void Fl_Widget::copy_tooltip | ( | const char * | text | ) |
Sets the current tooltip text.
Unlike tooltip(), this method allocates a copy of the tooltip string instead of using the original string pointer.
The internal copy will automatically be freed whenever you assign a new tooltip or when the widget is destroyed.
If no tooltip is set, the tooltip of the parent is inherited. Setting a tooltip for a group and setting no tooltip for a child will show the group's tooltip instead. To avoid this behavior, you can set the child's tooltip to an empty string ("").
[in] | text | New tooltip text (an internal copy is made and managed) |
|
inline |
Returns 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.
void Fl_Widget::damage | ( | uchar | c | ) |
Sets the damage bits for the widget.
Setting damage bits will schedule the widget for the next redraw.
[in] | c | bitmask of flags to set |
void Fl_Widget::damage | ( | uchar | c, |
int | x, | ||
int | y, | ||
int | w, | ||
int | h | ||
) |
Sets the damage bits for an area inside the widget.
Setting damage bits will schedule the widget for the next redraw.
[in] | c | bitmask of flags to set |
[in] | x,y,w,h | size of damaged area |
int Fl_Widget::damage_resize | ( | int | X, |
int | Y, | ||
int | W, | ||
int | H | ||
) |
Internal use only.
void Fl_Widget::deactivate | ( | ) |
Deactivates the widget.
Inactive widgets will be drawn "grayed out", e.g. with less contrast than the active widget. Inactive widgets will not receive any keyboard or mouse button events. Other events (including FL_ENTER, FL_MOVE, FL_LEAVE, FL_SHORTCUT, and others) will still be sent. A widget is only active if active() is true on it and all of its parents.
Changing this value will send FL_DEACTIVATE to the widget if active_r() is true.
Currently you cannot deactivate Fl_Window widgets.
|
static |
Sets the default callback for all widgets.
Sets 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.
[in] | cb | the new callback |
[in] | d | user data associated with that callback |
|
inline |
Gets the image that is used as part of the widget label.
This image is used when drawing the widget in the inactive state.
|
inline |
Sets the image to use as part of the widget label.
This image is used when drawing the widget in the inactive state.
[in] | img | the new image for the deactivated widget |
|
inline |
Sets the image to use as part of the widget label.
This image is used when drawing the widget in the inactive state.
[in] | img | the new image for the deactivated widget |
|
inline |
Calls the widget callback.
Causes a widget to invoke its callback function with default arguments.
|
inline |
Calls the widget callback.
Causes a widget to invoke its callback function with arbitrary arguments.
[in] | o | call the callback with o as the widget argument |
[in] | arg | call the callback with arg as the user data argument |
void Fl_Widget::do_callback | ( | Fl_Widget * | o, |
void * | arg = 0 |
||
) |
Calls the widget callback.
Causes a widget to invoke its callback function with arbitrary arguments.
[in] | o | call the callback with o as the widget argument |
[in] | arg | use arg as the user data argument |
|
pure virtual |
Draws the widget.
Never call this function directly. FLTK will schedule redrawing whenever needed. If your widget must be redrawn as soon as possible, call redraw() instead.
Override this function to draw your own widgets.
If you ever need to call another widget's draw method from within your own draw() method, e.g. for an embedded scrollbar, you can do it (because draw() is virtual) like this:
Implemented in Fl_Table, Fl_FormsText, Fl_Tree, Fl_Text_Display, Fl_Input, Fl_Gl_Window, Fl_Tabs, Fl_Browser_, Fl_Window, Fl_Scroll, Fl_Button, Fl_Chart, Fl_Choice, Fl_Slider, Fl_Value_Input, Fl_File_Input, Fl_Counter, Fl_Free, Fl_Clock_Output, Fl_Group, Fl_Dial, Fl_Cairo_Window, Fl_Menu_Bar, Fl_Pack, Fl_Menu_Button, Fl_Scrollbar, Fl_Positioner, Fl_Adjuster, Fl_Timer, Fl_Value_Output, Fl_Glut_Window, Fl_Progress, Fl_Sys_Menu_Bar, Fl_Light_Button, Fl_Value_Slider, Fl_Roller, Fl_Box, Fl_Return_Button, Fl_FormsPixmap, and Fl_FormsBitmap.
|
protected |
Draws a box of type t, of color c at the widget's position and size.
|
protected |
Draws a box of type t, of color c at the position X,Y and size W,H.
|
protected |
Draws the widget's label at the defined label position.
This is the normal call for a widget's draw() method.
|
protected |
Draws the label in an arbitrary bounding box.
draw() can use this instead of draw_label(void) to change the bounding box
void Fl_Widget::draw_label | ( | int | X, |
int | Y, | ||
int | W, | ||
int | H, | ||
Fl_Align | a | ||
) | const |
Draws the label in an arbitrary bounding box with an arbitrary alignment.
Anybody can call this to force the label to draw anywhere.
|
inlineprotected |
Internal use only.
Use position(int,int), size(int,int) or resize(int,int,int,int) instead.
|
inline |
Gets the widget height.
|
virtual |
Handles the specified event.
You normally don't call this method directly, but instead let FLTK do it when the user interacts with the widget.
When implemented in a widget, this function must return 0 if the widget does not use the event or 1 otherwise.
Most of the time, you want to call the inherited handle() method in your overridden method so that you don't short-circuit events that you don't handle. In this last case you should return the callee retval.
[in] | event | the kind of event received |
0 | if the event was not used or understood |
1 | if the event was used and can be deleted |
Reimplemented in Fl_Tree, Fl_Table, Fl_Input, Fl_Window, Fl_Browser_, Fl_Tabs, Fl_Text_Display, Fl_Scroll, Fl_Spinner, Fl_Table_Row, Fl_Clock, Fl_Check_Browser, Fl_Button, Fl_Gl_Window, Fl_Choice, Fl_Slider, Fl_Menu_Button, Fl_Group, Fl_Value_Input, Fl_Counter, Fl_File_Input, Fl_Free, Fl_Dial, Fl_Menu_Bar, Fl_Scrollbar, Fl_Text_Editor, Fl_Positioner, Fl_Box, Fl_Value_Output, Fl_Timer, Fl_Glut_Window, Fl_Adjuster, Fl_Secret_Input, Fl_Light_Button, Fl_Value_Slider, Fl_Roller, Fl_Return_Button, Fl_Repeat_Button, and Fl_Tile.
|
virtual |
Makes a widget invisible.
Reimplemented in Fl_Window, Fl_Browser, Fl_Gl_Window, Fl_Overlay_Window, Fl_Double_Window, and Fl_Menu_Window.
|
inline |
Gets the image that is used as part of the widget label.
This image is used when drawing the widget in the active state.
|
inline |
Sets the image to use as part of the widget label.
This image is used when drawing the widget in the active state.
[in] | img | the new image for the label |
|
inline |
Sets the image to use as part of the widget label.
This image is used when drawing the widget in the active state.
[in] | img | the new image for the label |
|
inline |
Checks if this widget is a child of wgt
.
Returns 1 if this widget is a child of wgt
, or is equal to wgt
. Returns 0 if wgt
is NULL.
[in] | wgt | the possible parent widget. |
|
inline |
Gets the current label text.
void Fl_Widget::label | ( | const char * | text | ) |
Sets 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. The copy_label() method can be used to make a copy of the label string automatically.
[in] | text | pointer to new label text |
|
inline |
Shortcut to set the label text and type in one call.
|
static |
Returns the Unicode value of the '&x' shortcut in a given text.
The given text t
(usually a widget's label or a menu text) is searched for a '&x' shortcut label, and if found, the Unicode value (code point) of the '&x' shortcut is returned.
t | text or label to search for '&x' shortcut. |
t
or 0.
|
inline |
Gets the label color.
The default color is FL_FOREGROUND_COLOR.
|
inline |
Sets the label color.
The default color is FL_FOREGROUND_COLOR.
[in] | c | the new label color |
|
inline |
Gets the font to use.
Fonts are identified by indexes into a table. The default value uses a Helvetica typeface (Arial for Microsoft® Windows®). The function Fl::set_font() can define new typefaces.
|
inline |
Sets the font to use.
Fonts are identified by indexes into a table. The default value uses a Helvetica typeface (Arial for Microsoft® Windows®). The function Fl::set_font() can define new typefaces.
[in] | f | the new font for the label |
|
inline |
Gets the font size in pixels.
The default size is 14 pixels.
|
inline |
|
inline |
|
inline |
Sets the label type.
The label type 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.
[in] | a | new label type |
|
inline |
Sets width ww and height hh accordingly with the label size.
Labels with images will return w() and h() of the image.
This calls fl_measure() internally. For more information about the arguments ww
and hh
and word wrapping
|
inline |
Returns if a widget is used for output only.
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.
0 | if the widget is used for input and output |
|
inline |
Returns a pointer to the parent widget.
Usually this is a Fl_Group or Fl_Window.
NULL | if the widget has no parent |
|
inline |
Internal use only - "for hacks only".
It is STRONGLY recommended not to use this method, because it short-circuits Fl_Group's normal widget adding and removing methods, if the widget is already a child widget of another Fl_Group.
Use Fl_Group::add(Fl_Widget*) and/or Fl_Group::remove(Fl_Widget*) instead.
|
inline |
Repositions the window or widget.
position(X, Y) is a shortcut for resize(X, Y, w(), h()).
[in] | X,Y | new position relative to the parent window |
void Fl_Widget::redraw | ( | ) |
Schedules the drawing of the widget.
Marks the widget as needing its draw() routine called.
void Fl_Widget::redraw_label | ( | ) |
Schedules the drawing of the label.
Marks the widget or the parent as needing a redraw for the label area of a widget.
|
virtual |
Changes the size or position of the widget.
This is a virtual function so that the widget may implement its own handling of resizing. The default version does not call the redraw() method, but instead relies on the parent widget to do so because the parent may know a faster way to update the display, such as scrolling from the old position.
Some window managers under X11 call resize() a lot more often than needed. Please verify that the position or size of a widget did actually change before doing any extensive calculations.
position(X, Y) is a shortcut for resize(X, Y, w(), h()), and size(W, H) is a shortcut for resize(x(), y(), W, H).
[in] | x,y | new position relative to the parent window |
[in] | w,h | new size |
Reimplemented in Fl_Table, Fl_Tree, Fl_Help_View, Fl_Text_Display, Fl_Window, Fl_Browser_, Fl_Input_, Fl_Input_Choice, Fl_Spinner, Fl_Scroll, Fl_Group, Fl_Gl_Window, Fl_Value_Input, Fl_Overlay_Window, Fl_Double_Window, and Fl_Tile.
|
inline |
Gets the selection color.
|
inline |
Sets the selection color.
The selection color 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(Fl_Color bg, Fl_Color sel).
[in] | a | the new selection color |
|
inline |
Marks the widget as active without sending events or changing focus.
This is mainly for specialized use, for normal cases you want activate().
|
inline |
Marks the value of the widget as changed.
|
inline |
Sets a widget to output only.
|
inline |
Makes the widget visible.
You must still redraw the parent widget to see a change in the window. Normally you want to use the show() method instead.
|
inline |
Enables keyboard focus navigation with this widget.
Note, however, that this will not necessarily mean that the widget will accept focus, but for widgets that can accept focus, this method enables it if it has been disabled.
|
virtual |
Makes a widget visible.
An invisible widget never gets redrawn and does not get keyboard or mouse events, but can receive a few other events like FL_SHOW.
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.
Reimplemented in Fl_Window, Fl_Browser, Fl_Gl_Window, Fl_Overlay_Window, Fl_Double_Window, Fl_Single_Window, and Fl_Menu_Window.
|
inline |
Changes the size of the widget.
size(W, H) is a shortcut for resize(x(), y(), W, H).
[in] | W,H | new size |
int Fl_Widget::take_focus | ( | ) |
Gives the widget the keyboard 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, setting Fl::focus() to this widget. You should use this method to assign the focus to a widget.
|
inline |
int Fl_Widget::test_shortcut | ( | ) |
Returns true if the widget's label contains the entered '&x' shortcut.
This method must only be called in handle() methods or callbacks after a keypress event (usually FL_KEYDOWN or FL_SHORTCUT). The widget's label is searched for a '&x' shortcut, and if found, this is compared with the entered key value.
Fl::event_text() is used to get the entered key value.
|
static |
Returns true if the given text t
contains the entered '&x' shortcut.
This method must only be called in handle() methods or callbacks after a keypress event (usually FL_KEYDOWN or FL_SHORTCUT). The given text t
(usually a widget's label or menu text) is searched for a '&x' shortcut, and if found, this is compared with the entered key value.
Fl::event_text() is used to get the entered key value. Fl::event_state() is used to get the Alt modifier, if require_alt
is true.
t | text or label to search for '&x' shortcut. |
require_alt | if true: match only if Alt key is pressed. |
t
false (0) otherwise.
|
inline |
Gets the current tooltip text.
void Fl_Widget::tooltip | ( | const char * | text | ) |
Sets the current tooltip text.
Sets a string of text to display in a popup tooltip window when the user hovers the mouse over the widget. The string is not copied, so make sure any formatted string is stored in a static, global, or allocated buffer. If you want a copy made and managed for you, use the copy_tooltip() method, which will manage the tooltip string automatically.
If no tooltip is set, the tooltip of the parent is inherited. Setting a tooltip for a group and setting no tooltip for a child will show the group's tooltip instead. To avoid this behavior, you can set the child's tooltip to an empty string ("").
[in] | text | New tooltip text (no copy is made) |
Fl_Window * Fl_Widget::top_window | ( | ) | const |
Returns a pointer to the top-level window for the widget.
In other words, the 'window manager window' that contains this widget. This method differs from window() in that it won't return sub-windows (if there are any).
Fl_Window * Fl_Widget::top_window_offset | ( | int & | xoff, |
int & | yoff | ||
) | const |
Finds the x/y offset of the current widget relative to the top-level window.
[out] | xoff,yoff | Returns the x/y offset |
|
inline |
|
inline |
Sets the widget type.
This is used for Forms compatibility.
|
inline |
Gets the user data for this widget.
Gets the current user data (void *) argument that is passed to the callback function.
|
inline |
Sets the user data for this widget.
Sets the new user data (void *) argument that is passed to the callback function.
[in] | v | new user data |
|
inline |
Returns whether a widget is visible.
0 | if the widget is not drawn and hence invisible. |
|
inline |
Modifies keyboard focus navigation.
[in] | v | set or clear visible focus |
|
inline |
Checks whether this widget has a visible focus.
0 | if this widget has no visible focus. |
int Fl_Widget::visible_r | ( | ) | const |
|
inlineprotected |
Internal use only.
Use position(int,int), size(int,int) or resize(int,int,int,int) instead.
|
inline |
Gets the widget width.
|
inline |
Returns the conditions under which the callback is called.
You can set the flags with when(uchar), the default value is FL_WHEN_RELEASE.
|
inline |
Sets the flags used to decide when a callback is called.
This controls when callbacks are done. The following values are useful, the default value is FL_WHEN_RELEASE:
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.
[in] | i | set of flags |
Fl_Window * Fl_Widget::window | ( | ) | const |
Returns a pointer to the nearest parent window up the widget hierarchy.
This will return sub-windows if there are any, or the parent window if there's no sub-windows. If this widget IS the top-level window, NULL is returned.
NULL | if no window is associated with this widget. |
|
inlineprotected |
Internal use only.
Use position(int,int), size(int,int) or resize(int,int,int,int) instead.
|
inline |
Gets the widget position in its window.
|
inlineprotected |
Internal use only.
Use position(int,int), size(int,int) or resize(int,int,int,int) instead.
|
inline |
Gets the widget position in its window.