The Battle for Wesnoth 1.21.0-dev
 
Loading...
Searching...
No Matches
scrollarea.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2004 - 2025
3 by Guillaume Melquiond <guillaume.melquiond@gmail.com>
4 Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY.
12
13 See the COPYING file for more details.
14*/
15
16#pragma once
17
18#include "scrollbar.hpp"
19
20namespace gui {
21
22class scrollarea : public widget
23{
24public:
25 /**
26 * Create a zone with automatic handling of scrollbar.
27 * @todo FIXME: parameterlist ??
28 */
29 //- \param d the display object
30 //- \param pane the widget where wheel events take place
31 scrollarea(bool auto_join=true);
32
33 virtual void hide(bool value = true);
34
35protected:
37 virtual void update_location(const rect& rect);
38 virtual void handle_event(const SDL_Event& event);
39 virtual void process_event();
40 virtual void scroll(unsigned int pos) = 0;
41 virtual void set_inner_location(const rect& rect) = 0;
42
43 rect inner_location() const;
44 unsigned scrollbar_width() const;
45
46 unsigned get_position() const;
47 unsigned get_max_position() const;
48 void set_position(unsigned pos);
49 void adjust_position(unsigned pos);
50 void move_position(int dep);
51 void set_shown_size(unsigned h);
52 void set_full_size(unsigned h);
53 void set_scroll_rate(unsigned r);
54 bool has_scrollbar() const;
55
56private:
60 unsigned shown_size_;
61 unsigned full_size_;
63 struct {
64 int x;
65 int y;
67
68 void test_scrollbar();
69};
70
71} // end namespace gui
virtual void update_location(const rect &rect)
unsigned get_max_position() const
void test_scrollbar()
bool has_scrollbar() const
void set_shown_size(unsigned h)
virtual void hide(bool value=true)
void adjust_position(unsigned pos)
unsigned get_position() const
struct gui::scrollarea::@8 swipe_origin_
void set_full_size(unsigned h)
void set_position(unsigned pos)
virtual void scroll(unsigned int pos)=0
virtual void set_inner_location(const rect &rect)=0
scrollbar scrollbar_
virtual void process_event()
virtual sdl_handler_vector handler_members()
unsigned full_size_
rect inner_location() const
void move_position(int dep)
virtual void handle_event(const SDL_Event &event)
unsigned scrollbar_width() const
unsigned shown_size_
void set_scroll_rate(unsigned r)
Scrollbar.
Definition scrollbar.hpp:26
std::vector< events::sdl_handler * > sdl_handler_vector
Definition events.hpp:219
General purpose widgets.
std::unique_ptr< MIX_Audio, decltype(&MIX_DestroyAudio)> value
Definition sound.cpp:139
An abstract description of a rectangle with integer coordinates.
Definition rect.hpp:49
#define h