示例#1
0
        /// <summary>
        /// Raises the MouseEnter event
        /// </summary>
        /// <param name="e">A HeaderMouseEventArgs that contains the event data</param>
        public virtual void OnMouseEnter(HeaderMouseEventArgs e)
        {
            this.Bounds = e.HeaderRect;

            bool tooltipActive = e.Table.ToolTip.Active;

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

            e.Table.ResetMouseEventArgs();

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

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

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

                    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;
            }
        }
示例#2
0
 /// <summary>
 /// Raises the Click event
 /// </summary>
 /// <param name="e">A HeaderMouseEventArgs that contains the event data</param>
 public virtual void OnClick(HeaderMouseEventArgs e)
 {
     this.Bounds = e.HeaderRect;
 }
示例#3
0
		/// <summary>
		/// Raises the HeaderDoubleClick event
		/// </summary>
		/// <param name="e">A HeaderMouseEventArgs that contains the event data</param>
		protected virtual void OnHeaderDoubleClick(HeaderMouseEventArgs e)
		{
			if (this.CanRaiseEvents)
			{
				if (this.HeaderRenderer != null)
				{
					this.HeaderRenderer.OnDoubleClick(e);
				}
				
				if (HeaderDoubleClick != null)
				{
					HeaderDoubleClick(e.Column, e);
				}
			}
		}
示例#4
0
        /// <summary>
        /// Raises the MouseDown event
        /// </summary>
        /// <param name="e">A HeaderMouseEventArgs that contains the event data</param>
        public virtual void OnMouseDown(HeaderMouseEventArgs e)
        {
            if (!e.Table.Focused)
            {
                e.Table.Focus();
            }

            this.Bounds = e.HeaderRect;
        }
示例#5
0
		/// <summary>
		/// Raises a MouseMove event for the Column header at the specified colunm 
		/// index position
		/// </summary>
		/// <param name="index">The index of the column to recieve the event</param>
		/// <param name="e">A HeaderMouseEventArgs that contains the event data</param>
		protected void RaiseHeaderMouseMove(int index, MouseEventArgs e)
		{
			if (index < 0 || this.ColumnModel == null || index >= this.ColumnModel.Columns.Count)
			{
				return;
			}

			if (this.HeaderRenderer != null)
			{
				Column column = this.ColumnModel.Columns[index];

				HeaderMouseEventArgs mhea = new HeaderMouseEventArgs(column, this, index, this.DisplayRectToClient(this.ColumnModel.ColumnHeaderRect(index)), e);

				this.OnHeaderMouseMove(mhea);
			}
		}
示例#6
0
		/// <summary>
		/// Raises the HeaderMouseHover event
		/// </summary>
		/// <param name="e">A HeaderMouseEventArgs that contains the event data</param>
		protected virtual void OnHeaderMouseHover(HeaderMouseEventArgs e)
		{
			if (this.CanRaiseEvents)
			{
				if (HeaderMouseHover != null)
				{
					HeaderMouseHover(e.Column, e);
				}
			}
		}
示例#7
0
		/// <summary>
		/// Raises the MouseEnter event
		/// </summary>
		/// <param name="e">A HeaderMouseEventArgs that contains the event data</param>
		public virtual void OnMouseEnter(HeaderMouseEventArgs e)
		{
			this.Bounds = e.HeaderRect;

			bool tooltipActive = e.Table.ToolTip.Active;

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

			e.Table.ResetMouseEventArgs();

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

			if (tooltipActive)
			{
				e.Table.ToolTip.Active = true;
			}
		}
示例#8
0
		/// <summary>
		/// Raises the HeaderMouseMove event
		/// </summary>
		/// <param name="e">A HeaderMouseEventArgs that contains the event data</param>
		protected virtual void OnHeaderMouseMove(HeaderMouseEventArgs e)
		{
			if (this.CanRaiseEvents)
			{
				if (this.HeaderRenderer != null)
				{
					this.HeaderRenderer.OnMouseMove(e);
				}
				
				if (HeaderMouseMove != null)
				{
					HeaderMouseMove(e.Column, e);
				}
			}
		}
示例#9
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);
                }
            }
        }
 /// <summary>
 /// Initializes a new instance of the HandledHeaderMouseEventArgs class with
 /// the specified source Column, Table, column index, column header bounds
 /// and MouseEventArgs
 /// </summary>
 /// <param name="e"></param>
 public HandledHeaderMouseEventArgs(HeaderMouseEventArgs e)
     : base(e.Column, e.Table, e.Index, e.HeaderRect, e)
 {
     this.Handled = false;
 }
示例#11
0
文件: Table.cs 项目: schoetbi/XPTable
        /// <summary>
        /// Raises the HeaderFilterClick event
        /// </summary>
        /// <param name="e">A HeaderMouseEventArgs that contains the event data</param>
        protected virtual void OnHeaderFilterClick(HeaderMouseEventArgs e)
        {
            if (this.CanRaiseEvents)
            {
                var args = new HandledHeaderMouseEventArgs(e);

                if (HeaderFilterClick != null)
                {
                    HeaderFilterClick(e.Column, args);
                }

                if (!args.Handled)
                {
                    if (e.Column.Filter != null)
                    {
                        e.Column.Filter.OnHeaderFilterClick(e);
                    }
                }
            }
        }
 /// <summary>
 /// Initializes a new instance of the HandledHeaderMouseEventArgs class with 
 /// the specified source Column, Table, column index, column header bounds 
 /// and MouseEventArgs
 /// </summary>
 /// <param name="e"></param>
 public HandledHeaderMouseEventArgs(HeaderMouseEventArgs e)
     : base(e.Column, e.Table, e.Index, e.HeaderRect, e)
 {
     this.Handled = false;
 }
示例#13
0
        void UpdateFilter(HeaderMouseEventArgs e, TextColumnFilterDialog dialog)
        {
            if (dialog.AnyUncheckedItems())
                SetFilterItems(dialog.GetCheckedItems());
            else
                SetFilterItems(null);   // The user has ticked every item - so no filtering is needed

            e.Table.OnHeaderFilterChanged(e);
        }
示例#14
0
        TextColumnFilterDialog CreateFilterDialog(HeaderMouseEventArgs e)
        {
            var dialog = new TextColumnFilterDialog();

            Point screenPos = e.Table.PointToScreen(new Point(e.HeaderRect.Left, e.HeaderRect.Bottom));

            dialog.StartPosition = FormStartPosition.Manual;

            dialog.Location = screenPos;

            return dialog;
        }
示例#15
0
        /// <summary>
        /// Called when the filter button is clicked on this column
        /// </summary>
        /// <param name="e"></param>
        public void OnHeaderFilterClick(HeaderMouseEventArgs e)
        {
            TextColumnFilterDialog dialog = CreateFilterDialog(e);

            AddItems(dialog, e.Table, e.Index);

            DialogResult result = dialog.ShowDialog();

            if (result == DialogResult.Cancel)
                return;

            UpdateFilter(e, dialog);
        }