Tizen 2.1 base
[framework/osp/uifw.git] / src / ui / inc / FUiCtrl_ProgressPopupPresenter.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 /**
19  * @file                FUiCtrl_ProgressPopupPresenter.h
20  * @brief       This is the header file for the _ProgressPopupPresenter class.
21  *
22  * This header file contains the declarations of the _ProgressPopupPresenter class.
23  */
24
25 #ifndef _FUI_CTRL_INTERNAL_PROGRESS_POPUP_PRESENTER_H_
26 #define _FUI_CTRL_INTERNAL_PROGRESS_POPUP_PRESENTER_H_
27
28
29 #include "FUiCtrl_Animation.h"
30 #include "FUiCtrl_PopupPresenter.h"
31
32
33 namespace Tizen { namespace Ui { namespace Controls
34 {
35
36 class _ProgressPopup;
37
38
39 /**
40  * @class _ProgressPopupPresenter
41  * @brief
42  * @since       1.0
43  *
44  *
45  *
46  *
47  */
48 class _ProgressPopupPresenter
49         : public _PopupPresenter
50         , public Tizen::Ui::Controls::_IAnimationEventListener
51         , virtual public Tizen::Base::Runtime::IEventListener
52 {
53 // Lifecycle
54 public:
55         _ProgressPopupPresenter(void);
56         virtual ~_ProgressPopupPresenter(void);
57
58 // Operations
59 public:
60         result Initialize(_ProgressPopup& ProgressPopup, bool cancelButton, bool translucent, const Tizen::Graphics::Rectangle& animationRect);
61
62         void SetTitleTextObject(void);
63         void SetTextObject(void);
64
65         virtual void Draw(void);
66
67         virtual result DoModal(int& modalResult);
68
69         int GetBodyTextHeight(void) const;
70
71         Tizen::Graphics::Rectangle GetButtonBounds(void) const;
72         Tizen::Graphics::Rectangle GetTitleBounds(void) const;
73         Tizen::Graphics::Rectangle GetTextBounds(void) const;
74
75         result PlayProcessAnimation(void);
76         result StopProcessAnimation(void);
77         result SetProcessAnimation(void);
78
79         void OnFontChanged(Tizen::Graphics::Font* pFont);
80         void OnFontInfoRequested(unsigned long& style, int& size);
81
82         result SetFontInfo(unsigned long style, int size);
83
84         // Touch Event Listener
85         virtual bool OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo);
86         virtual bool OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo);
87         virtual bool OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo);
88
89         virtual void OnAnimationStopped(const Tizen::Ui::_Control& source);
90
91 private:
92         _ProgressPopupPresenter(const _ProgressPopupPresenter& rhs);
93         _ProgressPopupPresenter& operator =(const _ProgressPopupPresenter& rhs);
94
95         result LoadImages(void);
96
97 private:
98         enum
99         {
100                 MAX_PROCESS_IMAGE_COUNT = 30
101         };
102
103 //Attribute
104 private:
105         _ProgressPopup* __pProgressPopup;
106
107         Tizen::Graphics::_Text::TextObject* __pTitleTextObject;
108         Tizen::Graphics::_Text::TextObject* __pBodyTextObject;
109
110         Tizen::Graphics::Rectangle __titleBounds;
111         Tizen::Graphics::Rectangle __textBounds;
112         Tizen::Graphics::Rectangle __animationBounds;
113
114         Tizen::Graphics::Bitmap* __pProcessImage[MAX_PROCESS_IMAGE_COUNT];
115
116         _Animation* __pAnimation;
117         Tizen::Base::Collection::ArrayList* __pAnimationFrameList;
118
119         unsigned long __fontStyle;
120         int __fontSize;
121
122         int __textObjectHeight;
123         int __currentIndex;
124
125         bool __buttonPressState;
126         bool __cancelButton;
127         bool __translucent;
128
129         static const int ANIMATION_REPEAT_COUNT = 100;
130
131 };  // _ProgressPopupPresenter
132
133
134 }}} // Tizen::Ui::Controls
135
136 #endif //_FUI_CTRL_INTERNAL_PROGRESS_POPUP_PRESENTER_H_