NDEVR
API Documentation
BasicKeyControllerabstract

Assigns actions to key presses and registers them as a program-wide service. More...

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

Public Member Functions

 BasicKeyController (const TranslatedString &key_controller_title)
 Constructs a BasicKeyController with the given title.
virtual void addKeyOption (const KeyOption &option)
 Adds a new key option mapping to this controller.
const Buffer< KeyOption > & currentKeyMaps () const
 Returns the current set of key option mappings.
virtual void getINI (INIFactory &factory) override
 Serializes or deserializes key controller settings to/from an INI file.
const TranslatedStringkeyControllerTitle () const
 Returns the display title of this key controller.
bool processKeyEvent (const KeyEvent &key_event, DesignObjectLookup *lookup, Camera *camera) final override
 Processes a key event by matching it against registered key options.
virtual bool processKeyEvent (const StringView &id, const KeyEvent &key_event, DesignObjectLookup *lookup, Camera *camera)=0
 Processes a key event identified by its string ID.
virtual void resetKeyControllerToDefaults ()=0
 Resets all key mappings to their default values.
virtual void setKeyOption (const KeyOption &option)
 Sets or updates an existing key option mapping.
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.

Protected Attributes

TranslatedString m_key_controller_title
 The display title for this key controller.
Buffer< KeyOptionm_key_options
 The collection of registered key option mappings.
bool m_save_ini_on_change_key_option_change = false
 Whether to automatically save INI settings when a key option changes.
Protected Attributes inherited from INIInterface
File m_default_ini
 The default file path used for reading and writing INI options.

Detailed Description

Assigns actions to key presses and registers them as a program-wide service.


Definition at line 77 of file KeyController.h.

Constructor & Destructor Documentation

◆ BasicKeyController()

BasicKeyController::BasicKeyController ( const TranslatedString & key_controller_title)

Constructs a BasicKeyController with the given title.

Parameters
[in]key_controller_titleThe display title for this key controller.

Member Function Documentation

◆ addKeyOption()

virtual void BasicKeyController::addKeyOption ( const KeyOption & option)
virtual

Adds a new key option mapping to this controller.

Parameters
[in]optionThe key option to add.

◆ currentKeyMaps()

const Buffer< KeyOption > & BasicKeyController::currentKeyMaps ( ) const
inline

Returns the current set of key option mappings.

Returns
A reference to the buffer of KeyOption entries.

Definition at line 115 of file KeyController.h.

References m_key_options.

◆ getINI()

virtual void BasicKeyController::getINI ( INIFactory & factory)
overridevirtual

Serializes or deserializes key controller settings to/from an INI file.

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

Implements INIInterface.

◆ keyControllerTitle()

const TranslatedString & BasicKeyController::keyControllerTitle ( ) const
inline

Returns the display title of this key controller.

Returns
A reference to the translated title string.

Definition at line 110 of file KeyController.h.

References m_key_controller_title.

◆ processKeyEvent() [1/2]

bool BasicKeyController::processKeyEvent ( const KeyEvent & key_event,
DesignObjectLookup * lookup,
Camera * camera )
finaloverridevirtual

Processes a key event by matching it against registered key options.

Parameters
[in]key_eventThe key event to process.
[in]lookupThe design object lookup context.
[in]cameraThe active camera context.
Returns
True if the key event was handled, false otherwise.

Implements KeyControllerBase.

◆ processKeyEvent() [2/2]

virtual bool BasicKeyController::processKeyEvent ( const StringView & id,
const KeyEvent & key_event,
DesignObjectLookup * lookup,
Camera * camera )
pure virtual

Processes a key event identified by its string ID.

Subclasses implement specific behavior.

Parameters
[in]idThe string identifier of the key option that matched.
[in]key_eventThe key event to process.
[in]lookupThe design object lookup context.
[in]cameraThe active camera context.
Returns
True if the key event was handled, false otherwise.

Implemented in NDEVRRibbon, PointScannerKeyController, QCustomMessageBox, and SelectionWidget.

◆ resetKeyControllerToDefaults()

virtual void BasicKeyController::resetKeyControllerToDefaults ( )
pure virtual

Resets all key mappings to their default values.

Subclasses must implement this.

Implemented in NDEVRRibbon, PointScannerKeyController, QCustomMessageBox, and SelectionWidget.

◆ setKeyOption()

virtual void BasicKeyController::setKeyOption ( const KeyOption & option)
virtual

Sets or updates an existing key option mapping.

Parameters
[in]optionThe key option to set.

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