slider.h
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2013 The ClanLib Team
4 **
5 ** This software is provided 'as-is', without any express or implied
6 ** warranty. In no event will the authors be held liable for any damages
7 ** arising from the use of this software.
8 **
9 ** Permission is granted to anyone to use this software for any purpose,
10 ** including commercial applications, and to alter it and redistribute it
11 ** freely, subject to the following restrictions:
12 **
13 ** 1. The origin of this software must not be misrepresented; you must not
14 ** claim that you wrote the original software. If you use this software
15 ** in a product, an acknowledgment in the product documentation would be
16 ** appreciated but is not required.
17 ** 2. Altered source versions must be plainly marked as such, and must not be
18 ** misrepresented as being the original software.
19 ** 3. This notice may not be removed or altered from any source distribution.
20 **
21 ** Note: Some of the libraries ClanLib may link to may have additional
22 ** requirements or restrictions.
23 **
24 ** File Author(s):
25 **
26 ** Magnus Norddahl
27 ** Harry Storbacka
28 */
29 
30 
31 #pragma once
32 
33 #include "../api_gui.h"
34 #include "../gui_component.h"
35 
36 namespace clan
37 {
40 
41 class Slider_Impl;
42 
44 class CL_API_GUI Slider : public GUIComponent
45 {
48 
49 public:
50 
54  Slider(GUIComponent *parent);
55 
56  virtual ~Slider();
57 
61 
62 public:
64 
68  static Slider *get_named_item(GUIComponent *reference_component, const std::string &id);
69 
73  bool is_vertical() const;
74 
78  bool is_horizontal() const;
79 
83  int get_min() const;
84 
88  int get_max() const;
89 
93  int get_tick_count() const;
94 
98  int get_page_step() const;
99 
103  int get_position() const;
104 
108  bool get_lock_to_ticks() const;
109 
113  float get_preferred_content_width();
114 
118  float get_preferred_content_height(float width);
119 
123 
124 public:
125 
129  void set_vertical(bool enable);
130 
134  void set_horizontal(bool enable);
135 
139  void set_min(int slider_min);
140 
144  void set_max(int slider_max);
145 
149  void set_tick_count(int tick_count);
150 
154  void set_page_step(int steps);
155 
159  void set_lock_to_ticks(bool lock);
160 
167  void set_ranges(int slider_min, int slider_max, unsigned int tick_count, int page_step);
168 
172  void set_position(int pos);
173 
177 
178 public:
180  Callback_v0 &func_value_changed();
181 
183 
184  Callback_v0 &func_value_decremented();
185 
187 
188  Callback_v0 &func_value_incremented();
189 
191  Callback_v0 &func_slider_moved();
192 
196 
197 private:
198  std::shared_ptr<Slider_Impl> impl;
200 };
201 
202 }
203 
Track bar component.
Definition: slider.h:44
GUI base component class.
Definition: gui_component.h:81
GUIComponent * get_named_item(const std::string &id)
Find child component with the specified component ID name.
Callback_v0.
Definition: callback_v0.h:152