ControlRenderer & RendererFactory for Toolkit Controls
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / renderers / renderer-factory-impl.h
1 #ifndef __DALI_TOOLKIT_RENDERER_FACTORY_IMPL_H__
2 #define __DALI_TOOLKIT_RENDERER_FACTORY_IMPL_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 // EXTERNAL INCLUDES
21 #include <dali/public-api/object/base-object.h>
22
23 // INTERNAL INCLUDES
24 #include <dali-toolkit/devel-api/controls/renderer-factory/renderer-factory.h>
25 #include <dali-toolkit/devel-api/controls/renderer-factory/control-renderer.h>
26
27 namespace Dali
28 {
29
30 namespace Toolkit
31 {
32
33 namespace Internal
34 {
35
36 class RendererFactoryCache;
37 typedef IntrusivePtr<RendererFactoryCache> RendererFactoryCachePtr;
38
39 /**
40  * @copydoc Toolkit::RendererFactory
41  */
42 class RendererFactory : public BaseObject
43 {
44
45 public:
46
47   /**
48    * @brief Constructor
49    */
50   RendererFactory();
51
52   /**
53    * @copydoc Toolkit::RenderFactory::GetControlRenderer
54    */
55   Toolkit::ControlRenderer GetControlRenderer( const Property::Map& propertyMap  );
56
57 protected:
58
59   /**
60    * A reference counted object may only be deleted by calling Unreference()
61    */
62   virtual ~RendererFactory();
63
64 private:
65
66   RendererFactoryCachePtr mFactoryCache;
67 };
68
69 } // namespace Internal
70
71 inline const Internal::RendererFactory& GetImplementation(const Toolkit::RendererFactory& factory)
72 {
73   DALI_ASSERT_ALWAYS( factory && "RendererFactory handle is empty" );
74
75   const BaseObject& handle = factory.GetBaseObject();
76
77   return static_cast<const Internal::RendererFactory&>(handle);
78 }
79
80 inline Internal::RendererFactory& GetImplementation(Toolkit::RendererFactory& factory)
81 {
82   DALI_ASSERT_ALWAYS( factory && "RendererFactory handle is empty" );
83
84   BaseObject& handle = factory.GetBaseObject();
85
86   return static_cast<Internal::RendererFactory&>(handle);
87 }
88
89 } // namespace Toolkit
90
91 } // namespace Dali
92
93 #endif /* __DALI_TOOLKIT_RENDERER_FACTORY_IMPL_H__ */