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