2#include "control/SComboBox.h"
36 m_pListBox->SetAttribute(L
"pos", L
"0,0,-0,-0", TRUE);
37 m_pListBox->SetAttribute(L
"hotTrack", L
"1", TRUE);
56 m_pListBox->AddString(S_CW2T(GETSTRING(strText)), iIcon, lParam);
70 int nDropHeight = m_nDropHeight.toPixelSize(
GetScale());
74 CRect rcMargin =
m_pListBox->GetStyle().GetMargin();
75 nDropHeight = smin(nDropHeight, (
int)(nItemHeight *
GetCount() + rcMargin.top + rcMargin.bottom));
82 __baseCls::OnCreateDropDown(pDropDown);
98 __baseCls::OnDestroyDropDown(pDropDown);
104 if (m_pEdit && !m_pEdit->GetEventSet()->isMuted())
106 SStringT strText = GetLBText(
m_pListBox->GetCurSel());
107 m_pEdit->GetEventSet()->setMutedState(
true);
108 SComboBase::SetWindowText(strText);
109 m_pEdit->GetEventSet()->setMutedState(
false);
112 __baseCls::OnSelChanged();
117 if (evt->IdFrom() == IDC_DROPDOWN_LIST && m_pDropDownWnd)
119 if (evt->GetID() == EventLBSelChanged::EventID)
124 if (evt->GetID() == EventCmd::EventID)
130 return SComboBase::FireEvent(evt);
135 __baseCls::OnScaleChanged(nScale);
142 HRESULT hr = __baseCls::OnLanguageChanged();
179 return m_pListBox->SetItemData(iItem, lParam);
184 return m_pListBox->InsertString(iPos, pszText, iIcon, lParam);
200 if (iItem < 0 || iItem >=
GetCount())
203 SStringT strRet =
m_pListBox->GetText(iItem, bRawText);
int GetCurSel() SCONST OVERRIDE
Get the current selection index.
LPARAM GetItemData(UINT iItem) SCONST OVERRIDE
Get the data associated with a list box item.
int InsertItem(int iPos, LPCTSTR pszText, int iIcon, LPARAM lParam) OVERRIDE
Insert an item into the list box.
virtual void OnSelChanged()
Handle selection change in the dropdown window.
virtual void OnCreateDropDown(SDropDownWnd *pDropDown)
Handle creation of the dropdown window.
SListBox * GetListBox()
Get the list box pointer.
BOOL GetItemText(int iItem, BOOL bRawText, IStringT *str) SCONST OVERRIDE
Get the text of a list box item.
virtual void OnScaleChanged(int nScale)
Handle scale change event.
virtual int GetListBoxHeight()
Get the height of the list box.
void ResetContent() OVERRIDE
Reset the content of the list box.
virtual void OnDestroyDropDown(SDropDownWnd *pDropDown)
Handle destruction of the dropdown window.
virtual HRESULT OnLanguageChanged()
Handle language change event.
BOOL SetItemData(UINT iItem, LPARAM lParam) OVERRIDE
Set the data associated with a list box item.
BOOL FireEvent(IEvtArgs *evt) OVERRIDE
Notify event.
BOOL DeleteString(int iPos) OVERRIDE
Delete a string from the list box.
IListBox * GetIListBox() OVERRIDE
Get the list box interface.
BOOL SetCurSel(int iSel) OVERRIDE
Set the current selection index.
virtual ~SComboBox()
Destructor.
virtual BOOL CreateListBox(SXmlNode xmlNode)
Create the list box.
int GetCount() SCONST OVERRIDE
Get the number of items in the list box.
SWindow * GetRoot() const
Gets the root window.
static LPCWSTR GetClassName()
A class representing an ASCII string.
BOOL IsEmpty() SCONST
Checks if the string is empty.
BOOL RemoveChild(SWindow *pChild)
Removes a child window from the window tree.
void SDispatchMessage(UINT uMsg, WPARAM wParam=0, LPARAM lParam=0) OVERRIDE
Dispatches a message to the window.
int GetScale() SCONST OVERRIDE
Retrieves the scale factor of the window.
ISwndContainer * GetContainer() OVERRIDE
Retrieves the container associated with this window.
void InsertChild(SWindow *pNewChild, SWindow *pInsertAfter=NULL)
Inserts a child window into the window tree.
static SStringW GetXmlText(const SXmlNode &xmlNode)
Gets the XML text from a node.
void UpdateChildrenPosition() OVERRIDE
Updates the position of child windows.
virtual SWindow * CreateChildByName(LPCWSTR pszName)
Create child window by name.
void Invalidate() OVERRIDE
Invalidates the entire window.
int as_int(int def=0) const
Converts the attribute value to an integer.
const wchar_t * as_string(const wchar_t *def=L"") const
Gets the attribute value as a string.
const wchar_t * value() const
Gets the attribute value.
Class representing an XML node.
SXmlNode next_sibling() const
Gets the next sibling node in the children list of the parent node.
SXmlAttr attribute(const wchar_t *name, bool bCaseSensitive=false) const
Gets the attribute with the specified name.
SXmlNode child(const wchar_t *name, bool bCaseSensitive=false) const
Gets the child node, attribute, or next/previous sibling with the specified name.