5#include "../forms_export.h"
33#include <xtd/drawing/color>
34#include <xtd/drawing/font>
35#include <xtd/drawing/point>
36#include <xtd/drawing/rectangle>
37#include <xtd/drawing/size>
39#include <xtd/async_result>
40#include <xtd/optional>
41#include <xtd/iclonable>
42#include <xtd/iequatable>
43#include <xtd/isynchronize_invoke>
58 class horizontal_layout_panel;
60 class vertical_layout_panel;
86 enum class state :
int64 {
92 creating_handle = 0b10000,
94 parent_recreating = 0b1000000,
96 client_size_setted = 0b10000000,
98 top_level = 0b1000000000,
99 visible = 0b10000000000,
100 enabled = 0b100000000000,
102 tab_stop = 0b10000000000000,
103 allow_drop = 0b100000000000000,
104 drop_target = 0b1000000000000000,
106 layout_deferred = 0b10000000000000000,
107 docked = 0b100000000000000000,
109 double_click_fired = 0b1000000000000000000,
110 double_buffered = 0b10000000000000000000,
112 mouse_enter_pending = 0b100000000000000000000,
113 tracking_mouse_event = 0b1000000000000000000000,
114 mouse_pressed = 0b10000000000000000000000,
117 is_accessible = 0b1000000000000000000000000,
118 no_zorder = 0b10000000000000000000000000,
119 size_locked_by_os = 0b10000000000000000000000000,
120 causes_validation = 0b100000000000000000000000000,
121 own_ctl_brush = 0b1000000000000000000000000000,
122 exception_while_painting = 0b10000000000000000000000000000,
123 layout_sis_dirty = 0b100000000000000000000000000000,
124 checked_host = 0b1000000000000000000000000000000,
125 hosted_in_dialog = 0b10000000000000000000000000000000,
126 validation_cancelled = 0b100000000000000000000000000000000,
127 mirrored = 0b1000000000000000000000000000000000,
133 explicit async_result_invoke(std::any async_state);
134 std::any async_state()
const noexcept override;
136 bool completed_synchronously()
const noexcept override;
137 bool is_completed()
const noexcept override;
186 using base::operator [];
191 std::optional<value_type> operator [](
const xtd::string& name)
const;
211 template<
typename control_t,
typename ... args_t>
213 auto control_ptr = xtd::new_uptr<control_t>(control_t::create(std::forward<args_t>(args)...));
215 controls_.push_back(std::move(control_ptr));
229 template<
typename control_t,
typename ... args_t>
231 auto control_ptr = xtd::new_uptr<control_t>(control_t::create(std::forward<args_t>(args)...));
233 controls_.push_back(std::move(control_ptr));
246 template<
typename control_t,
typename ... args_t>
248 auto control_ptr = xtd::new_uptr<control_t>(control_t::create(std::forward<args_t>(args)...));
250 controls_.push_back(std::move(control_ptr));
257 void insert_at(
size_t index,
const value_type& value)
override;
261 template<
typename control_t>
263 for (
auto it = begin(); it !=
end(); ++it)
264 if (it->get() == value)
return it;
265 if (!keep_cloned_controls_)
return base::insert(pos, value);
266 auto control_ptr = as<control>(as<iclonable>(value).clone());
268 controls_.push_back(std::move(control_ptr));
272 template<
typename control_t>
273 void insert_at(
size_t index, control_t& value) {
274 for (
auto it = begin(); it !=
end(); ++it)
275 if (it->get() == value)
return;
276 if (!keep_cloned_controls_) base::insert_at(index, value);
278 auto control_ptr = as<control>(as<iclonable>(value).clone());
280 controls_.push_back(std::move(control_ptr));
285 template<
typename control_t>
286 void push_back(control_t& value) {
287 for (
auto it = begin(); it !=
end(); ++it)
288 if (it->get() == value)
return;
289 if (!keep_cloned_controls_) base::push_back(value);
291 auto control_ptr = as<control>(as<iclonable>(value).clone());
292 auto& control_ref = *control_ptr;
293 controls_.push_back(std::move(control_ptr));
294 base::push_back(control_ref);
307 if (
iterator->get() != &item.get())
continue;
318 bool keep_cloned_controls_ =
false;
319 static std::vector<xtd::uptr<xtd::forms::control>> controls_;
391 virtual drawing::point auto_scroll_point() const noexcept;
396 virtual
bool auto_size() const noexcept;
407 virtual drawing::color back_color() const noexcept;
415 virtual
control& back_color(const
xtd::drawing::color& color);
417 virtual
control& back_color(std::nullptr_t);
423 virtual const
xtd::drawing::image& background_image() const noexcept;
428 virtual
control& background_image(const
xtd::drawing::image& background_image);
447 virtual
int32 bottom() const noexcept;
452 virtual drawing::rectangle bounds() const noexcept;
457 virtual
control& bounds(const
xtd::drawing::rectangle& bounds);
462 virtual
bool can_focus() const noexcept;
475 virtual
bool can_select() const noexcept;
479 bool can_raise_events() const noexcept override;
485 virtual const drawing::rectangle& client_rectangle() const noexcept;
490 virtual const drawing::
size& client_size() const noexcept;
499 virtual
xtd::
string company_name() const noexcept;
544 virtual
bool created() const noexcept;
561 virtual drawing::rectangle display_rectangle() const noexcept;
585 virtual
bool double_buffered() const noexcept;
589 virtual
control& double_buffered(
bool double_buffered);
593 virtual
bool enabled() const noexcept;
601 virtual
bool focused() const noexcept;
606 virtual drawing::font font() const noexcept;
613 virtual
control& font(std::nullptr_t);
619 virtual drawing::color fore_color() const noexcept;
624 virtual
control& fore_color(const
xtd::drawing::color& color);
626 virtual
control& fore_color(std::nullptr_t);
636 virtual
int32 height() const noexcept;
644 bool invoke_required() const noexcept override;
649 bool is_handle_created() const noexcept;
653 virtual
int32 left() const noexcept;
661 virtual drawing::point location() const noexcept;
665 virtual
control& location(const
xtd::drawing::point& location);
680 virtual const drawing::
size& maximum_client_size() const noexcept;
693 virtual const drawing::
size& maximum_size() const noexcept;
706 virtual const drawing::
size& minimum_client_size() const noexcept;
719 virtual const drawing::
size& minimum_size() const noexcept;
734 virtual const
xtd::
string& name() const noexcept;
762 virtual
xtd::
string product_name() const noexcept;
766 bool recreating_handle() const noexcept;
772 virtual const
xtd::drawing::region& region() const noexcept;
782 virtual
int32 right() const noexcept;
832 virtual style_sheets::style_sheet style_sheet() const noexcept;
836 virtual
control& style_sheet(const style_sheets::style_sheet& value);
852 virtual
bool tab_stop() const noexcept;
864 virtual std::any tag() const noexcept;
874 virtual const
xtd::
string& text() const noexcept;
899 virtual
bool visible() const noexcept;
907 virtual
int32 width() const noexcept;
921 static
bool check_for_illegal_cross_thread_calls() noexcept;
926 static
void check_for_illegal_cross_thread_calls(
bool value);
940 static
xtd::drawing::point mouse_position() noexcept;
956 xtd::
async_result begin_invoke(delegate<
void(std::vector<std::any>)> method, const std::vector<std::any>& args) override;
960 virtual
void bring_to_front();
962 int32 compare_to(const
control& value) const noexcept override;
967 void create_control();
972 drawing::graphics create_graphics() const;
978 virtual
void destroy_control();
984 using
object::equals;
985 bool equals(const
control& value) const noexcept override;
998 std::
optional<
xtd::drawing::color> get_back_color() const noexcept;
1003 std::
optional<
xtd::drawing::font> get_font() const noexcept;
1008 std::
optional<
xtd::drawing::color> get_fore_color() const noexcept;
1020 size_t get_child_index(
intptr child,
bool& throw_exception) const;
1024 virtual
void hide();
1028 virtual
void invalidate() const;
1033 virtual
void invalidate(
bool invalidate_children) const;
1038 virtual
void invalidate(const drawing::rectangle& rect) const;
1044 virtual
void invalidate(const drawing::rectangle& rect,
bool invalidate_children) const;
1049 virtual
void invalidate(const drawing::region& region) const;
1055 virtual
void invalidate(const drawing::region& region,
bool invalidate_children) const;
1064 std::
optional<
object_ref> invoke(delegate<
void(std::vector<std::any>)> method, const std::vector<std::any>& args) override;
1072 void perform_layout();
1077 xtd::drawing::point point_to_client(const
xtd::drawing::point& p) const;
1082 xtd::drawing::point point_to_screen(const
xtd::drawing::point& p) const;
1101 virtual
void refresh() const;
1107 void resume_layout();
1115 void resume_layout(
bool perform_layout);
1146 virtual
void show();
1153 void suspend_layout();
1157 xtd::
string to_string() const noexcept override;
1165 virtual
void update() const;
1193 static
control create(const drawing::point& location);
1204 static
control create(const drawing::point& location, const drawing::
size&
size, const
xtd::
string& name);
1231 template<typename control_t>
1232 static control_t create() {
1233 auto result = control_t {};
1239 template<
typename control_t>
1241 auto result = control_t {};
1249 template<
typename control_t>
1251 auto result = control_t {};
1261 template<
typename control_t>
1263 auto result = control_t {};
1272 template<
typename control_t>
1274 auto result = control_t {};
1275 result.parent(parent);
1282 template<
typename control_t>
1284 auto result = control_t {};
1285 result.parent(parent);
1294 template<
typename control_t>
1296 auto result = control_t {};
1297 result.parent(parent);
1308 template<
typename control_t>
1310 auto result = control_t {};
1311 result.parent(parent);
1320 template<
typename control_t>
1322 auto result = control_t {};
1330 template<
typename control_t>
1332 auto result = control_t {};
1342 template<
typename control_t>
1344 auto result = control_t {};
1356 template<
typename control_t>
1358 auto result = control_t {};
1369 template<
typename control_t>
1371 auto result = control_t {};
1372 result.parent(parent);
1381 template<
typename control_t>
1383 auto result = control_t {};
1384 result.parent(parent);
1395 template<
typename control_t>
1397 auto result = control_t {};
1398 result.parent(parent);
1411 template<
typename control_t>
1413 auto result = control_t {};
1414 result.parent(parent);
1885 virtual drawing::color default_back_color() const noexcept;
1893 virtual drawing::font default_font() const noexcept;
1897 virtual drawing::color default_fore_color() const noexcept;
1901 virtual drawing::
size default_size() const noexcept;
1917 virtual
void create_handle();
1922 virtual
void destroy_handle();
1936 virtual drawing::
size measure_control() const noexcept;
1940 drawing::
size measure_text() const noexcept;
1956 virtual
void on_background_image_layout_changed(const
event_args& e);
1980 virtual
void on_create_control();
1988 virtual
void on_destroy_control();
2159 void post_recreate_handle() noexcept;
2163 virtual
void recreate_handle();
2180 void set_can_focus(
bool value);
2185 virtual
void set_text(const
xtd::
string& text);
2224 bool get_state(
control::state flag) const noexcept;
2225 void set_state(
control::state flag,
bool value);
2230 void do_layout_children_with_dock_style();
2231 void do_layout_with_auto_size_mode();
2232 void do_layout_with_anchor_styles();
2233 static
bool is_trace_form_or_control(const
string& name);
2234 void on_controls_item_added(
size_t,
control_ref item);
2235 void on_controls_item_removed(
size_t,
control_ref item);
2236 void on_parent_size_changed(
object& sender, const
event_args& e);
2273 static
bool check_for_illegal_cross_thread_calls_;
Contains xtd::forms::anchor_styles enum class.
Contains xtd::forms::layout::arranged_element_collection collection.
Contains xtd::forms::auto_size_mode enum class.
Contains xtd::forms::bounds_specified enum class.
Represents text as a sequence of character units.
Definition basic_string.h:79
Represents an ordered pair of integer x- and y-coordinates that defines a point in a two-dimensional ...
Definition point.h:54
Stores an ordered pair of integers, which specify a height and width.
Definition size.h:31
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 event.
Definition event.h:21
Represents the status of an asynchronous operation.
Definition iasync_result.h:25
Supports cloning, which creates a new instance of a class with the same value as an existing instance...
Definition iclonable.h:21
Defines a generalized comparison method that a value type or class implements to create a type-specif...
Definition icomparable.h:21
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.h:22
Provides a way to synchronously or asynchronously execute a delegate.
Definition isynchronize_invoke.h:26
Encapsulates operating system specific objects that wait for exclusive access to shared resources.
Definition wait_handle.h:52
Contains xtd::forms::component class.
Contains xtd::forms::const_control_ref typedef.
Contains xtd::forms::control_appearance enum class.
Contains xtd::forms::control_event_handler event handler.
Contains xtd::forms::control_ref typedef.
Contains xtd::forms::visual_styles::control_state enum class.
Contains xtd::forms::control_styles enum class.
Contains xtd::forms::dock_style enum class.
#define forms_export_
Define shared library export.
Definition forms_export.h:13
std::optional< type_t > optional
Represents the null_opt alias on std::nullopt_t.
Definition optional.h:181
int32_t int32
Represents a 32-bit signed integer.
Definition int32.h:23
int64_t int64
Represents a 64-bit signed integer.
Definition int64.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
intmax_t intptr
Represent a pointer or a handle.
Definition intptr.h:23
std::shared_ptr< type_t > sptr
The xtd::sptr object is a shared pointer.
Definition sptr.h:25
xtd::sptr< xtd::iasync_result > async_result
Represents the status of an asynchronous operation.
Definition async_result.h:19
std::reference_wrapper< object > object_ref
Represents an object reference.
Definition object_ref.h:20
@ insert
The INS (INSERT) key.
Contains xtd::forms::help_event_handler event handler.
Contains xtd::forms::image_layout enum class.
Contains xtd::forms::iwin32_window interface.
Contains xtd::forms::key_event_handler event handler.
Contains xtd::forms::key_press_event_handler event handler.
Contains xtd::forms::message class.
Contains xtd::forms::mouse_event_handler event handler.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
Contains xtd::forms::paint_event_handler event handler.
Contains xtd::forms::right_to_left enum class.
Contains xtd::forms::style_sheets::style_sheet class.
Contains xtd::forms::style_sheets::padding alias.