Button Refactoring phase 1
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / buttons / push-button-impl.h
1 #ifndef __DALI_TOOLKIT_INTERNAL_PUSH_BUTTON_H__
2 #define __DALI_TOOLKIT_INTERNAL_PUSH_BUTTON_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/public-api/common/dali-vector.h>
23
24 // INTERNAL INCLUDES
25 #include <dali-toolkit/public-api/controls/buttons/push-button.h>
26 #include "button-impl.h"
27
28 namespace Dali
29 {
30
31 namespace Toolkit
32 {
33
34 namespace Internal
35 {
36
37 /**
38  * PushButton implementation class.
39  *
40  * \sa Dali::Toolkit::PushButton
41  */
42 class PushButton : public Button
43 {
44 public:
45
46   /**
47    * Create a new PushButton.
48    * @return A smart-pointer to the newly allocated PushButton.
49    */
50   static Dali::Toolkit::PushButton New();
51
52 protected: // From Button
53
54   /**
55    * Sets the Leave signal.
56    */
57   virtual void OnButtonInitialize();
58
59 protected: // From Control
60
61   /**
62    * @copydoc Control::GetNaturalSize()
63    */
64   virtual Vector3 GetNaturalSize();
65
66   /**
67    * Construct a new PushButton.
68    */
69   PushButton();
70
71   /**
72    * A reference counted object may only be deleted by calling Unreference()
73    */
74   virtual ~PushButton();
75
76 private:
77
78   // Undefined
79   PushButton( const PushButton& );
80
81   // Undefined
82   PushButton& operator=( const PushButton& );
83 };
84
85 } // namespace Internal
86
87 // Helpers for public-api forwarding methods
88
89 inline Toolkit::Internal::PushButton& GetImplementation( Toolkit::PushButton& button )
90 {
91   DALI_ASSERT_ALWAYS( button );
92
93   Dali::RefObject& handle = button.GetImplementation();
94
95   return static_cast<Toolkit::Internal::PushButton&>( handle );
96 }
97
98 inline const Toolkit::Internal::PushButton& GetImplementation( const Toolkit::PushButton& button )
99 {
100   DALI_ASSERT_ALWAYS( button );
101
102   const Dali::RefObject& handle = button.GetImplementation();
103
104   return static_cast<const Toolkit::Internal::PushButton&>( handle );
105 }
106
107 } // namespace Toolkit
108
109 } // namespace Dali
110
111 #endif // __DALI_TOOLKIT_INTERNAL_PUSH_BUTTON_H__