xtd 0.2.0
combo_box.hpp
Go to the documentation of this file.
1
4#pragma once
6#include "combo_box_style.hpp"
7#include "list_control.hpp"
8
10namespace xtd {
12 namespace forms {
37 struct data;
38
39 public:
41
46
48 combo_box(combo_box&& rhs);
49 combo_box(const combo_box&) = default;
50 combo_box& operator =(const combo_box&) = default;
52
54
58 bool dropped_down() const noexcept;
62 combo_box& dropped_down(bool value);
63
72
79 const object_collection& items() const noexcept;
84
90
93 const item& selected_item() const noexcept;
98
102 virtual bool sorted() const noexcept;
107 virtual combo_box& sorted(bool sorted);
108
109 using list_control::text;
112 control& text(const xtd::string& text) override;
114
116
121
126
128
136 static combo_box create(const drawing::point& location);
141 static combo_box create(const drawing::point& location, const drawing::size& size);
147 static combo_box create(const drawing::point& location, const drawing::size& size, const xtd::string& name);
162 static combo_box create(const object_collection& items, const drawing::point& location, const drawing::size& size);
169 static combo_box create(const object_collection& items, const drawing::point& location, const drawing::size& size, const xtd::string& name);
187 static combo_box create(const object_collection& items, size_t selected_index, const drawing::point& location, const drawing::size& size);
195 static combo_box create(const object_collection& items, size_t selected_index, const drawing::point& location, const drawing::size& size, const xtd::string& name);
204 static combo_box create(const control& parent, const drawing::point& location);
210 static combo_box create(const control& parent, const drawing::point& location, const drawing::size& size);
217 static combo_box create(const control& parent, const drawing::point& location, const drawing::size& size, const xtd::string& name);
228 static combo_box create(const control& parent, const object_collection& items, const drawing::point& location);
235 static combo_box create(const control& parent, const object_collection& items, const drawing::point& location, const drawing::size& size);
243 static combo_box create(const control& parent, const object_collection& items, const drawing::point& location, const drawing::size& size, const xtd::string& name);
256 static combo_box create(const control& parent, const object_collection& items, size_t selected_index, const drawing::point& location);
264 static combo_box create(const control& parent, const object_collection& items, size_t selected_index, const drawing::point& location, const drawing::size& size);
273 static combo_box create(const control& parent, const object_collection& items, size_t selected_index, const drawing::point& location, const drawing::size& size, const xtd::string& name);
275
277
289
290 protected:
292
294 forms::create_params create_params() const noexcept override;
296
298
304 xtd::uptr<xtd::object> clone() const override;
305
310 virtual void on_drop_down(const event_args& e);
311
315 virtual void on_drop_down_closed(const event_args& e);
316
322
323 void on_handle_created(const event_args& e) override;
325 void wnd_proc(message& message) override;
327
328 private:
329 void on_items_item_added(size_t pos, const item& item);
330 void on_items_item_removed(size_t pos, const item& item);
331 void on_items_item_updated(size_t pos, const item& item);
332 void wm_command_control(message& message);
333 void wm_command_control_selchange(message& message);
334 void wm_mouse_double_click(message& message);
335 void wm_mouse_down(message& message);
336 void wm_mouse_up(message& message);
337
338 xtd::sptr<data> data_;
339 };
340 }
341}
Contains xtd::forms::layout::arranged_element_collection collection.
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
event< combo_box, event_handler > drop_down
Occurs when the drop-down portion of a xtd::forms::combo_box is shown.
Definition combo_box.hpp:281
virtual void on_drop_down(const event_args &e)
Raises the xtd::forms::combo_box::drop_down event.
xtd::uptr< xtd::object > clone() const override
Creates a new object that is a copy of the current instance.
virtual void on_drop_down_closed(const event_args &e)
Raises the xtd::forms::combo_box::drop_down_closed event.
object_collection & items() noexcept
Gets an object representing the collection of the items contained in this combo_box....
list_control & selected_index(size_t selected_index) override
When overridden in a derived class, Sets the zero-based index of the currently selected item.
control & text(const xtd::string &text) override
Sets the text associated with this control.
const item & selected_item() const noexcept
Gets currently selected item in the combo_box.
combo_box()
Initializes a new instance of the combo_box class.
forms::create_params create_params() const noexcept override
Gets the required creation parameters when the control handle is created.
void on_handle_created(const event_args &e) override
Raises the xtd::forms::control::handle_created event.
virtual bool sorted() const noexcept
Gets a value indicating whether the items in the combo_box are sorted alphabetically.
static combo_box create()
A factory to create an xtd::forms::combo_box.
event< combo_box, event_handler > drop_down_style_changed
Occurs when the drop_down_style property has changed.
Definition combo_box.hpp:287
void end_update()
Resumes painting the combo_box control after painting is suspended by the begin_update method.
void wnd_proc(message &message) override
Processes Windows messages.
void on_selected_value_changed(const event_args &e) override
Raises the list_control::selected_value_changed event.
event< combo_box, event_handler > drop_down_closed
Occurs when the drop-down portion of the xtd::forms::combo_box is no longer visible.
Definition combo_box.hpp:284
bool dropped_down() const noexcept
Gets a value indicating whether the combo box is displaying its drop-down portion.
combo_box_style drop_down_style() const noexcept
Gets a value specifying the style of the combo box.
virtual void on_drop_down_style_changed(const event_args &e)
Raises the xtd::forms::combo_box::drop_down_style_changed event.
void begin_update()
Maintains performance while items are added to the combo_box one at a time by preventing the control ...
Defines the base class for controls, which are components with visual representation.
Definition control.hpp:81
virtual drawing::point location() const noexcept
Gets the coordinates of the upper-left corner of the control relative to the upper-left corner of its...
virtual const xtd::string & name() const noexcept
Gets the name of the control.
virtual drawing::size size() const noexcept
Gets the height and width of the control.
virtual std::optional< control_ref > parent() const noexcept
Gets the parent container of the control.
Represent an item contained in the list_control::object_collection collection.
Definition list_control.hpp:32
layout::arranged_element_collection< item, item::sorter > object_collection
Represents the collection of items in a list_control.
Definition list_control.hpp:135
list_control()
Initializes a new instance of the list_control class.
Contains xtd::forms::combo_box_style enum class.
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::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
combo_box_style
Specifies the combo_box style.
Definition combo_box_style.hpp:24
@ e
The E key.
Definition keys.hpp:207
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 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