xtd 1.0.0
Loading...
Searching...
No Matches
control.hpp
Go to the documentation of this file.
1
4#pragma once
5#include "../forms_export.hpp"
7#include "anchor_styles.hpp"
8#include "auto_size_mode.hpp"
10#include "component.hpp"
11#include "const_control_ref.hpp"
12#include "context_menu.hpp"
15#include "control_ref.hpp"
16#include "control_styles.hpp"
17#include "create_params.hpp"
18#include "cursors.hpp"
19#include "dock_style.hpp"
21#include "image_layout.hpp"
22#include "iwin32_window.hpp"
23#include "key_event_handler.hpp"
25#include "message.hpp"
27#include "padding.hpp"
29#include "right_to_left.hpp"
30#include "timer.hpp"
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>
38#include <xtd/any>
39#include <xtd/async_result>
40#include <xtd/optional>
41#include <xtd/iequatable>
42#include <xtd/isynchronize_invoke>
43#include <cstdint>
44#include <functional>
45#include <map>
46#include <memory>
47#include <string>
48#include <vector>
49
51namespace xtd {
53 namespace forms {
55 class application;
56 class context_menu;
58 class form;
59 class screen;
61
63
82 struct data;
83
84 protected:
86 enum class state : xtd::int64 {
87 empty = 0,
88 creating = 0b1,
89 created = 0b10,
90 destroying = 0b100,
91 destroyed = 0b1000,
92 creating_handle = 0b10000,
93 recreate = 0b100000,
94 parent_recreating = 0b1000000,
95
96 client_size_setted = 0b10000000,
97 modal = 0b100000000,
98 top_level = 0b1000000000,
99 visible = 0b10000000000,
100 enabled = 0b100000000000,
101 auto_size = 0b1000000000000,
102 tab_stop = 0b10000000000000,
103 allow_drop = 0b100000000000000,
104 drop_target = 0b1000000000000000,
105
106 layout_deferred = 0b10000000000000000,
107 docked = 0b100000000000000000,
108
109 double_click_fired = 0b1000000000000000000,
110 double_buffered = 0b10000000000000000000,
111
112 mouse_enter_pending = 0b100000000000000000000,
113 tracking_mouse_event = 0b1000000000000000000000,
114 mouse_pressed = 0b10000000000000000000000,
115 use_wait_cursor = 0b100000000000000000000000,
116
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,
128 };
129
130 class async_result_invoke : public xtd::iasync_result {
131 struct data;
132 public:
133 explicit async_result_invoke(const xtd::any_object& async_state);
134 [[nodiscard]] auto async_state() const noexcept -> xtd::any_object override;
135 [[nodiscard]] auto async_wait_handle() noexcept -> xtd::threading::wait_handle& override;
136 [[nodiscard]] auto completed_synchronously() const noexcept -> bool override;
137 [[nodiscard]] auto is_completed() const noexcept -> bool override;
138
139 xtd::sptr<data> data_;
140 };
142
143 public:
145
150
153 public:
155
160
162
166 explicit control_collection() = default;
168
170 explicit control_collection(const base& collection);
171 control_collection(const control_collection& collection);
172 control_collection& operator =(const control_collection& collection);
175
177
179 using base::operator [];
180 using base::operator ();
185 [[nodiscard]] auto operator [](const xtd::string& name) const -> value_type;
190 [[nodiscard]] auto operator [](const xtd::string& name) -> value_type;
195 [[nodiscard]] auto operator ()(const xtd::string& name) const -> value_type;
200 [[nodiscard]] auto operator ()(const xtd::string& name) -> value_type;
202
204
206 auto add(const xtd::forms::control_ref& value) -> void override;
207
208 template<typename control_t>
209 auto add(control_t& value) -> void {
210 base::add(value);
211 }
212
220 template<typename control_t>
221 auto add_new() -> control_t& {return insert_new<control_t>(count());}
230 template<typename control_t, typename ...args_t>
231 auto add_new(args_t&& ...args) -> control_t& {return insert_new<control_t>(count(), std::forward<args_t>(args)...);}
232
233 auto insert(xtd::usize index, const xtd::forms::control_ref& value) -> void override;
234
235 template<typename control_t>
236 auto insert(xtd::usize index, control_t& value) -> void {
237 base::insert(index, value);
238 }
239
249 template<typename control_t>
250 auto insert_new(xtd::usize index) -> control_t& {
252 controls_.add(control);
254 return *control;
255 }
256
265 template<typename control_t, typename ...args_t>
266 auto insert_new(xtd::usize index, args_t&& ...args) -> control_t& {
267 auto control = xtd::new_sptr<control_t>(control_t::create(std::forward<args_t>(args)...));
269 controls_.add(control);
271 return *control;
272 }
273
274
276
278 using arranged_element_collection::push_back;
279 template<typename control_t>
280 [[deprecated("Replaced by xtd::forms::control::control_collection::add - Will be removed in version 1.2.0.")]]
281 auto push_back(control_t& value) -> void {add(value);}
283
284 protected:
286
290 for (auto i = xtd::usize {0}; i < controls_.count(); ++i) {
291 if (controls_[i].get() != &item.get()) continue;
292 controls_.remove_at(i);
293 break;
294 }
295 }
296
297
298 private:
301
303 };
304
306
315 explicit control(const xtd::string& text);
342
344 control(control&& rhs) = default;
345 auto operator = (control&&) -> control& = default;
346 control(const control& rhs) = delete;
347 auto operator = (const control&) -> control& = delete;
348 ~control();
350
352
361 [[nodiscard]] virtual auto anchor() const noexcept -> xtd::forms::anchor_styles;
371 virtual auto anchor(xtd::forms::anchor_styles value) -> control&;
372
375 [[nodiscard]] virtual auto auto_scroll_point() const noexcept -> xtd::drawing::point;
376
380 [[nodiscard]] virtual auto auto_size() const noexcept -> bool;
385 virtual auto auto_size(bool value) -> control&;
386
391 [[nodiscard]] virtual auto back_color() const noexcept -> xtd::drawing::color;
399 virtual auto back_color(const xtd::drawing::color& value) -> control&;
404
408 [[nodiscard]] virtual auto background_image() const noexcept -> const xtd::drawing::image&;
413 virtual auto background_image(const xtd::drawing::image& value) -> control&;
414
419 [[nodiscard]] virtual auto background_image_layout() const noexcept -> xtd::forms::image_layout;
426
431 [[nodiscard]] virtual auto bottom() const noexcept -> xtd::int32;
432
436 [[nodiscard]] virtual auto bounds() const noexcept -> xtd::drawing::rectangle;
441 virtual auto bounds(const xtd::drawing::rectangle& value) -> control&;
442
446 [[nodiscard]] virtual auto can_focus() const noexcept -> bool;
447
459 [[nodiscard]] virtual auto can_select() const noexcept -> bool;
460
463 [[nodiscard]] auto can_raise_events() const noexcept -> bool override;
464
469 [[nodiscard]] virtual auto client_rectangle() const noexcept -> const xtd::drawing::rectangle&;
470
474 [[nodiscard]] virtual auto client_size() const noexcept -> const xtd::drawing::size&;
479 virtual auto client_size(const xtd::drawing::size& value) -> control&;
480
483 [[nodiscard]] virtual auto company_name() const noexcept -> xtd::string;
484
487 [[nodiscard]] virtual auto context_menu() const noexcept -> std::optional<context_menu_ref>;
491 virtual auto context_menu(xtd::forms::context_menu& value) -> control&;
495 virtual auto context_menu(xtd::null_ptr) -> control&;
496
502 [[nodiscard]] virtual auto control_appearance() const noexcept -> xtd::forms::control_appearance;
509
516 [[nodiscard]] virtual auto controls() noexcept -> control_collection&;
523 [[nodiscard]] virtual auto controls() const noexcept -> const control_collection&;
524
528 [[nodiscard]] virtual auto created() const noexcept -> bool;
529
533 [[nodiscard]] virtual auto cursor() const noexcept -> xtd::forms::cursor;
538 virtual auto cursor(const xtd::forms::cursor& value) -> control&;
543
546 [[nodiscard]] virtual auto display_rectangle() const noexcept -> xtd::drawing::rectangle;
547
556 [[nodiscard]] virtual auto dock() const noexcept -> xtd::forms::dock_style;
566 virtual auto dock(xtd::forms::dock_style value) -> control&;
567
570 [[nodiscard]] virtual auto double_buffered() const noexcept -> bool;
574 virtual auto double_buffered(bool value) -> control&;
575
578 [[nodiscard]] virtual auto enabled() const noexcept -> bool;
582 virtual auto enabled(bool value) -> control&;
583
586 [[nodiscard]] virtual auto focused() const noexcept -> bool;
587
591 [[nodiscard]] virtual auto font() const noexcept -> xtd::drawing::font;
596 virtual auto font(const xtd::drawing::font& value) -> control&;
600 virtual auto font(xtd::null_ptr) -> control&;
601
605 [[nodiscard]] virtual auto fore_color() const noexcept -> xtd::drawing::color;
610 virtual auto fore_color(const xtd::drawing::color& value) -> control&;
615
619 [[nodiscard]] auto handle() const -> xtd::intptr override;
620
623 [[nodiscard]] virtual auto height() const noexcept -> xtd::int32;
627 virtual auto height(xtd::int32 value) -> control&;
628
631 [[nodiscard]] auto invoke_required() const noexcept -> bool override;
632
636 [[nodiscard]] auto is_handle_created() const noexcept -> bool;
637
640 [[nodiscard]] virtual auto left() const noexcept -> xtd::int32;
644 virtual auto left(xtd::int32 value) -> control&;
645
648 [[nodiscard]] virtual auto location() const noexcept -> xtd::drawing::point;
652 virtual auto location(const xtd::drawing::point& value) -> control&;
653
656 [[nodiscard]] virtual auto margin() const noexcept -> xtd::forms::padding;
660 virtual auto margin(const xtd::forms::padding& value) -> control&;
661
667 [[nodiscard]] virtual auto maximum_client_size() const noexcept -> const xtd::drawing::size&;
674
680 [[nodiscard]] virtual auto maximum_size() const noexcept -> const xtd::drawing::size&;
686 virtual auto maximum_size(const xtd::drawing::size& value) -> control&;
687
693 [[nodiscard]] virtual auto minimum_client_size() const noexcept -> const xtd::drawing::size&;
699 virtual auto minimum_client_size(const xtd::drawing::size& value) -> control&;
700
706 [[nodiscard]] virtual auto minimum_size() const noexcept -> const xtd::drawing::size&;
712 virtual auto minimum_size(const xtd::drawing::size& value) -> control&;
713
717 [[nodiscard]] auto native_handle() const noexcept -> xtd::intptr;
718
721 [[nodiscard]] virtual auto name() const noexcept -> const xtd::string&;
725 virtual auto name(const xtd::string& value) -> control&;
726
729 [[nodiscard]] virtual auto padding() const noexcept -> xtd::forms::padding;
733 virtual auto padding(const xtd::forms::padding& value) -> control&;
734
737 [[nodiscard]] virtual auto parent() const noexcept -> std::optional<xtd::forms::control_ref>;
741 virtual auto parent(const control& value) -> control&;
746
749 [[nodiscard]] virtual auto product_name() const noexcept -> xtd::string;
750
753 [[nodiscard]] auto recreating_handle() const noexcept -> bool;
754
759 [[nodiscard]] virtual auto region() const noexcept -> const xtd::drawing::region&;
765 virtual auto region(const xtd::drawing::region& value) -> control&;
766
769 [[nodiscard]] virtual auto right() const noexcept -> xtd::int32;
770
786 [[nodiscard]] virtual auto right_to_left() const noexcept -> xtd::forms::right_to_left;
808
811 [[nodiscard]] virtual auto size() const noexcept -> xtd::drawing::size;
815 virtual auto size(const xtd::drawing::size& value) -> control&;
816
820 [[nodiscard]] virtual auto style_sheet() const noexcept -> xtd::forms::style_sheets::style_sheet;
824 virtual auto style_sheet(const xtd::forms::style_sheets::style_sheet& value) -> control&;
829 virtual auto style_sheet(const xtd::string& value) -> control&;
834 virtual auto style_sheet(xtd::null_ptr) -> control&;
835
840 [[nodiscard]] virtual auto tab_stop() const noexcept -> bool;
846 virtual auto tab_stop(bool value) -> control&;
847
852 [[nodiscard]] virtual auto tag() const noexcept -> const xtd::any_object&;
858 virtual auto tag(const xtd::any_object& value) -> control&;
859
862 [[nodiscard]] virtual auto text() const noexcept -> const xtd::string&;
866 virtual auto text(const xtd::string& value) -> control&;
867
871 [[nodiscard]] auto toolkit_handle() const noexcept -> xtd::intptr;
872
875 [[nodiscard]] virtual auto top() const noexcept -> xtd::int32;
879 virtual auto top(xtd::int32 value) -> control&;
880
883 [[nodiscard]] virtual auto top_level_control() const noexcept -> std::optional<xtd::forms::control_ref>;
884
887 [[nodiscard]] virtual auto visible() const noexcept -> bool;
891 virtual auto visible(bool value) -> control&;
892
895 [[nodiscard]] virtual auto width() const noexcept -> xtd::int32;
899 virtual auto width(xtd::int32 value) -> control&;
901
903
909 [[nodiscard]] static auto check_for_illegal_cross_thread_calls() noexcept -> bool;
914 static auto check_for_illegal_cross_thread_calls(bool value) -> void;
915
918 [[nodiscard]] static auto modifier_keys() noexcept -> xtd::forms::keys;
919
922 [[nodiscard]] static auto mouse_buttons() noexcept -> xtd::forms::mouse_buttons;
923
928 static auto mouse_position() noexcept -> xtd::drawing::point;
930
932
938 [[nodiscard]] auto begin_invoke(xtd::delegate<void()> method) -> xtd::async_result override;
939
944 [[nodiscard]] auto begin_invoke(xtd::delegate<void(xtd::array<xtd::any_object>)> method, const xtd::array<xtd::any_object>& args) -> xtd::async_result override;
945
948 virtual auto bring_to_front() -> void;
949
950 [[nodiscard]] auto compare_to(const control& value) const noexcept -> xtd::int32 override;
951
956
960 [[nodiscard]] auto create_graphics() const -> xtd::drawing::graphics;
961
966 virtual auto destroy_control() -> void;
967
970 [[nodiscard]] auto end_invoke(xtd::async_result async) -> std::optional<xtd::object_ref> override;
971
975 [[nodiscard]] auto equals(const xtd::object& obj) const noexcept -> bool override;
979 [[nodiscard]] auto equals(const control& value) const noexcept -> bool override;
980
984 auto focus() -> bool;
985
988 [[nodiscard]] auto get_auto_size_mode() const -> xtd::forms::auto_size_mode;
989
992 [[nodiscard]] auto get_back_color() const noexcept -> std::optional<xtd::drawing::color>;
994
997 [[nodiscard]] auto get_font() const noexcept -> std::optional<xtd::drawing::font>;
999
1002 [[nodiscard]] auto get_fore_color() const noexcept -> std::optional<xtd::drawing::color>;
1004
1009 [[nodiscard]] auto get_child_index(xtd::intptr child) const -> xtd::usize;
1010
1014 [[nodiscard]] auto get_child_index(xtd::intptr child, bool& throw_exception) const -> xtd::usize;
1015
1018 [[nodiscard]] auto get_hash_code() const noexcept -> xtd::usize override;
1019
1022 virtual auto hide() -> void;
1023
1026 virtual auto invalidate() const -> void;
1027
1031 virtual auto invalidate(bool invalidate_children) const -> void;
1032
1036 virtual auto invalidate(const xtd::drawing::rectangle& rect) const -> void;
1037
1042 virtual auto invalidate(const xtd::drawing::rectangle& rect, bool invalidate_children) const -> void;
1043
1047 virtual auto invalidate(const xtd::drawing::region& region) const -> void;
1048
1053 virtual auto invalidate(const xtd::drawing::region& region, bool invalidate_children) const -> void;
1054
1058 auto invoke(xtd::delegate<void()> method) -> std::optional<xtd::object_ref> override;
1062 auto invoke(xtd::delegate<void(xtd::array<xtd::any_object>)> method, const xtd::array<xtd::any_object>& args) -> std::optional<xtd::object_ref> override;
1066 auto invoke(xtd::delegate<void(xtd::array<xtd::any_object>)> method, const xtd::any_object& arg) -> std::optional<xtd::object_ref> override;
1067
1071
1075 [[nodiscard]] auto point_to_client(const xtd::drawing::point& p) const -> xtd::drawing::point;
1076
1080 [[nodiscard]] auto point_to_screen(const xtd::drawing::point& p) const -> xtd::drawing::point;
1081
1088 auto post_message(xtd::intptr hwnd, xtd::int32 msg, xtd::intptr wparam, xtd::intptr lparam) const -> bool;
1089
1095
1099 virtual auto refresh() const -> void;
1100
1106
1114
1121 auto send_message(xtd::intptr hwnd, xtd::int32 msg, xtd::intptr wparam, xtd::intptr lparam) const -> xtd::intptr;
1122
1126
1133
1141
1144 virtual auto show() -> void;
1145
1152
1155 [[nodiscard]] auto to_string() const noexcept -> xtd::string override;
1156
1163 virtual auto update() const -> void;
1165
1167
1173 auto operator <<(control& child) -> control&;
1174
1179 auto operator >>(control& child) -> control&;
1181
1183
1187 [[nodiscard]] static auto create() -> control;
1191 [[nodiscard]] static auto create(const xtd::drawing::point& location) -> control;
1196 [[nodiscard]] static auto create(const xtd::drawing::point& location, const xtd::drawing::size& size) -> control;
1202 [[nodiscard]] static auto create(const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> control;
1206 [[nodiscard]] static auto create(const control& paren) -> control;
1213 [[nodiscard]] static auto create(const control& parent, const xtd::drawing::point& location) -> control;
1219 [[nodiscard]] static auto create(const control& parent, const xtd::drawing::point& location, const xtd::drawing::size& size) -> control;
1226 [[nodiscard]] static auto create(const control& parent, const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> control;
1229 template<typename control_t>
1230 [[nodiscard]] static auto create() -> control_t {
1231 auto result = control_t {};
1232 return result;
1233 }
1234
1237 template<typename control_t>
1238 [[nodiscard]] static auto create(const xtd::drawing::point& location) -> control_t {
1239 auto result = control_t {};
1240 result.location(location);
1241 return result;
1242 }
1243
1247 template<typename control_t>
1248 [[nodiscard]] static auto create(const xtd::drawing::point& location, const xtd::drawing::size& size) -> control_t {
1249 auto result = control_t {};
1250 result.location(location);
1251 result.size(size);
1252 return result;
1253 }
1254
1259 template<typename control_t>
1260 [[nodiscard]] static auto create(const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> control_t {
1261 auto result = control_t {};
1262 result.location(location);
1263 result.size(size);
1264 result.name(name);
1265 return result;
1266 }
1267
1270 template<typename control_t>
1271 [[nodiscard]] static auto create(const control& parent) -> control_t {
1272 auto result = control_t {};
1273 result.parent(parent);
1274 return result;
1275 }
1276
1280 template<typename control_t>
1281 [[nodiscard]] static auto create(const control& parent, const xtd::drawing::point& location) -> control_t {
1282 auto result = control_t {};
1283 result.parent(parent);
1284 result.location(location);
1285 return result;
1286 }
1287
1292 template<typename control_t>
1293 [[nodiscard]] static auto create(const control& parent, const xtd::drawing::point& location, const xtd::drawing::size& size) -> control_t {
1294 auto result = control_t {};
1295 result.parent(parent);
1296 result.location(location);
1297 result.size(size);
1298 return result;
1299 }
1300
1306 template<typename control_t>
1307 [[nodiscard]] static auto create(const control& parent, const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> control_t {
1308 auto result = control_t {};
1309 result.parent(parent);
1310 result.location(location);
1311 result.size(size);
1312 result.name(name);
1313 return result;
1314 }
1315
1318 template<typename control_t>
1319 [[nodiscard]] static auto create(const xtd::string& text) -> control_t {
1320 auto result = control_t {};
1321 result.text(text);
1322 return result;
1323 }
1324
1328 template<typename control_t>
1329 [[nodiscard]] static auto create(const xtd::string& text, const xtd::drawing::point& location) -> control_t {
1330 auto result = control_t {};
1331 result.text(text);
1332 result.location(location);
1333 return result;
1334 }
1335
1340 template<typename control_t>
1341 [[nodiscard]] static auto create(const xtd::string& text, const xtd::drawing::point& location, const xtd::drawing::size& size) -> control_t {
1342 auto result = control_t {};
1343 result.text(text);
1344 result.location(location);
1345 result.size(size);
1346 return result;
1347 }
1348
1354 template<typename control_t>
1355 [[nodiscard]] static auto create(const xtd::string& text, const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> control_t {
1356 auto result = control_t {};
1357 result.text(text);
1358 result.location(location);
1359 result.size(size);
1360 result.name(name);
1361 return result;
1362 }
1363
1367 template<typename control_t>
1368 [[nodiscard]] static auto create(const control& parent, const xtd::string& text) -> control_t {
1369 auto result = control_t {};
1370 result.parent(parent);
1371 result.text(text);
1372 return result;
1373 }
1374
1379 template<typename control_t>
1380 [[nodiscard]] static auto create(const control& parent, const xtd::string& text, const xtd::drawing::point& location) -> control_t {
1381 auto result = control_t {};
1382 result.parent(parent);
1383 result.text(text);
1384 result.location(location);
1385 return result;
1386 }
1387
1393 template<typename control_t>
1394 [[nodiscard]] static auto create(const control& parent, const xtd::string& text, const xtd::drawing::point& location, const xtd::drawing::size& size) -> control_t {
1395 auto result = control_t {};
1396 result.parent(parent);
1397 result.text(text);
1398 result.location(location);
1399 result.size(size);
1400 return result;
1401 }
1402
1409 template<typename control_t>
1410 [[nodiscard]] static auto create(const control& parent, const xtd::string& text, const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> control_t {
1411 auto result = control_t {};
1412 result.parent(parent);
1413 result.text(text);
1414 result.location(location);
1415 result.size(size);
1416 result.name(name);
1417 return result;
1418 }
1419
1424 [[nodiscard]] static auto from_child_handle(xtd::intptr handle) -> std::optional<xtd::forms::control_ref>;
1425
1429 [[nodiscard]] static auto from_handle(xtd::intptr handle) -> std::optional<xtd::forms::control_ref>;
1431
1433
1439
1444
1449
1454
1459
1484
1489
1494
1498
1502
1507
1531
1552
1557
1562
1567
1572
1577
1582
1594
1608
1620
1625
1630
1652
1668
1688
1702
1716
1731
1745
1759
1773
1788
1792
1801
1806
1811
1820
1825
1830
1835
1840
1845
1850
1856
1857 protected:
1858 friend class application;
1859 friend class context_menu;
1860 friend class horizontal_layout_panel;
1861 friend class form;
1862 friend class paint_event_args;
1863 friend class screen;
1864 friend class vertical_layout_panel;
1865 friend class style_sheets::style_sheet;
1866
1868
1872 [[nodiscard]] auto control_state() const noexcept -> xtd::forms::visual_styles::control_state;
1873
1879 [[nodiscard]] virtual auto create_params() const noexcept -> xtd::forms::create_params;
1880
1884 [[nodiscard]] virtual auto default_back_color() const noexcept -> xtd::drawing::color;
1885
1888 [[nodiscard]] virtual auto default_cursor() const noexcept -> xtd::forms::cursor;
1889
1892 [[nodiscard]] virtual auto default_font() const noexcept -> xtd::drawing::font;
1893
1896 [[nodiscard]] virtual auto default_fore_color() const noexcept -> xtd::drawing::color;
1897
1900 [[nodiscard]] virtual auto default_size() const noexcept -> xtd::drawing::size;
1902
1904
1910 virtual auto create_handle() -> void;
1911
1915 virtual auto destroy_handle() -> void;
1916
1920
1925 [[nodiscard]] auto get_style(xtd::forms::control_styles flag) const noexcept -> bool;
1926
1929 [[nodiscard]] virtual auto measure_control() const noexcept -> xtd::drawing::size;
1930
1933 [[nodiscard]] auto measure_text() const noexcept -> xtd::drawing::size;
1934
1937 virtual auto on_auto_size_changed(const xtd::event_args& e) -> void;
1938
1941 virtual auto on_back_color_changed(const xtd::event_args& e) -> void;
1942
1946
1950
1954
1957 virtual auto on_click(const xtd::event_args& e) -> void;
1958
1961 virtual auto on_client_size_changed(const xtd::event_args& e) -> void;
1962
1965 virtual auto on_control_added(const xtd::forms::control_event_args& e) -> void;
1966
1970
1973 virtual auto on_create_control() -> void;
1974
1977 virtual auto on_cursor_changed(const xtd::event_args& e) -> void;
1978
1981 virtual auto on_destroy_control() -> void;
1982
1985 virtual auto on_dock_changed(const xtd::event_args& e) -> void;
1986
1989 virtual auto on_double_click(const xtd::event_args& e) -> void;
1990
1993 virtual auto on_enabled_changed(const xtd::event_args& e) -> void;
1994
1997 virtual auto on_fore_color_changed(const xtd::event_args& e) -> void;
1998
2001 virtual auto on_font_changed(const xtd::event_args& e) -> void;
2002
2005 virtual auto on_got_focus(const xtd::event_args& e) -> void;
2006
2009 virtual auto on_handle_created(const xtd::event_args& e) -> void;
2010
2013 virtual auto on_handle_destroyed(const xtd::event_args& e) -> void;
2014
2018
2021 virtual auto on_key_down(xtd::forms::key_event_args& e) -> void;
2022
2026
2029 virtual auto on_key_up(xtd::forms::key_event_args& e) -> void;
2030
2033 virtual auto on_layout(const xtd::event_args& e) -> void;
2034
2037 virtual auto on_location_changed(const xtd::event_args& e) -> void;
2038
2041 virtual auto on_lost_focus(const xtd::event_args& e) -> void;
2042
2045 virtual auto on_mouse_click(const xtd::forms::mouse_event_args& e) -> void;
2046
2050
2053 virtual auto on_mouse_down(const xtd::forms::mouse_event_args& e) -> void;
2054
2057 virtual auto on_mouse_enter(const xtd::event_args& e) -> void;
2058
2062
2065 virtual auto on_mouse_leave(const xtd::event_args& e) -> void;
2066
2069 virtual auto on_mouse_move(const xtd::forms::mouse_event_args& e) -> void;
2070
2073 virtual auto on_mouse_up(const xtd::forms::mouse_event_args& e) -> void;
2074
2077 virtual auto on_mouse_wheel(const xtd::forms::mouse_event_args& e) -> void;
2078
2081 virtual auto on_move(const xtd::event_args& e) -> void;
2082
2085 virtual auto on_paint(xtd::forms::paint_event_args& e) -> void;
2086
2090 virtual auto on_paint_background(xtd::forms::paint_event_args& e) -> void;
2091
2095
2098 virtual auto on_parent_cursor_changed(const xtd::event_args& e) -> void;
2099
2102 virtual auto on_parent_changed(const xtd::event_args& e) -> void;
2103
2106 virtual auto on_parent_enabled_changed(const xtd::event_args& e) -> void;
2107
2111
2114 virtual auto on_parent_font_changed(const xtd::event_args& e) -> void;
2115
2118 virtual auto on_resize(const xtd::event_args& e) -> void;
2119
2122 virtual auto on_region_changed(const xtd::event_args& e) -> void;
2123
2126 virtual auto on_right_to_left_changed(const xtd::event_args& e) -> void;
2127
2130 virtual auto on_size_changed(const xtd::event_args& e) -> void;
2131
2134 virtual auto on_style_sheet_changed(const xtd::event_args& e) -> void;
2135
2138 virtual auto on_system_colors_changed(const xtd::event_args& e) -> void;
2139
2142 virtual auto on_tab_stop_changed(const xtd::event_args& e) -> void;
2143
2146 virtual auto on_text_changed(const xtd::event_args& e) -> void;
2147
2150 virtual auto on_visible_changed(const xtd::event_args& e) -> void;
2151
2152 auto post_recreate_handle() noexcept -> void;
2153
2156 virtual auto recreate_handle() -> void;
2157
2169
2173 auto set_can_focus(bool value) -> void;
2174
2178 virtual auto set_text(const xtd::string& text) -> void;
2179
2188
2192
2198 auto set_style(xtd::forms::control_styles flag, bool value) -> void;
2199
2205 virtual auto wnd_proc(xtd::forms::message& m) -> void;
2207
2209
2215
2217 [[nodiscard]] auto get_state(control::state flag) const noexcept -> bool;
2218 auto set_state(control::state flag, bool value) -> void;
2219 auto on_context_menu_item_click(xtd::forms::context_menu& menu, intptr menu_id) const -> bool;
2221
2222 private:
2223 auto do_layout_children_with_dock_style() -> void;
2224 auto do_layout_with_auto_size_mode() -> void;
2225 auto do_layout_with_anchor_styles() -> void;
2226 [[nodiscard]] static auto is_trace_form_or_control(const string& name) -> bool;
2227 auto on_parent_size_changed(xtd::object& sender, const xtd::event_args& e) -> void;
2228 auto show_context_menu(xtd::forms::context_menu& menu, const xtd::drawing::point& pos) const -> void;
2229 auto reflect_message(xtd::intptr handle, xtd::forms::message& message) -> void;
2230 [[nodiscard]] auto wnd_proc_(xtd::intptr hwnd, xtd::uint32 msg, xtd::intptr wparam, xtd::intptr lparam, xtd::intptr handle) -> xtd::intptr;
2231 auto wm_app_idle(xtd::forms::message& message) -> void;
2232 auto wm_child_activate(xtd::forms::message& message) -> void;
2233 auto wm_command(xtd::forms::message& message) -> void;
2234 auto wm_command_control(xtd::forms::message& message) -> void;
2235 auto wm_ctlcolor(xtd::forms::message& message) -> void;
2236 auto wm_ctlcolor_control(xtd::forms::message& message) -> void;
2237 auto wm_create(xtd::forms::message& message) -> void;
2238 auto wm_destroy(xtd::forms::message& message) -> void;
2239 auto wm_key_char(xtd::forms::message& message) -> void;
2240 auto wm_kill_focus(xtd::forms::message& message) -> void;
2241 auto wm_menu_command(xtd::forms::message& message) -> void;
2242 auto wm_mouse_down(xtd::forms::message& message) -> void;
2243 auto wm_mouse_double_click(xtd::forms::message& message) -> void;
2244 auto wm_mouse_enter(xtd::forms::message& message) -> void;
2245 auto wm_mouse_leave(xtd::forms::message& message) -> void;
2246 auto wm_mouse_up(xtd::forms::message& message) -> void;
2247 auto wm_mouse_move(xtd::forms::message& message) -> void;
2248 auto wm_move(xtd::forms::message& message) -> void;
2249 auto wm_mouse_wheel(xtd::forms::message& message) -> void;
2250 auto wm_notify(xtd::forms::message& message) -> void;
2251 auto wm_notify_control(xtd::forms::message& message) -> void;
2252 auto wm_paint(xtd::forms::message& message) -> void;
2253 auto wm_erase_background(xtd::forms::message& message) -> void;
2254 auto wm_help(xtd::forms::message& message) -> void;
2255 auto wm_scroll(xtd::forms::message& message) -> void;
2256 auto wm_scroll_control(xtd::forms::message& message) -> void;
2257 auto wm_set_focus(xtd::forms::message& message) -> void;
2258 auto wm_set_text(xtd::forms::message& message) -> void;
2259 auto wm_show(xtd::forms::message& message) -> void;
2260 auto wm_size(xtd::forms::message& message) -> void;
2261 auto wm_sizing(xtd::forms::message& message) -> void;
2262 auto wm_style_sheet_changed(xtd::forms::message& message) -> void;
2263
2264 static bool check_for_illegal_cross_thread_calls_;
2265 static xtd::forms::keys modifier_keys_;
2266 static xtd::forms::mouse_buttons mouse_buttons_;
2267 static std::map<xtd::intptr, control*> handles_;
2268 static control_collection top_level_controls_;
2269
2270 xtd::sptr<data> data_;
2271 };
2272 }
2273}
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.
Represent a polymorphic wrapper capable of holding any type.
Definition any_object.hpp:30
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition array.hpp:64
Represents a strongly typed list of objects that can be accessed by index. Provides methods to search...
Definition list.hpp:84
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition event_args.hpp:18
Represents an event.
Definition event.hpp:23
Provides static methods and properties to manage an application, such as methods to start and stop an...
Definition application.hpp:54
Provides the base implementation and enables object sharing between applications.
Definition component.hpp:26
Represents a shortcut menu.
Definition context_menu.hpp:35
Represents a collection of controls.
Definition control.hpp:152
auto add_new() -> control_t &
Creates and adds a control to the end.
Definition control.hpp:221
auto add_new(args_t &&...args) -> control_t &
Creates and adds a control to the end.
Definition control.hpp:231
auto insert_new(xtd::usize index) -> control_t &
Creates and inserts specified control at specified position.
Definition control.hpp:250
control_collection()=default
Creates a new object xtd::forms::control::control_collection with specified allocator (optional).
auto push_back(control_t &value) -> void
Definition control.hpp:281
xtd::forms::layout::arranged_element_collection< xtd::forms::control_ref > base
Represents the base type of the collection.
Definition control.hpp:158
auto insert_new(xtd::usize index, args_t &&...args) -> control_t &
Creates and inserts specified control at specified position.
Definition control.hpp:266
auto on_item_removed(xtd::usize index, xtd::forms::control_ref &item) -> void override
Raises the xtd::forms::layout::arranged_element_collection::item_removed event.
Definition control.hpp:288
auto insert(xtd::usize index, const xtd::forms::control_ref &value) -> void override
Inserts specified element at specified index.
Provides data for the xtd::forms::control::control_added and xtd::forms::control::control_removed eve...
Definition control_event_args.hpp:27
control(const control &parent, const xtd::string &text)
Initializes a new instance of the xtd::forms::control class as a child control, with specific text.
xtd::event< control, xtd::event_handler > background_image_layout_changed
Occurs when the value of the xtd::forms::control::background_image_layout property changes.
Definition control.hpp:1453
virtual auto invalidate() const -> void
Invalidates the entire surface of the control and causes the control to be redrawn.
virtual auto destroy_handle() -> void
Destroys the handle associated with the control.
auto to_string() const noexcept -> xtd::string override
Returns a string containing the name of the control, if any.
static auto mouse_buttons() noexcept -> xtd::forms::mouse_buttons
Gets a value indicating which of the mouse buttons is in a pressed state.
friend class form
The form data allows you to specify the box of a form control.
Definition control.hpp:1861
virtual auto on_size_changed(const xtd::event_args &e) -> void
Raises the xtd::forms::control::size_changed event.
static auto create(const control &parent) -> control_t
A factory to create a specified control with specified parent.
Definition control.hpp:1271
virtual auto default_fore_color() const noexcept -> xtd::drawing::color
Gets the default foreground color of the control.
virtual auto on_parent_back_color_changed(const xtd::event_args &e) -> void
Raises the xtd::forms::control::parent_back_color_changed event.
virtual auto on_mouse_up(const xtd::forms::mouse_event_args &e) -> void
Raises the xtd::forms::control::mouse_up event.
auto get_hash_code() const noexcept -> xtd::usize override
Serves as a hash function for a particular type.
virtual auto on_fore_color_changed(const xtd::event_args &e) -> void
Raises the xtd::forms::control::fore_color_changed event.
auto handle() const -> xtd::intptr override
Gets the window handle that the control is bound to.
virtual auto can_focus() const noexcept -> bool
Gets a value indicating whether the control can receive focus.
virtual auto on_double_click(const xtd::event_args &e) -> void
Raises the xtd::forms::control::double_click event.
virtual auto set_client_size_core(xtd::int32 width, xtd::int32 height) -> void
Sets the size of the client area of the control.
virtual auto on_region_changed(const xtd::event_args &e) -> void
Raises the xtd::forms::control::region_changed event.
virtual auto refresh() const -> void
Forces the control to invalidate its client area and immediately redraw itself and any child controls...
auto create_graphics() const -> xtd::drawing::graphics
Creates the xtd::drawing::graphics for the control.
static auto create(const xtd::drawing::point &location, const xtd::drawing::size &size) -> control_t
A factory to create a specified control with specified location, and size.
Definition control.hpp:1248
virtual auto on_visible_changed(const xtd::event_args &e) -> void
Raises the xtd::forms::control::visible_changed event.
virtual auto size() const noexcept -> xtd::drawing::size
Gets the height and width of the control.
xtd::event< control, xtd::event_handler > handle_created
Occurs when a handle is created for the xtd::forms::control.
Definition control.hpp:1556
xtd::event< control, xtd::event_handler > lost_focus
Occurs when the xtd::forms::control loses focus.
Definition control.hpp:1651
static auto create(const xtd::string &text, const xtd::drawing::point &location) -> control_t
A factory to create a specified control with specified text, and location.
Definition control.hpp:1329
virtual auto on_back_color_changed(const xtd::event_args &e) -> void
Raises the xtd::forms::control::back_color_changed event.
virtual auto focused() const noexcept -> bool
Gets a value indicating whether the control has input focus.
virtual auto on_create_control() -> void
Raises the xtd::forms::control::create_control event.
virtual auto on_mouse_horizontal_wheel(const xtd::forms::mouse_event_args &e) -> void
Raises the xtd::forms::control::mouse_horizontal_wheel event.
auto set_can_focus(bool value) -> void
Sets a value indicating whether the control can receive focus.
auto toolkit_handle() const noexcept -> xtd::intptr
Gets the toolkit handle that the control is bound to.
virtual auto width() const noexcept -> xtd::int32
Gets the width of the control.
virtual auto on_system_colors_changed(const xtd::event_args &e) -> void
Raises the control::system_colors_changed event.
virtual auto enabled() const noexcept -> bool
Gets a value indicating whether the control can respond to user interaction.
virtual auto on_parent_changed(const xtd::event_args &e) -> void
Raises the xtd::forms::control::parent_changed event.
virtual auto bring_to_front() -> void
Brings the control to the front of the z-order.
virtual auto on_mouse_move(const xtd::forms::mouse_event_args &e) -> void
Raises the xtd::forms::control::mouse_move event.
static auto from_child_handle(xtd::intptr handle) -> std::optional< xtd::forms::control_ref >
Retrieves the control that contains the specified handle.
virtual auto destroy_control() -> void
Forces the destruction of the visible control, including the destruction of the handle and any visibl...
auto begin_invoke(xtd::delegate< void()> method) -> xtd::async_result override
Executes the specified delegate asynchronously on the thread that the control's underlying handle was...
virtual auto font() const noexcept -> xtd::drawing::font
Gets the font of the text displayed by the control.
virtual auto company_name() const noexcept -> xtd::string
Gets the name of the company or creator of the application containing the control.
xtd::event< control, xtd::event_handler > visible_changed
Occurs when the value of the xtd::forms::control::visible property changes.
Definition control.hpp:1854
virtual auto update() const -> void
Causes the control to redraw the invalidated regions within its client area.
xtd::event< control, xtd::event_handler > size_changed
Occurs when the value of the xtd::forms::control::size property changes.
Definition control.hpp:1829
static auto create(const control &parent, const xtd::drawing::point &location, const xtd::drawing::size &size) -> control_t
A factory to create a specified control with specified parent, location, and size.
Definition control.hpp:1293
xtd::event< control, xtd::forms::mouse_event_handler > mouse_double_click
Occurs when the xtd::forms::control is double clicked by the mouse.
Definition control.hpp:1687
xtd::event< control, xtd::forms::mouse_event_handler > mouse_wheel
Occurs when the mouse wheel moves while the xtd::forms::control has focus.
Definition control.hpp:1787
xtd::event< control, xtd::forms::key_press_event_handler > key_press
Occurs when a character. space or backspace key is pressed while the xtd::forms::control has focus.
Definition control.hpp:1607
xtd::event< control, xtd::event_handler > region_changed
Occurs when the value of the xtd::forms::control::region property changes.
Definition control.hpp:1810
virtual auto on_paint_background(xtd::forms::paint_event_args &e) -> void
Paints the background of the xtd::forms::control.
static auto create(const control &parent, const xtd::drawing::point &location) -> control_t
A factory to create a specified control with specified parent, and location.
Definition control.hpp:1281
virtual auto right_to_left() const noexcept -> xtd::forms::right_to_left
Gets a value indicating whether control's elements are aligned to support locales using right-to-left...
auto equals(const xtd::object &obj) const noexcept -> bool override
Determines whether the specified object is equal to the current object.
virtual auto control_appearance() const noexcept -> xtd::forms::control_appearance
Gets control appearance.
xtd::event< control, xtd::event_handler > mouse_leave
Occurs when the mouse pointer leaves the xtd::forms::control.
Definition control.hpp:1744
control(const xtd::string &text)
Initializes a new instance of the xtd::forms::control class with specific text.
xtd::event< control, xtd::event_handler > location_changed
Occurs when the value of the xtd::forms::control::location property changes.
Definition control.hpp:1629
virtual auto on_key_up(xtd::forms::key_event_args &e) -> void
Raises the xtd::forms::control::key_up event.
virtual auto parent() const noexcept -> std::optional< xtd::forms::control_ref >
Gets the parent container of the control.
xtd::event< control, xtd::event_handler > style_sheet_changed
Occurs when the value of the xtd::forms::control::style_sheet property changes or when xtd::applicati...
Definition control.hpp:1834
auto set_auto_size_mode(xtd::forms::auto_size_mode auto_size_mode) -> void
Sets a value indicating how a control will behave when its auto_size property is enabled.
virtual auto on_help_requested(xtd::forms::help_event_args &e) -> void
Raises the xtd::forms::control::help_requested event.
auto get_child_index(xtd::intptr child) const -> xtd::usize
Retrieves the index of a control within the control collection.
auto native_handle() const noexcept -> xtd::intptr
Gets the native handle that the control is bound to.
virtual auto on_handle_created(const xtd::event_args &e) -> void
Raises the xtd::forms::control::handle_created event.
auto get_auto_size_mode() const -> xtd::forms::auto_size_mode
Gets a value indicating how a control will behave when its auto_size property is enabled.
virtual auto on_background_image_changed(const xtd::event_args &e) -> void
Raises the xtd::forms::control::background_image_changed event.
static auto create(const control &parent, const xtd::drawing::point &location, const xtd::drawing::size &size, const xtd::string &name) -> control_t
A factory to create a specified control with specified parent, location, size, and name.
Definition control.hpp:1307
virtual auto bottom() const noexcept -> xtd::int32
Gets the distance, in pixels, between the bottom edge of the control and the top edge of its containe...
xtd::event< control, xtd::event_handler > move
Occurs when the control is moved.
Definition control.hpp:1791
virtual auto on_mouse_wheel(const xtd::forms::mouse_event_args &e) -> void
Raises the xtd::forms::control::mouse_wheel event.
virtual auto on_control_appearance_changed(const xtd::event_args &e) -> void
Raises the control::control_appearance_changed event.
virtual auto top_level_control() const noexcept -> std::optional< xtd::forms::control_ref >
Gets the parent control that is not parented by another Windows Forms control. Typically,...
virtual auto recreate_handle() -> void
Forces the re-creation of the handle for the control.
virtual auto wnd_proc(xtd::forms::message &m) -> void
Processes Windows messages.
virtual auto background_image_layout() const noexcept -> xtd::forms::image_layout
Gets the background image layout as defined in the xtd::forms::image_layout enumeration.
auto is_handle_created() const noexcept -> bool
Gets a value indicating whether the control has a handle associated with it.
static auto check_for_illegal_cross_thread_calls() noexcept -> bool
Gets a value indicating whether to catch calls on the wrong thread that access a xtd::forms::contrtol...
virtual auto product_name() const noexcept -> xtd::string
Gets the product name of the assembly containing the control.
xtd::event< control, xtd::event_handler > cursor_changed
Occurs when the value of the xtd::forms::control::cursor property changes.
Definition control.hpp:1493
virtual auto maximum_size() const noexcept -> const xtd::drawing::size &
Gets the size that is the upper limit that xtd::forms::control::get_preferred_size can specify.
xtd::event< control, xtd::event_handler > tab_stop_changed
Occurs when the xtd::forms::control::tab_stop property value changes.
Definition control.hpp:1844
auto invoke(xtd::delegate< void()> method) -> std::optional< xtd::object_ref > override
Executes the specified delegate on the thread that owns the control's underlying window handle.
virtual auto on_resize(const xtd::event_args &e) -> void
Raises the xtd::forms::control::region event.
virtual auto on_enabled_changed(const xtd::event_args &e) -> void
Raises the xtd::forms::control::enabled_changed event.
xtd::ref< xtd::forms::context_menu > context_menu_ref
Represent an xtd::forms::context_menu reference.
Definition control.hpp:148
virtual auto tag() const noexcept -> const xtd::any_object &
Gets the object that contains data about the control.
virtual auto on_text_changed(const xtd::event_args &e) -> void
Raises the xtd::forms::control::text_changed event.
virtual auto back_color() const noexcept -> xtd::drawing::color
Gets the background color for the control.
static auto create(const xtd::string &text, const xtd::drawing::point &location, const xtd::drawing::size &size, const xtd::string &name) -> control_t
A factory to create a specified control with specified text, location,size, and name.
Definition control.hpp:1355
auto perform_layout() -> void
Forces the control to apply layout logic to all its child controls.
virtual auto right() const noexcept -> xtd::int32
Gets the distance, in pixels, between the right edge of the control and the left edge of its containe...
virtual auto measure_control() const noexcept -> xtd::drawing::size
Measure this control.
static auto create(const control &parent, const xtd::string &text, const xtd::drawing::point &location, const xtd::drawing::size &size, const xtd::string &name) -> control_t
A factory to create a specified control with specified parent, text, location, size,...
Definition control.hpp:1410
virtual auto on_right_to_left_changed(const xtd::event_args &e) -> void
Raises the xtd::forms::control::right_to_left_changed event.
static auto create(const control &parent, const xtd::string &text, const xtd::drawing::point &location, const xtd::drawing::size &size) -> control_t
A factory to create a specified control with specified parent, text, location, and size.
Definition control.hpp:1394
virtual auto client_rectangle() const noexcept -> const xtd::drawing::rectangle &
Gets the rectangle that represents the client area of the control.
auto invoke_required() const noexcept -> bool override
Gets a value indicating whether the caller must call an invoke method when making method calls to the...
virtual auto on_click(const xtd::event_args &e) -> void
Raises the xtd::forms::control::click event.
xtd::event< control, xtd::event_handler > layout
Occurs when a xtd::forms::control should reposition its child controls.
Definition control.hpp:1624
virtual auto on_dock_changed(const xtd::event_args &e) -> void
Raises the xtd::forms::control::dock_changed event.
virtual auto default_cursor() const noexcept -> xtd::forms::cursor
Gets the default cursor for the control.
xtd::event< control, xtd::event_handler > parent_changed
Occurs when the value of the xtd::forms::control::parent property changes.
Definition control.hpp:1805
static auto create(const xtd::string &text, const xtd::drawing::point &location, const xtd::drawing::size &size) -> control_t
A factory to create a specified control with specified text, location, and size.
Definition control.hpp:1341
virtual auto on_mouse_leave(const xtd::event_args &e) -> void
Raises the xtd::forms::control::mouse_leave event.
virtual auto text() const noexcept -> const xtd::string &
Gets the text associated with this control.
virtual auto auto_size() const noexcept -> bool
Gets a value that indicates whether the control resizes based on its contents.
virtual auto on_mouse_double_click(const xtd::forms::mouse_event_args &e) -> void
Raises the xtd::forms::control::mouse_double_click event.
virtual auto on_lost_focus(const xtd::event_args &e) -> void
Raises the xtd::forms::control::lost_focus event.
virtual auto set_text(const xtd::string &text) -> void
Sets the text associated with this control.
virtual auto on_cursor_changed(const xtd::event_args &e) -> void
Raises the xtd::forms::control::cursor_changed event.
static auto create(const control &parent, const xtd::string &text, const xtd::drawing::point &location) -> control_t
A factory to create a specified control with specified parent, text, and location.
Definition control.hpp:1380
virtual auto on_destroy_control() -> void
Raises the xtd::forms::control::destroy_control event.
virtual auto name() const noexcept -> const xtd::string &
Gets the name of the control.
control()
Initializes a new instance of the xtd::forms::control class with default settings.
virtual auto pre_process_message(const xtd::forms::message &message) -> bool
Preprocesses keyboard or input messages within the message loop before they are dispatched.
virtual auto maximum_client_size() const noexcept -> const xtd::drawing::size &
Gets the client size that is the upper limit that xtd::forms::control::get_preferred_size can specify...
virtual auto on_key_down(xtd::forms::key_event_args &e) -> void
Raises the xtd::forms::control::key_down event.
xtd::event< control, xtd::forms::mouse_event_handler > mouse_horizontal_wheel
Occurs when the mouse horizontal wheel moves while the xtd::forms::control has focus.
Definition control.hpp:1730
virtual auto auto_scroll_point() const noexcept -> xtd::drawing::point
Gets where this control is scrolled to in scroll_control_into_view(control).
static auto modifier_keys() noexcept -> xtd::forms::keys
Gets a value indicating which of the modifier keys (SHIFT, CTRL, and ALT) is in a pressed state.
virtual auto on_handle_destroyed(const xtd::event_args &e) -> void
Raises the xtd::forms::control::handle_destroyed event.
virtual auto on_style_sheet_changed(const xtd::event_args &e) -> void
Raises the xtd::forms::control::style_sheet_changed event.
virtual auto cursor() const noexcept -> xtd::forms::cursor
Gets the cursor that is displayed when the mouse pointer is over the control.
virtual auto def_wnd_proc(xtd::forms::message &message) -> void
Sends the specified message to the default window procedure.
xtd::event< control, xtd::event_handler > client_size_changed
Occurs when the value of the xtd::forms::control::client_size property changes.
Definition control.hpp:1488
xtd::event< control, xtd::event_handler > mouse_enter
Occurs when the mouse pointer enters the xtd::forms::control.
Definition control.hpp:1715
virtual auto left() const noexcept -> xtd::int32
Gets the distance, in pixels, between the left edge of the control and the left edge of its container...
virtual auto on_parent_cursor_changed(const xtd::event_args &e) -> void
Raises the xtd::forms::control::parent_cursor_changed event.
static auto from_handle(xtd::intptr handle) -> std::optional< xtd::forms::control_ref >
Returns the control that is currently associated with the specified handle.
virtual auto minimum_size() const noexcept -> const xtd::drawing::size &
Gets the size that is the lower limit that xtd::forms::control::get_preferred_size can specify.
static auto create(const xtd::drawing::point &location) -> control_t
A factory to create a specified control with specified location.
Definition control.hpp:1238
virtual auto on_mouse_down(const xtd::forms::mouse_event_args &e) -> void
Raises the xtd::forms::control::mouse_down event.
virtual auto location() const noexcept -> xtd::drawing::point
Gets the coordinates of the upper-left corner of the control relative to the upper-left corner of its...
virtual auto on_tab_stop_changed(const xtd::event_args &e) -> void
Raises the xtd::forms::control::tab_stop_changed event.
xtd::event< control, xtd::event_handler > control_appearance_changed
Occurs when the value of the xtd::forms::control::control_appearance property changes.
Definition control.hpp:1458
auto set_bounds(xtd::int32 x, xtd::int32 y, xtd::int32 width, xtd::int32 height) -> void
Sets the bounds of the control to the specified location and size.
auto point_to_screen(const xtd::drawing::point &p) const -> xtd::drawing::point
Computes the location of the specified client point into screen coordinates.
virtual auto on_move(const xtd::event_args &e) -> void
Raises the xtd::forms::control::move event.
xtd::event< control, xtd::event_handler > resize
Occurs when the xtd::forms::control is resized.
Definition control.hpp:1819
xtd::event< control, xtd::forms::key_event_handler > key_down
Occurs when a key is pressed while the xtd::forms::control has focus.
Definition control.hpp:1593
xtd::event< control, xtd::forms::help_event_handler > help_requested
Occurs when the user requests help for a xtd::forms::control.
Definition control.hpp:1581
virtual auto height() const noexcept -> xtd::int32
Gets the height of the control.
static auto mouse_position() noexcept -> xtd::drawing::point
Gets the position of the mouse cursor in screen coordinates.
virtual auto on_parent_font_changed(const xtd::event_args &e) -> void
Raises the xtd::forms::control::parent_font_changed event.
virtual auto on_location_changed(const xtd::event_args &e) -> void
Raises the xtd::forms::control::location_changed event.
virtual auto on_font_changed(const xtd::event_args &e) -> void
Raises the xtd::forms::control::font_changed event.
auto measure_text() const noexcept -> xtd::drawing::size
Measure this control text.
virtual auto set_bounds_core(xtd::int32 x, xtd::int32 y, xtd::int32 width, xtd::int32 height, xtd::forms::bounds_specified specified) -> void
Performs the work of setting the specified bounds of this control.
virtual auto region() const noexcept -> const xtd::drawing::region &
Gets the window region associated with the control.
virtual auto on_layout(const xtd::event_args &e) -> void
Raises the xtd::forms::control::layout event.
virtual auto on_got_focus(const xtd::event_args &e) -> void
Raises the xtd::forms::control::got_focus event.
auto end_invoke(xtd::async_result async) -> std::optional< xtd::object_ref > override
Retrieves the return value of the asynchronous operation represented by the async_result_invoke passe...
virtual auto display_rectangle() const noexcept -> xtd::drawing::rectangle
Gets the rectangle that represents the display area of the control.
virtual auto top() const noexcept -> xtd::int32
Gets the distance, in pixels, between the top edge of the control and the top edge of its container's...
virtual auto on_control_added(const xtd::forms::control_event_args &e) -> void
Raises the xtd::forms::control::control_added event.
auto can_raise_events() const noexcept -> bool override
Determines if events can be raised on the control.
xtd::event< control, xtd::event_handler > fore_color_changed
Occurs when the value of the xtd::forms::control::fore_color property changes.
Definition control.hpp:1571
xtd::event< control, xtd::event_handler > handle_destroyed
Occurs when the control's handle is in the process of being destroyed.
Definition control.hpp:1561
auto create_control() -> void
Forces the creation of the visible control, including the creation of the handle and any visible chil...
virtual auto fore_color() const noexcept -> xtd::drawing::color
Gets the foreground color of the control.
virtual auto on_client_size_changed(const xtd::event_args &e) -> void
Raises the xtd::forms::control::client_size_changed event.
virtual auto on_background_image_layout_changed(const xtd::event_args &e) -> void
Raises the xtd::forms::control::background_image_layout_changed event.
virtual auto margin() const noexcept -> xtd::forms::padding
Gets the space between controls.
virtual auto minimum_client_size() const noexcept -> const xtd::drawing::size &
Gets the client size that is the lower limit that xtd::forms::control::get_preferred_size can specify...
virtual auto show() -> void
Displays the control to the user.
xtd::event< control, xtd::event_handler > double_click
Occurs when the xtd::forms::control is double-clicked.
Definition control.hpp:1530
auto recreating_handle() const noexcept -> bool
Gets a value indicating whether the control is currently re-creating its handle.
auto post_message(xtd::intptr hwnd, xtd::int32 msg, xtd::intptr wparam, xtd::intptr lparam) const -> bool
Places (posts) a message in the message queue with specified hwnd, message, wparam and lparam.
xtd::event< control, xtd::event_handler > text_changed
Occurs when the value of the xtd::forms::control::text property changes.
Definition control.hpp:1849
static auto create(const control &parent, const xtd::string &text) -> control_t
A factory to create a specified control with specified parent, and text.
Definition control.hpp:1368
xtd::event< control, xtd::event_handler > click
Occurs when the xtd::forms::control is clicked.
Definition control.hpp:1483
xtd::event< control, xtd::event_handler > got_focus
Occurs when the xtd::forms::control receives focus.
Definition control.hpp:1551
virtual auto default_back_color() const noexcept -> xtd::drawing::color
Gets the default background color of the control.
xtd::event< control, xtd::forms::paint_event_handler > paint
Occurs when the xtd::forms::control is redrawn.
Definition control.hpp:1800
control(const control &parent, const xtd::string &text, int32 left, int32 top, int32 width, int32 height)
Initializes a new instance of the xtd::forms::control class as a child control, with specific text,...
xtd::event< control, xtd::forms::mouse_event_handler > mouse_click
Occurs when the xtd::forms::control is clicked by the mouse.
Definition control.hpp:1667
virtual auto on_parent_enabled_changed(const xtd::event_args &e) -> void
Raises the xtd::control::enabled_changed event when the xtd::control::enabled property value of the c...
virtual auto bounds() const noexcept -> xtd::drawing::rectangle
Gets the size and location of the control including its nonclient elements, in pixels,...
static auto create(const xtd::string &text) -> control_t
A factory to create a specified control with specified text.
Definition control.hpp:1319
auto suspend_layout() -> void
Temporarily suspends the layout logic for the control.
xtd::event< control, xtd::event_handler > font_changed
Occurs when the value of the xtd::forms::control::font property changes.
Definition control.hpp:1576
auto set_parent(xtd::intptr handle) -> void
Sets the parent handle of the control.
xtd::event< control, xtd::event_handler > dock_changed
Occurs when the value of the xtd::forms::control::dock property changes.
Definition control.hpp:1506
virtual auto on_key_press(xtd::forms::key_press_event_args &e) -> void
Raises the xtd::forms::control::key_press event.
static auto create(const xtd::drawing::point &location, const xtd::drawing::size &size, const xtd::string &name) -> control_t
A factory to create a specified control with specified location, size, and name.
Definition control.hpp:1260
virtual auto dock() const noexcept -> xtd::forms::dock_style
Gets which control borders are docked to its parent control and determines how a control is resized w...
virtual auto client_size() const noexcept -> const xtd::drawing::size &
Gets the height and width of the client area of the control.
virtual auto on_parent_fore_color_changed(const xtd::event_args &e) -> void
Raises the xtd::forms::control::parent_fore_color_changed event.
xtd::event< control, xtd::event_handler > system_colors_changed
Occurs when the xtd::drwing::system_colors changes.
Definition control.hpp:1839
auto point_to_client(const xtd::drawing::point &p) const -> xtd::drawing::point
Computes the location of the specified screen point into client coordinates.
virtual auto padding() const noexcept -> xtd::forms::padding
Gets padding within the control.
virtual auto on_mouse_enter(const xtd::event_args &e) -> void
Raises the xtd::forms::control::mouse_enter event.
virtual auto on_mouse_click(const xtd::forms::mouse_event_args &e) -> void
Raises the xtd::forms::control::mouse_click event.
static auto set_mouse_buttons(xtd::forms::mouse_buttons value) -> void
Sets a value indicating which of the mouse buttons is in a pressed state.
static auto create() -> control
A factory to create a specified control.
xtd::event< control, xtd::event_handler > background_image_changed
Occurs when the value of the xtd::forms::control::background_image property changes.
Definition control.hpp:1448
auto control_state() const noexcept -> xtd::forms::visual_styles::control_state
Gets state.
xtd::event< control, xtd::event_handler > auto_size_changed
Occurs when the value of the xtd::forms::control::auto_size property changes.
Definition control.hpp:1438
auto set_style(xtd::forms::control_styles flag, bool value) -> void
Sets a specified control_styles flag to either true or false.
virtual auto create_params() const noexcept -> xtd::forms::create_params
Gets the required creation parameters when the control handle is created.
control(const xtd::string &text, int32 left, int32 top, int32 width, int32 height)
Initializes a new instance of the control class with specific text, size, and location.
virtual auto created() const noexcept -> bool
Gets a value indicating whether the control has been created.
virtual auto anchor() const noexcept -> xtd::forms::anchor_styles
Gets the edges of the container to which a control is bound and determines how a control is resized w...
xtd::event< control, xtd::forms::control_event_handler > control_added
Occurs when a new xtd::forms::control::control is added to the xtd::forms::control::control_collectio...
Definition control.hpp:1497
xtd::event< control, xtd::event_handler > enabled_changed
Occurs when the value of the xtd::forms::control::enabled property changes.
Definition control.hpp:1566
xtd::event< control, xtd::forms::control_event_handler > control_removed
Occurs when a new xtd::forms::control:: is removed to the xtd::forms::control::control_collection.
Definition control.hpp:1501
xtd::event< control, xtd::forms::key_event_handler > key_up
Occurs when a key is released while the xtd::forms::control has focus.
Definition control.hpp:1619
virtual auto visible() const noexcept -> bool
Gets a value indicating whether the control and all its child controls are displayed.
virtual auto default_font() const noexcept -> xtd::drawing::font
Gets the default font of the control.
xtd::event< control, xtd::forms::mouse_event_handler > mouse_up
Occurs when the mouse pointer is over the xtd::forms::control and a mouse button is released.
Definition control.hpp:1772
auto focus() -> bool
Sets input focus to the control.
xtd::event< control, xtd::event_handler > right_to_left_changed
Occurs when the value of the xtd::forms::control::right_to_left property changes.
Definition control.hpp:1824
auto send_message(xtd::intptr hwnd, xtd::int32 msg, xtd::intptr wparam, xtd::intptr lparam) const -> xtd::intptr
Send a message with specified hwnd, message, wparam and lparam.
virtual auto on_control_removed(const xtd::forms::control_event_args &e) -> void
Raises the xtd::forms::control::control_removed event.
xtd::event< control, xtd::forms::mouse_event_handler > mouse_down
Occurs when the mouse pointer is over the xtd::forms::control and a mouse button is pressed.
Definition control.hpp:1701
virtual auto background_image() const noexcept -> const xtd::drawing::image &
Gets the background image displayed in the control.
virtual auto on_auto_size_changed(const xtd::event_args &e) -> void
Raises the xtd::forms::control::auto_size_changed event.
virtual auto can_select() const noexcept -> bool
Gets a value indicating whether the control can be selected.
virtual auto controls() noexcept -> control_collection &
Gets the collection of controls contained within the control.
xtd::event< control, xtd::forms::mouse_event_handler > mouse_move
Occurs when the mouse pointer is moved over the xtd::forms::control.
Definition control.hpp:1758
virtual auto tab_stop() const noexcept -> bool
Gets a value indicating whether the user can give the focus to this control using the TAB key.
virtual auto default_size() const noexcept -> xtd::drawing::size
Gets the default size of the control.
virtual auto hide() -> void
Conceals the control from the user.
auto resume_layout() -> void
Resumes usual layout logic.
auto get_style(xtd::forms::control_styles flag) const noexcept -> bool
Retrieves the value of the specified control style bit for the control.
xtd::event< control, xtd::event_handler > back_color_changed
Occurs when the value of the xtd::forms::control::back_color property changes.
Definition control.hpp:1443
virtual auto on_paint(xtd::forms::paint_event_args &e) -> void
Raises the xtd::forms::control::paint event.
virtual auto double_buffered() const noexcept -> bool
Gets a value indicating whether this control should redraw its surface using a secondary buffer to re...
virtual auto create_handle() -> void
Creates a handle for the control.
Represents a window or dialog box that makes up an application's user interface.
Definition form.hpp:54
Provides data for the xtd::forms::control::control_added and xtd::forms::control::control_removed eve...
Definition help_event_args.hpp:26
Used to group collections of horizontally aligned controls.
Definition horizontal_layout_panel.hpp:31
Provides an interface to expose Win32 HWND handles.
Definition iwin32_window.hpp:23
Provides data for the xtd::forms::control::key_down or xtd::forms::control::key_up event.
Definition key_event_args.hpp:25
Provides data for the xtd::forms::control::key_press event.
Definition key_press_event_args.hpp:26
Represents a collection of objects.
Definition arranged_element_collection.hpp:45
virtual auto on_item_removed(xtd::usize index, type_t &item) -> void
Raises the xtd::forms::layout::arranged_element_collection::item_removed event.
Definition arranged_element_collection.hpp:861
auto add(const xtd::forms::control_ref &item) -> void override
Definition arranged_element_collection.hpp:215
auto count() const noexcept -> size_type override
Definition arranged_element_collection.hpp:181
virtual auto insert(xtd::usize index, const xtd::forms::control_ref &value) -> void
Definition arranged_element_collection.hpp:328
Represents the base functionality for all menus. Although tool_strip_drop_down and tool_strip_drop_do...
Definition menu.hpp:37
Provides data for the xtd::forms::control::mouse_up, xtd::forms::control::mouse_down,...
Definition mouse_event_args.hpp:34
Represents a display device or multiple display devices on a single system.
Definition screen.hpp:32
The xtd::forms::style_sheets::style_sheet allows you to specify an xtd style sheet.
Definition style_sheet.hpp:64
Creates a use wait cursor class.
Definition use_wait_cursor.hpp:25
Used to group collections of vertically aligned controls.
Definition vertical_layout_panel.hpp:32
static auto throws(xtd::helpers::exception_case exception_case, const source_location &location=source_location::current()) -> void
Throws an exption with specified exception case.
Represents the status of an asynchronous operation.
Definition iasync_result.hpp:25
Defines a generalized comparison method that a value type or class implements to create a type-specif...
Definition icomparable.hpp:22
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:23
Provides a way to synchronously or asynchronously execute a delegate.
Definition isynchronize_invoke.hpp:27
Encapsulates operating system specific objects that wait for exclusive access to shared resources.
Definition wait_handle.hpp:52
Contains xtd::forms::component class.
Contains xtd::forms::const_control_ref typedef.
Contains xtd::forms::context_menu menu.
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::create_params class.
Contains xtd::forms::cursors factory.
auto() -> void
Signals a breakpoint to an attached debugger.
Definition debugger.hpp:75
Contains xtd::forms::dock_style enum class.
Contains forms_export_ keyword.
@ argument
The argument is not valid.
Definition exception_case.hpp:31
#define forms_export_
Define shared library export.
Definition forms_export.hpp:13
xtd::basic_string< char > string
Represents text as a sequence of UTF-8 code units.
Definition __string_definitions.hpp:43
std::int64_t int64
Represents a 64-bit signed integer.
Definition int64.hpp:23
std::uint32_t uint32
Represents a 32-bit unsigned integer.
Definition uint32.hpp:23
xtd::shared_ptr_object< type_t > sptr
The xtd::sptr object is a shared pointer.
Definition sptr.hpp:25
std::nullptr_t null_ptr
Represents the null_opt alias on std::nullptr_t.
Definition null_ptr.hpp:19
std::intmax_t intptr
Represent a pointer or a handle.
Definition intptr.hpp:23
std::int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:25
xtd::reference_wrapper_object< type_t > ref
The xtd::ref object is a reference wrapper.
Definition ref.hpp:25
std::optional< type_t > optional
Represents the optional alias on std::optional.
Definition optional.hpp:26
std::size_t usize
Represents an unsigned size of any object in bytes.
Definition usize.hpp:22
xtd::sptr< xtd::iasync_result > async_result
Represents the status of an asynchronous operation.
Definition async_result.hpp:19
xtd::ref< xtd::object > object_ref
Represents an object reference.
Definition object_ref.hpp:20
auto new_sptr(args_t &&... args) -> xtd::sptr< type_t >
xtd::new_sptr operator creates a xtd::sptr object.
Definition new_sptr.hpp:24
@ i
The I key.
Definition console_key.hpp:104
keys
Specifies key codes and modifiers.
Definition keys.hpp:77
bounds_specified
Specifies the bounds of the control to use when defining a control's size and position....
Definition bounds_specified.hpp:22
image_layout
Specifies the position of the image on the control.
Definition image_layout.hpp:21
control_styles
Specifies the style and behavior of a control.
Definition control_styles.hpp:33
auto_size_mode
Specifies how a control will behave when its auto_size property is enabled.
Definition auto_size_mode.hpp:22
dock_style
Specifies the position and manner in which a control is docked.
Definition dock_style.hpp:23
xtd::ref< xtd::forms::control > control_ref
Represents a control reference.
Definition control_ref.hpp:25
anchor_styles
Specifies how a control anchors to the edges of its container.
Definition anchor_styles.hpp:19
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::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition actions_system_images.hpp:10
The xtd::forms::style_sheets namespace contains various properties, states, and subcontrols that make...
Definition background_image.hpp:21
The xtd::forms::visual_styles namespace contains classes for rendering controls and other windows use...
Definition check_box_state.hpp:12
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition texts.hpp:219
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
constexpr auto data() const noexcept -> const_pointer
Gets direct access to the underlying contiguous storage.
Definition read_only_span.hpp:197
Contains xtd::forms::padding class.
Contains xtd::forms::paint_event_handler event handler.
Contains xtd::forms::right_to_left enum class.
Represents an ordered pair of integer x- and y-coordinates that defines a point in a two-dimensional ...
Definition point.hpp:54
Stores an ordered pair of integers, which specify a height and width.
Definition size.hpp:32
Implements a Windows message.
Definition message.hpp:33
Represents a type that can be used to index a collection either from the beginning or the end.
Definition index.hpp:38
Contains xtd::forms::style_sheets::style_sheet class.
Contains xtd::forms::timer component.