1 #ifndef __DALI_TOOLKIT_PAGE_H__
2 #define __DALI_TOOLKIT_PAGE_H__
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
11 // http://floralicense.org/license/
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.
21 #include <dali-toolkit/public-api/controls/control.h>
22 #include <dali-toolkit/public-api/controls/alignment/alignment.h>
23 #include <dali-toolkit/public-api/controls/popup/popup.h>
25 namespace Dali DALI_IMPORT_API
31 namespace Internal DALI_INTERNAL
33 // Forward declarations
38 * A Page is a custom control which can be pushed into the stack of navigation control.
39 * It serves as the root of a navigation view.
40 * 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.
42 class Page : public Control
48 * The names of custom properties installed by this control.
51 static const char* const PROPERTY_TITLE; ///< name "title", type std::string
52 static const char* const PROPERTY_SUB_TITLE; ///< name "sub-title", type std::string
55 * Structure to indicate a control on the navigation tool bar and its group (HorizontalLeft, HorizontalRight or HorizontalCenter)
62 ControlOnBar(Actor actor, Toolkit::Alignment::Type alignment)
64 alignment( alignment )
68 Actor control; ///< The control actor
69 Toolkit::Alignment::Type alignment; ///< The alignment of the control actor
72 typedef std::vector< const ControlOnBar* > ControlOnBarContainer;
77 * Create a Page handle; this can be initialized with Page::New().
78 * Calling member function with an uninitialized handle is not allowed.
85 Page( const Page& handle );
88 * Assignment operator.
89 * Change this handle to point to another real object.
91 Page& operator=( const Page& handle );
94 * Create an initialized Page.
95 * @return A handle to a newly allocated Dali resource.
100 * Downcast an object handle to Page.
101 * If handle points to a Page, the downcast produces valid handle.
102 * If not, the returned handle is left uninitialized.
103 * @param[in] handle Handle to an object.
104 * @return handle to a Page of an uninitialized handle.
106 static Page DownCast( BaseHandle handle );
109 * Sets the Page's title.
110 * The title will be displayed on the navigation title bar when the item is on the top of the stack.
111 * @param[in] title The Page's title.
113 void SetTitle(const std::string& title);
116 * Retrieve the title of the page.
117 * @return The Page's title or "" when the item does not have a title.
119 const std::string& GetTitle() const;
122 * Sets the Page's subtitle.
123 * The subtitle will be displayed on the navigation title bar when the item is on the top of the stack.
124 * @param[in] subtitle The Page's subtitle.
126 void SetSubTitle(const std::string& subtitle);
129 * Retrieve the subtitle of the page.
130 * @return The Page's subtitle or "" when the subtitle does not have a subtitle.
132 const std::string& GetSubTitle() const;
135 * Sets the Page's title icon.
136 * The icon will be displayed in front of the title on the navigation item bar when the item is on the top.
137 * @param[in] titleIcon The Page's icon
139 void SetTitleIcon( Actor titleIcon);
142 * Retrieve the title icon of the page.
143 * @return The Page's icon or an empty handle when the item does not have title icon.
145 Actor GetTitleIcon() const;
148 * Set a control onto the navigation tool bar when the item is on the top.
149 * Only one control (the last set one) is valid for HorizontalLeft and HorizontalRight each.
150 * Can have multiple controls for HorizontalCenter.
151 * If the control is uninitialized or if the alignment has a value other from HorizontalLeft/HorizontalRight/HorizontalCenter, the control is not added.
152 * @param[in] control The control on the navigation tool bar.
153 * @param[in] alignment The position of the control, can be HorizontalLeft/HorizontalRight/HorizontalCenter.
154 * @return true if add control successfully, false if fail to add the control
156 bool AddControlToToolBar(Actor control, Alignment::Type alignment);
159 * Retrieve the controls that would be displayed on the navigation tool bar when the item is on the top.
160 * @return the vector of tool bar controls associated with the current item.
162 const ControlOnBarContainer GetControlsOnToolBar() const;
165 * Set a control onto the right part of the navigation title bar when the item is on the top.
166 * If the control is uninitialized or if the alignment has a value other from HorizontalLeft/HorizontalRight/HorizontalCenter, the control is not added.
167 * @param[in] control The control on the navigation title bar.
168 * @return true if add control successfully, false if fail to add the control
170 bool AddControlToTitleBar(Actor control);
173 * Retrieve the controls that would be displayed on the navigation title bar when the item is on the top.
174 * @return the vector of title bar controls associate with the current item.
176 const ActorContainer GetControlsOnTitleBar() const;
179 * Set the menu which would pop up when the KEY_MENU is pressed.
180 * @param[in] popupMenu the popup menu connected to the KEY_MENU event
182 void SetPopupMenu( Toolkit::Popup popupMenu );
185 * Get the menu which would pop up when the KEY_MENU is pressed.
186 * @return The popup menu connected to the KEY_MENU event
188 Toolkit::Popup GetPopupMenu() const;
190 public: // Not intended for application developers
193 * Creates a handle using the Toolkit::Internal implementation.
194 * @param[in] impl The Page implementation.
196 Page(Internal::Page& impl);
199 * Allows the creation of this Control from an Internal::CustomActor pointer.
200 * @param[in] internal A pointer to the internal CustomActor.
202 Page( Dali::Internal::CustomActor* internal );
205 } // namespace Toolkit
209 #endif /* __DALI_TOOLKIT_PAGE_H__ */