Beispiel #1
0
        public ColourPad(CharacterHandler handler)
        {
            this.Handler             = handler;
            this.Handler.ColourStart = start;

            this.Handler.DrawAttributeChanged += new EventHandler <EventArgs> (HandleColourChanged).MakeWeak((e) => this.Handler.DrawAttributeChanged -= e);

            this.Handler.CurrentPage.PaletteChanged += new EventHandler <EventArgs> (delegate {
                SetColours();
                UpdateButtons();
                Invalidate();
            }).MakeWeak((e) => this.Handler.CurrentPage.PaletteChanged -= e);

            var boxSize      = new Size(30, 30);
            int boxOffset    = 10;
            int boxesPadding = 10;
            int boxesOffset  = boxSize.Width + boxOffset + boxesPadding;

            max = 8;             //Math.Min (16, Palette.Count / 2);

            Size       = new Size(40, boxesOffset + (max * 18) + 16 + 17);
            foreground = new FBColourBox {
                Size = boxSize,
                Pad  = this
            };

            background = new FBColourBox {
                Size = boxSize,
                Pad  = this
            };

            SetColours();

            var layout = new PixelLayout();

            layout.Add(background, boxOffset, boxOffset);
            layout.Add(foreground, 0, 0);

            colours = new SelectColourBox[max * 2];

            for (int i = 0; i < max; i++)
            {
                CreateButton(layout, i, 2, boxesOffset + i * 18);
                CreateButton(layout, i + max, 22, boxesOffset + i * 18);
            }

            layout.Add(SelectButton(), 10, this.Size.Height - 16);
            layout.Add(UpButton(), 2, this.Size.Height - 16 - 15);
            layout.Add(DownButton(), 22, this.Size.Height - 16 - 15);

            Content = layout;

            UpdateButtons();
        }
Beispiel #2
0
        public ColourPad(RipHandler handler)
        {
            this.Handler = handler;
            //this.Handler.ColourStart = start;

            this.Handler.AttributeChanged += new EventHandler <EventArgs>(HandleColourChanged).MakeWeak(e => this.Handler.AttributeChanged -= HandleColourChanged);

            /*this.Handler.CurrentPage.PaletteChanged += new EventHandler<EventArgs> (delegate{
             *      SetColours ();
             *      UpdateButtons ();
             *      Invalidate ();
             * }).MakeWeak ((e) => this.Handler.CurrentPage.PaletteChanged -= e);*/

            var boxSize      = new Size(30, 30);
            int boxOffset    = 10;
            int boxesPadding = 10;
            int boxesOffset  = boxSize.Width + boxOffset + boxesPadding;

            max = 8;             //Math.Min (16, Palette.Count / 2);

            Size       = new Size(40, boxesOffset + (max * 18));
            foreground = new FBColourBox {
                Size = boxSize,
                Pad  = this
            };

            background = new FBColourBox {
                Size = boxSize,
                Pad  = this
            };

            SetColours();

            var layout = new PixelLayout();

            layout.Add(background, boxOffset, boxOffset);
            layout.Add(foreground, 0, 0);

            colours = new SelectColourBox[max * 2];

            for (int i = 0; i < max; i++)
            {
                CreateButton(layout, i, 2, boxesOffset + i * 18);
                CreateButton(layout, i + max, 22, boxesOffset + i * 18);
            }

            Content = layout;

            UpdateButtons();
        }