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