コード例 #1
0
ファイル: XPTableTweaks.cs プロジェクト: chzh/xrefresh
 /// <summary>
 /// Handler for the editors drop down button MouseDown event
 /// </summary>
 /// <param name="sender">The object that raised the event</param>
 /// <param name="e">A CellMouseEventArgs that contains the event data</param>
 public virtual void OnEditorButtonMouseDown(object sender, CellMouseEventArgs e)
 {
     FolderBrowserDialog browser = new FolderBrowserDialog();
     browser.Description = "Select web project folder";
     browser.SelectedPath = TextBox.Text;
     inBrowseMode = true;
     DialogResult res = browser.ShowDialog();
     inBrowseMode = false;
     if (res == DialogResult.OK) TextBox.Text = browser.SelectedPath;
     EditingTable.StopEditing();
 }
コード例 #2
0
        /// <summary>
        /// Raises the MouseMove event
        /// </summary>
        /// <param name="e">A CellMouseEventArgs that contains the event data</param>
        public override void OnMouseMove(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 == ComboBoxState.Normal)
                        {
                            if (e.Button == MouseButtons.Left && e.Row == e.Table.LastMouseDownCell.Row && e.Column == e.Table.LastMouseDownCell.Column)
                            {
                                rendererData.ButtonState = ComboBoxState.Pressed;
                            }
                            else
                            {
                                rendererData.ButtonState = ComboBoxState.Hot;
                            }

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

                            e.Table.Invalidate(e.CellRect);
                        }
                    }
                }
            }
        }
コード例 #3
0
ファイル: ButtonCellRenderer.cs プロジェクト: antiduh/XPTable
        /// <summary>
        /// Raises the MouseEnter event
        /// </summary>
        /// <param name="e">A CellMouseEventArgs that contains the event data</param>
        public override void OnMouseEnter(CellMouseEventArgs e)
        {
            base.OnMouseEnter(e);

            // get the button renderer data
            ButtonRendererData rendererData = this.GetButtonRendererData(e.Cell);

            // if the mouse is inside the button, make sure it is "hot"
            if (this.CalcButtonBounds().Contains(e.X, e.Y))
            {
                if (rendererData.ButtonState != PushButtonState.Hot)
                {
                    rendererData.ButtonState = PushButtonState.Hot;

                    e.Table.Invalidate(e.CellRect);
                }
            }
                // the mouse isn't inside the button, so it is in its normal state
            else
            {
                if (rendererData.ButtonState != PushButtonState.Normal)
                {
                    rendererData.ButtonState = PushButtonState.Normal;

                    e.Table.Invalidate(e.CellRect);
                }
            }
        }
コード例 #4
0
		/// <summary>
		/// Handler for the editors drop down button MouseUp event
		/// </summary>
		/// <param name="sender">The object that raised the event</param>
		/// <param name="e">A CellMouseEventArgs that contains the event data</param>
		public virtual void OnEditorButtonMouseUp(object sender, CellMouseEventArgs e)
		{
			
		}
コード例 #5
0
ファイル: XPTableTweaks.cs プロジェクト: chzh/xrefresh
        /// <summary>
        /// Raises the MouseLeave event
        /// </summary>
        /// <param name="e">A CellMouseEventArgs that contains the event data</param>
        public override void OnMouseLeave(CellMouseEventArgs e)
        {
            base.OnMouseLeave(e);

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

                if (e.Cell.CheckState == CheckState.Checked)
                {
                    if (rendererData.CheckState != CheckBoxStates.CheckedNormal)
                    {
                        rendererData.CheckState = CheckBoxStates.CheckedNormal;

                        e.Table.Invalidate(e.CellRect);
                    }
                }
                else if (e.Cell.CheckState == CheckState.Indeterminate)
                {
                    if (rendererData.CheckState != CheckBoxStates.MixedNormal)
                    {
                        rendererData.CheckState = CheckBoxStates.MixedNormal;

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

                        e.Table.Invalidate(e.CellRect);
                    }
                }
            }
        }
コード例 #6
0
ファイル: XPTableTweaks.cs プロジェクト: chzh/xrefresh
        public override void OnMouseDown(CellMouseEventArgs e)
        {
            //base.OnMouseDown(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 (!(e.Table.ColumnModel.GetCellEditor(e.CellPos.Column) is DropDownCellEditor))
                    {
                        throw new InvalidOperationException("Cannot edit Cell as DropDownCellRenderer requires a DropDownColumn that uses a DropDownCellEditor");
                    }

                    rendererData.ButtonState = ComboBoxStates.Pressed;

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

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

                    e.Table.Invalidate(e.CellRect);
                }
            }
        }
コード例 #7
0
ファイル: XPTableTweaks.cs プロジェクト: chzh/xrefresh
        /// <summary>
        /// Raises the MouseUp event
        /// </summary>
        /// <param name="e">A CellMouseEventArgs that contains the event data</param>
        public override void OnMouseUp(CellMouseEventArgs e)
        {
            base.OnMouseUp(e);

            if (mustBeChecked != null)
            {
                // get the renderer data
                CheckBoxRendererData rendererData = this.GetCheckBoxRendererData(mustBeChecked);

                if (mustBeChecked.CheckState == CheckState.Checked)
                {
                    if (!mustBeChecked.ThreeState || !(e.Table.ColumnModel.Columns[e.Column] is CheckBoxColumn) ||
                        ((CheckBoxColumn)e.Table.ColumnModel.Columns[e.Column]).CheckStyle == CheckBoxColumnStyle.RadioButton)
                    {
                        rendererData.CheckState = CheckBoxStates.UncheckedHot;
                        mustBeChecked.CheckState = CheckState.Unchecked;
                    }
                    else
                    {
                        rendererData.CheckState = CheckBoxStates.MixedHot;
                        mustBeChecked.CheckState = CheckState.Indeterminate;
                    }
                }
                else if (mustBeChecked.CheckState == CheckState.Indeterminate)
                {
                    rendererData.CheckState = CheckBoxStates.UncheckedHot;
                    mustBeChecked.CheckState = CheckState.Unchecked;
                }
                else //if (mustBeChecked.CheckState == CheckState.Unchecked)
                {
                    rendererData.CheckState = CheckBoxStates.CheckedHot;
                    mustBeChecked.CheckState = CheckState.Checked;
                }

                e.Table.Invalidate(CalcCheckRectangle());
                mustBeChecked = null;
            }
        }
コード例 #8
0
        /// <summary>
        /// Raises the MouseMove event
        /// </summary>
        /// <param name="e">A CellMouseEventArgs that contains the event data</param>
        public override void OnMouseMove(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 == CheckBoxState.CheckedNormal)
                        {
                            if (e.Button == MouseButtons.Left && e.Row == e.Table.LastMouseDownCell.Row && e.Column == e.Table.LastMouseDownCell.Column)
                            {
                                rendererData.CheckState = CheckBoxState.CheckedPressed;
                            }
                            else
                            {
                                rendererData.CheckState = CheckBoxState.CheckedHot;
                            }

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

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

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

                    e.Table.Invalidate(e.CellRect);
                }
            }
        }
コード例 #9
0
ファイル: Table.cs プロジェクト: nithinphilips/SMOz
		/// <summary>
		/// Raises a MouseMove event for the Cell at the specified cell position
		/// </summary>
		/// <param name="cellPos">The position of the Cell</param>
		/// <param name="e">A MouseEventArgs that contains the event data</param>
		protected void RaiseCellMouseMove(CellPos cellPos, MouseEventArgs e)
		{
			if (!this.IsValidCell(cellPos))
			{
				return;
			}

			if (this.ColumnModel.GetCellRenderer(cellPos.Column) != null)
			{
				Cell cell = null;

				if (cellPos.Column < this.TableModel.Rows[cellPos.Row].Cells.Count)
				{
					cell = this.TableModel.Rows[cellPos.Row].Cells[cellPos.Column];
				}

				CellMouseEventArgs mcea = new CellMouseEventArgs(cell, this, cellPos.Row, cellPos.Column, this.CellRect(cellPos.Row, cellPos.Column), e);

				this.OnCellMouseMove(mcea);
			}
		}
コード例 #10
0
ファイル: Table.cs プロジェクト: nithinphilips/SMOz
		/// <summary>
		/// Raises the CellMouseMove event
		/// </summary>
		/// <param name="e">A CellMouseEventArgs that contains the event data</param>
		protected virtual void OnCellMouseMove(CellMouseEventArgs e)
		{
			if (this.CanRaiseEvents)
			{
				ICellRenderer renderer = this.ColumnModel.GetCellRenderer(e.Column);

				if (renderer != null)
				{
					renderer.OnMouseMove(e);
				}
				
				if (CellMouseMove != null)
				{
					CellMouseMove(e.Cell, e);
				}
			}
		}
コード例 #11
0
ファイル: CellRenderer.cs プロジェクト: antiduh/XPTable
        /// <summary>
        /// Raises the MouseEnter event
        /// </summary>
        /// <param name="e">A CellMouseEventArgs that contains the event data</param>
        public virtual void OnMouseEnter(CellMouseEventArgs e)
        {
            this.Bounds = e.CellRect;

            this.Padding = e.Cell == null ? CellPadding.Empty : e.Cell.Padding;

            bool tooltipActive = e.Table.ToolTip.Active;

            if (tooltipActive)
                e.Table.ToolTip.Active = false;

            e.Table.ResetMouseEventArgs();

            if (tooltipActive)
            {
                if (e.Cell != null)
                {
                    CellToolTipEventArgs args = new CellToolTipEventArgs(e.Cell, new Point(e.X, e.Y));

                    // The default tooltip is to show the full text for any cell that has been truncated
                    if (e.Cell.IsTextTrimmed)
                        args.ToolTipText = e.Cell.Text;

                    // Allow the outside world to modify the text or cancel this tooltip
                    e.Table.OnCellToolTipPopup(args);

                    // Even if this tooltip has been cancelled we need to get rid of the old tooltip
                    if (args.Cancel)
                        e.Table.ToolTip.SetToolTip(e.Table, string.Empty);
                    else
                        e.Table.ToolTip.SetToolTip(e.Table, args.ToolTipText);
                }
                else
                {
                    e.Table.ToolTip.SetToolTip(e.Table, string.Empty);
                }
                e.Table.ToolTip.Active = true;
            }
        }
コード例 #12
0
		/// <summary>
		/// Raises the MouseUp event
		/// </summary>
		/// <param name="e">A CellMouseEventArgs that contains the event data</param>
		public override void OnMouseUp(CellMouseEventArgs e)
		{
			base.OnMouseUp(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.Button == MouseButtons.Left && e.Table.LastMouseDownCell.Row == e.Row && e.Table.LastMouseDownCell.Column == e.Column)
					{
						//
						if (e.Cell.CheckState == CheckState.Checked)
						{
							if (!e.Cell.ThreeState || !(e.Table.ColumnModel.Columns[e.Column] is CheckBoxColumn) || 
								((CheckBoxColumn) e.Table.ColumnModel.Columns[e.Column]).CheckStyle == CheckBoxColumnStyle.RadioButton)
							{
								rendererData.CheckState = CheckBoxStates.UncheckedHot;
								e.Cell.CheckState = CheckState.Unchecked;
							}
							else
							{
								rendererData.CheckState = CheckBoxStates.MixedHot;
								e.Cell.CheckState = CheckState.Indeterminate;
							}
						}
						else if (e.Cell.CheckState == CheckState.Indeterminate)
						{
							rendererData.CheckState = CheckBoxStates.UncheckedHot;
							e.Cell.CheckState = CheckState.Unchecked;
						}
						else //if (e.Cell.CheckState == CheckState.Unchecked)
						{
							rendererData.CheckState = CheckBoxStates.CheckedHot;
							e.Cell.CheckState = CheckState.Checked;
						}

						e.Table.Invalidate(e.CellRect);
					}
				}
			}
		}
コード例 #13
0
		/// <summary>
		/// Handler for the editors buttons MouseUp event
		/// </summary>
		/// <param name="sender">The object that raised the event</param>
		/// <param name="e">A CellMouseEventArgs that contains the event data</param>
		public void OnEditorButtonMouseUp(object sender, CellMouseEventArgs e)
		{
			this.StopTimer();

			this.buttonID = 0;
		}
コード例 #14
0
		/// <summary>
		/// Handler for the editors buttons MouseDown event
		/// </summary>
		/// <param name="sender">The object that raised the event</param>
		/// <param name="e">A CellMouseEventArgs that contains the event data</param>
		public void OnEditorButtonMouseDown(object sender, CellMouseEventArgs e)
		{
			this.ParseEditText();

			if (e.Y < this.buttonBounds.Top + (this.buttonBounds.Height / 2))
			{
				this.buttonID = UpButtonID;
				
				this.UpButton();
			}
			else
			{
				this.buttonID = DownButtonID;
				
				this.DownButton();
			}

			this.StartTimer();
		}
コード例 #15
0
ファイル: ButtonCellRenderer.cs プロジェクト: antiduh/XPTable
        /// <summary>
        /// Raises the MouseMove event
        /// </summary>
        /// <param name="e">A CellMouseEventArgs that contains the event data</param>
        public override void OnMouseMove(CellMouseEventArgs e)
        {
            base.OnMouseMove(e);

            // get the button renderer data
            ButtonRendererData rendererData = this.GetButtonRendererData(e.Cell);

            Rectangle buttonRect = this.CalcButtonBounds();

            // check if the left mouse button is pressed
            if (e.Button == MouseButtons.Left)
            {
                // check if the mouse press originated in the button area
                if (buttonRect.Contains(rendererData.ClickPoint))
                {
                    // check if the mouse is currently in the button
                    if (buttonRect.Contains(e.X, e.Y))
                    {
                        // make sure the button is pressed
                        if (rendererData.ButtonState != PushButtonState.Pressed)
                        {
                            rendererData.ButtonState = PushButtonState.Pressed;

                            e.Table.Invalidate(e.CellRect);
                        }
                    }
                    else
                    {
                        // the mouse isn't inside the button so make sure it is "hot"
                        if (rendererData.ButtonState != PushButtonState.Hot)
                        {
                            rendererData.ButtonState = PushButtonState.Hot;

                            e.Table.Invalidate(e.CellRect);
                        }
                    }
                }
            }
            else
            {
                // check if the mouse is currently in the button
                if (buttonRect.Contains(e.X, e.Y))
                {
                    // the mouse is inside the button so make sure it is "hot"
                    if (rendererData.ButtonState != PushButtonState.Hot)
                    {
                        rendererData.ButtonState = PushButtonState.Hot;

                        e.Table.Invalidate(e.CellRect);
                    }
                }
                else
                {
                    // not inside the button so make sure it is in its normal state
                    if (rendererData.ButtonState != PushButtonState.Normal)
                    {
                        rendererData.ButtonState = PushButtonState.Normal;

                        e.Table.Invalidate(e.CellRect);
                    }
                }
            }
        }
コード例 #16
0
ファイル: Table.cs プロジェクト: nithinphilips/SMOz
		/// <summary>
		/// Raises the CellHover event
		/// </summary>
		/// <param name="e">A CellEventArgs that contains the event data</param>
		protected virtual void OnCellMouseHover(CellMouseEventArgs e)
		{
			if (this.CanRaiseEvents)
			{
				if (CellMouseHover != null)
				{
					CellMouseHover(e.Cell, e);
				}
			}
		}
コード例 #17
0
ファイル: Table.cs プロジェクト: nithinphilips/SMOz
		/// <summary>
		/// Raises the CellDoubleClick event
		/// </summary>
		/// <param name="e">A CellEventArgs that contains the event data</param>
		protected virtual void OnCellDoubleClick(CellMouseEventArgs e)
		{
			if (!this.IsCellEnabled(e.CellPos))
			{
				return;
			}
			
			if (this.CanRaiseEvents)
			{
				ICellRenderer renderer = this.ColumnModel.GetCellRenderer(this.LastMouseCell.Column);

				if (renderer != null)
				{
					renderer.OnDoubleClick(e);
				}
				
				if (CellDoubleClick != null)
				{
					CellDoubleClick(e.Cell, e);
				}
			}
		}
コード例 #18
0
        /// <summary>
        /// Raises the MouseMove event
        /// </summary>
        /// <param name="e">A CellMouseEventArgs that contains the event data</param>
        public override void OnMouseMove(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 == UpDownState.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 = UpDownState.Pressed;

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

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

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

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

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

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

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

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

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

                            e.Table.Invalidate(e.CellRect);
                        }
                    }
                }
            }
        }
コード例 #19
0
		/// <summary>
		/// Raises the MouseEnter event
		/// </summary>
		/// <param name="e">A CellMouseEventArgs that contains the event data</param>
		public virtual void OnMouseEnter(CellMouseEventArgs e)
		{
			this.Bounds = e.CellRect;

			if (e.Cell == null)
			{
				this.Padding = CellPadding.Empty;
			}
			else
			{
				this.Padding = e.Cell.Padding;
			}
			
			bool tooltipActive = e.Table.ToolTip.Active;

			if (tooltipActive)
			{
				e.Table.ToolTip.Active = false;
			}

			e.Table.ResetMouseEventArgs();

			e.Table.ToolTip.SetToolTip(e.Table, e.Cell.ToolTipText);

			if (tooltipActive)
			{
				e.Table.ToolTip.Active = true;
			}
		}
コード例 #20
0
ファイル: XPTableTweaks.cs プロジェクト: chzh/xrefresh
        /// <summary>
        /// Raises the MouseLeave event
        /// </summary>
        /// <param name="e">A CellMouseEventArgs that contains the event data</param>
        public override void OnMouseLeave(CellMouseEventArgs e)
        {
            base.OnMouseLeave(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 (rendererData.ButtonState != ComboBoxStates.Normal)
                    {
                        rendererData.ButtonState = ComboBoxStates.Normal;

                        e.Table.Invalidate(e.CellRect);
                    }
                }
            }
        }
コード例 #21
0
		/// <summary>
		/// Raises the MouseDown event
		/// </summary>
		/// <param name="e">A CellMouseEventArgs that contains the event data</param>
		public virtual void OnMouseDown(CellMouseEventArgs e)
		{
			if (!e.Table.Focused)
			{
				if (!(e.Table.IsEditing && e.Table.EditingCell == e.CellPos && e.Table.EditingCellEditor is IEditorUsesRendererButtons))
				{
					e.Table.Focus();
				}
			}
			
			this.Bounds = e.CellRect;
			
			if (e.Cell == null)
			{
				this.Padding = CellPadding.Empty;
			}
			else
			{
				this.Padding = e.Cell.Padding;
			}
		}
コード例 #22
0
ファイル: XPTableTweaks.cs プロジェクト: chzh/xrefresh
        /// <summary>
        /// Raises the MouseUp event
        /// </summary>
        /// <param name="e">A CellMouseEventArgs that contains the event data</param>
        public override void OnMouseUp(CellMouseEventArgs e)
        {
            base.OnMouseUp(e);

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

                    if (this.CalcDropDownButtonBounds().Contains(e.X, e.Y))
                    {
                        rendererData.ButtonState = ComboBoxStates.Hot;

                        e.Table.Invalidate(e.CellRect);
                    }
                }
            }
        }
コード例 #23
0
		/// <summary>
		/// Raises the MouseMove event
		/// </summary>
		/// <param name="e">A CellMouseEventArgs that contains the event data</param>
		public virtual void OnMouseMove(CellMouseEventArgs e)
		{
			this.Bounds = e.CellRect;
			
			if (e.Cell == null)
			{
				this.Padding = CellPadding.Empty;
			}
			else
			{
				this.Padding = e.Cell.Padding;
			}
		}
コード例 #24
0
ファイル: XPTableTweaks.cs プロジェクト: chzh/xrefresh
        /// <summary>
        /// Raises the MouseDown event
        /// </summary>
        /// <param name="e">A CellMouseEventArgs that contains the event data</param>
        public override void OnMouseDown(CellMouseEventArgs 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)
                    {
                        rendererData.CheckState = CheckBoxStates.CheckedPressed;
                    }
                    else if (e.Cell.CheckState == CheckState.Indeterminate)
                    {
                        rendererData.CheckState = CheckBoxStates.MixedPressed;
                    }
                    else //if (e.Cell.CheckState == CheckState.Unchecked)
                    {
                        rendererData.CheckState = CheckBoxStates.UncheckedPressed;
                    }

                    mustBeChecked = e.Cell;

                    e.Table.Invalidate(e.CellRect);
                }
            }
            base.OnMouseDown(e);
        }
コード例 #25
0
		/// <summary>
		/// Raises the DoubleClick event
		/// </summary>
		/// <param name="e">A CellMouseEventArgs that contains the event data</param>
		public virtual void OnDoubleClick(CellMouseEventArgs e)
		{
			this.Bounds = e.CellRect;
			
			if (e.Cell == null)
			{
				this.Padding = CellPadding.Empty;
			}
			else
			{
				this.Padding = e.Cell.Padding;
			}

			if (e.Table.EditStartAction == EditStartAction.DoubleClick && e.Table.IsCellEditable(e.CellPos))
			{
				e.Table.EditCell(e.CellPos);
			}
		}
コード例 #26
0
		/// <summary>
		/// Handler for the editors drop down button MouseDown event
		/// </summary>
		/// <param name="sender">The object that raised the event</param>
		/// <param name="e">A CellMouseEventArgs that contains the event data</param>
		public virtual void OnEditorButtonMouseDown(object sender, CellMouseEventArgs e)
		{
			this.DroppedDown = !this.DroppedDown;
		}
コード例 #27
0
		/// <summary>
		/// Raises the MouseLeave event
		/// </summary>
		/// <param name="e">A CellMouseEventArgs that contains the event data</param>
		public override void OnMouseLeave(CellMouseEventArgs e)
		{
			base.OnMouseLeave(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 (rendererData.UpButtonState != UpDownStates.Normal)
					{
						rendererData.UpButtonState = UpDownStates.Normal;

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

						e.Table.Invalidate(e.CellRect);
					}
				}
			}
		}
コード例 #28
0
ファイル: ButtonCellRenderer.cs プロジェクト: antiduh/XPTable
        /// <summary>
        /// Raises the MouseDown event
        /// </summary>
        /// <param name="e">A CellMouseEventArgs that contains the event data</param>
        public override void OnMouseDown(CellMouseEventArgs e)
        {
            base.OnMouseDown(e);

            // get the button renderer data
            ButtonRendererData rendererData = this.GetButtonRendererData(e.Cell);

            // check if the left mouse button is pressed
            if (e.Button == MouseButtons.Left)
            {
                // record where the click started
                rendererData.ClickPoint = new Point(e.X, e.Y);

                // if the click was inside the button, set the button state to pressed
                if (this.CalcButtonBounds().Contains(rendererData.ClickPoint))
                {
                    rendererData.ButtonState = PushButtonState.Pressed;

                    e.Table.Invalidate(e.CellRect);
                }
            }
        }
コード例 #29
0
		/// <summary>
		/// Raises the MouseUp event
		/// </summary>
		/// <param name="e">A CellMouseEventArgs that contains the event data</param>
		public override void OnMouseUp(CellMouseEventArgs e)
		{
			base.OnMouseUp(e);

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

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

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

						if (!e.Table.IsEditing)
						{
							e.Table.EditCell(e.CellPos);
						}
						
						((IEditorUsesRendererButtons) e.Table.EditingCellEditor).OnEditorButtonMouseUp(this, e);

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

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

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

						e.Table.Invalidate(e.CellRect);
					}
				}
			}
		}
コード例 #30
0
ファイル: ButtonCellRenderer.cs プロジェクト: antiduh/XPTable
        /// <summary>
        /// Raises the MouseLeave event
        /// </summary>
        /// <param name="e">A CellMouseEventArgs that contains the event data</param>
        public override void OnMouseLeave(CellMouseEventArgs e)
        {
            base.OnMouseLeave(e);

            // get the button renderer data
            ButtonRendererData rendererData = this.GetButtonRendererData(e.Cell);

            // make sure the button is in its normal state
            if (rendererData.ButtonState != PushButtonState.Normal)
            {
                rendererData.ButtonState = PushButtonState.Normal;

                e.Table.Invalidate(e.CellRect);
            }
        }
コード例 #31
0
		/// <summary>
		/// Raises the MouseDown event
		/// </summary>
		/// <param name="e">A CellMouseEventArgs that contains the event data</param>
		public override void OnMouseDown(CellMouseEventArgs e)
		{
			base.OnMouseDown(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);

					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 NumberCellEditor))
						{
							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 = UpDownStates.Pressed;

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

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

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

							e.Table.Invalidate(e.CellRect);
						}
					}
				}
			}
		}
コード例 #32
0
ファイル: ButtonCellRenderer.cs プロジェクト: antiduh/XPTable
        /// <summary>
        /// Raises the MouseUp event
        /// </summary>
        /// <param name="e">A CellMouseEventArgs that contains the event data</param>
        public override void OnMouseUp(CellMouseEventArgs e)
        {
            base.OnMouseUp(e);

            // get the button renderer data
            ButtonRendererData rendererData = this.GetButtonRendererData(e.Cell);

            // check for the left mouse button
            if (e.Button == MouseButtons.Left)
            {
                Rectangle buttonRect = this.CalcButtonBounds();

                // if the mouse pointer is over the button, make sure
                // the button is "hot"
                if (buttonRect.Contains(e.X, e.Y))
                {
                    rendererData.ButtonState = PushButtonState.Hot;

                    e.Table.Invalidate(e.CellRect);

                    // check if the click started inside the button.  if
                    // it did, Raise the tables CellButtonClicked event
                    if (buttonRect.Contains(rendererData.ClickPoint))
                    {
                        e.Table.OnCellButtonClicked(new CellButtonEventArgs(e.Cell, e.Column, e.Row));
                    }
                }
                else
                {
                    // the mouse was released somewhere outside of the button,
                    // so make set the button back to its normal state
                    if (rendererData.ButtonState != PushButtonState.Normal)
                    {
                        rendererData.ButtonState = PushButtonState.Normal;

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

            // reset the click point
            rendererData.ClickPoint = Point.Empty;
        }
コード例 #33
0
ファイル: Table.cs プロジェクト: schoetbi/XPTable
        /// <summary>
        /// Raises the Click event
        /// </summary>
        /// <param name="e">An EventArgs that contains the event data</param>
        protected override void OnMouseClick(MouseEventArgs e)
        {
            base.OnMouseClick(e);

            if (this.IsValidCell(this.LastMouseCell))
            {
                // Adjust this to take colspan into account
                // LastMouseCell may be a cell that is 'under' a colspan cell
                CellPos realCell = this.ResolveColspan(this.LastMouseCell);

                var cellMouseEventArgs = new CellMouseEventArgs(
                    this.TableModel[realCell],
                    this,
                    realCell,
                    this.CellRect(realCell),
                    e);
                this.OnCellClick(cellMouseEventArgs);
            }
            else if (this.hotColumn != -1)
            {
                var columnHeaderRect = this.ColumnModel.ColumnHeaderRect(this.hotColumn);
                var headerRect = this.DisplayRectToClient(columnHeaderRect);

                bool handled = false;

                // Column filters
                if (this.EnableFilters && this.ColumnModel.Columns[hotColumn].Filterable)
                {
                    Point client = this.DisplayRectToClient(e.X, e.Y);
                    ColumnHeaderRegion region = this.HeaderRenderer.HitTest(client.X, client.Y);

                    if (region == ColumnHeaderRegion.FilterButton)
                    {
                        handled = true;

                        var mouseEventArgs = new HeaderMouseEventArgs(
                            this.ColumnModel.Columns[this.hotColumn],
                            this,
                            this.hotColumn,
                            headerRect,
                            e);

                        this.OnHeaderFilterClick(mouseEventArgs);
                    }
                }

                if (!handled)
                {
                    var mouseEventArgs = new HeaderMouseEventArgs(
                        this.ColumnModel.Columns[this.hotColumn],
                        this,
                        this.hotColumn,
                        headerRect,
                        e);
                    this.OnHeaderClick(mouseEventArgs);
                }
            }
        }