using System;
using System.Runtime.InteropServices;
-//using Samsung.Tizen.AI.Nmt;
using Tizen;
+using Tizen.Internals;
internal static partial class Interop
{
internal static string LogTag = "SclNuiCSharp";
+ internal enum SclNuiKeyType
+ {
+ None = 0, /**< none */
+ Char, /**< key that can be displayed independently */
+ Control, /**< key to use as control */
+ Modechange, /**< key to change mode*/
+ String, /**< key to be displayed as string */
+ User, /**< key to be processed by user custom function */
+ Max /* maximum number of Key type */
+ }
+
+ internal enum SclNuiEventType
+ {
+ None = 0, /**< none */
+ Press, /**< button press event */
+ Move, /**< button move event */
+ Release, /**< button release event */
+ Longpress, /**< button longpress event */
+ Repeat, /**< button repeat event */
+ Max /* maximum number of Event type */
+ }
+
+ internal enum SclNuiKeyModifier
+ {
+ None = 0, /**< none */
+ LongKey, /**< longkey event */
+ MultitapStart, /**< multitap started */
+ MultitapRepeat, /**< multitap repeated */
+ MultitapRelease, /**< multitap released */
+
+ DirectionLeft, /**< drag left */
+ DirectionRight, /**< drag right */
+ DirectionUp, /**< drag up */
+ DirectionDown, /**< drag down */
+ DirectionUpLeft, /**< drag up left */
+ DirectionUpRight, /**< drag up right */
+ DirectionDownLeft, /**< drag down left */
+ DirectionDownRight, /**< drag down right */
+
+ DirectionLeftLong, /**< drag left */
+ DirectionRightLong, /**< drag right */
+ DirectionUpLong, /**< drag up */
+ DirectionDownLong, /**< drag down */
+ DirectionUpLeftLong, /**< drag up left */
+ DirectionUpRightLong, /**< drag up right */
+ DirectionDownLeftLong, /**< drag down left */
+ DirectionDownRightLong, /**< drag down right */
+
+ DirectionLeftReturn, /**< drag left */
+ DirectionRightReturn, /**< drag right */
+ DirectionUpReturn, /**< drag up */
+ DirectionDownReturn, /**< drag down */
+ DirectionUpLeftReturn, /**< drag up left */
+ DirectionUpRightReturn, /**< drag up right */
+ DirectionDownLeftReturn, /**< drag down left */
+ DirectionDownRightReturn, /**< drag down right */
+
+ DirectionCurveUpLeft, /**< drag up left */
+ DirectionCurveUpRight, /**< drag up right */
+ DirectionCurveDownLeft, /**< drag down left */
+ DirectionCurveDownRight, /**< drag down right */
+ DirectionCurveLeftUp, /**< drag left up */
+ DirectionCurveLeftDown, /**< drag left down */
+ DirectionCurveRightUp, /**< drag right up */
+ DirectionCurveRightDown, /**< drag right down */
+
+ Toggled, /**< toggled state */
+ Max /**< maximum number of Key type */
+ }
+
+ internal enum SclNuiEventReturnType
+ {
+ PassOn = 0, /* This event needs further handling of default SCL event handler */
+ Done /* We're done with this event, do not call any other default SCL event handlers */
+ }
+
+ internal struct Point
+ {
+ internal int x;
+ internal int y;
+ }
+
+ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
+ internal struct SclNuiEventDesc
+ {
+ internal string keyValue;
+ internal ulong keyEvent;
+ internal SclNuiKeyType keyType;
+ internal SclNuiKeyModifier keyModifier;
+ internal int touchID;
+ internal int touchEventOrder;
+ internal Point MousePressedPoint;
+ internal Point MouseCurrentPoint;
+ internal Point MouseFarhestPoint;
+ internal SclNuiEventType eventType;
+ }
+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
//internal delegate void DrawTextCallback(IntPtr str, int x, int y, int w, int h, int fontsize, IntPtr userData);
//internal delegate void DrawTextCallback(SclFontInfo fontinfo, SclColor color, IntPtr str, int x, int y, int w, int h, int label_alignment, int padding_x, int padding_y, int inner_width, int inner_height, IntPtr userData);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate void UpdateWindowCallback(int x, int y, int width, int height, IntPtr user_data);
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate int KeyClickEventCallback(IntPtr eventDesc);
+
[DllImport(Libraries.SclNui, EntryPoint = "scl_nui_init")]
internal static extern int SclNuiInit(string entry_filepath);
[DllImport(Libraries.SclNui, EntryPoint = "scl_nui_set_update_window_cb")]
internal static extern int SclNuiUpdateWindowCb(UpdateWindowCallback callbackFunction, IntPtr userData);
+
+ [DllImport(Libraries.SclNui, EntryPoint = "scl_nui_set_key_click_event_cb")]
+ internal static extern int SclNuiKeyClickEventCb(KeyClickEventCallback callbackFunction);
}
}
private DrawImageCallback _draw_image_cb = null;
private DrawRectangleCallback _draw_rectangle_cb = null;
private UpdateWindowCallback _update_window_cb = null;
+ private KeyClickEventCallback _onKeyClickEvent = null;
private List<ImageView> image_list;
private List<TextLabel> label_list;
};
SclNuiUpdateWindowCb(_update_window_cb, (IntPtr)null);
+ _onKeyClickEvent = (IntPtr eventDesc) =>
+ {
+ IntPtr pnt = Marshal.AllocHGlobal(Marshal.SizeOf(eventDesc));
+ Marshal.StructureToPtr(eventDesc, pnt, false);
+ SclNuiEventDesc eventInfo;
+ eventInfo = (SclNuiEventDesc)Marshal.PtrToStructure(pnt, typeof(SclNuiEventDesc));
+
+ if (eventInfo.keyValue.Equals("OPTION"))
+ {
+ navigator.Pop();
+ KeyboardSettingPage keyboardSettingPage = new KeyboardSettingPage(navigator);
+ navigator.Push(keyboardSettingPage);
+ }
+
+ Marshal.FreeHGlobal(pnt);
+ return (int)SclNuiEventReturnType.PassOn;
+ };
+ SclNuiKeyClickEventCb(_onKeyClickEvent);
+
Window.Instance.TouchEvent += OnWindowTouched;
BackKeyPressed += (object source, EventArgs args) =>
Log.Info("NUIIME", "[MOUSE UP] x=" + e.Touch.GetScreenPosition(0).X + ", y=" + e.Touch.GetScreenPosition(0).Y);
SclControllerMouseRelease((int)e.Touch.GetScreenPosition(0).X, (int)e.Touch.GetScreenPosition(0).Y);
//mTouched = false;
-
-
- navigator.Pop();
- KeyboardSettingPage keyboardSettingPage = new KeyboardSettingPage(navigator);
- navigator.Push(keyboardSettingPage);
-
break;
}
}