OpenBarnyard
 
Loading...
Searching...
No Matches
AGUI2TextBox Class Reference

#include <AGUI2TextBox.h>

Inheritance diagram for AGUI2TextBox:
AGUI2Element AGUI2ElementNode

Public Member Functions

 AGUI2TextBox ()
 
 ~AGUI2TextBox ()
 
void Create (AGUI2Font *a_pFont, TFLOAT a_fWidth)
 
void SetText (const TWCHAR *a_wszText)
 
void SetScale (TFLOAT a_fScale)
 
void SetShadow (TBOOL a_bEnabled, TUINT32 a_uiColour)
 
void SetShadowEnabled (TBOOL a_bEnabled)
 
void SetShadowColour (const Toshi::TColor &a_rColour)
 
void SetShadowColour (TUINT32 a_uiColour)
 
void SetShadowOffset (TFLOAT a_fOffsetX, TFLOAT a_fOffsetY)
 
void SetTextAlign (AGUI2Font::TextAlign a_eTextAlign)
 
const TWCHARGetText () const
 
TFLOAT GetShadowOffsetX () const
 
TFLOAT GetShadowOffsetY () const
 
virtual void Render () OVERRIDE
 
virtual void GetDimensions (TFLOAT &a_rWidth, TFLOAT &a_rHeight) OVERRIDE
 
virtual TFLOAT GetWidth () OVERRIDE
 
virtual TFLOAT GetHeight () OVERRIDE
 
virtual void SetWidth (TFLOAT a_fWidth) OVERRIDE
 
virtual void SetShadowAlpha (TFLOAT a_fAlpha) OVERRIDE
 
- Public Member Functions inherited from AGUI2Element
 AGUI2Element ()
 
virtual ~AGUI2Element ()=default
 
virtual void Tick (TFLOAT a_fDeltaTime)
 
virtual void PreRender ()
 
virtual void PostRender ()
 
virtual void SetHeight (TFLOAT a_fHeight)
 
virtual void SetDimensions (TFLOAT a_fWidth, TFLOAT a_fHeight)
 
virtual void GetMins (TFLOAT &a_fX, TFLOAT &a_fY)
 
virtual void GetMaxs (TFLOAT &a_fX, TFLOAT &a_fY)
 
virtual void SetColour (TUINT32 a_uiColour)
 
virtual void SetAlpha (TFLOAT a_fAlpha)
 
virtual void SetFocus (TBOOL a_bFocused)
 
virtual TBOOL IsPointInside (TFLOAT a_fX, TFLOAT a_fY)
 
void AnchorPos (TFLOAT &a_rX, TFLOAT &a_rY, TFLOAT a_fWidth, TFLOAT a_fHeight)
 
void PivotPos (TFLOAT &a_rX, TFLOAT &a_rY, TFLOAT a_fWidth, TFLOAT a_fHeight)
 
void GetScreenTransform (AGUI2Transform &a_rOutTransform)
 
void GetInvScreenTransform (AGUI2Transform &a_rOutTransform)
 
void Show ()
 
void Hide ()
 
void SetInFront ()
 
void SetRenderBeforeChildren ()
 
TBOOL HasFlags (TUINT32 a_uiFlags) const
 
TBOOL IsVisible () const
 
TBOOL IsFocused () const
 
TBOOL ShouldRenderBeforeChildren ()
 
TBOOL IsInFront () const
 
TFLOAT GetAlpha () const
 
void AddChildTail (AGUI2Element &a_rElement)
 
void AddChildHead (AGUI2Element &a_rElement)
 
void SetTranslation (TFLOAT a_fX, TFLOAT a_fY)
 
void SetTranslation (const Toshi::TVector2 &a_rTranslation)
 
void SetTransform (TFLOAT a_fX, TFLOAT a_fY, float a_fRotAngle=0.0f)
 
void SetAnchor (AGUI2ATTACHMENT a_eAnchor)
 
void SetPivot (AGUI2ATTACHMENT a_ePivot)
 
void SetAttachment (AGUI2ATTACHMENT a_eAnchor, AGUI2ATTACHMENT a_ePivot)
 
t_PostRender SetPostRenderCallback (t_PostRender a_cbNewCallback)
 
AGUI2TransformGetTransform ()
 
AGUI2ElementChildBegin () const
 
AGUI2ElementChildRBegin () const
 
AGUI2ElementGetNextChild (AGUI2Element *a_pCurrentChild)
 
AGUI2ElementGetPrevChild (AGUI2Element *a_pCurrentChild)
 
void RemoveSelf ()
 
void LinkChildBefore (AGUI2Element &a_rNewChildren, AGUI2Element &a_rInsertAfter)
 
- Public Member Functions inherited from AGUI2ElementNode
 AGUI2ElementNode ()
 
virtual ~AGUI2ElementNode ()
 
void Unlink ()
 
void LinkAfter (AGUI2ElementNode &a_rNode)
 
void LinkBefore (AGUI2ElementNode &a_rNode)
 
TBOOL IsLinked () const
 
AGUI2ElementNodeGetNext () const
 
AGUI2ElementNodeGetPrev () const
 

Additional Inherited Members

- Public Types inherited from AGUI2Element
using t_PostRender = void ( * )()
 
- Public Attributes inherited from AGUI2ElementNode
friend AGUI2Element
 
- Static Public Attributes inherited from AGUI2Element
static TUINT32 s_uiVisibilityMask = 0xFFFFFFFF
 
- Protected Attributes inherited from AGUI2Element
AGUI2Elementm_pParent
 
AGUI2Transform m_oTransform
 
AGUI2ElementNode m_Children
 
AGUI2ATTACHMENT m_eAnchor
 
AGUI2ATTACHMENT m_ePivot
 
TFLOAT m_fWidth
 
TFLOAT m_fHeight
 
TUINT32 m_uiColour
 
TUINT32 m_eFlags
 
t_PostRender m_cbPostRender
 
TUINT32 m_uiVisibilityMask
 
- Protected Attributes inherited from AGUI2ElementNode
AGUI2ElementNodem_pNext
 
AGUI2ElementNodem_pPrev
 

Detailed Description

Definition at line 7 of file AGUI2TextBox.h.

Constructor & Destructor Documentation

◆ AGUI2TextBox()

AGUI2TextBox::AGUI2TextBox ( )

Definition at line 10 of file AGUI2TextBox.cpp.

11{
12 m_bRenderShadow = TFALSE;
13 m_wszText = TNULL;
14 m_pFont = TNULL;
15 m_bUnkFlag2 = TFALSE;
16 m_fShadowOffsetX = 5.0f;
17 m_fShadowOffsetY = 5.0f;
18 m_uiShadowColour = 0x80000000;
19 m_fScale = 1.0f;
20 m_eTextAlign = AGUI2Font::TextAlign_Center;
21}
#define TNULL
Definition Typedefs.h:23
#define TFALSE
Definition Typedefs.h:24
@ TextAlign_Center
Definition AGUI2Font.h:40

◆ ~AGUI2TextBox()

AGUI2TextBox::~AGUI2TextBox ( )

Definition at line 23 of file AGUI2TextBox.cpp.

24{
25}

Member Function Documentation

◆ Create()

void AGUI2TextBox::Create ( AGUI2Font * a_pFont,
TFLOAT a_fWidth )

Definition at line 27 of file AGUI2TextBox.cpp.

28{
29 m_pFont = a_pFont;
30 AGUI2Element::m_fWidth = a_fWidth;
31 m_bDimensionsDirty = TTRUE;
32 m_bUnkFlag2 = TFALSE;
33}
#define TTRUE
Definition Typedefs.h:25

◆ GetDimensions()

void AGUI2TextBox::GetDimensions ( TFLOAT & a_rWidth,
TFLOAT & a_rHeight )
virtual

Reimplemented from AGUI2Element.

Definition at line 138 of file AGUI2TextBox.cpp.

139{
140 if ( !m_bUnkFlag2 && m_bDimensionsDirty )
141 {
142 if ( !m_wszText || !m_pFont )
143 {
145 }
146 else
147 {
148 AGUI2Element::m_fHeight = m_pFont->GetTextHeightWrapped( m_wszText, AGUI2Element::m_fWidth, m_fScale );
149 }
150
151 m_bDimensionsDirty = TFALSE;
152 }
153
154 a_rWidth = AGUI2Element::m_fWidth;
155 a_rHeight = AGUI2Element::m_fHeight;
156}

◆ GetHeight()

TFLOAT AGUI2TextBox::GetHeight ( )
virtual

Reimplemented from AGUI2Element.

Definition at line 167 of file AGUI2TextBox.cpp.

168{
169 TFLOAT fWidth;
170 TFLOAT fHeight;
171 GetDimensions( fWidth, fHeight );
172
173 return fHeight;
174}
float TFLOAT
Definition Typedefs.h:4
virtual void GetDimensions(TFLOAT &a_rWidth, TFLOAT &a_rHeight) OVERRIDE

◆ GetShadowOffsetX()

TFLOAT AGUI2TextBox::GetShadowOffsetX ( ) const
inline

Definition at line 26 of file AGUI2TextBox.h.

26{ return m_fShadowOffsetX; }

◆ GetShadowOffsetY()

TFLOAT AGUI2TextBox::GetShadowOffsetY ( ) const
inline

Definition at line 27 of file AGUI2TextBox.h.

27{ return m_fShadowOffsetY; }

◆ GetText()

const TWCHAR * AGUI2TextBox::GetText ( ) const
inline

Definition at line 25 of file AGUI2TextBox.h.

25{ return m_wszText; }

◆ GetWidth()

TFLOAT AGUI2TextBox::GetWidth ( )
virtual

Reimplemented from AGUI2Element.

Definition at line 158 of file AGUI2TextBox.cpp.

159{
160 TFLOAT fWidth;
161 TFLOAT fHeight;
162 GetDimensions( fWidth, fHeight );
163
164 return fWidth;
165}

◆ Render()

void AGUI2TextBox::Render ( )
virtual

Reimplemented from AGUI2Element.

Definition at line 119 of file AGUI2TextBox.cpp.

120{
121 TASSERT( m_pFont != TNULL );
122
123 if ( AGUI2Element::HasFlags( 8 ) )
124 {
125 // Render children before text
127 }
128
129 RenderText( TNULL );
130
131 if ( !AGUI2Element::HasFlags( 8 ) )
132 {
133 // Render children after text
135 }
136}
#define TASSERT(X,...)
Definition Defines.h:138
virtual void Render()
TBOOL HasFlags(TUINT32 a_uiFlags) const

◆ SetScale()

void AGUI2TextBox::SetScale ( TFLOAT a_fScale)

Definition at line 81 of file AGUI2TextBox.cpp.

82{
83 m_fScale = a_fScale;
84 m_bDimensionsDirty = TTRUE;
85}

◆ SetShadow()

void AGUI2TextBox::SetShadow ( TBOOL a_bEnabled,
TUINT32 a_uiColour )

Definition at line 87 of file AGUI2TextBox.cpp.

88{
89 m_bRenderShadow = a_bEnabled;
90 m_uiShadowColour = a_uiColour;
91}

◆ SetShadowAlpha()

void AGUI2TextBox::SetShadowAlpha ( TFLOAT a_fAlpha)
virtual

Reimplemented from AGUI2Element.

Definition at line 182 of file AGUI2TextBox.cpp.

183{
184 TUINT8 ui8Alpha = TUINT8( a_fAlpha * 255.0f );
185 m_uiShadowColour = ( m_uiShadowColour & 0x00FFFFFF ) | ui8Alpha << 24;
186}
uint8_t TUINT8
Definition Typedefs.h:17

◆ SetShadowColour() [1/2]

void AGUI2TextBox::SetShadowColour ( const Toshi::TColor & a_rColour)

Definition at line 103 of file AGUI2TextBox.cpp.

104{
105 m_uiShadowColour = a_rColour.Value32;
106}

◆ SetShadowColour() [2/2]

void AGUI2TextBox::SetShadowColour ( TUINT32 a_uiColour)

Definition at line 98 of file AGUI2TextBox.cpp.

99{
100 m_uiShadowColour = a_uiColour;
101}

◆ SetShadowEnabled()

void AGUI2TextBox::SetShadowEnabled ( TBOOL a_bEnabled)

Definition at line 93 of file AGUI2TextBox.cpp.

94{
95 m_bRenderShadow = a_bEnabled;
96}

◆ SetShadowOffset()

void AGUI2TextBox::SetShadowOffset ( TFLOAT a_fOffsetX,
TFLOAT a_fOffsetY )

Definition at line 108 of file AGUI2TextBox.cpp.

109{
110 m_fShadowOffsetX = m_fScale * a_fOffsetX;
111 m_fShadowOffsetY = m_fScale * a_fOffsetY;
112}

◆ SetText()

void AGUI2TextBox::SetText ( const TWCHAR * a_wszText)

Definition at line 35 of file AGUI2TextBox.cpp.

36{
37 m_wszText = a_wszText;
38 m_bDimensionsDirty = TTRUE;
39}

◆ SetTextAlign()

void AGUI2TextBox::SetTextAlign ( AGUI2Font::TextAlign a_eTextAlign)

Definition at line 114 of file AGUI2TextBox.cpp.

115{
116 m_eTextAlign = a_eTextAlign;
117}

◆ SetWidth()

void AGUI2TextBox::SetWidth ( TFLOAT a_fWidth)
virtual

Reimplemented from AGUI2Element.

Definition at line 176 of file AGUI2TextBox.cpp.

177{
178 AGUI2Element::m_fWidth = a_fWidth;
179 m_bDimensionsDirty = TTRUE;
180}

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