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

#include <PDrawObject.h>

Inheritance diagram for PThickLine:
PDrawObject PWidget PEBLObjectBase PlatformThickLine PlatformThickLine

Public Member Functions

 PThickLine (pInt x1, pInt y1, pInt x2, pInt y2, pInt width, Variant fg)
 
virtual ~PThickLine ()
 
virtual std::ostream & SendToStream (std::ostream &out)
 
virtual void SetPosition (pInt x, pInt y)
 This sets the widget's position on its parent widget.
 
virtual void SetEnds (pInt x1, pInt y1, pInt x2, pInt y2)
 
virtual void SetThickness (pInt t)
 
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 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 Attributes

pInt mX1
 
pInt mY1
 
pInt mX2
 
pInt mY2
 
pInt mThickness
 
- 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 104 of file PDrawObject.h.

Constructor & Destructor Documentation

◆ PThickLine()

PThickLine::PThickLine ( pInt  x1,
pInt  y1,
pInt  x2,
pInt  y2,
pInt  width,
Variant  fg 
)

Definition at line 254 of file PDrawObject.cpp.

254 :
255 PDrawObject(),
256 mX1(x1),
257 mY1(y1),
258 mX2(x2),
259 mY2(y2),
260 mThickness(width)
261
262{
263
264
265 InitializeProperty("NAME",Variant("<THICKLINE>"));
266 InitializeProperty("X1",x1);
267 InitializeProperty("Y1",y1);
268 InitializeProperty("X2",x2);
269 InitializeProperty("Y2",y2);
270 InitializeProperty("THICKNESS",width);
271
272 SetEnds(x1,y1,x2,y2);
273
276
277}
virtual void SetAA(bool aa)
virtual void SetColor(Variant col)
virtual bool InitializeProperty(std::string name, Variant v)
pInt mThickness
virtual void SetEnds(pInt x1, pInt y1, pInt x2, pInt y2)

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

◆ ~PThickLine()

PThickLine::~PThickLine ( )
virtual

Definition at line 279 of file PDrawObject.cpp.

280{
281}

Member Function Documentation

◆ GetProperty()

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

Reimplemented from PDrawObject.

Definition at line 353 of file PDrawObject.cpp.

354{
355 return PEBLObjectBase::GetProperty(name);
356}
Variant GetProperty(std::string) const

References PEBLObjectBase::GetProperty().

◆ SendToStream()

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

Definition at line 383 of file PDrawObject.cpp.

384{
385 out << "PThickLine";
386 return out;
387}

◆ SetEnds()

void PThickLine::SetEnds ( pInt  x1,
pInt  y1,
pInt  x2,
pInt  y2 
)
virtual

Definition at line 297 of file PDrawObject.cpp.

298{
299
300
301 mX1 = x1;
302 mY1 = y1;
303 mX2 = x2;
304 mY2 = y2;
305
306 mX = (x1 + x2)/2;
307 mY = (y1 + y2)/2;
308
313 }
virtual bool SetProperty(std::string name, Variant v)
pInt mX
Definition PWidget.h:125
pInt mY
Definition PWidget.h:125

References PWidget::mX, mX1, mX2, PWidget::mY, mY1, mY2, and PEBLObjectBase::SetProperty().

Referenced by PThickLine(), SetPosition(), and SetProperty().

◆ SetPosition()

void PThickLine::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 PlatformThickLine.

Definition at line 284 of file PDrawObject.cpp.

285{
286
287
288 int deltaX = (int)(x - mX);
289 int deltaY = (int)(y - mY);
290
292
293 SetEnds(mX1 + deltaX,mY1 + deltaY,mX2+deltaX,mY2+deltaY);
294
295}
virtual void SetPosition(pInt x, pInt y)
This sets the widget's position on its parent widget.
Definition PWidget.cpp:220

References PWidget::mX, mX1, mX2, PWidget::mY, mY1, mY2, SetEnds(), and PWidget::SetPosition().

Referenced by PlatformThickLine::SetPosition().

◆ SetProperty()

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

Reimplemented from PDrawObject.

Reimplemented in PlatformThickLine.

Definition at line 324 of file PDrawObject.cpp.

325{
326
327 if(PDrawObject::SetProperty(name,v))
328 {
329 return true;
330 } else {
331
332 // Note, currently the properties dx and dy are not user-accessible. Use height and width.
333 //
334
335 if("X1" == name)
336 SetEnds(v,mY1,mX2,mY2);
337 else if ("Y1" == name)
338 SetEnds(mX1,v,mX2,mY2);
339 else if ("X2" == name)
340 SetEnds(mX1,mY1,v,mY2);
341 else if ("Y2" == name)
342 SetEnds(mX1,mY1,mX2,v);
343 else if ("THICKNESS" == name)
344 SetThickness(v);
345 else
346 return false;
347 }
348
349 return true;
350}
virtual bool SetProperty(std::string, Variant v)
virtual void SetThickness(pInt t)

References mX1, mX2, mY1, mY2, SetEnds(), PDrawObject::SetProperty(), and SetThickness().

Referenced by PlatformThickLine::SetProperty().

◆ SetThickness()

void PThickLine::SetThickness ( pInt  t)
virtual

Definition at line 317 of file PDrawObject.cpp.

318{
319 mThickness = t;
320 PEBLObjectBase::SetProperty("THICKNESS",t);
321 }

References mThickness, and PEBLObjectBase::SetProperty().

Referenced by SetProperty().

◆ ValidateProperty() [1/2]

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

Reimplemented from PDrawObject.

Reimplemented in PlatformThickLine.

Definition at line 365 of file PDrawObject.cpp.

366{
367
369 {
370 return OVE_VALID;
371 }
372 else
373 {
374 if("X1" == name || "X2" == name ||
375 "Y1" == name || "Y2" == name ||
376 "THICKNESS" == name )
377 return OVE_VALID;
378 else return OVE_INVALID_PROPERTY_NAME;
379 }
380}
@ 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 PThickLine::ValidateProperty ( std::string  name,
Variant  v 
) const
virtual

Reimplemented from PDrawObject.

Reimplemented in PlatformThickLine.

Definition at line 359 of file PDrawObject.cpp.

360{
361 return ValidateProperty(name);
362}
virtual ObjectValidationError ValidateProperty(std::string, Variant v) const

References ValidateProperty().

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

Member Data Documentation

◆ mThickness

pInt PThickLine::mThickness
protected

Definition at line 133 of file PDrawObject.h.

Referenced by PlatformThickLine::Draw(), and SetThickness().

◆ mX1

pInt PThickLine::mX1
protected

◆ mX2

pInt PThickLine::mX2
protected

◆ mY1

pInt PThickLine::mY1
protected

◆ mY2

pInt PThickLine::mY2
protected

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