Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FX::FXComboBox Class Reference

A Combo Box provides a way to select a string from a list of strings. More...

#include <FXComboBox.h>

Inheritance diagram for FX::FXComboBox:
FX::FXPacker FX::FXComposite FX::FXWindow FX::FXDrawable FX::FXId FX::FXObject

List of all members.

Public Types

enum  { ID_LIST = FXPacker::ID_LAST, ID_TEXT, ID_LAST }

Public Member Functions

long onFocusUp (FXObject *, FXSelector, void *)
long onFocusDown (FXObject *, FXSelector, void *)
long onFocusSelf (FXObject *, FXSelector, void *)
long onMouseWheel (FXObject *, FXSelector, void *)
long onTextButton (FXObject *, FXSelector, void *)
long onTextChanged (FXObject *, FXSelector, void *)
long onTextCommand (FXObject *, FXSelector, void *)
long onListClicked (FXObject *, FXSelector, void *)
long onListCommand (FXObject *, FXSelector, void *)
long onFwdToText (FXObject *, FXSelector, void *)
long onUpdFmText (FXObject *, FXSelector, void *)
 FXComboBox (FXComposite *p, FXint cols, FXObject *tgt=NULL, FXSelector sel=0, FXuint opts=COMBOBOX_NORMAL, FXint x=0, FXint y=0, FXint w=0, FXint h=0, FXint pl=DEFAULT_PAD, FXint pr=DEFAULT_PAD, FXint pt=DEFAULT_PAD, FXint pb=DEFAULT_PAD)
 Construct a Combo Box widget with room to display cols columns of text.
virtual void create ()
 Create server-side resources.
virtual void detach ()
 Detach server-side resources.
virtual void destroy ()
 Destroy server-side resources.
virtual void enable ()
 Enable combo box.
virtual void disable ()
 Disable combo box.
virtual FXint getDefaultWidth ()
 Return default width.
virtual FXint getDefaultHeight ()
 Return default height.
virtual void layout ()
 Perform layout.
FXbool isEditable () const
 Return true if combobox is editable.
void setEditable (FXbool edit=true)
 Set editable state.
void setText (const FXString &text, FXbool notify=false)
 Set the text; selects the matching item.
FXString getText () const
 Get the text.
void setNumColumns (FXint cols)
 Set the number of columns.
FXint getNumColumns () const
 Get the number of columns.
void setJustify (FXuint mode)
 Change text justification mode; default is JUSTIFY_LEFT.
FXuint getJustify () const
 Return text justification mode.
FXint getNumItems () const
 Return the number of items in the list.
FXint getNumVisible () const
 Return the number of visible items.
void setNumVisible (FXint nvis)
 Set the number of visible items in the drop down list.
FXbool isItemCurrent (FXint index) const
 Return true if current item.
void setCurrentItem (FXint index, FXbool notify=false)
 Set the current item (index is zero-based)
FXint getCurrentItem () const
 Get the current item's index.
FXString getItem (FXint index) const
 Return the item at the given index.
FXint setItem (FXint index, const FXString &text, void *ptr=NULL, FXbool notify=false)
 Replace the item at index.
FXint fillItems (const FXchar **strings, FXbool notify=false)
 Fill combo box by appending items from array of strings.
FXint fillItems (const FXString &strings, FXbool notify=false)
 Fill combo box by appending items from newline separated strings.
FXint insertItem (FXint index, const FXString &text, void *ptr=NULL, FXbool notify=false)
 Insert a new item at index.
FXint appendItem (const FXString &text, void *ptr=NULL, FXbool notify=false)
 Append an item to the list.
FXint prependItem (const FXString &text, void *ptr=NULL, FXbool notify=false)
 Prepend an item to the list.
FXint moveItem (FXint newindex, FXint oldindex, FXbool notify=false)
 Move item from oldindex to newindex.
void removeItem (FXint index, FXbool notify=false)
 Remove this item from the list.
void clearItems (FXbool notify=false)
 Remove all items from the list.
FXint findItem (const FXString &text, FXint start=-1, FXuint flags=SEARCH_FORWARD|SEARCH_WRAP) const
 Search items by name, beginning from item start.
FXint findItemByData (const void *ptr, FXint start=-1, FXuint flags=SEARCH_FORWARD|SEARCH_WRAP) const
 Search items by associated user data, beginning from item start.
void setItemText (FXint index, const FXString &text)
 Set text for specified item.
FXString getItemText (FXint index) const
 Get text for specified item.
void setItemData (FXint index, void *ptr) const
 Set data pointer for specified item.
void * getItemData (FXint index) const
 Get data pointer for specified item.
void showMenu (FXbool shw)
 Show or hide menu.
FXbool isMenuShown () const
 Is the menu pane shown.
void sortItems ()
 Sort items using current sort function.
void setFont (FXFont *fnt)
 Set text font.
FXFontgetFont () const
 Get text font.
void setComboStyle (FXuint mode)
 Set the combobox style.
FXuint getComboStyle () const
 Get the combobox style.
void setShrinkWrap (FXbool flag)
 Change popup pane shrinkwrap mode.
FXbool getShrinkWrap () const
 Return popup pane shrinkwrap mode.
virtual void setBackColor (FXColor clr)
 Set window background color.
FXColor getBackColor () const
 Get background color.
void setTextColor (FXColor clr)
 Change text color.
FXColor getTextColor () const
 Return text color.
void setSelBackColor (FXColor clr)
 Change selected background color.
FXColor getSelBackColor () const
 Return selected background color.
void setSelTextColor (FXColor clr)
 Change selected text color.
FXColor getSelTextColor () const
 Return selected text color.
FXListSortFunc getSortFunc () const
 Return sort function.
void setSortFunc (FXListSortFunc func)
 Change sort function.
void setHelpText (const FXString &txt)
 Set the combobox help text.
const FXStringgetHelpText () const
 Get the combobox help text.
void setTipText (const FXString &txt)
 Set the tool tip message for this combobox.
const FXStringgetTipText () const
 Get the tool tip message for this combobox.
virtual void save (FXStream &store) const
 Save combobox to a stream.
virtual void load (FXStream &store)
 Load combobox from a stream.
virtual ~FXComboBox ()
 Destructor.

Protected Attributes

FXTextFieldfield
FXMenuButtonbutton
FXListlist
FXPopuppane

Detailed Description

A Combo Box provides a way to select a string from a list of strings.

Unless COMBOBOX_STATIC is passed, it also allows the user to enter a new string into the text field, for example if the desired entry is not in the list of strings. Passing COMBOBOX_REPLACE, COMBOBOX_INSERT_BEFORE, COMBOBOX_INSERT_AFTER, COMBOBOX_INSERT_FIRST, or COMBOBOX_INSERT_LAST causes a newly entered text to replace the current one in the list, or be added before or after the current entry, or to be added at the beginning or end of the list. Combo Box is intended to enter text; if you need to enter a choice from a list of options, it is recommended that the List Box widget is used instead. When the text in the field is changed, a SEL_COMMAND will be send to the target. The Combo Box can also receive ID_GETSTRINGVALUE and ID_SETSTRINGVALUE and so on, which will behave similar to Text Field in that they will retrieve or update the value of the field.


Member Function Documentation

FXint FX::FXComboBox::findItem ( const FXString text,
FXint  start = -1,
FXuint  flags = SEARCH_FORWARD|SEARCH_WRAP 
) const

Search items by name, beginning from item start.

If the start item is -1 the search will start at the first item in the list. Flags may be SEARCH_FORWARD or SEARCH_BACKWARD to control the search direction; this can be combined with SEARCH_NOWRAP or SEARCH_WRAP to control whether the search wraps at the start or end of the list. The option SEARCH_IGNORECASE causes a case-insensitive match. Finally, passing SEARCH_PREFIX causes searching for a prefix of the item name. Return -1 if no matching item is found.

FXint FX::FXComboBox::findItemByData ( const void *  ptr,
FXint  start = -1,
FXuint  flags = SEARCH_FORWARD|SEARCH_WRAP 
) const

Search items by associated user data, beginning from item start.

If the start item is -1 the search will start at the first item in the list. Flags may be SEARCH_FORWARD or SEARCH_BACKWARD to control the search direction; this can be combined with SEARCH_NOWRAP or SEARCH_WRAP to control whether the search wraps at the start or end of the list.


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

Copyright © 1997-2011 Jeroen van der Zijp