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

#include <PDrawObject.h>

Inheritance diagram for PLine:
PDrawObject PWidget PEBLObjectBase PlatformLine PlatformLine

Public Member Functions

 PLine (pInt x1, pInt y1, pInt dx, pInt dy, Variant fg)
 
virtual ~PLine ()
 
virtual pInt GetWidth () const
 
virtual pInt GetHeight () const
 
virtual void SetSize (pInt dx, pInt dy)
 
virtual std::ostream & SendToStream (std::ostream &out)
 
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 PDrawObject
 PDrawObject ()
 
virtual ~PDrawObject ()
 
virtual void SetFilled (bool filled)
 
virtual void SetColor (Variant col)
 
virtual void SetOutlineColor (Variant ocol)
 
virtual void SetAA (bool aa)
 
- 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 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 Attributes

pInt mDX
 
pInt mDY
 
- Protected Attributes inherited from PDrawObject
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
 

Additional Inherited Members

- Protected Member Functions inherited from PDrawObject
virtual std::ostream & SendToStream (std::ostream &out) const =0
 An inheritable printing class used by PEBLObjectBase::operator<<.
 
PColorGetColor () const
 
PColorGetOutlineColor () const
 

Detailed Description

Definition at line 75 of file PDrawObject.h.

Constructor & Destructor Documentation

◆ PLine()

PLine::PLine ( pInt  x1,
pInt  y1,
pInt  dx,
pInt  dy,
Variant  fg 
)

Definition at line 165 of file PDrawObject.cpp.

165 :
166 PDrawObject(),
167 mDX(dx),
168 mDY(dy)
169{
170 InitializeProperty("NAME",Variant("<LINE>"));
171 InitializeProperty("WIDTH",dx);
172 InitializeProperty("HEIGHT",dy);
173
174 SetPosition(x1,y1);
177
178}
virtual void SetAA(bool aa)
virtual void SetColor(Variant col)
virtual bool InitializeProperty(std::string name, Variant v)
pInt mDX
Definition PDrawObject.h:96
pInt mDY
Definition PDrawObject.h:97
virtual void SetPosition(pInt x, pInt y)
This sets the widget's position on its parent widget.
Definition PWidget.cpp:220

References PEBLObjectBase::InitializeProperty(), PDrawObject::SetAA(), PDrawObject::SetColor(), and PWidget::SetPosition().

◆ ~PLine()

PLine::~PLine ( )
virtual

Definition at line 180 of file PDrawObject.cpp.

181{
182}

Member Function Documentation

◆ GetHeight()

virtual pInt PLine::GetHeight ( ) const
inlinevirtual

Reimplemented from PWidget.

Definition at line 81 of file PDrawObject.h.

81{return mDY;};

References mDY.

◆ GetProperty()

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

Reimplemented from PDrawObject.

Definition at line 218 of file PDrawObject.cpp.

219{
220 return PEBLObjectBase::GetProperty(name);
221}
Variant GetProperty(std::string) const

References PEBLObjectBase::GetProperty().

◆ GetWidth()

virtual pInt PLine::GetWidth ( ) const
inlinevirtual

Reimplemented from PWidget.

Definition at line 80 of file PDrawObject.h.

80{return mDX;};

References mDX.

◆ SendToStream()

std::ostream & PLine::SendToStream ( std::ostream &  out)
virtual

Definition at line 246 of file PDrawObject.cpp.

247{
248 out << "PLine";
249 return out;
250}

◆ SetProperty()

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

Reimplemented from PDrawObject.

Reimplemented in PlatformLine.

Definition at line 195 of file PDrawObject.cpp.

196{
197
198 if(PDrawObject::SetProperty(name,v))
199 {
200 return true;
201 } else {
202
203 // Note, currently the properties dx and dy are not user-accessible. Use height and width.
204 //
205
206 if("WIDTH" == name)
207 SetSize(v,mDY);
208 else if ("HEIGHT" == name)
209 SetSize(mDX, v);
210 else
211 return false;
212 }
213
214 return true;
215}
virtual bool SetProperty(std::string, Variant v)
virtual void SetSize(pInt dx, pInt dy)

References mDX, mDY, PDrawObject::SetProperty(), and SetSize().

Referenced by PlatformLine::SetProperty().

◆ SetSize()

void PLine::SetSize ( pInt  dx,
pInt  dy 
)
virtual

Definition at line 185 of file PDrawObject.cpp.

186{
187
188 mDX = dx;
189 mDY = dy;
190 PEBLObjectBase::SetProperty("WIDTH",dx);
191 PEBLObjectBase::SetProperty("HEIGHT",dy);
192}
virtual bool SetProperty(std::string name, Variant v)

References mDX, mDY, and PEBLObjectBase::SetProperty().

Referenced by SetProperty().

◆ ValidateProperty() [1/2]

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

Reimplemented from PDrawObject.

Reimplemented in PlatformLine.

Definition at line 230 of file PDrawObject.cpp.

231{
232
234 {
235 return OVE_VALID;
236 }
237 else
238 {
239 if("WIDTH" == name || "HEIGHT" == name )
240 return OVE_VALID;
241 else return OVE_INVALID_PROPERTY_NAME;
242 }
243}
@ 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 PDrawObject::ValidateProperty().

◆ ValidateProperty() [2/2]

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

Reimplemented from PDrawObject.

Reimplemented in PlatformLine.

Definition at line 224 of file PDrawObject.cpp.

225{
226 return ValidateProperty(name);
227}
virtual ObjectValidationError ValidateProperty(std::string, Variant v) const

References ValidateProperty().

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

Member Data Documentation

◆ mDX

pInt PLine::mDX
protected

◆ mDY

pInt PLine::mDY
protected

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