xtd - Reference Guide  0.1.1
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
progress_bar.h
Go to the documentation of this file.
1 #pragma once
5 #include "control.h"
6 #include "orientation.h"
7 #include "progress_bar_style.h"
8 
10 namespace xtd {
12  namespace forms {
32  public:
36 
39  drawing::size default_size() const override {return {100, 23};}
40 
45  virtual size_t marquee_animation_speed() {return marquee_animation_speed_;}
50  virtual progress_bar& marquee_animation_speed(size_t marquee_animation_speed);
51 
56  virtual int32_t maximum() {return maximum_;}
61  virtual progress_bar& maximum(int32_t maximum);
62 
66  virtual int32_t minimum() {return minimum_;}
70  virtual progress_bar& minimum(int32_t minimum);
71 
75  virtual forms::orientation orientation() const {return orientation_;}
80 
84  virtual int32_t step() {return step_;}
88  virtual progress_bar& step(int32_t step);
89 
93  virtual progress_bar_style style() const {return style_;}
98 
104  virtual int32_t value() {return value_;}
110  virtual progress_bar& value(int32_t value);
111 
116  void increment(int32_t value) {
117  if (value_ + value < minimum_)
118  this->value(minimum_);
119  if (value_ + value > maximum_)
120  this->value(maximum_);
121  else
122  this->value(value_ + value);
123  }
124 
127  void perform_step() {increment(step());}
128 
133  void set_range(int min_value, int max_value) {
134  minimum(min_value);
135  maximum(min_value > max_value ? min_value : max_value);
136  }
137 
141  xtd::ustring to_string() const noexcept override {return ustring::format("{}, minimum: {}, maximum: {}, value: {}", ustring::full_class_name(*this), minimum_, maximum_, value_);}
142 
143  protected:
146  forms::create_params create_params() const override;
147 
150  void on_handle_created(const event_args& e) override;
151 
153  size_t marquee_animation_speed_ = 100;
154  int32_t maximum_ = 100;
155  int32_t minimum_ = 0;
157  int32_t step_ = 10;
159  int32_t value_ = 0;
161  };
162  }
163 }
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
Defines the base class for controls, which are components with visual representation.
Definition: control.h:67
Represents a Windows progress bar control.
Definition: progress_bar.h:31
virtual progress_bar & step(int32_t step)
Sets the amount by which a call to the PerformStep() method increases the current position of the pro...
drawing::size default_size() const override
Gets the default size of the control.
Definition: progress_bar.h:39
virtual progress_bar & marquee_animation_speed(size_t marquee_animation_speed)
Sets the time period, in milliseconds, that it takes the progress block to scroll across the progress...
void set_range(int min_value, int max_value)
Sets the minimum and maximum values for a xtd::forms::progress_bar.
Definition: progress_bar.h:133
virtual int32_t minimum()
Gets the minimum value of the range of the control.
Definition: progress_bar.h:66
virtual progress_bar & orientation(forms::orientation orientation)
Sets a value indicating the horizontal or vertical orientation of the progress bar.
virtual progress_bar & maximum(int32_t maximum)
Sets the maximum value of the range of the control.
progress_bar()
Initializes a new instance of the progress_bar class.
void increment(int32_t value)
Advances the current position of the progress bar by the specified amount.
Definition: progress_bar.h:116
virtual int32_t maximum()
Gets the maximum value of the range of the control.
Definition: progress_bar.h:56
virtual progress_bar & style(progress_bar_style style)
Sets the manner in which progress should be indicated on the progress bar.
virtual int32_t step()
Gets the amount by which a call to the PerformStep() method increases the current position of the pro...
Definition: progress_bar.h:84
virtual progress_bar_style style() const
Gets the manner in which progress should be indicated on the progress bar.
Definition: progress_bar.h:93
virtual size_t marquee_animation_speed()
Gets he time period, in milliseconds, that it takes the progress block to scroll across the progress ...
Definition: progress_bar.h:45
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 progress bar.
Definition: progress_bar.h:75
virtual int32_t value()
Gets the current position of the progress bar.
Definition: progress_bar.h:104
xtd::ustring to_string() const noexcept override
Returns a string that represents the progress_bar control.
Definition: progress_bar.h:141
virtual progress_bar & minimum(int32_t minimum)
Sets the minimum value of the range of the control.
forms::create_params create_params() const override
Gets the required creation parameters when the control handle is created.
virtual progress_bar & value(int32_t value)
Sets the current position of the progress bar.
void perform_step()
Advances the current position of the progress bar by the amount of the Step property.
Definition: progress_bar.h:127
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:48
static ustring full_class_name()
Gets the fully qualified class name of the objec_t, including the namespace of the objec_t.
Definition: ustring.h:427
Contains xtd::forms::control control.
static ustring format(const ustring &fmt, args_t &&... args)
Writes the text representation of the specified arguments list, to string using the specified format ...
Definition: ustring.h:689
#define forms_export_
Define shared library export.
Definition: forms_export.h:13
orientation
Specifies the orientation of controls or elements of controls.
Definition: orientation.h:18
progress_bar_style
Specifies the progress_bar_style of controls or elements of controls.
Definition: progress_bar_style.h:18
@ horizontal
The control or element is oriented horizontally.
@ blocks
Indicates progress by increasing the number of segmented blocks in a progress_bar.
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::progress_bar_style enum class.