xtd 1.0.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
42
46
48
53
55
59 [[nodiscard]] virtual auto border_sides() const noexcept -> xtd::forms::border_sides;
62 virtual auto border_sides(forms::border_sides value) -> list_box&;
63
66 [[nodiscard]] virtual auto border_style() const noexcept -> xtd::forms::border_style;
70 virtual auto border_style(forms::border_style value) -> list_box&;
75 virtual auto border_style(xtd::null_ptr) -> list_box&;
76
80 [[nodiscard]] auto items() noexcept -> object_collection&;
83 [[nodiscard]] auto items() const noexcept -> const object_collection&;
88 auto items(const object_collection& value) -> list_box&;
89
94 auto selected_index(xtd::usize value) -> list_control& override;
95
100 [[nodiscard]] virtual auto selected_indices() const noexcept -> selected_index_collection;
101
106 [[nodiscard]] auto selected_item() const noexcept -> const item&;
112 auto selected_item(const item& value) -> list_box&;
113
118 [[nodiscard]] auto selected_items() const noexcept -> selected_object_collection;
119
123 [[nodiscard]] virtual auto selection_mode() const noexcept -> xtd::forms::selection_mode;
128 virtual auto selection_mode(forms::selection_mode value) -> list_box&;
129
133 [[nodiscard]] virtual auto sorted() const noexcept -> bool;
138 virtual auto sorted(bool value) -> list_box&;
139
140 using list_control::text;
143 auto text(const xtd::string& value) -> xtd::forms::control& override;
145
147
151 auto begin_update() -> void;
152
155 auto end_update() -> void;
157
159
163 [[nodiscard]] static auto create() -> list_box;
167 [[nodiscard]] static auto create(const xtd::drawing::point& location) -> list_box;
172 [[nodiscard]] static auto create(const xtd::drawing::point& location, const xtd::drawing::size& size) -> list_box;
178 [[nodiscard]] static auto create(const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> list_box;
182 [[nodiscard]] static auto create(const object_collection& items) -> list_box;
187 [[nodiscard]] static auto create(const object_collection& items, const xtd::drawing::point& location) -> list_box;
193 [[nodiscard]] static auto create(const object_collection& items, const xtd::drawing::point& location, const xtd::drawing::size& size) -> list_box;
200 [[nodiscard]] static auto create(const object_collection& items, const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> list_box;
205 [[nodiscard]] static auto create(const object_collection& items, xtd::usize selected_index) -> list_box;
211 [[nodiscard]] static auto create(const object_collection& items, xtd::usize selected_index, const xtd::drawing::point& location) -> list_box;
218 [[nodiscard]] static auto create(const object_collection& items, xtd::usize selected_index, const xtd::drawing::point& location, const xtd::drawing::size& size) -> list_box;
226 [[nodiscard]] static auto create(const object_collection& items, xtd::usize selected_index, const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> list_box;
230 [[nodiscard]] static auto create(const xtd::forms::control& parent) -> list_box;
235 [[nodiscard]] static auto create(const xtd::forms::control& parent, const xtd::drawing::point& location) -> list_box;
241 [[nodiscard]] static auto create(const xtd::forms::control& parent, const xtd::drawing::point& location, const xtd::drawing::size& size) -> list_box;
248 [[nodiscard]] static auto create(const xtd::forms::control& parent, const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> list_box;
253 [[nodiscard]] static auto create(const xtd::forms::control& parent, const object_collection& items) -> list_box;
259 [[nodiscard]] static auto create(const xtd::forms::control& parent, const object_collection& items, const xtd::drawing::point& location) -> list_box;
266 [[nodiscard]] static auto create(const xtd::forms::control& parent, const object_collection& items, const xtd::drawing::point& location, const xtd::drawing::size& size) -> list_box;
274 [[nodiscard]] static auto create(const xtd::forms::control& parent, const object_collection& items, const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> list_box;
280 [[nodiscard]] static auto create(const xtd::forms::control& parent, const object_collection& items, xtd::usize selected_index) -> list_box;
287 [[nodiscard]] static auto create(const xtd::forms::control& parent, const object_collection& items, xtd::usize selected_index, const xtd::drawing::point& location) -> list_box;
295 [[nodiscard]] static auto create(const xtd::forms::control& parent, const object_collection& items, xtd::usize selected_index, const xtd::drawing::point& location, const xtd::drawing::size& size) -> list_box;
304 [[nodiscard]] static auto create(const xtd::forms::control& parent, const object_collection& items, xtd::usize selected_index, const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> list_box;
306
307 protected:
309
311 [[nodiscard]] auto allow_selection() const noexcept -> bool override;
312 [[nodiscard]] auto create_params() const noexcept -> xtd::forms::create_params override;
313 [[nodiscard]] auto default_back_color() const noexcept -> xtd::drawing::color override;
314 [[nodiscard]] auto default_fore_color() const noexcept -> xtd::drawing::color override;
318
320 auto on_handle_created(const event_args& e) -> void override;
321 auto on_selected_value_changed(const event_args& e) -> void override;
322 auto wnd_proc(message& message) -> void override;
324
325 private:
326 auto wm_command_control(message& message) -> void;
327 auto wm_mouse_double_click(message& message) -> void;
328 auto wm_mouse_down(message& message) -> void;
329 auto wm_mouse_up(message& message) -> void;
330
331 xtd::sptr<data> data_;
332 };
333 }
334}
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:64
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 auto size() const noexcept -> xtd::drawing::size
Gets the height and width of the control.
virtual auto parent() const noexcept -> std::optional< xtd::forms::control_ref >
Gets the parent container of the control.
virtual auto name() const noexcept -> const xtd::string &
Gets the name of the control.
virtual auto location() const noexcept -> xtd::drawing::point
Gets the coordinates of the upper-left corner of the control relative to the upper-left corner of its...
xtd::array< xtd::usize > selected_index_collection
Represents the collection containing the indexes to the selected items in a list_box.
Definition list_box.hpp:41
virtual auto selected_indices() const noexcept -> selected_index_collection
Gets a collection that contains the zero-based indexes of all currently selected items in the list_bo...
auto items() noexcept -> object_collection &
Gets the items of the list_box.
list_box()
Initializes a new instance of the list_box class.
auto on_selected_value_changed(const event_args &e) -> void override
Raises the list_control::selected_value_changed event.
auto allow_selection() const noexcept -> bool override
Gets a value indicating whether the list enables selection of list items.
virtual auto border_style() const noexcept -> xtd::forms::border_style
Gets the type of border that is drawn around the list_box.
auto default_back_color() const noexcept -> xtd::drawing::color override
Gets the default background color of the control.
auto selected_item() const noexcept -> const item &
Gets the currently selected item in the list_box.
auto end_update() -> void
Resumes painting the list_box control after painting is suspended by the begin_update method.
xtd::array< item > selected_object_collection
Represents the collection of selected items in the list_box.
Definition list_box.hpp:44
auto selected_index(xtd::usize value) -> list_control &override
When overridden in a derived class, Sets the zero-based index of the currently selected item.
virtual auto selection_mode() const noexcept -> xtd::forms::selection_mode
Gets the method in which items are selected in the list_box.
auto wnd_proc(message &message) -> void override
Processes Windows messages.
auto begin_update() -> void
Maintains performance while items are added to the list_box one at a time by preventing the control f...
auto default_fore_color() const noexcept -> xtd::drawing::color override
Gets the default foreground color of the control.
auto on_handle_created(const event_args &e) -> void override
Raises the xtd::forms::control::handle_created event.
auto text(const xtd::string &value) -> xtd::forms::control &override
Sets the text associated with this control.
auto selected_items() const noexcept -> selected_object_collection
Gets a collection containing the currently selected items in the list_box.
virtual auto sorted() const noexcept -> bool
Gets a value indicating whether the items in the list_box are sorted alphabetically.
virtual auto border_sides() const noexcept -> xtd::forms::border_sides
Gets the border sides for the control.
static auto create() -> list_box
A factory to create an xtd::forms::list_box.
auto create_params() const noexcept -> xtd::forms::create_params override
Gets the required creation parameters when the control handle is created.
Provides a common implementation of members for the list_box, choice and combo_box classes.
Definition list_control.hpp:27
xtd::forms::layout::arranged_element_collection< item, item::sorter > object_collection
Represents the collection of items in a list_control.
Definition list_control.hpp:128
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
std::nullptr_t null_ptr
Represents the null_opt alias on std::nullptr_t.
Definition null_ptr.hpp:19
std::size_t usize
Represents an unsigned size of any object in bytes.
Definition usize.hpp:22
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 auto data() const noexcept -> const_pointer
Gets direct access to the underlying contiguous storage.
Definition read_only_span.hpp:197
Contains xtd::forms::selection_mode enum class.
Implements a Windows message.
Definition message.hpp:33