Add the ability to get a command by it's name.

This commit is contained in:
Jean-Paul Chaput 2011-01-09 18:19:21 +00:00
parent be264380ea
commit 214bb4dda4
4 changed files with 15 additions and 0 deletions

View File

@ -1268,6 +1268,15 @@ namespace Hurricane {
}
Command* CellWidget::getCommand ( const string& name ) const
{
for ( size_t i=0 ; i<_commands.size() ; ++i ) {
if ( _commands[i]->getName() == name ) return _commands[i];
}
return NULL;
}
void CellWidget::pushCursor ( Qt::CursorShape cursor )
{
setCursor ( cursor );

View File

@ -199,6 +199,10 @@ namespace Hurricane {
string SelectCommand::_name = "SelectCommand";
const string& SelectCommand::getStaticName ()
{ return _name; }
SelectCommand::SelectCommand ()
: AreaCommand ()
, _selectionPopup(NULL)

View File

@ -146,6 +146,7 @@ namespace Hurricane {
void unbindCommand ( Command* );
inline void setActiveCommand ( Command* );
inline Command* getActiveCommand () const;
Command* getCommand ( const std::string& ) const;
inline void resetActiveCommand ();
inline void setCursorStep ( DbU::Unit );
inline void setRealSnapGridStep ( DbU::Unit step );

View File

@ -54,6 +54,7 @@ namespace Hurricane {
public:
enum SelectMode { AllMode=0, NetMode=1, NoAnonNetMode=2 };
public:
static const string& getStaticName ();
SelectCommand ();
virtual ~SelectCommand ();
virtual const string& getName () const;