Merge remote-tracking branch 'origin/tizen' into devel/new_mesh
[platform/core/uifw/dali-toolkit.git] / 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-toolkit/public-api/controls/control-impl.h>
25 #include <dali-toolkit/public-api/controls/navigation-frame/page.h>
26
27 namespace Dali
28 {
29
30 namespace Toolkit
31 {
32
33 class Page;
34
35 namespace Internal
36 {
37
38 /**
39  * Page object is a custom control which can be pushed into the stack of navigation control.
40  * @see Dali::Toolkit::Page for more details
41  */
42
43 class Page : public Control
44 {
45
46 public:
47
48   /**
49    * destructor
50    */
51   virtual ~Page();
52
53   /**
54    * Create an initialized Page.
55    * @return A handle to a newly allocated Dali resource
56    */
57   static Toolkit::Page New();
58
59   /**
60    * @copydoc Dali::Toolkit::Page::SetTitle
61    */
62   void SetTitle(const std::string& title);
63
64   /**
65    * @copydoc Dali::Toolkit::Page::GetTitle
66    */
67   const std::string& GetTitle() const;
68
69   /**
70    * @copydoc Dali::Toolkit::Page::SetSubTitle
71    */
72   void SetSubTitle(const std::string& subtitle);
73
74   /**
75    * @copydoc Dali::Toolkit::Page::GetSubTitle
76    */
77   const std::string& GetSubTitle() const;
78
79   /**
80    * @copydoc Dali::Toolkit::Page::SetTitleIcon
81    */
82   void SetTitleIcon( Actor titleIcon);
83
84   /**
85    * @copydoc Dali::Toolkit::Page::GetTitleIcon
86    */
87   Actor GetTitleIcon() const;
88
89   /**
90    * @copydoc Dali::Toolkit::Page::AddControlToToolBar
91    */
92   bool AddControlToToolBar(Actor control, Toolkit::Alignment::Type alignment);
93
94   /**
95    * @copydoc Dali::Toolkit::Page::GetControlsOnToolBar
96    */
97   const Toolkit::Page::ControlOnBarContainer& GetControlsOnToolBar() const;
98
99   /**
100    * @copydoc Dali::Toolkit::Page::AddControlToTitleBar
101    */
102   bool AddControlToTitleBar(Actor control);
103
104   /**
105    * @copydoc Dali::Toolkit::Page::GetControlsOnTitleBar
106    */
107   const ActorContainer& GetControlsOnTitleBar() const;
108
109   /**
110    * @copydoc Dali::Toolkit::Page::SetPopupMenu
111    */
112   void SetPopupMenu( Toolkit::Popup popupMenu );
113
114   /**
115    * @copydoc Dali::Toolkit::Page::GetPopupMenu
116    */
117   Toolkit::Popup GetPopupMenu() const;
118
119   // Properties
120
121   /**
122    * Called when a property of an object of this type is set.
123    * @param[in] object The object whose property is set.
124    * @param[in] index The property index.
125    * @param[in] value The new property value.
126    */
127   static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
128
129   /**
130    * Called to retrieve a property of an object of this type.
131    * @param[in] object The object whose property is to be retrieved.
132    * @param[in] index The property index.
133    * @return The current value of the property.
134    */
135   static Property::Value GetProperty( BaseObject* object, Property::Index propertyIndex );
136
137 private:
138
139   /**
140    * Constructor.
141    * It initializes the Page members
142    */
143   Page();
144
145 private:
146   std::string        mTitle;
147   std::string        mSubTitle;
148   Actor              mTitleIcon;
149   Toolkit::Popup     mPopupMenu;
150
151   ActorContainer                        mTitleBarControls;
152   Toolkit::Page::ControlOnBarContainer  mToolBarControls;
153 };
154
155 } // namespace Internal
156
157 // Helpers for public-api forwarding methods
158
159 inline Toolkit::Internal::Page& GetImpl( Toolkit::Page& page )
160 {
161   DALI_ASSERT_ALWAYS( page );
162
163   Dali::RefObject& handle = page.GetImplementation();
164
165   return static_cast<Toolkit::Internal::Page&>( handle );
166 }
167
168 inline const Toolkit::Internal::Page& GetImpl( const Toolkit::Page& page )
169 {
170   DALI_ASSERT_ALWAYS( page );
171
172   const Dali::RefObject& handle = page.GetImplementation();
173
174   return static_cast<const Toolkit::Internal::Page&>( handle );
175 }
176
177 }// namespace Toolkit
178
179 } // namespace Dali
180
181
182 #endif /* __DALI_TOOLKIT_INTERNAL_PAGE_IMPL_H__*/