xtd 0.2.0
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
121 inline static constexpr xtd::size npos = xtd::size_object::max_value;
123
125
130
133 domain_up_down(const domain_up_down&) = default;
134 domain_up_down& operator =(const domain_up_down&) = default;
136
138
146 const object_collection& items() const noexcept;
153 virtual size_t selected_index() const noexcept;
158
161 const item& selected_item() const noexcept;
166
169 virtual bool wrap() const noexcept;
173 virtual domain_up_down& wrap(bool value);
175
176
178
186 static domain_up_down create(const drawing::point& location);
191 static domain_up_down create(const drawing::point& location, const drawing::size& size);
197 static domain_up_down create(const drawing::point& location, const drawing::size& size, const xtd::string& name);
219 static domain_up_down create(const object_collection& items, const drawing::point& location, const drawing::size& size, const xtd::string& name);
245 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);
254 static domain_up_down create(const control& parent, const drawing::point& location);
260 static domain_up_down create(const control& parent, const drawing::point& location, const drawing::size& size);
267 static domain_up_down create(const control& parent, const drawing::point& location, const drawing::size& size, const xtd::string& name);
293 static domain_up_down create(const control& parent, const object_collection& items, const drawing::point& location, const drawing::size& size, const xtd::string& name);
323 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);
325
327
332
337
338 protected:
340
342 forms::create_params create_params() const noexcept override;
343 drawing::color default_back_color() const noexcept override;
344 drawing::color default_fore_color() const noexcept override;
346
348
354 xtd::uptr<xtd::object> clone() const override;
355
356 void on_handle_created(const event_args& e) override;
357 void on_lost_focus(const event_args& e) override;
358
362
363 void on_text_changed(const event_args& e) override;
364 void wnd_proc(message& message) override;
366
368 void wm_scroll_control(message& message);
370
371 private:
372 void on_items_item_added(size_t pos, const item& item);
373 void on_items_item_removed(size_t pos, const item& item);
374 void on_items_item_updated(size_t pos, const item& item);
375
376 xtd::sptr<data> data_;
377 };
378 }
379}
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:335
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.
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:331
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
This is a special value equal to the maximum value representable by the type size_t.
Definition domain_up_down.hpp:121
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
box_integer< size_t > size_object
Represent a boxed size_t.
Definition size_object.hpp:28
xtd::shared_ptr_object< type_t > sptr
The xtd::sptr object is a shared pointer.
Definition sptr.hpp:25
int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:23
xtd::unique_ptr_object< type_t > uptr
The xtd::uptr object is a unique pointer.
Definition uptr.hpp:25
@ 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:22
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.