Beispiel #1
0
 public SkinLayer(SkinLayer source)
     : base(source)
 {
     if (source != null)
     {
         this.Image          = new SkinImage(source.Image);
         this.Width          = source.Width;
         this.Height         = source.Height;
         this.OffsetX        = source.OffsetX;
         this.OffsetY        = source.OffsetY;
         this.Alignment      = source.Alignment;
         this.SizingMargins  = source.SizingMargins;
         this.ContentMargins = source.ContentMargins;
         this.States         = source.States;
         this.Overlays       = source.Overlays;
         this.Text           = new SkinText(source.Text);
         this.Attributes     = new SkinList <SkinAttribute>(source.Attributes);
     }
     else
     {
         throw new Exception("Parameter for SkinLayer copy constructor cannot be null.");
     }
 }
Beispiel #2
0
        protected override void AdjustMargins()
        {
            if (horz != null && !horz.Visible)
            {
                vert.Height   = Height - 4;
                ClientMargins = new Margins(ClientMargins.Left, ClientMargins.Top, ClientMargins.Right, Skin.ClientMargins.Bottom);
            }
            else
            {
                ClientMargins = new Margins(ClientMargins.Left, ClientMargins.Top, ClientMargins.Right, 18 + Skin.ClientMargins.Bottom);
            }

            if (vert != null && !vert.Visible)
            {
                horz.Width    = Width - 4;
                ClientMargins = new Margins(ClientMargins.Left, ClientMargins.Top, Skin.ClientMargins.Right, ClientMargins.Bottom);
            }
            else
            {
                ClientMargins = new Margins(ClientMargins.Left, ClientMargins.Top, 18 + Skin.ClientMargins.Right, ClientMargins.Bottom);
            }
            base.AdjustMargins();
        }
Beispiel #3
0
        protected override void AdjustMargins()
        {
            if (captionVisible && borderVisible)
            {
                ClientMargins = new Margins(Skin.ClientMargins.Left, Skin.Layers[lrCaption].Height, Skin.ClientMargins.Right, Skin.ClientMargins.Bottom);
            }
            else if (!captionVisible && borderVisible)
            {
                ClientMargins = new Margins(Skin.ClientMargins.Left, Skin.ClientMargins.Top, Skin.ClientMargins.Right, Skin.ClientMargins.Bottom);
            }
            else if (!borderVisible)
            {
                ClientMargins = new Margins(0, 0, 0, 0);
            }

            if (btnClose != null)
            {
                btnClose.Visible = closeButtonVisible && captionVisible && borderVisible;
            }

            SetMovableArea();

            base.AdjustMargins();
        }
Beispiel #4
0
        public static Rectangle GetDestinationArea(Rectangle area, Margins margins, EAlignment alignment)
        {
            Rectangle rect = new Rectangle();

            int adj = 1;

            margins.Left   += margins.Left > 0 ? adj : 0;
            margins.Top    += margins.Top > 0 ? adj : 0;
            margins.Right  += margins.Right > 0 ? adj : 0;
            margins.Bottom += margins.Bottom > 0 ? adj : 0;

            margins = new Margins(margins.Left, margins.Top, margins.Right, margins.Bottom);

            switch (alignment)
            {
            case EAlignment.TopLeft: {
                rect = new Rectangle(area.Left + 0,
                                     area.Top + 0,
                                     margins.Left,
                                     margins.Top);
                break;
            }

            case EAlignment.TopCenter: {
                rect = new Rectangle(area.Left + margins.Left,
                                     area.Top + 0,
                                     area.Width - margins.Left - margins.Right,
                                     margins.Top);
                break;
            }

            case EAlignment.TopRight: {
                rect = new Rectangle(area.Left + area.Width - margins.Right,
                                     area.Top + 0,
                                     margins.Right,
                                     margins.Top);
                break;
            }

            case EAlignment.MiddleLeft: {
                rect = new Rectangle(area.Left + 0,
                                     area.Top + margins.Top,
                                     margins.Left,
                                     area.Height - margins.Top - margins.Bottom);
                break;
            }

            case EAlignment.MiddleCenter: {
                rect = new Rectangle(area.Left + margins.Left,
                                     area.Top + margins.Top,
                                     area.Width - margins.Left - margins.Right,
                                     area.Height - margins.Top - margins.Bottom);
                break;
            }

            case EAlignment.MiddleRight: {
                rect = new Rectangle(area.Left + area.Width - margins.Right,
                                     area.Top + margins.Top,
                                     margins.Right,
                                     area.Height - margins.Top - margins.Bottom);
                break;
            }

            case EAlignment.BottomLeft: {
                rect = new Rectangle(area.Left + 0,
                                     area.Top + area.Height - margins.Bottom,
                                     margins.Left,
                                     margins.Bottom);
                break;
            }

            case EAlignment.BottomCenter: {
                rect = new Rectangle(area.Left + margins.Left,
                                     area.Top + area.Height - margins.Bottom,
                                     area.Width - margins.Left - margins.Right,
                                     margins.Bottom);
                break;
            }

            case EAlignment.BottomRight: {
                rect = new Rectangle(area.Left + area.Width - margins.Right,
                                     area.Top + area.Height - margins.Bottom,
                                     margins.Right,
                                     margins.Bottom);
                break;
            }
            }

            return(rect);
        }
Beispiel #5
0
        private static Rectangle GetSourceArea(Size imageSize, Size partSize, Margins margins, EAlignment alignment, int index)
        {
            Rectangle rect = new Rectangle();
            int       xc   = (int)((float)imageSize.Width / partSize.Width);
            int       yc   = (int)((float)imageSize.Height / partSize.Height);

            int xm = (index) % xc;
            int ym = (index) / xc;

            int adj = 1;

            margins.Left   += margins.Left > 0 ? adj : 0;
            margins.Top    += margins.Top > 0 ? adj : 0;
            margins.Right  += margins.Right > 0 ? adj : 0;
            margins.Bottom += margins.Bottom > 0 ? adj : 0;

            margins = new Margins(margins.Left, margins.Top, margins.Right, margins.Bottom);
            switch (alignment)
            {
            case EAlignment.TopLeft: {
                rect = new Rectangle((0 + (xm * partSize.Width)),
                                     (0 + (ym * partSize.Height)),
                                     margins.Left,
                                     margins.Top);
                break;
            }

            case EAlignment.TopCenter: {
                rect = new Rectangle((0 + (xm * partSize.Width)) + margins.Left,
                                     (0 + (ym * partSize.Height)),
                                     partSize.Width - margins.Left - margins.Right,
                                     margins.Top);
                break;
            }

            case EAlignment.TopRight: {
                rect = new Rectangle((partSize.Width + (xm * partSize.Width)) - margins.Right,
                                     (0 + (ym * partSize.Height)),
                                     margins.Right,
                                     margins.Top);
                break;
            }

            case EAlignment.MiddleLeft: {
                rect = new Rectangle((0 + (xm * partSize.Width)),
                                     (0 + (ym * partSize.Height)) + margins.Top,
                                     margins.Left,
                                     partSize.Height - margins.Top - margins.Bottom);
                break;
            }

            case EAlignment.MiddleCenter: {
                rect = new Rectangle((0 + (xm * partSize.Width)) + margins.Left,
                                     (0 + (ym * partSize.Height)) + margins.Top,
                                     partSize.Width - margins.Left - margins.Right,
                                     partSize.Height - margins.Top - margins.Bottom);
                break;
            }

            case EAlignment.MiddleRight: {
                rect = new Rectangle((partSize.Width + (xm * partSize.Width)) - margins.Right,
                                     (0 + (ym * partSize.Height)) + margins.Top,
                                     margins.Right,
                                     partSize.Height - margins.Top - margins.Bottom);
                break;
            }

            case EAlignment.BottomLeft: {
                rect = new Rectangle((0 + (xm * partSize.Width)),
                                     (partSize.Height + (ym * partSize.Height)) - margins.Bottom,
                                     margins.Left,
                                     margins.Bottom);
                break;
            }

            case EAlignment.BottomCenter: {
                rect = new Rectangle((0 + (xm * partSize.Width)) + margins.Left,
                                     (partSize.Height + (ym * partSize.Height)) - margins.Bottom,
                                     partSize.Width - margins.Left - margins.Right,
                                     margins.Bottom);
                break;
            }

            case EAlignment.BottomRight: {
                rect = new Rectangle((partSize.Width + (xm * partSize.Width)) - margins.Right,
                                     (partSize.Height + (ym * partSize.Height)) - margins.Bottom,
                                     margins.Right,
                                     margins.Bottom);
                break;
            }
            }

            return(rect);
        }
Beispiel #6
0
 protected override void AdjustMargins()
 {
     base.AdjustMargins();
     ClientMargins = new Margins(ClientMargins.Left, ClientMargins.Top, ClientMargins.Right + 16, ClientMargins.Bottom);
 }
Beispiel #7
0
        protected override void AdjustMargins()
        {
            Margins m = Skin.ClientMargins;

            if (this.GetType() != typeof(Container))
            {
                m = ClientMargins;
            }

            if (mainMenu != null && mainMenu.Visible)
            {
                if (!mainMenu.Initialized)
                {
                    mainMenu.Init();
                }
                mainMenu.Left   = m.Left;
                mainMenu.Top    = m.Top;
                mainMenu.Width  = Width - m.Horizontal;
                mainMenu.Anchor = EAnchors.Left | EAnchors.Top | EAnchors.Right;

                m.Top += mainMenu.Height;
            }
            if (toolBarPanel != null && toolBarPanel.Visible)
            {
                if (!toolBarPanel.Initialized)
                {
                    toolBarPanel.Init();
                }
                toolBarPanel.Left   = m.Left;
                toolBarPanel.Top    = m.Top;
                toolBarPanel.Width  = Width - m.Horizontal;
                toolBarPanel.Anchor = EAnchors.Left | EAnchors.Top | EAnchors.Right;

                m.Top += toolBarPanel.Height;
            }
            if (statusBar != null && statusBar.Visible)
            {
                if (!statusBar.Initialized)
                {
                    statusBar.Init();
                }
                statusBar.Left   = m.Left;
                statusBar.Top    = Height - m.Bottom - statusBar.Height;
                statusBar.Width  = Width - m.Horizontal;
                statusBar.Anchor = EAnchors.Left | EAnchors.Bottom | EAnchors.Right;

                m.Bottom += statusBar.Height;
            }
            if (sbVert != null && sbVert.Visible)
            {
                m.Right += (sbVert.Width + 2);
            }
            if (sbHorz != null && sbHorz.Visible)
            {
                m.Bottom += (sbHorz.Height + 2);
            }

            ClientMargins = m;

            PositionScrollBars();

            base.AdjustMargins();
        }