xtd 0.2.0
list_box.hpp
Go to the documentation of this file.
1
4#pragma once
6#include "border_sides.hpp"
7#include "border_style.hpp"
8#include "list_control.hpp"
9#include "selection_mode.hpp"
10
12namespace xtd {
14 namespace forms {
34 struct data;
35
36 public:
38
42
46
48
53
55 list_box(list_box&& rhs);
56 list_box(const list_box&) = default;
57 list_box& operator =(const list_box&) = default;
59
61
65 virtual forms::border_sides border_sides() const noexcept;
69
72 virtual forms::border_style border_style() const noexcept;
81 virtual list_box& border_style(std::nullptr_t);
82
89 const object_collection& items() const noexcept;
95
101
107
112 const item& selected_item() const noexcept;
119
125
129 virtual forms::selection_mode selection_mode() const noexcept;
135
139 virtual bool sorted() const noexcept;
144 virtual list_box& sorted(bool sorted);
145
146 using list_control::text;
149 control& text(const xtd::string& text) override;
151
153
158
163
165
169 static list_box create();
173 static list_box create(const drawing::point& location);
178 static list_box create(const drawing::point& location, const drawing::size& size);
184 static list_box create(const drawing::point& location, const drawing::size& size, const xtd::string& name);
193 static list_box create(const object_collection& items, const drawing::point& location);
199 static list_box create(const object_collection& items, const drawing::point& location, const drawing::size& size);
206 static list_box create(const object_collection& items, const drawing::point& location, const drawing::size& size, const xtd::string& name);
217 static list_box create(const object_collection& items, size_t selected_index, const drawing::point& location);
224 static list_box create(const object_collection& items, size_t selected_index, const drawing::point& location, const drawing::size& size);
232 static list_box create(const object_collection& items, size_t selected_index, const drawing::point& location, const drawing::size& size, const xtd::string& name);
241 static list_box create(const control& parent, const drawing::point& location);
247 static list_box create(const control& parent, const drawing::point& location, const drawing::size& size);
254 static list_box create(const control& parent, const drawing::point& location, const drawing::size& size, const xtd::string& name);
265 static list_box create(const control& parent, const object_collection& items, const drawing::point& location);
272 static list_box create(const control& parent, const object_collection& items, const drawing::point& location, const drawing::size& size);
280 static list_box create(const control& parent, const object_collection& items, const drawing::point& location, const drawing::size& size, const xtd::string& name);
293 static list_box create(const control& parent, const object_collection& items, size_t selected_index, const drawing::point& location);
301 static list_box create(const control& parent, const object_collection& items, size_t selected_index, const drawing::point& location, const drawing::size& size);
310 static list_box create(const control& parent, const object_collection& items, size_t selected_index, const drawing::point& location, const drawing::size& size, const xtd::string& name);
312
313 protected:
315
317 bool allow_selection() const noexcept override;
318 forms::create_params create_params() const noexcept override;
319 drawing::color default_back_color() const noexcept override;
320 drawing::color default_fore_color() const noexcept override;
324
330 xtd::uptr<xtd::object> clone() const override;
331
332 void on_handle_created(const event_args& e) override;
334 void wnd_proc(message& message) override;
336
337 private:
338 void on_items_item_added(size_t pos, const item& item);
339 void on_items_item_removed(size_t pos, const item& item);
340 void on_items_item_updated(size_t pos, const item& item);
341 void wm_command_control(message& message);
342 void wm_mouse_double_click(message& message);
343 void wm_mouse_down(message& message);
344 void wm_mouse_up(message& message);
345
346 xtd::sptr<data> data_;
347 };
348 }
349}
Contains xtd::forms::layout::arranged_element_collection collection.
Contains xtd::forms::border_sides enum class.
Contains xtd::forms::border_style enum class.
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition array.hpp:61
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition event_args.hpp:18
Defines the base class for controls, which are components with visual representation.
Definition control.hpp:81
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 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.
xtd::array< xtd::size > selected_index_collection
Represents the collection containing the indexes to the selected items in a list_box.
Definition list_box.hpp:41
void on_handle_created(const event_args &e) override
Raises the xtd::forms::control::handle_created event.
drawing::color default_fore_color() const noexcept override
Gets the default foreground color of the control.
drawing::color default_back_color() const noexcept override
Gets the default background color of the control.
list_box()
Initializes a new instance of the list_box class.
virtual selected_index_collection selected_indices() const noexcept
Gets a collection that contains the zero-based indexes of all currently selected items in the list_bo...
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 begin_update()
Maintains performance while items are added to the list_box one at a time by preventing the control f...
xtd::array< item > selected_object_collection
Represents the collection of selected items in the list_box.
Definition list_box.hpp:44
bool allow_selection() const noexcept override
Gets a value indicating whether the list enables selection of list items.
virtual forms::border_sides border_sides() const noexcept
Gets the border sides for the control.
selected_object_collection selected_items() const noexcept
Gets a collection containing the currently selected items in the list_box.
virtual forms::selection_mode selection_mode() const noexcept
Gets the method in which items are selected in the list_box.
object_collection & items() noexcept
Gets the items of the list_box.
static list_box create()
A factory to create an xtd::forms::list_box.
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.
void wnd_proc(message &message) override
Processes Windows messages.
virtual bool sorted() const noexcept
Gets a value indicating whether the items in the list_box are sorted alphabetically.
control & text(const xtd::string &text) override
Sets the text associated with this control.
void end_update()
Resumes painting the list_box control after painting is suspended by the begin_update method.
const item & selected_item() const noexcept
Gets the currently selected item in the list_box.
virtual forms::border_style border_style() const noexcept
Gets the type of border that is drawn around the list_box.
void on_selected_value_changed(const event_args &e) override
Raises the list_control::selected_value_changed event.
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
xtd::unique_ptr_object< type_t > uptr
The xtd::uptr object is a unique pointer.
Definition uptr.hpp:25
border_sides
Specifies how a control anchors to the edges of its container.
Definition border_sides.hpp:23
@ e
The E key.
Definition keys.hpp:207
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
Contains xtd::forms::selection_mode enum class.
Implements a Windows message.
Definition message.hpp:33