c0b1f7363fd2c2cbbc8378eda1cdaf6c62294725
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / common / indicator-interface.h
1 #ifndef __DALI_INTERNAL_BASE_INDICATOR_INTERFACE_H__
2 #define __DALI_INTERNAL_BASE_INDICATOR_INTERFACE_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 // EXTERNAL INCLUDES
22 #include <dali/public-api/actors/actor.h>
23
24 // INTERNAL INCLUDES
25 #include <dali/public-api/adaptor-framework/window.h>
26
27 namespace Dali
28 {
29 namespace Internal
30 {
31 namespace Adaptor
32 {
33
34 class Adaptor;
35
36 /**
37  * @brief The Indicator interface.
38  * Can be used to draw an indicator graphic generated from the platform as an overlay on
39  * top of DALi scene contents.
40  */
41 class IndicatorInterface
42 {
43 public:
44
45   /**
46    * @brief Type of indiciator
47    */
48   enum Type
49   {
50     INDICATOR_TYPE_UNKNOWN,
51     INDICATOR_TYPE_1,
52     INDICATOR_TYPE_2
53   };
54
55
56 public:
57
58   /**
59    * @brief observer for listening to indicator events
60    */
61   class Observer
62   {
63   public:
64     /**
65      * @brief Notify the observer if the indicator type changes
66      * @param[in] type The new indicator type
67      */
68     virtual void IndicatorTypeChanged( Type type ) = 0;
69
70     /**
71      * @brief Notify the observer when the upload has completed.
72      * @param[in] indicator The indicator that has finished uploading.
73      */
74     virtual void IndicatorClosed(IndicatorInterface* indicator) = 0;
75
76     /**
77      * @brief Notify the observer when the indicator visible status is changed.
78      * @param[in] isShowing Whether the indicator is visible.
79      */
80     virtual void IndicatorVisibilityChanged( bool isVisible ) = 0;
81   };
82
83
84 public:
85
86   /**
87    * @brief constructor
88    */
89   IndicatorInterface() {}
90
91   /**
92    * @brief Virtual Destructor
93    */
94   virtual ~IndicatorInterface() {}
95
96   /**
97    * @brief assign the adaptor to this object
98    * @param[in] adaptor
99    */
100   virtual void SetAdaptor(Adaptor* adaptor) = 0;
101
102   /**
103    * @brief Get the actor which contains the indicator image. Ensure that the handle is
104    * released when no longer needed.
105    * Changes from the indicator service will modify the image and resize the actor appropriately.
106    * @return The indicator actor.
107    */
108   virtual Dali::Actor GetActor() = 0;
109
110   /**
111    * Opens a new connection for the required orientation.
112    * @param[in] orientation The new orientation
113    */
114   virtual void Open( Dali::Window::WindowOrientation orientation ) = 0;
115
116   /**
117    * Close the current connection. Will respond with Observer::IndicatorClosed()
118    * when done.
119    * @note, IndicatorClosed() will be called synchronously if there's no update
120    * in progress, or asychronously if waiting for SignalUploaded )
121    */
122   virtual void Close() = 0;
123
124   /**
125    * Notify the indicator flicked.
126    */
127   virtual void Flicked() = 0;
128
129   /**
130    * Set the opacity mode of the indicator background.
131    * @param[in] mode opacity mode
132    */
133   virtual void SetOpacityMode( Dali::Window::IndicatorBgOpacity mode ) = 0;
134
135   /**
136    * Set whether the indicator is visible or not.
137    * @param[in] visibleMode visible mode for indicator bar.
138    * @param[in] forceUpdate true if want to change visible mode forcely
139    */
140   virtual void SetVisible( Dali::Window::IndicatorVisibleMode visibleMode, bool forceUpdate = false ) = 0;
141
142   /**
143    * Check whether the indicator is connected to the indicator service.
144    * @return whether the indicator is connected or not.
145    */
146   virtual bool IsConnected() = 0;
147
148   /**
149    * Send message to the indicator service.
150    * @param[in] messageDomain Message Reference number
151    * @param[in] messageId Reference number of the message this message refers to
152    * @param[in] data The data to send as part of the message
153    * @param[in] size Length of the data, in bytes, to send
154    * @return whether the message is sent successfully or not
155    */
156   virtual bool SendMessage( int messageDomain, int messageId, const void *data, int size ) = 0;
157 };
158
159 } // Adaptor
160 } // Internal
161 } // Dali
162
163 #endif