GL Studio C++ Runtime API
GlsTextBox Class Reference

#include <gls_text_box.h>

Inheritance diagram for GlsTextBox:
GlsText GLPolygon DisplayObject AttributeChangedNotifier WeakReferenceableMixin WeakReferenceable


struct  RowInfo
class  UnderlineStrikeThruHelper

Public Member Functions

 GlsTextBox ()
virtual ~GlsTextBox ()
virtual void SetAvailableAttributes (unsigned int value) DISTI_METHOD_OVERRIDE
virtual void Calculate (double time) DISTI_METHOD_OVERRIDE
virtual DisplayObjectCloneObject (bool generateNames=false) DISTI_METHOD_OVERRIDE
virtual void CopyGeometry (DisplayObject *src) DISTI_METHOD_OVERRIDE
virtual void CopyProperties (DisplayObject *src) DISTI_METHOD_OVERRIDE
virtual void Draw (void) DISTI_METHOD_OVERRIDE
virtual InterfaceListTypeGetCppInterfaceDescription (InterfaceListType *addToThisList=NULL) DISTI_METHOD_OVERRIDE
virtual void GetCppInterfaceDescriptionFree (InterfaceListType *array) DISTI_METHOD_OVERRIDE
virtual void SetVertices (unsigned int nPoints, Vertex *vertices) DISTI_METHOD_OVERRIDE
void Rebuild ()
virtual unsigned int MaxLinesToDraw (void)
virtual void Scale (float px, float py, float pz, Vertex *anchor, int handleBar) DISTI_METHOD_OVERRIDE
void VerticalAlignment (Align_t justification)
virtual Align_t VerticalAlignment () const
void Clear (void)
void ClearChars (void)
void SetString (const char *s)
void VaString (const char *format,...)
void TabSpacing (float)
float TabSpacing ()
bool LeftToRight (void)
void LeftToRight (bool leftToRight)
float GetCharWidth (const unsigned short c) const
- Public Member Functions inherited from GlsText
 GlsText ()
virtual ~GlsText ()
void Baseline (const float &baselineShift)
float Baseline ()
void BgColor (const GlsColor &color)
GlsColor BgColor ()
void Border (const float &units)
float Border () const
void CellHeight (float height)
float CellHeight () const
void CellWidth (float width)
float CellWidth () const
void Char (Char_t code)
CharAttr_t CharAttribs () const
CharAttr_t CharAttr (unsigned int index) const
void CharScaling (const float &newScale)
float CharScaling ()
void CharSpacing (const float &horizontalSpacing)
float CharSpacing ()
void ConstrainCellRatio (bool constrain)
bool ConstrainCellRatio () const
void ControlCellSize (bool control)
bool ControlCellSize () const
void Erase ()
void FauxBold (const bool &bold)
bool FauxBold ()
GlsFontBaseFont () const
void Font (GlsFontBase *font)
void Halo (bool halo)
void HaloColor (const GlsColor &color)
void InvalidateFont ()
void Inverse (const bool &inverse)
bool Inverse ()
void Justify (Justify_t justification)
Justify_t Justify () const
void LineSpacing (float spacing)
float LineSpacing () const
void LockCellSize (bool lock)
bool LockCellSize () const
virtual void Rotate (const Vector &orig, float angle, const Vector &axis) override
virtual void SetValue (int spec, va_list &args) override
void Shadow (bool shadow)
void ShadowColor (const GlsColor &color)
void ShadowDistance (const float &dist)
void ShadowOffset (const Vector &offset)
void StrikeThru (const bool &strike)
bool StrikeThru ()
virtual void String (const std::string &s)
virtual void String (const char *s)
std::string String () const
void TextColor (const GlsColor &color)
GlsColor TextColor ()
void Underline (const bool &underline)
bool Underline ()
void Uppercase (bool uppercase)
void WrapText (bool wrap)
bool WrapText () const
void SetRebuild ()
virtual bool RequiresFontFile () const
- Public Member Functions inherited from GLPolygon
 GLPolygon (unsigned int nPoints, const Vertex *vertices)
 GLPolygon (unsigned int nPoints, const Vertex *vertices, const Vertex &location)
 GLPolygon (void)
 GLPolygon (const GLPolygon &polygon, const bool generateNames)
virtual ~GLPolygon (void)
void ConfigureMetaData (void)
virtual void CalculateTextureCoordinates (void)
virtual void CalcNormals (int windingOrder=1)
virtual void DeleteVertexAt (unsigned int index)
virtual DisplayObjectPick3D (const Vector &winLoc, const Vector &logicalCoords, float scale, const Vector &directionVector, Vector &collisionWinLoc, const OpenGLMatrices &parentDrawn)
- Public Member Functions inherited from DisplayObject
 DisplayObject (float x, float y, float z)
 DisplayObject (const DisplayObject &object, const bool generateNames)
virtual ~DisplayObject (void)
void Destroy ()
virtual void AlphaMode (int mode)
virtual int AlphaMode (void)
virtual bool AntiAlias (void)
virtual void AntiAlias (bool alias)
void ApplyTextureSettings (int textureIndex=-1)
DistiAttribDictAttributes ()
virtual void SetBlendColor (const GlsColor &color)
void GetBlendColor (unsigned char color[])
void GetBlendColor (unsigned char &r, unsigned char &g, unsigned char &b, unsigned char &a)
virtual GlsColor GetBlendColor ()
void SetBlendColor (unsigned char color[])
void SetBlendColor (unsigned char r, unsigned char g, unsigned char b, unsigned char a)
bool BlinkedOff (void)
virtual bool Blinking (void)
virtual void Blinking (const bool blink)
virtual float BlinkRate (void)
virtual void BlinkRate (const float rate)
const VectorBoundingVolumeCenter () const
void BoundingVolumeCenter (const Vector &center)
bool BoundingVolumeHit (const Vector &start, const Vector &direction)
float BoundingVolumeRadius () const
void BoundingVolumeRadius (float radius)
void CalculateCollisionPoint (const Vector &pickLoc, const Vector &directionVector, Vector *collisionPoint)
virtual void CalculateParentBoundingBox (void)
bool GetTexturePointTransformationMatrix (GlsMatrixType &world2tex)
CallbackMethodCallerBaseCallbackCaller () const
void CallbackCaller (CallbackMethodCallerBase *cb)
virtual void GetCenter (Vector &center)
virtual GlsColor GetColor ()
void GetColor (unsigned char c4[])
void GetColor (unsigned char &r, unsigned char &g, unsigned char &b, unsigned char &a)
virtual void SetColor (const GlsColor &color)
void SetColor (unsigned char c4[])
void SetColor (unsigned char r, unsigned char g, unsigned char b, unsigned char a)
virtual void CopyHierarchyProperties (DisplayObject *src, bool copyName)
virtual void CullBackFace (const bool val)
virtual bool CullBackFace (void)
bool Culled () const
bool CullTest (const GlsMatrixType *matrix, const Culler &culler)
GlsMatrixTypeDcsMatrix ()
void DcsMatrix (const GlsMatrixType &matrix)
virtual void DeleteVertex (unsigned int indexAfter) final
virtual int DepthTest (void)
virtual void DepthTest (unsigned char zbuf)
const GlsMatrixTypeDrawMatrix ()
bool NeedCalcDrawMatrix ()
void DynamicRotate (float angle, int axis)
void DynamicRotate (const Vector &v)
void DynamicRotate (float angle[])
virtual void DynamicRotate (float x, float y, float z)
virtual void DynamicRotateRelative (float angle, int axis)
virtual float DynamicRotation (int axis)
virtual Vector DynamicScale ()
virtual void DynamicScale (float x, float y, float z)
void DynamicScale (const Vector &scale)
virtual void DynamicTranslate (float x, float y, float z, bool relative=false)
void DynamicTranslate (const Vertex &amount, bool relative)
void DynamicTranslate (const Vector &amount)
virtual void DynamicTranslate (float amount, int axis, bool relative=false)
virtual float DynamicTranslation (int axis)
virtual Vector DynamicTranslation ()
DisplayObjectEditor * Editor ()
const DisplayObjectEditor * Editor () const
void Editor (DisplayObjectEditor *editor)
virtual void GetExtents (float &x, float &y, float &z, float &x1, float &y1, float &z1)
void GetExtentsDCS (Vector &min, Vector &max)
void GetFillColor (unsigned char &r, unsigned char &g, unsigned char &b, unsigned char &a)
void GetFillColor (unsigned char c4[])
virtual GlsColor GetFillColor (void)
void SetFillColor (unsigned char r, unsigned char g, unsigned char b, unsigned char a)
void SetFillColor (unsigned char c4[])
virtual void SetFillColor (const GlsColor &color)
virtual void FinishObject ()
virtual void GenerateInstanceName (void)
virtual DisplayObjecthandle (DisplayEvent *ev)
virtual bool Hit (float x, float y, float z, float scale, const Vector &directionVector, Vector *collisionPoint)
virtual bool HitUtil (float x, float y, float z, float scale, Vertex *vertices, unsigned int vertex_cnt, const Vector &directionVector, Vector *collisionPoint)
virtual void InsertVertexAt (unsigned int index)
virtual void InsertVertex (unsigned int indexAfter) final
char * InstanceName (void)
void InstanceName (const char *name)
virtual bool LightingEnabled ()
virtual void LightingEnabled (bool lighting)
virtual int LineStippleMultiplier (void)
virtual void LineStippleMultiplier (int mult)
virtual int LineStipplePattern (void)
virtual void LineStipplePattern (int pattern)
virtual float LineWidth (void)
virtual void LineWidth (float width)
virtual const VertexLocation (void) const
virtual void Location (const Vertex &v)
virtual void Location (float x, float y, float z)
virtual void GetLocation (Vertex &v)
virtual void GetLocation (float &x, float &y, float &z)
float X (void) const
float Y (void) const
float Z (void) const
void X (const float x)
void Y (const float y)
void Z (const float z)
virtual int MaterialIndex ()
virtual void MaterialIndex (int index)
virtual DynamicArray< int > & MaterialIndices ()
virtual void MaterialIndices (DynamicArray< int > indices)
GlsMatrixTypeModelMatrix ()
bool NeedCalculate ()
VectorNormals ()
virtual void SetNormals (unsigned int nPoints, Vector *vertices)
void VaSetNormals (unsigned int nPoints,...)
unsigned int NumberOfVertices () const
virtual float ObjectDepth (void)
virtual float ObjectHeight (void)
virtual float ObjectWidth (void)
virtual void SetOrigin (const Vertex &vert)
virtual void Parent (DisplayFrame *par)
DisplayFrameParent (void) const
virtual void ParentGroup (Group *group)
GroupParentGroup (void) const
unsigned char Pickable ()
virtual void Pickable (unsigned char pick)
virtual int PolygonEnd (void)
virtual void PolygonEnd (const int end)
virtual int PolygonMode (void)
virtual void PolygonMode (int mode)
virtual void PreDraw (const OpenGLMatrices &current, Culler &culler)
GlsMatrixTypeProjMatrix ()
virtual void ReallocateVertices (unsigned int numVertices, bool initializeNew, bool copyOld)
virtual float RelativeAngle (const float x, const float y)
virtual DistiAttributeBaseResource (const char *name)
virtual void GetResources (std::ostream &outstr, GlsResourceFilter *filter=NULL)
void RestoreAlpha (void)
void RestoreAntiAlias (void)
void RestoreLighting (void)
void RestoreLineStyle (void)
const VertexRotationPoint () const
virtual void RotationPoint (const Vertex &v)
virtual void RotationPoint (float x, float y, float z)
virtual void GetRotationPoint (Vertex &v)
virtual void Rotate (float angle, int axis=Z_AXIS)
virtual void Rotate (const Vector &origin, float angle, int axis=Z_AXIS)
void SaveMatrices ()
void Set (int spec,...)
bool SetupAlpha (void)
bool SetupAntiAlias (void)
void SetupDepthTest (void)
void SetupLighting (void)
bool SetupLineStyle (void)
void SetupPolyDrawStyle (void)
void SetupShading (void)
bool SetupTexture (void)
virtual int Shading (void)
virtual void Shading (const int shading)
virtual void GetTransformedExtents (Vector &min, Vector &max, const GlsMatrixType &matrix, bool resetMinMax=true)
virtual void SetTexCoords (unsigned int nPoints, Vector *new_tex_coord, bool isVectorArray=true)
void SetTexCoords (unsigned int nPoints, Vertex *new_tex_coord)
void VaSetTexCoords (unsigned int nPoints,...)
VectorTextureCoordinates (void)
VectorGetTextureCoordinates (void)
virtual int TextureIndex (void)
virtual void TextureIndex (int textureIndex)
virtual VectorGetTexturePoints (void)
virtual bool TextureRepeat (void)
virtual void TextureRepeat (const int rep)
virtual int TextureMappingTechnique (void)
virtual void TextureMappingTechnique (const int map)
virtual int TextureMagnificationFilter (void)
virtual void TextureMagnificationFilter (const int filter)
virtual int TextureMinificationFilter (void)
virtual void TextureMinificationFilter (const int filter)
virtual void Translate (float tr[])
virtual void Translate (float x, float y, float z)
virtual void TranslateVertices (float x, float y, float z)
virtual void UpdateBoundingVolume (void)
void * UserData (void) const
void UserData (void *data)
virtual void SetVertexColor (unsigned int vertex, unsigned char CurrentFillColor[])
virtual VertexVertices ()
void VaSetVertices (unsigned int nPoints,...)
int * ViewMatrix ()
bool Visible (void) const
bool Visibility (void) const
virtual void Visibility (const bool vis)
virtual Vector WorldRotationPoint (void)
virtual void WorldRotationPoint (const Vector &vert)
virtual Vertex WorldVertex (unsigned int i)
virtual void WorldVertex (unsigned int i, const Vertex &vert)
bool LogicalToWindow (const Vector &logical, Vector &winLoc, const OpenGLMatrices &alternateMatrices=OpenGLMatrices())
bool WindowToLogical (const Vector &winLoc, Vector &logical, Vector *directionVector=NULL, const OpenGLMatrices &alternateMatrices=OpenGLMatrices())
void LogicalToDCS (Vector logicalPoint, Vector &objectLocal, const Vector *directionVector, const Vector &planeNormal=Vector(0, 0, 1), const Vector &planePoint=Vector(), const GlsMatrixType *dcsMatrix=NULL)
void DCSToLogical (Vector dcsPoint, Vector &logicalPoint, const GlsMatrixType *dcsMatrix=NULL)
virtual bool GetPlaneVectorPoints (Vertex &p1, Vertex &p2, Vertex &p3, Vertex &planeVector)
void NotifyAttributeChanged (const AttributeName &name) override
virtual void SetPainter (GlsPainter *painter)
virtual GlsPainterGetPainter ()
void InvalidatePainter ()
virtual bool IsVisibleInScene (const DisplayObject *obj=NULL) const
- Public Member Functions inherited from AttributeChangedNotifier
virtual ~AttributeChangedNotifier ()
- Public Member Functions inherited from WeakReferenceableMixin
void AddWeakReference (WeakReference *weakRef) override
void NotifyWeakReferenceDestroyed (WeakReference *ref) override

Protected Member Functions

virtual void CalculateRowData (void)
- Protected Member Functions inherited from GlsText
char * FormatVarArgList (const int initialBufferLength, const char *format, va_list args)
- Protected Member Functions inherited from DisplayObject
virtual void VaListSetVertices (unsigned int nPoints, va_list args)
virtual void VaListSetNormals (unsigned int nPoints, va_list args)
virtual void VaListSetTexCoords (unsigned int nPoints, va_list args)
void AllocateModelMatrix ()
bool ApplyDynamicRotation (void)
virtual void CalcDrawMatrix ()
void CalcDrawMatrixIfExists ()
virtual void CalculateMatrices (const OpenGLMatrices &newMatrices)
bool InsideVertexExtents (float x, float y, unsigned int nVerts, Vertex *verts, float tolerance)
void NeedCalculate (bool val)
void PickSetup (float x, float y, float z, Vertex *vertices, unsigned int vertex_cnt, const Vector &directionVector)
void PickCleanup (Vertex *vertices, unsigned int vertex_cnt)
int GetApplicableTextureIndex ()
int GetApplicableTextureRepeat ()
- Protected Member Functions inherited from WeakReferenceableMixin
 WeakReferenceableMixin (void)
virtual ~WeakReferenceableMixin ()

Protected Attributes

unsigned int _lineCount
bool _leftToRight
UTF16String _unicodeText
- Protected Attributes inherited from GlsText
float _border
CharAttrCont_t _chars
float _cellHeight
float _cellWidth
bool _constrainRatio
bool _controlCellSize
GlsColor _haloColor
Justify_t _justify
float _lineSpacing
bool _lockCellSize
bool _needToRebuild
GlsColor _shadowColor
Vector _shadowOffset
std::string _text
bool _uppercase
Vector _vX
Vector _vY
Vector _vZ
bool _wrapText
ScopedPtr< RuntimeGlyphGenerationText > _runtimeGlyphGenerationText
- Protected Attributes inherited from DisplayObject
int _alphaMode
bool _antiAlias
bool _attributesAdded
bool _blinking
float _blinkRate
GlsColor _color
bool _cullBackFace
GlsMatrixType _dcsMatrix
unsigned char _depthTest
unsigned char _lineStippleMultiplier
unsigned short _lineStipplePattern
float _lineWidth
Vertex _location
unsigned int _nTex_vertices
unsigned int _nVertices
unsigned char _polygonEnd
unsigned char _polygonMode
int _polygonOffset
unsigned char _shading
GlsColor _textureBlendColor
int _textureIndex
unsigned char _textureMagFilter
unsigned char _textureMinFilter
unsigned char _textureMap
Vector _texturePoints [4]
unsigned char _textureRepeat
void * _userData
int * _viewMatrix
bool _visible
- Protected Attributes inherited from WeakReferenceableMixin
DynamicArray< WeakReference * > * _weakRefs

Additional Inherited Members

- Public Types inherited from GlsText
enum  Justify_t
 Different text justifications.
- Public Types inherited from DisplayObject
enum  AvailableAttributesEnum
- Static Public Member Functions inherited from GlsText
static void DrawScalableLine (GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
- Static Public Member Functions inherited from DisplayObject
static void UseManualBlinkElapsedTime (bool useManualTime)
static void SetManualBlinkElapsedTime (double elapsedTime)

Detailed Description

Constructor & Destructor Documentation

Class Constructor.

virtual ~GlsTextBox ( )

Class Constructor.

Member Function Documentation

virtual void Calculate ( double  time)

Provides a mechanism for performing regular calculations, seperate from drawing. In a standalone applicaton Calculate is recursively called by the main loop before the objects are drawn.

timeThe elaspsed time in seconds since program start

Reimplemented from DisplayObject.

virtual void CalculateRowData ( void  )

Populate the _rowInfo array based on the current display string

_rowInfo array is populated based on the current display string
void Clear ( void  )

Clears all of the characters and resets the attributes of all characters (TextDisplay compatability method)

use Erase instead
void ClearChars ( void  )

Clears all of the characters. Does NOT reset the attributes of the characters (TextDisplay compatability method)

virtual DisplayObject* CloneObject ( bool  generateNames = false)

Copy+Create operation in one method. In derived classes, this method will create a new instance of the derived class and then copy the object into the new instance. The cut,copy,paste and undo operations use this method.

generateNamesWhether or not to generate new names for cloned objects
A new object, identical to the original, except for the instance name

Reimplemented from GLPolygon.

virtual void CopyGeometry ( DisplayObject src)

Copies the geometry information from one object to another. Used by the undo mechanism to allow user to undo a geometry change.

srcThe object to copy geometry from

Reimplemented from GlsText.

virtual void CopyProperties ( DisplayObject src)

Copies the attributes except for geometry attributes from one object to another. Used by the undo mechanism to undo most attribute change operations.

srcThe object to copy properties from

Reimplemented from GlsText.

virtual void Draw ( void  )

Draws this object on the current display frame (_parent member).

Reimplemented from GLPolygon.

float GetCharWidth ( const unsigned short  c) const

Get the width for the given character taking into account cell sizing, character spacing, uppercasing and tab characters width being expanded

ccharacter in question
width for given character
virtual InterfaceListType* GetCppInterfaceDescription ( InterfaceListType addToThisList = NULL)

Get the details of the Cpp Interface The actual interface is exposed in compiled code.

addToThisListIf not NULL this list will be added to then returned. If NULL a new list will be created.
A templated list. The caller must call the corresponding free method to safely free the memory.

Reimplemented from GlsText.

virtual void GetCppInterfaceDescriptionFree ( InterfaceListType array)

Frees the memory allocated by a previous call to GetCppInterfaceDescription

arrayMemory allocated by a previous call to GetCppInterfaceDescription

Reimplemented from GlsText.

bool LeftToRight ( void  )

Determine if the text direction is set to left->right or right->left

true if if the text direction is set to left->right else false for right->left
void LeftToRight ( bool  leftToRight)

Set the text direction

leftToRighttrue for left->right else false for right->left
virtual unsigned int MaxLinesToDraw ( void  )

We need to know the Max number of lines/rows possible to display, we may run out of characters to print/display before we hit the max number of lines though.

A value between Zero and INT_MAX, representing the max lines/rows to draw
The TextBox object has been initialized
The value of max lines returned to the caller
void Rebuild ( )

Rebuilds this text box layout. This may be an expensive call, so it should only be called when a property changes.

virtual void Scale ( float  px,
float  py,
float  pz,
Vertex anchor,
int  handleBar 

Scales the object, either the handleBar, or the Anchor is used to translate the object, not both. Anchor takes presidence, if it is set HandleBar is ignored. The footprint is different from the 2D scale so the compiler can destinguish the two.

pxValue of the percentage of scale in x-axis
pyValue of the percentage of scale in y-axis
pzValue of the percentage of scale in z-axis
anchorAnchor from which to scale object relative to
handleBarVertex that is being dragged

Reimplemented from DisplayObject.

virtual void SetAvailableAttributes ( unsigned int  value)

Specifies which attributes are available for the object. Currently the available attributes cannot be changed after they have been set. (Only the first call has an effect.)

valueA bitfield specifying which types of attributes to make available.
See also

Reimplemented from GlsText.

void SetString ( const char *  s)

SetColor() meaning has changed, now use TextColor Print a string into this text object starting at index 0 and proceeding Left to right Wraps at newline characters. Does not change the color or any other modes. Replaces the entire string. (TextDisplay compatability method)

sThe string to print
use String instead
virtual void SetVertices ( unsigned int  nPoints,
Vertex vertices 

Sets the vertex data for this polygon You should call UpdateBoundingVolume after changing an object's extents.

See also
nPointsThe number of vertices in the object
verticesThe vertex data for the object

Reimplemented from DisplayObject.

void TabSpacing ( float  )

Sets tab space multiplier, 1.0 == same as specified in font

float TabSpacing ( )

Returns the current tab space multiplier

the current tab space multiplier
void VaString ( const char *  format,

Print a string into this text object to right. Wraps at newline characters. Does not change the color or any other modes. Replaces the entire string.

formatprintf style varargs formatting string.
void VerticalAlignment ( Align_t  justification)

Set the vertical justification for this text object

justificationThe justification mode (TOP, BOTTOM, CENTER)
virtual Align_t VerticalAlignment ( ) const

Get the vertical justification for this text object

vertical justification

Member Data Documentation

bool _leftToRight

true to render characters from left to right else false for right to left

unsigned int _lineCount

Number of rows of characters in the text grid (number of lines)

RowInfo* _rowInfo

array ( _rows number of elements ) of RowInfo

UTF16String _unicodeText

unicode version of _text from base class, updated by CalculateRowData

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