From: InHong Han Date: Tue, 20 Jul 2021 10:07:40 +0000 (+0900) Subject: Add auto_popup type to distinguish it from option_popup X-Git-Tag: accepted/tizen/unified/20210804.043630~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F43%2F262143%2F1;p=platform%2Fcore%2Fuifw%2Fise-default-nui.git Add auto_popup type to distinguish it from option_popup Change-Id: I7f4cf038c2560b559d37b8bf694634b08f5d4873 --- diff --git a/ISEDefaultNUI/ISEDefaultNUI.cs b/ISEDefaultNUI/ISEDefaultNUI.cs index e648223..d16d541 100644 --- a/ISEDefaultNUI/ISEDefaultNUI.cs +++ b/ISEDefaultNUI/ISEDefaultNUI.cs @@ -131,6 +131,7 @@ namespace ISEDefaultNUI private static void Hide(InputMethodEditor.ContextId a) { + navigator.Pop(); } static void Main(string[] args) diff --git a/ISEDefaultNUI/Interop/Interop.SclNui.cs b/ISEDefaultNUI/Interop/Interop.SclNui.cs index b06f93f..d5d6c3b 100644 --- a/ISEDefaultNUI/Interop/Interop.SclNui.cs +++ b/ISEDefaultNUI/Interop/Interop.SclNui.cs @@ -172,7 +172,7 @@ internal static partial class Interop bool fill, int fill_color_r, int fill_color_g, int fill_color_b, int fill_color_a, int type, IntPtr user_data); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void UpdateWindowCallback(int x, int y, int width, int height, IntPtr user_data); + internal delegate void UpdateWindowCallback(int type, int x, int y, int width, int height, IntPtr user_data); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] internal delegate int KeyClickEventCallback(IntPtr eventDesc); @@ -220,7 +220,7 @@ internal static partial class Interop internal static extern int SclNuiSetDrawRectangleCb(DrawRectangleCallback callbackFunction, IntPtr userData); [DllImport(Libraries.SclNui, EntryPoint = "scl_controller_mouse_press")] - internal static extern int SclControllerMousePress(int x, int y); + internal static extern int SclControllerMousePress(int window_type, int x, int y); [DllImport(Libraries.SclNui, EntryPoint = "scl_controller_mouse_release")] internal static extern int SclControllerMouseRelease(int x, int y); diff --git a/ISEDefaultNUI/PopupWindow.cs b/ISEDefaultNUI/PopupWindow.cs index 4d56995..abf5f06 100644 --- a/ISEDefaultNUI/PopupWindow.cs +++ b/ISEDefaultNUI/PopupWindow.cs @@ -11,12 +11,14 @@ namespace ISEDefaultNUI private List imageList; private List labelList; private bool isShowing; + private WindowAttribute.WindowType type; private PopupWindow() { imageList = new List(); labelList = new List(); isShowing = false; + type = WindowAttribute.WindowType.Popup; } public static PopupWindow Instance @@ -30,6 +32,12 @@ namespace ISEDefaultNUI } } + public WindowAttribute.WindowType Type + { + get => type; + set { type = value; } + } + public void Show(View parent) { isShowing = true; diff --git a/ISEDefaultNUI/SCLNUI.cs b/ISEDefaultNUI/SCLNUI.cs index 47e8053..173c917 100644 --- a/ISEDefaultNUI/SCLNUI.cs +++ b/ISEDefaultNUI/SCLNUI.cs @@ -51,14 +51,6 @@ namespace ISEDefaultNUI MAX_LABEL_ALIGNMENT } - enum WindowType - { - Keypad = 0, - Magnifier, - Dim, - Popup, - } - enum NotificationType { PopupOpening = 0, @@ -101,20 +93,33 @@ namespace ISEDefaultNUI string FontName = Marshal.PtrToStringAnsi(font_name); LabelAlignment align = (LabelAlignment)label_align; string keystr = Marshal.PtrToStringAnsi(str); - WindowType windowType = (WindowType)type; + WindowAttribute.WindowType windowType = (WindowAttribute.WindowType)type; switch (windowType) { - case WindowType.Keypad: + case WindowAttribute.WindowType.Keypad: { - keyText = draw_text(FontName, font_size, is_italic, is_bold, r, g, b, a, - keystr, pos_x, pos_y, width, height, - align, padding_x, padding_y, inner_width, inner_height); - Add(keyText); - label_list.Add(keyText); + TextLabel textLabel = label_list.Find(label => label.Text.Equals(keystr) && label.Position.X == pos_x && + label.Position.Y == pos_y); + + if (textLabel == null) + { + keyText = draw_text(FontName, font_size, is_italic, is_bold, r, g, b, a, + keystr, pos_x, pos_y, width, height, + align, padding_x, padding_y, inner_width, inner_height); + + Add(keyText); + label_list.Add(keyText); + } + + if (popup.IsExists() && popup.Type == WindowAttribute.WindowType.Popup) + { + int dimOrder = DimView.Instance.GetDimView().SiblingOrder; + keyText.SiblingOrder = dimOrder - 1; + } break; } - case WindowType.Magnifier: + case WindowAttribute.WindowType.Magnifier: { WindowAttribute.Position magnifierPosition = magnifier.GetPosition(); TextLabel magnifierText = draw_text(FontName, font_size, is_italic, is_bold, r, g, b, a, @@ -123,7 +128,8 @@ namespace ISEDefaultNUI magnifier.AddLabel(magnifierText); break; } - case WindowType.Popup: + case WindowAttribute.WindowType.Popup: + case WindowAttribute.WindowType.AutoPopup: { TextLabel popupText = draw_text(FontName, font_size, is_italic, is_bold, r, g, b, a, keystr, pos_x, pos_y, width, height, @@ -141,46 +147,49 @@ namespace ISEDefaultNUI _draw_image_cb = (IntPtr image_path, int dest_x, int dest_y, int dest_weight, int dest_height, int src_x, int src_y, int src_width, int src_height, int type, IntPtr user_data) => { string image_path_str = Marshal.PtrToStringAnsi(image_path); - WindowType windowType = (WindowType)type; + WindowAttribute.WindowType windowType = (WindowAttribute.WindowType)type; Log.Info("NUIIME", "image: " + image_path_str + ", x: " + dest_x + ", y: " + dest_y); if (image_path_str.EndsWith("/")) return; switch (windowType) { - case WindowType.Keypad: + case WindowAttribute.WindowType.Keypad: { - if (popup.IsShowing()) - { - ImageView imageView = image_list.Find(image => image.Position.X == dest_x && image.Position.Y == dest_y && + ImageView imageView = image_list.Find(image => image.Position.X == dest_x && image.Position.Y == dest_y && image.Size.Width == dest_weight && image.Size.Height == dest_height); - if (imageView != null) - { - imageView.ResourceUrl = image_path_str; - int dimOrder = DimView.Instance.GetDimView().SiblingOrder; - imageView.SiblingOrder = dimOrder - 1; - } - } - else + if (imageView == null) { imageView = draw_image(image_path_str, dest_x, dest_y, dest_weight, dest_height, src_x, src_y, src_width, src_height); Add(imageView); image_list.Add(imageView); } + else + { + imageView.ResourceUrl = image_path_str; + } + + if (popup.IsExists() && popup.Type == WindowAttribute.WindowType.Popup) + { + int dimOrder = DimView.Instance.GetDimView().SiblingOrder; + imageView.SiblingOrder = dimOrder - 1; + } break; } - case WindowType.Magnifier: + case WindowAttribute.WindowType.Magnifier: { WindowAttribute.Position magnifierPosition = magnifier.GetPosition(); ImageView magnifierImageView = draw_image(image_path_str, magnifierPosition.X, magnifierPosition.Y, dest_weight, dest_height, src_x, src_y, src_width, src_height); magnifier.AddImage(magnifierImageView); break; } - case WindowType.Popup: + case WindowAttribute.WindowType.Popup: + case WindowAttribute.WindowType.AutoPopup: { ImageView popupImageView = draw_image(image_path_str, dest_x, dest_y, dest_weight, dest_height, src_x, src_y, src_width, src_height); popup.AddImage(popupImageView); + popup.Type = windowType; break; } default: @@ -195,23 +204,24 @@ namespace ISEDefaultNUI Log.Info("NUIIME", "rectangle: x=" + pos_x + ", y=" + pos_y + ", w=" + width + ", h=" + height); Log.Info("NUIIME", "fill: " + fill + ", r=" + fill_color_r + ", g=" + fill_color_g + ", b=" + fill_color_b + ", a=" + fill_color_a); - WindowType windowType = (WindowType)type; + WindowAttribute.WindowType windowType = (WindowAttribute.WindowType)type; switch (windowType) { - case WindowType.Keypad: + case WindowAttribute.WindowType.Keypad: { rectView = draw_rectangle(pos_x, pos_y, width, height, fill, fill_color_r, fill_color_g, fill_color_b, fill_color_a); Add(rectView); break; } - case WindowType.Dim: + case WindowAttribute.WindowType.Dim: { dim.SetWindowColor(new WindowAttribute.BackgroundColor(fill_color_r, fill_color_g, fill_color_b, fill_color_a)); dim.SetPosition(pos_x, pos_y); - dim.SetSize(720, 442); + dim.SetSize(Window.Instance.Size.Width, Window.Instance.Size.Height); break; } - case WindowType.Popup: + case WindowAttribute.WindowType.Popup: + case WindowAttribute.WindowType.AutoPopup: { break; } @@ -221,12 +231,22 @@ namespace ISEDefaultNUI }; SclNuiSetDrawRectangleCb(_draw_rectangle_cb, (IntPtr)null); - _update_window_cb = (int x, int y, int width, int height, IntPtr user_data) => + _update_window_cb = (int type, int x, int y, int width, int height, IntPtr user_data) => { - Log.Info("NUIIME", "update_window"); - - if (!popup.IsShowing()) - UpdateArea(x, y, width, height); + WindowAttribute.WindowType windowType = (WindowAttribute.WindowType)type; + switch(windowType) + { + case WindowAttribute.WindowType.Keypad: + { + if (x + y + width + height == 0) + dispose_all_objects(); + break; + } + case WindowAttribute.WindowType.AutoPopup: + { + break; + } + } if (magnifier.IsExists() && !magnifier.IsRunning()) magnifier.Show(this); @@ -277,7 +297,6 @@ namespace ISEDefaultNUI } beforePositionX = 0; - afterPositionX = 0; Marshal.FreeHGlobal(pnt); @@ -287,6 +306,11 @@ namespace ISEDefaultNUI _onDragStateChangedEvent = (IntPtr eventDesc) => { + IntPtr pnt = Marshal.AllocHGlobal(Marshal.SizeOf(eventDesc)); + Marshal.StructureToPtr(eventDesc, pnt, false); + SclNuiEventDesc eventInfo; + eventInfo = (SclNuiEventDesc)Marshal.PtrToStructure(pnt, typeof(SclNuiEventDesc)); + return (int)SclNuiEventReturnType.PassOn; }; SclNuiDragStateChangedCb(_onDragStateChangedEvent); @@ -299,7 +323,8 @@ namespace ISEDefaultNUI { if (popup.IsExists() && !popup.IsShowing()) { - dim.Show(this); + if (popup.Type == WindowAttribute.WindowType.Popup) + dim.Show(this); popup.Show(this); } } @@ -338,9 +363,9 @@ namespace ISEDefaultNUI _updateWindowPositionChangedEvent = (int type, int x, int y, int rotationX, int rotationY, IntPtr user_data) => { - WindowType windowType = (WindowType)type; + WindowAttribute.WindowType windowType = (WindowAttribute.WindowType)type; - if (windowType == WindowType.Magnifier) + if (windowType == WindowAttribute.WindowType.Magnifier) { magnifier.SetPosition(new WindowAttribute.Position(x, y, rotationX, rotationY)); } @@ -562,7 +587,10 @@ namespace ISEDefaultNUI magnifier.Hide(); Log.Info("NUIIME", "[MOUSE DOWN] x=" + e.Touch.GetScreenPosition(0).X + ", y=" + e.Touch.GetScreenPosition(0).Y); - SclControllerMousePress((int)e.Touch.GetScreenPosition(0).X, (int)e.Touch.GetScreenPosition(0).Y); + if (popup.IsShowing()) + SclControllerMousePress((int)WindowAttribute.WindowType.Popup, (int)e.Touch.GetScreenPosition(0).X, (int)e.Touch.GetScreenPosition(0).Y); + else + SclControllerMousePress((int)WindowAttribute.WindowType.Keypad, (int)e.Touch.GetScreenPosition(0).X, (int)e.Touch.GetScreenPosition(0).Y); beforePositionX = (int)e.Touch.GetScreenPosition(0).X; break; } diff --git a/ISEDefaultNUI/WindowAttribute.cs b/ISEDefaultNUI/WindowAttribute.cs index ee1cc1b..5a18503 100644 --- a/ISEDefaultNUI/WindowAttribute.cs +++ b/ISEDefaultNUI/WindowAttribute.cs @@ -8,6 +8,15 @@ namespace ISEDefaultNUI { public class WindowAttribute { + public enum WindowType + { + Keypad = 0, + Magnifier, + Dim, + Popup, + AutoPopup, + } + public class BackgroundColor { public int Red;