soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
SEdit.h
1#ifndef _SEDIT_H_
2#define _SEDIT_H_
3
4#include <control/SRichEdit.h>
5
6SNSBEGIN
7
8/**
9 * @class SEdit
10 * @brief Simple Edit Control
11 * @details A simple edit control that supports cue text and color customization.
12 */
13class SOUI_EXP SEdit : public TCtrlProxy<IEdit, SRichEdit> {
14 DEF_SOBJECT(SRichEdit, L"edit")
15
16 public:
17 /**
18 * @brief Constructor
19 */
20 SEdit();
21
22 public:
23 /**
24 * @brief Get the cue text
25 * @param pStr Output string for the cue text
26 */
27 STDMETHOD_(void, GetCueText)(CTHIS_ IStringT *pStr) SCONST
28 {
29 SStringT str = GetCueText(FALSE);
30 pStr->Copy(&str);
31 }
32
33 /**
34 * @brief Get the cue text color
35 * @return Cue text color
36 */
37 STDMETHOD_(COLORREF, GetCueColor)(CTHIS) SCONST
38 {
39 return m_crCue;
40 }
41
42 public:
43 /**
44 * @brief Get the cue text
45 * @param bRawText Whether to get raw text
46 * @return Cue text
47 */
48 SStringT GetCueText(BOOL bRawText = FALSE) const;
49
50 SOUI_ATTRS_BEGIN()
51 ATTR_COLOR(L"cueColor", m_crCue, TRUE)
52 ATTR_I18NSTRT(L"cueText", m_strCue, TRUE)
53 SOUI_ATTRS_END()
54
55 protected:
56 /**
57 * @brief Handle language change event
58 * @return HRESULT
59 */
60 virtual HRESULT OnLanguageChanged();
61
62 /**
63 * @brief Paint the control
64 * @param pRT Rendering target handle
65 * @details This function is a message handler.
66 */
67 void OnPaint(IRenderTarget *pRT);
68
69 /**
70 * @brief Handle set focus event
71 * @param wndOld Previous focus window handle
72 * @details This function is a message handler.
73 */
74 void OnSetFocus(SWND wndOld);
75
76 /**
77 * @brief Get the alignment of the cue text
78 * @return Alignment of the cue text
79 */
80 UINT GetCueTextAlign();
81
82 /**
83 * @brief Handle kill focus event
84 * @param wndFocus New focus window handle
85 * @details This function is a message handler.
86 */
87 void OnKillFocus(SWND wndFocus);
88
89 SOUI_MSG_MAP_BEGIN()
90 MSG_WM_PAINT_EX(OnPaint)
91 MSG_WM_SETFOCUS_EX(OnSetFocus)
92 MSG_WM_KILLFOCUS_EX(OnKillFocus)
93 SOUI_MSG_MAP_END()
94
95 protected:
96 COLORREF m_crCue; /**< Cue text color */
97 STrText m_strCue; /**< Cue text */
98};
99
100SNSEND
101
102#endif // _SEDIT_H_
COLORREF m_crCue
Definition SEdit.h:96
STrText m_strCue
Definition SEdit.h:97
SEdit()
Constructor.
Definition SEdit.cpp:6
void GetCueText(IStringT *pStr) SCONST
Get the cue text.
Definition SEdit.h:27
COLORREF GetCueColor() SCONST
Get the cue text color.
Definition SEdit.h:37
RichEdit Control.
Definition SRichEdit.h:31
Class for handling text with translation support.
Definition SWnd.h:230
Interface for rendering target objects.
Definition SRender-i.h:1440