xtd 0.2.0
dot_matrix_display.h
Go to the documentation of this file.
1 #pragma once
5 #include "control.h"
6 #include "segments.h"
7 #include "dot_matrix_style.h"
8 #include <xtd/drawing/solid_brush>
9 #include <xtd/argument_out_of_range_exception>
10 #include <array>
11 
12 namespace xtd {
13  namespace forms {
30  class dot_matrix_display : public control {
31  struct data;
32 
33  public:
35 
38  using dots_collection = std::vector<std::vector<bool>>;
39 
41  using points_collection = std::vector<xtd::drawing::point>;
43 
45 
50 
52 
57  virtual drawing::color back_dot_color() const noexcept;
62  virtual dot_matrix_display& back_dot_color(const drawing::color& value);
63 
66  virtual double back_dot_opacity() const noexcept;
71  virtual dot_matrix_display& back_dot_opacity(double value);
72 
75  virtual forms::dot_matrix_style dot_matrix_style() const noexcept;
80 
83  virtual const dots_collection& dots() const noexcept;
88 
91  virtual int32 matrix_height() const noexcept;
95  virtual dot_matrix_display& matrix_height(int32 value);
96 
99  virtual int32 matrix_width() const noexcept;
103  virtual dot_matrix_display& matrix_width(int32 value);
104 
107  virtual const drawing::size& matrix_size() const noexcept;
111  virtual dot_matrix_display& matrix_size(const drawing::size& value);
112 
115  virtual bool show_back_dot() const noexcept;
119  virtual dot_matrix_display& show_back_dot(bool value);
120 
123  virtual int32 thickness() const noexcept;
127  virtual dot_matrix_display& thickness(int32 value);
129 
131 
133  using control::create;
141  static dot_matrix_display create(const dots_collection& dots, bool show_back_dot = true, const drawing::point& location = {-1, -1}, const drawing::size& size = {-1, -1}, const xtd::ustring& name = xtd::ustring::empty_string);
150  static dot_matrix_display create(const control& parent, const dots_collection& dots, bool show_back_dot = true, const drawing::point& location = {-1, -1}, const drawing::size& size = {-1, -1}, const xtd::ustring& name = xtd::ustring::empty_string);
151 
155  virtual bool get_dot(const drawing::point& point) const noexcept;
156 
159  virtual void set_all_dots(bool on);
160 
164  virtual void set_dot(const drawing::point& point, bool on);
165 
168  virtual void set_dots(const points_collection& points);
172  virtual void set_dots(const points_collection& points, bool on);
174 
175  protected:
177 
179  xtd::drawing::size default_size() const noexcept override;
181 
183 
185  void on_back_color_changed(const event_args& e) override;
186 
187  void on_fore_color_changed(const event_args& e) override;
188 
189  void on_paint(paint_event_args& e) override;
190 
191  drawing::size measure_control() const noexcept override;
192 
197  virtual void draw_dot(drawing::graphics& graphics, const drawing::color& color, const drawing::point& point);
199 
200  private:
201  std::shared_ptr<data> data_;
202  };
203  }
204 }
std::vector< xtd::drawing::point > points_collection
Represents a point collection.
Definition: dot_matrix_display.h:41
Represents a dot matrix display class.
Definition: dot_matrix_display.h:30
virtual bool get_dot(const drawing::point &point) const noexcept
Gets specified dot point status.
drawing::size measure_control() const noexcept override
Measure this control.
virtual void set_dots(const points_collection &points)
Sets specified dots to on.
void on_paint(paint_event_args &e) override
Raises the xtd::forms::control::paint event.
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition: event_args.h:18
Represents an ordered pair of integer x- and y-coordinates that defines a point in a two-dimensional ...
Definition: point.h:54
dot_matrix_display()
Initialize a new instance of dot_matrix_display class.
Stores an ordered pair of integers, which specify a height and width.
Definition: size.h:31
virtual int32 thickness() const noexcept
Gets thickness of dot.
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
Contains xtd::forms::segments enum class.
virtual const dots_collection & dots() const noexcept
Gets all dots status.
virtual void set_all_dots(bool on)
Sets all dots with specified boolean.
virtual const xtd::ustring & name() const noexcept
Gets the name of the control.
virtual void set_dot(const drawing::point &point, bool on)
Sets specified dot point status.
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:46
std::vector< std::vector< bool > > dots_collection
Represents a dots collection.
Definition: dot_matrix_display.h:38
virtual bool show_back_dot() const noexcept
Gets a value indicate if background dots are shown.
dot_matrix_style
Represent dot matrix style used by dot_matrix_display control.
Definition: dot_matrix_style.h:19
Represents an ARGB (alpha, red, green, blue) color.
Definition: color.h:45
Provides data for the xtd::forms::control::paint event.
Definition: paint_event_args.h:28
static dot_matrix_display create(const dots_collection &dots, bool show_back_dot=true, const drawing::point &location={-1, -1}, const drawing::size &size={-1, -1}, const xtd::ustring &name=xtd::ustring::empty_string)
A factory to create an xtd::forms::dot_matrix_display with specified color, location, size, and name.
xtd::drawing::size default_size() const noexcept override
Gets the default size of the control.
virtual drawing::point location() const noexcept
Gets the coordinates of the upper-left corner of the control relative to the upper-left corner of its...
Defines the base class for controls, which are components with visual representation.
Definition: control.h:78
virtual void draw_dot(drawing::graphics &graphics, const drawing::color &color, const drawing::point &point)
Draw specified dot point with specified color on specified graphics.
virtual std::optional< control_ref > parent() const noexcept
Gets the parent container of the control.
virtual int32 matrix_height() const noexcept
Gets the matrix size. Number of height dots.
int_least32_t int32
Represents a 32-bit signed integer.
Definition: types.h:129
void on_fore_color_changed(const event_args &e) override
Raises the xtd::forms::control::fore_color_changed event.
Contains xtd::forms::control control.
void on_back_color_changed(const event_args &e) override
Raises the xtd::forms::control::back_color_changed event.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
static const ustring empty_string
Represents the empty string.
Definition: ustring.h:53
Contains xtd::forms::dot_matrix_style enum class.
virtual const drawing::size & matrix_size() const noexcept
Gets the matrix size. Number of width and height dots.
virtual int32 matrix_width() const noexcept
Gets the matrix size. Number height dots.
virtual drawing::color back_dot_color() const noexcept
Gets background dot color.
size_t size
Represents a size of any object in bytes.
Definition: types.h:195
virtual double back_dot_opacity() const noexcept
Gets the background dot opacity.