/// <summary> /// Initializes a new instance of the TableEventArgs class with the specified table, event type and old value /// </summary> /// <param name="_table">The table on which the event occured</param> /// <param name="_eventType">The type of event (principally the property that changed)</param> /// <param name="_oldValue">The old value of a changed property /// <para>would be null for non property change events e.g. if table was being used as a matrix then there might be an inversion event)</para></param> public TableEventArgs(Table _table, TableEventType _eventType, object _oldValue) : base() { this.theTable = _table; this.theEventType = _eventType; this.theOldValue = _oldValue; }
/// <summary> /// Initializes a new instance of the PaintCellEventArgs class with /// the specified graphics, table, row index, column index, selected value, /// focused value, mouse value and clipping rectangle /// </summary> /// <param name="g">The Graphics used to paint the Cell</param> /// <param name="cell">The Cell to be painted</param> /// <param name="table">The Table the Cell belongs to</param> /// <param name="row">The Row index of the Cell</param> /// <param name="column">The Column index of the Cell</param> /// <param name="selected">Specifies whether the Cell is selected</param> /// <param name="focused">Specifies whether the Cell has focus</param> /// <param name="sorted">Specifies whether the Cell's Column is sorted</param> /// <param name="editable">Specifies whether the Cell is able to be edited</param> /// <param name="enabled">Specifies whether the Cell is enabled</param> /// <param name="cellRect">The rectangle in which to paint the Cell</param> public PaintCellEventArgs(Graphics g, Cell cell, Table table, int row, int column, bool selected, bool focused, bool sorted, bool editable, bool enabled, Rectangle cellRect) : base(g, cellRect) { this.cell = cell; this.table = table; this.row = row; this.column = column; this.selected = selected; this.focused = focused; this.sorted = sorted; this.editable = editable; this.enabled = enabled; this.cellRect = cellRect; this.handled = false; }
/// <summary> /// Initializes a new instance of the CellFocusEventArgs class with /// the specified source Cell, table, row index, column index and /// cell bounds /// </summary> /// <param name="source">The Cell that Raised the event</param> /// <param name="table">The Table the Cell belongs to</param> /// <param name="row">The Row index of the Cell</param> /// <param name="column">The Column index of the Cell</param> /// <param name="cellRect">The Cell's bounding rectangle</param> public CellFocusEventArgs(Cell source, Table table, int row, int column, Rectangle cellRect) : base(source, column, row) { this.table = table; this.cellRect = cellRect; }
/// <summary> /// Initializes a new instance of the CellKeyEventArgs class with /// the specified source Cell, table, row index, column index, cell /// bounds and KeyEventArgs /// </summary> /// <param name="cell">The Cell that Raised the event</param> /// <param name="table">The Table the Cell belongs to</param> /// <param name="row">The Row index of the Cell</param> /// <param name="column">The Column index of the Cell</param> /// <param name="cellRect">The Cell's bounding rectangle</param> /// <param name="kea"></param> public CellKeyEventArgs(Cell cell, Table table, int row, int column, Rectangle cellRect, KeyEventArgs kea) : base(kea.KeyData) { this.cell = cell; this.table = table; this.row = row; this.column = column; this.cellRect = cellRect; }
/// <summary> /// Conceals the editor from the user and removes it from the Table's /// Control collection /// </summary> protected virtual void RemoveEditControl() { this.control.Visible = false; this.control.Parent = null; this.table.Focus(); this.cell = null; this.table = null; this.cellPos = CellPos.Empty; this.cellRect = Rectangle.Empty; }
/// <summary> /// Prepares the CellEditor to edit the specified Cell /// </summary> /// <param name="cell">The Cell to be edited</param> /// <param name="table">The Table that contains the Cell</param> /// <param name="cellPos">A CellPos representing the position of the Cell</param> /// <param name="cellRect">The Rectangle that represents the Cells location and size</param> /// <param name="userSetEditorValues">Specifies whether the ICellEditors /// starting value has already been set by the user</param> /// <returns>true if the ICellEditor can continue editing the Cell, false otherwise</returns> public override bool PrepareForEditing(Cell cell, Table table, CellPos cellPos, Rectangle cellRect, bool userSetEditorValues) { // if (!(table.ColumnModel.Columns[cellPos.Column] is NumberColumn)) { throw new InvalidOperationException("Cannot edit Cell as NumberCellEditor can only be used with a NumberColumn"); } if (!(table.ColumnModel.GetCellRenderer(cellPos.Column) is NumberCellRenderer)) { throw new InvalidOperationException("Cannot edit Cell as NumberCellEditor can only be used with a NumberColumn that uses a NumberCellRenderer"); } this.Minimum = ((NumberColumn) table.ColumnModel.Columns[cellPos.Column]).Minimum; this.Maximum = ((NumberColumn) table.ColumnModel.Columns[cellPos.Column]).Maximum; this.Increment = ((NumberColumn) table.ColumnModel.Columns[cellPos.Column]).Increment; return base.PrepareForEditing (cell, table, cellPos, cellRect, userSetEditorValues); }
/// <summary> /// Initializes a new instance of the HeaderMouseEventArgs class with /// the specified source Column, Table, column index and column header bounds /// </summary> /// <param name="column">The Column that Raised the event</param> /// <param name="table">The Table the Column belongs to</param> /// <param name="index">The index of the Column</param> /// <param name="headerRect">The column header's bounding rectangle</param> public HeaderMouseEventArgs(Column column, Table table, int index, Rectangle headerRect) : base(MouseButtons.None, 0, -1, -1, 0) { this.column = column; this.table = table; this.index = index; this.headerRect = headerRect; }
/// <summary> /// Initializes a new instance of the CellEventArgs class with /// the specified Cell source, column index and row index /// </summary> /// <param name="source">The Cell that Raised the event</param> /// <param name="editor">The CellEditor used to edit the Cell</param> /// <param name="table">The Table that the Cell belongs to</param> public CellEditEventArgs(Cell source, ICellEditor editor, Table table) : this(source, editor, table, -1, -1, Rectangle.Empty) { }
/// <summary> /// Initializes a new instance of the CellMouseEventArgs class with /// the specified source Cell, table, row index, column index and /// cell bounds /// </summary> /// <param name="cell">The Cell that Raised the event</param> /// <param name="table">The Table the Cell belongs to</param> /// <param name="cellPos"></param> /// <param name="cellRect">The Cell's bounding rectangle</param> /// <param name="mea"></param> public CellMouseEventArgs(Cell cell, Table table, CellPos cellPos, Rectangle cellRect, MouseEventArgs mea) : base(mea.Button, mea.Clicks, mea.X, mea.Y, mea.Delta) { this.cell = cell; this.table = table; this.row = cellPos.Row; this.column = cellPos.Column; this.cellRect = cellRect; }
/// <summary> /// Initializes a new instance of the CellMouseEventArgs class with /// the specified source Cell, table, row index, column index and /// cell bounds /// </summary> /// <param name="cell">The Cell that Raised the event</param> /// <param name="table">The Table the Cell belongs to</param> /// <param name="row">The Row index of the Cell</param> /// <param name="column">The Column index of the Cell</param> /// <param name="cellRect">The Cell's bounding rectangle</param> public CellMouseEventArgs(Cell cell, Table table, int row, int column, Rectangle cellRect) : base(MouseButtons.None, 0, -1, -1, 0) { this.cell = cell; this.table = table; this.row = row; this.column = column; this.cellRect = cellRect; }
/// <summary> /// Gets whether the specified Table is using a NumericCellEditor to edit the /// Cell at the specified CellPos /// </summary> /// <param name="table">The Table to check</param> /// <param name="cellPos">A CellPos that represents the Cell to check</param> /// <returns>true if the specified Table is using a NumericCellEditor to edit the /// Cell at the specified CellPos, false otherwise</returns> internal bool TableUsingNumericCellEditor(Table table, CellPos cellPos) { return (table.IsEditing && cellPos == table.EditingCell && table.EditingCellEditor is NumberCellEditor); }
/// <summary> /// Initializes a new instance of the PaintHeaderEventArgs class with /// the specified graphics, column, table, column index, header style /// and clipping rectangle /// </summary> /// <param name="g">The Graphics used to paint the Column header</param> /// <param name="column">The Column to be painted</param> /// <param name="table">The Table the Column's ColumnModel belongs to</param> /// <param name="columnIndex">The index of the Column in the Table's ColumnModel</param> /// <param name="headerStyle">The style of the Column's header</param> /// <param name="headerRect">The Rectangle that represents the rectangle /// in which to paint</param> public PaintHeaderEventArgs(Graphics g, Column column, Table table, int columnIndex, ColumnHeaderStyle headerStyle, Rectangle headerRect) : base(g, headerRect) { this.column = column; this.table = table; this.columnIndex = columnIndex; this.column = column; this.headerStyle = headerStyle; this.headerRect = headerRect; this.handled = false; }
/// <summary> /// Initialise default settings /// </summary> private void Init() { this.columns = null; this.table = null; this.headerHeight = ColumnModel.DefaultHeaderHeight; this.cellRenderers = new Hashtable(); this.SetCellRenderer("TEXT", new TextCellRenderer()); this.cellEditors = new Hashtable(); this.SetCellEditor("TEXT", new TextCellEditor()); this.secondarySortOrder = new SortColumnCollection(); }
/// <summary> /// Initializes a new instance of the CellEditor class with default settings /// </summary> protected CellEditor() { this.control = null; this.cell = null; this.table = null; this.cellPos = CellPos.Empty; this.cellRect = Rectangle.Empty; this.mouseMessageFilter = new MouseMessageFilter(this); this.keyMessageFilter = new KeyMessageFilter(this); }
/// <summary> /// /// </summary> /// <param name="table"></param> internal void SetTable(Table table) { this.table = table; }
/// <summary> /// Initializes a new instance of the CellEventArgs class with /// the specified Cell source, column index and row index /// </summary> /// <param name="source">The Cell that Raised the event</param> /// <param name="editor">The CellEditor used to edit the Cell</param> /// <param name="table">The Table that the Cell belongs to</param> /// <param name="row">The Column index of the Cell</param> /// <param name="column">The Row index of the Cell</param> /// <param name="cellRect"></param> public CellEditEventArgs(Cell source, ICellEditor editor, Table table, int row, int column, Rectangle cellRect) : base(source, column, row) { this.editor = editor; this.table = table; this.cellRect = cellRect; this.cancel = false; }
/// <summary> /// Initializes a new instance of the CellMouseEventArgs class with /// the specified source Cell, table, row index, column index and /// cell bounds /// </summary> /// <param name="cell">The Cell that Raised the event</param> /// <param name="table">The Table the Cell belongs to</param> /// <param name="cellPos"></param> /// <param name="cellRect">The Cell's bounding rectangle</param> public CellMouseEventArgs(Cell cell, Table table, CellPos cellPos, Rectangle cellRect) : base(MouseButtons.None, 0, -1, -1, 0) { this.cell = cell; this.table = table; this.row = cellPos.Row; this.column = cellPos.Column; this.cellRect = cellRect; }
/// <summary> /// Initializes a new instance of the HeaderMouseEventArgs class with /// the specified source Column, Table, column index, column header bounds /// and MouseEventArgs /// </summary> /// <param name="column">The Column that Raised the event</param> /// <param name="table">The Table the Column belongs to</param> /// <param name="index">The index of the Column</param> /// <param name="headerRect">The column header's bounding rectangle</param> /// <param name="mea">The MouseEventArgs that contains data about the /// mouse event</param> public HeaderMouseEventArgs(Column column, Table table, int index, Rectangle headerRect, MouseEventArgs mea) : base(mea.Button, mea.Clicks, mea.X, mea.Y, mea.Delta) { this.column = column; this.table = table; this.index = index; this.headerRect = headerRect; }
/// <summary> /// /// </summary> public ShowColumnsDialog() { this.label1 = new Label(); this.columnTable = new Table(); this.upButton = new Button(); this.downButton = new Button(); this.showButton = new Button(); this.hideButton = new Button(); this.label2 = new Label(); this.widthTextBox = new TextBox(); this.autoSizeCheckBox = new CheckBox(); this.groupBox1 = new GroupBox(); this.okButton = new Button(); this.cancelButton = new Button(); this.SuspendLayout(); // // label1 // this.label1.Location = new Point(8, 12); this.label1.Name = "label1"; this.label1.Size = new Size(324, 28); this.label1.TabIndex = 0; //this.label1.Text = "Select the columns you want to appear in this view. Click Move Up and Move Down " + // "to arrange the columns."; this.label1.Text = "Select the columns you want to appear in this view."; // // columnListBox // this.columnTable.HeaderStyle = ColumnHeaderStyle.None; this.columnTable.Location = new Point(12, 52); this.columnTable.Name = "columnListBox"; this.columnTable.Size = new Size(231, 240); this.columnTable.TabIndex = 1; this.columnTable.ColumnModel = new ColumnModel(); this.columnTable.ColumnModel.Columns.Add(new CheckBoxColumn("Columns", 227)); this.columnTable.TableModel = new TableModel(); this.columnTable.TableModel.RowHeight += 3; // // upButton // this.upButton.FlatStyle = FlatStyle.System; this.upButton.Location = new Point(253, 52); this.upButton.Name = "upButton"; this.upButton.TabIndex = 2; this.upButton.Text = "Move &Up"; this.upButton.Visible = false; //this.upButton.Click += new EventHandler(this.upButton_Click); // // downButton // this.downButton.FlatStyle = FlatStyle.System; this.downButton.Location = new Point(253, 81); this.downButton.Name = "downButton"; this.downButton.TabIndex = 3; this.downButton.Text = "Move &Down"; this.downButton.Visible = false; //this.downButton.Click += new EventHandler(this.downButton_Click); // // showButton // this.showButton.FlatStyle = FlatStyle.System; //this.showButton.Location = new Point(253, 114); this.showButton.Location = new Point(253, 52); this.showButton.Name = "showButton"; this.showButton.TabIndex = 4; this.showButton.Text = "&Show"; this.showButton.Click += new EventHandler(this.showButton_Click); // // hideButton // this.hideButton.FlatStyle = FlatStyle.System; //this.hideButton.Location = new Point(253, 145); this.hideButton.Location = new Point(253, 81); this.hideButton.Name = "hideButton"; this.hideButton.TabIndex = 5; this.hideButton.Text = "&Hide"; this.hideButton.Click += new EventHandler(this.hideButton_Click); // // label2 // this.label2.Location = new Point(12, 300); this.label2.Name = "label2"; this.label2.Size = new Size(192, 21); this.label2.TabIndex = 6; this.label2.Text = "&Width of selected column (in pixels):"; this.label2.TextAlign = ContentAlignment.MiddleLeft; // // textBox1 // this.widthTextBox.Location = new Point(207, 300); this.widthTextBox.MaxLength = 4; this.widthTextBox.Name = "textBox1"; this.widthTextBox.Size = new Size(36, 21); this.widthTextBox.TabIndex = 7; this.widthTextBox.Text = "0"; this.widthTextBox.TextAlign = HorizontalAlignment.Right; this.widthTextBox.KeyPress += new KeyPressEventHandler(widthTextBox_KeyPress); // // autoSizeCheckBox // this.autoSizeCheckBox.Location = new Point(12, 330); this.autoSizeCheckBox.Name = "autoSizeCheckBox"; this.autoSizeCheckBox.Size = new Size(228, 16); this.autoSizeCheckBox.TabIndex = 8; this.autoSizeCheckBox.Text = "&Automatically size all columns"; this.autoSizeCheckBox.Visible = false; // // groupBox1 // this.groupBox1.Location = new Point(8, 352); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new Size(322, 8); this.groupBox1.TabIndex = 9; this.groupBox1.TabStop = false; // // okButton // this.okButton.FlatStyle = FlatStyle.System; this.okButton.Location = new Point(168, 372); this.okButton.Name = "okButton"; this.okButton.TabIndex = 10; this.okButton.Text = "OK"; this.okButton.Click += new EventHandler(okButton_Click); // // cancelButton // this.cancelButton.DialogResult = DialogResult.Cancel; this.cancelButton.FlatStyle = FlatStyle.System; this.cancelButton.Location = new Point(253, 372); this.cancelButton.Name = "cancelButton"; this.cancelButton.TabIndex = 11; this.cancelButton.Text = "Cancel"; // // ShowColumnsDialog // this.AcceptButton = this.okButton; this.AutoScaleBaseSize = new Size(5, 14); this.CancelButton = this.cancelButton; this.ClientSize = new Size(339, 408); this.Controls.Add(this.cancelButton); this.Controls.Add(this.okButton); this.Controls.Add(this.groupBox1); this.Controls.Add(this.autoSizeCheckBox); this.Controls.Add(this.widthTextBox); this.Controls.Add(this.label2); this.Controls.Add(this.hideButton); this.Controls.Add(this.showButton); this.Controls.Add(this.downButton); this.Controls.Add(this.upButton); this.Controls.Add(this.columnTable); this.Controls.Add(this.label1); this.Font = new Font("Tahoma", 8.25F); this.FormBorderStyle = FormBorderStyle.FixedDialog; this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "ShowColumnsDialog"; this.ShowInTaskbar = false; this.StartPosition = FormStartPosition.CenterParent; this.Text = "Choose Columns"; this.ResumeLayout(false); }
/// <summary> /// Initialise default settings /// </summary> private void Init() { this.rows = null; this.selection = new Selection(this); this.table = null; this.rowHeight = TableModel.DefaultRowHeight; }
/// <summary> /// Prepares the CellEditor to edit the specified Cell /// </summary> /// <param name="cell">The Cell to be edited</param> /// <param name="table">The Table that contains the Cell</param> /// <param name="cellPos">A CellPos representing the position of the Cell</param> /// <param name="cellRect">The Rectangle that represents the Cells location and size</param> /// <param name="userSetEditorValues">Specifies whether the ICellEditors /// starting value has already been set by the user</param> /// <returns>true if the ICellEditor can continue editing the Cell, false otherwise</returns> public override bool PrepareForEditing(Cell cell, Table table, CellPos cellPos, Rectangle cellRect, bool userSetEditorValues) { if (!(table.ColumnModel.Columns[cellPos.Column] is DropDownColumn)) { throw new InvalidOperationException("Cannot edit Cell as DropDownCellEditor can only be used with a DropDownColumn"); } return base.PrepareForEditing (cell, table, cellPos, cellRect, userSetEditorValues); }
/// <summary> /// Initializes a new instance of the CellKeyEventArgs class with /// the specified source Cell, table, row index, column index and /// cell bounds /// </summary> /// <param name="cell">The Cell that Raised the event</param> /// <param name="table">The Table the Cell belongs to</param> /// <param name="cellPos"></param> /// <param name="cellRect">The Cell's bounding rectangle</param> /// <param name="kea"></param> public CellKeyEventArgs(Cell cell, Table table, CellPos cellPos, Rectangle cellRect, KeyEventArgs kea) : base(kea.KeyData) { this.cell = cell; this.table = table; this.row = cellPos.Row; this.column = cellPos.Column; this.cellRect = cellRect; }
/// <summary> /// Prepares the CellEditor to edit the specified Cell /// </summary> /// <param name="cell">The Cell to be edited</param> /// <param name="table">The Table that contains the Cell</param> /// <param name="cellPos">A CellPos representing the position of the Cell</param> /// <param name="cellRect">The Rectangle that represents the Cells location and size</param> /// <param name="userSetEditorValues">Specifies whether the ICellEditors /// starting value has already been set by the user</param> /// <returns>true if the ICellEditor can continue editing the Cell, false otherwise</returns> public virtual bool PrepareForEditing(Cell cell, Table table, CellPos cellPos, Rectangle cellRect, bool userSetEditorValues) { // this.cell = cell; this.table = table; this.cellPos = cellPos; this.cellRect = cellRect; // check if the user has already set the editors value for us if (!userSetEditorValues) { this.SetEditValue(); } this.SetEditLocation(cellRect); // raise the BeginEdit event CellEditEventArgs e = new CellEditEventArgs(cell, this, table, cellPos.Row, cellPos.Column, cellRect); e.Handled = userSetEditorValues; this.OnBeginEdit(e); // if the edit has been canceled, remove the editor and return false if (e.Cancel) { this.RemoveEditControl(); return false; } return true; }