xtd 0.2.0
Loading...
Searching...
No Matches
dot_matrix_display.h
Go to the documentation of this file.
1
4#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
12namespace 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;
96
99 virtual int32 matrix_width() const noexcept;
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;
129
131
136 virtual bool get_dot(const drawing::point& point) const noexcept;
137
140 virtual void set_all_dots(bool on);
141
145 virtual void set_dot(const drawing::point& point, bool on);
146
149 virtual void set_dots(const points_collection& points);
153 virtual void set_dots(const points_collection& points, bool on);
155
157
165 static dot_matrix_display create(const drawing::point& location);
170 static dot_matrix_display create(const drawing::point& location, const drawing::size& size);
176 static dot_matrix_display create(const drawing::point& location, const drawing::size& size, const xtd::ustring& name);
185 static dot_matrix_display create(const dots_collection& dots, const drawing::point& location);
191 static dot_matrix_display create(const dots_collection& dots, const drawing::point& location, const drawing::size& size);
198 static dot_matrix_display create(const dots_collection& dots, const drawing::point& location, const drawing::size& size, const xtd::ustring& name);
209 static dot_matrix_display create(const dots_collection& dots, bool show_back_dot, const drawing::point& location);
216 static dot_matrix_display create(const dots_collection& dots, bool show_back_dot, const drawing::point& location, const drawing::size& size);
224 static dot_matrix_display create(const dots_collection& dots, bool show_back_dot, const drawing::point& location, const drawing::size& size, const xtd::ustring& name);
233 static dot_matrix_display create(const control& parent, const drawing::point& location);
239 static dot_matrix_display create(const control& parent, const drawing::point& location, const drawing::size& size);
246 static dot_matrix_display create(const control& parent, const drawing::point& location, const drawing::size& size, const xtd::ustring& name);
257 static dot_matrix_display create(const control& parent, const dots_collection& dots, const drawing::point& location);
264 static dot_matrix_display create(const control& parent, const dots_collection& dots, const drawing::point& location, const drawing::size& size);
272 static dot_matrix_display create(const control& parent, const dots_collection& dots, const drawing::point& location, const drawing::size& size, const xtd::ustring& name);
285 static dot_matrix_display create(const control& parent, const dots_collection& dots, bool show_back_dot, const drawing::point& location);
293 static dot_matrix_display create(const control& parent, const dots_collection& dots, bool show_back_dot, const drawing::point& location, const drawing::size& size);
302 static dot_matrix_display create(const control& parent, const dots_collection& dots, bool show_back_dot, const drawing::point& location, const drawing::size& size, const xtd::ustring& name);
304
305 protected:
307
309 xtd::drawing::size default_size() const noexcept override;
311
313
319 std::unique_ptr<xtd::object> clone() const override;
320
321 void on_back_color_changed(const event_args& e) override;
322
323 void on_fore_color_changed(const event_args& e) override;
324
325 void on_paint(paint_event_args& e) override;
326
327 drawing::size measure_control() const noexcept override;
328
333 virtual void draw_dot(drawing::graphics& graphics, const drawing::color& color, const drawing::point& point);
335
336 private:
337 std::shared_ptr<data> data_;
338 };
339 }
340}
Represents an ARGB (alpha, red, green, blue) color.
Definition color.h:49
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition event_args.h:18
Defines the base class for controls, which are components with visual representation.
Definition control.h:79
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...
virtual const xtd::ustring & name() const noexcept
Gets the name of the control.
virtual std::optional< control_ref > parent() const noexcept
Gets the parent container of the control.
Represents a dot matrix display class.
Definition dot_matrix_display.h:30
dot_matrix_display()
Initialize a new instance of dot_matrix_display class.
virtual int32 matrix_width() const noexcept
Gets the matrix size. Number height dots.
virtual bool show_back_dot() const noexcept
Gets a value indicate if background dots are shown.
static dot_matrix_display create()
A factory to create an xtd::forms::dot_matrix_display.
std::vector< std::vector< bool > > dots_collection
Represents a dots collection.
Definition dot_matrix_display.h:38
drawing::size measure_control() const noexcept override
Measure this control.
void on_fore_color_changed(const event_args &e) override
Raises the xtd::forms::control::fore_color_changed event.
virtual void set_dots(const points_collection &points)
Sets specified dots to on.
std::unique_ptr< xtd::object > clone() const override
Creates a new object that is a copy of the current instance.
virtual void set_dot(const drawing::point &point, bool on)
Sets specified dot point status.
virtual drawing::color back_dot_color() const noexcept
Gets background dot color.
void on_back_color_changed(const event_args &e) override
Raises the xtd::forms::control::back_color_changed event.
std::vector< xtd::drawing::point > points_collection
Represents a point collection.
Definition dot_matrix_display.h:41
virtual double back_dot_opacity() const noexcept
Gets the background dot opacity.
virtual int32 matrix_height() const noexcept
Gets the matrix size. Number of height dots.
virtual void set_all_dots(bool on)
Sets all dots with specified boolean.
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 bool get_dot(const drawing::point &point) const noexcept
Gets specified dot point status.
void on_paint(paint_event_args &e) override
Raises the xtd::forms::control::paint event.
xtd::drawing::size default_size() const noexcept override
Gets the default size of the control.
virtual int32 thickness() const noexcept
Gets thickness of dot.
virtual const dots_collection & dots() const noexcept
Gets all dots status.
virtual const drawing::size & matrix_size() const noexcept
Gets the matrix size. Number of width and height dots.
Provides data for the xtd::forms::control::paint event.
Definition paint_event_args.h:28
Represents text as a sequence of UTF-8 code units.
Definition ustring.h:47
Contains xtd::forms::dot_matrix_style enum class.
int_least32_t int32
Represents a 32-bit signed integer.
Definition types.h:131
size_t size
Represents a size of any object in bytes.
Definition types.h:197
dot_matrix_style
Represent dot matrix style used by dot_matrix_display control.
Definition dot_matrix_style.h:19
@ e
The E key.
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
Contains xtd::forms::segments enum class.
Contains xtd::forms::style_sheets::control class.