示例#1
0
        public void setCellReadOnly(int _columnIndex, int _rowIndex, PM_state _state)
        {
            cellInfo _cellInfo = new cellInfo(__model.row(_rowIndex).cell(_columnIndex), _columnIndex, _rowIndex);

            _cellInfo.cell.readOnly = _state;
            updateCell(_cellInfo);
        }
示例#2
0
        public void setRowHeaderStyle(int _rowIndex, PM_GridCellStyle _style)
        {
            cellInfo _cellInfo = new cellInfo(__model.row(_rowIndex).header, 0, _rowIndex);

            _cellInfo.cell.style = _style;
            updateCell(_cellInfo);
        }
示例#3
0
        public void setColumnHeaderStyle(int _columnIndex, PM_GridCellStyle _style)
        {
            cellInfo _cellInfo = new cellInfo(__model.column(_columnIndex).header, _columnIndex, 0);

            _cellInfo.cell.style = _style;
            updateCell(_cellInfo);
        }
示例#4
0
        public void setCellStyle(int _columnIndex, int _rowIndex, PM_GridCellStyle _style)
        {
            cellInfo _cellInfo = new cellInfo(__model.row(_rowIndex).cell(_columnIndex), _columnIndex, _rowIndex);

            _cellInfo.cell.style = _style;
            updateCell(_cellInfo);
        }
示例#5
0
        void applyProperties(cellInfo _cellInfo)
        {
            PM_GridColumn _column = __model.column(_cellInfo.colIndex);
            PM_GridRow    _row    = __model.row(_cellInfo.rowIndex);

            _cellInfo.cell.applyControl_value();

            if (_cellInfo.cell.type == PM_GridCellType.HORIZONTALHEADER)
            {
                applyHorizontalHeaderProperties(_cellInfo);
                return;
            }

            if (_cellInfo.cell.type == PM_GridCellType.VERTICALHEADER)
            {
                applyVerticalHeaderProperties(_cellInfo);
                return;
            }

            // readOnly
            if (_cellInfo.cell.readOnly != PM_state.UNSET)
            {
                _cellInfo.cell.applyIsReadOnly(_cellInfo.cell.readOnly);
            }
            else
            if (_row.readOnly != PM_state.UNSET)
            {
                _cellInfo.cell.applyIsReadOnly(_row.readOnly);
            }
            else
            if (_column.readOnly != PM_state.UNSET)
            {
                _cellInfo.cell.applyIsReadOnly(_column.readOnly);
            }
            else
            {
                _cellInfo.cell.applyIsReadOnly(__model.readOnly);
            }

            // style
            if (_cellInfo.cell.style != null)
            {
                _cellInfo.cell.applyStyle(_cellInfo.cell.style);
            }
            else
            if (_row.style != null)
            {
                _cellInfo.cell.applyStyle(_row.style);
            }
            else
            if (_column.style != null)
            {
                _cellInfo.cell.applyStyle(_column.style);
            }
            else
            {
                _cellInfo.cell.applyStyle(__model.style);
            }
        }
示例#6
0
 private void updateCell(cellInfo _cellInfo)
 {
     if (!__noRender && _cellInfo.cell.setOnGrid)
     {
         _cellInfo.cell.show();
         applyProperties(_cellInfo);
     }
 }
示例#7
0
        void setControlToGrid(int _visualCol, int _visualRow, cellInfo _cellInfo)
        {
            if (_cellInfo.cell == null)
            {
                return;
            }
            //init control if null, connect control events
            _cellInfo.cell.show();

            Control _control = _cellInfo.cell.control();

            if (_control == null)
            {
                return;
            }

            applyProperties(_cellInfo);

            Grid.SetColumn(_control, _visualCol);
            Grid.SetRow(_control, _visualRow);
            __grid.Children.Add(_control);
            _cellInfo.cell.setOnGrid = true;
            __displayedCells.Add(_cellInfo);

            _control.Tag = new PM_GridEventArg(_cellInfo.colIndex, _cellInfo.rowIndex, _cellInfo.cell.type);

            switch (_cellInfo.cell.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;
            }
        }
示例#8
0
 void applyVerticalHeaderProperties(cellInfo _cellInfo)
 {
     if (_cellInfo.cell.style != null)
     {
         _cellInfo.cell.applyStyle(_cellInfo.cell.style);
     }
     else
     if (__model.verticalHeaderStyle != null)
     {
         _cellInfo.cell.applyStyle(__model.verticalHeaderStyle);
     }
     else
     {
         _cellInfo.cell.applyStyle(__model.style);
     }
 }