xtd 0.2.0
tool_bar.h
Go to the documentation of this file.
1 #pragma once
5 #include "border_style.h"
6 #include "button.h"
7 #include "context_menu.h"
8 #include "image_list.h"
9 #include "panel.h"
10 #include "tool_bar_appearance.h"
11 #include "tool_bar_button.h"
13 #include "tool_bar_text_align.h"
14 #include <memory>
15 #include <vector>
16 
18 namespace xtd {
20  namespace forms {
22  class form;
24 
50  class forms_export_ tool_bar : public control {
51  struct data;
52  class tool_bar_button_control;
53 
54  public:
56 
61 
63 
67  tool_bar();
69 
71 
76  virtual xtd::forms::tool_bar_appearance appearance() const noexcept;
82 
85  virtual forms::border_sides border_sides() const noexcept;
90 
94  virtual forms::border_style border_style() const noexcept;
99  virtual tool_bar& border_style(forms::border_style value);
104  virtual xtd::forms::tool_bar& border_style(std::nullptr_t value);
105 
109  const tool_bar_button_collection& buttons() const noexcept;
114 
118  virtual xtd::drawing::size button_size() const noexcept;
123  virtual tool_bar& button_size(const xtd::drawing::size& value);
128  virtual tool_bar& button_size(std::nullptr_t value);
129 
134  virtual bool divider() const noexcept;
140  virtual tool_bar& divider(bool value);
141 
142  dock_style dock() const noexcept override;
143  control& dock(dock_style dock) override;
144 
148  virtual bool drop_down_arrows() const noexcept;
153  virtual tool_bar& drop_down_arrows(bool value);
154 
158  const xtd::forms::image_list& image_list() const noexcept;
167  tool_bar& image_list(const xtd::forms::image_list& value);
168 
171  virtual xtd::drawing::size image_size() const noexcept;
172 
175  virtual bool show_icon() const noexcept;
179  virtual tool_bar& show_icon(bool value);
180 
183  virtual bool show_text() const noexcept;
187  virtual tool_bar& show_text(bool value);
188 
192  virtual bool show_tool_tips() const noexcept;
197  virtual tool_bar& show_tool_tips(bool value);
198 
202  virtual xtd::forms::tool_bar_text_align text_align() const noexcept;
207  virtual tool_bar& text_align(xtd::forms::tool_bar_text_align value);
208 
212  virtual bool wrappable() const noexcept;
218  virtual tool_bar& wrappable(bool value);
220 
222 
227 
230  xtd::event<tool_bar, xtd::forms::tool_bar_button_click_event_handler> button_drop_down;
232 
233  protected:
234  friend tool_bar_button;
235  friend form;
236 
238 
240  forms::create_params create_params() const noexcept override;
241  xtd::drawing::font default_font() const noexcept override;
242  drawing::size default_size() const noexcept override;
244 
246 
254  void on_button_click(const xtd::forms::tool_bar_button_click_event_args& e);
255 
262  void on_button_drop_down(const xtd::forms::tool_bar_button_click_event_args& e);
263 
264  void on_handle_created(const event_args& e) override;
265  void on_handle_destroyed(const event_args& e) override;
266  void on_paint(xtd::forms::paint_event_args& e) override;
267  void on_resize(const event_args& e) override;
268  void wnd_proc(message& message) override;
270 
271  private:
272  void fill();
273 
274  bool is_horizontal() const noexcept;
275  bool is_system_tool_bar() const noexcept;
276  tool_bar& is_system_tool_bar(bool value);
277 
278  void on_item_added(size_t pos, tool_bar_button_ref item);
279  void on_item_updated(size_t pos, tool_bar_button_ref item);
280  void on_item_removed(size_t pos, tool_bar_button_ref item);
281 
282  void resize_stretchable_separtors();
283  void update_toolbar_button_control(intptr handle, const xtd::ustring& text, const xtd::ustring& tool_tip_text, const xtd::drawing::image& image, bool pushed, bool enabled, bool visible);
284 
285  void wm_click(const message& message);
286 
287  std::shared_ptr<data> data_;
288  };
289  }
290 }
The button appears pressed.
Provides methods to manage a collection of xtd::drawing::image objects. This class cannot be inherite...
Definition: image_list.h:28
intmax_t intptr
Represent a pointer or a handle.
Definition: types.h:151
xtd::forms::style_sheets::control tool_bar
The tool_bar data allows you to specify the box of a tool_bar control.
Definition: tool_bar.h:23
Contains xtd::forms::panel container.
Represents a Windows toolbar.
Definition: tool_bar.h:50
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition: event_args.h:18
appearance
Specifies the appearance of a control.
Definition: appearance.h:20
std::reference_wrapper< tool_bar_button > tool_bar_button_ref
Represents a xtd::forms::tool_bar_item reference.
Definition: tool_bar_button_ref.h:23
Represents a toolbar button.
Definition: tool_bar_button.h:40
tool_bar_appearance
Specifies the type of toolbar to display.
Definition: tool_bar_appearance.h:21
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
All the control&#39;s edges are docked to the all edges of its containing control and sized appropriately...
Contains xtd::forms::button control.
Contains xtd::forms::tool_bar_appearance enum class.
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
Provides data for the xtd::forms::tool_bar::button_click event.
Definition: tool_bar_button_click_event_args.h:23
Represents a window or dialog box that makes up an application&#39;s user interface.
Definition: form.h:52
Represents an event.
Definition: event.h:21
Contains xtd::forms::tool_bar_button container.
Provides data for the xtd::forms::control::paint event.
Definition: paint_event_args.h:28
Contains xtd::forms::image_list component.
tool_bar_text_align
Specifies the type of toolbar to display.
Definition: tool_bar_text_align.h:21
border_sides
Specifies how a control anchors to the edges of its container.
Definition: border_sides.h:21
Provides a collection of button objects for use by a Windows Forms application.
Definition: buttons.h:23
border_style
Specifies the border style for a control.
Definition: border_style.h:20
Contains xtd::forms::context_menu menu.
Implements a Windows message.
Definition: message.h:26
Defines the base class for controls, which are components with visual representation.
Definition: control.h:78
xtd::forms::style_sheets::control form
The form data allows you to specify the box of a form control.
Definition: form.h:21
dock_style
Specifies the position and manner in which a control is docked.
Definition: dock_style.h:21
Contains xtd::forms::tool_bar_button_click_event_handler event handler.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
Contains xtd::forms::border_style enum class.
Contains xtd::forms::tool_bar_text_align enum class.
The xtd::forms::status_bar_panel displays text in the standard font.
delegate< void(object &sender, const tool_bar_button_click_event_args &e)> tool_bar_button_click_event_handler
Represents the method that will handle the xtd::forms::tool_bar::button_click event of a xtd::forms::...
Definition: tool_bar_button_click_event_handler.h:24
size_t size
Represents a size of any object in bytes.
Definition: types.h:195