xtd 1.0.0
Loading...
Searching...
No Matches
domain_up_down.hpp
Go to the documentation of this file.
1
4#pragma once
5
6#include "up_down_base.hpp"
7#include "application.hpp"
8#include <xtd/iequatable>
9#include <xtd/usize_object>
10
12namespace xtd {
14 namespace forms {
34 struct data;
35
36 public:
38 class item : public xtd::object, public xtd::icomparable<item>, public xtd::iequatable<item> {
39 public:
41
44 item() = default;
47 item(const xtd::string& value); // Can't be explicit by design.
53
55 item(const char* value); // Can't be explicit by design.
57
59
63 [[nodiscard]] virtual auto value() const noexcept -> const xtd::string&;
64
67 virtual auto tag() const noexcept -> const xtd::any_object&;
69
71
83 [[nodiscard]] auto compare_to(const item& value) const noexcept -> xtd::int32 override;
84
88 [[nodiscard]] auto equals(const xtd::object& obj) const noexcept -> bool override;
92 [[nodiscard]] auto equals(const item& other) const noexcept -> bool override;
93
96 [[nodiscard]] auto get_hash_code() const noexcept -> xtd::usize override;
97
100 [[nodiscard]] auto to_string() const noexcept -> xtd::string override;
102
103 private:
104 xtd::string value_;
105 xtd::any_object tag_;
106 };
107
109
112 using object_collection = xtd::forms::layout::arranged_element_collection<item>;
114
116
120 inline static constexpr xtd::usize npos = object_collection::npos;
121
124 static inline constexpr xtd::usize bpos = object_collection::bpos;
125
130 static inline constexpr xtd::usize epos = object_collection::epos;
132
134
139
141
146 [[nodiscard]] auto items() const noexcept -> const object_collection&;
150 [[nodiscard]] auto items() noexcept -> object_collection&;
154 auto items(const object_collection& value) -> domain_up_down&;
155
158 [[nodiscard]] virtual auto selected_index() const noexcept -> xtd::usize;
162 virtual auto selected_index(xtd::usize value) -> domain_up_down&;
163
166 [[nodiscard]] auto selected_item() const noexcept -> const item&;
170 auto selected_item(const item& value) -> domain_up_down&;
171
174 [[nodiscard]] virtual auto wrap() const noexcept -> bool;
178 virtual auto wrap(bool value) -> domain_up_down&;
180
182
186 [[nodiscard]] static auto create() -> domain_up_down;
190 [[nodiscard]] static auto create(const xtd::drawing::point& location) -> domain_up_down;
195 [[nodiscard]] static auto create(const xtd::drawing::point& location, const xtd::drawing::size& size) -> domain_up_down;
201 [[nodiscard]] static auto create(const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> domain_up_down;
205 [[nodiscard]] static auto create(const object_collection& items) -> domain_up_down;
210 [[nodiscard]] static auto create(const object_collection& items, const xtd::drawing::point& location) -> domain_up_down;
216 [[nodiscard]] static auto create(const object_collection& items, const xtd::drawing::point& location, const xtd::drawing::size& size) -> domain_up_down;
223 [[nodiscard]] static auto create(const object_collection& items, const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> domain_up_down;
228 [[nodiscard]] static auto create(const object_collection& items, xtd::usize selected_index) -> domain_up_down;
234 [[nodiscard]] static auto create(const object_collection& items, xtd::usize selected_index, const xtd::drawing::point& location) -> domain_up_down;
241 [[nodiscard]] static auto create(const object_collection& items, xtd::usize selected_index, const xtd::drawing::point& location, const xtd::drawing::size& size) -> domain_up_down;
249 [[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) -> domain_up_down;
253 [[nodiscard]] static auto create(const control& parent) -> domain_up_down;
258 [[nodiscard]] static auto create(const control& parent, const xtd::drawing::point& location) -> domain_up_down;
264 [[nodiscard]] static auto create(const control& parent, const xtd::drawing::point& location, const xtd::drawing::size& size) -> domain_up_down;
271 [[nodiscard]] static auto create(const control& parent, const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> domain_up_down;
276 [[nodiscard]] static auto create(const control& parent, const object_collection& items) -> domain_up_down;
282 [[nodiscard]] static auto create(const control& parent, const object_collection& items, const xtd::drawing::point& location) -> domain_up_down;
289 [[nodiscard]] static auto create(const control& parent, const object_collection& items, const xtd::drawing::point& location, const xtd::drawing::size& size) -> domain_up_down;
297 [[nodiscard]] static auto create(const control& parent, const object_collection& items, const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> domain_up_down;
303 [[nodiscard]] static auto create(const control& parent, const object_collection& items, xtd::usize selected_index) -> domain_up_down;
310 [[nodiscard]] static auto create(const control& parent, const object_collection& items, xtd::usize selected_index, const xtd::drawing::point& location) -> domain_up_down;
318 [[nodiscard]] static auto create(const control& parent, const object_collection& items, xtd::usize selected_index, const xtd::drawing::point& location, const xtd::drawing::size& size) -> domain_up_down;
327 [[nodiscard]] static auto create(const control& parent, const object_collection& items, xtd::usize selected_index, const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> domain_up_down;
329
331
336
341
342 protected:
344
346 xtd::forms::create_params create_params() const noexcept override;
347 xtd::drawing::color default_back_color() const noexcept override;
348 xtd::drawing::color default_fore_color() const noexcept override;
350
352
354 auto on_handle_created(const xtd::event_args& e) -> void override;
355 auto on_lost_focus(const xtd::event_args& e) -> void override;
356
359 virtual auto on_selected_item_changed(const xtd::event_args& e) -> void;
360
361 auto on_text_changed(const xtd::event_args& e) -> void override;
362 auto wnd_proc(xtd::forms::message& message) -> void override;
364
366 auto wm_scroll_control(xtd::forms::message& message) -> void;
368
369 private:
370 xtd::sptr<data> data_;
371 };
372 }
373}
Contains xtd::forms::application class.
Represent a polymorphic wrapper capable of holding any type.
Definition any_object.hpp:29
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition event_args.hpp:18
Represents an event.
Definition event.hpp:23
Defines the base class for controls, which are components with visual representation.
Definition control.hpp:81
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...
Represent an item contained in the domain_up_down::object_collection collection.
Definition domain_up_down.hpp:38
item()=default
Initializes a new instance of the item class.
auto get_hash_code() const noexcept -> xtd::usize override
Serves as a hash function for a particular type.
auto equals(const xtd::object &obj) const noexcept -> bool override
Determines whether the specified object is equal to the current object.
virtual auto tag() const noexcept -> const xtd::any_object &
Gets the tag of the item.
auto to_string() const noexcept -> xtd::string override
Returns a string containing the vague of the item.
item(const xtd::string &value, const xtd::any_object &tag)
Initializes a new instance of the item class with specified value and tag.
auto compare_to(const item &value) const noexcept -> xtd::int32 override
Compares the current instance with another object of the same type.
item(const xtd::string &value)
Initializes a new instance of the item class with specified value.
virtual auto value() const noexcept -> const xtd::string &
Gets the value of the item.
xtd::forms::create_params create_params() const noexcept override
Gets the required creation parameters when the control handle is created.
xtd::drawing::color default_back_color() const noexcept override
Gets the default background color of the control.
static constexpr xtd::usize bpos
Represents the index of the first valid element in a collection.
Definition domain_up_down.hpp:124
auto on_lost_focus(const xtd::event_args &e) -> void override
Raises the xtd::forms::control::lost_focus event.
auto items() const noexcept -> const object_collection &
Gets an object representing the collection of the items contained in this domain_up_down....
auto on_handle_created(const xtd::event_args &e) -> void override
Raises the xtd::forms::control::handle_created event.
xtd::drawing::color default_fore_color() const noexcept override
Gets the default foreground color of the control.
static constexpr xtd::usize epos
Represents the index of the last valid element in a collection.
Definition domain_up_down.hpp:130
auto on_text_changed(const xtd::event_args &e) -> void override
Raises the xtd::forms::control::text_changed event.
auto wnd_proc(xtd::forms::message &message) -> void override
Processes Windows messages.
xtd::event< domain_up_down, xtd::event_handler > value_changed
Occurs when the value property has been changed.
Definition domain_up_down.hpp:339
xtd::event< domain_up_down, xtd::event_handler > selected_item_changed
Occurs when the selected_item property has been changed.
Definition domain_up_down.hpp:335
virtual auto wrap() const noexcept -> bool
Gets a value indicating whether the collection of items continues to the first or last item if the us...
domain_up_down()
Initializes a new instance of the DomainUpDown class.
xtd::forms::layout::arranged_element_collection< item > object_collection
Represents the collection of items in a list_control.
Definition domain_up_down.hpp:112
auto selected_item() const noexcept -> const item &
Gets the selected item based on the index value of the selected item in the collection.
static auto create() -> domain_up_down
A factory to create an xtd::forms::domain_up_down.
virtual auto selected_index() const noexcept -> xtd::usize
Gets the zero-based index of the currently selected item.
static constexpr xtd::usize npos
Represents a value that is not a valid position in a collection.
Definition domain_up_down.hpp:120
virtual auto on_selected_item_changed(const xtd::event_args &e) -> void
Raises the domain_up_down::selected_item_changed event.
Implements the basic functionality required by a spin box (also known as an up-down control).
Definition up_down_base.hpp:23
Defines a generalized comparison method that a value type or class implements to create a type-specif...
Definition icomparable.hpp:22
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:23
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:45
generic_event_handler< const xtd::event_args & > event_handler
Represents the method that will handle an event that has no event data.
Definition event_handler.hpp:24
#define forms_export_
Define shared library export.
Definition forms_export.hpp:13
xtd::basic_string< char > string
Represents text as a sequence of UTF-8 code units.
Definition __string_definitions.hpp:43
xtd::shared_ptr_object< type_t > sptr
The xtd::sptr object is a shared pointer.
Definition sptr.hpp:25
std::int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:25
std::size_t usize
Represents an unsigned size of any object in bytes.
Definition usize.hpp:22
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition actions_system_images.hpp:10
The xtd::forms::layout namespace contains classes for implementing layout behaviors in your form or c...
Definition arranged_element_collection.hpp:25
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
constexpr auto size() const noexcept -> size_type
Returns the number of elements.
Definition read_only_span.hpp:217
Implements a Windows message.
Definition message.hpp:33
Contains xtd::forms::up_down_base control.