Example #1
0
            internal void Draw()
            {
                // Get the start position of the notification
                var pos = Position;

                // Draw the textures
                if (Header != null)
                {
                    Header.Color = Color.FromArgb(AlphaLevel, Content.Color);
                    Header.Draw(pos + Handle.Texture.Header.Position ?? Vector2.Zero, Handle.Texture.Header.SourceRectangle);
                }
                if (Content != null)
                {
                    Content.Color = Color.FromArgb(AlphaLevel, Content.Color);
                    Content.Draw(pos + Handle.Texture.Content.Position ?? Vector2.Zero, Handle.Texture.Content.SourceRectangle, null, null, new Vector2(1, ContentScale));
                }
                if (Footer != null)
                {
                    Footer.Color = Color.FromArgb(AlphaLevel, Footer.Color);
                    if (ContentScale > 1)
                    {
                        int extraHeight;
                        if (Handle.Texture.Footer.SourceRectangle.HasValue)
                        {
                            extraHeight = Height - Handle.Texture.Footer.SourceRectangle.Value.Height;
                        }
                        else
                        {
                            extraHeight = Height - Footer.Texture.GetLevelDescription(0).Height;
                        }
                        Footer.Draw(pos + new Vector2(0, extraHeight), Handle.Texture.Footer.SourceRectangle);
                    }
                    else
                    {
                        Footer.Draw(pos + Handle.Texture.Footer.Position ?? Vector2.Zero, Handle.Texture.Footer.SourceRectangle);
                    }
                }

                // Draw the text
                HeaderText.Draw(Handle.HeaderText, Color.FromArgb(AlphaLevel, HeaderText.Color),
                                new Rectangle((int)(pos.X + Width - HeaderText.Width - TextOuterPadding.X), (int)(pos.Y + TextOuterPadding.Y), (int)HeaderText.Size.X, (int)HeaderText.Size.Y));
                ContentText.Draw(Handle.ContentText, Color.FromArgb(AlphaLevel, ContentText.Color),
                                 new Rectangle((int)(pos.X + Width - ContentText.Width - TextOuterPadding.X), (int)(pos.Y + TextOuterPadding.Y + HeaderText.Size.Y + HeaderToContentSpace),
                                               (int)ContentText.Size.X, (int)ContentText.Size.Y));
            }