xtd - Reference Guide  0.1.2
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Loading...
Searching...
No Matches
track_bar.h
Go to the documentation of this file.
1
4#pragma once
5#include "control.h"
6#include "orientation.h"
7#include "tick_style.h"
8
10namespace xtd {
12 namespace forms {
26 public:
30
33 drawing::size default_size() const override {return {104, 45};}
34
38 virtual int32_t large_change() {return large_change_;}
43 virtual track_bar& large_change(int32_t large_change);
44
47 virtual int32_t maximum() {return maximum_;}
52 virtual track_bar& maximum(int32_t maximum);
53
56 virtual int32_t minimum() {return minimum_;}
61 virtual track_bar& minimum(int32_t minimum);
62
65 virtual forms::orientation orientation() const {return orientation_;}
71
76 virtual int32_t small_change() {return small_change_;}
82 virtual track_bar& small_change(int32_t small_change);
83
87 virtual int32_t tick_frequency() {return tick_frequency_;}
92 virtual track_bar& tick_frequency(int32_t tick_frequency);
93
97 virtual forms::tick_style tick_style() {return tick_style_;}
103
107 virtual int32_t value() {return value_;}
112 virtual track_bar& value(int32_t value);
113
118 void set_range(int min_value, int max_value) {
119 minimum(min_value);
120 maximum(min_value > max_value ? min_value : max_value);
121 }
122
126 xtd::ustring to_string() const noexcept override {return ustring::format("{}, minimum: {}, maximum: {}, value: {}", ustring::full_class_name(*this), minimum_, maximum_, value_);}
127
131
135
136 protected:
139 forms::create_params create_params() const override;
140
142
145 void on_handle_created(const event_args& e) override;
146
154 virtual void on_scroll(const event_args& e);
155
158 virtual void on_value_changed(const event_args& e);
159
166 void set_bounds_core(int32_t x, int32_t y, int32_t width, int32_t height, bounds_specified specified) override {
167 control::set_bounds_core(x, y, width, height, specified);
168 if ((specified & bounds_specified::width) == bounds_specified::width || (specified & bounds_specified::height) == bounds_specified::height)
169 recreate_handle();
170 }
171
175 void set_client_size_core(int32_t width, int32_t height) override {
176 control::set_client_size_core(width, height);
177 recreate_handle();
178 }
179
183 void wnd_proc(message& message) override;
184
186 int32_t large_change_ = 5;
187 int32_t maximum_ = 10;
188 int32_t minimum_ = 0;
189 forms::orientation orientation_ = forms::orientation::horizontal;
190 int32_t small_change_ = 1;
191 int32_t tick_frequency_ = 1;
192 forms::tick_style tick_style_ = forms::tick_style::bottom_right;
193 int32_t value_ = 0;
195
196 private:
197 void wm_scroll(message& message);
198 };
199 }
200}
Stores an ordered pair of integers, which specify a height and width.
Definition size.h:25
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition event_args.h:18
Represents an event.
Definition event.h:21
Defines the base class for controls, which are components with visual representation.
Definition control.h:67
Implements a Windows message.
Definition message.h:25
Represents a standard Windows track bar.
Definition track_bar.h:25
void set_range(int min_value, int max_value)
Sets the minimum and maximum values for a xtd::forms::track_bar.
Definition track_bar.h:118
virtual int32_t maximum()
Gets the upper limit of the range this track_bar is working with.
Definition track_bar.h:47
drawing::size measure_control() const override
Measure this control.
virtual track_bar & maximum(int32_t maximum)
sets the upper limit of the range this track_bar is working with.
virtual void on_value_changed(const event_args &e)
Raises the track_bar::value_changed event.
xtd::ustring to_string() const noexcept override
Returns a string that represents the track_bar control.
Definition track_bar.h:126
virtual int32_t tick_frequency()
Gets a value that specifies the delta between ticks drawn on the control.
Definition track_bar.h:87
virtual track_bar & large_change(int32_t large_change)
Sets a value to be added to or subtracted from the value property when the scroll box is moved a larg...
void set_bounds_core(int32_t x, int32_t y, int32_t width, int32_t height, bounds_specified specified) override
Performs the work of setting the specified bounds of this control.
Definition track_bar.h:166
virtual int32_t large_change()
Gets a value to be added to or subtracted from the value property when the scroll box is moved a larg...
Definition track_bar.h:38
virtual track_bar & small_change(int32_t small_change)
Sets the value added to or subtracted from the Value property when the scroll box is moved a small di...
virtual track_bar & orientation(forms::orientation orientation)
Sets a value indicating the horizontal or vertical orientation of the track bar.
forms::create_params create_params() const override
Gets the required creation parameters when the control handle is created.
virtual int32_t value()
Gets a numeric value that represents the current position of the scroll box on the track bar.
Definition track_bar.h:107
drawing::size default_size() const override
Gets the default size of the control.
Definition track_bar.h:33
virtual track_bar & tick_frequency(int32_t tick_frequency)
Sets a value that specifies the delta between ticks drawn on the control.
virtual track_bar & tick_style(forms::tick_style tick_style)
Sets a value indicating how to display the tick marks on the track bar.
void on_handle_created(const event_args &e) override
Overrides control::on_handle_created(const event_args&)
virtual forms::orientation orientation() const
Gets a value indicating the horizontal or vertical orientation of the track bar.
Definition track_bar.h:65
virtual forms::tick_style tick_style()
Gets a value indicating how to display the tick marks on the track bar.
Definition track_bar.h:97
void set_client_size_core(int32_t width, int32_t height) override
Sets the size of the client area of the control.
Definition track_bar.h:175
void wnd_proc(message &message) override
Processes Windows messages.
virtual int32_t minimum()
Gets the lower limit of the range this track_bar is working with.
Definition track_bar.h:56
virtual void on_scroll(const event_args &e)
Raises the track_bar::scroll event.
virtual track_bar & minimum(int32_t minimum)
Sets the lower limit of the range this track_bar is working with.
track_bar()
Initializes a new instance of the track_bar class.
virtual int32_t small_change()
Gets he value added to or subtracted from the Value property when the scroll box is moved a small dis...
Definition track_bar.h:76
virtual track_bar & value(int32_t value)
Sets a numeric value that represents the current position of the scroll box on the track bar.
Represents text as a sequence of UTF-8 code units.
Definition ustring.h:48
Contains xtd::forms::control control.
event< track_bar, event_handler > value_changed
Occurs when the value property of a track bar changes, either by movement of the scroll box or by man...
Definition track_bar.h:134
event< track_bar, event_handler > scroll
Occurs when either a mouse or keyboard action moves the scroll box.
Definition track_bar.h:130
#define forms_export_
Define shared library export.
Definition forms_export.h:13
@ y
The Y key.
@ x
The X key.
bounds_specified
Specifies the bounds of the control to use when defining a control's size and position....
Definition bounds_specified.h:18
tick_style
Specifies the location of tick marks in a track_bar control.
Definition tick_style.h:18
orientation
Specifies the orientation of controls or elements of controls.
Definition orientation.h:18
@ height
Specifies that the height of the control is defined.
@ width
Specifies that the width of the control is defined.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition about_box.h:13
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition system_report.h:17
Contains xtd::forms::orientation enum class.
Contains xtd::forms::tick_style enum class.