#include <scrollarea.hpp>
Public Member Functions | |
scrollarea (bool auto_join=true) | |
Create a zone with automatic handling of scrollbar. More... | |
virtual void | hide (bool value=true) |
Public Member Functions inherited from gui::widget | |
const rect & | location () const |
virtual void | set_location (const SDL_Rect &rect) |
void | set_location (int x, int y) |
void | set_width (int w) |
void | set_height (int h) |
void | set_measurements (int w, int h) |
int | width () const |
int | height () const |
bool | focus (const SDL_Event *event) |
void | set_focus (bool focus) |
bool | hidden () const |
virtual void | enable (bool new_val=true) |
bool | enabled () const |
void | set_clip_rect (const SDL_Rect &rect) |
void | queue_redraw () |
Indicate that the widget should be redrawn. More... | |
void | queue_redraw (const rect &) |
Indicate that a specific region of the screen should be redrawn. More... | |
void | set_dirty (bool dirty=true) |
bool | dirty () const |
const std::string & | id () const |
void | set_id (const std::string &id) |
void | set_tooltip_string (const std::string &str) |
virtual void | process_tooltip_string (int mousex, int mousey) override |
virtual void | layout () override |
Called by draw_manager to validate layout. More... | |
virtual bool | expose (const rect ®ion) override |
Called by draw_manager when it believes a redraw is necessary. More... | |
virtual rect | screen_location () override |
The current draw location of the display, on the screen. More... | |
Public Member Functions inherited from events::sdl_handler | |
virtual void | handle_window_event (const SDL_Event &) |
virtual bool | requires_event_focus (const SDL_Event *=nullptr) const |
virtual void | join () |
virtual void | join (context &c) |
virtual void | join_same (sdl_handler *parent) |
virtual void | leave () |
virtual void | join_global () |
virtual void | leave_global () |
virtual bool | has_joined () |
virtual bool | has_joined_global () |
sdl_handler & | operator= (sdl_handler &&)=delete |
Moving would require two instances' context membership to be handled, it's simpler to delete these and require the two instances to be separately constructed / destructed. More... | |
sdl_handler (sdl_handler &&)=delete | |
Public Member Functions inherited from gui2::top_level_drawable | |
virtual void | update () |
Update state and any parameters that may effect layout, or any of the later stages. More... | |
virtual void | render () |
Perform any internal rendering necessary to prepare the drawable. More... | |
Protected Member Functions | |
virtual sdl_handler_vector | handler_members () |
virtual void | update_location (const SDL_Rect &rect) |
virtual void | handle_event (const SDL_Event &event) |
virtual void | process_event () |
virtual void | scroll (unsigned int pos)=0 |
virtual void | set_inner_location (const SDL_Rect &rect)=0 |
rect | inner_location () const |
unsigned | scrollbar_width () const |
unsigned | get_position () const |
unsigned | get_max_position () const |
void | set_position (unsigned pos) |
void | adjust_position (unsigned pos) |
void | move_position (int dep) |
void | set_shown_size (unsigned h) |
void | set_full_size (unsigned h) |
void | set_scroll_rate (unsigned r) |
bool | has_scrollbar () const |
Protected Member Functions inherited from gui::widget | |
widget (const bool auto_join=true) | |
virtual | ~widget () |
virtual void | draw_contents () |
bool | mouse_locked () const |
void | aquire_mouse_lock () |
void | free_mouse_lock () |
Protected Member Functions inherited from events::sdl_handler | |
sdl_handler (const bool auto_join=true) | |
sdl_handler (const sdl_handler &) | |
sdl_handler & | operator= (const sdl_handler &) |
virtual | ~sdl_handler () |
Protected Member Functions inherited from gui2::top_level_drawable | |
top_level_drawable () | |
virtual | ~top_level_drawable () |
top_level_drawable (const top_level_drawable &) | |
top_level_drawable & | operator= (const top_level_drawable &) |
top_level_drawable (top_level_drawable &&) | |
top_level_drawable & | operator= (top_level_drawable &&) |
Private Member Functions | |
void | test_scrollbar () |
Private Attributes | |
scrollbar | scrollbar_ |
int | old_position_ |
bool | recursive_ |
bool | shown_scrollbar_ |
unsigned | shown_size_ |
unsigned | full_size_ |
int | swipe_dy_ |
struct { | |
int x | |
int y | |
} | swipe_origin_ |
Additional Inherited Members | |
Protected Attributes inherited from gui::widget | |
bool | focus_ |
Definition at line 22 of file scrollarea.hpp.
gui::scrollarea::scrollarea | ( | bool | auto_join = true | ) |
Create a zone with automatic handling of scrollbar.
Definition at line 25 of file scrollarea.cpp.
References gui::widget::hide(), and scrollbar_.
|
protected |
Definition at line 96 of file scrollarea.cpp.
References gui::scrollbar::adjust_position(), and scrollbar_.
|
protected |
Definition at line 86 of file scrollarea.cpp.
References gui::scrollbar::get_max_position(), and scrollbar_.
Referenced by gui::textbox::append_text(), and gui::textbox::scroll_to_bottom().
|
protected |
Definition at line 81 of file scrollarea.cpp.
References gui::scrollbar::get_position(), and scrollbar_.
Referenced by gui::textbox::append_text().
|
protectedvirtual |
Reimplemented from gui::widget.
Reimplemented in gui::textbox.
Definition at line 147 of file scrollarea.cpp.
References utils::contains(), rect::contains(), video::game_canvas_size(), gui::scrollbar::get_max_position(), sdl::get_mouse_location(), gui::scrollbar::get_position(), gui::widget::handle_event(), gui::widget::height(), gui::widget::hidden(), inner_location(), gui::widget::mouse_locked(), gui::scrollbar::scroll_down(), gui::scrollbar::scroll_up(), scrollbar_, gui::scrollbar::set_position(), swipe_dy_, and swipe_origin_.
Referenced by gui::textbox::handle_event().
|
protectedvirtual |
Reimplemented from events::sdl_handler.
Definition at line 38 of file scrollarea.cpp.
References h, and scrollbar_.
|
protected |
Definition at line 33 of file scrollarea.cpp.
References full_size_, and shown_size_.
Referenced by test_scrollbar(), and update_location().
|
virtual |
Reimplemented from gui::widget.
Definition at line 74 of file scrollarea.cpp.
References gui::widget::hide(), scrollbar_, and shown_scrollbar_.
|
protected |
Definition at line 134 of file scrollarea.cpp.
References gui::widget::location(), scrollbar_, shown_scrollbar_, and gui::widget::width().
Referenced by gui::textbox::add_text_line(), gui::textbox::draw_contents(), handle_event(), and gui::textbox::handle_event().
|
protected |
Definition at line 101 of file scrollarea.cpp.
References gui::scrollbar::move_position(), and scrollbar_.
|
protectedvirtual |
Reimplemented from events::sdl_handler.
Definition at line 125 of file scrollarea.cpp.
References gui::scrollbar::get_position(), old_position_, scroll(), and scrollbar_.
|
protectedpure virtual |
Implemented in gui::textbox.
Referenced by process_event().
|
protected |
Definition at line 142 of file scrollarea.cpp.
References scrollbar_, and gui::widget::width().
|
protected |
Definition at line 113 of file scrollarea.cpp.
References full_size_, h, scrollbar_, gui::scrollbar::set_full_size(), and test_scrollbar().
Referenced by gui::textbox::update_text_cache().
|
protectedpure virtual |
Implemented in gui::textbox.
Referenced by update_location().
|
protected |
Definition at line 91 of file scrollarea.cpp.
References scrollbar_, and gui::scrollbar::set_position().
Referenced by gui::textbox::scroll_to_bottom().
|
protected |
Definition at line 120 of file scrollarea.cpp.
References scrollbar_, and gui::scrollbar::set_scroll_rate().
Referenced by gui::textbox::textbox().
|
protected |
Definition at line 106 of file scrollarea.cpp.
References h, scrollbar_, gui::scrollbar::set_shown_size(), shown_size_, and test_scrollbar().
Referenced by gui::textbox::update_text_cache().
|
private |
Definition at line 63 of file scrollarea.cpp.
References has_scrollbar(), gui::widget::location(), recursive_, shown_scrollbar_, and update_location().
Referenced by set_full_size(), and set_shown_size().
|
protectedvirtual |
Reimplemented from gui::widget.
Reimplemented in gui::textbox.
Definition at line 45 of file scrollarea.cpp.
References has_scrollbar(), gui::widget::hidden(), gui::widget::hide(), draw::rect(), scrollbar_, set_inner_location(), gui::widget::set_location(), shown_scrollbar_, w, and gui::widget::width().
Referenced by test_scrollbar(), and gui::textbox::update_location().
|
private |
Definition at line 61 of file scrollarea.hpp.
Referenced by has_scrollbar(), and set_full_size().
|
private |
Definition at line 58 of file scrollarea.hpp.
Referenced by process_event().
|
private |
Definition at line 59 of file scrollarea.hpp.
Referenced by test_scrollbar().
|
private |
Definition at line 57 of file scrollarea.hpp.
Referenced by adjust_position(), get_max_position(), get_position(), handle_event(), handler_members(), hide(), inner_location(), move_position(), process_event(), scrollarea(), scrollbar_width(), set_full_size(), set_position(), set_scroll_rate(), set_shown_size(), and update_location().
|
private |
Definition at line 59 of file scrollarea.hpp.
Referenced by hide(), inner_location(), test_scrollbar(), and update_location().
|
private |
Definition at line 60 of file scrollarea.hpp.
Referenced by has_scrollbar(), and set_shown_size().
|
private |
Definition at line 62 of file scrollarea.hpp.
Referenced by handle_event().
struct { ... } gui::scrollarea::swipe_origin_ |
Referenced by handle_event().
int gui::scrollarea::x |
Definition at line 64 of file scrollarea.hpp.
Referenced by gui::textbox::handle_event().
int gui::scrollarea::y |
Definition at line 65 of file scrollarea.hpp.
Referenced by gui::textbox::handle_event().