Revert "License conversion from Flora to Apache 2.0"
[platform/core/uifw/dali-toolkit.git] / optional / dali-toolkit / public-api / controls / tool-bar / tool-bar.h
1 #ifndef __DALI_TOOLKIT_TOOL_BAR_H__
2 #define __DALI_TOOLKIT_TOOL_BAR_H__
3
4 //
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
6 //
7 // Licensed under the Flora License, Version 1.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
10 //
11 //     http://floralicense.org/license/
12 //
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.
18 //
19
20 // EXTERNAL INCLUDES
21 #include <string>
22
23 // INTERNAL INCLUDES
24 #include <dali/dali.h>
25 #include <dali-toolkit/public-api/controls/alignment/alignment.h>
26
27 namespace Dali DALI_IMPORT_API
28 {
29
30 namespace Toolkit
31 {
32
33 namespace Internal DALI_INTERNAL
34 {
35 // Forward declarations
36 class ToolBar;
37 }
38
39 /**
40  * Provides a tool bar where other controls (Dali::Actor) could be placed.
41  * controls could be added into three different groups: on the left, center or right.
42  * AddControl() and RemoveControl() methods should be used to add and remove controls. The use of Actor's Dali::Actor::Add() method
43  * is not forbidden, it adds controls on the left group with a size of 10% of the total tool bar size.
44  * Dali::Actor::Remove() method does nothing.
45  */
46 class ToolBar : public Control
47 {
48 public:
49   static const Toolkit::Alignment::Padding DEFAULT_PADDING; ///< Default padding space between controls. By default all values are set to 0.
50
51 public:
52   /**
53    * Create a ToolBar handle; this can be initialised with ToolBar::New()
54    * Calling member functions with an uninitialised handle is not allowed.
55    */
56   ToolBar();
57
58   /**
59    * Copy constructor. Creates another handle that points to the same real object
60    * @param handle to copy from
61    */
62   ToolBar( const ToolBar& handle );
63
64   /**
65    * Assignment operator. Changes this handle to point to another real object
66    */
67   ToolBar& operator=( const ToolBar& handle );
68
69   /**
70    * virtual Destructor.
71    */
72   virtual ~ToolBar();
73
74   /**
75    * Create an initialized ToolBar.
76    * @return A handle to a newly allocated Dali resource.
77    */
78   static ToolBar New();
79
80   /**
81    * Downcast an Object handle to ToolBar. If handle points to a ToolBar the
82    * downcast produces valid handle. If not the returned handle is left uninitialized.
83    * @param[in] handle Handle to an object
84    * @return handle to a ToolBar or an uninitialized handle
85    */
86   static ToolBar DownCast( BaseHandle handle );
87
88   /**
89    * Sets a background image.
90    * @param background Actor with the tool bar background.
91    */
92   void SetBackground( Actor background );
93
94   /**
95    * Adds an additional control to the tool bar.
96    * @pre The tool bar needs to be initialized.
97    * @pre The alignment needs to be horizontal.
98    * @param control An Actor with the additional control.
99    * @param relativeSize Control's size as a percentage of the tool bar width.
100    * @param alignment Where to insert controls. Possible values are Toolkit::Alignment::Left, Toolkit::Alignment::Center or Toolkit::Alignment::Right.
101    * @param padding Padding values used for the added control (left, right, top, bottom). By default, no padding is added.
102    */
103   void AddControl( Actor control, float relativeSize, Toolkit::Alignment::Type alignment, const Toolkit::Alignment::Padding& padding = DEFAULT_PADDING );
104
105   /**
106    * Removes a control from the tool bar.
107    * @pre control must have been added before to this tool bar.
108    * @param control The control to be removed.
109    */
110   void RemoveControl( Actor control );
111
112 public: // Not intended for application developers
113
114   /**
115    * Creates a handle using the Toolkit::Internal implementation.
116    * @param[in]  implementation  The Control implementation.
117    */
118   ToolBar( Internal::ToolBar& implementation );
119
120   /**
121    * Allows the creation of this Control from an Internal::CustomActor pointer.
122    * @param[in]  internal  A pointer to the internal CustomActor.
123    */
124   ToolBar( Dali::Internal::CustomActor* internal );
125 };
126
127 } // namespace Toolkit
128
129 } // namespace Dali
130
131 #endif // __DALI_TOOLKIT_TOOL_BAR_H__