GL Studio Safety Critical Embedded C++ Runtime Library
GlsTextGrid Class Reference

#include <gls_text_grid.h>

+ Inheritance diagram for GlsTextGrid:

Classes

class  CharAttributeGrid
 
struct  InitParameters
 

Public Member Functions

 GlsTextGrid (const InitParameters &initParameters, GlsEventDispatcher *const eventDispatcher)
 
virtual void SetCharAttributes (const GlsText::CharAttribute &charAttribute)
 
void SetCharAttribute (const GlsUInt32 column, const GlsUInt32 row, const GlsText::CharAttribute &charAttribute)
 
- Public Member Functions inherited from GlsText
virtual void Draw (GlsStateManager &gl, const GlsFloat64 time)
 
virtual void SetAlphaMode (const GlsAlphaMode alphaMode)
 
virtual void SetFillColor (const GlsColor &fillColor)
 
virtual void SetLineColor (const GlsColor &lineColor)
 
virtual void SetLineWidth (const GlsFloat32 lineWidth)
 
virtual void SetPolygonMode (const GlsPolygonMode polygonMode)
 
virtual void SetTextureIndex (const GlsUInt32 textureIndex)
 
virtual void OffsetTexture (const GlsVector2D &offset)
 
void SetString (const GlsChar *const str)
 
void SetHaloColor (const GlsColor &haloColor)
 
void SetShadowColor (const GlsColor &shadowColor)
 
- Public Member Functions inherited from GlsDisplayObject
virtual void Calculate (const GlsFloat64 time)
 
virtual GlsDisplayObjectPickTest (const GlsVector2D &windowCoord, GlsInputManager &inputManager, const GlsMatrixAffineD::GLMatrixAffineF &parentDrawMatrix)
 
GlsDisplayObjectHandleEvent (GlsEvent &event)
 
ObjectType GetObjectType (void) const
 
void SetBlinking (const GlsBool blinking)
 
void SetBlinkRate (const GlsFloat32 blinkRate)
 
void SetDynamicRotation (const GlsVector3D &dynamicRotation)
 
void SetDynamicScale (const GlsVector3D &dynamicScale)
 
void SetDynamicTranslation (const GlsVector3D &dynamicTranslation)
 
void SetVisibility (const GlsBool visible)
 
void SetParent (GlsDisplayObject *const parent)
 
void SetPickMode (const PickMode pickMode)
 
GlsBool NeedCalculate (void) const
 
void InvalidatePickCache (void)
 

Protected Member Functions

virtual void DrawCharacters (GlsStateManager &gl)
 
virtual void CalculateRowData (void)
 
virtual ~GlsTextGrid ()
 
- Protected Member Functions inherited from GlsText
 GlsText (const InitParameters &initParameters, const GlsUInt32 maxNumLineSegmentsPerRow, GlsEventDispatcher *const eventDispatcher)
 
GlsFloat32 JustificationOffset (const GlsUInt32 row) const
 
void ResetUnderineStrikeThruRenderers (void)
 
virtual ~GlsText ()
 
- Protected Member Functions inherited from GlsRenderObject
 GlsRenderObject (const InitParameters &initParameters, GlsEventDispatcher *const eventDispatcher)
 
GLint GlsTextureFilterModeToGL (const GlsTextureFilterMode mode) const
 
void SetupDepthTest (GlsStateManager &gl) const
 
void SetupAlpha (GlsStateManager &gl) const
 
GlsBool SetupTexture (GlsStateManager &gl, const GlsUInt32 textureIndex) const
 
void SetupTextureFilterSettings (GlsStateManager &gl) const
 
void SetupBackfaceCulling (GlsStateManager &gl) const
 
void SetupShading (GlsStateManager &gl) const
 
void SetupLineStyle (GlsStateManager &gl) const
 
void SetupAntiAlias (GlsStateManager &gl) const
 
virtual ~GlsRenderObject ()
 
- Protected Member Functions inherited from GlsDisplayObject
 GlsDisplayObject (const InitParameters &initParameters, const ObjectType objectType, GlsEventDispatcher *const eventDispatcher)
 
virtual ~GlsDisplayObject ()
 
GlsBool CalcDrawMatrix (const GlsMatrixAffineD *const additionalTransform, const GlsBool includeLocation)
 
virtual void CalcWindowPickRegion (GlsInputManager &inputManager, const GlsMatrixAffineD::GLMatrixAffineF &parentDrawMatrix)
 
GlsBool IsBlinkedOff (const GlsFloat64 time) const
 

Protected Attributes

const GlsUInt32 _columns
 
CharAttributeGrid _charAttributes
 
GlsBool _perCharAttributes
 
- Protected Attributes inherited from GlsText
const GlsUInt32 _rows
 
const GlsUInt32 _border
 
const GlsFloat32 _cellWidth
 
const GlsFloat32 _cellHeight
 
const GlsFontBase_font
 
const GlsBool _halo
 
GlsColor _haloColor
 
const Justification _justification
 
const GlsBool _shadow
 
const GlsFloat32 _shadowDistance
 
GlsColor _shadowColor
 
GlsString _str
 
const GlsBool _uppercase
 
const GlsBool _wrapText
 
const GlsFloat32 _rowOffset
 
const GlsFloat32 _textWidth
 
const GlsFloat32 _textHeight
 
GlsPolygon_backgroundPoly
 
GlsMatrixAffineD::GLMatrixAffineF _textRotationMatrix
 
GlsBool _textRotationMatrixIsIdentity
 
RowInfo *const _rowInfo
 
GlsPointerArray _underlineStrikeThruRenderers
 
- Protected Attributes inherited from GlsRenderObject
const GlsBool _antiAlias
 
const GlsTexturePalette_texturePalette
 
const GlsBool _textureRepeat
 
const GlsTextureMapMode _textureMapMode
 
const GlsTextureFilterMode _textureMagFilterMode
 
const GlsTextureFilterMode _textureMinFilterMode
 
const GlsBool _cullBackFace
 
const GlsDepthBufferMode _depthBufferMode
 
const GlsPolygonEndMode _polygonEndMode
 
const GlsShadingMode _shadingMode
 
GlsAlphaMode _alphaMode
 
GlsColor _lineColor
 
GlsUInt32 _textureIndex
 
GlsPolygonMode _polygonMode
 
GlsColor _fillColor
 
GlsFloat32 _lineWidth
 
- Protected Attributes inherited from GlsDisplayObject
const GlsMatrixAffineD _dcsMatrix
 
const GlsMatrixAffineD _dcsMatrixInverse
 
const GlsBool _dcsMatrixIsIdentity
 
const GlsVector3D _location
 
const GlsBool _needCalculate
 
const ObjectType _objectType
 
const PickRegion _pickRegion
 
GlsEventDispatcher *const _eventDispatcher
 
const GlsVector3D _rotationPoint
 
GlsBool _blinking
 
GlsFloat32 _blinkRate
 
GlsMatrixAffineD::GLMatrixAffineF _drawMatrix
 
GlsVector3D _dynamicRotation
 
GlsVector3D _dynamicScale
 
GlsBool _dynamicScaleIsUnity
 
GlsVector3D _dynamicTranslation
 
GlsBool _needCalcDrawMatrix
 
GlsBool _visible
 
PickMode _pickMode
 
GlsBool _windowPickRegionValid
 
GlsVector2D _windowPickLowerLeft
 
GlsVector2D _windowPickUpperRight
 
GlsVector2D _windowPickUpperLeft
 
GlsVector2D _windowPickLowerRight
 
GlsMatrixAffineD::GLMatrixAffineF _pickMatrix
 
GlsDisplayObject_parent
 

Additional Inherited Members

- Public Types inherited from GlsText
enum  Justification { JUSTIFICATION_LEFT, JUSTIFICATION_CENTER, JUSTIFICATION_RIGHT }
 
- Public Types inherited from GlsDisplayObject
enum  ObjectType { OBJECT_TYPE_COMPOSITE, OBJECT_TYPE_RENDERABLE }
 
enum  PickMode { PICK_MODE_NEVER, PICK_MODE_FIRST, PICK_MODE_ALWAYS }
 
- Static Protected Attributes inherited from GlsText
static const GlsUInt32 NUM_VERTS_BACKGROUND_POLY = 4u
 
static const GlsChar NEW_LINE_CHAR
 
static const GlsChar SPACE_CHAR
 
- Static Protected Attributes inherited from GlsRenderObject
static const GLclampf ALPHA_MODE_2_LEVEL_REF
 

Detailed Description

This class implements an mxn display grid of characters.

Invariant
base class invariant holds, _columns > 0, _rows > 0, _charAttributes invariant holds, each _rowInfo element has a length field <= columns

Constructor & Destructor Documentation

GlsTextGrid::GlsTextGrid ( const InitParameters initParameters,
GlsEventDispatcher *const  eventDispatcher 
)

Constructor - create an instance

Parameters
initParametersinitialization parameters
eventDispatcherevent dispatcher for this object else GLS_NULL
Precondition
initParameters.IsValid()
Postcondition
instance created
virtual GlsTextGrid::~GlsTextGrid ( )
protectedvirtual

Destructor - shall never be called

Precondition
none
Postcondition
none

Member Function Documentation

virtual void GlsTextGrid::CalculateRowData ( void  )
protectedvirtual

Populate the _rowInfo array based on the current display string

Precondition
none
Postcondition
_rowInfo array is populated based on the current display string

Implements GlsText.

virtual void GlsTextGrid::DrawCharacters ( GlsStateManager gl)
protectedvirtual

Draw the characters associated with the text grid

Parameters
glGL state manager to draw into
Precondition
all necessary GL matrix adjustments have been applied, the font texture has been bound to GL with GlsFontBase::BindFontTexture() and its texture filter settings have been setup
Postcondition
text characters are drawn to GL

Implements GlsText.

void GlsTextGrid::SetCharAttribute ( const GlsUInt32  column,
const GlsUInt32  row,
const GlsText::CharAttribute charAttribute 
)

Set the character attributes for a character at a given column and row

Parameters
columncolumn in question ( < _columns )
rowrow in question ( < _rows )
charAttributenew attributes for character at given column, row
Precondition
column < _columns, row < _rows, charAttribute.IsValid()
Postcondition
character at column, row has new character attributes
virtual void GlsTextGrid::SetCharAttributes ( const GlsText::CharAttribute charAttribute)
virtual

Set the character attributes for all of the text

Parameters
charAttributenew character attributes for the text
Precondition
charAttribue.IsValid()
Postcondition
text has new character attribute

Implements GlsText.

Member Data Documentation

CharAttributeGrid GlsTextGrid::_charAttributes
protected

grid (_columns*_rows) of character attributes

const GlsUInt32 GlsTextGrid::_columns
protected

number of columns in grid ( > 0 )

GlsBool GlsTextGrid::_perCharAttributes
protected

GLS_TRUE if grid utilizes character attributes on a per character basis else GLS_FALSE if all text uses the first character attribute in _charAttributes