/// <summary>
		/// Initializes a new instance of the HeaderContextMenu class with 
		/// no menu items specified
		/// </summary>
		public HeaderContextMenu() : base()
		{
			this.model = null;
			this.enabled = true;

			this.moreMenuItem = new MenuItem("More...", new EventHandler(moreMenuItem_Click));
			this.separator = new MenuItem("-");
		}
		/// <summary>
		/// Initializes a new instance of the ColumnModel.ColumnCollection class 
		/// that belongs to the specified ColumnModel
		/// </summary>
		/// <param name="owner">A ColumnModel representing the columnModel that owns 
		/// the Column collection</param>
		public ColumnCollection(ColumnModel owner) : base()
		{
			if (owner == null)
			{
				throw new ArgumentNullException("owner");
			}
				
			this.owner = owner;
			this.totalColumnWidth = 0;
			this.visibleColumnsWidth = 0;
			this.visibleColumnCount = 0;
			this.lastVisibleColumn = -1;
		}
		/// <summary>
		/// Displays the shortcut menu at the specified position
		/// </summary>
		/// <param name="control">A Control object that specifies the control 
		/// with which this shortcut menu is associated</param>
		/// <param name="pos">A Point object that specifies the coordinates at 
		/// which to display the menu. These coordinates are specified relative 
		/// to the client coordinates of the control specified in the control 
		/// parameter</param>
		public new void Show(Control control, Point pos)
		{
			if (control == null)
			{
				throw new ArgumentNullException("control", "control cannot be null");
			}

			if (!(control is Table))
			{
				throw new ArgumentException("control must be of type Table", "control");
			}

			if (((Table) control).ColumnModel == null)
			{
				throw new InvalidOperationException("The specified Table does not have an associated ColumnModel");
			}

			//
			this.model = ((Table) control).ColumnModel;

			//
			this.MenuItems.Clear();

			base.Show(control, pos);
		}
			/// <summary>
			/// 
			/// </summary>
			/// <param name="model"></param>
			/// <returns></returns>
			public void AddColumns(ColumnModel model)
			{
				this.model = model;

				CellStyle cellStyle = new CellStyle();
				cellStyle.Padding = new CellPadding(6, 0, 0, 0);

				this.columnTable.BeginUpdate();
				
				for (int i=0; i<model.Columns.Count; i++)
				{
					Row row = new Row();
				
					Cell cell = new Cell(model.Columns[i].Text, model.Columns[i].Visible);
					cell.Tag = model.Columns[i].Width;
					cell.CellStyle = cellStyle;
				
					row.Cells.Add(cell);

					this.columnTable.TableModel.Rows.Add(row);
				}

				this.columnTable.SelectionChanged += new SelectionEventHandler(columnTable_SelectionChanged);
				this.columnTable.CellCheckChanged += new CellCheckBoxEventHandler(columnTable_CellCheckChanged);

				if (this.columnTable.VScroll)
				{
					this.columnTable.ColumnModel.Columns[0].Width -= SystemInformation.VerticalScrollBarWidth;
				}

				if (this.columnTable.TableModel.Rows.Count > 0)
				{
					this.columnTable.TableModel.Selections.SelectCell(0, 0);

					this.showButton.Enabled = !this.model.Columns[0].Visible;
					this.hideButton.Enabled = this.model.Columns[0].Visible;

					this.widthTextBox.Text = this.model.Columns[0].Width.ToString();
				}

				this.columnTable.EndUpdate();
			}
		/// <summary>
		/// Initializes a new instance of the ColumnModelEventArgs class with 
		/// the specified ColumnModel source, start index, end index and affected Column
		/// </summary>
		/// <param name="source">The ColumnModel that originated the event</param>
		/// <param name="column">The affected Column</param>
		/// <param name="fromIndex">The start index of the affected Column(s)</param>
		/// <param name="toIndex">The end index of the affected Column(s)</param>
		public ColumnModelEventArgs(ColumnModel source, Column column, int fromIndex, int toIndex) : base()
		{
			this.source = source;
			this.column = column;
			this.fromIndex = fromIndex;
			this.toIndex = toIndex;
		}
Beispiel #6
0
		/// <summary>
		/// Initialise default values
		/// </summary>
		private void Init()
		{
			this.text = null;
			this.width = Column.DefaultWidth;
			this.columnState = ColumnState.Normal;
			this.alignment = ColumnAlignment.Left;
			this.image = null;
			this.imageOnRight = false;
			this.columnModel = null;
			this.x = 0;
			this.tooltipText = null;
			this.format = "";
			this.sortOrder = SortOrder.None;
			this.renderer = null;
			this.editor = null;
			this.comparer = null;

			this.state = (byte) (STATE_ENABLED | STATE_EDITABLE | STATE_VISIBLE | STATE_SELECTABLE | STATE_SORTABLE);
		}