Merge "Added Application::New(..., stylesheet)" into tizen
[platform/core/uifw/dali-adaptor.git] / platform-abstractions / tizen / tizen-platform-abstraction.h
1 #ifndef __DALI_TIZEN_PLATFORM_ABSTRACTION_H__
2 #define __DALI_TIZEN_PLATFORM_ABSTRACTION_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/platform-abstraction.h>
22 #include <dali/integration-api/resource-cache.h>
23 #include <dali/public-api/common/dali-common.h>
24
25 #include <string>
26
27 namespace Dali
28 {
29
30 /**
31  * Construct a platform abstraction and return it.
32  */
33 Integration::PlatformAbstraction* CreatePlatformAbstraction();
34
35 namespace TizenPlatform
36 {
37
38 class DynamicsFactory;
39 class ResourceLoader;
40
41 /**
42  * Concrete implementation of the platform abstraction class.
43  */
44 class TizenPlatformAbstraction : public Integration::PlatformAbstraction
45 {
46
47 public: // Construction & Destruction
48
49   /**
50    * Constructor
51    */
52   TizenPlatformAbstraction();
53
54   /**
55    * Destructor
56    */
57   virtual ~TizenPlatformAbstraction();
58
59 public: // PlatformAbstraction overrides
60
61   /**
62    * @copydoc PlatformAbstraction::GetTimeMicroseconds()
63    */
64   virtual void GetTimeMicroseconds(unsigned int &seconds, unsigned int &microSeconds);
65
66   /**
67    * @copydoc PlatformAbstraction::Suspend()
68    */
69   virtual void Suspend();
70
71   /**
72    * @copydoc PlatformAbstraction::Resume()
73    */
74   virtual void Resume();
75
76   /**
77    * @copydoc PlatformAbstraction::GetClosestImageSize()
78    */
79   virtual ImageDimensions GetClosestImageSize( const std::string& filename,
80                                                ImageDimensions size,
81                                                FittingMode::Type fittingMode,
82                                                SamplingMode::Type samplingMode,
83                                                bool orientationCorrection );
84
85   /**
86    * @copydoc PlatformAbstraction::GetClosestImageSize()
87    */
88   virtual ImageDimensions GetClosestImageSize( Integration::ResourcePointer resourceBuffer,
89                                                ImageDimensions size,
90                                                FittingMode::Type fittingMode,
91                                                SamplingMode::Type samplingMode,
92                                                bool orientationCorrection );
93
94   /**
95    * @copydoc PlatformAbstraction::LoadResource()
96    */
97   virtual void LoadResource(const Integration::ResourceRequest& request);
98
99   /**
100    * @copydoc PlatformAbstraction::LoadResourceSynchronously()
101    */
102   virtual Integration::ResourcePointer LoadResourceSynchronously(const Integration::ResourceType& resourceType, const std::string& resourcePath);
103
104   /**
105    * @copydoc PlatformAbstraction::SaveResource()
106    */
107   virtual void SaveResource(const Integration::ResourceRequest& request);
108
109   /**
110    * @copydoc PlatformAbstraction::CancelLoad()
111    */
112   virtual void CancelLoad(Integration::ResourceId id, Integration::ResourceTypeId typeId);
113
114   /**
115    * @copydoc PlatformAbstraction::GetResources()
116    */
117   virtual void GetResources(Integration::ResourceCache& cache);
118
119   /**
120    * @copydoc PlatformAbstraction::IsLoading()
121    */
122   virtual bool IsLoading();
123
124   /**
125    * @copydoc PlatformAbstraction::JoinLoaderThreads()
126    */
127   virtual void JoinLoaderThreads();
128
129   /**
130    * @copydoc PlatformAbstraction::GetDefaultFontDescription()
131    */
132   virtual void GetDefaultFontDescription( std::string& family, std::string& style ) const;
133
134   /**
135    * @copydoc PlatformAbstraction::GetDefaultFontSize()
136    */
137   virtual int GetDefaultFontSize() const;
138
139   /**
140    * @copydoc PlatformAbstraction::SetDpi()
141    */
142   virtual void SetDpi (unsigned int DpiHorizontal, unsigned int DpiVertical);
143
144   /**
145    * @copydoc PlatformAbstraction::LoadFile()
146    */
147   virtual bool LoadFile( const std::string& filename, std::vector< unsigned char >& buffer ) const;
148
149   /**
150    * @copydoc PlatformAbstraction::LoadFile()
151    */
152   virtual std::string LoadFile( const std::string& filename );
153
154   /**
155    * @copydoc PlatformAbstraction::SaveFile()
156    */
157   virtual bool SaveFile(const std::string& filename, std::vector< unsigned char >& buffer) const;
158
159   /**
160    * @copydoc PlatformAbstraction::GetDynamicsFactory();
161    */
162   virtual Integration::DynamicsFactory* GetDynamicsFactory();
163
164   /**
165    * @copydoc PlatformAbstraction::LoadShaderBinFile()
166    */
167   virtual bool LoadShaderBinFile( const std::string& filename, std::vector< unsigned char >& buffer ) const;
168
169   /**
170    * Sets path for data/resource storage.
171    * @param[in] path data/resource storage path
172    */
173   void SetDataStoragePath( const std::string& path );
174
175 private:
176   ResourceLoader* mResourceLoader;
177   DynamicsFactory* mDynamicsFactory;
178   std::string mDataStoragePath;
179 };
180
181 }  // namespace TizenPlatform
182 }  // namespace Dali
183
184 #endif // __DALI_TIZEN_PLATFORM_ABSTRACTION_H__