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.
up_down_button.h
Go to the documentation of this file.
1 #pragma once
5 #include "button_base.h"
6 #include "orientation.h"
7 
9 namespace xtd {
11  namespace forms {
22  public:
25 
29  virtual int32_t maximum() {return maximum_;}
34  virtual up_down_button& maximum(int32_t value);
35 
39  virtual int32_t minimum() {return minimum_;}
44  virtual up_down_button& minimum(int32_t value);
45 
48  virtual forms::orientation orientation() const {return orientation_;}
53 
57  virtual int32_t value() {return value_;}
62  virtual up_down_button& value(int32_t value);
63 
66  virtual bool wrapped() {return wrapped_;}
70  virtual up_down_button& wrapped(bool value);
71 
76  void set_range(int min_value, int max_value) {
77  minimum(min_value);
78  maximum(min_value > max_value ? min_value : max_value);
79  }
80 
84  xtd::ustring to_string() const noexcept override {return ustring::format("{}, minimum: {}, maximum: {}, value: {}", ustring::full_class_name(*this), minimum_, maximum_, value_);}
85 
89 
93 
94  protected:
95 
96  drawing::size default_size() const override {return {18, 34};}
97 
98  forms::create_params create_params() const override;
99 
102  void on_handle_created(const event_args& e) override;
103 
111  virtual void on_scroll(const event_args& e);
112 
115  virtual void on_value_changed(const event_args& e);
116 
120  void wnd_proc(message& message) override;
121 
123  bool wrapped_ = false;
124  int32_t maximum_ = 100;
125  int32_t minimum_ = 0;
127  int32_t value_ = 0;
129 
130  private:
131  void wm_scroll(message& message);
132  };
133  }
134 }
Contains xtd::forms::button_base class.
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
Implements the basic functionality common to button controls.
Definition: button_base.h:26
Implements a Windows message.
Definition: message.h:25
Represents a standard Windows up down button.
Definition: up_down_button.h:21
forms::create_params create_params() const override
Gets the required creation parameters when the control handle is created.
virtual up_down_button & orientation(forms::orientation orientation)
Sets a value indicating the horizontal or vertical orientation of the up down button.
void wnd_proc(message &message) override
Processes Windows messages.
virtual up_down_button & maximum(int32_t value)
Sets the maximum value for the up_down_button control.
virtual void on_scroll(const event_args &e)
Raises the up_down_button::scroll event.
up_down_button()
Initializes a new instance of up_down_button class.
void on_handle_created(const event_args &e) override
Overrides control::on_handle_created(const event_args&)
virtual int32_t maximum()
Gets the maximum value for the up_down_button control.
Definition: up_down_button.h:29
virtual int32_t minimum()
Gets the minimum allowed value for the up_down_button control.
Definition: up_down_button.h:39
virtual void on_value_changed(const event_args &e)
Raises the up_down_button::value_changed event.
virtual up_down_button & value(int32_t value)
Sets the value assigned to the up_down_button control.
void set_range(int min_value, int max_value)
Sets the minimum and maximum values for a track_bar.
Definition: up_down_button.h:76
virtual up_down_button & minimum(int32_t value)
Sets the minimum allowed value for the up_down_button control.
xtd::ustring to_string() const noexcept override
Returns a string that represents the track_bar control.
Definition: up_down_button.h:84
drawing::size default_size() const override
Gets the default size of the control.
Definition: up_down_button.h:96
virtual int32_t value()
Gets the value assigned to the up_down_button control.
Definition: up_down_button.h:57
virtual bool wrapped()
Get a value indicate if value can be wrapped.
Definition: up_down_button.h:66
virtual forms::orientation orientation() const
Gets a value indicating the horizontal or vertical orientation of the up down button.
Definition: up_down_button.h:48
virtual up_down_button & wrapped(bool value)
Set a value indicate if value can be wrapped.
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
event< up_down_button, event_handler > value_changed
Occurs when the value of the value property changes.
Definition: up_down_button.h:92
event< up_down_button, event_handler > scroll
Occurs when either a mouse or keyboard action moves the scroll box.
Definition: up_down_button.h:88
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
@ vertical
The control or element is oriented vertically.
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.