(PanGesture) Two motions before pan & ability to set the min distance/events via...
[platform/core/uifw/dali-adaptor.git] / adaptors / base / environment-options.h
1 #ifndef __DALI_INTERNAL_ADAPTOR_ENVIRONMENT_OPTIONS_H__
2 #define __DALI_INTERNAL_ADAPTOR_ENVIRONMENT_OPTIONS_H__
3
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 #include <dali/integration-api/debug.h>
22
23 namespace Dali
24 {
25 namespace Internal
26 {
27 namespace Adaptor
28 {
29
30 /**
31  * Contains environment options which define settings and the ability to install a log function.
32  */
33 class EnvironmentOptions
34 {
35
36 public:
37
38   /**
39    * Constructor
40    */
41   EnvironmentOptions();
42
43   /**
44    * non-virtual destructor, not intended as a base class
45    */
46   ~EnvironmentOptions();
47
48   /**
49    * @param logFunction logging function
50    * @param logFilterOptions bitmask of the logging options defined in intergration/debug.h (e.g.
51    * @param logFrameRateFrequency frequency of how often FPS is logged out (e.g. 0 = off, 2 = every 2 seconds).
52    * @param logupdateStatusFrequency frequency of how often the update status is logged in number of frames
53    * @param logPerformanceLevel performance logging, 0 = disabled,  1+ =  enabled
54    * @param logPanGestureLevel pan-gesture logging, 0 = disabled,  1 = enabled
55    */
56   void SetLogOptions( const Dali::Integration::Log::LogFunction& logFunction,
57                        unsigned int logFrameRateFrequency,
58                        unsigned int logupdateStatusFrequency,
59                        unsigned int logPerformanceLevel,
60                        unsigned int logPanGestureLevel );
61
62   /**
63    * Install the log function for the current thread.
64    */
65   void InstallLogFunction() const;
66
67   /**
68    * Un-install the log function for the current thread.
69    */
70   void UnInstallLogFunction() const;
71
72   /**
73    * @return frequency of how often FPS is logged out (e.g. 0 = off, 2 = every 2 seconds).
74    */
75   unsigned int GetFrameRateLoggingFrequency() const;
76
77   /**
78    * @return frequency of how often Update Status is logged out (e.g. 0 = off, 60 = log every 60 frames = 1 second @ 60FPS).
79    */
80   unsigned int GetUpdateStatusLoggingFrequency() const;
81
82   /**
83    * @return logPerformanceLevel performance log level ( 0 = off )
84    */
85   unsigned int GetPerformanceLoggingLevel() const;
86
87   /**
88    * @return pan-gesture logging level ( 0 == off )
89    */
90   unsigned int GetPanGestureLoggingLevel() const;
91
92   /**
93    * @return pan-gesture smoothing mode ( -1 means not set so no smoothing, 0 = no smoothing )
94    */
95   int GetPanGestureSmoothingMode() const;
96
97   /**
98    * @return pan-gesture prediction amount
99    */
100   float GetPanGesturePredictionAmount() const;
101
102   /**
103    * @return The minimum distance before a pan can be started (-1 means it's not set)
104    */
105   int GetMinimumPanDistance() const;
106
107   /**
108    * @return The minimum events before a pan can be started (-1 means it's not set)
109    */
110   int GetMinimumPanEvents() const;
111
112   /**
113    * @brief Sets the mode used to smooth pan gesture movement properties calculated on the Update thread
114    *
115    * @param[in] mode The smoothing mode to use
116    */
117   void SetPanGesturePredictionMode(unsigned int mode);
118
119   /**
120    * @brief Sets the prediction amount of the pan gesture
121    *
122    * @param[in] amount The prediction amount in milliseconds
123    */
124   void SetPanGesturePredictionAmount(unsigned int amount);
125
126   /**
127    * @brief Sets the minimum distance required before a pan starts
128    *
129    * @param[in] distance The minimum distance before a pan starts
130    */
131   void SetMinimumPanDistance( int distance );
132
133   /**
134    * @brief Sets the minimum number of events required before a pan starts
135    *
136    * @param[in] events The minimum events before a pan starts
137    */
138   void SetMinimumPanEvents( int events );
139
140 private:
141
142   unsigned int mFpsFrequency;                     ///< how often fps is logged out in seconds
143   unsigned int mUpdateStatusFrequency;            ///< how often update status is logged out in frames
144   unsigned int mPerformanceLoggingLevel;          ///< performance log level
145   unsigned int mPanGestureLoggingLevel;           ///< pan-gesture log level
146   int mPanGesturePredictionMode;                  ///< prediction mode for pan gestures
147   float mPanGesturePredictionAmount;              ///< prediction amount for pan gestures
148   int mPanMinimumDistance;                        ///< minimum distance required before pan starts
149   int mPanMinimumEvents;                          ///< minimum events required before pan starts
150
151   Dali::Integration::Log::LogFunction mLogFunction;
152
153   // Undefined copy constructor.
154   EnvironmentOptions( const EnvironmentOptions& );
155
156   // Undefined assignment operator.
157   EnvironmentOptions& operator=( const EnvironmentOptions& );
158
159 };
160
161 } // Adaptor
162 } // Internal
163 } // Dali
164
165 #endif // __DALI_INTERNAL_ADAPTOR_ENVIRONMENT_OPTIONS_H__