#include <textbox.hpp>


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, const SDL_Color &color=font::NORMAL_COLOR) |
| void | append_text (const std::string &text, bool auto_scroll=false, const SDL_Color &color=font::NORMAL_COLOR) |
| void | clear () |
| void | set_editable (bool value) |
| bool | editable () const |
| void | scroll_to_bottom () |
| void | set_wrap (bool val) |
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, const SDL_Color &color=font::NORMAL_COLOR) |
| surface | add_text_line (const wide_string &text, const SDL_Color &color=font::NORMAL_COLOR) |
| 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_ |
Definition at line 26 of file textbox.hpp.
| 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 | |||
| ) |
Definition at line 33 of file textbox.cpp.
References gui::font_size, font::get_max_height(), gui::widget::set_measurements(), gui::scrollarea::set_scroll_rate(), and update_text_cache().

| gui::textbox::~textbox | ( | ) | [virtual] |
Definition at line 48 of file textbox.cpp.
| surface gui::textbox::add_text_line | ( | const wide_string & | text, | |
| const SDL_Color & | color = font::NORMAL_COLOR | |||
| ) | [private] |
Definition at line 235 of file textbox.cpp.
References char_x_, char_y_, gui::font_size, font::get_max_height(), font::get_rendered_text(), gui::scrollarea::inner_location(), line_height_, font::line_width(), w, utils::wchar_to_string(), wrap_, and utils::wstring_to_string().
Referenced by append_text(), and update_text_cache().


| void gui::textbox::append_text | ( | const std::string & | text, | |
| bool | auto_scroll = false, |
|||
| const SDL_Color & | color = font::NORMAL_COLOR | |||
| ) |
Definition at line 79 of file textbox.cpp.
References add_text_line(), surface::assign(), create_compatible_surface(), gui2::create_rect(), surface::get(), gui::scrollarea::get_max_position(), gui::scrollarea::get_position(), handle_text_changed(), scroll_to_bottom(), sdl_blit(), gui::widget::set_dirty(), set_text(), utils::string_to_wstring(), text_, text_image_, update_text_cache(), and wrap_.
Referenced by mp::chat::init_textbox(), and mp::chat::update_textbox().


| void gui::textbox::clear | ( | ) |
Definition at line 118 of file textbox.cpp.
References cursor_, cursor_pos_, handle_text_changed(), selend_, selstart_, gui::widget::set_dirty(), text_, text_pos_, and update_text_cache().
Referenced by mp::ui::handle_key_event().


| void gui::textbox::draw_contents | ( | ) | [protected, virtual] |
Reimplemented from gui::widget.
Definition at line 144 of file textbox.cpp.
References alpha_, alpha_focus_, char_x_, char_y_, gui2::create_rect(), cursor_pos_, draw_cursor(), draw_solid_tinted_rectangle(), fill_rect_alpha(), gui::widget::focus(), CVideo::getSurface(), gui::scrollarea::inner_location(), is_selection(), line_height_, right, screen_area(), sdl_blit(), selend_, selstart_, editor::start(), text_image_, text_pos_, update_rect(), update_text_cache(), gui::widget::video(), and yscroll_.

| void gui::textbox::draw_cursor | ( | int | pos, | |
| CVideo & | video | |||
| ) | const [private] |
Definition at line 131 of file textbox.cpp.
References gui2::create_rect(), editable_, CVideo::getSurface(), h, gui::widget::location(), sdl_fill_rect(), and show_cursor_.
Referenced by draw_contents().


| bool gui::textbox::editable | ( | ) | const |
Definition at line 210 of file textbox.cpp.
References editable_.
| void gui::textbox::erase_selection | ( | ) | [private] |
Definition at line 330 of file textbox.cpp.
References cursor_, is_selection(), selend_, selstart_, and text_.
Referenced by handle_event().


| void gui::textbox::handle_event | ( | const SDL_Event & | event | ) | [private, virtual] |
Reimplemented from gui::scrollarea.
Definition at line 379 of file textbox.cpp.
References char_x_, char_y_, copy_from_clipboard(), copy_to_clipboard(), cursor_, DBG_G, gui2::distance(), gui::widget::draw(), editable_, erase_selection(), gui::widget::focus(), events::focus_handler(), grabmouse_, handle_text_changed(), gui::widget::hidden(), gui::scrollarea::inner_location(), is_selection(), line_height_, max_size_, gui::widget::mouse_locked(), point_in_rect(), pos, selend_, selstart_, gui::widget::set_dirty(), gui::widget::set_focus(), show_cursor_, show_cursor_at_, utils::string_to_wstring(), text_, text_image_, text_pos_, update_text_cache(), WRN_DP, utils::wstring_to_string(), and yscroll_.

| virtual void gui::textbox::handle_text_changed | ( | const wide_string & | ) | [inline, private, virtual] |
Reimplemented in gui::filter_textbox.
Definition at line 50 of file textbox.hpp.
Referenced by append_text(), clear(), handle_event(), and set_text().

| bool gui::textbox::is_selection | ( | ) | [private] |
Definition at line 325 of file textbox.cpp.
References selend_, and selstart_.
Referenced by draw_contents(), erase_selection(), and handle_event().

| bool gui::textbox::requires_event_focus | ( | const SDL_Event * | event = NULL |
) | const [private, virtual] |
Reimplemented from events::handler.
Definition at line 351 of file textbox.cpp.
References editable_, gui::widget::focus_, and gui::widget::hidden().

| void gui::textbox::scroll | ( | unsigned int | pos | ) | [protected, virtual] |
Implements gui::scrollarea.
Definition at line 229 of file textbox.cpp.
References gui::widget::set_dirty(), and yscroll_.

| void gui::textbox::scroll_to_bottom | ( | ) |
Definition at line 215 of file textbox.cpp.
References gui::scrollarea::get_max_position(), and gui::scrollarea::set_position().
Referenced by append_text().


| void gui::textbox::set_editable | ( | bool | value | ) |
Definition at line 205 of file textbox.cpp.
References editable_.
Referenced by mp::lobby::lobby(), and mp::lobby::process_event().

| void gui::textbox::set_inner_location | ( | SDL_Rect const & | rect | ) | [protected, virtual] |
Implements gui::scrollarea.
Definition at line 52 of file textbox.cpp.
References gui::widget::bg_register(), surface::null(), text_image_, text_pos_, and update_text_cache().

| void gui::textbox::set_text | ( | const std::string & | text, | |
| const SDL_Color & | color = font::NORMAL_COLOR | |||
| ) |
Definition at line 67 of file textbox.cpp.
References cursor_, handle_text_changed(), selend_, selstart_, gui::widget::set_dirty(), utils::string_to_wstring(), text_, text_pos_, and update_text_cache().
Referenced by append_text(), mp::create::create(), gui::filter_textbox::filter_textbox(), mp::ui::handle_key_event(), and mp::lobby::lobby().


| void gui::textbox::set_wrap | ( | bool | val | ) |
Definition at line 220 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().


| bool gui::textbox::show_scrollbar | ( | ) | const [private] |
| const std::string gui::textbox::text | ( | ) | const |
Definition at line 60 of file textbox.cpp.
References text_, and utils::wstring_to_string().
Referenced by mp::create::get_parameters(), mp::ui::handle_key_event(), gui::dialog::layout(), mp::lobby::process_event(), mp::create::process_event(), and gui::dialog::textbox_text().


| void gui::textbox::update_text_cache | ( | bool | reset = false, |
|
| const SDL_Color & | color = font::NORMAL_COLOR | |||
| ) | [private] |
Definition at line 301 of file textbox.cpp.
References add_text_line(), surface::assign(), char_x_, char_y_, cursor_, cursor_pos_, h, gui::widget::location(), surface::null(), gui::scrollarea::set_full_size(), gui::scrollarea::set_shown_size(), text_, text_image_, text_pos_, and w.
Referenced by append_text(), clear(), draw_contents(), handle_event(), set_inner_location(), set_text(), set_wrap(), and textbox().


double gui::textbox::alpha_ [private] |
Definition at line 80 of file textbox.hpp.
Referenced by draw_contents().
double gui::textbox::alpha_focus_ [private] |
Definition at line 81 of file textbox.hpp.
Referenced by draw_contents().
std::vector<int> gui::textbox::char_x_ [private] |
Definition at line 64 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 64 of file textbox.hpp.
Referenced by add_text_line(), draw_contents(), handle_event(), and update_text_cache().
int gui::textbox::cursor_ [private] |
Definition at line 57 of file textbox.hpp.
Referenced by clear(), erase_selection(), handle_event(), set_text(), and update_text_cache().
int gui::textbox::cursor_pos_ [private] |
Definition at line 63 of file textbox.hpp.
Referenced by clear(), draw_contents(), and update_text_cache().
bool gui::textbox::editable_ [private] |
Definition at line 66 of file textbox.hpp.
Referenced by draw_cursor(), editable(), handle_event(), requires_event_focus(), and set_editable().
bool gui::textbox::grabmouse_ [private] |
Definition at line 60 of file textbox.hpp.
Referenced by handle_event().
size_t gui::textbox::line_height_ [private] |
Definition at line 78 of file textbox.hpp.
Referenced by add_text_line(), draw_contents(), and handle_event().
size_t gui::textbox::max_size_ [private] |
Definition at line 52 of file textbox.hpp.
Referenced by handle_event().
int gui::textbox::selend_ [private] |
Definition at line 59 of file textbox.hpp.
Referenced by clear(), draw_contents(), erase_selection(), handle_event(), is_selection(), and set_text().
int gui::textbox::selstart_ [private] |
Definition at line 58 of file textbox.hpp.
Referenced by clear(), draw_contents(), erase_selection(), handle_event(), is_selection(), and set_text().
bool gui::textbox::show_cursor_ [private] |
Definition at line 68 of file textbox.hpp.
Referenced by draw_cursor(), and handle_event().
int gui::textbox::show_cursor_at_ [private] |
Definition at line 73 of file textbox.hpp.
Referenced by handle_event().
wide_string gui::textbox::text_ [private] |
Definition at line 54 of file textbox.hpp.
Referenced by append_text(), clear(), erase_selection(), handle_event(), set_text(), text(), and update_text_cache().
surface gui::textbox::text_image_ [private] |
Definition at line 74 of file textbox.hpp.
Referenced by append_text(), draw_contents(), handle_event(), set_inner_location(), and update_text_cache().
int gui::textbox::text_pos_ [private] |
Definition at line 62 of file textbox.hpp.
Referenced by clear(), draw_contents(), handle_event(), set_inner_location(), set_text(), and update_text_cache().
bool gui::textbox::wrap_ [private] |
Definition at line 76 of file textbox.hpp.
Referenced by add_text_line(), append_text(), and set_wrap().
size_t gui::textbox::yscroll_ [private] |
Definition at line 78 of file textbox.hpp.
Referenced by draw_contents(), handle_event(), and scroll().
| Generated by doxygen 1.7.1 on Thu May 24 2012 01:21:40 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |