MAX_LABEL_ALIGNMENT
}
- enum WindowType
- {
- Keypad = 0,
- Magnifier,
- Dim,
- Popup,
- }
-
enum NotificationType
{
PopupOpening = 0,
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,
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,
_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:
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;
}
};
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);
}
beforePositionX = 0;
-
afterPositionX = 0;
Marshal.FreeHGlobal(pnt);
_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);
{
if (popup.IsExists() && !popup.IsShowing())
{
- dim.Show(this);
+ if (popup.Type == WindowAttribute.WindowType.Popup)
+ dim.Show(this);
popup.Show(this);
}
}
_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));
}
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;
}