Inheritance: ScriptGUI.Widget
Ejemplo n.º 1
0
        unsafe internal static void OnStartDrag(DDContainer widget, DragEventArg arg)
        {
            DDItemInfo item_info = new DDItemInfo();

            SetItemInfo(widget, ref arg, ref item_info);
            widget.mHandleStartDrag(widget.Name, item_info, ref *((bool *)arg.result.ToPointer()));
        }
Ejemplo n.º 2
0
        internal static void SetItemInfo(DDContainer sender, ref DragEventArg arg, ref DDItemInfo item_info)
        {
            _DDItemInfo _info = (_DDItemInfo)Util.PtrToStruct <_DDItemInfo>(arg.DDItemInfo);

            item_info.receiver_index = _info.receiver_index;
            item_info.sender_index   = _info.sender_index;

            item_info.sender = sender.Name;

            if (_info.receiver == IntPtr.Zero)
            {
                item_info.receiver = null;
            }
            item_info.receiver = Widget.GetName(_info.receiver);
        }
Ejemplo n.º 3
0
        internal static void OnDragWidgetInfo(DDContainer widget, RequestDragWidgetInfoEventArg arg)
        {
            FString layout;
            FString item;

            widget.mHandleDragWidgetInfo(widget.Name, out layout, out item, arg.Dimension);
            Widget wd = null;

            if (null != layout && null != item)
            {
                ExecuteResult ret = GUI.FindWidget(layout, item, out wd);
                if (ExecuteResult.Success == ret)
                {
                    arg.Item = wd.Instance.Ptr;
                }
            }
        }
Ejemplo n.º 4
0
        internal static Widget CreateWidget(Instance inst, FString name, Layout parent_layout)
        {
            WidgetType type   = ICall_getType(inst.Ptr);
            Widget     widget = null;

            switch (type)
            {
            case WidgetType.Widget:
                widget = new Widget(inst, name, parent_layout, WidgetType.Widget);
                break;

            case WidgetType.ImageBox:
                widget = new ImageBox(inst, name, parent_layout);
                break;

            case WidgetType.Window:
                widget = new Window(inst, name, parent_layout);
                break;

            case WidgetType.TextBox:
                widget = new TextBox(inst, name, parent_layout);
                break;

            case WidgetType.ListBox:
                widget = new ListBox(inst, name, parent_layout);
                break;

            case WidgetType.Button:
                widget = new Button(inst, name, parent_layout);
                break;

            case WidgetType.EditBox:
                widget = new EditBox(inst, name, parent_layout);
                break;

            case WidgetType.ComboBox:
                widget = new ComboBox(inst, name, parent_layout);
                break;

            case WidgetType.ScrollBar:
                widget = new ScrollBar(inst, name, parent_layout);
                break;

            case WidgetType.DDContainer:
                widget = new DDContainer(inst, name, parent_layout);
                break;

            case WidgetType.ItemBox:
                widget = new ItemBox(inst, name, parent_layout);
                break;

            case WidgetType.Canvas:
                widget = new Canvas(inst, name, parent_layout);
                break;

            default:
                widget = new Widget(inst, name, parent_layout, WidgetType.Unknown);
                break;
            }
            return(widget);
        }
Ejemplo n.º 5
0
        internal static Widget CreateWidget(Instance inst, FString name, Layout parent_layout)
        {
            WidgetType type = ICall_getType(inst.Ptr);

            Widget widget = null;
            switch (type)
            {
                case WidgetType.Widget:
                    widget = new Widget(inst, name, parent_layout, WidgetType.Widget);
                    break;
                case WidgetType.ImageBox:
                    widget = new ImageBox(inst, name, parent_layout);
                    break;
                case WidgetType.Window:
                    widget = new Window(inst, name, parent_layout);
                    break;
                case WidgetType.TextBox:
                    widget = new TextBox(inst, name, parent_layout);
                    break;
                case WidgetType.ListBox:
                    widget = new ListBox(inst, name, parent_layout);
                    break;
                case WidgetType.Button:
                    widget = new Button(inst, name, parent_layout);
                    break;
                case WidgetType.EditBox:
                    widget = new EditBox(inst, name, parent_layout);
                    break;
                case WidgetType.ComboBox:
                    widget = new ComboBox(inst, name, parent_layout);
                    break;

                case WidgetType.ScrollBar:
                    widget = new ScrollBar(inst, name, parent_layout);
                    break;
                case WidgetType.DDContainer:
                    widget = new DDContainer(inst, name, parent_layout);
                    break;
                case WidgetType.ItemBox:
                    widget = new ItemBox(inst, name, parent_layout);
                    break;
                case WidgetType.Canvas:
                    widget = new Canvas(inst, name, parent_layout);
                    break;
                default:
                    widget = new Widget(inst, name, parent_layout, WidgetType.Unknown);
                    break;
            }
            return widget;
        }
Ejemplo n.º 6
0
 internal static void OnChangeDDState(DDContainer widget, ChangeDDStateEventArg arg)
 {
     widget.mHandleChangeDDState(widget.Name, arg.State);
 }
Ejemplo n.º 7
0
        // ----------------------- 模板,勿删 -----------------------------------------
        //internal static void On(Widget widget, EventArg arg)
        //{
        //    widget.mHandle(widget.Name);
        //}
        //internal event Event. Event
        //{
        //    add
        //    {
        //        if (null == )
        //        {
        //            if (ICall_appendEvent(this, mInstance.Ptr, EventType.))
        //            {
        //                += value;
        //            }
        //        }
        //    }
        //    remove
        //    {
        //        -= value;
        //        if (null == )
        //        {
        //            ICall_removeEvent(this, mInstance.Ptr, EventType.);
        //        }
        //    }
        //}
        //protected Event. mHandle;



        unsafe private static void onEvent(Widget widget, IntPtr int_ptr)
        {
            EventArg arg = Util.PtrToStruct <EventArg>(int_ptr);

            switch (arg.EventType)
            {
            case EventType.MouseButtonClick:
            {
                Widget.OnMouseButtonClick(widget, Util.PtrToStruct <EventArg>(int_ptr));       //
            }
            break;

            case EventType.MouseButtonPressed:
            {
                Widget.OnMouseButtonPressed(widget, Util.PtrToStruct <MouseButtonEventArg>(int_ptr));
            }
            break;

            case EventType.MouseButtonReleased:
            {
                Widget.OnMouseButtonReleased(widget, Util.PtrToStruct <MouseButtonEventArg>(int_ptr));
            }
            break;

            case EventType.MouseButtonDoubleClick:
            {
                Widget.OnMouseButtonDoubleClick(widget, Util.PtrToStruct <EventArg>(int_ptr));
            }
            break;

            case EventType.MouseLostFocus:
            {
                Widget.OnMouseLostFocus(widget, Util.PtrToStruct <FocusEventArg>(int_ptr));
            }
            break;

            case EventType.MouseSetFocus:
            {
                Widget.OnMouseSetFocus(widget, Util.PtrToStruct <FocusEventArg>(int_ptr));
            }
            break;

            case EventType.MouseDrag:
            {
                Widget.OnMouseDrag(widget, Util.PtrToStruct <MouseDragEventArg>(int_ptr));
            }
            break;

            case EventType.MouseMove:
            {
                Widget.OnMouseMove(widget, Util.PtrToStruct <MouseMoveEventArg>(int_ptr));
            }
            break;

            case EventType.MouseWheel:
            {
                Widget.OnMouseWheel(widget, Util.PtrToStruct <MouseWheelEventArg>(int_ptr));
            }
            break;

            case EventType.KeyLostFocus:
            {
                Widget.OnKeyLostFocus(widget, Util.PtrToStruct <FocusEventArg>(int_ptr));
            }
            break;

            case EventType.KeySetFocus:
            {
                Widget.OnKeySetFocus(widget, Util.PtrToStruct <FocusEventArg>(int_ptr));
            }
            break;

            case EventType.KeyButtonPressed:
            {
                Widget.OnKeyButtonPressed(widget, Util.PtrToStruct <KeyButtonPressedEventArg>(int_ptr));
            }
            break;

            case EventType.KeyButtonReleased:
            {
                Widget.OnKeyButtonReleased(widget, Util.PtrToStruct <KeyButtonReleasedEventArg>(int_ptr));
            }
            break;

            case EventType.RootMouseChangeFocus:
            {
                Widget.OnRootMouseChangeFocus(widget, Util.PtrToStruct <RootChangeFocusEventArg>(int_ptr));
            }
            break;

            case EventType.RootKeyChangeFocus:
            {
                Widget.OnRootKeyChangeFocus(widget, Util.PtrToStruct <RootChangeFocusEventArg>(int_ptr));
            }
            break;

            case EventType.ToolTip:
            {
                Widget.OnToolTip(widget, Util.PtrToStruct <ToolTipEventArg>(int_ptr));
            }
            break;


            case EventType.ScrollChangePosition:
            {
                ScrollBar sb = widget as ScrollBar;
                if (null != sb)
                {
                    ScrollBar.OnScrollChangePosition(sb, Util.PtrToStruct <ScrollChangePositionEventArg>(int_ptr));
                }
            }
            break;

            // --------------------------------------- DDContainer event ------------------------------------------------
            case EventType.StartDrag:
            {
                DDContainer ct = widget as DDContainer;
                if (null != ct)
                {
                    DDContainer.OnStartDrag(ct, Util.PtrToStruct <DragEventArg>(int_ptr));
                }
            }
            break;

            case EventType.RequestDrop:
            {
                DDContainer ct = widget as DDContainer;
                if (null != ct)
                {
                    DDContainer.OnRequestDrop(ct, Util.PtrToStruct <DragEventArg>(int_ptr));
                }
            }
            break;

            case EventType.DropResult:
            {
                DDContainer ct = widget as DDContainer;
                if (null != ct)
                {
                    DDContainer.OnDropResult(ct, Util.PtrToStruct <DragEventArg>(int_ptr));
                }
            }
            break;

            case EventType.ChangeDDState:
            {
                DDContainer ct = widget as DDContainer;
                if (null != ct)
                {
                    DDContainer.OnChangeDDState(ct, Util.PtrToStruct <ChangeDDStateEventArg>(int_ptr));
                }
            }
            break;

            case EventType.RequestDragWidgetInfo:
            {
                DDContainer ct = widget as DDContainer;
                if (null != ct)
                {
                    DDContainer.OnDragWidgetInfo(ct, Util.PtrToStruct <RequestDragWidgetInfoEventArg>(int_ptr));
                }
            }
            break;

            // --------------------------------------- item box event ------------------------------------------------
            case EventType.RequestCoordItem:
            {
                ItemBox ib = widget as ItemBox;
                if (null != ib)
                {
                    ItemBox.OnRequestCoordItem(ib, Util.PtrToStruct <RequestCoordWidgetItemEventArg>(int_ptr));
                }
            }
            break;

            case EventType.RequestCreateWidgetItem:
            {
                ItemBox ib = widget as ItemBox;
                if (null != ib)
                {
                    ItemBox.OnRequestCreateWidgetItem(ib, Util.PtrToStruct <RequestCreateWidgetItemEventArg>(int_ptr));
                }
            }
            break;

            case EventType.RequestDrawItem:
            {
                ItemBox ib = widget as ItemBox;
                if (null != ib)
                {
                    ItemBox.OnRequestDrawItem(ib, Util.PtrToStruct <RequestDrawItemEventArg>(int_ptr));
                }
            }
            break;

            case EventType.SelectItemAccept:
            {
                ItemBox ib = widget as ItemBox;
                if (null != ib)
                {
                    ItemBox.OnSelectItemAccept(ib, Util.PtrToStruct <ItemEventArg>(int_ptr));
                }
            }
            break;

            case EventType.ChangeItemPosition:
            {
                ItemBox ib = widget as ItemBox;
                if (null != ib)
                {
                    ItemBox.OnChangeItemPosition(ib, Util.PtrToStruct <ItemEventArg>(int_ptr));
                }
            }
            break;

            case EventType.MouseItemActivate:
            {
                ItemBox ib = widget as ItemBox;
                if (null != ib)
                {
                    ItemBox.OnMouseItemActivate(ib, Util.PtrToStruct <ItemEventArg>(int_ptr));
                }
            }
            break;

            case EventType.NotifyItem:
            {
                ItemBox ib = widget as ItemBox;
                if (null != ib)
                {
                    ItemBox.OnNotifyItem(ib, Util.PtrToStruct <NotifyItemEventArg>(int_ptr));
                }
            }
            break;

            // -------------------------------- List Box event ----------------------------------
            case EventType.ListSelectAccept:
            {
                ListBox ib = widget as ListBox;
                if (null != ib)
                {
                    ListBox.OnListSelectAccept(ib, Util.PtrToStruct <ListBoxEventArg>(int_ptr));
                }
            }
            break;

            case EventType.ListChangePosition:
            {
                ListBox ib = widget as ListBox;
                if (null != ib)
                {
                    ListBox.OnListChangePosition(ib, Util.PtrToStruct <ListBoxEventArg>(int_ptr));
                }
            }
            break;

            case EventType.ListMouseItemActivate:
            {
                ListBox ib = widget as ListBox;
                if (null != ib)
                {
                    ListBox.OnListMouseItemActivate(ib, Util.PtrToStruct <ListBoxEventArg>(int_ptr));
                }
            }
            break;

            case EventType.ListMouseItemFocus:
            {
                ListBox ib = widget as ListBox;
                if (null != ib)
                {
                    ListBox.OnListMouseItemFocus(ib, Util.PtrToStruct <ListBoxEventArg>(int_ptr));
                }
            }
            break;

            case EventType.ListChangeScroll:
            {
                ListBox ib = widget as ListBox;
                if (null != ib)
                {
                    ListBox.OnListChangeScroll(ib, Util.PtrToStruct <ListBoxEventArg>(int_ptr));
                }
            }
            break;

            // -------------------------------- Window event ----------------------------------
            case EventType.WindowButtonPressed:
            {
                Window window = widget as Window;
                if (null != window)
                {
                    Window.OnWindowButtonPressed(window, Util.PtrToStruct <WindowButtonPressedEventArg>(int_ptr));
                }
            }
            break;

            case EventType.WindowChangeCoord:
            {
                Window window = widget as Window;
                if (null != window)
                {
                    Window.OnWindowChangeCoord(window, arg);
                }
            }
            break;

            // -------------------------------- Canvas event ----------------------------------
            case EventType.PreTextureChanges:
            {
                Canvas canvas = widget as Canvas;
                if (null != canvas)
                {
                    Canvas.OnPreTextureChanges(canvas, Util.PtrToStruct <EventArg>(int_ptr));
                }
            }
            break;

            case EventType.RequestUpdateCanvas:
            {
                Canvas canvas = widget as Canvas;
                if (null != canvas)
                {
                    Canvas.OnRequestUpdateCanvas(canvas, Util.PtrToStruct <RequestUpdateCanvasEventArg>(int_ptr));
                }
            }
            break;

            default:
                break;
            }
        }
Ejemplo n.º 8
0
        internal static void SetItemInfo(DDContainer sender, ref DragEventArg arg, ref DDItemInfo item_info)
        {
            _DDItemInfo _info = (_DDItemInfo)Util.PtrToStruct<_DDItemInfo>(arg.DDItemInfo);

            item_info.receiver_index = _info.receiver_index;
            item_info.sender_index = _info.sender_index;

            item_info.sender = sender.Name;

            if (_info.receiver == IntPtr.Zero)
            {
                item_info.receiver = null;
            }
            item_info.receiver = Widget.GetName(_info.receiver);
        }
Ejemplo n.º 9
0
 internal static unsafe void OnStartDrag(DDContainer widget, DragEventArg arg)
 {
     DDItemInfo item_info = new DDItemInfo();
     SetItemInfo(widget, ref arg, ref item_info);
     widget.mHandleStartDrag(widget.Name, item_info, ref *((bool*)arg.result.ToPointer()));
 }
Ejemplo n.º 10
0
        internal static void OnDragWidgetInfo(DDContainer widget, RequestDragWidgetInfoEventArg arg)
        {
            FString layout;
            FString item;
            widget.mHandleDragWidgetInfo(widget.Name, out layout, out item, arg.Dimension);
            Widget wd = null;

            if (null != layout && null !=item)
            {
                ExecuteResult ret = GUI.FindWidget(layout, item, out wd);
                if (ExecuteResult.Success == ret)
                {
                    arg.Item = wd.Instance.Ptr;
                }
            }
        }
Ejemplo n.º 11
0
 internal static void OnChangeDDState(DDContainer widget, ChangeDDStateEventArg arg)
 {
     widget.mHandleChangeDDState(widget.Name, arg.State);
 }