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/ustring>
14#include <memory>
15
17namespace xtd {
19 namespace forms {
21 namespace style_sheets {
23 class style_sheet;
25
40 class forms_export_ background_image : public xtd::iequatable<background_image>, public xtd::object {
41 public:
43
46 static const background_image empty;
48
50
61 background_image() = default;
70 explicit background_image(const xtd::ustring& url);
79 explicit background_image(const std::vector<xtd::drawing::color>& colors);
85 background_image(const std::vector<xtd::drawing::color>& colors, int32 angle);
92 background_image(xtd::forms::style_sheets::image_type image_type, const std::vector<xtd::drawing::color>& colors);
100 background_image(xtd::forms::style_sheets::image_type image_type, const std::vector<xtd::drawing::color>& colors, int32 angle);
102
104 background_image(const std::initializer_list<xtd::drawing::color>& colors);
105 background_image(const background_image&) = default;
107 background_image& operator =(const background_image&) = default;
109
111
116 int32 angle() const noexcept;
120 void angle(int32 value) noexcept;
121
125 const std::vector<xtd::drawing::color>& colors() const noexcept;
130 void colors(const std::vector<xtd::drawing::color>& value);
131
134 const xtd::uri& url() const noexcept;
137 void url(const xtd::uri& value) noexcept;
138
141 xtd::forms::style_sheets::image_type image_type() const noexcept;
144 void image_type(xtd::forms::style_sheets::image_type value) noexcept;
146
148
150 bool equals(const background_image& other) const noexcept override {return image_type_ == other.image_type_ && colors_ == other.colors_ && angle_ == other.angle_;}
151
152 xtd::ustring to_string() const noexcept override;
154
156
162 static std::unique_ptr<xtd::drawing::brush> make_brush(const xtd::forms::style_sheets::background_image& image, const xtd::drawing::rectangle& rect);
164
165 private:
166 friend class style_sheet;
167 xtd::forms::style_sheets::image_type image_type_ = style_sheets::image_type::none;
168 xtd::uri url_;
169 std::vector<xtd::drawing::color> colors_ = {xtd::drawing::color::black, xtd::drawing::color::black};
170 int32 angle_ = 180;
171 };
172 }
173 }
174}
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:40
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(const xtd::ustring &url)
Initializes a new instance of the xtd::forms::style_sheets::background_image class with specified url...
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:46
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::ustring to_string() const noexcept override
Returns a sxd::ustring that represents the current object.
The xtd::forms::style_sheets::style_sheet allows you to specify an xtd style sheet.
Definition style_sheet.h:62
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.h:18
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.h:32
Provides an object representation of a uniform resource identifier (URI) and easy access to the parts...
Definition uri.h:103
Represents text as a sequence of UTF-8 code units.
Definition ustring.h:47
#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:21
int_least32_t int32
Represents a 32-bit signed integer.
Definition types.h:131
@ 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