xtd 1.0.0
Loading...
Searching...
No Matches
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
107 [[nodiscard]] auto value() const noexcept -> double;
110 auto value(double value) noexcept -> void;
111
114 [[nodiscard]] auto unit() const noexcept -> length_unit;
117 auto unit(length_unit value) noexcept -> void;
119
121
126 [[nodiscard]] auto equals(const xtd::object& obj) const noexcept -> bool override;
130 [[nodiscard]] auto equals(const length& other) const noexcept -> bool override;
131
134 [[nodiscard]] auto get_hash_code() const noexcept -> xtd::usize override;
135
139 [[nodiscard]] auto get_pixels(const xtd::drawing::rectangle& rect) const noexcept -> xtd::int32;
140
141 [[nodiscard]] auto to_string() const noexcept -> xtd::string override;
143
144 private:
145 double value_ = -1;
146 length_unit unit_ = length_unit::pixels;
147 };
148 }
149 }
150}
auto equals(const xtd::object &obj) const noexcept -> bool override
Determines whether the specified object is equal to the current object.
auto value() const noexcept -> double
Gets the xtd::forms::style_sheets::length value.
static const length empty
Provides a xtd::forms::style_sheets::length object with 0 pixels.
Definition length.hpp:83
auto get_pixels(const xtd::drawing::rectangle &rect) const noexcept -> xtd::int32
Gets the legnth in pixels.
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.
auto unit() const noexcept -> length_unit
Gets the xtd::forms::style_sheets::length unit.
auto to_string() const noexcept -> xtd::string override
Returns a xtd::string that represents the current object.
auto get_hash_code() const noexcept -> xtd::usize override
Serves as a hash function for a particular type.
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:23
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:45
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
std::int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:25
std::size_t usize
Represents an unsigned size of any object in bytes.
Definition usize.hpp:22
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