#include <ComboBox.h>
Widget to select an option from a drop down list.
Public Member Functions | |
ComboBox (Widget *parent, Style style=ComboBoxStyle) | |
virtual | ~ComboBox () |
int | addItem (const String &text) |
(CB_ADDSTRING) | |
void | insertItem (int itemIndex, const String &text) |
(CB_INSERTSTRING) | |
void | removeItem (int itemIndex) |
(CB_DELETESTRING) | |
void | removeAllItems () |
(CB_RESETCONTENT) | |
int | getItemCount () |
(CB_GETCOUNT) | |
String | getItemText (int itemIndex) |
(CB_GETLBTEXT and CB_GETLBTEXTLEN) | |
void | setItemText (int itemIndex, const String &text) |
int | getCurrentItem () |
Returns the current selected item index (CB_GETCURSEL). | |
void | setCurrentItem (int itemIndex) |
Changes the current selected item to the itemIndex only (CB_SETCURSEL). | |
void | setCurrentItem (const String &firstText) |
Selects the item which its text begins with firstText. | |
void | setDropDownVisibile (bool visible) |
bool | isDropDownVisible () |
Rect | getDropDownBounds () |
virtual void | layout () |
Must arranges the children bounds. | |
Public Attributes | |
Signal1< void, Event & > | Action |
Signal1< void, Event & > | SelChange |
Signal1< void, Event & > | EditChange |
Protected Member Functions | |
virtual void | onPreferredSize (Size &sz) |
It should calculates the preferred size for this widget. | |
virtual void | onAction (Event &ev) |
When the user press double-click in some item of a Simple combo-box (with the SimpleComboBoxStyle) (Win32 CBN_DBLCLK notification). | |
virtual void | onSelChange (Event &ev) |
When the user changes the current selected item (CBN_SELCHANGE). | |
virtual void | onEditChange (Event &ev) |
When the user changes the text of the ComboBox. | |
virtual bool | onReflectedCommand (int id, int code, LRESULT &lResult) |
This method can be used to handle command notifications (WM_COMMAND (W32)) reflected from the parent. | |
Private Member Functions | |
int | getHeightForAllItems () |
ComboBox::~ComboBox | ( | ) | [virtual] |
int ComboBox::addItem | ( | const String & | text | ) |
(CB_ADDSTRING)
void ComboBox::insertItem | ( | int | itemIndex, | |
const String & | text | |||
) |
(CB_INSERTSTRING)
void ComboBox::removeItem | ( | int | itemIndex | ) |
(CB_DELETESTRING)
void ComboBox::removeAllItems | ( | ) |
(CB_RESETCONTENT)
int ComboBox::getItemCount | ( | ) |
(CB_GETCOUNT)
String ComboBox::getItemText | ( | int | itemIndex | ) |
(CB_GETLBTEXT and CB_GETLBTEXTLEN)
void ComboBox::setItemText | ( | int | itemIndex, | |
const String & | text | |||
) |
int ComboBox::getCurrentItem | ( | ) |
Returns the current selected item index (CB_GETCURSEL).
Returns -1 if there aren't selection at all.
void ComboBox::setCurrentItem | ( | int | itemIndex | ) |
Changes the current selected item to the itemIndex only (CB_SETCURSEL).
void ComboBox::setCurrentItem | ( | const String & | firstText | ) |
Selects the item which its text begins with firstText.
void ComboBox::setDropDownVisibile | ( | bool | visible | ) |
bool ComboBox::isDropDownVisible | ( | ) |
Rect ComboBox::getDropDownBounds | ( | ) |
void ComboBox::layout | ( | ) | [virtual] |
Must arranges the children bounds.
The default implementation calls the Layout::layout method of the Widget's layout manager (Widget::m_layout), but you can override this to obtain your own behavior (you can avoid to use Layout manager if you want).
This method is called from Widget::onResize by default, so when the Widget is shown for first time or it's resized, this method is called.
Reimplemented from Vaca::Widget.
void ComboBox::onPreferredSize | ( | Size & | sz | ) | [protected, virtual] |
It should calculates the preferred size for this widget.
sz | It's for input and output. You should put the preferred size in this value, but also you should read the input value to know if you must to fit the widget in some size. The possible values for sz are:
|
Reimplemented from Vaca::Widget.
void ComboBox::onAction | ( | Event & | ev | ) | [protected, virtual] |
When the user press double-click in some item of a Simple combo-box (with the SimpleComboBoxStyle) (Win32 CBN_DBLCLK notification).
void ComboBox::onSelChange | ( | Event & | ev | ) | [protected, virtual] |
When the user changes the current selected item (CBN_SELCHANGE).
void ComboBox::onEditChange | ( | Event & | ev | ) | [protected, virtual] |
When the user changes the text of the ComboBox.
Only for combo-boxes with SimpleComboBoxStyle or EditComboBoxStyle (Win32 CBN_EDITCHANGE notification).
bool ComboBox::onReflectedCommand | ( | int | id, | |
int | code, | |||
LRESULT & | lResult | |||
) | [protected, virtual] |
This method can be used to handle command notifications (WM_COMMAND
(W32)) reflected from the parent.
id | Identifier of the control or menu item. | |
code | Notification code. | |
lResult | Result to return by the wndProc method. |
Reimplemented from Vaca::Widget.
int ComboBox::getHeightForAllItems | ( | ) | [private] |
Signal1<void, Event&> Vaca::ComboBox::Action |
Signal1<void, Event&> Vaca::ComboBox::SelChange |
Signal1<void, Event&> Vaca::ComboBox::EditChange |