1 #ifndef __DALI_WIDGET_H__
2 #define __DALI_WIDGET_H__
5 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali/public-api/object/base-handle.h>
23 #include <dali/public-api/signals/dali-signal.h>
25 #include <dali/public-api/math/vector2.h>
26 #include <dali/public-api/math/uint-16-pair.h>
29 #include "widget-data.h"
34 namespace Internal DALI_INTERNAL
47 * @brief Widget object should be created by WidgetApplication.
50 class DALI_IMPORT_API Widget : public BaseHandle
55 * @brief Enumeration for terminate type of widget instance.
59 PERMANENT, /**< User deleted this widget from the viewer */
60 TEMPORARY, /**< Widget is deleted because of other reasons (e.g. widget process is terminated temporarily by the system) */
61 } WidgetTerminateType;
66 CREATE = 1, /**< The widget is created */
67 DESTROY = 2, /**< The widget is destroyed */
68 PAUSE = 3, /**< The widget is paused */
69 RESUME = 4, /**< The widget is resumed */
70 } WidgetLifecycleEventType;
72 typedef Uint16Pair WindowSize;
74 typedef Signal< void (WidgetData, bundle*, WindowSize) > WidgetInstanceCreateSignalType; ///< Widget instance lifecycle signal and system signal callback type
75 typedef Signal< void (WidgetData, bundle*, WidgetTerminateType) > WidgetInstanceTerminateSignalType; ///< Widget instance lifecycle signal and system signal callback type
76 typedef Signal< void (WidgetData) > WidgetInstancePauseSignalType; ///< Widget instance lifecycle signal and system signal callback type
77 typedef Signal< void (WidgetData) > WidgetInstanceResumeSignalType; ///< Widget instance lifecycle signal and system signal callback type
78 typedef Signal< void (WidgetData, WindowSize) > WidgetInstanceResizeSignalType; ///< Widget instance lifecycle signal and system signal callback type
79 typedef Signal< void (WidgetData, bundle*, int) > WidgetInstanceUpdateSignalType; ///< Widget instance lifecycle signal and system signal callback type
84 * @brief This is the constructor for Widget.
85 * @param[in] id for widget instance
86 * @return A handle to the Widget
88 static Widget New( const std::string& id );
91 * @brief The default constructor.
97 * @brief Copy Constructor.
98 * @param[in] Widget Handle to an object
100 Widget( const Widget& widget );
103 * @brief Assignment operator.
104 * @param[in] Widget Handle to an object
105 * @return A reference to this
107 Widget& operator=( const Widget& widget );
118 * @brief The user should connect to this signal to determine when they create widget instance.
119 * @return The signal to connect to
121 WidgetInstanceCreateSignalType& CreateSignal();
124 * @brief The user should connect to this signal to determine when they terminate widget instance.
125 * @return The signal to connect to
127 WidgetInstanceTerminateSignalType& TerminateSignal();
130 * @brief This signal is emitted when the language is changed on the device.
131 * @return The signal to connect to
133 WidgetInstancePauseSignalType& PauseSignal();
136 * @brief This signal is emitted when the region of the device is changed.
137 * @return The signal to connect to
139 WidgetInstanceResumeSignalType& ResumeSignal();
142 * @brief This signal is emitted when the battery level of the device is low.
143 * @return The signal to connect to
145 WidgetInstanceResizeSignalType& ResizeSignal();
148 * @brief This signal is emitted when the memory level of the device is low.
149 * @return The signal to connect to
151 WidgetInstanceUpdateSignalType& UpdateSignal();
153 public: // Not intended for application developers
156 * @brief Internal constructor.
158 explicit DALI_INTERNAL Widget(Internal::Adaptor::Widget* widget);
164 #endif // ___DALI_WIDGET_H__