Example #1
0
 public override void Render( RenderingBuffer buffer )
 {
     Attr attr = Colors.Blend( Color.DarkCyan, Color.DarkBlue );
     buffer.FillRectangle(0, 0, ActualWidth, ActualHeight, UnicodeTable.MediumShade, attr);
     int filled = ( int ) ( ActualWidth*( Percent*0.01 ) );
     buffer.FillRectangle(0, 0, Math.Min( filled, ActualWidth ), ActualHeight, UnicodeTable.DarkShade, attr);
 }
Example #2
0
        public override void Render( RenderingBuffer buffer )
        {
            Attr attr = Colors.Blend( Color.Black, Color.DarkGreen );
            Attr inactiveAttr = Colors.Blend( Color.DarkGray, Color.DarkGreen );

            // Transparent background for borders
            buffer.SetOpacityRect( 0, 0, ActualWidth, ActualHeight, 3 );

            buffer.FillRectangle( 0, 0, ActualWidth, ActualHeight, ' ', attr );

            // Transparent child content part
            if ( ActualWidth > 2 && ActualHeight > 3 )
                buffer.SetOpacityRect( 1, 3, ActualWidth - 2, ActualHeight - 4, 2 );

            renderBorderSafe( buffer, 0, 2, Math.Max( getTabHeaderWidth( ) - 1, ActualWidth - 1 ), ActualHeight - 1 );

            // Start to render header
            buffer.FillRectangle( 0, 0, ActualWidth, Math.Min( 2, ActualHeight ), ' ', attr );

            int x = 0;

            // Render tabs before active tab
            for ( int tab = 0; tab < tabDefinitions.Count; x += TabDefinitions[ tab++ ].Title.Length + 3 ) {
                var tabDefinition = TabDefinitions[ tab ];
                if ( tab <= activeTabIndex ) {
                    buffer.SetPixelSafe( x, 0, UnicodeTable.SingleFrameTopLeftCorner );
                    buffer.SetPixelSafe( x, 1, UnicodeTable.SingleFrameVertical );
                }
                if ( tab == activeTabIndex ) {
                    buffer.SetPixelSafe( x, 2,
                        activeTabIndex == 0 ? UnicodeTable.SingleFrameVertical : UnicodeTable.SingleFrameBottomRightCorner );
                }
                for ( int i = 0; i < tabDefinition.Title.Length + 2; i++ ) {
                    buffer.SetPixelSafe( x + 1 + i, 0, UnicodeTable.SingleFrameHorizontal );
                    if ( tab == activeTabIndex )
                        buffer.SetPixelSafe( x + 1 + i, 2, ' ' );
                }
                buffer.RenderStringSafe( " " + tabDefinition.Title + " ", x + 1, 1,
                    activeTabIndex == tab ? attr : inactiveAttr );
                if ( tab >= activeTabIndex ) {
                    buffer.SetPixelSafe( x + tabDefinition.Title.Length + 3, 0, UnicodeTable.SingleFrameTopRightCorner );
                    buffer.SetPixelSafe( x + tabDefinition.Title.Length + 3, 1, UnicodeTable.SingleFrameVertical );
                }
                if ( tab == activeTabIndex ) {
                    buffer.SetPixelSafe( x + tabDefinition.Title.Length + 3, 2,
                        activeTabIndex == tabDefinitions.Count - 1 && ActualWidth - 1 == x + tabDefinition.Title.Length + 3
                            ? UnicodeTable.SingleFrameVertical
                            : UnicodeTable.SingleFrameBottomLeftCorner );
                }
            }
        }
Example #3
0
 public override void Render(RenderingBuffer buffer) {
     Attr attr = Colors.Blend(Color.Black, Color.DarkYellow);
     buffer.FillRectangle( 0, 0, ActualWidth, ActualHeight, ' ', attr);
     for (int x = 0; x < ActualWidth; ++x) {
         for (int y = 0; y < ActualHeight; ++y) {
             if (y == 0 && x < text.Length) {
                 buffer.SetPixel(x, y, text[x], attr);
             }
         }
     }
     buffer.SetOpacityRect(0, 0, ActualWidth, ActualHeight, 3);
 }
Example #4
0
        public override void Render(RenderingBuffer buffer) {
            Attr captionAttrs;
            if (Disabled) {
                captionAttrs = Colors.Blend(Color.Gray, Color.DarkGray);
            } else {
                if (HasFocus)
                    captionAttrs = Colors.Blend(Color.White, Color.DarkGreen);
                else
                    captionAttrs = Colors.Blend(Color.Black, Color.DarkGreen);
            }

            if (pressed || pressedUsingKeyboard) {
                buffer.FillRectangle(1, 0, ActualWidth - 1, ActualHeight - 1, ' ', captionAttrs);
                buffer.SetOpacityRect(0, 0, 1, ActualHeight, 3);
                buffer.FillRectangle(0, 0, 1, ActualHeight, ' ', captionAttrs);
                if (!string.IsNullOrEmpty(Caption)) {
                    RenderString(Caption, buffer, 2 + 1 +(ActualWidth - 2 * 2 - Caption.Length) / 2,
                        (ActualHeight-1)/2, ActualWidth - 2 * 2, captionAttrs);
                }
                buffer.SetOpacityRect(0, ActualHeight-1, ActualWidth, 1, 3);
                buffer.FillRectangle(0, ActualHeight - 1, ActualWidth, 1, ' ', Attr.NO_ATTRIBUTES);
            } else {
                buffer.FillRectangle(0, 0, ActualWidth - 1, ActualHeight, ' ', captionAttrs);
                if (!string.IsNullOrEmpty(Caption)) {
                    RenderString(Caption, buffer, 2 + (ActualWidth - 2 * 2 - Caption.Length) / 2, 
                        (ActualHeight - 1) / 2, ActualWidth - 2 * 2, captionAttrs);
                }
                buffer.SetPixel(0, ActualHeight-1, ' ');
                buffer.SetOpacityRect(0, ActualHeight -1, ActualWidth, 1, 3);
                buffer.FillRectangle(1, ActualHeight-1, ActualWidth - 1, 1, UnicodeTable.UpperHalfBlock, Attr.NO_ATTRIBUTES);
                buffer.SetOpacityRect(ActualWidth - 1, 0, 1, ActualHeight, 3);
                buffer.FillRectangle(ActualWidth - 1, 1, 1, ActualHeight - 2, UnicodeTable.FullBlock, Attr.NO_ATTRIBUTES);
                buffer.SetPixel(ActualWidth - 1, 0, UnicodeTable.LowerHalfBlock);
            }
        }
Example #5
0
 public override void Render( RenderingBuffer buffer ) {
     Attr attr = Colors.Blend( Color.Black, Color.Gray );
     buffer.FillRectangle(0, 0, ActualWidth, ActualHeight, ' ', attr);
 }
Example #6
0
        public override void Render(RenderingBuffer buffer) {
            Attr captionAttrs;
            if (HasFocus)
                captionAttrs = Colors.Blend(Color.Black, Color.DarkGreen);
            else
                captionAttrs = Colors.Blend(Color.Black, Color.Gray);

            buffer.FillRectangle(0, 0, ActualWidth, ActualHeight, UnicodeTable.SingleFrameHorizontal, captionAttrs);
        }
Example #7
0
            public override void Render(RenderingBuffer buffer)
            {
                Attr borderAttrs = Colors.Blend(Color.Black, Color.Gray);

                // Background
                buffer.FillRectangle(0, 1, ActualWidth, ActualHeight - 1, ' ', borderAttrs);

                // Первые width пикселей первой строки - прозрачные, но события мыши не пропускают
                // По нажатию на них мы закрываем всплывающее окно вручную
                buffer.SetOpacityRect(0, 0, parentItemWidth, 1, 2);
                // Оставшиеся пиксели первой строки - пропускают события мыши
                // И WindowsHost закроет всплывающее окно автоматически при нажатии или
                // перемещении нажатого курсора над этим местом
                buffer.SetOpacityRect( parentItemWidth, 0, ActualWidth - parentItemWidth, 1, 6 );

                if (shadow) {
                    buffer.SetOpacity(0, ActualHeight - 1, 2 + 4);
                    buffer.SetOpacity(ActualWidth - 1, 1, 2 + 4);
                    buffer.SetOpacityRect(ActualWidth - 1, 2, 1, ActualHeight - 2, 1 + 4);
                    buffer.FillRectangle(ActualWidth - 1, 2, 1, ActualHeight - 2, UnicodeTable.FullBlock, borderAttrs);
                    buffer.SetOpacityRect(1, ActualHeight - 1, ActualWidth - 1, 1, 3 + 4);
                    buffer.FillRectangle(1, ActualHeight - 1, ActualWidth - 1, 1, UnicodeTable.UpperHalfBlock,
                                          Attr.NO_ATTRIBUTES);
                }

                RenderBorders( buffer, new Point( 1, 1 ),
                               shadow
                                   ? new Point( ActualWidth - 3, ActualHeight - 2 )
                                   : new Point( ActualWidth - 2, ActualHeight - 1 ),
                               true, borderAttrs );
            }
Example #8
0
        public override void Render(RenderingBuffer buffer) {
            Attr captionAttrs;
            Attr specialAttrs;
            if ( HasFocus || this.expanded ) {
                captionAttrs = Colors.Blend( Color.Black, Color.DarkGreen );
                specialAttrs = Colors.Blend( Color.DarkRed, Color.DarkGreen );
            } else {
                captionAttrs = Colors.Blend( Color.Black, Color.Gray );
                specialAttrs = Colors.Blend( Color.DarkRed, Color.Gray );
            }
            if ( disabled )
                captionAttrs = Colors.Blend( Color.DarkGray, Color.Gray );

            buffer.FillRectangle( 0, 0, ActualWidth, ActualHeight, ' ', captionAttrs );
            if ( null != Title ) {
                renderString( Title, buffer, 1, 0, ActualWidth, captionAttrs, 
                    Disabled ? captionAttrs : specialAttrs );
            }
            if ( null != TitleRight )
                RenderString( TitleRight, buffer, ActualWidth - TitleRight.Length - 1, 0,
                              TitleRight.Length, captionAttrs );
        }
        public override void Render(RenderingBuffer buffer) {
            Attr attr = Colors.Blend(Color.DarkCyan, Color.DarkBlue);

            buffer.SetOpacityRect( 0,0, ActualWidth, ActualHeight, 2 );

            if ( horizontalScrollVisible ) {
                buffer.SetOpacityRect( 0, ActualHeight-1, ActualWidth, 1, 0 );
                buffer.SetPixel(0, ActualHeight - 1, UnicodeTable.ArrowLeft, attr); // ◄
                // оставляем дополнительный пиксель справа, если одновременно видны оба скроллбара
                int rightOffset = verticalScrollVisible ? 1 : 0;
                if ( ActualWidth > 2 + rightOffset ) {
                    buffer.FillRectangle(1, ActualHeight - 1, ActualWidth - (2 + rightOffset), 1, 
                        UnicodeTable.MediumShade, attr); // ▒
                }
                if ( ActualWidth > 1 + rightOffset ) {
                    buffer.SetPixel(ActualWidth - (1 + rightOffset), ActualHeight - 1,
                        UnicodeTable.ArrowRight, attr); // ►
                }

                // определим, в каком месте находится ползунок
                if ( ActualWidth > 3 + ( verticalScrollVisible ? 1 : 0 ) ) {
                    int remainingWidth = ActualWidth - ( verticalScrollVisible ? 1 : 0 );
                    int extraWidth = Content.RenderSize.Width - remainingWidth;
                    int pages = extraWidth/( remainingWidth - 2 - 1 );

                    //Debugger.Log( 1, "", "pages: " + pages + "\n" );

                    int scrollerPos;
                    if ( pages == 0 ) {
                        double posInDelta = ( remainingWidth*1.0 - 2 - 1 )/extraWidth;
                        //Debugger.Log( 1, "", "posInDelta: " + posInDelta + "\n" );
                        scrollerPos = ( int ) Math.Round( posInDelta*deltaX );
                    } else {
                        double deltaInPos = ( extraWidth*1.0 )/( remainingWidth - 2 - 1 );
                        //Debugger.Log( 1, "", "deltaX/( deltaInPos ): " + deltaX/( deltaInPos ) + "\n" );
                        scrollerPos = ( int ) Math.Round( deltaX/( deltaInPos ) );
                    }

                    buffer.SetPixel(1 + scrollerPos, ActualHeight - 1, UnicodeTable.BlackSquare, attr); // ■
                } else if ( ActualWidth == 3 + ( verticalScrollVisible ? 1 : 0 ) ) {
                    buffer.SetPixel(1, ActualHeight - 1, UnicodeTable.BlackSquare, attr); // ■
                }
            }
            if ( verticalScrollVisible ) {
                buffer.SetOpacityRect(ActualWidth-1, 0, 1, ActualHeight, 0);

                buffer.SetPixel(ActualWidth - 1, 0, UnicodeTable.ArrowUp, attr); // ▲
                // оставляем дополнительный пиксель снизу, если одновременно видны оба скроллбара
                int downOffset = horizontalScrollVisible ? 1 : 0;
                if ( ActualHeight > 2 + downOffset ) {
                    buffer.FillRectangle(ActualWidth - 1, 1, 1, ActualHeight - (2 + downOffset), UnicodeTable.MediumShade, attr); // ▒
                }
                if ( ActualHeight > 1 + downOffset ) {
                    buffer.SetPixel(ActualWidth - 1, ActualHeight - (1 + downOffset), UnicodeTable.ArrowDown, attr); // ▼
                }

                // определим, в каком месте находится ползунок
                if ( ActualHeight > 3 + ( horizontalScrollVisible ? 1 : 0 ) ) {
                    int remainingHeight = ActualHeight - (horizontalScrollVisible ? 1 : 0);
                    int extraHeight = Content.RenderSize.Height - remainingHeight;
                    int pages = extraHeight/( remainingHeight - 2 - 1 );

                    //Debugger.Log( 1, "", "pages: " + pages + "\n" );

                    int scrollerPos;
                    if ( pages == 0 ) {
                        double posInDelta = ( remainingHeight*1.0 - 2 - 1 )/extraHeight;
                        //Debugger.Log( 1, "", "posInDelta: " + posInDelta + "\n" );
                        scrollerPos = ( int ) Math.Round( posInDelta*deltaY );
                    } else {
                        double deltaInPos = ( extraHeight*1.0 )/( remainingHeight - 2 - 1 );
                        //Debugger.Log( 1, "", "deltaY/( deltaInPos ): " + deltaY/( deltaInPos ) + "\n" );
                        scrollerPos = ( int ) Math.Round( deltaY/( deltaInPos ) );
                    }

                    buffer.SetPixel(ActualWidth - 1, 1 + scrollerPos, UnicodeTable.BlackSquare, attr); // ■
                } else if ( ActualHeight == 3 + ( horizontalScrollVisible ? 1 : 0 ) ) {
                    buffer.SetPixel(ActualWidth - 1, 1, UnicodeTable.BlackSquare, attr); // ■
                }
            }
            if ( horizontalScrollVisible && verticalScrollVisible ) {
                buffer.SetPixel(ActualWidth - 1, ActualHeight - 1, UnicodeTable.SingleFrameBottomRightCorner, attr); // ┘
            }
        }
Example #10
0
 public override void Render(RenderingBuffer buffer)
 {
     Attr borderAttrs = moving ? Colors.Blend(Color.Green, Color.Gray) : Colors.Blend(Color.White, Color.Gray);
     // background
     buffer.FillRectangle(0, 0, this.ActualWidth, this.ActualHeight, ' ', borderAttrs);
     // Borders
     RenderBorders(buffer, new Point(0, 0), new Point(ActualWidth - 3, ActualHeight - 2),
         this.moving || this.resizing, borderAttrs);
     // close button
     if (ActualWidth > 4) {
         buffer.SetPixel(2, 0, '[');
         buffer.SetPixel(3, 0, showClosingGlyph ? UnicodeTable.WindowClosePressedSymbol : UnicodeTable.WindowCloseSymbol,
             Colors.Blend(Color.Green, Color.Gray));
         buffer.SetPixel(4, 0, ']');
     }
     // shadows
     buffer.SetOpacity(0, ActualHeight - 1, 2+4);
     buffer.SetOpacity(1, ActualHeight - 1, 2+4);
     buffer.SetOpacity(ActualWidth - 1, 0, 2+4);
     buffer.SetOpacity(ActualWidth - 2, 0, 2+4);
     buffer.SetOpacityRect(2, ActualHeight - 1, ActualWidth - 2, 1, 1+4);
     buffer.SetOpacityRect(ActualWidth - 2, 1, 2, ActualHeight - 1, 1+4);
     // title
     if (!string.IsNullOrEmpty(Title)) {
         int titleStartX = 7;
         bool renderTitle = false;
         string renderTitleString = null;
         int availablePixelsCount = ActualWidth - titleStartX*2;
         if (availablePixelsCount > 0) {
             renderTitle = true;
             if (Title.Length <= availablePixelsCount) {
                 // dont truncate title
                 titleStartX += (availablePixelsCount - Title.Length)/2;
                 renderTitleString = Title;
             } else {
                 renderTitleString = Title.Substring(0, availablePixelsCount);
                 if (renderTitleString.Length > 2) {
                     renderTitleString = renderTitleString.Substring(0, renderTitleString.Length - 2) + "..";
                 } else {
                     renderTitle = false;
                 }
             }
         }
         if (renderTitle) {
             // assert !string.IsNullOrEmpty(renderingTitleString);
             buffer.SetPixel(titleStartX - 1, 0, ' ', borderAttrs);
             for (int i = 0; i < renderTitleString.Length; i++) {
                 buffer.SetPixel(titleStartX + i, 0, renderTitleString[i], borderAttrs);
             }
             buffer.SetPixel(titleStartX + renderTitleString.Length, 0, ' ', borderAttrs);
         }
     }
 }
Example #11
0
        public override void Render(RenderingBuffer buffer)
        {
            Attr selectedAttr = Colors.Blend(Color.White, Color.DarkGreen);
            Attr attr = Colors.Blend(Color.Black, Color.DarkCyan);
            Attr disabledAttr = Colors.Blend(Color.Gray, Color.DarkCyan);
            for ( int y = 0; y < ActualHeight; y++ ) {
                string item = y < items.Count ? items[ y ] : null;

                if ( item != null ) {
                    Attr currentAttr = disabledItemsIndexes.Contains(y) ? disabledAttr :
                        (SelectedItemIndex == y ? selectedAttr : attr);

                    buffer.SetPixel( 0, y, ' ', currentAttr );
                    if ( ActualWidth > 1 ) {
                        // минус 2 потому что у нас есть по пустому пикселю слева и справа
                        int rendered = RenderString( item, buffer, 1, y, ActualWidth - 2, currentAttr );
                        buffer.FillRectangle( 1 + rendered, y, ActualWidth - (1 + rendered), 1, ' ',
                            currentAttr);
                    }
                } else {
                    buffer.FillRectangle(0, y, ActualWidth, 1, ' ', attr);
                }
            }
        }
Example #12
0
        public override void Render(RenderingBuffer buffer)
        {
            Attr attrs;
            if ( HasFocus ) {
                attrs = Colors.Blend(Color.White, Color.DarkGreen);
            } else attrs = Colors.Blend( Color.Black, Color.DarkCyan );

            buffer.SetPixel( 0, 0, ' ', attrs );
            int usedForCurrentItem = 0;
            if ( Items.Count != 0 && ActualWidth > 4 ) {
                usedForCurrentItem = RenderString(Items[SelectedItemIndex ?? 0], buffer, 1, 0, ActualWidth - 4, attrs);
            }
            buffer.FillRectangle( 1 + usedForCurrentItem, 0, ActualWidth - (usedForCurrentItem + 1), 1, ' ', attrs );
            if (ActualWidth > 2)
            {
                buffer.SetPixel(ActualWidth - 2, 0, opened ? '^' : 'v', attrs);
            }
        }
Example #13
0
            public override void Render(RenderingBuffer buffer)
            {
                Attr borderAttrs = Colors.Blend(Color.Black, Color.DarkCyan);

                // Background
                buffer.FillRectangle(1, 1, this.ActualWidth - 1, this.ActualHeight - 1, ' ', borderAttrs);

                // First row and first column are transparent
                // Column is also transparent for mouse events
                buffer.SetOpacityRect( 0,0,ActualWidth, 1, 2 );
                buffer.SetOpacityRect( 0, 1, 1, ActualHeight-1, 6 );
                if ( shadow ) {
                    buffer.SetOpacity( 1, ActualHeight - 1, 2+4 );
                    buffer.SetOpacity( ActualWidth - 1, 0, 2+4 );
                    buffer.SetOpacityRect( ActualWidth - 1, 1, 1, ActualHeight - 1, 1+4 );
                    buffer.FillRectangle(ActualWidth - 1, 1, 1, ActualHeight - 1, UnicodeTable.FullBlock, borderAttrs);
                    buffer.SetOpacityRect( 2, ActualHeight - 1, ActualWidth - 2, 1, 3+4 );
                    buffer.FillRectangle(2, ActualHeight - 1, ActualWidth - 2, 1, UnicodeTable.UpperHalfBlock,
                                          Attr.NO_ATTRIBUTES );
                }
            }
Example #14
0
        public override void Render(RenderingBuffer buffer) {
            Attr attr = Colors.Blend( Color.Black, Color.DarkGreen );

            // прозрачный фон для рамки
            buffer.SetOpacityRect( 0, 0, ActualWidth, ActualHeight, 3 );
            // полностью прозрачный внутри
            if (ActualWidth > 2 && ActualHeight > 2)
                buffer.SetOpacityRect( 1, 1, ActualWidth-2, ActualHeight-2, 2 );
            // title
            int titleRenderedWidth = 0;
            if ( !string.IsNullOrEmpty( title ) )
                titleRenderedWidth = RenderString( title, buffer, 2, 0, ActualWidth - 4, attr );
            // upper border
            for ( int x = 0; x < ActualWidth; x++ ) {
                char? c = null;
                if ( x == 0 )
                    c = UnicodeTable.SingleFrameTopLeftCorner;
                else if (x == ActualWidth - 1)
                    c = UnicodeTable.SingleFrameTopRightCorner;
                else if (x == 1 || x == 2 + titleRenderedWidth)
                    c = ' ';
                else if ( x > 2 + titleRenderedWidth && x < ActualWidth - 1 )
                    c = UnicodeTable.SingleFrameHorizontal;
                if (c != null)
                    buffer.SetPixel( x, 0, c.Value, attr );
            }
            // left border
            if (ActualHeight > 2)
                buffer.FillRectangle(0, 1, 1, ActualHeight - 2, UnicodeTable.SingleFrameVertical, attr);
            if (ActualHeight > 1)
                buffer.SetPixel(0, ActualHeight - 1, UnicodeTable.SingleFrameBottomLeftCorner, attr);
            // right border
            if ( ActualWidth > 1 ) {
                if (ActualHeight > 2)
                    buffer.FillRectangle(ActualWidth - 1, 1, 1, ActualHeight - 2, UnicodeTable.SingleFrameVertical, attr);
                if (ActualHeight > 1)
                    buffer.SetPixel(ActualWidth - 1, ActualHeight - 1, UnicodeTable.SingleFrameBottomRightCorner, attr);
            }
            // bottom border
            if ( ActualHeight > 1 && ActualWidth > 2 ) {
                buffer.FillRectangle(1, ActualHeight - 1, ActualWidth - 2, 1, UnicodeTable.SingleFrameHorizontal, attr);
            }
        }
Example #15
0
            public override void Render(RenderingBuffer buffer)
            {
                Attr borderAttrs = Colors.Blend(Color.Black, Color.DarkCyan);
                // устанавливаем прозрачными первую строку и первый столбец
                // для столбца дополнительно включена прозрачность для событий мыши

                // background
                buffer.FillRectangle(1, 1, this.ActualWidth - 1, this.ActualHeight - 1, ' ', borderAttrs);

                buffer.SetOpacityRect( 0,0,ActualWidth, 1, 2 );
                buffer.SetOpacityRect( 0, 1, 1, ActualHeight-1, 6 );
                if ( shadow ) {
                    buffer.SetOpacity( 1, ActualHeight - 1, 2+4 );
                    buffer.SetOpacity( ActualWidth - 1, 0, 2+4 );
                    buffer.SetOpacityRect( ActualWidth - 1, 1, 1, ActualHeight - 1, 1+4 );
                    buffer.FillRectangle(ActualWidth - 1, 1, 1, ActualHeight - 1, UnicodeTable.FullBlock, borderAttrs);
                    buffer.SetOpacityRect( 2, ActualHeight - 1, ActualWidth - 2, 1, 3+4 );
                    buffer.FillRectangle(2, ActualHeight - 1, ActualWidth - 2, 1, UnicodeTable.UpperHalfBlock,
                                          Attr.NO_ATTRIBUTES );
                }
            }
Example #16
0
 public override void Render(RenderingBuffer buffer)
 {
     buffer.FillRectangle(0, 0, ActualWidth, ActualHeight, ' ', Attr.BACKGROUND_BLUE);
 }
Example #17
0
 public override void Render(RenderingBuffer buffer) {
     Attr attr = Colors.Blend(Color.White, Color.DarkBlue);
     buffer.FillRectangle(0, 0, ActualWidth, ActualHeight, ' ', attr);
     if (null != text) {
         for (int i = displayOffset; i < text.Length; i++) {
             if (i - displayOffset < ActualWidth - 2 && i - displayOffset >= 0) {
                 buffer.SetPixel(1 + i - displayOffset, 0, text[i]);
             }
         }
     }
     Attr arrowsAttr = Colors.Blend(Color.Green, Color.DarkBlue);
     if (displayOffset > 0)
         buffer.SetPixel(0, 0, '<', arrowsAttr);
     if (!String.IsNullOrEmpty(text) && ActualWidth - 2 + displayOffset < text.Length)
         buffer.SetPixel(ActualWidth - 1, 0, '>', arrowsAttr);
 }
Example #18
0
 protected void RenderBorders( RenderingBuffer buffer, Point a, Point b, bool singleOrDouble, Attr attrs ) {
     if ( singleOrDouble ) {
         // Corners
         buffer.SetPixel(a.X, a.Y, UnicodeTable.SingleFrameTopLeftCorner, attrs);
         buffer.SetPixel(b.X, b.Y, UnicodeTable.SingleFrameBottomRightCorner, attrs);
         buffer.SetPixel(a.X, b.Y, UnicodeTable.SingleFrameBottomLeftCorner, attrs);
         buffer.SetPixel(b.X, a.Y, UnicodeTable.SingleFrameTopRightCorner, attrs);
         // Horizontal & vertical frames
         buffer.FillRectangle(a.X + 1, a.Y, b.X - a.X - 1, 1, UnicodeTable.SingleFrameHorizontal, attrs);
         buffer.FillRectangle(a.X + 1, b.Y, b.X - a.X - 1, 1, UnicodeTable.SingleFrameHorizontal, attrs);
         buffer.FillRectangle(a.X, a.Y + 1, 1, b.Y - a.Y - 1, UnicodeTable.SingleFrameVertical, attrs);
         buffer.FillRectangle(b.X, a.Y + 1, 1, b.Y - a.Y - 1, UnicodeTable.SingleFrameVertical, attrs);
     } else {
         // Corners
         buffer.SetPixel( a.X, a.Y, UnicodeTable.DoubleFrameTopLeftCorner, attrs );
         buffer.SetPixel( b.X, b.Y, UnicodeTable.DoubleFrameBottomRightCorner, attrs );
         buffer.SetPixel( a.X, b.Y, UnicodeTable.DoubleFrameBottomLeftCorner, attrs );
         buffer.SetPixel( b.X, a.Y, UnicodeTable.DoubleFrameTopRightCorner, attrs );
         // Horizontal & vertical frames
         buffer.FillRectangle( a.X + 1, a.Y, b.X - a.X - 1, 1, UnicodeTable.DoubleFrameHorizontal, attrs );
         buffer.FillRectangle( a.X + 1, b.Y, b.X - a.X - 1, 1, UnicodeTable.DoubleFrameHorizontal, attrs );
         buffer.FillRectangle( a.X, a.Y + 1, 1, b.Y - a.Y - 1, UnicodeTable.DoubleFrameVertical, attrs );
         buffer.FillRectangle( b.X, a.Y + 1, 1, b.Y - a.Y - 1, UnicodeTable.DoubleFrameVertical, attrs );
     }
 }