The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
scrollarea.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2004 - 2016 by Guillaume Melquiond <[email protected]>
3  Part of the Battle for Wesnoth Project http://www.wesnoth.org/
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
15 /** @file */
16 
17 #ifndef SCROLLAREA_HPP_INCLUDED
18 #define SCROLLAREA_HPP_INCLUDED
19 
20 #include "scrollbar.hpp"
21 
22 namespace gui {
23 
24 class scrollarea : public widget
25 {
26 public:
27  /**
28  * Create a zone with automatic handling of scrollbar.
29  * @todo FIXME: parameterlist ??
30  */
31  //- \param d the display object
32  //- \param pane the widget where wheel events take place
33  scrollarea(CVideo &video, bool auto_join=true);
34 
35  virtual void hide(bool value = true);
36 
37 protected:
39  virtual void update_location(SDL_Rect const &rect);
40  virtual void handle_event(const SDL_Event& event);
41  virtual void process_event();
42  virtual void scroll(unsigned int pos) = 0;
43  virtual void set_inner_location(SDL_Rect const &rect) = 0;
44 
45  SDL_Rect inner_location() const;
46  unsigned scrollbar_width() const;
47 
48  unsigned get_position() const;
49  unsigned get_max_position() const;
50  void set_position(unsigned pos);
51  void adjust_position(unsigned pos);
52  void move_position(int dep);
53  void set_shown_size(unsigned h);
54  void set_full_size(unsigned h);
55  void set_scroll_rate(unsigned r);
56  bool has_scrollbar() const;
57 
58 private:
62  unsigned shown_size_;
63  unsigned full_size_;
64 
65  void test_scrollbar();
66 };
67 
68 } // end namespace gui
69 
70 #endif
Scrollbar.
Definition: scrollbar.hpp:28
void set_shown_size(unsigned h)
Definition: scrollarea.cpp:110
void adjust_position(unsigned pos)
Definition: scrollarea.cpp:100
std::vector< events::sdl_handler * > sdl_handler_vector
Definition: events.hpp:163
int pos
Definition: formula.cpp:800
virtual sdl_handler_vector handler_members()
Definition: scrollarea.cpp:40
Definition: video.hpp:58
CVideo & video() const
Definition: widget.hpp:83
General purpose widgets.
bool has_scrollbar() const
Definition: scrollarea.cpp:35
unsigned scrollbar_width() const
Definition: scrollarea.cpp:146
void set_scroll_rate(unsigned r)
Definition: scrollarea.cpp:124
void test_scrollbar()
Definition: scrollarea.cpp:65
void move_position(int dep)
Definition: scrollarea.cpp:105
virtual void scroll(unsigned int pos)=0
void set_full_size(unsigned h)
Definition: scrollarea.cpp:117
void set_position(unsigned pos)
Definition: scrollarea.cpp:95
SDL_Rect inner_location() const
Definition: scrollarea.cpp:138
GLsizei const GLfloat * value
Definition: glew.h:1817
virtual void set_inner_location(SDL_Rect const &rect)=0
unsigned get_position() const
Definition: scrollarea.cpp:85
unsigned full_size_
Definition: scrollarea.hpp:63
scrollbar scrollbar_
Definition: scrollarea.hpp:59
virtual void handle_event(const SDL_Event &event)
Definition: scrollarea.cpp:151
GLfloat GLfloat GLfloat GLfloat h
Definition: glew.h:5910
unsigned get_max_position() const
Definition: scrollarea.cpp:90
GLdouble GLdouble GLdouble r
Definition: glew.h:1374
virtual void hide(bool value=true)
Definition: scrollarea.cpp:78
unsigned shown_size_
Definition: scrollarea.hpp:62
cl_event event
Definition: glew.h:3070
scrollarea(CVideo &video, bool auto_join=true)
Create a zone with automatic handling of scrollbar.
Definition: scrollarea.cpp:27
virtual void process_event()
Definition: scrollarea.cpp:129
virtual void update_location(SDL_Rect const &rect)
Definition: scrollarea.cpp:47