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