示例#1
0
        public override void Update(IGUIContext ctx)
        {
            // We start a new round here.
            // Ensure the stack is empty
            ctx.ClipBoundStack.Clear();
            // The root container sets the first clip-bounds without combining
            // all later should combine the clips..
            using (var clip = new ClipBoundClip(ctx, Bounds, false)) {
                base.Update(ctx);
            }

            try {
                Overlays.RWLock.EnterReadLock();
                //for (int i = 0; i < Overlays.Count; i++) {
                for (int i = Overlays.Count - 1; i >= 0; i--)
                {
                    Widget w = Overlays [i];
                    w.Update(ctx);
                }
            } catch (Exception ex) {
                ex.LogError();
            }
            finally {
                Overlays.RWLock.ExitReadLock();
            }
        }
示例#2
0
        public override void Update(IGUIContext ctx)
        {
            if (Bounds.Width <= 0 || Bounds.Height <= 0)
            {
                return;
            }

            using (var clip = new ClipBoundClip(ctx, Bounds, true)) {
                if (!clip.IsEmptyClip)
                {
                    Button.Update(ctx);

                    try {
                        RectangleF bounds = Bounds;
                        bounds.Width -= Bounds.Height;
                        this.OnPaint(ctx, bounds);
                    } catch (Exception ex) {
                        ex.LogError();
                    } finally {
                        //ctx.ResetClip ();
                    }
                }
            }

            if (DropDownWindow != null && DropDownWindow.Visible)
            {
                DropDownWindow.Update(ctx);
            }
        }
示例#3
0
 // RECURSIVE Update Function
 public override void Update(IGUIContext ctx)
 {
     using (var clip = new ClipBoundClip(ctx, Bounds, true)) {
         if (!clip.IsEmptyClip)
         {
             base.Update(ctx);
             // GEMALT WIRD RÜCKWÄRTS
             for (int i = Children.Count - 1; i >= 0; i--)
             {
                 Widget child = Children [i];
                 if (child != null && child.Visible && !child.IsOverlay)
                 {
                     try {
                         using (var clipChild = new ClipBoundClip(ctx, child.Bounds, true)) {
                             if (!clipChild.IsEmptyClip)
                             {
                                 child.Update(ctx);
                             }
                         }
                     } catch (Exception ex) {
                         ex.LogError();
                     }
                 }
             }
         }
     }
 }
示例#4
0
        public override void OnPaint(IGUIContext ctx, RectangleF bounds)
        {
            if (!Visible || Font == null || String.IsNullOrEmpty(Text))
            {
                return;
            }

            using (var clipChild = new ClipBoundClip(ctx, Bounds, true)) {
                ctx.DrawString(Text, Font, Style.ForeColorBrush, PaddingBounds, FontFormat.DefaultMultiLine);
            }

            // Fadeout animation
            if (bFadeOut)
            {
                try {
                    if (Style.AlphaBack >= 5)
                    {
                        Style.AlphaBack   -= 5;
                        Style.AlphaFore   -= 5;
                        Style.AlphaBorder -= 5;
                    }
                } catch (Exception ex) {
                    ex.LogError();
                } finally {
                    if (Style.AlphaBack < 5)
                    {
                        OnClose();
                    }
                    ctx.Invalidate(1);
                }
            }
        }
示例#5
0
        public override void OnPaint(IGUIContext ctx, RectangleF bounds)
        {
            base.OnPaint(ctx, bounds);
            if (szDay.Width <= 0 || szDay.Height <= 0)
            {
                return;
            }

            // prev / next buttons
            ctx.DrawString(((char)FontAwesomeIcons.fa_long_arrow_left).ToString(),
                           IconFont, prevArrowHover ? Theme.Brushes.Blue : Theme.Brushes.Base02,
                           prevRec, FontFormat.DefaultIconFontFormatCenter);
            ctx.DrawString(((char)FontAwesomeIcons.fa_long_arrow_right).ToString(),
                           IconFont, nextArrowHover ? Theme.Brushes.Blue : Theme.Brushes.Base02,
                           nextRec, FontFormat.DefaultIconFontFormatCenter);

            DateTime date  = CurrentDate;
            string   title = String.Format("{0} {1}", CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(date.Month).ToUpper(), date.Year.ToString());

            using (var clip = new ClipBoundClip(ctx, rTitle)) {
                ctx.DrawString(title, TitleFont, Theme.Brushes.Base02, rTitle, Format);
            }

            for (int i = 0; i < 7; i++)
            {
                RectangleF rx = new RectangleF((int)(bounds.Left + Padding.Left + (i * szDay.Width)), (int)szDay.Height + bounds.Top + Padding.Top, (int)szDay.Width, (int)szDay.Height);
                string     wd = m_Weekdays [i].Substring(0, 1);
                if (i == 0 || i == 6)
                {
                    ctx.DrawString(wd, DayFont, Theme.Brushes.Orange, rx, Format);
                }
                else
                {
                    ctx.DrawString(wd, DayFont, Theme.Brushes.Cyan, rx, Format);
                }
            }

            DateTime  firstDayOfMonth = new DateTime(CurrentDate.Year, CurrentDate.Month, 1);
            DayOfWeek dowStart        = firstDayOfMonth.DayOfWeek;

            int dayMax    = (int)dowStart < 6 ? 35 : 42;
            int currMonth = CurrentDate.Month;

            DateTime today      = DateTime.Now.Date;
            Brush    textBrusch = new SolidBrush(Style.ForeColorBrush.Color);
            float    radius     = Math.Max(MinCircleRadius, Math.Min(MaxCircleRadius, szDay.Width * 0.35f));

            for (int i = 0; i < dayMax; i++)
            {
                int       col = i % 7;
                int       row = (i / 7);
                Rectangle rx  = new Rectangle((int)(bounds.Left + Padding.Left + ((float)col * szDay.Width)), (int)(bounds.Top + Padding.Top + ((float)(row + 2) * szDay.Height)), (int)szDay.Width, (int)szDay.Height);

                DateTime dt = m_MonthView [i];
                string   wd = dt.Day.ToString();

                Color color = Color.Empty;
                if (dt == today)
                {
                    color = TodayBackColor;
                }
                else if (dt == CurrentDate)
                {
                    color = CurrentDayBackColor;
                }
                else if (dt == HoverDate)
                {
                    color = DayHoverBackColor;
                }


                Color textColor = Color.Empty;

                if (!color.IsEmpty)
                {
                    using (var brush = new SolidBrush(color))
                    {
                        ctx.FillCircle(brush, rx.Left + (rx.Width / 2f) - 0.5f, rx.Top + (rx.Height / 2f) - 1f, radius, 1);
                    }

                    textColor = Style.ForeColorBrush.Color;
                }
                else
                {
                    textColor = (col == 0 || col == 6) ? Theme.Colors.Orange : Style.ForeColorBrush.Color;
                }

                if (dt.Month != currMonth)
                {
                    textColor = Color.FromArgb(128, textColor);
                }
                textBrusch.Color = textColor;

                ctx.DrawString(wd, DayFont, textBrusch, rx, Format);
            }
        }