FLTK 1.3.0
|
A combination of the input widget and a menu button. More...
#include <Fl_Input_Choice.H>
Classes | |
class | InputMenuButton |
Public Member Functions | |
void | add (const char *s) |
Adds an item to the menu. | |
int | changed () const |
Returns the combined changed() state of the input and menu button widget. | |
void | clear () |
Removes all items from the menu. | |
void | clear_changed () |
Clears the changed() state of both input and menu button widgets. | |
Fl_Boxtype | down_box () const |
Gets the box type of the menu button. | |
void | down_box (Fl_Boxtype b) |
Sets the box type of the menu button. | |
Fl_Input_Choice (int X, int Y, int W, int H, const char *L=0) | |
Creates a new Fl_Input_Choice widget using the given position, size, and label string. | |
Fl_Input * | input () |
Returns a pointer to the internal Fl_Input widget. | |
const Fl_Menu_Item * | menu () |
Gets the Fl_Menu_Item array used for the menu. | |
void | menu (const Fl_Menu_Item *m) |
Sets the Fl_Menu_Item array used for the menu. | |
Fl_Menu_Button * | menubutton () |
Returns a pointer to the internal Fl_Menu_Button widget. | |
void | resize (int X, int Y, int W, int H) |
Resizes the Fl_Group widget and all of its children. | |
void | set_changed () |
Sets the changed() state of both input and menu button widgets to the specfied value. | |
Fl_Color | textcolor () const |
Gets the Fl_Input text field's text color. | |
void | textcolor (Fl_Color c) |
Sets the Fl_Input text field's text color to c . | |
Fl_Font | textfont () const |
Gets the Fl_Input text field's font style. | |
void | textfont (Fl_Font f) |
Sets the Fl_Input text field's font style to f . | |
Fl_Fontsize | textsize () const |
Gets the Fl_Input text field's font size. | |
void | textsize (Fl_Fontsize s) |
Sets the Fl_Input text field's font size to s . | |
const char * | value () const |
Returns the Fl_Input text field's current contents. | |
void | value (const char *val) |
Sets the Fl_Input text field's contents to val . | |
void | value (int val) |
Chooses item# val in the menu, and sets the Fl_Input text field to that value. |
A combination of the input widget and a menu button.
The user can either type into the input area, or use the menu button chooser on the right to choose an item which loads the input area with the selected text.
The application can directly access both the internal Fl_Input and Fl_Menu_Button widgets respectively using the input() and menubutton() accessor methods.
Fl_Input_Choice::Fl_Input_Choice | ( | int | X, |
int | Y, | ||
int | W, | ||
int | H, | ||
const char * | L = 0 |
||
) |
Creates a new Fl_Input_Choice widget using the given position, size, and label string.
Inherited destructor destroys the widget and any values associated with it.
void Fl_Input_Choice::add | ( | const char * | s | ) | [inline] |
Adds an item to the menu.
You can access the more complex Fl_Menu_Button::add() methods (setting callbacks, userdata, etc), via menubutton(). Example:
Fl_Input_Choice *choice = new Fl_Input_Choice(100,10,120,25,"Fonts"); Fl_Menu_Button *mb = choice->menubutton(); // use Fl_Input_Choice's Fl_Menu_Button mb->add("Helvetica", 0, MyFont_CB, (void*)mydata); // use Fl_Menu_Button's add() methods mb->add("Courier", 0, MyFont_CB, (void*)mydata); mb->add("More..", 0, FontDialog_CB, (void*)mydata);
void Fl_Input_Choice::clear | ( | ) | [inline] |
Removes all items from the menu.
Reimplemented from Fl_Group.
Fl_Input* Fl_Input_Choice::input | ( | ) | [inline] |
const Fl_Menu_Item* Fl_Input_Choice::menu | ( | ) | [inline] |
Gets the Fl_Menu_Item array used for the menu.
void Fl_Input_Choice::menu | ( | const Fl_Menu_Item * | m | ) | [inline] |
Sets the Fl_Menu_Item array used for the menu.
Fl_Menu_Button* Fl_Input_Choice::menubutton | ( | ) | [inline] |
Returns a pointer to the internal Fl_Menu_Button widget.
This can be used to access any of the methods of the menu button, e.g.
Fl_Input_Choice *choice = new Fl_Input_Choice(100,10,120,25,"Choice:"); [..] // Print all the items in the choice menu for ( int t=0; t<choice->menubutton()->size(); t++ ) { const Fl_Menu_Item &item = choice->menubutton()->menu()[t]; printf("item %d -- label=%s\n", t, item.label() ? item.label() : "(Null)"); }
void Fl_Input_Choice::resize | ( | int | X, |
int | Y, | ||
int | W, | ||
int | H | ||
) | [inline, virtual] |
Resizes the Fl_Group widget and all of its children.
The Fl_Group widget first resizes itself, and then it moves and resizes all its children according to the rules documented for Fl_Group::resizable(Fl_Widget*)
Reimplemented from Fl_Group.
void Fl_Input_Choice::set_changed | ( | ) | [inline] |
void Fl_Input_Choice::value | ( | const char * | val | ) | [inline] |
Sets the Fl_Input text field's contents to val
.
Does not affect the menu selection.
void Fl_Input_Choice::value | ( | int | val | ) | [inline] |
Chooses item# val
in the menu, and sets the Fl_Input text field to that value.
Any previous text is cleared.