[NUI] Add WindowMouseInOutEvent (#5242)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / Interop / Interop.FrameBroker.cs
1 /*
2  * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 using System;
18 using System.Runtime.InteropServices;
19 using Tizen.Applications;
20 using Tizen.NUI;
21
22 namespace Tizen.NUI
23 {
24     internal static partial class Interop
25     {
26         internal static partial class FrameBroker
27         {
28             internal enum ErrorCode
29             {
30                 None = Tizen.Internals.Errors.ErrorCode.None,
31                 InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter,
32                 OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory,
33                 AppNotFound = AppControlResult.AppNotFound,
34                 LaunchRejected = AppControlResult.LaunchRejected,
35                 IoError = Tizen.Internals.Errors.ErrorCode.IoError,
36                 PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied,
37             }
38
39             internal enum FrameContextErrorCode
40             {
41                 None = 0,
42                 Disqualified = 1,
43                 WrongRequest = 2,
44             }
45
46             [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
47             internal delegate void AppControlResultCallback(IntPtr request, int result, IntPtr userData);
48
49             [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
50             internal delegate void AppControlReplyCallback(IntPtr request, IntPtr reply, int result, IntPtr userData);
51
52             internal delegate void FrameContextCreateCallback(IntPtr context, IntPtr userData);
53
54             internal delegate void FrameContextResumeCallback(IntPtr context, IntPtr frame, IntPtr userData);
55
56             internal delegate void FrameContextPauseCallback(IntPtr context, IntPtr userData);
57
58             internal delegate void FrameContextDestroyCallback(IntPtr context, IntPtr userData);
59
60             internal delegate void FrameContextErrorCallback(IntPtr context, int error, IntPtr userData);
61
62             internal delegate void FrameContextUpdateCallback(IntPtr context, IntPtr frame, IntPtr userData);
63
64             [StructLayout(LayoutKind.Sequential)]
65             internal struct FrameContextLifecycleCallbacks
66             {
67                 public FrameContextCreateCallback OnCreate;
68                 public FrameContextResumeCallback OnResume;
69                 public FrameContextPauseCallback OnPause;
70                 public FrameContextDestroyCallback OnDestroy;
71                 public FrameContextUpdateCallback OnUpdate;
72                 public FrameContextErrorCallback OnError;
73             }
74
75             [DllImport(Libraries.FrameBroker, EntryPoint = "frame_context_start_animation")]
76             internal static extern ErrorCode StartAnimation(IntPtr handle);
77
78             [DllImport(Libraries.FrameBroker, EntryPoint = "frame_context_finish_animation")]
79             internal static extern ErrorCode FinishAnimation(IntPtr handle);
80
81
82             [DllImport(Libraries.FrameBroker, EntryPoint = "frame_broker_create")]
83             internal static extern ErrorCode Create(IntPtr wl2Win, ref FrameContextLifecycleCallbacks callbacks, IntPtr userData, out SafeFrameBrokerHandle handle);
84
85             [DllImport(Libraries.FrameBroker, EntryPoint = "frame_broker_destroy")]
86             internal static extern ErrorCode DangerousDestroy(IntPtr handle);
87
88             [DllImport(Libraries.FrameBroker, EntryPoint = "frame_broker_send_launch_request")]
89             internal static extern ErrorCode SendLaunchRequest(SafeFrameBrokerHandle handle, SafeAppControlHandle safeAppControlHandle, AppControlResultCallback resultCallback, AppControlReplyCallback replyCallback, IntPtr userData);
90
91             [DllImport(Libraries.FrameBroker, EntryPoint = "frame_broker_send_launch_request_to_provider")]
92             internal static extern ErrorCode SendLaunchRequestToProvider(SafeFrameBrokerHandle handle, SafeAppControlHandle safeAppControlHandle, AppControlResultCallback resultCallback, AppControlReplyCallback replyCallback, IntPtr userData);
93
94
95             internal enum FrameType
96             {
97                 RemoteSurfaceTbmSurface = 0,
98                 RemoteSurfaceImageFile = 1,
99                 SplashScreenImage = 2,
100                 SplashScreenEdje = 3,
101             }
102
103             internal enum FrameDirection
104             {
105                 Forward = 0,
106                 Backward = 1,
107             }
108
109             [DllImport(Libraries.FrameBroker, EntryPoint = "frame_get_tbm_surface")]
110             internal static extern ErrorCode GetTbmSurface(IntPtr handle, out IntPtr tbmSurface);
111
112             [DllImport(Libraries.FrameBroker, EntryPoint = "frame_get_image_file")]
113             internal static extern ErrorCode GetImageFile(IntPtr handle, out Int32 fd, out UInt32 size);
114
115             [DllImport(Libraries.FrameBroker, EntryPoint = "frame_get_file_path")]
116             internal static extern ErrorCode GetFilePath(IntPtr handle, out string filePath);
117
118             [DllImport(Libraries.FrameBroker, EntryPoint = "frame_get_file_group")]
119             internal static extern ErrorCode GetFileGroup(IntPtr handle, out string fileGroup);
120
121             [DllImport(Libraries.FrameBroker, EntryPoint = "frame_get_type")]
122             internal static extern ErrorCode GetType(IntPtr handle, out FrameType type);
123
124             [DllImport(Libraries.FrameBroker, EntryPoint = "frame_get_direction")]
125             internal static extern ErrorCode GetDirection(IntPtr handle, out FrameDirection direction);
126
127             [DllImport(Libraries.FrameBroker, EntryPoint = "frame_get_position_x")]
128             internal static extern ErrorCode GetPositionX(IntPtr handle, out Int32 x);
129
130             [DllImport(Libraries.FrameBroker, EntryPoint = "frame_get_position_y")]
131             internal static extern ErrorCode GetPositionY(IntPtr handle, out Int32 y);
132
133             [DllImport(Libraries.FrameBroker, EntryPoint = "frame_get_extra_data")]
134             internal static extern ErrorCode GetExtraData(IntPtr handle, out SafeBundleHandle safeBundleHandle);
135         }
136     }
137 }