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

#include <PMovie.h>

Inheritance diagram for PMovie:
PWidget PDevice PEBLObjectBase

Public Member Functions

 PMovie ()
 
virtual ~PMovie ()
 
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
 
virtual long int GetLength ()
 
virtual void SetPosition (int x, int y)
 
virtual void SetSize (int width, int height)
 
virtual std::string ObjectName () const
 
virtual void SetPlaybackPosition (unsigned long int x)
 
virtual void SetVolume (long double vol)
 
- 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
 
- 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 ()
 
- Public Member Functions inherited from PDevice
 PDevice ()
 The Standard constructor.
 
virtual ~PDevice ()
 The Standard destructor.
 
virtual PEBL_DEVICE_TYPE GetDeviceType ()
 
virtual int GetState (int iface) const
 

Protected Member Functions

virtual std::ostream & SendToStream (std::ostream &out) const
 An inheritable printing class used by PEBLObjectBase::operator<<.
 

Protected Attributes

long int mLength
 
double mPlaybackPosition
 
double mVolume
 
- 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

This class, a subtype of PComplexData, is the base Object class subtypes include sounds, visual objects, etc.

Definition at line 40 of file PMovie.h.

Constructor & Destructor Documentation

◆ PMovie()

PMovie::PMovie ( )

Definition at line 35 of file PMovie.cpp.

35 :
36 PWidget()
37{
38 InitializeProperty("NAME",Variant("<MOVIE>"));
39 InitializeProperty("FILENAME","UNKNOWN");
40 InitializeProperty("DURATION",0);
41 InitializeProperty("PLAYBACKPOSITION",0);
42 InitializeProperty("VOLUME",1);
43 __SetProps__();
44
45}
virtual bool InitializeProperty(std::string name, Variant v)
PWidget()
Definition PWidget.cpp:37

References PEBLObjectBase::InitializeProperty().

◆ ~PMovie()

virtual PMovie::~PMovie ( )
inlinevirtual

Definition at line 45 of file PMovie.h.

45{};

Member Function Documentation

◆ GetLength()

virtual long int PMovie::GetLength ( )
inlinevirtual

This will load a file into the class data, given a file name. height and width are set automatically.

Definition at line 59 of file PMovie.h.

59{return mLength;};
long int mLength
Definition PMovie.h:72

References mLength.

◆ GetProperty()

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

Reimplemented from PWidget.

Definition at line 115 of file PMovie.cpp.

116{
117
118 return PEBLObjectBase::GetProperty(name);
119}
Variant GetProperty(std::string) const

References PEBLObjectBase::GetProperty().

◆ ObjectName()

virtual std::string PMovie::ObjectName ( ) const
inlinevirtual

Reimplemented from PWidget.

Definition at line 62 of file PMovie.h.

62{return "PMovie";};

◆ SendToStream()

virtual std::ostream & PMovie::SendToStream ( std::ostream &  out) const
inlineprotectedvirtual

An inheritable printing class used by PEBLObjectBase::operator<<.

Reimplemented from PWidget.

Definition at line 71 of file PMovie.h.

71{return out;};

◆ SetPlaybackPosition()

void PMovie::SetPlaybackPosition ( unsigned long int  x)
virtual

Definition at line 70 of file PMovie.cpp.

71{
73 PEBLObjectBase::SetProperty("PLAYBACKPOSITION",pos);
74
75}
virtual bool SetProperty(std::string name, Variant v)
double mPlaybackPosition
Definition PMovie.h:73

References mPlaybackPosition, and PEBLObjectBase::SetProperty().

Referenced by SetProperty().

◆ SetPosition()

void PMovie::SetPosition ( int  x,
int  y 
)
virtual

This sets the imagebox's position on its parent widget. It overrides the parent method because images positions are set by their centers.

Definition at line 50 of file PMovie.cpp.

51{
52
53
55 mDrawX = x - GetWidth()/2;
56 mDrawY = y - GetHeight()/2;
57}
pInt mDrawX
Definition PWidget.h:129
virtual void SetPosition(pInt x, pInt y)
This sets the widget's position on its parent widget.
Definition PWidget.cpp:220
virtual pInt GetWidth() const
Definition PWidget.h:85
virtual pInt GetHeight() const
Definition PWidget.h:86
pInt mDrawY
Definition PWidget.h:130

References PWidget::GetHeight(), PWidget::GetWidth(), PWidget::mDrawX, PWidget::mDrawY, and PWidget::SetPosition().

Referenced by SetProperty().

◆ SetProperty()

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

Reimplemented from PWidget.

Definition at line 85 of file PMovie.cpp.

86{
87
88 //Width and height are not currently 'settable', in that
89 //they are properties of the object.
90
91 if(name == "X") SetPosition(v,mY);
92 else if (name == "Y") SetPosition(mX,v);
93 else if (name == "HEIGHT") SetSize(v,mWidth);
94 else if (name == "WIDTH") SetSize(mHeight, v);
95 else if (name == "DURATION")
96 PEBLObjectBase::SetProperty("DURATION",v);
97 else if (name == "PLAYBACKPOSITION") SetPlaybackPosition(v);
98 else if (name == "VOLUME") SetVolume((pDouble)v);
99 else if (name == "FILENAME")
100 PEBLObjectBase::SetProperty("FILENAME",v);
101 else if (name == "VISIBLE")
102 {
103 if(v.GetInteger())
104 Show();
105 else
106 Hide();
107 }
108 else return PWidget::SetProperty(name,v);
109
110 return true;
111}
#define pDouble
Definition Defs.h:7
virtual void SetSize(int width, int height)
Definition PMovie.cpp:59
virtual void SetPlaybackPosition(unsigned long int x)
Definition PMovie.cpp:70
virtual void SetVolume(long double vol)
Definition PMovie.cpp:78
virtual void SetPosition(int x, int y)
Definition PMovie.cpp:50
virtual void Show()
Definition PWidget.cpp:396
virtual bool SetProperty(std::string, Variant v)
Definition PWidget.cpp:142
pInt mWidth
Definition PWidget.h:136
pInt mX
Definition PWidget.h:125
pInt mHeight
Definition PWidget.h:136
virtual void Hide()
Definition PWidget.cpp:402
pInt mY
Definition PWidget.h:125
pInt GetInteger() const
Definition Variant.cpp:997

References Variant::GetInteger(), PWidget::Hide(), PWidget::mHeight, PWidget::mWidth, PWidget::mX, PWidget::mY, pDouble, SetPlaybackPosition(), SetPosition(), PEBLObjectBase::SetProperty(), PWidget::SetProperty(), SetSize(), SetVolume(), and PWidget::Show().

◆ SetSize()

void PMovie::SetSize ( int  width,
int  height 
)
virtual

Definition at line 59 of file PMovie.cpp.

60{
61 mWidth = width;
62 mHeight = height;
63
64 PEBLObjectBase::SetProperty("WIDTH",width);
65 PEBLObjectBase::SetProperty("HEIGHT",height);
66
67}

References PWidget::mHeight, PWidget::mWidth, and PEBLObjectBase::SetProperty().

Referenced by SetProperty().

◆ SetVolume()

void PMovie::SetVolume ( long double  vol)
virtual

Definition at line 78 of file PMovie.cpp.

79{
81}

References pDouble, and PEBLObjectBase::SetProperty().

Referenced by SetProperty().

◆ ValidateProperty() [1/2]

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

Reimplemented from PWidget.

Definition at line 137 of file PMovie.cpp.

138{
139 //All valid properties are also valid Widget properties
141 if(ove == OVE_VALID)
142 {
143 return ove;
144 }
145 else if(name =="WIDTH" ||
146 name == "HEIGHT"||
147 name == "DURATION"||
148 name == "FILENAME"||
149 name == "PLAYBACKPOSITION" ||
150 name == "VOLUME" )
151
152 return OVE_VALID;
153 else
155}
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]

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

Reimplemented from PWidget.

Definition at line 122 of file PMovie.cpp.

123{
125 if((code==OVE_VALID) & (name == "VOLUME"))
126 {
127
128 if((pDouble)v < 0)
129 {
131 }
132 }
133
134 return code;
135}
@ OVE_INVALID_PROPERTY_VALUE
Definition PEBLObject.h:42
virtual ObjectValidationError ValidateProperty(std::string, Variant v) const
Definition PMovie.cpp:122

References OVE_INVALID_PROPERTY_VALUE, OVE_VALID, pDouble, and ValidateProperty().

Referenced by ValidateProperty().

Member Data Documentation

◆ mLength

long int PMovie::mLength
protected

Definition at line 72 of file PMovie.h.

Referenced by GetLength().

◆ mPlaybackPosition

double PMovie::mPlaybackPosition
protected

Definition at line 73 of file PMovie.h.

Referenced by SetPlaybackPosition().

◆ mVolume

double PMovie::mVolume
protected

Definition at line 74 of file PMovie.h.


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