Performance improvements
[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 "GlFileOpInvalidateListener.h"
27 #include "GlTimerScanDirListener.h"
28
29 class GlProgressBar;
30
31 class GlTimerBase
32         : public Tizen::Ui::IActionEventListener
33         , public Tizen::Base::Runtime::ITimerEventListener
34         , public ITimerScanDirListener
35         , public Tizen::Ui::IPropagatedKeyEventListener
36 {
37 public:
38
39         GlTimerBase(IFileOpInvalidateListener*, enum FileActionMode actionId);
40         virtual ~GlTimerBase(void);
41
42         bool StartTimer(void);
43         void CancelTimer(void);
44         void SetActionMode(const enum FileActionMode actionId);
45
46         virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
47
48         virtual void OnTimerExpired(Tizen::Base::Runtime::Timer& timer);
49         virtual void OnTimerScanDirComplete();
50
51         void Cancel(void);
52         bool IsStarted(void);
53
54
55         virtual bool OnKeyPressed(Tizen::Ui::Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo){ return false; };
56         virtual bool OnKeyReleased(Tizen::Ui::Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo);
57         virtual bool OnPreviewKeyPressed(Tizen::Ui::Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo){ return false;};
58         virtual bool OnPreviewKeyReleased(Tizen::Ui::Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo){ return false;};
59
60
61 protected:
62         virtual Tizen::Base::Collection::IList* TimerStart(void) = 0;
63         virtual result TimerExpired(const Tizen::Base::Object*) = 0;
64         virtual void TimerCancel(int, enum FileActionCancelRes res) = 0;
65         virtual void TimerComplete(int, enum FileActionCompleteRes res) = 0;
66         virtual result ScanDirectories(void) = 0;
67         virtual int GetDirScanCount() const = 0;
68         int GetMovedCount() const;
69
70 private:
71         void OnOpComplete(enum FileActionCompleteRes);
72         void OnOpCancelled(enum FileActionCancelRes res);
73
74 protected:
75         enum FileActionMode _actionId;
76
77 private:
78         Tizen::Base::Runtime::Timer __moveTimer;
79         Tizen::Base::Collection::IList * __pContentIdList;
80         int __moveToCount;
81         GlProgressBar* __pMoveProBar;
82         IFileOpInvalidateListener* __pInvalidate;
83         bool __isStarted;
84         enum TimerCompleteOptions
85         {
86                 CANCEL_SYS,
87                 CANCEL_BY_USER,
88                 TIMER_COMPLETE
89         };
90         enum TimerCompleteOptions  __timerRes;
91  };
92
93 #endif //_GL_TIMER_BASE_H_