2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://floralicense.org/license/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 * @file FUi_ResourceManager.h
19 * @brief This is the header file for _ResourceManager class.
22 * This header file contains declaration of _ResourceManager class.
23 * The ActionEvent class can call listener's method. So, when event occurred,
24 * application can handle it appropriately.
27 #ifndef _FUI_INTERNAL_RESOURCE_MANAGER_H_
28 #define _FUI_INTERNAL_RESOURCE_MANAGER_H_
30 #include <FOspConfig.h>
31 #include <FBaseString.h>
32 #include <FGrpBitmap.h>
33 #include "FUi_ControlManager.h"
35 namespace Tizen { namespace Base
40 namespace Tizen { namespace Base { namespace Collection
42 template<class Type> class ArrayListT;
45 namespace Tizen { namespace Graphics
50 class _ICoordinateSystemTransformer;
53 namespace Tizen { namespace Ui { namespace _Resource
60 namespace Tizen { namespace Ui
62 namespace Controls { namespace __Internal
64 const int OVERLAY_REGION_MIN_LENGTH = 16;
65 }}//Tizen::Ui::Controls::__Internal
67 #define GET_SHAPE_CONFIG(shapeId, orientation, x)\
68 Tizen::Ui::_ResourceManager::GetInstance()->GetShape(#shapeId, orientation, x);
70 #define GET_DIMENSION_CONFIG(dimensionId, orientation, x)\
71 Tizen::Ui::_ResourceManager::GetInstance()->GetDimension(#dimensionId, orientation, x);
73 #define GET_COLOR_CONFIG(colorId, x) \
74 Tizen::Ui::_ResourceManager::GetInstance()->GetColor(#colorId, x);
76 #define GET_BITMAP_CONFIG_N(bitmapId, pixelFormat, pOutBitmap)\
77 Tizen::Ui::_ResourceManager::GetInstance()->GetBitmapN(#bitmapId, pixelFormat, _CONTROL_ORIENTATION_PORTRAIT, pOutBitmap);
79 #define GET_STRING_CONFIG(stringId, string)\
80 Tizen::Ui::_ResourceManager::GetInstance()->GetString(#stringId, string);
82 #define GET_FIXED_VALUE_CONFIG(fixedValueId, orientation, x)\
83 Tizen::Ui::_ResourceManager::GetInstance()->GetFixedValue(#fixedValueId, orientation, x);
85 #define IS_CUSTOM_BITMAP(bitmapId) \
86 Tizen::Ui::_ResourceManager::GetInstance()->IsCustomBitmap(#bitmapId);
88 #define IS_CUSTOM_COLOR(colorId) \
89 Tizen::Ui::_ResourceManager::GetInstance()->IsCustomColor(#colorId);
92 class _OSP_EXPORT_ _ResourceManager
95 static _ResourceManager* GetInstance(void);
96 result GetBitmapN(const Tizen::Base::String& bitmapId, Tizen::Graphics::BitmapPixelFormat pixelFormat, _ControlOrientation orientation, Tizen::Graphics::Bitmap*& pBitmap);
97 result GetString(const Tizen::Base::String& stringId, Tizen::Base::String& string);
98 result GetColor(const Tizen::Base::String& colorId, Tizen::Graphics::Color& color);
99 result GetShape(const Tizen::Base::String& shapeId, _ControlOrientation orientation, int& value);
100 result GetFixedValue(const Tizen::Base::String& shapeId, _ControlOrientation orientation, int& value);
101 result GetDimension(const Tizen::Base::String& dimensionId, _ControlOrientation orientation, Tizen::Graphics::Dimension& dimension);
102 void GetThemeName(Tizen::Base::String& systemTheme, Tizen::Base::String& userTheme) const;
103 void ReloadTheme(Tizen::Base::String& themeName, bool userdefine);
104 bool IsCustomColor(const Tizen::Base::String& colorId);
105 bool IsCustomBitmap(const Tizen::Base::String& bitmapId);
109 _ResourceManager(void);
110 ~_ResourceManager(void);
111 static void CreateInstance(void);
113 _ResourceManager(const _ResourceManager& rhs);
114 _ResourceManager& operator =(const _ResourceManager& rhs);
116 enum MapContainerType
118 MAP_CONTAINER_TYPE_APP_BASE_PORTRAIT = 0,
119 MAP_CONTAINER_TYPE_APP_BASE_LANDSCAPE = 1,
120 MAP_CONTAINER_TYPE_DEFAULT_PORTRAIT = 2,
121 MAP_CONTAINER_TYPE_DEFAULT_LANDSCAPE = 3,
122 MAP_CONTAINER_TYPE_MAX = 4,
124 result GetBitmapInternalN(const Tizen::Base::String& fileName, Tizen::Graphics::BitmapPixelFormat pixelFormat, _ControlOrientation orientation, Tizen::Graphics::Bitmap*& pBitmap);
125 result GetDefaultShapeWithScaling(const Tizen::Base::String& shapeId, _ControlOrientation orientation, Tizen::Base::Integer& integer);
126 result GetDefaultShapeWithScaling(const Tizen::Base::String& shapeId, _ControlOrientation orientation, Tizen::Graphics::Dimension& dimension);
127 result LoadThemeInformation(Tizen::Base::String& systemTheme, Tizen::Base::String& userTheme);
128 bool InitializeTheme(_Resource::MapContainer& mapContainer);
129 void LoadConfig(const Tizen::Base::String& resolution, _Resource::MapContainer& mapContainer);
130 _Resource::MapContainer* GetMapContainer(MapContainerType type);
131 void SetSystemColor(void);
132 Tizen::Base::String FindImagePath(const Tizen::Base::String& fileName, int& findFolder);
133 bool GetDensityDirectory(const Tizen::Base::String directoryName, float scaleFactor);
134 bool GetResolutionDirectory(const Tizen::Base::String directoryName, float scaleFactor);
138 struct ResourceFallbackItem
141 Tizen::Base::String directoryName;
144 _Resource::StringLoader* __pStringLoader;
145 _Resource::MapContainer* __pMapContainer[MAP_CONTAINER_TYPE_MAX];
146 Tizen::Graphics::_ICoordinateSystemTransformer* __pTransformer;
147 Tizen::Base::String __appBasePortraitMode;
148 Tizen::Base::String __appBaseLandscapeMode;
149 Tizen::Base::String __targetPortraitMode;
150 Tizen::Base::String __targetLandscapeMode;
151 Tizen::Base::String __defaultPortraitMode;
152 Tizen::Base::String __defaultLandscapeMode;
153 Tizen::Base::String __systemTheme;
154 Tizen::Base::String __userTheme;
155 bool __appliedUserTheme;
161 Tizen::Base::Collection::ArrayListT<ResourceFallbackItem*>* __pFallbackList;
166 #endif // _FUI_INTERNAL_RESOURCE_MANAGER_H_