FLTK 1.4.4

Loading...
Searching...
No Matches
Fl_Widget.H
Go to the documentation of this file.
1//
2// Widget header file for the Fast Light Tool Kit (FLTK).
3//
4// Copyright 1998-2024 by Bill Spitzak and others.
5//
6// This library is free software. Distribution and use rights are outlined in
7// the file "COPYING" which should have been included with this file. If this
8// file is missing or damaged, see the license at:
9//
10// https://www.fltk.org/COPYING.php
11//
12// Please see the following page on how to report bugs and issues:
13//
14// https://www.fltk.org/bugs.php
15//
16
21
22#ifndef Fl_Widget_H
23#define Fl_Widget_H
24
25#include "Fl.H"
26
27 class Fl_Widget;
28 class Fl_Window;
29 class Fl_Group;
30 class Fl_Image;
31
33 typedef void (Fl_Callback )(Fl_Widget*, void*);
35 typedef Fl_Callback* Fl_Callback_p; // needed for BORLAND
37 typedef void (Fl_Callback0)(Fl_Widget*);
39 typedef void (Fl_Callback1)(Fl_Widget*, long);
40
49 struct FL_EXPORT Fl_Label {
51 const char* value;
53 Fl_Image* image;
55 Fl_Image* deimage;
57 Fl_Font font;
59 Fl_Fontsize size;
61 Fl_Color color;
63 Fl_Align align_;
65 uchar type;
67 signed char h_margin_;
69 signed char v_margin_;
71 uchar spacing;
72
74 void draw(int,int,int,int, Fl_Align) const ;
75 void measure(int &w, int &h) const ;
76};
77
78
92 class FL_EXPORT Fl_Callback_User_Data {
93 protected:
94 Fl_Callback_User_Data() {}
95 public:
96 virtual ~Fl_Callback_User_Data() { }
97};
98
99
112 class FL_EXPORT Fl_Widget {
113 friend class Fl_Group;
114
115 Fl_Group* parent_;
116 Fl_Callback* callback_;
117 void* user_data_;
118 int x_,y_,w_,h_;
119 Fl_Label label_;
120 unsigned int flags_;
121 Fl_Color color_;
122 Fl_Color color2_;
123 uchar type_;
124 uchar damage_;
125 uchar box_;
126 uchar when_;
127
128 const char *tooltip_;
129
131 Fl_Widget(const Fl_Widget &);
133 Fl_Widget& operator=(const Fl_Widget &);
134
135 protected:
136
147 Fl_Widget(int x, int y, int w, int h, const char *label=0L);
148
150 void x(int v) {x_ = v;}
152 void y(int v) {y_ = v;}
154 void w(int v) {w_ = v;}
156 void h(int v) {h_ = v;}
158 unsigned int flags() const {return flags_;}
160 void set_flag(unsigned int c) {flags_ |= c;}
162 void clear_flag(unsigned int c) {flags_ &= ~c;}
166 enum {
167 INACTIVE = 1<<0,
168 INVISIBLE = 1<<1,
169 OUTPUT = 1<<2,
170 NOBORDER = 1<<3,
171 FORCE_POSITION = 1<<4,
172 NON_MODAL = 1<<5,
173 SHORTCUT_LABEL = 1<<6,
174 CHANGED = 1<<7,
175 OVERRIDE = 1<<8,
176 VISIBLE_FOCUS = 1<<9,
177 COPIED_LABEL = 1<<10,
178 CLIP_CHILDREN = 1<<11,
179 MENU_WINDOW = 1<<12,
180 TOOLTIP_WINDOW = 1<<13,
181 MODAL = 1<<14,
182 NO_OVERLAY = 1<<15,
183 GROUP_RELATIVE = 1<<16,
184 COPIED_TOOLTIP = 1<<17,
185 FULLSCREEN = 1<<18,
186 MAC_USE_ACCENTS_MENU = 1<<19,
187 NEEDS_KEYBOARD = 1<<20,
188 IMAGE_BOUND = 1<<21,
189 DEIMAGE_BOUND = 1<<22,
190 AUTO_DELETE_USER_DATA = 1<<23,
191 MAXIMIZED = 1<<24,
192 POPUP = 1<<25,
193 // Note to devs: add new FLTK core flags above this line (up to 1<<28).
194
195 // Three more flags, reserved for user code
196
197 USERFLAG3 = 1<<29,
198 USERFLAG2 = 1<<30,
199 USERFLAG1 = 1<<31
200 };
201 void draw_box() const;
202 void draw_box(Fl_Boxtype t, Fl_Color c) const;
203 void draw_box(Fl_Boxtype t, int x,int y,int w,int h, Fl_Color c) const;
204 void draw_backdrop() const;
205
211 void draw_focus() const {
212 draw_focus(box(), x(), y(), w(), h(), color());
213 }
214
220 void draw_focus(Fl_Boxtype t, int X, int Y, int W, int H) const {
221 draw_focus(t, X, Y, W, H, color());
222
223 }
224 // See documentation in Fl_Widget.cxx
225 void draw_focus(Fl_Boxtype t, int x, int y, int w, int h, Fl_Color bg) const;
226
227 void draw_label() const;
228 void draw_label(int, int, int, int) const;
229
230 public:
231
240 virtual ~Fl_Widget();
241
258 virtual void draw() = 0;
259
289 virtual int handle(int event);
290
299 int is_label_copied() const {return ((flags_ & COPIED_LABEL) ? 1 : 0);}
300
315 void needs_keyboard(bool needs) {
316 if (needs) set_flag(NEEDS_KEYBOARD);
317 else clear_flag(NEEDS_KEYBOARD);
318 }
319
325 bool needs_keyboard() const {
326 return (flags_ & NEEDS_KEYBOARD);
327 }
328
334 Fl_Group* parent() const {return parent_;}
335
344 void parent(Fl_Group* p) {parent_ = p;} // for hacks only, use Fl_Group::add()
345
351 uchar type() const {return type_;}
352
356 void type(uchar t) {type_ = t;}
357
361 int x() const {return x_;}
362
366 int y() const {return y_;}
367
371 int w() const {return w_;}
372
376 int h() const {return h_;}
377
397 virtual void resize(int x, int y, int w, int h);
398
400 int damage_resize(int,int,int,int);
401
409 void position(int X,int Y) {resize(X,Y,w_,h_);}
410
418 void size(int W,int H) {resize(x_,y_,W,H);}
419
425 Fl_Align align() const {return label_.align_;}
426
434 void align(Fl_Align alignment) {label_.align_ = alignment;}
435
440 Fl_Boxtype box() const {return (Fl_Boxtype)box_;}
441
449 void box(Fl_Boxtype new_box) {box_ = new_box;}
450
455 Fl_Color color() const {return color_;}
456
467 void color(Fl_Color bg) {color_ = bg;}
468
473 Fl_Color selection_color() const {return color2_;}
474
483 void selection_color(Fl_Color a) {color2_ = a;}
484
492 void color(Fl_Color bg, Fl_Color sel) {color_=bg; color2_=sel;}
493
498 const char* label() const {return label_.value;}
499
511 void label(const char* text);
512
523 void copy_label(const char *new_label);
524
528 void label(Fl_Labeltype a, const char* b) {label_.type = a; label_.value = b;}
529
534 Fl_Labeltype labeltype() const {return (Fl_Labeltype)label_.type;}
535
544 void labeltype(Fl_Labeltype a) {label_.type = a;}
545
550 Fl_Color labelcolor() const {return label_.color;}
551
556 void labelcolor(Fl_Color c) {label_.color=c;}
557
565 Fl_Font labelfont() const {return label_.font;}
566
574 void labelfont(Fl_Font f) {label_.font=f;}
575
580 Fl_Fontsize labelsize() const {return label_.size;}
581
586 void labelsize(Fl_Fontsize pix) {label_.size=pix;}
587
591 Fl_Image* image() {return label_.image;}
592
596 const Fl_Image* image() const {return label_.image;}
597
613 void image(Fl_Image* img);
614
619 void image(Fl_Image& img);
620
636 void bind_image(Fl_Image* img);
637
642 void bind_image(int f) { if (f) set_flag(IMAGE_BOUND); else clear_flag(IMAGE_BOUND); }
643
649 int image_bound() const {return ((flags_ & IMAGE_BOUND) ? 1 : 0);}
650
654 Fl_Image* deimage() {return label_.deimage;}
655
659 const Fl_Image* deimage() const {return label_.deimage;}
660
667 void deimage(Fl_Image* img);
668
673 void deimage(Fl_Image& img);
674
681 void bind_deimage(Fl_Image* img);
682
688 int deimage_bound() const {return ((flags_ & DEIMAGE_BOUND) ? 1 : 0);}
689
694 void bind_deimage(int f) { if (f) set_flag(DEIMAGE_BOUND); else clear_flag(DEIMAGE_BOUND); }
695
700 void label_image_spacing(int gap) { label_.spacing = (uchar)gap; }
701
705 int label_image_spacing() { return label_.spacing; }
706
710 void horizontal_label_margin(int px) { label_.h_margin_ = (signed char)px; }
711
715 int horizontal_label_margin() { return label_.h_margin_; }
716
720 void vertical_label_margin(int px) { label_.v_margin_ = (signed char)px; }
721
725 int vertical_label_margin() { return label_.v_margin_; }
726
731 const char *tooltip() const {return tooltip_;}
732
733 void tooltip(const char *text); // see Fl_Tooltip
734 void copy_tooltip(const char *text); // see Fl_Tooltip
735
740 Fl_Callback_p callback() const {return callback_;}
741
747 void callback(Fl_Callback* cb, void* p) {
748 callback_ = cb;
749 user_data(p);
750 }
751
759 void callback(Fl_Callback* cb, Fl_Callback_User_Data* p, bool auto_free) {
760 callback_ = cb;
761 user_data(p, auto_free);
762 }
763
768 void callback(Fl_Callback* cb) {callback_ = cb;}
769
774 void callback(Fl_Callback0* cb) {
775 callback_ = (Fl_Callback*)(fl_intptr_t)(cb);
776 }
777
783 void callback(Fl_Callback1* cb, long p = 0) {
784 callback_ = (Fl_Callback*)(fl_intptr_t)(cb);
785 user_data((void*)(fl_intptr_t)p);
786 }
787
792 void* user_data() const {return user_data_;}
793
795 void user_data(void* v);
796
798 void user_data(Fl_Callback_User_Data* v, bool auto_free);
799
811 long argument() const {return (long)(fl_intptr_t)user_data_;}
812
817 void argument(long v) {user_data((void*)(fl_intptr_t)v);}
818
827 Fl_When when() const {return (Fl_When)when_;}
828
866 void when(uchar i) {when_ = i;}
867
872 unsigned int visible() const {return !(flags_&INVISIBLE);}
873
878 int visible_r() const;
879
897 virtual void show();
898
902 virtual void hide();
903
908 void set_visible() {flags_ &= ~INVISIBLE;}
909
914 void clear_visible() {flags_ |= INVISIBLE;}
915
920 unsigned int active() const {return !(flags_&INACTIVE);}
921
926 int active_r() const;
927
933 void activate();
934
949 void deactivate();
950
959 unsigned int output() const {return (flags_&OUTPUT);}
960
964 void set_output() {flags_ |= OUTPUT;}
965
969 void clear_output() {flags_ &= ~OUTPUT;}
970
976 unsigned int takesevents() const {return !(flags_&(INACTIVE|INVISIBLE|OUTPUT));}
977
996 unsigned int changed() const {return flags_ & CHANGED;}
997
1001 void set_changed() {flags_ |= CHANGED;}
1002
1006 void clear_changed() {flags_ &= ~CHANGED;}
1007
1012 void clear_active() {flags_ |= INACTIVE;}
1013
1018 void set_active() {flags_ &= ~INACTIVE;}
1019
1027 int take_focus();
1028
1035 void set_visible_focus() { flags_ |= VISIBLE_FOCUS; }
1036
1041 void clear_visible_focus() { flags_ &= ~VISIBLE_FOCUS; }
1042
1047 void visible_focus(int v) { if (v) set_visible_focus(); else clear_visible_focus(); }
1048
1053 unsigned int visible_focus() const { return flags_ & VISIBLE_FOCUS; }
1054
1075 static void default_callback(Fl_Widget *widget, void *data);
1076
1089 void do_callback(Fl_Callback_Reason reason=FL_REASON_UNKNOWN) {do_callback(this, user_data_, reason);}
1090
1098 void do_callback(Fl_Widget *widget, long arg, Fl_Callback_Reason reason=FL_REASON_UNKNOWN) {
1099 do_callback(widget, (void*)(fl_intptr_t)arg, reason);
1100 }
1101
1102 void do_callback(Fl_Widget *widget, void *arg = 0, Fl_Callback_Reason reason=FL_REASON_UNKNOWN);
1103
1104 /* Internal use only. */
1105 int test_shortcut();
1106 /* Internal use only. */
1107 static unsigned int label_shortcut(const char *t);
1108 /* Internal use only. */
1109 static int test_shortcut(const char*, const bool require_alt = false);
1110 /* Internal use only. */
1111 void _set_fullscreen() {flags_ |= FULLSCREEN;}
1112 void _clear_fullscreen() {flags_ &= ~FULLSCREEN;}
1113
1119 int contains(const Fl_Widget *w) const ;
1120
1127 int inside(const Fl_Widget *wgt) const {return wgt ? wgt->contains(this) : 0;}
1128
1132 void redraw();
1133
1138 void redraw_label();
1139
1146 uchar damage() const {return damage_;}
1147
1160 void clear_damage(uchar c = 0) {damage_ = c;}
1161
1167 void damage(uchar c);
1168
1175 void damage(uchar c, int x, int y, int w, int h);
1176
1177 void draw_label(int, int, int, int, Fl_Align) const;
1178
1186 void measure_label(int& ww, int& hh) const {label_.measure(ww, hh);}
1187
1188 Fl_Window* window() const ;
1189 Fl_Window* top_window() const;
1190 Fl_Window* top_window_offset(int& xoff, int& yoff) const;
1191
1215 virtual Fl_Group* as_group() { return NULL; }
1216 virtual Fl_Group const* as_group() const { return NULL; }
1217
1230 virtual Fl_Window* as_window() { return 0; }
1231 virtual Fl_Window const* as_window() const { return NULL; }
1232
1243 virtual class Fl_Gl_Window* as_gl_window() { return NULL; }
1244 virtual class Fl_Gl_Window const* as_gl_window() const { return NULL; }
1245
1248 int use_accents_menu() { return flags() & MAC_USE_ACCENTS_MENU; }
1249
1253 Fl_Color color2() const {return (Fl_Color)color2_;}
1254
1258 void color2(unsigned a) {color2_ = a;}
1259
1271 void shortcut_label(int value) {
1272 if (value)
1273 set_flag(SHORTCUT_LABEL);
1274 else
1275 clear_flag(SHORTCUT_LABEL);
1276 }
1277
1280 int shortcut_label() const { return flags_ & SHORTCUT_LABEL; }
1281};
1282
1288#define FL_RESERVED_TYPE 100
1289
1290#endif
Fl_Font
int Fl_Font
A font number is an index into the internal font table.
Definition Enumerations.H:1063
Fl_Align
unsigned Fl_Align
FLTK type for alignment control.
Definition Enumerations.H:986
Fl_Color
unsigned int Fl_Color
An FLTK color value; see also Colors.
Definition Enumerations.H:1120
Fl_Labeltype
Fl_Labeltype
The labeltype() method sets the type of the label.
Definition Enumerations.H:835
Fl_Fontsize
int Fl_Fontsize
Size of a font in pixels.
Definition Enumerations.H:1092
Fl_When
Fl_When
These constants determine when a callback is performed.
Definition Enumerations.H:435
Fl_Boxtype
Fl_Boxtype
FLTK standard box types.
Definition Enumerations.H:644
Fl_Callback_Reason
Fl_Callback_Reason
These constants describe why a callback is performed.
Definition Enumerations.H:455
FL_REASON_UNKNOWN
@ FL_REASON_UNKNOWN
unknown or unset reason
Definition Enumerations.H:456
Fl.H
Fl static class.
Fl_Callback
void Fl_Callback(Fl_Widget *, void *)
Default callback type definition for all fltk widgets (by far the most used)
Definition Fl_Widget.H:33
Fl_Callback0
void Fl_Callback0(Fl_Widget *)
One parameter callback type definition passing only the widget.
Definition Fl_Widget.H:37
Fl_Callback1
void Fl_Callback1(Fl_Widget *, long)
Callback type definition passing the widget and a long data value.
Definition Fl_Widget.H:39
Fl_Callback_p
Fl_Callback * Fl_Callback_p
Default callback type pointer definition for all fltk widgets.
Definition Fl_Widget.H:35
Fl_Callback_User_Data
A class prototype that allows for additional data in callbacks.
Definition Fl_Widget.H:92
Fl_Callback_User_Data::~Fl_Callback_User_Data
virtual ~Fl_Callback_User_Data()
Destructor.
Definition Fl_Widget.H:96
Fl_Callback_User_Data::Fl_Callback_User_Data
Fl_Callback_User_Data()
Protected constructor.
Definition Fl_Widget.H:94
Fl_Gl_Window
The Fl_Gl_Window widget sets things up so OpenGL works.
Definition Fl_Gl_Window.H:56
Fl_Group
The Fl_Group class is the main FLTK container widget.
Definition Fl_Group.H:56
Fl_Image
Base class for image caching, scaling and drawing.
Definition Fl_Image.H:60
Fl_Widget
Fl_Widget is the base class for all widgets in FLTK.
Definition Fl_Widget.H:112
Fl_Widget::labelcolor
Fl_Color labelcolor() const
Gets the label color.
Definition Fl_Widget.H:550
Fl_Widget::shortcut_label
void shortcut_label(int value)
Sets whether the widget's label uses '&' to indicate shortcuts.
Definition Fl_Widget.H:1271
Fl_Widget::deimage
const Fl_Image * deimage() const
Gets the image that is used as part of the widget label when in the inactive state.
Definition Fl_Widget.H:659
Fl_Widget::as_gl_window
virtual class Fl_Gl_Window * as_gl_window()
Returns an Fl_Gl_Window pointer if this widget is an Fl_Gl_Window.
Definition Fl_Widget.H:1243
Fl_Widget::labelfont
Fl_Font labelfont() const
Gets the font to use.
Definition Fl_Widget.H:565
Fl_Widget::color
Fl_Color color() const
Gets the background color of the widget.
Definition Fl_Widget.H:455
Fl_Widget::clear_visible
void clear_visible()
Hides the widget.
Definition Fl_Widget.H:914
Fl_Widget::draw
virtual void draw()=0
Draws the widget.
Fl_Widget::argument
long argument() const
Gets the current user data (long) argument that is passed to the callback function.
Definition Fl_Widget.H:811
Fl_Widget::shortcut_label
int shortcut_label() const
Returns whether the widget's label uses '&' to indicate shortcuts.
Definition Fl_Widget.H:1280
Fl_Widget::inside
int inside(const Fl_Widget *wgt) const
Checks if this widget is a child of wgt.
Definition Fl_Widget.H:1127
Fl_Widget::contains
int contains(const Fl_Widget *w) const
Checks if w is a child of this widget.
Definition Fl_Widget.cxx:283
Fl_Widget::draw_focus
void draw_focus(Fl_Boxtype t, int X, int Y, int W, int H) const
Draws a focus rectangle around the widget.
Definition Fl_Widget.H:220
Fl_Widget::bind_image
void bind_image(int f)
Bind the image to the widget, so the widget will delete the image when it is no longer needed.
Definition Fl_Widget.H:642
Fl_Widget::callback
void callback(Fl_Callback *cb)
Sets the current callback function for the widget.
Definition Fl_Widget.H:768
Fl_Widget::deimage
Fl_Image * deimage()
Gets the image that is used as part of the widget label when in the inactive state.
Definition Fl_Widget.H:654
Fl_Widget::argument
void argument(long v)
Sets the current user data (long) argument that is passed to the callback function.
Definition Fl_Widget.H:817
Fl_Widget::clear_output
void clear_output()
Sets a widget to accept input.
Definition Fl_Widget.H:969
Fl_Widget::is_label_copied
int is_label_copied() const
Returns whether the current label was assigned with copy_label().
Definition Fl_Widget.H:299
Fl_Widget::box
void box(Fl_Boxtype new_box)
Sets the box type for the widget.
Definition Fl_Widget.H:449
Fl_Widget::label
const char * label() const
Gets the current label text.
Definition Fl_Widget.H:498
Fl_Widget::vertical_label_margin
int vertical_label_margin()
Get the spacing between the label and the vertical edge of the widget.
Definition Fl_Widget.H:725
Fl_Widget::y
int y() const
Gets the widget position in its window.
Definition Fl_Widget.H:366
Fl_Widget::vertical_label_margin
void vertical_label_margin(int px)
Set the spacing between the label and the vertical edge of the widget.
Definition Fl_Widget.H:720
Fl_Widget::clear_visible_focus
void clear_visible_focus()
Disables keyboard focus navigation with this widget.
Definition Fl_Widget.H:1041
Fl_Widget::label_image_spacing
int label_image_spacing()
Return the gap size between the label and the image.
Definition Fl_Widget.H:705
Fl_Widget::h
int h() const
Gets the widget height.
Definition Fl_Widget.H:376
Fl_Widget::color
void color(Fl_Color bg, Fl_Color sel)
Sets the background and selection color of the widget.
Definition Fl_Widget.H:492
Fl_Widget::flags
unsigned int flags() const
Gets the widget flags mask.
Definition Fl_Widget.H:158
Fl_Widget::label_image_spacing
void label_image_spacing(int gap)
Set the gap between the label and the image in pixels.
Definition Fl_Widget.H:700
Fl_Widget::horizontal_label_margin
void horizontal_label_margin(int px)
Set the spacing between the label and the horizontal edge of the widget.
Definition Fl_Widget.H:710
Fl_Widget::visible_focus
void visible_focus(int v)
Modifies keyboard focus navigation.
Definition Fl_Widget.H:1047
Fl_Widget::align
Fl_Align align() const
Gets the label alignment.
Definition Fl_Widget.H:425
Fl_Widget::parent
void parent(Fl_Group *p)
Internal use only - "for hacks only".
Definition Fl_Widget.H:344
Fl_Widget::OVERRIDE
@ OVERRIDE
position window on top (Fl_Window)
Definition Fl_Widget.H:175
Fl_Widget::COPIED_TOOLTIP
@ COPIED_TOOLTIP
the widget tooltip is internally copied, its destruction is handled by the widget
Definition Fl_Widget.H:184
Fl_Widget::USERFLAG2
@ USERFLAG2
reserved for 3rd party extensions
Definition Fl_Widget.H:198
Fl_Widget::INACTIVE
@ INACTIVE
the widget can't receive focus, and is disabled but potentially visible
Definition Fl_Widget.H:167
Fl_Widget::MAC_USE_ACCENTS_MENU
@ MAC_USE_ACCENTS_MENU
On the macOS platform, pressing and holding a key on the keyboard opens an accented-character menu wi...
Definition Fl_Widget.H:186
Fl_Widget::FORCE_POSITION
@ FORCE_POSITION
don't let the window manager position the window (Fl_Window)
Definition Fl_Widget.H:171
Fl_Widget::NOBORDER
@ NOBORDER
don't draw a decoration (Fl_Window)
Definition Fl_Widget.H:170
Fl_Widget::MAXIMIZED
@ MAXIMIZED
a maximized Fl_Window
Definition Fl_Widget.H:191
Fl_Widget::TOOLTIP_WINDOW
@ TOOLTIP_WINDOW
a temporary popup, transparent to events, and dismissed easily (Fl_Window)
Definition Fl_Widget.H:180
Fl_Widget::GROUP_RELATIVE
@ GROUP_RELATIVE
Reserved, not implemented. DO NOT USE.
Definition Fl_Widget.H:183
Fl_Widget::USERFLAG3
@ USERFLAG3
reserved for 3rd party extensions
Definition Fl_Widget.H:197
Fl_Widget::USERFLAG1
@ USERFLAG1
reserved for 3rd party extensions
Definition Fl_Widget.H:199
Fl_Widget::CHANGED
@ CHANGED
the widget value changed
Definition Fl_Widget.H:174
Fl_Widget::MODAL
@ MODAL
a window blocking input to all other windows (Fl_Window)
Definition Fl_Widget.H:181
Fl_Widget::IMAGE_BOUND
@ IMAGE_BOUND
binding the image to the widget will transfer ownership, so that the widget will delete the image whe...
Definition Fl_Widget.H:188
Fl_Widget::MENU_WINDOW
@ MENU_WINDOW
a temporary popup window, dismissed by clicking outside (Fl_Window)
Definition Fl_Widget.H:179
Fl_Widget::CLIP_CHILDREN
@ CLIP_CHILDREN
all drawing within this widget will be clipped (Fl_Group)
Definition Fl_Widget.H:178
Fl_Widget::NEEDS_KEYBOARD
@ NEEDS_KEYBOARD
set on touch screen devices if a widget needs a keyboard when it gets the focus. Reserved,...
Definition Fl_Widget.H:187
Fl_Widget::SHORTCUT_LABEL
@ SHORTCUT_LABEL
the label contains a shortcut we need to draw
Definition Fl_Widget.H:173
Fl_Widget::INVISIBLE
@ INVISIBLE
the widget is not drawn, but can receive a few special events
Definition Fl_Widget.H:168
Fl_Widget::AUTO_DELETE_USER_DATA
@ AUTO_DELETE_USER_DATA
automatically call delete on the user_data pointer when destroying this widget; if set,...
Definition Fl_Widget.H:190
Fl_Widget::POPUP
@ POPUP
popup window (i.e., positioned relatively to another mapped window)
Definition Fl_Widget.H:192
Fl_Widget::VISIBLE_FOCUS
@ VISIBLE_FOCUS
accepts keyboard focus navigation if the widget can have the focus
Definition Fl_Widget.H:176
Fl_Widget::NON_MODAL
@ NON_MODAL
this is a hovering toolbar window (Fl_Window)
Definition Fl_Widget.H:172
Fl_Widget::DEIMAGE_BOUND
@ DEIMAGE_BOUND
bind the inactive image to the widget, so the widget deletes the image when it is no longer needed
Definition Fl_Widget.H:189
Fl_Widget::COPIED_LABEL
@ COPIED_LABEL
the widget label is internally copied, its destruction is handled by the widget
Definition Fl_Widget.H:177
Fl_Widget::FULLSCREEN
@ FULLSCREEN
a fullscreen window (Fl_Window)
Definition Fl_Widget.H:185
Fl_Widget::NO_OVERLAY
@ NO_OVERLAY
window not using a hardware overlay plane (Fl_Menu_Window)
Definition Fl_Widget.H:182
Fl_Widget::OUTPUT
@ OUTPUT
for output only
Definition Fl_Widget.H:169
Fl_Widget::as_group
virtual Fl_Group * as_group()
Returns an Fl_Group pointer if this widget is an Fl_Group.
Definition Fl_Widget.H:1215
Fl_Widget::set_flag
void set_flag(unsigned int c)
Sets a flag in the flags mask.
Definition Fl_Widget.H:160
Fl_Widget::tooltip
const char * tooltip() const
Gets the current tooltip text.
Definition Fl_Widget.H:731
Fl_Widget::color
void color(Fl_Color bg)
Sets the background color of the widget.
Definition Fl_Widget.H:467
Fl_Widget::do_callback
void do_callback(Fl_Widget *widget, long arg, Fl_Callback_Reason reason=FL_REASON_UNKNOWN)
Calls the widget callback function with arbitrary arguments.
Definition Fl_Widget.H:1098
Fl_Widget::align
void align(Fl_Align alignment)
Sets the label alignment.
Definition Fl_Widget.H:434
Fl_Widget::set_changed
void set_changed()
Marks the value of the widget as changed.
Definition Fl_Widget.H:1001
Fl_Widget::set_visible
void set_visible()
Makes the widget visible.
Definition Fl_Widget.H:908
Fl_Widget::measure_label
void measure_label(int &ww, int &hh) const
Sets width ww and height hh accordingly with the label size.
Definition Fl_Widget.H:1186
Fl_Widget::callback
void callback(Fl_Callback1 *cb, long p=0)
Sets the current callback function for the widget.
Definition Fl_Widget.H:783
Fl_Widget::deimage_bound
int deimage_bound() const
Returns whether the inactive image is managed by the widget.
Definition Fl_Widget.H:688
Fl_Widget::clear_active
void clear_active()
Marks the widget as inactive without sending events or changing focus.
Definition Fl_Widget.H:1012
Fl_Widget::labeltype
void labeltype(Fl_Labeltype a)
Sets the label type.
Definition Fl_Widget.H:544
Fl_Widget::set_output
void set_output()
Sets a widget to output only.
Definition Fl_Widget.H:964
Fl_Widget::user_data
void * user_data() const
Gets the user data for this widget.
Definition Fl_Widget.H:792
Fl_Widget::labelsize
void labelsize(Fl_Fontsize pix)
Sets the font size in pixels.
Definition Fl_Widget.H:586
Fl_Widget::w
int w() const
Gets the widget width.
Definition Fl_Widget.H:371
Fl_Widget::handle
virtual int handle(int event)
Handles the specified event.
Definition Fl_Widget.cxx:102
Fl_Widget::box
Fl_Boxtype box() const
Gets the box type of the widget.
Definition Fl_Widget.H:440
Fl_Widget::labelsize
Fl_Fontsize labelsize() const
Gets the font size in pixels.
Definition Fl_Widget.H:580
Fl_Widget::selection_color
Fl_Color selection_color() const
Gets the selection color.
Definition Fl_Widget.H:473
Fl_Widget::bind_deimage
void bind_deimage(int f)
Bind the inactive image to the widget, so the widget will delete the image when it is no longer neede...
Definition Fl_Widget.H:694
Fl_Widget::label
void label(Fl_Labeltype a, const char *b)
Shortcut to set the label text and type in one call.
Definition Fl_Widget.H:528
Fl_Widget::labelcolor
void labelcolor(Fl_Color c)
Sets the label color.
Definition Fl_Widget.H:556
Fl_Widget::as_window
virtual Fl_Window * as_window()
Returns an Fl_Window pointer if this widget is an Fl_Window.
Definition Fl_Widget.H:1230
Fl_Widget::callback
void callback(Fl_Callback0 *cb)
Sets the current callback function for the widget.
Definition Fl_Widget.H:774
Fl_Widget::selection_color
void selection_color(Fl_Color a)
Sets the selection color.
Definition Fl_Widget.H:483
Fl_Widget::clear_changed
void clear_changed()
Marks the value of the widget as unchanged.
Definition Fl_Widget.H:1006
Fl_Widget::labeltype
Fl_Labeltype labeltype() const
Gets the label type.
Definition Fl_Widget.H:534
Fl_Widget::x
void x(int v)
Internal use only.
Definition Fl_Widget.H:150
Fl_Widget::visible
unsigned int visible() const
Returns whether a widget is visible.
Definition Fl_Widget.H:872
Fl_Widget::output
unsigned int output() const
Returns if a widget is used for output only.
Definition Fl_Widget.H:959
Fl_Widget::callback
Fl_Callback_p callback() const
Gets the current callback function for the widget.
Definition Fl_Widget.H:740
Fl_Widget::position
void position(int X, int Y)
Repositions the window or widget.
Definition Fl_Widget.H:409
Fl_Widget::resize
virtual void resize(int x, int y, int w, int h)
Changes the size or position of the widget.
Definition Fl_Widget.cxx:138
Fl_Widget::when
void when(uchar i)
Sets the flags used to decide when a callback is called.
Definition Fl_Widget.H:866
Fl_Widget::parent
Fl_Group * parent() const
Returns a pointer to the parent widget.
Definition Fl_Widget.H:334
Fl_Widget::image
const Fl_Image * image() const
Gets the image that is used as part of the widget label when in the active state.
Definition Fl_Widget.H:596
Fl_Widget::set_visible_focus
void set_visible_focus()
Enables keyboard focus navigation with this widget.
Definition Fl_Widget.H:1035
Fl_Widget::type
void type(uchar t)
Sets the widget type.
Definition Fl_Widget.H:356
Fl_Widget::needs_keyboard
void needs_keyboard(bool needs)
Sets whether this widget needs a keyboard.
Definition Fl_Widget.H:315
Fl_Widget::color2
Fl_Color color2() const
For back compatibility only.
Definition Fl_Widget.H:1253
Fl_Widget::image
Fl_Image * image()
Gets the image that is used as part of the widget label when in the active state.
Definition Fl_Widget.H:591
Fl_Widget::when
Fl_When when() const
Returns the conditions under which the callback is called.
Definition Fl_Widget.H:827
Fl_Widget::callback
void callback(Fl_Callback *cb, Fl_Callback_User_Data *p, bool auto_free)
Sets the current callback function and managed user data for the widget.
Definition Fl_Widget.H:759
Fl_Widget::w
void w(int v)
Internal use only.
Definition Fl_Widget.H:154
Fl_Widget::callback
void callback(Fl_Callback *cb, void *p)
Sets the current callback function and data for the widget.
Definition Fl_Widget.H:747
Fl_Widget::damage
uchar damage() const
Returns non-zero if draw() needs to be called.
Definition Fl_Widget.H:1146
Fl_Widget::image_bound
int image_bound() const
Returns whether the image is managed by the widget.
Definition Fl_Widget.H:649
Fl_Widget::horizontal_label_margin
int horizontal_label_margin()
Get the spacing between the label and the horizontal edge of the widget.
Definition Fl_Widget.H:715
Fl_Widget::labelfont
void labelfont(Fl_Font f)
Sets the font to use.
Definition Fl_Widget.H:574
Fl_Widget::type
uchar type() const
Gets the widget type.
Definition Fl_Widget.H:351
Fl_Widget::set_active
void set_active()
Marks the widget as active without sending events or changing focus.
Definition Fl_Widget.H:1018
Fl_Widget::needs_keyboard
bool needs_keyboard() const
Returns whether this widget needs a keyboard.
Definition Fl_Widget.H:325
Fl_Widget::active
unsigned int active() const
Returns whether the widget is active.
Definition Fl_Widget.H:920
Fl_Widget::visible_focus
unsigned int visible_focus() const
Checks whether this widget has a visible focus.
Definition Fl_Widget.H:1053
Fl_Widget::size
void size(int W, int H)
Changes the size of the widget.
Definition Fl_Widget.H:418
Fl_Widget::draw_focus
void draw_focus() const
Draws a focus rectangle around the widget.
Definition Fl_Widget.H:211
Fl_Widget::takesevents
unsigned int takesevents() const
Returns if the widget is able to take events.
Definition Fl_Widget.H:976
Fl_Widget::color2
void color2(unsigned a)
For back compatibility only.
Definition Fl_Widget.H:1258
Fl_Widget::y
void y(int v)
Internal use only.
Definition Fl_Widget.H:152
Fl_Widget::clear_flag
void clear_flag(unsigned int c)
Clears a flag in the flags mask.
Definition Fl_Widget.H:162
Fl_Widget::h
void h(int v)
Internal use only.
Definition Fl_Widget.H:156
Fl_Widget::x
int x() const
Gets the widget position in its window.
Definition Fl_Widget.H:361
Fl_Widget::use_accents_menu
int use_accents_menu()
Returns non zero if MAC_USE_ACCENTS_MENU flag is set, 0 otherwise.
Definition Fl_Widget.H:1248
Fl_Widget::changed
unsigned int changed() const
Checks if the widget value changed since the last callback.
Definition Fl_Widget.H:996
Fl_Widget::clear_damage
void clear_damage(uchar c=0)
Clears or sets the damage flags.
Definition Fl_Widget.H:1160
Fl_Widget::do_callback
void do_callback(Fl_Callback_Reason reason=FL_REASON_UNKNOWN)
Calls the widget callback function with default arguments.
Definition Fl_Widget.H:1089
Fl_Window
This widget produces an actual window.
Definition Fl_Window.H:55
uchar
unsigned char uchar
unsigned char
Definition fl_types.h:30
fl_intptr_t
opaque fl_intptr_t
An integral type large enough to store a pointer or a long value.
Definition platform_types.h:31
Fl_Label
This struct stores all information for a text or mixed graphics label.
Definition Fl_Widget.H:49
Fl_Label::draw
void draw(int, int, int, int, Fl_Align) const
Draws the label aligned to the given box.
Definition fl_labeltype.cxx:83
Fl_Label::type
uchar type
type of label.
Definition Fl_Widget.H:65
Fl_Label::deimage
Fl_Image * deimage
optional image for a deactivated label
Definition Fl_Widget.H:55
Fl_Label::measure
void measure(int &w, int &h) const
Measures the size of the label.
Definition fl_labeltype.cxx:102
Fl_Label::size
Fl_Fontsize size
size of label font
Definition Fl_Widget.H:59
Fl_Label::value
const char * value
label text
Definition Fl_Widget.H:51
Fl_Label::align_
Fl_Align align_
alignment of label
Definition Fl_Widget.H:63
Fl_Label::color
Fl_Color color
text color
Definition Fl_Widget.H:61
Fl_Label::v_margin_
signed char v_margin_
Spacing between label and the vertically aligned side of the widget.
Definition Fl_Widget.H:69
Fl_Label::h_margin_
signed char h_margin_
Spacing between label and the horizontally aligned side of the widget.
Definition Fl_Widget.H:67
Fl_Label::spacing
uchar spacing
Spacing between an image and the label text.
Definition Fl_Widget.H:71
Fl_Label::image
Fl_Image * image
optional image for an active label
Definition Fl_Widget.H:53
Fl_Label::font
Fl_Font font
label font used in text
Definition Fl_Widget.H:57