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.
51 item(const xtd::string& value, const std::any& tag);
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 std::any tag() const noexcept;
71
73
75 int32 compare_to(const item& value) const noexcept override;
76 using object::equals;
77 bool equals(const item& value) const noexcept override;
80 xtd::string to_string() const noexcept override;
82
83 private:
84 xtd::string value_;
85 std::any tag_;
86 };
87
89
92 using object_collection = layout::arranged_element_collection<item>;
94
96
99 inline static constexpr xtd::size npos = xtd::size_object::max_value;
101
103
108
111 domain_up_down(const domain_up_down&) = default;
112 domain_up_down& operator =(const domain_up_down&) = default;
114
116
121 object_collection& items() noexcept;
124 const object_collection& items() const noexcept;
128 const domain_up_down& items(const object_collection& items);
131 virtual size_t selected_index() const noexcept;
135 virtual domain_up_down& selected_index(size_t selected_index);
136
139 const item& selected_item() const noexcept;
143 domain_up_down& selected_item(const item& selected_item);
144
147 virtual bool wrap() const noexcept;
151 virtual domain_up_down& wrap(bool value);
153
154
156
160 static domain_up_down create();
164 static domain_up_down create(const drawing::point& location);
169 static domain_up_down create(const drawing::point& location, const drawing::size& size);
175 static domain_up_down create(const drawing::point& location, const drawing::size& size, const xtd::string& name);
179 static domain_up_down create(const object_collection& items);
184 static domain_up_down create(const object_collection& items, const drawing::point& location);
190 static domain_up_down create(const object_collection& items, const drawing::point& location, const drawing::size& size);
197 static domain_up_down create(const object_collection& items, const drawing::point& location, const drawing::size& size, const xtd::string& name);
202 static domain_up_down create(const object_collection& items, size_t selected_index);
208 static domain_up_down create(const object_collection& items, size_t selected_index, const drawing::point& location);
215 static domain_up_down create(const object_collection& items, size_t selected_index, const drawing::point& location, const drawing::size& size);
223 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);
227 static domain_up_down create(const control& parent);
232 static domain_up_down create(const control& parent, const drawing::point& location);
238 static domain_up_down create(const control& parent, const drawing::point& location, const drawing::size& size);
245 static domain_up_down create(const control& parent, const drawing::point& location, const drawing::size& size, const xtd::string& name);
250 static domain_up_down create(const control& parent, const object_collection& items);
256 static domain_up_down create(const control& parent, const object_collection& items, const drawing::point& location);
263 static domain_up_down create(const control& parent, const object_collection& items, const drawing::point& location, const drawing::size& size);
271 static domain_up_down create(const control& parent, const object_collection& items, const drawing::point& location, const drawing::size& size, const xtd::string& name);
277 static domain_up_down create(const control& parent, const object_collection& items, size_t selected_index);
284 static domain_up_down create(const control& parent, const object_collection& items, size_t selected_index, const drawing::point& location);
292 static domain_up_down create(const control& parent, const object_collection& items, size_t selected_index, const drawing::point& location, const drawing::size& size);
301 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);
303
305
309 event<domain_up_down, event_handler> selected_item_changed;
310
315
316 protected:
318
320 forms::create_params create_params() const noexcept override;
321 drawing::color default_back_color() const noexcept override;
322 drawing::color default_fore_color() const noexcept override;
324
326
332 xtd::uptr<xtd::object> clone() const override;
333
334 void on_handle_created(const event_args& e) override;
335 void on_lost_focus(const event_args& e) override;
336
339 virtual void on_selected_item_changed(const event_args& e);
340
341 void on_text_changed(const event_args& e) override;
342 void wnd_proc(message& message) override;
344
346 void wm_scroll_control(message& message);
348
349 private:
350 void on_items_item_added(size_t pos, const item& item);
351 void on_items_item_removed(size_t pos, const item& item);
352 void on_items_item_updated(size_t pos, const item& item);
353
354 xtd::sptr<data> data_;
355 };
356 }
357}
Contains xtd::forms::application class.
Represents text as a sequence of character units.
Definition basic_string.hpp:79
Represents a boxed integer object.
Definition box_integer.hpp:52
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
Encapsulates the information needed when creating a control.
Definition create_params.hpp:29
Represent an item contained in the domain_up_down::object_collection collection.
Definition domain_up_down.hpp:38
item(const xtd::string &value, const std::any &tag)
Initializes a new instance of the item class with specified value and tag.
item()=default
Initializes a new instance of the item class.
item(const xtd::string &value)
Initializes a new instance of the item class with specified value.
virtual const xtd::string & value() const noexcept
Gets the value of the item.
Represents a Windows spin box (also known as an up-down control) that displays string values.
Definition domain_up_down.hpp:33
Represents a collection of objects.
Definition arranged_element_collection.hpp:34
Implements a Windows message.
Definition message.hpp:28
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:21
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:22
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:42
generic_event_handler<> event_handler
Represents the method that will handle an event that has no event data.
Definition event_handler.hpp:32
#define forms_export_
Define shared library export.
Definition forms_export.hpp:13
int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:23
std::unique_ptr< type_t > uptr
The xtd::uptr object is a unique pointer.
Definition uptr.hpp:25
size_t size
Represents a size of any object in bytes.
Definition size.hpp:23
std::shared_ptr< type_t > sptr
The xtd::sptr object is a shared pointer.
Definition sptr.hpp:25
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition xtd_about_box.hpp:12
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10
Contains xtd::forms::up_down_base control.