xtd.forms - Reference Guide  0.1.0
Modern c++17 library containing classes for creating Windows-based applications that take full advantage of the rich user interface features available in the Microsoft Windows, Apple macOS and Linux like Ubuntu operating system.
numeric_up_down.h
1 #pragma once
2 #include "up_down_base.h"
3 
5 namespace xtd {
7  namespace forms {
8  class numeric_up_down : public up_down_base {
9  public:
11 
12  virtual double decimal_place() {return decimal_place_;}
13  virtual numeric_up_down& decimal_place(int32_t value);
14 
15  virtual double increment() {return increment_;}
16  virtual numeric_up_down& increment(double value);
17 
18  virtual double maximum() {return maximum_;}
19  virtual numeric_up_down& maximum(double value);
20 
21  virtual double minimum() {return minimum_;}
22  virtual numeric_up_down& minimum(double value);
23 
24  virtual double value() {return value_;}
25  virtual numeric_up_down& value(double value);
26 
27  virtual bool wrapped() {return wrapped_;}
28  virtual numeric_up_down& wrapped(bool value);
29 
34  void set_range(int min_value, int max_value) {
35  this->minimum(min_value);
36  this->maximum(min_value > max_value ? min_value : max_value);
37  }
38 
42  std::string to_string() const override {return strings::format("{}, minimum: {}, maximum: {}, value: {}", strings::full_class_name(*this), this->minimum_, this->maximum_, this->value_);}
43 
44  event<numeric_up_down, event_handler<control&>> value_changed;
45 
46  protected:
47  drawing::color default_back_color() const override {return xtd::forms::theme_colors::current_theme().window();}
48 
49  drawing::color default_fore_color() const override {return xtd::forms::theme_colors::current_theme().window_text();}
50 
51  drawing::size default_size() const override {return {120, 21};}
52 
53  forms::create_params create_params() const override;
54 
57  void on_handle_created(const event_args& e) override;
58 
59  virtual void on_value_changed(const event_args& e);
60 
62  void wnd_proc(message& message) override;
63  void wm_command(message& message);
65 
66  int32_t decimal_place_ = 0;
67  double increment_ = 1.0;
68  double maximum_ = 100.0;
69  double minimum_ = 0.0;
70  double value_ = 0.0;
71  bool wrapped_ = false;
72  };
73  }
74 }
void set_range(int min_value, int max_value)
Sets the minimum and maximum values for a track_bar.
Definition: numeric_up_down.h:34
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: numeric_up_down.h:8
forms::create_params create_params() const override
Gets the required creation parameters when the control handle is created.
Definition: up_down_base.h:9
static std::basic_string< char_t > format(const std::basic_string< char_t > &fmt, args_t &&... args)
drawing::color default_back_color() const override
Gets the default background color of the control.
Definition: numeric_up_down.h:47
std::string to_string() const override
Returns a string that represents the track_bar control.
Definition: numeric_up_down.h:42
virtual void wnd_proc(message &m)
Processes Windows messages.
Definition: message.h:10
void on_handle_created(const event_args &e) override
Overrides control::on_handle_created(const event_args&)
static std::string full_class_name()