Exemplo n.º 1
0
        /// <summary>
        /// Gets or sets the maximum value for the Cell
        /// </summary>
        //protected decimal Maximum
        //{
        //    get
        //    {
        //        return this.maximum;
        //    }

        //    set
        //    {
        //        this.maximum = value;

        //        if (this.minimum > this.maximum)
        //        {
        //            this.minimum = this.maximum;
        //        }
        //    }
        //}


        /// <summary>
        /// Gets or sets the minimum value for the Cell
        /// </summary>
        //protected decimal Minimum
        //{
        //    get
        //    {
        //        return this.minimum;
        //    }

        //    set
        //    {
        //        this.minimum = value;

        //        if (this.minimum > this.maximum)
        //        {
        //            this.maximum = value;
        //        }
        //    }
        //}

        #endregion


        #region Events

        #region Mouse

        #region MouseLeave

        /// <summary>
        /// Raises the MouseLeave event
        /// </summary>
        /// <param name="e">A CellMouseEventArgs that contains the event data</param>
        public override void OnMouseLeave(I3CellMouseEventArgs e)
        {
            base.OnMouseLeave(e);

            if (this.ShowUpDownButtons || this.TableUsingNumericCellEditor(e.Table, e.CellPos))
            {
                if (e.Table.IsCellEditable(e.CellPos))
                {
                    // get the button renderer data
                    I3NumberRendererData rendererData = this.GetNumberRendererData(e.Cell);

                    if (rendererData.UpButtonState != I3UpDownStates.Normal)
                    {
                        rendererData.UpButtonState = I3UpDownStates.Normal;

                        e.Table.Invalidate(e.CellRect);
                    }
                    else if (rendererData.DownButtonState != I3UpDownStates.Normal)
                    {
                        rendererData.DownButtonState = I3UpDownStates.Normal;

                        e.Table.Invalidate(e.CellRect);
                    }
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets the NumberRendererData specific data used by the Renderer from
        /// the specified Cell
        /// </summary>
        /// <param name="cell">The Cell to get the NumberRendererData data for</param>
        /// <returns>The NumberRendererData data for the specified Cell</returns>
        protected I3NumberRendererData GetNumberRendererData(I3Cell cell)
        {
            object rendererData = this.GetRendererData(cell);

            if (rendererData == null || !(rendererData is I3NumberRendererData))
            {
                rendererData = new I3NumberRendererData();

                this.SetRendererData(cell, rendererData);
            }

            return((I3NumberRendererData)rendererData);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Raises the MouseDown event
        /// </summary>
        /// <param name="e">A CellMouseEventArgs that contains the event data</param>
        public override void OnMouseDown(I3CellMouseEventArgs e)
        {
            base.OnMouseDown(e);

            //
            if (this.ShowUpDownButtons || this.TableUsingNumericCellEditor(e.Table, e.CellPos))
            {
                if (e.Table.IsCellEditable(e.CellPos))
                {
                    // get the button renderer data
                    I3NumberRendererData rendererData = this.GetNumberRendererData(e.Cell);

                    rendererData.ClickPoint = new Point(e.X, e.Y);

                    if (this.CalcButtonBounds().Contains(e.X, e.Y))
                    {
                        if (!(e.Table.ColumnModel.GetCellEditor(e.CellPos.Column) is I3NumberCellEditor))
                        {
                            throw new InvalidOperationException("Cannot edit Cell as NumberCellRenderer requires a NumberColumn that uses a NumberCellEditor");
                        }

                        if (!e.Table.IsEditing)
                        {
                            e.Table.EditCell(e.CellPos);
                        }

                        if (this.GetUpButtonBounds().Contains(e.X, e.Y))
                        {
                            rendererData.UpButtonState = I3UpDownStates.Pressed;

                            ((II3EditorUsesRendererButtons)e.Table.EditingCellEditor).OnEditorButtonMouseDown(this, e);

                            e.Table.Invalidate(e.CellRect);
                        }
                        else if (this.GetDownButtonBounds().Contains(e.X, e.Y))
                        {
                            rendererData.DownButtonState = I3UpDownStates.Pressed;

                            ((II3EditorUsesRendererButtons)e.Table.EditingCellEditor).OnEditorButtonMouseDown(this, e);

                            e.Table.Invalidate(e.CellRect);
                        }
                    }
                }
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Raises the MouseUp event
        /// </summary>
        /// <param name="e">A CellMouseEventArgs that contains the event data</param>
        public override void OnMouseUp(I3CellMouseEventArgs e)
        {
            base.OnMouseUp(e);

            //
            if (this.ShowUpDownButtons || this.TableUsingNumericCellEditor(e.Table, e.CellPos))
            {
                if (e.Table.IsCellEditable(e.CellPos))
                {
                    // get the renderer data
                    I3NumberRendererData rendererData = this.GetNumberRendererData(e.Cell);

                    rendererData.ClickPoint = new Point(-1, -1);

                    if (this.GetUpButtonBounds().Contains(e.X, e.Y))
                    {
                        rendererData.UpButtonState = I3UpDownStates.Hot;

                        if (!e.Table.IsEditing)
                        {
                            e.Table.EditCell(e.CellPos);
                        }

                        ((II3EditorUsesRendererButtons)e.Table.EditingCellEditor).OnEditorButtonMouseUp(this, e);

                        e.Table.Invalidate(e.CellRect);
                    }
                    else if (this.GetDownButtonBounds().Contains(e.X, e.Y))
                    {
                        rendererData.DownButtonState = I3UpDownStates.Hot;

                        if (!e.Table.IsEditing)
                        {
                            e.Table.EditCell(e.CellPos);
                        }

                        ((II3EditorUsesRendererButtons)e.Table.EditingCellEditor).OnEditorButtonMouseUp(this, e);

                        e.Table.Invalidate(e.CellRect);
                    }
                }
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Raises the MouseMove event
        /// </summary>
        /// <param name="e">A CellMouseEventArgs that contains the event data</param>
        public override void OnMouseMove(IE310.Table.Events.I3CellMouseEventArgs e)
        {
            base.OnMouseMove(e);

            if (this.ShowUpDownButtons || this.TableUsingNumericCellEditor(e.Table, e.CellPos))
            {
                if (e.Table.IsCellEditable(e.CellPos))
                {
                    // get the button renderer data
                    I3NumberRendererData rendererData = this.GetNumberRendererData(e.Cell);

                    if (this.GetUpButtonBounds().Contains(e.X, e.Y))
                    {
                        if (rendererData.UpButtonState == I3UpDownStates.Normal)
                        {
                            if (e.Button == MouseButtons.Left && e.Row == e.Table.LastMouseDownCell.Row && e.Column == e.Table.LastMouseDownCell.Column)
                            {
                                if (this.GetUpButtonBounds().Contains(rendererData.ClickPoint))
                                {
                                    rendererData.UpButtonState = I3UpDownStates.Pressed;

                                    if (this.TableUsingNumericCellEditor(e.Table, e.CellPos))
                                    {
                                        ((II3EditorUsesRendererButtons)e.Table.EditingCellEditor).OnEditorButtonMouseDown(this, e);
                                    }
                                }
                                else if (this.GetDownButtonBounds().Contains(rendererData.ClickPoint))
                                {
                                    rendererData.DownButtonState = I3UpDownStates.Normal;

                                    if (this.TableUsingNumericCellEditor(e.Table, e.CellPos))
                                    {
                                        ((II3EditorUsesRendererButtons)e.Table.EditingCellEditor).OnEditorButtonMouseUp(this, e);
                                    }
                                }
                            }
                            else
                            {
                                rendererData.UpButtonState = I3UpDownStates.Hot;

                                if (rendererData.DownButtonState == I3UpDownStates.Hot)
                                {
                                    rendererData.DownButtonState = I3UpDownStates.Normal;
                                }
                            }

                            e.Table.Invalidate(e.CellRect);
                        }
                    }
                    else if (this.GetDownButtonBounds().Contains(e.X, e.Y))
                    {
                        if (rendererData.DownButtonState == I3UpDownStates.Normal)
                        {
                            if (e.Button == MouseButtons.Left && e.Row == e.Table.LastMouseDownCell.Row && e.Column == e.Table.LastMouseDownCell.Column)
                            {
                                if (this.GetDownButtonBounds().Contains(rendererData.ClickPoint))
                                {
                                    rendererData.DownButtonState = I3UpDownStates.Pressed;

                                    if (this.TableUsingNumericCellEditor(e.Table, e.CellPos))
                                    {
                                        ((II3EditorUsesRendererButtons)e.Table.EditingCellEditor).OnEditorButtonMouseDown(this, e);
                                    }
                                }
                                else if (this.GetUpButtonBounds().Contains(rendererData.ClickPoint))
                                {
                                    rendererData.UpButtonState = I3UpDownStates.Normal;

                                    if (this.TableUsingNumericCellEditor(e.Table, e.CellPos))
                                    {
                                        ((II3EditorUsesRendererButtons)e.Table.EditingCellEditor).OnEditorButtonMouseUp(this, e);
                                    }
                                }
                            }
                            else
                            {
                                rendererData.DownButtonState = I3UpDownStates.Hot;

                                if (rendererData.UpButtonState == I3UpDownStates.Hot)
                                {
                                    rendererData.UpButtonState = I3UpDownStates.Normal;
                                }
                            }

                            e.Table.Invalidate(e.CellRect);
                        }
                    }
                    else
                    {
                        if (rendererData.UpButtonState != I3UpDownStates.Normal || rendererData.DownButtonState != I3UpDownStates.Normal)
                        {
                            rendererData.UpButtonState   = I3UpDownStates.Normal;
                            rendererData.DownButtonState = I3UpDownStates.Normal;

                            if (this.TableUsingNumericCellEditor(e.Table, e.CellPos))
                            {
                                ((II3EditorUsesRendererButtons)e.Table.EditingCellEditor).OnEditorButtonMouseUp(this, e);
                            }

                            e.Table.Invalidate(e.CellRect);
                        }
                    }
                }
            }
        }