xtd - Reference Guide  0.1.2
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Loading...
Searching...
No Matches
combo_box.h
Go to the documentation of this file.
1
4#pragma once
6#include "combo_box_style.h"
7#include "list_control.h"
8
10namespace xtd {
12 namespace forms {
28 public:
31
32 virtual drawing::size default_size() const override {return {121, 23};}
33
37 combo_box_style drop_down_style() const {return drop_down_style_;}
42
46 object_collection& items() {return items_;}
49 const object_collection& items() const {return items_;}
53 const combo_box& items(const object_collection& items) {
54 items_ = items;
55 return *this;
56 }
57
58 using list_control::selected_index;
62 list_control& selected_index(size_t selected_index) override;
63
66 const item& selected_item() const {return selected_item_;}
70 combo_box& selected_item(const item& selected_item);
71
75 virtual bool sorted() const {return sorted_;}
80 virtual combo_box& sorted(bool sorted);
81
82 using list_control::text;
85 control& text(const xtd::ustring& text) override {return *this;}
86
92 void end_update();
93
97
98 protected:
99 forms::create_params create_params() const override;
100
103
104 void on_handle_created(const event_args& e) override;
105
106 void on_selected_value_changed(const event_args& e) override;
107
108 void set_bounds_core(int32_t x, int32_t y, int32_t width, int32_t height, bounds_specified specified) override;
109
110 void set_client_size_core(int32_t width, int32_t height) override;
111
112 void wnd_proc(message& message) override;
113
117
121
125
129
131 int32_t drop_down_height_ = 0;
132 combo_box_style drop_down_style_ = combo_box_style::drop_down;
133 int32_t drop_down_width_ = 0;
134 object_collection items_;
135 item selected_item_;
136 bool sorted_ = false;
137 bool user_set_size_ = false;
139 };
140 }
141}
Contains xtd::forms::arranged_element_collection collection.
Stores an ordered pair of integers, which specify a height and width.
Definition size.h:25
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition event_args.h:18
Represents an event.
Definition event.h:21
Represents a Windows combo box control.
Definition combo_box.h:27
forms::create_params create_params() const override
Gets the required creation parameters when the control handle is created.
control & text(const xtd::ustring &text) override
Sets the text associated with this control.
Definition combo_box.h:85
object_collection & items()
Gets an object representing the collection of the items contained in this combo_box....
Definition combo_box.h:46
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.
combo_box()
Initializes a new instance of the combo_box class.
virtual bool sorted() const
Gets a value indicating whether the items in the combo_box are sorted alphabetically.
Definition combo_box.h:75
combo_box & selected_item(const item &selected_item)
Sets currently selected item in the combo_box.
combo_box_style drop_down_style() const
Gets a value specifying the style of the combo box.
Definition combo_box.h:37
void on_handle_created(const event_args &e) override
Raises the control::handle_created event.
void set_bounds_core(int32_t x, int32_t y, int32_t width, int32_t height, bounds_specified specified) override
Performs the work of setting the specified bounds of this control.
virtual combo_box & sorted(bool sorted)
Sets a value indicating whether the items in the combo_box are sorted alphabetically.
virtual drawing::size default_size() const override
Gets the default size of the control.
Definition combo_box.h:32
void end_update()
Resumes painting the combo_box control after painting is suspended by the begin_update method.
const object_collection & items() const
Gets an object representing the collection of the items contained in this combo_box....
Definition combo_box.h:49
void set_client_size_core(int32_t width, int32_t height) override
Sets the size of the client area of the control.
const item & selected_item() const
Gets currently selected item in the combo_box.
Definition combo_box.h:66
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.
virtual void wm_reflect_command(message &message)
Processes the command message the list_box control receives from the top-level window.
combo_box & drop_down_style(combo_box_style drop_down_style)
Sets a value specifying the style of the combo box.
const combo_box & items(const object_collection &items)
Sets an object representing the collection of the items contained in this combo_box....
Definition combo_box.h:53
virtual void wm_mouse_up(message &message)
Processes the mouse up message the list_box control receives from the top-level window.
virtual void wm_mouse_down(message &message)
Processes the mouse down message the list_box control receives from the top-level window.
virtual void wm_mouse_double_click(message &message)
Processes the mouse double-click message the list_box control receives from the top-level window.
virtual void on_drop_down_style_changed(const event_args &e)
Raises the 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.h:67
Represents a collection of objects.
Definition arranged_element_collection.h:28
Represent an item contained in the list_control::object_collection collection.
Definition list_control.h:24
Provides a common implementation of members for the list_box, choice and combo_box classes.
Definition list_control.h:21
Implements a Windows message.
Definition message.h:25
Represents text as a sequence of UTF-8 code units.
Definition ustring.h:48
Contains xtd::forms::combo_box_style enum class.
event< combo_box, event_handler > drop_down_style_changed
Occurs when the drop_down_style property has changed.
Definition combo_box.h:96
#define forms_export_
Define shared library export.
Definition forms_export.h:13
bounds_specified
Specifies the bounds of the control to use when defining a control's size and position....
Definition bounds_specified.h:18
combo_box_style
Specifies the combo_box style.
Definition combo_box_style.h:20
Contains xtd::forms::list_control control.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition about_box.h:13
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition system_report.h:17