xtd 0.2.0
background_image.h
Go to the documentation of this file.
1 #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 
17 namespace 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;
106  background_image(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 
156  static std::unique_ptr<xtd::drawing::brush> make_brush(const xtd::forms::style_sheets::background_image& image, const xtd::drawing::rectangle& rect);
157 
158  xtd::ustring to_string() const noexcept override;
160 
161  private:
162  friend class style_sheet;
163  xtd::forms::style_sheets::image_type image_type_ = style_sheets::image_type::none;
164  xtd::uri url_;
165  std::vector<xtd::drawing::color> colors_ = {xtd::drawing::color::black, xtd::drawing::color::black};
166  int32 angle_ = 180;
167  };
168  }
169  }
170 }
static const background_image empty
Provides an empty xtd::forms::style_sheets::background_image object.
Definition: background_image.h:46
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
The image data allows you to specify the url or gradient mode.
Definition: background_image.h:40
Contains xtd::forms::style_sheets::image_type enum class.
image_type
The image_type enum class specifies what kind of image to display.
Definition: image_type.h:21
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
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition: iequatable.h:18
Stores a set of four integers that represent the location and size of a rectangle.
Definition: rectangle.h:44
The operating system is other.
Provides an object representation of a uniform resource identifier (URI) and easy access to the parts...
Definition: uri.h:103
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes...
Definition: object.h:32
int_least32_t int32
Represents a 32-bit signed integer.
Definition: types.h:129
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
The xtd::forms::style_sheets::style_sheet allows you to specify an xtd style sheet.
Definition: style_sheet.h:62
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:79