xtd 0.2.0
length.h
Go to the documentation of this file.
1 #pragma once
5 #include "../../forms_export.h"
6 #include "length_unit.h"
7 #include <xtd/drawing/rectangle>
8 #include <xtd/iequatable>
9 #include <xtd/ustring>
10 
12 namespace xtd {
14  namespace forms {
16  namespace style_sheets {
75  class forms_export_ length : public xtd::iequatable<length>, public xtd::object {
76  public:
78 
81  static const length empty;
83 
85 
88  length() = default;
89 
92  explicit length(double value);
93 
97  length(double value, length_unit unit);
99 
101  length(const length&) = default;
102  length& operator =(const length&) = default;
104 
106 
110  double value() const noexcept;
113  void value(double value) noexcept;
114 
117  length_unit unit() const noexcept;
120  void unit(length_unit value) noexcept;
122 
124 
126  bool equals(const length& other) const noexcept override;
127 
131  int32 get_pixels(const xtd::drawing::rectangle& rect) const noexcept;
132 
133  xtd::ustring to_string() const noexcept override;
135 
136  private:
137  double value_ = -1;
138  length_unit unit_ = length_unit::pixels;
139  };
140  }
141  }
142 }
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:46
std::string to_string(const date_time &value, const std::string &fmt, const std::locale &loc)
Convert a specified value into a string with specified format and locale.
Definition: date_time.h:1063
length_unit
The length_unit enum class specifies the units for xtd::forms::style_sheets::length.
Definition: length_unit.h:64
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition: iequatable.h:18
static const length empty
Provides a xtd::forms::style_sheets::length object with 0 pixels.
Definition: length.h:81
Defines pixels unit (1px = 1/96th of 1in).
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes...
Definition: object.h:32
Contains xtd::forms::style_sheets::length_unit enum class.
int_least32_t int32
Represents a 32-bit signed integer.
Definition: types.h:129
The xtd::forms::style_sheets::length specifies the legth and unit of many properties of the xtd::form...
Definition: length.h:75
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13