xtd 0.2.0
Loading...
Searching...
No Matches
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
41 using selected_index_collection = std::vector<size_t>;
42
44 using selected_object_collection = std::vector<item>;
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
86 object_collection& items() noexcept;
89 const object_collection& items() const noexcept;
94 const list_box& items(const object_collection& items);
95
96 using list_control::selected_index;
100 list_control& selected_index(size_t selected_index) override;
101
106 virtual selected_index_collection selected_indices() const noexcept;
107
112 const item& selected_item() const noexcept;
118 list_box& selected_item(const item& selected_item);
119
124 selected_object_collection selected_items() const noexcept;
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
157 void begin_update();
158
161 void end_update();
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);
188 static list_box create(const object_collection& items);
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);
211 static list_box create(const object_collection& items, size_t selected_index);
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);
236 static list_box create(const control& parent);
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);
259 static list_box create(const control& parent, const object_collection& items);
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);
286 static list_box create(const control& parent, const object_collection& items, size_t selected_index);
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;
333 void on_selected_value_changed(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.
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
Encapsulates the information needed when creating a control.
Definition create_params.hpp:29
Represents a collection of objects.
Definition arranged_element_collection.hpp:34
Represents a standard Windows list box.
Definition list_box.hpp:33
list_box()
Initializes a new instance of the list_box class.
std::vector< item > selected_object_collection
Represents the collection of selected items in the list_box.
Definition list_box.hpp:44
virtual forms::border_sides border_sides() const noexcept
Gets the border sides for the control.
std::vector< size_t > selected_index_collection
Represents the collection containing the indexes to the selected items in a list_box.
Definition list_box.hpp:41
Represent an item contained in the list_control::object_collection collection.
Definition list_control.hpp:32
Provides a common implementation of members for the list_box, choice and combo_box classes.
Definition list_control.hpp:27
Implements a Windows message.
Definition message.hpp:28
#define forms_export_
Define shared library export.
Definition forms_export.hpp:13
std::unique_ptr< type_t > uptr
The xtd::uptr object is a unique pointer.
Definition uptr.hpp:25
size_t size
Represents a size of any object in bytes.
Definition size.hpp:23
std::shared_ptr< type_t > sptr
The xtd::sptr object is a shared pointer.
Definition sptr.hpp:25
selection_mode
Specifies the selection behavior of a list box.
Definition selection_mode.hpp:22
border_sides
Specifies how a control anchors to the edges of its container.
Definition border_sides.hpp:23
border_style
Specifies the border style for a control.
Definition border_style.hpp:22
Contains xtd::forms::list_control control.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition xtd_about_box.hpp:12
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10
Contains xtd::forms::selection_mode enum class.
Contains xtd::forms::style_sheets::border_style class.