soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
SComboView.h
1#ifndef __SCOMBOVIEW__H__
2#define __SCOMBOVIEW__H__
3
4#include "SComboBase.h"
5#include "SListView.h"
6
7SNSBEGIN
8
9/**
10 * @class SComboView
11 * @brief ComboBox Control with ListView
12 * @details A ComboBox control that uses a ListView for its dropdown content.
13 */
14class SOUI_EXP SComboView : public TComboBaseProxy<IComboView> {
15 DEF_SOBJECT(SComboBase, L"comboview")
16
17 public:
18 /**
19 * @brief Constructor
20 */
21 SComboView(void);
22
23 /**
24 * @brief Destructor
25 */
26 ~SComboView(void);
27
28 public:
29 /**
30 * @brief Set the current selection index
31 * @param iSel Index to set as the current selection
32 * @return TRUE if successful, FALSE otherwise
33 */
34 STDMETHOD_(BOOL, SetCurSel)(int iSel) OVERRIDE;
35
36 /**
37 * @brief Get the current selection index
38 * @return Current selection index
39 */
40 STDMETHOD_(int, GetCurSel)() SCONST OVERRIDE;
41
42 /**
43 * @brief Get the number of items in the list view
44 * @return Number of items
45 */
46 STDMETHOD_(int, GetCount)() SCONST OVERRIDE;
47
48 /**
49 * @brief Get the text of a list view item
50 * @param iItem Item index
51 * @param bRawText Whether to get raw text
52 * @param str Output string for the item text
53 * @return TRUE if successful, FALSE otherwise
54 */
55 STDMETHOD_(BOOL, GetItemText)(int iItem, BOOL bRawText, IStringT *str) SCONST OVERRIDE;
56
57 /**
58 * @brief Get the text of a list view item (ANSI version)
59 * @param iItem Item index
60 * @param bRawText Whether to get raw text
61 * @param str Output string for the item text
62 * @return TRUE if successful, FALSE otherwise
63 */
64 STDMETHOD_(BOOL, GetItemTextA)(int iItem, BOOL bRawText, IStringA *str) SCONST OVERRIDE
65 {
66 SStringT strBuf;
67 BOOL bRet = GetItemText(iItem, bRawText, &strBuf);
68 SStringA strBufA = S_CT2A(strBuf, CP_UTF8);
69 str->Copy(&strBufA);
70 return bRet;
71 }
72
73 /**
74 * @brief Get the list view interface
75 * @return Pointer to the list view interface
76 */
77 STDMETHOD_(IListView *, GetIListView)(THIS) OVERRIDE;
78
79 public:
80 /**
81 * @brief Get the list view pointer
82 * @return Pointer to the list view
83 */
84 SListView *GetListView();
85
86 protected:
87 /**
88 * @brief Notify event
89 * @param evt Event object
90 * @return TRUE if successful, FALSE otherwise
91 * @details This function is a message handler.
92 */
93 STDMETHOD_(BOOL, FireEvent)(THIS_ IEvtArgs *evt) OVERRIDE;
94
95 /**
96 * @brief Handle scale change event
97 * @param nScale Scale factor
98 */
99 virtual void OnScaleChanged(int nScale);
100
101 /**
102 * @brief Handle language change event
103 * @return HRESULT
104 */
105 virtual HRESULT OnLanguageChanged() override;
106
107 /**
108 * @brief Create the list view
109 * @param xmlNode XML node for the list view
110 * @return TRUE if successful, FALSE otherwise
111 */
112 virtual BOOL CreateListBox(SXmlNode xmlNode);
113
114 /**
115 * @brief Get the height of the list view
116 * @return Height of the list view
117 */
118 virtual int GetListBoxHeight();
119
120 /**
121 * @brief Handle creation of the dropdown window
122 * @param pDropDown Dropdown window pointer
123 */
124 virtual void OnCreateDropDown(SDropDownWnd *pDropDown);
125
126 /**
127 * @brief Handle destruction of the dropdown window
128 * @param pDropDown Dropdown window pointer
129 */
130 virtual void OnDestroyDropDown(SDropDownWnd *pDropDown);
131
132 /**
133 * @brief Handle selection change in the dropdown window
134 */
135 virtual void OnSelChanged();
136
137 protected:
138 SListView *m_pListBox; /**< Pointer to the list view */
139};
140
141SNSEND
142
143#endif // __SCOMBOVIEW__H__
BOOL GetItemText(int iItem, BOOL bRawText, IStringT *str) SCONST OVERRIDE
Get the text of a list view item.
BOOL GetItemTextA(int iItem, BOOL bRawText, IStringA *str) SCONST OVERRIDE
Get the text of a list view item (ANSI version)
Definition SComboView.h:64
SListView * m_pListBox
Definition SComboView.h:138
BOOL SetCurSel(int iSel) OVERRIDE
Set the current selection index.
int GetCount() SCONST OVERRIDE
Get the number of items in the list view.
int GetCurSel() SCONST OVERRIDE
Get the current selection index.
SComboView(void)
Constructor.
Definition SComboView.cpp:5
Dropdown Window Class.
Definition SDropDown.h:43
A class representing an ASCII string.
Definition sstringa.h:96
Class representing an XML node.
Definition SXml.h:352