The base class for all FLTK widgets.
Subclasses: Box Browser_ Button Group Input_ Menu_
active | changed | labelfont | selection_color | when |
align | color | labelsize | takesevents | window |
argument | h | labeltype | type | x |
box | label | output | visible | y |
callback | labelcolor | parent | w | |
activate | clear_output | inside | resize | size |
active_r | contains | position | set_changed | take_focus |
clear_changed | deactivate | redraw | set_output | visible_r |
type | name | summary |
string | label | Widget label |
integer | labelsize | Label font size |
Font | labelfont | Label font |
Color | labelcolor | Label color |
Color | color | Color of widget |
Boxtype | box | Border and style of widget |
Align | align | Position of label |
function | callback | Function called when triggered |
type | name | summary |
void | redraw() | Redraw the widget |
void | resize(integer x, integer y, integer w, integer h) | Change this widget's position and size |
boolean | take_focus() | Give this widget the focus |
Widget is the base class for all widgets in FLTK. You can't create one of these directly, but all other widgets inherit from it.
When you create any widget, it's added to the current Group (which may be a Window. See the Group documentation for more information on groups.
When you change properties that affect the widget's appearance (like color or label), it's up to you to call redraw() to update the display.
Returns a the parent widget. Usually this is a Group or Window. Returns
nil if none.
parent is not readonly, but you should not set it unless you
really know what you're doing.
The type property provides C++ code with rough runtime
information about what kind of Fl_Widget this is. Lua
doesn't need this, but some subclasses of Widget change their
behavior by setting this to particular values.
Except for window widgets, x is the horizontal position of
this widget relative to its parent window. Use resize() or
position() to change.
Except for window widgets, y is the vertical position of
this widget relative to its parent window. Use resize() or
position() to change.
The width of this widget. Use resize() or size() to change.
The height of this widget. Use resize() or size() to change.
Resize and reposition this widget. Except for windows, these
coordinates are relative to the widget's parent window.
Reposition this widget. Except for windows, these
coordinates are relative to the widget's parent window.
Resize this widget.
How the label is printed next to or inside the widget. The default
value is Align.center, which centers the label. See Align for further details.
The box property identifies a routine that draws the border and background of
the widget. For instance, a Button with a raised border has Boxtype.up; a Button with lowered border has Boxtype.down.
See Boxtype for the available
types. The default depends on the widget, but is usually
Boxtype.none or Boxtype.up.
This color is passed to the box routine; it's usually the overall color of the widget
color is an index into an internal table of rgb colors.
For most widgets this defaults to Color.gray. See the
documentation of Color for named
colors and operations that affect FLTK's color handling.
Widgets have a secondary color. This is usually
used to color the widget when it is selected, although some widgets
use this color for other purposes.
The label is printed somewhere on the widget or next to it. Its
position depends on the align property; how it's drawn
depends on the labeltype property..
A labeltype The value Labeltype.normal prints the label as text. See
Labeltype for further
documentation.
The color used to draw the widget's label.
labelcolor is an index into an internal table of rgb
colors. For most widgets this defaults to Color.black. See
the documentation of Color for named colors and operations
that affect FLTK's color handling.
The font used to draw the widget's label. Font is an index into an
internal table of fonts. The default font is Font.helvetica;
add Font.bold or Font.italic to add those styles:
Font.helvetica+Font.bold. See Font for further
documentation.
The point size of the font used to draw the widget's label. The FLTK default is 14.
Most widgets are designed to respond to user interaction. Depending
on the type of widget and the value of the when property, the function
in the callback property will be called when the user takes
action that directly affects this widget. For example, the callback
runs when a Button is pushed, or when the user changes the value of an
Input field.
Don't set this property; it's reserved for the use of the Lua FLTK runtime system.
The when property is a set of flags used by subclasses of
Widget to decide when to deliver a callback. If the value is When.never
then the callback is never done. Other values are described in the
individual widgets and in the When documentation.
An invisible widget never gets redrawn and does not get events. The
visible property is true if the widget is set to be
visible. A widget is only visible if
visible is true on it and all of its parents.
Changing it will send Event.show or Event.hide
events to the widget. Do not change visible if the parent is not
visible, as this will send false Event.show or Event.hide
events to the widget. redraw() is called automatically,
if necessary, on this widget or its parent.
visible_r() 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.
active returns whether the widget is 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 Event.activate or
Event.deactivate to the widget if active_r() is true.
Currently you cannot deactivate Window widgets. 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.
Activates the widget. See the active property for more documentation.
Deactivates the widget. See the active property for more documentation.
Widgets that the output property is true of are "output
only"; they don't receive any events. This is similar to not
active widgets, except output does not affect how the
widget is drawn.
Makes this widget output-only. See the output property for more documentation.
Resets this widget's output-only status. See the output property for more documentation.
This property is true if the widget is visible, active, and not output-only.
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 Widget that store values, but is in the base
class so it is easier to scan all the widgets in a panel and run the
callback on the changed ones in response to an "OK" button.
Most widgets turn this flag off when they perform a callback, and when
the program sets the stored value.
Sets the changed flag on this widget. See the changed property for more documentation.
Clears the changed flag on this widget. See the output property for more documentation.
Tries to make this widget be the Fl.focus widget, by first
sending it an Event.focus event, and if it returns non-zero,
setting Fl.focus to this widget. You should use this
method to assign the focus to an widget. Returns true if the widget
accepted the focus.
Returns true if b is a child of this widget, or is equal to
this widget. Returns false if b is nil.
Returns true if this is a child of a, or is equal to
a . Returns false if a is nil.
Redraw this widget. Call this after changing appearance-related properties like labelsize.
Actually, this only flags the widget as needing a redisplay; it will be
redrawn the next time events are processed.
The Window this widget lives in. For window widgets,
gives the window's parent window, if any; otherwise it's nil.
type: integer
x: readonly integer
y: readonly integer
w: readonly integer
h: readonly integer
resize(integer x, integer y, integer w, integer h): void
position(integer x, integer y): void
size(integer w, integer h): void
align: Align
box: Boxtype
color: Color
selection_color: Color
label: string
labeltype: Labeltype
labelcolor: Color
labelfont: Font
labelsize: integer
callback: function
argument: integer
when: When
visible: readonly boolean
visible_r(): boolean
active: readonly boolean
active_r(): boolean
activate(): void
deactivate(): void
output: readonly boolean
set_output(): void
clear_output(): void
takesevents: readonly boolean
changed: readonly boolean
set_changed(): void
clear_changed(): void
take_focus(): boolean
contains(Widget b): boolean
inside(Widget a): boolean
redraw(): void
window: readonly Window
doctool generated at Sun Aug 12 22:23:17 2001