xtd 0.2.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/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
150
153 public:
155
160
162
166 explicit control_collection() = default;
171 explicit control_collection(bool keep_cloned_controls);
173
175 explicit control_collection(const base& collection);
176 control_collection(const control_collection& collection);
177 control_collection& operator =(const control_collection& collection);
180
182
184 using base::operator [];
189 std::optional<value_type> operator [](const xtd::string& name) const;
194 std::optional<value_type> operator [](const xtd::string& name);
196
198
200 void add(const control_ref& value) override;
201
202 template<class control_t>
203 void add(control_t& value) {
204 for (auto it = begin(); it != end(); ++it)
205 if (it->get() == value) return;
206 if (!keep_cloned_controls_) base::add(value);
207 else {
208 auto control_ptr = as<control>(as<iclonable>(value).clone());
209 auto& control_ref = *control_ptr;
210 controls_.add(std::move(control_ptr));
212 }
213 }
214
224 template<class control_t, class ...args_t>
225 control_t& emplace_front(args_t&& ...args) {
226 auto control_ptr = xtd::new_uptr<control_t>(control_t::create(std::forward<args_t>(args)...));
227 auto& control_ref = *control_ptr;
228 controls_.add(std::move(control_ptr));
230 return control_ref;
231 }
232
242 template<class control_t, class ...args_t>
243 control_t& emplace_at(size_t index, args_t&& ...args) {
244 auto control_ptr = xtd::new_uptr<control_t>(control_t::create(std::forward<args_t>(args)...));
245 auto& control_ref = *control_ptr;
246 controls_.add(std::move(control_ptr));
248 return control_ref;
249 }
250
259 template<class control_t, class ...args_t>
260 control_t& emplace_back(args_t&& ...args) {
261 auto control_ptr = xtd::new_uptr<control_t>(control_t::create(std::forward<args_t>(args)...));
262 auto& control_ref = *control_ptr;
263 controls_.add(std::move(control_ptr));
265 return control_ref;
266 }
267
268 void insert(size_t index, const control_ref& value) override;
269
270 template<class control_t>
271 void insert(size_t index, control_t& value) {
272 for (auto it = begin(); it != end(); ++it)
273 if (it->get() == value) return;
274 if (!keep_cloned_controls_) base::insert(index, value);
275 else {
276 auto control_ptr = as<control>(as<iclonable>(value).clone());
277 auto& control_ref = *control_ptr;
278 controls_.add(std::move(control_ptr));
280 }
281 }
283
285
287 using arranged_element_collection::push_back;
288 template<class control_t>
289 [[deprecated("Replaced by xtd::forms::control::control_collection::add - Will be removed in version 0.4.0.")]]
290 void push_back(control_t& value) {add(value);}
292
293 protected:
295
297 void on_item_removed(size_t index, control_ref& item) override {
299 for (auto i = xtd::size {0}; i < controls_.count(); ++i) {
300 if (controls_[i].get() != &item.get()) continue;
301 controls_.remove_at(i);
302 break;
303 }
304 }
305
306
307 private:
310
311 bool keep_cloned_controls_ = false;
313 };
314
316
325 explicit control(const xtd::string& text);
352
354 control(control&& rhs);
355 control(const control&) = default;
356 control& operator = (const control&) = default;
357 ~control();
359
361
370 virtual anchor_styles anchor() const noexcept;
381
384 virtual drawing::point auto_scroll_point() const noexcept;
385
389 virtual bool auto_size() const noexcept;
395
400 virtual drawing::color back_color() const noexcept;
408 virtual control& back_color(const xtd::drawing::color& color);
410 virtual control& back_color(std::nullptr_t);
412
416 virtual const xtd::drawing::image& background_image() const noexcept;
422
427 virtual xtd::forms::image_layout background_image_layout() const noexcept;
428
435
440 virtual int32 bottom() const noexcept;
441
445 virtual drawing::rectangle bounds() const noexcept;
450 virtual control& bounds(const xtd::drawing::rectangle& bounds);
451
455 virtual bool can_focus() const noexcept;
456
468 virtual bool can_select() const noexcept;
469
472 bool can_raise_events() const noexcept override;
473
478 virtual const drawing::rectangle& client_rectangle() const noexcept;
479
483 virtual const drawing::size& client_size() const noexcept;
489
492 virtual xtd::string company_name() const noexcept;
493
496 virtual std::optional<context_menu_ref> context_menu() const noexcept;
500 virtual control& context_menu(xtd::forms::context_menu& value);
504 virtual control& context_menu(std::nullptr_t);
505
511 virtual forms::control_appearance control_appearance() const noexcept;
518
525 virtual control_collection& controls() noexcept;
532 virtual const control_collection& controls() const noexcept;
533
537 virtual bool created() const noexcept;
538
542 virtual forms::cursor cursor() const noexcept;
547 virtual control& cursor(const xtd::forms::cursor& cursor);
549 virtual control& cursor(std::nullptr_t);
551
554 virtual drawing::rectangle display_rectangle() const noexcept;
555
564 virtual dock_style dock() const noexcept;
575
578 virtual bool double_buffered() const noexcept;
583
586 virtual bool enabled() const noexcept;
590 virtual control& enabled(bool enabled);
591
594 virtual bool focused() const noexcept;
595
599 virtual drawing::font font() const noexcept;
604 virtual control& font(const xtd::drawing::font& font);
606 virtual control& font(std::nullptr_t);
608
612 virtual drawing::color fore_color() const noexcept;
617 virtual control& fore_color(const xtd::drawing::color& color);
619 virtual control& fore_color(std::nullptr_t);
621
625 intptr handle() const override;
626
629 virtual int32 height() const noexcept;
634
637 bool invoke_required() const noexcept override;
638
642 bool is_handle_created() const noexcept;
643
646 virtual int32 left() const noexcept;
651
654 virtual drawing::point location() const noexcept;
658 virtual control& location(const xtd::drawing::point& location);
659
662 virtual forms::padding margin() const noexcept;
666 virtual control& margin(const xtd::forms::padding& margin);
667
673 virtual const drawing::size& maximum_client_size() const noexcept;
680
686 virtual const drawing::size& maximum_size() const noexcept;
693
699 virtual const drawing::size& minimum_client_size() const noexcept;
706
712 virtual const drawing::size& minimum_size() const noexcept;
719
723 intptr native_handle() const noexcept;
724
727 virtual const xtd::string& name() const noexcept;
731 virtual control& name(const xtd::string& name);
732
735 virtual forms::padding padding() const noexcept;
740
743 virtual std::optional<control_ref> parent() const noexcept;
747 virtual control& parent(const control& parent);
751 virtual control& parent(std::nullptr_t);
752
755 virtual xtd::string product_name() const noexcept;
756
759 bool recreating_handle() const noexcept;
760
765 virtual const xtd::drawing::region& region() const noexcept;
771 virtual control& region(const xtd::drawing::region& value);
772
775 virtual int32 right() const noexcept;
776
792 virtual xtd::forms::right_to_left right_to_left() const noexcept;
811 virtual control& right_to_left(std::nullptr_t);
813
816 virtual drawing::size size() const noexcept;
820 virtual control& size(const drawing::size& size);
821
825 virtual style_sheets::style_sheet style_sheet() const noexcept;
829 virtual control& style_sheet(const style_sheets::style_sheet& value);
834 virtual control& style_sheet(const xtd::string& value);
839 virtual control& style_sheet(std::nullptr_t);
840
845 virtual bool tab_stop() const noexcept;
851 virtual control& tab_stop(bool value);
852
857 virtual xtd::any_object tag() const noexcept;
863 virtual control& tag(const xtd::any_object& tag);
864
867 virtual const xtd::string& text() const noexcept;
871 virtual control& text(const xtd::string& text);
872
876 intptr toolkit_handle() const noexcept;
877
880 virtual int32 top() const noexcept;
884 virtual control& top(int32 top);
885
888 virtual std::optional<control_ref> top_level_control() const noexcept;
889
892 virtual bool visible() const noexcept;
896 virtual control& visible(bool visible);
897
900 virtual int32 width() const noexcept;
906
908
920
923 static forms::keys modifier_keys() noexcept;
924
928
933 static xtd::drawing::point mouse_position() noexcept;
935
937
943 xtd::async_result begin_invoke(delegate<void()> method) override;
944
949 xtd::async_result begin_invoke(delegate<void(xtd::array<xtd::any_object>)> method, const xtd::array<xtd::any_object>& args) override;
950
953 virtual void bring_to_front();
954
955 int32 compare_to(const control& value) const noexcept override;
956
961
965 drawing::graphics create_graphics() const;
966
971 virtual void destroy_control();
972
976
980 bool equals(const xtd::object& obj) const noexcept override;
984 bool equals(const control& value) const noexcept override;
985
989 bool focus();
990
994
997 std::optional<xtd::drawing::color> get_back_color() const noexcept;
999
1002 std::optional<xtd::drawing::font> get_font() const noexcept;
1004
1007 std::optional<xtd::drawing::color> get_fore_color() const noexcept;
1009
1014 size_t get_child_index(intptr child) const;
1015
1019 size_t get_child_index(intptr child, bool& throw_exception) const;
1020
1023 xtd::size get_hash_code() const noexcept override;
1024
1027 virtual void hide();
1028
1031 virtual void invalidate() const;
1032
1036 virtual void invalidate(bool invalidate_children) const;
1037
1041 virtual void invalidate(const drawing::rectangle& rect) const;
1042
1047 virtual void invalidate(const drawing::rectangle& rect, bool invalidate_children) const;
1048
1052 virtual void invalidate(const drawing::region& region) const;
1053
1058 virtual void invalidate(const drawing::region& region, bool invalidate_children) const;
1059
1063 std::optional<object_ref> invoke(delegate<void()> method) override;
1067 std::optional<object_ref> invoke(delegate<void(xtd::array<xtd::any_object>)> method, const xtd::array<xtd::any_object>& args) override;
1071 std::optional<object_ref> invoke(delegate<void(xtd::array<xtd::any_object>)> method, const xtd::any_object& arg) override;
1072
1076
1080 xtd::drawing::point point_to_client(const xtd::drawing::point& p) const;
1081
1085 xtd::drawing::point point_to_screen(const xtd::drawing::point& p) const;
1086
1093 bool post_message(intptr hwnd, int32 msg, intptr wparam, intptr lparam) const;
1094
1100
1104 virtual void refresh() const;
1105
1111
1119
1126 intptr send_message(intptr hwnd, int32 msg, intptr wparam, intptr lparam) const;
1127
1131
1138
1146
1149 virtual void show();
1150
1157
1160 xtd::string to_string() const noexcept override;
1161
1168 virtual void update() const;
1170
1172
1178 control& operator <<(control& child);
1179
1184 control& operator >>(control& child);
1186
1188
1192 static control create();
1196 static control create(const drawing::point& location);
1201 static control create(const drawing::point& location, const drawing::size& size);
1207 static control create(const drawing::point& location, const drawing::size& size, const xtd::string& name);
1211 static control create(const control& paren);
1218 static control create(const control& parent, const drawing::point& location);
1224 static control create(const control& parent, const drawing::point& location, const drawing::size& size);
1231 static control create(const control& parent, const drawing::point& location, const drawing::size& size, const xtd::string& name);
1234 template<class control_t>
1235 static control_t create() {
1236 auto result = control_t {};
1237 return result;
1238 }
1239
1242 template<class control_t>
1243 static control_t create(const drawing::point& location) {
1244 auto result = control_t {};
1245 result.location(location);
1246 return result;
1247 }
1248
1252 template<class control_t>
1253 static control_t create(const drawing::point& location, const drawing::size& size) {
1254 auto result = control_t {};
1255 result.location(location);
1256 result.size(size);
1257 return result;
1258 }
1259
1264 template<class control_t>
1265 static control_t create(const drawing::point& location, const drawing::size& size, const xtd::string& name) {
1266 auto result = control_t {};
1267 result.location(location);
1268 result.size(size);
1269 result.name(name);
1270 return result;
1271 }
1272
1275 template<class control_t>
1276 static control_t create(const control& parent) {
1277 auto result = control_t {};
1278 result.parent(parent);
1279 return result;
1280 }
1281
1285 template<class control_t>
1286 static control_t create(const control& parent, const drawing::point& location) {
1287 auto result = control_t {};
1288 result.parent(parent);
1289 result.location(location);
1290 return result;
1291 }
1292
1297 template<class control_t>
1298 static control_t create(const control& parent, const drawing::point& location, const drawing::size& size) {
1299 auto result = control_t {};
1300 result.parent(parent);
1301 result.location(location);
1302 result.size(size);
1303 return result;
1304 }
1305
1311 template<class control_t>
1312 static control_t create(const control& parent, const drawing::point& location, const drawing::size& size, const xtd::string& name) {
1313 auto result = control_t {};
1314 result.parent(parent);
1315 result.location(location);
1316 result.size(size);
1317 result.name(name);
1318 return result;
1319 }
1320
1323 template<class control_t>
1324 static control_t create(const xtd::string& text) {
1325 auto result = control_t {};
1326 result.text(text);
1327 return result;
1328 }
1329
1333 template<class control_t>
1334 static control_t create(const xtd::string& text, const drawing::point& location) {
1335 auto result = control_t {};
1336 result.text(text);
1337 result.location(location);
1338 return result;
1339 }
1340
1345 template<class control_t>
1346 static control_t create(const xtd::string& text, const drawing::point& location, const drawing::size& size) {
1347 auto result = control_t {};
1348 result.text(text);
1349 result.location(location);
1350 result.size(size);
1351 return result;
1352 }
1353
1359 template<class control_t>
1360 static control_t create(const xtd::string& text, const drawing::point& location, const drawing::size& size, const xtd::string& name) {
1361 auto result = control_t {};
1362 result.text(text);
1363 result.location(location);
1364 result.size(size);
1365 result.name(name);
1366 return result;
1367 }
1368
1372 template<class control_t>
1373 static control_t create(const control& parent, const xtd::string& text) {
1374 auto result = control_t {};
1375 result.parent(parent);
1376 result.text(text);
1377 return result;
1378 }
1379
1384 template<class control_t>
1385 static control_t create(const control& parent, const xtd::string& text, const drawing::point& location) {
1386 auto result = control_t {};
1387 result.parent(parent);
1388 result.text(text);
1389 result.location(location);
1390 return result;
1391 }
1392
1398 template<class control_t>
1399 static control_t create(const control& parent, const xtd::string& text, const drawing::point& location, const drawing::size& size) {
1400 auto result = control_t {};
1401 result.parent(parent);
1402 result.text(text);
1403 result.location(location);
1404 result.size(size);
1405 return result;
1406 }
1407
1414 template<class control_t>
1415 static control_t create(const control& parent, const xtd::string& text, const drawing::point& location, const drawing::size& size, const xtd::string& name) {
1416 auto result = control_t {};
1417 result.parent(parent);
1418 result.text(text);
1419 result.location(location);
1420 result.size(size);
1421 result.name(name);
1422 return result;
1423 }
1424
1429 static std::optional<control_ref> from_child_handle(intptr handle);
1430
1434 static std::optional<control_ref> from_handle(intptr handle);
1436
1438
1444
1449
1454
1459
1464
1489
1494
1499
1503
1507
1512
1536
1557
1562
1567
1572
1577
1582
1587
1599
1613
1625
1630
1635
1657
1673
1693
1707
1721
1736
1750
1764
1778
1793
1797
1806
1811
1816
1825
1830
1835
1840
1845
1850
1855
1861
1862 protected:
1863 friend class application;
1864 friend class context_menu;
1865 friend class horizontal_layout_panel;
1866 friend class paint_event_args;
1867 friend class screen;
1868 friend class vertical_layout_panel;
1869 friend class style_sheets::style_sheet;
1870
1872
1877
1883 virtual forms::create_params create_params() const noexcept;
1884
1888 virtual drawing::color default_back_color() const noexcept;
1889
1892 virtual forms::cursor default_cursor() const noexcept;
1893
1896 virtual drawing::font default_font() const noexcept;
1897
1900 virtual drawing::color default_fore_color() const noexcept;
1901
1904 virtual drawing::size default_size() const noexcept;
1906
1908
1914 xtd::uptr<xtd::object> clone() const override;
1915
1920 virtual void create_handle();
1921
1925 virtual void destroy_handle();
1926
1930
1935 bool get_style(control_styles flag) const noexcept;
1936
1939 virtual drawing::size measure_control() const noexcept;
1940
1943 drawing::size measure_text() const noexcept;
1944
1947 virtual void on_auto_size_changed(const event_args& e);
1948
1951 virtual void on_back_color_changed(const event_args& e);
1952
1956
1960
1964
1967 virtual void on_click(const event_args& e);
1968
1972
1976
1980
1983 virtual void on_create_control();
1984
1987 virtual void on_cursor_changed(const event_args& e);
1988
1991 virtual void on_destroy_control();
1992
1995 virtual void on_dock_changed(const event_args& e);
1996
1999 virtual void on_double_click(const event_args& e);
2000
2003 virtual void on_enabled_changed(const event_args& e);
2004
2007 virtual void on_fore_color_changed(const event_args& e);
2008
2011 virtual void on_font_changed(const event_args& e);
2012
2015 virtual void on_got_focus(const event_args& e);
2016
2019 virtual void on_handle_created(const event_args& e);
2020
2023 virtual void on_handle_destroyed(const event_args& e);
2024
2028
2032
2036
2040
2043 virtual void on_layout(const event_args& e);
2044
2047 virtual void on_location_changed(const event_args& e);
2048
2051 virtual void on_lost_focus(const event_args& e);
2052
2055 virtual void on_mouse_click(const mouse_event_args& e);
2056
2060
2063 virtual void on_mouse_down(const mouse_event_args& e);
2064
2067 virtual void on_mouse_enter(const event_args& e);
2068
2072
2075 virtual void on_mouse_leave(const event_args& e);
2076
2079 virtual void on_mouse_move(const mouse_event_args& e);
2080
2083 virtual void on_mouse_up(const mouse_event_args& e);
2084
2087 virtual void on_mouse_wheel(const mouse_event_args& e);
2088
2091 virtual void on_move(const event_args& e);
2092
2095 virtual void on_paint(paint_event_args& e);
2096
2100 virtual void on_paint_background(paint_event_args& e);
2101
2105
2109
2112 virtual void on_parent_changed(const event_args& e);
2113
2117
2121
2125
2128 virtual void on_resize(const event_args& e);
2129
2132 virtual void on_region_changed(const event_args& e);
2133
2137
2140 virtual void on_size_changed(const event_args& e);
2141
2145
2149
2152 virtual void on_tab_stop_changed(const event_args& e);
2153
2156 virtual void on_text_changed(const event_args& e);
2157
2160 virtual void on_visible_changed(const event_args& e);
2161
2162 void post_recreate_handle() noexcept;
2163
2166 virtual void recreate_handle();
2167
2179
2183 void set_can_focus(bool value);
2184
2188 virtual void set_text(const xtd::string& text);
2189
2198
2202
2208 void set_style(control_styles flag, bool value);
2209
2215 virtual void wnd_proc(message& m);
2217
2219
2225
2227 bool get_state(control::state flag) const noexcept;
2228 void set_state(control::state flag, bool value);
2229 bool on_context_menu_item_click(xtd::forms::context_menu& menu, intptr menu_id) const;
2231
2232 private:
2233 void do_layout_children_with_dock_style();
2234 void do_layout_with_auto_size_mode();
2235 void do_layout_with_anchor_styles();
2236 static bool is_trace_form_or_control(const string& name);
2237 void on_controls_item_added(size_t, control_ref item);
2238 void on_controls_item_removed(size_t, control_ref item);
2239 void on_parent_size_changed(object& sender, const event_args& e);
2240 void show_context_menu(xtd::forms::context_menu& menu, const xtd::drawing::point& pos) const;
2241 void reflect_message(intptr handle, message& message);
2242 intptr wnd_proc_(intptr hwnd, int32 msg, intptr wparam, intptr lparam, intptr handle);
2243 void wm_app_idle(message& message);
2244 void wm_child_activate(message& message);
2245 void wm_command(message& message);
2246 void wm_command_control(message& message);
2247 void wm_ctlcolor(message& message);
2248 void wm_ctlcolor_control(message& message);
2249 void wm_create(message& message);
2250 void wm_destroy(message& message);
2251 void wm_key_char(message& message);
2252 void wm_kill_focus(message& message);
2253 void wm_menu_command(message& message);
2254 void wm_mouse_down(message& message);
2255 void wm_mouse_double_click(message& message);
2256 void wm_mouse_enter(message& message);
2257 void wm_mouse_leave(message& message);
2258 void wm_mouse_up(message& message);
2259 void wm_mouse_move(message& message);
2260 void wm_move(message& message);
2261 void wm_mouse_wheel(message& message);
2262 void wm_notify(message& message);
2263 void wm_notify_control(message& message);
2264 void wm_paint(message& message);
2265 void wm_erase_background(message& message);
2266 void wm_help(message& message);
2267 void wm_scroll(message& message);
2268 void wm_scroll_control(message& message);
2269 void wm_set_focus(message& message);
2270 void wm_set_text(message& message);
2271 void wm_show(message& message);
2272 void wm_size(message& message);
2273 void wm_sizing(message& message);
2274 void wm_style_sheet_changed(message& message);
2275
2276 static bool check_for_illegal_cross_thread_calls_;
2277 static forms::keys modifier_keys_;
2278 static forms::mouse_buttons mouse_buttons_;
2279 static std::map<intptr, control*> handles_;
2280 static control_collection top_level_controls_;
2281
2282 xtd::sptr<data> data_;
2283 };
2284 }
2285}
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:63
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:52
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_t & emplace_at(size_t index, args_t &&...args)
Creates and inserts specified control at specified position.
Definition control.hpp:243
xtd::forms::layout::arranged_element_collection< control_ref > base
Represents the base type of the collection.
Definition control.hpp:158
control_collection()=default
Creates a new object xtd::forms::control::control_collection with specified allocator (optional).
control_t & emplace_front(args_t &&...args)
Creates and inserts specified control at specified position.
Definition control.hpp:225
control_collection(bool keep_cloned_controls)
Creates a new object xtd::forms::control::control_collection with specified keep_cloned_controls,...
void insert(size_t index, const control_ref &value) override
Inserts specified element at specified index.
control_t & emplace_back(args_t &&...args)
Creates and adds a control to the end.
Definition control.hpp:260
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:297
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:1810
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:1586
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:1360
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:1298
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:1511
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:1796
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:1839
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:1453
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:1493
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:1844
event< control, event_handler > tab_stop_changed
Occurs when the xtd::forms::control::tab_stop property value changes.
Definition control.hpp:1849
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:1624
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:1346
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.
event< control, event_handler > enabled_changed
Occurs when the value of the xtd::forms::control::enabled property changes.
Definition control.hpp:1571
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:1859
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:1854
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:1629
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:1581
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.
xtd::ref< xtd::forms::context_menu > context_menu_ref
Represent an xtd::forms::context_menu reference.
Definition control.hpp:148
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:1535
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:1488
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:1612
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:1373
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:1561
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:1566
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:1506
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:1706
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:1385
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:1720
event< control, event_handler > auto_size_changed
Occurs when the value of the xtd::forms::control::auto_size property changes.
Definition control.hpp:1443
event< control, mouse_event_handler > mouse_double_click
Occurs when the xtd::forms::control is double clicked by the mouse.
Definition control.hpp:1692
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:1324
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:1805
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:1253
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:1656
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:1415
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:1458
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:1286
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:1815
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:1749
event< control, mouse_event_handler > mouse_move
Occurs when the mouse pointer is moved over the xtd::forms::control.
Definition control.hpp:1763
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:1829
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:1399
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:1265
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:1463
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:1598
event< control, event_handler > got_focus
Occurs when the xtd::forms::control receives focus.
Definition control.hpp:1556
event< control, event_handler > location_changed
Occurs when the value of the xtd::forms::control::location property changes.
Definition control.hpp:1634
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:1777
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:1735
static control_t create(const control &parent)
A factory to create a specified control with specified parent.
Definition control.hpp:1276
event< control, mouse_event_handler > mouse_wheel
Occurs when the mouse wheel moves while the xtd::forms::control has focus.
Definition control.hpp:1792
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:1243
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:1312
event< control, event_handler > back_color_changed
Occurs when the value of the xtd::forms::control::back_color property changes.
Definition control.hpp:1448
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:1502
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:1576
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:1824
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:1498
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:1334
event< control, mouse_event_handler > mouse_click
Occurs when the xtd::forms::control is clicked by the mouse.
Definition control.hpp:1672
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:1834
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:42
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:805
void add(const control_ref &item) override
Definition arranged_element_collection.hpp:267
virtual void insert(xtd::size index, const control_ref &value)
Definition arranged_element_collection.hpp:355
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
type & get() const
Gets the stored reference.
Definition reference_wrapper_object.hpp:190
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
std::int64_t int64
Represents a 64-bit signed integer.
Definition int64.hpp:23
size_t size
Represents a size of any object in bytes.
Definition size.hpp:23
xtd::shared_ptr_object< type_t > sptr
The xtd::sptr object is a shared pointer.
Definition sptr.hpp:25
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
std::int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:23
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: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
xtd::ref< control > control_ref
Represents a control reference.
Definition control_ref.hpp:25
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
@ add
The add key.
Definition keys.hpp:281
@ m
The M key.
Definition keys.hpp:223
@ end
The END key.
Definition keys.hpp:151
@ p
The P key.
Definition keys.hpp:229
@ i
The I key.
Definition keys.hpp:215
@ 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
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:32
Implements a Windows message.
Definition message.hpp:33
Contains xtd::forms::style_sheets::style_sheet class.
Contains xtd::forms::timer component.