Conversion to Apache 2.0 license
[platform/core/uifw/dali-toolkit.git] / optional / dali-toolkit / internal / controls / navigation-frame / page-impl.h
1 #ifndef __DALI_TOOLKIT_INTERNAL_PAGE_IMPL_H__
2 #define __DALI_TOOLKIT_INTERNAL_PAGE_IMPL_H__
3 /*
4  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 // EXTERNAL INCLUDES
21 #include <string>
22
23 // INTERNAL INCLUDES
24 #include <dali/dali.h>
25 #include <dali-toolkit/public-api/controls/control-impl.h>
26 #include <dali-toolkit/public-api/controls/navigation-frame/page.h>
27
28 namespace Dali
29 {
30
31 namespace Toolkit
32 {
33
34 class Page;
35
36 namespace Internal
37 {
38
39 /**
40  * Page object is a custom control which can be pushed into the stack of navigation control.
41  * @see Dali::Toolkit::Page for more details
42  */
43
44 class Page : public Control
45 {
46
47 public:
48
49   /**
50    * destructor
51    */
52   virtual ~Page();
53
54   /**
55    * Create an initialized Page.
56    * @return A handle to a newly allocated Dali resource
57    */
58   static Toolkit::Page New();
59
60   /**
61    * @copydoc Dali::Toolkit::Page::SetTitle
62    */
63   void SetTitle(const std::string& title);
64
65   /**
66    * @copydoc Dali::Toolkit::Page::GetTitle
67    */
68   const std::string& GetTitle() const;
69
70   /**
71    * @copydoc Dali::Toolkit::Page::SetSubTitle
72    */
73   void SetSubTitle(const std::string& subtitle);
74
75   /**
76    * @copydoc Dali::Toolkit::Page::GetSubTitle
77    */
78   const std::string& GetSubTitle() const;
79
80   /**
81    * @copydoc Dali::Toolkit::Page::SetTitleIcon
82    */
83   void SetTitleIcon( Actor titleIcon);
84
85   /**
86    * @copydoc Dali::Toolkit::Page::GetTitleIcon
87    */
88   Actor GetTitleIcon() const;
89
90   /**
91    * @copydoc Dali::Toolkit::Page::AddControlToToolBar
92    */
93   bool AddControlToToolBar(Actor control, Toolkit::Alignment::Type alignment);
94
95   /**
96    * @copydoc Dali::Toolkit::Page::GetControlsOnToolBar
97    */
98   const Toolkit::Page::ControlOnBarContainer& GetControlsOnToolBar() const;
99
100   /**
101    * @copydoc Dali::Toolkit::Page::AddControlToTitleBar
102    */
103   bool AddControlToTitleBar(Actor control);
104
105   /**
106    * @copydoc Dali::Toolkit::Page::GetControlsOnTitleBar
107    */
108   const ActorContainer& GetControlsOnTitleBar() const;
109
110   /**
111    * @copydoc Dali::Toolkit::Page::SetPopupMenu
112    */
113   void SetPopupMenu( Toolkit::Popup popupMenu );
114
115   /**
116    * @copydoc Dali::Toolkit::Page::GetPopupMenu
117    */
118   Toolkit::Popup GetPopupMenu() const;
119
120 private: // From Control
121
122   /**
123    * @copydoc Toolkit::Control::OnInitialize()
124    */
125   virtual void OnInitialize();
126
127   /**
128    * @copydoc Dali::CustomActorImpl::OnPropertySet()
129    */
130   virtual void OnPropertySet( Property::Index index, Property::Value propertyValue );
131
132 private:
133
134   /**
135    * Constructor.
136    * It initializes the Page members
137    */
138   Page();
139
140 private:
141   std::string        mTitle;
142   std::string        mSubTitle;
143   Actor              mTitleIcon;
144   Toolkit::Popup     mPopupMenu;
145
146   ActorContainer                        mTitleBarControls;
147   Toolkit::Page::ControlOnBarContainer  mToolBarControls;
148
149   Property::Index  mPropertyTitle;       ///< Property index for title.
150   Property::Index  mPropertySubTitle;    ///< Property index for sub title.
151 };
152
153 } // namespace Internal
154
155 // Helpers for public-api forwarding methods
156
157 inline Toolkit::Internal::Page& GetImpl( Toolkit::Page& page )
158 {
159   DALI_ASSERT_ALWAYS( page );
160
161   Dali::RefObject& handle = page.GetImplementation();
162
163   return static_cast<Toolkit::Internal::Page&>( handle );
164 }
165
166 inline const Toolkit::Internal::Page& GetImpl( const Toolkit::Page& page )
167 {
168   DALI_ASSERT_ALWAYS( page );
169
170   const Dali::RefObject& handle = page.GetImplementation();
171
172   return static_cast<const Toolkit::Internal::Page&>( handle );
173 }
174
175 }// namespace Toolkit
176
177 } // namespace Dali
178
179
180 #endif /* __DALI_TOOLKIT_INTERNAL_PAGE_IMPL_H__*/