Main Page | Namespace List | Class Hierarchy | Compound List | File List | Compound Members | File Members | Related Pages

CmdInstance Class Reference

Represents an instance of a command. More...

#include <cmdinstance.h>

List of all members.

Public Slots

void cmdSelectionChanged (CmdTreeNode *cmd)

Signals

void cmdInstanceChanged (CmdInstance *instance)
void cmdEnabledStatusChanged (CmdInstance *instance)
void cmdParamChanged (CmdInstance *instance)
void varInstanceCreated (CmdInstance *instance, VarInstance *varInst)

Public Member Functions

 CmdInstance (CmdTreeNode *cmd=NULL, bool autoInitParams=true)
 CmdInstance (CmdTreeNode *cmd, const QStringList &paramValues)
 ~CmdInstance ()
CmdTreeNodecmd ()
const QStringList & paramValues () const
const QMap< uint, VarInstance * > & externVarsMap () const
bool isEnabled () const
void setCmd (CmdTreeNode *cmd, bool autoInitParams=true)
void setParamValues (const QStringList &paramValues)
void setEnabled (bool enable)
void exec () const
void initParamValues ()
QString toString () const
void updateParamValues ()
QHBox * createEditorWidget (QWidget *parent)
QHBox * getEditorWidget ()
void setCmdSelector (CmdSelector *selector)
CmdSelectorcmdSelectoror () const
void setEditorBackgroundColour (const QColor &colour)
void updateParamWidgets ()

Private Slots

void cmdSelectorClicked ()
void cmdEnableCheckBoxToggled (bool on)
void paramValueChanged ()
void editorWidgetCleanup ()

Private Member Functions

void sharedInit ()
void createParamWidgets ()

Private Attributes

CmdTreeNodemyCmd
QStringList myParamValues
bool myEnabledStatus
QMap< uint, VarInstance * > myExternVarsMap
CmdSelectormyCmdSelector
QHBox * cmdEditorBox
QCheckBox * cmdEnabledCheckBox
QLabel * cmdSpacerLabel
QPushButton * cmdSelectorButton
QLabel * cmdOpenBraceLabel
QLabel * cmdCloseBraceLabel
QHBox * cmdParamsBox
QPtrList< QWidget > cmdParamWidgets


Detailed Description

Represents an instance of a command.

Note: There is a QtMac (Q_OS_MACX) specific section in the CmdInstance::setEditorBackgroundColour() method.

Note: If you want to be able to make a CmdInstance::createEditorWidget() call, then you will need to make a CmdInstance::setCmdSelector() call first. Though, this only needs to be done once.


Constructor & Destructor Documentation

CmdInstance::CmdInstance CmdTreeNode cmd = NULL,
bool  autoInitParams = true
 

Default constructor, which gives the ability to initialize the parameters to the command's defaults.

CmdInstance::CmdInstance CmdTreeNode cmd,
const QStringList &  paramValues
 

Constructor, which allow you to specify a list of parameters.

Assumption: The paramValues contains the correct number of values.

CmdInstance::~CmdInstance  ) 
 

Destructor.

Deallocate any external variables that the command instance used.


Member Function Documentation

CmdTreeNode* CmdInstance::cmd  )  [inline]
 

void CmdInstance::cmdEnableCheckBoxToggled bool  on  )  [private, slot]
 

This method updates the command instance's enabled status. This includes updating the private myEnabledStatus variable and enabling/disabling the editor widgets (bar the cmdEnabledCheckbox of course). It also emits the cmdEnabledStatusChanged signal.

void CmdInstance::cmdEnabledStatusChanged CmdInstance instance  )  [signal]
 

void CmdInstance::cmdInstanceChanged CmdInstance instance  )  [signal]
 

void CmdInstance::cmdParamChanged CmdInstance instance  )  [signal]
 

void CmdInstance::cmdSelectionChanged CmdTreeNode cmd  )  [slot]
 

Change the command item for a given table command row. It also emits the cmdInstanceChanged signal just before it returns.

Precondition: myCmdSelector != 0 and cmd != 0.

void CmdInstance::cmdSelectorClicked  )  [private, slot]
 

Called when the command selection button is toggled. This is connected to QPushButton's toggled( bool on ) signal.

Precondition: myCmdSelector != 0.

CmdSelector* CmdInstance::cmdSelectoror  )  const [inline]
 

QHBox * CmdInstance::createEditorWidget QWidget *  parent  ) 
 

Create an instance of an editor for THIS command instance.

Note: You need to ensure that you have made a CmdInstance::setCmdSelector() call first before calling this method. Without doing this, the method will simply return NULL without doing anything. Though, this only needs to be done once.

Note: Only one editor can exist at once, as the command selector is SHARED.

void CmdInstance::createParamWidgets  )  [private]
 

Create the paremeter widgets and insert them into a container widget. This is called by createEditorWidget and cmdSelectionChanged. NOTE! This is designed for indernal use only. NOTE! This will delete any existing parameter widgets first. The widgets are inserted into cmdParamsBox.

void CmdInstance::editorWidgetCleanup  )  [private, slot]
 

This method cleans up this command instance when it editor is destroyed.

This is called by cmdEditorBox's destroyed signal.

void CmdInstance::exec  )  const
 

Execute the command instance, using the current command and the current parameters.

Note: The command instance will NOT execute if it has been disabled using the CmdInstance::setEnabled() method.

const QMap<uint,VarInstance*>& CmdInstance::externVarsMap  )  const [inline]
 

QHBox* CmdInstance::getEditorWidget  )  [inline]
 

void CmdInstance::initParamValues  ) 
 

Initialize the parameters to the defaults that are specified by the command.

If myCmd is NULL, then this will NOT do anything (we don't know the formal parameters).

Note: This has to be done AFTER myExternVarsMap is created! Otherwise if a parameter uses an array, their values will not be appended.

bool CmdInstance::isEnabled  )  const [inline]
 

void CmdInstance::paramValueChanged  )  [private, slot]
 

Called when one of the parameter input widget's value is changed. It also emits the cmdParamChanged signal just before it returns.

const QStringList& CmdInstance::paramValues  )  const [inline]
 

void CmdInstance::setCmd CmdTreeNode cmd,
bool  autoInitParams = true
 

Set the command tree command prototype node for the instance.

Note: This will return straight away if cmd = 0.

Note: This destroys existing external variables and creates new ones for the given command. In the case where new external variables are created, a varInstanceCreated will be emitted for each one.

void CmdInstance::setCmdSelector CmdSelector selector  )  [inline]
 

void CmdInstance::setEditorBackgroundColour const QColor &  colour  ) 
 

Set the background colour of the editor, that is if it is active.

Note: There is a QtMac (Q_OS_MACX) specific section in this method. It is used to set colours appropiately for specific widgets.

void CmdInstance::setEnabled bool  enable  )  [inline]
 

void CmdInstance::setParamValues const QStringList &  paramValues  )  [inline]
 

void CmdInstance::sharedInit  )  [private]
 

This method is used by the constructors to perform tasks that are common to all of them.

QString CmdInstance::toString  )  const
 

Get a string representation of the command instanance (including its params).

void CmdInstance::updateParamValues  ) 
 

Update that myParamValues string value list using values from both the parameter widgets and the element widgets of arrays that being to parameters.

Note: An editor does NOT need to be active for this method to be useful. For example, this can be called when an external variable that belongs to one of this instance's parameter's is updated.

void CmdInstance::updateParamWidgets  ) 
 

This is used to update the values of the parameter widgets in an existing and active command instance editor (for this instance).

It is particularly useful if you want to change the name of a variable and then need the change to be reflected by the command instance editor.

void CmdInstance::varInstanceCreated CmdInstance instance,
VarInstance varInst
[signal]
 


Member Data Documentation

QLabel* CmdInstance::cmdCloseBraceLabel [private]
 

QHBox* CmdInstance::cmdEditorBox [private]
 

QCheckBox* CmdInstance::cmdEnabledCheckBox [private]
 

QLabel* CmdInstance::cmdOpenBraceLabel [private]
 

QHBox* CmdInstance::cmdParamsBox [private]
 

QPtrList<QWidget> CmdInstance::cmdParamWidgets [private]
 

QPushButton* CmdInstance::cmdSelectorButton [private]
 

QLabel* CmdInstance::cmdSpacerLabel [private]
 

CmdTreeNode* CmdInstance::myCmd [private]
 

CmdSelector* CmdInstance::myCmdSelector [private]
 

bool CmdInstance::myEnabledStatus [private]
 

QMap<uint,VarInstance*> CmdInstance::myExternVarsMap [private]
 

QStringList CmdInstance::myParamValues [private]
 


The documentation for this class was generated from the following files:
Generated on Fri Feb 27 12:01:40 2004 for Glitch by doxygen 1.3.2