Exemplo n.º 1
0
        public GMacroEditorPanel(Macro m)
            : base(0, 0, 259, 230)
        {
            this.m_Macro   = m;
            this.m_CanDrag = false;
            this.m_NonRestrictivePicking = true;
            this.ShouldHitTest           = false;
            this.m_Ctrl          = new GSystemButton(10, 10, 40, 20, GumpPaint.Blend(Color.WhiteSmoke, SystemColors.Control, 0.5f), SystemColors.ControlText, "Ctrl", (IFont)Engine.GetUniFont(2));
            this.m_Alt           = new GSystemButton(49, 10, 40, 20, GumpPaint.Blend(Color.WhiteSmoke, SystemColors.Control, 0.5f), SystemColors.ControlText, "Alt", (IFont)Engine.GetUniFont(2));
            this.m_Shift         = new GSystemButton(88, 10, 42, 20, GumpPaint.Blend(Color.WhiteSmoke, SystemColors.Control, 0.5f), SystemColors.ControlText, "Shift", (IFont)Engine.GetUniFont(2));
            this.m_Ctrl.OnClick  = new OnClick(this.Ctrl_OnClick);
            this.m_Alt.OnClick   = new OnClick(this.Alt_OnClick);
            this.m_Shift.OnClick = new OnClick(this.Shift_OnClick);
            this.m_Ctrl.Tooltip  = (ITooltip) new Tooltip("Toggles the control key modifier", true);
            this.m_Alt.Tooltip   = (ITooltip) new Tooltip("Toggles the alt key modifier", true);
            this.m_Shift.Tooltip = (ITooltip) new Tooltip("Toggles the shift key modifier", true);
            this.m_Children.Add((Gump)this.m_Ctrl);
            this.m_Children.Add((Gump)this.m_Alt);
            this.m_Children.Add((Gump)this.m_Shift);
            this.UpdateModifiers();
            this.m_Children.Add((Gump) new GAlphaBackground(129, 10, 74, 20)
            {
                FillAlpha = 1f,
                FillColor = GumpColors.Window
            });
            GMacroKeyEntry gmacroKeyEntry = new GMacroKeyEntry(GMacroEditorPanel.GetKeyName(m.Key), 129, 10, 74, 20);

            gmacroKeyEntry.Tooltip = (ITooltip) new Tooltip("Press any key here to change the macro", true);
            this.m_Children.Add((Gump)gmacroKeyEntry);
            GSystemButton gsystemButton = new GSystemButton(10, 10, 40, 20, GumpPaint.Blend(Color.WhiteSmoke, SystemColors.Control, 0.5f), SystemColors.ControlText, "Delete", (IFont)Engine.GetUniFont(2));

            gsystemButton.SetBackColor(GumpPaint.Blend(Color.SteelBlue, SystemColors.Control, 0.25f));
            gsystemButton.InactiveColor = GumpPaint.Blend(Color.WhiteSmoke, SystemColors.Control, 0.5f);
            gsystemButton.Tooltip       = (ITooltip) new Tooltip("Deletes the entire macro", true);
            gsystemButton.OnClick       = new OnClick(this.Delete_OnClick);
            gsystemButton.X             = this.Width - 10 - gsystemButton.Width;
            this.m_Children.Add((Gump)gsystemButton);
            this.FillAlpha = 0.15f;
            for (int index = 0; index < m.Actions.Count; ++index)
            {
                try
                {
                    Action action = m.Actions[index];
                    if (action.Handler != null)
                    {
                        ActionHandler handler   = action.Handler;
                        GMainMenu     gmainMenu = new GMainMenu(10, 35 + index * 23);
                        GMenuItem     mi        = (GMenuItem) new GActionMenu(this, m, action);
                        gmainMenu.Add(this.FormatMenu(mi));
                        if (handler.Params == null)
                        {
                            GAlphaBackground galphaBackground = new GAlphaBackground(129, 35 + index * 23, 120, 24);
                            galphaBackground.FillAlpha = 1f;
                            galphaBackground.FillColor = GumpColors.Window;
                            this.m_Children.Add((Gump)galphaBackground);
                            IHue     windowText = GumpHues.WindowText;
                            GTextBox gtextBox   = (GTextBox) new GMacroParamEntry(action, action.Param, galphaBackground.X + 4, galphaBackground.Y, galphaBackground.Width - 4, galphaBackground.Height);
                            gtextBox.MaxChars = 239;
                            this.m_Children.Add((Gump)gtextBox);
                        }
                        else if (handler.Params.Length != 0)
                        {
                            GMenuItem menuFrom = this.GetMenuFrom(new ParamNode(GMacroEditorPanel.Find(action.Param, handler.Params) ?? action.Param, handler.Params), action, handler);
                            menuFrom.DropDown = index == m.Actions.Count - 1;
                            gmainMenu.Add(menuFrom);
                        }
                        gmainMenu.LeftToRight = true;
                        this.m_Children.Add((Gump)gmainMenu);
                    }
                }
                catch
                {
                }
            }
            GMainMenu gmainMenu1 = new GMainMenu(10, 35 + m.Actions.Count * 23);
            GMenuItem menuFrom1  = this.GetMenuFrom(ActionHandler.Root);

            menuFrom1.Tooltip  = (ITooltip) new Tooltip("To create a new instruction pick one from the menu below", false, 200);
            menuFrom1.Text     = "New...";
            menuFrom1.DropDown = true;
            gmainMenu1.Add(this.FormatMenu(menuFrom1));
            gmainMenu1.LeftToRight = true;
            this.m_Children.Add((Gump)gmainMenu1);
        }
Exemplo n.º 2
0
        protected internal override void Draw(int x, int y)
        {
            Renderer.SetTexture((Texture)null);
            int num = 0;

            switch (this.m_Style)
            {
            case WindowsButtonStyle.Normal:
                switch (this.m_State)
                {
                case 0:
                    GumpPaint.DrawRaised3D(x, y, this.m_Width, this.m_Height);
                    this.CaptionDown = false;
                    break;

                case 1:
                    GumpPaint.DrawRaised3D(x, y, this.m_Width, this.m_Height);
                    this.CaptionDown = false;
                    break;

                case 2:
                    GumpPaint.DrawFlat(x, y, this.m_Width, this.m_Height, GumpColors.ControlDark, GumpColors.Control);
                    this.CaptionDown = true;
                    num = 1;
                    break;
                }
                break;

            case WindowsButtonStyle.Flat:
                switch (this.m_State)
                {
                case 0:
                    GumpPaint.DrawFlat(x, y, this.m_Width, this.m_Height, GumpColors.ControlDarkDark, GumpColors.Control);
                    this.CaptionDown = false;
                    break;

                case 1:
                    GumpPaint.DrawFlat(x, y, this.m_Width, this.m_Height, GumpColors.ControlDarkDark, GumpColors.ControlAlternate);
                    this.CaptionDown = false;
                    break;

                case 2:
                    GumpPaint.DrawFlat(x, y, this.m_Width, this.m_Height, GumpColors.ControlDarkDark, GumpPaint.Blend(GumpColors.ControlAlternate, GumpColors.ControlLightLight, 128));
                    this.CaptionDown = false;
                    break;
                }
                break;
            }
            if (this.m_Image == null)
            {
                return;
            }
            if (this.m_vCache == null)
            {
                this.m_vCache = new VertexCache();
            }
            if (this.m_ImageColor == -1)
            {
                this.m_vCache.Draw(this.m_Image, num + x + (this.m_Width - (this.m_Image.xMax - this.m_Image.xMin + 1)) / 2 - this.m_Image.xMin, num + y + (this.m_Height - (this.m_Image.yMax - this.m_Image.yMin + 1)) / 2 - this.m_Image.yMin);
            }
            else
            {
                this.m_vCache.Draw(this.m_Image, num + x + (this.m_Width - (this.m_Image.xMax - this.m_Image.xMin + 1)) / 2 - this.m_Image.xMin, num + y + (this.m_Height - (this.m_Image.yMax - this.m_Image.yMin + 1)) / 2 - this.m_Image.yMin, this.m_ImageColor);
            }
        }
Exemplo n.º 3
0
 public static void DrawFlat(int x, int y, int w, int h, int border, int fill)
 {
     GumpPaint.DrawRect(border, x, y, w, h);
     GumpPaint.DrawRect(fill, x + 1, y + 1, w - 2, h - 2);
 }
Exemplo n.º 4
0
 public static void DrawFlat(int x, int y, int w, int h)
 {
     GumpPaint.DrawRect(SystemColors.ControlDark, x, y, w, h);
     GumpPaint.DrawRect(SystemColors.Control, x + 1, y + 1, w - 2, h - 2);
 }
Exemplo n.º 5
0
 public static int Blend(int c1, int c2, int p)
 {
     return(GumpPaint.Blend(Color.FromArgb(c1), Color.FromArgb(c2), p).ToArgb() & 16777215);
 }
Exemplo n.º 6
0
 public static Color Blend(Color c1, Color c2, float f)
 {
     return(GumpPaint.Blend(c1, c2, (int)((double)f * (double)byte.MaxValue)));
 }
Exemplo n.º 7
0
 protected internal override void OnMouseEnter(int X, int Y, MouseButtons mb)
 {
     this.m_NameBack.FillColor  = GumpPaint.Blend(GumpColors.Window, GumpColors.Highlight, 0.9f);
     this.m_ValueBack.FillColor = this.m_NameBack.FillColor;
 }