1 #ifndef DALI_TOOLKIT_TOOL_BAR_H
2 #define DALI_TOOLKIT_TOOL_BAR_H
5 * Copyright (c) 2022 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
25 #include <dali-toolkit/devel-api/controls/alignment/alignment.h>
31 namespace Internal DALI_INTERNAL
33 // Forward declarations
35 } // namespace DALI_INTERNAL
38 * Provides a tool bar where other controls (Dali::Actor) could be placed.
39 * controls could be added into three different groups: on the left, center or right.
40 * AddControl() and RemoveControl() methods should be used to add and remove controls. The use of Actor's Dali::Actor::Add() method
41 * is not forbidden, it adds controls on the left group with a size of 10% of the total tool bar size.
42 * Dali::Actor::Remove() method does nothing.
44 class DALI_TOOLKIT_API ToolBar : public Control
47 static const Toolkit::Alignment::Padding DEFAULT_PADDING; ///< Default padding space between controls. By default all values are set to 0.
51 * Create a ToolBar handle; this can be initialised with ToolBar::New()
52 * Calling member functions with an uninitialised handle is not allowed.
57 * Copy constructor. Creates another handle that points to the same real object
58 * @param[in] handle Handle to copy.
60 ToolBar(const ToolBar& handle);
63 * Assignment operator. Changes this handle to point to another real object
64 * @param[in] handle The handle to copy from.
65 * @return reference to this
67 ToolBar& operator=(const ToolBar& handle);
70 * Move constructor. Creates another handle that points to the same real object
71 * @param[in] handle Handle to move.
73 ToolBar(ToolBar&& handle);
76 * Move assignment operator. Changes this handle to point to another real object
77 * @param[in] handle The handle to move from.
78 * @return reference to this
80 ToolBar& operator=(ToolBar&& handle);
85 * This is non-virtual since derived Handle types must not contain data or virtual methods.
90 * Create an initialized ToolBar.
91 * @return A handle to a newly allocated Dali resource.
96 * Downcast an Object handle to ToolBar. If handle points to a ToolBar the
97 * downcast produces valid handle. If not the returned handle is left uninitialized.
98 * @param[in] handle Handle to an object
99 * @return handle to a ToolBar or an uninitialized handle
101 static ToolBar DownCast(BaseHandle handle);
104 * Adds an additional control to the tool bar.
105 * @pre The tool bar needs to be initialized.
106 * @pre The alignment needs to be horizontal.
107 * @param control An Actor with the additional control.
108 * @param relativeSize Control's size as a percentage of the tool bar width.
109 * @param alignment Where to insert controls. Possible values are Toolkit::Alignment::Left, Toolkit::Alignment::Center or Toolkit::Alignment::Right.
110 * @param padding Padding values used for the added control (left, right, top, bottom). By default, no padding is added.
112 void AddControl(Actor control, float relativeSize, Toolkit::Alignment::Type alignment, const Toolkit::Alignment::Padding& padding = DEFAULT_PADDING);
115 * Removes a control from the tool bar.
116 * @pre control must have been added before to this tool bar.
117 * @param control The control to be removed.
119 void RemoveControl(Actor control);
121 public: // Not intended for application developers
123 * Creates a handle using the Toolkit::Internal implementation.
124 * @param[in] implementation The Control implementation.
126 DALI_INTERNAL ToolBar(Internal::ToolBar& implementation);
129 * Allows the creation of this Control from an Internal::CustomActor pointer.
130 * @param[in] internal A pointer to the internal CustomActor.
132 explicit DALI_INTERNAL ToolBar(Dali::Internal::CustomActor* internal);
135 } // namespace Toolkit
139 #endif // DALI_TOOLKIT_TOOL_BAR_H