wx_BGI_Graphics
Classic BGI-compatible graphics API with modern OpenGL extension API
Loading...
Searching...
No Matches
Functions
Hook-Context DDS Functions

Functions safe to call from within user hook callbacks. More...

Collaboration diagram for Hook-Context DDS Functions:

Functions

BGI_API void BGI_CALL wxbgi_hk_dds_deselect (const char *id)
 Removes the DDS object with the given ID from the selection (hook-context safe).
 
BGI_API void BGI_CALL wxbgi_hk_dds_deselect_all (void)
 Clears the entire DDS selection (hook-context safe).
 
BGI_API int BGI_CALL wxbgi_hk_dds_get_selected_count (void)
 Returns the number of currently selected DDS objects (hook-context safe).
 
BGI_API int BGI_CALL wxbgi_hk_dds_get_selected_id (int index, char *outId, int maxLen)
 Copies the ID of the nth selected object into outId (hook-context safe).
 
BGI_API int BGI_CALL wxbgi_hk_dds_is_selected (const char *id)
 Returns 1 if the DDS object with the given ID is selected (hook-context safe).
 
BGI_API int BGI_CALL wxbgi_hk_dds_pick_at (int x, int y, int ctrl)
 Manually runs the DDS pick algorithm at screen position (x, y) and updates selectedObjectIds (hook-context safe).
 
BGI_API void BGI_CALL wxbgi_hk_dds_select (const char *id)
 Adds the DDS object with the given ID to the selection (hook-context safe).
 
BGI_API int BGI_CALL wxbgi_hk_get_mouse_x (void)
 Returns the current mouse X position (hook-context safe).
 
BGI_API int BGI_CALL wxbgi_hk_get_mouse_y (void)
 Returns the current mouse Y position (hook-context safe).
 

Detailed Description

Functions safe to call from within user hook callbacks.

All other wxbgi_* functions acquire gMutex and will deadlock if called from a hook callback (which fires with the mutex already held). The wxbgi_hk_* functions intentionally skip mutex acquisition and are designed specifically for use inside hook callbacks.

Warning
Call wxbgi_hk_* functions only from within a registered WxbgiKeyHook, WxbgiCharHook, WxbgiCursorPosHook, WxbgiMouseButtonHook, or WxbgiScrollHook callback. Calling them from outside a hook (where the mutex is NOT held) introduces a data race.

Function Documentation

◆ wxbgi_hk_dds_deselect()

BGI_API void BGI_CALL wxbgi_hk_dds_deselect ( const char *  id)

Removes the DDS object with the given ID from the selection (hook-context safe).

Has no effect if the object is not selected or id is NULL.

◆ wxbgi_hk_dds_deselect_all()

BGI_API void BGI_CALL wxbgi_hk_dds_deselect_all ( void  )

Clears the entire DDS selection (hook-context safe).

◆ wxbgi_hk_dds_get_selected_count()

BGI_API int BGI_CALL wxbgi_hk_dds_get_selected_count ( void  )

Returns the number of currently selected DDS objects (hook-context safe).

◆ wxbgi_hk_dds_get_selected_id()

BGI_API int BGI_CALL wxbgi_hk_dds_get_selected_id ( int  index,
char *  outId,
int  maxLen 
)

Copies the ID of the nth selected object into outId (hook-context safe).

Parameters
indexZero-based index into the selection list.
outIdBuffer to receive the null-terminated ID string; may be NULL.
maxLenCapacity of outId buffer including the null terminator.
Returns
Length of the full ID string, or -1 if index is out of range.

◆ wxbgi_hk_dds_is_selected()

BGI_API int BGI_CALL wxbgi_hk_dds_is_selected ( const char *  id)

Returns 1 if the DDS object with the given ID is selected (hook-context safe).

Parameters
idObject ID string; may be NULL (returns 0).

◆ wxbgi_hk_dds_pick_at()

BGI_API int BGI_CALL wxbgi_hk_dds_pick_at ( int  x,
int  y,
int  ctrl 
)

Manually runs the DDS pick algorithm at screen position (x, y) and updates selectedObjectIds (hook-context safe).

Equivalent to the left-click pick that WXBGI_DEFAULT_MOUSE_PICK normally triggers. Useful when that default is disabled and you want to implement your own pick logic before calling this.

Parameters
xScreen X in window pixels.
yScreen Y in window pixels.
ctrlNon-zero to toggle (Ctrl+click behaviour); 0 for single select.
Returns
Number of selected objects after the pick.

◆ wxbgi_hk_dds_select()

BGI_API void BGI_CALL wxbgi_hk_dds_select ( const char *  id)

Adds the DDS object with the given ID to the selection (hook-context safe).

Has no effect if the object is already selected or id is NULL.

◆ wxbgi_hk_get_mouse_x()

BGI_API int BGI_CALL wxbgi_hk_get_mouse_x ( void  )

Returns the current mouse X position (hook-context safe).

◆ wxbgi_hk_get_mouse_y()

BGI_API int BGI_CALL wxbgi_hk_get_mouse_y ( void  )

Returns the current mouse Y position (hook-context safe).