/// <summary> /// Gets the DropDownRendererData specific data used by the Renderer from /// the specified Cell /// </summary> /// <param name="cell">The Cell to get the DropDownRendererData data for</param> /// <returns>The DropDownRendererData data for the specified Cell</returns> protected I3DropDownRendererData GetDropDownRendererData(I3Cell cell) { object rendererData = this.GetRendererData(cell); if (rendererData == null || !(rendererData is I3DropDownRendererData)) { rendererData = new I3DropDownRendererData(); this.SetRendererData(cell, rendererData); } return((I3DropDownRendererData)rendererData); }
/// <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.ShowDropDownButton || (e.Table.IsEditing && e.CellPos == e.Table.EditingCell)) { if (e.Table.IsCellEditable(e.CellPos)) { // get the renderer data I3DropDownRendererData rendererData = this.GetDropDownRendererData(e.Cell); if (this.CalcDropDownButtonBounds().Contains(e.X, e.Y)) { rendererData.ButtonState = I3ComboBoxStates.Hot; e.Table.Invalidate(e.CellRect); } } } }
/// <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.ShowDropDownButton || (e.Table.IsEditing && e.CellPos == e.Table.EditingCell)) { if (e.Table.IsCellEditable(e.CellPos)) { // get the button renderer data I3DropDownRendererData rendererData = this.GetDropDownRendererData(e.Cell); if (rendererData.ButtonState != I3ComboBoxStates.Normal) { rendererData.ButtonState = I3ComboBoxStates.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(IE310.Table.Events.I3CellMouseEventArgs 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 I3DropDownRendererData rendererData = this.GetDropDownRendererData(e.Cell); if (this.CalcDropDownButtonBounds().Contains(e.X, e.Y)) { if (rendererData.ButtonState == I3ComboBoxStates.Normal) { if (e.Button == MouseButtons.Left && e.Row == e.Table.LastMouseDownCell.Row && e.Column == e.Table.LastMouseDownCell.Column) { rendererData.ButtonState = I3ComboBoxStates.Pressed; } else { rendererData.ButtonState = I3ComboBoxStates.Hot; } e.Table.Invalidate(e.CellRect); } } else { if (rendererData.ButtonState != I3ComboBoxStates.Normal) { rendererData.ButtonState = I3ComboBoxStates.Normal; e.Table.Invalidate(e.CellRect); } } } } }
/// <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.ShowDropDownButton || (e.Table.IsEditing && e.CellPos == e.Table.EditingCell)) { if (e.Table.IsCellEditable(e.CellPos)) { // get the button renderer data I3DropDownRendererData rendererData = this.GetDropDownRendererData(e.Cell); if (this.CalcDropDownButtonBounds().Contains(e.X, e.Y)) { if (!(e.Table.ColumnModel.GetCellEditor(e.CellPos.Column) is I3DropDownCellEditor)) { throw new InvalidOperationException("Cannot edit Cell as DropDownCellRenderer requires a DropDownColumn that uses a DropDownCellEditor"); } rendererData.ButtonState = I3ComboBoxStates.Pressed; if (!e.Table.IsEditing) { if (!e.Table.EditCell(e.CellPos)) { e.Table.Invalidate(e.CellRect); return; } } ((II3EditorUsesRendererButtons)e.Table.EditingCellEditor).OnEditorButtonMouseDown(this, e); e.Table.Invalidate(e.CellRect); } } } }