MGUI::CTRL_COMBOBOX Class Reference

ComboBox control. More...

#include <mgui/combobox.h>

Inheritance diagram for MGUI::CTRL_COMBOBOX:

Inheritance graph
MGUI::CTRL_COMBOBOX_T\< _CT \>MGUI::CTRLMGUI::FORM
[legend]
List of all members.

Public Types

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

Public Member Functions

DEPRECATED int AddItem (ID id, const char *string, bool resize=true)
int AddItem (ID id, const MISTRING &string, bool resize=true)
DEPRECATED void AddItems (const MGUI::LISTITEMDEF *items, bool resize=true)
void AddUnitItems (int UnitType, int DftUnitID=0)
DEPRECATED void Create (MGUI::LAYOUT_PANE_BASE &ParentPane, const MGUI::LISTITEMDEF *items, int listheight=7, int width=0, MGUI::LAYOUT_SIZEALIGN sizealign=MGUI::LAYOUT_SIZEALIGN_FixedSize, STYLE style=STYLE_Default)
void Create (MGUI::LAYOUT_PANE_BASE &ParentPane, int listheight=7, int width=0, MGUI::LAYOUT_SIZEALIGN sizealign=MGUI::LAYOUT_SIZEALIGN_FixedSize, STYLE style=STYLE_Default)
 CTRL_COMBOBOX ()
void DeleteAllItems ()
void DeleteItem (int index)
void DeleteItemID (ID id)
int GetCount () const
CComboBox & GetCtrl ()
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, 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)
void SetSelectedItemID (ID id)
void SetSorted (bool sorted=true)
void SizeToContentWidth ()
virtual ~CTRL_COMBOBOX ()

Detailed Description

ComboBox control.

At present this is implemented as an OptionMenu for X.

Definition at line 94 of file combobox.h.


Member Enumeration Documentation

enum MGUI::CTRL_COMBOBOX::STYLE

Enumerator:
STYLE_Default 
STYLE_Sorted 

Definition at line 97 of file combobox.h.


Constructor & Destructor Documentation

MGUI::CTRL_COMBOBOX::CTRL_COMBOBOX (  ) 

Constructor.

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

Destructor.


Member Function Documentation

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

Add single item with string from resource lookup.

If control was created with STYLE_Sorted then the list 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.
Deprecated:
Use TEXTID with MISTRING version instead.
Parameters:
id  ID to attach to item
string  String for resource lookup
resize  Attempt to resize if needed to fit new item string

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

DEPRECATED void MGUI::CTRL_COMBOBOX::AddItems ( const MGUI::LISTITEMDEF items,
bool  resize = true 
)

Add multiple items.

Deprecated:
Use AddItem with TEXTID instead.
Parameters:
items  Items to add, terminated by item with NULL string
resize  Attempt to resize if needed to fit largest item string

void MGUI::CTRL_COMBOBOX::AddUnitItems ( int  UnitType,
int  DftUnitID = 0 
)

Add items to combobox for unit selection.

Item IDs will be equal to UnitIDs.

Parameters:
UnitType  Unit type
DftUnitID  Default unit ID

DEPRECATED void MGUI::CTRL_COMBOBOX::Create ( MGUI::LAYOUT_PANE_BASE ParentPane,
const MGUI::LISTITEMDEF items,
int  listheight = 7,
int  width = 0,
MGUI::LAYOUT_SIZEALIGN  sizealign = MGUI::LAYOUT_SIZEALIGN_FixedSize,
STYLE  style = STYLE_Default 
)

Create control.

Deprecated:
Use variant without LISTITEMDEF array and AddItem using TEXTID.
Parameters:
ParentPane  Parent pane
items  Initial item set
listheight  Maximum list height when dropped down in characters
width  Width in 'typical' characters, 0 for default

void MGUI::CTRL_COMBOBOX::Create ( MGUI::LAYOUT_PANE_BASE ParentPane,
int  listheight = 7,
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.

CComboBox& MGUI::CTRL_COMBOBOX::GetCtrl (  )  [inline]

Get reference to MFC control (MFC only).

Definition at line 195 of file combobox.h.

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,
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

Definition at line 237 of file combobox.h.

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.

Definition at line 258 of file combobox.h.

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  ) 

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

void MGUI::CTRL_COMBOBOX::SetSelectedItemID ( ID  id  ) 

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

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.


The documentation for this class was generated from the following file:
Generated on Thu Apr 26 04:48:26 2007 for TNTsdk by  doxygen 1.5.2