[NUI] Add Window validation check
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / Common / DaliEnumConstants.cs
1 /*
2  * Copyright (c) 2021 Samsung Electronics Co., Ltd.
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.Diagnostics;
19 using System.Runtime.CompilerServices;
20
21 namespace Tizen.NUI
22 {
23     namespace Constants
24     {
25         /// <summary>
26         /// Enumeration for texture types.
27         /// </summary>
28         /// <since_tizen> 3 </since_tizen>
29         public enum TextureType
30         {
31             /// <summary>
32             /// One 2D image
33             /// </summary>
34             /// <since_tizen> 3 </since_tizen>
35             Texture2D = Tizen.NUI.TextureType.TEXTURE_2D,
36             /// <summary>
37             /// Six 2D images arranged in a cube-shape
38             /// </summary>
39             /// <since_tizen> 3 </since_tizen>
40             TextureCube = Tizen.NUI.TextureType.TEXTURE_CUBE
41         }
42
43         /// <summary>
44         /// Enumeration for the direction
45         /// </summary>
46         /// <since_tizen> 3 </since_tizen>
47         public struct Direction
48         {
49             /// <summary>
50             /// Enumeration for the Direction types.
51             /// </summary>
52             /// <since_tizen> 3 </since_tizen>
53             public enum Type
54             {
55                 /// <summary>
56                 /// from Left to Right
57                 /// </summary>
58                 /// <since_tizen> 3 </since_tizen>
59                 LeftToRight = Tizen.NUI.DirectionType.LEFT_TO_RIGHT,
60                 /// <summary>
61                 /// from Right to Left
62                 /// </summary>
63                 /// <since_tizen> 3 </since_tizen>
64                 RightToLeft = Tizen.NUI.DirectionType.RIGHT_TO_LEFT
65             }
66         }
67
68         /// <summary>
69         /// Tooltip
70         /// </summary>
71         /// <since_tizen> 3 </since_tizen>
72         public struct Tooltip
73         {
74             /// <summary>
75             /// The properties used for a Tooltip.
76             /// </summary>
77             /// <since_tizen> 3 </since_tizen>
78             [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1716: Identifiers should not match keywords")]
79             public struct Property
80             {
81                 /// <summary>
82                 /// The content to display.
83                 /// </summary>
84                 /// <since_tizen> 3 </since_tizen>
85                 public static readonly int Content = NDalic.TooltipContent;
86                 /// <summary>
87                 /// The layout of the content.
88                 /// </summary>\
89                 /// <since_tizen> 3 </since_tizen>
90                 public static readonly int Layout = NDalic.TooltipLayout;
91                 /// <summary>
92                 /// Time to wait in seconds before a tooltip is shown while the is movement is within the allowed threshold.
93                 /// </summary>
94                 /// <since_tizen> 3 </since_tizen>
95                 public static readonly int WaitTime = NDalic.TooltipWaitTime;
96                 /// <summary>
97                 /// The background of the tooltip.
98                 /// </summary>
99                 /// <since_tizen> 3 </since_tizen>
100                 public static readonly int Background = NDalic.TooltipBackground;
101                 /// <summary>
102                 /// The tail used by the tooltip.
103                 /// </summary>
104                 /// <since_tizen> 3 </since_tizen>
105                 public static readonly int Tail = NDalic.TooltipTail;
106                 /// <summary>
107                 /// The position of the tooltip in relation to the control.
108                 /// </summary>
109                 /// <since_tizen> 3 </since_tizen>
110                 public static readonly int Position = NDalic.TooltipPosition;
111                 /// <summary>
112                 /// If Tooltip::Position::HOVER_POINT is used for the POSITION, then this is the offset the tooltip is displayed at from the hover point.
113                 /// </summary>
114                 /// <since_tizen> 3 </since_tizen>
115                 public static readonly int HoverPointOffset = NDalic.TooltipHoverPointOffset;
116                 /// <summary>
117                 /// The movement threshold allowed before showing (or hiding a popup).
118                 /// </summary>
119                 /// <since_tizen> 3 </since_tizen>
120                 public static readonly int MovementThreshold = NDalic.TooltipMovementThreshold;
121                 /// <summary>
122                 /// If true, the tooltip will disappear after hover movement beyond a certain distance.
123                 /// </summary>
124                 /// <since_tizen> 3 </since_tizen>
125                 public static readonly int DisappearOnMovement = NDalic.TooltipDisappearOnMovement;
126             }
127
128             /// <summary>
129             /// Background Property
130             /// </summary>
131             /// <since_tizen> 3 </since_tizen>
132             public struct BackgroundProperty
133             {
134                 /// <summary>
135                 /// The image to use as the background.
136                 /// </summary>
137                 /// <since_tizen> 3 </since_tizen>
138                 public static readonly int Visual = NDalic.TooltipBackgroundVisual;
139                 /// <summary>
140                 /// The size of the borders in the order: left, right, bottom, top.
141                 /// </summary>
142                 /// <since_tizen> 3 </since_tizen>
143                 public static readonly int Border = NDalic.TooltipBackgroundBorder;
144             }
145
146             /// <summary>
147             /// The properties of the tail used by the tooltip.
148             /// </summary>
149             /// <since_tizen> 3 </since_tizen>
150             public struct TailProperty
151             {
152                 /// <summary>
153                 /// Whether to show the tail or not.
154                 /// </summary>
155                 /// <since_tizen> 3 </since_tizen>
156                 public static readonly int Visibility = NDalic.TooltipTailVisibility;
157                 /// <summary>
158                 /// The image used for the tail if it is above the tooltip.
159                 /// </summary>
160                 /// <since_tizen> 3 </since_tizen>
161                 public static readonly int AboveVisual = NDalic.TooltipTailAboveVisual;
162                 /// <summary>
163                 /// The image used for the tail if it is below the tooltip.
164                 /// </summary>
165                 /// <since_tizen> 3 </since_tizen>
166                 public static readonly int BelowVisual = NDalic.TooltipTailBelowVisual;
167             }
168         }
169
170         /// <summary>
171         /// Enumeration for stereoscopic view modes.
172         /// </summary>
173         /// <since_tizen> 3 </since_tizen>
174         /// <remarks>
175         /// Deprecated.(API Level 6) Not used.
176         /// </remarks>
177         [Obsolete("Do not use this ViewMode(Deprecated).")]
178         public enum ViewMode
179         {
180             /// <summary>
181             /// Monoscopic (single camera). This is the default.
182             /// </summary>
183             /// <since_tizen> 3 </since_tizen>
184             /// <remarks>
185             /// Deprecated.(API Level 6) Not used.
186             /// </remarks>
187             [Obsolete("Do not use this ViewMode.Mono(Deprecated).")]
188             Mono,
189             /// <summary>
190             /// Stereoscopic. Frame buffer is split horizontally with the left and right camera views in their respective sides.
191             /// </summary>
192             /// <since_tizen> 3 </since_tizen>
193             /// <remarks>
194             /// Deprecated.(API Level 6) Not used.
195             /// </remarks>
196             [Obsolete("Do not use this ViewMode.StereoHorizontal(Deprecated).")]
197             StereoHorizontal,
198             /// <summary>
199             /// Stereoscopic. Frame buffer is split vertically with the left camera view at the top and the right camera view at the bottom.
200             /// </summary>
201             /// <since_tizen> 3 </since_tizen>
202             /// <remarks>
203             /// Deprecated.(API Level 6) Not used.
204             /// </remarks>
205             [Obsolete("Do not use this ViewMode.StereoVertical(Deprecated).")]
206             StereoVertical,
207             /// <summary>
208             /// Stereoscopic. Left/Right camera views are rendered into the framebuffer on alternate frames.
209             /// </summary>
210             /// <since_tizen> 3 </since_tizen>
211             /// <remarks>
212             /// Deprecated.(API Level 6) Not used.
213             /// </remarks>
214             [Obsolete("Do not use this ViewMode.StereoInterlaced(Deprecated).")]
215             StereoInterlaced
216         }
217
218     } // namespace Constants
219
220
221     internal class NUILog
222     {
223         [Conditional("NUI_DEBUG_ON")]
224         public static void Debug(string msg,
225             [CallerLineNumber] int lineNum = 0,
226             [CallerMemberName] string caller = null,
227             [CallerFilePath] string file = null
228         )
229         {
230             Tizen.Log.Error("NUI", $"{msg} (at line {lineNum} of {caller} in {file})\n");
231         }
232
233         public static void Error(string msg,
234             [CallerLineNumber] int lineNum = 0,
235             [CallerMemberName] string caller = null,
236             [CallerFilePath] string file = null
237         )
238         {
239             Tizen.Log.Error("NUI", $"{msg} (at line {lineNum} of {caller} in {file})\n");
240         }
241
242         public static void ErrorBacktrace(string msg,
243             [CallerLineNumber] int lineNum = 0,
244             [CallerMemberName] string caller = null,
245             [CallerFilePath] string file = null
246         )
247         {
248             Tizen.Log.Error("NUI", $"[ERR]{msg} (at line {lineNum} of {caller} in {file})\n");
249             Tizen.Log.Error("NUI", $"[ERR] Back Trace =>");
250             global::System.Diagnostics.StackTrace st = new global::System.Diagnostics.StackTrace(true);
251             for (int i = 0; i < st.FrameCount; i++)
252             {
253                 global::System.Diagnostics.StackFrame sf = st.GetFrame(i);
254                 Tizen.Log.Error("NUI", " Method " + sf.GetMethod());
255             }
256         }
257     }
258
259 }