Torque2D Reference
Loading...
Searching...
No Matches
GuiControl Class Reference

#include <guiControl.h>

Inheritance diagram for GuiControl:

Public Types

enum  horizSizingOptions {
  horizResizeRight = 0 , horizResizeWidth , horizResizeLeft , horizResizeCenter ,
  horizResizeRelative , horizResizeFill
}
enum  vertSizingOptions {
  vertResizeBottom = 0 , vertResizeHeight , vertResizeTop , vertResizeCenter ,
  vertResizeRelative , vertResizeFill
}
enum  TextRotationOptions { tRotateNone = 0 , tRotateLeft , tRotateRight }
typedef U32(* TextWidthFn) (void *context, const char *text)
typedef SimObjectList::iterator iterator
typedef SimObjectList::value_type value
Public Types inherited from SimObject
enum  WriteFlags { SelectedOnly = BIT(0) }
enum  CopyFieldsFlags { CopyFields_SkipName = BIT(0) , CopyFields_SkipParentGroup = BIT(1) , CopyFields_SkipScriptClass = BIT(2) }
 What copyFieldsFrom may be told to leave alone. More...

Public Member Functions

virtual bool isEditMode ()
virtual bool isEditSelected ()
bool isHiddenInEditor (GuiControl *child)
virtual void getScrollLineSizes (U32 *rowHeight, U32 *columnWidth)
virtual void getCursor (GuiCursor *&cursor, bool &showCursor, const GuiEvent &lastGuiEvent)
void awaken ()
 Called when this control and its children have been wired up.
void sleep ()
 Called when this control is no more.
void preRender ()
 Prerender this control and all its children.
bool handleTouchDown (const GuiEvent &event, const Point2I &pt, S32 initialLayer=-1)
bool handleTouchUp (const GuiEvent &event, const Point2I &pt, S32 initialLayer=-1)
bool handleTouchMove (const GuiEvent &event, const Point2I &pt, S32 initialLayer=-1)
bool sendScriptMouseEvent (const char *name, const GuiEvent &event)
bool sendScriptKeyEvent (const char *name, const InputEvent &event)
virtual bool onInputEvent (const InputEvent &event)
 General input handler.
virtual void onFocus (bool foundFirstResponder)
virtual bool ControlIsChild (GuiControl *child)
virtual void setControlProfile (GuiControlProfile *prof)
virtual void setControlTooltipProfile (GuiControlProfile *prof)
virtual void onAction ()
 Occurs when this control performs its "action".
void renderText (const Point2I &offset, const Point2I &extent, const char *text, GuiControlProfile *profile, TextRotationOptions rot=tRotateNone)
virtual void renderLineList (const Point2I &offset, const Point2I &extent, const S32 startOffsetY, const vector< string > lineList, GuiControlProfile *profile, const TextRotationOptions rot=tRotateNone)
virtual vector< string > getLineList (const char *text, GuiControlProfile *profile, S32 totalWidth)
virtual void renderTextLine (const Point2I &startPoint, const string line, GuiControlProfile *profile, F32 rotationInDegrees, U32 ibeamPosAtLineStart, U32 lineNumber)
RectI applyMargins (Point2I &offset, Point2I &extent, GuiControlState currentState, GuiControlProfile *profile)
 Returns a new rect based on the margins.
RectI applyBorders (Point2I &offset, Point2I &extent, GuiControlState currentState, GuiControlProfile *profile)
 Returns the bounds of the rect after considering the borders.
RectI applyPadding (Point2I &offset, Point2I &extent, GuiControlState currentState, GuiControlProfile *profile)
 Returns the bounds of the rect this time with padding.
RectI getInnerRect (GuiControlState currentState=GuiControlState::NormalState)
 Returns the bounds of the rect with margin, borders, and padding applied.
RectI getInnerRect (Point2I &offset, GuiControlState currentState=GuiControlState::NormalState)
virtual RectI getInnerRect (Point2I &offset, Point2I &extent, GuiControlState currentState, GuiControlProfile *profile)
Point2I getOuterExtent (Point2I &innerExtent, GuiControlState currentState, GuiControlProfile *profile)
 Returns the extent of the outer rect given the extent of the inner rect.
S32 getOuterWidth (S32 innerExtent, GuiControlState currentState, GuiControlProfile *profile)
S32 getOuterHeight (S32 innerExtent, GuiControlState currentState, GuiControlProfile *profile)
virtual void inspectPostApply ()
virtual void inspectPreApply ()
Point2I extentBattery (Point2I &newExtent)
void resetStoredExtent ()
Point2F relPosBatteryH (S32 pos, S32 ext, S32 parentExt)
Point2F relPosBatteryV (S32 pos, S32 ext, S32 parentExt)
void relPosBattery (Point2F &battery, S32 pos, S32 ext, S32 parentExt)
void resetStoredRelPos ()
virtual void setDataField (StringTableEntry slotName, const char *array, const char *value)
Editor

These functions are used by the GUI Editor

void setSizing (S32 horz, S32 vert)
void write (Stream &stream, U32 tabStop, U32 flags)
 Overrides Parent Serialization to allow specific controls to not be saved (Dynamic Controls, etc).
bool getCanSave ()
 Returns boolean specifying if a control can be serialized.
void setCanSave (bool bCanSave)
 Set serialization flag.
bool getCanSaveParent ()
 Returns boolean as to whether any parent of this control has the 'no serialization' flag set.
Children
virtual void addObject (SimObject *obj)
void removeObject (SimObject *obj)
GuiControlgetParent ()
 Returns the control which owns this one.
GuiCanvasgetRoot ()
 Returns the root canvas of this control.
Coordinates
virtual Point2I localToGlobalCoord (const Point2I &src)
virtual Point2I globalToLocalCoord (const Point2I &src)
Rendering
virtual void onRender (Point2I offset, const RectI &updateRect)
virtual bool renderTooltip (Point2I &cursorPos, const char *tipText=NULL)
GuiControlProfileresolveDefaultTooltipProfile ()
virtual void renderChildControls (const Point2I &offset, const RectI &content, const RectI &updateRect)
virtual void renderChild (GuiControl *ctrl, const Point2I &offset, const RectI &content, const RectI &clipRect)
 Renders a single child control.
void setUpdateRegion (Point2I pos, Point2I ext)
virtual void setUpdate ()
 Sets the update area of the control to encompass the whole control.
Events

If you subclass these, make sure to call the Parent::'s versions.

virtual bool onWake ()
 Called when this object is asked to wake up returns true if it's actually awake at the end.
virtual void onSleep ()
 Called when this object is asked to sleep.
virtual void onPreRender ()
 Do special pre-render proecessing.
virtual void onRemove ()
 Called when this object is removed using delete.
virtual void onGroupRemove ()
 Called when this object is removed using delete or parent.remove().
virtual bool onAdd ()
 Called when this object is added to the scene.
virtual void onChildAdded (GuiControl *child)
 Called when this object has a new child. Congratulations!
virtual void onChildRemoved (GuiControl *child)
 Called when a child is removed.
Input (Keyboard/Mouse)
virtual bool pointInControl (const Point2I &parentCoordPoint)
bool cursorInControl ()
 Returns true if the global cursor is inside this control.
virtual GuiControlfindHitControl (const Point2I &pt, S32 initialLayer=-1, const bool ignoreUseInput=false, const bool ignoreEditSelected=true)
virtual void mouseLock (GuiControl *lockingControl)
virtual void mouseLock ()
 Turn on mouse locking with last used lock control.
virtual void mouseUnlock ()
 Unlock the mouse.
virtual bool isMouseLocked ()
 Returns true if the mouse is locked.
Touch/Mouse Events

These functions are called when the input event which is in the name of the function occurs.

virtual void onTouchUp (const GuiEvent &event)
virtual void onTouchDown (const GuiEvent &event)
virtual void onTouchMove (const GuiEvent &event)
virtual void onTouchDragged (const GuiEvent &event)
virtual void onTouchEnter (const GuiEvent &event)
virtual void onTouchLeave (const GuiEvent &event)
virtual void onMouseWheelUp (const GuiEvent &event)
virtual void onMouseWheelDown (const GuiEvent &event)
virtual void onRightMouseDown (const GuiEvent &event)
virtual void onRightMouseUp (const GuiEvent &event)
virtual void onRightMouseDragged (const GuiEvent &event)
virtual void onMiddleMouseDown (const GuiEvent &event)
virtual void onMiddleMouseUp (const GuiEvent &event)
virtual void onMiddleMouseDragged (const GuiEvent &event)
Editor Mouse Events

These functions are called when the input event which is in the name of the function occurs. Conversly from normal mouse events, these have a boolean return value that, if they return true, the editor will NOT act on them or be able to respond to this particular event.

This is particularly useful for when writing controls so that they may become aware of the editor and allow customization of their data or appearance as if they were actually in use. For example, the GuiTabBookCtrl catches on mouse down to select a tab and NOT let the editor do any instant group manipulation.

virtual bool onMouseDownEditor (const GuiEvent &event, const Point2I &offset)
virtual bool onMouseUpEditor (const GuiEvent &event, const Point2I &offset)
virtual bool onRightMouseDownEditor (const GuiEvent &event, const Point2I &offset)
virtual bool onMouseDraggedEditor (const GuiEvent &event, const Point2I &offset)
virtual bool canBeChildOf (GuiControl *parent)
virtual bool isGeometryEditable ()
Tabs
virtual GuiControlfindFirstTabable ()
 Find the first tab-accessable child of this control.
virtual GuiControlfindLastTabable (bool firstCall=true)
virtual GuiControlfindPrevTabable (GuiControl *curResponder, bool firstCall=true)
virtual GuiControlfindNextTabable (GuiControl *curResponder, bool firstCall=true)
First Responder

A first responder is the control which reacts first, in it's responder chain, to keyboard events The responder chain is set for each parent and so there is only one first responder amongst it's children.

virtual void setFirstResponder (GuiControl *firstResponder)
virtual void makeFirstResponder (bool value)
bool isFirstResponder ()
 Returns true if this control is a first responder.
virtual void setFirstResponder ()
 Sets this object to be a first responder.
void clearFirstResponder ()
 Clears the first responder for this chain.
void clearFirstResponder (GuiControl *target)
GuiControlgetFirstResponder ()
 Returns the first responder for this chain.
virtual void onLoseFirstResponder ()
 Occurs when the first responder for this chain is lost.
Keyboard Events
void addAcceleratorKey ()
 Adds the accelerator key for this object to the canvas.
virtual void buildAcceleratorMap ()
virtual void acceleratorKeyPress (U32 index)
virtual void acceleratorKeyRelease (U32 index)
virtual bool onKeyDown (const GuiEvent &event)
virtual bool onKeyUp (const GuiEvent &event)
virtual bool onKeyRepeat (const GuiEvent &event)
Peer Messaging

Used to send a message to other GUIControls which are children of the same parent.

This is mostly used by radio controls.

void messageSiblings (S32 message)
 Send a message to all siblings.
virtual void onMessage (GuiControl *sender, S32 msg)
 Receive a message from another control.
Canvas Events

Functions called by the canvas

virtual void onDialogPush ()
 Called if this object is a dialog, when it is added to the visible layers.
virtual void onDialogPop ()
 Called if this object is a dialog, when it is removed from the visible layers.
Public Member Functions inherited from SimGroup
 ~SimGroup ()
void addObject (SimObject *, SimObjectId)
void addObject (SimObject *, const char *name)
virtual void onChildRemoved (SimObject *)
virtual SimObjectfindObject (const char *name)
 Find an object in the group.
bool processArguments (S32 argc, const char **argv)
 Process constructor options. (ie, new SimObject(1,2,3)).
 DECLARE_CONOBJECT (SimGroup)
Public Member Functions inherited from SimSet
 SimSet ()
 ~SimSet ()
virtual void onDeleteNotify (SimObject *object)
virtual U32 getTamlChildCount (void) const
 Called when Taml attempts to compile a list of children.
virtual SimObjectgetTamlChild (const U32 childIndex) const
 Called when Taml attempts to compile a list of children.
virtual void addTamlChild (SimObject *pSimObject)
 Called when Taml attempts to populate an objects children during a read.
void callOnChildren (const char *method, S32 argc, const char *argv[], bool executeOnChildGroups=true)
SimObjectfindObjectByInternalName (const char *internalName, bool searchChildren=false)
virtual bool writeObject (Stream *stream)
virtual bool readObject (Stream *stream)
void lock ()
void unlock ()
 DECLARE_CONOBJECT (SimSet)
void _setVectorAssoc (const char *file, const U32 line)
virtual void pushObject (SimObject *)
virtual void popObject ()
 Remove an object from the end of the list.
void bringObjectToFront (SimObject *obj)
void pushObjectToBack (SimObject *obj)
SimObjectfront ()
SimObjectfirst ()
SimObjectlast ()
bool empty ()
S32 size () const
iterator begin ()
iterator end ()
value operator[] (S32 index)
iterator find (iterator first, iterator last, SimObject *obj)
iterator find (SimObject *obj)
template<typename T>
bool containsType (void)
bool isMember (SimObject *obj)
virtual bool reOrder (SimObject *obj, SimObject *target=0)
SimObjectat (S32 index) const
void deleteObjects (void)
void clear ()
Public Member Functions inherited from SimObject
StringTableEntry getClassNamespace () const
StringTableEntry getSuperClassNamespace () const
void setClassNamespace (const char *classNamespace)
void setSuperClassNamespace (const char *superClassNamespace)
void pushScriptCallbackGuard (void)
void popScriptCallbackGuard (void)
S32 getScriptCallbackGuard (void)
NamespacegetNamespace ()
 Return the object's namespace.
const char * tabComplete (const char *prevText, S32 baseLen, bool)
virtual void dump ()
virtual void dumpClassHierarchy ()
SimObjectclone (const bool copyDynamicFields)
virtual void copyTo (SimObject *object)
SimObjectdeepClone ()
template<typename T>
bool isType (void)
virtual bool handlesConsoleMethod (const char *fname, S32 *routingId)
 DECLARE_CONOBJECT (SimObject)
virtual bool writeField (StringTableEntry fieldname, const char *value)
virtual void writeFields (Stream &stream, U32 tabStop)
virtual void buildFilterList ()
void addFieldFilter (const char *fieldName)
void removeFieldFilter (const char *fieldName)
void clearFieldFilters ()
bool isFiltered (const char *fieldName)
void assignFieldsFrom (SimObject *obj)
void copyFieldsFrom (SimObject *obj, const U32 flags)
void assignDynamicFieldsFrom (SimObject *obj)
NotifyremoveNotify (void *ptr, Notify::Type)
 Remove a notification from the list.
void deleteNotify (SimObject *obj)
 Notify an object when we are deleted.
void clearNotify (SimObject *obj)
 Notify an object when we are cleared.
void clearAllNotifications ()
 Remove all notifications for this object.
void processDeleteNotifies ()
 Send out deletion notifications.
void registerReference (SimObject **obj)
void unregisterReference (SimObject **obj)
void addListener (std::string objID)
void removeListener (std::string objID)
void removeAllListeners ()
void postEvent (std::string eventName, std::string data)
const char * getDataField (StringTableEntry slotName, const char *array)
const char * getPrefixedDataField (StringTableEntry fieldName, const char *array)
void setPrefixedDataField (StringTableEntry fieldName, const char *array, const char *value)
const char * getPrefixedDynamicDataField (StringTableEntry fieldName, const char *array, const S32 fieldType=-1)
void setPrefixedDynamicDataField (StringTableEntry fieldName, const char *array, const char *value, const S32 fieldType=-1)
StringTableEntry getDataFieldPrefix (StringTableEntry fieldName)
U32 getDataFieldType (StringTableEntry slotName, const char *array)
SimFieldDictionarygetFieldDictionary ()
void clearDynamicFields (void)
 Clear all dynamic fields.
void setCanSaveDynamicFields (bool bCanSave)
 Set whether fields created at runtime should be saved. Default is true.
bool getCanSaveDynamicFields (void) const
 Get whether fields created at runtime should be saved. Default is true.
void setInternalName (const char *newname)
StringTableEntry getInternalName ()
 Get the internal of of this control.
virtual bool save (const char *pcFilePath, bool bOnlySelected=false)
 Save object as a TorqueScript File.
virtual bool isMethod (const char *methodName)
 Check if a method exists in the objects current namespace.
SimObjectId getId (void) const
StringTableEntry getIdString (void) const
U32 getType () const
const StringTableEntry getName (void) const
void setId (SimObjectId id)
void assignName (const char *name)
SimGroupgetGroup () const
bool isChildOfGroup (SimGroup *pGroup)
bool isProperlyAdded () const
bool isDeleted () const
bool isRemoved () const
bool isLocked () const
void setLocked (bool b)
bool isHidden () const
void setHidden (bool b)
void setProgenitorFile (const char *pFile)
StringTableEntry getProgenitorFile (void) const
void setPeriodicTimerID (const S32 timerID)
S32 getPeriodicTimerID (void) const
bool isPeriodicTimerActive (void) const
bool isSelected () const
bool isExpanded () const
void setSelected (bool sel)
void setExpanded (bool exp)
void setModDynamicFields (bool dyn)
void setModStaticFields (bool sta)
 SimObject ()
virtual ~SimObject ()
virtual void onGroupAdd ()
 Called when the object is added to a SimGroup.
virtual void onNameChange (const char *name)
 Called when the object's name is changed.
virtual void onStaticModified (const char *slotName, const char *newValue=NULL)
virtual void onEditorEnable ()
 Called when the editor is activated.
virtual void onEditorDisable ()
 Called when the editor is deactivated.
bool registerObject ()
bool registerObject (U32 id)
bool registerObject (const char *name)
bool registerObject (const char *name, U32 id)
void unregisterObject ()
void deleteObject ()
bool addToSet (SimObjectId)
bool addToSet (const char *)
bool removeFromSet (SimObjectId)
bool removeFromSet (const char *)
Public Member Functions inherited from ConsoleObject
const AbstractClassRep::FieldfindField (StringTableEntry fieldName) const
 Get a reference to a field by name.
virtual AbstractClassRepgetClassRep () const
 Gets the ClassRep.
bool setField (const char *fieldName, const char *value)
 Set the value of a field.
virtual ~ConsoleObject ()
const AbstractClassRep::FieldListgetFieldList () const
 Get a list of all the fields. This information cannot be modified.
AbstractClassRep::FieldListgetModifiableFieldList ()
bool & getDynamicGroupExpand ()
S32 getClassId (U32 netClassGroup) const
const char * getClassName () const
Public Member Functions inherited from Tickable
 Tickable ()
virtual ~Tickable ()
virtual bool isProcessingTicks () const
virtual void setProcessTicks (bool tick=true)

Static Public Member Functions

static vector< string > splitParagraphs (const char *text)
static vector< string > wrapParagraph (const string &paragraph, S32 totalWidth, TextWidthFn measure, void *context)
static S32 getTextVerticalOffset (S32 textHeight, S32 totalHeight, VertAlignmentType align)
Static Public Member Functions inherited from SimObject
static void initPersistFields ()
Static Public Member Functions inherited from ConsoleObject
static const char * lookupClassName (const U32 in_classTag)
 Get the classname from a class tag.
static void initPersistFields ()
static void consoleInit ()
static AbstractClassRepgetStaticClassRep ()
 Get the abstract class information for this class.
static AbstractClassRepgetParentStaticClassRep ()
 Get the abstract class information for this class's superclass.
static ConsoleObjectcreate (const char *in_pClassName)
static ConsoleObjectcreate (const U32 groupId, const U32 typeId, const U32 in_classId)
Static Public Member Functions inherited from Tickable
static bool advanceTime (U32 timeDelta)

Public Attributes

bool mPassEventThru = false
bool mAllowEventPassThru

Static Public Attributes

Design Time Editor Access
static GuiEditCtrlsmEditorHandle = NULL
 static GuiEditCtrl pointer that gives controls access to editor-NULL if editor is closed
static bool disableNameChanging = false
Static Public Attributes inherited from Tickable
static const U32 smTickShift = 4
 Shift value to control how often Ticks occur.
static const U32 smTickMs = ( 1 << smTickShift )
 Number of milliseconds per tick, 32 in this case.
static const F32 smTickSec = ( F32( Tickable::smTickMs ) / 1000.f )
 Fraction of a second per tick.
static const U32 smTickMask = ( smTickMs - 1 )

Protected Member Functions

virtual void interpolateTick (F32 delta)
virtual void processTick ()
virtual void advanceTime (F32 timeDelta)
S32 getTextHorizontalOffset (S32 textWidth, S32 totalWidth, AlignmentType align)
AlignmentType getAlignmentType ()
VertAlignmentType getVertAlignmentType ()
AlignmentType getAlignmentType (GuiControlProfile *profile)
VertAlignmentType getVertAlignmentType (GuiControlProfile *profile)
const ColorIgetFontColor (GuiControlProfile *profile, const GuiControlState state=GuiControlState::NormalState)
Callbacks

Executes a console command, and returns the result.

The global console variable $ThisControl is set to the id of the calling control. WARNING: because multiple controls may set $ThisControl, at any time, the value of $ThisControl should be stored in a local variable by the callback code. The use of the $ThisControl variable is not thread safe.

const char * execConsoleCallback ()
 Executes mConsoleCommand, and returns the result.
const char * execAltConsoleCallback ()
 Executes mAltConsoleCommand, and returns the result.
Protected Member Functions inherited from SimGroup
virtual void deepCloneChildren (SimObject *clone)
Protected Member Functions inherited from SimObject
virtual void onTamlPreWrite (void)
 Taml callbacks.
virtual void onTamlPostWrite (void)
 Called after Taml has finished writing the object.
virtual void onTamlPreRead (void)
 Called prior to Taml reading the object.
virtual void onTamlPostRead (const TamlCustomNodes &customNodes)
virtual void onTamlAddParent (SimObject *pParentObject)
 Called after Taml has finished reading the object and has added the object to any parent.
virtual void onTamlCustomWrite (TamlCustomNodes &customNodes)
 Called during the writing of the object to allow custom properties to be written.
virtual void onTamlCustomRead (const TamlCustomNodes &customNodes)
 Called during the reading of the object to allow custom properties to be read.
void linkNamespaces ()
void unlinkNamespaces ()
virtual SimObjectallocClone ()
 A registered but empty object of this object's class.
void cloneInto (SimObject *clone)
Protected Member Functions inherited from ConsoleObject
 ConsoleObject ()
 ConsoleObject (const ConsoleObject &)

Protected Attributes

bool mPreviouslyAwake
Protected Attributes inherited from SimSet
SimObjectList objectList
void * mMutex
Protected Attributes inherited from SimObject
SimObjectId mId
 Id number for this object.
StringTableEntry mIdString
NamespacemNameSpace
U32 mTypeMask
S32 mScriptCallbackGuard
 Whether the object is executing a script callback.
bool mCanSaveFieldDictionary
 true if dynamic fields (added at runtime) should be saved, defaults to true
StringTableEntry mInternalName
 Stores object Internal Name.
StringTableEntry mClassName
 Stores the class name to link script class namespaces.
StringTableEntry mSuperClassName
 Stores super class name to link script class namespaces.

Control State

GuiControlProfilemProfile
GuiControlProfilemTooltipProfile
GuiControlProfilemLazyTooltipProfile
S32 mTipHoverTime
S32 mTooltipWidth
bool mVisible
bool mActive
bool mAwake
bool mSetFirstResponder
bool mCanSave
bool mIsContainer
 True if the GuiEditor can drag other controls into this one.
bool mRendersChildren
 True if the control renders children. If false, then the control cannot be a container. This is set by the class and cannot be changed by the user.
bool mUseInput
 True if input events like a click can be passed to this gui. False will pass events to the parent and this object and its children will not process input (touch and keyboard).
S32 mLayer
RectI mBounds
Point2I mMinExtent
Point2I mRenderInsetLT
Point2I mRenderInsetRB
 Add this to the mBounds and parent offset to get the true render location of the control.
StringTableEntry mLangTableName
 The actual rendered inset for the right and bottom sides.
LangTablemLangTable
static const S32 DEFAULT_TOOLTIP_WIDTH = 250
static const S32 DEFAULT_TOOLTIP_HOVERTIME = 1000
static S32 smCursorChanged = -1
 Has this control modified the cursor? -1 or type.
static bool smDesignTime = false
 static GuiControl boolean that specifies if the GUI Editor is active
S32 mHorizSizing
 Set from horizSizingOptions.
S32 mVertSizing
 Set from vertSizingOptions.
Point2I mStoredExtent
Point2F mStoredRelativePosH
Point2F mStoredRelativePosV
bool mUseRelPosH
bool mUseRelPosV
StringTableEntry mConsoleVariable
StringTableEntry mConsoleCommand
StringTableEntry mAltConsoleCommand
StringTableEntry mAcceleratorKey
StringTableEntry mTooltip
StringTableEntry mText
StringTableEntry mTextID
bool mTextWrap
bool mTextExtend
AlignmentType mAlignment
VertAlignmentType mVAlignment
F32 mFontSizeAdjust
ColorI mFontColor
bool mOverrideFontColor
static bool writeToolTipWidthFn (void *obj, const char *data)
static bool writeToolTipHoverTimeFn (void *obj, const char *data)
static bool writeFontSizeAdjustFn (void *obj, const char *data)
static bool writeFontColorFn (void *obj, const char *data)
static bool writeOverrideFontColorFn (void *obj, const char *data)

Keyboard Input

GuiControlmFirstResponder
static GuiControlsmPrevResponder = NULL
static GuiControlsmCurResponder = NULL

Initialization

static void initPersistFields ()
 DECLARE_CONOBJECT (GuiControl)
 GuiControl ()
virtual ~GuiControl ()

Accessors

static bool setTextProperty (void *obj, const char *data)
static const char * getTextProperty (void *obj, const char *data)
static bool writeTextWrapFn (void *obj, const char *data)
static bool writeTextExtendFn (void *obj, const char *data)
static bool setExtentFn (void *obj, const char *data)
static bool setMinExtentFn (void *obj, const char *data)
static bool writeMinExtentFn (void *obj, const char *data)
static bool setPositionFn (void *obj, const char *data)
const Point2IgetPosition ()
 Returns position of the control.
const Point2IgetExtent ()
 Returns extents of the control.
const RectIgetBounds ()
 Returns the bounds of the control.
const Point2IgetMinExtent ()
 Returns minimum size the control can be.
const S32 getLeft ()
 Returns the X position of the control.
const S32 getTop ()
 Returns the Y position of the control.
const S32 getWidth ()
 Returns the width of the control.
const S32 getHeight ()
 Returns the height of the control.
virtual void setText (const char *text)
virtual void setTextID (S32 id)
virtual void setTextID (const char *id)
virtual const char * getText ()
void setTextWrap (const bool wrap)
bool getTextWrap ()
void setTextExtend (const bool extend)
bool getTextExtend ()
const horizSizingOptions getHorizSizing ()
const vertSizingOptions getVertSizing ()
void setHorizSizing (const horizSizingOptions sizing)
void setVertSizing (const vertSizingOptions sizing)

Flags

static bool writeVisibleFn (void *obj, const char *data)
static bool writeUseInputFn (void *obj, const char *data)
static bool writeIsContainerFn (void *obj, const char *data)
static bool setIsContainerFn (void *obj, const char *data)
virtual void setVisible (bool value)
bool isVisible ()
 Returns true if the object is visible.
bool rendersChildren ()
 True if the control draws its children, which is what makes it able to be a container.
virtual void setActive (bool value)
bool isActive ()
 Returns true if this control is active.
bool isAwake ()
 Returns true if this control is awake.

Resizing

static Point2I rescuedPosition (const Point2I &pos, const Point2I &extent, const Point2I &parentInnerExtent)
virtual void resize (const Point2I &newPosition, const Point2I &newExtent)
virtual void setPosition (const Point2I &newPosition)
virtual void setExtent (const Point2I &newExtent)
virtual void setBounds (const RectI &newBounds)
virtual void setLeft (S32 newLeft)
virtual void setTop (S32 newTop)
virtual void setWidth (S32 newWidth)
virtual void setHeight (S32 newHeight)
virtual void childResized (GuiControl *child)
virtual void childMoved (GuiControl *child)
virtual void childrenReordered ()
 Called when the children of this control may have been reordered.
virtual void parentResized (const Point2I &oldParentExtent, const Point2I &newParentExtent)
bool pullIntoView ()
void preventResizeModeFill ()
 Removes the resize mode of fill and changes it to right or bottom.
void preventResizeModeCenter ()
 Removes the resize mode of center and changes it to right or bottom.
void preventHorizResizeModeFill ()
void preventVertResizeModeFill ()
void preventHorizResizeModeCenter ()
void preventVertResizeModeCenter ()

Console

void setConsoleVariable (const char *variable)
void setConsoleCommand (const char *newCmd)
const char * getConsoleCommand ()
 Returns the name of the function bound to this GuiControl.
LangTablegetGUILangTable (void)
const UTF8 * getGUIString (S32 id)
virtual const char * getScriptValue ()
 Returns the value of the variable bound to this object.
virtual void setScriptValue (const char *value)
 Sets the value of the variable bound to this object.
void setVariable (const char *value)
void setIntVariable (S32 value)
void setFloatVariable (F32 value)
const char * getVariable ()
 Returns value of control's bound variable as a string.
S32 getIntVariable ()
 Returns value of control's bound variable as a integer.
F32 getFloatVariable ()
 Returns value of control's bound variable as a float.

Additional Inherited Members

Static Protected Member Functions inherited from SimObject
static bool setClass (void *obj, const char *data)
static bool setSuperClass (void *obj, const char *data)
static bool writeObjectName (void *obj, StringTableEntry pFieldName)
static bool writeCanSaveDynamicFields (void *obj, StringTableEntry pFieldName)
static bool writeInternalName (void *obj, StringTableEntry pFieldName)
static bool setParentGroup (void *obj, const char *data)
static bool writeParentGroup (void *obj, StringTableEntry pFieldName)
static bool writeSuperclass (void *obj, StringTableEntry pFieldName)
static bool writeClass (void *obj, StringTableEntry pFieldName)
static bool setProtectedName (void *obj, const char *data)
static const char * getProtectedName (void *obj, const char *data)
static SimObject::NotifyallocNotify ()
 Get a free Notify structure.
static void freeNotify (SimObject::Notify *)
 Mark a Notify structure as free.
static void addGroup (const char *in_pGroupname, const char *in_pGroupDocs=NULL)
static void endGroup (const char *in_pGroupname)
static void addField (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, const U32 in_elementCount=1, EnumTable *in_table=NULL, const char *in_pFieldDocs=NULL)
static void addField (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, AbstractClassRep::WriteDataNotify in_writeDataFn, const U32 in_elementCount=1, EnumTable *in_table=NULL, const char *in_pFieldDocs=NULL)
static void addField (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, const char *in_pFieldDocs)
static void addField (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, AbstractClassRep::WriteDataNotify in_writeDataFn, const char *in_pFieldDocs)
static void addFieldV (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, ConsoleTypeValidator *v, const char *in_pFieldDocs=NULL)
static void addProtectedField (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, AbstractClassRep::SetDataNotify in_setDataFn, AbstractClassRep::GetDataNotify in_getDataFn=&defaultProtectedGetFn, const U32 in_elementCount=1, EnumTable *in_table=NULL, const char *in_pFieldDocs=NULL)
static void addProtectedField (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, AbstractClassRep::SetDataNotify in_setDataFn, AbstractClassRep::GetDataNotify in_getDataFn=&defaultProtectedGetFn, AbstractClassRep::WriteDataNotify in_writeDataFn=&defaultProtectedWriteFn, const U32 in_elementCount=1, EnumTable *in_table=NULL, const char *in_pFieldDocs=NULL)
static void addProtectedField (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, AbstractClassRep::SetDataNotify in_setDataFn, AbstractClassRep::GetDataNotify in_getDataFn=&defaultProtectedGetFn, const char *in_pFieldDocs=NULL)
static void addProtectedField (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, AbstractClassRep::SetDataNotify in_setDataFn, AbstractClassRep::GetDataNotify in_getDataFn=&defaultProtectedGetFn, AbstractClassRep::WriteDataNotify in_writeDataFn=&defaultProtectedWriteFn, const char *in_pFieldDocs=NULL)
static void addDepricatedField (const char *fieldName)
static bool removeField (const char *in_pFieldname)
static SimObject::NotifymNotifyFreeList = NULL

Member Typedef Documentation

◆ TextWidthFn

typedef U32(* TextWidthFn) (void *context, const char *text)

How wide a string is, asked of whatever knows: a GFont at render time, a stand-in in a unit test. wrapParagraph takes one of these rather than a GFont so that it can be tested with no GL context – asking a profile for a font registers a texture, and TextureManager::refresh asserts without one, which in a debug build is a modal box and so arrives as a hang.

Member Enumeration Documentation

◆ horizSizingOptions

Enumerator
horizResizeRight 

fixed on the left and width

horizResizeWidth 

fixed on the left and right

horizResizeLeft 

fixed on the right and width

horizResizeCenter 
horizResizeRelative 

resize relative

horizResizeFill 

fill the entire content area of the parent

◆ TextRotationOptions

Enumerator
tRotateNone 
tRotateLeft 
tRotateRight 

◆ vertSizingOptions

Enumerator
vertResizeBottom 

fixed on the top and in height

vertResizeHeight 

fixed on the top and bottom

vertResizeTop 

fixed in height and on the bottom

vertResizeCenter 
vertResizeRelative 

resize relative

vertResizeFill 

fill the entire content area of the parent

Constructor & Destructor Documentation

◆ GuiControl()

◆ ~GuiControl()

~GuiControl ( )
virtual

Member Function Documentation

◆ acceleratorKeyPress()

void acceleratorKeyPress ( U32 index)
virtual

Occurs when the accelerator key for this control is pressed

Parameters
indexIndex in the acclerator map of the key

Reimplemented in GuiButtonCtrl, and GuiMenuBarCtrl.

◆ acceleratorKeyRelease()

void acceleratorKeyRelease ( U32 index)
virtual

Occurs when the accelerator key for this control is released

Parameters
indexIndex in the acclerator map of the key

Reimplemented in GuiButtonCtrl.

◆ addAcceleratorKey()

void addAcceleratorKey ( )

Adds the accelerator key for this object to the canvas.

◆ addObject()

void addObject ( SimObject * obj)
virtual

Adds an object as a child of this object.

Parameters
objNew child object of this control

Reimplemented from SimGroup.

Reimplemented in GuiExpandCtrl, GuiListBoxCtrl, and GuiScrollCtrl.

◆ advanceTime()

virtual void advanceTime ( F32 timeDelta)
inlineprotectedvirtual

This method is called once every frame regardless of the return value of isProcessingTicks and informs the object of the passage of time

Implements Tickable.

Reimplemented in GuiSpriteCtrl, and SceneWindow.

◆ applyBorders()

RectI applyBorders ( Point2I & offset,
Point2I & extent,
GuiControlState currentState,
GuiControlProfile * profile )

Returns the bounds of the rect after considering the borders.

◆ applyMargins()

RectI applyMargins ( Point2I & offset,
Point2I & extent,
GuiControlState currentState,
GuiControlProfile * profile )

Returns a new rect based on the margins.

◆ applyPadding()

RectI applyPadding ( Point2I & offset,
Point2I & extent,
GuiControlState currentState,
GuiControlProfile * profile )

Returns the bounds of the rect this time with padding.

◆ awaken()

void awaken ( )

Called when this control and its children have been wired up.

◆ buildAcceleratorMap()

void buildAcceleratorMap ( )
virtual

Adds this control's accelerator key to the accelerator map, and recursively tells all children to do the same.

◆ canBeChildOf()

virtual bool canBeChildOf ( GuiControl * parent)
inlinevirtual

Whether this control is allowed to become a child of the given container.

The Gui Editor asks before it reparents anything - a drag in the Explorer tree, a drag across the canvas, a paste - and leaves the control where it is when the answer is no. Nothing else in the engine asks: SimGroup::addObject cannot refuse, so this is advice the editor takes, not an invariant the object model enforces.

A control that only means something inside one particular parent overrides this. GuiTabPageCtrl is the one that does.

Reimplemented in GuiMenuItemCtrl, and GuiTabPageCtrl.

◆ childMoved()

void childMoved ( GuiControl * child)
virtual

Called when a child control of the object is moved

Parameters
childChild object

Reimplemented in GuiChainCtrl, GuiFrameSetCtrl, and GuiGridCtrl.

◆ childrenReordered()

void childrenReordered ( )
virtual

Called when the children of this control may have been reordered.

Reimplemented in GuiChainCtrl, GuiFrameSetCtrl, GuiGridCtrl, GuiMenuBarCtrl, and GuiTabBookCtrl.

◆ childResized()

void childResized ( GuiControl * child)
virtual

Called when a child control of the object is resized

Parameters
childChild object

Reimplemented in GuiChainCtrl, GuiExpandCtrl, GuiFrameSetCtrl, GuiGridCtrl, GuiMenuBarCtrl, GuiScrollCtrl, and GuiTabBookCtrl.

◆ clearFirstResponder() [1/2]

void clearFirstResponder ( )

Clears the first responder for this chain.

◆ clearFirstResponder() [2/2]

void clearFirstResponder ( GuiControl * target)

◆ ControlIsChild()

bool ControlIsChild ( GuiControl * child)
virtual

Returns true if the provided control is a child (grandchild, or greatgrandchild) of this one.

Parameters
childControl to test

◆ cursorInControl()

bool cursorInControl ( )

Returns true if the global cursor is inside this control.

◆ DECLARE_CONOBJECT()

DECLARE_CONOBJECT ( GuiControl )

◆ execAltConsoleCallback()

const char * execAltConsoleCallback ( )
protected

Executes mAltConsoleCommand, and returns the result.

◆ execConsoleCallback()

const char * execConsoleCallback ( )
protected

Executes mConsoleCommand, and returns the result.

◆ extentBattery()

Point2I extentBattery ( Point2I & newExtent)

◆ findFirstTabable()

GuiControl * findFirstTabable ( )
virtual

Find the first tab-accessable child of this control.

◆ findHitControl()

GuiControl * findHitControl ( const Point2I & pt,
S32 initialLayer = -1,
const bool ignoreUseInput = false,
const bool ignoreEditSelected = true )
virtual

Returns the control which the provided point is under, with layering

Parameters
ptPoint to test
initialLayerLayer of gui objects to begin the search

Reimplemented in GuiMenuBarCtrl.

◆ findLastTabable()

GuiControl * findLastTabable ( bool firstCall = true)
virtual

Find the last tab-accessable child of this control

Parameters
firstCallSet to true to clear the global previous responder

◆ findNextTabable()

GuiControl * findNextTabable ( GuiControl * curResponder,
bool firstCall = true )
virtual

Find next tab-accessable control with regards to the provided control.

Parameters
curResponderCurrent control
firstCallSet to true to clear the global current responder

Reimplemented in GuiTabPageCtrl, and GuiWindowCtrl.

◆ findPrevTabable()

GuiControl * findPrevTabable ( GuiControl * curResponder,
bool firstCall = true )
virtual

Find previous tab-accessable control with respect to the provided one

Parameters
curResponderCurrent control
firstCallSet to true to clear the global previous responder

Reimplemented in GuiTabPageCtrl, and GuiWindowCtrl.

◆ getAlignmentType() [1/2]

AlignmentType getAlignmentType ( )
protected

◆ getAlignmentType() [2/2]

AlignmentType getAlignmentType ( GuiControlProfile * profile)
protected

◆ getBounds()

const RectI & getBounds ( )
inline

Returns the bounds of the control.

◆ getCanSave()

bool getCanSave ( )

Returns boolean specifying if a control can be serialized.

◆ getCanSaveParent()

bool getCanSaveParent ( )

Returns boolean as to whether any parent of this control has the 'no serialization' flag set.

◆ getConsoleCommand()

const char * getConsoleCommand ( )

Returns the name of the function bound to this GuiControl.

◆ getCursor()

void getCursor ( GuiCursor *& cursor,
bool & showCursor,
const GuiEvent & lastGuiEvent )
virtual

Get information about the cursor.

Parameters
cursorCursor information will be stored here
showCursorWill be set to true if the cursor is visible
lastGuiEventGuiEvent containing cursor position and modifyer keys (ie ctrl, shift, alt etc)

Reimplemented in EditorToySceneWindow, GuiEditCtrl, GuiFrameSetCtrl, GuiTextEditCtrl, and GuiWindowCtrl.

◆ getExtent()

const Point2I & getExtent ( )
inline

Returns extents of the control.

◆ getFirstResponder()

GuiControl * getFirstResponder ( )
inline

Returns the first responder for this chain.

◆ getFloatVariable()

F32 getFloatVariable ( )
protected

Returns value of control's bound variable as a float.

◆ getFontColor()

const ColorI & getFontColor ( GuiControlProfile * profile,
const GuiControlState state = GuiControlState::NormalState )
protected

◆ getGUILangTable()

LangTable * getGUILangTable ( void )

◆ getGUIString()

const UTF8 * getGUIString ( S32 id)

◆ getHeight()

const S32 getHeight ( )
inline

Returns the height of the control.

◆ getHorizSizing()

const horizSizingOptions getHorizSizing ( )
inline

◆ getInnerRect() [1/3]

RectI getInnerRect ( GuiControlState currentState = GuiControlState::NormalState)

Returns the bounds of the rect with margin, borders, and padding applied.

◆ getInnerRect() [2/3]

RectI getInnerRect ( Point2I & offset,
GuiControlState currentState = GuiControlState::NormalState )

◆ getInnerRect() [3/3]

RectI getInnerRect ( Point2I & offset,
Point2I & extent,
GuiControlState currentState,
GuiControlProfile * profile )
virtual

Reimplemented in GuiScrollCtrl, and GuiWindowCtrl.

◆ getIntVariable()

S32 getIntVariable ( )
protected

Returns value of control's bound variable as a integer.

◆ getLeft()

const S32 getLeft ( )
inline

Returns the X position of the control.

◆ getLineList()

vector< string > getLineList ( const char * text,
GuiControlProfile * profile,
S32 totalWidth )
virtual

◆ getMinExtent()

const Point2I & getMinExtent ( )
inline

Returns minimum size the control can be.

◆ getOuterExtent()

Point2I getOuterExtent ( Point2I & innerExtent,
GuiControlState currentState,
GuiControlProfile * profile )

Returns the extent of the outer rect given the extent of the inner rect.

◆ getOuterHeight()

S32 getOuterHeight ( S32 innerExtent,
GuiControlState currentState,
GuiControlProfile * profile )

◆ getOuterWidth()

S32 getOuterWidth ( S32 innerExtent,
GuiControlState currentState,
GuiControlProfile * profile )

◆ getParent()

GuiControl * getParent ( )

Returns the control which owns this one.

◆ getPosition()

const Point2I & getPosition ( )
inline

Returns position of the control.

◆ getRoot()

GuiCanvas * getRoot ( )

Returns the root canvas of this control.

◆ getScriptValue()

const char * getScriptValue ( )
virtual

Returns the value of the variable bound to this object.

Reimplemented in GuiButtonCtrl, GuiCheckBoxCtrl, GuiColorPickerCtrl, GuiColorPopupCtrl, GuiProgressCtrl, and GuiTextEditCtrl.

◆ getScrollLineSizes()

void getScrollLineSizes ( U32 * rowHeight,
U32 * columnWidth )
virtual

Get information about the size of a scroll line.

Parameters
rowHeightThe height, in pixels, of a row
columnWidthThe width, in pixels, of a column

◆ getText()

const char * getText ( )
virtual

Reimplemented in GuiTextEditCtrl.

◆ getTextExtend()

bool getTextExtend ( )
inline

◆ getTextHorizontalOffset()

S32 getTextHorizontalOffset ( S32 textWidth,
S32 totalWidth,
AlignmentType align )
protected

◆ getTextProperty()

const char * getTextProperty ( void * obj,
const char * data )
inlinestatic

◆ getTextVerticalOffset()

S32 getTextVerticalOffset ( S32 textHeight,
S32 totalHeight,
VertAlignmentType align )
static

Where a block of text starts, given how tall it is and how tall the room is. Static and public because it reads nothing off the control, and because it is the step that turns a line count into a position – which is how one stray line in the line list becomes a caption drawn a line too high. Tested beside wrapParagraph for exactly that reason.

◆ getTextWrap()

bool getTextWrap ( )
inline

◆ getTop()

const S32 getTop ( )
inline

Returns the Y position of the control.

◆ getVariable()

const char * getVariable ( )
protected

Returns value of control's bound variable as a string.

◆ getVertAlignmentType() [1/2]

VertAlignmentType getVertAlignmentType ( )
protected

◆ getVertAlignmentType() [2/2]

VertAlignmentType getVertAlignmentType ( GuiControlProfile * profile)
protected

◆ getVertSizing()

const vertSizingOptions getVertSizing ( )
inline

◆ getWidth()

const S32 getWidth ( )
inline

Returns the width of the control.

◆ globalToLocalCoord()

Point2I globalToLocalCoord ( const Point2I & src)
virtual

Returns global coordinates translated into local space

Parameters
srcGlobal coordinates to translate

Reimplemented in GuiSceneScrollCtrl.

◆ handleTouchDown()

bool handleTouchDown ( const GuiEvent & event,
const Point2I & pt,
S32 initialLayer = -1 )

◆ handleTouchMove()

bool handleTouchMove ( const GuiEvent & event,
const Point2I & pt,
S32 initialLayer = -1 )

◆ handleTouchUp()

bool handleTouchUp ( const GuiEvent & event,
const Point2I & pt,
S32 initialLayer = -1 )

◆ initPersistFields()

void initPersistFields ( )
static

◆ inspectPostApply()

void inspectPostApply ( )
virtual

Called after any property of the object is changed in the world editor.

See also
inspectPreApply

Reimplemented from SimObject.

Reimplemented in GuiChainCtrl, GuiFrameSetCtrl, GuiGridCtrl, GuiInspector, GuiMenuBarCtrl, GuiMenuItemCtrl, GuiMessageVectorCtrl, GuiSceneObjectCtrl, GuiScrollCtrl, and GuiTextEditCtrl.

◆ inspectPreApply()

void inspectPreApply ( )
virtual

Specifically, this is called by setDataField when a static field is modified, see the console details. Called before any property of the object is changed in the world editor.

The calling order here is:

Reimplemented from SimObject.

Reimplemented in GuiChainCtrl.

◆ interpolateTick()

virtual void interpolateTick ( F32 delta)
inlineprotectedvirtual

This method is called every frame and lets the control interpolate between ticks so you can smooth things as long as isProcessingTicks returns true when it is called on the object

Implements Tickable.

Reimplemented in GuiSpriteCtrl, and SceneWindow.

◆ isActive()

bool isActive ( )
inline

Returns true if this control is active.

◆ isAwake()

bool isAwake ( )
inline

Returns true if this control is awake.

◆ isEditMode()

bool isEditMode ( )
virtual

Reimplemented in GuiCanvas.

◆ isEditSelected()

bool isEditSelected ( )
virtual

◆ isFirstResponder()

bool isFirstResponder ( )

Returns true if this control is a first responder.

◆ isGeometryEditable()

virtual bool isGeometryEditable ( )
inlinevirtual

Whether the Gui Editor may move or resize this control.

False where the PARENT dictates the geometry and the control's own Position and Extent are written over the moment anything re-lays it out - a tab page, a menu item. The editor draws such a control the way it draws a locked one: an outline rather than eight sizing handles, which would otherwise be handles you can drag to no effect at all.

This is the control's own nature, not the user's padlock; isLocked is that, and the editor honours both.

Reimplemented in GuiMenuItemCtrl, and GuiTabPageCtrl.

◆ isHiddenInEditor()

bool isHiddenInEditor ( GuiControl * child)
inline

Whether a child of this control must be treated as though it were not there: the eye in the Gui Editor's Explorer is off for it.

The paint and the hit test both ask this, and they have to agree. A control the editor does not draw must not be a target either, or the eye takes it out of sight while leaving it in the way - which is the one thing hiding is for.

Cheap test first: isHidden is a bit, isEditMode walks the parent chain, and the answer for almost every control on almost every mouse move is no.

◆ isMouseLocked()

bool isMouseLocked ( )
virtual

Returns true if the mouse is locked.

Reimplemented in GuiSceneScrollCtrl.

◆ isVisible()

bool isVisible ( )
inline

Returns true if the object is visible.

◆ localToGlobalCoord()

Point2I localToGlobalCoord ( const Point2I & src)
virtual

Translates local coordinates (wrt this object) into global coordinates

Parameters
srcLocal coordinates to translate

Reimplemented in GuiSceneScrollCtrl.

◆ makeFirstResponder()

void makeFirstResponder ( bool value)
virtual

Sets up this control to be the first in it's group to respond to an input event

Parameters
valueTrue if this should be a first responder

◆ messageSiblings()

void messageSiblings ( S32 message)

Send a message to all siblings.

◆ mouseLock() [1/2]

void mouseLock ( )
virtual

Turn on mouse locking with last used lock control.

Reimplemented in GuiSceneScrollCtrl.

◆ mouseLock() [2/2]

void mouseLock ( GuiControl * lockingControl)
virtual

Lock the mouse within the provided control

Parameters
lockingControlControl to lock the mouse within

Reimplemented in GuiCanvas, and GuiSceneScrollCtrl.

◆ mouseUnlock()

void mouseUnlock ( )
virtual

Unlock the mouse.

Reimplemented in GuiSceneScrollCtrl.

◆ onAction()

void onAction ( )
virtual

Occurs when this control performs its "action".

Reimplemented in GuiButtonCtrl, GuiCheckBoxCtrl, GuiColorPopupCtrl, GuiColorPopupSwatchCtrl, GuiDropDownCtrl, GuiMenuItemCtrl, and GuiRadioCtrl.

◆ onAdd()

bool onAdd ( void )
virtual

◆ onChildAdded()

void onChildAdded ( GuiControl * child)
virtual

Called when this object has a new child. Congratulations!

Reimplemented in GuiChainCtrl, GuiFrameSetCtrl, GuiGridCtrl, GuiMenuBarCtrl, GuiMenuItemCtrl, and GuiTabBookCtrl.

◆ onChildRemoved()

void onChildRemoved ( GuiControl * child)
virtual

Called when a child is removed.

Reimplemented in GuiFrameSetCtrl, GuiGridCtrl, and GuiTabBookCtrl.

◆ onDialogPop()

void onDialogPop ( )
virtual

Called if this object is a dialog, when it is removed from the visible layers.

◆ onDialogPush()

void onDialogPush ( )
virtual

Called if this object is a dialog, when it is added to the visible layers.

◆ onFocus()

void onFocus ( bool foundFirstResponder)
virtual

Reimplemented in GuiCanvas, GuiTextEditCtrl, and GuiWindowCtrl.

◆ onGroupRemove()

void onGroupRemove ( )
virtual

Called when this object is removed using delete or parent.remove().

Reimplemented from SimObject.

◆ onInputEvent()

bool onInputEvent ( const InputEvent & event)
virtual

General input handler.

Reimplemented in GuiInputCtrl.

◆ onKeyDown()

bool onKeyDown ( const GuiEvent & event)
virtual

◆ onKeyRepeat()

bool onKeyRepeat ( const GuiEvent & event)
virtual

Happens when a key is held down, resulting in repeated keystrokes.

Parameters
eventEvent descriptor (which contains the key)

◆ onKeyUp()

bool onKeyUp ( const GuiEvent & event)
virtual

Happens when a key is released

Parameters
eventEvent descriptor (which contains the key)

Reimplemented in GuiButtonCtrl.

◆ onLoseFirstResponder()

void onLoseFirstResponder ( )
virtual

Occurs when the first responder for this chain is lost.

Reimplemented in GuiColorPopupValueCtrl, GuiConsoleEditCtrl, and GuiTextEditCtrl.

◆ onMessage()

void onMessage ( GuiControl * sender,
S32 msg )
virtual

Receive a message from another control.

Reimplemented in GuiButtonCtrl, GuiCheckBoxCtrl, and GuiRadioCtrl.

◆ onMiddleMouseDown()

void onMiddleMouseDown ( const GuiEvent & event)
virtual

Reimplemented in SceneWindow.

◆ onMiddleMouseDragged()

void onMiddleMouseDragged ( const GuiEvent & event)
virtual

Reimplemented in SceneWindow.

◆ onMiddleMouseUp()

void onMiddleMouseUp ( const GuiEvent & event)
virtual

Reimplemented in SceneWindow.

◆ onMouseDownEditor()

bool onMouseDownEditor ( const GuiEvent & event,
const Point2I & offset )
virtual

Called when a mouseDown event occurs on a control and the GUI editor is active

Parameters
eventthe GuiEvent which caused the call to this function
offsetthe offset which is representative of the units x and y that the editor takes up on screen

Reimplemented in GuiFrameSetCtrl, GuiMenuBarCtrl, GuiScrollCtrl, and GuiTabBookCtrl.

◆ onMouseDraggedEditor()

virtual bool onMouseDraggedEditor ( const GuiEvent & event,
const Point2I & offset )
inlinevirtual

Called when a mouseDragged event occurs on a control and the GUI editor is active

Parameters
eventthe GuiEvent which caused the call to this function
offsetthe offset which is representative of the units x and y that the editor takes up on screen

Reimplemented in GuiFrameSetCtrl, and GuiScrollCtrl.

◆ onMouseUpEditor()

virtual bool onMouseUpEditor ( const GuiEvent & event,
const Point2I & offset )
inlinevirtual

Called when a mouseUp event occurs on a control and the GUI editor is active

Parameters
eventthe GuiEvent which caused the call to this function
offsetthe offset which is representative of the units x and y that the editor takes up on screen

Reimplemented in GuiFrameSetCtrl, and GuiScrollCtrl.

◆ onMouseWheelDown()

void onMouseWheelDown ( const GuiEvent & event)
virtual

◆ onMouseWheelUp()

void onMouseWheelUp ( const GuiEvent & event)
virtual

◆ onPreRender()

◆ onRemove()

void onRemove ( )
virtual

Called when this object is removed using delete.

Reimplemented from SimGroup.

Reimplemented in EditorToySceneWindow, GuiEditCtrl, GuiMessageVectorCtrl, GuiTabBookCtrl, and SceneWindow.

◆ onRender()

◆ onRightMouseDown()

void onRightMouseDown ( const GuiEvent & event)
virtual

◆ onRightMouseDownEditor()

virtual bool onRightMouseDownEditor ( const GuiEvent & event,
const Point2I & offset )
inlinevirtual

Called when a rightMouseDown event occurs on a control and the GUI editor is active

Parameters
eventthe GuiEvent which caused the call to this function
offsetthe offset which is representative of the units x and y that the editor takes up on screen

◆ onRightMouseDragged()

void onRightMouseDragged ( const GuiEvent & event)
virtual

Reimplemented in EditorToySceneWindow, and SceneWindow.

◆ onRightMouseUp()

void onRightMouseUp ( const GuiEvent & event)
virtual

◆ onSleep()

◆ onTouchDown()

◆ onTouchDragged()

◆ onTouchEnter()

void onTouchEnter ( const GuiEvent & event)
virtual

◆ onTouchLeave()

◆ onTouchMove()

◆ onTouchUp()

◆ onWake()

◆ parentResized()

void parentResized ( const Point2I & oldParentExtent,
const Point2I & newParentExtent )
virtual

Called when this objects parent is resized

Parameters
oldParentExtentThe old size of the parent object
newParentExtentThe new size of the parent object

Reimplemented in GuiEditFrameStripCtrl, GuiExpandCtrl, GuiFrameSetCtrl, GuiInspector, GuiListBoxCtrl, GuiMessageVectorCtrl, GuiTabPageCtrl, and GuiTextEditCtrl.

◆ pointInControl()

bool pointInControl ( const Point2I & parentCoordPoint)
virtual

This function will return true if the provided coordinates (wrt parent object) are within the bounds of this control

Parameters
parentCoordPointCoordinates to test

Reimplemented in GuiMenuBarCtrl.

◆ preRender()

void preRender ( )

Prerender this control and all its children.

◆ preventHorizResizeModeCenter()

void preventHorizResizeModeCenter ( )

◆ preventHorizResizeModeFill()

void preventHorizResizeModeFill ( )

The same, one axis at a time.

A container that can only offer a child a fixed size in ONE direction – a scroll control, whose other axis is as long as its content wants to be – has to be able to refuse fill across without refusing it down. See GuiScrollCtrl::preventUnsizedModes.

◆ preventResizeModeCenter()

void preventResizeModeCenter ( )

Removes the resize mode of center and changes it to right or bottom.

◆ preventResizeModeFill()

void preventResizeModeFill ( )

Removes the resize mode of fill and changes it to right or bottom.

◆ preventVertResizeModeCenter()

void preventVertResizeModeCenter ( )

◆ preventVertResizeModeFill()

void preventVertResizeModeFill ( )

◆ processTick()

virtual void processTick ( )
inlineprotectedvirtual

This method is called once every 32ms if isProcessingTicks returns true when called on the object

Implements Tickable.

Reimplemented in GuiEasingSupport, GuiExpandCtrl, GuiProgressCtrl, GuiSpriteCtrl, and SceneWindow.

◆ pullIntoView()

bool pullIntoView ( )

The same against the parent this control actually has, resizing it if it had to move. Answers whether it did.

A no-op for a control that is even partly visible, and for one with no parent at all, so a caller can ask about a whole selection without working out which members need it.

◆ relPosBattery()

void relPosBattery ( Point2F & battery,
S32 pos,
S32 ext,
S32 parentExt )

◆ relPosBatteryH()

Point2F relPosBatteryH ( S32 pos,
S32 ext,
S32 parentExt )

◆ relPosBatteryV()

Point2F relPosBatteryV ( S32 pos,
S32 ext,
S32 parentExt )

◆ removeObject()

void removeObject ( SimObject * obj)
virtual

Removes a child object from this control.

Parameters
objObject to remove from this control

Reimplemented from SimGroup.

◆ renderChild()

void renderChild ( GuiControl * ctrl,
const Point2I & offset,
const RectI & content,
const RectI & clipRect )
virtual

Renders a single child control.

Reimplemented in GuiFrameSetCtrl.

◆ renderChildControls()

void renderChildControls ( const Point2I & offset,
const RectI & content,
const RectI & updateRect )
virtual

Called when this control should render its children

Parameters
offsetThe top left of the parent control
contentOffsetThe top left of the parent's content
updateRectThe screen area this control has drawing access to

Reimplemented in GuiScrollCtrl.

◆ renderLineList()

void renderLineList ( const Point2I & offset,
const Point2I & extent,
const S32 startOffsetY,
const vector< string > lineList,
GuiControlProfile * profile,
const TextRotationOptions rot = tRotateNone )
virtual

Reimplemented in GuiTextEditCtrl.

◆ rendersChildren()

bool rendersChildren ( )
inline

True if the control draws its children, which is what makes it able to be a container.

◆ renderText()

void renderText ( const Point2I & offset,
const Point2I & extent,
const char * text,
GuiControlProfile * profile,
TextRotationOptions rot = tRotateNone )

Renders justified text using the profile.

Note
This should move into the graphics library at some point

◆ renderTextLine()

void renderTextLine ( const Point2I & startPoint,
const string line,
GuiControlProfile * profile,
F32 rotationInDegrees,
U32 ibeamPosAtLineStart,
U32 lineNumber )
virtual

◆ renderTooltip()

bool renderTooltip ( Point2I & cursorPos,
const char * tipText = NULL )
virtual

Render a tooltip at the specified cursor position for this control

Parameters
cursorPosposition of cursor to display the tip near
tipTextoptional alternate tip to be rendered

Reimplemented in GuiEditFrameStripCtrl, and GuiEditorExplorerTree.

◆ rescuedPosition()

Point2I rescuedPosition ( const Point2I & pos,
const Point2I & extent,
const Point2I & parentInnerExtent )
static

Where a control goes when a move has stranded it outside its parent.

Reparenting in the Explorer tree is a gesture with no pointer in it, so nothing supplies a position and the control keeps the local one it held in its old parent. Dropped into something smaller that can put it entirely outside: not clipped, not partly visible, gone.

Per axis, because a placement that is still valid should be kept – a control that was 20 pixels down and 400 across is still 20 pixels down. Only when it is ENTIRELY outside on that axis, because a control the user can see is a control the user can drag, and moving one that merely overhangs the edge would be undoing a placement rather than rescuing it.

Static and taking everything it uses, so the arithmetic can be tested without a canvas – as GuiScrollCtrl::subtractScrollBars is.

◆ resetStoredExtent()

void resetStoredExtent ( )
inline

◆ resetStoredRelPos()

void resetStoredRelPos ( )
inline

◆ resize()

void resize ( const Point2I & newPosition,
const Point2I & newExtent )
virtual

Changes the size and/or position of this control

Parameters
newPositionNew position of this control
newExtentNew size of this control

Reimplemented in EditorToySceneWindow, GuiChainCtrl, GuiColorPickerCtrl, GuiFrameSetCtrl, GuiGridCtrl, GuiInspector, GuiInspectorDynamicField, GuiInspectorTypeFileName, GuiMenuBarCtrl, GuiParticleGraphInspector, GuiScrollCtrl, GuiTabBookCtrl, GuiTabPageCtrl, GuiWindowCtrl, and SceneWindow.

◆ resolveDefaultTooltipProfile()

GuiControlProfile * resolveDefaultTooltipProfile ( )

The tooltip profile to use when none was set: the Tooltip member of the theme this control's own profile belongs to, so a tip looks like the rest of the theme, falling back to the global GuiTooltipProfile for a control wearing an unthemed profile. NULL only if neither can be found.

◆ sendScriptKeyEvent()

bool sendScriptKeyEvent ( const char * name,
const InputEvent & event )

◆ sendScriptMouseEvent()

bool sendScriptMouseEvent ( const char * name,
const GuiEvent & event )

◆ setActive()

void setActive ( bool value)
virtual

Sets the status of this control as active and responding or inactive

Parameters
valueTrue if this is active

Reimplemented in GuiButtonCtrl.

◆ setBounds()

void setBounds ( const RectI & newBounds)
virtual

Changes the bounds of this control

Parameters
newBoundsNew bounds of this control

◆ setCanSave()

void setCanSave ( bool bCanSave)

Set serialization flag.

◆ setConsoleCommand()

void setConsoleCommand ( const char * newCmd)

Set the name of the console function bound to, such as a script function a button calls when clicked.

Parameters
newCmdConsole function to attach to this GuiControl

◆ setConsoleVariable()

void setConsoleVariable ( const char * variable)

Set the name of the console variable which this GuiObject is bound to

Parameters
variableVariable name

◆ setControlProfile()

void setControlProfile ( GuiControlProfile * prof)
virtual

Sets the control profile for this control.

See also
GuiControlProfile
Parameters
profControl profile to apply

Reimplemented in GuiEasingSupport, GuiPanelCtrl, and GuiParticleGraphInspector.

◆ setControlTooltipProfile()

void setControlTooltipProfile ( GuiControlProfile * prof)
virtual

Sets the profile this control's tooltips are drawn with, keeping the reference counts straight whether or not the control is already awake. NULL is allowed and means "work one out for yourself" – see resolveDefaultTooltipProfile.

Parameters
profTooltip profile to apply, or NULL

◆ setDataField()

void setDataField ( StringTableEntry slotName,
const char * array,
const char * value )
virtual

Set the value of a field on the object.

See here for a detailed discussion of what this function does.

Parameters
slotNameField to access.
arrayString containing index into array; if NULL, it is ignored.
valueValue to store.

Reimplemented from SimObject.

◆ setExtent()

void setExtent ( const Point2I & newExtent)
virtual

Changes the size of this control

Parameters
newExtentNew size of this control

◆ setExtentFn()

bool setExtentFn ( void * obj,
const char * data )
inlinestatic

◆ setFirstResponder() [1/2]

void setFirstResponder ( )
virtual

Sets this object to be a first responder.

Reimplemented in GuiTextEditCtrl.

◆ setFirstResponder() [2/2]

void setFirstResponder ( GuiControl * firstResponder)
virtual

Sets the first responder for child controls

Parameters
firstResponderFirst responder for this chain

Reimplemented in GuiCanvas.

◆ setFloatVariable()

void setFloatVariable ( F32 value)
protected

Sets the value of the console variable bound to this control

Parameters
valueFloat value to assign to control's console variable

◆ setHeight()

void setHeight ( S32 newHeight)
virtual

Changes the height of this control

Parameters
newHeightNew Height of this control

◆ setHorizSizing()

void setHorizSizing ( const horizSizingOptions sizing)
inline

◆ setIntVariable()

void setIntVariable ( S32 value)
protected

Sets the value of the console variable bound to this control

Parameters
valueInteger value to assign to control's console variable

◆ setIsContainerFn()

bool setIsContainerFn ( void * obj,
const char * data )
inlinestatic

◆ setLeft()

void setLeft ( S32 newLeft)
virtual

Changes the X position of this control

Parameters
newXPositionNew X Position of this control

◆ setMinExtentFn()

bool setMinExtentFn ( void * obj,
const char * data )
inlinestatic

◆ setPosition()

void setPosition ( const Point2I & newPosition)
virtual

Changes the position of this control

Parameters
newPositionNew position of this control

◆ setPositionFn()

bool setPositionFn ( void * obj,
const char * data )
inlinestatic

◆ setScriptValue()

void setScriptValue ( const char * value)
virtual

Sets the value of the variable bound to this object.

Reimplemented in GuiButtonCtrl, GuiCheckBoxCtrl, GuiColorPickerCtrl, GuiColorPopupCtrl, GuiProgressCtrl, GuiSliderCtrl, and GuiTextEditCtrl.

◆ setSizing()

void setSizing ( S32 horz,
S32 vert )

Sets the size of the GuiControl

Parameters
horzWidth of the control
vertHeight of the control

◆ setText()

void setText ( const char * text)
virtual

◆ setTextExtend()

void setTextExtend ( const bool extend)
inline

◆ setTextID() [1/2]

void setTextID ( const char * id)
virtual

Reimplemented in GuiTextEditCtrl.

◆ setTextID() [2/2]

void setTextID ( S32 id)
virtual

Reimplemented in GuiTextEditCtrl.

◆ setTextProperty()

bool setTextProperty ( void * obj,
const char * data )
inlinestatic

◆ setTextWrap()

void setTextWrap ( const bool wrap)
inline

◆ setTop()

void setTop ( S32 newTop)
virtual

Changes the Y position of this control

Parameters
newYPositionNew Y Position of this control

◆ setUpdate()

void setUpdate ( )
virtual

Sets the update area of the control to encompass the whole control.

Reimplemented in GuiMenuBarCtrl, and GuiTabBookCtrl.

◆ setUpdateRegion()

void setUpdateRegion ( Point2I pos,
Point2I ext )

Sets the area (local coordinates) this control wants refreshed each frame

Parameters
posUpperLeft point on rectangle of refresh area
extExtent of update rect

◆ setVariable()

void setVariable ( const char * value)
protected

Sets the value of the console variable bound to this control

Parameters
valueString value to assign to control's console variable

◆ setVertSizing()

void setVertSizing ( const vertSizingOptions sizing)
inline

◆ setVisible()

void setVisible ( bool value)
virtual

Sets the visibility of the control

Parameters
valueTrue if object should be visible

◆ setWidth()

void setWidth ( S32 newWidth)
virtual

Changes the width of this control

Parameters
newWidthNew width of this control

◆ sleep()

void sleep ( )

Called when this control is no more.

◆ splitParagraphs()

vector< string > splitParagraphs ( const char * text)
static

Splits text into paragraphs on its line breaks. The measuring half of getLineList needs a font; this half does not, which is what lets it be tested on its own.

◆ wrapParagraph()

vector< string > wrapParagraph ( const string & paragraph,
S32 totalWidth,
TextWidthFn measure,
void * context )
static

Breaks one paragraph into the lines it is drawn as. The word-fitting half of getLineList, separated from the font for the same reason as above.

◆ write()

void write ( Stream & stream,
U32 tabStop,
U32 flags )
virtual

Overrides Parent Serialization to allow specific controls to not be saved (Dynamic Controls, etc).

Reimplemented from SimSet.

◆ writeFontColorFn()

bool writeFontColorFn ( void * obj,
const char * data )
inlinestaticprotected

◆ writeFontSizeAdjustFn()

bool writeFontSizeAdjustFn ( void * obj,
const char * data )
inlinestaticprotected

◆ writeIsContainerFn()

bool writeIsContainerFn ( void * obj,
const char * data )
inlinestatic

◆ writeMinExtentFn()

bool writeMinExtentFn ( void * obj,
const char * data )
inlinestatic

◆ writeOverrideFontColorFn()

bool writeOverrideFontColorFn ( void * obj,
const char * data )
inlinestaticprotected

◆ writeTextExtendFn()

bool writeTextExtendFn ( void * obj,
const char * data )
inlinestatic

◆ writeTextWrapFn()

bool writeTextWrapFn ( void * obj,
const char * data )
inlinestatic

◆ writeToolTipHoverTimeFn()

bool writeToolTipHoverTimeFn ( void * obj,
const char * data )
inlinestatic

◆ writeToolTipWidthFn()

bool writeToolTipWidthFn ( void * obj,
const char * data )
inlinestatic

◆ writeUseInputFn()

bool writeUseInputFn ( void * obj,
const char * data )
inlinestatic

◆ writeVisibleFn()

bool writeVisibleFn ( void * obj,
const char * data )
inlinestatic

Member Data Documentation

◆ DEFAULT_TOOLTIP_HOVERTIME

const S32 DEFAULT_TOOLTIP_HOVERTIME = 1000
static

◆ DEFAULT_TOOLTIP_WIDTH

const S32 DEFAULT_TOOLTIP_WIDTH = 250
static

◆ mAcceleratorKey

StringTableEntry mAcceleratorKey
protected

◆ mActive

bool mActive

◆ mAlignment

AlignmentType mAlignment
protected

◆ mAllowEventPassThru

bool mAllowEventPassThru

◆ mAltConsoleCommand

StringTableEntry mAltConsoleCommand
protected

◆ mAwake

bool mAwake

◆ mBounds

RectI mBounds

◆ mCanSave

bool mCanSave

◆ mConsoleCommand

StringTableEntry mConsoleCommand
protected

◆ mConsoleVariable

StringTableEntry mConsoleVariable
protected

◆ mFirstResponder

GuiControl* mFirstResponder

◆ mFontColor

ColorI mFontColor
protected

◆ mFontSizeAdjust

F32 mFontSizeAdjust
protected

◆ mHorizSizing

S32 mHorizSizing
protected

Set from horizSizingOptions.

◆ mIsContainer

bool mIsContainer

True if the GuiEditor can drag other controls into this one.

◆ mLangTable

LangTable* mLangTable

◆ mLangTableName

StringTableEntry mLangTableName

The actual rendered inset for the right and bottom sides.

◆ mLayer

S32 mLayer

◆ mLazyTooltipProfile

GuiControlProfile* mLazyTooltipProfile

The tooltip profile renderTooltip chose for a control that was never given one, kept so a later render can tell its own pick from a deliberate one and re-resolve only its own. NULL until the first tooltip is drawn.

◆ mMinExtent

Point2I mMinExtent

◆ mOverrideFontColor

bool mOverrideFontColor
protected

◆ mPassEventThru

bool mPassEventThru = false

◆ mPreviouslyAwake

bool mPreviouslyAwake
protected

◆ mProfile

GuiControlProfile* mProfile

◆ mRenderInsetLT

Point2I mRenderInsetLT

◆ mRenderInsetRB

Point2I mRenderInsetRB

Add this to the mBounds and parent offset to get the true render location of the control.

◆ mRendersChildren

bool mRendersChildren

True if the control renders children. If false, then the control cannot be a container. This is set by the class and cannot be changed by the user.

◆ mSetFirstResponder

bool mSetFirstResponder

◆ mStoredExtent

Point2I mStoredExtent
protected

◆ mStoredRelativePosH

Point2F mStoredRelativePosH
protected

◆ mStoredRelativePosV

Point2F mStoredRelativePosV
protected

◆ mText

StringTableEntry mText
protected

◆ mTextExtend

bool mTextExtend
protected

◆ mTextID

StringTableEntry mTextID
protected

◆ mTextWrap

bool mTextWrap
protected

◆ mTipHoverTime

S32 mTipHoverTime

◆ mTooltip

StringTableEntry mTooltip
protected

◆ mTooltipProfile

GuiControlProfile* mTooltipProfile

◆ mTooltipWidth

S32 mTooltipWidth

◆ mUseInput

bool mUseInput

True if input events like a click can be passed to this gui. False will pass events to the parent and this object and its children will not process input (touch and keyboard).

◆ mUseRelPosH

bool mUseRelPosH
protected

◆ mUseRelPosV

bool mUseRelPosV
protected

◆ mVAlignment

VertAlignmentType mVAlignment
protected

◆ mVertSizing

S32 mVertSizing
protected

Set from vertSizingOptions.

◆ mVisible

bool mVisible

◆ smCurResponder

GuiControl * smCurResponder = NULL
static

◆ smCursorChanged

S32 smCursorChanged = -1
static

Has this control modified the cursor? -1 or type.

◆ smDesignTime

bool smDesignTime = false
static

static GuiControl boolean that specifies if the GUI Editor is active

◆ smEditorHandle

GuiEditCtrl * smEditorHandle = NULL
static

static GuiEditCtrl pointer that gives controls access to editor-NULL if editor is closed

◆ smPrevResponder

GuiControl * smPrevResponder = NULL
static

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