12#include "EventMouse.h"
13#include "ViewObject.h"
19 TEXT = 1 << (ViewObjectAttributeMax + 0),
20 APPEARANCE = 1 << (ViewObjectAttributeMax + 1),
22const int TextEntryAttributeMax = ViewObjectAttributeMax + 2;
86 virtual int draw()
override;
93 virtual int serialize(std::stringstream *p_ss,
unsigned int attr=0)
override;
99 virtual int deserialize(std::stringstream *p_ss,
unsigned int *p_a=NULL)
override;
Definition: TextEntry.h:24
int m_blink_rate
Cursor blink rate.
Definition: TextEntry.h:31
virtual int serialize(std::stringstream *p_ss, unsigned int attr=0) override
Serialize attributes to stream.
int getBlinkRate() const
Get blink rate for cursor (in ticks).
void clearText()
Clear text entry.
virtual void callback()=0
Called when TextEntry enter hit.
std::string getText() const
Get text entered.
void setLimit(int new_limit)
Set limit of number of characters allowed.
char m_cursor_char
Cursor character.
Definition: TextEntry.h:30
int m_limit
Character limit in text.
Definition: TextEntry.h:28
int eventHandler(const Event *p_e) override
Handle "keyboard" events.
char getCursorChar() const
Get cursor character.
virtual int draw() override
Draw viewstring + text entered.
bool m_shift_down
True if shift key pressed.
Definition: TextEntry.h:33
void setNumbersOnly(bool new_numbers_only=true)
Set to allow only numbers to be entered.
int getLimit() const
Get limit of number of characters allowed.
virtual int deserialize(std::stringstream *p_ss, unsigned int *p_a=NULL) override
Deserialize stream to attributes and apply.
bool numbersOnly() const
Return true if only numbers can be entered.
void setCursor(int new_cursor)
Set cursor to location.
std::string m_text
Text entered.
Definition: TextEntry.h:27
int m_cursor
Cursor location.
Definition: TextEntry.h:29
void setText(std::string new_text)
Set text, increasing limit if needed.
void setCursorChar(char new_cursor_char)
Set cursor character.
int getCursor() const
Get cursor location.
void setBlinkRate(int new_blink_rate)
Set blink rate for cursor (in ticks).
bool m_numbers_only
True if only numbers.
Definition: TextEntry.h:32
Definition: ViewObject.h:39
An animation for a sprite.
Definition: Animation.h:15
TextEntryAttribute
Categories of TextEntry attributes that indicate modification.
Definition: TextEntry.h:18