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

#include <PLabel.h>

Inheritance diagram for PLabel:
PTextObject PWidget PEBLObjectBase PlatformLabel PlatformLabel

Public Member Functions

 PLabel ()
 
 PLabel (const std::string &text)
 
 PLabel (const PLabel &label)
 
virtual ~PLabel ()
 
virtual bool SetProperty (std::string, Variant v)
 
virtual Variant GetProperty (std::string) const
 
virtual ObjectValidationError ValidateProperty (std::string, Variant v) const
 
virtual ObjectValidationError ValidateProperty (std::string) const
 
void SetPosition (pInt x, pInt y)
 This sets the widget's position on its parent widget.
 
virtual std::string ObjectName () const
 
- Public Member Functions inherited from PTextObject
 PTextObject ()
 
 PTextObject (const std::string &text)
 
 PTextObject (PTextObject &object)
 
virtual ~PTextObject ()
 
virtual void SetText (const std::string &text)
 
virtual void SetDirection (int i)
 
virtual std::string GetText () const
 
virtual unsigned long int GetNumCharacters ()
 
- 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 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)
 
virtual void SetParent (PWidget *widget)
 This unconditionally sets the parent widget.
 
virtual PWidgetGetParent ()
 
virtual bool IsParent (PWidget *parent)
 
virtual bool Draw ()
 
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 RemoveSubWidgets ()
 
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 ()
 

Protected Member Functions

virtual std::ostream & SendToStream (std::ostream &out) const
 An inheritable printing class used by PEBLObjectBase::operator<<.
 

Additional Inherited Members

- Protected Attributes inherited from PTextObject
bool mChanged
 
std::string mText
 
int mDirection
 
- 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
 

Detailed Description

This class simply represent a visual word. It contains a pointer to a PFont structure and a character string. It can be used by a higher-level class to represent a string of text; but do so while keeping track of the specific locations of words. It actually can represent multiple words, but only displays a single line.

Definition at line 44 of file PLabel.h.

Constructor & Destructor Documentation

◆ PLabel() [1/3]

PLabel::PLabel ( )

Definition at line 36 of file PLabel.cpp.

36 :
37 PTextObject("")
38{
39 InitializeProperty("NAME",Variant("<LABEL>"));
40 InitializeProperty("FORMATTED",Variant(0));
42}
@ CDT_LABEL
Definition PEBLObject.h:59
virtual bool InitializeProperty(std::string name, Variant v)
ComplexDataType mCDT
Definition PEBLObject.h:109

References CDT_LABEL, PEBLObjectBase::InitializeProperty(), and PEBLObjectBase::mCDT.

◆ PLabel() [2/3]

PLabel::PLabel ( const std::string &  text)

Definition at line 46 of file PLabel.cpp.

46 :
47 PTextObject(text)
48{
49 InitializeProperty("NAME",Variant("<LABEL>"));
50 InitializeProperty("FORMATTED",Variant(0));
52}

References CDT_LABEL, PEBLObjectBase::InitializeProperty(), and PEBLObjectBase::mCDT.

◆ PLabel() [3/3]

PLabel::PLabel ( const PLabel label)

Definition at line 56 of file PLabel.cpp.

56 :
57 PTextObject(label.GetText())
58{
59 InitializeProperty("NAME",Variant("<LABEL>"));
60 InitializeProperty("FORMATTED",Variant(0));
62}
virtual std::string GetText() const
Definition PTextObject.h:56

References CDT_LABEL, PEBLObjectBase::InitializeProperty(), and PEBLObjectBase::mCDT.

◆ ~PLabel()

PLabel::~PLabel ( )
virtual

Definition at line 64 of file PLabel.cpp.

65{
66}

Member Function Documentation

◆ GetProperty()

Variant PLabel::GetProperty ( std::string  name) const
virtual

Reimplemented from PTextObject.

Definition at line 83 of file PLabel.cpp.

84{
85 return PTextObject::GetProperty(name);
86}
virtual Variant GetProperty(std::string) const

References PTextObject::GetProperty().

◆ ObjectName()

std::string PLabel::ObjectName ( ) const
virtual

Reimplemented from PTextObject.

Reimplemented in PlatformLabel, and PlatformLabel.

Definition at line 124 of file PLabel.cpp.

125{
126 return "Text Label";
127}

◆ SendToStream()

virtual std::ostream & PLabel::SendToStream ( std::ostream &  out) const
inlineprotectedvirtual

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

Reimplemented from PTextObject.

Reimplemented in PlatformLabel, and PlatformLabel.

Definition at line 69 of file PLabel.h.

69{return out;};

◆ SetPosition()

void PLabel::SetPosition ( pInt  x,
pInt  y 
)
virtual

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.

Reimplemented in PlatformLabel.

Definition at line 110 of file PLabel.cpp.

111{
112 //Why does this get called 4x with an EasyLabel?
113
114 mX = x;
115 mY = y;
116 mDrawX = x - GetWidth()/2;
117 mDrawY = y - GetHeight()/2;
118 // cout << "Setting label position\n" << x << ","<<y<<"|" << mDrawX << "," << mDrawY<<endl;
121}
virtual bool SetProperty(std::string name, Variant v)
pInt mDrawX
Definition PWidget.h:129
virtual pInt GetWidth() const
Definition PWidget.h:85
virtual pInt GetHeight() const
Definition PWidget.h:86
pInt mX
Definition PWidget.h:125
pInt mY
Definition PWidget.h:125
pInt mDrawY
Definition PWidget.h:130

References PWidget::GetHeight(), PWidget::GetWidth(), PWidget::mDrawX, PWidget::mDrawY, PWidget::mX, PWidget::mY, and PEBLObjectBase::SetProperty().

Referenced by PlatformLabel::SetPosition().

◆ SetProperty()

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

Reimplemented from PTextObject.

Reimplemented in PlatformLabel, and PlatformLabel.

Definition at line 69 of file PLabel.cpp.

70{
71 if(name == "FORMATTED") {
72 // FORMATTED property: 0 or 1
74 return true;
75 }
76 else if(PTextObject::SetProperty(name,v))
77 return true;
78 else return false;
79
80}
virtual bool SetProperty(std::string, Variant v)

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

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

◆ ValidateProperty() [1/2]

ObjectValidationError PLabel::ValidateProperty ( std::string  name) const
virtual

Reimplemented from PTextObject.

Reimplemented in PlatformLabel.

Definition at line 94 of file PLabel.cpp.

95{
96 // Check for Label-specific properties first
97 if(name == "FORMATTED") {
98 return OVE_VALID;
99 }
100
101 // Then check parent class properties
103
104 if(ove == OVE_VALID)
105 return ove;
106 else
108}
ObjectValidationError
Definition PEBLObject.h:37
@ OVE_INVALID_PROPERTY_NAME
Definition PEBLObject.h:40
@ OVE_VALID
Definition PEBLObject.h:39
virtual ObjectValidationError ValidateProperty(std::string, Variant v) const

References OVE_INVALID_PROPERTY_NAME, OVE_VALID, and PTextObject::ValidateProperty().

◆ ValidateProperty() [2/2]

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

Reimplemented from PTextObject.

Reimplemented in PlatformLabel.

Definition at line 89 of file PLabel.cpp.

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

References ValidateProperty().

Referenced by PlatformLabel::ValidateProperty(), PlatformLabel::ValidateProperty(), and ValidateProperty().


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