xtd 0.2.0
Loading...
Searching...
No Matches
tool_bar.h
Go to the documentation of this file.
1
4#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
18namespace xtd {
20 namespace forms {
22 class form;
24
53 struct data;
54 class tool_bar_button_control;
55
56 public:
58
63
65
71
73 tool_bar(tool_bar&& rhs);
74 tool_bar(const tool_bar&) = default;
75 tool_bar& operator =(const tool_bar&) = default;
77
79
90
93 virtual forms::border_sides border_sides() const noexcept;
98
102 virtual forms::border_style border_style() const noexcept;
112 virtual xtd::forms::tool_bar& border_style(std::nullptr_t value);
113
117 const tool_bar_button_collection& buttons() const noexcept;
122
126 virtual xtd::drawing::size button_size() const noexcept;
131 virtual tool_bar& button_size(const xtd::drawing::size& value);
136 virtual tool_bar& button_size(std::nullptr_t value);
137
142 virtual bool divider() const noexcept;
148 virtual tool_bar& divider(bool value);
149
150 dock_style dock() const noexcept override;
151 control& dock(dock_style dock) override;
152
156 virtual bool drop_down_arrows() const noexcept;
161 virtual tool_bar& drop_down_arrows(bool value);
162
166 const xtd::forms::image_list& image_list() const noexcept;
176
179 virtual xtd::drawing::size image_size() const noexcept;
180
183 virtual bool show_icon() const noexcept;
187 virtual tool_bar& show_icon(bool value);
188
191 virtual bool show_text() const noexcept;
195 virtual tool_bar& show_text(bool value);
196
200 virtual bool show_tool_tips() const noexcept;
205 virtual tool_bar& show_tool_tips(bool value);
206
210 virtual xtd::forms::tool_bar_text_align text_align() const noexcept;
215 virtual tool_bar& text_align(xtd::forms::tool_bar_text_align value);
216
220 virtual bool wrappable() const noexcept;
226 virtual tool_bar& wrappable(bool value);
228
230
235
240
242
247 static tool_bar create();
252 static tool_bar create(const xtd::forms::image_list::image_collection& image_collection);
258 static tool_bar create(const xtd::forms::image_list::image_collection& image_collection, const xtd::string& name);
263 static tool_bar create(xtd::forms::dock_style style);
269 static tool_bar create(xtd::forms::dock_style style, const xtd::forms::image_list::image_collection& image_collection);
276 static tool_bar create(xtd::forms::dock_style style, const xtd::forms::image_list::image_collection& image_collection, const xtd::string& name);
285 static tool_bar create(const xtd::forms::image_list::image_collection& image_collection, const tool_bar_button_collection& buttons);
291 static tool_bar create(const xtd::forms::image_list::image_collection& image_collection, const tool_bar_button_collection& buttons, const xtd::string& name);
302 static tool_bar create(xtd::forms::dock_style style, const xtd::forms::image_list::image_collection& image_collection, const tool_bar_button_collection& buttons);
309 static tool_bar create(xtd::forms::dock_style style, const xtd::forms::image_list::image_collection& image_collection, const tool_bar_button_collection& buttons, const xtd::string& name);
313 static tool_bar create(const control& parent);
319 static tool_bar create(const control& parent, const xtd::forms::image_list::image_collection& image_collection);
326 static tool_bar create(const control& parent, const xtd::forms::image_list::image_collection& image_collection, const xtd::string& name);
331 static tool_bar create(const control& parent, xtd::forms::dock_style style);
337 static tool_bar create(const control& parent, xtd::forms::dock_style style, const xtd::forms::image_list::image_collection& image_collection);
344 static tool_bar create(const control& parent, xtd::forms::dock_style style, const xtd::forms::image_list::image_collection& image_collection, const xtd::string& name);
348 static tool_bar create(const control& parent, const tool_bar_button_collection& buttons);
354 static tool_bar create(const control& parent, const xtd::forms::image_list::image_collection& image_collection, const tool_bar_button_collection& buttons);
361 static tool_bar create(const control& parent, const xtd::forms::image_list::image_collection& image_collection, const tool_bar_button_collection& buttons, const xtd::string& name);
366 static tool_bar create(const control& parent, xtd::forms::dock_style style, const tool_bar_button_collection& buttons);
372 static tool_bar create(const control& parent, xtd::forms::dock_style style, const xtd::forms::image_list::image_collection& image_collection, const tool_bar_button_collection& buttons);
379 static tool_bar create(const control& parent, xtd::forms::dock_style style, const xtd::forms::image_list::image_collection& image_collection, const tool_bar_button_collection& buttons, const xtd::string& name);
381
382 protected:
383 friend tool_bar_button;
384 friend form;
385
387
389 forms::create_params create_params() const noexcept override;
390 xtd::drawing::font default_font() const noexcept override;
391 drawing::size default_size() const noexcept override;
393
395
401 xtd::uptr<xtd::object> clone() const override;
402
409 void on_button_click(const xtd::forms::tool_bar_button_click_event_args& e);
410
417 void on_button_drop_down(const xtd::forms::tool_bar_button_click_event_args& e);
418
419 void on_handle_created(const event_args& e) override;
420 void on_handle_destroyed(const event_args& e) override;
421 void on_paint(xtd::forms::paint_event_args& e) override;
422 void on_resize(const event_args& e) override;
423 void wnd_proc(message& message) override;
425
426 private:
427 void fill();
428
429 bool is_horizontal() const noexcept;
430 bool is_system_tool_bar() const noexcept;
431 tool_bar& is_system_tool_bar(bool value);
432
433 void on_item_added(size_t pos, tool_bar_button_ref item);
434 void on_item_updated(size_t pos, tool_bar_button_ref item);
435 void on_item_removed(size_t pos, tool_bar_button_ref item);
436
437 void resize_stretchable_separtors();
438 void update_toolbar_button_control(intptr handle, const xtd::string& text, const xtd::string& tool_tip_text, const xtd::drawing::image& image, bool pushed, bool enabled, bool visible);
439
440 void wm_click(const message& message);
441
442 xtd::sptr<data> data_;
443 };
444 }
445}
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
Provides a collection of button objects for use by a Windows Forms application.
Definition buttons.h:24
Defines the base class for controls, which are components with visual representation.
Definition control.h:81
Encapsulates the information needed when creating a control.
Definition create_params.h:29
Represents a window or dialog box that makes up an application's user interface.
Definition form.h:54
Provides methods to manage a collection of xtd::drawing::image objects. This class cannot be inherite...
Definition image_list.h:30
Represents a collection of objects.
Definition arranged_element_collection.h:34
Implements a Windows message.
Definition message.h:28
Provides data for the xtd::forms::control::paint event.
Definition paint_event_args.h:30
Provides data for the xtd::forms::tool_bar::button_click event.
Definition tool_bar_button_click_event_args.h:25
Represents a toolbar button.
Definition tool_bar_button.h:43
Represents a Windows toolbar.
Definition tool_bar.h:52
virtual xtd::forms::tool_bar_appearance appearance() const noexcept
Gets the value that determines the appearance of a toolbar control and its buttons.
tool_bar()
Initializes a new instance of the xtd::forms::tool_bar class.
Contains xtd::forms::context_menu menu.
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:26
#define forms_export_
Define shared library export.
Definition forms_export.h:13
xtd::forms::style_sheets::control form
The form data allows you to specify the box of a form control.
Definition form.h:23
std::unique_ptr< type_t > uptr
The xtd::uptr object is a unique pointer.
Definition uptr.h:25
size_t size
Represents a size of any object in bytes.
Definition size.h:23
intmax_t intptr
Represent a pointer or a handle.
Definition intptr.h:23
std::shared_ptr< type_t > sptr
The xtd::sptr object is a shared pointer.
Definition sptr.h:25
std::reference_wrapper< tool_bar_button > tool_bar_button_ref
Represents a xtd::forms::tool_bar_item reference.
Definition tool_bar_button_ref.h:25
tool_bar_text_align
Specifies the type of toolbar to display.
Definition tool_bar_text_align.h:23
border_sides
Specifies how a control anchors to the edges of its container.
Definition border_sides.h:23
tool_bar_appearance
Specifies the type of toolbar to display.
Definition tool_bar_appearance.h:23
border_style
Specifies the border style for a control.
Definition border_style.h:22
dock_style
Specifies the position and manner in which a control is docked.
Definition dock_style.h:23
appearance
Specifies the appearance of a control.
Definition appearance.h:22
Contains xtd::forms::image_list component.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition xtd_about_box.h:12
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
Contains xtd::forms::style_sheets::border_style class.
Contains xtd::forms::style_sheets::button alias.
Contains xtd::forms::style_sheets::panel class.
Contains xtd::forms::tool_bar_appearance enum class.
Contains xtd::forms::tool_bar_button container.
Contains xtd::forms::tool_bar_button_click_event_handler event handler.
Contains xtd::forms::tool_bar_text_align enum class.