xtd 0.2.0
seven_segment_display.h
Go to the documentation of this file.
1 #pragma once
5 #include "application.h"
6 #include "control.h"
7 #include "segments.h"
8 #include "segment_style.h"
9 #include <xtd/argument_out_of_range_exception>
10 #include <xtd/drawing/system_colors>
11 
12 namespace xtd {
13  namespace forms {
30  class seven_segment_display : public control {
31  struct data;
32 
33  public:
35 
40 
42 
47  virtual drawing::color back_segment_color() const noexcept;
53 
56  virtual double back_segment_opacity() const noexcept;
61  virtual seven_segment_display& back_segment_opacity(double value);
62 
65  virtual bool show_back_segment() const noexcept;
69  virtual seven_segment_display& show_back_segment(bool value);
70 
73  virtual forms::segment_style segment_style() const noexcept;
78 
81  virtual int32 thickness() const noexcept;
85  virtual seven_segment_display& thickness(int32 value);
86 
89  virtual forms::segments value() const noexcept;
95 
97 
99  using control::create;
107  static seven_segment_display create(xtd::forms::segments segments, bool show_back_segment = true, const drawing::point& location = {-1, -1}, const drawing::size& size = {-1, -1}, const xtd::ustring& name = xtd::ustring::empty_string);
116  static seven_segment_display create(const control& parent, xtd::forms::segments segments, bool show_back_segment = true, const drawing::point& location = {-1, -1}, const drawing::size& size = {-1, -1}, const xtd::ustring& name = xtd::ustring::empty_string);
117 
120  virtual bool get_segments(forms::segments segment) const noexcept;
124  virtual void set_segments(forms::segments segment, bool value);
126 
127  protected:
129 
131  drawing::size default_size() const noexcept override;
133 
135 
137  void on_back_color_changed(const event_args& e) override;
138 
139  void on_enabled_changed(const event_args& e) override;
140 
141  void on_fore_color_changed(const event_args& e) override;
142 
143  void on_paint(paint_event_args& e) override;
144 
145  void on_parent_enabled_changed(const event_args& e) override;
146 
147  drawing::size measure_control() const noexcept override;
148 
149  void set_bounds_core(int32 x, int32 y, int32 width, int32 height, bounds_specified specified) override;
150 
151  void set_client_size_core(int32 width, int32 height) override;
152 
155  virtual void draw_back_digit(drawing::graphics& graphics);
156 
160  virtual void draw_segment_a(drawing::graphics& graphics, const drawing::color& color);
161 
165  virtual void draw_segment_b(drawing::graphics& graphics, const drawing::color& color);
166 
170  virtual void draw_segment_c(drawing::graphics& graphics, const drawing::color& color);
171 
175  virtual void draw_segment_d(drawing::graphics& graphics, const drawing::color& color);
176 
180  virtual void draw_segment_e(drawing::graphics& graphics, const drawing::color& color);
181 
185  virtual void draw_segment_f(drawing::graphics& graphics, const drawing::color& color);
186 
190  virtual void draw_segment_g(drawing::graphics& graphics, const drawing::color& color);
191 
195  virtual void draw_dp(drawing::graphics& graphics, const drawing::color& color);
196 
200  virtual void draw_pc(drawing::graphics& graphics, const drawing::color& color);
202 
203  private:
204  std::shared_ptr<data> data_;
205  };
206  }
207 }
void on_paint(paint_event_args &e) override
Raises the xtd::forms::control::paint event.
virtual void draw_segment_a(drawing::graphics &graphics, const drawing::color &color)
Draw segment a on specified graphics with specified color.
void on_parent_enabled_changed(const event_args &e) override
Raises the xtd::control::enabled_changed event when the xtd::control::enabled property value of the c...
Contains xtd::forms::application class.
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition: event_args.h:18
segment_style
Represent segment style used by seven_segment_display, fourteen_segment_display, nine_segment_display...
Definition: segment_style.h:19
virtual void draw_pc(drawing::graphics &graphics, const drawing::color &color)
Draw segment punctuation colon on specified graphics with specified color.
virtual void draw_segment_f(drawing::graphics &graphics, const drawing::color &color)
Draw segment f on specified graphics with specified color.
virtual void set_segments(forms::segments segment, bool value)
Sets specified xtd::forms::segments combination to on.
virtual forms::segment_style segment_style() const noexcept
Gets segment style.
Represents an ordered pair of integer x- and y-coordinates that defines a point in a two-dimensional ...
Definition: point.h:54
virtual int32 width() const noexcept
Gets the width of the control.
Stores an ordered pair of integers, which specify a height and width.
Definition: size.h:31
Specifies that the top edge of the control is defined.
void on_back_color_changed(const event_args &e) override
Raises the xtd::forms::control::back_color_changed event.
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 xtd::ustring & name() const noexcept
Gets the name of the control.
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:46
void on_fore_color_changed(const event_args &e) override
Raises the xtd::forms::control::fore_color_changed event.
Specifies that the left edge of the control is defined.
segments
Specifies how a control anchors to the edges of its container.
Definition: segments.h:21
static control create(const drawing::point &location={-1, -1}, const drawing::size &size={-1, -1}, const xtd::ustring &name=xtd::ustring::empty_string)
A factory to create a specified control with specified location, size, and name.
virtual bool show_back_segment() const noexcept
Gets a value indicate if background segments are shown.
void set_client_size_core(int32 width, int32 height) override
Sets the size of the client area of the control.
virtual int32 thickness() const noexcept
Gets thickness of segment.
virtual forms::segments value() const noexcept
Gets seven_segment_display value.
static seven_segment_display create(xtd::forms::segments segments, bool show_back_segment=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::seven_segment_display with specified color, location, size, and name.
virtual void draw_segment_c(drawing::graphics &graphics, const drawing::color &color)
Draw segment c on specified graphics with specified color.
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
virtual void draw_segment_e(drawing::graphics &graphics, const drawing::color &color)
Draw segment e on specified graphics with specified color.
drawing::size measure_control() const noexcept override
Measure this control.
virtual void draw_back_digit(drawing::graphics &graphics)
Draw all background digit on specified graphics.
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...
void on_enabled_changed(const event_args &e) override
Raises the xtd::forms::control::enabled_changed event.
void set_bounds_core(int32 x, int32 y, int32 width, int32 height, bounds_specified specified) override
Performs the work of setting the specified bounds of this control.
Defines the base class for controls, which are components with visual representation.
Definition: control.h:78
Contains xtd::forms::segment_style enum class.
drawing::size default_size() const noexcept override
Gets the default size of the control.
virtual void draw_segment_g(drawing::graphics &graphics, const drawing::color &color)
Draw segment g on specified graphics with specified color.
virtual std::optional< control_ref > parent() const noexcept
Gets the parent container of the control.
int_least32_t int32
Represents a 32-bit signed integer.
Definition: types.h:129
virtual void draw_dp(drawing::graphics &graphics, const drawing::color &color)
Draw segment dot point on specified graphics with specified color.
Contains xtd::forms::control control.
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
bounds_specified
Specifies the bounds of the control to use when defining a control&#39;s size and position. This enumeration has a flags attribute that allows a bitwise combination of its member values.
Definition: bounds_specified.h:20
Represents a seven segment display class.
Definition: seven_segment_display.h:30
virtual int32 height() const noexcept
Gets the height of the control.
Defines an object used to draw lines and curves. This class cannot be inherited.
Definition: graphics.h:70
virtual drawing::color back_segment_color() const noexcept
Gets background segment color.
seven_segment_display()
Initialize a new instance of seven_segment_display class.
virtual double back_segment_opacity() const noexcept
Gets the background segment opacity.
virtual bool get_segments(forms::segments segment) const noexcept
Gets if specified xtd::forms::segments combination is on.
virtual void draw_segment_b(drawing::graphics &graphics, const drawing::color &color)
Draw segment b on specified graphics with specified color.
size_t size
Represents a size of any object in bytes.
Definition: types.h:195
virtual void draw_segment_d(drawing::graphics &graphics, const drawing::color &color)
Draw segment d on specified graphics with specified color.