gui::textbox Class Reference

#include <textbox.hpp>

Inheritance diagram for gui::textbox:

Inheritance graph
[legend]
Collaboration diagram for gui::textbox:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 textbox (CVideo &video, int width, const std::string &text="", bool editable=true, size_t max_size=256, double alpha=0.4, double alpha_focus=0.2, const bool auto_join=true)
virtual ~textbox ()
const std::string text () const
void set_text (const std::string &text)
void append_text (const std::string &text, bool auto_scroll=false)
void clear ()
void process ()
void set_editable (bool value)
bool editable () const
void scroll_to_bottom ()
void set_wrap (bool val)
void set_location (const SDL_Rect &rect)
void set_location (int x, int y)

Protected Member Functions

virtual void draw_contents ()
virtual void set_inner_location (SDL_Rect const &)
virtual void scroll (unsigned int pos)

Private Member Functions

virtual void handle_text_changed (const wide_string &)
void handle_event (const SDL_Event &event)
void draw_cursor (int pos, CVideo &video) const
void update_text_cache (bool reset=false)
surface add_text_line (const wide_string &text)
bool is_selection ()
void erase_selection ()
bool requires_event_focus (const SDL_Event *event=NULL) const
bool show_scrollbar () const

Private Attributes

size_t max_size_
wide_string text_
int cursor_
int selstart_
int selend_
bool grabmouse_
int text_pos_
int cursor_pos_
std::vector< int > char_x_
std::vector< int > char_y_
bool editable_
bool show_cursor_
int show_cursor_at_
surface text_image_
bool wrap_
size_t line_height_
size_t yscroll_
double alpha_
double alpha_focus_


Detailed Description

Definition at line 27 of file textbox.hpp.


Constructor & Destructor Documentation

gui::textbox::textbox ( CVideo video,
int  width,
const std::string &  text = "",
bool  editable = true,
size_t  max_size = 256,
double  alpha = 0.4,
double  alpha_focus = 0.2,
const bool  auto_join = true 
)

gui::textbox::~textbox (  )  [virtual]

Definition at line 59 of file textbox.cpp.


Member Function Documentation

const std::string gui::textbox::text (  )  const

void gui::textbox::set_text ( const std::string &  text  ) 

void gui::textbox::append_text ( const std::string &  text,
bool  auto_scroll = false 
)

void gui::textbox::clear ( void   ) 

void gui::textbox::process (  ) 

void gui::textbox::set_editable ( bool  value  ) 

Definition at line 221 of file textbox.cpp.

References editable_.

bool gui::textbox::editable (  )  const

Definition at line 226 of file textbox.cpp.

References editable_.

void gui::textbox::scroll_to_bottom (  ) 

void gui::textbox::set_wrap ( bool  val  ) 

Definition at line 236 of file textbox.cpp.

References gui::widget::set_dirty(), update_text_cache(), and wrap_.

Referenced by mp::ui::set_location(), and gui::dialog::set_textbox().

void gui::textbox::set_location ( const SDL_Rect &  rect  )  [virtual]

void gui::textbox::set_location ( int  x,
int  y 
) [inline]

Reimplemented from gui::widget.

Definition at line 50 of file textbox.hpp.

void gui::textbox::draw_contents (  )  [protected, virtual]

void gui::textbox::set_inner_location ( SDL_Rect const &  rect  )  [protected, virtual]

Implements gui::scrollarea.

Definition at line 63 of file textbox.cpp.

References gui::widget::bg_register().

void gui::textbox::scroll ( unsigned int  pos  )  [protected, virtual]

Implements gui::scrollarea.

Definition at line 253 of file textbox.cpp.

References gui::widget::set_dirty(), and yscroll_.

virtual void gui::textbox::handle_text_changed ( const wide_string  )  [inline, private, virtual]

Definition at line 58 of file textbox.hpp.

Referenced by append_text(), clear(), handle_event(), and set_text().

void gui::textbox::handle_event ( const SDL_Event &  event  )  [private, virtual]

void gui::textbox::draw_cursor ( int  pos,
CVideo video 
) const [private]

Definition at line 135 of file textbox.cpp.

References editable_, CVideo::getSurface(), gui::widget::location(), rect, and show_cursor_.

Referenced by draw_contents().

void gui::textbox::update_text_cache ( bool  reset = false  )  [private]

surface gui::textbox::add_text_line ( const wide_string text  )  [private]

bool gui::textbox::is_selection (  )  [private]

Definition at line 349 of file textbox.cpp.

References selend_, and selstart_.

Referenced by draw_contents(), erase_selection(), and handle_event().

void gui::textbox::erase_selection (  )  [private]

Definition at line 354 of file textbox.cpp.

References cursor_, is_selection(), minimum(), selend_, selstart_, and text_.

Referenced by handle_event().

bool gui::textbox::requires_event_focus ( const SDL_Event *  event = NULL  )  const [private, virtual]

Reimplemented from events::handler.

Definition at line 375 of file textbox.cpp.

References editable_, gui::widget::focus_, and gui::widget::hidden().

bool gui::textbox::show_scrollbar (  )  const [private]


Member Data Documentation

size_t gui::textbox::max_size_ [private]

Definition at line 60 of file textbox.hpp.

Referenced by handle_event().

int gui::textbox::cursor_ [private]

Definition at line 65 of file textbox.hpp.

Referenced by clear(), erase_selection(), handle_event(), set_text(), and update_text_cache().

int gui::textbox::selstart_ [private]

Definition at line 66 of file textbox.hpp.

Referenced by clear(), draw_contents(), erase_selection(), handle_event(), is_selection(), and set_text().

int gui::textbox::selend_ [private]

Definition at line 67 of file textbox.hpp.

Referenced by clear(), draw_contents(), erase_selection(), handle_event(), is_selection(), and set_text().

bool gui::textbox::grabmouse_ [private]

Definition at line 68 of file textbox.hpp.

Referenced by handle_event().

int gui::textbox::text_pos_ [private]

Definition at line 71 of file textbox.hpp.

Referenced by clear(), draw_contents(), and update_text_cache().

std::vector<int> gui::textbox::char_x_ [private]

Definition at line 72 of file textbox.hpp.

Referenced by add_text_line(), draw_contents(), handle_event(), and update_text_cache().

std::vector<int> gui::textbox::char_y_ [private]

Definition at line 72 of file textbox.hpp.

Referenced by add_text_line(), draw_contents(), handle_event(), and update_text_cache().

bool gui::textbox::editable_ [private]

Definition at line 76 of file textbox.hpp.

Referenced by draw_cursor(), handle_event(), and process().

Definition at line 81 of file textbox.hpp.

Referenced by handle_event(), and process().

Definition at line 82 of file textbox.hpp.

Referenced by append_text(), draw_contents(), handle_event(), and update_text_cache().

bool gui::textbox::wrap_ [private]

Definition at line 84 of file textbox.hpp.

Referenced by add_text_line(), append_text(), and set_wrap().

size_t gui::textbox::line_height_ [private]

Definition at line 86 of file textbox.hpp.

Referenced by add_text_line(), draw_contents(), and handle_event().

size_t gui::textbox::yscroll_ [private]

Definition at line 86 of file textbox.hpp.

Referenced by draw_contents(), handle_event(), and scroll().

double gui::textbox::alpha_ [private]

Definition at line 88 of file textbox.hpp.

Referenced by draw_contents().

double gui::textbox::alpha_focus_ [private]

Definition at line 89 of file textbox.hpp.

Referenced by draw_contents().


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

Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs