soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
SRichEdit.h
1#ifndef __SRICHEDIT__H__
2#define __SRICHEDIT__H__
3
4#include <richedit.h>
5#include <core/SPanel.h>
6#include <proxy/SCtrlProxy.h>
7#include <interface/STimer-i.h>
8
9#include <imm.h>
10#include <textserv.h>
11
12SNSBEGIN
13
14enum
15{
16 MENU_CUT = 1,
17 MENU_COPY,
18 MENU_PASTE,
19 MENU_DEL,
20 MENU_SELALL,
21 //---------------
22 MENU_USER = 20,
23};
24
25/**
26 * @class SRichEdit
27 * @brief RichEdit Control
28 * @details A control that uses a windowless RichEdit to implement an edit control.
29 */
30class STextHost;
31class SOUI_EXP SRichEdit : public TPanelProxy<IRichEdit> {
32 friend class STextHost;
33 friend class SApplication;
34
35 public:
36 DEF_SOBJECT(SPanel, L"richedit")
37
38 /**
39 * @brief Constructor
40 */
41 SRichEdit();
42
43 /**
44 * @brief Destructor
45 */
46 virtual ~SRichEdit()
47 {
48 }
49
50 private:
51 /**
52 * @brief Initialize text service
53 */
54 static void InitTextService();
55
56 /**
57 * @brief Uninitialize text service
58 */
59 static void UninitTextService();
60
61 public: // RichEdit Interface
62 /**
63 * @brief Save content to an RTF file
64 * @param pszFileName File name to save the RTF content
65 * @return Number of bytes written
66 */
67 STDMETHOD_(DWORD, SaveRtf)(THIS_ LPCTSTR pszFileName) OVERRIDE;
68
69 /**
70 * @brief Load content from an RTF file
71 * @param pszFileName File name to load the RTF content
72 * @return Number of bytes read
73 */
74 STDMETHOD_(DWORD, LoadRtf)(THIS_ LPCTSTR pszFileName) OVERRIDE;
75
76 /**
77 * @brief Set the selection range
78 * @param nStartChar Start character position
79 * @param nEndChar End character position
80 * @param bNoScroll Whether to scroll to the selection
81 */
82 STDMETHOD_(void, SetSel)(THIS_ long nStartChar, long nEndChar, BOOL bNoScroll) OVERRIDE;
83
84 /**
85 * @brief Replace the selected text
86 * @param pszText Text to replace the selection
87 * @param bCanUndo Whether the operation can be undone
88 */
89 STDMETHOD_(void, ReplaceSel)(THIS_ LPCTSTR pszText, BOOL bCanUndo = TRUE) OVERRIDE;
90
91 /**
92 * @brief Get the word wrap setting
93 * @return TRUE if word wrap is enabled, FALSE otherwise
94 */
95 STDMETHOD_(BOOL, GetWordWrap)(THIS) SCONST OVERRIDE;
96
97 /**
98 * @brief Set the word wrap setting
99 * @param fWordWrap TRUE to enable word wrap, FALSE to disable
100 */
101 STDMETHOD_(void, SetWordWrap)(THIS_ BOOL fWordWrap) OVERRIDE;
102
103 /**
104 * @brief Check if the control is read-only
105 * @return TRUE if read-only, FALSE otherwise
106 */
107 STDMETHOD_(BOOL, GetReadOnly)(THIS) SCONST OVERRIDE;
108
109 /**
110 * @brief Set the read-only state
111 * @param bReadOnly TRUE to set read-only, FALSE to allow editing
112 * @return TRUE if successful, FALSE otherwise
113 */
114 STDMETHOD_(BOOL, SetReadOnly)(THIS_ BOOL bReadOnly) OVERRIDE;
115
116 /**
117 * @brief Get the maximum text length
118 * @return Maximum text length
119 */
120 STDMETHOD_(LONG, GetLimitText)(THIS) SCONST OVERRIDE;
121
122 /**
123 * @brief Set the maximum text length
124 * @param nLength Maximum text length
125 * @return TRUE if successful, FALSE otherwise
126 */
127 STDMETHOD_(BOOL, SetLimitText)(THIS_ int nLength) OVERRIDE;
128
129 /**
130 * @brief Get the default text alignment
131 * @return Default text alignment
132 */
133 STDMETHOD_(WORD, GetDefaultAlign)(THIS) SCONST OVERRIDE;
134
135 /**
136 * @brief Set the default text alignment
137 * @param wNewAlign New text alignment
138 */
139 STDMETHOD_(void, SetDefaultAlign)(THIS_ WORD wNewAlign) OVERRIDE;
140
141 /**
142 * @brief Get the rich text flag
143 * @return TRUE if rich text is enabled, FALSE otherwise
144 */
145 STDMETHOD_(BOOL, GetRichTextFlag)(THIS) SCONST OVERRIDE;
146
147 /**
148 * @brief Set the rich text flag
149 * @param fRich TRUE to enable rich text, FALSE to disable
150 */
151 STDMETHOD_(void, SetRichTextFlag)(THIS_ BOOL fRich) OVERRIDE;
152
153 /**
154 * @brief Get the default left indent
155 * @return Default left indent
156 */
157 STDMETHOD_(LONG, GetDefaultLeftIndent)(THIS) SCONST OVERRIDE;
158
159 /**
160 * @brief Set the default left indent
161 * @param lNewIndent New left indent
162 */
163 STDMETHOD_(void, SetDefaultLeftIndent)(THIS_ LONG lNewIndent) OVERRIDE;
164
165 /**
166 * @brief Set the save selection flag
167 * @param fSaveSelection TRUE to save selection, FALSE otherwise
168 * @return TRUE if successful, FALSE otherwise
169 */
170 STDMETHOD_(BOOL, SetSaveSelection)(THIS_ BOOL fSaveSelection) OVERRIDE;
171
172 /**
173 * @brief Set the default text color
174 * @param cr New text color
175 * @return Previous text color
176 */
177 STDMETHOD_(COLORREF, SetDefaultTextColor)(THIS_ COLORREF cr) OVERRIDE;
178
179 /**
180 * @brief Set the window text
181 * @param lpszText New window text
182 */
183 STDMETHOD_(void, SetWindowText)(LPCTSTR lpszText) OVERRIDE;
184
185 /**
186 * @brief Get the window text
187 * @param pBuf Buffer to store the text
188 * @param nBufLen Length of the buffer
189 * @param bRawText Whether to get raw text
190 * @return Length of the text
191 */
192 STDMETHOD_(int, GetWindowText)(THIS_ TCHAR *pBuf, int nBufLen, BOOL bRawText) OVERRIDE;
193
194 /**
195 * @brief Process window messages
196 * @param uMsg Message identifier
197 * @param wParam Additional message-specific information
198 * @param lParam Additional message-specific information
199 * @param lResult Pointer to the result
200 * @return TRUE if the message was processed, FALSE otherwise
201 */
202 STDMETHOD_(BOOL, SwndProc)(THIS_ UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *lResult) OVERRIDE;
203
204 /**
205 * @brief Create a caret
206 * @param pBmp Bitmap for the caret
207 * @param nWid Width of the caret
208 * @param nHeight Height of the caret
209 * @return TRUE if successful, FALSE otherwise
210 */
211 STDMETHOD_(BOOL, CreateCaret)(THIS_ HBITMAP pBmp, int nWid, int nHeight) OVERRIDE;
212
213 public:
214 /**
215 * @brief Get the window text
216 * @param bRawText Whether to get raw text
217 * @return Window text
218 */
219 SStringT GetWindowText(BOOL bRawText = FALSE);
220
221 /**
222 * @brief Set the selection range
223 * @param dwSelection Selection range
224 * @param bNoScroll Whether to scroll to the selection
225 */
226 void SetSel(DWORD dwSelection, BOOL bNoScroll = FALSE);
227
228 /**
229 * @brief Get the length of the window text
230 * @return Length of the window text
231 */
232 int GetWindowTextLength() const;
233
234 protected:
235 /**
236 * @brief Handle creation of the control
237 * @param lpCreateStruct Create structure
238 * @return Result of the creation
239 */
240 int OnCreate(LPVOID lpCreateStruct);
241
242 /**
243 * @brief Handle destruction of the control
244 */
245 void OnDestroy();
246
247 /**
248 * @brief Handle paint message
249 * @param pRT Rendering target handle
250 */
251 void OnPaint(IRenderTarget *pRT);
252
253 /**
254 * @brief Handle set focus message
255 * @param wndOld Previous focus window handle
256 */
257 void OnSetFocus(SWND wndOld);
258
259 /**
260 * @brief Handle kill focus message
261 * @param wndFocus New focus window handle
262 */
263 void OnKillFocus(SWND wndFocus);
264
265 /**
266 * @brief Handle timer message
267 * @param idEvent Timer ID
268 */
269 void OnTimer(char idEvent);
270
271 /**
272 * @brief Get dialog code
273 * @return Dialog code
274 */
275 virtual UINT WINAPI OnGetDlgCode() const;
276
277 /**
278 * @brief Handle scroll message
279 * @param bVertical TRUE if vertical scroll, FALSE if horizontal
280 * @param uCode Scroll code
281 * @param nPos Scroll position
282 * @return TRUE if successful, FALSE otherwise
283 */
284 virtual BOOL OnScroll(BOOL bVertical, UINT uCode, int nPos);
285
286 /**
287 * @brief Handle set cursor message
288 * @param pt Mouse coordinates
289 * @return TRUE if successful, FALSE otherwise
290 */
291 virtual BOOL OnSetCursor(const CPoint &pt);
292
293 /**
294 * @brief Handle scale change message
295 * @param nScale New scale factor
296 */
297 virtual void OnScaleChanged(int nScale);
298
299 /**
300 * @brief Handle rebuild font message
301 */
302 virtual void OnRebuildFont();
303
304 /**
305 * @brief Check if rich text scaling is enabled
306 * @return TRUE if enabled, FALSE otherwise
307 */
308 BOOL IsRichScale() const;
309
310 /**
311 * @brief Handle enable message
312 * @param bEnable Enable flag
313 * @param nStatus Status code
314 */
315 void OnEnable(BOOL bEnable, UINT nStatus);
316
317 /**
318 * @brief Initialize default character format
319 * @param pcf Character format structure
320 * @param pFont Font to apply
321 * @return Result of the initialization
322 */
323 HRESULT InitDefaultCharFormat(CHARFORMAT2W *pcf, IFontS *pFont = NULL);
324
325 /**
326 * @brief Initialize default paragraph format
327 * @param ppf Paragraph format structure
328 * @return Result of the initialization
329 */
330 HRESULT InitDefaultParaFormat(PARAFORMAT2 *ppf);
331
332 /**
333 * @brief Handle text notification
334 * @param iNotify Notification code
335 * @param pv Notification data
336 * @return Result of the notification handling
337 */
338 virtual HRESULT OnTxNotify(DWORD iNotify, LPVOID pv);
339
340 /**
341 * @brief Handle left button down message
342 * @param nFlags Mouse flags
343 * @param point Mouse coordinates
344 */
345 void OnLButtonDown(UINT nFlags, CPoint point);
346
347 /**
348 * @brief Handle left button up message
349 * @param nFlags Mouse flags
350 * @param point Mouse coordinates
351 */
352 void OnLButtonUp(UINT nFlags, CPoint point);
353
354 /**
355 * @brief Handle right button down message
356 * @param nFlags Mouse flags
357 * @param point Mouse coordinates
358 */
359 void OnRButtonDown(UINT nFlags, CPoint point);
360
361 /**
362 * @brief Handle mouse move message
363 * @param nFlags Mouse flags
364 * @param point Mouse coordinates
365 */
366 void OnMouseMove(UINT nFlags, CPoint point);
367
368 /**
369 * @brief Handle mouse wheel message
370 * @param nFlags Mouse flags
371 * @param zDelta Wheel delta
372 * @param pt Mouse coordinates
373 * @return TRUE if successful, FALSE otherwise
374 */
375 BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
376
377 /**
378 * @brief Handle key down message
379 * @param nChar Key code
380 * @param nRepCnt Repeat count
381 * @param nFlags Key flags
382 */
383 void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
384
385 /**
386 * @brief Handle button click message
387 * @param uMsg Message identifier
388 * @param wParam Additional message-specific information
389 * @param lParam Additional message-specific information
390 * @return Result of the message processing
391 */
392 LRESULT OnButtonClick(UINT uMsg, WPARAM wParam, LPARAM lParam);
393
394 /**
395 * @brief Handle character message
396 * @param nChar Character code
397 * @param nRepCnt Repeat count
398 * @param nFlags Character flags
399 */
400 void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
401
402 /**
403 * @brief Handle set font message
404 * @param font Font to apply
405 * @param bRedraw Whether to redraw the control
406 */
407 void OnSetFont(IFontS *font, BOOL bRedraw);
408
409 /**
410 * @brief Handle set text message
411 * @param uMsg Message identifier
412 * @param wParam Additional message-specific information
413 * @param lParam Additional message-specific information
414 * @return Result of the message processing
415 */
416 LRESULT OnSetText(UINT uMsg, WPARAM wParam, LPARAM lParam);
417
418 /**
419 * @brief Handle set character format message
420 * @param uMsg Message identifier
421 * @param wParam Additional message-specific information
422 * @param lParam Additional message-specific information
423 * @return Result of the message processing
424 */
425 LRESULT OnSetCharFormat(UINT uMsg, WPARAM wParam, LPARAM lParam);
426
427 /**
428 * @brief Handle set paragraph format message
429 * @param uMsg Message identifier
430 * @param wParam Additional message-specific information
431 * @param lParam Additional message-specific information
432 * @return Result of the message processing
433 */
434 LRESULT OnSetParaFormat(UINT uMsg, WPARAM wParam, LPARAM lParam);
435
436 /**
437 * @brief Handle set read-only message
438 * @param uMsg Message identifier
439 * @param wParam Additional message-specific information
440 * @param lParam Additional message-specific information
441 * @return Result of the message processing
442 */
443 LRESULT OnSetReadOnly(UINT uMsg, WPARAM wParam, LPARAM lParam);
444
445 /**
446 * @brief Handle set limit text message
447 * @param uMsg Message identifier
448 * @param wParam Additional message-specific information
449 * @param lParam Additional message-specific information
450 * @return Result of the message processing
451 */
452 LRESULT OnSetLimitText(UINT uMsg, WPARAM wParam, LPARAM lParam);
453
454 /**
455 * @brief Handle non-client calculate size message
456 * @param bCalcValidRects Whether to calculate valid rectangles
457 * @param lParam Additional message-specific information
458 * @return Result of the message processing
459 */
460 LRESULT OnNcCalcSize(BOOL bCalcValidRects, LPARAM lParam);
461
462 /**
463 * @brief Enable or disable drag-and-drop
464 * @param bEnable Enable flag
465 */
466 void OnEnableDragDrop(BOOL bEnable);
467
468 /**
469 * @brief Handle get rectangle message
470 * @param uMsg Message identifier
471 * @param wp Additional message-specific information
472 * @param lp Additional message-specific information
473 * @return Result of the message processing
474 */
475 LRESULT OnGetRect(UINT uMsg, WPARAM wp, LPARAM lp);
476
477 /**
478 * @brief Handle set scroll position message
479 * @param fnBar Scroll bar identifier
480 * @param nPos Scroll position
481 * @param fRedraw Whether to redraw the control
482 * @return TRUE if successful, FALSE otherwise
483 */
484 BOOL OnTxSetScrollPos(INT fnBar, INT nPos, BOOL fRedraw);
485
486 /**
487 * @brief Handle set timer message
488 * @param idTimer Timer ID
489 * @param uTimeout Timeout interval
490 * @return TRUE if successful, FALSE otherwise
491 */
492 BOOL OnTxSetTimer(UINT idTimer, UINT uTimeout);
493
494 /**
495 * @brief Handle kill timer message
496 * @param idTimer Timer ID
497 */
498 void OnTxKillTimer(UINT idTimer);
499
500 /**
501 * @brief Handle timer timeout message
502 * @param e Event arguments
503 * @return TRUE if successful, FALSE otherwise
504 */
505 BOOL OnTimeout(IEvtArgs *e);
506
507 protected:
508 SOUI_MSG_MAP_BEGIN()
509 MSG_WM_CREATE(OnCreate)
510 MSG_WM_DESTROY(OnDestroy)
511 MSG_WM_PAINT_EX(OnPaint)
512 MSG_WM_NCCALCSIZE(OnNcCalcSize)
513 MSG_WM_SETFOCUS_EX(OnSetFocus)
514 MSG_WM_KILLFOCUS_EX(OnKillFocus)
515 MSG_WM_TIMER_EX(OnTimer)
516 MSG_WM_LBUTTONDOWN(OnLButtonDown)
517 MSG_WM_LBUTTONUP(OnLButtonUp)
518 MSG_WM_RBUTTONDOWN(OnRButtonDown)
519 MSG_WM_MOUSEMOVE(OnMouseMove)
520 MSG_WM_MOUSEWHEEL(OnMouseWheel)
521 MSG_WM_KEYDOWN(OnKeyDown)
522 MSG_WM_CHAR(OnChar)
523 MSG_WM_SETFONT_EX(OnSetFont)
524 MESSAGE_HANDLER_EX(WM_LBUTTONDBLCLK, OnButtonClick)
525 MESSAGE_HANDLER_EX(WM_SETTEXT, OnSetText)
526 MESSAGE_HANDLER_EX(EM_SETPARAFORMAT, OnSetParaFormat)
527 MESSAGE_HANDLER_EX(EM_SETCHARFORMAT, OnSetCharFormat)
528 MESSAGE_HANDLER_EX(EM_SETREADONLY, OnSetReadOnly)
529 MESSAGE_HANDLER_EX(EM_EXLIMITTEXT, OnSetLimitText)
530 MESSAGE_HANDLER_EX(EM_GETRECT, OnGetRect)
531 SOUI_MSG_MAP_END()
532
533 protected:
534#define ATTR_RE_STYLE(attr, style, txtBit, func) \
535 if (0 == strAttribName.CompareNoCase(attr)) \
536 { \
537 hRet = func(strValue, style, txtBit, bLoading); \
538 } \
539 else
540
541 /**
542 * @brief Set text color attribute
543 * @param strValue Attribute value
544 * @param bLoading Loading flag
545 * @return Result of the attribute setting
546 */
547 HRESULT OnAttrTextColor(const SStringW &strValue, BOOL bLoading);
548
549 /**
550 * @brief Set RTF attribute
551 * @param strValue Attribute value
552 * @param bLoading Loading flag
553 * @return Result of the attribute setting
554 */
555 HRESULT OnAttrRTF(const SStringW &strValue, BOOL bLoading);
556
557 /**
558 * @brief Set alignment attribute
559 * @param strValue Attribute value
560 * @param bLoading Loading flag
561 * @return Result of the attribute setting
562 */
563 HRESULT OnAttrAlign(const SStringW &strValue, BOOL bLoading);
564
565 /**
566 * SRichEdit::OnAttrNotifyChange
567 * @brief Handle the notify change attribute
568 * @param const SStringW &strValue -- The attribute value as a string
569 * @param BOOL bLoading -- Indicates if the attribute is being loaded
570 * @return Returns HRESULT indicating success or failure
571 *
572 * Describe This function processes the "notifyChange" attribute, which determines whether the control should receive notifications when data changes.
573 */
574 HRESULT OnAttrNotifyChange(const SStringW &strValue, BOOL bLoading);
575
576 /**
577 * SRichEdit::OnAttrPasswordChar
578 * @brief Handle the password character attribute
579 * @param const SStringW &strValue -- The attribute value as a string
580 * @param BOOL bLoading -- Indicates if the attribute is being loaded
581 * @return Returns HRESULT indicating success or failure
582 *
583 * Describe This function processes the "passwordChar" attribute, which sets the character used to display password input.
584 */
585 HRESULT OnAttrPasswordChar(const SStringW &strValue, BOOL bLoading);
586
587 /**
588 * SRichEdit::OnAttrEnableDragdrop
589 * @brief Handle the enable dragdrop attribute
590 * @param const SStringW &strValue -- The attribute value as a string
591 * @param BOOL bLoading -- Indicates if the attribute is being loaded
592 * @return Returns HRESULT indicating success or failure
593 *
594 * Describe This function processes the "enableDragdrop" attribute, which determines whether drag-and-drop operations are enabled in the control.
595 */
596 HRESULT OnAttrEnableDragdrop(const SStringW &strValue, BOOL bLoading);
597
598 /**
599 * SRichEdit::OnAttrReStyle
600 * @brief Handle the restyle attribute
601 * @param const SStringW &strValue -- The attribute value as a string
602 * @param DWORD dwStyle -- The style to apply
603 * @param DWORD txtBit -- The text bit to apply
604 * @param BOOL bLoading -- Indicates if the attribute is being loaded
605 * @return Returns HRESULT indicating success or failure
606 *
607 * Describe This function processes various restyle attributes, applying the specified style and text bit to the control.
608 */
609 HRESULT OnAttrReStyle(const SStringW &strValue, DWORD dwStyle, DWORD txtBit, BOOL bLoading);
610
611 /**
612 * SRichEdit::OnAttrReStyle2
613 * @brief Handle the restyle attribute (variant)
614 * @param const SStringW &strValue -- The attribute value as a string
615 * @param DWORD dwStyle -- The style to apply
616 * @param DWORD txtBit -- The text bit to apply
617 * @param BOOL bLoading -- Indicates if the attribute is being loaded
618 * @return Returns HRESULT indicating success or failure
619 *
620 * Describe This function processes additional restyle attributes, applying the specified style and text bit to the control.
621 */
622 HRESULT OnAttrReStyle2(const SStringW &strValue, DWORD dwStyle, DWORD txtBit, BOOL bLoading);
623
624 public:
625 /**
626 * SRichEdit::SOUI_ATTRS_BEGIN
627 * @brief Begin the attribute map for the SRichEdit class
628 *
629 * Describe This macro starts the definition of the attribute map, which maps XML attributes to member variables and custom handlers.
630 */
631 SOUI_ATTRS_BEGIN()
632 ATTR_INT(L"style", m_dwStyle, TRUE)
633 ATTR_INT(L"maxBuf", m_cchTextMost, FALSE)
634 ATTR_BOOL(L"transparent", m_fTransparent, TRUE)
635 ATTR_BOOL(L"rich", m_fRich, TRUE)
636 ATTR_BOOL(L"vertical", m_fVertical, TRUE)
637 ATTR_BOOL(L"wordWrap", m_fWordWrap, TRUE)
638 ATTR_BOOL(L"allowBeep", m_fAllowBeep, FALSE)
639 ATTR_BOOL(L"autoWordSel", m_fEnableAutoWordSel, TRUE)
640 ATTR_BOOL(L"vcenter", m_fSingleLineVCenter, TRUE)
641 ATTR_BOOL(L"disableCaret", m_fDisableCaret, TRUE)
642 ATTR_BOOL(L"wantTab", m_fWantTab, FALSE)
643 ATTR_BOOL(L"autoSel", m_fAutoSel, FALSE)
644 ATTR_CUSTOM(L"colorText", OnAttrTextColor)
645 ATTR_CUSTOM(L"rtf", OnAttrRTF)
646 ATTR_CUSTOM(L"align", OnAttrAlign)
647 ATTR_CUSTOM(L"notifyChange", OnAttrNotifyChange)
648 ATTR_RE_STYLE(L"wantReturn", ES_WANTRETURN, 0, OnAttrReStyle)
649 ATTR_RE_STYLE(L"number", ES_NUMBER, 0, OnAttrReStyle)
650 ATTR_RE_STYLE(L"upperCase", ES_UPPERCASE, 0, OnAttrReStyle)
651 ATTR_RE_STYLE(L"lowerCase", ES_LOWERCASE, 0, OnAttrReStyle)
652 ATTR_RE_STYLE(L"password", ES_PASSWORD, TXTBIT_USEPASSWORD, OnAttrReStyle)
653 ATTR_RE_STYLE(L"readOnly", ES_READONLY, TXTBIT_READONLY, OnAttrReStyle)
654 ATTR_RE_STYLE(L"multiLines", ES_MULTILINE, TXTBIT_MULTILINE, OnAttrReStyle)
655 ATTR_RE_STYLE(L"autoHscroll", ES_AUTOHSCROLL, TXTBIT_SCROLLBARCHANGE, OnAttrReStyle2)
656 ATTR_RE_STYLE(L"autoVscroll", ES_AUTOVSCROLL, TXTBIT_SCROLLBARCHANGE, OnAttrReStyle2)
657 ATTR_RE_STYLE(L"hscrollBar", WS_HSCROLL, TXTBIT_SCROLLBARCHANGE, OnAttrReStyle2)
658 ATTR_RE_STYLE(L"vscrollBar", WS_VSCROLL, TXTBIT_SCROLLBARCHANGE, OnAttrReStyle2)
659 ATTR_CUSTOM(L"passwordChar", OnAttrPasswordChar)
660 ATTR_CUSTOM(L"enableDragdrop", OnAttrEnableDragdrop)
661 SOUI_ATTRS_END()
662
663 protected:
664 CHARFORMAT2W m_cfDef; /**< Default character format */
665 PARAFORMAT2 m_pfDef; /**< Default paragraph format */
666 DWORD m_cchTextMost; /**< Maximum number of characters */
667 TCHAR m_chPasswordChar; /**< Character used for password input */
668 LONG m_lAccelPos; /**< Position of accelerator */
669 SIZEL m_sizelExtent; /**< Extent array */
670 CRect m_rcInset; /**< Inset margin */
671 int m_nFontHeight; /**< Height of single line text output */
672 DWORD m_dwStyle;
673
674 UINT m_fEnableAutoWordSel : 1; /**< Enable Word style auto word selection? */
675 UINT m_fWordWrap : 1; /**< Whether control should word wrap */
676 UINT m_fRich : 1; /**< Whether control is rich text */
677 UINT m_fSaveSelection : 1; /**< Whether to save the selection when inactive */
678 UINT m_fTransparent : 1; /**< Whether control is transparent */
679 UINT m_fVertical : 1; /**< Whether control is layout following vertical */
680 UINT m_fAllowBeep : 1; /**< Whether message beep is allowed in the control */
681 UINT m_fWantTab : 1; /**< Whether control will deal with tab input */
682 UINT m_fSingleLineVCenter : 1; /**< Whether control that is single line will be vertical
683 centered */
684 UINT m_fScrollPending : 1; /**< Whether scroll is activated by richedit or by panelex */
685 UINT m_fEnableDragDrop : 1; /**< 允许在该控件中使用拖放 */
686 UINT m_fAutoSel : 1; /**< 有焦点时自动全选 */
687 UINT m_fNotifyChange : 1; /**< receive re_notify when data changed */
688 UINT m_fDisableCaret : 1; /**< disable caret flag */
689 BYTE m_byDbcsLeadByte; /**< DBCS输入时的中文头字节*/
690 SStringW m_strRtfSrc; /**< 在XML中指定的RTF数据源*/
691 STextHost *m_pTxtHost; /**< Host of Richedit*/
692 SMap<UINT, SAutoRefPtr<ITimer>> m_mapTimer; /**< map of timer to id*/
693};
694
695SNSEND
696
697#endif // __SRICHEDIT__H__
SOUI Panel with Scrollbar Support.
Smart pointer class for managing COM-style reference-counted objects.
void OnEnable(BOOL bEnable, UINT uStatus)
Handles the WM_ENABLE message.
Definition SPanel.cpp:598
LRESULT OnNcCalcSize(BOOL bCalcValidRects, LPARAM lParam)
Handles the WM_NCCALCSIZE message.
Definition SPanel.cpp:472
virtual void OnScaleChanged(int nScale)
Handles scale change events.
Definition SPanel.cpp:638
SPanel()
Constructor for SPanel.
Definition SPanel.cpp:165
BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
Handles the WM_MOUSEWHEEL message.
Definition SPanel.cpp:484
void OnTimer(char cTimerID)
Handles the WM_TIMER message.
Definition SPanel.cpp:569
virtual BOOL OnScroll(BOOL bVertical, UINT uCode, int nPos)
Handles scroll events.
Definition SPanel.cpp:517
int OnCreate(LPVOID)
Handles the WM_CREATE message.
Definition SPanel.cpp:318
void OnDestroy()
Handles the WM_DESTROY message.
Definition SPanel.cpp:326
LONG m_lAccelPos
Definition SRichEdit.h:668
UINT m_fSingleLineVCenter
Definition SRichEdit.h:682
HRESULT OnAttrTextColor(const SStringW &strValue, BOOL bLoading)
Set text color attribute.
UINT m_fSaveSelection
Definition SRichEdit.h:677
SStringW m_strRtfSrc
Definition SRichEdit.h:690
UINT m_fDisableCaret
Definition SRichEdit.h:688
SRichEdit()
Constructor.
UINT m_fScrollPending
Definition SRichEdit.h:684
virtual ~SRichEdit()
Destructor.
Definition SRichEdit.h:46
UINT m_fEnableAutoWordSel
Definition SRichEdit.h:674
HRESULT OnAttrReStyle2(const SStringW &strValue, DWORD dwStyle, DWORD txtBit, BOOL bLoading)
Handle the restyle attribute (variant)
UINT m_fEnableDragDrop
Definition SRichEdit.h:685
PARAFORMAT2 m_pfDef
Definition SRichEdit.h:665
UINT m_fTransparent
Definition SRichEdit.h:678
UINT m_fNotifyChange
Definition SRichEdit.h:687
UINT m_fRich
Definition SRichEdit.h:676
int m_nFontHeight
Definition SRichEdit.h:671
HRESULT OnAttrNotifyChange(const SStringW &strValue, BOOL bLoading)
Handle the notify change attribute.
UINT m_fAutoSel
Definition SRichEdit.h:686
DWORD m_cchTextMost
Definition SRichEdit.h:666
SIZEL m_sizelExtent
Definition SRichEdit.h:669
BYTE m_byDbcsLeadByte
Definition SRichEdit.h:689
TCHAR m_chPasswordChar
Definition SRichEdit.h:667
UINT m_fAllowBeep
Definition SRichEdit.h:680
UINT m_fVertical
Definition SRichEdit.h:679
CHARFORMAT2W m_cfDef
Definition SRichEdit.h:664
HRESULT OnAttrReStyle(const SStringW &strValue, DWORD dwStyle, DWORD txtBit, BOOL bLoading)
Handle the restyle attribute.
STextHost * m_pTxtHost
Definition SRichEdit.h:691
CRect m_rcInset
Definition SRichEdit.h:670
HRESULT OnAttrEnableDragdrop(const SStringW &strValue, BOOL bLoading)
Handle the enable dragdrop attribute.
UINT m_fWantTab
Definition SRichEdit.h:681
HRESULT OnAttrRTF(const SStringW &strValue, BOOL bLoading)
Set RTF attribute.
HRESULT OnAttrAlign(const SStringW &strValue, BOOL bLoading)
Set alignment attribute.
UINT m_fWordWrap
Definition SRichEdit.h:675
SMap< UINT, SAutoRefPtr< ITimer > > m_mapTimer
Definition SRichEdit.h:692
HRESULT OnAttrPasswordChar(const SStringW &strValue, BOOL bLoading)
Handle the password character attribute.
A class representing an ASCII string.
Definition sstringw.h:96
Describe.
UINT OnGetDlgCode() SCONST OVERRIDE
Retrieves the dialog code for the window.
Definition Swnd.cpp:1991
void OnMouseMove(UINT nFlags, CPoint pt)
Handles the mouse move event.
Definition Swnd.cpp:2131
int GetWindowText(TCHAR *pBuf, int nBufLen, BOOL bRawText) OVERRIDE
Retrieves the window text.
Definition Swnd.cpp:263
void OnKillFocus(SWND wndFocus)
Handles losing focus.
Definition Swnd.cpp:2274
void OnPaint(IRenderTarget *pRT)
Handles the painting of the window.
Definition Swnd.cpp:1785
void OnLButtonUp(UINT nFlags, CPoint pt)
Handles the left mouse button up event.
Definition Swnd.cpp:2105
void OnLButtonDown(UINT nFlags, CPoint pt)
Handles the left mouse button down event.
Definition Swnd.cpp:2092
virtual void OnRebuildFont()
Called when the font of the window needs to be rebuilt.
Definition Swnd.cpp:3303
virtual BOOL OnSetCursor(const CPoint &pt)
Sets the cursor when the mouse hovers over the window.
Definition Swnd.cpp:429
void OnRButtonDown(UINT nFlags, CPoint point)
Handles the right mouse button down event.
Definition Swnd.cpp:2122
void OnSetFocus(SWND wndOld)
Handles gaining focus.
Definition Swnd.cpp:2265
Font object interface.
Definition SRender-i.h:650
Interface for rendering target objects.
Definition SRender-i.h:1440