xtd - Reference Guide  0.2.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
numeric_up_down.h
Go to the documentation of this file.
1 #pragma once
5 #include "up_down_base.h"
6 
8 namespace xtd {
10  namespace forms {
24  class forms_export_ numeric_up_down : public up_down_base {
25  public:
27 
32 
34 
39  virtual double decimal_place() {return decimal_place_;}
44  virtual numeric_up_down& decimal_place(int32_t value);
45 
49  virtual double increment() {return increment_;}
54  virtual numeric_up_down& increment(double value);
55 
59  virtual double maximum() {return maximum_;}
64  virtual numeric_up_down& maximum(double value);
65 
69  virtual double minimum() {return minimum_;}
74  virtual numeric_up_down& minimum(double value);
75 
79  virtual double value() {return value_;}
84  virtual numeric_up_down& value(double value);
85 
88  virtual bool wrapped() {return wrapped_;}
92  virtual numeric_up_down& wrapped(bool value);
94 
96 
102  void set_range(int min_value, int max_value) {
103  minimum(min_value);
104  maximum(min_value > max_value ? min_value : max_value);
105  }
106 
110  xtd::ustring to_string() const noexcept override {return ustring::format("{}, minimum: {}, maximum: {}, value: {}", ustring::full_class_name(*this), minimum_, maximum_, value_);}
112 
114 
120 
121  protected:
123 
125  drawing::color default_back_color() const override {return xtd::forms::theme_colors::current_theme().window();}
126  drawing::color default_fore_color() const override {return xtd::forms::theme_colors::current_theme().window_text();}
127  drawing::size default_size() const override {return {120, 21};}
128  forms::create_params create_params() const override;
129 
132  void on_handle_created(const event_args& e) override;
133 
136  virtual void on_value_changed(const event_args& e);
137 
138  void wnd_proc(message& message) override;
140 
142  void wm_command(message& message);
144 
145  private:
146  int32_t decimal_place_ = 0;
147  double increment_ = 1.0;
148  double maximum_ = 100.0;
149  double minimum_ = 0.0;
150  double value_ = 0.0;
151  bool wrapped_ = false;
152  };
153  }
154 }
void set_range(int min_value, int max_value)
Sets the minimum and maximum values for a track_bar.
Definition: numeric_up_down.h:102
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition: event_args.h:18
Stores an ordered pair of integers, which specify a height and width.
Definition: size.h:25
xtd::ustring to_string() const noexcept override
Returns a string that represents the track_bar control.
Definition: numeric_up_down.h:110
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
Represents a standard Windows numeric up down.
Definition: numeric_up_down.h:24
Implements the basic functionality required by a spin box (also known as an up-down control)...
Definition: up_down_base.h:18
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:48
event< numeric_up_down, event_handler > value_changed
Occurs when the value property has been changed in some way.
Definition: numeric_up_down.h:118
drawing::color default_back_color() const override
Gets the default background color of the control.
Definition: numeric_up_down.h:125
Represents an ARGB (alpha, red, green, blue) color.
Definition: color.h:39
Represents an event.
Definition: event.h:21
virtual double increment()
Gets the value to increment or decrement the spin box (also known as an up-down control) when the up ...
Definition: numeric_up_down.h:49
virtual double maximum()
Gets the maximum value for the spin box (also known as an up-down control).
Definition: numeric_up_down.h:59
virtual double value()
Gets the value assigned to the spin box (also known as an up-down control).
Definition: numeric_up_down.h:79
virtual double decimal_place()
Gets the number of decimal places to display in the spin box (also known as an up-down control)...
Definition: numeric_up_down.h:39
Implements a Windows message.
Definition: message.h:25
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:442
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:700
drawing::size default_size() const override
Gets the default size of the control.
Definition: numeric_up_down.h:127
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
drawing::color default_fore_color() const override
Gets the default foreground color of the control.
Definition: numeric_up_down.h:126
Contains xtd::forms::up_down_base control.
virtual double minimum()
Gets the minimum allowed value for the spin box (also known as an up-down control).
Definition: numeric_up_down.h:69
virtual bool wrapped()
Get a value indicate if value can be wrapped.
Definition: numeric_up_down.h:88