NDEVR
API Documentation
MouseControllerfinal

Contains logic for executing actions based on user mouse inputs. More...

Inheritance diagram for MouseController:
[legend]
Collaboration diagram for MouseController:
[legend]

Classes

class  MouseActions
 Holds the configurable action bindings and settings for a single mouse button. More...

Public Types

enum  MouseAction : uint01 {
  e_ignore , e_select , e_inv_select , e_orbit ,
  e_pan , e_look_around , e_zoom , e_inv_zoom ,
  e_context_menu , e_command
}
 Defines the possible actions that can be bound to a mouse button interaction. More...
enum  MouseSelectionMode {
  e_select_model , e_select_model_base , e_select_material , e_select_geometry ,
  e_select_bone
}
 Defines which type of design object is targeted during mouse selection. More...
enum  ReferencePoint : uint01 { e_map_center , e_mouse_center , e_screen_center }
 Defines the reference point used for camera operations such as orbit and zoom. More...

Public Member Functions

 MouseController ()
 Constructs a MouseController with default settings.
virtual ~MouseController ()
 Destructor.
void addController (UUID id, MouseControllerBase *controller)
 Registers a mouse sub-controller with a given identifier.
bool contextMenuRequested () const
 Checks whether a context menu has been requested by a recent mouse event.
MouseAction getAction (const MouseEvent &event) const
 Determines the action to perform for a given mouse event based on current bindings.
MouseActionsgetDefaultAction (MouseEvent::MouseClickType type)
 Gets the mutable MouseActions for a given mouse click type.
const MouseActionsgetDefaultAction (MouseEvent::MouseClickType type) const
 Gets the const MouseActions for a given mouse click type.
const MouseEventlastMouseEvent () const
 Returns the last mouse event that was processed.
bool processMouseEvent (MouseControllerEvent &event, SelectionInfo &info) override
 Processes a mouse event, delegating to registered sub-controllers and handling camera manipulation, selection, and context menu requests.
void removeController (UUID id)
 Removes a previously registered mouse sub-controller.
void resetContextMenuRequested ()
 Resets the context menu request flag to false.
void resetSelectionRequested ()
 Resets the selection request flag to false.
bool selectionRequested () const
 Checks whether a selection has been requested by a recent mouse event.
void setNDEVRDefaults ()
 Resets all mouse action bindings to the NDEVR default configuration.
Public Member Functions inherited from INIInterface
 INIInterface ()
 Constructs an INIInterface with no default INI file.
 INIInterface (const File &default_ini)
 Constructs an INIInterface with the specified default INI file.
virtual ~INIInterface ()
 Virtual destructor for safe polymorphic cleanup.
virtual void finishReadingINI (INIFactory &)
 Called after reading an INI file.
virtual void prepareForINI (INIFactory &)
 Called before reading or writing an INI file.
virtual bool readINIOptions ()
 Reads INI options from the default INI file.
virtual bool readINIOptions (File &ini_file)
 Reads INI options from the specified INI file.
virtual bool saveINIOptions (bool multithead=false)
 Saves INI options to the default INI file.
virtual bool saveINIOptions (File &ini_file, bool multithead=false)
 Saves INI options to the specified INI file.
void setDefaultINIFile (const File &file)
 Sets the default INI file path used for reading and writing options.
virtual void writeToLog (const StringView &title, LogPtr log, uint01 log_level=2U)
 Writes the current INI options to the specified log with a title.
virtual void writeToLog (LogPtr log, uint01 log_level=2U)
 Writes the current INI options to the specified log.

Public Attributes

MouseActions center_mouse_action
 Action bindings for the center (middle) mouse button.
Resource< Stringcursor
 The current cursor icon name.
Resource< UUIDfocus
 The UUID of the currently focused object.
Resource< Stringinformation
 Informational text associated with current mouse state.
MouseActions left_mouse_action
 Action bindings for the left mouse button.
Resource< uint04number_of_mouse_clicks
 Counter for total mouse clicks processed.
Resource< uint04number_of_mouse_events
 Counter for total mouse events processed.
MouseActions right_mouse_action
 Action bindings for the right mouse button.
Resource< Buffer< UUID > > selected
 The currently selected object UUIDs.
Resource< UUIDselected_layer
 The UUID of the currently selected layer.
MouseActions wheel_mouse_action
 Action bindings for the mouse wheel.

Protected Attributes

Dictionary< UUID, MouseControllerBase * > m_controller_lookup
 Maps controller UUIDs to their instances.
Buffer< MouseControllerBase * > m_controllers
 Ordered list of registered sub-controllers.
bool m_ignore_next_event_if_click
 If true, the next click event will be ignored.
bool m_request_context_menu
 Flag indicating a context menu has been requested.
bool m_request_selection
 Flag indicating a selection has been requested.
DynamicPointer< SnapControllerm_snap_controller
 Pointer to the snap controller for snapping behavior.
Protected Attributes inherited from INIInterface
File m_default_ini
 The default file path used for reading and writing INI options.

Private Member Functions

void getINI (INIFactory &factory) override
 Serializes and deserializes mouse controller settings to/from INI configuration.

Detailed Description

Contains logic for executing actions based on user mouse inputs.


Manages mouse button bindings, camera manipulation (orbit, pan, zoom), selection, context menus, and delegates to registered sub-controllers. Persists settings via INIInterface.

See also
MouseEvent, KeyController, SelectionController, Camera

Definition at line 88 of file MouseController.h.

Member Enumeration Documentation

◆ MouseAction

Defines the possible actions that can be bound to a mouse button interaction.


Enumerator
e_ignore 

No action; the mouse input is ignored.

e_select 

Select the object under the cursor.

e_inv_select 

Inverted selection (deselect or toggle selection).

e_orbit 

Orbit the camera around the reference point.

e_pan 

Pan the camera in the view plane.

e_look_around 

Rotate the camera view direction (first-person look).

e_zoom 

Zoom the camera toward the reference point.

e_inv_zoom 

Zoom the camera away from the reference point (inverted zoom).

e_context_menu 

Show a context menu.

e_command 

Execute a custom command.

Definition at line 103 of file MouseController.h.

◆ MouseSelectionMode

Defines which type of design object is targeted during mouse selection.


Enumerator
e_select_model 

Select whole models.

e_select_model_base 

Select model base objects.

e_select_material 

Select materials.

e_select_geometry 

Select individual geometry.

e_select_bone 

Select bone/skeleton elements.

Definition at line 120 of file MouseController.h.

◆ ReferencePoint

Defines the reference point used for camera operations such as orbit and zoom.


Enumerator
e_map_center 

Use the center of the map as the reference point.

e_mouse_center 

Use the current mouse position as the reference point.

e_screen_center 

Use the center of the screen as the reference point.

Definition at line 94 of file MouseController.h.

Constructor & Destructor Documentation

◆ MouseController()

MouseController::MouseController ( )

Constructs a MouseController with default settings.


◆ ~MouseController()

virtual MouseController::~MouseController ( )
virtual

Destructor.


Member Function Documentation

◆ addController()

void MouseController::addController ( UUID id,
MouseControllerBase * controller )

Registers a mouse sub-controller with a given identifier.


Parameters
[in]idThe unique identifier for the controller.
[in]controllerPointer to the MouseControllerBase to register.

◆ contextMenuRequested()

bool MouseController::contextMenuRequested ( ) const
inline

Checks whether a context menu has been requested by a recent mouse event.


Returns
True if a context menu was requested.

Definition at line 216 of file MouseController.h.

References m_request_context_menu.

◆ getAction()

MouseAction MouseController::getAction ( const MouseEvent & event) const

Determines the action to perform for a given mouse event based on current bindings.


Parameters
[in]eventThe mouse event to evaluate.
Returns
The MouseAction that should be executed for the given event.

◆ getDefaultAction() [1/2]

MouseActions & MouseController::getDefaultAction ( MouseEvent::MouseClickType type)

Gets the mutable MouseActions for a given mouse click type.


Parameters
[in]typeThe mouse click type (left, right, center, etc.).
Returns
A reference to the MouseActions for the specified click type.

◆ getDefaultAction() [2/2]

const MouseActions & MouseController::getDefaultAction ( MouseEvent::MouseClickType type) const

Gets the const MouseActions for a given mouse click type.


Parameters
[in]typeThe mouse click type (left, right, center, etc.).
Returns
A const reference to the MouseActions for the specified click type.

◆ getINI()

void MouseController::getINI ( INIFactory & factory)
overrideprivatevirtual

Serializes and deserializes mouse controller settings to/from INI configuration.


Parameters
[in]factoryThe INI factory used for reading or writing settings.

Implements INIInterface.

◆ lastMouseEvent()

const MouseEvent & MouseController::lastMouseEvent ( ) const
inline

Returns the last mouse event that was processed.


Returns
A const reference to the most recent MouseEvent.

Definition at line 234 of file MouseController.h.

◆ processMouseEvent()

bool MouseController::processMouseEvent ( MouseControllerEvent & event,
SelectionInfo & info )
overridevirtual

Processes a mouse event, delegating to registered sub-controllers and handling camera manipulation, selection, and context menu requests.


Parameters
[in]eventThe mouse controller event to process.
[in]infoThe selection info to update.
Returns
True if the event was consumed, false otherwise.

Implements MouseControllerBase.

◆ removeController()

void MouseController::removeController ( UUID id)

Removes a previously registered mouse sub-controller.


Parameters
[in]idThe unique identifier of the controller to remove.

◆ resetContextMenuRequested()

void MouseController::resetContextMenuRequested ( )
inline

Resets the context menu request flag to false.


Definition at line 220 of file MouseController.h.

References m_request_context_menu.

◆ resetSelectionRequested()

void MouseController::resetSelectionRequested ( )
inline

Resets the selection request flag to false.


Definition at line 229 of file MouseController.h.

References m_request_selection.

◆ selectionRequested()

bool MouseController::selectionRequested ( ) const
inline

Checks whether a selection has been requested by a recent mouse event.


Returns
True if a selection was requested.

Definition at line 225 of file MouseController.h.

References m_request_selection.

◆ setNDEVRDefaults()

void MouseController::setNDEVRDefaults ( )

Resets all mouse action bindings to the NDEVR default configuration.



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