The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
vertical_scrollbar.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 - 2016 by Mark de Wever <[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 #ifndef GUI_WIDGETS_VERTICAL_SCROLLBAR_HPP_INCLUDED
16 #define GUI_WIDGETS_VERTICAL_SCROLLBAR_HPP_INCLUDED
17 
19 
20 namespace gui2
21 {
22 
23 // ------------ WIDGET -----------{
24 
25 /** A vertical scrollbar. */
27 {
28 public:
30  {
31  }
32 
33 private:
34  /** Inherited from tscrollbar. */
35  unsigned get_length() const
36  {
37  return get_height();
38  }
39 
40  /** Inherited from tscrollbar. */
41  unsigned minimum_positioner_length() const;
42 
43  /** Inherited from tscrollbar. */
44  unsigned maximum_positioner_length() const;
45 
46  /** Inherited from tscrollbar. */
47  unsigned offset_before() const;
48 
49  /** Inherited from tscrollbar. */
50  unsigned offset_after() const;
51 
52  /** Inherited from tscrollbar. */
53  bool on_positioner(const tpoint& coordinate) const;
54 
55  /** Inherited from tscrollbar. */
56  int on_bar(const tpoint& coordinate) const;
57 
58  /** Inherited from tscrollbar. */
59  bool in_orthogonal_range(const tpoint& coordinate) const;
60 
61  /** Inherited from tscrollbar. */
62  int get_length_difference(const tpoint& original, const tpoint& current)
63  const
64  {
65  return current.y - original.y;
66  }
67 
68  /** See @ref tcontrol::get_control_type. */
69  virtual const std::string& get_control_type() const override;
70 };
71 
72 // }---------- DEFINITION ---------{
73 
75 {
76  explicit tvertical_scrollbar_definition(const config& cfg);
77 
79  {
80  explicit tresolution(const config& cfg);
81 
84 
85  unsigned top_offset;
86  unsigned bottom_offset;
87  };
88 };
89 
90 // }---------- BUILDER -----------{
91 
92 namespace implementation
93 {
94 
96 {
97  explicit tbuilder_vertical_scrollbar(const config& cfg);
98 
100 
101  twidget* build() const;
102 };
103 
104 } // namespace implementation
105 
106 // }------------ END --------------
107 
108 } // namespace gui2
109 
110 #endif
int on_bar(const tpoint &coordinate) const
Inherited from tscrollbar.
Base class for a scroll bar.
Definition: scrollbar.hpp:41
Base class of a resolution, contains the common keys for a resolution.
A class inherited from ttext_box that displays its input as stars.
Definition: field-fwd.hpp:23
virtual twidget * build() const =0
virtual const std::string & get_control_type() const override
See tcontrol::get_control_type.
bool in_orthogonal_range(const tpoint &coordinate) const
Inherited from tscrollbar.
int y
y coordinate.
Definition: point.hpp:34
unsigned offset_before() const
Inherited from tscrollbar.
unsigned maximum_positioner_length() const
Inherited from tscrollbar.
unsigned minimum_positioner_length() const
Inherited from tscrollbar.
unsigned get_height() const
Definition: widget.cpp:299
Holds a 2D point.
Definition: point.hpp:24
unsigned get_length() const
Inherited from tscrollbar.
unsigned offset_after() const
Inherited from tscrollbar.
int get_length_difference(const tpoint &original, const tpoint &current) const
Inherited from tscrollbar.
Base class for all widgets.
Definition: widget.hpp:49
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:83
bool on_positioner(const tpoint &coordinate) const
Inherited from tscrollbar.
GLsizei const GLcharARB ** string
Definition: glew.h:4503
Contains the implementation details for lexical_cast and shouldn't be used directly.
A vertical scrollbar.