1#ifndef __SCOMBOBASE__H__
2#define __SCOMBOBASE__H__
5#include <control/SEdit.h>
6#include <control/SDropDown.h>
10#define IDC_CB_EDIT -100
11#define IDC_DROPDOWN_LIST -200
19 DEF_SOBJECT(
SEdit, L
"ComboEdit")
54 void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
62 STDMETHOD_(BOOL,
FireEvent)(THIS_ IEvtArgs *evt) OVERRIDE;
78class SOUI_EXP SDropDownWnd_ComboBox :
public SDropDownWnd {
85 virtual BOOL WINAPI PreTranslateMessage(MSG *pMsg);
93class SOUI_EXP SComboBase
94 :
public TWindowProxy<IComboBase>
96 DEF_SOBJECT(
SWindow, L
"combobase")
107 virtual ~SComboBase(
void);
117 STDMETHOD_(
int, FindString)
118 (THIS_ LPCTSTR pszFind,
int nAfter = -1, BOOL bPartMatch = TRUE) OVERRIDE;
127 STDMETHOD_(
int, FindStringA)
128 (THIS_ LPCSTR pszFind,
int nAfter = -1, BOOL bPartMatch = TRUE) OVERRIDE
130 SStringT str = S_CA2T(pszFind, CP_UTF8);
131 return FindString(str, nAfter, bPartMatch);
137 STDMETHOD_(
void, DropDown)(THIS) OVERRIDE;
142 STDMETHOD_(
void, CloseUp)(THIS) OVERRIDE;
148 STDMETHOD_(BOOL, IsDropdown)(THIS) SCONST OVERRIDE;
154 STDMETHOD_(
void, SetDropdown)(THIS_ BOOL bDropdown) OVERRIDE;
161 STDMETHOD_(
void, SetWindowText)(LPCTSTR pszText) OVERRIDE;
169 STDMETHOD_(
void, GetDesiredSize)(THIS_ SIZE *psz,
int nParentWid,
int nParentHei) OVERRIDE;
174 STDMETHOD_(
void, SetFocus)(THIS) OVERRIDE;
181 STDMETHOD_(BOOL, FireEvent)(THIS_ IEvtArgs *evt) OVERRIDE;
187 STDMETHOD_(UINT, OnGetDlgCode)(CTHIS) SCONST OVERRIDE;
193 STDMETHOD_(BOOL, IsFocusable)(CTHIS) SCONST OVERRIDE;
198 STDMETHOD_(
void, UpdateChildrenPosition)(THIS) OVERRIDE;
205 SStringT GetWindowText(BOOL bRawText = FALSE) OVERRIDE;
213 SStringT GetLBText(
int iItem, BOOL bRawText = FALSE);
220 virtual SWindow *GetDropDownOwner();
233 virtual void OnDestroyDropDown(
SDropDownWnd *pDropDown);
238 virtual void OnSelChanged();
245 void UpdateDropdown(
const SStringT &strInput);
253 BOOL CalcPopupRect(
int nHeight, CRect &rcPopup);
260 virtual BOOL CreateListBox(
SXmlNode xmlNode) = 0;
266 virtual int GetListBoxHeight() = 0;
272 void GetDropBtnRect(LPRECT prc);
279 virtual BOOL CreateChildren(
SXmlNode xmlNode);
285 virtual void GetTextRect(LPRECT pRect);
291 virtual void OnColorize(COLORREF cr);
303 virtual void OnScaleChanged(
int nScale);
316 void OnLButtonDown(UINT nFlags, CPoint pt);
323 void OnMouseMove(UINT nFlags, CPoint pt);
336 void OnKeyDown(TCHAR nChar, UINT nRepCnt, UINT nFlags);
345 BOOL OnMouseWheel(UINT nFlags,
short zDelta, CPoint pt);
353 void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
365 int OnCreate(LPVOID);
378 SStringT
GetCueText(BOOL bRawText = FALSE)
const;
386 HRESULT OnAttrDropDown(
const SStringW &strValue, BOOL bLoading);
389 ATTR_CUSTOM(L
"dropDown", OnAttrDropDown)
390 ATTR_LAYOUTSIZE(L
"dropHeight", m_nDropHeight, TRUE)
391 ATTR_INT(L
"curSel", m_iInitSel, FALSE)
392 ATTR_SKIN(L
"btnSkin", m_pSkinBtn, TRUE)
393 ATTR_INT(L
"animateTime", m_nAnimTime, FALSE)
394 ATTR_INT(L
"autoFitDropBtn", m_bAutoFitDropBtn, TRUE)
395 ATTR_COLOR(L
"cueColor", m_crCue, TRUE)
396 ATTR_I18NSTRT(L
"cueText", m_strCue, TRUE)
397 ATTR_BOOL(L
"autoMatch", m_bAutoMatch, FALSE)
398 ATTR_BOOL(L
"autoDropdown", m_bAutoDropdown, FALSE)
402 MSG_WM_PAINT_EX(OnPaint)
403 MSG_WM_LBUTTONDOWN(OnLButtonDown)
404 MSG_WM_MOUSEMOVE(OnMouseMove)
405 MSG_WM_MOUSELEAVE(OnMouseLeave)
406 MSG_WM_MOUSEWHEEL(OnMouseWheel)
407 MSG_WM_KEYDOWN(OnKeyDown)
409 MSG_WM_DESTROY(OnDestroy)
410 MSG_WM_CREATE(OnCreate)
411 MSG_WM_KILLFOCUS_EX(OnKillFocus)
419 SStringT GetEditText()
const
423 return m_pEdit->GetWindowText();
441 BOOL m_bAutoFitDropBtn;
446 DWORD m_LastPressTime;
448 BOOL m_bAutoDropdown;
455 ,
public SComboBase {
457 STDMETHOD_(
long, AddRef)(THIS) OVERRIDE
459 return SComboBase::AddRef();
462 STDMETHOD_(
long, Release)(THIS) OVERRIDE
464 return SComboBase::Release();
467 STDMETHOD_(
void, OnFinalRelease)(THIS) OVERRIDE
472 STDMETHOD_(IWindow *, ToIWindow)(THIS) OVERRIDE
474 return (SComboBase *)
this;
477 STDMETHOD_(HRESULT, QueryInterface)(REFGUID id, IObjRef **ppRet) OVERRIDE
479 if (
id == T::GetIID())
491 STDMETHOD_(
int, FindString)
492 (THIS_ LPCTSTR pszFind,
int nAfter = -1, BOOL bPartMatch = TRUE) OVERRIDE
494 return SComboBase::FindString(pszFind, nAfter, bPartMatch);
497 STDMETHOD_(
int, FindStringA)
498 (THIS_ LPCSTR pszFind,
int nAfter = -1, BOOL bPartMatch = TRUE) OVERRIDE
500 return SComboBase::FindStringA(pszFind, nAfter, bPartMatch);
503 STDMETHOD_(
void, DropDown)(THIS) OVERRIDE
505 return SComboBase::DropDown();
508 STDMETHOD_(
void, CloseUp)(THIS) OVERRIDE
510 return SComboBase::CloseUp();
513 STDMETHOD_(BOOL, IsDropdown)(THIS) SCONST OVERRIDE
515 return SComboBase::IsDropdown();
518 STDMETHOD_(
void, SetDropdown)(THIS_ BOOL bDropdown) OVERRIDE
520 return SComboBase::SetDropdown(bDropdown);
Smart pointer class for managing COM-style reference-counted objects.
void OnMouseHover(WPARAM wParam, CPoint ptPos)
Handle mouse hover event.
void OnMouseLeave()
Handle mouse leave event.
BOOL FireEvent(IEvtArgs *evt) OVERRIDE
Notify event.
void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
Handle key down event.
void OnKillFocus(SWND wndFocus)
Handle kill focus event.
void OnKillFocus(SWND wndFocus)
Handle kill focus event.
virtual HRESULT OnLanguageChanged()
Handle language change event.
void OnPaint(IRenderTarget *pRT)
Paint the control.
void GetCueText(IStringT *pStr) SCONST
Get the cue text.
A class representing an ASCII string.
Class for handling text with translation support.
Base class for SOUI DUI windows.
HRESULT QueryInterface(REFGUID id, IObjRef **ppRet) OVERRIDE
Queries an interface.
void OnFinalRelease()
Called when the last reference to the object is released.
Implementation of IXmlDoc.
Class representing an XML node.
Interface for rendering target objects.
Interface for Dropdown Owner.