KiCad PCB EDA Suite
Loading...
Searching...
No Matches
PSEUDO_ACTION Class Reference
Inheritance diagram for PSEUDO_ACTION:
TOOL_ACTION

Public Member Functions

 PSEUDO_ACTION (const wxString &aLabel, int aHotKey, int aHotKeyAlt=0)
 
bool operator== (const TOOL_ACTION &aRhs) const
 
bool operator!= (const TOOL_ACTION &aRhs) const
 
const std::string & GetName () const
 Return name of the action.
 
int GetDefaultHotKey () const
 Return the default hotkey (if any) for the action.
 
int GetDefaultHotKeyAlt () const
 
int GetHotKey () const
 Return the hotkey keycode which initiates the action.
 
int GetHotKeyAlt () const
 
void SetHotKey (int aKeycode, int aKeycodeAlt=0)
 
int GetId () const
 Return the unique id of the TOOL_ACTION object.
 
bool HasCustomUIId () const
 Return true if this action has a custom UI ID set.
 
int GetUIId () const
 Get the unique ID for this action in the user interface system.
 
TOOL_EVENT MakeEvent () const
 Return the event associated with the action (i.e.
 
wxString GetMenuLabel () const
 Return the translated label for the action.
 
wxString GetMenuItem () const
 
wxString GetTooltip (bool aIncludeHotkey=true) const
 
wxString GetButtonTooltip () const
 
wxString GetDescription () const
 
wxString GetFriendlyName () const
 Return the translated user-friendly name of the action.
 
TOOL_ACTION_SCOPE GetScope () const
 
template<typename T>
T GetParam () const
 Return a non-standard parameter assigned to the action.
 
const std::optional< TOOL_ACTION_GROUPGetActionGroup () const
 
std::string GetToolName () const
 Return name of the tool associated with the action.
 
bool IsActivation () const
 Return true if the action is intended to activate a tool.
 
bool IsNotification () const
 Return true if the action is a notification.
 
BITMAPS GetIcon () const
 Return an icon associated with the action.
 
bool CheckToolbarState (TOOLBAR_STATE aState) const
 Check if a specific toolbar state is required for this action.
 

Static Public Member Functions

static int GetBaseUIId ()
 Get the base value used to offset the user interface IDs for the actions.
 

Protected Attributes

std::string m_name
 Name of the action (convention is "app.tool.actionName")
 
TOOL_ACTION_SCOPE m_scope
 
std::optional< TOOL_ACTION_GROUPm_group
 Optional group for the action to belong to.
 
const int m_defaultHotKey
 Default hot key.
 
const int m_defaultHotKeyAlt
 Default hot key alternate.
 
int m_hotKey
 The current hotkey (post-user-settings-application).
 
int m_hotKeyAlt
 The alternate hotkey (post-user-settings-application).
 
const std::string m_legacyName
 Name for reading legacy hotkey settings.
 
wxString m_friendlyName
 User-friendly name.
 
std::optional< wxString > m_menuLabel
 Menu label.
 
wxString m_tooltip
 User facing tooltip help text.
 
std::optional< wxString > m_description
 Description of the action.
 
std::optional< BITMAPSm_icon
 Icon for the menu entry.
 
int m_id
 Unique ID for maps. Assigned by ACTION_MANAGER.
 
std::optional< int > m_uiid
 ID to use when interacting with the UI (if empty, generate one).
 
TOOLBAR_STATE_FLAGS m_toolbarState
 Toolbar state behavior for the action.
 
TOOL_ACTION_FLAGS m_flags
 
ki::any m_param
 Generic parameter.
 

Static Protected Attributes

static constexpr int ACTION_BASE_UI_ID = 20000
 Base ID to use inside the user interface system to offset the action IDs.
 

Detailed Description

Definition at line 32 of file hotkey_store.cpp.

Constructor & Destructor Documentation

◆ PSEUDO_ACTION()

PSEUDO_ACTION::PSEUDO_ACTION ( const wxString & aLabel,
int aHotKey,
int aHotKeyAlt = 0 )
inline

Member Function Documentation

◆ CheckToolbarState()

bool TOOL_ACTION::CheckToolbarState ( TOOLBAR_STATE aState) const
inlineinherited

Check if a specific toolbar state is required for this action.

Parameters
aStateThe state (from TOOLBAR_STATE enum) to check
Returns
true if the state should be used for this action

Definition at line 473 of file tool_action.h.

References m_toolbarState.

Referenced by ACTION_TOOLBAR::Add().

◆ GetActionGroup()

const std::optional< TOOL_ACTION_GROUP > TOOL_ACTION::GetActionGroup ( ) const
inlineinherited

Definition at line 429 of file tool_action.h.

References m_group.

◆ GetBaseUIId()

static int TOOL_ACTION::GetBaseUIId ( )
inlinestaticinherited

Get the base value used to offset the user interface IDs for the actions.

Definition at line 379 of file tool_action.h.

References ACTION_BASE_UI_ID.

Referenced by ACTION_GROUP::GetUIId(), ACTION_MANAGER::IsActionUIId(), and ACTION_TOOLBAR::onToolEvent().

◆ GetButtonTooltip()

wxString TOOL_ACTION::GetButtonTooltip ( ) const
inherited

◆ GetDefaultHotKey()

int TOOL_ACTION::GetDefaultHotKey ( ) const
inlineinherited

Return the default hotkey (if any) for the action.

Definition at line 342 of file tool_action.h.

References m_defaultHotKey.

Referenced by BOOST_AUTO_TEST_CASE().

◆ GetDefaultHotKeyAlt()

int TOOL_ACTION::GetDefaultHotKeyAlt ( ) const
inlineinherited

Definition at line 343 of file tool_action.h.

References m_defaultHotKeyAlt.

◆ GetDescription()

◆ GetFriendlyName()

wxString TOOL_ACTION::GetFriendlyName ( ) const
inherited

◆ GetHotKey()

int TOOL_ACTION::GetHotKey ( ) const
inlineinherited

◆ GetHotKeyAlt()

int TOOL_ACTION::GetHotKeyAlt ( ) const
inlineinherited

Definition at line 349 of file tool_action.h.

References m_hotKeyAlt.

Referenced by ACTION_MANAGER::UpdateHotKeys().

◆ GetIcon()

◆ GetId()

int TOOL_ACTION::GetId ( ) const
inlineinherited

Return the unique id of the TOOL_ACTION object.

It is valid only after registering the TOOL_ACTION by ACTION_MANAGER.

Returns
The unique identification number. If the number is negative, then it is not valid.

Definition at line 359 of file tool_action.h.

References m_id.

Referenced by CONDITIONAL_MENU::AddCheckItem(), CONDITIONAL_MENU::AddItem(), ACTION_MANAGER::GetCondition(), ACTION_MANAGER::GetHotKey(), ACTION_MANAGER::SetConditions(), and ACTION_MANAGER::UpdateHotKeys().

◆ GetMenuItem()

wxString TOOL_ACTION::GetMenuItem ( ) const
inherited

Definition at line 165 of file tool_action.cpp.

References AddHotkeyName(), GetMenuLabel(), IS_HOTKEY, and m_hotKey.

Referenced by ACTION_MENU::Add().

◆ GetMenuLabel()

◆ GetName()

◆ GetParam()

template<typename T>
T TOOL_ACTION::GetParam ( ) const
inlineinherited

Return a non-standard parameter assigned to the action.

Definition at line 407 of file tool_action.h.

References ki::any_cast(), m_param, name, and T.

◆ GetScope()

TOOL_ACTION_SCOPE TOOL_ACTION::GetScope ( ) const
inlineinherited

Definition at line 401 of file tool_action.h.

References m_scope.

Referenced by HOTKEY_STORE::CheckKeyConflicts().

◆ GetToolName()

std::string TOOL_ACTION::GetToolName ( ) const
inherited

Return name of the tool associated with the action.

It is basically the action name stripped of the last part (e.g. for "pcbnew.InteractiveDrawing.drawCircle" it is "pcbnew.InteractiveDrawing").

Definition at line 216 of file tool_action.cpp.

References m_name.

Referenced by HOTKEY_STORE::CheckKeyConflicts(), NL_3D_VIEWER_PLUGIN_IMPL::exportCommandsAndImages(), NL_FOOTPRINT_PROPERTIES_PLUGIN_IMPL::exportCommandsAndImages(), NL_PCBNEW_PLUGIN_IMPL::exportCommandsAndImages(), and NL_SCHEMATIC_PLUGIN_IMPL::exportCommandsAndImages().

◆ GetTooltip()

wxString TOOL_ACTION::GetTooltip ( bool aIncludeHotkey = true) const
inherited

◆ GetUIId()

int TOOL_ACTION::GetUIId ( ) const
inlineinherited

Get the unique ID for this action in the user interface system.

This can be either set to a specific ID during creation or computed by offsetting the action ID by ACTION_BASE_UI_ID.

Returns
The unique ID number for use in the user interface system.

Definition at line 374 of file tool_action.h.

References ACTION_BASE_UI_ID, m_id, and m_uiid.

Referenced by ACTION_MENU::Add(), ACTION_TOOLBAR::Add(), ACTION_TOOLBAR_PALETTE::AddAction(), ACTION_TOOLBAR::AddButton(), ACTION_TOOLBAR::AddToolContextMenu(), ACTION_TOOLBAR_PALETTE::CheckAction(), ACTION_TOOLBAR_PALETTE::EnableAction(), ACTION_TOOLBAR::popupPalette(), ACTION_MANAGER::RegisterAction(), TOOLS_HOLDER::RegisterUIUpdateHandler(), ACTION_TOOLBAR::SetToolBitmap(), ACTION_TOOLBAR::Toggle(), ACTION_TOOLBAR::Toggle(), and TOOLS_HOLDER::UnregisterUIUpdateHandler().

◆ HasCustomUIId()

bool TOOL_ACTION::HasCustomUIId ( ) const
inlineinherited

Return true if this action has a custom UI ID set.

Definition at line 364 of file tool_action.h.

References m_uiid.

Referenced by ACTION_MANAGER::RegisterAction().

◆ IsActivation()

bool TOOL_ACTION::IsActivation ( ) const
inlineinherited

Return true if the action is intended to activate a tool.

Definition at line 441 of file tool_action.h.

References AF_ACTIVATE, and m_flags.

Referenced by MakeEvent().

◆ IsNotification()

bool TOOL_ACTION::IsNotification ( ) const
inlineinherited

Return true if the action is a notification.

Definition at line 449 of file tool_action.h.

References AF_NOTIFY, and m_flags.

Referenced by MakeEvent().

◆ MakeEvent()

TOOL_EVENT TOOL_ACTION::MakeEvent ( ) const
inherited

◆ operator!=()

bool TOOL_ACTION::operator!= ( const TOOL_ACTION & aRhs) const
inlineinherited

Definition at line 324 of file tool_action.h.

References m_id, and TOOL_ACTION().

◆ operator==()

bool TOOL_ACTION::operator== ( const TOOL_ACTION & aRhs) const
inlineinherited

Definition at line 319 of file tool_action.h.

References m_id, and TOOL_ACTION().

◆ SetHotKey()

void TOOL_ACTION::SetHotKey ( int aKeycode,
int aKeycodeAlt = 0 )
inherited

Member Data Documentation

◆ ACTION_BASE_UI_ID

int TOOL_ACTION::ACTION_BASE_UI_ID = 20000
staticconstexprprotectedinherited

Base ID to use inside the user interface system to offset the action IDs.

Definition at line 485 of file tool_action.h.

Referenced by GetBaseUIId(), and GetUIId().

◆ m_defaultHotKey

const int TOOL_ACTION::m_defaultHotKey
protectedinherited

Default hot key.

Definition at line 493 of file tool_action.h.

Referenced by GetDefaultHotKey(), ACTION_MANAGER::processHotKey(), TOOL_ACTION(), TOOL_ACTION(), and TOOL_ACTION().

◆ m_defaultHotKeyAlt

const int TOOL_ACTION::m_defaultHotKeyAlt
protectedinherited

Default hot key alternate.

Definition at line 494 of file tool_action.h.

Referenced by GetDefaultHotKeyAlt(), TOOL_ACTION(), TOOL_ACTION(), and TOOL_ACTION().

◆ m_description

std::optional<wxString> TOOL_ACTION::m_description
protectedinherited

Description of the action.

Definition at line 504 of file tool_action.h.

Referenced by GetDescription(), and TOOL_ACTION().

◆ m_flags

TOOL_ACTION_FLAGS TOOL_ACTION::m_flags
protectedinherited

Definition at line 513 of file tool_action.h.

Referenced by IsActivation(), IsNotification(), TOOL_ACTION(), TOOL_ACTION(), and TOOL_ACTION().

◆ m_friendlyName

wxString TOOL_ACTION::m_friendlyName
protectedinherited

User-friendly name.

Definition at line 501 of file tool_action.h.

Referenced by GetFriendlyName(), PSEUDO_ACTION::PSEUDO_ACTION(), and TOOL_ACTION().

◆ m_group

std::optional<TOOL_ACTION_GROUP> TOOL_ACTION::m_group
protectedinherited

Optional group for the action to belong to.

Definition at line 491 of file tool_action.h.

Referenced by GetActionGroup(), MakeEvent(), TOOL_ACTION(), TOOL_ACTION(), and TOOL_ACTION().

◆ m_hotKey

int TOOL_ACTION::m_hotKey
protectedinherited

The current hotkey (post-user-settings-application).

Definition at line 495 of file tool_action.h.

Referenced by GetHotKey(), GetMenuItem(), ACTION_MANAGER::processHotKey(), PSEUDO_ACTION::PSEUDO_ACTION(), SetHotKey(), and TOOL_ACTION().

◆ m_hotKeyAlt

int TOOL_ACTION::m_hotKeyAlt
protectedinherited

The alternate hotkey (post-user-settings-application).

Definition at line 498 of file tool_action.h.

Referenced by GetHotKeyAlt(), PSEUDO_ACTION::PSEUDO_ACTION(), SetHotKey(), and TOOL_ACTION().

◆ m_icon

std::optional<BITMAPS> TOOL_ACTION::m_icon
protectedinherited

Icon for the menu entry.

Definition at line 506 of file tool_action.h.

Referenced by GetIcon(), TOOL_ACTION(), and TOOL_ACTION().

◆ m_id

int TOOL_ACTION::m_id
protectedinherited

Unique ID for maps. Assigned by ACTION_MANAGER.

Definition at line 508 of file tool_action.h.

Referenced by GetId(), GetUIId(), operator!=(), operator==(), TOOL_ACTION(), TOOL_ACTION(), and TOOL_ACTION().

◆ m_legacyName

const std::string TOOL_ACTION::m_legacyName
protectedinherited

Name for reading legacy hotkey settings.

Definition at line 499 of file tool_action.h.

Referenced by ACTION_MANAGER::processHotKey(), TOOL_ACTION(), and TOOL_ACTION().

◆ m_menuLabel

std::optional<wxString> TOOL_ACTION::m_menuLabel
protectedinherited

Menu label.

Definition at line 502 of file tool_action.h.

Referenced by GetMenuLabel(), TOOL_ACTION(), and TOOL_ACTION().

◆ m_name

std::string TOOL_ACTION::m_name
protectedinherited

Name of the action (convention is "app.tool.actionName")

Definition at line 488 of file tool_action.h.

Referenced by GetName(), GetToolName(), MakeEvent(), ACTION_MANAGER::processHotKey(), ACTION_MANAGER::RegisterAction(), TOOL_ACTION(), and TOOL_ACTION().

◆ m_param

ki::any TOOL_ACTION::m_param
protectedinherited

Generic parameter.

Definition at line 514 of file tool_action.h.

Referenced by GetParam(), MakeEvent(), and TOOL_ACTION().

◆ m_scope

TOOL_ACTION_SCOPE TOOL_ACTION::m_scope
protectedinherited

Definition at line 489 of file tool_action.h.

Referenced by GetScope(), MakeEvent(), TOOL_ACTION(), TOOL_ACTION(), and TOOL_ACTION().

◆ m_toolbarState

TOOLBAR_STATE_FLAGS TOOL_ACTION::m_toolbarState
protectedinherited

Toolbar state behavior for the action.

Definition at line 511 of file tool_action.h.

Referenced by CheckToolbarState(), and TOOL_ACTION().

◆ m_tooltip

wxString TOOL_ACTION::m_tooltip
protectedinherited

User facing tooltip help text.

Definition at line 503 of file tool_action.h.

Referenced by GetTooltip(), TOOL_ACTION(), and TOOL_ACTION().

◆ m_uiid

std::optional<int> TOOL_ACTION::m_uiid
protectedinherited

ID to use when interacting with the UI (if empty, generate one).

Definition at line 509 of file tool_action.h.

Referenced by GetUIId(), HasCustomUIId(), and TOOL_ACTION().


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