soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
SHostPresenter.h
1#ifndef _SHOSTPRESENTER_H_
2#define _SHOSTPRESENTER_H_
3
4#include <interface/SHostPresenter-i.h>
5#include <helper/obj-ref-impl.hpp>
6
7SNSBEGIN
8
9// Forward declaration of SHostWnd class
10class SHostWnd;
11
12#ifdef _WIN32
13
14// Structure to hold information for SUpdateLayeredWindowIndirect function
15struct S_UPDATELAYEREDWINDOWINFO;
16
17/**
18 * @brief Helper class for window surface operations.
19 * This class provides static methods for initializing and updating layered windows.
20 */
21class SWndSurface {
22 public:
23 /**
24 * @brief Initializes the SWndSurface functionality.
25 * @return TRUE if initialization is successful, FALSE otherwise.
26 */
27 static BOOL Init();
28
29 /**
30 * @brief Updates a layered window using indirect information.
31 * @param hWnd Handle to the layered window.
32 * @param pULWInfo Pointer to a S_UPDATELAYEREDWINDOWINFO structure containing update information.
33 * @return TRUE if the update is successful, FALSE otherwise.
34 */
35 static BOOL SUpdateLayeredWindowIndirect(HWND hWnd, const S_UPDATELAYEREDWINDOWINFO *pULWInfo);
36};
37
38#endif // _WIN32
39
40/**
41 * @brief Presenter class for the host window.
42 * This class manages the lifecycle and rendering of the host window.
43 */
44class SOUI_EXP SHostPresenter : public TObjRefImpl<IHostPresenter> {
45 protected:
46 // Pointer to the host window
47 SHostWnd *m_pHostWnd;
48
49 public:
50 /**
51 * @brief Constructor for SHostPresenter.
52 * @param pHostWnd Pointer to the host window.
53 */
54 SHostPresenter(SHostWnd *pHostWnd);
55
56 /**
57 * @brief Destructor for SHostPresenter.
58 */
59 ~SHostPresenter(void);
60
61 public:
62 /**
63 * @brief Called when the host window is created.
64 */
65 STDMETHOD_(void, OnHostCreate)(THIS) OVERRIDE;
66
67 /**
68 * @brief Called when the host window is destroyed.
69 */
70 STDMETHOD_(void, OnHostDestroy)(THIS) OVERRIDE;
71
72 /**
73 * @brief Called when the host window is resized.
74 * @param szHost New size of the host window.
75 */
76 STDMETHOD_(void, OnHostResize)(THIS_ SIZE szHost) OVERRIDE;
77
78 /**
79 * @brief Called to present the host window.
80 * @param hdc Device context for drawing.
81 * @param pMemRT Pointer to the memory render target.
82 * @param rcDirty Rectangle specifying the area to update.
83 * @param byAlpha Alpha blending value.
84 */
85 STDMETHOD_(void, OnHostPresent)(THIS_ HDC hdc, IRenderTarget *pMemRT, LPCRECT rcDirty, BYTE byAlpha) OVERRIDE;
86
87 protected:
88 /**
89 * @brief Updates the layer from the render target.
90 * @param pRT Pointer to the render target.
91 * @param byAlpha Alpha blending value.
92 * @param prcDirty Optional rectangle specifying the area to update.
93 */
94 void UpdateLayerFromRenderTarget(IRenderTarget *pRT, BYTE byAlpha, LPCRECT prcDirty = NULL);
95};
96
97SNSEND
98
99#endif // _SHOSTPRESENTER_H_
void UpdateLayerFromRenderTarget(IRenderTarget *pRT, BYTE byAlpha, LPCRECT prcDirty=NULL)
Updates the layer from the render target.
void OnHostPresent(HDC hdc, IRenderTarget *pMemRT, LPCRECT rcDirty, BYTE byAlpha) OVERRIDE
Called to present the host window.
void OnHostResize(SIZE szHost) OVERRIDE
Called when the host window is resized.
SHostPresenter(SHostWnd *pHostWnd)
Constructor for SHostPresenter.
void OnHostCreate() OVERRIDE
Called when the host window is created.
void OnHostDestroy() OVERRIDE
Called when the host window is destroyed.
The main host window class responsible for managing the layout, events, and rendering of SOUI windows...
Definition SHostWnd.h:318
Interface for rendering target objects.
Definition SRender-i.h:1440