Esempio n. 1
0
        /// <summary>
        /// Creates a new DataGrid component.
        /// </summary>
        /// <param name="name">name</param>
        /// <param name="alpha">alpha</param>
        /// <param name="x">x</param>
        /// <param name="y">y</param>
        /// <param name="width">width</param>
        /// <param name="rowHeight">rowHeight</param>
        /// <param name="rowCount">rowCount</param>
        public DataGrid(string name, ushort alpha, int x, int y, int width, int rowHeight, int rowCount)
        {
            Name = name;
            Alpha = 255;
            X = x;
            Y = y;
            Width = width;
            RowHeight = rowHeight;
            // Setting the RowCount changes the Height.
            RowCount = rowCount;

            // Show headers is on by default.
            // When the headers are shown the row count is decreased by one.
            ShowHeaders = true;

            _headers = Glide.CreateBitmap(Width, RowHeight);

            Clear();
        }
Esempio n. 2
0
        /// <summary>
        /// Renders the DataGrid onto it's parent container's graphics.
        /// </summary>
        public override void Render()
        {
            if (ShowHeaders && _renderHeaders)
            {
                _renderHeaders = false;
                RenderHeaders();
            }

            if (_renderItems)
            {
                _renderItems = false;

                // Only recreate the items Bitmap if necessary
                if (_items == null || _items.Height != _rows.Count * RowHeight)
                {
                    if (_items != null)
                        _items.Dispose();

                    if (_rows.Count < _rowCount)
                    {
                        _items = Glide.CreateBitmap(Width, _rowCount * RowHeight);
                        RenderEmpty();
                    }
                    else
                        _items = Glide.CreateBitmap(Width, _rows.Count * RowHeight);
                }
                else
                    _items.DrawRectangle(0, 0, 0, 0, Width, _items.Height, 0, 0, 0, 0, 0, 0, 0, 0, 255);

                if (_rows.Count > 0)
                {
                    for (int i = 0; i < _rows.Count; i++)
                        UpdateItem(i, false);
                }
            }

            int x = Parent.X + X;
            int y = Parent.Y + Y;

            if (_showHeaders)
            {
                Parent.Graphics.DrawImage(x, y, _headers, 0, 0, Width, RowHeight);
                y += RowHeight;
            }

            Parent.Graphics.DrawImage(x, y, _items, 0, _listY, Width, _rowCount * RowHeight);

            if (ShowScrollbar)
            {
                _scrollbarHeight = RowHeight;
                int travel = Height - _scrollbarHeight;

                if (_rows.Count > 0)
                    _scrollbarTick = (int)System.Math.Round((double)(travel / _rows.Count));
                else
                    _scrollbarTick = 0;

                _scrollbarHeight = Height - ((_rows.Count - _rowCount) * _scrollbarTick);

                x += Width - ScrollbarWidth;
                y = Parent.Y + Y;

                Parent.Graphics.DrawRectangle(0, 0, x, y, ScrollbarWidth, Height, 0, 0, ScrollbarBackColor, 0, 0, 0, 0, 0, 255);

                // Only show the scrollbar scrubber if it's smaller than the Height
                if (_scrollbarHeight < Height)
                    Parent.Graphics.DrawRectangle(0, 0, x, y + (_scrollIndex * _scrollbarTick), ScrollbarWidth, _scrollbarHeight, 0, 0, ScrollbarScrubberColor, 0, 0, 0, 0, 0, 255);
            }
        }
Esempio n. 3
0
 public void DrawImage(int xDst, int yDst, Bitmap bitmap, int xSrc, int ySrc, int width, int height)
 {
     DrawImage(xDst, yDst, bitmap, xSrc, ySrc, width, height, OpacityOpaque);
 }
 internal static extern void EnableTouchCollection(int flags, int x1, int x2, int y1, int y2, Bitmap bitmap);
Esempio n. 5
0
 public abstract void StretchImage(int xDst, int yDst, int widthDst, int heightDst, Bitmap bitmap,
     int xSrc, int ySrc, int widthSrc, int heightSrc, ushort opacity);
Esempio n. 6
0
 public abstract void TileImage(int xDst, int yDst, Bitmap bitmap, int width, int height, ushort opacity);
Esempio n. 7
0
 public abstract void RotateImage(int angle, int xDst, int yDst, Bitmap bitmap, int xSrc, int ySrc, int width, int height, ushort opacity);
Esempio n. 8
0
 /// <summary>
 /// Draws an image.
 /// </summary>
 /// <param name="xDst">Destination X.</param>
 /// <param name="yDst">Destination Y.</param>
 /// <param name="bitmap">Bitmap</param>
 /// <param name="xSrc">Source X.</param>
 /// <param name="ySrc">Source Y.</param>
 /// <param name="width">Width</param>
 /// <param name="height">Height</param>
 /// <param name="opacity">Opacity</param>
 public void DrawImage(int xDst, int yDst, Bitmap bitmap, int xSrc, int ySrc, int width, int height, ushort opacity)
 {
     _bitmap.DrawImage(xDst, yDst, bitmap, xSrc, ySrc, width, height, opacity);
 }
Esempio n. 9
0
 /// <summary>
 /// Creates a new Graphics object.
 /// </summary>
 /// <param name="width">Width</param>
 /// <param name="height">Height</param>
 public Graphics(int width, int height)
 {
     _bitmap = Glide.CreateBitmap(width, height);
 }
Esempio n. 10
0
 public abstract void DrawImage(int xDst, int yDst, Bitmap bitmap, int xSrc, int ySrc, int width, int height, ushort opacity);
Esempio n. 11
0
 //public void SetPixel(int xPos, int yPos, Color color);
 /// <summary>
 /// Stretch an image.
 /// </summary>
 /// <param name="xDst">Destination X.</param>
 /// <param name="yDst">Destination Y.</param>
 /// <param name="bitmap">Bitmap</param>
 /// <param name="width">Width</param>
 /// <param name="height">Height</param>
 /// <param name="opacity">Opacity</param>
 public void StretchImage(int xDst, int yDst, Bitmap bitmap, int width, int height, ushort opacity)
 {
     _bitmap.StretchImage(xDst, yDst, bitmap, width, height, opacity);
 }
Esempio n. 12
0
 /// <summary>
 /// Resizes images without distortion.
 /// </summary>
 /// <param name="xDst">Destination X.</param>
 /// <param name="yDst">Destination Y.</param>
 /// <param name="widthDst">Width</param>
 /// <param name="heightDst">Height</param>
 /// <param name="bitmap">Bitmap</param>
 /// <param name="border">Border</param>
 /// <param name="opacity">Opacity</param>
 public void Scale9Image(int xDst, int yDst, int widthDst, int heightDst, Bitmap bitmap, int border, ushort opacity)
 {
     _bitmap.Scale9Image(xDst, yDst, widthDst, heightDst, bitmap, border, border, border, border, opacity);
 }
Esempio n. 13
0
 //public Color GetPixel(int xPos, int yPos);
 //public void MakeTransparent(Color color);
 //public void RotateImage(int angle, int xDst, int yDst, Bitmap bitmap, int xSrc, int ySrc, int width, int height, ushort opacity);
 /// <summary>
 /// Resizes images without distortion.
 /// </summary>
 /// <param name="xDst">Destination X.</param>
 /// <param name="yDst">Destination Y.</param>
 /// <param name="widthDst">Width</param>
 /// <param name="heightDst">Height</param>
 /// <param name="bitmap">Bitmap</param>
 /// <param name="leftBorder">Left border.</param>
 /// <param name="topBorder">Top border.</param>
 /// <param name="rightBorder">Right border.</param>
 /// <param name="bottomBorder">Bottom border.</param>
 /// <param name="opacity">Opacity</param>
 public void Scale9Image(int xDst, int yDst, int widthDst, int heightDst, Bitmap bitmap, int leftBorder, int topBorder, int rightBorder, int bottomBorder, ushort opacity)
 {
     _bitmap.Scale9Image(xDst, yDst, widthDst, heightDst, bitmap, leftBorder, topBorder, rightBorder, bottomBorder, opacity);
 }
Esempio n. 14
0
 /// <summary>
 /// Renders the ListItem onto the provided bitmap.
 /// </summary>
 /// <param name="bitmap">Bitmap this item will be drawn on.</param>
 public override void Render(Bitmap bitmap)
 {
     Width = Parent.Width;
     bitmap.DrawTextInRect(Label, X, Y + (Height - _font.Height) / 2, Width, _font.Height, Bitmap.DT_AlignmentCenter, Colors.Black, _font);
     bitmap.DrawLine(Colors.LightGray, 1, 0, Y + Height, Width, Y + Height);
 }
Esempio n. 15
0
 public abstract void Scale9Image(int xDst, int yDst, int widthDst, int heightDst, Bitmap bitmap, 
     int leftBorder, int topBorder, int rightBorder, int bottomBorder, ushort opacity);
Esempio n. 16
0
 /// <summary>
 /// Renders this display object on a specified bitmap.
 /// </summary>
 /// <param name="bitmap"></param>
 public virtual void Render(Bitmap bitmap)
 {
     // Do something
 }
Esempio n. 17
0
 /// <summary>
 /// Draws an image.
 /// </summary>
 /// <param name="xDst">Destination X.</param>
 /// <param name="yDst">Destination Y.</param>
 /// <param name="bitmap">Bitmap</param>
 /// <param name="xSrc">Source X.</param>
 /// <param name="ySrc">Source Y.</param>
 /// <param name="width">Width</param>
 /// <param name="height">Height</param>
 public void DrawImage(int xDst, int yDst, Bitmap bitmap, int xSrc, int ySrc, int width, int height)
 {
     _bitmap.DrawImage(xDst, yDst, bitmap, xSrc, ySrc, width, height);
 }