Merge "New Popup implementation" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / controls / popup / confirmation-popup.h
1 #ifndef __DALI_TOOLKIT_CONFIRMATION_POPUP_H__
2 #define __DALI_TOOLKIT_CONFIRMATION_POPUP_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 // INTERNAL INCLUDES
22 #include "popup.h"
23
24 namespace Dali
25 {
26
27 namespace Toolkit
28 {
29
30 // Forward declarations
31 namespace Internal DALI_INTERNAL
32 {
33 class ConfirmationPopup;
34 }
35
36 /**
37  * @brief The ConfirmationPopup widget provides a simple interface to the Popup widget in which to
38  * create common use-case popups.
39  *
40  * ConfirmationPopup will automatically provide signals for 1 or 2 buttons.
41  * These signals are dynamically created. The controls (typically PushButtons) must be named as per the example below.
42  *
43  * Please see the programming guide for a detailed description of the ConfirmationPopup including examples.
44  *
45  * Signals (these are dynamically created upon connect).
46  * | %Signal Name          | Actor name to connect to | Property to set signal type (eg clicked) |
47  * |-----------------------|--------------------------|------------------------------------------|
48  * | control-signal-ok     | control-ok               | connect-signal-ok-selected               |
49  * | control-signal-cancel | control-cancel           | connect-signal-cancel-selected           |
50  */
51 class DALI_IMPORT_API ConfirmationPopup : public Popup
52 {
53 public:
54
55   /**
56    * @brief The start and end property ranges for this control.
57    */
58   enum PropertyRange
59   {
60     PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1 + DEFAULT_PROPERTY_MAX_COUNT_PER_DERIVATION + 1,
61     PROPERTY_END_INDEX =   PROPERTY_START_INDEX + 1000              ///< Reserve property indices
62   };
63
64   /**
65    * @brief An enumeration of properties belonging to the ConfirmationPopup class.
66    */
67   struct Property
68   {
69     enum
70     {
71       CONNECT_SIGNAL_OK_SELECTED = PROPERTY_START_INDEX, ///< name "connect-signal-ok-selected",     type std::string
72       CONNECT_SIGNAL_CANCEL_SELECTED                     ///< name "connect-signal-cancel-selected", type std::string
73     };
74   };
75
76   /**
77    * @brief An enumeration to use as indices to reference buttons.
78    */
79   enum ControlIndex
80   {
81     CONTROL_OK = 0,    ///< Index of control 1
82     CONTROL_CANCEL,    ///< Index of control 2
83   };
84
85   /**
86    * @brief Create an uninitialized ConfirmationPopup; this can be initialized with ConfirmationPopup::New().
87    *
88    * Calling member functions with an uninitialized Dali::Object is not allowed.
89    */
90   ConfirmationPopup();
91
92   /**
93    * @brief Copy constructor.
94    */
95   ConfirmationPopup( const ConfirmationPopup& confirmationPopup );
96
97   /**
98    * @brief Assignment operator.
99    */
100   ConfirmationPopup& operator=( const ConfirmationPopup& confirmationPopup );
101
102   /**
103    * @brief Destructor.
104    *
105    * This is non-virtual since derived types must not contain data or virtual methods.
106    */
107   ~ConfirmationPopup();
108
109   /**
110    * @brief Create an initialized ConfirmationPopup.
111    *
112    * @return A handle to a newly allocated Dali resource.
113    */
114   static ConfirmationPopup New();
115
116   /**
117    * @brief Downcast an Object handle to ConfirmationPopup.
118    *
119    * If handle points to a ConfirmationPopup the downcast produces valid
120    * handle. If not the returned handle is left uninitialized.
121    *
122    * @param[in] handle Handle to an object
123    * @return handle to a ConfirmationPopup or an uninitialized handle
124    */
125   static ConfirmationPopup DownCast( BaseHandle handle );
126
127 public: // Not intended for application developers
128
129   /**
130    * @brief Creates a handle using the Toolkit::Internal implementation.
131    *
132    * @param[in]  implementation  The Control implementation.
133    */
134   DALI_INTERNAL ConfirmationPopup( Internal::ConfirmationPopup& implementation );
135
136   /**
137    * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
138    *
139    * @param[in]  internal  A pointer to the internal CustomActor.
140    */
141   DALI_INTERNAL ConfirmationPopup( Dali::Internal::CustomActor* internal );
142 };
143
144 } // namespace Toolkit
145
146 } // namespace Dali
147
148 #endif // __DALI_TOOLKIT_CONFIRMATION_POPUP_H__