xtd 0.2.0
combo_box.h
Go to the documentation of this file.
1 #pragma once
6 #include "combo_box_style.h"
7 #include "list_control.h"
8 
10 namespace xtd {
12  namespace forms {
34  class forms_export_ combo_box : public list_control {
35  struct data;
36 
37  public:
39 
42  combo_box();
44 
46 
50  bool dropped_down() const noexcept;
54  combo_box& dropped_down(bool value);
55 
59  combo_box_style drop_down_style() const noexcept;
63  combo_box& drop_down_style(combo_box_style drop_down_style);
64 
68  object_collection& items() noexcept;
71  const object_collection& items() const noexcept;
75  const combo_box& items(const object_collection& items);
76 
81  list_control& selected_index(size_t selected_index) override;
82 
85  const item& selected_item() const noexcept;
89  combo_box& selected_item(const item& selected_item);
90 
94  virtual bool sorted() const noexcept;
99  virtual combo_box& sorted(bool sorted);
100 
101  using list_control::text;
104  control& text(const xtd::ustring& text) override;
106 
108 
112  void begin_update();
113 
114  using control::create;
121  static combo_box create(const object_collection& items, size_t selected_index = object_collection::npos, const drawing::point& location = {-1, -1}, const drawing::size& size = {-1, -1}, const xtd::ustring& name = xtd::ustring::empty_string);
129  static combo_box create(const control& parent, const object_collection& items, size_t selected_index, const drawing::point& location = {-1, -1}, const drawing::size& size = {-1, -1}, const xtd::ustring& name = xtd::ustring::empty_string);
130 
133  void end_update();
135 
137 
149 
150  protected:
152 
154  forms::create_params create_params() const noexcept override;
156 
158 
164  virtual void on_drop_down(const event_args& e);
165 
169  virtual void on_drop_down_closed(const event_args& e);
170 
175  virtual void on_drop_down_style_changed(const event_args& e);
176 
177  void on_handle_created(const event_args& e) override;
178  void on_selected_value_changed(const event_args& e) override;
179  void wnd_proc(message& message) override;
181 
182  private:
183  void wm_command_control(message& message);
184  void wm_command_control_selchange(message& message);
185  void wm_mouse_double_click(message& message);
186  void wm_mouse_down(message& message);
187  void wm_mouse_up(message& message);
188 
189  std::shared_ptr<data> data_;
190  };
191  }
192 }
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition: event_args.h:18
Contains xtd::forms::layout::arranged_element_collection collection.
Represent an item contained in the list_control::object_collection collection.
Definition: list_control.h:28
Represents an ordered pair of integer x- and y-coordinates that defines a point in a two-dimensional ...
Definition: point.h:54
Stores an ordered pair of integers, which specify a height and width.
Definition: size.h:31
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
Encapsulates the information needed when creating a control.
Definition: create_params.h:27
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:46
Represents a collection of objects.
Definition: arranged_element_collection.h:31
static control create(const drawing::point &location={-1, -1}, const drawing::size &size={-1, -1}, const xtd::ustring &name=xtd::ustring::empty_string)
A factory to create a specified control with specified location, size, and name.
Represents an event.
Definition: event.h:21
Represents a Windows combo box control.
Definition: combo_box.h:34
virtual const xtd::ustring & text() const noexcept
Gets the text associated with this control.
Implements a Windows message.
Definition: message.h:26
Provides a common implementation of members for the list_box, choice and combo_box classes...
Definition: list_control.h:23
Defines the base class for controls, which are components with visual representation.
Definition: control.h:78
Contains xtd::forms::list_control control.
event< combo_box, event_handler > drop_down
Occurs when the drop-down portion of a xtd::forms::combo_box is shown.
Definition: combo_box.h:141
virtual size_t selected_index() const noexcept
Gets the zero-based index of the currently selected item.
event< combo_box, event_handler > drop_down_style_changed
Occurs when the drop_down_style property has changed.
Definition: combo_box.h:147
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
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.h:144
static const ustring empty_string
Represents the empty string.
Definition: ustring.h:53
Specifies that both the x and y coordinates of the control are defined.
The xtd::forms::status_bar_panel displays text in the standard font.
Contains xtd::forms::combo_box_style enum class.
size_t size
Represents a size of any object in bytes.
Definition: types.h:195
combo_box_style
Specifies the combo_box style.
Definition: combo_box_style.h:22