Fork for IVI: mesa fixing
[profile/ivi/uifw.git] / src / ui / inc / FUi_ModalLoopManager.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        FUi_ModalLoopManager.h
19  * @brief       This is the header file for the _ModalLoopManager class.
20  *
21  * This header file contains the declarations of the %_ModalLoopManager class.
22  */
23
24 #ifndef _FUI_INTERNAL_MODAL_LOOP_MANAGER_H_
25 #define _FUI_INTERNAL_MODAL_LOOP_MANAGER_H_
26
27 #include <FBaseColArrayListT.h>
28 #include <FBaseRtITimerEventListener.h>
29
30 namespace Tizen { namespace Base { namespace Runtime
31 {
32 class Timer;
33 }}}
34
35 namespace Tizen { namespace Ui
36 {
37
38 class _ModalLoopManager
39         : public Tizen::Base::Runtime::ITimerEventListener
40 {
41         class _TimerInfo {
42         public:
43                 _TimerInfo(void);
44                 ~_TimerInfo(void);
45
46                 bool operator== (const _TimerInfo& rhs) const;
47                 bool operator!= (const _TimerInfo& rhs) const;
48                 _TimerInfo& operator= (const _TimerInfo& rhs);
49
50         public:
51                 int loopId;
52                 Tizen::Base::Runtime::Timer* pTimer;
53                 int exitCode;
54                 bool expired;
55         };
56         typedef Tizen::Base::Collection::ArrayListT<_TimerInfo> TimerInfoList;
57
58 public:
59         static void Initialize(void);
60         static _ModalLoopManager* GetInstance(void);
61
62         int BeginMainLoop(void);
63         int BeginMainLoop(unsigned long timeOut, int exitCode);
64         int EndMainLoop(int exitCode, bool endAllLoops);
65         int GetLastExitCode(void);
66
67         virtual void OnTimerExpired(Tizen::Base::Runtime::Timer& timer);
68
69 private:
70         ~_ModalLoopManager(void);
71         _ModalLoopManager(void);
72         _ModalLoopManager(const _ModalLoopManager& rhs);
73         _ModalLoopManager& operator =(const _ModalLoopManager& rhs);
74
75 public:
76         enum {
77                 MODAL_LOOP_EXIT_CODE_APP_TERMINATION = -1,
78                 MODAL_LOOP_EXIT_CODE_CONTINUOUS_TERMINATION = -2
79         };
80
81 private:
82         static _ModalLoopManager* __pInstance;
83         TimerInfoList*  __pTimerInfoList;
84         int __nestedMainLoop;
85         int __lastExitCode;
86 }; // _ModalLoopManager
87
88 }} // Tizen::Ui
89
90 #endif // _FUI_INTERNAL_MODAL_LOOP_MANAGER_H_