Kanzi  3.9.9
Kanzi Engine C++ API
kanzi::win32 Namespace Reference

Classes

struct  DefaultFiberContext
 Structure that represents the default Win32 fiber context. More...
 
class  DefaultWin32WGLGraphicsOutput
 Class that represents the default Win32 WGL graphics output. More...
 
struct  DefaultWin32WGLGraphicsOutputProperties
 Structure that represents the default Win32 WGL graphics output properties. More...
 
class  WGLContext
 Class that represents the WGL context. More...
 
class  Win32DeviceContext
 Class that represents the Win32 device context. More...
 
class  Win32Display
 Class that represents a Win32 display. More...
 
class  Win32DynamicLibrary
 Class that represents the Win32 dynamic library. More...
 
class  Win32Fiber
 Class that represents the Win32 fiber. More...
 
struct  Win32LParam
 Structure that represents the Win32 LPARAM. More...
 
class  Win32Window
 Class that represents a Win32 window. More...
 
class  Win32WindowClass
 Class that represents the Win32 window class. More...
 
struct  Win32WParam
 Structure that represents the Win32 WPARAM. More...
 

Typedefs

typedef HWND Win32WindowHandle
 Type alias for the native Win32 window handle. More...
 

Functions

bool addMouseDownEvent (EventQueue &queue, PointerButton buttons, int x, int y, HWND hwnd)
 Adds a mouse button pressed down event. More...
 
bool addMouseUpEvent (EventQueue &queue, PointerButton buttons, int x, int y)
 Adds a mouse button released event. More...
 
LRESULT CALLBACK appWindowProcHandler (Win32WindowHandle windowHandle, UINT message, WPARAM wParam, LPARAM lParam)
 Win32 window procedure for receiving messages for the window that was created by the thread. More...
 
bool attachTouchWindow (const Win32DynamicLibrary &user32Lib, Win32Window &window) noexcept
 Tries to dynamically register the touch input for a window. More...
 
bool changeToFullscreenWin32Display (const Win32Display &display)
 Changes window mode of the application to full screen on the given Win32 display. More...
 
bool closeWin32TouchInput (Win32LParam lParam) noexcept
 Closes the touch input handle. More...
 
bool currentMouseMessageIsFromTouch () noexcept
 Predicate for testing whether the current mouse event originated from a touch device. More...
 
bool displayWindow (Win32Window &window) noexcept
 Sets a window to be visible and active on the current display. More...
 
KZ_NO_DISCARD unsigned int findWin32DisplayCount () noexcept
 Finds the number of available active displays. More...
 
string getLastErrorAsString () noexcept
 Gets the last Win32 error as a printable string. More...
 
KZ_NO_DISCARD int getMaximumPixelFormatID (const Win32DeviceContext &deviceContext) noexcept
 Gets the maximum allowable pixel format ID. More...
 
KZ_NO_DISCARD POINT getMousePosition (const Win32Window &window) noexcept
 Gets the mouse position of a window in screen coordinates. More...
 
KZ_NO_DISCARD PointerButton getTriggeredPointerButtonEvent (UINT message, Win32WParam wParam) noexcept
 Gets the triggered Kanzi mouse button from the Win32 mouse button event. More...
 
KZ_NO_DISCARD optional< windowing::PositiongetWin32DisplayOrigin (const Win32Display &display)
 Gets the origin of the Win32 display. More...
 
KZ_NO_DISCARD windowing::SizeU getWin32DisplaySizeU (const Win32Display &display)
 Gets the size of the Win32 display. More...
 
KZ_NO_DISCARD KeyModifier getWin32KeyModifiers (kanzi::LogicalKey key)
 Gets the currently active key modifiers for a logical key. More...
 
KZ_NO_DISCARD MONITORINFO getWin32MonitorInfo (HMONITOR monitor) noexcept
 Gets the information about the Win32 monitor. More...
 
bool getWin32TouchInputInfo (Win32WParam wParam, Win32LParam lParam, TOUCHINPUT &touchInputs) noexcept
 Gets the touch input information. More...
 
unsigned int getWin32TouchPointCount (Win32WParam wParam) noexcept
 Gets the number of input points for a touch. More...
 
KZ_NO_DISCARD int getWindowHeight (const Win32Window &window) noexcept
 Gets the window height in screen coordinates. More...
 
KZ_NO_DISCARD int getWindowPositionX (const Win32Window &window) noexcept
 Gets the window X coordinate in screen coordinates. More...
 
KZ_NO_DISCARD int getWindowPositionY (const Win32Window &window) noexcept
 Gets the window Y coordinate in screen coordinates. More...
 
KZ_NO_DISCARD LONG getWindowStyle (const Win32Window &window) noexcept
 Gets the style flags for a window. More...
 
KZ_NO_DISCARD void * getWindowUserData (const Win32Window &window) noexcept
 Gets the user data of a window. More...
 
KZ_NO_DISCARD int getWindowWidth (const Win32Window &window) noexcept
 Gets the window width in screen coordinates. More...
 
bool hideWindow (Win32Window &window) noexcept
 Makes a window invisible and inactive on the current display. More...
 
void logActiveDisplays () noexcept
 Prints all available active displays. More...
 
void logGraphicsFormats (const Win32DeviceContext &deviceContext) noexcept
 Logs all available graphic formats to the standard output. More...
 
void logGraphicsFormats () noexcept
 Prints all possible graphics formats by ID to log in CSV format. More...
 
bool makeFullscreenWindow (Win32Window &window, windowing::Position windowOrigin, windowing::SizeU windowSize) noexcept
 Sets a window to full-screen on the current display. More...
 
bool makeRegularWindow (Win32Window &window) noexcept
 Sets a window to regular on the current display. More...
 
bool maximizeWindow (Win32Window &window) noexcept
 Maximize a window on the current display. More...
 
bool minimizeWindow (Win32Window &window) noexcept
 Minimize a window to the taskbar and make it inactive on the current display. More...
 
bool moveWindow (Win32Window &window, int positionX, int positionY) noexcept
 Moves a window to a new position. More...
 
void print (const char *format,...) noexcept
 Prints a formatted string to the standard output. More...
 
void WINAPI processFiberMessages (DefaultFiberContext *fiberData)
 Processes the incoming messages on the Win32 message fiber. More...
 
void registerWin32TouchInput (const Win32DynamicLibrary &user32Lib) noexcept
 Dynamically registers touch input. More...
 
bool resizeClientWindowArea (Win32Window &window, int width, int height) noexcept
 Resizes the client-area of a window. More...
 
bool resizeWindow (Win32Window &window, int width, int height) noexcept
 Resizes a window. More...
 
bool setWindowStyle (Win32Window &window, LONG windowStyle) noexcept
 Sets the style flags for a window. More...
 
bool setWindowUserData (Win32Window &window, void *userData) noexcept
 Sets user data for a window. More...
 
void showMessageBox (const char *format,...) noexcept
 Prints a formatted string in a message window. More...
 
bool showWindow (Win32Window &window) noexcept
 Set a window to be visible and active on the current display. More...
 
KZ_NO_DISCARD PointerButton translateWin32ButtonsToKanzi (Win32WParam wParam) noexcept
 Maps the pressed down Win32 mouse buttons to logical mouse buttons used by Kanzi. More...
 
KZ_NO_DISCARD LogicalKey win32KeyToLogicalKey (Win32WParam wParam, Win32LParam lParam)
 Maps the native Win32 key to a logical key used by Kanzi. More...
 

Variables

constexpr auto MaximumWin32TouchPointCount
 The maximum number of touch input points. More...
 

Typedef Documentation

Type alias for the native Win32 window handle.

Since
Kanzi 3.9.7

Function Documentation

LRESULT CALLBACK kanzi::win32::appWindowProcHandler ( Win32WindowHandle  windowHandle,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)

Win32 window procedure for receiving messages for the window that was created by the thread.

Parameters
windowHandleThe window for which to receive the message.
messageType of the message.
wParamMessage-specific parameter. Exact meaning depends on the message code.
lParamMessage-specific parameter. Exact meaning depends on the message code.
Returns
The result of handling the received message.
void kanzi::win32::logGraphicsFormats ( )
noexcept

Prints all possible graphics formats by ID to log in CSV format.

Since
Kanzi 3.9.7
void kanzi::win32::logActiveDisplays ( )
noexcept

Prints all available active displays.

Since
Kanzi 3.9.7
KZ_NO_DISCARD LogicalKey kanzi::win32::win32KeyToLogicalKey ( Win32WParam  wParam,
Win32LParam  lParam 
)

Maps the native Win32 key to a logical key used by Kanzi.

Parameters
wParamExtra data for the input key. The data depends on the key.
lParamExtra data for the input key. The data depends on the key.
Since
Kanzi 3.9.7
KZ_NO_DISCARD KeyModifier kanzi::win32::getWin32KeyModifiers ( kanzi::LogicalKey  key)

Gets the currently active key modifiers for a logical key.

Parameters
keyThe logical key from which to extract the modifiers.
Returns
Currently active key modifiers.
Since
Kanzi 3.9.7
KZ_NO_DISCARD PointerButton kanzi::win32::getTriggeredPointerButtonEvent ( UINT  message,
Win32WParam  wParam 
)
noexcept

Gets the triggered Kanzi mouse button from the Win32 mouse button event.

Parameters
messageThe type of Win32 mouse button event.
wParamThe Win32 button to use for extended buttons.
Returns
Triggered mouse button.
Since
Kanzi 3.9.7
KZ_NO_DISCARD PointerButton kanzi::win32::translateWin32ButtonsToKanzi ( Win32WParam  wParam)
noexcept

Maps the pressed down Win32 mouse buttons to logical mouse buttons used by Kanzi.

Parameters
wParamThe Win32 button to translate.
Returns
Logical mouse buttons.
Since
Kanzi 3.9.7
bool kanzi::win32::currentMouseMessageIsFromTouch ( )
noexcept

Predicate for testing whether the current mouse event originated from a touch device.

Use the predicate in the context when emulated touch input is mixed with real touch input.

Returns
On success, true, otherwise false.
Since
Kanzi 3.9.7
bool kanzi::win32::addMouseDownEvent ( EventQueue queue,
PointerButton  buttons,
int  x,
int  y,
HWND  hwnd 
)

Adds a mouse button pressed down event.

Parameters
queueThe queue to which to add the event.
buttonsThe buttons pressed down for the event.
xX coordinate of the button event. In screen coordinates.
yY coordinate of the button event. In screen coordinates.
hwndThe window that received the mouse button pressed down event.
Since
Kanzi 3.9.7
bool kanzi::win32::addMouseUpEvent ( EventQueue queue,
PointerButton  buttons,
int  x,
int  y 
)

Adds a mouse button released event.

Parameters
queueThe queue to which to add the event.
buttonsThe buttons released for the event.
xX coordinate of the button event. In screen coordinates.
yY coordinate of the button event. In screen coordinates.
Since
Kanzi 3.9.7
unsigned int kanzi::win32::getWin32TouchPointCount ( Win32WParam  wParam)
noexcept

Gets the number of input points for a touch.

Parameters
wParamWin32 parameter from which to extract the number of input points.
Returns
The number of input points for a touch.
Since
Kanzi 3.9.7
void kanzi::win32::registerWin32TouchInput ( const Win32DynamicLibrary user32Lib)
noexcept

Dynamically registers touch input.

Parameters
user32LibThe library with which to register the touch input.
Since
Kanzi 3.9.7
bool kanzi::win32::getWin32TouchInputInfo ( Win32WParam  wParam,
Win32LParam  lParam,
TOUCHINPUT &  touchInputs 
)
noexcept

Gets the touch input information.

Parameters
wParamWin32 parameter from which to extract the touch input information.
lParamWin32 parameter from which to extract the touch input information.
touchInputsTouch input that receives the information.
Returns
On success, true. On failure, false.
Since
Kanzi 3.9.7
bool kanzi::win32::closeWin32TouchInput ( Win32LParam  lParam)
noexcept

Closes the touch input handle.

Parameters
lParamWin32 parameter from which to extract the touch input handle to close.
Returns
On success, true. On failure, false.
Since
Kanzi 3.9.7
void WINAPI kanzi::win32::processFiberMessages ( DefaultFiberContext fiberData)

Processes the incoming messages on the Win32 message fiber.

Since
Kanzi 3.9.7
string kanzi::win32::getLastErrorAsString ( )
noexcept

Gets the last Win32 error as a printable string.

Returns
The error string.
Since
Kanzi 3.9.7
void kanzi::win32::print ( const char *  format,
  ... 
)
noexcept

Prints a formatted string to the standard output.

Parameters
formatThe format string.
...The list of parameters to print. The parameters can be empty.
Since
Kanzi 3.9.7
void kanzi::win32::showMessageBox ( const char *  format,
  ... 
)
noexcept

Prints a formatted string in a message window.

Parameters
formatThe format string.
...The list of parameters to print. The parameters can be empty.
Since
Kanzi 3.9.7
void kanzi::win32::logGraphicsFormats ( const Win32DeviceContext deviceContext)
noexcept

Logs all available graphic formats to the standard output.

Parameters
deviceContextThe device context for which to log the graphics formats.
KZ_NO_DISCARD int kanzi::win32::getMaximumPixelFormatID ( const Win32DeviceContext deviceContext)
noexcept

Gets the maximum allowable pixel format ID.

Parameters
deviceContextThe device context for which to get the maximum allowable pixel format ID for.
Returns
On success, maximum pixel format index, otherwise 0.
KZ_NO_DISCARD unsigned int kanzi::win32::findWin32DisplayCount ( )
noexcept

Finds the number of available active displays.

Returns
The number of available active displays.
bool kanzi::win32::changeToFullscreenWin32Display ( const Win32Display display)

Changes window mode of the application to full screen on the given Win32 display.

Parameters
displayThe display to which to change the window mode to full screen.
Returns
On success, true, otherwise false.
KZ_NO_DISCARD windowing::SizeU kanzi::win32::getWin32DisplaySizeU ( const Win32Display display)

Gets the size of the Win32 display.

Parameters
displayThe display for which to get the size.
Returns
The display size. On error, width and height of the display are both 0.
KZ_NO_DISCARD optional<windowing::Position> kanzi::win32::getWin32DisplayOrigin ( const Win32Display display)

Gets the origin of the Win32 display.

Parameters
displayThe display for which to get the origin.
Return values
nulloptGetting the origin failed.
Returns
The display origin.
KZ_NO_DISCARD MONITORINFO kanzi::win32::getWin32MonitorInfo ( HMONITOR  monitor)
noexcept

Gets the information about the Win32 monitor.

Parameters
monitorThe monitor for which to get the information.
Returns
The Win32 monitor information.
Since
Kanzi 3.9.7
bool kanzi::win32::resizeClientWindowArea ( Win32Window window,
int  width,
int  height 
)
noexcept

Resizes the client-area of a window.

Parameters
windowWindow whose client-area to resize.
widthWidth to which to resize.
heightHeight to which to resize.
Returns
On success, true, otherwise false.
bool kanzi::win32::resizeWindow ( Win32Window window,
int  width,
int  height 
)
noexcept

Resizes a window.

Parameters
windowWindow to resize.
widthWidth to which to resize.
heightHeight to which to resize.
Returns
On success, true, otherwise false.
bool kanzi::win32::moveWindow ( Win32Window window,
int  positionX,
int  positionY 
)
noexcept

Moves a window to a new position.

Parameters
windowWindow to move.
positionXThe horizontal position of the top-left corner of the window in screen coordinates.
positionYThe vertical position of the top-left corner of the window in screen coordinates.
Returns
On success, true, otherwise false.
bool kanzi::win32::makeFullscreenWindow ( Win32Window window,
windowing::Position  windowOrigin,
windowing::SizeU  windowSize 
)
noexcept

Sets a window to full-screen on the current display.

Parameters
windowWindow to set to full-screen.
windowOriginWindow origin in pixels.
windowSizeWindow size in pixels.
Returns
On success, true, otherwise false.
bool kanzi::win32::makeRegularWindow ( Win32Window window)
noexcept

Sets a window to regular on the current display.

Parameters
windowWindow to set to regular.
Returns
On success, true, otherwise false.
bool kanzi::win32::displayWindow ( Win32Window window)
noexcept

Sets a window to be visible and active on the current display.

If the window is minimized or maximized, restores the original size and position of the window.

Parameters
windowWindow to display.
Returns
On success, true, otherwise false.
bool kanzi::win32::showWindow ( Win32Window window)
noexcept

Set a window to be visible and active on the current display.

Parameters
windowWindow to show.
Returns
On success, true, otherwise false.
bool kanzi::win32::hideWindow ( Win32Window window)
noexcept

Makes a window invisible and inactive on the current display.

Parameters
windowWindow to hide.
Returns
On success, true, otherwise false.
bool kanzi::win32::maximizeWindow ( Win32Window window)
noexcept

Maximize a window on the current display.

Parameters
windowWindow to maximize.
Returns
On success, true, otherwise false.
bool kanzi::win32::minimizeWindow ( Win32Window window)
noexcept

Minimize a window to the taskbar and make it inactive on the current display.

Parameters
windowWindow to minimize.
Returns
On success, true, otherwise false.
KZ_NO_DISCARD int kanzi::win32::getWindowWidth ( const Win32Window window)
noexcept

Gets the window width in screen coordinates.

Parameters
windowWindow for which to retrieve the width.
Returns
The window width.
KZ_NO_DISCARD int kanzi::win32::getWindowHeight ( const Win32Window window)
noexcept

Gets the window height in screen coordinates.

Parameters
windowWindow for which to retrieve the height.
Returns
The window height.
KZ_NO_DISCARD int kanzi::win32::getWindowPositionX ( const Win32Window window)
noexcept

Gets the window X coordinate in screen coordinates.

Parameters
windowWindow for which to retrieve the X coordinate.
Returns
The X coordinate of the window.
KZ_NO_DISCARD int kanzi::win32::getWindowPositionY ( const Win32Window window)
noexcept

Gets the window Y coordinate in screen coordinates.

Parameters
windowWindow for which to retrieve the Y coordinate.
Returns
The Y coordinate of the window.
bool kanzi::win32::setWindowUserData ( Win32Window window,
void *  userData 
)
noexcept

Sets user data for a window.

Parameters
windowWindow for which to set the user data.
userDataUser data to set.
Returns
On success, true, otherwise false.
KZ_NO_DISCARD void* kanzi::win32::getWindowUserData ( const Win32Window window)
noexcept

Gets the user data of a window.

Parameters
windowWindow for which to get the user data.
Returns
The user data of the window.
bool kanzi::win32::setWindowStyle ( Win32Window window,
LONG  windowStyle 
)
noexcept

Sets the style flags for a window.

Parameters
windowWindow for which to set the style flags.
windowStyleThe style flags to set.
Returns
On success, true, otherwise false.
KZ_NO_DISCARD LONG kanzi::win32::getWindowStyle ( const Win32Window window)
noexcept

Gets the style flags for a window.

Parameters
windowWindow for which to get the style flags.
Returns
The style flags of the window.
KZ_NO_DISCARD POINT kanzi::win32::getMousePosition ( const Win32Window window)
noexcept

Gets the mouse position of a window in screen coordinates.

Returns
The mouse position of a window in screen coordinates.
bool kanzi::win32::attachTouchWindow ( const Win32DynamicLibrary user32Lib,
Win32Window window 
)
noexcept

Tries to dynamically register the touch input for a window.

Parameters
user32LibLibrary with which to register the window.
windowWindow for which to register the touch input.
Returns
On success, true, otherwise false.

Variable Documentation

constexpr auto kanzi::win32::MaximumWin32TouchPointCount

The maximum number of touch input points.

Since
Kanzi 3.9.7