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 [];
184 [[nodiscard]] auto operator [](const xtd::string& name) const -> value_type;
189 [[nodiscard]] auto operator [](const xtd::string& name) -> value_type;
191
193
195 auto add(const xtd::forms::control_ref& value) -> void override;
196
197 template<typename control_t>
198 auto add(control_t& value) -> void {
199 for (const auto& control : items())
200 if (control.get() == value) return;
201 base::add(value);
202 }
203
211 template<typename control_t>
212 auto add_new() -> control_t& {return insert_new<control_t>(count());}
221 template<typename control_t, typename ...args_t>
222 auto add_new(args_t&& ...args) -> control_t& {return insert_new<control_t>(count(), std::forward<args_t>(args)...);}
223
224 auto insert(xtd::usize index, const xtd::forms::control_ref& value) -> void override;
225
226 template<typename control_t>
227 auto insert(xtd::usize index, control_t& value) -> void {
228 for (const auto& control : items())
229 if (control.get() == value) return;
230 base::insert(index, value);
231 }
232
242 template<typename control_t>
243 auto insert_new(xtd::usize index) -> control_t& {
245 controls_.add(control);
246 insert(index, *control);
247 return *control;
248 }
249
258 template<typename control_t, typename ...args_t>
259 auto insert_new(xtd::usize index, args_t&& ...args) -> control_t& {
260 auto control = xtd::new_sptr<control_t>(control_t::create(std::forward<args_t>(args)...));
262 controls_.add(control);
263 insert(index, *control);
264 return *control;
265 }
266
267
269
271 using arranged_element_collection::push_back;
272 template<typename control_t>
273 [[deprecated("Replaced by xtd::forms::control::control_collection::add - Will be removed in version 1.2.0.")]]
274 auto push_back(control_t& value) -> void {add(value);}
276
277 protected:
279
281 auto on_item_removed(xtd::usize index, xtd::forms::control_ref& item) -> void override {
283 for (auto i = xtd::usize {0}; i < controls_.count(); ++i) {
284 if (controls_[i].get() != &item.get()) continue;
285 controls_.remove_at(i);
286 break;
287 }
288 }
289
290
291 private:
294
296 };
297
299
308 explicit control(const xtd::string& text);
335
337 control(control&& rhs) = default;
338 auto operator = (control&&) -> control& = default;
339 control(const control& rhs) = delete;
340 auto operator = (const control&) -> control& = delete;
341 ~control();
343
345
354 [[nodiscard]] virtual auto anchor() const noexcept -> xtd::forms::anchor_styles;
364 virtual auto anchor(xtd::forms::anchor_styles value) -> control&;
365
368 [[nodiscard]] virtual auto auto_scroll_point() const noexcept -> xtd::drawing::point;
369
373 [[nodiscard]] virtual auto auto_size() const noexcept -> bool;
378 virtual auto auto_size(bool value) -> control&;
379
384 [[nodiscard]] virtual auto back_color() const noexcept -> xtd::drawing::color;
392 virtual auto back_color(const xtd::drawing::color& value) -> control&;
396 virtual auto back_color(xtd::null_ptr) -> control&;
397
401 [[nodiscard]] virtual auto background_image() const noexcept -> const xtd::drawing::image&;
406 virtual auto background_image(const xtd::drawing::image& value) -> control&;
407
412 [[nodiscard]] virtual auto background_image_layout() const noexcept -> xtd::forms::image_layout;
419
424 [[nodiscard]] virtual auto bottom() const noexcept -> xtd::int32;
425
429 [[nodiscard]] virtual auto bounds() const noexcept -> xtd::drawing::rectangle;
434 virtual auto bounds(const xtd::drawing::rectangle& value) -> control&;
435
439 [[nodiscard]] virtual auto can_focus() const noexcept -> bool;
440
452 [[nodiscard]] virtual auto can_select() const noexcept -> bool;
453
456 [[nodiscard]] auto can_raise_events() const noexcept -> bool override;
457
462 [[nodiscard]] virtual auto client_rectangle() const noexcept -> const xtd::drawing::rectangle&;
463
467 [[nodiscard]] virtual auto client_size() const noexcept -> const xtd::drawing::size&;
472 virtual auto client_size(const xtd::drawing::size& value) -> control&;
473
476 [[nodiscard]] virtual auto company_name() const noexcept -> xtd::string;
477
480 [[nodiscard]] virtual auto context_menu() const noexcept -> std::optional<context_menu_ref>;
484 virtual auto context_menu(xtd::forms::context_menu& value) -> control&;
488 virtual auto context_menu(xtd::null_ptr) -> control&;
489
495 [[nodiscard]] virtual auto control_appearance() const noexcept -> xtd::forms::control_appearance;
502
509 [[nodiscard]] virtual auto controls() noexcept -> control_collection&;
516 [[nodiscard]] virtual auto controls() const noexcept -> const control_collection&;
517
521 [[nodiscard]] virtual auto created() const noexcept -> bool;
522
526 [[nodiscard]] virtual auto cursor() const noexcept -> xtd::forms::cursor;
531 virtual auto cursor(const xtd::forms::cursor& value) -> control&;
535 virtual auto cursor(xtd::null_ptr) -> control&;
536
539 [[nodiscard]] virtual auto display_rectangle() const noexcept -> xtd::drawing::rectangle;
540
549 [[nodiscard]] virtual auto dock() const noexcept -> xtd::forms::dock_style;
559 virtual auto dock(xtd::forms::dock_style value) -> control&;
560
563 [[nodiscard]] virtual auto double_buffered() const noexcept -> bool;
567 virtual auto double_buffered(bool value) -> control&;
568
571 [[nodiscard]] virtual auto enabled() const noexcept -> bool;
575 virtual auto enabled(bool value) -> control&;
576
579 [[nodiscard]] virtual auto focused() const noexcept -> bool;
580
584 [[nodiscard]] virtual auto font() const noexcept -> xtd::drawing::font;
589 virtual auto font(const xtd::drawing::font& value) -> control&;
593 virtual auto font(xtd::null_ptr) -> control&;
594
598 [[nodiscard]] virtual auto fore_color() const noexcept -> xtd::drawing::color;
603 virtual auto fore_color(const xtd::drawing::color& value) -> control&;
607 virtual auto fore_color(xtd::null_ptr) -> control&;
608
612 [[nodiscard]] auto handle() const -> xtd::intptr override;
613
616 [[nodiscard]] virtual auto height() const noexcept -> xtd::int32;
620 virtual auto height(xtd::int32 value) -> control&;
621
624 [[nodiscard]] auto invoke_required() const noexcept -> bool override;
625
629 [[nodiscard]] auto is_handle_created() const noexcept -> bool;
630
633 [[nodiscard]] virtual auto left() const noexcept -> xtd::int32;
637 virtual auto left(xtd::int32 value) -> control&;
638
641 [[nodiscard]] virtual auto location() const noexcept -> xtd::drawing::point;
645 virtual auto location(const xtd::drawing::point& value) -> control&;
646
649 [[nodiscard]] virtual auto margin() const noexcept -> xtd::forms::padding;
653 virtual auto margin(const xtd::forms::padding& value) -> control&;
654
660 [[nodiscard]] virtual auto maximum_client_size() const noexcept -> const xtd::drawing::size&;
666 virtual auto maximum_client_size(const xtd::drawing::size& size) -> control&;
667
673 [[nodiscard]] virtual auto maximum_size() const noexcept -> const xtd::drawing::size&;
679 virtual auto maximum_size(const xtd::drawing::size& value) -> control&;
680
686 [[nodiscard]] virtual auto minimum_client_size() const noexcept -> const xtd::drawing::size&;
692 virtual auto minimum_client_size(const xtd::drawing::size& value) -> control&;
693
699 [[nodiscard]] virtual auto minimum_size() const noexcept -> const xtd::drawing::size&;
705 virtual auto minimum_size(const xtd::drawing::size& value) -> control&;
706
710 [[nodiscard]] auto native_handle() const noexcept -> xtd::intptr;
711
714 [[nodiscard]] virtual auto name() const noexcept -> const xtd::string&;
718 virtual auto name(const xtd::string& value) -> control&;
719
722 [[nodiscard]] virtual auto padding() const noexcept -> xtd::forms::padding;
726 virtual auto padding(const xtd::forms::padding& value) -> control&;
727
730 [[nodiscard]] virtual auto parent() const noexcept -> std::optional<xtd::forms::control_ref>;
734 virtual auto parent(const control& value) -> control&;
738 virtual auto parent(xtd::null_ptr) -> control&;
739
742 [[nodiscard]] virtual auto product_name() const noexcept -> xtd::string;
743
746 [[nodiscard]] auto recreating_handle() const noexcept -> bool;
747
752 [[nodiscard]] virtual auto region() const noexcept -> const xtd::drawing::region&;
758 virtual auto region(const xtd::drawing::region& value) -> control&;
759
762 [[nodiscard]] virtual auto right() const noexcept -> xtd::int32;
763
779 [[nodiscard]] virtual auto right_to_left() const noexcept -> xtd::forms::right_to_left;
796 virtual auto right_to_left(xtd::forms::right_to_left value) -> control&;
800 virtual auto right_to_left(xtd::null_ptr) -> control&;
801
804 [[nodiscard]] virtual auto size() const noexcept -> xtd::drawing::size;
808 virtual auto size(const xtd::drawing::size& value) -> control&;
809
813 [[nodiscard]] virtual auto style_sheet() const noexcept -> xtd::forms::style_sheets::style_sheet;
817 virtual auto style_sheet(const xtd::forms::style_sheets::style_sheet& value) -> control&;
822 virtual auto style_sheet(const xtd::string& value) -> control&;
827 virtual auto style_sheet(xtd::null_ptr) -> control&;
828
833 [[nodiscard]] virtual auto tab_stop() const noexcept -> bool;
839 virtual auto tab_stop(bool value) -> control&;
840
845 [[nodiscard]] virtual auto tag() const noexcept -> const xtd::any_object&;
851 virtual auto tag(const xtd::any_object& value) -> control&;
852
855 [[nodiscard]] virtual auto text() const noexcept -> const xtd::string&;
859 virtual auto text(const xtd::string& value) -> control&;
860
864 [[nodiscard]] auto toolkit_handle() const noexcept -> xtd::intptr;
865
868 [[nodiscard]] virtual auto top() const noexcept -> xtd::int32;
872 virtual auto top(xtd::int32 value) -> control&;
873
876 [[nodiscard]] virtual auto top_level_control() const noexcept -> std::optional<xtd::forms::control_ref>;
877
880 [[nodiscard]] virtual auto visible() const noexcept -> bool;
884 virtual auto visible(bool value) -> control&;
885
888 [[nodiscard]] virtual auto width() const noexcept -> xtd::int32;
892 virtual auto width(xtd::int32 value) -> control&;
894
896
902 [[nodiscard]] static auto check_for_illegal_cross_thread_calls() noexcept -> bool;
907 static auto check_for_illegal_cross_thread_calls(bool value) -> void;
908
911 [[nodiscard]] static auto modifier_keys() noexcept -> xtd::forms::keys;
912
915 [[nodiscard]] static auto mouse_buttons() noexcept -> xtd::forms::mouse_buttons;
916
921 static auto mouse_position() noexcept -> xtd::drawing::point;
923
925
931 [[nodiscard]] auto begin_invoke(xtd::delegate<void()> method) -> xtd::async_result override;
932
937 [[nodiscard]] auto begin_invoke(xtd::delegate<void(xtd::array<xtd::any_object>)> method, const xtd::array<xtd::any_object>& args) -> xtd::async_result override;
938
941 virtual auto bring_to_front() -> void;
942
943 [[nodiscard]] auto compare_to(const control& value) const noexcept -> xtd::int32 override;
944
948 auto create_control() -> void;
949
953 [[nodiscard]] auto create_graphics() const -> xtd::drawing::graphics;
954
959 virtual auto destroy_control() -> void;
960
963 [[nodiscard]] auto end_invoke(xtd::async_result async) -> std::optional<xtd::object_ref> override;
964
968 [[nodiscard]] auto equals(const xtd::object& obj) const noexcept -> bool override;
972 [[nodiscard]] auto equals(const control& value) const noexcept -> bool override;
973
977 auto focus() -> bool;
978
981 [[nodiscard]] auto get_auto_size_mode() const -> xtd::forms::auto_size_mode;
982
985 [[nodiscard]] auto get_back_color() const noexcept -> std::optional<xtd::drawing::color>;
987
990 [[nodiscard]] auto get_font() const noexcept -> std::optional<xtd::drawing::font>;
992
995 [[nodiscard]] auto get_fore_color() const noexcept -> std::optional<xtd::drawing::color>;
997
1002 [[nodiscard]] auto get_child_index(xtd::intptr child) const -> xtd::usize;
1003
1007 [[nodiscard]] auto get_child_index(xtd::intptr child, bool& throw_exception) const -> xtd::usize;
1008
1011 [[nodiscard]] auto get_hash_code() const noexcept -> xtd::usize override;
1012
1015 virtual auto hide() -> void;
1016
1019 virtual auto invalidate() const -> void;
1020
1024 virtual auto invalidate(bool invalidate_children) const -> void;
1025
1029 virtual auto invalidate(const xtd::drawing::rectangle& rect) const -> void;
1030
1035 virtual auto invalidate(const xtd::drawing::rectangle& rect, bool invalidate_children) const -> void;
1036
1040 virtual auto invalidate(const xtd::drawing::region& region) const -> void;
1041
1046 virtual auto invalidate(const xtd::drawing::region& region, bool invalidate_children) const -> void;
1047
1051 auto invoke(xtd::delegate<void()> method) -> std::optional<xtd::object_ref> override;
1055 auto invoke(xtd::delegate<void(xtd::array<xtd::any_object>)> method, const xtd::array<xtd::any_object>& args) -> std::optional<xtd::object_ref> override;
1059 auto invoke(xtd::delegate<void(xtd::array<xtd::any_object>)> method, const xtd::any_object& arg) -> std::optional<xtd::object_ref> override;
1060
1063 auto perform_layout() -> void;
1064
1068 [[nodiscard]] auto point_to_client(const xtd::drawing::point& p) const -> xtd::drawing::point;
1069
1073 [[nodiscard]] auto point_to_screen(const xtd::drawing::point& p) const -> xtd::drawing::point;
1074
1081 auto post_message(xtd::intptr hwnd, xtd::int32 msg, xtd::intptr wparam, xtd::intptr lparam) const -> bool;
1082
1087 virtual auto pre_process_message(const xtd::forms::message& message) -> bool;
1088
1092 virtual auto refresh() const -> void;
1093
1098 auto resume_layout() -> void;
1099
1106 auto resume_layout(bool perform_layout) -> void;
1107
1114 auto send_message(xtd::intptr hwnd, xtd::int32 msg, xtd::intptr wparam, xtd::intptr lparam) const -> xtd::intptr;
1115
1119
1126
1134
1137 virtual auto show() -> void;
1138
1144 auto suspend_layout() -> void;
1145
1148 [[nodiscard]] auto to_string() const noexcept -> xtd::string override;
1149
1156 virtual auto update() const -> void;
1158
1160
1166 auto operator <<(control& child) -> control&;
1167
1172 auto operator >>(control& child) -> control&;
1174
1176
1180 [[nodiscard]] static auto create() -> control;
1184 [[nodiscard]] static auto create(const xtd::drawing::point& location) -> control;
1189 [[nodiscard]] static auto create(const xtd::drawing::point& location, const xtd::drawing::size& size) -> control;
1195 [[nodiscard]] static auto create(const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> control;
1199 [[nodiscard]] static auto create(const control& paren) -> control;
1206 [[nodiscard]] static auto create(const control& parent, const xtd::drawing::point& location) -> control;
1212 [[nodiscard]] static auto create(const control& parent, const xtd::drawing::point& location, const xtd::drawing::size& size) -> control;
1219 [[nodiscard]] static auto create(const control& parent, const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> control;
1222 template<typename control_t>
1223 [[nodiscard]] static auto create() -> control_t {
1224 auto result = control_t {};
1225 return result;
1226 }
1227
1230 template<typename control_t>
1231 [[nodiscard]] static auto create(const xtd::drawing::point& location) -> control_t {
1232 auto result = control_t {};
1233 result.location(location);
1234 return result;
1235 }
1236
1240 template<typename control_t>
1241 [[nodiscard]] static auto create(const xtd::drawing::point& location, const xtd::drawing::size& size) -> control_t {
1242 auto result = control_t {};
1243 result.location(location);
1244 result.size(size);
1245 return result;
1246 }
1247
1252 template<typename control_t>
1253 [[nodiscard]] static auto create(const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> control_t {
1254 auto result = control_t {};
1255 result.location(location);
1256 result.size(size);
1257 result.name(name);
1258 return result;
1259 }
1260
1263 template<typename control_t>
1264 [[nodiscard]] static auto create(const control& parent) -> control_t {
1265 auto result = control_t {};
1266 result.parent(parent);
1267 return result;
1268 }
1269
1273 template<typename control_t>
1274 [[nodiscard]] static auto create(const control& parent, const xtd::drawing::point& location) -> control_t {
1275 auto result = control_t {};
1276 result.parent(parent);
1277 result.location(location);
1278 return result;
1279 }
1280
1285 template<typename control_t>
1286 [[nodiscard]] static auto create(const control& parent, const xtd::drawing::point& location, const xtd::drawing::size& size) -> control_t {
1287 auto result = control_t {};
1288 result.parent(parent);
1289 result.location(location);
1290 result.size(size);
1291 return result;
1292 }
1293
1299 template<typename control_t>
1300 [[nodiscard]] static auto create(const control& parent, const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> control_t {
1301 auto result = control_t {};
1302 result.parent(parent);
1303 result.location(location);
1304 result.size(size);
1305 result.name(name);
1306 return result;
1307 }
1308
1311 template<typename control_t>
1312 [[nodiscard]] static auto create(const xtd::string& text) -> control_t {
1313 auto result = control_t {};
1314 result.text(text);
1315 return result;
1316 }
1317
1321 template<typename control_t>
1322 [[nodiscard]] static auto create(const xtd::string& text, const xtd::drawing::point& location) -> control_t {
1323 auto result = control_t {};
1324 result.text(text);
1325 result.location(location);
1326 return result;
1327 }
1328
1333 template<typename control_t>
1334 [[nodiscard]] static auto create(const xtd::string& text, const xtd::drawing::point& location, const xtd::drawing::size& size) -> control_t {
1335 auto result = control_t {};
1336 result.text(text);
1337 result.location(location);
1338 result.size(size);
1339 return result;
1340 }
1341
1347 template<typename control_t>
1348 [[nodiscard]] static auto create(const xtd::string& text, const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> control_t {
1349 auto result = control_t {};
1350 result.text(text);
1351 result.location(location);
1352 result.size(size);
1353 result.name(name);
1354 return result;
1355 }
1356
1360 template<typename control_t>
1361 [[nodiscard]] static auto create(const control& parent, const xtd::string& text) -> control_t {
1362 auto result = control_t {};
1363 result.parent(parent);
1364 result.text(text);
1365 return result;
1366 }
1367
1372 template<typename control_t>
1373 [[nodiscard]] static auto create(const control& parent, const xtd::string& text, const xtd::drawing::point& location) -> control_t {
1374 auto result = control_t {};
1375 result.parent(parent);
1376 result.text(text);
1377 result.location(location);
1378 return result;
1379 }
1380
1386 template<typename control_t>
1387 [[nodiscard]] static auto create(const control& parent, const xtd::string& text, const xtd::drawing::point& location, const xtd::drawing::size& size) -> control_t {
1388 auto result = control_t {};
1389 result.parent(parent);
1390 result.text(text);
1391 result.location(location);
1392 result.size(size);
1393 return result;
1394 }
1395
1402 template<typename control_t>
1403 [[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 {
1404 auto result = control_t {};
1405 result.parent(parent);
1406 result.text(text);
1407 result.location(location);
1408 result.size(size);
1409 result.name(name);
1410 return result;
1411 }
1412
1417 [[nodiscard]] static auto from_child_handle(xtd::intptr handle) -> std::optional<xtd::forms::control_ref>;
1418
1422 [[nodiscard]] static auto from_handle(xtd::intptr handle) -> std::optional<xtd::forms::control_ref>;
1424
1426
1432
1437
1442
1447
1452
1477
1482
1487
1491
1495
1500
1524
1545
1550
1555
1560
1565
1570
1575
1587
1601
1613
1618
1623
1645
1661
1681
1695
1709
1724
1738
1752
1766
1781
1785
1794
1799
1804
1813
1818
1823
1828
1833
1838
1843
1849
1850 protected:
1851 friend class application;
1852 friend class context_menu;
1853 friend class horizontal_layout_panel;
1854 friend class form;
1855 friend class paint_event_args;
1856 friend class screen;
1857 friend class vertical_layout_panel;
1858 friend class style_sheets::style_sheet;
1859
1861
1865 [[nodiscard]] auto control_state() const noexcept -> xtd::forms::visual_styles::control_state;
1866
1872 [[nodiscard]] virtual auto create_params() const noexcept -> xtd::forms::create_params;
1873
1877 [[nodiscard]] virtual auto default_back_color() const noexcept -> xtd::drawing::color;
1878
1881 [[nodiscard]] virtual auto default_cursor() const noexcept -> xtd::forms::cursor;
1882
1885 [[nodiscard]] virtual auto default_font() const noexcept -> xtd::drawing::font;
1886
1889 [[nodiscard]] virtual auto default_fore_color() const noexcept -> xtd::drawing::color;
1890
1893 [[nodiscard]] virtual auto default_size() const noexcept -> xtd::drawing::size;
1895
1897
1903 virtual auto create_handle() -> void;
1904
1908 virtual auto destroy_handle() -> void;
1909
1912 virtual auto def_wnd_proc(xtd::forms::message& message) -> void;
1913
1918 [[nodiscard]] auto get_style(xtd::forms::control_styles flag) const noexcept -> bool;
1919
1922 [[nodiscard]] virtual auto measure_control() const noexcept -> xtd::drawing::size;
1923
1926 [[nodiscard]] auto measure_text() const noexcept -> xtd::drawing::size;
1927
1930 virtual auto on_auto_size_changed(const xtd::event_args& e) -> void;
1931
1934 virtual auto on_back_color_changed(const xtd::event_args& e) -> void;
1935
1938 virtual auto on_background_image_changed(const xtd::event_args& e) -> void;
1939
1942 virtual auto on_background_image_layout_changed(const xtd::event_args& e) -> void;
1943
1946 virtual auto on_control_appearance_changed(const xtd::event_args& e) -> void;
1947
1950 virtual auto on_click(const xtd::event_args& e) -> void;
1951
1954 virtual auto on_client_size_changed(const xtd::event_args& e) -> void;
1955
1958 virtual auto on_control_added(const xtd::forms::control_event_args& e) -> void;
1959
1962 virtual auto on_control_removed(const xtd::forms::control_event_args& e) -> void;
1963
1966 virtual auto on_create_control() -> void;
1967
1970 virtual auto on_cursor_changed(const xtd::event_args& e) -> void;
1971
1974 virtual auto on_destroy_control() -> void;
1975
1978 virtual auto on_dock_changed(const xtd::event_args& e) -> void;
1979
1982 virtual auto on_double_click(const xtd::event_args& e) -> void;
1983
1986 virtual auto on_enabled_changed(const xtd::event_args& e) -> void;
1987
1990 virtual auto on_fore_color_changed(const xtd::event_args& e) -> void;
1991
1994 virtual auto on_font_changed(const xtd::event_args& e) -> void;
1995
1998 virtual auto on_got_focus(const xtd::event_args& e) -> void;
1999
2002 virtual auto on_handle_created(const xtd::event_args& e) -> void;
2003
2006 virtual auto on_handle_destroyed(const xtd::event_args& e) -> void;
2007
2010 virtual auto on_help_requested(xtd::forms::help_event_args& e) -> void;
2011
2014 virtual auto on_key_down(xtd::forms::key_event_args& e) -> void;
2015
2018 virtual auto on_key_press(xtd::forms::key_press_event_args& e) -> void;
2019
2022 virtual auto on_key_up(xtd::forms::key_event_args& e) -> void;
2023
2026 virtual auto on_layout(const xtd::event_args& e) -> void;
2027
2030 virtual auto on_location_changed(const xtd::event_args& e) -> void;
2031
2034 virtual auto on_lost_focus(const xtd::event_args& e) -> void;
2035
2038 virtual auto on_mouse_click(const xtd::forms::mouse_event_args& e) -> void;
2039
2042 virtual auto on_mouse_double_click(const xtd::forms::mouse_event_args& e) -> void;
2043
2046 virtual auto on_mouse_down(const xtd::forms::mouse_event_args& e) -> void;
2047
2050 virtual auto on_mouse_enter(const xtd::event_args& e) -> void;
2051
2054 virtual auto on_mouse_horizontal_wheel(const xtd::forms::mouse_event_args& e) -> void;
2055
2058 virtual auto on_mouse_leave(const xtd::event_args& e) -> void;
2059
2062 virtual auto on_mouse_move(const xtd::forms::mouse_event_args& e) -> void;
2063
2066 virtual auto on_mouse_up(const xtd::forms::mouse_event_args& e) -> void;
2067
2070 virtual auto on_mouse_wheel(const xtd::forms::mouse_event_args& e) -> void;
2071
2074 virtual auto on_move(const xtd::event_args& e) -> void;
2075
2078 virtual auto on_paint(xtd::forms::paint_event_args& e) -> void;
2079
2083 virtual auto on_paint_background(xtd::forms::paint_event_args& e) -> void;
2084
2087 virtual auto on_parent_back_color_changed(const xtd::event_args& e) -> void;
2088
2091 virtual auto on_parent_cursor_changed(const xtd::event_args& e) -> void;
2092
2095 virtual auto on_parent_changed(const xtd::event_args& e) -> void;
2096
2099 virtual auto on_parent_enabled_changed(const xtd::event_args& e) -> void;
2100
2103 virtual auto on_parent_fore_color_changed(const xtd::event_args& e) -> void;
2104
2107 virtual auto on_parent_font_changed(const xtd::event_args& e) -> void;
2108
2111 virtual auto on_resize(const xtd::event_args& e) -> void;
2112
2115 virtual auto on_region_changed(const xtd::event_args& e) -> void;
2116
2119 virtual auto on_right_to_left_changed(const xtd::event_args& e) -> void;
2120
2123 virtual auto on_size_changed(const xtd::event_args& e) -> void;
2124
2127 virtual auto on_style_sheet_changed(const xtd::event_args& e) -> void;
2128
2131 virtual auto on_system_colors_changed(const xtd::event_args& e) -> void;
2132
2135 virtual auto on_tab_stop_changed(const xtd::event_args& e) -> void;
2136
2139 virtual auto on_text_changed(const xtd::event_args& e) -> void;
2140
2143 virtual auto on_visible_changed(const xtd::event_args& e) -> void;
2144
2145 auto post_recreate_handle() noexcept -> void;
2146
2149 virtual auto recreate_handle() -> void;
2150
2161 virtual auto set_bounds_core(xtd::int32 x, xtd::int32 y, xtd::int32 width, xtd::int32 height, xtd::forms::bounds_specified specified) -> void;
2162
2166 auto set_can_focus(bool value) -> void;
2167
2171 virtual auto set_text(const xtd::string& text) -> void;
2172
2181
2184 auto set_parent(xtd::intptr handle) -> void;
2185
2191 auto set_style(xtd::forms::control_styles flag, bool value) -> void;
2192
2198 virtual auto wnd_proc(xtd::forms::message& m) -> void;
2200
2202
2206 static auto set_mouse_buttons(xtd::forms::mouse_buttons value) -> void;
2208
2210 [[nodiscard]] auto get_state(control::state flag) const noexcept -> bool;
2211 auto set_state(control::state flag, bool value) -> void;
2212 auto on_context_menu_item_click(xtd::forms::context_menu& menu, intptr menu_id) const -> bool;
2214
2215 private:
2216 auto do_layout_children_with_dock_style() -> void;
2217 auto do_layout_with_auto_size_mode() -> void;
2218 auto do_layout_with_anchor_styles() -> void;
2219 [[nodiscard]] static auto is_trace_form_or_control(const string& name) -> bool;
2220 auto on_parent_size_changed(xtd::object& sender, const xtd::event_args& e) -> void;
2221 auto show_context_menu(xtd::forms::context_menu& menu, const xtd::drawing::point& pos) const -> void;
2222 auto reflect_message(xtd::intptr handle, xtd::forms::message& message) -> void;
2223 [[nodiscard]] auto wnd_proc_(xtd::intptr hwnd, xtd::uint32 msg, xtd::intptr wparam, xtd::intptr lparam, xtd::intptr handle) -> xtd::intptr;
2224 auto wm_app_idle(xtd::forms::message& message) -> void;
2225 auto wm_child_activate(xtd::forms::message& message) -> void;
2226 auto wm_command(xtd::forms::message& message) -> void;
2227 auto wm_command_control(xtd::forms::message& message) -> void;
2228 auto wm_ctlcolor(xtd::forms::message& message) -> void;
2229 auto wm_ctlcolor_control(xtd::forms::message& message) -> void;
2230 auto wm_create(xtd::forms::message& message) -> void;
2231 auto wm_destroy(xtd::forms::message& message) -> void;
2232 auto wm_key_char(xtd::forms::message& message) -> void;
2233 auto wm_kill_focus(xtd::forms::message& message) -> void;
2234 auto wm_menu_command(xtd::forms::message& message) -> void;
2235 auto wm_mouse_down(xtd::forms::message& message) -> void;
2236 auto wm_mouse_double_click(xtd::forms::message& message) -> void;
2237 auto wm_mouse_enter(xtd::forms::message& message) -> void;
2238 auto wm_mouse_leave(xtd::forms::message& message) -> void;
2239 auto wm_mouse_up(xtd::forms::message& message) -> void;
2240 auto wm_mouse_move(xtd::forms::message& message) -> void;
2241 auto wm_move(xtd::forms::message& message) -> void;
2242 auto wm_mouse_wheel(xtd::forms::message& message) -> void;
2243 auto wm_notify(xtd::forms::message& message) -> void;
2244 auto wm_notify_control(xtd::forms::message& message) -> void;
2245 auto wm_paint(xtd::forms::message& message) -> void;
2246 auto wm_erase_background(xtd::forms::message& message) -> void;
2247 auto wm_help(xtd::forms::message& message) -> void;
2248 auto wm_scroll(xtd::forms::message& message) -> void;
2249 auto wm_scroll_control(xtd::forms::message& message) -> void;
2250 auto wm_set_focus(xtd::forms::message& message) -> void;
2251 auto wm_set_text(xtd::forms::message& message) -> void;
2252 auto wm_show(xtd::forms::message& message) -> void;
2253 auto wm_size(xtd::forms::message& message) -> void;
2254 auto wm_sizing(xtd::forms::message& message) -> void;
2255 auto wm_style_sheet_changed(xtd::forms::message& message) -> void;
2256
2257 static bool check_for_illegal_cross_thread_calls_;
2258 static xtd::forms::keys modifier_keys_;
2259 static xtd::forms::mouse_buttons mouse_buttons_;
2260 static std::map<xtd::intptr, control*> handles_;
2261 static control_collection top_level_controls_;
2262
2263 xtd::sptr<data> data_;
2264 };
2265 }
2266}
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:80
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:212
auto add_new(args_t &&...args) -> control_t &
Creates and adds a control to the end.
Definition control.hpp:222
auto insert_new(xtd::usize index) -> control_t &
Creates and inserts specified control at specified position.
Definition control.hpp:243
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:259
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:281
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:1446
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:1854
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:1264
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:1241
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:1549
xtd::event< control, xtd::event_handler > lost_focus
Occurs when the xtd::forms::control loses focus.
Definition control.hpp:1644
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:1322
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:1847
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:1822
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:1286
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:1680
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:1780
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:1600
xtd::event< control, xtd::event_handler > region_changed
Occurs when the value of the xtd::forms::control::region property changes.
Definition control.hpp:1803
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:1274
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:1737
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:1622
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:1827
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:1300
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:1784
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:1486
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:1837
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:1348
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:1403
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:1387
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:1617
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:1798
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:1334
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:1373
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:1723
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:1481
xtd::event< control, xtd::event_handler > mouse_enter
Occurs when the mouse pointer enters the xtd::forms::control.
Definition control.hpp:1708
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:1231
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:1451
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:1812
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:1586
xtd::event< control, xtd::forms::help_event_handler > help_requested
Occurs when the user requests help for a xtd::forms::control.
Definition control.hpp:1574
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:1564
xtd::event< control, xtd::event_handler > handle_destroyed
Occurs when the control's handle is in the process of being destroyed.
Definition control.hpp:1554
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:1523
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:1842
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:1361
xtd::event< control, xtd::event_handler > click
Occurs when the xtd::forms::control is clicked.
Definition control.hpp:1476
xtd::event< control, xtd::event_handler > got_focus
Occurs when the xtd::forms::control receives focus.
Definition control.hpp:1544
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:1793
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:1660
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:1312
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:1569
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:1499
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:1253
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:1832
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:1441
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:1431
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:1490
xtd::event< control, xtd::event_handler > enabled_changed
Occurs when the value of the xtd::forms::control::enabled property changes.
Definition control.hpp:1559
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:1494
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:1612
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:1765
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:1817
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:1694
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:1751
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:1436
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:41
const auto & items() const
Definition arranged_element_collection.hpp:216
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:824
auto add(const xtd::forms::control_ref &item) -> void override
Definition arranged_element_collection.hpp:239
auto count() const noexcept -> size_type override
Definition arranged_element_collection.hpp:205
virtual auto insert(xtd::usize index, const xtd::forms::control_ref &value) -> void
Definition arranged_element_collection.hpp:352
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
Contains xtd::forms::style_sheets::style_sheet class.
Contains xtd::forms::timer component.