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