Fork for IVI: mesa fixing
[profile/ivi/uifw.git] / src / ui / inc / FUiCtrl_SplitPanelPresenter.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://floralicense.org/license/
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 /**
18  * @file                FUiCtrl_SplitPanelPresenter.h
19  * @brief               This is the header file for the _SplitPanelPresenter class.
20  *
21  * This header file contains the declarations of the %_SplitPanelPresenter class.
22  */
23
24 #ifndef _FUICTRL_INTERNAL_SPLIT_PANEL_PRESENTER_H_
25 #define _FUICTRL_INTERNAL_SPLIT_PANEL_PRESENTER_H_
26
27 #include <FBaseObject.h>
28 #include "FUi_Control.h"
29 #include "FUiCtrl_SplitPanelModel.h"
30 #include "FUi_ITouchTapGestureEventListener.h"
31 #include "FUiAnimations.h"
32
33 namespace Tizen { namespace Ui { namespace Controls
34 {
35 class _SplitPanel;
36
37 enum _SplitPanelAnimationDirection
38 {
39         _SPLIT_PANEL_ANIMATION_RIGHT = 0,
40         _SPLIT_PANEL_ANIMATION_LEFT,
41         _SPLIT_PANEL_ANIMATION_TOP,
42         _SPLIT_PANEL_ANIMATION_BOTTOM,
43         _SPLIT_PANEL_ANIMATION_RESTORE_HORIZONTAL,
44         _SPLIT_PANEL_ANIMATION_RESTORE_VERTICAL,
45         _SPLIT_PANEL_ANIMATION_MAX
46 };
47
48 const long ANIMATION_DURATION = 1000;
49 const float ANIMATION_ALPHA_HIDE = 0.0;
50 const float ANIMATION_ALPHA_SHOW = 1.0;
51
52 class _SplitPanelPresenter
53         : public Tizen::Base::Object
54         , public Tizen::Ui::_ITouchTapGestureEventListener
55 {
56 // Lifecycle
57 public:
58         _SplitPanelPresenter(void);
59         virtual ~_SplitPanelPresenter(void);
60
61 // Operations
62         virtual result Construct(const _SplitPanel& splitPanel, SplitPanelDividerStyle splitPanelDividerStyle, SplitPanelDividerDirection splitPanelDividerDirection);
63         bool CheckDividerTouchRegion(int positionX, int positionY);
64
65         virtual bool OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo);
66         virtual bool OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo);
67         virtual bool OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo);
68         virtual bool OnTouchCanceled(const _Control& source, const _TouchInfo& touchinfo);
69
70         virtual bool OnTapGestureDetected(_TouchTapGestureDetector& gesture);
71         virtual bool OnTapGestureCanceled(_TouchTapGestureDetector& gesture);
72
73         result SetDividerStyle(SplitPanelDividerStyle splitPanelDividerStyle);
74         SplitPanelDividerStyle GetDividerStyle(void) const;
75
76         Tizen::Graphics::Rectangle GetDividerRectangle(void) const;
77
78         result MaximizePane(SplitPanelPaneOrder paneOrder);
79         bool IsPaneMaximized(SplitPanelPaneOrder paneOrder) const;
80         result RestorePane(void);
81
82         result Draw(void);
83
84         result LoadBitmap(SplitPanelDividerDirection splitPanelDividerDirection);
85
86         void RecalcSplitPanel(void);
87
88         void OnChangeLayout(Tizen::Ui::_ControlOrientation orientation);
89
90         void OnBoundsChanged(void);
91
92 protected:
93         result SetModel(const _SplitPanelModel& splitPanelModel);
94
95 private:
96         result SetPaneBounds(void);
97         void AdjustDividerRectangle(void);
98
99         // Animation
100         void ChangePaneOrder(SplitPanelPaneOrder paneOrder);
101         result AnimateDivider(int destination);
102         result AnimatePane(int destination);
103         Tizen::Ui::Control* GetPaneControl(SplitPanelPaneOrder paneOrder);
104         Tizen::Ui::Animations::AnimatorStatus GetAnimationStatus(void);
105         Tizen::Graphics::Rectangle GetRestorePaneBounds(SplitPanelPaneOrder paneOrder);
106
107 private:
108         _SplitPanelPresenter(const _SplitPanelPresenter& value);
109         _SplitPanelPresenter& operator =(const _SplitPanelPresenter& value);
110
111 private:
112         _SplitPanel* __pSplitPanel;
113         _SplitPanelModel* __pSplitPanelModel;
114
115         int __dividerMaximumPosition;
116         int __dividerMinimumPosition;
117         bool __splitPanelDividerPressed;
118         bool __setFirstDividerPositionChangeEvent;
119
120         Tizen::Graphics::Rectangle __dividerRectangle;
121         Tizen::Graphics::Rectangle __dividerThumbRectangle;
122         Tizen::Graphics::Bitmap* __pDividerPressedBackgroundBitmap;
123         Tizen::Graphics::Bitmap* __pDividerBackgroundBitmap;
124         Tizen::Graphics::Bitmap* __pDividerBackgroundEffectBitmap;
125         Tizen::Graphics::Bitmap* __pDividerThumbBitmap;
126         Tizen::Graphics::Color __dividerBackgroundColor;
127         Tizen::Graphics::Color __dividerPressedBackgroundColor;
128
129         // Animation
130         int __transactionIdMaximize;
131         int __transactionIdRestore;
132
133         Tizen::Ui::Animations::AnimationInterpolatorType __controlAnimatorAnimationInterpolator;
134         Tizen::Base::String __visualElementAnimationInterpolator;
135
136 }; // _SplitPanelPresenter;
137
138 }}} // Tizen::Ui::Controls
139
140 #endif  // _FUICTRL_INTERNAL_SPLIT_PANEL_PRESENTER_H_
141
142
143