xtd - Reference Guide  0.1.1
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
choice.h
Go to the documentation of this file.
1 #pragma once
6 #include "list_control.h"
7 
9 namespace xtd {
11  namespace forms {
26  public:
28  choice();
29 
30  virtual drawing::size default_size() const override {return {121, 23};}
31 
35  object_collection& items() {return items_;}
38  const object_collection& items() const {return items_;}
41  const choice& items(const object_collection& items) {
42  items_ = items;
43  return *this;
44  }
45 
49  list_control& selected_index(size_t selected_index) override;
50 
53  const item& selected_item() const {return selected_item_;}
56  choice& selected_item(const item& selected_item);
57 
61  virtual bool sorted() const {return sorted_;}
65  virtual choice& sorted(bool sorted);
66 
67  using list_control::text;
70  control& text(const xtd::ustring& text) override {return *this;}
71 
74  void begin_update();
77  void end_update();
78 
79  protected:
80  forms::create_params create_params() const override;
81 
82  void on_handle_created(const event_args& e) override;
83 
84  void on_selected_value_changed(const event_args& e) override;
85 
86  void set_bounds_core(int32_t x, int32_t y, int32_t width, int32_t height, bounds_specified specified) override;
87 
88  void set_client_size_core(int32_t width, int32_t height) override;
89 
90  void wnd_proc(message& message) override;
91 
95 
99 
102  virtual void wm_mouse_down(message& message);
103 
106  virtual void wm_mouse_up(message& message);
107 
109  object_collection items_;
110  item selected_item_;
111  bool sorted_ = false;
112  bool user_set_size_ = false;
114  };
115  }
116 }
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 a choice control.
Definition: choice.h:25
virtual bool sorted() const
Gets a value indicating whether the items in the choice are sorted.
Definition: choice.h:61
virtual void wm_mouse_down(message &message)
Processes the mouse down message the choice control receives from the top-level window.
virtual void wm_mouse_double_click(message &message)
Processes the mouse double-click message the choice control receives from the top-level window.
virtual drawing::size default_size() const override
Gets the default size of the control.
Definition: choice.h:30
virtual void wm_reflect_command(message &message)
Processes the command message the choice control receives from the top-level window.
void on_selected_value_changed(const event_args &e) override
Raises the list_control::selected_value_changed event.
const object_collection & items() const
Gets an object representing the collection of the items contained in this choice.
Definition: choice.h:38
object_collection & items()
Gets an object representing the collection of the items contained in this choice.
Definition: choice.h:35
void on_handle_created(const event_args &e) override
Raises the control::handle_created event.
void end_update()
Resumes painting the choice control after painting is suspended by the begin_update method.
void begin_update()
Maintains performance while items are added to the choice one at a time by preventing the control fro...
forms::create_params create_params() const override
Gets the required creation parameters when the control handle is created.
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.
choice & selected_item(const item &selected_item)
Sets currently selected item in the choice.
control & text(const xtd::ustring &text) override
Sets the text associated with this control.
Definition: choice.h:70
void set_client_size_core(int32_t width, int32_t height) override
Sets the size of the client area of the control.
virtual choice & sorted(bool sorted)
Sets a value indicating whether the items in the choice are sorted.
void wnd_proc(message &message) override
Processes Windows messages.
virtual void wm_mouse_up(message &message)
Processes the mouse up message the choice control receives from the top-level window.
const item & selected_item() const
Gets currently selected item in the choice.
Definition: choice.h:53
const choice & items(const object_collection &items)
Sets an object representing the collection of the items contained in this choice.
Definition: choice.h:41
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.
choice()
Initializes a new instance of the choice class.
Defines the base class for controls, which are components with visual representation.
Definition: control.h:67
virtual const xtd::ustring & text() const
Gets the text associated with this control.
Definition: control.h:650
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:22
Provides a common implementation of members for the list_box, choice and combo_box classes.
Definition: list_control.h:19
virtual size_t selected_index() const
Gets the zero-based index of the currently selected item.
Definition: list_control.h:84
Implements a Windows message.
Definition: message.h:25
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:48
#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
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