Merge "DALi Version 1.0.35" into 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 // EXTERNAL INCLUDES
22 #include <dali/integration-api/debug.h>
23
24 namespace Dali
25 {
26 namespace Internal
27 {
28 namespace Adaptor
29 {
30
31 /**
32  * Contains environment options which define settings and the ability to install a log function.
33  *
34  * TODO: This file and adaptor needs cleaning up. There should not be any environment options in the adaptor class, only here!
35  */
36 class EnvironmentOptions
37 {
38
39 public:
40
41   /**
42    * Constructor
43    */
44   EnvironmentOptions();
45
46   /**
47    * non-virtual destructor, not intended as a base class
48    */
49   ~EnvironmentOptions();
50
51   /**
52    * @param logFunction logging function
53    * @param networkControl whether network control is enabled
54    * @param logFilterOptions bitmask of the logging options defined in intergration/debug.h (e.g.
55    * @param logFrameRateFrequency frequency of how often FPS is logged out (e.g. 0 = off, 2 = every 2 seconds).
56    * @param logupdateStatusFrequency frequency of how often the update status is logged in number of frames
57    * @param logPerformanceStats performance statistics logging, 0 = disabled,  1+ =  enabled
58    * @param logPerformanceStatsFrequency statistics logging frequency in seconds
59    * @param performanceTimeStampOutput where to output performance related time stamps to
60    * @param logPanGestureLevel pan-gesture logging, 0 = disabled,  1 = enabled
61    */
62   void SetLogOptions( const Dali::Integration::Log::LogFunction& logFunction,
63                        unsigned int networkControl,
64                        unsigned int logFrameRateFrequency,
65                        unsigned int logupdateStatusFrequency,
66                        unsigned int logPerformanceStats,
67                        unsigned int logPerformanceStatsFrequency,
68                        unsigned int performanceTimeStampOutput,
69                        unsigned int logPanGestureLevel );
70
71   /**
72    * Install the log function for the current thread.
73    */
74   void InstallLogFunction() const;
75
76   /**
77    * Un-install the log function for the current thread.
78    */
79   void UnInstallLogFunction() const;
80
81   /**
82    * @return whether network control is enabled or not ( 0 = off, 1 = on )
83    */
84   unsigned int GetNetworkControlMode() const;
85
86   /**
87    * @return frequency of how often FPS is logged out (e.g. 0 = off, 2 = every 2 seconds).
88    */
89   unsigned int GetFrameRateLoggingFrequency() const;
90
91   /**
92    * @return frequency of how often Update Status is logged out (e.g. 0 = off, 60 = log every 60 frames = 1 second @ 60FPS).
93    */
94   unsigned int GetUpdateStatusLoggingFrequency() const;
95
96   /**
97    * @return performance statistics log level ( 0 == off )
98    */
99   unsigned int GetPerformanceStatsLoggingOptions() const;
100
101   /**
102    * @return performance statistics log frequency in seconds
103    */
104   unsigned int GetPerformanceStatsLoggingFrequency() const;
105
106   /**
107    * @return performance time stamp output ( 0 == off)
108    */
109   unsigned int GetPerformanceTimeStampOutput() const;
110
111   /**
112    * @return pan-gesture logging level ( 0 == off )
113    */
114   unsigned int GetPanGestureLoggingLevel() const;
115
116   /**
117    * @return pan-gesture prediction mode ( -1 means not set so no prediction, 0 = no prediction )
118    */
119   int GetPanGesturePredictionMode() const;
120
121   /**
122    * @return pan-gesture prediction amount
123    */
124   int GetPanGesturePredictionAmount() const;
125
126   /**
127    * @return maximum pan-gesture prediction amount
128    */
129   int GetPanGestureMaximumPredictionAmount() const;
130
131   /**
132    * @return minimum pan-gesture prediction amount
133    */
134   int GetPanGestureMinimumPredictionAmount() const;
135
136   /**
137    * @return pan-gesture prediction amount adjustment
138    */
139   int GetPanGesturePredictionAmountAdjustment() const;
140
141   /**
142    * @return pan-gesture smoothing mode ( -1 means not set so no smoothing, 0 = no smoothing )
143    */
144   int GetPanGestureSmoothingMode() const;
145
146   /**
147    * @return pan-gesture smoothing amount
148    */
149   float GetPanGestureSmoothingAmount() const;
150
151   /**
152    * @return The minimum distance before a pan can be started (-1 means it's not set)
153    */
154   int GetMinimumPanDistance() const;
155
156   /**
157    * @return The minimum events before a pan can be started (-1 means it's not set)
158    */
159   int GetMinimumPanEvents() const;
160
161   /**
162    * @return The width of the window
163    */
164   unsigned int GetWindowWidth() const;
165
166   /**
167    * @return The height of the window
168    */
169   unsigned int GetWindowHeight() const;
170
171   /**
172    * @brief Sets the mode used to predict pan gesture movement
173    *
174    * @param[in] mode The prediction mode to use
175    */
176   void SetPanGesturePredictionMode( unsigned int mode );
177
178   /**
179    * @brief Sets the prediction amount of the pan gesture
180    *
181    * @param[in] amount The prediction amount in milliseconds
182    */
183   void SetPanGesturePredictionAmount( unsigned int amount );
184
185   /**
186    * @brief Sets the upper bound of the prediction amount for clamping
187    *
188    * @param[in] amount The prediction amount in milliseconds
189    */
190   void SetPanGestureMaximumPredictionAmount( unsigned int amount );
191
192   /**
193    * @brief Sets the lower bound of the prediction amount for clamping
194    *
195    * @param[in] amount The prediction amount in milliseconds
196    */
197   void SetPanGestureMinimumPredictionAmount( unsigned int amount );
198
199   /**
200    * @brief Sets the prediction amount to adjust when the pan velocity is changed.
201    * If the pan velocity is accelerating, the prediction amount will be increased
202    * by the specified amount until it reaches the upper bound. If the pan velocity
203    * is decelerating, the prediction amount will be decreased by the specified
204    * amount until it reaches the lower bound.
205    *
206    * @param[in] amount The prediction amount in milliseconds
207    */
208   void SetPanGesturePredictionAmountAdjustment( unsigned int amount );
209
210   /**
211    * @brief Called to set how pan gestures smooth input
212    *
213    * @param[in] mode The smoothing mode to use
214    */
215   void SetPanGestureSmoothingMode( unsigned int mode );
216
217   /**
218    * @brief Sets the mode used to smooth pan gesture movement properties calculated on the Update thread
219    *
220    * @param[in] amount The smoothing amount [0.0f,1.0f] - 0.0f would be no smoothing, 1.0f maximum smoothing
221    */
222   void SetPanGestureSmoothingAmount( float amount );
223
224   /**
225    * @brief Sets the minimum distance required before a pan starts
226    *
227    * @param[in] distance The minimum distance before a pan starts
228    */
229   void SetMinimumPanDistance( int distance );
230
231   /**
232    * @brief Sets the minimum number of events required before a pan starts
233    *
234    * @param[in] events The minimum events before a pan starts
235    */
236   void SetMinimumPanEvents( int events );
237
238   /**
239    * @brief Sets how often the gles call logging occurs
240    *
241    * @param[in] time the number of seconds between logging output
242    */
243   void SetGlesCallTime( int time );
244
245   /**
246    * @brief Get the graphics status time
247    */
248   int GetGlesCallTime() const;
249
250   /**
251    * @brief Sets the width of the window
252    */
253   void SetWindowWidth( int width );
254
255   /**
256    * @brief Sets the width of the window
257    */
258   void SetWindowHeight( int height );
259
260   /**
261    * @return true if performance server is required
262    */
263   bool PerformanceServerRequired() const;
264
265 private:
266
267   unsigned int mNetworkControl;                   ///< whether network control is enabled
268   unsigned int mFpsFrequency;                     ///< how often fps is logged out in seconds
269   unsigned int mUpdateStatusFrequency;            ///< how often update status is logged out in frames
270   unsigned int mPerformanceStatsLevel;            ///< performance statistics logging bitmask
271   unsigned int mPerformanceStatsFrequency;        ///< performance statistics logging frequency (seconds)
272   unsigned int mPerformanceTimeStampOutput;       ///< performance time stamp output ( bitmask)
273   unsigned int mPanGestureLoggingLevel;           ///< pan-gesture log level
274   int mPanGesturePredictionMode;                  ///< prediction mode for pan gestures
275   int mPanGesturePredictionAmount;                ///< prediction amount for pan gestures
276   int mPanGestureMaxPredictionAmount;             ///< maximum prediction amount for pan gestures
277   int mPanGestureMinPredictionAmount;             ///< minimum prediction amount for pan gestures
278   int mPanGesturePredictionAmountAdjustment;      ///< adjustment of prediction amount for pan gestures
279   int mPanGestureSmoothingMode;                   ///< prediction mode for pan gestures
280   float mPanGestureSmoothingAmount;               ///< prediction amount for pan gestures
281   int mPanMinimumDistance;                        ///< minimum distance required before pan starts
282   int mPanMinimumEvents;                          ///< minimum events required before pan starts
283   int mGlesCallTime;                              ///< time in seconds between status updates
284   unsigned int mWindowWidth;                      ///< width of the window
285   unsigned int mWindowHeight;                     ///< height of the window
286
287   Dali::Integration::Log::LogFunction mLogFunction;
288
289   // Undefined copy constructor.
290   EnvironmentOptions( const EnvironmentOptions& );
291
292   // Undefined assignment operator.
293   EnvironmentOptions& operator=( const EnvironmentOptions& );
294
295 };
296
297 } // Adaptor
298 } // Internal
299 } // Dali
300
301 #endif // __DALI_INTERNAL_ADAPTOR_ENVIRONMENT_OPTIONS_H__