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

VarInstance Class Reference

Represents an instance of a variable. More...

#include <varinstance.h>

List of all members.

Signals

void varElementChanged ()

Public Member Functions

 VarInstance (const QString &name, CmdParam *cmdParam=NULL, bool autoInitElements=true)
 VarInstance (const QString &name, CmdParam *cmdParam, const QStringList &elementValues)
const QString & varName () const
CmdParamcmdParam ()
const QStringList & elementValues () const
const QString & elementTypeName () const
void setVarName (const QString &name)
void setCmdParam (CmdParam *cmdParam, bool autoInitElements=true)
void setElementValues (const QStringList &values)
void initElementValues ()
QString toString () const
QHBox * createEditorWidget (QWidget *parent)
QHBox * getEditorWidget ()
void updateEditorWidget ()
void setEditorBackgroundColour (const QColor &colour)

Private Slots

void editorWidgetCleanup ()
void elementValueChanged ()

Private Member Functions

void sharedInit ()

Private Attributes

QString myVarName
CmdParammyCmdParam
QStringList myElementValues
QString myElementTypeName
QHBox * varEditorBox
QLabel * varFrontLabel
QLabel * varEndLabel
QPtrList< QWidget > varElementWidgets


Detailed Description

Represents an instance of a variable.

Arrays are supported, as it uses a string list for the elements.

Note: Currently, only ARRAYS are supported, as they are the only type of variable needed by Glitch (currently).

Note: Arrays of arrays are NOT supported.

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

Assumption: All of the elements in extVarElements of myCmdParam (set by either VarInstance::VarInstance() or VarInstance::setCmdParam() MUST be of the same type!


Constructor & Destructor Documentation

VarInstance::VarInstance const QString &  name,
CmdParam cmdParam = NULL,
bool  autoInitElements = true
 

Constructor. Allows you to create a variable instance that can set the element values to their defaults.

VarInstance::VarInstance const QString &  name,
CmdParam cmdParam,
const QStringList &  elementValues
 

Constructor. Allows you to create a variable instance, where the element values are set as specified by the elementValues parameter.

Note: if |elementValues| != |elements|, then the elementValues parameter will be ignored and the element values will be set to their defaults.


Member Function Documentation

CmdParam* VarInstance::cmdParam  )  [inline]
 

QHBox * VarInstance::createEditorWidget QWidget *  parent  ) 
 

Create an editor widget (which is a QHBox), which can be used to edit the elements of the variable instance.

void VarInstance::editorWidgetCleanup  )  [private, slot]
 

This method cleans up this command instance when it editor is destroyed. This is called by cmdEditorBox's destroyed signal.

const QString& VarInstance::elementTypeName  )  const [inline]
 

void VarInstance::elementValueChanged  )  [private, slot]
 

Called when one of the element input widget's value is changed. It also emits the VarInstance::varElementChanged() signal just before it returns.

const QStringList& VarInstance::elementValues  )  const [inline]
 

QHBox* VarInstance::getEditorWidget  )  [inline]
 

void VarInstance::initElementValues  ) 
 

Initialize the elements to the defaults that are specified by the command parameter.

If myCmdParam is NULL, then this will NOT do anything.

void VarInstance::setCmdParam CmdParam cmdParam,
bool  autoInitElements = true
 

Set the command parameter that this variable instance is being used for.

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

void VarInstance::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 VarInstance::setElementValues const QStringList &  values  ) 
 

Set the value(s) of the element(s) in this variable instance.

This ensures that the correct string representation is used for the values.

If myCmdParam == NULL, then this will return without doing anything.

void VarInstance::setVarName const QString &  name  )  [inline]
 

void VarInstance::sharedInit  )  [private]
 

Shared initializer for the class. This method contains code that must be performed by all constructors.

QString VarInstance::toString  )  const
 

Produces a string/text representation of the variable instance.

void VarInstance::updateEditorWidget  ) 
 

This method is very useful, as it allows an update in the name of the instance to be refected by the editor... if it exists.

If varEditorBox == NULL, then this method returns without doing anything.

Note: Currently, only the element type name and variable name are actualy updated by this method. The reason for this is that they are the only two that NEEDED to be updated (by an external object) in Glitch.

void VarInstance::varElementChanged  )  [signal]
 

const QString& VarInstance::varName  )  const [inline]
 


Member Data Documentation

CmdParam* VarInstance::myCmdParam [private]
 

QString VarInstance::myElementTypeName [private]
 

QStringList VarInstance::myElementValues [private]
 

QString VarInstance::myVarName [private]
 

QHBox* VarInstance::varEditorBox [private]
 

QPtrList<QWidget> VarInstance::varElementWidgets [private]
 

QLabel* VarInstance::varEndLabel [private]
 

QLabel* VarInstance::varFrontLabel [private]
 


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