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