FLTK 1.4.0
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-2020 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 
20 #ifndef Fl_Widget_H
21 #define Fl_Widget_H
22 
23 #include "Enumerations.H"
24 #include "Fl.H"
25 
26 class Fl_Widget;
27 class Fl_Window;
28 class Fl_Group;
29 class Fl_Image;
30 
32 typedef void (Fl_Callback )(Fl_Widget*, void*);
34 typedef Fl_Callback* Fl_Callback_p; // needed for BORLAND
36 typedef void (Fl_Callback0)(Fl_Widget*);
38 typedef void (Fl_Callback1)(Fl_Widget*, long);
39 
48 struct FL_EXPORT Fl_Label {
50  const char* value;
65 
67  void draw(int,int,int,int, Fl_Align) const ;
68  void measure(int &w, int &h) const ;
69 };
70 
71 
72 
85 class FL_EXPORT Fl_Widget {
86  friend class Fl_Group;
87  friend void Fl::focus(Fl_Widget*);
88 
89  Fl_Group* parent_;
90  Fl_Callback* callback_;
91  void* user_data_;
92  int x_,y_,w_,h_;
93  Fl_Label label_;
94  unsigned int flags_;
95  Fl_Color color_;
96  Fl_Color color2_;
97  uchar type_;
98  uchar damage_;
99  uchar box_;
100  uchar when_;
101 
102  const char *tooltip_;
103 
105  Fl_Widget(const Fl_Widget &);
107  Fl_Widget& operator=(const Fl_Widget &);
108 
109 protected:
110 
121  Fl_Widget(int x, int y, int w, int h, const char *label=0L);
122 
124  void x(int v) {x_ = v;}
126  void y(int v) {y_ = v;}
128  void w(int v) {w_ = v;}
130  void h(int v) {h_ = v;}
132  unsigned int flags() const {return flags_;}
134  void set_flag(unsigned int c) {flags_ |= c;}
136  void clear_flag(unsigned int c) {flags_ &= ~c;}
140  enum {
141  INACTIVE = 1<<0,
142  INVISIBLE = 1<<1,
143  OUTPUT = 1<<2,
144  NOBORDER = 1<<3,
145  FORCE_POSITION = 1<<4,
146  NON_MODAL = 1<<5,
147  SHORTCUT_LABEL = 1<<6,
148  CHANGED = 1<<7,
149  OVERRIDE = 1<<8,
150  VISIBLE_FOCUS = 1<<9,
151  COPIED_LABEL = 1<<10,
152  CLIP_CHILDREN = 1<<11,
153  MENU_WINDOW = 1<<12,
154  TOOLTIP_WINDOW = 1<<13,
155  MODAL = 1<<14,
156  NO_OVERLAY = 1<<15,
157  GROUP_RELATIVE = 1<<16,
158  COPIED_TOOLTIP = 1<<17,
159  FULLSCREEN = 1<<18,
161  // (space for more flags)
162  NEEDS_KEYBOARD = 1<<20,
163  // a tiny bit more space for new flags...
164  USERFLAG3 = 1<<29,
165  USERFLAG2 = 1<<30,
166  USERFLAG1 = 1<<31
167  };
168  void draw_box() const;
169  void draw_box(Fl_Boxtype t, Fl_Color c) const;
170  void draw_box(Fl_Boxtype t, int x,int y,int w,int h, Fl_Color c) const;
171  void draw_backdrop() const;
172 
178  void draw_focus() const {
179  draw_focus(box(), x(), y(), w(), h(), color());
180  }
181 
187  void draw_focus(Fl_Boxtype t, int X, int Y, int W, int H) const {
188  draw_focus(t, X, Y, W, H, color());
189 
190  }
191  // See documentation in Fl_Widget.cxx
192  void draw_focus(Fl_Boxtype t, int x, int y, int w, int h, Fl_Color bg) const;
193 
194  void draw_label() const;
195  void draw_label(int, int, int, int) const;
196 
197 public:
198 
207  virtual ~Fl_Widget();
208 
225  virtual void draw() = 0;
226 
243  virtual int handle(int event);
244 
253  int is_label_copied() const {return ((flags_ & COPIED_LABEL) ? 1 : 0);}
254 
260  Fl_Group* parent() const {return parent_;}
261 
270  void parent(Fl_Group* p) {parent_ = p;} // for hacks only, use Fl_Group::add()
271 
280  uchar type() const {return type_;}
281 
285  void type(uchar t) {type_ = t;}
286 
290  int x() const {return x_;}
291 
295  int y() const {return y_;}
296 
300  int w() const {return w_;}
301 
305  int h() const {return h_;}
306 
326  virtual void resize(int x, int y, int w, int h);
327 
329  int damage_resize(int,int,int,int);
330 
338  void position(int X,int Y) {resize(X,Y,w_,h_);}
339 
347  void size(int W,int H) {resize(x_,y_,W,H);}
348 
354  Fl_Align align() const {return label_.align_;}
355 
363  void align(Fl_Align alignment) {label_.align_ = alignment;}
364 
369  Fl_Boxtype box() const {return (Fl_Boxtype)box_;}
370 
378  void box(Fl_Boxtype new_box) {box_ = new_box;}
379 
384  Fl_Color color() const {return color_;}
385 
396  void color(Fl_Color bg) {color_ = bg;}
397 
402  Fl_Color selection_color() const {return color2_;}
403 
412  void selection_color(Fl_Color a) {color2_ = a;}
413 
421  void color(Fl_Color bg, Fl_Color sel) {color_=bg; color2_=sel;}
422 
427  const char* label() const {return label_.value;}
428 
440  void label(const char* text);
441 
452  void copy_label(const char *new_label);
453 
457  void label(Fl_Labeltype a, const char* b) {label_.type = a; label_.value = b;}
458 
463  Fl_Labeltype labeltype() const {return (Fl_Labeltype)label_.type;}
464 
473  void labeltype(Fl_Labeltype a) {label_.type = a;}
474 
479  Fl_Color labelcolor() const {return label_.color;}
480 
485  void labelcolor(Fl_Color c) {label_.color=c;}
486 
494  Fl_Font labelfont() const {return label_.font;}
495 
503  void labelfont(Fl_Font f) {label_.font=f;}
504 
509  Fl_Fontsize labelsize() const {return label_.size;}
510 
515  void labelsize(Fl_Fontsize pix) {label_.size=pix;}
516 
520  Fl_Image* image() {return label_.image;}
524  const Fl_Image* image() const {return label_.image;}
525 
531  void image(Fl_Image* img) {label_.image=img;}
532 
537  void image(Fl_Image& img) {label_.image=&img;}
538 
542  Fl_Image* deimage() {return label_.deimage;}
546  const Fl_Image* deimage() const {return label_.deimage;}
547 
553  void deimage(Fl_Image* img) {label_.deimage=img;}
554 
559  void deimage(Fl_Image& img) {label_.deimage=&img;}
560 
565  const char *tooltip() const {return tooltip_;}
566 
567  void tooltip(const char *text); // see Fl_Tooltip
568  void copy_tooltip(const char *text); // see Fl_Tooltip
569 
574  Fl_Callback_p callback() const {return callback_;}
575 
581  void callback(Fl_Callback* cb, void* p) {callback_ = cb; user_data_ = p;}
582 
587  void callback(Fl_Callback* cb) {callback_ = cb;}
588 
593  void callback(Fl_Callback0* cb) {callback_ = (Fl_Callback*)cb;}
594 
600  void callback(Fl_Callback1* cb, long p = 0) {
601  callback_ = (Fl_Callback*)cb;
602  user_data_ = (void*)(fl_intptr_t)p;
603  }
604 
609  void* user_data() const {return user_data_;}
610 
615  void user_data(void* v) {user_data_ = v;}
616 
631  long argument() const {return (long)(fl_intptr_t)user_data_;}
632 
637  void argument(long v) {user_data_ = (void*)(fl_intptr_t)v;}
638 
647  Fl_When when() const {return (Fl_When)when_;}
648 
680  void when(uchar i) {when_ = i;}
681 
686  unsigned int visible() const {return !(flags_&INVISIBLE);}
687 
692  int visible_r() const;
693 
711  virtual void show();
712 
716  virtual void hide();
717 
722  void set_visible() {flags_ &= ~INVISIBLE;}
723 
728  void clear_visible() {flags_ |= INVISIBLE;}
729 
734  unsigned int active() const {return !(flags_&INACTIVE);}
735 
740  int active_r() const;
741 
747  void activate();
748 
763  void deactivate();
764 
773  unsigned int output() const {return (flags_&OUTPUT);}
774 
778  void set_output() {flags_ |= OUTPUT;}
779 
783  void clear_output() {flags_ &= ~OUTPUT;}
784 
790  unsigned int takesevents() const {return !(flags_&(INACTIVE|INVISIBLE|OUTPUT));}
791 
810  unsigned int changed() const {return flags_ & CHANGED;}
811 
815  void set_changed() {flags_ |= CHANGED;}
816 
820  void clear_changed() {flags_ &= ~CHANGED;}
821 
826  void clear_active() {flags_ |= INACTIVE;}
827 
832  void set_active() {flags_ &= ~INACTIVE;}
833 
841  int take_focus();
842 
849  void set_visible_focus() { flags_ |= VISIBLE_FOCUS; }
850 
855  void clear_visible_focus() { flags_ &= ~VISIBLE_FOCUS; }
856 
861  void visible_focus(int v) { if (v) set_visible_focus(); else clear_visible_focus(); }
862 
867  unsigned int visible_focus() const { return flags_ & VISIBLE_FOCUS; }
868 
889  static void default_callback(Fl_Widget *widget, void *data);
890 
900  void do_callback() {do_callback(this, user_data_);}
901 
908  void do_callback(Fl_Widget *widget, long arg) {
909  do_callback(widget, (void*)(fl_intptr_t)arg);
910  }
911 
912  // Causes a widget to invoke its callback function with arbitrary arguments.
913  // Documentation and implementation in Fl_Widget.cxx
914  void do_callback(Fl_Widget *widget, void *arg = 0);
915 
916  /* Internal use only. */
917  int test_shortcut();
918  /* Internal use only. */
919  static unsigned int label_shortcut(const char *t);
920  /* Internal use only. */
921  static int test_shortcut(const char*, const bool require_alt = false);
922  /* Internal use only. */
923  void _set_fullscreen() {flags_ |= FULLSCREEN;}
924  void _clear_fullscreen() {flags_ &= ~FULLSCREEN;}
925 
931  int contains(const Fl_Widget *w) const ;
932 
939  int inside(const Fl_Widget *wgt) const {return wgt ? wgt->contains(this) : 0;}
940 
944  void redraw();
945 
950  void redraw_label();
951 
958  uchar damage() const {return damage_;}
959 
972  void clear_damage(uchar c = 0) {damage_ = c;}
973 
979  void damage(uchar c);
980 
987  void damage(uchar c, int x, int y, int w, int h);
988 
989  void draw_label(int, int, int, int, Fl_Align) const;
990 
998  void measure_label(int& ww, int& hh) const {label_.measure(ww, hh);}
999 
1000  Fl_Window* window() const ;
1001  Fl_Window* top_window() const;
1002  Fl_Window* top_window_offset(int& xoff, int& yoff) const;
1003 
1027  virtual Fl_Group* as_group() {return 0;}
1028 
1041  virtual Fl_Window* as_window() {return 0;}
1042 
1053  virtual class Fl_Gl_Window* as_gl_window() {return 0;}
1054 
1058 
1062  Fl_Color color2() const {return (Fl_Color)color2_;}
1063 
1067  void color2(unsigned a) {color2_ = a;}
1068 
1080  void shortcut_label(int value) {
1081  if (value)
1083  else
1085  }
1086 
1089  int shortcut_label() const { return flags_ & SHORTCUT_LABEL; }
1090 };
1091 
1097 #define FL_RESERVED_TYPE 100
1098 
1099 #endif
This file contains type definitions and general enumerations.
int Fl_Font
A font number is an index into the internal font table.
Definition: Enumerations.H:985
unsigned Fl_Align
FLTK type for alignment control.
Definition: Enumerations.H:908
unsigned int Fl_Color
An FLTK color value; see also Colors
Definition: Enumerations.H:1042
Fl_Labeltype
The labeltype() method sets the type of the label.
Definition: Enumerations.H:757
int Fl_Fontsize
Size of a font in pixels.
Definition: Enumerations.H:1014
Fl_When
These constants determine when a callback is performed.
Definition: Enumerations.H:421
Fl_Boxtype
FLTK standard box types.
Definition: Enumerations.H:598
Fl static class.
void() Fl_Callback1(Fl_Widget *, long)
Callback type definition passing the widget and a long data value.
Definition: Fl_Widget.H:38
void() Fl_Callback(Fl_Widget *, void *)
Default callback type definition for all fltk widgets (by far the most used)
Definition: Fl_Widget.H:32
void() Fl_Callback0(Fl_Widget *)
One parameter callback type definition passing only the widget.
Definition: Fl_Widget.H:36
Fl_Callback * Fl_Callback_p
Default callback type pointer definition for all fltk widgets.
Definition: Fl_Widget.H:34
The Fl_Gl_Window widget sets things up so OpenGL works.
Definition: Fl_Gl_Window.H:56
The Fl_Group class is the FLTK container widget.
Definition: Fl_Group.H:50
int handle(int)
Handles the specified event.
Definition: Fl_Group.cxx:145
void resize(int, int, int, int)
Resizes the Fl_Group widget and all of its children.
Definition: Fl_Group.cxx:823
Base class for image caching, scaling and drawing.
Definition: Fl_Image.H:60
Fl_Widget is the base class for all widgets in FLTK.
Definition: Fl_Widget.H:85
Fl_Color labelcolor() const
Gets the label color.
Definition: Fl_Widget.H:479
void shortcut_label(int value)
Sets whether the widget's label uses '&' to indicate shortcuts.
Definition: Fl_Widget.H:1080
Fl_Image * deimage()
Gets the image that is used as part of the widget label when in the inactive state.
Definition: Fl_Widget.H:542
Fl_Font labelfont() const
Gets the font to use.
Definition: Fl_Widget.H:494
static void default_callback(Fl_Widget *widget, void *data)
The default callback for all widgets that don't set a callback.
Definition: Fl_Widget.cxx:38
Fl_Color color() const
Gets the background color of the widget.
Definition: Fl_Widget.H:384
void clear_visible()
Hides the widget.
Definition: Fl_Widget.H:728
virtual void draw()=0
Draws the widget.
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:546
virtual void hide()
Makes a widget invisible.
Definition: Fl_Widget.cxx:275
long argument() const
Gets the current user data (long) argument that is passed to the callback function.
Definition: Fl_Widget.H:631
void redraw_label()
Schedules the drawing of the label.
Definition: Fl.cxx:1530
int active_r() const
Returns whether the widget and all of its parents are active.
Definition: Fl_Widget.cxx:257
void user_data(void *v)
Sets the user data for this widget.
Definition: Fl_Widget.H:615
void image(Fl_Image *img)
Sets the image to use as part of the widget label when in the active state.
Definition: Fl_Widget.H:531
int shortcut_label() const
Returns whether the widget's label uses '&' to indicate shortcuts.
Definition: Fl_Widget.H:1089
void deactivate()
Deactivates the widget.
Definition: Fl_Widget.cxx:245
int inside(const Fl_Widget *wgt) const
Checks if this widget is a child of wgt.
Definition: Fl_Widget.H:939
int contains(const Fl_Widget *w) const
Checks if w is a child of this widget.
Definition: Fl_Widget.cxx:295
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:187
void callback(Fl_Callback *cb)
Sets the current callback function for the widget.
Definition: Fl_Widget.H:587
void deimage(Fl_Image *img)
Sets the image to use as part of the widget label when in the inactive state.
Definition: Fl_Widget.H:553
void do_callback()
Calls the widget callback function with default arguments.
Definition: Fl_Widget.H:900
void argument(long v)
Sets the current user data (long) argument that is passed to the callback function.
Definition: Fl_Widget.H:637
Fl_Image * image()
Gets the image that is used as part of the widget label when in the active state.
Definition: Fl_Widget.H:520
void clear_output()
Sets a widget to accept input.
Definition: Fl_Widget.H:783
int is_label_copied() const
Returns whether the current label was assigned with copy_label().
Definition: Fl_Widget.H:253
void box(Fl_Boxtype new_box)
Sets the box type for the widget.
Definition: Fl_Widget.H:378
virtual Fl_Window * as_window()
Returns an Fl_Window pointer if this widget is an Fl_Window.
Definition: Fl_Widget.H:1041
int y() const
Gets the widget position in its window.
Definition: Fl_Widget.H:295
void clear_visible_focus()
Disables keyboard focus navigation with this widget.
Definition: Fl_Widget.H:855
int h() const
Gets the widget height.
Definition: Fl_Widget.H:305
int damage_resize(int, int, int, int)
Internal use only.
Definition: Fl_Widget.cxx:141
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:1053
void color(Fl_Color bg, Fl_Color sel)
Sets the background and selection color of the widget.
Definition: Fl_Widget.H:421
unsigned int flags() const
Gets the widget flags mask.
Definition: Fl_Widget.H:132
virtual Fl_Group * as_group()
Returns an Fl_Group pointer if this widget is an Fl_Group.
Definition: Fl_Widget.H:1027
void visible_focus(int v)
Modifies keyboard focus navigation.
Definition: Fl_Widget.H:861
Fl_Align align() const
Gets the label alignment.
Definition: Fl_Widget.H:354
void parent(Fl_Group *p)
Internal use only - "for hacks only".
Definition: Fl_Widget.H:270
Fl_Group * parent() const
Returns a pointer to the parent widget.
Definition: Fl_Widget.H:260
void set_flag(unsigned int c)
Sets a flag in the flags mask.
Definition: Fl_Widget.H:134
void deimage(Fl_Image &img)
Sets the image to use as part of the widget label when in the inactive state.
Definition: Fl_Widget.H:559
Fl_Window * top_window() const
Returns a pointer to the top-level window for the widget.
Definition: Fl_Window.cxx:119
void color(Fl_Color bg)
Sets the background color of the widget.
Definition: Fl_Widget.H:396
void align(Fl_Align alignment)
Sets the label alignment.
Definition: Fl_Widget.H:363
void draw_box() const
Draws the widget box according its box style.
Definition: fl_boxtype.cxx:442
void set_changed()
Marks the value of the widget as changed.
Definition: Fl_Widget.H:815
void set_visible()
Makes the widget visible.
Definition: Fl_Widget.H:722
void measure_label(int &ww, int &hh) const
Sets width ww and height hh accordingly with the label size.
Definition: Fl_Widget.H:998
void callback(Fl_Callback1 *cb, long p=0)
Sets the current callback function for the widget.
Definition: Fl_Widget.H:600
Fl_Window * window() const
Returns a pointer to the nearest parent window up the widget hierarchy.
Definition: Fl_Window.cxx:107
void clear_active()
Marks the widget as inactive without sending events or changing focus.
Definition: Fl_Widget.H:826
@ OVERRIDE
position window on top (Fl_Window)
Definition: Fl_Widget.H:149
@ COPIED_TOOLTIP
the widget tooltip is internally copied, its destruction is handled by the widget
Definition: Fl_Widget.H:158
@ USERFLAG2
reserved for 3rd party extensions
Definition: Fl_Widget.H:165
@ INACTIVE
the widget can't receive focus, and is disabled but potentially visible
Definition: Fl_Widget.H:141
@ MAC_USE_ACCENTS_MENU
On the Mac OS platform, pressing and holding a key on the keyboard opens an accented-character menu w...
Definition: Fl_Widget.H:160
@ FORCE_POSITION
don't let the window manager position the window (Fl_Window)
Definition: Fl_Widget.H:145
@ NOBORDER
don't draw a decoration (Fl_Window)
Definition: Fl_Widget.H:144
@ TOOLTIP_WINDOW
a temporary popup, transparent to events, and dismissed easily (Fl_Window)
Definition: Fl_Widget.H:154
@ GROUP_RELATIVE
Reserved, not implemented. DO NOT USE.
Definition: Fl_Widget.H:157
@ USERFLAG3
reserved for 3rd party extensions
Definition: Fl_Widget.H:164
@ USERFLAG1
reserved for 3rd party extensions
Definition: Fl_Widget.H:166
@ CHANGED
the widget value changed
Definition: Fl_Widget.H:148
@ MODAL
a window blocking input to all other winows (Fl_Window)
Definition: Fl_Widget.H:155
@ MENU_WINDOW
a temporary popup window, dismissed by clicking outside (Fl_Window)
Definition: Fl_Widget.H:153
@ CLIP_CHILDREN
all drawing within this widget will be clipped (Fl_Group)
Definition: Fl_Widget.H:152
@ NEEDS_KEYBOARD
set this on touch screen devices if a widget needs a keyboard when it gets Focus.
Definition: Fl_Widget.H:162
@ SHORTCUT_LABEL
the label contains a shortcut we need to draw
Definition: Fl_Widget.H:147
@ INVISIBLE
the widget is not drawn, but can receive a few special events
Definition: Fl_Widget.H:142
@ VISIBLE_FOCUS
accepts keyboard focus navigation if the widget can have the focus
Definition: Fl_Widget.H:150
@ NON_MODAL
this is a hovering toolbar window (Fl_Window)
Definition: Fl_Widget.H:146
@ COPIED_LABEL
the widget label is internally copied, its destruction is handled by the widget
Definition: Fl_Widget.H:151
@ FULLSCREEN
a fullscreen window (Fl_Window)
Definition: Fl_Widget.H:159
@ NO_OVERLAY
window not using a hardware overlay plane (Fl_Menu_Window)
Definition: Fl_Widget.H:156
@ OUTPUT
for output only
Definition: Fl_Widget.H:143
void labeltype(Fl_Labeltype a)
Sets the label type.
Definition: Fl_Widget.H:473
void * user_data() const
Gets the user data for this widget.
Definition: Fl_Widget.H:609
void set_output()
Sets a widget to output only.
Definition: Fl_Widget.H:778
void labelsize(Fl_Fontsize pix)
Sets the font size in pixels.
Definition: Fl_Widget.H:515
int w() const
Gets the widget width.
Definition: Fl_Widget.H:300
Fl_Boxtype box() const
Gets the box type of the widget.
Definition: Fl_Widget.H:369
Fl_Fontsize labelsize() const
Gets the font size in pixels.
Definition: Fl_Widget.H:509
Fl_Color selection_color() const
Gets the selection color.
Definition: Fl_Widget.H:402
const char * label() const
Gets the current label text.
Definition: Fl_Widget.H:427
static unsigned int label_shortcut(const char *t)
Returns the Unicode value of the '&x' shortcut in a given text.
Definition: fl_shortcut.cxx:301
void label(Fl_Labeltype a, const char *b)
Shortcut to set the label text and type in one call.
Definition: Fl_Widget.H:457
void redraw()
Schedules the drawing of the widget.
Definition: Fl.cxx:1526
void draw_label() const
Draws the widget's label at the defined label position.
Definition: fl_labeltype.cxx:105
void labelcolor(Fl_Color c)
Sets the label color.
Definition: Fl_Widget.H:485
int take_focus()
Gives the widget the keyboard focus.
Definition: Fl_Widget.cxx:148
void callback(Fl_Callback0 *cb)
Sets the current callback function for the widget.
Definition: Fl_Widget.H:593
void copy_label(const char *new_label)
Sets the current label.
Definition: Fl_Widget.cxx:314
void selection_color(Fl_Color a)
Sets the selection color.
Definition: Fl_Widget.H:412
virtual void show()
Makes a widget visible.
Definition: Fl_Widget.cxx:263
const char * tooltip() const
Gets the current tooltip text.
Definition: Fl_Widget.H:565
int test_shortcut()
Returns true if the widget's label contains the entered '&x' shortcut.
Definition: fl_shortcut.cxx:369
void clear_changed()
Marks the value of the widget as unchanged.
Definition: Fl_Widget.H:820
Fl_Labeltype labeltype() const
Gets the label type.
Definition: Fl_Widget.H:463
void x(int v)
Internal use only.
Definition: Fl_Widget.H:124
unsigned int visible() const
Returns whether a widget is visible.
Definition: Fl_Widget.H:686
unsigned int output() const
Returns if a widget is used for output only.
Definition: Fl_Widget.H:773
Fl_Callback_p callback() const
Gets the current callback function for the widget.
Definition: Fl_Widget.H:574
void position(int X, int Y)
Repositions the window or widget.
Definition: Fl_Widget.H:338
int visible_r() const
Returns whether a widget and all its parents are visible.
Definition: Fl_Widget.cxx:287
virtual ~Fl_Widget()
Destroys the widget.
Definition: Fl_Widget.cxx:164
void when(uchar i)
Sets the flags used to decide when a callback is called.
Definition: Fl_Widget.H:680
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:524
void set_visible_focus()
Enables keyboard focus navigation with this widget.
Definition: Fl_Widget.H:849
void type(uchar t)
Sets the widget type.
Definition: Fl_Widget.H:285
void do_callback(Fl_Widget *widget, long arg)
Calls the widget callback function with arbitrary arguments.
Definition: Fl_Widget.H:908
Fl_Color color2() const
For back compatibility only.
Definition: Fl_Widget.H:1062
Fl_When when() const
Returns the conditions under which the callback is called.
Definition: Fl_Widget.H:647
void w(int v)
Internal use only.
Definition: Fl_Widget.H:128
void callback(Fl_Callback *cb, void *p)
Sets the current callback function for the widget.
Definition: Fl_Widget.H:581
uchar damage() const
Returns non-zero if draw() needs to be called.
Definition: Fl_Widget.H:958
void labelfont(Fl_Font f)
Sets the font to use.
Definition: Fl_Widget.H:503
uchar type() const
Gets the widget type.
Definition: Fl_Widget.H:280
void set_active()
Marks the widget as active without sending events or changing focus.
Definition: Fl_Widget.H:832
void activate()
Activates the widget.
Definition: Fl_Widget.cxx:233
unsigned int active() const
Returns whether the widget is active.
Definition: Fl_Widget.H:734
unsigned int visible_focus() const
Checks whether this widget has a visible focus.
Definition: Fl_Widget.H:867
void size(int W, int H)
Changes the size of the widget.
Definition: Fl_Widget.H:347
void draw_focus() const
Draws a focus rectangle around the widget.
Definition: Fl_Widget.H:178
unsigned int takesevents() const
Returns if the widget is able to take events.
Definition: Fl_Widget.H:790
void color2(unsigned a)
For back compatibility only.
Definition: Fl_Widget.H:1067
void y(int v)
Internal use only.
Definition: Fl_Widget.H:126
void clear_flag(unsigned int c)
Clears a flag in the flags mask.
Definition: Fl_Widget.H:136
void h(int v)
Internal use only.
Definition: Fl_Widget.H:130
int x() const
Gets the widget position in its window.
Definition: Fl_Widget.H:290
int use_accents_menu()
Returns non zero if MAC_USE_ACCENTS_MENU flag is set, 0 otherwise.
Definition: Fl_Widget.H:1057
void draw_backdrop() const
If FL_ALIGN_IMAGE_BACKDROP is set, the image or deimage will be drawn.
Definition: fl_boxtype.cxx:447
unsigned int changed() const
Checks if the widget value changed since the last callback.
Definition: Fl_Widget.H:810
void copy_tooltip(const char *text)
Sets the current tooltip text.
Definition: Fl_Tooltip.cxx:378
void clear_damage(uchar c=0)
Clears or sets the damage flags.
Definition: Fl_Widget.H:972
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.
Definition: Fl_Window.cxx:130
void image(Fl_Image &img)
Sets the image to use as part of the widget label when in the active state.
Definition: Fl_Widget.H:537
This widget produces an actual window.
Definition: Fl_Window.H:52
unsigned char uchar
unsigned char
Definition: fl_types.h:28
static Fl_Widget * focus()
Gets the current Fl::focus() widget.
Definition: Fl.H:839
opaque fl_intptr_t
An integral type large enough to store a pointer or a long value.
Definition: platform_types.h:28
This struct stores all information for a text or mixed graphics label.
Definition: Fl_Widget.H:48
uchar type
type of label.
Definition: Fl_Widget.H:64
Fl_Image * deimage
optional image for a deactivated label
Definition: Fl_Widget.H:54
void measure(int &w, int &h) const
Measures the size of the label.
Definition: fl_labeltype.cxx:92
Fl_Fontsize size
size of label font
Definition: Fl_Widget.H:58
const char * value
label text
Definition: Fl_Widget.H:50
Fl_Align align_
alignment of label
Definition: Fl_Widget.H:62
Fl_Color color
text color
Definition: Fl_Widget.H:60
Fl_Image * image
optional image for an active label
Definition: Fl_Widget.H:52
Fl_Font font
label font used in text
Definition: Fl_Widget.H:56