|
PEBL 2.2
Psychology Experiment Building Language - Cross-platform psychological experiment development system
|
Validator platform textbox - no rendering, used only for compilation. More...
#include <PlatformTextBox.h>
Public Member Functions | |
| PlatformTextBox (std::string text, counted_ptr< PEBLObjectBase > font, int width, int height) | |
| PlatformTextBox (const PlatformTextBox &textbox) | |
| This copy constructor isn't const because the font is shared. | |
| virtual | ~PlatformTextBox () |
| Standard Destructor. | |
| virtual bool | RenderText () |
| virtual bool | SetProperty (std::string, Variant v) |
| virtual Variant | GetProperty (std::string name) const |
| virtual void | SetFont (counted_ptr< PEBLObjectBase > font) |
| virtual void | SetText (std::string text) |
| virtual void | SetHeight (int h) |
| virtual void | SetWidth (int w) |
| virtual counted_ptr< PEBLObjectBase > | GetFont () const |
| virtual bool | Draw () |
| This method initiates everything needed to display the main window | |
| virtual void | HandleKeyPress (int keycode, int modkeys, Uint16 unicode) |
| virtual void | HandleTextInput (std::string input) |
| virtual std::string | ObjectName () const |
| virtual int | FindCursorPosition (long int x, long int y) |
| virtual void | SetEditable (bool val) |
| Variant | GetLineBreaks () |
| PlatformTextBox (const std::string &text, counted_ptr< PEBLObjectBase > font, int width, int height) | |
| PlatformTextBox (PlatformTextBox &textbox) | |
| virtual | ~PlatformTextBox () |
| virtual bool | Draw () |
| This method initiates everything needed to display the main window | |
| virtual std::string | ObjectName () const |
| virtual int | FindCursorPosition (long int x, long int y) |
| virtual Variant | GetLineBreaks () |
| virtual void | SetFont (counted_ptr< PEBLObjectBase > font) |
| virtual bool | SetProperty (std::string name, Variant v) |
| virtual ObjectValidationError | ValidateProperty (std::string name, Variant v) const |
| virtual ObjectValidationError | ValidateProperty (std::string name) const |
| virtual void | SetPosition (pInt x, pInt y) |
| This sets the widget's position on its parent widget. | |
Public Member Functions inherited from PlatformWidget | |
| PlatformWidget () | |
| virtual | ~PlatformWidget () |
| virtual SDL_Texture * | GetSDL_Texture () |
| Used to extract an SDL surface from the widget. Used by children drawing themselves on their parent. | |
| void | SetParent (PlatformWidget *parent) |
| SDL_Surface * | GetSurface () |
| virtual bool | SetRenderer (SDL_Renderer *renderer) |
| SDL_Renderer * | GetRenderer () |
| virtual bool | AddToParentWidget (PlatformWidget *parent) |
| virtual bool | AddSubWidget (PlatformWidget *widget) |
| virtual bool | RemoveSubWidget (PlatformWidget *widget) |
| virtual bool | RemoveSubWidgets () |
| virtual bool | RotoZoom (double angle, double zoomx, double zoomy, int smooth) |
| This uses the SDL_gfx package to 'rotozoom'. | |
| bool | SetPoint (int x, int y, PColor col) |
| PColor | GetPixel (int x, int y) |
| PlatformWidget () | |
| PlatformWidget (pInt x, pInt y, pInt width, pInt height, bool visible) | |
| virtual | ~PlatformWidget () |
| 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) |
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 void | SetParent (PWidget *widget) |
| This unconditionally sets the parent widget. | |
| virtual PWidget * | GetParent () |
| virtual bool | IsParent (PWidget *parent) |
| 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 | 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 PTextBox | |
| PTextBox () | |
| PTextBox (std::string text, int width, int height) | |
| PTextBox (PTextBox &textbox) | |
| virtual | ~PTextBox () |
| virtual void | InsertText (const std::string character) |
| virtual void | DeleteText (int length) |
| virtual bool | GetEditable () |
| virtual void | SetCursorPosition (unsigned long int pos) |
| virtual unsigned long int | GetCursorPosition () |
| virtual long unsigned int | IncrementCursor () |
| virtual long unsigned int | DecrementCursor () |
| virtual void | SetLineWrap (bool state) |
| virtual void | SetJustify (Variant j) |
| virtual bool | AtPrintableCharacter (unsigned long int x) |
Public Member Functions inherited from PTextObject | |
| PTextObject () | |
| PTextObject (const std::string &text) | |
| PTextObject (PTextObject &object) | |
| virtual | ~PTextObject () |
| virtual void | SetText (const std::string &text) |
| virtual void | SetDirection (int i) |
| virtual std::string | GetText () const |
| virtual unsigned long int | GetNumCharacters () |
Protected Member Functions | |
| virtual std::ostream & | SendToStream (std::ostream &out) const |
| An inheritable printing class used by PEBLObjectBase::operator<<. | |
| virtual std::ostream & | SendToStream (std::ostream &out) const |
| An inheritable printing class used by PEBLObjectBase::operator<<. | |
Protected Member Functions inherited from PlatformWidget | |
| virtual void | PrintSubWidgets (std::ostream &out) const |
| virtual bool | LockSurface () |
| This needs to be used on some platforms/video cards. | |
| virtual bool | UnlockSurface () |
| This needs to be used on some platforms/video cards. | |
Protected Attributes | |
| std::vector< int > | mBreaks |
Protected Attributes inherited from PlatformWidget | |
| pInt | mTextureWidth |
| pInt | mTextureHeight |
| bool | mNeedsTexture |
| SDL_Texture * | mTexture |
| SDL_Surface * | mSurface |
| SDL_Renderer * | mRenderer |
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 |
| PWidget * | mParent |
Protected Attributes inherited from PEBLObjectBase | |
| ComplexDataType | mCDT |
| std::map< std::string, Variant > | mProperties |
Protected Attributes inherited from PTextBox | |
| bool | mEditable |
| unsigned long int | mCursorPos |
| bool | mCursorChanged |
| bool | mLineWrap |
| Variant | mJustify |
Protected Attributes inherited from PTextObject | |
| bool | mChanged |
| std::string | mText |
| int | mDirection |
Validator platform textbox - no rendering, used only for compilation.
This class defines an SDL-specific text box.
Definition at line 55 of file sdl/PlatformTextBox.h.
| PlatformTextBox::PlatformTextBox | ( | std::string | text, |
| counted_ptr< PEBLObjectBase > | font, | ||
| int | width, | ||
| int | height | ||
| ) |
| PlatformTextBox::PlatformTextBox | ( | const PlatformTextBox & | textbox | ) |
This copy constructor isn't const because the font is shared.
Definition at line 147 of file sdl/PlatformTextBox.cpp.
References CDT_TEXTBOX, GetFont(), PWidget::GetHeight(), PWidget::GetWidth(), PEBLObjectBase::mCDT, PTextObject::mChanged, PWidget::mHeight, PlatformWidget::mRenderer, PlatformWidget::mSurface, PTextObject::mText, PlatformWidget::mTexture, PlatformWidget::mTextureHeight, PlatformWidget::mTextureWidth, PWidget::mWidth, NULL, and SetFont().
|
virtual |
Standard Destructor.
Definition at line 172 of file sdl/PlatformTextBox.cpp.
| PlatformTextBox::PlatformTextBox | ( | const std::string & | text, |
| counted_ptr< PEBLObjectBase > | font, | ||
| int | width, | ||
| int | height | ||
| ) |
Definition at line 27 of file validator/PlatformTextBox.cpp.
| PlatformTextBox::PlatformTextBox | ( | PlatformTextBox & | textbox | ) |
Definition at line 32 of file validator/PlatformTextBox.cpp.
|
virtual |
|
virtual |
This method initiates everything needed to display the main window
Reimplemented from PlatformWidget.
Definition at line 1651 of file sdl/PlatformTextBox.cpp.
References PlatformFont::ClearChanged(), PlatformWidget::Draw(), counted_ptr< X >::get(), PFont::GetAntiAliased(), PWidget::GetBackgroundColor(), PFont::GetBackgroundColor(), PFont::GetFontColor(), PFont::GetFontFileName(), PFont::GetFontSize(), PFont::GetFontStyle(), Variant::GetInteger(), PEBLObjectBase::GetProperty(), PTextObject::mChanged, PTextBox::mCursorChanged, PTextBox::mEditable, NULL, RenderText(), PWidget::SetBackgroundColor(), and PEBLObjectBase::SetProperty().
|
virtual |
This method initiates everything needed to display the main window
Reimplemented from PlatformWidget.
|
virtual |
Given an x,y position, this will return an integer specifying the character in mText before which the cursor should be n. But, the text may be UTF-8, so an particular character may be several bytes wide so we need to take care to compute cursor position correctly. Cursor position should be related to the byte is the string, but it should not allow half-byte character positions.
Definition at line 1454 of file sdl/PlatformTextBox.cpp.
References PTextBox::AtPrintableCharacter(), PlatformFont::GetPosition(), PlatformFont::GetTextHeight(), PlatformFont::GetTextWidth(), mBreaks, PWidget::mHeight, PTextBox::mJustify, PTextObject::mText, and PWidget::mWidth.
Referenced by PEBLEnvironment::GetTextBoxCursorFromClick(), and HandleKeyPress().
|
inlinevirtual |
Definition at line 42 of file validator/PlatformTextBox.h.
|
inlinevirtual |
Definition at line 78 of file sdl/PlatformTextBox.h.
References counted_ptr< X >::get().
Referenced by PlatformTextBox().
| Variant PlatformTextBox::GetLineBreaks | ( | ) |
Definition at line 1952 of file sdl/PlatformTextBox.cpp.
References mBreaks, NULL, and PList::PushBack().
Referenced by PEBLObjects::GetLineBreaks().
|
inlinevirtual |
Definition at line 43 of file validator/PlatformTextBox.h.
|
virtual |
Reimplemented from PWidget.
Definition at line 655 of file sdl/PlatformTextBox.cpp.
References PTextBox::GetProperty(), and mBreaks.
|
virtual |
Reimplemented from PTextBox.
Definition at line 1791 of file sdl/PlatformTextBox.cpp.
References PTextBox::DecrementCursor(), PTextBox::DeleteText(), FindCursorPosition(), PlatformFont::GetTextHeight(), PlatformFont::GetTextWidth(), PTextBox::IncrementCursor(), PTextBox::InsertText(), mBreaks, PTextBox::mCursorChanged, PTextBox::mCursorPos, PTextBox::mJustify, PTextObject::mText, PWidget::mWidth, PEBL_KEYCODE_BACKSPACE, PEBL_KEYCODE_DELETE, PEBL_KEYCODE_DOWN, PEBL_KEYCODE_KP_ENTER, PEBL_KEYCODE_LEFT, PEBL_KEYCODE_RETURN, PEBL_KEYCODE_RETURN2, PEBL_KEYCODE_RIGHT, and PEBL_KEYCODE_UP.
Referenced by PEBLEnvironment::GetInput0().
|
virtual |
Reimplemented from PTextBox.
Definition at line 1945 of file sdl/PlatformTextBox.cpp.
References PTextBox::HandleTextInput().
Referenced by PEBLEnvironment::GetInput0().
|
inlinevirtual |
Reimplemented from PWidget.
Definition at line 86 of file sdl/PlatformTextBox.h.
|
inlinevirtual |
Reimplemented from PWidget.
Definition at line 41 of file validator/PlatformTextBox.h.
|
virtual |
This method should be called when the font is initialized or the text is changed. It will make the mSurface pointer hold the appropriate image.
Definition at line 190 of file sdl/PlatformTextBox.cpp.
References PColor::GetAlpha(), PFont::GetAntiAliased(), PFont::GetBackgroundColor(), PColor::GetBlue(), PFont::GetFontColor(), PFont::GetFontFileName(), PFont::GetFontSize(), PColor::GetGreen(), Variant::GetInteger(), PEBLObjectBase::GetProperty(), PColor::GetRed(), PlatformFont::GetTextHeight(), PlatformFont::GetTextWidth(), PlatformFont::GetTTFFont(), FormatParser::JUSTIFY_CENTER, FormatParser::JUSTIFY_NONE, FormatParser::JUSTIFY_RIGHT, mBreaks, PTextObject::mChanged, PTextBox::mEditable, PWidget::mHeight, PTextBox::mJustify, PlatformWidget::mRenderer, PlatformWidget::mSurface, PTextObject::mText, PlatformWidget::mTexture, PlatformWidget::mTextureHeight, PlatformWidget::mTextureWidth, PWidget::mWidth, NULL, FormatParser::ParseFormattedText(), PlatformFont::RenderText(), PError::SignalFatalError(), and PEBLUtility::strrev_utf8().
Referenced by Draw().
|
protectedvirtual |
An inheritable printing class used by PEBLObjectBase::operator<<.
Reimplemented from PlatformWidget.
Definition at line 44 of file validator/PlatformTextBox.cpp.
|
protectedvirtual |
An inheritable printing class used by PEBLObjectBase::operator<<.
Reimplemented from PlatformWidget.
|
virtual |
Reimplemented from PTextBox.
Definition at line 739 of file sdl/PlatformTextBox.cpp.
References Variant::GetInteger(), PEBLObjectBase::GetProperty(), PTextObject::mChanged, PTextBox::mCursorChanged, PTextBox::mCursorPos, PTextObject::mText, PTextBox::SetEditable(), and PEBLObjectBase::SetProperty().
Referenced by PEBLEnvironment::GetInput0(), and PEBLObjects::SetEditable().
|
virtual |
Definition at line 691 of file sdl/PlatformTextBox.cpp.
References PWidget::GetBackgroundColor(), PFont::GetFontSize(), Variant::GetInteger(), PEBLObjectBase::GetProperty(), PTextObject::mChanged, PWidget::SetBackgroundColor(), and PEBLObjectBase::SetProperty().
Referenced by PlatformTextBox(), PEBLObjects::SetFont(), and SetProperty().
|
inlinevirtual |
Definition at line 44 of file validator/PlatformTextBox.h.
|
virtual |
Reimplemented from PTextBox.
Definition at line 669 of file sdl/PlatformTextBox.cpp.
References PlatformWidget::mTextureHeight, and PTextBox::SetHeight().
Referenced by SetProperty().
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.
Definition at line 58 of file validator/PlatformTextBox.h.
References PWidget::SetPosition().
Referenced by PEBLObjects::MakeTextBox().
|
inlinevirtual |
Reimplemented from PWidget.
Definition at line 47 of file validator/PlatformTextBox.h.
References PTextBox::SetProperty().
|
virtual |
Reimplemented from PWidget.
Definition at line 626 of file sdl/PlatformTextBox.cpp.
References Variant::GetComplexData(), PComplexData::GetObject(), SetFont(), SetHeight(), PTextBox::SetProperty(), SetText(), and SetWidth().
Referenced by PEBLObjects::MakeTextBox().
|
virtual |
Definition at line 718 of file sdl/PlatformTextBox.cpp.
References PTextObject::mChanged, PTextBox::mCursorChanged, and PTextObject::SetText().
Referenced by SetProperty(), and PEBLObjects::SetText().
|
virtual |
Reimplemented from PTextBox.
Definition at line 679 of file sdl/PlatformTextBox.cpp.
References PlatformWidget::mTextureWidth, and PTextBox::SetWidth().
Referenced by SetProperty().
|
inlinevirtual |
Reimplemented from PWidget.
Definition at line 53 of file validator/PlatformTextBox.h.
References PTextBox::ValidateProperty().
|
inlinevirtual |
Reimplemented from PWidget.
Definition at line 50 of file validator/PlatformTextBox.h.
References PTextBox::ValidateProperty().
|
protected |
Definition at line 94 of file sdl/PlatformTextBox.h.
Referenced by FindCursorPosition(), GetLineBreaks(), GetProperty(), HandleKeyPress(), and RenderText().