Release 4.0.0-preview1-00051
[platform/core/csapi/tizenfx.git] / src / Tizen.Maps / Interop / Interop.View.Object.cs
1 /*
2  * Copyright (c) 2016 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 ElmSharp;
20
21 internal static partial class Interop
22 {
23     internal enum ViewObjectType
24     {
25         Polyline, // MAPS_VIEW_OBJECT_POLYLINE
26         Polygon, // MAPS_VIEW_OBJECT_POLYGON
27         Marker, // MAPS_VIEW_OBJECT_MARKER
28         Overlay, // MAPS_VIEW_OBJECT_OVERLAY
29     }
30
31     internal enum ViewMarkerType
32     {
33         Pin, // MAPS_VIEW_MARKER_PIN
34         Sticker, // MAPS_VIEW_MARKER_STICKER
35     }
36
37     internal enum ViewOverlayType
38     {
39         Normal, // MAPS_VIEW_OVERLAY_NORMAL
40         Bubble, // MAPS_VIEW_OVERLAY_BUBBLE
41         Box, // MAPS_VIEW_OVERLAY_BOX
42     }
43
44     [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_get_type")]
45     internal static extern ErrorCode GetType(this ViewObjectHandle /* maps_view_object_h */ viewObject, out ViewObjectType /* maps_view_object_type_e */ type);
46
47     [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_set_visible")]
48     internal static extern ErrorCode SetVisible(this ViewObjectHandle /* maps_view_object_h */ viewObject, bool visible);
49
50     [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_get_visible")]
51     internal static extern ErrorCode GetVisible(this ViewObjectHandle /* maps_view_object_h */ viewObject, out bool visible);
52
53     internal class ViewObjectHandle : SafeMapsHandle
54     {
55         [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_destroy")]
56         internal static extern ErrorCode Destroy(IntPtr /* maps_view_object_h */ viewObject);
57
58         internal bool IsVisible
59         {
60             get { return NativeGet<bool>(this.GetVisible); }
61             set { NativeSet(this.SetVisible, value); }
62         }
63
64         public ViewObjectHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy)
65         {
66         }
67
68         internal static ViewObjectHandle Create(IntPtr nativeHandle, bool needToRelease)
69         {
70             return new ViewObjectHandle(nativeHandle, needToRelease);
71         }
72     }
73 }