The Battle for Wesnoth  1.19.7+dev
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
gui::scrollarea Class Referenceabstract

#include <scrollarea.hpp>

Inheritance diagram for gui::scrollarea:

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 rectlocation () 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 &region) 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_handleroperator= (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_handleroperator= (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_drawableoperator= (const top_level_drawable &)
 
 top_level_drawable (top_level_drawable &&)
 
top_level_drawableoperator= (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_
 

Detailed Description

Definition at line 22 of file scrollarea.hpp.

Constructor & Destructor Documentation

◆ scrollarea()

gui::scrollarea::scrollarea ( bool  auto_join = true)

Create a zone with automatic handling of scrollbar.

Todo:
FIXME: parameterlist ??

Definition at line 25 of file scrollarea.cpp.

References gui::widget::hide(), and scrollbar_.

Member Function Documentation

◆ adjust_position()

void gui::scrollarea::adjust_position ( unsigned  pos)
protected

Definition at line 96 of file scrollarea.cpp.

References gui::scrollbar::adjust_position(), and scrollbar_.

◆ get_max_position()

unsigned gui::scrollarea::get_max_position ( ) const
protected

◆ get_position()

unsigned gui::scrollarea::get_position ( ) const
protected

Definition at line 81 of file scrollarea.cpp.

References gui::scrollbar::get_position(), and scrollbar_.

Referenced by gui::textbox::append_text().

◆ handle_event()

void gui::scrollarea::handle_event ( const SDL_Event &  event)
protectedvirtual

◆ handler_members()

sdl_handler_vector gui::scrollarea::handler_members ( )
protectedvirtual

Reimplemented from events::sdl_handler.

Definition at line 38 of file scrollarea.cpp.

References h, and scrollbar_.

◆ has_scrollbar()

bool gui::scrollarea::has_scrollbar ( ) const
protected

Definition at line 33 of file scrollarea.cpp.

References full_size_, and shown_size_.

Referenced by test_scrollbar(), and update_location().

◆ hide()

void gui::scrollarea::hide ( bool  value = true)
virtual

Reimplemented from gui::widget.

Definition at line 74 of file scrollarea.cpp.

References gui::widget::hide(), scrollbar_, and shown_scrollbar_.

◆ inner_location()

rect gui::scrollarea::inner_location ( ) const
protected

◆ move_position()

void gui::scrollarea::move_position ( int  dep)
protected

Definition at line 101 of file scrollarea.cpp.

References gui::scrollbar::move_position(), and scrollbar_.

◆ process_event()

void gui::scrollarea::process_event ( )
protectedvirtual

Reimplemented from events::sdl_handler.

Definition at line 125 of file scrollarea.cpp.

References gui::scrollbar::get_position(), old_position_, scroll(), and scrollbar_.

◆ scroll()

virtual void gui::scrollarea::scroll ( unsigned int  pos)
protectedpure virtual

Implemented in gui::textbox.

Referenced by process_event().

◆ scrollbar_width()

unsigned gui::scrollarea::scrollbar_width ( ) const
protected

Definition at line 142 of file scrollarea.cpp.

References scrollbar_, and gui::widget::width().

◆ set_full_size()

void gui::scrollarea::set_full_size ( unsigned  h)
protected

◆ set_inner_location()

virtual void gui::scrollarea::set_inner_location ( const SDL_Rect &  rect)
protectedpure virtual

Implemented in gui::textbox.

Referenced by update_location().

◆ set_position()

void gui::scrollarea::set_position ( unsigned  pos)
protected

Definition at line 91 of file scrollarea.cpp.

References scrollbar_, and gui::scrollbar::set_position().

Referenced by gui::textbox::scroll_to_bottom().

◆ set_scroll_rate()

void gui::scrollarea::set_scroll_rate ( unsigned  r)
protected

Definition at line 120 of file scrollarea.cpp.

References scrollbar_, and gui::scrollbar::set_scroll_rate().

Referenced by gui::textbox::textbox().

◆ set_shown_size()

void gui::scrollarea::set_shown_size ( unsigned  h)
protected

◆ test_scrollbar()

void gui::scrollarea::test_scrollbar ( )
private

◆ update_location()

void gui::scrollarea::update_location ( const SDL_Rect &  rect)
protectedvirtual

Member Data Documentation

◆ full_size_

unsigned gui::scrollarea::full_size_
private

Definition at line 61 of file scrollarea.hpp.

Referenced by has_scrollbar(), and set_full_size().

◆ old_position_

int gui::scrollarea::old_position_
private

Definition at line 58 of file scrollarea.hpp.

Referenced by process_event().

◆ recursive_

bool gui::scrollarea::recursive_
private

Definition at line 59 of file scrollarea.hpp.

Referenced by test_scrollbar().

◆ scrollbar_

scrollbar gui::scrollarea::scrollbar_
private

◆ shown_scrollbar_

bool gui::scrollarea::shown_scrollbar_
private

Definition at line 59 of file scrollarea.hpp.

Referenced by hide(), inner_location(), test_scrollbar(), and update_location().

◆ shown_size_

unsigned gui::scrollarea::shown_size_
private

Definition at line 60 of file scrollarea.hpp.

Referenced by has_scrollbar(), and set_shown_size().

◆ swipe_dy_

int gui::scrollarea::swipe_dy_
private

Definition at line 62 of file scrollarea.hpp.

Referenced by handle_event().

◆ 

struct { ... } gui::scrollarea::swipe_origin_

Referenced by handle_event().

◆ x

int gui::scrollarea::x

Definition at line 64 of file scrollarea.hpp.

Referenced by gui::textbox::handle_event().

◆ y

int gui::scrollarea::y

Definition at line 65 of file scrollarea.hpp.

Referenced by gui::textbox::handle_event().


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