Ejemplo n.º 1
0
 public override void Render(GUIRenderContext Context)
 {
     this._Near.Render(Context);
     Context.PushTranslate(new Point(this._NearSize, 0.0).SwapIf(this._Direction == Axis.Vertical));
     this._Far.Render(Context);
     Context.Pop();
 }
Ejemplo n.º 2
0
 public override void Render(GUIRenderContext Context)
 {
     Context.PushClip(new Rectangle(this._Size));
     Context.PushTranslate(-new Point(Math.Round(this._Offset.X), Math.Round(this._Offset.Y)));
     this._Client.Render(Context);
     Context.Pop();
     Context.Pop();
 }
Ejemplo n.º 3
0
 public override void OverRender(GUIRenderContext Context)
 {
     if (this._ScoreSample == null)
     {
         this._ScoreSample = Font.Default.CreateSample(this.Board.GetScore(0).ToString());
     }
     Context.DrawText(Color.RGB(0.0, 0.0, 0.0), this._ScoreSample, new Point(10.0, 10.0));
 }
Ejemplo n.º 4
0
 public override void Render(GUIRenderContext Context)
 {
     Rectangle inner = new Rectangle(new Point(), this.Size);
     Context.PushClip(inner);
     foreach (_Child c in this._Children)
     {
         Context.PushTranslate(c.Offset);
         c.Control.Render(Context);
         Context.Pop();
     }
     Context.Pop();
 }
Ejemplo n.º 5
0
        public override void Render(GUIRenderContext Context)
        {
            Skin skin = this._Style.Skin;
            Surface surfback = skin.GetSurface(this._Style.Backing, this.Size);
            Context.DrawSurface(surfback);

            double width = this.Size.X * this._Value;
            Rectangle clip = new Rectangle(0, 0, width, this.Size.Y);
            Context.PushClip(clip);
            Surface surfprog = skin.GetSurface(this._Style.Progress, this.Size);
            Context.DrawSurface(surfprog);
            Context.Pop();
        }
Ejemplo n.º 6
0
 public override void Render(GUIRenderContext Context)
 {
     Context.PushClip(new Rectangle(this.Size));
     double d = 0.0;
     foreach (_Child c in this._Children)
     {
         Context.PushTranslate(new Point(d, 0.0).SwapIf(this._Direction == Axis.Vertical));
         c.Control.Render(Context);
         Context.Pop();
         d += c.Size + this._Seperation;
     }
     Context.Pop();
 }
Ejemplo n.º 7
0
        protected override void OnRenderFrame(FrameEventArgs e)
        {
            GL.ClearColor(Color.RGB(1.0, 1.0, 1.0));
            GL.Clear(ClearBufferMask.ColorBufferBit);

            GL.MatrixMode(MatrixMode.Projection);
            GL.LoadIdentity();

            GUIRenderContext rc = new GUIRenderContext(this.ViewSize);
            rc.Setup();
            this._Control.Render(rc);

            this.SwapBuffers();
        }
Ejemplo n.º 8
0
        public override void Render(GUIRenderContext Context)
        {
            CheckboxStyle style = this._Style;
            Skin s = style.Skin;

            Surface surfbox = s.GetSurface(style.Box, style.BoxSize);
            Context.DrawSurface(surfbox);

            if(this.Checked)
            {
                Surface surftick = s.GetSurface(style.Tick, style.BoxSize);
                Context.DrawSurface(surftick);
            }

            Rectangle textrect = new Rectangle(style.BoxSize.X + style.Padding, 0, this.Size.X - style.BoxSize.X, this.Size.Y);
            if(this._Sample == null)
                this._Sample = style.TextFont.CreateSample(this._Text, textrect.Size, TextAlign.Left, TextAlign.Top, TextWrap.Wrap);
            Context.DrawText(style.TextColor, this._Sample, textrect);
        }
Ejemplo n.º 9
0
        public override void Render(Point Offset, GUIRenderContext Context)
        {
            GL.Enable(EnableCap.Texture2D);
            GL.BindTexture(TextureTarget.Texture2D, this._Skin.Texture);
            GL.Color4(1.0, 1.0, 1.0, 1.0);

            int xs = this._XStops.Count - 1;
            int ys = this._YStops.Count - 1;

            GL.Begin(BeginMode.Quads);
            for (int tx = 0; tx < xs; tx++)
            {
                for (int ty = 0; ty < ys; ty++)
                {
                    double x = this._XStops[tx].RenderOffset + Offset.X;
                    double y = this._YStops[ty].RenderOffset + Offset.Y;
                    double xx = this._XStops[tx + 1].RenderOffset + Offset.X;
                    double yy = this._YStops[ty + 1].RenderOffset + Offset.Y;
                    double u = this._XStops[tx].TextureOffset;
                    double v = this._YStops[ty].TextureOffset;
                    double uu = this._XStops[tx + 1].TextureOffset;
                    double vv = this._YStops[ty + 1].TextureOffset;
                    GL.TexCoord2(u, v); GL.Vertex2(x, y);
                    GL.TexCoord2(uu, v); GL.Vertex2(xx, y);
                    GL.TexCoord2(uu, vv); GL.Vertex2(xx, yy);
                    GL.TexCoord2(u, vv); GL.Vertex2(x, yy);
                }
            }
            GL.End();
        }
Ejemplo n.º 10
0
        public override void Render(GUIRenderContext Context)
        {
            Skin s = this._Style.Skin;

            double areastart;
            double areaend;
            double areasize;
            double sliderstart;
            double slidersize;
            this._GetScrollMeasurements(out areastart, out areaend, out areasize, out sliderstart, out slidersize);
            slidersize = Math.Round(slidersize);
            areastart = Math.Round(areastart);
            sliderstart = Math.Round(sliderstart);
            if (this._Direction == Axis.Horizontal)
            {
                Context.DrawSurface(s.GetSurface(this._Style.HorizontalBackground, new Point(areasize, this.Size.Y)), new Point(areastart, 0.0));
                if (this._Enabled)
                {
                    Context.DrawSurface(s.GetSurface(this._Style.HorizontalSlider, new Point(slidersize, this.Size.Y)), new Point(sliderstart, 0.0));
                }
            }
            else
            {
                Context.DrawSurface(s.GetSurface(this._Style.VerticalBackground, new Point(this.Size.X, areasize)), new Point(0.0, areastart));
                if (this._Enabled)
                {
                    Context.DrawSurface(s.GetSurface(this._Style.VerticalSlider, new Point(this.Size.X, slidersize)), new Point(0.0, sliderstart));
                }
            }

            this._TopLeftButton.Render(Context);
            Context.PushTranslate(this._BottomRightButtonOffset);
            this._BottomRightButton.Render(Context);
            Context.Pop();
        }
Ejemplo n.º 11
0
 public override void Render(GUIRenderContext Context)
 {
     this._View.Render(Context);
     if (this._VScroll != null)
     {
         Context.PushTranslate(new Point(this.Size.X - this._VScroll.Size.X, 0.0));
         this._VScroll.Render(Context);
         Context.Pop();
     }
     if (this._HScroll != null)
     {
         Context.PushTranslate(new Point(0.0, this.Size.Y - this._HScroll.Size.Y));
         this._HScroll.Render(Context);
         Context.Pop();
     }
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Renders the surface with the given context with no additional translation.
 /// </summary>
 public void Render(GUIRenderContext Context)
 {
     this.Render(new Point(0.0, 0.0), Context);
 }
Ejemplo n.º 13
0
        public override void Render(GUIRenderContext Context)
        {
            Rectangle clirect = this.ClientRectangle;

            // Back
            Context.DrawSolid(this._Style.BackColor, clirect);

            // Client
            Context.PushTranslate(clirect.Location);
            this._Client.Render(Context);
            Context.Pop();

            // Form
            Skin s = this._Style.Skin;
            Context.DrawSurface(s.GetSurface(this._Style.Form, this._Style.Form.Width / 2, this._Style.FormVerticalStretchLine, this.Size));

            // Right of the title bar.
            Context.PushTranslate(this._RightTitleBarOffset);
            this._RightTitleBar.Render(Context);
            Context.Pop();

            // Text
            if (this._Text != null && this._Text != "")
            {
                Rectangle textrect = new Rectangle(
                        this._Style.TitleBarLeftRightMargin,
                        this._Style.TitleBarTopMargin,
                        this.Size.X - this._Style.TitleBarLeftRightMargin - this._RightTitleBar.Size.X - this._Style.TitleBarItemSeperation,
                        this._Style.TitleBarSize - this._Style.TitleBarTopMargin - this._Style.TitleBarBottomMargin);
                if (this._TextSample == null)
                {
                    this._TextSample = this._Style.TitleBarFont.CreateSample(this._Text, textrect.Size, TextAlign.Left, TextAlign.Center, TextWrap.Ellipsis);
                }
                Context.DrawText(this._Style.TitleBarTextColor, this._TextSample, textrect);
            }
        }
Ejemplo n.º 14
0
        public override void Render(GUIRenderContext Context)
        {
            if (this._Text != null && this._Text != "")
            {
                if (this._Sample == null)
                {
                    this._CreateSample();
                }
                //Context.DrawText(this._Color, this._Sample, new Rectangle(this.Size));

                /*
                Skin s = this._Style.Skin;
                Context.DrawSurface(s.GetSurface(this._Style.Textbox, this.Size));
                */
                Rectangle inner = new Rectangle(this.Size);
                Context.PushClip(inner);

                // Draw text
                Point texloc = new Point(inner.Location.X, inner.Location.Y + inner.Size.Y / 2.0 - this._Sample.Size.Y / 2.0);
                Context.DrawText(this._Color, this._Sample, texloc);

                // Draw selection
                if (this._Selection != null)
                {
                    int starti;
                    int endi;
                    this._Selection.Order(out starti, out endi);
                    Rectangle[] charbounds = this._Sample.CharacterBounds;
                    if (endi - starti > 0)
                    {
                        double startx = inner.Location.X + Textbox.SelectionX(charbounds, starti);
                        double endx = inner.Location.X + Textbox.SelectionX(charbounds, endi);
                        Rectangle clip = new Rectangle(startx, inner.Location.Y, endx - startx, inner.Size.Y);
                        Context.PushClip(clip);
                        Context.DrawSolid(this._Style.SelectionBackgroundColor, clip);
                        Context.DrawText(this._Style.SelectionTextColor, this._Sample, texloc);
                        Context.Pop();
                    }

                }

                Context.Pop();
            }
        }
Ejemplo n.º 15
0
 /// <summary>
 /// Renders a shadow for the hovering control. The context given will not be translated or clipped from
 /// the layer container.
 /// </summary>
 public virtual void RenderShadow(Point Position, GUIRenderContext Context)
 {
     ShadowStyle ss = this._Container.Style.DefaultShadowStyle;
     double width = ss.Width;
     Context.DrawSurface(ss.Skin.GetSurface(ss.Image, this.Size + new Point(width * 2.0, width * 2.0)), Position - new Point(width, width));
 }
Ejemplo n.º 16
0
        public override void Render(GUIRenderContext Context)
        {
            Skin s = this._Style.Skin;
            Context.DrawSurface(s.GetSurface(this._Style.Textbox, this.Size));

            Rectangle inner = new Rectangle(this.Size).Margin(this._Style.InteriorMargin);
            Context.PushClip(inner);

            // Draw text
            Point texloc = new Point(inner.Location.X, inner.Location.Y + inner.Size.Y / 2.0 - this._TextSample.Size.Y / 2.0);
            Context.DrawText(this._Style.TextColor, this._TextSample, texloc);

            // Draw selection
            if (this._Selection != null)
            {
                int starti;
                int endi;
                this._Selection.Order(out starti, out endi);
                Rectangle[] charbounds = this._TextSample.CharacterBounds;
                if (endi - starti > 0)
                {
                    double startx = inner.Location.X + SelectionX(charbounds, starti);
                    double endx = inner.Location.X + SelectionX(charbounds, endi);
                    Rectangle clip = new Rectangle(startx, inner.Location.Y, endx - startx, inner.Size.Y);
                    Context.PushClip(clip);
                    Context.DrawSolid(this._Style.SelectionBackgroundColor, clip);
                    Context.DrawText(this._Style.SelectionTextColor, this._TextSample, texloc);
                    Context.Pop();
                }

                // Draw cursor
                if (_CursorFlashTime > 0.0)
                {
                    int curi = this._Selection.Start;
                    double cursx = inner.Location.X + SelectionX(charbounds, curi);
                    Context.DrawSolid(this._Style.CursorColor, new Rectangle(cursx, inner.Location.Y, 1.0, inner.Size.Y));
                }
            }

            Context.Pop();
        }
Ejemplo n.º 17
0
 /// <summary>
 /// Renders the control with the given context.
 /// </summary>
 /// <remarks>Rendering, when the given context is current, should be done from (0.0, 0.0) to (Size.X, Size.Y).</remarks>
 public virtual void Render(GUIRenderContext Context)
 {
 }
Ejemplo n.º 18
0
 public override void Render(GUIRenderContext Context)
 {
     this._Client.Render(Context);
 }
Ejemplo n.º 19
0
 public override void Render(GUIRenderContext Context)
 {
     if (this._Text != null && this._Text != "")
     {
         if (this._Sample == null)
         {
             this._CreateSample();
         }
         Context.DrawText(this._Color, this._Sample, new Rectangle(this.Size));
     }
 }
Ejemplo n.º 20
0
        public override void Render(GUIRenderContext Context)
        {
            Skin s = this._Style.Skin;
            Surface sf;
            if (this._MouseOver)
            {
                if (this._MouseDown)
                {
                    sf = s.GetSurface(this._Style.Pushed, this.Size);
                }
                else
                {
                    sf = s.GetSurface(this._Style.Active, this.Size);
                }
            }
            else
            {
                sf = s.GetSurface(this._Style.Normal, this.Size);
            }
            Context.DrawSurface(sf);

            // Render client, if any
            if (this._Client != null)
            {
                Context.PushTranslate(new Point(this._Style.ClientMargin, this._Style.ClientMargin));
                this._Client.Render(Context);
                Context.Pop();
            }
        }
Ejemplo n.º 21
0
 public override void Render(GUIRenderContext Context)
 {
     if (this._Background != null)
     {
         this._Background.Render(Context);
     }
     bool lightbox = this._ModalOptions != null && this._ModalOptions.Lightbox;
     foreach (LayerControl lc in this._LayerControls)
     {
         if (lightbox && this._ModalOptions.LowestModal == lc)
         {
             this._DrawLightbox(Context);
             lightbox = false;
         }
         lc.RenderShadow(lc._Position, Context);
         Context.PushTranslate(lc._Position);
         lc.Render(Context);
         Context.Pop();
     }
     if (this._ModalOptions == null && this._LightboxTime > 0.0)
     {
         this._DrawLightbox(Context);
     }
 }
Ejemplo n.º 22
0
 public override void Render(GUIRenderContext Context)
 {
     Context.PushTranslate(this._ClientOffset);
     this._Client.Render(Context);
     Context.Pop();
 }
Ejemplo n.º 23
0
 private void _DrawLightbox(GUIRenderContext Context)
 {
     Color c = this._Style.LightBoxColor;
     c.A *= this._LightboxTime / this._Style.LightBoxFadeTime;
     Context.DrawSolid(c, new Rectangle(this.Size));
 }
Ejemplo n.º 24
0
 public override void Render(GUIRenderContext Context)
 {
     Context.PushTranslate(new Point(this._Margin, this._Margin));
     this._Child.Render(Context);
     Context.Pop();
 }
Ejemplo n.º 25
0
 /// <summary>
 /// Renders graph plot to the given render context.
 /// </summary>
 /// <param name="Size">The size of the renderable area.</param>
 /// <param name="Window">The area currently seen in the graph.</param>
 public virtual void Render(GUIRenderContext Context, Point Size, Rectangle Window)
 {
 }
Ejemplo n.º 26
0
        public override void Render(GUIRenderContext Context)
        {
            PopupStyle style = this._Style;
            Skin s = style.Skin;

            Context.DrawSurface(s.GetSurface(style.Back, this.Size));
            Rectangle inner = new Rectangle(this.Size).Margin(this._Style.Margin);

            foreach (_Item i in this._Items)
            {
                if (this._Active == i)
                {
                    SkinArea sa = this._MouseDown ? style.PushedItem : style.ActiveItem;
                    Context.DrawSurface(s.GetSurface(sa, new Point(this.Size.X, i.Size.Y)), new Point(0.0, i.Y + inner.Location.Y));
                }
                i.Render(Context, style, new Rectangle(0.0, i.Y, inner.Size.X, i.Size.Y) + inner.Location);
            }
        }
Ejemplo n.º 27
0
 public override void Render(GUIRenderContext Context)
 {
     Point size = this.Size;
     if (this._Left > 0.0) Context.DrawSolid(this._Color, new Rectangle(0.0, 0.0, this._Left, size.Y));
     if (this._Top > 0.0) Context.DrawSolid(this._Color, new Rectangle(0.0, 0.0, size.X, this._Top));
     if (this._Right > 0.0) Context.DrawSolid(this._Color, new Rectangle(size.X - this._Right, 0.0, this._Right, size.Y));
     if (this._Bottom > 0.0) Context.DrawSolid(this._Color, new Rectangle(0.0, size.Y - this._Bottom, size.X, this._Bottom));
     Context.PushTranslate(new Point(this._Left, this._Top));
     this._Client.Render(Context);
     Context.Pop();
 }
Ejemplo n.º 28
0
            /// <summary>
            /// Renders the item to the specified location.
            /// </summary>
            public void Render(GUIRenderContext Context, PopupStyle Style, Rectangle Area)
            {
                CommandMenuItem cmi = Source as CommandMenuItem;
                if (cmi != null)
                {
                    Context.DrawText(Style.TextColor, this.Sample, Area);
                }

                CompoundMenuItem cpmi = Source as CompoundMenuItem;
                if (cpmi != null)
                {
                    Context.DrawText(Style.TextColor, this.Sample, Area);

                    Point arrowsize = Style.CompoundArrowSize;
                    Context.DrawSurface(
                        Style.Skin.GetSurface(Style.CompoundArrow, arrowsize),
                        new Point(Area.Location.X + Area.Size.X - arrowsize.X, Area.Location.Y + Area.Size.Y * 0.5 - arrowsize.Y * 0.5));
                }

                SeperatorMenuItem smi = Source as SeperatorMenuItem;
                if (smi != null)
                {
                    Context.DrawSurface(
                        Style.Skin.GetSurface(Style.Seperator, new Point(Area.Size.X, Style.SeperatorHeight)),
                        Area.Location + new Point(0.0, Style.SeperatorPadding));
                }
            }
Ejemplo n.º 29
0
 public override void Render(GUIRenderContext Context)
 {
     Context.DrawSolid(this._Color, new Rectangle(this.Size));
 }
Ejemplo n.º 30
0
 /// <summary>
 /// Renders the surface with the given context and offset.
 /// </summary>
 public abstract void Render(Point Offset, GUIRenderContext Context);