The Battle for Wesnoth
1.19.5+dev
widgets
scrollarea.hpp
Go to the documentation of this file.
1
/*
2
Copyright (C) 2004 - 2024
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
20
namespace
gui
{
21
22
class
scrollarea
:
public
widget
23
{
24
public
:
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
35
protected
:
36
virtual
sdl_handler_vector
handler_members
();
37
virtual
void
update_location
(
const
SDL_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
SDL_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
56
private
:
57
scrollbar
scrollbar_
;
58
int
old_position_
;
59
bool
recursive_
,
shown_scrollbar_
;
60
unsigned
shown_size_
;
61
unsigned
full_size_
;
62
int
swipe_dy_
;
63
struct
{
64
int
x
;
65
int
y
;
66
}
swipe_origin_
;
67
68
void
test_scrollbar
();
69
};
70
71
}
// end namespace gui
gui::scrollarea
Definition:
scrollarea.hpp:23
gui::scrollarea::recursive_
bool recursive_
Definition:
scrollarea.hpp:59
gui::scrollarea::shown_scrollbar_
bool shown_scrollbar_
Definition:
scrollarea.hpp:59
gui::scrollarea::old_position_
int old_position_
Definition:
scrollarea.hpp:58
gui::scrollarea::get_max_position
unsigned get_max_position() const
Definition:
scrollarea.cpp:86
gui::scrollarea::test_scrollbar
void test_scrollbar()
Definition:
scrollarea.cpp:63
gui::scrollarea::x
int x
Definition:
scrollarea.hpp:64
gui::scrollarea::has_scrollbar
bool has_scrollbar() const
Definition:
scrollarea.cpp:33
gui::scrollarea::set_shown_size
void set_shown_size(unsigned h)
Definition:
scrollarea.cpp:106
gui::scrollarea::hide
virtual void hide(bool value=true)
Definition:
scrollarea.cpp:74
gui::scrollarea::adjust_position
void adjust_position(unsigned pos)
Definition:
scrollarea.cpp:96
gui::scrollarea::scrollarea
scrollarea(bool auto_join=true)
Create a zone with automatic handling of scrollbar.
Definition:
scrollarea.cpp:25
gui::scrollarea::get_position
unsigned get_position() const
Definition:
scrollarea.cpp:81
gui::scrollarea::swipe_origin_
struct gui::scrollarea::@8 swipe_origin_
gui::scrollarea::set_full_size
void set_full_size(unsigned h)
Definition:
scrollarea.cpp:113
gui::scrollarea::set_position
void set_position(unsigned pos)
Definition:
scrollarea.cpp:91
gui::scrollarea::update_location
virtual void update_location(const SDL_Rect &rect)
Definition:
scrollarea.cpp:45
gui::scrollarea::scroll
virtual void scroll(unsigned int pos)=0
gui::scrollarea::scrollbar_
scrollbar scrollbar_
Definition:
scrollarea.hpp:57
gui::scrollarea::process_event
virtual void process_event()
Definition:
scrollarea.cpp:125
gui::scrollarea::handler_members
virtual sdl_handler_vector handler_members()
Definition:
scrollarea.cpp:38
gui::scrollarea::y
int y
Definition:
scrollarea.hpp:65
gui::scrollarea::full_size_
unsigned full_size_
Definition:
scrollarea.hpp:61
gui::scrollarea::inner_location
rect inner_location() const
Definition:
scrollarea.cpp:134
gui::scrollarea::move_position
void move_position(int dep)
Definition:
scrollarea.cpp:101
gui::scrollarea::swipe_dy_
int swipe_dy_
Definition:
scrollarea.hpp:62
gui::scrollarea::set_inner_location
virtual void set_inner_location(const SDL_Rect &rect)=0
gui::scrollarea::handle_event
virtual void handle_event(const SDL_Event &event)
Definition:
scrollarea.cpp:147
gui::scrollarea::scrollbar_width
unsigned scrollbar_width() const
Definition:
scrollarea.cpp:142
gui::scrollarea::shown_size_
unsigned shown_size_
Definition:
scrollarea.hpp:60
gui::scrollarea::set_scroll_rate
void set_scroll_rate(unsigned r)
Definition:
scrollarea.cpp:120
gui::scrollbar
Scrollbar.
Definition:
scrollbar.hpp:26
gui::widget
Definition:
widget.hpp:28
sdl_handler_vector
std::vector< events::sdl_handler * > sdl_handler_vector
Definition:
events.hpp:182
gui
General purpose widgets.
Definition:
tristate_button.cpp:30
rect
An abstract description of a rectangle with integer coordinates.
Definition:
rect.hpp:47
scrollbar.hpp
h
#define h
Generated by
1.9.1