Example #1
0
 public PM_GridRow(int _columns, double _height)
 {
     __cells    = new PM_GridCell[_columns];
     height     = _height;
     readOnly   = PM_state.UNSET;
     visibility = Visibility.Visible;
 }
Example #2
0
 public void setCell(PM_GridCell _cell, int _col)
 {
     Contract.Requires(_col >= 0 && _col < cells.Length);
     if (_cell != null)
     {
         _cell.grid = grid;
     }
     __cells[_col] = _cell;
 }
Example #3
0
        public void value(int _col, int _row, object _value)
        {
            PM_GridCell _cell = __model.cell(_col, _row);

            if (_cell == null)
            {
                return;
            }
            _cell.value = _value;
            updateCell(new cellInfo(_cell, _col, _row));
        }
Example #4
0
 public bool hasValues()
 {
     for (int _i = 0; _i < __cells.Length; _i++)
     {
         PM_GridCell _cell = __cells[_i];
         if (_cell != null && _cell.hasValue())
         {
             return(true);
         }
     }
     return(false);
 }
Example #5
0
        public void value(int _columnIndex, int _rowIndex, object _value)
        {
            PM_GridRow _row = row(_rowIndex);

            if (_row == null)
            {
                return;
            }
            PM_GridCell _cell = _row.cell(_columnIndex);

            if (_cell != null)
            {
                _cell.value = _value;
            }
        }
Example #6
0
 string value(PM_GridRow _row)
 {
     Contract.Requires(_row != null);
     if (__column >= 0 && __column < _row.cells.Length)
     {
         PM_GridCell _cell = _row.cell(__column);
         if (_cell != null)
         {
             return((string)_cell.value);
         }
         else
         {
             return("");
         }
     }
     else
     {
         throw new Exception("__column out of range.");
     }
 }
Example #7
0
        void detachDisplayedControls()
        {
            for (int _i = 0; _i < __displayedCells.Count; _i++)
            {
                PM_GridCell _cell = __displayedCells[_i].cell;
                _cell.setOnGrid = false;
                Control _control = _cell.control();
                _control.Visibility = Visibility.Hidden;

                switch (((PM_GridEventArg)_control.Tag).type)
                {
                case PM_GridCellType.HORIZONTALHEADER:
                    ((Button)_control).Click -= OnCellClicked;
                    break;

                case PM_GridCellType.VERTICALHEADER:
                    ((Button)_control).Click -= OnCellClicked;
                    break;

                case PM_GridCellType.CELLTEXTBOX:
                    ((TextBox)_control).PreviewMouseDown -= OnCellClicked;
                    break;

                case PM_GridCellType.CELLCHECKBOX:
                    ((CheckBox)_control).Click -= OnCellClicked;
                    break;

                case PM_GridCellType.CELLBUTTON:
                    ((Button)_control).Click -= OnCellClicked;
                    break;

                default:
                    break;
                }
            }
        }
Example #8
0
 public PM_GridCheckBox(PM_GridCell _cell)
 {
     __cell = _cell;
 }
Example #9
0
 public PM_GridTextBox(PM_GridCell _cell)
 {
     __cell = _cell;
 }
Example #10
0
        private void renderContent()
        {
            double        _heightdelta = 0;
            double        _widthdelta  = 0;
            PM_GridRow    _pmRow;
            PM_GridColumn _pmColumn;
            int           _firstVisualColumn = 0;
            int           _visualRow         = 0;
            int           _visualColumn      = 0;

            PM_Size _size = drawableSurface();

            bool _showVHeaders = (__vHeaderVisible == true && __vHeadersWidth > 0);
            bool _showHHeaders = (__hHeaderVisible == true && __hHeadearsHeight > 0);

            bool _columnsDefinitionsDisplayed = false;

            detachDisplayedControls();

            if (_showVHeaders)
            {
                _widthdelta        = addColumnDefinition(__vHeadersWidth);
                _firstVisualColumn = 1;
            }

            if (_showHHeaders)
            {
                _heightdelta = addRowDefinition(__hHeadearsHeight);
                _visualRow   = 1;
            }

            _visualColumn = _firstVisualColumn;

            for (int _i = (int)__vScrollBar.Value; _i < rowCount; _i++)
            {
                if (_heightdelta <= _size.height)
                {
                    _pmRow = __model.row(_i);
                    if (_pmRow == null || _pmRow.visibility == Visibility.Hidden)
                    {
                        continue;
                    }

                    _heightdelta += addRowDefinition(_pmRow.height);
                    if (_showVHeaders)
                    {
                        _pmRow.header = header(_pmRow.header, _i);
                        setControlToGrid(0, _visualRow, new cellInfo(_pmRow.header, 0, _i));
                    }

                    for (int _j = (int)__hScrollBar.Value; _j < columnCount; _j++)
                    {
                        if (_widthdelta <= _size.width)
                        {
                            _pmColumn = __model.column(_j);
                            if (_pmColumn == null || _pmColumn.visibility == Visibility.Hidden)
                            {
                                continue;
                            }

                            if (!_columnsDefinitionsDisplayed)
                            {
                                addColumnDefinition(_pmColumn.width);
                                if (_showHHeaders)
                                {
                                    _pmColumn.header = header(_pmColumn.header, _j);
                                    setControlToGrid(_visualColumn, 0, new cellInfo(_pmColumn.header, _j, 0));
                                }
                            }

                            PM_GridCell _cell = _pmRow.cell(_j);
                            setControlToGrid(_visualColumn, _visualRow, new cellInfo(_cell, _j, _i));

                            _widthdelta += _pmColumn.width;
                            ++_visualColumn;
                        }
                        else
                        {
                            break;
                        }
                    }
                    _columnsDefinitionsDisplayed = true;

                    _visualColumn = _firstVisualColumn;
                    ++_visualRow;

                    _widthdelta = (_showHHeaders) ? __vHeadersWidth : 0;
                }
            }
            _showVHeaders = false;
        }
Example #11
0
 public cellInfo(PM_GridCell _cell, int _colIndex, int _rowIndex)
 {
     cell     = _cell;
     colIndex = _colIndex;
     rowIndex = _rowIndex;
 }
Example #12
0
        public object value(int _columnIndex, int _rowIndex)
        {
            PM_GridCell _cell = cell(_columnIndex, _rowIndex);

            return((_cell == null) ? null : _cell.value);
        }