xtd 0.2.0
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/iclonable>
42#include <xtd/iequatable>
43#include <xtd/isynchronize_invoke>
44#include <cstdint>
45#include <functional>
46#include <map>
47#include <memory>
48#include <string>
49#include <vector>
50
52namespace xtd {
54 namespace forms {
56 class application;
57 class context_menu;
59 class screen;
61
63
81 class forms_export_ control : public component, public iwin32_window, public iclonable, public icomparable<control>, public xtd::iequatable<control>, public xtd::isynchronize_invoke {
82 struct data;
83
84 protected:
86 enum class state : 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 xtd::any_object async_state() const noexcept override;
135 xtd::threading::wait_handle& async_wait_handle() noexcept override;
136 bool completed_synchronously() const noexcept override;
137 bool is_completed() const noexcept override;
138
139 xtd::sptr<data> data_;
140 };
142
143 public:
145
148 using context_menu_ref = std::reference_wrapper<xtd::forms::context_menu>;
150
153 public:
155
160
162
167 explicit control_collection(const allocator_type& allocator = allocator_type());
173 explicit control_collection(bool keep_cloned_controls, const allocator_type& allocator = allocator_type());
175
177 explicit control_collection(const base& collection);
178 control_collection(const control_collection& collection);
179 control_collection& operator =(const control_collection& collection);
182
184
186 using base::operator [];
191 std::optional<value_type> operator [](const xtd::string& name) const;
196 std::optional<value_type> operator [](const xtd::string& name);
198
200
211 template<class control_t, class ...args_t>
212 control_t& emplace(const_iterator pos, args_t&& ...args) {
213 auto control_ptr = xtd::new_uptr<control_t>(control_t::create(std::forward<args_t>(args)...));
214 auto& control_ref = *control_ptr;
215 controls_.push_back(std::move(control_ptr));
217 return control_ref;
218 }
219
229 template<class control_t, class ...args_t>
230 control_t& emplace_at(size_t index, args_t&& ...args) {
231 auto control_ptr = xtd::new_uptr<control_t>(control_t::create(std::forward<args_t>(args)...));
232 auto& control_ref = *control_ptr;
233 controls_.push_back(std::move(control_ptr));
235 return control_ref;
236 }
237
246 template<class control_t, class ...args_t>
247 control_t& emplace_back(args_t&& ...args) {
248 auto control_ptr = xtd::new_uptr<control_t>(control_t::create(std::forward<args_t>(args)...));
249 auto& control_ref = *control_ptr;
250 controls_.push_back(std::move(control_ptr));
252 return control_ref;
253 }
254
255 iterator insert(const_iterator pos, const value_type& value) override;
256
257 void insert_at(size_t index, const value_type& value) override;
258
259 void push_back(const value_type& value) override;
260
261 template<class control_t>
262 iterator insert(const_iterator pos, control_t& value) {
263 for (auto it = begin(); it != end(); ++it)
264 if (it->get() == value) return it;
265 if (!keep_cloned_controls_) return base::insert(pos, value);
266 auto control_ptr = as<control>(as<iclonable>(value).clone());
267 auto& control_ref = *control_ptr;
268 controls_.push_back(std::move(control_ptr));
269 return base::insert(pos, control_ref);
270 }
271
272 template<class control_t>
273 void insert_at(size_t index, control_t& value) {
274 for (auto it = begin(); it != end(); ++it)
275 if (it->get() == value) return;
276 if (!keep_cloned_controls_) base::insert_at(index, value);
277 else {
278 auto control_ptr = as<control>(as<iclonable>(value).clone());
279 auto& control_ref = *control_ptr;
280 controls_.push_back(std::move(control_ptr));
281 base::insert_at(index, control_ref);
282 }
283 }
284
285 template<class control_t>
286 void push_back(control_t& value) {
287 for (auto it = begin(); it != end(); ++it)
288 if (it->get() == value) return;
289 if (!keep_cloned_controls_) base::push_back(value);
290 else {
291 auto control_ptr = as<control>(as<iclonable>(value).clone());
292 auto& control_ref = *control_ptr;
293 controls_.push_back(std::move(control_ptr));
294 base::push_back(control_ref);
295 }
296 }
297
299
300 protected:
302
304 void on_item_removed(size_t index, control_ref& item) override {
306 for (auto iterator = controls_.begin(); iterator != controls_.end(); ++iterator) {
307 if (iterator->get() != &item.get()) continue;
308 controls_.erase(iterator);
309 break;
310 }
311 }
312
313
314 private:
317
318 bool keep_cloned_controls_ = false;
320 };
321
323
332 explicit control(const xtd::string& text);
359
361 control(control&& rhs);
362 control(const control&) = default;
363 control& operator =(const control&) = default;
364 ~control();
366
368
377 virtual anchor_styles anchor() const noexcept;
388
391 virtual drawing::point auto_scroll_point() const noexcept;
392
396 virtual bool auto_size() const noexcept;
402
407 virtual drawing::color back_color() const noexcept;
415 virtual control& back_color(const xtd::drawing::color& color);
417 virtual control& back_color(std::nullptr_t);
419
423 virtual const xtd::drawing::image& background_image() const noexcept;
429
434 virtual xtd::forms::image_layout background_image_layout() const noexcept;
435
442
447 virtual int32 bottom() const noexcept;
448
452 virtual drawing::rectangle bounds() const noexcept;
457 virtual control& bounds(const xtd::drawing::rectangle& bounds);
458
462 virtual bool can_focus() const noexcept;
463
475 virtual bool can_select() const noexcept;
476
479 bool can_raise_events() const noexcept override;
480
485 virtual const drawing::rectangle& client_rectangle() const noexcept;
486
490 virtual const drawing::size& client_size() const noexcept;
496
499 virtual xtd::string company_name() const noexcept;
500
503 virtual std::optional<context_menu_ref> context_menu() const noexcept;
507 virtual control& context_menu(xtd::forms::context_menu& value);
511 virtual control& context_menu(std::nullptr_t);
512
518 virtual forms::control_appearance control_appearance() const noexcept;
525
532 virtual control_collection& controls() noexcept;
539 virtual const control_collection& controls() const noexcept;
540
544 virtual bool created() const noexcept;
545
549 virtual forms::cursor cursor() const noexcept;
554 virtual control& cursor(const xtd::forms::cursor& cursor);
556 virtual control& cursor(std::nullptr_t);
558
561 virtual drawing::rectangle display_rectangle() const noexcept;
562
571 virtual dock_style dock() const noexcept;
582
585 virtual bool double_buffered() const noexcept;
590
593 virtual bool enabled() const noexcept;
597 virtual control& enabled(bool enabled);
598
601 virtual bool focused() const noexcept;
602
606 virtual drawing::font font() const noexcept;
611 virtual control& font(const xtd::drawing::font& font);
613 virtual control& font(std::nullptr_t);
615
619 virtual drawing::color fore_color() const noexcept;
624 virtual control& fore_color(const xtd::drawing::color& color);
626 virtual control& fore_color(std::nullptr_t);
628
632 intptr handle() const override;
633
636 virtual int32 height() const noexcept;
641
644 bool invoke_required() const noexcept override;
645
649 bool is_handle_created() const noexcept;
650
653 virtual int32 left() const noexcept;
658
661 virtual drawing::point location() const noexcept;
665 virtual control& location(const xtd::drawing::point& location);
666
669 virtual forms::padding margin() const noexcept;
673 virtual control& margin(const xtd::forms::padding& margin);
674
680 virtual const drawing::size& maximum_client_size() const noexcept;
687
693 virtual const drawing::size& maximum_size() const noexcept;
700
706 virtual const drawing::size& minimum_client_size() const noexcept;
713
719 virtual const drawing::size& minimum_size() const noexcept;
726
730 intptr native_handle() const noexcept;
731
734 virtual const xtd::string& name() const noexcept;
738 virtual control& name(const xtd::string& name);
739
742 virtual forms::padding padding() const noexcept;
747
750 virtual std::optional<control_ref> parent() const noexcept;
754 virtual control& parent(const control& parent);
758 virtual control& parent(std::nullptr_t);
759
762 virtual xtd::string product_name() const noexcept;
763
766 bool recreating_handle() const noexcept;
767
772 virtual const xtd::drawing::region& region() const noexcept;
778 virtual control& region(const xtd::drawing::region& value);
779
782 virtual int32 right() const noexcept;
783
799 virtual xtd::forms::right_to_left right_to_left() const noexcept;
818 virtual control& right_to_left(std::nullptr_t);
820
823 virtual drawing::size size() const noexcept;
827 virtual control& size(const drawing::size& size);
828
832 virtual style_sheets::style_sheet style_sheet() const noexcept;
836 virtual control& style_sheet(const style_sheets::style_sheet& value);
841 virtual control& style_sheet(const xtd::string& value);
846 virtual control& style_sheet(std::nullptr_t);
847
852 virtual bool tab_stop() const noexcept;
858 virtual control& tab_stop(bool value);
859
864 virtual xtd::any_object tag() const noexcept;
870 virtual control& tag(const xtd::any_object& tag);
871
874 virtual const xtd::string& text() const noexcept;
878 virtual control& text(const xtd::string& text);
879
883 intptr toolkit_handle() const noexcept;
884
887 virtual int32 top() const noexcept;
891 virtual control& top(int32 top);
892
895 virtual std::optional<control_ref> top_level_control() const noexcept;
896
899 virtual bool visible() const noexcept;
903 virtual control& visible(bool visible);
904
907 virtual int32 width() const noexcept;
913
915
927
930 static forms::keys modifier_keys() noexcept;
931
935
940 static xtd::drawing::point mouse_position() noexcept;
942
944
950 xtd::async_result begin_invoke(delegate<void()> method) override;
951
956 xtd::async_result begin_invoke(delegate<void(xtd::array<xtd::any_object>)> method, const xtd::array<xtd::any_object>& args) override;
957
960 virtual void bring_to_front();
961
962 int32 compare_to(const control& value) const noexcept override;
963
968
972 drawing::graphics create_graphics() const;
973
978 virtual void destroy_control();
979
983
987 bool equals(const xtd::object& obj) const noexcept override;
991 bool equals(const control& value) const noexcept override;
992
996 bool focus();
997
1001
1004 std::optional<xtd::drawing::color> get_back_color() const noexcept;
1006
1009 std::optional<xtd::drawing::font> get_font() const noexcept;
1011
1014 std::optional<xtd::drawing::color> get_fore_color() const noexcept;
1016
1021 size_t get_child_index(intptr child) const;
1022
1026 size_t get_child_index(intptr child, bool& throw_exception) const;
1027
1030 xtd::size get_hash_code() const noexcept override;
1031
1034 virtual void hide();
1035
1038 virtual void invalidate() const;
1039
1043 virtual void invalidate(bool invalidate_children) const;
1044
1048 virtual void invalidate(const drawing::rectangle& rect) const;
1049
1054 virtual void invalidate(const drawing::rectangle& rect, bool invalidate_children) const;
1055
1059 virtual void invalidate(const drawing::region& region) const;
1060
1065 virtual void invalidate(const drawing::region& region, bool invalidate_children) const;
1066
1070 std::optional<object_ref> invoke(delegate<void()> method) override;
1074 std::optional<object_ref> invoke(delegate<void(xtd::array<xtd::any_object>)> method, const xtd::array<xtd::any_object>& args) override;
1078 std::optional<object_ref> invoke(delegate<void(xtd::array<xtd::any_object>)> method, const xtd::any_object& arg) override;
1079
1083
1087 xtd::drawing::point point_to_client(const xtd::drawing::point& p) const;
1088
1092 xtd::drawing::point point_to_screen(const xtd::drawing::point& p) const;
1093
1100 bool post_message(intptr hwnd, int32 msg, intptr wparam, intptr lparam) const;
1101
1107
1111 virtual void refresh() const;
1112
1118
1126
1133 intptr send_message(intptr hwnd, int32 msg, intptr wparam, intptr lparam) const;
1134
1138
1145
1153
1156 virtual void show();
1157
1164
1167 xtd::string to_string() const noexcept override;
1168
1175 virtual void update() const;
1177
1179
1185 control& operator <<(control& child);
1186
1191 control& operator >>(control& child);
1193
1195
1199 static control create();
1203 static control create(const drawing::point& location);
1208 static control create(const drawing::point& location, const drawing::size& size);
1214 static control create(const drawing::point& location, const drawing::size& size, const xtd::string& name);
1218 static control create(const control& paren);
1225 static control create(const control& parent, const drawing::point& location);
1231 static control create(const control& parent, const drawing::point& location, const drawing::size& size);
1238 static control create(const control& parent, const drawing::point& location, const drawing::size& size, const xtd::string& name);
1241 template<class control_t>
1242 static control_t create() {
1243 auto result = control_t {};
1244 return result;
1245 }
1246
1249 template<class control_t>
1250 static control_t create(const drawing::point& location) {
1251 auto result = control_t {};
1252 result.location(location);
1253 return result;
1254 }
1255
1259 template<class control_t>
1260 static control_t create(const drawing::point& location, const drawing::size& size) {
1261 auto result = control_t {};
1262 result.location(location);
1263 result.size(size);
1264 return result;
1265 }
1266
1271 template<class control_t>
1272 static control_t create(const drawing::point& location, const drawing::size& size, const xtd::string& name) {
1273 auto result = control_t {};
1274 result.location(location);
1275 result.size(size);
1276 result.name(name);
1277 return result;
1278 }
1279
1282 template<class control_t>
1283 static control_t create(const control& parent) {
1284 auto result = control_t {};
1285 result.parent(parent);
1286 return result;
1287 }
1288
1292 template<class control_t>
1293 static control_t create(const control& parent, const drawing::point& location) {
1294 auto result = control_t {};
1295 result.parent(parent);
1296 result.location(location);
1297 return result;
1298 }
1299
1304 template<class control_t>
1305 static control_t create(const control& parent, const drawing::point& location, const drawing::size& size) {
1306 auto result = control_t {};
1307 result.parent(parent);
1308 result.location(location);
1309 result.size(size);
1310 return result;
1311 }
1312
1318 template<class control_t>
1319 static control_t create(const control& parent, const drawing::point& location, const drawing::size& size, const xtd::string& name) {
1320 auto result = control_t {};
1321 result.parent(parent);
1322 result.location(location);
1323 result.size(size);
1324 result.name(name);
1325 return result;
1326 }
1327
1330 template<class control_t>
1331 static control_t create(const xtd::string& text) {
1332 auto result = control_t {};
1333 result.text(text);
1334 return result;
1335 }
1336
1340 template<class control_t>
1341 static control_t create(const xtd::string& text, const drawing::point& location) {
1342 auto result = control_t {};
1343 result.text(text);
1344 result.location(location);
1345 return result;
1346 }
1347
1352 template<class control_t>
1353 static control_t create(const xtd::string& text, const drawing::point& location, const drawing::size& size) {
1354 auto result = control_t {};
1355 result.text(text);
1356 result.location(location);
1357 result.size(size);
1358 return result;
1359 }
1360
1366 template<class control_t>
1367 static control_t create(const xtd::string& text, const drawing::point& location, const drawing::size& size, const xtd::string& name) {
1368 auto result = control_t {};
1369 result.text(text);
1370 result.location(location);
1371 result.size(size);
1372 result.name(name);
1373 return result;
1374 }
1375
1379 template<class control_t>
1380 static control_t create(const control& parent, const xtd::string& text) {
1381 auto result = control_t {};
1382 result.parent(parent);
1383 result.text(text);
1384 return result;
1385 }
1386
1391 template<class control_t>
1392 static control_t create(const control& parent, const xtd::string& text, const drawing::point& location) {
1393 auto result = control_t {};
1394 result.parent(parent);
1395 result.text(text);
1396 result.location(location);
1397 return result;
1398 }
1399
1405 template<class control_t>
1406 static control_t create(const control& parent, const xtd::string& text, const drawing::point& location, const drawing::size& size) {
1407 auto result = control_t {};
1408 result.parent(parent);
1409 result.text(text);
1410 result.location(location);
1411 result.size(size);
1412 return result;
1413 }
1414
1421 template<class control_t>
1422 static control_t create(const control& parent, const xtd::string& text, const drawing::point& location, const drawing::size& size, const xtd::string& name) {
1423 auto result = control_t {};
1424 result.parent(parent);
1425 result.text(text);
1426 result.location(location);
1427 result.size(size);
1428 result.name(name);
1429 return result;
1430 }
1431
1436 static std::optional<control_ref> from_child_handle(intptr handle);
1437
1441 static std::optional<control_ref> from_handle(intptr handle);
1443
1445
1451
1456
1461
1466
1471
1496
1501
1506
1510
1514
1519
1543
1564
1569
1574
1579
1584
1589
1594
1606
1620
1632
1637
1642
1664
1680
1700
1714
1728
1743
1757
1771
1785
1800
1804
1813
1818
1823
1832
1837
1842
1847
1852
1857
1862
1868
1869 protected:
1870 friend class application;
1871 friend class context_menu;
1872 friend class horizontal_layout_panel;
1873 friend class paint_event_args;
1874 friend class screen;
1875 friend class vertical_layout_panel;
1876 friend class style_sheets::style_sheet;
1877
1879
1884
1890 virtual forms::create_params create_params() const noexcept;
1891
1895 virtual drawing::color default_back_color() const noexcept;
1896
1899 virtual forms::cursor default_cursor() const noexcept;
1900
1903 virtual drawing::font default_font() const noexcept;
1904
1907 virtual drawing::color default_fore_color() const noexcept;
1908
1911 virtual drawing::size default_size() const noexcept;
1913
1915
1921 xtd::uptr<xtd::object> clone() const override;
1922
1927 virtual void create_handle();
1928
1932 virtual void destroy_handle();
1933
1937
1942 bool get_style(control_styles flag) const noexcept;
1943
1946 virtual drawing::size measure_control() const noexcept;
1947
1950 drawing::size measure_text() const noexcept;
1951
1954 virtual void on_auto_size_changed(const event_args& e);
1955
1958 virtual void on_back_color_changed(const event_args& e);
1959
1963
1967
1971
1974 virtual void on_click(const event_args& e);
1975
1979
1983
1987
1990 virtual void on_create_control();
1991
1994 virtual void on_cursor_changed(const event_args& e);
1995
1998 virtual void on_destroy_control();
1999
2002 virtual void on_dock_changed(const event_args& e);
2003
2006 virtual void on_double_click(const event_args& e);
2007
2010 virtual void on_enabled_changed(const event_args& e);
2011
2014 virtual void on_fore_color_changed(const event_args& e);
2015
2018 virtual void on_font_changed(const event_args& e);
2019
2022 virtual void on_got_focus(const event_args& e);
2023
2026 virtual void on_handle_created(const event_args& e);
2027
2030 virtual void on_handle_destroyed(const event_args& e);
2031
2035
2039
2043
2047
2050 virtual void on_layout(const event_args& e);
2051
2054 virtual void on_location_changed(const event_args& e);
2055
2058 virtual void on_lost_focus(const event_args& e);
2059
2062 virtual void on_mouse_click(const mouse_event_args& e);
2063
2067
2070 virtual void on_mouse_down(const mouse_event_args& e);
2071
2074 virtual void on_mouse_enter(const event_args& e);
2075
2079
2082 virtual void on_mouse_leave(const event_args& e);
2083
2086 virtual void on_mouse_move(const mouse_event_args& e);
2087
2090 virtual void on_mouse_up(const mouse_event_args& e);
2091
2094 virtual void on_mouse_wheel(const mouse_event_args& e);
2095
2098 virtual void on_move(const event_args& e);
2099
2102 virtual void on_paint(paint_event_args& e);
2103
2107 virtual void on_paint_background(paint_event_args& e);
2108
2112
2116
2119 virtual void on_parent_changed(const event_args& e);
2120
2124
2128
2132
2135 virtual void on_resize(const event_args& e);
2136
2139 virtual void on_region_changed(const event_args& e);
2140
2144
2147 virtual void on_size_changed(const event_args& e);
2148
2152
2156
2159 virtual void on_tab_stop_changed(const event_args& e);
2160
2163 virtual void on_text_changed(const event_args& e);
2164
2167 virtual void on_visible_changed(const event_args& e);
2168
2169 void post_recreate_handle() noexcept;
2170
2173 virtual void recreate_handle();
2174
2186
2190 void set_can_focus(bool value);
2191
2195 virtual void set_text(const xtd::string& text);
2196
2205
2209
2215 void set_style(control_styles flag, bool value);
2216
2222 virtual void wnd_proc(message& m);
2224
2226
2232
2234 bool get_state(control::state flag) const noexcept;
2235 void set_state(control::state flag, bool value);
2236 bool on_context_menu_item_click(xtd::forms::context_menu& menu, intptr menu_id) const;
2238
2239 private:
2240 void do_layout_children_with_dock_style();
2241 void do_layout_with_auto_size_mode();
2242 void do_layout_with_anchor_styles();
2243 static bool is_trace_form_or_control(const string& name);
2244 void on_controls_item_added(size_t, control_ref item);
2245 void on_controls_item_removed(size_t, control_ref item);
2246 void on_parent_size_changed(object& sender, const event_args& e);
2247 void show_context_menu(xtd::forms::context_menu& menu, const xtd::drawing::point& pos) const;
2248 void reflect_message(intptr handle, message& message);
2249 intptr wnd_proc_(intptr hwnd, int32 msg, intptr wparam, intptr lparam, intptr handle);
2250 void wm_app_idle(message& message);
2251 void wm_child_activate(message& message);
2252 void wm_command(message& message);
2253 void wm_command_control(message& message);
2254 void wm_ctlcolor(message& message);
2255 void wm_ctlcolor_control(message& message);
2256 void wm_create(message& message);
2257 void wm_destroy(message& message);
2258 void wm_key_char(message& message);
2259 void wm_kill_focus(message& message);
2260 void wm_menu_command(message& message);
2261 void wm_mouse_down(message& message);
2262 void wm_mouse_double_click(message& message);
2263 void wm_mouse_enter(message& message);
2264 void wm_mouse_leave(message& message);
2265 void wm_mouse_up(message& message);
2266 void wm_mouse_move(message& message);
2267 void wm_move(message& message);
2268 void wm_mouse_wheel(message& message);
2269 void wm_notify(message& message);
2270 void wm_notify_control(message& message);
2271 void wm_paint(message& message);
2272 void wm_erase_background(message& message);
2273 void wm_help(message& message);
2274 void wm_scroll(message& message);
2275 void wm_scroll_control(message& message);
2276 void wm_set_focus(message& message);
2277 void wm_set_text(message& message);
2278 void wm_show(message& message);
2279 void wm_size(message& message);
2280 void wm_sizing(message& message);
2281 void wm_style_sheet_changed(message& message);
2282
2283 static bool check_for_illegal_cross_thread_calls_;
2284 static forms::keys modifier_keys_;
2285 static forms::mouse_buttons mouse_buttons_;
2286 static std::map<intptr, control*> handles_;
2287 static control_collection top_level_controls_;
2288
2289 xtd::sptr<data> data_;
2290 };
2291 }
2292}
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:61
Represents a strongly typed list of objects that can be accessed by index. Provides methods to search...
Definition list.hpp:79
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:21
Provides static methods and properties to manage an application, such as methods to start and stop an...
Definition application.hpp:51
component()
Initialises a new instance of the component class.
Represents a shortcut menu.
Definition context_menu.hpp:36
Represents a collection of controls.
Definition control.hpp:152
control_collection(const allocator_type &allocator=allocator_type())
Creates a new object xtd::forms::control::control_collection with specified allocator (optional).
control_t & emplace_at(size_t index, args_t &&...args)
Creates and inserts specified control at specified position.
Definition control.hpp:230
xtd::forms::layout::arranged_element_collection< control_ref > base
Represents the base type of the collection.
Definition control.hpp:158
control_t & emplace(const_iterator pos, args_t &&...args)
Creates and inserts specified control at specified position.
Definition control.hpp:212
iterator insert(const_iterator pos, const value_type &value) override
Inserts specified element at specified position.
void push_back(const value_type &value) override
Adds an element to the end.
control_t & emplace_back(args_t &&...args)
Creates and adds a control to the end.
Definition control.hpp:247
void on_item_removed(size_t index, control_ref &item) override
Raises the xtd::forms::layout::arranged_element_collection::item_removed event.
Definition control.hpp:304
control_collection(bool keep_cloned_controls, const allocator_type &allocator=allocator_type())
Creates a new object xtd::forms::control::control_collection with specified keep_cloned_controls,...
void insert_at(size_t index, const value_type &value) 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.
virtual void on_paint_background(paint_event_args &e)
Paints the background of the xtd::forms::control.
virtual void on_click(const event_args &e)
Raises the xtd::forms::control::click event.
virtual void on_help_requested(help_event_args &e)
Raises the xtd::forms::control::help_requested event.
virtual void on_back_color_changed(const event_args &e)
Raises the xtd::forms::control::back_color_changed event.
virtual void on_auto_size_changed(const event_args &e)
Raises the xtd::forms::control::auto_size_changed event.
virtual void bring_to_front()
Brings the control to the front of the z-order.
event< control, event_handler > parent_changed
Occurs when the value of the xtd::forms::control::parent property changes.
Definition control.hpp:1817
virtual void on_size_changed(const event_args &e)
Raises the xtd::forms::control::size_changed event.
event< control, help_event_handler > help_requested
Occurs when the user requests help for a xtd::forms::control.
Definition control.hpp:1593
virtual void destroy_handle()
Destroys the handle associated with the control.
virtual int32 left() const noexcept
Gets the distance, in pixels, between the left edge of the control and the left edge of its container...
static control_t create(const xtd::string &text, const drawing::point &location, const drawing::size &size, const xtd::string &name)
A factory to create a specified control with specified text, location,size, and name.
Definition control.hpp:1367
virtual void on_move(const event_args &e)
Raises the xtd::forms::control::move event.
static control_t create(const control &parent, const drawing::point &location, const drawing::size &size)
A factory to create a specified control with specified parent, location, and size.
Definition control.hpp:1305
virtual drawing::size measure_control() const noexcept
Measure this control.
event< control, event_handler > dock_changed
Occurs when the value of the xtd::forms::control::dock property changes.
Definition control.hpp:1518
virtual void on_parent_back_color_changed(const event_args &e)
Raises the xtd::forms::control::parent_back_color_changed event.
virtual void def_wnd_proc(message &message)
Sends the specified message to the default window procedure.
event< control, event_handler > move
Occurs when the control is moved.
Definition control.hpp:1803
virtual int32 width() const noexcept
Gets the width of the control.
event< control, 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:1846
virtual void set_client_size_core(int32 width, int32 height)
Sets the size of the client area of the control.
virtual void on_control_appearance_changed(const event_args &e)
Raises the control::control_appearance_changed event.
event< control, event_handler > background_image_changed
Occurs when the value of the xtd::forms::control::background_image property changes.
Definition control.hpp:1460
bool post_message(intptr hwnd, int32 msg, intptr wparam, intptr lparam) const
Places (posts) a message in the message queue with specified hwnd, message, wparam and lparam.
virtual void on_got_focus(const event_args &e)
Raises the xtd::forms::control::got_focus event.
static void set_mouse_buttons(forms::mouse_buttons value)
Sets a value indicating which of the mouse buttons is in a pressed state.
virtual void on_mouse_up(const mouse_event_args &e)
Raises the xtd::forms::control::mouse_up event.
virtual drawing::color fore_color() const noexcept
Gets the foreground color of the control.
virtual void on_layout(const event_args &e)
Raises the xtd::forms::control::layout event.
virtual const drawing::size & client_size() const noexcept
Gets the height and width of the client area of the control.
virtual bool pre_process_message(const xtd::forms::message &message)
Preprocesses keyboard or input messages within the message loop before they are dispatched.
event< control, event_handler > client_size_changed
Occurs when the value of the xtd::forms::control::client_size property changes.
Definition control.hpp:1500
void suspend_layout()
Temporarily suspends the layout logic for the control.
event< control, event_handler > system_colors_changed
Occurs when the xtd::drwing::system_colors changes.
Definition control.hpp:1851
event< control, event_handler > tab_stop_changed
Occurs when the xtd::forms::control::tab_stop property value changes.
Definition control.hpp:1856
virtual void on_parent_fore_color_changed(const event_args &e)
Raises the xtd::forms::control::parent_fore_color_changed event.
event< control, key_event_handler > key_up
Occurs when a key is released while the xtd::forms::control has focus.
Definition control.hpp:1631
virtual void on_key_up(key_event_args &e)
Raises the xtd::forms::control::key_up event.
static control_t create(const xtd::string &text, const drawing::point &location, const drawing::size &size)
A factory to create a specified control with specified text, location, and size.
Definition control.hpp:1353
virtual const drawing::rectangle & client_rectangle() const noexcept
Gets the rectangle that represents the client area of the control.
virtual void on_handle_created(const event_args &e)
Raises the xtd::forms::control::handle_created event.
bool equals(const xtd::object &obj) const noexcept override
Determines whether the specified object is equal to the current object.
std::reference_wrapper< xtd::forms::context_menu > context_menu_ref
Represent an xtd::forms::context_menu reference.
Definition control.hpp:148
event< control, event_handler > enabled_changed
Occurs when the value of the xtd::forms::control::enabled property changes.
Definition control.hpp:1578
virtual drawing::color default_fore_color() const noexcept
Gets the default foreground color of the control.
virtual void on_parent_changed(const event_args &e)
Raises the xtd::forms::control::parent_changed event.
virtual void on_parent_cursor_changed(const event_args &e)
Raises the xtd::forms::control::parent_cursor_changed event.
static control create()
A factory to create a specified control.
virtual void on_key_down(key_event_args &e)
Raises the xtd::forms::control::key_down event.
event< control, event_handler > visible_changed
Occurs when the value of the xtd::forms::control::visible property changes.
Definition control.hpp:1866
virtual void on_background_image_changed(const event_args &e)
Raises the xtd::forms::control::background_image_changed event.
virtual bool can_focus() const noexcept
Gets a value indicating whether the control can receive focus.
static std::optional< control_ref > from_child_handle(intptr handle)
Retrieves the control that contains the specified handle.
control(const xtd::string &text)
Initializes a new instance of the xtd::forms::control class with specific text.
virtual drawing::font default_font() const noexcept
Gets the default font of the control.
static xtd::drawing::point mouse_position() noexcept
Gets the position of the mouse cursor in screen coordinates.
xtd::drawing::point point_to_screen(const xtd::drawing::point &p) const
Computes the location of the specified client point into screen coordinates.
xtd::uptr< xtd::object > clone() const override
Creates a new object that is a copy of the current instance.
virtual void on_handle_destroyed(const event_args &e)
Raises the xtd::forms::control::handle_destroyed event.
virtual const xtd::drawing::image & background_image() const noexcept
Gets the background image displayed in the control.
virtual void on_cursor_changed(const event_args &e)
Raises the xtd::forms::control::cursor_changed event.
event< control, event_handler > text_changed
Occurs when the value of the xtd::forms::control::text property changes.
Definition control.hpp:1861
virtual void refresh() const
Forces the control to invalidate its client area and immediately redraw itself and any child controls...
virtual drawing::color default_back_color() const noexcept
Gets the default background color of the control.
virtual void on_dock_changed(const event_args &e)
Raises the xtd::forms::control::dock_changed event.
event< control, event_handler > layout
Occurs when a xtd::forms::control should reposition its child controls.
Definition control.hpp:1636
virtual const xtd::drawing::region & region() const noexcept
Gets the window region associated with the control.
intptr handle() const override
Gets the window handle that the control is bound to.
event< control, event_handler > font_changed
Occurs when the value of the xtd::forms::control::font property changes.
Definition control.hpp:1588
virtual drawing::point location() const noexcept
Gets the coordinates of the upper-left corner of the control relative to the upper-left corner of its...
bool is_handle_created() const noexcept
Gets a value indicating whether the control has a handle associated with it.
virtual drawing::rectangle display_rectangle() const noexcept
Gets the rectangle that represents the display area of the control.
virtual int32 height() const noexcept
Gets the height of the control.
virtual void on_font_changed(const event_args &e)
Raises the xtd::forms::control::font_changed event.
virtual drawing::font font() const noexcept
Gets the font of the text displayed by the control.
virtual void on_tab_stop_changed(const event_args &e)
Raises the xtd::forms::control::tab_stop_changed event.
virtual std::optional< control_ref > top_level_control() const noexcept
Gets the parent control that is not parented by another Windows Forms control. Typically,...
virtual void on_lost_focus(const event_args &e)
Raises the xtd::forms::control::lost_focus event.
drawing::size measure_text() const noexcept
Measure this control text.
xtd::string to_string() const noexcept override
Returns a string containing the name of the control, if any.
bool recreating_handle() const noexcept
Gets a value indicating whether the control is currently re-creating its handle.
auto_size_mode get_auto_size_mode() const
Gets a value indicating how a control will behave when its auto_size property is enabled.
intptr toolkit_handle() const noexcept
Gets the toolkit handle that the control is bound to.
virtual bool tab_stop() const noexcept
Gets a value indicating whether the user can give the focus to this control using the TAB key.
event< control, event_handler > double_click
Occurs when the xtd::forms::control is double-clicked.
Definition control.hpp:1542
virtual bool enabled() const noexcept
Gets a value indicating whether the control can respond to user interaction.
virtual xtd::string product_name() const noexcept
Gets the product name of the assembly containing the control.
event< control, event_handler > click
Occurs when the xtd::forms::control is clicked.
Definition control.hpp:1495
virtual control_collection & controls() noexcept
Gets the collection of controls contained within the control.
virtual bool double_buffered() const noexcept
Gets a value indicating whether this control should redraw its surface using a secondary buffer to re...
void set_can_focus(bool value)
Sets a value indicating whether the control can receive focus.
virtual bool visible() const noexcept
Gets a value indicating whether the control and all its child controls are displayed.
virtual void on_mouse_double_click(const mouse_event_args &e)
Raises the xtd::forms::control::mouse_double_click event.
virtual void on_background_image_layout_changed(const event_args &e)
Raises the xtd::forms::control::background_image_layout_changed event.
virtual xtd::any_object tag() const noexcept
Gets the object that contains data about the control.
virtual void update() const
Causes the control to redraw the invalidated regions within its client area.
event< control, 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:1619
static control_t create(const control &parent, const xtd::string &text)
A factory to create a specified control with specified parent, and text.
Definition control.hpp:1380
virtual void on_paint(paint_event_args &e)
Raises the xtd::forms::control::paint event.
virtual int32 bottom() const noexcept
Gets the distance, in pixels, between the bottom edge of the control and the top edge of its containe...
virtual bool can_select() const noexcept
Gets a value indicating whether the control can be selected.
bool invoke_required() const noexcept override
Gets a value indicating whether the caller must call an invoke method when making method calls to the...
static forms::keys modifier_keys() noexcept
Gets a value indicating which of the modifier keys (SHIFT, CTRL, and ALT) is in a pressed state.
event< control, event_handler > handle_created
Occurs when a handle is created for the xtd::forms::control.
Definition control.hpp:1568
virtual void on_region_changed(const event_args &e)
Raises the xtd::forms::control::region_changed event.
event< control, event_handler > handle_destroyed
Occurs when the control's handle is in the process of being destroyed.
Definition control.hpp:1573
virtual forms::padding margin() const noexcept
Gets the space between controls.
virtual void on_create_control()
Raises the xtd::forms::control::create_control event.
virtual void on_control_added(const control_event_args &e)
Raises the xtd::forms::control::control_added event.
event< control, control_event_handler > control_removed
Occurs when a new xtd::forms::control:: is removed to the xtd::forms::control::control_collection.
Definition control.hpp:1513
event< control, 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:1713
virtual forms::cursor cursor() const noexcept
Gets the cursor that is displayed when the mouse pointer is over the control.
static control_t create(const control &parent, const xtd::string &text, const drawing::point &location)
A factory to create a specified control with specified parent, text, and location.
Definition control.hpp:1392
bool get_style(control_styles flag) const noexcept
Retrieves the value of the specified control style bit for the control.
virtual void on_double_click(const event_args &e)
Raises the xtd::forms::control::double_click event.
virtual const xtd::string & name() const noexcept
Gets the name of the control.
virtual void on_control_removed(const control_event_args &e)
Raises the xtd::forms::control::control_removed event.
control()
Initializes a new instance of the xtd::forms::control class with default settings.
void set_parent(intptr handle)
Sets the parent handle of the control.
event< control, event_handler > mouse_enter
Occurs when the mouse pointer enters the xtd::forms::control.
Definition control.hpp:1727
event< control, event_handler > auto_size_changed
Occurs when the value of the xtd::forms::control::auto_size property changes.
Definition control.hpp:1450
event< control, mouse_event_handler > mouse_double_click
Occurs when the xtd::forms::control is double clicked by the mouse.
Definition control.hpp:1699
virtual void hide()
Conceals the control from the user.
void set_auto_size_mode(auto_size_mode auto_size_mode)
Sets a value indicating how a control will behave when its auto_size property is enabled.
virtual void set_bounds_core(int32 x, int32 y, int32 width, int32 height, bounds_specified specified)
Performs the work of setting the specified bounds of this control.
virtual void on_style_sheet_changed(const event_args &e)
Raises the xtd::forms::control::style_sheet_changed event.
static control_t create(const xtd::string &text)
A factory to create a specified control with specified text.
Definition control.hpp:1331
virtual void on_resize(const event_args &e)
Raises the xtd::forms::control::region event.
xtd::drawing::point point_to_client(const xtd::drawing::point &p) const
Computes the location of the specified screen point into client coordinates.
event< control, paint_event_handler > paint
Occurs when the xtd::forms::control is redrawn.
Definition control.hpp:1812
static control_t create(const drawing::point &location, const drawing::size &size)
A factory to create a specified control with specified location, and size.
Definition control.hpp:1260
virtual dock_style dock() const noexcept
Gets which control borders are docked to its parent control and determines how a control is resized w...
event< control, event_handler > lost_focus
Occurs when the xtd::forms::control loses focus.
Definition control.hpp:1663
static control_t create(const control &parent, const xtd::string &text, const drawing::point &location, const drawing::size &size, const xtd::string &name)
A factory to create a specified control with specified parent, text, location, size,...
Definition control.hpp:1422
void resume_layout()
Resumes usual layout logic.
intptr native_handle() const noexcept
Gets the native handle that the control is bound to.
event< control, event_handler > background_image_layout_changed
Occurs when the value of the xtd::forms::control::background_image_layout property changes.
Definition control.hpp:1465
xtd::forms::visual_styles::control_state control_state() const noexcept
Gets state.
static control_t create(const control &parent, const drawing::point &location)
A factory to create a specified control with specified parent, and location.
Definition control.hpp:1293
virtual void on_enabled_changed(const event_args &e)
Raises the xtd::forms::control::enabled_changed event.
event< control, event_handler > region_changed
Occurs when the value of the xtd::forms::control::region property changes.
Definition control.hpp:1822
virtual const drawing::size & maximum_size() const noexcept
Gets the size that is the upper limit that xtd::forms::control::get_preferred_size can specify.
virtual void on_fore_color_changed(const event_args &e)
Raises the xtd::forms::control::fore_color_changed event.
virtual void on_destroy_control()
Raises the xtd::forms::control::destroy_control event.
virtual void invalidate() const
Invalidates the entire surface of the control and causes the control to be redrawn.
virtual void on_location_changed(const event_args &e)
Raises the xtd::forms::control::location_changed event.
event< control, event_handler > mouse_leave
Occurs when the mouse pointer leaves the xtd::forms::control.
Definition control.hpp:1756
event< control, mouse_event_handler > mouse_move
Occurs when the mouse pointer is moved over the xtd::forms::control.
Definition control.hpp:1770
virtual xtd::forms::right_to_left right_to_left() const noexcept
Gets a value indicating whether control's elements are aligned to support locales using right-to-left...
virtual forms::create_params create_params() const noexcept
Gets the required creation parameters when the control handle is created.
virtual forms::padding padding() const noexcept
Gets padding within the control.
size_t get_child_index(intptr child) const
Retrieves the index of a control within the control collection.
virtual void on_visible_changed(const event_args &e)
Raises the xtd::forms::control::visible_changed event.
event< control, event_handler > right_to_left_changed
Occurs when the value of the xtd::forms::control::right_to_left property changes.
Definition control.hpp:1836
static control_t create(const control &parent, const xtd::string &text, const drawing::point &location, const drawing::size &size)
A factory to create a specified control with specified parent, text, location, and size.
Definition control.hpp:1406
virtual const drawing::size & maximum_client_size() const noexcept
Gets the client size that is the upper limit that xtd::forms::control::get_preferred_size can specify...
virtual const drawing::size & minimum_size() const noexcept
Gets the size that is the lower limit that xtd::forms::control::get_preferred_size can specify.
static control_t create(const drawing::point &location, const drawing::size &size, const xtd::string &name)
A factory to create a specified control with specified location, size, and name.
Definition control.hpp:1272
virtual int32 top() const noexcept
Gets the distance, in pixels, between the top edge of the control and the top edge of its container's...
virtual drawing::color back_color() const noexcept
Gets the background color for the control.
static bool check_for_illegal_cross_thread_calls() noexcept
Gets a value indicating whether to catch calls on the wrong thread that access a xtd::forms::contrtol...
virtual void on_mouse_down(const mouse_event_args &e)
Raises the xtd::forms::control::mouse_down event.
virtual forms::control_appearance control_appearance() const noexcept
Gets control appearance.
void set_bounds(int32 x, int32 y, int32 width, int32 height)
Sets the bounds of the control to the specified location and size.
std::optional< object_ref > end_invoke(xtd::async_result async) override
Retrieves the return value of the asynchronous operation represented by the async_result_invoke passe...
virtual void on_client_size_changed(const event_args &e)
Raises the xtd::forms::control::client_size_changed event.
void create_control()
Forces the creation of the visible control, including the creation of the handle and any visible chil...
bool can_raise_events() const noexcept override
Determines if events can be raised on the control.
virtual void on_parent_font_changed(const event_args &e)
Raises the xtd::forms::control::parent_font_changed event.
virtual void on_key_press(key_press_event_args &e)
Raises the xtd::forms::control::key_press event.
virtual const xtd::string & text() const noexcept
Gets the text associated with this control.
virtual bool focused() const noexcept
Gets a value indicating whether the control has input focus.
xtd::async_result begin_invoke(delegate< void()> method) override
Executes the specified delegate asynchronously on the thread that the control's underlying handle was...
virtual anchor_styles anchor() const noexcept
Gets the edges of the container to which a control is bound and determines how a control is resized w...
event< control, event_handler > control_appearance_changed
Occurs when the value of the xtd::forms::control::control_appearance property changes.
Definition control.hpp:1470
virtual drawing::size default_size() const noexcept
Gets the default size of the control.
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,...
static forms::mouse_buttons mouse_buttons() noexcept
Gets a value indicating which of the mouse buttons is in a pressed state.
virtual void on_mouse_wheel(const mouse_event_args &e)
Raises the xtd::forms::control::mouse_wheel event.
virtual void on_right_to_left_changed(const event_args &e)
Raises the xtd::forms::control::right_to_left_changed event.
virtual void wnd_proc(message &m)
Processes Windows messages.
event< control, key_event_handler > key_down
Occurs when a key is pressed while the xtd::forms::control has focus.
Definition control.hpp:1605
event< control, event_handler > got_focus
Occurs when the xtd::forms::control receives focus.
Definition control.hpp:1563
event< control, event_handler > location_changed
Occurs when the value of the xtd::forms::control::location property changes.
Definition control.hpp:1641
xtd::size get_hash_code() const noexcept override
Serves as a hash function for a particular type.
virtual void on_text_changed(const event_args &e)
Raises the xtd::forms::control::text_changed event.
bool focus()
Sets input focus to the control.
event< control, 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:1784
virtual int32 right() const noexcept
Gets the distance, in pixels, between the right edge of the control and the left edge of its containe...
virtual void destroy_control()
Forces the destruction of the visible control, including the destruction of the handle and any visibl...
void perform_layout()
Forces the control to apply layout logic to all its child controls.
event< control, mouse_event_handler > mouse_horizontal_wheel
Occurs when the mouse horizontal wheel moves while the xtd::forms::control has focus.
Definition control.hpp:1742
static control_t create(const control &parent)
A factory to create a specified control with specified parent.
Definition control.hpp:1283
event< control, mouse_event_handler > mouse_wheel
Occurs when the mouse wheel moves while the xtd::forms::control has focus.
Definition control.hpp:1799
virtual drawing::size size() const noexcept
Gets the height and width of the control.
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.
static control_t create(const drawing::point &location)
A factory to create a specified control with specified location.
Definition control.hpp:1250
drawing::graphics create_graphics() const
Creates the xtd::drawing::graphics for the control.
virtual xtd::forms::image_layout background_image_layout() const noexcept
Gets the background image layout as defined in the xtd::forms::image_layout enumeration.
std::optional< object_ref > invoke(delegate< void()> method) override
Executes the specified delegate on the thread that owns the control's underlying window handle.
void set_style(control_styles flag, bool value)
Sets a specified control_styles flag to either true or false.
static control_t create(const control &parent, const drawing::point &location, const drawing::size &size, const xtd::string &name)
A factory to create a specified control with specified parent, location, size, and name.
Definition control.hpp:1319
event< control, event_handler > back_color_changed
Occurs when the value of the xtd::forms::control::back_color property changes.
Definition control.hpp:1455
virtual xtd::string company_name() const noexcept
Gets the name of the company or creator of the application containing the control.
event< control, 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:1509
virtual bool auto_size() const noexcept
Gets a value that indicates whether the control resizes based on its contents.
virtual void on_mouse_horizontal_wheel(const mouse_event_args &e)
Raises the xtd::forms::control::mouse_horizontal_wheel event.
virtual bool created() const noexcept
Gets a value indicating whether the control has been created.
virtual drawing::point auto_scroll_point() const noexcept
Gets where this control is scrolled to in scroll_control_into_view(control).
virtual const drawing::size & minimum_client_size() const noexcept
Gets the client size that is the lower limit that xtd::forms::control::get_preferred_size can specify...
event< control, event_handler > fore_color_changed
Occurs when the value of the xtd::forms::control::fore_color property changes.
Definition control.hpp:1583
virtual void create_handle()
Creates a handle for the control.
event< control, event_handler > resize
Occurs when the xtd::forms::control is resized.
Definition control.hpp:1831
virtual void show()
Displays the control to the user.
virtual std::optional< control_ref > parent() const noexcept
Gets the parent container of the control.
virtual void set_text(const xtd::string &text)
Sets the text associated with this control.
virtual void on_mouse_enter(const event_args &e)
Raises the xtd::forms::control::mouse_enter event.
event< control, event_handler > cursor_changed
Occurs when the value of the xtd::forms::control::cursor property changes.
Definition control.hpp:1505
virtual void on_system_colors_changed(const event_args &e)
Raises the control::system_colors_changed event.
virtual void on_mouse_leave(const event_args &e)
Raises the xtd::forms::control::mouse_leave event.
static std::optional< control_ref > from_handle(intptr handle)
Returns the control that is currently associated with the specified handle.
virtual drawing::rectangle bounds() const noexcept
Gets the size and location of the control including its nonclient elements, in pixels,...
virtual void recreate_handle()
Forces the re-creation of the handle for the control.
intptr send_message(intptr hwnd, int32 msg, intptr wparam, intptr lparam) const
Send a message with specified hwnd, message, wparam and lparam.
virtual void on_parent_enabled_changed(const event_args &e)
Raises the xtd::control::enabled_changed event when the xtd::control::enabled property value of the c...
virtual void on_mouse_move(const mouse_event_args &e)
Raises the xtd::forms::control::mouse_move event.
static control_t create(const xtd::string &text, const drawing::point &location)
A factory to create a specified control with specified text, and location.
Definition control.hpp:1341
event< control, mouse_event_handler > mouse_click
Occurs when the xtd::forms::control is clicked by the mouse.
Definition control.hpp:1679
virtual void on_mouse_click(const mouse_event_args &e)
Raises the xtd::forms::control::mouse_click event.
event< control, event_handler > size_changed
Occurs when the value of the xtd::forms::control::size property changes.
Definition control.hpp:1841
virtual forms::cursor default_cursor() const noexcept
Gets the default cursor for the control.
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:35
iterator begin() noexcept
Definition arranged_element_collection.hpp:176
iterator end() noexcept
Definition arranged_element_collection.hpp:186
virtual void on_item_removed(size_t index, type_t &item)
Raises the xtd::forms::layout::arranged_element_collection::item_removed event.
Definition arranged_element_collection.hpp:496
typename std::vector< value_type >::iterator iterator
Definition arranged_element_collection.hpp:86
std::allocator< value_type > allocator_type
Definition arranged_element_collection.hpp:72
virtual iterator insert(const_iterator pos, const value_type &value)
Definition arranged_element_collection.hpp:258
virtual void insert_at(size_t index, const value_type &value)
Definition arranged_element_collection.hpp:287
virtual void push_back(const value_type &item)
Definition arranged_element_collection.hpp:372
typename std::vector< value_type >::const_iterator const_iterator
Definition arranged_element_collection.hpp:88
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
Represents the status of an asynchronous operation.
Definition iasync_result.hpp:25
Supports cloning, which creates a new instance of a class with the same value as an existing instance...
Definition iclonable.hpp:21
Defines a generalized comparison method that a value type or class implements to create a type-specif...
Definition icomparable.hpp:21
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:22
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.
#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
xtd::shared_ptr_object< type_t > sptr
The xtd::sptr object is a shared pointer.
Definition sptr.hpp:25
int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:23
xtd::unique_ptr_object< type_t > uptr
The xtd::uptr object is a unique pointer.
Definition uptr.hpp:25
intmax_t intptr
Represent a pointer or a handle.
Definition intptr.hpp:23
int64_t int64
Represents a 64-bit signed integer.
Definition int64.hpp:23
std::optional< type_t > optional
Represents the optional alias on std::optional.
Definition optional.hpp:25
xtd::sptr< xtd::iasync_result > async_result
Represents the status of an asynchronous operation.
Definition async_result.hpp:19
uptr< type_t > new_uptr(args_t &&... args)
xtd::new_uptr operator. This operator creates a xtd::uptr object.
Definition new_uptr.hpp:24
type_t as(any_object &o)
Casts a type into another type.
Definition __as_any_object.hpp:59
xtd::ref< xtd::object > object_ref
Represents an object reference.
Definition object_ref.hpp:20
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_state
Specifies the visual state of a control that is drawn with visual styles.
Definition control_state.hpp:24
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
anchor_styles
Specifies how a control anchors to the edges of its container.
Definition anchor_styles.hpp:19
std::reference_wrapper< control > control_ref
Represents a control reference.
Definition control_ref.hpp:25
@ m
The M key.
Definition keys.hpp:223
@ end
The END key.
Definition keys.hpp:151
@ p
The P key.
Definition keys.hpp:229
@ insert
The INSERT key.
Definition keys.hpp:173
@ e
The E key.
Definition keys.hpp:207
@ y
Specifies that the top edge of the control is defined.
Definition bounds_specified.hpp:28
@ x
Specifies that the left edge of the control is defined.
Definition bounds_specified.hpp:26
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 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
const_iterator begin() const
Returns an iterator to the beginning.
Definition read_only_span.hpp:183
const_iterator end() const
Returns an iterator to the end.
Definition read_only_span.hpp:213
constexpr const_pointer data() const noexcept
Gets direct access to the underlying contiguous storage.
Definition read_only_span.hpp:201
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:31
Implements a Windows message.
Definition message.hpp:33
Contains xtd::forms::style_sheets::style_sheet class.
Contains xtd::forms::timer component.