xtd 0.2.0
Loading...
Searching...
No Matches
background_image.h
Go to the documentation of this file.
1
4#pragma once
5#include "../../forms_export.h"
6#include "image_type.h"
7#include <xtd/drawing/brush>
8#include <xtd/drawing/color>
9#include <xtd/drawing/rectangle>
10#include <xtd/iequatable>
11#include <xtd/object>
12#include <xtd/uri>
13#include <xtd/string>
14#include <memory>
15
17namespace xtd {
19 namespace forms {
21 namespace style_sheets {
23 class style_sheet;
25
42 class forms_export_ background_image : public xtd::iequatable<background_image>, public xtd::object {
43 public:
45
48 static const background_image empty;
50
52
63 background_image() = default;
72 explicit background_image(const xtd::string& url);
81 explicit background_image(const std::vector<xtd::drawing::color>& colors);
87 background_image(const std::vector<xtd::drawing::color>& colors, int32 angle);
94 background_image(xtd::forms::style_sheets::image_type image_type, const std::vector<xtd::drawing::color>& colors);
102 background_image(xtd::forms::style_sheets::image_type image_type, const std::vector<xtd::drawing::color>& colors, int32 angle);
104
106 background_image(const std::initializer_list<xtd::drawing::color>& colors);
107 background_image(const background_image&) = default;
109 background_image& operator =(const background_image&) = default;
111
113
118 int32 angle() const noexcept;
122 void angle(int32 value) noexcept;
123
127 const std::vector<xtd::drawing::color>& colors() const noexcept;
132 void colors(const std::vector<xtd::drawing::color>& value);
133
136 const xtd::uri& url() const noexcept;
139 void url(const xtd::uri& value) noexcept;
140
143 xtd::forms::style_sheets::image_type image_type() const noexcept;
146 void image_type(xtd::forms::style_sheets::image_type value) noexcept;
148
150
152 using object::equals;
153 bool equals(const background_image& other) const noexcept override {return image_type_ == other.image_type_ && colors_ == other.colors_ && angle_ == other.angle_;}
154
155 xtd::string to_string() const noexcept override;
157
159
165 static xtd::uptr<xtd::drawing::brush> make_brush(const xtd::forms::style_sheets::background_image& image, const xtd::drawing::rectangle& rect);
167
168 private:
169 friend class style_sheet;
170 xtd::forms::style_sheets::image_type image_type_ = style_sheets::image_type::none;
171 xtd::uri url_;
172 std::vector<xtd::drawing::color> colors_ = {xtd::drawing::color::black, xtd::drawing::color::black};
173 int32 angle_ = 180;
174 };
175 }
176 }
177}
Represents text as a sequence of character units.
Definition basic_string.h:79
static const xtd::drawing::color black
Gets a system-defined color that has an ARGB value of 0xFF000000. This field is constant.
Definition color.h:83
The image data allows you to specify the url or gradient mode.
Definition background_image.h:42
background_image(const xtd::string &url)
Initializes a new instance of the xtd::forms::style_sheets::background_image class with specified url...
int32 angle() const noexcept
Gets the angle specifies the gradient direction.
background_image(const std::vector< xtd::drawing::color > &colors, int32 angle)
Initializes a new instance of the xtd::forms::style_sheets::background_image class with specified col...
background_image(xtd::forms::style_sheets::image_type image_type, const std::vector< xtd::drawing::color > &colors, int32 angle)
Initializes a new instance of the xtd::forms::style_sheets::background_image class with specified sty...
background_image(xtd::forms::style_sheets::image_type image_type, const std::vector< xtd::drawing::color > &colors)
Initializes a new instance of the xtd::forms::style_sheets::background_image class with specified sty...
static const background_image empty
Provides an empty xtd::forms::style_sheets::background_image object.
Definition background_image.h:48
background_image()=default
Initializes a new instance of the xtd::forms::style_sheets::background_image class.
background_image(const std::vector< xtd::drawing::color > &colors)
Initializes a new instance of the xtd::forms::style_sheets::background_image class with specified col...
xtd::string to_string() const noexcept override
Returns a xtd::string that represents the current object.
The xtd::forms::style_sheets::style_sheet allows you to specify an xtd style sheet.
Definition style_sheet.h:64
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.h:22
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.h:42
Provides an object representation of a uniform resource identifier (URI) and easy access to the parts...
Definition uri.h:103
#define forms_export_
Define shared library export.
Definition forms_export.h:13
image_type
The image_type enum class specifies what kind of image to display.
Definition image_type.h:23
int32_t int32
Represents a 32-bit signed integer.
Definition int32.h:23
std::unique_ptr< type_t > uptr
The xtd::uptr object is a unique pointer.
Definition uptr.h:25
@ other
The operating system is other.
Contains xtd::forms::style_sheets::image_type enum class.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition xtd_about_box.h:12
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10