soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
SWnd.h
Go to the documentation of this file.
1/**
2 * Copyright (C) 2014-2050
3 * All rights reserved.
4 *
5 * @file Swnd.h
6 * @brief SOUI基础DUI窗口模块
7 * @version v1.0
8 * @author SOUI group
9 * @date 2014/08/02
10 *
11 * Description: This file defines the SWindow class, which is the base class for SOUI DUI windows.
12 */
13
14#ifndef __SWND__H__
15#define __SWND__H__
16
17#include <core/SWindowMgr.h>
19#include <interface/slayout-i.h>
20#include <interface/saccproxy-i.h>
21#include <interface/scaret-i.h>
22#include <helper/SwndMsgCracker.h>
23#include <layout/SLayoutSize.h>
24#include <event/SEventSlot.h>
25#include <event/SEvents.h>
26#include <event/SEventSet.h>
27#include <res.mgr/SUiDef.h>
28#include <core/SWndStyle.h>
29#include <core/SSkin.h>
30#include <animation/SAnimation.h>
31#include <interface/SWindow-i.h>
32
33#define SC_WANTARROWS 0x0001 /* Control wants arrow keys */
34#define SC_WANTTAB 0x0002 /* Control wants tab keys */
35#define SC_WANTRETURN 0x0004 /* Control wants return keys */
36#define SC_WANTCHARS 0x0008 /* Want WM_CHAR messages */
37#define SC_WANTALLKEYS 0xFFFF /* Control wants all keys */
38#define SC_WANTSYSKEY 0x80000000 /* System Key */
39
40#define ICWND_FIRST ((SWindow *)-1) /* 子窗口插入在开头 */
41#define ICWND_LAST NULL /* 子窗口插入在末尾 */
42
43#ifdef _DEBUG
44#define ASSERT_UI_THREAD() SNS::SWindow::TestMainThread()
45#else
46#define ASSERT_UI_THREAD()
47#endif
48
49SNSBEGIN
50
51/**
52 * @brief Flags for window show state.
53 */
54enum
55{
56 NormalShow = 0, /**< Normal show state */
57 ParentShow = 1 /**< Parent show state */
58};
59
60/**
61 * @brief Flags for window enable state.
62 */
63enum
64{
65 NormalEnable = 0, /**< Normal enable state */
66 ParentEnable = 1 /**< Parent enable state */
67};
68
69/**
70 * @enum WndState
71 * @brief Window state flags.
72 */
74{
75 WndState_Normal = 0x00000000UL, /**< Normal state */
76 WndState_Hover = 0x00000001UL, /**< Hover state */
77 WndState_PushDown = 0x00000002UL, /**< Push down state */
78 WndState_Check = 0x00000004UL, /**< Check state */
79 WndState_Invisible = 0x00000008UL, /**< Invisible state */
80 WndState_Disable = 0x00000010UL /**< Disable state */
81};
82
83/**
84 * @struct SWNDMSG
85 * @brief Structure representing a window message.
86 */
87typedef struct SWNDMSG
88{
89 UINT uMsg; /**< Message identifier */
90 WPARAM wParam; /**< Additional message-specific information */
91 LPARAM lParam; /**< Additional message-specific information */
92} SWNDMSG, *PSWNDMSG;
93
94/**
95 * @class SStateHelper
96 * @brief Helper class for managing window states.
97 */
99 public:
100 /**
101 * @brief Marks a state as active.
102 * @param dwState Current state flags.
103 * @param state State to mark.
104 */
105 static void MarkState(DWORD &dwState, WndState state)
106 {
107 dwState |= state;
108 }
109
110 /**
111 * @brief Clears a state.
112 * @param dwState Current state flags.
113 * @param state State to clear.
114 */
115 static void ClearState(DWORD &dwState, WndState state)
116 {
117 dwState &= ~state;
118 }
119
120 /**
121 * @brief Tests if a state is active.
122 * @param dwState Current state flags.
123 * @param state State to test.
124 * @return TRUE if the state is active, FALSE otherwise.
125 */
126 static bool TestState(DWORD dwState, WndState state)
127 {
128 return (dwState & state) == state;
129 }
130};
131
132/**
133 * @class STimerID
134 * @brief Structure representing a timer ID.
135 */
136class SOUI_EXP STimerID {
137 public:
138 DWORD swnd : 24; /**< Window handle */
139 DWORD uTimerID : 7; /**< Timer ID */
140 DWORD bSwndTimer : 1; /**< Flag indicating if it's a SWND timer */
141
142 /**
143 * @brief Constructor.
144 * @param swnd_ Window handle.
145 * @param timeId Timer ID.
146 */
147 STimerID(SWND swnd_, char timeId)
148 : swnd(swnd_)
149 , uTimerID(timeId)
150 , bSwndTimer(1)
151 {
152 SASSERT(swnd < 0x00FFFFFF && timeId >= 0);
153 }
154
155 /**
156 * @brief Constructor.
157 * @param dwID Combined timer ID.
158 */
159 STimerID(DWORD dwID)
160 {
161 memcpy(this, &dwID, sizeof(DWORD));
162 }
163
164 /**
165 * @brief Conversion operator to DWORD.
166 * @return Combined timer ID as DWORD.
167 */
168 operator DWORD &() const
169 {
170 return *(DWORD *)this;
171 }
172};
173
174/**
175 * @class SPainter
176 * @brief Helper class for painting.
177 */
178class SOUI_EXP SPainter {
179 public:
180 SPainter()
181 : oldTextColor(CR_INVALID)
182 {
183 }
184
185 SAutoRefPtr<IFontS> oldFont; /**< Old font */
186 COLORREF oldTextColor; /**< Old text color */
187};
188
189/**
190 * @enum GW_CODE
191 * @brief Codes for getting related windows.
192 */
193typedef enum tagGW_CODE
194{
195 GSW_FIRSTCHILD = 0, /**< First child window */
196 GSW_LASTCHILD, /**< Last child window */
197 GSW_PREVSIBLING, /**< Previous sibling window */
198 GSW_NEXTSIBLING, /**< Next sibling window */
199 GSW_PARENT, /**< Parent window */
200 GSW_OWNER /**< Owner window */
201} GW_CODE;
202
203/**
204 * @struct SwndToolTipInfo
205 * @brief Information for window tooltips.
206 */
208{
209 SWND swnd; /**< Window handle */
210 DWORD dwCookie; /**< Tooltip ID */
211 CRect rcTarget; /**< Tooltip target rectangle */
212 SStringT strTip; /**< Tooltip text */
213};
214
215/**
216 * @enum HRET_FLAG
217 * @brief Flags for handling attributes.
218 */
219enum
220{
221 HRET_FLAG_STYLE = (1 << 16), /**< Style attribute flag */
222 HRET_FLAG_LAYOUT = (1 << 17), /**< Layout attribute flag */
223 HRET_FLAG_LAYOUT_PARAM = (1 << 18) /**< Layout parameter attribute flag */
224};
225
226/**
227 * @class STrText
228 * @brief Class for handling text with translation support.
229 */
230class SOUI_EXP STrText {
231 public:
232 /**
233 * @brief Constructor.
234 * @param pOwner Owner window.
235 */
236 STrText(SWindow *pOwner = NULL);
237
238 /**
239 * @brief Sets the owner window.
240 * @param pOwner Owner window.
241 */
242 void SetOwner(SWindow *pOwner);
243
244 /**
245 * @brief Sets the text.
246 * @param strText Text to set.
247 * @param bAutoEscape Flag to automatically escape the text.
248 */
249 void SetText(const SStringT &strText, bool bAutoEscape = true);
250
251 /**
252 * @brief Gets the text.
253 * @param bRawText Flag to get raw text.
254 * @return Text string.
255 */
256 SStringT GetText(BOOL bRawText = FALSE) const;
257
258 /**
259 * @brief Translates the text.
260 */
261 void TranslateText();
262
263 /**
264 * @brief Escapes a string.
265 * @param str String to escape.
266 * @return Escaped string.
267 */
268 static SStringW EscapeString(const SStringW &str);
269
270 protected:
271 SWindow *pOwner; /**< Owner window */
272 SStringT strRaw; /**< Raw text */
273 bool bAutoEscape; /**< Auto-escape flag */
274 SStringT strTr; /**< Translated text */
275};
276
277/**
278 * @class SWindow
279 * @brief Base class for SOUI DUI windows.
280 *
281 * This class provides the basic functionality for SOUI DUI windows, including layout,
282 * event handling, and rendering.
283 */
284class SOUI_EXP SWindow
285 : public TObjRefImpl<SObjectImpl<IWindow>>
286 , protected IAnimationListener {
287 DEF_SOBJECT(SObjectImpl<IWindow>, L"window")
288
289 friend class SwndLayoutBuilder;
290 friend class SWindowRepos;
291 friend class SHostWnd;
292 friend class SwndContainerImpl;
293 friend class FocusSearch;
294 friend class SGridLayout;
295 friend class SLinearLayout;
296 friend class SouiLayout;
297 friend class SHostProxy;
298
299 class SAnimationHandler : public ITimelineHandler {
300 private:
301 SWindow *m_pOwner; /**< Owner window */
302 STransformation m_transform; /**< Transformation */
303 bool m_bFillAfter; /**< Fill after flag */
304 SWindow *m_pPrevSiblingBackup; /**< Previous sibling backup */
305
306 public:
307 /**
308 * @brief Constructor.
309 * @param pOwner Owner window.
310 */
311 SAnimationHandler(SWindow *pOwner);
312
313 /**
314 * @brief Called when animation starts.
315 */
316 void OnAnimationStart();
317
318 /**
319 * @brief Called when animation stops.
320 */
321 void OnAnimationStop();
322
323 /**
324 * @brief Gets the transformation.
325 * @return Transformation object.
326 */
327 const STransformation &GetTransformation() const;
328
329 /**
330 * @brief Gets the fill after flag.
331 * @return Fill after flag.
332 */
333 bool getFillAfter() const;
334
335 public:
336 STDMETHOD_(void, OnNextFrame)(THIS_) OVERRIDE;
337
338 protected:
339 /**
340 * @brief Called when the owner window is resized.
341 * @param e Event arguments.
342 * @return TRUE if handled, FALSE otherwise.
343 */
344 BOOL OnOwnerResize(IEvtArgs *e);
345 };
346
347 public:
348 /**
349 * @brief Constructor.
350 */
351 SWindow();
352
353 /**
354 * @brief Destructor.
355 */
356 virtual ~SWindow();
357
358 public:
359 /**
360 * @brief Checks if the message is handled.
361 * @return TRUE if the message is handled, FALSE otherwise.
362 */
363 BOOL IsMsgHandled() const;
364
365 /**
366 * @brief Sets the message handled flag.
367 * @param bHandled Message handled flag.
368 */
369 void SetMsgHandled(BOOL bHandled);
370
371 public:
372 /**
373 * @brief Gets the XML text from a node.
374 * @param xmlNode XML node.
375 * @return XML text.
376 */
377 static SStringW GetXmlText(const SXmlNode &xmlNode);
378
379 public:
380 public:
381 /**
382 * @brief Called when the last reference to the object is released.
383 */
384 STDMETHOD_(void, OnFinalRelease)(THIS);
385
386 /**
387 * @brief Retrieves the window handle.
388 * @return Window handle.
389 */
390 STDMETHOD_(SWND, GetSwnd)(THIS) SCONST OVERRIDE;
391
392 /**
393 * @brief Retrieves the layout object associated with the window.
394 * @return Pointer to the layout object.
395 */
396 STDMETHOD_(ILayout *, GetLayout)(THIS) OVERRIDE
397 {
398 return m_pLayout;
399 }
400
401 /**
402 * @brief Retrieves the layout parameter object associated with the window.
403 * @return Pointer to the layout parameter object.
404 */
405 STDMETHOD_(ILayoutParam *, GetLayoutParam)(THIS) SCONST OVERRIDE
406 {
407 return m_pLayoutParam;
408 }
409
410 /**
411 * @brief Sets the layout parameter object for the window.
412 * @param pLayoutParam Pointer to the layout parameter object.
413 * @return TRUE if successful, FALSE otherwise.
414 */
415 STDMETHOD_(BOOL, SetLayoutParam)(THIS_ ILayoutParam *pLayoutParam) OVERRIDE;
416
417 /**
418 * @brief Checks if the window is floating.
419 * @return TRUE if the window is floating, FALSE otherwise.
420 */
421 STDMETHOD_(BOOL, IsFloat)(THIS) SCONST OVERRIDE;
422
423 /**
424 * @brief Checks if the window is displayed.
425 * @return TRUE if the window is displayed, FALSE otherwise.
426 */
427 STDMETHOD_(BOOL, IsDisplay)(THIS) SCONST OVERRIDE;
428
429 /**
430 * @brief Sets the window text.
431 * @param lpszText Text to set.
432 */
433 STDMETHOD_(void, SetWindowText)(THIS_ LPCTSTR lpszText) OVERRIDE;
434
435 /**
436 * @brief Sets the window text using a UTF-8 string.
437 * @param lpszText UTF-8 text to set.
438 */
439 STDMETHOD_(void, SetWindowTextU8)(THIS_ LPCSTR lpszText) OVERRIDE;
440
441 /**
442 * @brief Sets the tooltip text for the window.
443 * @param pszText Tooltip text to set.
444 */
445 STDMETHOD_(void, SetToolTipText)(THIS_ LPCTSTR pszText) OVERRIDE;
446
447 /**
448 * @brief Sets the tooltip text using a UTF-8 string.
449 * @param pszText UTF-8 tooltip text to set.
450 */
451 STDMETHOD_(void, SetToolTipTextU8)(THIS_ LPCSTR pszText) OVERRIDE;
452
453 /**
454 * @brief Checks if the window is checked.
455 * @return TRUE if the window is checked, FALSE otherwise.
456 */
457 STDMETHOD_(BOOL, IsChecked)(THIS) SCONST OVERRIDE;
458
459 /**
460 * @brief Sets the check state of the window.
461 * @param bCheck TRUE to check the window, FALSE to uncheck.
462 */
463 STDMETHOD_(void, SetCheck)(THIS_ BOOL bCheck) OVERRIDE;
464
465 /**
466 * @brief Checks if the window is disabled.
467 * @param bCheckParent Flag to check the parent window's state.
468 * @return TRUE if the window is disabled, FALSE otherwise.
469 */
470 STDMETHOD_(BOOL, IsDisabled)(THIS_ BOOL bCheckParent DEF_VAL(FALSE)) SCONST OVERRIDE;
471
472 /**
473 * @brief Enables or disables the window.
474 * @param bEnable TRUE to enable the window, FALSE to disable.
475 * @param bUpdate Flag to update the window state.
476 */
477 STDMETHOD_(void, EnableWindow)(THIS_ BOOL bEnable, BOOL bUpdate DEF_VAL(FALSE)) OVERRIDE;
478
479 /**
480 * @brief Checks if the window is visible.
481 * @param bCheckParent Flag to check the parent window's state.
482 * @return TRUE if the window is visible, FALSE otherwise.
483 */
484 STDMETHOD_(BOOL, IsVisible)(THIS_ BOOL bCheckParent DEF_VAL(FALSE)) SCONST OVERRIDE;
485
486 /**
487 * @brief Sets the visibility of the window.
488 * @param bVisible TRUE to make the window visible, FALSE to hide it.
489 * @param bUpdate Flag to update the window state.
490 */
491 STDMETHOD_(void, SetVisible)(THIS_ BOOL bVisible, BOOL bUpdate DEF_VAL(FALSE)) OVERRIDE;
492
493 /**
494 * @brief Checks if the window is message transparent.
495 * @return TRUE if the window is message transparent, FALSE otherwise.
496 */
497 STDMETHOD_(BOOL, IsMsgTransparent)(THIS) SCONST OVERRIDE;
498
499 /**
500 * @brief Retrieves the user data associated with the window.
501 * @return User data.
502 */
503 STDMETHOD_(ULONG_PTR, GetUserData)(THIS) SCONST OVERRIDE;
504
505 /**
506 * @brief Sets the user data for the window.
507 * @param uData User data to set.
508 * @return Previous user data.
509 */
510 STDMETHOD_(ULONG_PTR, SetUserData)(THIS_ ULONG_PTR uData) OVERRIDE;
511
512 /**
513 * @brief Retrieves the bounding rectangle of the window.
514 * @param prect Pointer to the rectangle to receive the window's bounds.
515 */
516 STDMETHOD_(void, GetWindowRect)(THIS_ LPRECT prect) SCONST OVERRIDE;
517
518 /**
519 * @brief Checks if the window is a video canvas.
520 * @return TRUE if the window is a video canvas, FALSE otherwise.
521 */
522 STDMETHOD_(BOOL, IsVideoCanvas)(CTHIS) SCONST OVERRIDE;
523
524 /**
525 * @brief Retrieves the visible rectangle of the window.
526 * @param prect Pointer to the rectangle to receive the visible area.
527 */
528 STDMETHOD_(void, GetVisibleRect)(CTHIS_ LPRECT prect) SCONST OVERRIDE;
529
530 /**
531 * @brief Retrieves the client rectangle of the window.
532 * @param prect Pointer to the rectangle to receive the client area.
533 */
534 STDMETHOD_(void, GetClientRect)(THIS_ LPRECT prect) SCONST OVERRIDE;
535
536 /**
537 * @brief Checks if the window contains a specified point.
538 * @param pt Point to check.
539 * @param bClientOnly Flag to check only the client area.
540 * @return TRUE if the point is within the window, FALSE otherwise.
541 */
542 STDMETHOD_(BOOL, IsContainPoint)(THIS_ POINT pt, BOOL bClientOnly) SCONST OVERRIDE;
543
544 /**
545 * @brief Applies colorization to the window.
546 * @param cr Color reference for colorization.
547 */
548 STDMETHOD_(void, DoColorize)(THIS_ COLORREF cr) OVERRIDE;
549
550 /**
551 * @brief Retrieves the colorization color of the window.
552 * @return Color reference for colorization.
553 */
554 STDMETHOD_(COLORREF, GetColorizeColor)(THIS) SCONST OVERRIDE;
555
556 /**
557 * @brief Destroys the window.
558 * @return TRUE if successful, FALSE otherwise.
559 */
560 STDMETHOD_(BOOL, Destroy)(THIS) OVERRIDE;
561
562 /**
563 * @brief Brings the window to the top of the Z-order.
564 */
565 STDMETHOD_(void, BringWindowToTop)(THIS) OVERRIDE;
566
567 /**
568 * @brief Retrieves the number of child windows.
569 * @return Number of child windows.
570 */
571 STDMETHOD_(UINT, GetChildrenCount)(THIS) SCONST OVERRIDE;
572
573 /**
574 * @brief Sends a message to the window.
575 * @param uMsg Message identifier.
576 * @param wParam Additional message-specific information.
577 * @param lParam Additional message-specific information.
578 * @param pbMsgHandled Pointer to receive the message handled flag.
579 * @return Result of the message processing.
580 */
581 STDMETHOD_(LRESULT, SSendMessage)
582 (THIS_ UINT uMsg, WPARAM wParam = 0, LPARAM lParam = 0, BOOL *pbMsgHandled DEF_VAL(NULL)) OVERRIDE;
583
584 /**
585 * @brief Dispatches a message to the window.
586 * @param uMsg Message identifier.
587 * @param wParam Additional message-specific information.
588 * @param lParam Additional message-specific information.
589 */
590 STDMETHOD_(void, SDispatchMessage)
591 (THIS_ UINT uMsg, WPARAM wParam = 0, LPARAM lParam = 0) OVERRIDE;
592
593 /**
594 * @brief Sets the focus to the window.
595 */
596 STDMETHOD_(void, SetFocus)(THIS) OVERRIDE;
597
598 /**
599 * @brief Kills the focus from the window.
600 */
601 STDMETHOD_(void, KillFocus)(THIS) OVERRIDE;
602
603 /**
604 * @brief Checks if the window has focus.
605 * @return TRUE if the window has focus, FALSE otherwise.
606 */
607 STDMETHOD_(BOOL, IsFocused)(THIS) SCONST OVERRIDE;
608
609 /**
610 * @brief Invalidates the entire window.
611 */
612 STDMETHOD_(void, Invalidate)(THIS) OVERRIDE;
613
614 /**
615 * @brief Invalidates a specific rectangle area of the window.
616 * @param lprect Pointer to the rectangle to invalidate.
617 */
618 STDMETHOD_(void, InvalidateRect)(THIS_ LPCRECT lprect) OVERRIDE;
619
620 /**
621 * @brief Locks updates to the window.
622 */
623 STDMETHOD_(void, LockUpdate)(THIS) OVERRIDE;
624
625 /**
626 * @brief Unlocks updates to the window.
627 */
628 STDMETHOD_(void, UnlockUpdate)(THIS) OVERRIDE;
629
630 /**
631 * @brief Checks if updates to the window are locked.
632 * @param bCheckParent Flag to check the parent window's state.
633 * @return TRUE if updates are locked, FALSE otherwise.
634 */
635 STDMETHOD_(BOOL, IsUpdateLocked)(CTHIS_ BOOL bCheckParent DEF_VAL(FALSE)) SCONST OVERRIDE;
636
637 /**
638 * @brief Updates the window.
639 * @param bForce Flag to force the update.
640 */
641 STDMETHOD_(void, Update)(THIS_ BOOL bForce DEF_VAL(FALSE)) OVERRIDE;
642
643 /**
644 * @brief Moves the window to a new position and size.
645 * @param prect Pointer to the rectangle defining the new position and size.
646 */
647 STDMETHOD_(void, Move)(THIS_ LPCRECT prect) OVERRIDE;
648
649 /**
650 * @brief Sets the window region.
651 * @param pRgn Pointer to the region object.
652 * @param bRedraw Flag to redraw the window.
653 */
654 STDMETHOD_(void, SetWindowRgn)(THIS_ IRegionS *pRgn, BOOL bRedraw DEF_VAL(TRUE)) OVERRIDE;
655
656 /**
657 * @brief Retrieves the window region.
658 * @return Pointer to the region object.
659 */
660 STDMETHOD_(IRegionS *, GetWindowRgn)(THIS) SCONST OVERRIDE;
661
662 /**
663 * @brief Sets the window path.
664 * @param pPath Pointer to the path object.
665 * @param bRedraw Flag to redraw the window.
666 */
667 STDMETHOD_(void, SetWindowPath)(THIS_ IPathS *pPath, BOOL bRedraw DEF_VAL(TRUE)) OVERRIDE;
668
669 /**
670 * @brief Retrieves the window path.
671 * @return Pointer to the path object.
672 */
673 STDMETHOD_(IPathS *, GetWindowPath)(THIS) SCONST OVERRIDE;
674
675 /**
676 * @brief Sets a timer for the window.
677 * @param id Timer ID.
678 * @param uElapse Elapse time in milliseconds.
679 * @return TRUE if successful, FALSE otherwise.
680 */
681 STDMETHOD_(BOOL, SetTimer)(THIS_ char id, UINT uElapse) OVERRIDE;
682
683 /**
684 * @brief Kills a timer for the window.
685 * @param id Timer ID.
686 * @return TRUE if successful, FALSE otherwise.
687 */
688 STDMETHOD_(BOOL, KillTimer)(THIS_ char id) OVERRIDE;
689
690 /**
691 * @brief Retrieves the window that has captured the mouse.
692 * @return Window handle of the captured window.
693 */
694 STDMETHOD_(SWND, GetCapture)(THIS) SCONST OVERRIDE;
695
696 /**
697 * @brief Sets the window to capture the mouse.
698 * @return Window handle of the window that now has capture.
699 */
700 STDMETHOD_(SWND, SetCapture)(THIS) OVERRIDE;
701
702 /**
703 * @brief Releases the mouse capture from the window.
704 * @return TRUE if successful, FALSE otherwise.
705 */
706 STDMETHOD_(BOOL, ReleaseCapture)(THIS) OVERRIDE;
707
708 /**
709 * @brief Sets an animation for the window.
710 * @param animation Pointer to the animation object.
711 */
712 STDMETHOD_(void, SetAnimation)(THIS_ IAnimation *animation) OVERRIDE;
713
714 /**
715 * @brief Retrieves the animation object associated with the window.
716 * @return Pointer to the animation object.
717 */
718 STDMETHOD_(IAnimation *, GetAnimation)(THIS) SCONST OVERRIDE;
719
720 /**
721 * @brief Starts an animation for the window.
722 * @param animation Pointer to the animation object.
723 */
724 STDMETHOD_(void, StartAnimation)(THIS_ IAnimation *animation) OVERRIDE;
725
726 /**
727 * @brief Clears the animation for the window.
728 */
729 STDMETHOD_(void, ClearAnimation)(THIS) OVERRIDE;
730
731 /**
732 * @brief Sets the alpha value for the window.
733 * @param byAlpha Alpha value.
734 */
735 STDMETHOD_(void, SetAlpha)(THIS_ BYTE byAlpha) OVERRIDE;
736
737 /**
738 * @brief Retrieves the alpha value of the window.
739 * @return Alpha value.
740 */
741 STDMETHOD_(BYTE, GetAlpha)(THIS) SCONST OVERRIDE;
742
743 /**
744 * @brief Sets the transformation matrix for the window.
745 * @param mtx Pointer to the transformation matrix.
746 */
747 STDMETHOD_(void, SetMatrix)(THIS_ const IMatrix *mtx) OVERRIDE;
748
749 /**
750 * @brief Retrieves the transformation matrix of the window.
751 * @param mtx Pointer to the matrix object to receive the transformation matrix.
752 */
753 STDMETHOD_(void, GetMatrix)(THIS_ IMatrix *mtx) SCONST OVERRIDE;
754
755 /**
756 * @brief Retrieves the scale factor of the window.
757 * @return Scale factor.
758 */
759 STDMETHOD_(int, GetScale)(THIS) SCONST OVERRIDE;
760
761 /**
762 * @brief Checks if siblings are auto-grouped.
763 * @return TRUE if siblings are auto-grouped, FALSE otherwise.
764 */
765 STDMETHOD_(BOOL, IsSiblingsAutoGroupped)(THIS) SCONST OVERRIDE;
766
767 /**
768 * @brief Requests a relayout of the window.
769 */
770 STDMETHOD_(void, RequestRelayout)(THIS) OVERRIDE;
771
772 /**
773 * @brief Updates the layout of the window.
774 */
775 STDMETHOD_(void, UpdateLayout)(THIS) OVERRIDE;
776
777 /**
778 * @brief Retrieves the dialog code for the window.
779 * @return Dialog code.
780 */
781 STDMETHOD_(UINT, OnGetDlgCode)(THIS) SCONST OVERRIDE;
782
783 /**
784 * @brief Checks if the window is focusable.
785 * @return TRUE if the window is focusable, FALSE otherwise.
786 */
787 STDMETHOD_(BOOL, IsFocusable)(THIS) SCONST OVERRIDE;
788
789 /**
790 * @brief Checks if client area clipping is enabled.
791 * @return TRUE if client area clipping is enabled, FALSE otherwise.
792 */
793 STDMETHOD_(BOOL, IsClipClient)(THIS) SCONST OVERRIDE;
794
795 /**
796 * @brief Checks if the layout is dirty.
797 * @return TRUE if the layout is dirty, FALSE otherwise.
798 */
799 STDMETHOD_(BOOL, IsLayoutDirty)(THIS) SCONST OVERRIDE;
800
801 /**
802 * @brief Retrieves the next layout child window.
803 * @param pCurChild Pointer to the current child window.
804 * @return Pointer to the next layout child window.
805 */
806 STDMETHOD_(IWindow *, GetNextLayoutIChild)(THIS_ const IWindow *pCurChild) SCONST OVERRIDE;
807
808 /**
809 * @brief Updates the position of child windows.
810 */
811 STDMETHOD_(void, UpdateChildrenPosition)(THIS) OVERRIDE;
812
813 /**
814 * @brief Retrieves a window based on a given code.
815 * @param uCode Code specifying the type of window to retrieve (e.g., first child, last child).
816 * @return Pointer to the requested window.
817 */
818 STDMETHOD_(IWindow *, GetIWindow)(THIS_ int uCode) SCONST OVERRIDE;
819
820 /**
821 * @brief Retrieves a child window by index.
822 * @param iChild Index of the child window.
823 * @return Pointer to the child window.
824 */
825 STDMETHOD_(IWindow *, GetIChild)(THIS_ int iChild) SCONST OVERRIDE;
826
827 /**
828 * @brief Retrieves the parent window.
829 * @return Pointer to the parent window.
830 */
831 STDMETHOD_(IWindow *, GetIParent)(THIS) SCONST OVERRIDE;
832
833 /**
834 * @brief Retrieves the root window in the hierarchy.
835 * @return Pointer to the root window.
836 */
837 STDMETHOD_(IWindow *, GetIRoot)(THIS) SCONST OVERRIDE;
838
839 /**
840 * @brief Checks if a window is a descendant of this window.
841 * @param pWnd Pointer to the window to check.
842 * @return TRUE if the window is a descendant, FALSE otherwise.
843 */
844 STDMETHOD_(BOOL, IsDescendant)(THIS_ const IWindow *pWnd) SCONST OVERRIDE;
845
846 /**
847 * @brief Adjusts the Z-order of the window.
848 * @param pInsertAfter Pointer to the window after which this window should be inserted.
849 * @return TRUE if successful, FALSE otherwise.
850 */
851 STDMETHOD_(BOOL, AdjustIZOrder)(THIS_ IWindow *pInsertAfter) OVERRIDE;
852
853 /**
854 * @brief Inserts a child window into the window tree.
855 * @param pNewChild Pointer to the new child window.
856 * @param pInsertAfter Pointer to the window after which the new child should be inserted.
857 */
858 STDMETHOD_(void, InsertIChild)
859 (THIS_ IWindow *pNewChild, IWindow *pInsertAfter = ICWND_LAST) OVERRIDE;
860
861 /**
862 * @brief Removes a child window from the window tree.
863 * @param pChild Pointer to the child window to remove.
864 * @return TRUE if successful, FALSE otherwise.
865 */
866 STDMETHOD_(BOOL, RemoveIChild)(THIS_ IWindow *pChild) OVERRIDE;
867
868 /**
869 * @brief Destroys a child window.
870 * @param pChild Pointer to the child window to destroy.
871 * @return TRUE if successful, FALSE otherwise.
872 */
873 STDMETHOD_(BOOL, DestroyIChild)(THIS_ IWindow *pChild) OVERRIDE;
874
875 /**
876 * @brief Destroys all child windows.
877 */
878 STDMETHOD_(void, DestroyAllChildren)(THIS) OVERRIDE;
879
880 /**
881 * @brief Finds a child window by its ID.
882 * @param nId ID of the child window to find.
883 * @return Pointer to the found child window.
884 */
885 STDMETHOD_(IWindow *, FindIChildByID)(THIS_ int nId) OVERRIDE;
886
887 /**
888 * @brief Finds a child window by its name.
889 * @param pszName Name of the child window to find.
890 * @return Pointer to the found child window.
891 */
892 STDMETHOD_(IWindow *, FindIChildByName)(THIS_ LPCWSTR pszName) OVERRIDE;
893
894 /**
895 * @brief Finds a child window by its name (ANSI version).
896 * @param pszName Name of the child window to find.
897 * @return Pointer to the found child window.
898 */
899 STDMETHOD_(IWindow *, FindIChildByNameA)(THIS_ LPCSTR pszName) OVERRIDE;
900
901 /**
902 * @brief Retrieves the container associated with this window.
903 * @return Pointer to the container object.
904 */
905 STDMETHOD_(ISwndContainer *, GetContainer)(THIS) OVERRIDE;
906
907 /**
908 * @brief Sets the container for the window.
909 * @param pContainer Pointer to the container object.
910 */
911 STDMETHOD_(void, SetContainer)(THIS_ ISwndContainer *pContainer) OVERRIDE;
912
913 /**
914 * @brief Retrieves the layout rectangle of the children.
915 * @param prc Pointer to the rectangle to receive the layout area.
916 */
917 STDMETHOD_(void, GetChildrenLayoutRect)(THIS_ RECT *prc) SCONST OVERRIDE;
918
919 /**
920 * @brief Retrieves the desired size of the window.
921 * @param psz Pointer to the size structure to receive the desired size.
922 * @param nParentWid Width of the parent window.
923 * @param nParentHei Height of the parent window.
924 */
925 STDMETHOD_(void, GetDesiredSize)(THIS_ SIZE *psz, int nParentWid, int nParentHei) OVERRIDE;
926
927 /**
928 * @brief Moves the window to a new position and optionally resizes it.
929 * @param x New X-coordinate of the window.
930 * @param y New Y-coordinate of the window.
931 * @param cx New width of the window (-1 to keep the current width).
932 * @param cy New height of the window (-1 to keep the current height).
933 */
934 STDMETHOD_(void, Move2)(THIS_ int x, int y, int cx DEF_VAL(-1), int cy DEF_VAL(-1)) OVERRIDE;
935
936 /**
937 * @brief Retrieves the window text.
938 * @param pBuf Buffer to receive the window text.
939 * @param nBufLen Length of the buffer.
940 * @param bRawText Flag to indicate if raw text should be retrieved.
941 * @return Length of the text copied to the buffer.
942 */
943 STDMETHOD_(int, GetWindowText)(THIS_ TCHAR *pBuf, int nBufLen, BOOL bRawText) OVERRIDE;
944
945 /**
946 * @brief Retrieves the window text as a UTF-8 string.
947 * @param pStr String object to receive the window text.
948 * @param bRawText Flag to indicate if raw text should be retrieved.
949 * @return Length of the text copied to the string object.
950 */
951 STDMETHOD_(int, GetWindowTextU8)(THIS_ IStringA *pStr, BOOL bRawText) OVERRIDE;
952
953 /**
954 * @brief Sets the event mute state.
955 * @param bMute Flag to indicate if events should be muted.
956 */
957 STDMETHOD_(void, SetEventMute)(THIS_ BOOL bMute) OVERRIDE;
958
959 /**
960 * @brief Retrieves the current state of the window.
961 * @return Current state flags.
962 */
963 STDMETHOD_(DWORD, GetState)(THIS) SCONST OVERRIDE;
964
965 /**
966 * @brief Modifies the state of the window.
967 * @param dwStateAdd State flags to add.
968 * @param dwStateRemove State flags to remove.
969 * @param bUpdate Flag to indicate if the state change should be updated.
970 * @return Modified state flags.
971 */
972 STDMETHOD_(DWORD, ModifyState)
973 (THIS_ DWORD dwStateAdd, DWORD dwStateRemove, BOOL bUpdate DEF_VAL(FALSE)) OVERRIDE;
974
975 /**
976 * @brief Sets the owner window.
977 * @param pOwner Pointer to the owner window.
978 */
979 STDMETHOD_(void, SetIOwner)(THIS_ IWindow *pOwner) OVERRIDE;
980
981 /**
982 * @brief Retrieves the owner window.
983 * @return Pointer to the owner window.
984 */
985 STDMETHOD_(IWindow *, GetIOwner)(THIS) SCONST OVERRIDE;
986
987 /**
988 * @brief Creates child windows from XML.
989 * @param pszXml XML string containing child window definitions.
990 * @return TRUE if successful, FALSE otherwise.
991 */
992 STDMETHOD_(BOOL, CreateChildrenFromXml)(THIS_ LPCWSTR pszXml) OVERRIDE;
993
994 /**
995 * @brief Creates child windows from a resource ID.
996 * @param pszResId Resource ID of the XML string containing child window definitions.
997 * @return TRUE if successful, FALSE otherwise.
998 */
999 STDMETHOD_(BOOL, CreateChildrenFromResId)(THIS_ LPCTSTR pszResId) OVERRIDE;
1000
1001 /**
1002 * @brief Initializes the window from an XML node.
1003 * @param pNode XML node containing window initialization data.
1004 * @return TRUE if successful, FALSE otherwise.
1005 */
1006 STDMETHOD_(BOOL, InitFromXml)(THIS_ IXmlNode *pNode) OVERRIDE;
1007
1008 /**
1009 * @brief Retrieves an attribute value from the window.
1010 * @param pszName Name of the attribute.
1011 * @param strValue String object to receive the attribute value.
1012 * @return TRUE if successful, FALSE otherwise.
1013 */
1014 STDMETHOD_(BOOL, GetAttribute)(THIS_ LPCWSTR pszName, IStringW *strValue) SCONST OVERRIDE;
1015
1016 /**
1017 * @brief Retrieves the background color of the window.
1018 * @return Background color.
1019 */
1020 STDMETHOD_(COLORREF, GetBkgndColor)(THIS) SCONST OVERRIDE;
1021
1022 /**
1023 * @brief Retrieves the selected sibling window in a group.
1024 * @return Pointer to the selected sibling window, or NULL if not in a group.
1025 */
1026 STDMETHOD_(IWindow *, GetISelectedSiblingInGroup)(THIS) OVERRIDE;
1027
1028 /**
1029 * @brief Retrieves the selected child window in a group.
1030 * @return Pointer to the selected child window, or NULL if not in a group.
1031 */
1032 STDMETHOD_(IWindow *, GetISelectedChildInGroup)(THIS) OVERRIDE;
1033
1034 /**
1035 * @brief Retrieves the window handle at a specified point.
1036 * @param pt Point to test.
1037 * @param bIncludeMsgTransparent Flag to include message-transparent windows.
1038 * @return Window handle at the specified point.
1039 */
1040 STDMETHOD_(SWND, SwndFromPoint)(THIS_ POINT *pt, BOOL bIncludeMsgTransparent DEF_VAL(FALSE)) SCONST OVERRIDE;
1041
1042 /**
1043 * @brief Fires an event.
1044 * @param evt Event arguments.
1045 * @return TRUE if the event was handled, FALSE otherwise.
1046 */
1047 STDMETHOD_(BOOL, FireEvent)(THIS_ IEvtArgs *evt) OVERRIDE;
1048
1049 /**
1050 * @brief Fires a command event.
1051 * @return TRUE if the command was handled, FALSE otherwise.
1052 */
1053 STDMETHOD_(BOOL, FireCommand)(THIS) OVERRIDE;
1054
1055 /**
1056 * @brief Fires a context menu event.
1057 * @param pt Point where the context menu should be displayed.
1058 * @return TRUE if the context menu was handled, FALSE otherwise.
1059 */
1060 STDMETHOD_(BOOL, FireCtxMenu)(THIS_ POINT pt) OVERRIDE;
1061
1062 /**
1063 * @brief Subscribes to an event.
1064 * @param evtId Event ID.
1065 * @param pSlot Event slot.
1066 * @return TRUE if successful, FALSE otherwise.
1067 */
1068 STDMETHOD_(BOOL, SubscribeEvent)(THIS_ DWORD evtId, const IEvtSlot *pSlot) OVERRIDE;
1069
1070 /**
1071 * @brief Unsubscribes from an event.
1072 * @param evtId Event ID.
1073 * @param pSlot Event slot.
1074 * @return TRUE if successful, FALSE otherwise.
1075 */
1076 STDMETHOD_(BOOL, UnsubscribeEvent)(THIS_ DWORD evtId, const IEvtSlot *pSlot) OVERRIDE;
1077
1078 /**
1079 * @brief Queries an interface.
1080 * @param id Interface ID.
1081 * @param ppRet Pointer to receive the interface pointer.
1082 * @return HRESULT indicating success or failure.
1083 */
1084 STDMETHOD_(HRESULT, QueryInterface)(THIS_ REFGUID id, IObjRef **ppRet) OVERRIDE;
1085
1086 /**
1087 * @brief Adds an event handler.
1088 * @param dwEventID Event ID.
1089 * @param pszEventHandlerName Event handler name.
1090 * @return TRUE if successful, FALSE otherwise.
1091 */
1092 STDMETHOD_(BOOL, AddEvent)(THIS_ DWORD dwEventID, LPCWSTR pszEventHandlerName) OVERRIDE;
1093
1094 /**
1095 * @brief Removes an event handler.
1096 * @param dwEventID Event ID.
1097 * @return TRUE if successful, FALSE otherwise.
1098 */
1099 STDMETHOD_(BOOL, RemoveEvent)(THIS_ DWORD dwEventID) OVERRIDE;
1100
1101 /**
1102 * @brief Processes a window message.
1103 * @param uMsg Message identifier.
1104 * @param wParam Additional message-specific information.
1105 * @param lParam Additional message-specific information.
1106 * @param lResult Pointer to receive the result of the message processing.
1107 * @return TRUE if the message was handled, FALSE otherwise.
1108 */
1109 STDMETHOD_(BOOL, SwndProc)(THIS_ UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *lResult) OVERRIDE;
1110
1111 /**
1112 * @brief Sets the window procedure.
1113 * @param swndProc Window procedure function.
1114 */
1115 STDMETHOD_(void, SetSwndProc)(THIS_ FunSwndProc swndProc) OVERRIDE;
1116
1117 /**
1118 * @brief Retrieves the host window handle.
1119 * @return Host window handle.
1120 */
1121 STDMETHOD_(HWND, GetHostHwnd)(THIS) OVERRIDE;
1122
1123 /**
1124 * @brief Retrieves the timeline handlers manager.
1125 * @return Pointer to the timeline handlers manager.
1126 */
1127 STDMETHOD_(ITimelineHandlersMgr *, GetTimelineHandlersMgr)(THIS) OVERRIDE;
1128
1129 /**
1130 * @brief Registers a drop target for the window.
1131 * @param pDragTarget Pointer to the drop target.
1132 * @return TRUE if successful, FALSE otherwise.
1133 */
1134 STDMETHOD_(BOOL, RegisterDragDrop)(THIS_ IDropTarget *pDragTarget) OVERRIDE;
1135
1136 /**
1137 * @brief Unregisters a drop target for the window.
1138 * @return TRUE if successful, FALSE otherwise.
1139 */
1140 STDMETHOD_(BOOL, UnregisterDragDrop)(THIS) OVERRIDE;
1141
1142 public: // caret相关方法
1143 /**
1144 * @brief Creates a caret.
1145 * @param pBmp Bitmap for the caret.
1146 * @param nWid Width of the caret.
1147 * @param nHeight Height of the caret.
1148 * @return TRUE if successful, FALSE otherwise.
1149 */
1150 STDMETHOD_(BOOL, CreateCaret)(THIS_ HBITMAP pBmp, int nWid, int nHeight) OVERRIDE;
1151
1152 /**
1153 * @brief Shows or hides the caret.
1154 * @param bShow Flag to indicate if the caret should be shown.
1155 */
1156 STDMETHOD_(void, ShowCaret)(THIS_ BOOL bShow) OVERRIDE;
1157
1158 /**
1159 * @brief Sets the caret position.
1160 * @param x X-coordinate of the caret position.
1161 * @param y Y-coordinate of the caret position.
1162 */
1163 STDMETHOD_(void, SetCaretPos)(THIS_ int x, int y) OVERRIDE;
1164
1165 public:
1166#ifdef _WIN32
1167 /**
1168 * @brief Retrieves the accessible object for the window.
1169 * @return Pointer to the accessible object.
1170 */
1171 IAccessible *GetAccessible();
1172#endif
1173 /**
1174 * @brief Retrieves the accessibility proxy for the window.
1175 * @return Pointer to the accessibility proxy.
1176 */
1177 IAccProxy *GetAccProxy();
1178
1179 /**
1180 * @brief Notifies an accessibility event.
1181 * @param dwEvt Event ID.
1182 */
1183 void accNotifyEvent(DWORD dwEvt);
1184
1185 public:
1186 /**
1187 * @brief Retrieves the current message being processed.
1188 * @return PSWNDMSG Pointer to the current message structure.
1189 */
1190 PSWNDMSG GetCurMsg(void) const
1191 {
1192 return m_pCurMsg;
1193 }
1194
1195 /**
1196 * @brief Retrieves the container associated with this window.
1197 * @return const ISwndContainer* Pointer to the container object.
1198 */
1199 const ISwndContainer *GetContainer() const;
1200
1201 /**
1202 * @brief Retrieves a window based on a given code.
1203 * @param uCode Code specifying the type of window to retrieve (e.g., first child, last child).
1204 * @return SWindow* Pointer to the requested window.
1205 */
1206 SWindow *GetWindow(int uCode) const;
1207
1208 /**
1209 * @brief Retrieves a child window by index.
1210 * @param iChild Index of the child window.
1211 * @return SWindow* Pointer to the child window.
1212 */
1213 SWindow *GetChild(int iChild) const;
1214
1215 /**
1216 * @brief Retrieves the parent window.
1217 * @return SWindow* Pointer to the parent window.
1218 */
1219 SWindow *GetParent() const;
1220
1221 /**
1222 * @brief Retrieves the root window in the hierarchy.
1223 * @return SWindow* Pointer to the root window.
1224 */
1225 SWindow *GetRoot() const;
1226
1227 /**
1228 * @brief Retrieves the next layout child after a specified child.
1229 * @param pCurChild Pointer to the current child window.
1230 * @return SWindow* Pointer to the next layout child.
1231 */
1232 SWindow *GetNextLayoutChild(const SWindow *pCurChild) const;
1233
1234 /**
1235 * @brief Adjusts the Z-order of the window.
1236 * @param pInsertAfter Pointer to the window after which this window should be inserted.
1237 * @return BOOL TRUE if successful; otherwise, FALSE.
1238 * @details If `pInsertAfter` is not a sibling of this window, the function will fail.
1239 */
1240 BOOL AdjustZOrder(SWindow *pInsertAfter);
1241
1242 /**
1243 * @brief Inserts a child window into the window tree.
1244 * @param pNewChild Pointer to the new child window.
1245 * @param pInsertAfter Pointer to the window after which the new child should be inserted.
1246 * @details The new child will not automatically enter the layout process.
1247 */
1248 void InsertChild(SWindow *pNewChild, SWindow *pInsertAfter = ICWND_LAST);
1249
1250 /**
1251 * @brief Removes a child window from the window tree.
1252 * @param pChild Pointer to the child window to remove.
1253 * @return BOOL TRUE if successful; otherwise, FALSE.
1254 * @details The removed child will not be automatically released.
1255 */
1256 BOOL RemoveChild(SWindow *pChild);
1257
1258 /**
1259 * @brief Destroys a child window.
1260 * @param pChild Pointer to the child window to destroy.
1261 * @return BOOL TRUE if successful; otherwise, FALSE.
1262 * @details Calls `RemoveChild` and then releases the child window.
1263 */
1264 BOOL DestroyChild(SWindow *pChild);
1265
1266 public:
1267 /**
1268 * @brief Sets the transformation matrix for the window.
1269 * @param mtx Reference to the transformation matrix.
1270 */
1271 void SetMatrix(const SMatrix &mtx);
1272
1273 /**
1274 * @brief Retrieves the text of the window.
1275 * @param bRawText Flag indicating whether to retrieve raw text.
1276 * @return SStringT Window text as a string.
1277 */
1278 virtual SStringT GetWindowText(BOOL bRawText = FALSE);
1279
1280 /**
1281 * @brief Retrieves the tooltip text of the window.
1282 * @return SStringT Tooltip text as a string.
1283 */
1284 virtual SStringT GetToolTipText();
1285
1286 /**
1287 * @brief Retrieves the event set associated with the window.
1288 * @return SEventSet* Pointer to the event set object.
1289 */
1291 {
1292 return &m_evtSet;
1293 }
1294
1295 /**
1296 * @brief Retrieves the style of the window.
1297 * @return SwndStyle& Reference to the style object.
1298 */
1299 const SwndStyle &GetStyle() const;
1300 SwndStyle &GetStyle();
1301
1302 /**
1303 * @brief Sets the owner of the window.
1304 * @param pOwner Pointer to the new owner window.
1305 */
1306 void SetOwner(SWindow *pOwner);
1307
1308 /**
1309 * @brief Retrieves the current owner of the window.
1310 * @return SWindow* Pointer to the owner window.
1311 */
1312 SWindow *GetOwner() const;
1313
1314 /**
1315 * @brief Retrieves the text alignment of the window.
1316 * @return UINT Text alignment flags.
1317 */
1318 UINT GetTextAlign() const;
1319
1320 /**
1321 * @brief Retrieves the bounding rectangle of the window.
1322 * @return CRect Bounding rectangle of the window.
1323 */
1324 CRect GetWindowRect() const;
1325
1326 /**
1327 * @brief Retrieves the client rectangle of the window.
1328 * @return CRect Client rectangle of the window.
1329 */
1330 virtual CRect GetClientRect() const;
1331
1332 public: // Window tree structure-related methods
1333 /**
1334 * @brief Finds a child window by its ID.
1335 * @param nID ID of the child window to find.
1336 * @param nDeep Depth of the search (-1 for unlimited depth).
1337 * @return SWindow* Pointer to the found child window.
1338 */
1339 SWindow *FindChildByID(int nID, int nDeep = -1);
1340
1341 /**
1342 * @brief Template method to cast layout parameters to a specific type.
1343 * @tparam T Type of the layout parameter.
1344 * @return T* Pointer to the casted layout parameter.
1345 */
1346 template <class T>
1348 {
1349 return sobj_cast<T>(GetLayoutParam());
1350 }
1351
1352 /**
1353 * @brief Finds a child window by its ID and casts it to a specific type.
1354 * @tparam T Type of the child window.
1355 * @param nID ID of the child window to find.
1356 * @param nDeep Depth of the search (-1 for unlimited depth).
1357 * @return T* Pointer to the found child window casted to type T.
1358 */
1359 template <class T>
1360 T *FindChildByID2(int nID, int nDeep = -1)
1361 {
1362 SWindow *pTarget = FindChildByID(nID, nDeep);
1363
1364 if (!pTarget || !pTarget->IsClass(T::GetClassName()))
1365 {
1366 SSLOGW() << "FindChildByID2 Failed, no window of class " << T::GetClassName() << " with id of " << nID << " was found within " << nDeep << " levels";
1367 return NULL;
1368 }
1369 return (T *)pTarget;
1370 }
1371
1372 /**
1373 * @brief Finds a child window by its name.
1374 * @param strName Name of the child window to find.
1375 * @param nDeep Depth of the search (-1 for unlimited depth).
1376 * @return SWindow* Pointer to the found child window.
1377 */
1378 SWindow *FindChildByName(LPCWSTR strName, int nDeep = -1);
1379
1380 /**
1381 * @brief Overloaded method to find a child window by its name (ANSI version).
1382 * @param strName Name of the child window to find.
1383 * @param nDeep Depth of the search (-1 for unlimited depth).
1384 * @return SWindow* Pointer to the found child window.
1385 */
1386 SWindow *FindChildByName(LPCSTR strName, int nDeep = -1);
1387
1388 /**
1389 * @brief Finds a child window by its name and casts it to a specific type.
1390 * @tparam T Type of the child window.
1391 * @param pszName Name of the child window to find.
1392 * @param nDeep Depth of the search (-1 for unlimited depth).
1393 * @return T* Pointer to the found child window casted to type T.
1394 */
1395 template <class T>
1396 T *FindChildByName2(LPCWSTR pszName, int nDeep = -1)
1397 {
1398 SWindow *pTarget = FindChildByName(pszName, nDeep);
1399 if (!pTarget || !pTarget->IsClass(T::GetClassName()))
1400 {
1401 SSLOGW() << "FindChildByName2 Failed, no window of class " << T::GetClassName() << " with name of " << pszName << " was found within " << nDeep << " levels";
1402 return NULL;
1403 }
1404 return (T *)pTarget;
1405 }
1406
1407 /**
1408 * @brief Overloaded method to find a child window by its name and cast it to a specific type (ANSI version).
1409 * @tparam T Type of the child window.
1410 * @param pszName Name of the child window to find.
1411 * @param nDeep Depth of the search (-1 for unlimited depth).
1412 * @return T* Pointer to the found child window casted to type T.
1413 */
1414 template <class T>
1415 T *FindChildByName2(LPCSTR pszName, int nDeep = -1)
1416 {
1417 return FindChildByName2<T>(S_CA2W(pszName), nDeep);
1418 }
1419
1420 /**
1421 * @brief Recursively finds a child window by its class type.
1422 * @tparam T Type of the child window.
1423 * @param nDeep Depth of the search (-1 for unlimited depth).
1424 * @return T* Pointer to the found child window casted to type T.
1425 */
1426 template <class T>
1427 T *FindChildByClass(int nDeep = -1) const
1428 {
1429 SWindow *pChild = GetWindow(GSW_FIRSTCHILD);
1430 while (pChild)
1431 {
1432 if (pChild->IsClass(T::GetClassName()))
1433 return (T *)pChild;
1434 pChild = pChild->GetWindow(GSW_NEXTSIBLING);
1435 }
1436
1437 if (nDeep > 0)
1438 nDeep--;
1439 if (nDeep == 0)
1440 return NULL;
1441
1442 pChild = GetWindow(GSW_FIRSTCHILD);
1443 while (pChild)
1444 {
1445 SWindow *pChildFind = pChild->FindChildByClass<T>(nDeep);
1446 if (pChildFind)
1447 return (T *)pChildFind;
1448 pChild = pChild->GetWindow(GSW_NEXTSIBLING);
1449 }
1450
1451 return NULL;
1452 }
1453
1454 // Protected methods for internal use
1455 protected:
1456 /**
1457 * @brief Retrieves the script module interface.
1458 * @return IScriptModule* Pointer to the script module interface.
1459 */
1460 IScriptModule *GetScriptModule();
1461
1462 /**
1463 * @brief Invalidates a specific rectangle area of the window.
1464 * @param rect The rectangle area to invalidate.
1465 * @param bFromThis TRUE if the invalidation originates from this window; otherwise, FALSE.
1466 * @param bClip TRUE if clipping should be applied; otherwise, FALSE.
1467 */
1468 void InvalidateRect(const CRect &rect, BOOL bFromThis = TRUE, BOOL bClip = FALSE);
1469
1470 /**
1471 * @brief Retrieves the current transformation matrix of the window.
1472 * @return STransformation The current transformation matrix.
1473 */
1474 STransformation GetTransformation() const;
1475
1476 /**
1477 * @brief Creates a child window from an XML node.
1478 * @param xmlChild The XML node containing the child window definition.
1479 * @return BOOL TRUE if the child window was successfully created; otherwise, FALSE.
1480 */
1481 BOOL CreateChild(SXmlNode xmlChild);
1482
1483 /**
1484 * @brief Creates multiple child windows from XML nodes.
1485 * @param xmlNode The XML node containing definitions for multiple child windows.
1486 */
1487 void CreateChilds(SXmlNode xmlNode);
1488
1489 // Animation related callback functions
1490 protected:
1491 /**
1492 * @brief Called when an animation starts.
1493 * @param animation Pointer to the animation object.
1494 */
1495 STDMETHOD_(void, OnAnimationStart)(THIS_ IAnimation *animation);
1496
1497 /**
1498 * @brief Called when an animation stops.
1499 * @param animation Pointer to the animation object.
1500 */
1501 STDMETHOD_(void, OnAnimationStop)(THIS_ IAnimation *animation);
1502
1503 /**
1504 * @brief Called when an animation repeats.
1505 * @param animation Pointer to the animation object.
1506 */
1507 STDMETHOD_(void, OnAnimationRepeat)(THIS_ IAnimation *animation);
1508
1509 /**
1510 * @brief Called when the pause state of an animation changes.
1511 * @param animation Pointer to the animation object.
1512 * @param bPaused TRUE if the animation is paused; otherwise, FALSE.
1513 */
1514 STDMETHOD_(void, OnAnimationPauseChange)(THIS_ IAnimation *animation, BOOL bPaused);
1515
1516 // Virtual functions for override
1517 protected:
1518 /**
1519 * @brief Called when an animation requires a redraw.
1520 * @param pAni Pointer to the animation object.
1521 * @param bErase TRUE if the background should be erased; otherwise, FALSE.
1522 */
1523 virtual void OnAnimationInvalidate(IAnimation *pAni, bool bErase);
1524
1525 /**
1526 * @brief Called when the content of the window changes.
1527 */
1528 virtual void OnContentChanged();
1529
1530 /**
1531 * @brief Adjusts the color tone of the window.
1532 * @param cr The color reference used for colorization.
1533 */
1534 virtual void OnColorize(COLORREF cr);
1535
1536 /**
1537 * @brief Sets the cursor when the mouse hovers over the window.
1538 * @param pt The point where the cursor is set.
1539 * @return BOOL TRUE if the cursor was set successfully; otherwise, FALSE.
1540 */
1541 virtual BOOL OnSetCursor(const CPoint &pt);
1542
1543 /**
1544 * @brief Called before the state of the window changes.
1545 * @param dwOldState The old state flags.
1546 * @param dwNewState The new state flags.
1547 */
1548 virtual void OnStateChanging(DWORD dwOldState, DWORD dwNewState);
1549
1550 /**
1551 * @brief Called after the state of the window changes.
1552 * @param dwOldState The old state flags.
1553 * @param dwNewState The new state flags.
1554 */
1555 virtual void OnStateChanged(DWORD dwOldState, DWORD dwNewState);
1556
1557 /**
1558 * @brief Called when the capture state of the window changes.
1559 * @param bCaptured TRUE if the window has captured the mouse; otherwise, FALSE.
1560 */
1561 virtual void OnCaptureChanged(BOOL bCaptured);
1562
1563 /**
1564 * @brief Handles window position changes during layout updates.
1565 * @param rcWnd The new window rectangle.
1566 * @return BOOL TRUE if the relayout was handled successfully; otherwise, FALSE.
1567 */
1568 virtual BOOL OnRelayout(const CRect &rcWnd);
1569
1570 // Public virtual functions
1571 public:
1572 /**
1573 * @brief Measures the size of the content within the window.
1574 * @param nParentWid The width of the parent window.
1575 * @param nParentHei The height of the parent window.
1576 * @return SIZE The measured size of the content.
1577 */
1578 virtual SIZE MeasureContent(int nParentWid, int nParentHei);
1579
1580 /**
1581 * @brief Measures the size of all child windows.
1582 * @param nParentWid The width of the parent window.
1583 * @param nParentHei The height of the parent window.
1584 * @return SIZE The measured size of the children.
1585 */
1586 virtual SIZE MeasureChildren(int nParentWid, int nParentHei);
1587
1588 /**
1589 * OnUpdateToolTip
1590 * @brief Handle tooltip updates
1591 */
1592 virtual BOOL UpdateToolTip(CPoint pt, SwndToolTipInfo &tipInfo);
1593
1594 /**
1595 * GetSelectedSiblingInGroup
1596 * @brief Get selected sibling in group
1597 */
1599 {
1600 return NULL;
1601 }
1602
1603 /**
1604 * GetSelectedChildInGroup
1605 * @brief Get selected child in group
1606 */
1607 virtual SWindow *GetSelectedChildInGroup();
1608
1609 /**
1610 * CreateChildren
1611 * @param xmlNode XML node containing child windows
1612 * @brief Create child windows from XML node
1613 * @return BOOL TRUE if child windows were created successfully; otherwise, FALSE
1614 */
1615 virtual BOOL CreateChildren(SXmlNode xmlNode);
1616
1617 /**
1618 * CreateChildByName
1619 * @brief Create child window by name
1620 * @param pszName Name of the child window
1621 * @return SWindow* Pointer to the created child window; otherwise, NULL
1622 */
1623 virtual SWindow *CreateChildByName(LPCWSTR pszName);
1624
1625 /**
1626 * RequestRelayout
1627 * @brief Request layout update
1628 */
1629 virtual void RequestRelayout(SWND hSource, BOOL bSourceResizable);
1630
1631 /**
1632 * tr
1633 * @brief Translation function
1634 * @param strSrc Source string
1635 * @return SStringW Translated string
1636 */
1637 virtual SStringW tr(const SStringW &strSrc) const; // Translation function
1638
1639 /**
1640 * SwndFromPoint
1641 * @brief Get window from point
1642 * @param pt Point coordinates
1643 * @param bIncludeMsgTransparent Include message transparency
1644 * @return SWND Window handle
1645 */
1646 virtual SWND SwndFromPoint(CPoint &pt, BOOL bIncludeMsgTransparent = false) const; // Get window from point
1647
1648 /**
1649 * OnNcHitTest
1650 * @brief Non-client area hit test
1651 * @param pt Point coordinates
1652 * @return BOOL TRUE if the point is within the non-client area; otherwise, FALSE
1653 */
1654 virtual BOOL OnNcHitTest(CPoint pt); // Non-client area hit test
1655
1656 /**
1657 * OnUpdateFloatPosition
1658 * @brief Update floating window position
1659 */
1660 virtual void OnUpdateFloatPosition(const CRect &rcParent){};
1661
1662 /**
1663 * NeedRedrawWhenStateChange
1664 * @brief Determine if redraw is needed on state change
1665 */
1666 virtual BOOL NeedRedrawWhenStateChange();
1667
1668 /**
1669 * GetTextRect
1670 * @brief Calculate text display rectangle
1671 */
1672 virtual void GetTextRect(LPRECT pRect);
1673
1674 /**
1675 * DrawText
1676 * @brief Draw text content
1677 */
1678 virtual void DrawText(IRenderTarget *pRT, LPCTSTR pszBuf, int cchText, LPRECT pRect, UINT uFormat);
1679
1680 /**
1681 * DrawFocus
1682 * @brief Draw focus state
1683 */
1684 virtual void DrawFocus(IRenderTarget *pRT);
1685
1686 /**
1687 * BeforePaint
1688 * @brief Prepare rendering environment
1689 */
1690 virtual void BeforePaint(IRenderTarget *pRT, SPainter &painter);
1691
1692 /**
1693 * AfterPaint
1694 * @brief Restore rendering environment
1695 */
1696 virtual void AfterPaint(IRenderTarget *pRT, SPainter &painter);
1697
1698 /**
1699 * GetTrCtx
1700 * @brief Get translation context
1701 */
1702 virtual LPCWSTR GetTrCtx() const;
1703
1704 // Public methods related to rendering
1705 public:
1706 /**
1707 * RedrawRegion
1708 * @brief Renders the content of the window and its child windows onto the RenderTarget.
1709 * @param IRenderTarget * pRT -- Target RenderTarget.
1710 * @param IRegion * pRgn -- Region to render; NULL renders the entire window.
1711 * @return void
1712 *
1713 * Describe This method redraws the specified region or the entire window if no region is provided.
1714 */
1715 void RedrawRegion(IRenderTarget *pRT, IRegionS *pRgn);
1716
1717 /**
1718 * GetRenderTarget
1719 * @brief Retrieves a memory DC compatible with the SWND window.
1720 * @param LPCRECT pRc -- Target rectangle for the RenderTarget.
1721 * @param DWORD gdcFlags -- Flags similar to OLEDCFLAGS.
1722 * @param BOOL bClientRT -- Indicates whether the client area should be used.
1723 * @return IRenderTarget *
1724 *
1725 * Describe The returned RenderTarget must be released using ReleaseRenderTarget.
1726 */
1727 IRenderTarget *GetRenderTarget(LPCRECT pRc = NULL, GrtFlag gdcFlags = GRT_NODRAW, BOOL bClientRT = TRUE);
1728
1729 /**
1730 * GetRenderTarget
1731 * @brief Retrieves a memory DC compatible with the SWND window.
1732 * @param DWORD gdcFlags -- Flags similar to OLEDCFLAGS.
1733 * @param IRegion *pRgn -- Target region for the RenderTarget.
1734 * @return IRenderTarget *
1735 *
1736 * Describe The returned RenderTarget must be released using ReleaseRenderTarget.
1737 */
1738 IRenderTarget *GetRenderTarget(GrtFlag gdcFlags, IRegionS *pRgn);
1739
1740 /**
1741 * ReleaseRenderTarget
1742 * @brief Releases the RenderTarget obtained via GetRenderTarget.
1743 * @param IRenderTarget * pRT -- RenderTarget to release.
1744 * @return void
1745 *
1746 * Describe This method ensures proper cleanup of the RenderTarget resources.
1747 */
1748 void ReleaseRenderTarget(IRenderTarget *pRT);
1749
1750 /**
1751 * PaintBackground
1752 * @brief Draws the background content of the window.
1753 * @param IRenderTarget * pRT -- Target RenderTarget.
1754 * @param LPRECT pRc -- Target rectangle within the window.
1755 * @return void
1756 *
1757 * Describe The target rectangle must lie within the window's bounds.
1758 */
1759 void PaintBackground(IRenderTarget *pRT, LPRECT pRc);
1760
1761 /**
1762 * PaintForeground
1763 * @brief Draws the foreground content of the window.
1764 * @param IRenderTarget * pRT -- Target RenderTarget.
1765 * @param LPRECT pRc -- Target rectangle within the window.
1766 * @param SWindow *pStartFrom -- Starting window for drawing; defaults to root.
1767 * @return void
1768 *
1769 * Describe The target rectangle must lie within the window's bounds, excluding child windows.
1770 */
1771 void PaintForeground(IRenderTarget *pRT, LPRECT pRc, SWindow *pStartFrom = NULL);
1772
1773 /**
1774 * BeforePaintEx
1775 * @brief Prepares the drawing environment for the current window's RenderTarget, starting from the top-level window.
1776 * @param IRenderTarget * pRT -- Target RenderTarget.
1777 * @return void
1778 *
1779 * Describe Typically used in conjunction with CreateRenderTarget.
1780 */
1781 void BeforePaintEx(IRenderTarget *pRT);
1782
1783 /**
1784 * TransformPoint
1785 * @brief Transforms a point based on the current window's transformation matrix.
1786 * @param CPoint &pt -- Point to transform.
1787 * @return void
1788 *
1789 * Describe Applies the transformation matrix to the point.
1790 */
1791 void TransformPoint(CPoint &pt) const;
1792
1793 /**
1794 * TransformPointEx
1795 * @brief Extends the transformation of a point.
1796 * @param CPoint &pt -- Point to transform.
1797 * @return void
1798 *
1799 * Describe Provides additional transformations beyond the basic TransformPoint.
1800 */
1801 void TransformPointEx(CPoint &pt) const;
1802
1803 /**
1804 * FireEvent
1805 * @brief Fires an event.
1806 * @param SEvtArgs &evt -- Event arguments.
1807 * @return BOOL -- Result of firing the event.
1808 *
1809 * Describe Simplifies the process of firing events by wrapping the pointer-based method.
1810 */
1811 BOOL FireEvent(SEvtArgs &evt)
1812 {
1813 return FireEvent(&evt);
1814 }
1815
1816 // Protected methods related to caching
1817 protected:
1818 /**
1819 * IsCacheDirty
1820 * @brief Checks if the cache is marked as dirty.
1821 * @return bool -- True if the cache is dirty.
1822 *
1823 * Describe Determines whether the cache needs to be refreshed.
1824 */
1825 bool IsCacheDirty() const;
1826
1827 /**
1828 * MarkCacheDirty
1829 * @brief Marks the cache as dirty.
1830 * @param bool bDirty -- Dirty state to set.
1831 * @return void
1832 *
1833 * Describe Sets the cache's dirty flag to indicate it needs updating.
1834 */
1835 void MarkCacheDirty(bool bDirty);
1836
1837 /**
1838 * IsDrawToCache
1839 * @brief Checks if the window content is being drawn to the cache.
1840 * @return bool -- True if drawing to cache.
1841 *
1842 * Describe Indicates whether the current rendering operation targets the cache.
1843 */
1844 virtual bool IsDrawToCache() const;
1845
1846 /**
1847 * IsLayeredWindow
1848 * @brief Determines if the window requires a render layer.
1849 * @return BOOL -- TRUE if a render layer is needed.
1850 *
1851 * Describe Indicates whether the window uses layered rendering.
1852 */
1853 virtual BOOL IsLayeredWindow() const;
1854
1855 /**
1856 * DispatchPaint
1857 * @brief Handles paint dispatching for the window.
1858 * @param IRenderTarget * pRT -- Target RenderTarget.
1859 * @param IRegion *pRgn -- Paint region.
1860 * @param UINT iBeginZorder -- Beginning Z-order.
1861 * @param UINT iEndZorder -- Ending Z-order.
1862 * @return void
1863 *
1864 * Describe Manages the painting process for the specified Z-order range.
1865 */
1866 virtual void DispatchPaint(IRenderTarget *pRT, IRegionS *pRgn, UINT iZorderBegin, UINT iZorderEnd);
1867
1868 /**
1869 * OnCommitSurface
1870 * @brief Commits surface changes.
1871 * @param IRenderTarget * pRtDest -- Destination RenderTarget.
1872 * @param LPCRECT pRcDest -- Destination rectangle.
1873 * @param IRenderTarget *pRtSrc -- Source RenderTarget.
1874 * @param LPCRECT pRcSrc -- Source rectangle.
1875 * @param BYTE alpha -- Alpha value for blending.
1876 * @return void
1877 *
1878 * Describe Applies surface changes with optional alpha blending.
1879 */
1880 virtual void OnCommitSurface(IRenderTarget *pRtDest, LPCRECT pRcDest, IRenderTarget *pRtSrc, LPCRECT pRcSrc, BYTE alpha);
1881
1882 // Protected helper functions
1883 protected:
1884 /**
1885 * _FindChildByID
1886 * @brief Finds a child window by ID.
1887 * @param int nID -- Child window ID.
1888 * @param int nDeep -- Search depth; -1 for unlimited.
1889 * @return SWindow * -- Found child window.
1890 *
1891 * Describe Searches for a child window by its unique identifier.
1892 */
1893 virtual SWindow *_FindChildByID(int nID, int nDeep);
1894
1895 /**
1896 * _FindChildByName
1897 * @brief Finds a child window by name.
1898 * @param const SStringW &strName -- Child window name.
1899 * @param int nDeep -- Search depth; -1 for unlimited.
1900 * @return SWindow * -- Found child window.
1901 *
1902 * Describe Searches for a child window by its name attribute.
1903 */
1904 virtual SWindow *_FindChildByName(const SStringW &strName, int nDeep);
1905
1906 /**
1907 * _GetCurrentRenderContainer
1908 * @brief Retrieves the host window for the current render layer.
1909 * @return SWindow * -- Host window for the render layer.
1910 *
1911 * Describe Identifies the container responsible for rendering the current window.
1912 */
1913 SWindow *_GetCurrentLayeredWindow();
1914
1915 /**
1916 * _ApplyMatrix
1917 * @brief Applies a transformation matrix to the RenderTarget.
1918 * @param IRenderTarget * pRT -- Target RenderTarget.
1919 * @param SMatrix &oriMtx -- Original transformation matrix.
1920 * @return bool -- True if the matrix was applied successfully.
1921 *
1922 * Describe Modifies the RenderTarget's transformation to account for the window's matrix.
1923 */
1924 bool _ApplyMatrix(IRenderTarget *pRT, SMatrix &oriMtx);
1925
1926 /**
1927 * _GetMatrixEx
1928 * @brief Retrieves the extended transformation matrix for the window.
1929 * @return SMatrix -- Extended transformation matrix.
1930 *
1931 * Describe Provides the complete transformation matrix for the window.
1932 */
1933 SMatrix _GetMatrixEx() const;
1934
1935 /**
1936 * _WndRectInRgn
1937 * @brief Checks if the window rectangle lies within a specified region.
1938 * @param const CRect &rc -- Window rectangle.
1939 * @param const IRegionS *rgn -- Target region.
1940 * @return bool -- True if the rectangle is within the region.
1941 *
1942 * Describe Verifies whether the window's rectangle intersects with the given region.
1943 */
1944 bool _WndRectInRgn(const CRect &rc, const IRegionS *rgn) const;
1945
1946 // Protected helper functions
1947 protected:
1948 /**
1949 * @brief Renders the client area of the window onto the RenderTarget.
1950 * @param pRT Pointer to the RenderTarget.
1951 */
1952 void _PaintClient(IRenderTarget *pRT);
1953
1954 /**
1955 * @brief Renders the non-client area of the window onto the RenderTarget.
1956 * @param pRT Pointer to the RenderTarget.
1957 */
1958 void _PaintNonClient(IRenderTarget *pRT);
1959
1960 /**
1961 * @brief Redraws the non-client area of the window.
1962 */
1963 void _RedrawNonClient();
1964
1965 /**
1966 * @brief Renders a specific region of the window onto the RenderTarget.
1967 * @param pRT Pointer to the RenderTarget.
1968 * @param pRgn Pointer to the region to render.
1969 * @param iZorderBegin Beginning Z-order for rendering.
1970 * @param iZorderEnd Ending Z-order for rendering.
1971 */
1972 void _PaintRegion(IRenderTarget *pRT, IRegionS *pRgn, UINT iZorderBegin, UINT iZorderEnd);
1973
1974 /**
1975 * @brief Renders child windows within a specific Z-order range.
1976 * @param pRT Pointer to the RenderTarget.
1977 * @param pRgn Pointer to the region to render.
1978 * @param iBeginZorder Beginning Z-order for rendering.
1979 * @param iEndZorder Ending Z-order for rendering.
1980 */
1981 void _PaintChildren(IRenderTarget *pRT, IRegionS *pRgn, UINT iBeginZorder, UINT iEndZorder);
1982
1983 /**
1984 * @brief Draws the default focus rectangle.
1985 * @param pRT Pointer to the RenderTarget.
1986 * @param rc Rectangle defining the focus area.
1987 */
1988 void DrawDefFocusRect(IRenderTarget *pRT, CRect rc);
1989
1990 /**
1991 * @brief Updates the cache mode for the window.
1992 */
1993 void UpdateCacheMode();
1994
1995 /**
1996 * @brief Tests if the current thread is the main UI thread.
1997 */
1998 void TestMainThread();
1999
2000 /**
2001 * @brief Retrieves a scaled skin object based on the current scale factor.
2002 * @param pSkin Reference to the SAutoRefPtr<ISkinObj> to store the scaled skin object.
2003 * @param nScale The scale factor.
2004 */
2005 void GetScaleSkin(SAutoRefPtr<ISkinObj> &pSkin, int nScale);
2006 // Protected methods for handling messages
2007 protected:
2008 /**
2009 * OnCreate
2010 * @brief Handles the creation of the window.
2011 * @param LPVOID -- Pointer to creation data.
2012 * @return int -- Result of the creation process.
2013 *
2014 * Describe This method is called when the window is created.
2015 */
2016 int OnCreate(LPVOID);
2017
2018 /**
2019 * OnSize
2020 * @brief Handles the resizing of the window.
2021 * @param UINT nType -- Resize type.
2022 * @param CSize size -- New size of the window.
2023 * @return void
2024 *
2025 * Describe This method is called when the window is resized.
2026 */
2027 void OnSize(UINT nType, CSize size);
2028
2029 /**
2030 * OnDestroy
2031 * @brief Handles the destruction of the window.
2032 * @return void
2033 *
2034 * Describe This method is called when the window is destroyed.
2035 */
2036 void OnDestroy();
2037
2038 /**
2039 * OnEraseBkgnd
2040 * @brief Handles the erasing of the background.
2041 * @param IRenderTarget *pRT -- RenderTarget for drawing.
2042 * @return BOOL -- TRUE if the background was erased.
2043 *
2044 * Describe This method is called to erase the background before painting.
2045 */
2046 BOOL OnEraseBkgnd(IRenderTarget *pRT);
2047
2048 /**
2049 * OnPaint
2050 * @brief Handles the painting of the window.
2051 * @param IRenderTarget *pRT -- RenderTarget for drawing.
2052 * @return void
2053 *
2054 * Describe This method is called to paint the window content.
2055 */
2056 void OnPaint(IRenderTarget *pRT);
2057
2058 /**
2059 * OnNcPaint
2060 * @brief Handles the painting of the non-client area.
2061 * @param IRenderTarget *pRT -- RenderTarget for drawing.
2062 * @return void
2063 *
2064 * Describe This method is called to paint the non-client area of the window.
2065 */
2066 void OnNcPaint(IRenderTarget *pRT);
2067
2068 /**
2069 * OnShowWindow
2070 * @brief Handles showing or hiding the window.
2071 * @param BOOL bShow -- TRUE to show, FALSE to hide.
2072 * @param UINT nStatus -- Show status flags.
2073 * @return void
2074 *
2075 * Describe This method is called when the window is shown or hidden.
2076 */
2077 void OnShowWindow(BOOL bShow, UINT nStatus);
2078
2079 /**
2080 * OnEnable
2081 * @brief Handles enabling or disabling the window.
2082 * @param BOOL bEnable -- TRUE to enable, FALSE to disable.
2083 * @param UINT nStatus -- Enable status flags.
2084 * @return void
2085 *
2086 * Describe This method is called when the window is enabled or disabled.
2087 */
2088 void OnEnable(BOOL bEnable, UINT nStatus);
2089
2090 /**
2091 * OnLButtonDown
2092 * @brief Handles the left mouse button down event.
2093 * @param UINT nFlags -- Mouse flags.
2094 * @param CPoint pt -- Mouse position.
2095 * @return void
2096 *
2097 * Describe This method is called when the left mouse button is pressed.
2098 */
2099 void OnLButtonDown(UINT nFlags, CPoint pt);
2100
2101 /**
2102 * OnLButtonDbClick
2103 * @brief Handles the left mouse button double-click event.
2104 * @param UINT nFlags -- Mouse flags.
2105 * @param CPoint point -- Mouse position.
2106 * @return void
2107 *
2108 * Describe This method is called when the left mouse button is double-clicked.
2109 */
2110 void OnLButtonDbClick(UINT nFlags, CPoint point);
2111
2112 /**
2113 * OnLButtonUp
2114 * @brief Handles the left mouse button up event.
2115 * @param UINT nFlags -- Mouse flags.
2116 * @param CPoint pt -- Mouse position.
2117 * @return void
2118 *
2119 * Describe This method is called when the left mouse button is released.
2120 */
2121 void OnLButtonUp(UINT nFlags, CPoint pt);
2122
2123 /**
2124 * OnRButtonDown
2125 * @brief Handles the right mouse button down event.
2126 * @param UINT nFlags -- Mouse flags.
2127 * @param CPoint point -- Mouse position.
2128 * @return void
2129 *
2130 * Describe This method is called when the right mouse button is pressed.
2131 */
2132 void OnRButtonDown(UINT nFlags, CPoint point);
2133
2134 /**
2135 * OnRButtonUp
2136 * @brief Handles the right mouse button up event.
2137 * @param UINT nFlags -- Mouse flags.
2138 * @param CPoint point -- Mouse position.
2139 * @return void
2140 *
2141 * Describe This method is called when the right mouse button is released.
2142 */
2143 void OnRButtonUp(UINT nFlags, CPoint point);
2144
2145 /**
2146 * OnMouseHover
2147 * @brief Handles the mouse hover event.
2148 * @param UINT nFlags -- Mouse flags.
2149 * @param CPoint ptPos -- Mouse position.
2150 * @return void
2151 *
2152 * Describe This method is called when the mouse hovers over the window.
2153 */
2154 void OnMouseHover(UINT nFlags, CPoint ptPos);
2155
2156 /**
2157 * OnMouseMove
2158 * @brief Handles the mouse move event.
2159 * @param UINT nFlags -- Mouse flags.
2160 * @param CPoint pt -- Mouse position.
2161 * @return void
2162 *
2163 * Describe This method is called when the mouse moves over the window.
2164 */
2165 void OnMouseMove(UINT nFlags, CPoint pt);
2166
2167 /**
2168 * OnMouseLeave
2169 * @brief Handles the mouse leave event.
2170 * @return void
2171 *
2172 * Describe This method is called when the mouse leaves the window.
2173 */
2174 void OnMouseLeave();
2175
2176 /**
2177 * OnMouseWheel
2178 * @brief Handles the mouse wheel event.
2179 * @param UINT nFlags -- Mouse flags.
2180 * @param short zDelta -- Wheel delta.
2181 * @param CPoint pt -- Mouse position.
2182 * @return BOOL -- TRUE if the event was handled.
2183 *
2184 * Describe This method is called when the mouse wheel is moved.
2185 */
2186 BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
2187
2188 /**
2189 * OnMouseClick
2190 * @brief Handles general mouse click events.
2191 * @param UINT uMsg -- Message identifier.
2192 * @param WPARAM wParam -- Additional message parameter.
2193 * @param LPARAM lParam -- Additional message parameter.
2194 * @return LRESULT -- Result of the message processing.
2195 *
2196 * Describe This method handles a range of mouse click messages.
2197 */
2198 LRESULT OnMouseClick(UINT uMsg, WPARAM wParam, LPARAM lParam);
2199
2200 /**
2201 * OnSetFocus
2202 * @brief Handles gaining focus.
2203 * @param SWND wndOld -- Handle of the previous focused window.
2204 * @return void
2205 *
2206 * Describe This method is called when the window gains focus.
2207 */
2208 void OnSetFocus(SWND wndOld);
2209
2210 /**
2211 * OnKillFocus
2212 * @brief Handles losing focus.
2213 * @param SWND wndFocus -- Handle of the new focused window.
2214 * @return void
2215 *
2216 * Describe This method is called when the window loses focus.
2217 */
2218 void OnKillFocus(SWND wndFocus);
2219
2220 /**
2221 * OnSetScale
2222 * @brief Handles setting the scale of the window.
2223 * @param UINT uMsg -- Message identifier.
2224 * @param WPARAM wParam -- Scale factor.
2225 * @param LPARAM lParam -- Reserved.
2226 * @return LRESULT -- Result of the message processing.
2227 *
2228 * Describe This method adjusts the window's scale.
2229 */
2230 LRESULT OnSetScale(UINT uMsg, WPARAM wParam, LPARAM lParam);
2231
2232 /**
2233 * OnSetLanguage
2234 * @brief Handles setting the language of the window.
2235 * @param UINT uMsg -- Message identifier.
2236 * @param WPARAM wParam -- Language identifier.
2237 * @param LPARAM lParam -- Reserved.
2238 * @return LRESULT -- Result of the message processing.
2239 *
2240 * Describe This method changes the language of the window.
2241 */
2242 LRESULT OnSetLanguage(UINT uMsg, WPARAM wParam, LPARAM lParam);
2243
2244 /**
2245 * OnSetColorize
2246 * @brief Handles setting the colorization of the window.
2247 * @param UINT uMsg -- Message identifier.
2248 * @param WPARAM wParam -- Colorization value.
2249 * @param LPARAM lParam -- Reserved.
2250 * @return LRESULT -- Result of the message processing.
2251 *
2252 * Describe This method applies colorization to the window.
2253 */
2254 LRESULT OnSetColorize(UINT uMsg, WPARAM wParam, LPARAM lParam);
2255
2256 /**
2257 * OnUpdateFont
2258 * @brief Handles updating the font of the window.
2259 * @param UINT uMsg -- Message identifier.
2260 * @param WPARAM wParam -- Font update parameter.
2261 * @param LPARAM lParam -- Reserved.
2262 * @return LRESULT -- Result of the message processing.
2263 *
2264 * Describe This method updates the font used by the window.
2265 */
2266 LRESULT OnUpdateFont(UINT uMsg, WPARAM wParam, LPARAM lParam);
2267
2268 // Message map for associating messages with handlers
2269 SOUI_MSG_MAP_BEGIN()
2270 MSG_WM_PAINT_EX(OnPaint)
2271 MSG_WM_ERASEBKGND_EX(OnEraseBkgnd)
2272 MSG_WM_NCPAINT_EX(OnNcPaint)
2273 MSG_WM_CREATE(OnCreate)
2274 MSG_WM_SIZE(OnSize)
2275 MSG_WM_DESTROY(OnDestroy)
2276 MSG_WM_SHOWWINDOW(OnShowWindow)
2277 MSG_WM_ENABLE_EX(OnEnable)
2278 MESSAGE_RANGE_HANDLER_EX(WM_LBUTTONDOWN, WM_MBUTTONDBLCLK, OnMouseClick)
2279 MSG_WM_LBUTTONDOWN(OnLButtonDown)
2280 MSG_WM_LBUTTONUP(OnLButtonUp)
2281 MSG_WM_LBUTTONDBLCLK(OnLButtonDbClick)
2282 MSG_WM_RBUTTONDOWN(OnRButtonDown)
2283 MSG_WM_RBUTTONUP(OnRButtonUp)
2284 MSG_WM_MOUSEMOVE(OnMouseMove)
2285 MSG_WM_MOUSEHOVER(OnMouseHover)
2286 MSG_WM_MOUSELEAVE(OnMouseLeave)
2287 MSG_WM_MOUSEWHEEL(OnMouseWheel)
2288 MSG_WM_SETFOCUS_EX(OnSetFocus)
2289 MSG_WM_KILLFOCUS_EX(OnKillFocus)
2290 MESSAGE_HANDLER_EX(UM_SETLANGUAGE, OnSetLanguage)
2291 MESSAGE_HANDLER_EX(UM_SETSCALE, OnSetScale)
2292 MESSAGE_HANDLER_EX(UM_SETCOLORIZE, OnSetColorize)
2293 MESSAGE_HANDLER_EX(UM_UPDATEFONT, OnUpdateFont)
2294 SOUI_MSG_MAP_END_BASE() // Messages are not passed to the base class.
2295
2296 // Protected attribute handling functions
2297 protected:
2298 /**
2299 * OnAttrVisible
2300 * @brief Handles the 'visible' attribute.
2301 * @param const SStringW &strValue -- Attribute value.
2302 * @param BOOL bLoading -- TRUE during loading, FALSE otherwise.
2303 * @return HRESULT -- Result of attribute processing.
2304 *
2305 * Describe This method processes the 'visible' attribute.
2306 */
2307 HRESULT OnAttrVisible(const SStringW &strValue, BOOL bLoading);
2308
2309 /**
2310 * OnAttrEnable
2311 * @brief Handles the 'enable' attribute.
2312 * @param const SStringW &strValue -- Attribute value.
2313 * @param BOOL bLoading -- TRUE during loading, FALSE otherwise.
2314 * @return HRESULT -- Result of attribute processing.
2315 *
2316 * Describe This method processes the 'enable' attribute.
2317 */
2318 HRESULT OnAttrEnable(const SStringW &strValue, BOOL bLoading);
2319
2320 /**
2321 * OnAttrDisplay
2322 * @brief Handles the 'display' attribute.
2323 * @param const SStringW &strValue -- Attribute value.
2324 * @param BOOL bLoading -- TRUE during loading, FALSE otherwise.
2325 * @return HRESULT -- Result of attribute processing.
2326 *
2327 * Describe This method processes the 'display' attribute.
2328 */
2329 HRESULT OnAttrDisplay(const SStringW &strValue, BOOL bLoading);
2330
2331 /**
2332 * OnAttrCache
2333 * @brief Handles the 'cache' attribute.
2334 * @param const SStringW &strValue -- Attribute value.
2335 * @param BOOL bLoading -- TRUE during loading, FALSE otherwise.
2336 * @return HRESULT -- Result of attribute processing.
2337 *
2338 * Describe This method processes the 'cache' attribute.
2339 */
2340 HRESULT OnAttrCache(const SStringW &strValue, BOOL bLoading);
2341
2342 /**
2343 * OnAttrAlpha
2344 * @brief Handles the 'alpha' attribute.
2345 * @param const SStringW &strValue -- Attribute value.
2346 * @param BOOL bLoading -- TRUE during loading, FALSE otherwise.
2347 * @return HRESULT -- Result of attribute processing.
2348 *
2349 * Describe This method processes the 'alpha' attribute.
2350 */
2351 HRESULT OnAttrAlpha(const SStringW &strValue, BOOL bLoading);
2352
2353 /**
2354 * OnAttrSkin
2355 * @brief Handles the 'skin' attribute.
2356 * @param const SStringW &strValue -- Attribute value.
2357 * @param BOOL bLoading -- TRUE during loading, FALSE otherwise.
2358 * @return HRESULT -- Result of attribute processing.
2359 *
2360 * Describe This method processes the 'skin' attribute.
2361 */
2362 HRESULT OnAttrSkin(const SStringW &strValue, BOOL bLoading);
2363
2364 /**
2365 * OnAttrLayout
2366 * @brief Handles the 'layout' attribute.
2367 * @param const SStringW &strValue -- Attribute value.
2368 * @param BOOL bLoading -- TRUE during loading, FALSE otherwise.
2369 * @return HRESULT -- Result of attribute processing.
2370 *
2371 * Describe This method processes the 'layout' attribute.
2372 */
2373 HRESULT OnAttrLayout(const SStringW &strValue, BOOL bLoading);
2374
2375 /**
2376 * OnAttrClass
2377 * @brief Handles the 'class' attribute.
2378 * @param const SStringW &strValue -- Attribute value.
2379 * @param BOOL bLoading -- TRUE during loading, FALSE otherwise.
2380 * @return HRESULT -- Result of attribute processing.
2381 *
2382 * Describe This method processes the 'class' attribute.
2383 */
2384 HRESULT OnAttrClass(const SStringW &strValue, BOOL bLoading);
2385
2386 /**
2387 * OnAttrTrackMouseEvent
2388 * @brief Handles the 'trackMouseEvent' attribute.
2389 * @param const SStringW &strValue -- Attribute value.
2390 * @param BOOL bLoading -- TRUE during loading, FALSE otherwise.
2391 * @return HRESULT -- Result of attribute processing.
2392 *
2393 * Describe This method processes the 'trackMouseEvent' attribute.
2394 */
2395 HRESULT OnAttrTrackMouseEvent(const SStringW &strValue, BOOL bLoading);
2396
2397 /**
2398 * OnAttrVideoCanvas
2399 * @brief Handles the 'videoCanvas' attribute.
2400 * @param const SStringW &strValue -- Attribute value.
2401 * @param BOOL bLoading -- TRUE during loading, FALSE otherwise.
2402 * @return HRESULT -- Result of attribute processing.
2403 *
2404 * Describe This method processes the 'videoCanvas' attribute.
2405 */
2406 HRESULT OnAttrVideoCanvas(const SStringW &strValue, BOOL bLoading);
2407
2408 /**
2409 * OnAttrID
2410 * @brief Handles the 'id' attribute.
2411 * @param const SStringW &strValue -- Attribute value.
2412 * @param BOOL bLoading -- TRUE during loading, FALSE otherwise.
2413 * @return HRESULT -- Result of attribute processing.
2414 *
2415 * Describe This method processes the 'id' attribute.
2416 */
2417 HRESULT OnAttrID(const SStringW &strValue, BOOL bLoading);
2418
2419 /**
2420 * OnAttrName
2421 * @brief Handles the 'name' attribute.
2422 * @param const SStringW &strValue -- Attribute value.
2423 * @param BOOL bLoading -- TRUE during loading, FALSE otherwise.
2424 * @return HRESULT -- Result of attribute processing.
2425 *
2426 * Describe This method processes the 'name' attribute.
2427 */
2428 HRESULT OnAttrName(const SStringW &strValue, BOOL bLoading);
2429
2430 /**
2431 * OnAttrTip
2432 * @brief Handles the 'tip' attribute.
2433 * @param const SStringW &strValue -- Attribute value.
2434 * @param BOOL bLoading -- TRUE during loading, FALSE otherwise.
2435 * @return HRESULT -- Result of attribute processing.
2436 *
2437 * Describe This method processes the 'tip' attribute.
2438 */
2439 HRESULT OnAttrTip(const SStringW &strValue, BOOL bLoading);
2440
2441 /**
2442 * OnAttrText
2443 * @brief Handles the 'text' attribute.
2444 * @param const SStringW &strValue -- Attribute value.
2445 * @param BOOL bLoading -- TRUE during loading, FALSE otherwise.
2446 * @return HRESULT -- Result of attribute processing.
2447 *
2448 * Describe This method processes the 'text' attribute.
2449 */
2450 HRESULT OnAttrText(const SStringW &strValue, BOOL bLoading);
2451
2452 /**
2453 * DefAttributeProc
2454 * @brief Default attribute processing function.
2455 * @param const SStringW &strAttribName -- Attribute name.
2456 * @param const SStringW &strValue -- Attribute value.
2457 * @param BOOL bLoading -- TRUE during loading, FALSE otherwise.
2458 * @return HRESULT -- Result of attribute processing.
2459 *
2460 * Describe This method processes attributes not explicitly handled.
2461 */
2462 HRESULT DefAttributeProc(const SStringW &strAttribName, const SStringW &strValue, BOOL bLoading);
2463
2464 /**
2465 * AfterAttribute
2466 * @brief Called after an attribute is processed.
2467 * @param const SStringW &strAttribName -- Attribute name.
2468 * @param const SStringW &strValue -- Attribute value.
2469 * @param BOOL bLoading -- TRUE during loading, FALSE otherwise.
2470 * @param HRESULT hr -- Result of attribute processing.
2471 * @return HRESULT -- Result of post-processing.
2472 *
2473 * Describe This method performs additional processing after an attribute is set.
2474 */
2475 virtual HRESULT AfterAttribute(const SStringW &strAttribName, const SStringW &strValue, BOOL bLoading, HRESULT hr);
2476 SOUI_ATTRS_BEGIN()
2477 ATTR_CUSTOM(L"layout", OnAttrLayout)
2478 ATTR_CUSTOM(L"class", OnAttrClass)
2479 ATTR_CUSTOM(L"id", OnAttrID)
2480 ATTR_CUSTOM(L"name", OnAttrName)
2481 ATTR_CUSTOM(L"skin", OnAttrSkin)
2482 ATTR_SKIN(L"ncskin", m_pNcSkin, TRUE)
2483 ATTR_INT(L"data", m_uData, 0)
2484 ATTR_CUSTOM(L"text", OnAttrText)
2485 ATTR_STRINGW(L"trCtx", m_strTrCtx, FALSE)
2486 ATTR_CUSTOM(L"enable", OnAttrEnable)
2487 ATTR_CUSTOM(L"visible", OnAttrVisible)
2488 ATTR_CUSTOM(L"show", OnAttrVisible)
2489 ATTR_CUSTOM(L"display", OnAttrDisplay)
2490 ATTR_CUSTOM(L"cache", OnAttrCache)
2491 ATTR_CUSTOM(L"alpha", OnAttrAlpha)
2492 ATTR_BOOL(L"layeredWindow", m_bLayeredWindow, TRUE)
2493 ATTR_CUSTOM(L"trackMouseEvent", OnAttrTrackMouseEvent)
2494 ATTR_CUSTOM(L"videoCanvas", OnAttrVideoCanvas)
2495 ATTR_CUSTOM(L"tip", OnAttrTip)
2496 ATTR_BOOL(L"msgTransparent", m_bMsgTransparent, FALSE)
2497 ATTR_LAYOUTSIZE(L"maxWidth", m_nMaxWidth, FALSE)
2498 ATTR_BOOL(L"clipClient", m_bClipClient, FALSE)
2499 ATTR_BOOL(L"focusable", m_bFocusable, FALSE)
2500 ATTR_BOOL(L"drawFocusRect", m_bDrawFocusRect, TRUE)
2501 ATTR_BOOL(L"hoverAware", m_bHoverAware, FALSE)
2502 ATTR_BOOL(L"float", m_bFloat, FALSE)
2503 ATTR_CHAIN(m_style, HRET_FLAG_STYLE)
2504 ATTR_CHAIN_PTR(m_pLayout, HRET_FLAG_LAYOUT)
2505 ATTR_CHAIN_PTR(m_pLayoutParam, HRET_FLAG_LAYOUT_PARAM)
2506 SOUI_ATTRS_END()
2507 // Protected virtual methods for handling specific events and operations in SWindow class.
2508 protected:
2509 /**
2510 * @brief Called when the language of the window changes.
2511 * @return HRESULT Result of the operation.
2512 */
2513 virtual HRESULT OnLanguageChanged();
2514
2515 /**
2516 * @brief Called when the scale of the window changes.
2517 * @param scale The new scale value.
2518 */
2519 virtual void OnScaleChanged(int scale);
2520
2521 /**
2522 * @brief Called when the font of the window needs to be rebuilt.
2523 */
2524 virtual void OnRebuildFont();
2525
2526 /**
2527 * @brief Called before a child window is inserted into this window.
2528 * @param pChild Pointer to the child window being inserted.
2529 */
2530 virtual void OnBeforeInsertChild(SWindow *pChild);
2531
2532 /**
2533 * @brief Called after a child window has been inserted into this window.
2534 * @param pChild Pointer to the child window that was inserted.
2535 */
2536 virtual void OnAfterInsertChild(SWindow *pChild);
2537
2538 /**
2539 * @brief Called before a child window is removed from this window.
2540 * @param pChild Pointer to the child window being removed.
2541 */
2542 virtual void OnBeforeRemoveChild(SWindow *pChild);
2543
2544 /**
2545 * @brief Called after a child window has been removed from this window.
2546 * @param pChild Pointer to the child window that was removed.
2547 */
2548 virtual void OnAfterRemoveChild(SWindow *pChild);
2549
2550 /**
2551 * @brief Called when the container of the window changes.
2552 * @param pOldContainer Pointer to the old container.
2553 * @param pNewContainer Pointer to the new container.
2554 */
2555 virtual void OnContainerChanged(ISwndContainer *pOldContainer, ISwndContainer *pNewContainer);
2556
2557 // Private member variable representing the window's position in its container.
2558 private:
2559 CRect m_rcWindow; /**<
2560 The position of the window within its container. Adjusted to private to prevent direct access by derived classes.
2561 */
2562
2563 protected:
2564 /**
2565 * @brief Enumerates the types of layout dirty states.
2566 */
2568 {
2569 dirty_clean = 0, // Clean state (no layout issues).
2570 dirty_self = 1, // Self-dirty state (this window needs re-layout).
2571 dirty_child = 2, // Child-dirty state (a child window needs re-layout).
2572 };
2573
2574 /**
2575 * @brief Member variables representing various properties of the window.
2576 */
2577 SWND m_swnd; /**< Window handle. */
2578 BOOL m_bFloat; /**< Indicates if the window position is fixed. */
2579
2580 ISwndContainer *m_pContainer; /**< Pointer to the container object. */
2581 SEventSet m_evtSet; /**< Event set for the window. */
2582
2583 SAutoRefPtr<ILayout> m_pLayout; /**< Pointer to the layout object. */
2584 SAutoRefPtr<ILayoutParam> m_pLayoutParam; /**< Pointer to the layout parameter object. */
2585
2586 SWindow *m_pOwner; /**< Pointer to the owner window. */
2587 SWindow *m_pParent; /**< Pointer to the parent window. */
2588 SWindow *m_pFirstChild; /**< Pointer to the first child window. */
2589 SWindow *m_pLastChild; /**< Pointer to the last child window. */
2590 SWindow *m_pNextSibling; /**< Pointer to the next sibling window. */
2591 SWindow *m_pPrevSibling; /**< Pointer to the previous sibling window. */
2592 UINT m_nChildrenCount; /**< Number of child windows. */
2593
2594 SWNDMSG *m_pCurMsg; /**< Pointer to the current message being processed. */
2595
2596 SwndStyle m_style; /**< Window style, a collection of window attributes. */
2597 STrText m_strText; /**< Window text. */
2598 STrText m_strToolTipText; /**< Tooltip text for the window. */
2599 SStringW m_strTrCtx; /**< Translation context. If empty, uses the container's translation context. */
2600 UINT m_uZorder; /**< Z-order of the window. */
2601 int m_nUpdateLockCnt; /**< Update lock count. Prevents Invalidate messages to the host when locked. */
2602
2603 BOOL m_dwState; /**< State of the window during rendering. */
2604 BOOL m_bVisible; /**< Visibility state of the window. */
2605 BOOL m_bDisable; /**< Disabled state of the window. */
2606 BOOL m_bDisplay; /**< Indicates if the window occupies space when hidden. */
2607 BOOL m_bClipClient; /**< Flag indicating if client area clipping is enabled. */
2608 BOOL m_bMsgTransparent; /**< Message transparency flag. TRUE means no message processing. */
2609 BOOL m_bFocusable; /**< Indicates if the window can receive focus. */
2610 BOOL m_bDrawFocusRect; /**< Indicates if the default focus rectangle should be drawn. */
2611 BOOL m_bCacheDraw; /**< Indicates if the window content is cached. */
2612 BOOL m_bCacheDirty; /**< Indicates if the cache is dirty. */
2613 BOOL m_bLayeredWindow; /**< Indicates if the window is layered. */
2614 BOOL m_isLoading; /**< Loading state flag. */
2615 BOOL m_bHoverAware; /**< Hover-aware state flag. */
2616 BOOL m_bMsgHandled; /**< Message handled flag. */
2617
2618 LayoutDirtyType m_layoutDirty; /**< Layout dirty state. */
2619 SAutoRefPtr<IRenderTarget> m_cachedRT; /**< Cached render target for the window. */
2620 SAutoRefPtr<IRegionS> m_clipRgn; /**< Clipping region for the window. */
2621 SAutoRefPtr<IPathS> m_clipPath; /**< Clipping path for the window. */
2622 SAutoRefPtr<ISkinObj> m_pBgSkin; /**< Background skin object. */
2623 SAutoRefPtr<ISkinObj> m_pNcSkin; /**< Non-client area skin object. */
2624 ULONG_PTR m_uData; /**< User data for the window. */
2625
2626 SLayoutSize m_nMaxWidth; /**< Maximum width of the window when calculating size automatically. */
2627
2628 COLORREF m_crColorize; /**< Colorization value for the window. */
2629
2630 SAutoRefPtr<IAnimation> m_animation; /**< Animation object. */
2631 SAnimationHandler m_animationHandler; /**< Animation handler for the window. */
2632 STransformation m_transform; /**< Transformation object. */
2633 bool m_isAnimating; /**< Flag indicating if the window is currently animating. */
2634 bool m_isDestroying; /**< Flag indicating if the window is being destroyed. */
2635
2636 typedef struct GETRTDATA
2637 {
2638 CRect rcRT; /**< Valid range for GETRT calls. */
2639 GrtFlag gdcFlags; /**< Drawing flags for GETRT. */
2640 SAutoRefPtr<IRegionS> rgn; /**< IRegion object corresponding to rcRT. */
2641 SAutoRefPtr<IRenderTarget> rt; /**< Render target created during GetRenderTarget, used for caching during redraws. */
2642 } * PGETRTDATA;
2643
2644 PGETRTDATA m_pGetRTData; /**< Pointer to GETRT data. */
2645
2646 SAutoRefPtr<IAttrStorage> m_attrStorage; /**< Attribute storage object. */
2647 SAutoRefPtr<ICaret> m_caret; /**< Caret object. */
2648
2649 FunSwndProc m_funSwndProc; /**< Custom window procedure. */
2650
2651#ifdef _WIN32
2652 SAutoRefPtr<IAccessible> m_pAcc; /**< Accessibility object. */
2653 SAutoRefPtr<IAccProxy> m_pAccProxy; /**< Accessibility proxy object. */
2654#endif //_WIN32
2655#ifdef _DEBUG
2656 tid_t m_nMainThreadId; /**< ID of the main thread hosting the window. */
2657#endif
2658};
2659
2660/**
2661 * @brief A helper class to enable or disable private UI definitions for the host container.
2662 */
2664 public:
2665 /**
2666 * @brief Constructor that enables private UI definitions for the host container.
2667 * @param pOwner Pointer to the owner window.
2668 */
2670 : m_pOwner(pOwner)
2671 {
2672 m_pOwner->GetContainer()->EnableHostPrivateUiDef(TRUE);
2673 }
2674
2675 /**
2676 * @brief Destructor that disables private UI definitions for the host container.
2677 */
2679 {
2680 m_pOwner->GetContainer()->EnableHostPrivateUiDef(FALSE);
2681 }
2682
2683 protected:
2684 SWindow *m_pOwner; /**< Pointer to the owner window. */
2685};
2686
2687SNSEND
2688#endif // __SWND__H__
SOUI系统中使用的事件系统
Skin Classes for SOUI.
SOUI系统中的DUI窗口管理模块
@ ParentShow
Definition SWnd.h:57
@ NormalShow
Definition SWnd.h:56
tagGW_CODE
Definition SWnd.h:194
@ GSW_FIRSTCHILD
Definition SWnd.h:195
@ GSW_LASTCHILD
Definition SWnd.h:196
@ GSW_PREVSIBLING
Definition SWnd.h:197
@ GSW_NEXTSIBLING
Definition SWnd.h:198
@ GSW_PARENT
Definition SWnd.h:199
@ GSW_OWNER
Definition SWnd.h:200
@ ParentEnable
Definition SWnd.h:66
@ NormalEnable
Definition SWnd.h:65
@ HRET_FLAG_STYLE
Definition SWnd.h:221
@ HRET_FLAG_LAYOUT
Definition SWnd.h:222
@ HRET_FLAG_LAYOUT_PARAM
Definition SWnd.h:223
WndState
Window state flags.
Definition SWnd.h:74
@ WndState_Hover
Definition SWnd.h:76
@ WndState_Check
Definition SWnd.h:78
@ WndState_Disable
Definition SWnd.h:80
@ WndState_Invisible
Definition SWnd.h:79
@ WndState_Normal
Definition SWnd.h:75
@ WndState_PushDown
Definition SWnd.h:77
GrtFlag
@ GRT_NODRAW
SOUI窗口风格管理
SAutoEnableHostPrivUiDef(SWindow *pOwner)
Constructor that enables private UI definitions for the host container.
Definition SWnd.h:2669
~SAutoEnableHostPrivUiDef()
Destructor that disables private UI definitions for the host container.
Definition SWnd.h:2678
Smart pointer class for managing COM-style reference-counted objects.
表示一组事件对象
Definition SEventSet.h:89
布局大小类
Definition SLayoutSize.h:10
The SMatrix class holds a 3x3 matrix for transforming coordinates. SMatrix does not have a constructo...
Definition SMatrix.h:22
BOOL IsClass(LPCWSTR lpszName) SCONST OVERRIDE
Checks if the object is of a specific class.
Definition Sobject.hpp:228
Helper class for painting.
Definition SWnd.h:178
SAutoRefPtr< IFontS > oldFont
Definition SWnd.h:185
COLORREF oldTextColor
Definition SWnd.h:186
Helper class for managing window states.
Definition SWnd.h:98
static bool TestState(DWORD dwState, WndState state)
Tests if a state is active.
Definition SWnd.h:126
static void ClearState(DWORD &dwState, WndState state)
Clears a state.
Definition SWnd.h:115
static void MarkState(DWORD &dwState, WndState state)
Marks a state as active.
Definition SWnd.h:105
A class representing an ASCII string.
Definition sstringw.h:96
STimerID(SWND swnd_, char timeId)
Constructor.
Definition SWnd.h:147
DWORD uTimerID
Definition SWnd.h:139
DWORD swnd
Definition SWnd.h:138
STimerID(DWORD dwID)
Constructor.
Definition SWnd.h:159
DWORD bSwndTimer
Definition SWnd.h:140
Class for handling text with translation support.
Definition SWnd.h:230
bool bAutoEscape
Definition SWnd.h:273
SStringT strRaw
Definition SWnd.h:272
void SetOwner(SWindow *pOwner)
Sets the owner window.
Definition Swnd.cpp:25
SWindow * pOwner
Definition SWnd.h:271
void TranslateText()
Translates the text.
Definition Swnd.cpp:42
void SetText(const SStringT &strText, bool bAutoEscape=true)
Sets the text.
Definition Swnd.cpp:35
SStringT GetText(BOOL bRawText=FALSE) const
Gets the text.
Definition Swnd.cpp:30
static SStringW EscapeString(const SStringW &str)
Escapes a string.
Definition Swnd.cpp:52
STrText(SWindow *pOwner=NULL)
Constructor.
Definition Swnd.cpp:19
SStringT strTr
Definition SWnd.h:274
Defines the transformation to be applied at one point in time of an Animation.
Base class for SOUI DUI windows.
Definition SWnd.h:286
IWindow * GetISelectedSiblingInGroup() OVERRIDE
Retrieves the selected sibling window in a group.
Definition Swnd.cpp:3582
void StartAnimation(IAnimation *animation) OVERRIDE
Starts an animation for the window.
Definition Swnd.cpp:2549
BOOL IsClipClient() SCONST OVERRIDE
Checks if client area clipping is enabled.
Definition Swnd.cpp:3446
SWNDMSG * m_pCurMsg
Definition SWnd.h:2594
BOOL m_bLayeredWindow
Definition SWnd.h:2613
BOOL SetTimer(char id, UINT uElapse) OVERRIDE
Sets a timer for the window.
Definition Swnd.cpp:477
UINT OnGetDlgCode() SCONST OVERRIDE
Retrieves the dialog code for the window.
Definition Swnd.cpp:1991
BOOL FireEvent(IEvtArgs *evt) OVERRIDE
Fires an event.
Definition Swnd.cpp:1540
SAutoRefPtr< ISkinObj > m_pNcSkin
Definition SWnd.h:2623
void SetMatrix(const IMatrix *mtx) OVERRIDE
Sets the transformation matrix for the window.
Definition Swnd.cpp:2607
void GetDesiredSize(SIZE *psz, int nParentWid, int nParentHei) OVERRIDE
Retrieves the desired size of the window.
Definition Swnd.cpp:1839
int m_nUpdateLockCnt
Definition SWnd.h:2601
SWND GetSwnd() SCONST OVERRIDE
Retrieves the window handle.
Definition Swnd.cpp:489
void accNotifyEvent(DWORD dwEvt)
Notifies an accessibility event.
Definition Swnd.cpp:3334
PGETRTDATA m_pGetRTData
Definition SWnd.h:2644
HRESULT QueryInterface(REFGUID id, IObjRef **ppRet) OVERRIDE
Queries an interface.
Definition Swnd.cpp:3572
IWindow * GetIOwner() SCONST OVERRIDE
Retrieves the owner window.
Definition Swnd.cpp:3557
SWindow * m_pLastChild
Definition SWnd.h:2589
BOOL m_bDisplay
Definition SWnd.h:2606
IWindow * GetIParent() SCONST OVERRIDE
Retrieves the parent window.
Definition Swnd.cpp:494
BOOL SubscribeEvent(DWORD evtId, const IEvtSlot *pSlot) OVERRIDE
Subscribes to an event.
Definition Swnd.cpp:3562
void InsertIChild(IWindow *pNewChild, IWindow *pInsertAfter=NULL) OVERRIDE
Inserts a child window into the window tree.
Definition Swnd.cpp:3537
void Move2(int x, int y, int cx=-1, int cy=-1) OVERRIDE
Moves the window to a new position and optionally resizes it.
Definition Swnd.cpp:417
BOOL m_isLoading
Definition SWnd.h:2614
BOOL m_bDisable
Definition SWnd.h:2605
BOOL UnregisterDragDrop() OVERRIDE
Unregisters a drop target for the window.
Definition Swnd.cpp:3666
IWindow * GetIRoot() SCONST OVERRIDE
Retrieves the root window in the hierarchy.
Definition Swnd.cpp:499
void UnlockUpdate() OVERRIDE
Unlocks updates to the window.
Definition Swnd.cpp:1497
BOOL Destroy() OVERRIDE
Destroys the window.
Definition Swnd.cpp:504
SWindow * m_pPrevSibling
Definition SWnd.h:2591
DWORD GetState() SCONST OVERRIDE
Retrieves the current state of the window.
Definition Swnd.cpp:437
BOOL AdjustIZOrder(IWindow *pInsertAfter) OVERRIDE
Adjusts the Z-order of the window.
Definition Swnd.cpp:3532
BOOL m_bCacheDirty
Definition SWnd.h:2612
SwndStyle m_style
Definition SWnd.h:2596
void OnAnimationStop(IAnimation *animation)
Called when an animation stops.
Definition Swnd.cpp:3362
void SetCaretPos(int x, int y) OVERRIDE
Sets the caret position.
Definition Swnd.cpp:3077
SAutoRefPtr< IRegionS > m_clipRgn
Definition SWnd.h:2620
SWND SwndFromPoint(POINT *pt, BOOL bIncludeMsgTransparent=FALSE) SCONST OVERRIDE
Retrieves the window handle at a specified point.
BOOL GetAttribute(LPCWSTR pszName, IStringW *strValue) SCONST OVERRIDE
Retrieves an attribute value from the window.
Definition Swnd.cpp:3216
void GetClientRect(LPRECT prect) SCONST OVERRIDE
Retrieves the client rectangle of the window.
BOOL FireEvent(SEvtArgs &evt)
Fires an event.
Definition SWnd.h:1811
BOOL IsSiblingsAutoGroupped() SCONST OVERRIDE
Checks if siblings are auto-grouped.
Definition Swnd.cpp:3441
BOOL m_bFloat
Definition SWnd.h:2578
IAccProxy * GetAccProxy()
Retrieves the accessibility proxy for the window.
Definition Swnd.cpp:3321
int GetWindowTextU8(IStringA *pStr, BOOL bRawText) OVERRIDE
Retrieves the window text as a UTF-8 string.
Definition Swnd.cpp:255
int GetWindowText(TCHAR *pBuf, int nBufLen, BOOL bRawText) OVERRIDE
Retrieves the window text.
Definition Swnd.cpp:263
IWindow * GetNextLayoutIChild(const IWindow *pCurChild) SCONST OVERRIDE
Retrieves the next layout child window.
Definition Swnd.cpp:2260
BOOL IsLayoutDirty() SCONST OVERRIDE
Checks if the layout is dirty.
Definition Swnd.cpp:3451
void SetAnimation(IAnimation *animation) OVERRIDE
Sets an animation for the window.
Definition Swnd.cpp:2512
void OnAnimationStart(IAnimation *animation)
Called when an animation starts.
Definition Swnd.cpp:3351
UINT GetChildrenCount() SCONST OVERRIDE
Retrieves the number of child windows.
Definition Swnd.cpp:533
SAutoRefPtr< ILayoutParam > m_pLayoutParam
Definition SWnd.h:2584
SAutoRefPtr< IPathS > m_clipPath
Definition SWnd.h:2621
BOOL SwndProc(UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *lResult) OVERRIDE
Processes a window message.
Definition Swnd.cpp:3592
void SDispatchMessage(UINT uMsg, WPARAM wParam=0, LPARAM lParam=0) OVERRIDE
Dispatches a message to the window.
Definition Swnd.cpp:388
void BringWindowToTop() OVERRIDE
Brings the window to the top of the Z-order.
Definition Swnd.cpp:1513
int GetScale() SCONST OVERRIDE
Retrieves the scale factor of the window.
Definition Swnd.cpp:3266
void GetMatrix(IMatrix *mtx) SCONST OVERRIDE
Retrieves the transformation matrix of the window.
Definition Swnd.cpp:2613
BOOL IsMsgHandled() const
Checks if the message is handled.
Definition Swnd.cpp:207
T * FindChildByID2(int nID, int nDeep=-1)
Finds a child window by its ID and casts it to a specific type.
Definition SWnd.h:1360
void GetVisibleRect(LPRECT prect) SCONST OVERRIDE
Retrieves the visible rectangle of the window.
Definition Swnd.cpp:3636
COLORREF GetColorizeColor() SCONST OVERRIDE
Retrieves the colorization color of the window.
Definition Swnd.cpp:3166
BOOL IsVideoCanvas() SCONST OVERRIDE
Checks if the window is a video canvas.
Definition Swnd.cpp:3656
UINT m_uZorder
Definition SWnd.h:2600
BOOL DestroyIChild(IWindow *pChild) OVERRIDE
Destroys a child window.
Definition Swnd.cpp:3547
void SetWindowPath(IPathS *pPath, BOOL bRedraw=TRUE) OVERRIDE
Sets the window path.
Definition Swnd.cpp:3131
STransformation m_transform
Definition SWnd.h:2632
BOOL UnsubscribeEvent(DWORD evtId, const IEvtSlot *pSlot) OVERRIDE
Unsubscribes from an event.
Definition Swnd.cpp:3567
ISwndContainer * GetContainer() OVERRIDE
Retrieves the container associated with this window.
Definition Swnd.cpp:679
void SetEventMute(BOOL bMute) OVERRIDE
Sets the event mute state.
Definition Swnd.cpp:324
COLORREF m_crColorize
Definition SWnd.h:2628
BOOL m_bMsgTransparent
Definition SWnd.h:2608
BOOL IsFocused() SCONST OVERRIDE
Checks if the window has focus.
Definition Swnd.cpp:2639
void DoColorize(COLORREF cr) OVERRIDE
Applies colorization to the window.
Definition Swnd.cpp:3143
BYTE GetAlpha() SCONST OVERRIDE
Retrieves the alpha value of the window.
Definition Swnd.cpp:2602
STransformation GetTransformation() const
Retrieves the current transformation matrix of the window.
Definition Swnd.cpp:2577
void SetAlpha(BYTE byAlpha) OVERRIDE
Sets the alpha value for the window.
Definition Swnd.cpp:2596
void SetSwndProc(FunSwndProc swndProc) OVERRIDE
Sets the window procedure.
Definition Swnd.cpp:3611
FunSwndProc m_funSwndProc
Definition SWnd.h:2649
PSWNDMSG GetCurMsg(void) const
Retrieves the current message being processed.
Definition SWnd.h:1190
void GetChildrenLayoutRect(RECT *prc) SCONST OVERRIDE
Retrieves the layout rectangle of the children.
Definition Swnd.cpp:2181
T * FindChildByName2(LPCSTR pszName, int nDeep=-1)
Overloaded method to find a child window by its name and cast it to a specific type (ANSI version).
Definition SWnd.h:1415
BOOL m_bDrawFocusRect
Definition SWnd.h:2610
SWindow * FindChildByName(LPCWSTR strName, int nDeep=-1)
Finds a child window by its name.
Definition Swnd.cpp:795
IAnimation * GetAnimation() SCONST OVERRIDE
Retrieves the animation object associated with the window.
Definition Swnd.cpp:2538
BOOL m_dwState
Definition SWnd.h:2603
void OnFinalRelease()
Called when the last reference to the object is released.
Definition Swnd.cpp:198
LRESULT SSendMessage(UINT uMsg, WPARAM wParam=0, LPARAM lParam=0, BOOL *pbMsgHandled=NULL) OVERRIDE
Sends a message to the window.
Definition Swnd.cpp:364
LayoutDirtyType
Enumerates the types of layout dirty states.
Definition SWnd.h:2568
IWindow * GetIWindow(int uCode) SCONST OVERRIDE
Retrieves a window based on a given code.
Definition Swnd.cpp:2653
IWindow * GetISelectedChildInGroup() OVERRIDE
Retrieves the selected child window in a group.
Definition Swnd.cpp:3587
SWindow * m_pFirstChild
Definition SWnd.h:2588
T * FindChildByName2(LPCWSTR pszName, int nDeep=-1)
Finds a child window by its name and casts it to a specific type.
Definition SWnd.h:1396
IWindow * FindIChildByNameA(LPCSTR pszName) OVERRIDE
Finds a child window by its name (ANSI version).
Definition Swnd.cpp:1680
BOOL CreateChildrenFromXml(LPCWSTR pszXml) OVERRIDE
Creates child windows from XML.
Definition Swnd.cpp:1024
static SStringW GetXmlText(const SXmlNode &xmlNode)
Gets the XML text from a node.
Definition Swnd.cpp:2955
void InvalidateRect(LPCRECT lprect) OVERRIDE
Invalidates a specific rectangle area of the window.
Definition Swnd.cpp:1444
void UpdateLayout() OVERRIDE
Updates the layout of the window.
Definition Swnd.cpp:2251
BOOL m_bHoverAware
Definition SWnd.h:2615
void UpdateChildrenPosition() OVERRIDE
Updates the position of child windows.
Definition Swnd.cpp:2189
bool m_isAnimating
Definition SWnd.h:2633
STrText m_strToolTipText
Definition SWnd.h:2598
BOOL m_bFocusable
Definition SWnd.h:2609
LayoutDirtyType m_layoutDirty
Definition SWnd.h:2618
SAutoRefPtr< IRenderTarget > m_cachedRT
Definition SWnd.h:2619
SWindow()
Constructor.
Definition Swnd.cpp:104
IRegionS * GetWindowRgn() SCONST OVERRIDE
Retrieves the window region.
Definition Swnd.cpp:3126
virtual void OnUpdateFloatPosition(const CRect &rcParent)
Update floating window position.
Definition SWnd.h:1660
BOOL RemoveIChild(IWindow *pChild) OVERRIDE
Removes a child window from the window tree.
Definition Swnd.cpp:3542
void SetContainer(ISwndContainer *pContainer) OVERRIDE
Sets the container for the window.
Definition Swnd.cpp:689
T * FindChildByClass(int nDeep=-1) const
Recursively finds a child window by its class type.
Definition SWnd.h:1427
BOOL IsContainPoint(POINT pt, BOOL bClientOnly) SCONST OVERRIDE
Checks if the window contains a specified point.
Definition Swnd.cpp:3100
T * GetLayoutParamT()
Template method to cast layout parameters to a specific type.
Definition SWnd.h:1347
SWND SetCapture() OVERRIDE
Sets the window to capture the mouse.
Definition Swnd.cpp:2484
SWindow * m_pOwner
Definition SWnd.h:2586
SAutoRefPtr< ICaret > m_caret
Definition SWnd.h:2647
void ClearAnimation() OVERRIDE
Clears the animation for the window.
Definition Swnd.cpp:2559
void SetFocus() OVERRIDE
Sets the focus to the window.
Definition Swnd.cpp:2620
BOOL m_bCacheDraw
Definition SWnd.h:2611
SStringW m_strTrCtx
Definition SWnd.h:2599
SWND GetCapture() SCONST OVERRIDE
Retrieves the window that has captured the mouse.
Definition Swnd.cpp:2470
void SetIOwner(IWindow *pOwner) OVERRIDE
Sets the owner window.
Definition Swnd.cpp:3552
BOOL IsUpdateLocked(BOOL bCheckParent=FALSE) SCONST OVERRIDE
Checks if updates to the window are locked.
Definition Swnd.cpp:1503
void SetWindowRgn(IRegionS *pRgn, BOOL bRedraw=TRUE) OVERRIDE
Sets the window region.
Definition Swnd.cpp:3114
ILayoutParam * GetLayoutParam() SCONST OVERRIDE
Retrieves the layout parameter object associated with the window.
Definition SWnd.h:405
SWindow * GetWindow(int uCode) const
Retrieves a window based on a given code.
Definition Swnd.cpp:3456
void ShowCaret(BOOL bShow) OVERRIDE
Shows or hides the caret.
Definition Swnd.cpp:3066
SLayoutSize m_nMaxWidth
Definition SWnd.h:2626
void KillFocus() OVERRIDE
Kills the focus from the window.
Definition Swnd.cpp:2629
IWindow * FindIChildByName(LPCWSTR pszName) OVERRIDE
Finds a child window by its name.
Definition Swnd.cpp:1675
void DestroyAllChildren() OVERRIDE
Destroys all child windows.
Definition Swnd.cpp:1685
SWindow * m_pNextSibling
Definition SWnd.h:2590
SEventSet * GetEventSet()
Retrieves the event set associated with the window.
Definition SWnd.h:1290
BOOL KillTimer(char id) OVERRIDE
Kills a timer for the window.
Definition Swnd.cpp:483
BOOL IsFocusable() SCONST OVERRIDE
Checks if the window is focusable.
Definition Swnd.cpp:1996
SWindow * m_pParent
Definition SWnd.h:2587
SAutoRefPtr< ISkinObj > m_pBgSkin
Definition SWnd.h:2622
BOOL FireCtxMenu(POINT pt) OVERRIDE
Fires a context menu event.
Definition Swnd.cpp:2719
void Invalidate() OVERRIDE
Invalidates the entire window.
Definition Swnd.cpp:1437
IPathS * GetWindowPath() SCONST OVERRIDE
Retrieves the window path.
Definition Swnd.cpp:3138
BOOL CreateCaret(HBITMAP pBmp, int nWid, int nHeight) OVERRIDE
Creates a caret.
Definition Swnd.cpp:3038
BOOL IsDescendant(const IWindow *pWnd) SCONST OVERRIDE
Checks if a window is a descendant of this window.
Definition Swnd.cpp:3518
BOOL m_bMsgHandled
Definition SWnd.h:2616
STrText m_strText
Definition SWnd.h:2597
virtual SWindow * GetSelectedSiblingInGroup()
Get selected sibling in group.
Definition SWnd.h:1598
void RequestRelayout() OVERRIDE
Requests a relayout of the window.
Definition Swnd.cpp:2225
BOOL AddEvent(DWORD dwEventID, LPCWSTR pszEventHandlerName) OVERRIDE
Adds an event handler.
Definition Swnd.cpp:3626
void GetWindowRect(LPRECT prect) SCONST OVERRIDE
Retrieves the bounding rectangle of the window.
COLORREF GetBkgndColor() SCONST OVERRIDE
Retrieves the background color of the window.
Definition Swnd.cpp:3386
ILayout * GetLayout() OVERRIDE
Retrieves the layout object associated with the window.
Definition SWnd.h:396
void SetMsgHandled(BOOL bHandled)
Sets the message handled flag.
Definition Swnd.cpp:212
SEventSet m_evtSet
Definition SWnd.h:2581
bool m_isDestroying
Definition SWnd.h:2634
BOOL RegisterDragDrop(IDropTarget *pDragTarget) OVERRIDE
Registers a drop target for the window.
Definition Swnd.cpp:3661
BOOL InitFromXml(IXmlNode *pNode) OVERRIDE
Initializes the window from an XML node.
Definition Swnd.cpp:946
IWindow * GetIChild(int iChild) SCONST OVERRIDE
Retrieves a child window by index.
Definition Swnd.cpp:2658
BOOL FireCommand() OVERRIDE
Fires a command event.
Definition Swnd.cpp:2713
void Update(BOOL bForce=FALSE) OVERRIDE
Updates the window.
Definition Swnd.cpp:1430
BOOL m_bVisible
Definition SWnd.h:2604
SAnimationHandler m_animationHandler
Definition SWnd.h:2631
DWORD ModifyState(DWORD dwStateAdd, DWORD dwStateRemove, BOOL bUpdate=FALSE) OVERRIDE
Modifies the state of the window.
Definition Swnd.cpp:443
SAutoRefPtr< IAttrStorage > m_attrStorage
Definition SWnd.h:2646
void LockUpdate() OVERRIDE
Locks updates to the window.
Definition Swnd.cpp:1492
HWND GetHostHwnd() OVERRIDE
Retrieves the host window handle.
Definition Swnd.cpp:3616
IWindow * FindIChildByID(int nId) OVERRIDE
Finds a child window by its ID.
Definition Swnd.cpp:1670
SWND m_swnd
Member variables representing various properties of the window.
Definition SWnd.h:2577
SWindow * FindChildByID(int nID, int nDeep=-1)
Finds a child window by its ID.
Definition Swnd.cpp:781
void Move(LPCRECT prect) OVERRIDE
Moves the window to a new position and size.
Definition Swnd.cpp:399
BOOL m_bClipClient
Definition SWnd.h:2607
ISwndContainer * m_pContainer
Definition SWnd.h:2580
ITimelineHandlersMgr * GetTimelineHandlersMgr() OVERRIDE
Retrieves the timeline handlers manager.
Definition Swnd.cpp:3621
SAutoRefPtr< ILayout > m_pLayout
Definition SWnd.h:2583
BOOL RemoveEvent(DWORD dwEventID) OVERRIDE
Removes an event handler.
Definition Swnd.cpp:3631
BOOL CreateChildrenFromResId(LPCTSTR pszResId) OVERRIDE
Creates child windows from a resource ID.
Definition Swnd.cpp:1032
ULONG_PTR m_uData
Definition SWnd.h:2624
SAutoRefPtr< IAnimation > m_animation
Definition SWnd.h:2630
UINT m_nChildrenCount
Definition SWnd.h:2592
BOOL ReleaseCapture() OVERRIDE
Releases the mouse capture from the window.
Definition Swnd.cpp:2491
Class representing an XML node.
Definition SXml.h:352
Manages the style attributes of SOUI windows.
Definition SWndStyle.h:28
Interface for reference counting.
Definition obj-ref-i.h:19
Region object interface.
Definition SRender-i.h:792
Interface for rendering target objects.
Definition SRender-i.h:1440
SOUI Window Container Interface.
时间轴处理接口
Interface for XML nodes.
Definition sxml-i.h:128
Structure representing a window message.
Definition SWnd.h:88
UINT uMsg
Definition SWnd.h:89
WPARAM wParam
Definition SWnd.h:90
LPARAM lParam
Definition SWnd.h:91
Information for window tooltips.
Definition SWnd.h:208
CRect rcTarget
Definition SWnd.h:211
DWORD dwCookie
Definition SWnd.h:210
SStringT strTip
Definition SWnd.h:212