Kanzi 3.9.10
kanzi::win32::Win32Window Class Reference

Class that represents a Win32 window. More...

#include <kanzi/core.ui/platform/windowing_ng/win32/win32_window.hpp>

Public Member Functions

bool bringToFront () noexcept
 Brings a window to the front of every other window in the z-order.
 
bool clientToScreen (LPPOINT point) const
 Converts the client-area coordinates to screen coordinates for a window.
 
bool destroyWindow ()
 Destroys the window and all its associated data by sending destroy request to the window procedure.
 
KZ_NO_DISCARD unsigned int findWindowZOrder () const noexcept
 Finds the z ordering for the active window related to all other windows currently visible.
 
KZ_NO_DISCARD RECT getClientRect () const noexcept
 Gets the client extents of the window.
 
KZ_NO_DISCARD HDC getDC () const noexcept
 Gets the associated device context handle of a window.
 
KZ_NO_DISCARD Win32WindowHandle getNativeHandle () const noexcept
 Gets the native window handle.
 
KZ_NO_DISCARD LONG_PTR getWindowLongPtr (int index) const
 Gets the attribute value of a window.
 
KZ_NO_DISCARD WINDOWPLACEMENT getWindowPlacement () const noexcept
 Gets the previous placement of the window.
 
KZ_NO_DISCARD RECT getWindowRect () const noexcept
 Gets the entire extents of the window.
 
KZ_NO_DISCARD string getWindowText () const
 Gets the title of the window.
 
void killTimer (UINT_PTR id) noexcept
 Destroys the set timer.
 
HMONITOR monitorFromWindow (unsigned long flags) noexcept
 Gets the display monitor with the largest area of intersection with a window.
 
bool moveWindow (int x, int y, int width, int height, bool repaint) noexcept
 Moves a window to a new position and sets the window size.
 
bool releaseDC (Win32DeviceContext &deviceContext) noexcept
 Releases the device context handle of a window.
 
bool screenToClient (LPPOINT point) const
 Converts the screen coordinates to client-area coordinates for a window.
 
UINT_PTR setTimer (UINT_PTR id, unsigned int timeout, TIMERPROC timerProc) noexcept
 Sets a timer for a window.
 
bool setTouchWindowProperty () noexcept
 Sets the default touch property for a window.
 
LONG_PTR setWindowLongPtr (int index, LONG_PTR value) noexcept
 Sets the attribute value of a window.
 
bool setWindowPlacement (WINDOWPLACEMENT windowPlacement)
 Sets the current placement of the window.
 
bool setWindowPosition (Win32WindowHandle insertAfter, int x, int y, int width, int height, unsigned int windowFlags) noexcept
 Sets the new position of a window.
 
bool setWindowText (const char *title)
 Sets the title of the window.
 
bool showWindow (int cmd) noexcept
 Shows the window.
 
bool tryRegisterTouchWindow (const Win32DynamicLibrary &user32Lib) noexcept
 Tries to dynamically register the touch input for a window.
 
void updateWindow ()
 Forces the updating of a window by sending the paint request to the window procedure.
 
 Win32Window (int x, int y, int width, int height, WindowStyle style, const char *className)
 Constructor.
 
 Win32Window (int x, int y, int width, int height, WindowStyle style, const Win32WindowClass &windowClass)
 Constructor.
 
 Win32Window (Win32WindowHandle nativeHandle)
 Constructor.
 
 Win32Window (windowing::Region windowRegion, WindowStyle style, const Win32WindowClass &windowClass)
 Constructor.
 

Detailed Description

Class that represents a Win32 window.

Since
Kanzi 3.9.7

Constructor & Destructor Documentation

◆ Win32Window() [1/4]

kanzi::win32::Win32Window::Win32Window ( windowing::Region windowRegion,
WindowStyle style,
const Win32WindowClass & windowClass )
explicit

Constructor.

Parameters
windowRegionWindow extent.
styleThe style of the window.
windowClassThe class to which the window belongs.

◆ Win32Window() [2/4]

kanzi::win32::Win32Window::Win32Window ( int x,
int y,
int width,
int height,
WindowStyle style,
const Win32WindowClass & windowClass )
explicit

Constructor.

Parameters
xThe horizontal position of the top-left corner of the window in screen coordinates.
yThe vertical position of the top-left corner of the window in screen coordinates.
widthThe horizontal extent of the window in screen coordinates.
heightThe vertical extent of the window in screen coordinates.
styleThe style of the window.
windowClassThe class name of the window.

◆ Win32Window() [3/4]

kanzi::win32::Win32Window::Win32Window ( int x,
int y,
int width,
int height,
WindowStyle style,
const char * className )
explicit

Constructor.

Parameters
xThe horizontal position of the top-left corner of the window in screen coordinates.
yThe vertical position of the top-left corner of the window in screen coordinates.
widthThe horizontal extent of the window in screen coordinates.
heightThe vertical extent of the window in screen coordinates.
styleThe style of the window.
classNameThe native class name of the window.

◆ Win32Window() [4/4]

kanzi::win32::Win32Window::Win32Window ( Win32WindowHandle nativeHandle)
explicit

Constructor.

Parameters
nativeHandleThe window handle.

Member Function Documentation

◆ setWindowText()

bool kanzi::win32::Win32Window::setWindowText ( const char * title)

Sets the title of the window.

Parameters
titleThe title to set.
Returns
On success, true, otherwise false.

◆ getWindowText()

KZ_NO_DISCARD string kanzi::win32::Win32Window::getWindowText ( ) const

Gets the title of the window.

Returns
Title of the window.

◆ moveWindow()

bool kanzi::win32::Win32Window::moveWindow ( int x,
int y,
int width,
int height,
bool repaint )
noexcept

Moves a window to a new position and sets the window size.

Parameters
xThe horizontal position of the top-left corner of the window in screen coordinates.
yThe vertical position of the top-left corner of the window in screen coordinates.
widthThe horizontal extent of the window in screen coordinates.
heightThe vertical extent of the window in screen coordinates.
repaintPredicate to do repainting of the window after moving.

◆ setWindowPosition()

bool kanzi::win32::Win32Window::setWindowPosition ( Win32WindowHandle insertAfter,
int x,
int y,
int width,
int height,
unsigned int windowFlags )
noexcept

Sets the new position of a window.

Parameters
insertAfterThe window to insert the window after in z-order.
xThe horizontal position of the top-left corner of the window in screen coordinates.
yThe vertical position of the top-left corner of the window in screen coordinates.
widthThe horizontal extent of the window in screen coordinates.
heightThe vertical extent of the window in screen coordinates.
windowFlagsFlags for setting the new window position.

◆ getClientRect()

KZ_NO_DISCARD RECT kanzi::win32::Win32Window::getClientRect ( ) const
noexcept

Gets the client extents of the window.

Returns
The extents of the client-area.

◆ getWindowRect()

KZ_NO_DISCARD RECT kanzi::win32::Win32Window::getWindowRect ( ) const
noexcept

Gets the entire extents of the window.

Returns
The extents of the window.

◆ setWindowPlacement()

bool kanzi::win32::Win32Window::setWindowPlacement ( WINDOWPLACEMENT windowPlacement)

Sets the current placement of the window.

Returns
On success, true, otherwise false.

◆ getWindowPlacement()

KZ_NO_DISCARD WINDOWPLACEMENT kanzi::win32::Win32Window::getWindowPlacement ( ) const
noexcept

Gets the previous placement of the window.

Returns
The previous placement.

◆ showWindow()

bool kanzi::win32::Win32Window::showWindow ( int cmd)
noexcept

Shows the window.

Parameters
cmdHow to show the window.
Returns
On success, true, otherwise false.

◆ bringToFront()

bool kanzi::win32::Win32Window::bringToFront ( )
noexcept

Brings a window to the front of every other window in the z-order.

Returns
On success, true, otherwise false.

◆ updateWindow()

void kanzi::win32::Win32Window::updateWindow ( )

Forces the updating of a window by sending the paint request to the window procedure.

If the update region is empty, does not send a message.

◆ destroyWindow()

bool kanzi::win32::Win32Window::destroyWindow ( )

Destroys the window and all its associated data by sending destroy request to the window procedure.

Returns
On success, true, otherwise false.

◆ screenToClient()

bool kanzi::win32::Win32Window::screenToClient ( LPPOINT point) const

Converts the screen coordinates to client-area coordinates for a window.

Parameters
pointThe coordinates to convert.
Returns
On success, true, otherwise false.

◆ clientToScreen()

bool kanzi::win32::Win32Window::clientToScreen ( LPPOINT point) const

Converts the client-area coordinates to screen coordinates for a window.

Parameters
pointThe coordinates to convert.
Returns
On success, true, otherwise false.

◆ getDC()

KZ_NO_DISCARD HDC kanzi::win32::Win32Window::getDC ( ) const
noexcept

Gets the associated device context handle of a window.

Returns
Device context handle.

◆ releaseDC()

bool kanzi::win32::Win32Window::releaseDC ( Win32DeviceContext & deviceContext)
noexcept

Releases the device context handle of a window.

Parameters
deviceContextThe device context to released.
Returns
On success, true, otherwise false.

◆ setWindowLongPtr()

LONG_PTR kanzi::win32::Win32Window::setWindowLongPtr ( int index,
LONG_PTR value )
noexcept

Sets the attribute value of a window.

Parameters
indexThe type of attribute to set.
valueThe attribute value to set.

◆ getWindowLongPtr()

KZ_NO_DISCARD LONG_PTR kanzi::win32::Win32Window::getWindowLongPtr ( int index) const

Gets the attribute value of a window.

Parameters
indexThe type of attribute to get.
Returns
The attribute value of a window.

◆ setTimer()

UINT_PTR kanzi::win32::Win32Window::setTimer ( UINT_PTR id,
unsigned int timeout,
TIMERPROC timerProc )
noexcept

Sets a timer for a window.

Parameters
idTimer ID to be set.
timeoutTime-out value in milliseconds. Clamped by the system-specific minimum and maximum timer values.
timerProcFunction to notify when the timer elapses. If null, sends the timer message to the application message queue.

◆ killTimer()

void kanzi::win32::Win32Window::killTimer ( UINT_PTR id)
noexcept

Destroys the set timer.

Parameters
idTimer ID to destroy.

◆ monitorFromWindow()

HMONITOR kanzi::win32::Win32Window::monitorFromWindow ( unsigned long flags)
noexcept

Gets the display monitor with the largest area of intersection with a window.

Parameters
flagsFlags to use if the window does not intersect with any display monitor.
Returns
The display monitor.

◆ tryRegisterTouchWindow()

bool kanzi::win32::Win32Window::tryRegisterTouchWindow ( const Win32DynamicLibrary & user32Lib)
noexcept

Tries to dynamically register the touch input for a window.

Parameters
user32LibThe library with which to register the window.
Returns
On success, true, otherwise false.

◆ setTouchWindowProperty()

bool kanzi::win32::Win32Window::setTouchWindowProperty ( )
noexcept

Sets the default touch property for a window.

Returns
On success, true, otherwise false.

◆ findWindowZOrder()

KZ_NO_DISCARD unsigned int kanzi::win32::Win32Window::findWindowZOrder ( ) const
noexcept

Finds the z ordering for the active window related to all other windows currently visible.

Returns
The z ordering.

◆ getNativeHandle()

KZ_NO_DISCARD Win32WindowHandle kanzi::win32::Win32Window::getNativeHandle ( ) const
inlinenoexcept

Gets the native window handle.

Returns
The native window handle.

The documentation for this class was generated from the following file: