#include <wg_dropdown.h>
Inheritance diagram for wGui::CDropDown:
Definition at line 42 of file wg_dropdown.h.
wGui::CDropDown::CDropDown | ( | const CRect & | WindowRect, | |
CWindow * | pParent, | |||
bool | bAllowEdit = true , |
|||
unsigned int | iItemHeight = 15 , |
|||
CFontEngine * | pFontEngine = 0 | |||
) |
Construct a new DropDown control
WindowRect | A CRect that defines the outer limits of the control (this only controls the dimensions of the edit control portion of the drop down) | |
pParent | A pointer to the parent window | |
bAllowEdit | If false, the edit box will be read only, and the value can only be changed via the drop-down list (true by default) | |
iItemHeight | The height of the items in the listbox portion of the control, defaults to 15 | |
pFontEngine | A pointer to the font engine to use when drawing the control If this is left out (or set to 0) it will use the default font engine specified by the CApplication (which must be set before instantiating this object) |
Definition at line 35 of file wg_dropdown.cpp.
References wGui::COLOR_WHITE, wGui::CMessage::CTRL_SINGLELCLICK, wGui::CMessage::CTRL_VALUECHANGE, wGui::CWindow::Draw(), wGui::CRect::Height(), wGui::CMessageServer::Instance(), m_bAllowEdit, m_pDropButton, m_pEditBox, m_pListBox, wGui::CWindow::m_WindowRect, wGui::CMessage::MOUSE_BUTTONDOWN, wGui::CMessageServer::RegisterMessageClient(), wGui::CWindow::SetBackgroundColor(), wGui::CListBox::SetDropDown(), wGui::CEditBox::SetReadOnly(), wGui::CWindow::SetVisible(), and wGui::CRect::Width().
int wGui::CDropDown::AddItem | ( | SListItem | ListItem | ) | [inline] |
Adds a new item to the list
ListItem | A SListItem structure with the data for the item |
Definition at line 60 of file wg_dropdown.h.
References wGui::CListBox::AddItem(), and m_pListBox.
SListItem& wGui::CDropDown::GetItem | ( | int | iItemIndex | ) | [inline] |
Returns the desired item
iItemIndex | The index of the item to check (will throw an exception if the index is out of range) |
Definition at line 65 of file wg_dropdown.h.
References wGui::CListBox::GetItem(), and m_pListBox.
void wGui::CDropDown::RemoveItem | ( | int | iItemIndex | ) | [inline] |
Remove an item from the list
iItemIndex | The index of the item to remove |
Definition at line 69 of file wg_dropdown.h.
References m_pListBox, and wGui::CListBox::RemoveItem().
int wGui::CDropDown::Size | ( | void | ) | [inline] |
Gets the current number of items in the listbox
Definition at line 76 of file wg_dropdown.h.
References m_pListBox, and wGui::CListBox::Size().
bool wGui::CDropDown::IsSelected | ( | int | iItemIndex | ) | [inline] |
iItemIndex | The index of the item to check (will return false if the index is out of range) |
Definition at line 80 of file wg_dropdown.h.
References wGui::CListBox::IsSelected(), and m_pListBox.
int wGui::CDropDown::GetFirstSelectedIndex | ( | void | ) | const [inline] |
Get the index of the first selected item
Definition at line 84 of file wg_dropdown.h.
References wGui::CListBox::GetFirstSelectedIndex(), and m_pListBox.
void wGui::CDropDown::SetSelection | ( | int | iItemIndex, | |
bool | bSelected | |||
) | [inline] |
Set an item as selected
iItemIndex | The index of the item to change | |
bSelected | Will select the item if true, or unselect if false |
Definition at line 89 of file wg_dropdown.h.
References m_pListBox, and wGui::CListBox::SetSelection().
void wGui::CDropDown::SetAllSelections | ( | bool | bSelected | ) | [inline] |
Set the selection for all of the items at once
bSelected | Will select all items if true, or unselect if false |
Definition at line 93 of file wg_dropdown.h.
References m_pListBox, and wGui::CListBox::SetAllSelections().
void wGui::CDropDown::SetListboxHeight | ( | int | iItemCount | ) |
Sets the height of the drop list
iItemCount | The height of the listbox in number of items shown (this is set to 5 by default) |
Definition at line 68 of file wg_dropdown.cpp.
References wGui::CListBox::GetItemHeight(), wGui::CRect::Height(), m_pListBox, wGui::CWindow::m_WindowRect, wGui::CListBox::SetWindowRect(), and wGui::CRect::Width().
void wGui::CDropDown::SetWindowRect | ( | const CRect & | WindowRect | ) | [virtual] |
Giving a control a new WindowRect will move and resize the control
WindowRect | A CRect that defines the outer limits of the control |
Reimplemented from wGui::CWindow.
Definition at line 75 of file wg_dropdown.cpp.
References wGui::CListBox::GetItemHeight(), wGui::CRect::Height(), m_pDropButton, m_pEditBox, m_pListBox, wGui::CWindow::m_WindowRect, wGui::CListBox::SetWindowRect(), wGui::CWindow::SetWindowRect(), and wGui::CRect::Width().
void wGui::CDropDown::SetWindowText | ( | std::wstring | sWindowText | ) | [virtual] |
Set the WindowText of the control
sWindowText | The text to assign to the window |
Definition at line 84 of file wg_dropdown.cpp.
References m_pEditBox, and wGui::CEditBox::SetWindowText().
Referenced by HandleMessage().
void wGui::CDropDown::MoveWindow | ( | const CPoint & | MoveDistance | ) | [virtual] |
Move the window and any child windows
MoveDistance | The relative distance to move the window |
Reimplemented from wGui::CWindow.
Definition at line 96 of file wg_dropdown.cpp.
References m_pListBox, and wGui::CWindow::MoveWindow().
void wGui::CDropDown::SetVisible | ( | bool | bVisible | ) | [virtual] |
Set the visibility of the control, and all of it's children
bVisible | Set to false to hide the control |
Reimplemented from wGui::CWindow.
Definition at line 103 of file wg_dropdown.cpp.
References HideListBox(), and wGui::CWindow::SetVisible().
bool wGui::CDropDown::HandleMessage | ( | CMessage * | pMessage | ) | [virtual] |
CDropDown will handle MOUSE_BUTTONDOWN messages
pMessage | A pointer to the message that needs to be handled |
Reimplemented from wGui::CWindow.
Definition at line 111 of file wg_dropdown.cpp.
References wGui::CMessage::CTRL_SINGLELCLICK, wGui::CMessage::CTRL_VALUECHANGE, wGui::CMessage::Destination(), wGui::CListBox::GetItem(), wGui::CWindow::GetWindowRect(), wGui::CRect::Grow(), wGui::CWindow::HandleMessage(), HideListBox(), wGui::CRect::HitTest(), wGui::CMessageServer::Instance(), wGui::CWindow::IsVisible(), wGui::CMouseMessage::LEFT, m_pDropButton, m_pEditBox, m_pListBox, wGui::CWindow::m_pParentWindow, wGui::CWindow::m_WindowRect, wGui::CMessage::MessageType(), wGui::CMessage::MOUSE_BUTTONDOWN, wGui::CMessageServer::QueueMessage(), wGui::CRect::RELPOS_INSIDE, wGui::CListBox::SetAllSelections(), SetWindowText(), ShowListBox(), wGui::CRect::SizeRect(), wGui::CMessage::Source(), wGui::CValueMessage< T >::Value(), and wGui::CWindow::ViewToWindow().