[dali_1.0.1] Merge branch 'tizen'
[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 prediction mode ( -1 means not set so no prediction, 0 = no prediction )
94    */
95   int GetPanGesturePredictionMode() const;
96
97   /**
98    * @return pan-gesture prediction amount
99    */
100   float GetPanGesturePredictionAmount() const;
101
102   /**
103    * @return pan-gesture smoothing mode ( -1 means not set so no smoothing, 0 = no smoothing )
104    */
105   int GetPanGestureSmoothingMode() const;
106
107   /**
108    * @return pan-gesture smoothing amount
109    */
110   float GetPanGestureSmoothingAmount() const;
111
112   /**
113    * @return The minimum distance before a pan can be started (-1 means it's not set)
114    */
115   int GetMinimumPanDistance() const;
116
117   /**
118    * @return The minimum events before a pan can be started (-1 means it's not set)
119    */
120   int GetMinimumPanEvents() const;
121
122   /**
123    * @brief Sets the mode used to smooth pan gesture movement properties calculated on the Update thread
124    *
125    * @param[in] mode The smoothing mode to use
126    */
127   void SetPanGesturePredictionMode( unsigned int mode );
128
129   /**
130    * @brief Sets the prediction amount of the pan gesture
131    *
132    * @param[in] amount The prediction amount in milliseconds
133    */
134   void SetPanGesturePredictionAmount( unsigned int amount );
135
136   /**
137    * @brief Called to set how pan gestures smooth input
138    *
139    * @param[in] mode The smoothing mode to use
140    */
141   void SetPanGestureSmoothingMode( unsigned int mode );
142
143   /**
144    * @brief Sets the prediction amount of the pan gesture
145    *
146    * @param[in] amount The smoothing amount [0.0f,1.0f] - 0.0f would be no smoothing, 1.0f maximum smoothing
147    */
148   void SetPanGestureSmoothingAmount( float amount );
149
150   /**
151    * @brief Sets the minimum distance required before a pan starts
152    *
153    * @param[in] distance The minimum distance before a pan starts
154    */
155   void SetMinimumPanDistance( int distance );
156
157   /**
158    * @brief Sets the minimum number of events required before a pan starts
159    *
160    * @param[in] events The minimum events before a pan starts
161    */
162   void SetMinimumPanEvents( int events );
163
164   /**
165    * @brief Sets how often the gles call logging occurs
166    *
167    * @param[in] time the number of seconds between logging output
168    */
169   void SetGlesCallTime( int time );
170
171   /**
172    * @brief Get the graphics status time
173    */
174   int GetGlesCallTime();
175
176
177 private:
178
179   unsigned int mFpsFrequency;                     ///< how often fps is logged out in seconds
180   unsigned int mUpdateStatusFrequency;            ///< how often update status is logged out in frames
181   unsigned int mPerformanceLoggingLevel;          ///< performance log level
182   unsigned int mPanGestureLoggingLevel;           ///< pan-gesture log level
183   int mPanGesturePredictionMode;                  ///< prediction mode for pan gestures
184   float mPanGesturePredictionAmount;              ///< prediction amount for pan gestures
185   int mPanGestureSmoothingMode;                  ///< prediction mode for pan gestures
186   float mPanGestureSmoothingAmount;              ///< prediction amount for pan gestures
187   int mPanMinimumDistance;                        ///< minimum distance required before pan starts
188   int mPanMinimumEvents;                          ///< minimum events required before pan starts
189   int mGlesCallTime;                              ///< time in seconds between status updates
190
191   Dali::Integration::Log::LogFunction mLogFunction;
192
193   // Undefined copy constructor.
194   EnvironmentOptions( const EnvironmentOptions& );
195
196   // Undefined assignment operator.
197   EnvironmentOptions& operator=( const EnvironmentOptions& );
198
199 };
200
201 } // Adaptor
202 } // Internal
203 } // Dali
204
205 #endif // __DALI_INTERNAL_ADAPTOR_ENVIRONMENT_OPTIONS_H__