public override void RenderPopupNotificationHeader(PopupNotificationHeader header, PaintEventArgs e)
        {
            const int BetweenTextAndButtons = 2;
            const int BeforeContent         = 2;

            var graphics = e.Graphics;
            var client   = header.ClientRectangle;

            var rect = (RectangleF)client;

            rect.X      -= .5f;
            rect.Width  += 1;
            rect.Y      -= .5f;
            rect.Height += 1;

            graphics.TextRenderingHint = GraphicsUtility.TextRenderingHint;
            graphics.TextContrast      = GraphicsUtility.TextContrast;

            Color textColor, backgroundStart, backgroundEnd;

            textColor       = ColorTable.ViewHostHeaderTextFocused;
            backgroundStart = ColorTable.ViewHostHeaderBackgroundFocusedStart;
            backgroundEnd   = ColorTable.ViewHostHeaderBackgroundFocusedEnd;
            using (var brush = new SolidBrush(ColorTable.ViewHostHeaderBackground))
            {
                graphics.FillRectangle(brush, e.ClipRectangle);
            }
            graphics.SmoothingMode = SmoothingMode.HighQuality;
            using (var brush = new LinearGradientBrush(Point.Empty, new Point(0, Constants.HeaderHeight), backgroundStart, backgroundEnd))
            {
                graphics.FillRoundedRectangle(brush, rect, 2, 2, 0, 0);
            }
            rect.X     += BeforeContent;
            rect.Width -= BeforeContent;
            if (header.Buttons.Count != 0)
            {
                rect.Width -= header.Buttons.Width + BetweenTextAndButtons;
            }
            using (var brush = new SolidBrush(textColor))
            {
                GitterApplication.TextRenderer.DrawText(
                    graphics,
                    header.Text,
                    GitterApplication.FontManager.UIFont,
                    brush,
                    Rectangle.Truncate(rect),
                    ViewHostHeaderTextFormat);
            }
        }
示例#2
0
        public PopupNotificationForm(NotificationContent content)
        {
            if (content == null)
            {
                throw new ArgumentNullException("content");
            }

            _content        = content;
            Text            = content.Text;
            Font            = GitterApplication.FontManager.UIFont;
            BackColor       = GitterApplication.Style.ViewRenderer.BackgroundColor;
            FormBorderStyle = FormBorderStyle.None;
            StartPosition   = FormStartPosition.Manual;
            Padding         = new Padding(Renderer.FloatBorderSize);
            ShowInTaskbar   = false;
            ShowIcon        = false;
            ControlBox      = false;
            MinimizeBox     = false;
            MaximizeBox     = true;
            TopMost         = true;

            var header = new PopupNotificationHeader()
            {
                Text   = content.Text,
                Bounds = new Rectangle(
                    Renderer.FloatBorderSize,
                    Renderer.FloatBorderSize,
                    ViewConstants.PopupWidth - Renderer.FloatBorderSize * 2,
                    ViewManager.Renderer.HeaderHeight),
                Parent = this,
            };

            var cr = ClientRectangle;

            content.Width  = ViewConstants.PopupWidth - Renderer.FloatBorderSize * 2;
            content.Top    = cr.Top + ViewManager.Renderer.HeaderHeight + Renderer.FloatBorderSize;
            ClientSize     = new Size(ViewConstants.PopupWidth, content.Height + Renderer.HeaderHeight + Renderer.FloatBorderSize * 2);
            content.Left   = Renderer.FloatBorderSize;
            content.Parent = this;

            AssignEventHandlers(this);
        }
示例#3
0
 public abstract void RenderPopupNotificationHeader(PopupNotificationHeader header, PaintEventArgs e);
示例#4
0
        public override void RenderPopupNotificationHeader(PopupNotificationHeader header, PaintEventArgs e)
        {
            const int BetweenTextAndButtons = 2;
            const int BeforeContent = 2;

            var graphics = e.Graphics;
            var client = header.ClientRectangle;

            var rect = (RectangleF)client;
            rect.X -= .5f;
            rect.Width += 1;
            rect.Y -= .5f;
            rect.Height += 1;

            graphics.TextRenderingHint = GraphicsUtility.TextRenderingHint;
            graphics.TextContrast      = GraphicsUtility.TextContrast;

            Color textColor, backgroundStart, backgroundEnd;
            textColor = ColorTable.ViewHostHeaderTextFocused;
            backgroundStart = ColorTable.ViewHostHeaderBackgroundFocusedStart;
            backgroundEnd = ColorTable.ViewHostHeaderBackgroundFocusedEnd;
            using(var brush = new SolidBrush(ColorTable.ViewHostHeaderBackground))
            {
                graphics.FillRectangle(brush, e.ClipRectangle);
            }
            graphics.SmoothingMode = SmoothingMode.HighQuality;
            using(var brush = new LinearGradientBrush(Point.Empty, new Point(0, Constants.HeaderHeight), backgroundStart, backgroundEnd))
            {
                graphics.FillRoundedRectangle(brush, rect, 2, 2, 0, 0);
            }
            rect.X += BeforeContent;
            rect.Width -= BeforeContent;
            if(header.Buttons.Count != 0)
            {
                rect.Width -= header.Buttons.Width + BetweenTextAndButtons;
            }
            using(var brush = new SolidBrush(textColor))
            {
                GitterApplication.TextRenderer.DrawText(
                    graphics,
                    header.Text,
                    GitterApplication.FontManager.UIFont,
                    brush,
                    Rectangle.Truncate(rect),
                    ViewHostHeaderTextFormat);
            }
        }
示例#5
0
        public override void RenderPopupNotificationHeader(PopupNotificationHeader header, PaintEventArgs e)
        {
            const int BetweenTextAndButtons = 2;
            const int BeforeContent = 2;

            var graphics = e.Graphics;

            var textColor		= ColorTable.ViewHostHeaderTextFocused;
            var backgroundColor	= ColorTable.ViewHostHeaderBackgroundFocused;
            var accentColor		= ColorTable.ViewHostHeaderAccentFocused;

            using(var brush = new SolidBrush(backgroundColor))
            {
                graphics.FillRectangle(brush, e.ClipRectangle);
            }

            var client = header.ClientRectangle;
            client.X += BeforeContent;
            client.Width -= BeforeContent;
            if(header.Buttons.Count != 0)
            {
                client.Width -= header.Buttons.Width + BetweenTextAndButtons;
            }
            if(client.Width > 1)
            {
                int textWidth;
                using(var brush = new SolidBrush(textColor))
                {
                    graphics.TextRenderingHint = GraphicsUtility.TextRenderingHint;
                    graphics.TextContrast      = GraphicsUtility.TextContrast;
                    textWidth = GitterApplication.TextRenderer.MeasureText(
                        graphics,
                        header.Text,
                        GitterApplication.FontManager.UIFont,
                        client.Width).Width;
                    GitterApplication.TextRenderer.DrawText(
                        graphics,
                        header.Text,
                        GitterApplication.FontManager.UIFont,
                        brush,
                        client,
                        ViewHostHeaderTextFormat);
                }
                client.X += textWidth + 6;
                client.Width -= textWidth + 6;
                if(client.Width > 1)
                {
                    const int AccentHeight = 5;
                    client.Y = (client.Height - AccentHeight) / 2;
                    client.Height = AccentHeight;

                    using(var brush = new HatchBrush(HatchStyle.Percent20, accentColor, backgroundColor))
                    {
                        graphics.RenderingOrigin = new Point(client.X % 4, client.Y % 4);
                        graphics.FillRectangle(brush, client);
                        graphics.RenderingOrigin = Point.Empty;
                    }
                }
            }
        }
示例#6
0
 public abstract void RenderPopupNotificationHeader(PopupNotificationHeader header, PaintEventArgs e);