xtd 0.2.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/size_object>
10
12namespace xtd {
14 namespace forms {
34 struct data;
35
36 public:
38 class item : public object, public 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.
56 item(const item& value) = default;
57 item& operator =(const item& value) = default;
59
61
65 virtual const xtd::string& value() const noexcept;
66
69 virtual const xtd::any_object& tag() const noexcept;
71
73
85 int32 compare_to(const item& value) const noexcept override;
86
90 bool equals(const xtd::object& obj) const noexcept override;
94 bool equals(const item& other) const noexcept override;
95
98 xtd::size get_hash_code() const noexcept override;
99
102 xtd::string to_string() const noexcept override;
104
105 private:
106 xtd::string value_;
107 xtd::any_object tag_;
108 };
109
111
114 using object_collection = layout::arranged_element_collection<item>;
116
118
122 inline static constexpr xtd::size npos = object_collection::npos;
123
126 static inline constexpr xtd::size bpos = object_collection::bpos;
127
132 static inline constexpr xtd::size epos = object_collection::epos;
134
136
141
144 domain_up_down(const domain_up_down&) = default;
145 domain_up_down& operator =(const domain_up_down&) = default;
147
149
157 const object_collection& items() const noexcept;
164 virtual size_t selected_index() const noexcept;
169
172 const item& selected_item() const noexcept;
177
180 virtual bool wrap() const noexcept;
184 virtual domain_up_down& wrap(bool value);
186
187
189
197 static domain_up_down create(const drawing::point& location);
202 static domain_up_down create(const drawing::point& location, const drawing::size& size);
208 static domain_up_down create(const drawing::point& location, const drawing::size& size, const xtd::string& name);
230 static domain_up_down create(const object_collection& items, const drawing::point& location, const drawing::size& size, const xtd::string& name);
256 static domain_up_down create(const object_collection& items, size_t selected_index, const drawing::point& location, const drawing::size& size, const xtd::string& name);
265 static domain_up_down create(const control& parent, const drawing::point& location);
271 static domain_up_down create(const control& parent, const drawing::point& location, const drawing::size& size);
278 static domain_up_down create(const control& parent, const drawing::point& location, const drawing::size& size, const xtd::string& name);
304 static domain_up_down create(const control& parent, const object_collection& items, const drawing::point& location, const drawing::size& size, const xtd::string& name);
334 static domain_up_down create(const control& parent, const object_collection& items, size_t selected_index, const drawing::point& location, const drawing::size& size, const xtd::string& name);
336
338
343
348
349 protected:
351
353 forms::create_params create_params() const noexcept override;
354 drawing::color default_back_color() const noexcept override;
355 drawing::color default_fore_color() const noexcept override;
357
359
365 xtd::uptr<xtd::object> clone() const override;
366
367 void on_handle_created(const event_args& e) override;
368 void on_lost_focus(const event_args& e) override;
369
373
374 void on_text_changed(const event_args& e) override;
375 void wnd_proc(message& message) override;
377
379 void wm_scroll_control(message& message);
381
382 private:
383 void on_items_item_added(size_t pos, const item& item);
384 void on_items_item_removed(size_t pos, const item& item);
385 void on_items_item_updated(size_t pos, const item& item);
386
387 xtd::sptr<data> data_;
388 };
389 }
390}
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:21
Defines the base class for controls, which are components with visual representation.
Definition control.hpp:81
virtual const xtd::string & name() const noexcept
Gets the name of the control.
virtual std::optional< control_ref > parent() const noexcept
Gets the parent container of the control.
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.
xtd::size get_hash_code() const noexcept override
Serves as a hash function for a particular type.
virtual const xtd::any_object & tag() const noexcept
Gets the tag of the item.
xtd::string to_string() const noexcept 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.
item(const xtd::string &value)
Initializes a new instance of the item class with specified value.
bool equals(const xtd::object &obj) const noexcept override
Determines whether the specified object is equal to the current object.
virtual const xtd::string & value() const noexcept
Gets the value of the item.
int32 compare_to(const item &value) const noexcept override
Compares the current instance with another object of the same type.
virtual bool wrap() const noexcept
Gets a value indicating whether the collection of items continues to the first or last item if the us...
drawing::color default_fore_color() const noexcept override
Gets the default foreground color of the control.
void on_text_changed(const event_args &e) override
Raises the xtd::forms::control::text_changed event.
event< domain_up_down, event_handler > value_changed
Occurs when the value property has been changed.
Definition domain_up_down.hpp:346
void on_lost_focus(const event_args &e) override
Raises the xtd::forms::control::lost_focus event.
const item & selected_item() const noexcept
Gets the selected item based on the index value of the selected item in the collection.
static constexpr xtd::size epos
Represents the index of the last valid element in a collection.
Definition domain_up_down.hpp:132
virtual size_t selected_index() const noexcept
Gets the zero-based index of the currently selected item.
xtd::uptr< xtd::object > clone() const override
Creates a new object that is a copy of the current instance.
layout::arranged_element_collection< item > object_collection
Represents the collection of items in a list_control.
Definition domain_up_down.hpp:114
static domain_up_down create()
A factory to create an xtd::forms::domain_up_down.
domain_up_down()
Initializes a new instance of the DomainUpDown class.
void wnd_proc(message &message) override
Processes Windows messages.
event< domain_up_down, event_handler > selected_item_changed
Occurs when the selected_item property has been changed.
Definition domain_up_down.hpp:342
drawing::color default_back_color() const noexcept override
Gets the default background color of the control.
void on_handle_created(const event_args &e) override
Raises the xtd::forms::control::handle_created event.
virtual void on_selected_item_changed(const event_args &e)
Raises the domain_up_down::selected_item_changed event.
object_collection & items() noexcept
Gets an object representing the collection of the items contained in this domain_up_down....
forms::create_params create_params() const noexcept override
Gets the required creation parameters when the control handle is created.
static constexpr xtd::size npos
Represents a value that is not a valid position in a collection.
Definition domain_up_down.hpp:122
static constexpr xtd::size bpos
Represents the index of the first valid element in a collection.
Definition domain_up_down.hpp:126
up_down_base()
Initialize a new instance of up_down_base class.
Defines a generalized comparison method that a value type or class implements to create a type-specif...
Definition icomparable.hpp:21
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:22
object()=default
Create a new instance of the ultimate base class object.
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
xtd::unique_ptr_object< type_t > uptr
The xtd::uptr object is a unique pointer.
Definition uptr.hpp:25
std::int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:23
@ other
The operating system is other.
Definition platform_id.hpp:58
@ e
The E key.
Definition keys.hpp:207
@ location
Specifies that both the x and y coordinates of the control are defined.
Definition bounds_specified.hpp:30
@ size
Specifies that both the width and height property values of the control are defined.
Definition bounds_specified.hpp:36
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 const_pointer data() const noexcept
Gets direct access to the underlying contiguous storage.
Definition read_only_span.hpp:201
Implements a Windows message.
Definition message.hpp:33
Contains xtd::forms::up_down_base control.