Merge base & optional
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / navigation-frame / navigation-bar.h
1 #ifndef __DALI_TOOLKIT_INTERNAL_NAVIGATION_BAR_H__
2 #define __DALI_TOOLKIT_INTERNAL_NAVIGATION_BAR_H__
3
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <string>
23
24 // INTERNAL INCLUDES
25 #include <dali-toolkit/public-api/controls/table-view/table-view.h>
26 #include <dali-toolkit/internal/controls/navigation-frame/navigation-control-impl.h>
27 #include <dali-toolkit/public-api/controls/navigation-frame/page.h>
28 #include <dali-toolkit/public-api/controls/navigation-frame/navigation-bar-style.h>
29
30
31 namespace Dali
32 {
33
34 namespace Toolkit
35 {
36
37 namespace Internal
38 {
39
40 /**
41  * Base class for different navigation bars such as tool bar, title bar.
42  */
43 class NavigationBar : public Dali::RefObject, public ConnectionTracker
44 {
45
46 public:
47   /**
48    * Constructor
49    * Pass in the navigationControl with which the bar associates and its style.
50    */
51   NavigationBar( NavigationControl& naviControl,
52                  Toolkit::BasicNaviBarStyle barStylePortrait,
53                  Toolkit::BasicNaviBarStyle barStyleLandscape);
54
55   /**
56    * Update the bar scale when the size of the navigation control is set / reset
57    * Also Update the style when the orientation( portrait/landscape) is changed
58    * @param[in] naviControlSize The size of the navigation control
59    * @param[in] orientation The angle of the current orientation
60    */
61   void ScaleStyleUpdate( Vector2 naviControlSize, int orientation );
62
63   /**
64    * Retrieve the height of the bar
65    * @return The height of the bar
66    */
67   float GetBarHeight() const;
68
69 private:
70
71   /**
72    * Set a background image and add it onto the NavigaionControl's bar layer.
73    *
74    */
75   void SetBackground( Actor background );
76
77   /**
78    * Call the update function when it receives the page pushed signal.
79    */
80   void OnItemPushed( Toolkit::NavigationControl naviControl, Toolkit::Page naviItem );
81
82   /**
83    * Call the update function when it receives the page popped signal.
84    */
85   void OnItemPopped( Toolkit::NavigationControl naviControl, Toolkit::Page naviItem );
86
87 protected:
88
89   /**
90    * virtual destructor
91    */
92   virtual ~NavigationBar();
93
94   /**
95    * Given the current page, update the bar content.
96    * @param[in] naviItem the item on the top of the navigation stack
97    */
98   virtual void Update( Toolkit::Page naviItem ) = 0;
99
100   /**
101    * update the bar style when the orientation is changed
102    * @param[in] isPortrait Whether the current orientation is portrait mode
103    */
104   virtual void OrientationUpdate( bool isPortrait ) = 0;
105
106 private:
107
108   // Undefined
109   NavigationBar(const NavigationBar&);
110
111   // Undefined
112   NavigationBar& operator=(const NavigationBar& rhs);
113
114
115 protected:
116   NavigationControl&                 mInternalNavigationControl;
117   Toolkit::BasicNaviBarStyle         mBasicStylePortrait;
118   Toolkit::BasicNaviBarStyle         mBasicStyleLandscape;
119   const Toolkit::BasicNaviBarStyle*  mBasicCurrentStyle;
120   float                              mRelativeScale;
121   float                              mBarHeight;
122
123   Toolkit::TableView                 mLayout;
124   Actor                              mBackground;
125
126   bool                               mIsPortrait;
127   Toolkit::Page            mCurrentItem;
128
129   bool                               mVisible;
130 };
131
132 } // namespace Internal
133
134 } // namespace Toolkit
135
136 } // namespace Dali
137
138
139 #endif /* __DALI_TOOLKIT_INTERNAL_NAVIGATION_BAR_H__ */