PEBL 2.2
Psychology Experiment Building Language - Cross-platform psychological experiment development system
PDrawObject Class Referenceabstract

#include <PDrawObject.h>

Inheritance diagram for PDrawObject:
PWidget PEBLObjectBase PBezier PCircle PEllipse PLine PPolygon PRectangle PThickLine PlatformBezier PlatformBezier PlatformCircle PlatformCircle PlatformEllipse PlatformEllipse PlatformLine PlatformLine PlatformPolygon PlatformPolygon PSquare PlatformRectangle PlatformRectangle PlatformThickLine PlatformThickLine

Public Member Functions

 PDrawObject ()
 
virtual ~PDrawObject ()
 
virtual void SetFilled (bool filled)
 
virtual void SetColor (Variant col)
 
virtual void SetOutlineColor (Variant ocol)
 
virtual void SetAA (bool aa)
 
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
 
- 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 SetPosition (pInt x, pInt y)
 This sets the widget's position on its parent widget.
 
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
 
virtual std::string ObjectName () 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 =0
 An inheritable printing class used by PEBLObjectBase::operator<<.
 
PColorGetColor () const
 
PColorGetOutlineColor () const
 

Protected Attributes

bool mFilled
 
bool mAntiAliased
 
- 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

Definition at line 39 of file PDrawObject.h.

Constructor & Destructor Documentation

◆ PDrawObject()

PDrawObject::PDrawObject ( )

Definition at line 37 of file PDrawObject.cpp.

38{
39 InitializeProperty("FILLED",Variant(0));
40 InitializeProperty("COLOR",Variant(0));
41 InitializeProperty("OUTLINECOLOR",Variant(0));
43
44 SetAA(0);
45}
virtual void SetAA(bool aa)
virtual bool InitializeProperty(std::string name, Variant v)

References PEBLObjectBase::InitializeProperty(), and SetAA().

◆ ~PDrawObject()

PDrawObject::~PDrawObject ( )
virtual

Definition at line 48 of file PDrawObject.cpp.

49{
50}

Member Function Documentation

◆ GetColor()

PColor * PDrawObject::GetColor ( ) const
protected

Definition at line 148 of file PDrawObject.cpp.

149{
151 if(v.GetComplexData())
152 return dynamic_cast<PColor*>(v.GetComplexData()->GetObject().get());
153 return nullptr;
154}
counted_ptr< PEBLObjectBase > GetObject() const
Variant GetProperty(std::string) const
PComplexData * GetComplexData() const
Definition Variant.cpp:1299
X * get() const
Definition rc_ptrs.h:110

References counted_ptr< X >::get(), Variant::GetComplexData(), PComplexData::GetObject(), and PEBLObjectBase::GetProperty().

Referenced by PlatformLine::Draw(), PlatformThickLine::Draw(), PlatformRectangle::Draw(), PlatformSquare::Draw(), PlatformEllipse::Draw(), PlatformCircle::Draw(), PlatformPolygon::Draw(), and PlatformBezier::Draw().

◆ GetOutlineColor()

PColor * PDrawObject::GetOutlineColor ( ) const
protected

Definition at line 156 of file PDrawObject.cpp.

157{
158 Variant v = PEBLObjectBase::GetProperty("OUTLINECOLOR");
159 if(v.GetComplexData())
160 return dynamic_cast<PColor*>(v.GetComplexData()->GetObject().get());
161 return nullptr;
162}

References counted_ptr< X >::get(), Variant::GetComplexData(), PComplexData::GetObject(), and PEBLObjectBase::GetProperty().

◆ GetProperty()

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

Reimplemented from PWidget.

Reimplemented in PLine, PThickLine, PRectangle, PSquare, PEllipse, PCircle, PPolygon, and PBezier.

Definition at line 92 of file PDrawObject.cpp.

93{
94
95 return PEBLObjectBase::GetProperty(name);
96}

References PEBLObjectBase::GetProperty().

◆ SendToStream()

virtual std::ostream & PDrawObject::SendToStream ( std::ostream &  out) const
protectedpure virtual

◆ SetAA()

void PDrawObject::SetAA ( bool  aa)
virtual

Definition at line 129 of file PDrawObject.cpp.

130{
131
133 mAntiAliased = aa;
134
135}
bool mAntiAliased
Definition PDrawObject.h:69
virtual bool SetProperty(std::string name, Variant v)

References mAntiAliased, and PEBLObjectBase::SetProperty().

Referenced by PDrawObject(), PEllipse::PEllipse(), PLine::PLine(), PPolygon::PPolygon(), PThickLine::PThickLine(), and SetProperty().

◆ SetColor()

◆ SetFilled()

void PDrawObject::SetFilled ( bool  filled)
virtual

Definition at line 123 of file PDrawObject.cpp.

124{
125 mFilled = filled;
126 PEBLObjectBase::SetProperty("FILLED",filled);
127}

References mFilled, and PEBLObjectBase::SetProperty().

Referenced by PCircle::PCircle(), PEllipse::PEllipse(), PPolygon::PPolygon(), PRectangle::PRectangle(), and SetProperty().

◆ SetOutlineColor()

void PDrawObject::SetOutlineColor ( Variant  ocol)
virtual

◆ SetProperty()

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

Reimplemented from PWidget.

Reimplemented in PlatformLine, PlatformThickLine, PlatformRectangle, PlatformSquare, PlatformEllipse, PlatformCircle, PlatformPolygon, PlatformBezier, PLine, PThickLine, PRectangle, PSquare, PEllipse, PCircle, PPolygon, and PBezier.

Definition at line 53 of file PDrawObject.cpp.

54{
55 if(!PWidget::SetProperty(name,v))
56 {
57
58 if (name == "FILLED")
59 {
60 SetFilled(v);
61 }
62 else if(name == "COLOR")
63 {
64 SetColor(v);
65
66 }
67 else if (name == "OUTLINECOLOR")
68 {
70 }
71 else if(name == "AA")
72 {
73 SetAA(v);
74 }
75 else
76 {
77 return false;
78 }
79 return true;
80
81 }
82 else
83 {
84
85 return false;
86 }
87
88
89}
virtual void SetOutlineColor(Variant ocol)
virtual void SetColor(Variant col)
virtual void SetFilled(bool filled)
virtual bool SetProperty(std::string, Variant v)
Definition PWidget.cpp:142

References SetAA(), SetColor(), SetFilled(), SetOutlineColor(), and PWidget::SetProperty().

Referenced by PLine::SetProperty(), PThickLine::SetProperty(), PRectangle::SetProperty(), PSquare::SetProperty(), PEllipse::SetProperty(), PCircle::SetProperty(), PPolygon::SetProperty(), and PBezier::SetProperty().

◆ ValidateProperty() [1/2]

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

Reimplemented from PWidget.

Reimplemented in PlatformLine, PlatformThickLine, PlatformRectangle, PlatformSquare, PlatformEllipse, PlatformCircle, PlatformPolygon, PlatformBezier, PLine, PThickLine, PRectangle, PSquare, PEllipse, PCircle, PPolygon, and PBezier.

Definition at line 104 of file PDrawObject.cpp.

105{
106
107
109
110 if(tmp == OVE_VALID ) return OVE_VALID;
111 else
112 {
113 if(name=="NAME" ||
114 name == "FILLED" ||
115 name == "COLOR" ||
116 name =="OUTLINECOLOR"||
117 name=="AA")
118 return OVE_VALID;
119 else return OVE_INVALID_PROPERTY_NAME;
120 }
121}
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
Definition PWidget.cpp:188

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

◆ ValidateProperty() [2/2]

Member Data Documentation

◆ mAntiAliased

bool PDrawObject::mAntiAliased
protected

◆ mFilled

bool PDrawObject::mFilled
protected

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