Gui::CommandManager Class Reference

The CommandManager class This class manage all available commands in FreeCAD. More...

#include <Command.h>

Public Member Functions

void addCommand (Command *pCom)
 Insert a new command into the manager. More...
 
void addCommandMode (const char *sContext, const char *sName)
 
bool addTo (const char *Name, QWidget *pcWidget)
 Adds the given command to a given widget. More...
 
const CommandcheckAcceleratorForConflicts (const char *accel, const Command *ignore=nullptr) const
 Returns a pointer to a conflicting command, or nullptr if there is no conflict. More...
 
 CommandManager ()
 Construction. More...
 
std::vector< Command * > getAllCommands (void) const
 Returns all commands registered in the manager delivers a vector of all commands. More...
 
CommandgetCommandByName (const char *sName) const
 Returns the command registered in the manager with the name sName If nothing is found it returns a null pointer. More...
 
const std::map< std::string, Command * > & getCommands () const
 method is OBSOLETE use GetModuleCommands() or GetAllCommands() More...
 
std::vector< Command * > getGroupCommands (const char *sGrpName) const
 Returns all commands of a group delivers a vector of all commands in the given group. More...
 
std::vector< Command * > getModuleCommands (const char *sModName) const
 Returns all commands of a special App Module delivers a vector of all commands in the given application module. More...
 
std::string newMacroName () const
 Returns the first available command name for a new macro (e.g. More...
 
void removeCommand (Command *pCom)
 Remove a command from the manager. More...
 
void runCommandByName (const char *sName) const
 Runs the command. More...
 
void testActive (void)
 get frequently called by the AppWnd to check the commands are active. More...
 
void updateCommands (const char *sContext, int mode)
 
 ~CommandManager ()
 Destruction. More...
 

Detailed Description

The CommandManager class This class manage all available commands in FreeCAD.

All Commands will registered here, also commands from Application modules. Also activation / deactivation, Icons Tooltips and so on are handles here. Further the Building of Toolbars and (Context) menus (connecting to a QAction) is done here.

See also
Command
Author
J├╝rgen Riegel

Constructor & Destructor Documentation

◆ CommandManager()

CommandManager::CommandManager ( )

Construction.

◆ ~CommandManager()

CommandManager::~CommandManager ( )

Destruction.

Member Function Documentation

◆ addCommand()

◆ addCommandMode()

void CommandManager::addCommandMode ( const char *  sContext,
const char *  sName 
)

◆ addTo()

◆ checkAcceleratorForConflicts()

const Command * Gui::CommandManager::checkAcceleratorForConflicts ( const char *  accel,
const Command ignore = nullptr 
) const

Returns a pointer to a conflicting command, or nullptr if there is no conflict.

In the case of multiple conflicts, only the first is returned.

Parameters
accelThe accelerator to check
ignore(optional) A command to ignore matches with

References Gui::Application::commandManager(), getAllCommands(), and Gui::Application::Instance.

Referenced by Gui::Command::printConflictingAccelerators().

◆ getAllCommands()

std::vector< Command * > CommandManager::getAllCommands ( void  ) const

Returns all commands registered in the manager delivers a vector of all commands.

If you intereted in commands of of a special app module use GetModuleCommands()

See also
Command

Referenced by Gui::MainWindow::changeEvent(), checkAcceleratorForConflicts(), Gui::Dialog::DlgCustomKeyboardImp::on_buttonResetAll_clicked(), and Gui::Dialog::DlgCustomKeyboardImp::on_editShortcut_textChanged().

◆ getCommandByName()

Command * CommandManager::getCommandByName ( const char *  sName) const

Returns the command registered in the manager with the name sName If nothing is found it returns a null pointer.

See also
Command

Referenced by Gui::PythonGroupCommand::activated(), Gui::GroupCommand::addCommand(), Gui::MDITabbar::contextMenuEvent(), Gui::PythonGroupCommand::createAction(), StdViewDockUndockFullscreen::createAction(), NaviCubeImplementation::createContextMenu(), Gui::Workbench::createLinkMenu(), Gui::MainWindow::createPopupMenu(), Gui::MainWindow::event(), Gui::Dialog::CommandModel::goAddMacro(), Gui::PythonGroupCommand::languageChange(), Gui::Dialog::DlgCustomActionsImp::on_actionListWidget_itemActivated(), Gui::Dialog::DlgCustomActionsImp::on_buttonReplaceAction_clicked(), Gui::Dialog::DlgCustomKeyboardImp::on_buttonReset_clicked(), Gui::Dialog::DlgCustomKeyboardImp::on_commandTreeWidget_currentItemChanged(), Gui::Dialog::DlgCustomKeyboardImp::on_editShortcut_textChanged(), Gui::Dialog::DemoMode::on_fullscreen_toggled(), Gui::Dialog::DlgCustomCommandsImp::onAddMacroAction(), Gui::Dialog::DlgCustomKeyboardImp::onAddMacroAction(), Gui::Dialog::DlgCustomToolbars::onAddMacroAction(), Gui::Dialog::DlgCustomCommandsImp::onModifyMacroAction(), Gui::Dialog::DlgCustomKeyboardImp::onModifyMacroAction(), Gui::Dialog::DlgCustomToolbars::onModifyMacroAction(), WebGui::BrowserView::onUpdateBrowserActions(), Gui::TaskCSysDragger::open(), runCommandByName(), Gui::Dialog::DlgCustomKeyboardImp::setShortcutOfCurrentAction(), MeshGui::Workbench::setupMenuBar(), Gui::Application::sRunCommand(), FemGui::TaskPostClip::TaskPostClip(), FemGui::TaskPostCut::TaskPostCut(), Gui::TaskView::TaskWatcherCommands::TaskWatcherCommands(), Gui::TaskView::TaskWatcherPython::TaskWatcherPython(), Gui::Command::testActive(), updateCommands(), Gui::MainWindow::updateEditorActions(), and Gui::TaskCSysDragger::~TaskCSysDragger().

◆ getCommands()

const std::map< std::string, Command * > & Gui::CommandManager::getCommands ( ) const

◆ getGroupCommands()

◆ getModuleCommands()

std::vector< Command * > CommandManager::getModuleCommands ( const char *  sModName) const

Returns all commands of a special App Module delivers a vector of all commands in the given application module.

When no name is given the standard commands (build in ) are returned.

See also
Command

◆ newMacroName()

std::string CommandManager::newMacroName ( ) const

Returns the first available command name for a new macro (e.g.

starting from 1, examines the existing user preferences for Std_Macro_%1 and returns the lowest available numbered string).

References Gui::Application::commandManager(), getGroupCommands(), and Gui::Application::Instance.

Referenced by Gui::Dialog::DlgCustomActionsImp::on_buttonAddAction_clicked().

◆ removeCommand()

void CommandManager::removeCommand ( Command pCom)

Remove a command from the manager.

References Gui::Command::getName().

Referenced by Gui::Dialog::DlgCustomActionsImp::on_buttonRemoveAction_clicked().

◆ runCommandByName()

◆ testActive()

void CommandManager::testActive ( void  )

get frequently called by the AppWnd to check the commands are active.

◆ updateCommands()

void CommandManager::updateCommands ( const char *  sContext,
int  mode 
)

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