/// <summary> /// Initializes a new instance of the TabEntry class. /// </summary> /// <param name="tabControl">The tab page control.</param> public TabEntry(TabLightweightControl tabLightweightControl, TabPageControl tabPageControl) { // Set the the tab control and the tab lightweight control. this.tabPageControl = tabPageControl; this.tabPageControl.TabStop = false; this.tabLightweightControl = tabLightweightControl; // Instantiate the tab selector lightweight control. tabSelectorLightweightControl = new TabSelectorLightweightControl(this); }
/// <summary> /// TabSelectorLightweightControl_Selected event handler. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">An EventArgs that contains the event data.</param> private void TabSelectorLightweightControl_Selected(object sender, EventArgs e) { // Ensure that the sender is who we think it is. Debug.Assert(sender is TabSelectorLightweightControl, "Doh!", "Bad event wiring is the leading cause of code decay."); if (sender is TabSelectorLightweightControl) { // Set the selected tab entry. TabSelectorLightweightControl tabSelectorLightweightControl = (TabSelectorLightweightControl)sender; SelectedTabEntry = tabSelectorLightweightControl.TabEntry; } }
/// <summary> /// TabSelectorLightweightControl_DragInside event handler. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">An EventArgs that contains the event data.</param> private void TabSelectorLightweightControl_DragOver(object sender, DragEventArgs e) { // Wait an amount of time before selecting the tab page. if (DateTime.Now.Subtract(dragInsideTime).Milliseconds < DRAG_DROP_SELECTION_DELAY) { return; } // Ensure that the sender is who we think it is. Debug.Assert(sender is TabSelectorLightweightControl, "Doh!", "Bad event wiring is the leading cause of code decay."); if (sender is TabSelectorLightweightControl) { // Set the selected tab entry, if we should. TabSelectorLightweightControl tabSelectorLightweightControl = (TabSelectorLightweightControl)sender; if (tabSelectorLightweightControl.TabEntry.TabPageControl.DragDropSelectable && SelectedTabEntry != tabSelectorLightweightControl.TabEntry) { SelectedTabEntry = tabSelectorLightweightControl.TabEntry; } } }
/// <summary> /// Initializes a new instance of the TabEntry class. /// </summary> /// <param name="tabControl">The tab page control.</param> public TabEntry(TabLightweightControl tabLightweightControl, TabPageControl tabPageControl) { // Set the the tab control and the tab lightweight control. this.tabPageControl = tabPageControl; this.tabPageControl.TabStop = false; this.tabLightweightControl = tabLightweightControl; // Instantiate the tab selector lightweight control. tabSelectorLightweightControl = new TabSelectorLightweightControl(this); }