soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
SNativeWndApi.h
1 //! Add reference
2 /*!
3 * @brief Increments the reference count of the object.
4 *
5 * @return long The new reference count.
6 */
7 STDMETHOD_(long, AddRef)(THIS) PURE;
8
9 //! Release reference
10 /*!
11 * @brief Decrements the reference count of the object.
12 *
13 * @return long The new reference count.
14 */
15 STDMETHOD_(long, Release)(THIS) PURE;
16
17 //! Final release of the object
18 /*!
19 * @brief Final release of the object, performing cleanup if necessary.
20 */
21 STDMETHOD_(void, OnFinalRelease)(THIS) PURE;
22
23 //////////////////////////////////////////////////////////////////////////
24
25 /**
26 * @brief Creates a Native window.
27 *
28 * @param lpWindowName Name of the window.
29 * @param dwStyle Window style.
30 * @param dwExStyle Extended window style.
31 * @param x X position of the window.
32 * @param y Y position of the window.
33 * @param nWidth Width of the window.
34 * @param nHeight Height of the window.
35 * @param hWndParent Handle to the parent window.
36 * @param nID Control ID of the window.
37 * @param lpParam Additional parameters.
38 * @return HWND Handle to the created window.
39 */
40 STDMETHOD_(HWND, CreateNative)
41 (THIS_ LPCTSTR lpWindowName, DWORD dwStyle, DWORD dwExStyle, int x, int y, int nWidth, int nHeight, HWND hWndParent, int nID, LPVOID lpParam) PURE;
42
43 /**
44 * @brief Retrieves the handle to the window.
45 *
46 * @return HWND Handle to the window.
47 */
48 STDMETHOD_(HWND, GetHwnd)(THIS) PURE;
49
50 /**
51 * @brief Subclasses an existing window with the SNativeWnd object.
52 *
53 * @param hWnd Handle to the window to subclass.
54 * @return BOOL TRUE if successful, FALSE otherwise.
55 */
56 STDMETHOD_(BOOL, SubclassWindow)(THIS_ HWND hWnd) PURE;
57
58 /**
59 * @brief Unsubclasses the window.
60 *
61 * @param bForce If TRUE, forces the unsubclassing even if the current window procedure is not SNativeWnd's.
62 * @return HWND Handle to the unsubclassed window.
63 */
64 STDMETHOD_(HWND, UnsubclassWindow)(THIS_ BOOL bForce /*= FALSE*/) PURE;
65
66 /**
67 * @brief Retrieves the current window message object.
68 *
69 * @return const MSG* Pointer to the current message object.
70 */
71 STDMETHOD_(const MSG *, GetCurrentMessage)(CTHIS) SCONST PURE;
72
73 /**
74 * @brief Retrieves the window ID.
75 *
76 * @return int Window ID.
77 */
78 STDMETHOD_(int, GetDlgCtrlID)(CTHIS) SCONST PURE;
79
80 /**
81 * @brief Retrieves the window style.
82 *
83 * @return DWORD Window style.
84 */
85 STDMETHOD_(DWORD, GetStyle)(CTHIS) SCONST PURE;
86
87 /**
88 * @brief Retrieves the extended window style.
89 *
90 * @return DWORD Extended window style.
91 */
92 STDMETHOD_(DWORD, GetExStyle)(CTHIS) SCONST PURE;
93
94 /**
95 * @brief Retrieves the long pointer value at the specified index.
96 *
97 * @param nIndex Index of the value to retrieve.
98 * @return LONG_PTR Long pointer value.
99 */
100 STDMETHOD_(LONG_PTR, GetWindowLongPtr)(CTHIS_ int nIndex) SCONST PURE;
101
102 /**
103 * @brief Sets the long pointer value at the specified index.
104 *
105 * @param nIndex Index of the value to set.
106 * @param dwNewLong New long pointer value.
107 * @return LONG_PTR Previous long pointer value.
108 */
109 STDMETHOD_(LONG_PTR, SetWindowLongPtr)(THIS_ int nIndex, LONG_PTR dwNewLong) PURE;
110
111 /**
112 * @brief Retrieves the handle to the parent window.
113 *
114 * @return HWND Handle to the parent window.
115 */
116 STDMETHOD_(HWND, GetParent)(THIS) PURE;
117
118 /**
119 * @brief Sets the handle to the parent window.
120 *
121 * @param hWndNewParent Handle to the new parent window.
122 * @return HWND Handle to the previous parent window.
123 */
124 STDMETHOD_(HWND, SetParent)(THIS_ HWND hWndNewParent) PURE;
125
126 /**
127 * @brief Checks if the window is enabled.
128 *
129 * @return BOOL TRUE if the window is enabled, FALSE otherwise.
130 */
131 STDMETHOD_(BOOL, IsWindowEnabled)(CTHIS) SCONST PURE;
132
133 /**
134 * @brief Modifies the window style.
135 *
136 * @param dwRemove Styles to remove.
137 * @param dwAdd Styles to add.
138 * @param nFlags Window positioning flags.
139 * @return BOOL TRUE if successful, FALSE otherwise.
140 */
141 STDMETHOD_(BOOL, ModifyStyle)(THIS_ DWORD dwRemove, DWORD dwAdd, UINT nFlags /*=0*/) PURE;
142
143 /**
144 * @brief Modifies the extended window style.
145 *
146 * @param dwRemove Styles to remove.
147 * @param dwAdd Styles to add.
148 * @param nFlags Window positioning flags.
149 * @return BOOL TRUE if successful, FALSE otherwise.
150 */
151 STDMETHOD_(BOOL, ModifyStyleEx)(THIS_ DWORD dwRemove, DWORD dwAdd, UINT nFlags /*=0*/) PURE;
152
153 /**
154 * @brief Sets the window position.
155 *
156 * @param hWndInsertAfter Handle to the window to insert after.
157 * @param x X position of the window.
158 * @param y Y position of the window.
159 * @param cx Width of the window.
160 * @param cy Height of the window.
161 * @param nFlags Window positioning flags.
162 * @return BOOL TRUE if successful, FALSE otherwise.
163 */
164 STDMETHOD_(BOOL, SetWindowPos)
165 (THIS_ HWND hWndInsertAfter, int x, int y, int cx, int cy, UINT nFlags) PURE;
166
167 /**
168 * @brief Centers the window relative to another window.
169 *
170 * @param hWndCenter Handle to the window to center relative to.
171 * @return BOOL TRUE if successful, FALSE otherwise.
172 */
173 STDMETHOD_(BOOL, CenterWindow)(THIS_ HWND hWndCenter /*= NULL*/) PURE;
174
175 /**
176 * @brief Destroys the window.
177 *
178 * @return BOOL TRUE if successful, FALSE otherwise.
179 */
180 STDMETHOD_(BOOL, DestroyWindow)(THIS) PURE;
181
182 /**
183 * @brief Checks if the handle is a valid window handle.
184 *
185 * @return BOOL TRUE if valid, FALSE otherwise.
186 */
187 STDMETHOD_(BOOL, IsWindow)(CTHIS) SCONST PURE;
188
189 /**
190 * @brief Invalidates the entire window.
191 *
192 * @param bErase Flag indicating if the background should be erased.
193 * @return BOOL TRUE if successful, FALSE otherwise.
194 */
195 STDMETHOD_(BOOL, Invalidate)(THIS_ BOOL bErase /*= TRUE*/) PURE;
196
197 /**
198 * @brief Invalidates a specified rectangle of the window.
199 *
200 * @param lpRect Rectangle to invalidate.
201 * @param bErase Flag indicating if the background should be erased.
202 * @return BOOL TRUE if successful, FALSE otherwise.
203 */
204 STDMETHOD_(BOOL, InvalidateRect)(THIS_ LPCRECT lpRect, BOOL bErase /* = TRUE*/) PURE;
205
206 /**
207 * @brief Retrieves the window rectangle.
208 *
209 * @param[out] lpRect Rectangle to receive the window rectangle.
210 * @return BOOL TRUE if successful, FALSE otherwise.
211 */
212 STDMETHOD_(BOOL, GetWindowRect)(CTHIS_ LPRECT lpRect) SCONST PURE;
213
214 /**
215 * @brief Retrieves the client rectangle.
216 *
217 * @param[out] lpRect Rectangle to receive the client rectangle.
218 * @return BOOL TRUE if successful, FALSE otherwise.
219 */
220 STDMETHOD_(BOOL, GetClientRect)(CTHIS_ LPRECT lpRect) SCONST PURE;
221
222 /**
223 * @brief Converts client coordinates to screen coordinates.
224 *
225 * @param[in][out] lpPoint Point to convert.
226 * @return BOOL TRUE if successful, FALSE otherwise.
227 */
228 STDMETHOD_(BOOL, ClientToScreen)(CTHIS_ LPPOINT lpPoint) SCONST PURE;
229
230 /**
231 * @brief Converts client rectangle coordinates to screen coordinates.
232 *
233 * @param[in][out] lpRect Rectangle to convert.
234 * @return BOOL TRUE if successful, FALSE otherwise.
235 */
236 STDMETHOD_(BOOL, ClientToScreen2)(CTHIS_ LPRECT lpRect) SCONST PURE;
237
238 /**
239 * @brief Converts screen coordinates to client coordinates.
240 *
241 * @param[in][out] lpPoint Point to convert.
242 * @return BOOL TRUE if successful, FALSE otherwise.
243 */
244 STDMETHOD_(BOOL, ScreenToClient)(CTHIS_ LPPOINT lpPoint) SCONST PURE;
245
246 /**
247 * @brief Converts screen rectangle coordinates to client coordinates.
248 *
249 * @param[in][out] lpRect Rectangle to convert.
250 * @return BOOL TRUE if successful, FALSE otherwise.
251 */
252 STDMETHOD_(BOOL, ScreenToClient2)(CTHIS_ LPRECT lpRect) SCONST PURE;
253
254 /**
255 * @brief Maps a set of points from one window to another.
256 *
257 * @param hWndTo Handle to the destination window.
258 * @param[in][out] lpPoint Array of points to map.
259 * @param nCount Number of points.
260 * @return int Number of points mapped.
261 */
262 STDMETHOD_(int, MapWindowPoints)(CTHIS_ HWND hWndTo, LPPOINT lpPoint, UINT nCount) SCONST PURE;
263
264 /**
265 * @brief Maps a rectangle from one window to another.
266 *
267 * @param hWndTo Handle to the destination window.
268 * @param[in][out] lpRect Rectangle to map.
269 * @return int Number of points mapped.
270 */
271 STDMETHOD_(int, MapWindowRect)(CTHIS_ HWND hWndTo, LPRECT lpRect) SCONST PURE;
272
273 /**
274 * @brief Sets a timer for the window.
275 *
276 * @param nIDEvent Timer ID.
277 * @param nElapse Elapse time in milliseconds.
278 * @param lpfnTimer Timer callback function, if NULL, a WM_TIMER message is generated.
279 * @return UINT_PTR Timer ID.
280 */
281 STDMETHOD_(UINT_PTR, SetTimer)
282 (THIS_ UINT_PTR nIDEvent, UINT nElapse, void(CALLBACK *lpfnTimer)(HWND, UINT, UINT_PTR, DWORD) /*= NULL*/) PURE;
283
284 /**
285 * @brief Kills a timer for the window.
286 *
287 * @param nIDEvent Timer ID.
288 * @return BOOL TRUE if successful, FALSE otherwise.
289 */
290 STDMETHOD_(BOOL, KillTimer)(THIS_ UINT_PTR nIDEvent) PURE;
291
292 /**
293 * @brief Retrieves a device context for the window.
294 *
295 * @return HDC Handle to the device context.
296 */
297 STDMETHOD_(HDC, GetDC)(THIS) PURE;
298
299 /**
300 * @brief Retrieves a device context for the entire window.
301 *
302 * @return HDC Handle to the device context.
303 */
304 STDMETHOD_(HDC, GetWindowDC)(THIS) PURE;
305
306 /**
307 * @brief Releases a device context.
308 *
309 * @param hDC Handle to the device context to release.
310 * @return int Number of times the device context was released.
311 */
312 STDMETHOD_(int, ReleaseDC)(THIS_ HDC hDC) PURE;
313
314 /**
315 * @brief Creates a caret for the window.
316 *
317 * @param hBitmap Handle to the bitmap for the caret.
318 * @param nWidth Width of the caret.
319 * @param nHeight Height of the caret.
320 * * @return BOOL TRUE if successful, FALSE otherwise.
321 */
322 STDMETHOD_(BOOL, CreateCaret)(THIS_ HBITMAP hBitmap, int nWidth, int nHeight) PURE;
323
324 /**
325 * @brief Hides the caret.
326 *
327 * @return BOOL TRUE if successful, FALSE otherwise.
328 */
329 STDMETHOD_(BOOL, HideCaret)(THIS) PURE;
330
331 /**
332 * @brief Shows the caret.
333 *
334 * @return BOOL TRUE if successful, FALSE otherwise.
335 */
336 STDMETHOD_(BOOL, ShowCaret)(THIS) PURE;
337
338 /**
339 * @brief Retrieves the handle to the window that has captured the mouse.
340 *
341 * @return HWND Handle to the capturing window.
342 */
343 STDMETHOD_(HWND, GetCapture)(THIS) PURE;
344
345 /**
346 * @brief Sets the window to capture the mouse input.
347 *
348 * @return HWND Handle to the previous capturing window.
349 */
350 STDMETHOD_(HWND, SetCapture)(THIS) PURE;
351
352 /**
353 * @brief Releases the mouse capture.
354 *
355 * @return BOOL TRUE if successful, FALSE otherwise.
356 */
357 STDMETHOD_(BOOL, ReleaseCapture)(THIS) PURE;
358
359 /**
360 * @brief Sets the input focus to the window.
361 *
362 * @return HWND Handle to the previous focused window.
363 */
364 STDMETHOD_(HWND, SetFocus)(THIS) PURE;
365
366 /**
367 * @brief Sends a message to the window.
368 *
369 * @param message Message ID.
370 * @param wParam WPARAM for the message.
371 * @param lParam LPARAM for the message.
372 * @return LRESULT Result of the message processing.
373 */
374 STDMETHOD_(LRESULT, SendMessage)
375 (THIS_ UINT message, WPARAM wParam /*= 0*/, LPARAM lParam /*= 0*/) PURE;
376
377 /**
378 * @brief Posts a message to the window.
379 *
380 * @param message Message ID.
381 * @param wParam WPARAM for the message.
382 * @param lParam LPARAM for the message.
383 * @return BOOL TRUE if successful, FALSE otherwise.
384 */
385 STDMETHOD_(BOOL, PostMessage)
386 (THIS_ UINT message, WPARAM wParam /*= 0*/, LPARAM lParam /*= 0*/) PURE;
387
388 /**
389 * @brief Sends a notify message to the window.
390 *
391 * @param message Message ID.
392 * @param wParam WPARAM for the message.
393 * @param lParam LPARAM for the message.
394 * @return BOOL TRUE if successful, FALSE otherwise.
395 */
396 STDMETHOD_(BOOL, SendNotifyMessage)
397 (THIS_ UINT message, WPARAM wParam /*= 0*/, LPARAM lParam /*= 0*/) PURE;
398
399 /**
400 * @brief Sets the window text.
401 *
402 * @param lpszString String to set as the window text.
403 * @return BOOL TRUE if successful, FALSE otherwise.
404 */
405 STDMETHOD_(BOOL, SetWindowText)(THIS_ LPCTSTR lpszString) PURE;
406
407 /**
408 * @brief Retrieves the window text.
409 *
410 * @param lpszStringBuf Buffer to receive the window text.
411 * @param nMaxCount Maximum number of characters to copy to the buffer.
412 * @return int Length of the string copied to the buffer, not including the terminating null character.
413 */
414 STDMETHOD_(int, GetWindowText)(CTHIS_ LPTSTR lpszStringBuf, int nMaxCount) SCONST PURE;
415
416 /**
417 * @brief Checks if the window is iconic (minimized).
418 *
419 * @return BOOL TRUE if the window is iconic, FALSE otherwise.
420 */
421 STDMETHOD_(BOOL, IsIconic)(CTHIS) SCONST PURE;
422
423 /**
424 * @brief Checks if the window is zoomed (maximized).
425 *
426 * @return BOOL TRUE if the window is zoomed, FALSE otherwise.
427 */
428 STDMETHOD_(BOOL, IsZoomed)(CTHIS) SCONST PURE;
429
430 /**
431 * @brief Checks if the window is visible.
432 *
433 * @return BOOL TRUE if the window is visible, FALSE otherwise.
434 */
435 STDMETHOD_(BOOL, IsWindowVisible)(CTHIS) SCONST PURE;
436
437 /**
438 * @brief Moves the window to the specified position and resizes it.
439 *
440 * @param x X position of the window.
441 * @param y Y position of the window.
442 * @param nWidth Width of the window.
443 * @param nHeight Height of the window.
444 * @param bRepaint Flag indicating if the window should be repainted.
445 * @return BOOL TRUE if successful, FALSE otherwise.
446 */
447 STDMETHOD_(BOOL, MoveWindow)
448 (THIS_ int x, int y, int nWidth, int nHeight, BOOL bRepaint /*= TRUE*/) PURE;
449
450 /**
451 * @brief Moves the window to the specified position and resizes it using a rectangle.
452 *
453 * @param lpRect Rectangle defining the new position and size of the window.
454 * @param bRepaint Flag indicating if the window should be repainted.
455 * @return BOOL TRUE if successful, FALSE otherwise.
456 */
457 STDMETHOD_(BOOL, MoveWindow2)(THIS_ LPCRECT lpRect, BOOL bRepaint /*= TRUE*/) PURE;
458
459 /**
460 * @brief Sets the show state of the window.
461 *
462 * @param nCmdShow Command to show the window (e.g., SW_SHOW, SW_HIDE).
463 * @return BOOL TRUE if successful, FALSE otherwise.
464 */
465 STDMETHOD_(BOOL, ShowWindow)(THIS_ int nCmdShow) PURE;
466
467 /**
468 * @brief Sets the window region.
469 *
470 * @param hRgn Handle to the region.
471 * @param bRedraw Flag indicating if the window should be redrawn.
472 * @return int Previous region handle.
473 */
474 STDMETHOD_(int, SetWindowRgn)(THIS_ HRGN hRgn, BOOL bRedraw /*=TRUE*/) PURE;
475
476 /**
477 * @brief Sets the layered window attributes.
478 *
479 * @param crKey Color key for transparency.
480 * @param bAlpha Alpha value for transparency.
481 * @param dwFlags Flags for the layered window attributes.
482 * @return BOOL TRUE if successful, FALSE otherwise.
483 */
484 STDMETHOD_(BOOL, SetLayeredWindowAttributes)
485 (THIS_ COLORREF crKey, BYTE bAlpha, DWORD dwFlags) PURE;
486
487 /**
488 * @brief Updates the layered window.
489 *
490 * @param hdcDst Destination device context.
491 * @param pptDst Destination point.
492 * @param psize Size of the destination.
493 * @param hdcSrc Source device context.
494 * @param pptSrc Source point.
495 * @param crKey Color key for transparency.
496 * @param pblend Blend function.
497 * @param dwFlags Flags for the update.
498 * @return BOOL TRUE if successful, FALSE otherwise.
499 */
500 STDMETHOD_(BOOL, UpdateLayeredWindow)
501 (THIS_ HDC hdcDst, POINT *pptDst, SIZE *psize, HDC hdcSrc, POINT *pptSrc, COLORREF crKey, BLENDFUNCTION *pblend, DWORD dwFlags) PURE;
502
503 /**
504 * @brief Sets the message handler for the window.
505 *
506 * @param fun Function pointer to the message handler.
507 * @param ctx Context pointer for the message handler.
508 */
509 STDMETHOD_(void, SetMsgHandler)(THIS_ FunMsgHandler fun, void *ctx) PURE;
510
511 /**
512 * @brief Retrieves the message handler for the window.
513 *
514 * @return MsgHandlerInfo* Pointer to the message handler information.
515 */
516 STDMETHOD_(MsgHandlerInfo *, GetMsgHandler)(THIS) PURE;
517
Structure containing message handler information.