xtd 0.2.0
Loading...
Searching...
No Matches
seven_segment_display.h
Go to the documentation of this file.
1
4#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
12namespace xtd {
13 namespace forms {
33 struct data;
34
35 public:
37
42
44
49 virtual drawing::color back_segment_color() const noexcept;
54 virtual seven_segment_display& back_segment_color(const drawing::color& value);
55
58 virtual double back_segment_opacity() const noexcept;
64
67 virtual bool show_back_segment() const noexcept;
72
75 virtual forms::segment_style segment_style() const noexcept;
80
83 virtual int32 thickness() const noexcept;
88
91 virtual forms::segments value() const noexcept;
97
99
103 virtual bool get_segments(forms::segments segment) const noexcept;
107 virtual void set_segments(forms::segments segment, bool value);
109
111
119 static seven_segment_display create(const drawing::point& location);
124 static seven_segment_display create(const drawing::point& location, const drawing::size& size);
130 static seven_segment_display create(const drawing::point& location, const drawing::size& size, const xtd::string& name);
145 static seven_segment_display create(xtd::forms::segments segments, const drawing::point& location, const drawing::size& size);
152 static seven_segment_display create(xtd::forms::segments segments, const drawing::point& location, const drawing::size& size, const xtd::string& name);
170 static seven_segment_display create(xtd::forms::segments segments, bool show_back_segment, const drawing::point& location, const drawing::size& size);
178 static seven_segment_display create(xtd::forms::segments segments, bool show_back_segment, const drawing::point& location, const drawing::size& size, const xtd::string& name);
187 static seven_segment_display create(const control& parent, const drawing::point& location);
193 static seven_segment_display create(const control& parent, const drawing::point& location, const drawing::size& size);
200 static seven_segment_display create(const control& parent, const drawing::point& location, const drawing::size& size, const xtd::string& name);
211 static seven_segment_display create(const control& parent, xtd::forms::segments segments, const drawing::point& location);
218 static seven_segment_display create(const control& parent, xtd::forms::segments segments, const drawing::point& location, const drawing::size& size);
226 static seven_segment_display create(const control& parent, xtd::forms::segments segments, const drawing::point& location, const drawing::size& size, const xtd::string& name);
247 static seven_segment_display create(const control& parent, xtd::forms::segments segments, bool show_back_segment, const drawing::point& location, const drawing::size& size);
256 static seven_segment_display create(const control& parent, xtd::forms::segments segments, bool show_back_segment, const drawing::point& location, const drawing::size& size, const xtd::string& name);
258
259 protected:
261
263 drawing::size default_size() const noexcept override;
265
267
273 xtd::uptr<xtd::object> clone() const override;
274
277 virtual void draw_back_digit(drawing::graphics& graphics);
278
282 virtual void draw_segment_a(drawing::graphics& graphics, const drawing::color& color);
283
287 virtual void draw_segment_b(drawing::graphics& graphics, const drawing::color& color);
288
292 virtual void draw_segment_c(drawing::graphics& graphics, const drawing::color& color);
293
297 virtual void draw_segment_d(drawing::graphics& graphics, const drawing::color& color);
298
302 virtual void draw_segment_e(drawing::graphics& graphics, const drawing::color& color);
303
307 virtual void draw_segment_f(drawing::graphics& graphics, const drawing::color& color);
308
312 virtual void draw_segment_g(drawing::graphics& graphics, const drawing::color& color);
313
317 virtual void draw_dp(drawing::graphics& graphics, const drawing::color& color);
318
322 virtual void draw_pc(drawing::graphics& graphics, const drawing::color& color);
323
324 void on_back_color_changed(const event_args& e) override;
325
326 void on_enabled_changed(const event_args& e) override;
327
328 void on_fore_color_changed(const event_args& e) override;
329
330 void on_paint(paint_event_args& e) override;
331
333
334 drawing::size measure_control() const noexcept override;
335
337
340
341 private:
342 xtd::sptr<data> data_;
343 };
344 }
345}
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:81
virtual int32 width() const noexcept
Gets the width 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...
virtual int32 height() const noexcept
Gets the height of the control.
virtual const xtd::string & name() const noexcept
Gets the name of the control.
virtual std::optional< control_ref > parent() const noexcept
Gets the parent container of the control.
Provides data for the xtd::forms::control::paint event.
Definition paint_event_args.h:30
Represents a seven segment display class.
Definition seven_segment_display.h:32
virtual void draw_segment_a(drawing::graphics &graphics, const drawing::color &color)
Draw segment a on specified graphics with specified color.
static seven_segment_display create()
A factory to create an xtd::forms::seven_segment_display.
void set_client_size_core(int32 width, int32 height) override
Sets the size of the client area of the control.
virtual drawing::color back_segment_color() const noexcept
Gets background segment color.
void on_fore_color_changed(const event_args &e) override
Raises the xtd::forms::control::fore_color_changed event.
xtd::uptr< xtd::object > clone() const override
Creates a new object that is a copy of the current instance.
virtual void set_segments(forms::segments segment, bool value)
Sets specified xtd::forms::segments combination to on.
virtual bool show_back_segment() const noexcept
Gets a value indicate if background segments are shown.
void on_paint(paint_event_args &e) override
Raises the xtd::forms::control::paint event.
virtual int32 thickness() const noexcept
Gets thickness of segment.
virtual void draw_segment_d(drawing::graphics &graphics, const drawing::color &color)
Draw segment d on specified graphics with specified color.
virtual void draw_segment_b(drawing::graphics &graphics, const drawing::color &color)
Draw segment b on specified graphics with specified color.
void on_back_color_changed(const event_args &e) override
Raises the xtd::forms::control::back_color_changed event.
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.
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...
virtual void draw_dp(drawing::graphics &graphics, const drawing::color &color)
Draw segment dot point on specified graphics with specified color.
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_c(drawing::graphics &graphics, const drawing::color &color)
Draw segment c on specified graphics with specified color.
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.
virtual double back_segment_opacity() const noexcept
Gets the background segment opacity.
seven_segment_display()
Initialize a new instance of seven_segment_display class.
virtual forms::segments value() const noexcept
Gets seven_segment_display value.
virtual void draw_segment_e(drawing::graphics &graphics, const drawing::color &color)
Draw segment e on specified graphics with specified color.
void on_enabled_changed(const event_args &e) override
Raises the xtd::forms::control::enabled_changed event.
virtual void draw_back_digit(drawing::graphics &graphics)
Draw all background digit on specified graphics.
virtual void draw_segment_f(drawing::graphics &graphics, const drawing::color &color)
Draw segment f on specified graphics with specified color.
drawing::size measure_control() const noexcept override
Measure this control.
virtual bool get_segments(forms::segments segment) const noexcept
Gets if specified xtd::forms::segments combination is on.
int32_t int32
Represents a 32-bit signed integer.
Definition int32.h:23
std::unique_ptr< type_t > uptr
The xtd::uptr object is a unique pointer.
Definition uptr.h:25
size_t size
Represents a size of any object in bytes.
Definition size.h:23
std::shared_ptr< type_t > sptr
The xtd::sptr object is a shared pointer.
Definition sptr.h:25
bounds_specified
Specifies the bounds of the control to use when defining a control's size and position....
Definition bounds_specified.h:22
segment_style
Represent segment style used by seven_segment_display, fourteen_segment_display, nine_segment_display...
Definition segment_style.h:21
segments
Specifies how a control anchors to the edges of its container.
Definition segments.h:23
@ e
The E key.
@ y
Specifies that the top edge of the control is defined.
@ x
Specifies that the left edge of the control is defined.
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::segment_style enum class.
Contains xtd::forms::segments enum class.
Contains xtd::forms::application class.
Contains xtd::forms::style_sheets::control class.