Пример #1
0
        public override void Construct()
        {
            Tooltip         = Resource.Tooltip;
            MinimumSize     = new Point(32, 64);
            Border          = "border-thin";
            Background      = new TileReference("basic", 1);
            BackgroundColor = new Vector4(0, 0, 0, 1.0f);


            if (Resource != null && Resource.Icon != null && CachedDynamicSheet == null)
            {
                CachedDynamicSheet = ResourceGraphicsHelper.GetDynamicSheet(Root, Resource.Icon);
            }
            if (Resource != null && Resource.OperationIcon != null && CachedOperationIconDynamicSheet == null)
            {
                CachedOperationIconDynamicSheet = ResourceGraphicsHelper.GetDynamicSheet(Root, Resource.OperationIcon);
            }

            OnClose = (sender) =>
            {
                if (CachedDynamicSheet != null)
                {
                    CachedDynamicSheet.Discard();
                }
                if (CachedOperationIconDynamicSheet != null)
                {
                    CachedOperationIconDynamicSheet.Discard();
                }
                CachedDynamicSheet = null;
                CachedOperationIconDynamicSheet = null;
            };

            base.Construct();
        }
Пример #2
0
        public override void Construct()
        {
            Font = "font10-outline-numsonly";
            TextHorizontalAlign = HorizontalAlign.Center;
            TextVerticalAlign   = VerticalAlign.Bottom;
            TextColor           = new Vector4(1, 1, 1, 1);
            WrapText            = false;

            OnUpdate = (sender, time) =>
            {
                if (Resource != null && CachedDynamicSheet == null)
                {
                    CachedDynamicSheet = ResourceGraphicsHelper.GetDynamicSheet(Root, Resource);
                    Invalidate();
                }
            };

            OnClose = (sender) =>
            {
                if (CachedDynamicSheet != null)
                {
                    CachedDynamicSheet.Discard();
                }
                CachedDynamicSheet = null;
            };

            Root.RegisterForUpdate(this);

            base.Construct();
        }
Пример #3
0
        public override void Construct()
        {
            if (EnableDragAndDrop && CreateDraggableItem != null)
            {
                OnMouseDown = (sender, args) =>
                {
                    var draggedItem = CreateDraggableItem(this);
                    if (draggedItem != null)
                    {
                        DragAndDrop.BeginDrag(Root, draggedItem);
                    }
                }
            }
            ;


            Font = "font10-outline-numsonly";
            TextHorizontalAlign = HorizontalAlign.Center;
            TextVerticalAlign   = VerticalAlign.Bottom;
            TextColor           = new Vector4(1, 1, 1, 1);
            WrapText            = false;

            OnUpdate = (sender, time) =>
            {
                if (Resource != null && Resource.Gui_Graphic != null && CachedDynamicSheet == null)
                {
                    CachedDynamicSheet = ResourceGraphicsHelper.GetDynamicSheet(Root, Resource);
                    Invalidate();
                }
            };

            OnClose = (sender) =>
            {
                if (CachedDynamicSheet != null)
                {
                    CachedDynamicSheet.Discard();
                }
                CachedDynamicSheet = null;
            };

            Root.RegisterForUpdate(this);

            base.Construct();
        }
Пример #4
0
        public override void Construct()
        {
            TextHorizontalAlign = HorizontalAlign.Center;
            Background          = new TileReference("icon-frame", 0);

            if (OnClick != null)
            {
                var lambdaOnClick = this.OnClick;
                OnClick = (sender, args) => { if (Enabled)
                                              {
                                                  lambdaOnClick(sender, args);
                                              }
                };
            }

            OnMouseEnter += (widget, action) =>
            {
                MouseIsOver = true;
            };

            OnMouseLeave += (widget, action) =>
            {
                MouseIsOver = false;
            };

            if (NewStyleIcon != null && CachedDynamicSheet == null)
            {
                CachedDynamicSheet = ResourceGraphicsHelper.GetDynamicSheet(Root, NewStyleIcon);
            }

            OnClose = (sender) =>
            {
                if (CachedDynamicSheet != null)
                {
                    CachedDynamicSheet.Discard();
                }
                CachedDynamicSheet = null;
            };
        }