xtd 0.2.0
choice.hpp
Go to the documentation of this file.
1
4#pragma once
6#include "list_control.hpp"
7
9namespace xtd {
11 namespace forms {
38 struct data;
39
40 public:
42
47
49 choice(choice&& rhs);
50 choice(const choice&) = default;
51 choice& operator =(const choice&) = default;
53
55
63 const object_collection& items() const noexcept;
67
72
75 const item& selected_item() const noexcept;
79
83 virtual bool sorted() const noexcept;
87 virtual choice& sorted(bool sorted);
88
89 using list_control::text;
92 control& text(const xtd::string& text) override;
94
96
101
106
108
112 static choice create();
116 static choice create(const drawing::point& location);
121 static choice create(const drawing::point& location, const drawing::size& size);
127 static choice create(const drawing::point& location, const drawing::size& size, const xtd::string& name);
136 static choice create(const object_collection& items, const drawing::point& location);
142 static choice create(const object_collection& items, const drawing::point& location, const drawing::size& size);
149 static choice create(const object_collection& items, const drawing::point& location, const drawing::size& size, const xtd::string& name);
160 static choice create(const object_collection& items, size_t selected_index, const drawing::point& location);
167 static choice create(const object_collection& items, size_t selected_index, const drawing::point& location, const drawing::size& size);
175 static choice create(const object_collection& items, size_t selected_index, const drawing::point& location, const drawing::size& size, const xtd::string& name);
179 static choice create(const control& parent);
184 static choice create(const control& parent, const drawing::point& location);
190 static choice create(const control& parent, const drawing::point& location, const drawing::size& size);
197 static choice create(const control& parent, const drawing::point& location, const drawing::size& size, const xtd::string& name);
208 static choice create(const control& parent, const object_collection& items, const drawing::point& location);
215 static choice create(const control& parent, const object_collection& items, const drawing::point& location, const drawing::size& size);
223 static choice create(const control& parent, const object_collection& items, const drawing::point& location, const drawing::size& size, const xtd::string& name);
236 static choice create(const control& parent, const object_collection& items, size_t selected_index, const drawing::point& location);
244 static choice create(const control& parent, const object_collection& items, size_t selected_index, const drawing::point& location, const drawing::size& size);
253 static choice create(const control& parent, const object_collection& items, size_t selected_index, const drawing::point& location, const drawing::size& size, const xtd::string& name);
255
256 protected:
258
260 forms::create_params create_params() const noexcept override;
262
264
270 xtd::uptr<xtd::object> clone() const override;
271
272 void on_handle_created(const event_args& e) override;
276 void wnd_proc(message& message) override;
278
279 private:
280 void on_items_item_added(size_t pos, const item& item);
281 void on_items_item_removed(size_t pos, const item& item);
282 void on_items_item_updated(size_t pos, const item& item);
283 void wm_command_control(message& message);
284 void wm_mouse_double_click(message& message);
285 void wm_mouse_down(message& message);
286 void wm_mouse_up(message& message);
287
288 xtd::sptr<data> data_;
289 };
290 }
291}
Contains xtd::forms::layout::arranged_element_collection collection.
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition event_args.hpp:18
const item & selected_item() const noexcept
Gets currently selected item in the choice.
void set_client_size_core(int32 width, int32 height) override
Sets the size of the client area of the control.
void on_selected_value_changed(const event_args &e) override
Raises the list_control::selected_value_changed event.
void on_handle_created(const event_args &e) override
Raises the xtd::forms::control::handle_created event.
void end_update()
Resumes painting the choice control after painting is suspended by the begin_update method.
void begin_update()
Maintains performance while items are added to the choice one at a time by preventing the control fro...
void set_bounds_core(int32 x, int32 y, int32 width, int32 height, bounds_specified specified) override
Performs the work of setting the specified bounds of this control.
object_collection & items() noexcept
Gets an object representing the collection of the items contained in this choice.
virtual bool sorted() const noexcept
Gets a value indicating whether the items in the choice are sorted.
static choice create()
A factory to create an xtd::forms::choice.
list_control & selected_index(size_t selected_index) override
When overridden in a derived class, Sets the zero-based index of the currently selected item.
forms::create_params create_params() const noexcept override
Gets the required creation parameters when the control handle is created.
xtd::uptr< xtd::object > clone() const override
Creates a new object that is a copy of the current instance.
void wnd_proc(message &message) override
Processes Windows messages.
choice()
Initializes a new instance of the choice class.
control & text(const xtd::string &text) override
Sets the text associated with this control.
Defines the base class for controls, which are components with visual representation.
Definition control.hpp:81
virtual int32 width() const noexcept
Gets the width of the control.
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...
virtual int32 height() const noexcept
Gets the height of the control.
virtual const xtd::string & name() const noexcept
Gets the name of the control.
virtual drawing::size size() const noexcept
Gets the height and width of the control.
virtual std::optional< control_ref > parent() const noexcept
Gets the parent container of the control.
Represent an item contained in the list_control::object_collection collection.
Definition list_control.hpp:32
layout::arranged_element_collection< item, item::sorter > object_collection
Represents the collection of items in a list_control.
Definition list_control.hpp:135
list_control()
Initializes a new instance of the list_control class.
#define forms_export_
Define shared library export.
Definition forms_export.hpp:13
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
bounds_specified
Specifies the bounds of the control to use when defining a control's size and position....
Definition bounds_specified.hpp:22
@ 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::list_control control.
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition actions_system_images.hpp:10
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition texts.hpp:219
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
constexpr const_pointer data() const noexcept
Gets direct access to the underlying contiguous storage.
Definition read_only_span.hpp:201
Implements a Windows message.
Definition message.hpp:33