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

#include <PDrawObject.h>

Inheritance diagram for PRectangle:
PDrawObject PWidget PEBLObjectBase PSquare PlatformRectangle PlatformRectangle PlatformSquare PlatformSquare

Public Member Functions

 PRectangle (pInt x1, pInt y1, pInt dx, pInt dy, Variant fg, bool filled)
 
virtual ~PRectangle ()
 
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 175 of file PDrawObject.h.

Constructor & Destructor Documentation

◆ PRectangle()

PRectangle::PRectangle ( pInt  x1,
pInt  y1,
pInt  dx,
pInt  dy,
Variant  fg,
bool  filled 
)

Definition at line 391 of file PDrawObject.cpp.

392{
393 InitializeProperty("NAME",Variant("<RECTANGLE>"));
394 InitializeProperty("WIDTH",dx);
395 InitializeProperty("HEIGHT",dy);
396 SetSize(dx,dy);
397 SetPosition(x1,y1);
398 SetFilled(filled);
401}
virtual void SetOutlineColor(Variant ocol)
virtual void SetColor(Variant col)
virtual void SetFilled(bool filled)
virtual bool InitializeProperty(std::string name, Variant v)
virtual void SetSize(pInt dx, pInt dy)
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::SetColor(), PDrawObject::SetFilled(), PDrawObject::SetOutlineColor(), PWidget::SetPosition(), and SetSize().

◆ ~PRectangle()

PRectangle::~PRectangle ( )
virtual

Definition at line 404 of file PDrawObject.cpp.

405{
406}

Member Function Documentation

◆ GetHeight()

virtual pInt PRectangle::GetHeight ( ) const
inlinevirtual

Reimplemented from PWidget.

Reimplemented in PSquare.

Definition at line 181 of file PDrawObject.h.

181{return mDY;};

References mDY.

◆ GetProperty()

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

Reimplemented from PDrawObject.

Reimplemented in PSquare.

Definition at line 440 of file PDrawObject.cpp.

441{
442 return PEBLObjectBase::GetProperty(name);
443
444}
Variant GetProperty(std::string) const

References PEBLObjectBase::GetProperty().

◆ GetWidth()

virtual pInt PRectangle::GetWidth ( ) const
inlinevirtual

Reimplemented from PWidget.

Reimplemented in PSquare.

Definition at line 180 of file PDrawObject.h.

180{return mDX;};

References mDX.

◆ SendToStream()

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

Reimplemented in PSquare.

Definition at line 468 of file PDrawObject.cpp.

469{
470 out <<"PRectangle";
471 return out;
472}

◆ SetProperty()

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

Reimplemented from PDrawObject.

Reimplemented in PlatformRectangle, PlatformSquare, and PSquare.

Definition at line 417 of file PDrawObject.cpp.

418{
419
420 if(!PDrawObject::SetProperty(name,v))
421 {
422 if("WIDTH" == name)
423 {
424 SetSize(v,mDY);
425 }
426 else if("HEIGHT" == name)
427 {
428 SetSize(mDX,v);
429 }
430 else
431 {
432 return false;
433 }
434
435 }
436 return true;
437}
virtual bool SetProperty(std::string, Variant v)

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

Referenced by PlatformRectangle::SetProperty().

◆ SetSize()

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

Definition at line 408 of file PDrawObject.cpp.

409{
410 mDX = dx;
411 mDY = dy;
412 PEBLObjectBase::SetProperty("WIDTH",dx);
413 PEBLObjectBase::SetProperty("HEIGHT",dy);
414 Draw();
415}
virtual bool SetProperty(std::string name, Variant v)
virtual bool Draw()
Definition PWidget.h:68

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

Referenced by PRectangle(), and SetProperty().

◆ ValidateProperty() [1/2]

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

Reimplemented from PDrawObject.

Reimplemented in PlatformRectangle, PlatformSquare, and PSquare.

Definition at line 452 of file PDrawObject.cpp.

453{
455 {
456 return OVE_VALID;
457 }
458 else
459 {
460 if("WIDTH" == name
461 || "HEIGHT" == name )
462 return OVE_VALID;
463 else return OVE_INVALID_PROPERTY_NAME;
464 }
465
466}
@ 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 PRectangle::ValidateProperty ( std::string  name,
Variant  v 
) const
virtual

Reimplemented from PDrawObject.

Reimplemented in PlatformRectangle, PlatformSquare, and PSquare.

Definition at line 447 of file PDrawObject.cpp.

448{
449 return ValidateProperty(name);
450}
virtual ObjectValidationError ValidateProperty(std::string, Variant v) const

References ValidateProperty().

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

Member Data Documentation

◆ mDX

◆ mDY


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