Molybden API
Loading...
Searching...
No Matches
molybden::GlobalShortcuts Class Referenceabstract

Allows handling global keyboard shortcuts in the application. More...

#include <global_shortcuts.hpp>

Public Member Functions

virtual bool registerShortcut (const Shortcut &shortcut, std::function< void(const Shortcut &)> handler)=0
 Registers a global shortcut along with a handler function to be executed when the shortcut is activated.
 
virtual void unregisterShortcut (const Shortcut &shortcut)=0
 Unregisters a previously registered shortcut.
 

Detailed Description

Allows handling global keyboard shortcuts in the application.

Provides an interface for registering, unregistering, and checking the status of shortcuts, as well as defining actions to be taken when a shortcut is activated.

Member Function Documentation

◆ registerShortcut()

virtual bool molybden::GlobalShortcuts::registerShortcut ( const Shortcut shortcut,
std::function< void(const Shortcut &)>  handler 
)
pure virtual

Registers a global shortcut along with a handler function to be executed when the shortcut is activated.

When a shortcut with the COMMAND_OR_CTRL modifier is activated, the handler will receive it as COMMAND or CTRL, depending on the platform.

The shortcut registration may fail if the same global shortcut is already registered by any running application or if it's a system-wide shortcut.

Parameters
shortcutthe keyboard shortcut to register.
handlerthe function to be called when the shortcut is activated.
Returns
true if the shortcut has been successfully registered.

◆ unregisterShortcut()

virtual void molybden::GlobalShortcuts::unregisterShortcut ( const Shortcut shortcut)
pure virtual

Unregisters a previously registered shortcut.

If the shortcut has not been registered, or is registered by another process, the method does nothing.

Parameters
shortcutthe keyboard shortcut to unregister.

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