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

#include <PDrawObject.h>

Inheritance diagram for PSquare:
PRectangle PDrawObject PWidget PEBLObjectBase PlatformSquare PlatformSquare

Public Member Functions

 PSquare (pInt x, pInt y, pInt size, Variant fg, bool filled)
 
virtual ~PSquare ()
 
virtual pInt GetWidth () const
 
virtual pInt GetHeight () const
 
virtual void SetSize (pInt size)
 
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 PRectangle
 PRectangle (pInt x1, pInt y1, pInt dx, pInt dy, Variant fg, bool filled)
 
virtual ~PRectangle ()
 
virtual void SetSize (pInt dx, pInt dy)
 
- 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 ()
 

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
 
- Protected Attributes inherited from PRectangle
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
 

Detailed Description

Definition at line 198 of file PDrawObject.h.

Constructor & Destructor Documentation

◆ PSquare()

PSquare::PSquare ( pInt  x,
pInt  y,
pInt  size,
Variant  fg,
bool  filled 
)

Definition at line 477 of file PDrawObject.cpp.

477 :
478 PRectangle(x,y,size,size,col,filled)
479{
480 InitializeProperty("NAME",Variant("<SQUARE>"));
481 InitializeProperty("SIZE",size);
482 SetSize(size);
483}
virtual bool InitializeProperty(std::string name, Variant v)
virtual void SetSize(pInt size)

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

◆ ~PSquare()

PSquare::~PSquare ( )
virtual

Definition at line 486 of file PDrawObject.cpp.

487{
488}

Member Function Documentation

◆ GetHeight()

virtual pInt PSquare::GetHeight ( ) const
inlinevirtual

Reimplemented from PRectangle.

Definition at line 204 of file PDrawObject.h.

204{return mDY;};

References PRectangle::mDY.

◆ GetProperty()

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

Reimplemented from PRectangle.

Definition at line 528 of file PDrawObject.cpp.

529{
530 return PEBLObjectBase::GetProperty(name);
531
532}
Variant GetProperty(std::string) const

References PEBLObjectBase::GetProperty().

◆ GetWidth()

virtual pInt PSquare::GetWidth ( ) const
inlinevirtual

Reimplemented from PRectangle.

Definition at line 203 of file PDrawObject.h.

203{return mDX;};

References PRectangle::mDX.

◆ SendToStream()

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

Reimplemented from PRectangle.

Definition at line 495 of file PDrawObject.cpp.

496{
497 out <<"PSquare";
498 return out;
499}

◆ SetProperty()

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

Reimplemented from PRectangle.

Reimplemented in PlatformSquare.

Definition at line 511 of file PDrawObject.cpp.

512{
513 if(!PDrawObject::SetProperty(name,v))
514 {
515
516 if("WIDTH" == name ||
517 "HEIGHT" == name ||
518 "SIZE" == name)
519 {
520 SetSize(v);
521 }
522 else return false;
523 }
524 return true;
525}
virtual bool SetProperty(std::string, Variant v)

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

Referenced by PlatformSquare::SetProperty().

◆ SetSize()

void PSquare::SetSize ( pInt  size)
virtual

Definition at line 501 of file PDrawObject.cpp.

502{
503 mDX = size;
504 mDY = size;
505 PEBLObjectBase::SetProperty("WIDTH",size);
506 PEBLObjectBase::SetProperty("HEIGHT",size);
507 PEBLObjectBase::SetProperty("SIZE",size);
508
509}
virtual bool SetProperty(std::string name, Variant v)

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

Referenced by PSquare(), and SetProperty().

◆ ValidateProperty() [1/2]

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

Reimplemented from PRectangle.

Reimplemented in PlatformSquare.

Definition at line 540 of file PDrawObject.cpp.

541{
542
544 {
545 return OVE_VALID;
546 }
547 else
548 {
549 if("WIDTH" == name
550 || "HEIGHT" == name
551 || "SIZE" == name)
552 return OVE_VALID;
553 else return OVE_INVALID_PROPERTY_NAME;
554 }
555
556}
@ 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 PSquare::ValidateProperty ( std::string  name,
Variant  v 
) const
virtual

Reimplemented from PRectangle.

Reimplemented in PlatformSquare.

Definition at line 535 of file PDrawObject.cpp.

536{
537 return ValidateProperty(name);
538}
virtual ObjectValidationError ValidateProperty(std::string, Variant v) const

References ValidateProperty().

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


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