Exemplo n.º 1
0
        override public void paint(SdlDotNet.Graphics.Surface surface, bool focused, Point offset)
        {
            Caption.SizeWithIcon = false;

            Point dest = new Point((Width - Caption.Width) / 2 + offset.X,
                                   (Height - Caption.Height) / 2 + offset.Y);

            Rectangle rect = new Rectangle(offset, Dimensions);

            surface.Fill(rect, DisplaySettings.atomForeground);
            rect.Width  -= Compound.BorderPadding.Width * 2;
            rect.Height -= Compound.BorderPadding.Height * 2;
            rect.X      += Compound.BorderPadding.Width;
            rect.Y      += Compound.BorderPadding.Height;
            surface.Fill(rect, pressed ? DisplaySettings.atomBackgroundDimmed : DisplaySettings.atomBackground);
            rect.Width  -= Compound.BorderPadding.Width * 2;
            rect.Height -= Compound.BorderPadding.Height * 2;
            rect.X      += Compound.BorderPadding.Width;
            rect.Y      += Compound.BorderPadding.Height;

            Rectangle oldClipper = surface.ClipRectangle;

            surface.ClipRectangle = rect;

            Caption.Blit(surface, dest);

            surface.ClipRectangle = oldClipper;
        }
Exemplo n.º 2
0
        override public void paint(SdlDotNet.Graphics.Surface surface, bool focused, Point offset)
        {
            Point p = offset;

            Caption.SizeWithIcon = false;

            DisplayIcon box = boxChecked ? DisplaySettings.checkChecked : DisplaySettings.checkUnchecked;

            if (Caption.Height > box.Height)
            {
                p.Y += (Caption.Height - box.Height) / 2;

                box.Blit(surface, p);

                p.X += box.Width + Compound.Padding;
                p.Y  = offset.Y;

                Caption.Blit(surface, p);
            }
            else
            {
                box.Blit(surface, p);

                p.X += box.Width + Compound.Padding;
                p.Y += (box.Height - Caption.Height) / 2;

                Caption.Blit(surface, p);
            }
        }
Exemplo n.º 3
0
        public override void paint(Surface display, bool focused, Point offset)
        {
            Rectangle target   = new Rectangle(offset, Dimensions);
            Rectangle titleBar = target;

            titleBar.Width  = titleBar.Width;
            titleBar.Height = Caption.Height + Compound.Padding;
            target.Width--;
            target.Height--;

            Caption.UseDefaultIcon = true;

            Rectangle windowFiller = target;

            display.Fill(target, focused ? DisplaySettings.bodyBorderFocused : DisplaySettings.bodyBorderBlured);

            target.Width  -= Compound.BorderPadding.Width * 2;
            target.Height -= Compound.BorderPadding.Height * 2;
            target.X       = offset.X + Compound.BorderPadding.Width;
            target.Y       = offset.Y + Compound.BorderPadding.Height;

            display.Fill(target, focused ? DisplaySettings.bodyFocused : DisplaySettings.bodyBlured);

            display.Fill(titleBar, focused ? DisplaySettings.bodyBorderFocused : DisplaySettings.bodyBorderBlured);
            titleBar.Width  -= Compound.BorderPadding.Width * 2;
            titleBar.Height -= Compound.BorderPadding.Height * 2;
            titleBar.X      += Compound.BorderPadding.Width;
            titleBar.Y      += Compound.BorderPadding.Height;
            display.Fill(titleBar, focused ? DisplaySettings.titleFocused : DisplaySettings.titleBlured);

            Point p = new Point(titleBar.X + Compound.Padding, titleBar.Y);

            p.Y += (titleBar.Height - Math.Max(DisplaySettings.minimizeIcon.Height, DisplaySettings.closeIcon.Height)) / 2;
            p.X  = titleBar.X + titleBar.Width - DisplaySettings.minimizeIcon.Width - DisplaySettings.closeIcon.Width - Compound.Padding;

            Rectangle oldClipper = display.ClipRectangle;
            Rectangle newClipper = new Rectangle(
                titleBar.X + Compound.Padding,
                titleBar.Y,
                p.X - titleBar.X - Compound.Padding * 2,
                titleBar.Height);

            display.ClipRectangle = newClipper;
            Caption.Blit(display, newClipper.Location);
            display.ClipRectangle = oldClipper;

            DisplaySettings.minimizeIcon.Blit(display, p);
            p.X += DisplaySettings.minimizeIcon.Width + Compound.Padding;
            DisplaySettings.closeIcon.Blit(display, p);

            newClipper = new Rectangle(new Point(target.X,
                                                 target.Y + Caption.Height),
                                       new Size(target.Width,
                                                target.Height - Compound.BorderPadding.Height - Caption.Height));

            Rectangle menuRect = newClipper;

            if (menu != null)
            {
                newClipper.Y      += menu.Height;
                newClipper.Height -= menu.Height;
            }

            newClipper.X      += Compound.Padding;
            newClipper.Y      += Compound.Padding * 2;
            newClipper.Width  -= Compound.Padding * 2;
            newClipper.Height -= Compound.Padding * 2;

            if (activeAtom != null && activeAtom.allowFocus())
            {
                p = newClipper.Location;

                Rectangle widgetBox = activeAtom.Boundaries;
                widgetBox.X += p.X;
                widgetBox.Y += p.Y;

                widgetBox.Inflate(Compound.BorderPadding);
                display.Fill(widgetBox, DisplaySettings.focused);
            }

            display.ClipRectangle = newClipper;

            foreach (Atom a in windowAtoms)
            {
                p = newClipper.Location;

                Rectangle widgetClip = a.Boundaries;
                widgetClip.X += p.X;
                widgetClip.Y += p.Y;
                widgetClip.Width++;
                widgetClip.Height++;

                widgetClip.Intersect(newClipper);
                display.ClipRectangle = widgetClip;

                a.paint(display, a == activeAtom && focused, widgetClip.Location);
            }

            display.ClipRectangle = oldClipper;

            if (menu != null)
            {
                menu.paint(display, menuRect);
            }
        }