MGUI::CTRL_COMBOBOX Class Reference

ComboBox control. More...

#include <mgui/combobox.h>

Inheritance diagram for MGUI::CTRL_COMBOBOX:
Inheritance graph
[legend]

List of all members.

Public Types

enum  STYLE { STYLE_Default = 0x00, STYLE_Sorted = 0x01 }

Public Member Functions

 CTRL_COMBOBOX ()
virtual ~CTRL_COMBOBOX ()
int AddItem (ID id, const MISTRING &string, bool resize=true)
void AddUnitItem (int MeasureType, int UnitID)
void AddUnitItems (int MeasureType, int DftUnitID=0)
void Create (MGUI::LAYOUT_PANE_BASE &ParentPane, int listheight=12, int width=0, MGUI::LAYOUT_SIZEALIGN sizealign=MGUI::LAYOUT_SIZEALIGN_FixedSize, STYLE style=STYLE_Default)
void DeleteAllItems ()
void DeleteItem (int index)
void DeleteItemID (ID id)
int GetCount () const
int GetIndexFromID (ID id) const
ID GetItemID (int index) const
MISTRING GetItemString (int index) const
int GetSelectedItem () const
ID GetSelectedItemID () const
void IniRead (INIHANDLE IniHandle, const char *IniGroup, const char *IniField, ID dftid, bool notify)
void IniRead (INIHANDLE IniHandle, const char *IniGroup, const char *IniField, bool notify=true)
void IniWrite (INIHANDLE IniHandle, const char *IniGroup, const char *IniField) const
int InsertItem (int index, ID id, const MISTRING &string)
bool IsItemSelected (int index) const
void SetDelegateOnSelection (DELEGATE_VOID_NOPARMS delegate)
virtual void SetEnabled (bool enabled=true)
void SetSelectedItem (int index, bool notify=false)
void SetSelectedItemID (ID id, bool notify=false)
void SetSelectedPrevious (bool notify=false)
void SetSorted (bool sorted=true)
void SizeToContentWidth ()

Private Member Functions

virtual void v_CreateEnd ()

Detailed Description

ComboBox control.

At present this is implemented as an OptionMenu for X.


Member Enumeration Documentation

Enumerator:
STYLE_Default 
STYLE_Sorted 

Constructor & Destructor Documentation

MGUI::CTRL_COMBOBOX::CTRL_COMBOBOX (  ) 

Constructor.

virtual MGUI::CTRL_COMBOBOX::~CTRL_COMBOBOX (  )  [virtual]

Destructor.


Member Function Documentation

int MGUI::CTRL_COMBOBOX::AddItem ( ID  id,
const MISTRING string,
bool  resize = true 
)

Add single item with MISTRING or TEXTID.

If control was created with STYLE_Sorted then the combo will be resorted after the item is added, otherwise the item will be added to the end of the list.

Returns:
Zero-based index of item added or error < 0.
Parameters:
id ID to attach to item
string String to show in list
resize Attempt to resize if needed to fit new item string
void MGUI::CTRL_COMBOBOX::AddUnitItem ( int  MeasureType,
int  UnitID 
)

Add item to combobox for unit selection.

Item ID will be equal to UnitID.

Parameters:
MeasureType Measurement type
UnitID Unit ID
void MGUI::CTRL_COMBOBOX::AddUnitItems ( int  MeasureType,
int  DftUnitID = 0 
)

Add items to combobox for unit selection.

Item IDs will be equal to UnitIDs.

Parameters:
MeasureType Measurement type
DftUnitID Default unit ID
void MGUI::CTRL_COMBOBOX::Create ( MGUI::LAYOUT_PANE_BASE ParentPane,
int  listheight = 12,
int  width = 0,
MGUI::LAYOUT_SIZEALIGN  sizealign = MGUI::LAYOUT_SIZEALIGN_FixedSize,
STYLE  style = STYLE_Default 
)

Create control.

Parameters:
ParentPane Parent pane
listheight Maximum list height when dropped down in characters
width Width in 'typical' characters, 0 for default
void MGUI::CTRL_COMBOBOX::DeleteAllItems (  ) 

Delete all items from control.

void MGUI::CTRL_COMBOBOX::DeleteItem ( int  index  ) 

Delete item from list given index.

Parameters:
index Zero-based index of item to delete
void MGUI::CTRL_COMBOBOX::DeleteItemID ( ID  id  ) 

Delete item from list given ID.

Parameters:
id ID of item to delete
int MGUI::CTRL_COMBOBOX::GetCount (  )  const

Retrieve number of items in the list.

int MGUI::CTRL_COMBOBOX::GetIndexFromID ( ID  id  )  const

Get index to item from ID.

Returns:
Zero-based index or -1 if no matching item found.
Parameters:
id ID of item to retrieve index of
ID MGUI::CTRL_COMBOBOX::GetItemID ( int  index  )  const

Get ID associated with list item.

Returns:
ID specified when item was added.
Parameters:
index Zero-based index of item
MISTRING MGUI::CTRL_COMBOBOX::GetItemString ( int  index  )  const

Get text string associated with list item.

Returns:
String containing text, will be empty if invalid item.
Parameters:
index Zero-based index of item
int MGUI::CTRL_COMBOBOX::GetSelectedItem (  )  const

Get currently selected item.

Returns:
Zero-based index of selected item or -1 if none selected.
ID MGUI::CTRL_COMBOBOX::GetSelectedItemID (  )  const

Get ID of currently selected item.

Returns:
ID or -1 if item was not found or none selected.
void MGUI::CTRL_COMBOBOX::IniRead ( INIHANDLE  IniHandle,
const char *  IniGroup,
const char *  IniField,
ID  dftid,
bool  notify 
)

Read setting from INI file with default ID.

If Create() has already been performed the control's state will be updated.

Parameters:
IniHandle Handle to INI file to read from, 0 for default
IniGroup INI group to read from
IniField INI field to read from
dftid Default ID
notify Call OnSelection() if control has already been created
void MGUI::CTRL_COMBOBOX::IniRead ( INIHANDLE  IniHandle,
const char *  IniGroup,
const char *  IniField,
bool  notify = true 
)

Read setting from INI file.

If Create() has already been performed the control's state will be updated.

Parameters:
IniHandle Handle to INI file to read from, 0 for default
IniGroup INI group to read from
IniField INI field to read from
notify Call OnSelection() if control has already been created
void MGUI::CTRL_COMBOBOX::IniWrite ( INIHANDLE  IniHandle,
const char *  IniGroup,
const char *  IniField 
) const [inline]

Write currently selected item ID to INI file.

Parameters:
IniHandle Handle to INI file to read from, 0 for default
IniGroup INI group to read from
IniField INI field to read from
int MGUI::CTRL_COMBOBOX::InsertItem ( int  index,
ID  id,
const MISTRING string 
)

Insert item at specified position.

Unlike the AddItem method this does not cause the list to be resorted.

Returns:
Zero-based index of item added or error < 0.
Parameters:
index Zero-based index of position at which item should be inserted
id ID to attach to item
string String to show in combo
bool MGUI::CTRL_COMBOBOX::IsItemSelected ( int  index  )  const

Determine if specified item is selected.

Parameters:
index Zero-based index of item
void MGUI::CTRL_COMBOBOX::SetDelegateOnSelection ( DELEGATE_VOID_NOPARMS  delegate  )  [inline]

Set delegate to call when user makes a selection.

virtual void MGUI::CTRL_COMBOBOX::SetEnabled ( bool  enabled = true  )  [virtual]

Set whether control is enabled.

Reimplemented from MGUI::CTRL.

void MGUI::CTRL_COMBOBOX::SetSelectedItem ( int  index,
bool  notify = false 
)

Select item using zero-based index.

If item is not visible the list will be scrolled to make it visible.

Parameters:
index Zero-based index of item, -1 to have no item selected
notify Notify delegate if selection changed
void MGUI::CTRL_COMBOBOX::SetSelectedItemID ( ID  id,
bool  notify = false 
)

Select item using item ID.

If item does not exist then no item will be selected. If item is not visible the list will be scrolled to make it visible.

Parameters:
id ID of item to select
notify Notify delegate if selection changed
void MGUI::CTRL_COMBOBOX::SetSelectedPrevious ( bool  notify = false  ) 

Set selected item to item prior to current selection.

Intended to be used in delegate to revert selection on failure.

Parameters:
notify Notify delegate if selection changed
void MGUI::CTRL_COMBOBOX::SetSorted ( bool  sorted = true  ) 

Set whether items are to be sorted or not.

void MGUI::CTRL_COMBOBOX::SizeToContentWidth (  ) 

Resize control to be able to show widest item.

virtual void MGUI::CTRL_COMBOBOX::v_CreateEnd (  )  [private, virtual]

Used to fill in the items of the combobox for a derived class.


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

Generated on Sun Oct 7 21:35:29 2012 for TNTsdk 2012 by  doxygen 1.6.1