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-toolkit/public-api/controls/control.h>
23 #include <dali-toolkit/public-api/controls/alignment/alignment.h>
24 #include <dali-toolkit/public-api/controls/popup/popup.h>
26 namespace Dali DALI_IMPORT_API
32 namespace Internal DALI_INTERNAL
34 // Forward declarations
39 * A Page is a custom control which can be pushed into the stack of navigation control.
40 * It serves as the root of a navigation view.
41 * 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.
43 class Page : public Control
49 * The names of custom properties installed by this control.
52 static const char* const PROPERTY_TITLE; ///< name "title", type std::string
53 static const char* const PROPERTY_SUB_TITLE; ///< name "sub-title", type std::string
56 * Structure to indicate a control on the navigation tool bar and its group (HorizontalLeft, HorizontalRight or HorizontalCenter)
63 ControlOnBar(Actor actor, Toolkit::Alignment::Type alignment)
65 alignment( alignment )
69 Actor control; ///< The control actor
70 Toolkit::Alignment::Type alignment; ///< The alignment of the control actor
73 typedef std::vector< const ControlOnBar* > ControlOnBarContainer;
78 * Create a Page handle; this can be initialized with Page::New().
79 * Calling member function with an uninitialized handle is not allowed.
86 Page( const Page& handle );
89 * Assignment operator.
90 * Change this handle to point to another real object.
92 Page& operator=( const Page& handle );
95 * Create an initialized Page.
96 * @return A handle to a newly allocated Dali resource.
101 * Downcast an object handle to Page.
102 * If handle points to a Page, the downcast produces valid handle.
103 * If not, the returned handle is left uninitialized.
104 * @param[in] handle Handle to an object.
105 * @return handle to a Page of an uninitialized handle.
107 static Page DownCast( BaseHandle handle );
110 * Sets the Page's title.
111 * The title will be displayed on the navigation title bar when the item is on the top of the stack.
112 * @param[in] title The Page's title.
114 void SetTitle(const std::string& title);
117 * Retrieve the title of the page.
118 * @return The Page's title or "" when the item does not have a title.
120 const std::string& GetTitle() const;
123 * Sets the Page's subtitle.
124 * The subtitle will be displayed on the navigation title bar when the item is on the top of the stack.
125 * @param[in] subtitle The Page's subtitle.
127 void SetSubTitle(const std::string& subtitle);
130 * Retrieve the subtitle of the page.
131 * @return The Page's subtitle or "" when the subtitle does not have a subtitle.
133 const std::string& GetSubTitle() const;
136 * Sets the Page's title icon.
137 * The icon will be displayed in front of the title on the navigation item bar when the item is on the top.
138 * @param[in] titleIcon The Page's icon
140 void SetTitleIcon( Actor titleIcon);
143 * Retrieve the title icon of the page.
144 * @return The Page's icon or an empty handle when the item does not have title icon.
146 Actor GetTitleIcon() const;
149 * Set a control onto the navigation tool bar when the item is on the top.
150 * Only one control (the last set one) is valid for HorizontalLeft and HorizontalRight each.
151 * Can have multiple controls for HorizontalCenter.
152 * If the control is uninitialized or if the alignment has a value other from HorizontalLeft/HorizontalRight/HorizontalCenter, the control is not added.
153 * @param[in] control The control on the navigation tool bar.
154 * @param[in] alignment The position of the control, can be HorizontalLeft/HorizontalRight/HorizontalCenter.
155 * @return true if add control successfully, false if fail to add the control
157 bool AddControlToToolBar(Actor control, Alignment::Type alignment);
160 * Retrieve the controls that would be displayed on the navigation tool bar when the item is on the top.
161 * @return the vector of tool bar controls associated with the current item.
163 const ControlOnBarContainer GetControlsOnToolBar() const;
166 * Set a control onto the right part of the navigation title bar when the item is on the top.
167 * If the control is uninitialized or if the alignment has a value other from HorizontalLeft/HorizontalRight/HorizontalCenter, the control is not added.
168 * @param[in] control The control on the navigation title bar.
169 * @return true if add control successfully, false if fail to add the control
171 bool AddControlToTitleBar(Actor control);
174 * Retrieve the controls that would be displayed on the navigation title bar when the item is on the top.
175 * @return the vector of title bar controls associate with the current item.
177 const ActorContainer GetControlsOnTitleBar() const;
180 * Set the menu which would pop up when the KEY_MENU is pressed.
181 * @param[in] popupMenu the popup menu connected to the KEY_MENU event
183 void SetPopupMenu( Toolkit::Popup popupMenu );
186 * Get the menu which would pop up when the KEY_MENU is pressed.
187 * @return The popup menu connected to the KEY_MENU event
189 Toolkit::Popup GetPopupMenu() const;
191 public: // Not intended for application developers
194 * Creates a handle using the Toolkit::Internal implementation.
195 * @param[in] impl The Page implementation.
197 Page(Internal::Page& impl);
200 * Allows the creation of this Control from an Internal::CustomActor pointer.
201 * @param[in] internal A pointer to the internal CustomActor.
203 Page( Dali::Internal::CustomActor* internal );
206 } // namespace Toolkit
210 #endif /* __DALI_TOOLKIT_PAGE_H__ */