using System;
using System.Collections.Generic;
+using System.Linq;
using System.Runtime.InteropServices;
using Tizen;
using Tizen.Applications;
private UpdateWindowCallback _update_window_cb = null;
private KeyClickEventCallback _onKeyClickEvent = null;
private DragStateChangedCallback _onDragStateChangedEvent = null;
+ private EventNotificationCallback _onEventNotification = null;
private UpdateWindowPositionCallback _updateWindowPositionChangedEvent = null;
private List<ImageView> image_list;
private int afterPositionX = 0;
private MagnifierWindow magnifier = MagnifierWindow.Instance;
+ private DimView dim = DimView.Instance;
+ private PopupWindow popup = PopupWindow.Instance;
enum LabelAlignment
{
Popup,
}
+ enum NotificationType
+ {
+ PopupOpening = 0,
+ PopupOpened,
+ PopupClosing,
+ PopupClosed,
+ GestureFlick,
+ ShiftStateChange,
+ InputModeChange,
+ HighlightNavigate,
+ Max,
+ }
+
struct SclPoint
{
public int x, y;
string keystr = Marshal.PtrToStringAnsi(str);
WindowType windowType = (WindowType)type;
- if (windowType == WindowType.Magnifier)
+ switch (windowType)
{
- MagnifierPosition magnifierPosition = magnifier.GetPosition();
- TextLabel magnifierText = draw_text(FontName, font_size, is_italic, is_bold, r, g, b, a,
- keystr, magnifierPosition.X, magnifierPosition.Y, width, height,
- align, padding_x, padding_y, inner_width, inner_height);
- magnifier.AddLabel(magnifierText);
- }
- else
- {
- keyText = draw_text(FontName, font_size, is_italic, is_bold, r, g, b, a,
+ case 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);
+ Add(keyText);
+ label_list.Add(keyText);
+ break;
+ }
+ case WindowType.Magnifier:
+ {
+ WindowAttribute.Position magnifierPosition = magnifier.GetPosition();
+ TextLabel magnifierText = draw_text(FontName, font_size, is_italic, is_bold, r, g, b, a,
+ keystr, magnifierPosition.X, magnifierPosition.Y, width, height,
+ align, padding_x, padding_y, inner_width, inner_height);
+ magnifier.AddLabel(magnifierText);
+ break;
+ }
+ case WindowType.Popup:
+ {
+ TextLabel popupText = 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);
+ popup.AddLabel(popupText);
+ break;
+ }
+ default:
+ break;
}
};
SclNuiSetDrawTextCb(_draw_text_cb, (IntPtr)null);
if (image_path_str.EndsWith("/"))
return;
- if (windowType == WindowType.Magnifier)
+ switch (windowType)
{
- MagnifierPosition 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);
- }
- else
- {
- 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);
+ case WindowType.Keypad:
+ {
+ if (popup.IsShowing())
+ {
+ 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
+ {
+ 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);
+ }
+ break;
+ }
+ case 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:
+ {
+ 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);
+ break;
+ }
+ default:
+ break;
}
};
SclNuiSetDrawImageCb(_draw_image_cb, (IntPtr)null);
/* Draw rectangle */
- _draw_rectangle_cb = (int pos_x, int pos_y, int width, int height, bool fill, int fill_color_r, int fill_color_g, int fill_color_b, int fill_color_a, IntPtr user_data) =>
+ _draw_rectangle_cb = (int pos_x, int pos_y, int width, int height, bool fill, int fill_color_r, int fill_color_g, int fill_color_b, int fill_color_a, int type, IntPtr user_data) =>
{
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);
- rectView = draw_rectangle(pos_x, pos_y, width, height, fill, fill_color_r, fill_color_g, fill_color_b, fill_color_a);
- Add(rectView);
+ WindowType windowType = (WindowType)type;
+ switch (windowType)
+ {
+ case 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:
+ {
+ 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);
+ break;
+ }
+ case WindowType.Popup:
+ {
+ break;
+ }
+ default:
+ break;
+ }
};
SclNuiSetDrawRectangleCb(_draw_rectangle_cb, (IntPtr)null);
{
Log.Info("NUIIME", "update_window");
- UpdateArea(x, y, width, height);
+ if (!popup.IsShowing())
+ UpdateArea(x, y, width, height);
if (magnifier.IsExists() && !magnifier.IsRunning())
magnifier.Show(this);
};
SclNuiDragStateChangedCb(_onDragStateChangedEvent);
+ _onEventNotification = (int notificationType, IntPtr eventDesc) =>
+ {
+ NotificationType type = (NotificationType)notificationType;
+
+ if (type == NotificationType.PopupOpened)
+ {
+ if (popup.IsExists() && !popup.IsShowing())
+ {
+ dim.Show(this);
+ popup.Show(this);
+ }
+ }
+ else if (type == NotificationType.PopupClosing)
+ {
+ popup.Hide();
+ dim.Hide();
+ }
+
+ return (int)SclNuiEventReturnType.PassOn;
+ };
+ SclNuiEventNotificationCb(_onEventNotification);
+
Window.Instance.TouchEvent += OnWindowTouched;
Window.Instance.Resized += OnResized;
BackKeyPressed += (object source, EventArgs args) =>
{
- NUIApplication.Current.Exit();
+ if (popup.IsShowing())
+ {
+ popup.Hide();
+ dim.Hide();
+ }
+ else
+ {
+ NUIApplication.Current.Exit();
+ }
};
Preference.EventContext context = null;
_updateWindowPositionChangedEvent = (int type, int x, int y, int rotationX, int rotationY, IntPtr user_data) =>
{
WindowType windowType = (WindowType)type;
+
if (windowType == WindowType.Magnifier)
{
- magnifier.SetPosition(new MagnifierPosition(x, y, rotationX, rotationY));
+ magnifier.SetPosition(new WindowAttribute.Position(x, y, rotationX, rotationY));
}
};
SclNuiUpdateWindowPositionCb(_updateWindowPositionChangedEvent, (IntPtr)null);
{
Log.Info("NUIIME", "### start draw image");
-
ImageView imageView = new ImageView(image_path_str);
imageView.Position = new Position(dest_x, dest_y);
imageView.Size = new Size(dest_weight, dest_height);