Example #1
0
        protected override void OnDraw(Graphics g, Font font, Style style)
        {
            SizeF limSize   = g.MeasureString("lim", font);
            float leftWidth = Math.Max(X.DesiredWidth + Limit.DesiredWidth + 10, limSize.Width);

            float bottomHeight = Height - limSize.Height;

            g.DrawString("lim", font, Brushes.Black, Left + (leftWidth - limSize.Width) / 2, 0);


            float x1 = X.Left + X.Width;
            float x2 = x1 + 10;

            float y1 = ((Height - (limSize.Height + Math.Max(X.Height, Limit.Height)))) / 2 + limSize.Height;
            float y  = y1 + Math.Max(X.Height, Limit.Height) / 2;

            Pen p = new Pen(Color.Black);

            g.DrawLine(p, x1, y, x2, y);
            g.DrawLine(p, x2 - 2, y - 2, x2, y);
            g.DrawLine(p, x2 - 2, y + 2, x2, y);
            p.Dispose();


            X.Draw(g, style.SmallFont, style);
            Limit.Draw(g, style.SmallFont, style);
            Body.Draw(g, font, style);
        }
Example #2
0
        protected override bool OnExposeEvent(Gdk.EventExpose args)
        {
            Rectangle area;

            //Console.WriteLine ("expose {0}", args.Area);
            foreach (Rectangle sub in args.Region.GetRectangles())
            {
                if (sub.Intersect(background, out area))
                {
                    Rectangle active = background;
                    int       min_x  = BoxX(min_limit.Position);
                    int       max_x  = BoxX(max_limit.Position + 1);
                    active.X     = min_x;
                    active.Width = max_x - min_x;

                    if (active.Intersect(area, out active))
                    {
                        GdkWindow.DrawRectangle(Style.BaseGC(State), true, active);
                    }

                    int i;
                    BoxXHit(area.X, out i);
                    int end;
                    BoxXHit(area.X + area.Width, out end);
                    while (i <= end)
                    {
                        DrawBox(area, i++);
                    }
                }

                Style.PaintShadow(this.Style, GdkWindow, State, ShadowType.In, area,
                                  this, null, background.X, background.Y,
                                  background.Width, background.Height);

                if (sub.Intersect(legend, out area))
                {
                    int i = 0;

                    while (i < box_counts.Length)
                    {
                        DrawTick(area, i++);
                    }
                }

                if (has_limits)
                {
                    if (min_limit != null)
                    {
                        min_limit.Draw(sub);
                    }

                    if (max_limit != null)
                    {
                        max_limit.Draw(sub);
                    }
                }

                if (glass != null)
                {
                    glass.Draw(sub);
                }
            }
            return(base.OnExposeEvent(args));
        }
Example #3
0
        protected override bool OnExposeEvent(Gdk.EventExpose args)
        {
            Rectangle area;

            //Console.WriteLine ("expose {0}", args.Area);
            foreach (Rectangle sub in args.Region.GetRectangles())
            {
                if (sub.Intersect(background, out area))
                {
                    Rectangle active = background;
                    int       min_x  = BoxX(min_limit.Position);
                    int       max_x  = BoxX(max_limit.Position + 1);
                    active.X     = min_x;
                    active.Width = max_x - min_x;

                    // white background for entire widget
                    if (active.Intersect(area, out active))
                    {
                        GdkWindow.DrawRectangle(Style.BaseGC(State), true, active);
                    }

                    // draw bars indicating photo counts
                    int i;
                    BoxXHit(area.X, out i);
                    int end;
                    BoxXHit(area.X + area.Width, out end);
                    while (i <= end)
                    {
                        DrawBox(area, i++);
                    }
                }

                Style.PaintShadow(this.Style, GdkWindow, State, ShadowType.In, area,
                                  this, null, background.X, background.Y,
                                  background.Width, background.Height);

                //	draw ticks and legend
                if (sub.Intersect(legend, out area))
                {
                    int i = 0;
                    while (i < box_counts.Length)
                    {
                        DrawTick(area, i++);
                    }
                }

                //  draw limit markers and glass if needed (drawing done inside confines of action_area)
                if (sub.Intersect(action_area, out area))
                {
                    //	draw limits markers
                    if (has_limits)
                    {
                        if (min_limit != null)
                        {
                            min_limit.Draw(area);
                        }

                        if (max_limit != null)
                        {
                            max_limit.Draw(area);
                        }
                    }

                    //	draw glass
                    if (glass != null)
                    {
                        glass.Draw(area);
                    }
                }
            }
            return(base.OnExposeEvent(args));
        }