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 {
31 struct data;
32
33 public:
35
40
42
47 virtual drawing::color back_segment_color() const noexcept;
52 virtual seven_segment_display& back_segment_color(const drawing::color& value);
53
56 virtual double back_segment_opacity() const noexcept;
62
65 virtual bool show_back_segment() const noexcept;
70
73 virtual forms::segment_style segment_style() const noexcept;
78
81 virtual int32 thickness() const noexcept;
86
89 virtual forms::segments value() const noexcept;
95
97
101 virtual bool get_segments(forms::segments segment) const noexcept;
105 virtual void set_segments(forms::segments segment, bool value);
107
109
117 static seven_segment_display create(const drawing::point& location);
122 static seven_segment_display create(const drawing::point& location, const drawing::size& size);
128 static seven_segment_display create(const drawing::point& location, const drawing::size& size, const xtd::ustring& name);
143 static seven_segment_display create(xtd::forms::segments segments, const drawing::point& location, const drawing::size& size);
150 static seven_segment_display create(xtd::forms::segments segments, const drawing::point& location, const drawing::size& size, const xtd::ustring& name);
168 static seven_segment_display create(xtd::forms::segments segments, bool show_back_segment, const drawing::point& location, const drawing::size& size);
176 static seven_segment_display create(xtd::forms::segments segments, bool show_back_segment, const drawing::point& location, const drawing::size& size, const xtd::ustring& name);
185 static seven_segment_display create(const control& parent, const drawing::point& location);
191 static seven_segment_display create(const control& parent, const drawing::point& location, const drawing::size& size);
198 static seven_segment_display create(const control& parent, const drawing::point& location, const drawing::size& size, const xtd::ustring& name);
209 static seven_segment_display create(const control& parent, xtd::forms::segments segments, const drawing::point& location);
216 static seven_segment_display create(const control& parent, xtd::forms::segments segments, const drawing::point& location, const drawing::size& size);
224 static seven_segment_display create(const control& parent, xtd::forms::segments segments, const drawing::point& location, const drawing::size& size, const xtd::ustring& name);
245 static seven_segment_display create(const control& parent, xtd::forms::segments segments, bool show_back_segment, const drawing::point& location, const drawing::size& size);
254 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::ustring& name);
256
257 protected:
259
261 drawing::size default_size() const noexcept override;
263
265
271 std::unique_ptr<xtd::object> clone() const override;
272
275 virtual void draw_back_digit(drawing::graphics& graphics);
276
280 virtual void draw_segment_a(drawing::graphics& graphics, const drawing::color& color);
281
285 virtual void draw_segment_b(drawing::graphics& graphics, const drawing::color& color);
286
290 virtual void draw_segment_c(drawing::graphics& graphics, const drawing::color& color);
291
295 virtual void draw_segment_d(drawing::graphics& graphics, const drawing::color& color);
296
300 virtual void draw_segment_e(drawing::graphics& graphics, const drawing::color& color);
301
305 virtual void draw_segment_f(drawing::graphics& graphics, const drawing::color& color);
306
310 virtual void draw_segment_g(drawing::graphics& graphics, const drawing::color& color);
311
315 virtual void draw_dp(drawing::graphics& graphics, const drawing::color& color);
316
320 virtual void draw_pc(drawing::graphics& graphics, const drawing::color& color);
321
322 void on_back_color_changed(const event_args& e) override;
323
324 void on_enabled_changed(const event_args& e) override;
325
326 void on_fore_color_changed(const event_args& e) override;
327
328 void on_paint(paint_event_args& e) override;
329
331
332 drawing::size measure_control() const noexcept override;
333
335
338
339 private:
340 std::shared_ptr<data> data_;
341 };
342 }
343}
Contains xtd::forms::application class.
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 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::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.
Provides data for the xtd::forms::control::paint event.
Definition paint_event_args.h:28
Represents a seven segment display class.
Definition seven_segment_display.h:30
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.
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.
std::unique_ptr< xtd::object > clone() const override
Creates a new object that is a copy of the current instance.
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.
Represents text as a sequence of UTF-8 code units.
Definition ustring.h:47
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
bounds_specified
Specifies the bounds of the control to use when defining a control's size and position....
Definition bounds_specified.h:20
segment_style
Represent segment style used by seven_segment_display, fourteen_segment_display, nine_segment_display...
Definition segment_style.h:19
segments
Specifies how a control anchors to the edges of its container.
Definition segments.h:21
@ 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::style_sheets::control class.