xtd 0.2.0
length.hpp
Go to the documentation of this file.
1
4#pragma once
6#include "length_unit.hpp"
7#include <xtd/drawing/rectangle>
8#include <xtd/iequatable>
9#include <xtd/string>
10
12namespace xtd {
14 namespace forms {
16 namespace style_sheets {
77 class forms_export_ length : public xtd::iequatable<length>, public xtd::object {
78 public:
80
83 static const length empty;
85
87
90 length() = default;
91
94 explicit length(double value);
95
101
103 length(const length&) = default;
104 length& operator =(const length&) = default;
106
108
112 double value() const noexcept;
115 void value(double value) noexcept;
116
119 length_unit unit() const noexcept;
122 void unit(length_unit value) noexcept;
124
126
131 bool equals(const xtd::object& obj) const noexcept override;
135 bool equals(const length& other) const noexcept override;
136
139 xtd::size get_hash_code() const noexcept override;
140
144 int32 get_pixels(const xtd::drawing::rectangle& rect) const noexcept;
145
146 xtd::string to_string() const noexcept override;
148
149 private:
150 double value_ = -1;
152 };
153 }
154 }
155}
xtd::size get_hash_code() const noexcept override
Serves as a hash function for a particular type.
bool equals(const xtd::object &obj) const noexcept override
Determines whether the specified object is equal to the current object.
double value() const noexcept
Gets the xtd::forms::style_sheets::length value.
length_unit unit() const noexcept
Gets the xtd::forms::style_sheets::length unit.
static const length empty
Provides a xtd::forms::style_sheets::length object with 0 pixels.
Definition length.hpp:83
length(double value)
Initializes a new instance of the xtd::forms::style_sheets::length class with specifed value in pixel...
length(double value, length_unit unit)
Initializes a new instance of the xtd::forms::style_sheets::length class with specifed value and unit...
length()=default
Initializes a new instance of the xtd::forms::style_sheets::length class.
int32 get_pixels(const xtd::drawing::rectangle &rect) const noexcept
Gets the legnth in pixels.
xtd::string to_string() const noexcept override
Returns a xtd::string that represents the current object.
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:22
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:44
Contains forms_export_ keyword.
#define forms_export_
Define shared library export.
Definition forms_export.hpp:13
length_unit
The length_unit enum class specifies the units for xtd::forms::style_sheets::length.
Definition length_unit.hpp:66
@ pixels
Defines pixels unit (1px = 1/96th of 1in).
Definition length_unit.hpp:74
int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:23
@ other
The operating system is other.
Definition platform_id.hpp:58
@ size
Specifies that both the width and height property values of the control are defined.
Definition bounds_specified.hpp:36
Contains xtd::forms::style_sheets::length_unit enum class.
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition actions_system_images.hpp:10
The xtd::forms::style_sheets namespace contains various properties, states, and subcontrols that make...
Definition background_image.hpp:21
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition texts.hpp:219
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8