1 #ifndef __DALI_TOOLKIT_PAGE_H__
2 #define __DALI_TOOLKIT_PAGE_H__
5 * Copyright (c) 2014 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.
22 #include <dali/public-api/common/dali-vector.h>
25 #include <dali-toolkit/public-api/controls/control.h>
26 #include <dali-toolkit/public-api/controls/alignment/alignment.h>
27 #include <dali-toolkit/public-api/controls/popup/popup.h>
35 namespace Internal DALI_INTERNAL
37 // Forward declarations
42 * A Page is a custom control which can be pushed into the stack of navigation control.
43 * It serves as the root of a navigation view.
44 * It also carries the title/subtitle/buttons/icons information which would be shown on the navigation bars when the item is on the top of the stack.
46 class DALI_IMPORT_API Page : public Control
52 * The names of custom properties installed by this control.
55 static const char* const PROPERTY_TITLE; ///< name "title", type std::string
56 static const char* const PROPERTY_SUB_TITLE; ///< name "sub-title", type std::string
59 * Structure to indicate a control on the navigation tool bar and its group (HorizontalLeft, HorizontalRight or HorizontalCenter)
66 ControlOnBar(Actor actor, Toolkit::Alignment::Type alignment)
68 alignment( alignment )
72 Actor control; ///< The control actor
73 Toolkit::Alignment::Type alignment; ///< The alignment of the control actor
76 typedef std::vector< const ControlOnBar* > ControlOnBarContainer;
81 * Create a Page handle; this can be initialized with Page::New().
82 * Calling member function with an uninitialized handle is not allowed.
89 Page( const Page& handle );
92 * Assignment operator.
93 * Change this handle to point to another real object.
95 Page& operator=( const Page& handle );
98 * Create an initialized Page.
99 * @return A handle to a newly allocated Dali resource.
104 * Downcast an object handle to Page.
105 * If handle points to a Page, the downcast produces valid handle.
106 * If not, the returned handle is left uninitialized.
107 * @param[in] handle Handle to an object.
108 * @return handle to a Page of an uninitialized handle.
110 static Page DownCast( BaseHandle handle );
113 * Sets the Page's title.
114 * The title will be displayed on the navigation title bar when the item is on the top of the stack.
115 * @param[in] title The Page's title.
117 void SetTitle(const std::string& title);
120 * Retrieve the title of the page.
121 * @return The Page's title or "" when the item does not have a title.
123 const std::string& GetTitle() const;
126 * Sets the Page's subtitle.
127 * The subtitle will be displayed on the navigation title bar when the item is on the top of the stack.
128 * @param[in] subtitle The Page's subtitle.
130 void SetSubTitle(const std::string& subtitle);
133 * Retrieve the subtitle of the page.
134 * @return The Page's subtitle or "" when the subtitle does not have a subtitle.
136 const std::string& GetSubTitle() const;
139 * Sets the Page's title icon.
140 * The icon will be displayed in front of the title on the navigation item bar when the item is on the top.
141 * @param[in] titleIcon The Page's icon
143 void SetTitleIcon( Actor titleIcon);
146 * Retrieve the title icon of the page.
147 * @return The Page's icon or an empty handle when the item does not have title icon.
149 Actor GetTitleIcon() const;
152 * Set a control onto the navigation tool bar when the item is on the top.
153 * Only one control (the last set one) is valid for HorizontalLeft and HorizontalRight each.
154 * Can have multiple controls for HorizontalCenter.
155 * If the control is uninitialized or if the alignment has a value other from HorizontalLeft/HorizontalRight/HorizontalCenter, the control is not added.
156 * @param[in] control The control on the navigation tool bar.
157 * @param[in] alignment The position of the control, can be HorizontalLeft/HorizontalRight/HorizontalCenter.
158 * @return true if add control successfully, false if fail to add the control
160 bool AddControlToToolBar(Actor control, Alignment::Type alignment);
163 * Retrieve the controls that would be displayed on the navigation tool bar when the item is on the top.
164 * @return the vector of tool bar controls associated with the current item.
166 const ControlOnBarContainer GetControlsOnToolBar() const;
169 * Set a control onto the right part of the navigation title bar when the item is on the top.
170 * If the control is uninitialized or if the alignment has a value other from HorizontalLeft/HorizontalRight/HorizontalCenter, the control is not added.
171 * @param[in] control The control on the navigation title bar.
172 * @return true if add control successfully, false if fail to add the control
174 bool AddControlToTitleBar(Actor control);
177 * Retrieve the controls that would be displayed on the navigation title bar when the item is on the top.
178 * @return the vector of title bar controls associate with the current item.
180 const ActorContainer GetControlsOnTitleBar() const;
183 * Set the menu which would pop up when the KEY_MENU is pressed.
184 * @param[in] popupMenu the popup menu connected to the KEY_MENU event
186 void SetPopupMenu( Toolkit::Popup popupMenu );
189 * Get the menu which would pop up when the KEY_MENU is pressed.
190 * @return The popup menu connected to the KEY_MENU event
192 Toolkit::Popup GetPopupMenu() const;
194 public: // Not intended for application developers
197 * Creates a handle using the Toolkit::Internal implementation.
198 * @param[in] impl The Page implementation.
200 DALI_INTERNAL Page(Internal::Page& impl);
203 * Allows the creation of this Control from an Internal::CustomActor pointer.
204 * @param[in] internal A pointer to the internal CustomActor.
206 explicit DALI_INTERNAL Page( Dali::Internal::CustomActor* internal );
209 } // namespace Toolkit
213 #endif /* __DALI_TOOLKIT_PAGE_H__ */