soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
SWindowMgr.h
Go to the documentation of this file.
1/**
2 * Copyright (C) 2014-2050
3 * All rights reserved.
4 *
5 * @file SWindowMgr.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 SWindowMgr class, which manages DUI windows in the SOUI system.
12 */
13
14#ifndef __SWINDOWMGR__H__
15#define __SWINDOWMGR__H__
16
17#include <core/SSingletonMap.h>
18#include <core/SDefine.h>
20
21SNSBEGIN
22
23class SWindow;
24
25/**
26 * @class SWindowMgr
27 * @brief Manages DUI windows in the SOUI system.
28 *
29 * This class is responsible for managing the creation, retrieval, and destruction of DUI windows.
30 * It uses a singleton pattern to ensure a single instance of the manager and provides methods
31 * to interact with the windows.
32 */
33class SOUI_EXP SWindowMgr : public SSingletonMap<SWindowMgr, SWindow *, SWND> {
34 SINGLETON2_TYPE(SINGLETON_SWNDMGR)
35
36 public:
37 /**
38 * @brief Invalid window handle constant.
39 */
40 enum
41 {
42 SWND_INVALID = 0
43 };
44
45 /**
46 * @brief Constructor.
47 */
48 SWindowMgr();
49
50 /**
51 * @brief Destructor.
52 */
54
55 /**
56 * @brief Retrieves the SWindow pointer from a given handle.
57 * @param swnd Handle of the window to retrieve.
58 * @return Pointer to the SWindow object, or nullptr if the handle is invalid.
59 */
60 static SWindow *GetWindow(SWND swnd);
61
62 /**
63 * @brief Checks if a given handle is a valid window handle.
64 * @param swnd Handle to check.
65 * @return TRUE if the handle is valid, FALSE otherwise.
66 */
67 static bool IsWindow(SWND swnd);
68
69 /**
70 * @brief Assigns a handle to a new SWindow.
71 * @param pWnd Pointer to the SWindow to assign a handle to.
72 * @return Handle assigned to the SWindow, or SWND_INVALID if assignment fails.
73 */
74 static SWND NewWindow(SWindow *pWnd);
75
76 /**
77 * @brief Destroys a window with the specified handle.
78 * @param swnd Handle of the window to destroy.
79 * @return TRUE if the window is successfully destroyed, FALSE otherwise.
80 */
81 static BOOL DestroyWindow(SWND swnd);
82
83 protected:
84 SCriticalSection m_lockWndMap; // Critical section for thread-safe access to the window map.
85 SWND m_hNextWnd; // Next available window handle.
86};
87
88SNSEND
89#endif // __SWINDOWMGR__H__
Header file for SCriticalSection and SAutoLock classes.
Wrapper class for a critical section.
Base class for SOUI DUI windows.
Definition SWnd.h:286
SWindowMgr()
Constructor.
Definition SWindowMgr.cpp:7
static SWindow * GetWindow(SWND swnd)
Retrieves the SWindow pointer from a given handle.
static bool IsWindow(SWND swnd)
Checks if a given handle is a valid window handle.
static BOOL DestroyWindow(SWND swnd)
Destroys a window with the specified handle.
static SWND NewWindow(SWindow *pWnd)
Assigns a handle to a new SWindow.