Fixed crash in case that overshoot scroll is not enabled
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / navigation-frame / navigation-tool-bar.h
1 #ifndef __DALI_TOOLKIT_INTERNAL_NAVIGATION_TOOL_BAR_H__
2 #define __DALI_TOOLKIT_INTERNAL_NAVIGATION_TOOL_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 // INTERNAL INCLUDES
22 #include <dali-toolkit/public-api/controls/table-view/table-view.h>
23 #include <dali-toolkit/public-api/controls/text-view/text-view.h>
24 #include <dali-toolkit/internal/controls/navigation-frame/navigation-control-impl.h>
25 #include <dali-toolkit/internal/controls/navigation-frame/navigation-bar.h>
26 #include <dali-toolkit/public-api/controls/navigation-frame/page.h>
27
28 namespace Dali
29 {
30
31 namespace Toolkit
32 {
33
34 namespace Internal
35 {
36
37 /**
38  * The tool bar locates in the bottom of the frame where other controls (such as PushButton ) could be placed.
39  * Controls could be added into three groups: HorizontalLeft, HorizontalCenter or HorizontalRight.
40  * The left and right groups can only have one control maximum each, while the central group can have multiple controls.
41  * It is also fine to have no control in each group.
42  * If the current NavigationOtem provides no control for the bar at all, the bar is hidden.
43  *               +----------------------------------------+
44  *               | +-+        +-----+  +-----+        +-+ |
45  *               | +-+        +-----+  +-----+        +-+ |
46  *               +----------------------------------------+
47  */
48 class NavigationToolBar : public NavigationBar
49 {
50 public:
51
52   NavigationToolBar(NavigationControl& naviControl,
53                     Toolkit::NaviToolBarStyle toolBarStylePortrait,
54                     Toolkit::NaviToolBarStyle toolBarStyleLandscape );
55
56 protected:
57
58   /**
59    * @copydoc Toolkit::Internal::NavigationBar::Update
60    */
61   void Update( Toolkit::Page page );
62
63   /**
64    * @copydoc Toolkit::Internal::NavigationBar::OrientationUpdate
65    */
66   void OrientationUpdate( bool isPortrait );
67
68 private:
69
70   /**
71    * Set a control onto the navigation tool bar when the page is on the top.
72    * @param[in] control The control on the navigation tool bar.
73    * @param[in] alignment The position of the control, can be HorizontalLeft/HorizontalRight/HorizontalCenter.
74    */
75   void AddControl(Actor actor, Toolkit::Alignment::Type alignment);
76
77   /**
78    * Set the fixed width and height to the cells of the layout
79    * These sizes need to be updated when the orientation is changing.
80    */
81   void SetFixedSizes();
82
83 private:
84
85   Toolkit::NaviToolBarStyle         mStylePortrait;
86   Toolkit::NaviToolBarStyle         mStyleLandscape;
87   const Toolkit::NaviToolBarStyle*  mCurrentStyle;
88
89   Toolkit::TableView                mLeftLayout;
90   Toolkit::TableView                mRightLayout;
91   Toolkit::TableView                mCentralLayout;
92
93   int                               mNumCentralActor;
94 };
95
96 } // namespace Internal
97
98 } // namespace Toolkit
99
100 } // namespace Dali
101
102 #endif /* __DALI_TOOLKIT_INTERNAL_NAVIGATION_TOOL_BAR_H__ */