PEBL 2.2
Psychology Experiment Building Language - Cross-platform psychological experiment development system
PlatformLabel Class Reference

Validator platform label - no rendering, used only for compilation. More...

#include <PlatformLabel.h>

Inheritance diagram for PlatformLabel:
PlatformWidget PLabel PlatformWidget PLabel PWidget PWidget PTextObject PWidget PWidget PTextObject PEBLObjectBase PEBLObjectBase PWidget PEBLObjectBase PEBLObjectBase PWidget PEBLObjectBase PEBLObjectBase

Public Member Functions

 PlatformLabel (const std::string &text, counted_ptr< PEBLObjectBase > font)
 
 PlatformLabel (PlatformLabel &label)
 This copy constructor isn't const because the font is shared.
 
virtual ~PlatformLabel ()
 Standard Destructor.
 
virtual bool RenderText ()
 
virtual bool SetProperty (std::string, Variant v)
 
virtual void SetFont (counted_ptr< PEBLObjectBase > font)
 
virtual void SetText (const std::string &text)
 
virtual bool Draw ()
 This method initiates everything needed to display the main window

 
virtual counted_ptr< PEBLObjectBaseGetFont ()
 
virtual std::string ObjectName () const
 
 PlatformLabel (const std::string &text, counted_ptr< PEBLObjectBase > font)
 
 PlatformLabel (PlatformLabel &label)
 
virtual ~PlatformLabel ()
 
virtual bool Draw ()
 This method initiates everything needed to display the main window

 
virtual std::string ObjectName () const
 
virtual void SetFont (counted_ptr< PEBLObjectBase > font)
 
virtual bool SetProperty (std::string name, Variant v)
 
virtual ObjectValidationError ValidateProperty (std::string name, Variant v) const
 
virtual ObjectValidationError ValidateProperty (std::string name) const
 
virtual void SetPosition (pInt x, pInt y)
 This sets the widget's position on its parent widget.
 
- Public Member Functions inherited from PlatformWidget
 PlatformWidget ()
 
virtual ~PlatformWidget ()
 
virtual SDL_Texture * GetSDL_Texture ()
 Used to extract an SDL surface from the widget. Used by children drawing themselves on their parent.
 
void SetParent (PlatformWidget *parent)
 
SDL_Surface * GetSurface ()
 
virtual bool SetRenderer (SDL_Renderer *renderer)
 
SDL_Renderer * GetRenderer ()
 
virtual bool AddToParentWidget (PlatformWidget *parent)
 
virtual bool AddSubWidget (PlatformWidget *widget)
 
virtual bool RemoveSubWidget (PlatformWidget *widget)
 
virtual bool RemoveSubWidgets ()
 
virtual bool RotoZoom (double angle, double zoomx, double zoomy, int smooth)
 This uses the SDL_gfx package to 'rotozoom'.
 
bool SetPoint (int x, int y, PColor col)
 
PColor GetPixel (int x, int y)
 
 PlatformWidget ()
 
 PlatformWidget (pInt x, pInt y, pInt width, pInt height, bool visible)
 
virtual ~PlatformWidget ()
 
virtual bool RotoZoom (pDouble angle, pDouble zoomx, pDouble zoomy, pInt smooth)
 
virtual bool SetPoint (pInt x, pInt y, PColor col)
 
virtual PColor GetPixel (pInt x, pInt y)
 
- Public Member Functions inherited from PWidget
 PWidget ()
 
 PWidget (const PWidget &pw)
 
 PWidget (pInt x, pInt y, pInt width, pInt height, bool visible)
 
virtual ~PWidget ()
 
virtual void SetParent (PWidget *widget)
 This unconditionally sets the parent widget.
 
virtual PWidgetGetParent ()
 
virtual bool IsParent (PWidget *parent)
 
virtual void SetZoomX (pDouble x)
 This sets the widget's position on its parent widget.
 
virtual void SetZoomY (pDouble x)
 This sets the widget's position on its parent widget.
 
virtual void SetRotation (pDouble x)
 This sets the widget's position on its parent widget.
 
virtual void SetWidth (pInt w)
 
virtual void SetHeight (pInt h)
 
virtual pInt GetX () const
 
virtual pInt GetY () const
 
virtual pInt GetWidth () const
 
virtual pInt GetHeight () const
 
virtual void SetBackgroundColor (const PColor &color)
 
virtual PColor GetBackgroundColor ()
 
virtual bool AddSubWidget (PWidget *widget)
 
virtual bool RemoveSubWidget (PWidget *widget)
 
virtual bool RemoveLastSubWidget ()
 This is probably pretty useless.
 
virtual void Show ()
 
virtual void Hide ()
 
virtual bool IsVisible () const
 
- Public Member Functions inherited from PEBLObjectBase
 PEBLObjectBase ()
 Standard Constructor.
 
 PEBLObjectBase (ComplexDataType cdt)
 Standard Constructor.
 
 PEBLObjectBase (const PEBLObjectBase &pob)
 
virtual ~PEBLObjectBase ()
 Standard Destructor.
 
virtual bool InitializeProperty (std::string name, Variant v)
 
Variant GetProperty (std::string) const
 
ComplexDataType GetType ()
 
virtual std::ostream & PrintProperties (std::ostream &out)
 
virtual Variant GetPropertyList ()
 
- Public Member Functions inherited from PLabel
 PLabel ()
 
 PLabel (const std::string &text)
 
 PLabel (const PLabel &label)
 
virtual ~PLabel ()
 
virtual Variant GetProperty (std::string) const
 
- Public Member Functions inherited from PTextObject
 PTextObject ()
 
 PTextObject (const std::string &text)
 
 PTextObject (PTextObject &object)
 
virtual ~PTextObject ()
 
virtual void SetDirection (int i)
 
virtual std::string GetText () const
 
virtual unsigned long int GetNumCharacters ()
 

Protected Member Functions

virtual std::ostream & SendToStream (std::ostream &out) const
 An inheritable printing class used by PEBLObjectBase::operator<<.
 
virtual std::ostream & SendToStream (std::ostream &out) const
 An inheritable printing class used by PEBLObjectBase::operator<<.
 
- Protected Member Functions inherited from PlatformWidget
virtual void PrintSubWidgets (std::ostream &out) const
 
virtual bool LockSurface ()
 This needs to be used on some platforms/video cards.
 
virtual bool UnlockSurface ()
 This needs to be used on some platforms/video cards.
 

Additional Inherited Members

- Protected Attributes inherited from PlatformWidget
pInt mTextureWidth
 
pInt mTextureHeight
 
bool mNeedsTexture
 
SDL_Texture * mTexture
 
SDL_Surface * mSurface
 
SDL_Renderer * mRenderer
 
- Protected Attributes inherited from PWidget
pInt mX
 
pInt mY
 
pInt mDrawX
 
pInt mDrawY
 
pInt mWidth
 
pInt mHeight
 
pDouble mZoomX
 
pDouble mZoomY
 
pDouble mRotation
 
PColor mBackgroundColor
 The background color of the widget. if alpha = 0, will not be painted.
 
std::list< PWidget * > mSubWidgets
 
bool mIsVisible
 
PWidgetmParent
 
- Protected Attributes inherited from PEBLObjectBase
ComplexDataType mCDT
 
std::map< std::string, VariantmProperties
 
- Protected Attributes inherited from PTextObject
bool mChanged
 
std::string mText
 
int mDirection
 

Detailed Description

Validator platform label - no rendering, used only for compilation.

This class defines the SDL Platform-specific representation of a text label. It uses the SDL_ttf library (a wrapper to freetype) to render words in a box.

Definition at line 49 of file sdl/PlatformLabel.h.

Constructor & Destructor Documentation

◆ PlatformLabel() [1/4]

PlatformLabel::PlatformLabel ( const std::string &  text,
counted_ptr< PEBLObjectBase font 
)

Definition at line 56 of file sdl/PlatformLabel.cpp.

56 :
58 PLabel(text),
59 mFontObject(font)
60{
61
62 mSurface = NULL;
63 mTexture = NULL;
65
67
68 SetFont(font);
69
70 SetText(text);
71
72 //Make the font property accessible
74
75 PComplexData * pcd = new PComplexData(myFont);
76
77 InitializeProperty("FONT",Variant(pcd));
78
79 delete pcd;
80 pcd=NULL;
81
82 InitializeProperty("WIDTH",Variant(0));
83 InitializeProperty("HEIGHT",Variant(0));
84
85 //issue draw() command to be sure the xy center is set right.
86 Draw();
87
88}
#define NULL
Definition BinReloc.cpp:317
@ CDT_LABEL
Definition PEBLObject.h:59
virtual bool InitializeProperty(std::string name, Variant v)
ComplexDataType mCDT
Definition PEBLObject.h:109
PLabel()
Definition PLabel.cpp:36
virtual bool Draw()
This method initiates everything needed to display the main window
virtual void SetText(const std::string &text)
virtual void SetFont(counted_ptr< PEBLObjectBase > font)
SDL_Surface * mSurface
SDL_Texture * mTexture
SDL_Renderer * mRenderer

References CDT_LABEL, Draw(), PEBLObjectBase::InitializeProperty(), PEBLObjectBase::mCDT, PlatformWidget::mRenderer, PlatformWidget::mSurface, PlatformWidget::mTexture, NULL, SetFont(), and SetText().

◆ PlatformLabel() [2/4]

PlatformLabel::PlatformLabel ( PlatformLabel label)

This copy constructor isn't const because the font is shared.

Definition at line 91 of file sdl/PlatformLabel.cpp.

91 :
93 PLabel(label.GetText())
94
95{
97 mSurface = NULL;
99 mTexture = NULL;
100
101 SetFont(label.GetFont());
102
103
105 PComplexData * pcd = new PComplexData(myFont);
106 delete pcd;
107 pcd=NULL;
108
109 InitializeProperty("FONT",Variant(pcd));
110 InitializeProperty("WIDTH",Variant(label.GetHeight()));
111 InitializeProperty("HEIGHT",Variant(label.GetWidth()));
112 cerr << "Drawing new label in platformlabel\n";
113 Draw();
114}
virtual std::string GetText() const
Definition PTextObject.h:56
virtual pInt GetWidth() const
Definition PWidget.h:85
virtual pInt GetHeight() const
Definition PWidget.h:86
virtual counted_ptr< PEBLObjectBase > GetFont()

References CDT_LABEL, Draw(), GetFont(), PWidget::GetHeight(), PWidget::GetWidth(), PEBLObjectBase::InitializeProperty(), PEBLObjectBase::mCDT, PlatformWidget::mRenderer, PlatformWidget::mSurface, PlatformWidget::mTexture, NULL, and SetFont().

◆ ~PlatformLabel() [1/2]

PlatformLabel::~PlatformLabel ( )
virtual

Standard Destructor.

Definition at line 118 of file sdl/PlatformLabel.cpp.

119{
120 //cerr << "Label destructor\n";
121
122}

◆ PlatformLabel() [3/4]

PlatformLabel::PlatformLabel ( const std::string &  text,
counted_ptr< PEBLObjectBase font 
)

◆ PlatformLabel() [4/4]

PlatformLabel::PlatformLabel ( PlatformLabel label)

◆ ~PlatformLabel() [2/2]

virtual PlatformLabel::~PlatformLabel ( )
virtual

Member Function Documentation

◆ Draw() [1/2]

bool PlatformLabel::Draw ( )
virtual

This method initiates everything needed to display the main window

Reimplemented from PlatformWidget.

Definition at line 377 of file sdl/PlatformLabel.cpp.

378{
379
380 // Check if label text changed OR if font properties changed
381 if(mChanged || GetPlatformFont()->HasChanged())
382 {
383
384 RenderText();
385 //Reposition. This just recalculates so things are centered
386 //correctly; labels are positioned based on their center.
387
388 SetPosition(mX, mY);
389
390 InitializeProperty("HEIGHT",mHeight);
391 InitializeProperty("WIDTH",mWidth);
392 GetPlatformFont()->ClearChanged(); // Clear font changed flag after re-rendering
393
394 // Only clear mChanged if texture was successfully created
395 // If mTexture is NULL, keep mChanged=true to retry when renderer is available
396 if(mTexture)
397 {
398 mChanged = false;
399 }
400 }
401 return PlatformWidget::Draw();
402
403}
pInt mWidth
Definition PWidget.h:136
pInt mX
Definition PWidget.h:125
pInt mHeight
Definition PWidget.h:136
pInt mY
Definition PWidget.h:125
void ClearChanged()
Clear all changed flags.
virtual void SetPosition(pInt x, pInt y)
This sets the widget's position on its parent widget.
virtual bool RenderText()
virtual bool Draw()
This method initiates everything needed to display the main window

References PlatformFont::ClearChanged(), PlatformWidget::Draw(), PEBLObjectBase::InitializeProperty(), PTextObject::mChanged, PWidget::mHeight, PlatformWidget::mTexture, PWidget::mWidth, PWidget::mX, PWidget::mY, RenderText(), and SetPosition().

Referenced by PlatformLabel(), PlatformLabel(), SetFont(), and SetText().

◆ Draw() [2/2]

virtual bool PlatformLabel::Draw ( )
virtual

This method initiates everything needed to display the main window

Reimplemented from PlatformWidget.

◆ GetFont()

virtual counted_ptr< PEBLObjectBase > PlatformLabel::GetFont ( )
inlinevirtual

Definition at line 69 of file sdl/PlatformLabel.h.

69{return mFontObject;}

Referenced by PlatformLabel().

◆ ObjectName() [1/2]

virtual std::string PlatformLabel::ObjectName ( ) const
inlinevirtual

Reimplemented from PWidget.

Definition at line 70 of file sdl/PlatformLabel.h.

70{return "PlatformLabel";} ;

◆ ObjectName() [2/2]

virtual std::string PlatformLabel::ObjectName ( ) const
inlinevirtual

Reimplemented from PWidget.

Definition at line 40 of file validator/PlatformLabel.h.

40{ return "PlatformLabel (validator)"; }

◆ RenderText()

bool PlatformLabel::RenderText ( )
virtual

RenderText is only called once the label is already added to a window/widget, so that it already has a renderer and a texture.

Definition at line 137 of file sdl/PlatformLabel.cpp.

138{
139 // Check if formatted text mode is enabled
140 Variant formattedVar = PEBLObjectBase::GetProperty("FORMATTED");
141 bool isFormatted = (formattedVar.GetInteger() != 0);
142
143 SDL_Surface * finalSurface = NULL;
144
145 if (isFormatted) {
146 // FORMATTED TEXT RENDERING (single-line with baseline alignment)
147
148 // Parse formatted text into segments
149 std::vector<FormatParser::FormatSegment> segments = FormatParser::ParseFormattedText(mText);
150
151 // FIRST PASS: Find maximum ascent for baseline alignment
152 int maxAscent = 0;
153 int totalWidth = 0;
154
155 for (const FormatParser::FormatSegment& seg : segments) {
156 if (!seg.text.empty()) {
157 PlatformFont* segFont = GetPlatformFont();
158 std::string fontFileName = segFont->GetFontFileName();
159 int baseSize = segFont->GetFontSize();
160 PColor baseFgColor = segFont->GetFontColor();
161 PColor baseBgColor = segFont->GetBackgroundColor();
162 bool antiAliased = segFont->GetAntiAliased();
163
164 int segStyle = seg.style;
165 int segSize = seg.hasSizeOverride ? seg.sizeOverride : baseSize;
166 PColor segFgColor = seg.hasColorOverride ? seg.colorOverride : baseFgColor;
167
168 PlatformFont* renderFont = new PlatformFont(
169 fontFileName, segStyle, segSize,
170 segFgColor, baseBgColor, antiAliased);
171
172 // Get ascent and width for this segment
173 int ascent = TTF_FontAscent(renderFont->GetTTFFont());
174 if (ascent > maxAscent) maxAscent = ascent;
175
176 int segWidth, segHeight;
177 TTF_SizeText(renderFont->GetTTFFont(), seg.text.c_str(), &segWidth, &segHeight);
178 totalWidth += segWidth;
179
180 delete renderFont;
181 }
182 }
183
184 // Calculate total height (use max ascent + max descent)
185 // Note: TTF_FontDescent() returns negative values for portions below baseline
186 int maxDescent = 0;
187 for (const FormatParser::FormatSegment& seg : segments) {
188 if (!seg.text.empty()) {
189 PlatformFont* segFont = GetPlatformFont();
190 std::string fontFileName = segFont->GetFontFileName();
191 int baseSize = segFont->GetFontSize();
192 PColor baseFgColor = segFont->GetFontColor();
193 PColor baseBgColor = segFont->GetBackgroundColor();
194 bool antiAliased = segFont->GetAntiAliased();
195
196 int segStyle = seg.style;
197 int segSize = seg.hasSizeOverride ? seg.sizeOverride : baseSize;
198 PColor segFgColor = seg.hasColorOverride ? seg.colorOverride : baseFgColor;
199
200 PlatformFont* renderFont = new PlatformFont(
201 fontFileName, segStyle, segSize,
202 segFgColor, baseBgColor, antiAliased);
203
204 int descent = TTF_FontDescent(renderFont->GetTTFFont());
205 // Convert negative descent to positive for comparison
206 int absDescent = (descent < 0) ? -descent : descent;
207 if (absDescent > maxDescent) maxDescent = absDescent;
208
209 delete renderFont;
210 }
211 }
212
213 int totalHeight = maxAscent + maxDescent;
214
215 // Create surface for the entire label
216 #if SDL_BYTEORDER == SDL_BIG_ENDIAN
217 Uint32 rmask = 0xff000000;
218 Uint32 gmask = 0x00ff0000;
219 Uint32 bmask = 0x0000ff00;
220 Uint32 amask = 0x000000ff;
221 #else
222 Uint32 rmask = 0x000000ff;
223 Uint32 gmask = 0x0000ff00;
224 Uint32 bmask = 0x00ff0000;
225 Uint32 amask = 0xff000000;
226 #endif
227
228 finalSurface = SDL_CreateRGBSurface(0, totalWidth, totalHeight, 32,
229 rmask, gmask, bmask, amask);
230
231 if (!finalSurface) {
232 return false;
233 }
234
235 // Fill with transparent background
236 SDL_FillRect(finalSurface, NULL, SDL_MapRGBA(finalSurface->format, 0, 0, 0, 0));
237
238 // SECOND PASS: Render segments with baseline alignment
239 int xOffset = 0;
240
241 for (const FormatParser::FormatSegment& seg : segments) {
242 if (!seg.text.empty()) {
243 PlatformFont* segFont = GetPlatformFont();
244 std::string fontFileName = segFont->GetFontFileName();
245 int baseSize = segFont->GetFontSize();
246 PColor baseFgColor = segFont->GetFontColor();
247 PColor baseBgColor = segFont->GetBackgroundColor();
248 bool antiAliased = segFont->GetAntiAliased();
249
250 int segStyle = seg.style;
251 int segSize = seg.hasSizeOverride ? seg.sizeOverride : baseSize;
252 PColor segFgColor = seg.hasColorOverride ? seg.colorOverride : baseFgColor;
253
254 PlatformFont* renderFont = new PlatformFont(
255 fontFileName, segStyle, segSize,
256 segFgColor, baseBgColor, antiAliased);
257
258 SDL_Surface* segSurface = renderFont->RenderText(seg.text.c_str());
259
260 if (segSurface) {
261 // Get ascent for this specific font
262 int thisAscent = TTF_FontAscent(renderFont->GetTTFFont());
263
264 // Calculate y-offset to align baseline with max baseline
265 int yOffset = maxAscent - thisAscent;
266
267 // Position segment with baseline alignment
268 SDL_Rect segRect = {xOffset, yOffset, segSurface->w, segSurface->h};
269
270 SDL_BlitSurface(segSurface, NULL, finalSurface, &segRect);
271 SDL_FreeSurface(segSurface);
272
273 xOffset += segRect.w;
274 }
275
276 delete renderFont;
277 }
278 }
279
280 } else {
281 // NORMAL (NON-FORMATTED) RENDERING
282 if(mDirection == 1) {
283 //Re-render the text using the associated font.
284 finalSurface = GetPlatformFont()->RenderText(mText.c_str());
285 } else {
286 std::string rtext = PEBLUtility::strrev_utf8(mText);
287 //Re-render the text using the associated font.
288 finalSurface = GetPlatformFont()->RenderText(rtext.c_str());
289 }
290 }
291
292 if(finalSurface) {
293 mWidth = finalSurface->w;
294 mHeight = finalSurface->h;
297 InitializeProperty("HEIGHT",mHeight);
298 InitializeProperty("WIDTH",mWidth);
299
300 //textures get created
301 if(mTexture) {
302 SDL_DestroyTexture(mTexture);
303 mTexture = NULL;
304 }
305
306 if(mRenderer) {
307 mTexture = SDL_CreateTextureFromSurface(mRenderer, finalSurface);
308 // Enable alpha blending for transparency support
309 SDL_SetTextureBlendMode(mTexture, SDL_BLENDMODE_BLEND);
310 // Enable best quality filtering (anisotropic) for zoomed textures
311 SDL_SetTextureScaleMode(mTexture, SDL_ScaleModeBest);
312
313 SDL_FreeSurface(finalSurface);
314 finalSurface = NULL;
315 }
316
317 return true;
318 } else {
319 return false;
320 }
321}
Variant GetProperty(std::string) const
virtual PColor GetBackgroundColor() const
Definition PFont.cpp:296
virtual PColor GetFontColor() const
Definition PFont.cpp:289
virtual std::string GetFontFileName() const
Definition PFont.h:83
virtual bool GetAntiAliased() const
Definition PFont.h:88
virtual int GetFontSize() const
Definition PFont.h:85
std::string mText
Definition PTextObject.h:70
SDL_Surface * RenderText(const std::string &text)
This takes care of all the busy work of rendering the text.
TTF_Font * GetTTFFont() const
pInt GetInteger() const
Definition Variant.cpp:997
std::vector< FormatSegment > ParseFormattedText(const std::string &input, int charWidth)
Parse formatted text into segments.
void strrev_utf8(char *p)

References PFont::GetAntiAliased(), PFont::GetBackgroundColor(), PFont::GetFontColor(), PFont::GetFontFileName(), PFont::GetFontSize(), Variant::GetInteger(), PEBLObjectBase::GetProperty(), PlatformFont::GetTTFFont(), PEBLObjectBase::InitializeProperty(), PTextObject::mDirection, PWidget::mHeight, PlatformWidget::mRenderer, PTextObject::mText, PlatformWidget::mTexture, PlatformWidget::mTextureHeight, PlatformWidget::mTextureWidth, PWidget::mWidth, NULL, FormatParser::ParseFormattedText(), PlatformFont::RenderText(), and PEBLUtility::strrev_utf8().

Referenced by Draw().

◆ SendToStream() [1/2]

std::ostream & PlatformLabel::SendToStream ( std::ostream &  out) const
protectedvirtual

An inheritable printing class used by PEBLObjectBase::operator<<.

Reimplemented from PlatformWidget.

Definition at line 43 of file validator/PlatformLabel.cpp.

43 {
44 out << "PlatformLabel (validator)";
45 return out;
46}

◆ SendToStream() [2/2]

virtual std::ostream & PlatformLabel::SendToStream ( std::ostream &  out) const
protectedvirtual

An inheritable printing class used by PEBLObjectBase::operator<<.

Reimplemented from PlatformWidget.

◆ SetFont() [1/2]

void PlatformLabel::SetFont ( counted_ptr< PEBLObjectBase font)
virtual

Definition at line 346 of file sdl/PlatformLabel.cpp.

347{
348
349 mFontObject = font;
350
351 // Update the FONT property so nested access works correctly
352 PComplexData * pcd = new PComplexData(mFontObject);
354 delete pcd;
355
356 mChanged =true;
357 Draw();
358
359 //if(!RenderText()) cerr << "Unable to render text.\n";
360
361}
virtual bool SetProperty(std::string name, Variant v)

References Draw(), PTextObject::mChanged, and PEBLObjectBase::SetProperty().

Referenced by PlatformLabel(), PlatformLabel(), PEBLObjects::SetFont(), and SetProperty().

◆ SetFont() [2/2]

virtual void PlatformLabel::SetFont ( counted_ptr< PEBLObjectBase font)
inlinevirtual

Definition at line 41 of file validator/PlatformLabel.h.

41{} // Stub for validator

◆ SetPosition()

virtual void PlatformLabel::SetPosition ( pInt  x,
pInt  y 
)
inlinevirtual

This sets the widget's position on its parent widget.

Sets the location of the upper left-hand corner of the image on the parent widget; unless overridden

Reimplemented from PWidget.

Definition at line 49 of file validator/PlatformLabel.h.

49{ PLabel::SetPosition(x, y); }
void SetPosition(pInt x, pInt y)
This sets the widget's position on its parent widget.
Definition PLabel.cpp:110

References PLabel::SetPosition().

Referenced by Draw(), and PEBLObjects::MakeLabel().

◆ SetProperty() [1/2]

virtual bool PlatformLabel::SetProperty ( std::string  name,
Variant  v 
)
inlinevirtual

Reimplemented from PWidget.

Definition at line 44 of file validator/PlatformLabel.h.

44{ return PLabel::SetProperty(name, v); }
virtual bool SetProperty(std::string, Variant v)
Definition PLabel.cpp:69

References PLabel::SetProperty().

◆ SetProperty() [2/2]

bool PlatformLabel::SetProperty ( std::string  name,
Variant  v 
)
virtual

Reimplemented from PWidget.

Definition at line 324 of file sdl/PlatformLabel.cpp.

325{
326
327 if(name == "TEXT")
328 {
329
330 SetText(v);
331 }
332 else if(PLabel::SetProperty(name,v))
333 {
334 // If we set it at higher level, don't worry.
335 }
336 else if (name == "FONT")
337 {
339
340 }
341 else return false;
342
343 return true;
344}
counted_ptr< PEBLObjectBase > GetObject() const
PComplexData * GetComplexData() const
Definition Variant.cpp:1299

References Variant::GetComplexData(), PComplexData::GetObject(), SetFont(), PLabel::SetProperty(), and SetText().

◆ SetText()

void PlatformLabel::SetText ( const std::string &  text)
virtual

Reimplemented from PTextObject.

Definition at line 364 of file sdl/PlatformLabel.cpp.

365{
366 //Chain up to parent method.
368 mChanged =true;
369 Draw();
370
371 //Re-render the text onto mSurface
372 //if(!RenderText()) cerr << "Unable to render text.\n";
373
374}
virtual void SetText(const std::string &text)

References Draw(), PTextObject::mChanged, and PTextObject::SetText().

Referenced by PlatformLabel(), SetProperty(), and PEBLObjects::SetText().

◆ ValidateProperty() [1/2]

virtual ObjectValidationError PlatformLabel::ValidateProperty ( std::string  name) const
inlinevirtual

Reimplemented from PWidget.

Definition at line 46 of file validator/PlatformLabel.h.

46{ return PLabel::ValidateProperty(name); }
virtual ObjectValidationError ValidateProperty(std::string, Variant v) const
Definition PLabel.cpp:89

References PLabel::ValidateProperty().

◆ ValidateProperty() [2/2]

virtual ObjectValidationError PlatformLabel::ValidateProperty ( std::string  name,
Variant  v 
) const
inlinevirtual

Reimplemented from PWidget.

Definition at line 45 of file validator/PlatformLabel.h.

45{ return PLabel::ValidateProperty(name, v); }

References PLabel::ValidateProperty().


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