FLTK 1.3.2

- Main Page
- Related Pages
- Modules
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Classes | Public Member Functions
Fl_Input_Choice Class Reference

A combination of the input widget and a menu button. More...

`#include <Fl_Input_Choice.H>`

Inheritance diagram for Fl_Input_Choice:

List of all members.

## 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.

## Detailed Description

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.

## Constructor & Destructor Documentation

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.

## Member Function Documentation

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);

int Fl_Input_Choice::changed | ( |  | ) | const`[inline]`

Returns the combined changed() state of the input and menu button widget.

Reimplemented from Fl_Widget.

void Fl_Input_Choice::clear | ( |  | ) | `[inline]`

Removes all items from the menu.

Reimplemented from Fl_Group.

void Fl_Input_Choice::clear_changed | ( |  | ) | `[inline]`

Clears the changed() state of both input and menu button widgets.

Reimplemented from Fl_Widget.

Fl_Input* Fl_Input_Choice::input | ( |  | ) | `[inline]`

Returns a pointer to the internal Fl_Input widget.

This can be used to directly access all of the Fl_Input widget's methods.

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*)

See also:
  Fl_Group::resizable(Fl_Widget*)
  Fl_Group::resizable()
  Fl_Widget::resize(int,int,int,int)

Reimplemented from Fl_Group.

void Fl_Input_Choice::set_changed | ( |  | ) | `[inline]`

Sets the changed() state of both input and menu button widgets to the specfied value.

Reimplemented from Fl_Widget.

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.

The documentation for this class was generated from the following files:

- Fl_Input_Choice.H
- Fl_Group.cxx