xtd 0.2.0
choice.h
Go to the documentation of this file.
1 #pragma once
6 #include "list_control.h"
7 
9 namespace xtd {
11  namespace forms {
35  class forms_export_ choice : public list_control {
36  struct data;
37 
38  public:
40 
43  choice();
45 
47 
52  object_collection& items() noexcept;
55  const object_collection& items() const noexcept;
58  const choice& items(const object_collection& items);
59 
63  list_control& selected_index(size_t selected_index) override;
64 
67  const item& selected_item() const noexcept;
70  choice& selected_item(const item& selected_item);
71 
75  virtual bool sorted() const noexcept;
79  virtual choice& sorted(bool sorted);
80 
81  using list_control::text;
84  control& text(const xtd::ustring& text) override;
86 
88 
92  void begin_update();
93 
94  using control::create;
101  static choice 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);
109  static choice 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);
110 
113  void end_update();
115 
116  protected:
118 
120  forms::create_params create_params() const noexcept override;
122 
124 
126  void on_handle_created(const event_args& e) override;
127  void on_selected_value_changed(const event_args& e) override;
128  void set_bounds_core(int32 x, int32 y, int32 width, int32 height, bounds_specified specified) override;
129  void set_client_size_core(int32 width, int32 height) override;
130  void wnd_proc(message& message) override;
132 
133  private:
134  void on_items_item_added(size_t pos, const item& item);
135  void on_items_item_removed(size_t pos, const item& item);
136  void on_items_item_updated(size_t pos, const item& item);
137  void wm_command_control(message& message);
138  void wm_mouse_double_click(message& message);
139  void wm_mouse_down(message& message);
140  void wm_mouse_up(message& message);
141 
142  std::shared_ptr<data> data_;
143  };
144  }
145 }
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
Specifies that the top edge of the control is defined.
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
Specifies that the left edge of the control is defined.
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.
Specifies that the height of the control is defined.
virtual const xtd::ustring & text() const noexcept
Gets the text associated with this control.
Specifies that the width of the control is defined.
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.
int_least32_t int32
Represents a 32-bit signed integer.
Definition: types.h:129
Represents a choice control.
Definition: choice.h:35
virtual size_t selected_index() const noexcept
Gets the zero-based index of the currently selected item.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
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.
bounds_specified
Specifies the bounds of the control to use when defining a control&#39;s size and position. This enumeration has a flags attribute that allows a bitwise combination of its member values.
Definition: bounds_specified.h:20
The xtd::forms::status_bar_panel displays text in the standard font.
size_t size
Represents a size of any object in bytes.
Definition: types.h:195