Initialize Tizen 2.3
[apps/osp/Gallery.git] / inc / GlTimerBase.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.1 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://floralicense.org/license/
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 /**
18  * @file                GlTimerBase.h
19  * @brief               This is the header file for GlTimerBase class.
20  */
21
22 #ifndef _GL_TIMER_BASE_H_
23 #define _GL_TIMER_BASE_H_
24
25 #include <FUi.h>
26 #include <FSystem.h>
27 #include "GlFileOpInvalidateListener.h"
28 #include "GlTimerScanDirListener.h"
29 #include "GlTypes.h"
30
31 class GlProgressBar;
32
33 class GlTimerBase
34         : public Tizen::Ui::IActionEventListener
35         , public Tizen::Base::Runtime::ITimerEventListener
36         , public ITimerScanDirListener
37         , public Tizen::Ui::IPropagatedKeyEventListener
38         , public Tizen::System::IDeviceEventListener
39 {
40 public:
41
42         GlTimerBase(IFileOpInvalidateListener*, enum FileActionMode actionId);
43         virtual ~GlTimerBase(void);
44
45         bool StartTimer(void);
46         void CancelTimer(void);
47         void SetActionMode(const enum FileActionMode actionId);
48
49         virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
50
51         virtual void OnTimerExpired(Tizen::Base::Runtime::Timer& timer);
52         virtual void OnTimerScanDirComplete();
53
54         void Cancel(void);
55         bool IsStarted(void);
56
57
58         virtual bool OnKeyPressed(Tizen::Ui::Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo){ return false; };
59         virtual bool OnKeyReleased(Tizen::Ui::Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo);
60         virtual bool OnPreviewKeyPressed(Tizen::Ui::Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo){ return false;};
61         virtual bool OnPreviewKeyReleased(Tizen::Ui::Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo){ return false;};
62
63
64 protected:
65         virtual Tizen::Base::Collection::IList* TimerStart(void) = 0;
66         virtual result TimerExpired(const Tizen::Base::Object*) = 0;
67         virtual void TimerCancel(int, enum FileActionCancelRes res) = 0;
68         virtual void TimerComplete(int, enum FileActionCompleteRes res) = 0;
69         virtual result ScanDirectories(void) = 0;
70         virtual int GetDirScanCount() = 0;
71         int GetMovedCount() const;
72         virtual void OnDeviceStateChanged(Tizen::System::DeviceType deviceType, const Tizen::Base::String& state) = 0;
73
74 private:
75         void OnOpComplete(enum FileActionCompleteRes);
76         void OnOpCancelled(enum FileActionCancelRes res);
77
78 protected:
79         enum FileActionMode _actionId;
80
81 private:
82         Tizen::Base::Runtime::Timer __moveTimer;
83         Tizen::Base::Collection::IList * __pContentIdList;
84         int __moveToCount;
85         GlProgressBar* __pMoveProBar;
86         IFileOpInvalidateListener* __pInvalidate;
87         bool __isStarted;
88         enum TimerCompleteOptions
89         {
90                 CANCEL_SYS,
91                 CANCEL_BY_USER,
92                 TIMER_COMPLETE
93         };
94         enum TimerCompleteOptions  __timerRes;
95  };
96
97 #endif //_GL_TIMER_BASE_H_