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();
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); }
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));
int Fl_Font
A font number is an index into the internal font table.
Definition Enumerations.H:707
unsigned int Fl_Color
an FLTK color value
Definition Enumerations.H:764
int Fl_Fontsize
Size of a font in pixels.
Definition Enumerations.H:736
@ FL_WHEN_NOT_CHANGED
Do the callback whenever the user interacts with the widget.
Definition Enumerations.H:316
@ FL_WHEN_CHANGED
Do the callback only when the widget value changes.
Definition Enumerations.H:315
@ FL_WHEN_RELEASE
Do the callback when the button or key is released and the value changes.
Definition Enumerations.H:317
Fl_Boxtype
Definition Enumerations.H:472
@ FL_FLAT_BOX
a flat box
Definition Enumerations.H:475
@ FL_DOWN_BOX
see figure 1
Definition Enumerations.H:477
@ FL_UP_BOX
see figure 1
Definition Enumerations.H:476
const Fl_Align FL_ALIGN_LEFT
Align the label at the left of the widget.
Definition Enumerations.H:669
void end()
Exactly the same as current(this->parent()).
Definition Fl_Group.cxx:80
void draw()
Draws the widget.
Definition Fl_Group.cxx:742
void resize(int, int, int, int)
Resizes the Fl_Group widget and all of its children.
Definition Fl_Group.cxx:637
static int box_dx(Fl_Boxtype)
Returns the X offset for the given boxtype.
Definition fl_boxtype.cxx:334
static int box_dw(Fl_Boxtype)
Returns the width offset for the given boxtype.
Definition fl_boxtype.cxx:365
static int box_dy(Fl_Boxtype)
Returns the Y offset for the given boxtype.
Definition fl_boxtype.cxx:359
static int box_dh(Fl_Boxtype)
Returns the height offset for the given boxtype.
Definition fl_boxtype.cxx:371
utility header to pull drawing functions together
FL_EXPORT Fl_Color fl_inactive(Fl_Color c)
Returns the inactive, dimmed version of the given color.
Definition fl_color.cxx:394
Fl_Color fl_color()
Returns the last fl_color() that was set.
Definition fl_draw.H:79
void fl_polygon(int x, int y, int x1, int y1, int x2, int y2)
Fills a 3-sided polygon.
Definition fl_draw.H:255
static Fl_Widget * focus()
Gets the current Fl::focus() widget.
Definition Fl.H:709