Dragonfly  4.3
A text-based game engine
Public Member Functions | Private Attributes | List of all members
df::TextEntry Class Referenceabstract
Inheritance diagram for df::TextEntry:
Inheritance graph
[legend]
Collaboration diagram for df::TextEntry:
Collaboration graph
[legend]

Public Member Functions

void setText (std::string new_text)
 
std::string getText () const
 
int eventHandler (const Event *p_e)
 
virtual void callback ()=0
 
void setLimit (int new_limit)
 
int getLimit () const
 
void setCursor (int new_cursor)
 
int getCursor () const
 
void setBlinkRate (int new_blink_rate)
 
int getBlinkRate () const
 
bool numbersOnly () const
 
void setNumbersOnly (bool new_numbers_only=true)
 
void setCursorChar (char new_cursor_char)
 
char getCursorChar () const
 
virtual void draw ()
 
virtual std::string serialize (bool all=false)
 
virtual int deserialize (std::string s)
 
virtual bool isModified (enum TextEntryAttribute attribute) const
 
virtual bool isModified () const
 
- Public Member Functions inherited from df::ViewObject
 ViewObject ()
 
void setLocation (ViewObjectLocation new_location)
 
ViewObjectLocation getLocation () const
 
void setDrawValue (bool new_draw_value=true)
 
bool getDrawValue () const
 
void setValue (int new_value)
 
int getValue () const
 
void setBorder (bool new_border)
 
bool getBorder () const
 
void setColor (Color new_color)
 
Color getColor () const
 
void setViewString (std::string new_view_string)
 
std::string getViewString () const
 
void setPosition (Vector new_pos)
 
virtual bool isModified (enum ViewObjectAttribute attribute) const
 
- Public Member Functions inherited from df::Object
 Object ()
 
virtual ~Object ()
 
void setId (int new_id)
 
int getId () const
 
void setType (std::string new_type)
 
std::string getType () const
 
Vector getPosition () const
 
bool isSolid () const
 
int setSolidness (Solidness new_solid)
 
Solidness getSolidness () const
 
void setNoSoft (bool new_no_soft=true)
 
bool getNoSoft () const
 
void setAvoidCollisions (bool new_avoid_collisions=true)
 
bool getAvoidCollisions () const
 
int setAltitude (int new_altitude)
 
int getAltitude () const
 
void setSpeed (float speed)
 
float getSpeed () const
 
void setDirection (Vector new_direction)
 
Vector getDirection () const
 
void setVelocity (Vector velocity)
 
Vector getVelocity () const
 
void setAcceleration (Vector new_acceleration)
 
Vector getAcceleration () const
 
void accelerate ()
 
Vector predictPosition ()
 
void pathTo (Vector position)
 
void pathTo (Object *p_o_target)
 
void moveTo (Vector position)
 
void doPathFollowing ()
 
int setVisible (bool visible=true)
 
bool isVisible () const
 
int setActive (bool active=true)
 
bool isActive () const
 
void setBox (Box new_box)
 
Box getBox () const
 
int registerInterest (std::string event_type)
 
int unregisterInterest (std::string event_type)
 
void setSpriteName (std::string new_name)
 
std::string getSpriteName () const
 
void setSprite (Sprite *p_new_sprite, bool set_box=true)
 
SpritegetSprite () const
 
void setCentered (bool centered=true)
 
bool isCentered () const
 
void setTransparency (char transparent=' ')
 
char getTransparency () const
 
void setSpriteIndex (int new_sprite_index)
 
int getSpriteIndex () const
 
void setSpriteSlowdown (int new_sprite_slowdown)
 
int getSpriteSlowdown () const
 
void setSpriteSlowdownCount (int new_sprite_slowdown_count)
 
int getSpriteSlowdownCount () const
 
virtual bool isModified (enum ObjectAttribute attribute) const
 
void setShape (Shape new_shape)
 
Shape getShape () const
 
void setFollowPath (bool new_follow_path=true)
 
bool getFollowPath () const
 
void setPath (Path new_path)
 
Path getPath () const
 
PathFindgetPathFind ()
 

Private Attributes

std::string m_text
 
int m_limit
 
int m_cursor
 
char m_cursor_char
 
int m_blink_rate
 
bool m_numbers_only
 
bool m_tmodified [TATTR_COUNT]
 

Member Function Documentation

virtual void df::TextEntry::callback ( )
pure virtual

Called when TextEntry enter hit.

Must be defined by derived class.

virtual int df::TextEntry::deserialize ( std::string  s)
virtual

Deserialize string to become attributes.

Rerturn 0 if no errors, else -1.

Reimplemented from df::ViewObject.

virtual void df::TextEntry::draw ( )
virtual

Draw viewstring + text entered.

Reimplemented from df::ViewObject.

int df::TextEntry::eventHandler ( const Event p_e)
virtual

Handle "keyboard" events.

Return 0 if ignored, else 1.

Reimplemented from df::ViewObject.

int df::TextEntry::getBlinkRate ( ) const

Get blink rate for cursor (in ticks).

int df::TextEntry::getCursor ( ) const

Get cursor location.

char df::TextEntry::getCursorChar ( ) const

Get cursor character.

int df::TextEntry::getLimit ( ) const

Get limit of number of characters allowed.

std::string df::TextEntry::getText ( ) const

Get text entered.

virtual bool df::TextEntry::isModified ( enum TextEntryAttribute  attribute) const
virtual

Return true if attribute modified since last serialize.

virtual bool df::TextEntry::isModified ( ) const
virtual

Return true if any attribute modified since last serialize.

Reimplemented from df::ViewObject.

bool df::TextEntry::numbersOnly ( ) const

Return true if only numbers can be entered.

virtual std::string df::TextEntry::serialize ( bool  all = false)
virtual

Serialize Button attributes to single string.

Only modified attributes (unless all is true).

Reimplemented from df::ViewObject.

void df::TextEntry::setBlinkRate ( int  new_blink_rate)

Set blink rate for cursor (in ticks).

void df::TextEntry::setCursor ( int  new_cursor)

Set cursor to location.

void df::TextEntry::setCursorChar ( char  new_cursor_char)

Set cursor character.

void df::TextEntry::setLimit ( int  new_limit)

Set limit of number of characters allowed.

void df::TextEntry::setNumbersOnly ( bool  new_numbers_only = true)

Set to allow only numbers to be entered.

void df::TextEntry::setText ( std::string  new_text)

Set text entered.

Member Data Documentation

int df::TextEntry::m_blink_rate
private

Cursor blink rate.

int df::TextEntry::m_cursor
private

Cursor location.

char df::TextEntry::m_cursor_char
private

Cursor character.

int df::TextEntry::m_limit
private

Character limit in text.

bool df::TextEntry::m_numbers_only
private

True if only numbers.

std::string df::TextEntry::m_text
private

Text entered.

bool df::TextEntry::m_tmodified[TATTR_COUNT]
private

Modified attribute since serialize().