xtd 0.2.0
Loading...
Searching...
No Matches
list_box.h
Go to the documentation of this file.
1
4#pragma once
6#include "border_sides.h"
7#include "border_style.h"
8#include "list_control.h"
9#include "selection_mode.h"
10
12namespace xtd {
14 namespace forms {
32 struct data;
33
34 public:
36
39 using selected_index_collection = std::vector<size_t>;
40
42 using selected_object_collection = std::vector<item>;
44
46
51
53 list_box(list_box&& rhs);
54 list_box(const list_box&) = default;
55 list_box& operator =(const list_box&) = default;
57
59
63 virtual forms::border_sides border_sides() const noexcept;
67
70 virtual forms::border_style border_style() const noexcept;
79 virtual list_box& border_style(std::nullptr_t);
80
84 object_collection& items() noexcept;
87 const object_collection& items() const noexcept;
92 const list_box& items(const object_collection& items);
93
94 using list_control::selected_index;
98 list_control& selected_index(size_t selected_index) override;
99
104 virtual selected_index_collection selected_indices() const noexcept;
105
110 const item& selected_item() const noexcept;
116 list_box& selected_item(const item& selected_item);
117
122 selected_object_collection selected_items() const noexcept;
123
127 virtual forms::selection_mode selection_mode() const noexcept;
133
137 virtual bool sorted() const noexcept;
142 virtual list_box& sorted(bool sorted);
143
144 using list_control::text;
147 control& text(const xtd::ustring& text) override;
149
151
155 void begin_update();
156
159 void end_update();
161
163
167 static list_box create();
171 static list_box create(const drawing::point& location);
176 static list_box create(const drawing::point& location, const drawing::size& size);
182 static list_box create(const drawing::point& location, const drawing::size& size, const xtd::ustring& name);
186 static list_box create(const object_collection& items);
191 static list_box create(const object_collection& items, const drawing::point& location);
197 static list_box create(const object_collection& items, const drawing::point& location, const drawing::size& size);
204 static list_box create(const object_collection& items, const drawing::point& location, const drawing::size& size, const xtd::ustring& name);
209 static list_box create(const object_collection& items, size_t selected_index);
215 static list_box create(const object_collection& items, size_t selected_index, const drawing::point& location);
222 static list_box create(const object_collection& items, size_t selected_index, const drawing::point& location, const drawing::size& size);
230 static list_box create(const object_collection& items, size_t selected_index, const drawing::point& location, const drawing::size& size, const xtd::ustring& name);
234 static list_box create(const control& parent);
239 static list_box create(const control& parent, const drawing::point& location);
245 static list_box create(const control& parent, const drawing::point& location, const drawing::size& size);
252 static list_box create(const control& parent, const drawing::point& location, const drawing::size& size, const xtd::ustring& name);
257 static list_box create(const control& parent, const object_collection& items);
263 static list_box create(const control& parent, const object_collection& items, const drawing::point& location);
270 static list_box create(const control& parent, const object_collection& items, const drawing::point& location, const drawing::size& size);
278 static list_box create(const control& parent, const object_collection& items, const drawing::point& location, const drawing::size& size, const xtd::ustring& name);
284 static list_box create(const control& parent, const object_collection& items, size_t selected_index);
291 static list_box create(const control& parent, const object_collection& items, size_t selected_index, const drawing::point& location);
299 static list_box create(const control& parent, const object_collection& items, size_t selected_index, const drawing::point& location, const drawing::size& size);
308 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::ustring& name);
310
311 protected:
313
315 bool allow_selection() const noexcept override;
316 forms::create_params create_params() const noexcept override;
317 drawing::color default_back_color() const noexcept override;
318 drawing::color default_fore_color() const noexcept override;
322
328 std::unique_ptr<xtd::object> clone() const override;
329
330 void on_handle_created(const event_args& e) override;
331 void on_selected_value_changed(const event_args& e) override;
332 void wnd_proc(message& message) override;
334
335 private:
336 void on_items_item_added(size_t pos, const item& item);
337 void on_items_item_removed(size_t pos, const item& item);
338 void on_items_item_updated(size_t pos, const item& item);
339 void wm_command_control(message& message);
340 void wm_mouse_double_click(message& message);
341 void wm_mouse_down(message& message);
342 void wm_mouse_up(message& message);
343
344 std::shared_ptr<data> data_;
345 };
346 }
347}
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.h:18
Defines the base class for controls, which are components with visual representation.
Definition control.h:79
Encapsulates the information needed when creating a control.
Definition create_params.h:27
Represents a collection of objects.
Definition arranged_element_collection.h:32
Represents a standard Windows list box.
Definition list_box.h:31
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.h:42
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.h:39
Represent an item contained in the list_control::object_collection collection.
Definition list_control.h:30
Provides a common implementation of members for the list_box, choice and combo_box classes.
Definition list_control.h:25
Implements a Windows message.
Definition message.h:26
Represents text as a sequence of UTF-8 code units.
Definition ustring.h:47
#define forms_export_
Define shared library export.
Definition forms_export.h:13
size_t size
Represents a size of any object in bytes.
Definition types.h:197
selection_mode
Specifies the selection behavior of a list box.
Definition selection_mode.h:20
border_sides
Specifies how a control anchors to the edges of its container.
Definition border_sides.h:21
border_style
Specifies the border style for a control.
Definition border_style.h:20
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.h:12
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
Contains xtd::forms::selection_mode enum class.
Contains xtd::forms::style_sheets::border_style class.