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 for (const auto& control : items())
211 if (control.get() == value) return;
212 base::add(value);
213 }
214
222 template<typename control_t>
223 auto add_new() -> control_t& {return insert_new<control_t>(count());}
232 template<typename control_t, typename ...args_t>
233 auto add_new(args_t&& ...args) -> control_t& {return insert_new<control_t>(count(), std::forward<args_t>(args)...);}
234
235 auto insert(xtd::usize index, const xtd::forms::control_ref& value) -> void override;
236
237 template<typename control_t>
238 auto insert(xtd::usize index, control_t& value) -> void {
239 for (const auto& control : items())
240 if (control.get() == value) return;
241 base::insert(index, value);
242 }
243
253 template<typename control_t>
254 auto insert_new(xtd::usize index) -> control_t& {
256 controls_.add(control);
258 return *control;
259 }
260
269 template<typename control_t, typename ...args_t>
270 auto insert_new(xtd::usize index, args_t&& ...args) -> control_t& {
271 auto control = xtd::new_sptr<control_t>(control_t::create(std::forward<args_t>(args)...));
273 controls_.add(control);
275 return *control;
276 }
277
278
280
282 using arranged_element_collection::push_back;
283 template<typename control_t>
284 [[deprecated("Replaced by xtd::forms::control::control_collection::add - Will be removed in version 1.2.0.")]]
285 auto push_back(control_t& value) -> void {add(value);}
287
288 protected:
290
294 for (auto i = xtd::usize {0}; i < controls_.count(); ++i) {
295 if (controls_[i].get() != &item.get()) continue;
296 controls_.remove_at(i);
297 break;
298 }
299 }
300
301
302 private:
305
307 };
308
310
319 explicit control(const xtd::string& text);
346
348 control(control&& rhs) = default;
349 auto operator = (control&&) -> control& = default;
350 control(const control& rhs) = delete;
351 auto operator = (const control&) -> control& = delete;
352 ~control();
354
356
365 [[nodiscard]] virtual auto anchor() const noexcept -> xtd::forms::anchor_styles;
375 virtual auto anchor(xtd::forms::anchor_styles value) -> control&;
376
379 [[nodiscard]] virtual auto auto_scroll_point() const noexcept -> xtd::drawing::point;
380
384 [[nodiscard]] virtual auto auto_size() const noexcept -> bool;
389 virtual auto auto_size(bool value) -> control&;
390
395 [[nodiscard]] virtual auto back_color() const noexcept -> xtd::drawing::color;
403 virtual auto back_color(const xtd::drawing::color& value) -> control&;
407 virtual auto back_color(xtd::null_ptr) -> control&;
408
412 [[nodiscard]] virtual auto background_image() const noexcept -> const xtd::drawing::image&;
417 virtual auto background_image(const xtd::drawing::image& value) -> control&;
418
423 [[nodiscard]] virtual auto background_image_layout() const noexcept -> xtd::forms::image_layout;
430
435 [[nodiscard]] virtual auto bottom() const noexcept -> xtd::int32;
436
440 [[nodiscard]] virtual auto bounds() const noexcept -> xtd::drawing::rectangle;
445 virtual auto bounds(const xtd::drawing::rectangle& value) -> control&;
446
450 [[nodiscard]] virtual auto can_focus() const noexcept -> bool;
451
463 [[nodiscard]] virtual auto can_select() const noexcept -> bool;
464
467 [[nodiscard]] auto can_raise_events() const noexcept -> bool override;
468
473 [[nodiscard]] virtual auto client_rectangle() const noexcept -> const xtd::drawing::rectangle&;
474
478 [[nodiscard]] virtual auto client_size() const noexcept -> const xtd::drawing::size&;
483 virtual auto client_size(const xtd::drawing::size& value) -> control&;
484
487 [[nodiscard]] virtual auto company_name() const noexcept -> xtd::string;
488
491 [[nodiscard]] virtual auto context_menu() const noexcept -> std::optional<context_menu_ref>;
495 virtual auto context_menu(xtd::forms::context_menu& value) -> control&;
499 virtual auto context_menu(xtd::null_ptr) -> control&;
500
506 [[nodiscard]] virtual auto control_appearance() const noexcept -> xtd::forms::control_appearance;
513
520 [[nodiscard]] virtual auto controls() noexcept -> control_collection&;
527 [[nodiscard]] virtual auto controls() const noexcept -> const control_collection&;
528
532 [[nodiscard]] virtual auto created() const noexcept -> bool;
533
537 [[nodiscard]] virtual auto cursor() const noexcept -> xtd::forms::cursor;
542 virtual auto cursor(const xtd::forms::cursor& value) -> control&;
546 virtual auto cursor(xtd::null_ptr) -> control&;
547
550 [[nodiscard]] virtual auto display_rectangle() const noexcept -> xtd::drawing::rectangle;
551
560 [[nodiscard]] virtual auto dock() const noexcept -> xtd::forms::dock_style;
570 virtual auto dock(xtd::forms::dock_style value) -> control&;
571
574 [[nodiscard]] virtual auto double_buffered() const noexcept -> bool;
578 virtual auto double_buffered(bool value) -> control&;
579
582 [[nodiscard]] virtual auto enabled() const noexcept -> bool;
586 virtual auto enabled(bool value) -> control&;
587
590 [[nodiscard]] virtual auto focused() const noexcept -> bool;
591
595 [[nodiscard]] virtual auto font() const noexcept -> xtd::drawing::font;
600 virtual auto font(const xtd::drawing::font& value) -> control&;
604 virtual auto font(xtd::null_ptr) -> control&;
605
609 [[nodiscard]] virtual auto fore_color() const noexcept -> xtd::drawing::color;
614 virtual auto fore_color(const xtd::drawing::color& value) -> control&;
618 virtual auto fore_color(xtd::null_ptr) -> control&;
619
623 [[nodiscard]] auto handle() const -> xtd::intptr override;
624
627 [[nodiscard]] virtual auto height() const noexcept -> xtd::int32;
631 virtual auto height(xtd::int32 value) -> control&;
632
635 [[nodiscard]] auto invoke_required() const noexcept -> bool override;
636
640 [[nodiscard]] auto is_handle_created() const noexcept -> bool;
641
644 [[nodiscard]] virtual auto left() const noexcept -> xtd::int32;
648 virtual auto left(xtd::int32 value) -> control&;
649
652 [[nodiscard]] virtual auto location() const noexcept -> xtd::drawing::point;
656 virtual auto location(const xtd::drawing::point& value) -> control&;
657
660 [[nodiscard]] virtual auto margin() const noexcept -> xtd::forms::padding;
664 virtual auto margin(const xtd::forms::padding& value) -> control&;
665
671 [[nodiscard]] virtual auto maximum_client_size() const noexcept -> const xtd::drawing::size&;
677 virtual auto maximum_client_size(const xtd::drawing::size& size) -> control&;
678
684 [[nodiscard]] virtual auto maximum_size() const noexcept -> const xtd::drawing::size&;
690 virtual auto maximum_size(const xtd::drawing::size& value) -> control&;
691
697 [[nodiscard]] virtual auto minimum_client_size() const noexcept -> const xtd::drawing::size&;
703 virtual auto minimum_client_size(const xtd::drawing::size& value) -> control&;
704
710 [[nodiscard]] virtual auto minimum_size() const noexcept -> const xtd::drawing::size&;
716 virtual auto minimum_size(const xtd::drawing::size& value) -> control&;
717
721 [[nodiscard]] auto native_handle() const noexcept -> xtd::intptr;
722
725 [[nodiscard]] virtual auto name() const noexcept -> const xtd::string&;
729 virtual auto name(const xtd::string& value) -> control&;
730
733 [[nodiscard]] virtual auto padding() const noexcept -> xtd::forms::padding;
737 virtual auto padding(const xtd::forms::padding& value) -> control&;
738
741 [[nodiscard]] virtual auto parent() const noexcept -> std::optional<xtd::forms::control_ref>;
745 virtual auto parent(const control& value) -> control&;
749 virtual auto parent(xtd::null_ptr) -> control&;
750
753 [[nodiscard]] virtual auto product_name() const noexcept -> xtd::string;
754
757 [[nodiscard]] auto recreating_handle() const noexcept -> bool;
758
763 [[nodiscard]] virtual auto region() const noexcept -> const xtd::drawing::region&;
769 virtual auto region(const xtd::drawing::region& value) -> control&;
770
773 [[nodiscard]] virtual auto right() const noexcept -> xtd::int32;
774
790 [[nodiscard]] virtual auto right_to_left() const noexcept -> xtd::forms::right_to_left;
807 virtual auto right_to_left(xtd::forms::right_to_left value) -> control&;
811 virtual auto right_to_left(xtd::null_ptr) -> control&;
812
815 [[nodiscard]] virtual auto size() const noexcept -> xtd::drawing::size;
819 virtual auto size(const xtd::drawing::size& value) -> control&;
820
824 [[nodiscard]] virtual auto style_sheet() const noexcept -> xtd::forms::style_sheets::style_sheet;
828 virtual auto style_sheet(const xtd::forms::style_sheets::style_sheet& value) -> control&;
833 virtual auto style_sheet(const xtd::string& value) -> control&;
838 virtual auto style_sheet(xtd::null_ptr) -> control&;
839
844 [[nodiscard]] virtual auto tab_stop() const noexcept -> bool;
850 virtual auto tab_stop(bool value) -> control&;
851
856 [[nodiscard]] virtual auto tag() const noexcept -> const xtd::any_object&;
862 virtual auto tag(const xtd::any_object& value) -> control&;
863
866 [[nodiscard]] virtual auto text() const noexcept -> const xtd::string&;
870 virtual auto text(const xtd::string& value) -> control&;
871
875 [[nodiscard]] auto toolkit_handle() const noexcept -> xtd::intptr;
876
879 [[nodiscard]] virtual auto top() const noexcept -> xtd::int32;
883 virtual auto top(xtd::int32 value) -> control&;
884
887 [[nodiscard]] virtual auto top_level_control() const noexcept -> std::optional<xtd::forms::control_ref>;
888
891 [[nodiscard]] virtual auto visible() const noexcept -> bool;
895 virtual auto visible(bool value) -> control&;
896
899 [[nodiscard]] virtual auto width() const noexcept -> xtd::int32;
903 virtual auto width(xtd::int32 value) -> control&;
905
907
913 [[nodiscard]] static auto check_for_illegal_cross_thread_calls() noexcept -> bool;
918 static auto check_for_illegal_cross_thread_calls(bool value) -> void;
919
922 [[nodiscard]] static auto modifier_keys() noexcept -> xtd::forms::keys;
923
926 [[nodiscard]] static auto mouse_buttons() noexcept -> xtd::forms::mouse_buttons;
927
932 static auto mouse_position() noexcept -> xtd::drawing::point;
934
936
942 [[nodiscard]] auto begin_invoke(xtd::delegate<void()> method) -> xtd::async_result override;
943
948 [[nodiscard]] auto begin_invoke(xtd::delegate<void(xtd::array<xtd::any_object>)> method, const xtd::array<xtd::any_object>& args) -> xtd::async_result override;
949
952 virtual auto bring_to_front() -> void;
953
954 [[nodiscard]] auto compare_to(const control& value) const noexcept -> xtd::int32 override;
955
959 auto create_control() -> void;
960
964 [[nodiscard]] auto create_graphics() const -> xtd::drawing::graphics;
965
970 virtual auto destroy_control() -> void;
971
974 [[nodiscard]] auto end_invoke(xtd::async_result async) -> std::optional<xtd::object_ref> override;
975
979 [[nodiscard]] auto equals(const xtd::object& obj) const noexcept -> bool override;
983 [[nodiscard]] auto equals(const control& value) const noexcept -> bool override;
984
988 auto focus() -> bool;
989
992 [[nodiscard]] auto get_auto_size_mode() const -> xtd::forms::auto_size_mode;
993
996 [[nodiscard]] auto get_back_color() const noexcept -> std::optional<xtd::drawing::color>;
998
1001 [[nodiscard]] auto get_font() const noexcept -> std::optional<xtd::drawing::font>;
1003
1006 [[nodiscard]] auto get_fore_color() const noexcept -> std::optional<xtd::drawing::color>;
1008
1013 [[nodiscard]] auto get_child_index(xtd::intptr child) const -> xtd::usize;
1014
1018 [[nodiscard]] auto get_child_index(xtd::intptr child, bool& throw_exception) const -> xtd::usize;
1019
1022 [[nodiscard]] auto get_hash_code() const noexcept -> xtd::usize override;
1023
1026 virtual auto hide() -> void;
1027
1030 virtual auto invalidate() const -> void;
1031
1035 virtual auto invalidate(bool invalidate_children) const -> void;
1036
1040 virtual auto invalidate(const xtd::drawing::rectangle& rect) const -> void;
1041
1046 virtual auto invalidate(const xtd::drawing::rectangle& rect, bool invalidate_children) const -> void;
1047
1051 virtual auto invalidate(const xtd::drawing::region& region) const -> void;
1052
1057 virtual auto invalidate(const xtd::drawing::region& region, bool invalidate_children) const -> void;
1058
1062 auto invoke(xtd::delegate<void()> method) -> std::optional<xtd::object_ref> override;
1066 auto invoke(xtd::delegate<void(xtd::array<xtd::any_object>)> method, const xtd::array<xtd::any_object>& args) -> std::optional<xtd::object_ref> override;
1070 auto invoke(xtd::delegate<void(xtd::array<xtd::any_object>)> method, const xtd::any_object& arg) -> std::optional<xtd::object_ref> override;
1071
1074 auto perform_layout() -> void;
1075
1079 [[nodiscard]] auto point_to_client(const xtd::drawing::point& p) const -> xtd::drawing::point;
1080
1084 [[nodiscard]] auto point_to_screen(const xtd::drawing::point& p) const -> xtd::drawing::point;
1085
1092 auto post_message(xtd::intptr hwnd, xtd::int32 msg, xtd::intptr wparam, xtd::intptr lparam) const -> bool;
1093
1098 virtual auto pre_process_message(const xtd::forms::message& message) -> bool;
1099
1103 virtual auto refresh() const -> void;
1104
1109 auto resume_layout() -> void;
1110
1117 auto resume_layout(bool perform_layout) -> void;
1118
1125 auto send_message(xtd::intptr hwnd, xtd::int32 msg, xtd::intptr wparam, xtd::intptr lparam) const -> xtd::intptr;
1126
1130
1137
1145
1148 virtual auto show() -> void;
1149
1155 auto suspend_layout() -> void;
1156
1159 [[nodiscard]] auto to_string() const noexcept -> xtd::string override;
1160
1167 virtual auto update() const -> void;
1169
1171
1177 auto operator <<(control& child) -> control&;
1178
1183 auto operator >>(control& child) -> control&;
1185
1187
1191 [[nodiscard]] static auto create() -> control;
1195 [[nodiscard]] static auto create(const xtd::drawing::point& location) -> control;
1200 [[nodiscard]] static auto create(const xtd::drawing::point& location, const xtd::drawing::size& size) -> control;
1206 [[nodiscard]] static auto create(const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> control;
1210 [[nodiscard]] static auto create(const control& paren) -> control;
1217 [[nodiscard]] static auto create(const control& parent, const xtd::drawing::point& location) -> control;
1223 [[nodiscard]] static auto create(const control& parent, const xtd::drawing::point& location, const xtd::drawing::size& size) -> control;
1230 [[nodiscard]] static auto create(const control& parent, const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> control;
1233 template<typename control_t>
1234 [[nodiscard]] static auto create() -> control_t {
1235 auto result = control_t {};
1236 return result;
1237 }
1238
1241 template<typename control_t>
1242 [[nodiscard]] static auto create(const xtd::drawing::point& location) -> control_t {
1243 auto result = control_t {};
1244 result.location(location);
1245 return result;
1246 }
1247
1251 template<typename control_t>
1252 [[nodiscard]] static auto create(const xtd::drawing::point& location, const xtd::drawing::size& size) -> control_t {
1253 auto result = control_t {};
1254 result.location(location);
1255 result.size(size);
1256 return result;
1257 }
1258
1263 template<typename control_t>
1264 [[nodiscard]] static auto create(const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> control_t {
1265 auto result = control_t {};
1266 result.location(location);
1267 result.size(size);
1268 result.name(name);
1269 return result;
1270 }
1271
1274 template<typename control_t>
1275 [[nodiscard]] static auto create(const control& parent) -> control_t {
1276 auto result = control_t {};
1277 result.parent(parent);
1278 return result;
1279 }
1280
1284 template<typename control_t>
1285 [[nodiscard]] static auto create(const control& parent, const xtd::drawing::point& location) -> control_t {
1286 auto result = control_t {};
1287 result.parent(parent);
1288 result.location(location);
1289 return result;
1290 }
1291
1296 template<typename control_t>
1297 [[nodiscard]] static auto create(const control& parent, const xtd::drawing::point& location, const xtd::drawing::size& size) -> control_t {
1298 auto result = control_t {};
1299 result.parent(parent);
1300 result.location(location);
1301 result.size(size);
1302 return result;
1303 }
1304
1310 template<typename control_t>
1311 [[nodiscard]] static auto create(const control& parent, const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> control_t {
1312 auto result = control_t {};
1313 result.parent(parent);
1314 result.location(location);
1315 result.size(size);
1316 result.name(name);
1317 return result;
1318 }
1319
1322 template<typename control_t>
1323 [[nodiscard]] static auto create(const xtd::string& text) -> control_t {
1324 auto result = control_t {};
1325 result.text(text);
1326 return result;
1327 }
1328
1332 template<typename control_t>
1333 [[nodiscard]] static auto create(const xtd::string& text, const xtd::drawing::point& location) -> control_t {
1334 auto result = control_t {};
1335 result.text(text);
1336 result.location(location);
1337 return result;
1338 }
1339
1344 template<typename control_t>
1345 [[nodiscard]] static auto create(const xtd::string& text, const xtd::drawing::point& location, const xtd::drawing::size& size) -> control_t {
1346 auto result = control_t {};
1347 result.text(text);
1348 result.location(location);
1349 result.size(size);
1350 return result;
1351 }
1352
1358 template<typename control_t>
1359 [[nodiscard]] static auto create(const xtd::string& text, const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> control_t {
1360 auto result = control_t {};
1361 result.text(text);
1362 result.location(location);
1363 result.size(size);
1364 result.name(name);
1365 return result;
1366 }
1367
1371 template<typename control_t>
1372 [[nodiscard]] static auto create(const control& parent, const xtd::string& text) -> control_t {
1373 auto result = control_t {};
1374 result.parent(parent);
1375 result.text(text);
1376 return result;
1377 }
1378
1383 template<typename control_t>
1384 [[nodiscard]] static auto create(const control& parent, const xtd::string& text, const xtd::drawing::point& location) -> control_t {
1385 auto result = control_t {};
1386 result.parent(parent);
1387 result.text(text);
1388 result.location(location);
1389 return result;
1390 }
1391
1397 template<typename control_t>
1398 [[nodiscard]] static auto create(const control& parent, const xtd::string& text, const xtd::drawing::point& location, const xtd::drawing::size& size) -> control_t {
1399 auto result = control_t {};
1400 result.parent(parent);
1401 result.text(text);
1402 result.location(location);
1403 result.size(size);
1404 return result;
1405 }
1406
1413 template<typename control_t>
1414 [[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 {
1415 auto result = control_t {};
1416 result.parent(parent);
1417 result.text(text);
1418 result.location(location);
1419 result.size(size);
1420 result.name(name);
1421 return result;
1422 }
1423
1428 [[nodiscard]] static auto from_child_handle(xtd::intptr handle) -> std::optional<xtd::forms::control_ref>;
1429
1433 [[nodiscard]] static auto from_handle(xtd::intptr handle) -> std::optional<xtd::forms::control_ref>;
1435
1437
1443
1448
1453
1458
1463
1488
1493
1498
1502
1506
1511
1535
1556
1561
1566
1571
1576
1581
1586
1598
1612
1624
1629
1634
1656
1672
1692
1706
1720
1735
1749
1763
1777
1792
1796
1805
1810
1815
1824
1829
1834
1839
1844
1849
1854
1860
1861 protected:
1862 friend class application;
1863 friend class context_menu;
1864 friend class horizontal_layout_panel;
1865 friend class form;
1866 friend class paint_event_args;
1867 friend class screen;
1868 friend class vertical_layout_panel;
1869 friend class style_sheets::style_sheet;
1870
1872
1876 [[nodiscard]] auto control_state() const noexcept -> xtd::forms::visual_styles::control_state;
1877
1883 [[nodiscard]] virtual auto create_params() const noexcept -> xtd::forms::create_params;
1884
1888 [[nodiscard]] virtual auto default_back_color() const noexcept -> xtd::drawing::color;
1889
1892 [[nodiscard]] virtual auto default_cursor() const noexcept -> xtd::forms::cursor;
1893
1896 [[nodiscard]] virtual auto default_font() const noexcept -> xtd::drawing::font;
1897
1900 [[nodiscard]] virtual auto default_fore_color() const noexcept -> xtd::drawing::color;
1901
1904 [[nodiscard]] virtual auto default_size() const noexcept -> xtd::drawing::size;
1906
1908
1914 virtual auto create_handle() -> void;
1915
1919 virtual auto destroy_handle() -> void;
1920
1923 virtual auto def_wnd_proc(xtd::forms::message& message) -> void;
1924
1929 [[nodiscard]] auto get_style(xtd::forms::control_styles flag) const noexcept -> bool;
1930
1933 [[nodiscard]] virtual auto measure_control() const noexcept -> xtd::drawing::size;
1934
1937 [[nodiscard]] auto measure_text() const noexcept -> xtd::drawing::size;
1938
1941 virtual auto on_auto_size_changed(const xtd::event_args& e) -> void;
1942
1945 virtual auto on_back_color_changed(const xtd::event_args& e) -> void;
1946
1949 virtual auto on_background_image_changed(const xtd::event_args& e) -> void;
1950
1953 virtual auto on_background_image_layout_changed(const xtd::event_args& e) -> void;
1954
1957 virtual auto on_control_appearance_changed(const xtd::event_args& e) -> void;
1958
1961 virtual auto on_click(const xtd::event_args& e) -> void;
1962
1965 virtual auto on_client_size_changed(const xtd::event_args& e) -> void;
1966
1969 virtual auto on_control_added(const xtd::forms::control_event_args& e) -> void;
1970
1973 virtual auto on_control_removed(const xtd::forms::control_event_args& e) -> void;
1974
1977 virtual auto on_create_control() -> void;
1978
1981 virtual auto on_cursor_changed(const xtd::event_args& e) -> void;
1982
1985 virtual auto on_destroy_control() -> void;
1986
1989 virtual auto on_dock_changed(const xtd::event_args& e) -> void;
1990
1993 virtual auto on_double_click(const xtd::event_args& e) -> void;
1994
1997 virtual auto on_enabled_changed(const xtd::event_args& e) -> void;
1998
2001 virtual auto on_fore_color_changed(const xtd::event_args& e) -> void;
2002
2005 virtual auto on_font_changed(const xtd::event_args& e) -> void;
2006
2009 virtual auto on_got_focus(const xtd::event_args& e) -> void;
2010
2013 virtual auto on_handle_created(const xtd::event_args& e) -> void;
2014
2017 virtual auto on_handle_destroyed(const xtd::event_args& e) -> void;
2018
2021 virtual auto on_help_requested(xtd::forms::help_event_args& e) -> void;
2022
2025 virtual auto on_key_down(xtd::forms::key_event_args& e) -> void;
2026
2029 virtual auto on_key_press(xtd::forms::key_press_event_args& e) -> void;
2030
2033 virtual auto on_key_up(xtd::forms::key_event_args& e) -> void;
2034
2037 virtual auto on_layout(const xtd::event_args& e) -> void;
2038
2041 virtual auto on_location_changed(const xtd::event_args& e) -> void;
2042
2045 virtual auto on_lost_focus(const xtd::event_args& e) -> void;
2046
2049 virtual auto on_mouse_click(const xtd::forms::mouse_event_args& e) -> void;
2050
2053 virtual auto on_mouse_double_click(const xtd::forms::mouse_event_args& e) -> void;
2054
2057 virtual auto on_mouse_down(const xtd::forms::mouse_event_args& e) -> void;
2058
2061 virtual auto on_mouse_enter(const xtd::event_args& e) -> void;
2062
2065 virtual auto on_mouse_horizontal_wheel(const xtd::forms::mouse_event_args& e) -> void;
2066
2069 virtual auto on_mouse_leave(const xtd::event_args& e) -> void;
2070
2073 virtual auto on_mouse_move(const xtd::forms::mouse_event_args& e) -> void;
2074
2077 virtual auto on_mouse_up(const xtd::forms::mouse_event_args& e) -> void;
2078
2081 virtual auto on_mouse_wheel(const xtd::forms::mouse_event_args& e) -> void;
2082
2085 virtual auto on_move(const xtd::event_args& e) -> void;
2086
2089 virtual auto on_paint(xtd::forms::paint_event_args& e) -> void;
2090
2094 virtual auto on_paint_background(xtd::forms::paint_event_args& e) -> void;
2095
2098 virtual auto on_parent_back_color_changed(const xtd::event_args& e) -> void;
2099
2102 virtual auto on_parent_cursor_changed(const xtd::event_args& e) -> void;
2103
2106 virtual auto on_parent_changed(const xtd::event_args& e) -> void;
2107
2110 virtual auto on_parent_enabled_changed(const xtd::event_args& e) -> void;
2111
2114 virtual auto on_parent_fore_color_changed(const xtd::event_args& e) -> void;
2115
2118 virtual auto on_parent_font_changed(const xtd::event_args& e) -> void;
2119
2122 virtual auto on_resize(const xtd::event_args& e) -> void;
2123
2126 virtual auto on_region_changed(const xtd::event_args& e) -> void;
2127
2130 virtual auto on_right_to_left_changed(const xtd::event_args& e) -> void;
2131
2134 virtual auto on_size_changed(const xtd::event_args& e) -> void;
2135
2138 virtual auto on_style_sheet_changed(const xtd::event_args& e) -> void;
2139
2142 virtual auto on_system_colors_changed(const xtd::event_args& e) -> void;
2143
2146 virtual auto on_tab_stop_changed(const xtd::event_args& e) -> void;
2147
2150 virtual auto on_text_changed(const xtd::event_args& e) -> void;
2151
2154 virtual auto on_visible_changed(const xtd::event_args& e) -> void;
2155
2156 auto post_recreate_handle() noexcept -> void;
2157
2160 virtual auto recreate_handle() -> void;
2161
2172 virtual auto set_bounds_core(xtd::int32 x, xtd::int32 y, xtd::int32 width, xtd::int32 height, xtd::forms::bounds_specified specified) -> void;
2173
2177 auto set_can_focus(bool value) -> void;
2178
2182 virtual auto set_text(const xtd::string& text) -> void;
2183
2192
2195 auto set_parent(xtd::intptr handle) -> void;
2196
2202 auto set_style(xtd::forms::control_styles flag, bool value) -> void;
2203
2209 virtual auto wnd_proc(xtd::forms::message& m) -> void;
2211
2213
2217 static auto set_mouse_buttons(xtd::forms::mouse_buttons value) -> void;
2219
2221 [[nodiscard]] auto get_state(control::state flag) const noexcept -> bool;
2222 auto set_state(control::state flag, bool value) -> void;
2223 auto on_context_menu_item_click(xtd::forms::context_menu& menu, intptr menu_id) const -> bool;
2225
2226 private:
2227 auto do_layout_children_with_dock_style() -> void;
2228 auto do_layout_with_auto_size_mode() -> void;
2229 auto do_layout_with_anchor_styles() -> void;
2230 [[nodiscard]] static auto is_trace_form_or_control(const string& name) -> bool;
2231 auto on_parent_size_changed(xtd::object& sender, const xtd::event_args& e) -> void;
2232 auto show_context_menu(xtd::forms::context_menu& menu, const xtd::drawing::point& pos) const -> void;
2233 auto reflect_message(xtd::intptr handle, xtd::forms::message& message) -> void;
2234 [[nodiscard]] auto wnd_proc_(xtd::intptr hwnd, xtd::uint32 msg, xtd::intptr wparam, xtd::intptr lparam, xtd::intptr handle) -> xtd::intptr;
2235 auto wm_app_idle(xtd::forms::message& message) -> void;
2236 auto wm_child_activate(xtd::forms::message& message) -> void;
2237 auto wm_command(xtd::forms::message& message) -> void;
2238 auto wm_command_control(xtd::forms::message& message) -> void;
2239 auto wm_ctlcolor(xtd::forms::message& message) -> void;
2240 auto wm_ctlcolor_control(xtd::forms::message& message) -> void;
2241 auto wm_create(xtd::forms::message& message) -> void;
2242 auto wm_destroy(xtd::forms::message& message) -> void;
2243 auto wm_key_char(xtd::forms::message& message) -> void;
2244 auto wm_kill_focus(xtd::forms::message& message) -> void;
2245 auto wm_menu_command(xtd::forms::message& message) -> void;
2246 auto wm_mouse_down(xtd::forms::message& message) -> void;
2247 auto wm_mouse_double_click(xtd::forms::message& message) -> void;
2248 auto wm_mouse_enter(xtd::forms::message& message) -> void;
2249 auto wm_mouse_leave(xtd::forms::message& message) -> void;
2250 auto wm_mouse_up(xtd::forms::message& message) -> void;
2251 auto wm_mouse_move(xtd::forms::message& message) -> void;
2252 auto wm_move(xtd::forms::message& message) -> void;
2253 auto wm_mouse_wheel(xtd::forms::message& message) -> void;
2254 auto wm_notify(xtd::forms::message& message) -> void;
2255 auto wm_notify_control(xtd::forms::message& message) -> void;
2256 auto wm_paint(xtd::forms::message& message) -> void;
2257 auto wm_erase_background(xtd::forms::message& message) -> void;
2258 auto wm_help(xtd::forms::message& message) -> void;
2259 auto wm_scroll(xtd::forms::message& message) -> void;
2260 auto wm_scroll_control(xtd::forms::message& message) -> void;
2261 auto wm_set_focus(xtd::forms::message& message) -> void;
2262 auto wm_set_text(xtd::forms::message& message) -> void;
2263 auto wm_show(xtd::forms::message& message) -> void;
2264 auto wm_size(xtd::forms::message& message) -> void;
2265 auto wm_sizing(xtd::forms::message& message) -> void;
2266 auto wm_style_sheet_changed(xtd::forms::message& message) -> void;
2267
2268 static bool check_for_illegal_cross_thread_calls_;
2269 static xtd::forms::keys modifier_keys_;
2270 static xtd::forms::mouse_buttons mouse_buttons_;
2271 static std::map<xtd::intptr, control*> handles_;
2272 static control_collection top_level_controls_;
2273
2274 xtd::sptr<data> data_;
2275 };
2276 }
2277}
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:29
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:52
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:223
auto add_new(args_t &&...args) -> control_t &
Creates and adds a control to the end.
Definition control.hpp:233
auto insert_new(xtd::usize index) -> control_t &
Creates and inserts specified control at specified position.
Definition control.hpp:254
control_collection()=default
Creates a new object xtd::forms::control::control_collection with specified allocator (optional).
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:270
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:292
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:1457
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:1865
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:1275
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:1252
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:1560
xtd::event< control, xtd::event_handler > lost_focus
Occurs when the xtd::forms::control loses focus.
Definition control.hpp:1655
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:1333
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:1858
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:1833
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:1297
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:1691
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:1791
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:1611
xtd::event< control, xtd::event_handler > region_changed
Occurs when the value of the xtd::forms::control::region property changes.
Definition control.hpp:1814
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:1285
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:1748
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:1633
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:1838
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:1311
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:1795
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:1497
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:1848
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:1359
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:1414
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:1398
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:1628
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:1809
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:1345
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:1384
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:1734
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:1492
xtd::event< control, xtd::event_handler > mouse_enter
Occurs when the mouse pointer enters the xtd::forms::control.
Definition control.hpp:1719
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:1242
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:1462
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:1823
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:1597
xtd::event< control, xtd::forms::help_event_handler > help_requested
Occurs when the user requests help for a xtd::forms::control.
Definition control.hpp:1585
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:1575
xtd::event< control, xtd::event_handler > handle_destroyed
Occurs when the control's handle is in the process of being destroyed.
Definition control.hpp:1565
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:1534
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:1853
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:1372
xtd::event< control, xtd::event_handler > click
Occurs when the xtd::forms::control is clicked.
Definition control.hpp:1487
xtd::event< control, xtd::event_handler > got_focus
Occurs when the xtd::forms::control receives focus.
Definition control.hpp:1555
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:1804
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:1671
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:1323
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:1580
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:1510
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:1264
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:1843
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:1452
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:1442
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:1501
xtd::event< control, xtd::event_handler > enabled_changed
Occurs when the value of the xtd::forms::control::enabled property changes.
Definition control.hpp:1570
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:1505
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:1623
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:1776
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:1828
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:1705
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:1762
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:1447
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
const auto & items() const
Definition arranged_element_collection.hpp:192
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.
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
@ add
The Add key.
Definition console_key.hpp:170
@ 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.