[SRUK] Initial copy from Tizen 2.2 version
[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 Flora License, Version 1.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://floralicense.org/license/
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 // EXTERNAL INCLUDES
20 #include <string>
21
22 // INTERNAL INCLUDES
23 #include <dali/dali.h>
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 ControlImpl
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 private: // From ControlImpl
120
121   /**
122    * @copydoc Toolkit::Control::OnInitialize()
123    */
124   virtual void OnInitialize();
125
126   /**
127    * @copydoc Dali::CustomActorImpl::OnPropertySet()
128    */
129   virtual void OnPropertySet( Property::Index index, Property::Value propertyValue );
130
131 private:
132
133   /**
134    * Constructor.
135    * It initializes the Page members
136    */
137   Page();
138
139 private:
140   std::string        mTitle;
141   std::string        mSubTitle;
142   Actor              mTitleIcon;
143   Toolkit::Popup     mPopupMenu;
144
145   ActorContainer                        mTitleBarControls;
146   Toolkit::Page::ControlOnBarContainer  mToolBarControls;
147
148   Property::Index  mPropertyTitle;       ///< Property index for title.
149   Property::Index  mPropertySubTitle;    ///< Property index for sub title.
150 };
151
152 } // namespace Internal
153
154 // Helpers for public-api forwarding methods
155
156 inline Toolkit::Internal::Page& GetImpl( Toolkit::Page& page )
157 {
158   DALI_ASSERT_ALWAYS( page );
159
160   Dali::RefObject& handle = page.GetImplementation();
161
162   return static_cast<Toolkit::Internal::Page&>( handle );
163 }
164
165 inline const Toolkit::Internal::Page& GetImpl( const Toolkit::Page& page )
166 {
167   DALI_ASSERT_ALWAYS( page );
168
169   const Dali::RefObject& handle = page.GetImplementation();
170
171   return static_cast<const Toolkit::Internal::Page&>( handle );
172 }
173
174 }// namespace Toolkit
175
176 } // namespace Dali
177
178
179 #endif /* __DALI_TOOLKIT_INTERNAL_PAGE_IMPL_H__*/