xtd 0.2.0
tool_bar.hpp
Go to the documentation of this file.
1
4#pragma once
5#include "border_style.hpp"
6#include "button.hpp"
7#include "context_menu.hpp"
8#include "image_list.hpp"
9#include "panel.hpp"
11#include "tool_bar_button.hpp"
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;
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;
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);
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);
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);
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);
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);
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
410
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}
Contains xtd::forms::border_style enum class.
Contains xtd::forms::button control.
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition event_args.hpp:18
Represents an event.
Definition event.hpp:21
intptr handle() const override
Gets the window handle that the control is bound to.
virtual drawing::font font() const noexcept
Gets the font of the text displayed by the control.
virtual bool enabled() const noexcept
Gets a value indicating whether the control can respond to user interaction.
virtual bool visible() const noexcept
Gets a value indicating whether the control and all its child controls are displayed.
virtual const xtd::string & name() const noexcept
Gets the name of the control.
control()
Initializes a new instance of the xtd::forms::control class with default settings.
virtual const xtd::string & text() const noexcept
Gets the text associated with this control.
virtual drawing::size size() const noexcept
Gets the height and width of the control.
virtual std::optional< control_ref > parent() const noexcept
Gets the parent container of the control.
Represents a window or dialog box that makes up an application's user interface.
Definition form.hpp:54
Represents a collection of objects.
Definition arranged_element_collection.hpp:35
Provides data for the xtd::forms::tool_bar::button_click event.
Definition tool_bar_button_click_event_args.hpp:25
xtd::event< tool_bar, xtd::forms::tool_bar_button_click_event_handler > button_drop_down
Occurs when a drop-down style xtd::forms::tool_bar_button or its down arrow is clicked.
Definition tool_bar.hpp:238
virtual bool show_tool_tips() const noexcept
Gets a value indicating whether the toolbar displays a xtd::forms::tool_tip for each button.
virtual forms::border_sides border_sides() const noexcept
Gets the border sides for the control.
void on_handle_destroyed(const event_args &e) override
Raises the xtd::forms::control::handle_destroyed event.
void on_resize(const event_args &e) override
Raises the xtd::forms::control::region event.
virtual bool divider() const noexcept
Gets a value indicating whether the toolbar displays a divider.
xtd::uptr< xtd::object > clone() const override
Creates a new object that is a copy of the current instance.
void wnd_proc(message &message) override
Processes Windows messages.
drawing::size default_size() const noexcept override
Gets the default size of the control.
virtual xtd::forms::tool_bar_appearance appearance() const noexcept
Gets the value that determines the appearance of a toolbar control and its buttons.
xtd::event< tool_bar, xtd::forms::tool_bar_button_click_event_handler > button_click
Occurs when a xtd::forms::tool_bar_button on the xtd::forms::tool_bar is clicked.
Definition tool_bar.hpp:234
void on_button_click(const xtd::forms::tool_bar_button_click_event_args &e)
Raises the xtd::forms::tool_bar::button_click event.
xtd::drawing::font default_font() const noexcept override
Gets the default font of the control.
forms::create_params create_params() const noexcept override
Gets the required creation parameters when the control handle is created.
virtual xtd::drawing::size image_size() const noexcept
Gets the size of the images in the image list assigned to the toolbar.
virtual bool drop_down_arrows() const noexcept
Gets a value indicating whether drop-down buttons on a toolbar display down arrows.
virtual xtd::forms::tool_bar_text_align text_align() const noexcept
Gets the alignment of text in relation to each image displayed on the toolbar button controls.
void on_paint(xtd::forms::paint_event_args &e) override
Raises the xtd::forms::control::paint event.
virtual forms::border_style border_style() const noexcept
Gets the border style for the control.
void on_button_drop_down(const xtd::forms::tool_bar_button_click_event_args &e)
Raises the xtd::forms::tool_bar::button_drop_down event.
static tool_bar create()
A factory to create an xtd::forms::tool_bar.
virtual bool show_icon() const noexcept
Gets a value indicating whether the toolbar displays the image for each button.
void on_handle_created(const event_args &e) override
Raises the xtd::forms::control::handle_created event.
tool_bar()
Initializes a new instance of the xtd::forms::tool_bar class.
virtual bool wrappable() const noexcept
Gets a value indicating whether the toolbar buttons wrap to the next line if the toolbar becomes too ...
xtd::forms::layout::arranged_element_collection< tool_bar_button_ref > tool_bar_button_collection
Represents the base type of the xtd::forms::tool_bar::buttons collection.
Definition tool_bar.hpp:61
dock_style dock() const noexcept override
Gets which control borders are docked to its parent control and determines how a control is resized w...
virtual xtd::drawing::size button_size() const noexcept
Gets the size of the buttons on the toolbar control.
const tool_bar_button_collection & buttons() const noexcept
Gets the collection of xtd::forms::tool_bar_button controls assigned to the toolbar control.
virtual bool show_text() const noexcept
Gets a value indicating whether the toolbar displays the text for each button.
const xtd::forms::image_list & image_list() const noexcept
Gets the collection of images available to the toolbar button controls.
Contains xtd::forms::context_menu menu.
xtd::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.hpp:29
#define forms_export_
Define shared library export.
Definition forms_export.hpp:13
xtd::shared_ptr_object< type_t > sptr
The xtd::sptr object is a shared pointer.
Definition sptr.hpp:25
xtd::unique_ptr_object< type_t > uptr
The xtd::uptr object is a unique pointer.
Definition uptr.hpp:25
intmax_t intptr
Represent a pointer or a handle.
Definition intptr.hpp:23
std::reference_wrapper< tool_bar_button > tool_bar_button_ref
Represents a xtd::forms::tool_bar_item reference.
Definition tool_bar_button_ref.hpp:25
tool_bar_text_align
Specifies the type of toolbar to display.
Definition tool_bar_text_align.hpp:23
tool_bar_appearance
Specifies the type of toolbar to display.
Definition tool_bar_appearance.hpp:23
dock_style
Specifies the position and manner in which a control is docked.
Definition dock_style.hpp:23
@ pushed
The button appears pressed.
Definition button_state.hpp:29
@ e
The E key.
Definition keys.hpp:207
Contains xtd::forms::image_list component.
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition actions_system_images.hpp:10
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition texts.hpp:219
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
constexpr const_pointer data() const noexcept
Gets direct access to the underlying contiguous storage.
Definition read_only_span.hpp:201
Contains xtd::forms::panel container.
Implements a Windows message.
Definition message.hpp:33
Contains xtd::forms::tool_bar_appearance enum class.
Contains xtd::forms::tool_bar_button container.
Contains xtd::forms::tool_bar_button_click_event_handler handler.
Contains xtd::forms::tool_bar_text_align enum class.