Ejemplo n.º 1
0
        /// <summary>
        /// Raises the MouseMove event
        /// </summary>
        /// <param name="e">A CellMouseEventArgs that contains the event data</param>
        public override void OnMouseMove(jingxian.ui.controls.XPTable.Events.CellMouseEventArgs e)
        {
            base.OnMouseMove(e);

            if (this.ShowDropDownButton || (e.Table.IsEditing && e.CellPos == e.Table.EditingCell))
            {
                if (e.Table.IsCellEditable(e.CellPos))
                {
                    // get the button renderer data
                    DropDownRendererData rendererData = this.GetDropDownRendererData(e.Cell);

                    if (this.CalcDropDownButtonBounds().Contains(e.X, e.Y))
                    {
                        if (rendererData.ButtonState == ComboBoxStates.Normal)
                        {
                            if (e.Button == MouseButtons.Left && e.Row == e.Table.LastMouseDownCell.Row && e.Column == e.Table.LastMouseDownCell.Column)
                            {
                                rendererData.ButtonState = ComboBoxStates.Pressed;
                            }
                            else
                            {
                                rendererData.ButtonState = ComboBoxStates.Hot;
                            }

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

                            e.Table.Invalidate(e.CellRect);
                        }
                    }
                }
            }
        }
        /// <summary>
        /// Raises the MouseMove event
        /// </summary>
        /// <param name="e">A CellMouseEventArgs that contains the event data</param>
        public override void OnMouseMove(jingxian.ui.controls.XPTable.Events.CellMouseEventArgs e)
        {
            base.OnMouseMove(e);

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

                    if (this.GetUpButtonBounds().Contains(e.X, e.Y))
                    {
                        if (rendererData.UpButtonState == UpDownStates.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 = UpDownStates.Pressed;

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

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

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

                            e.Table.Invalidate(e.CellRect);
                        }
                    }
                    else if (this.GetDownButtonBounds().Contains(e.X, e.Y))
                    {
                        if (rendererData.DownButtonState == UpDownStates.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 = UpDownStates.Pressed;

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

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

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

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

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

                            e.Table.Invalidate(e.CellRect);
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Raises the MouseMove event
        /// </summary>
        /// <param name="e">A CellMouseEventArgs that contains the event data</param>
        public override void OnMouseMove(jingxian.ui.controls.XPTable.Events.CellMouseEventArgs e)
        {
            base.OnMouseMove(e);

            if (e.Table.IsCellEditable(e.CellPos))
            {
                // get the renderer data
                CheckBoxRendererData rendererData = this.GetCheckBoxRendererData(e.Cell);

                if (this.CalcCheckRect(e.Table.TableModel.Rows[e.Row].Alignment, e.Table.ColumnModel.Columns[e.Column].Alignment).Contains(e.X, e.Y))
                {
                    if (e.Cell.CheckState == CheckState.Checked)
                    {
                        if (rendererData.CheckState == CheckBoxStates.CheckedNormal)
                        {
                            if (e.Button == MouseButtons.Left && e.Row == e.Table.LastMouseDownCell.Row && e.Column == e.Table.LastMouseDownCell.Column)
                            {
                                rendererData.CheckState = CheckBoxStates.CheckedPressed;
                            }
                            else
                            {
                                rendererData.CheckState = CheckBoxStates.CheckedHot;
                            }

                            e.Table.Invalidate(e.CellRect);
                        }
                    }
                    else if (e.Cell.CheckState == CheckState.Indeterminate)
                    {
                        if (rendererData.CheckState == CheckBoxStates.MixedNormal)
                        {
                            if (e.Button == MouseButtons.Left && e.Row == e.Table.LastMouseDownCell.Row && e.Column == e.Table.LastMouseDownCell.Column)
                            {
                                rendererData.CheckState = CheckBoxStates.MixedPressed;
                            }
                            else
                            {
                                rendererData.CheckState = CheckBoxStates.MixedHot;
                            }

                            e.Table.Invalidate(e.CellRect);
                        }
                    }
                    else                     //if (e.Cell.CheckState == CheckState.Unchecked)
                    {
                        if (rendererData.CheckState == CheckBoxStates.UncheckedNormal)
                        {
                            if (e.Button == MouseButtons.Left && e.Row == e.Table.LastMouseDownCell.Row && e.Column == e.Table.LastMouseDownCell.Column)
                            {
                                rendererData.CheckState = CheckBoxStates.UncheckedPressed;
                            }
                            else
                            {
                                rendererData.CheckState = CheckBoxStates.UncheckedHot;
                            }

                            e.Table.Invalidate(e.CellRect);
                        }
                    }
                }
                else
                {
                    if (e.Cell.CheckState == CheckState.Checked)
                    {
                        rendererData.CheckState = CheckBoxStates.CheckedNormal;
                    }
                    else if (e.Cell.CheckState == CheckState.Indeterminate)
                    {
                        rendererData.CheckState = CheckBoxStates.MixedNormal;
                    }
                    else                     //if (e.Cell.CheckState == CheckState.Unchecked)
                    {
                        rendererData.CheckState = CheckBoxStates.UncheckedNormal;
                    }

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