38 #ifndef Fl_Input_Choice_H
39 #define Fl_Input_Choice_H
42 #include <FL/Fl_Group.H>
43 #include <FL/Fl_Input.H>
44 #include <FL/Fl_Menu_Button.H>
65 int xc = x()+w()/2, yc=y()+h()/2;
70 InputMenuButton(
int x,
int y,
int w,
int h,
const char*l=0) :
75 InputMenuButton *menu_;
77 static void menu_cb(
Fl_Widget*,
void *data) {
81 if (item && item->
flags & (FL_SUBMENU|FL_SUBMENU_POINTER))
return;
82 if (!strcmp(o->inp_->
value(), o->menu_->text()))
84 o->Fl_Widget::clear_changed();
90 o->inp_->
value(o->menu_->text());
92 o->Fl_Widget::set_changed();
101 o->Fl_Widget::clear_changed();
106 static void inp_cb(
Fl_Widget*,
void *data) {
110 o->Fl_Widget::set_changed();
114 o->Fl_Widget::clear_changed();
122 o->Fl_Widget::clear_changed();
133 inline int menu_w() {
return(20); }
145 inp_ =
new Fl_Input(inp_x(), inp_y(),
147 inp_->callback(inp_cb, (
void*)
this);
150 menu_ =
new InputMenuButton(menu_x(), menu_y(),
152 menu_->callback(menu_cb, (
void*)
this);
158 void add(
const char *s) { menu_->add(s); }
161 inp_->clear_changed();
178 void resize(
int X,
int Y,
int W,
int H) {
180 inp_->resize(inp_x(), inp_y(), inp_w(), inp_h());
181 menu_->resize(menu_x(), menu_y(), menu_w(), menu_h());
196 const char*
value()
const {
return (inp_->value()); }
204 void value(
const char *val) { inp_->value(val); }
208 inp_->value(menu_->text(val));
218 #endif // !Fl_Input_Choice_H
Do the callback when the button or key is released and the value changes.
Definition: Enumerations.H:309
static Fl_Widget * focus()
Gets the current Fl::focus() widget.
Definition: Fl.H:706
see figure 1
Definition: Enumerations.H:469
static int box_dw(Fl_Boxtype)
Returns the width offset for the given boxtype.
Definition: fl_boxtype.cxx:350
Do the callback whenever the user interacts with the widget.
Definition: Enumerations.H:308
void fl_color(Fl_Color c)
Sets the color for all subsequent drawing operations.
Definition: fl_draw.H:61
static int box_dy(Fl_Boxtype)
Returns the Y offset for the given boxtype.
Definition: fl_boxtype.cxx:344
void end()
Exactly the same as current(this->parent()).
Definition: Fl_Group.cxx:80
Do the callback only when the widget value changes.
Definition: Enumerations.H:307
Fl_Boxtype
Definition: Enumerations.H:464
see figure 1
Definition: Enumerations.H:468
The Fl_Group class is the FLTK container widget.
Definition: Fl_Group.H:45
static int box_dx(Fl_Boxtype)
Returns the X offset for the given boxtype.
Definition: fl_boxtype.cxx:319
FL_EXPORT Fl_Color fl_inactive(Fl_Color c)
Returns the inactive, dimmed version of the given color.
Definition: fl_color.cxx:432
int Fl_Fontsize
Size of a font in pixels.
Definition: Enumerations.H:741
static int box_dh(Fl_Boxtype)
Returns the height offset for the given boxtype.
Definition: fl_boxtype.cxx:356
void resize(int, int, int, int)
Resizes the Fl_Group widget and all of its children.
Definition: Fl_Group.cxx:637
utility header to pull drawing functions together
unsigned int Fl_Color
an FLTK color value
Definition: Enumerations.H:769
int Fl_Font
A font number is an index into the internal font table.
Definition: Enumerations.H:712
a flat box
Definition: Enumerations.H:467
void fl_polygon(int x, int y, int x1, int y1, int x2, int y2)
Fills a 3-sided polygon.
Definition: fl_draw.H:253
const Fl_Align FL_ALIGN_LEFT
Align the label at the left of the widget.
Definition: Enumerations.H:674