/// <summary>Callback for the <see cref="TabDeselected" /> event.</summary> /// <param name="e">Arguments associated with the event.</param> protected void OnTabDeselected(TitleBarTabEventArgs e) { if (TabDeselected != null) { TabDeselected(this, e); } }
/// <summary>Callback for the <see cref="TabClicked" /> event.</summary> /// <param name="e">Arguments associated with the event.</param> protected internal void OnTabClicked(TitleBarTabEventArgs e) { if (TabClicked != null) { TabClicked(this, e); } }
/// <summary> /// Callback for the <see cref="TabSelected" /> event. Called when a <see cref="TitleBarTab" /> gains focus. Sets the active window in Aero Peek via a /// call to <see cref="TabbedThumbnailManager.SetActiveTab(Control)" />. /// </summary> /// <param name="e">Arguments associated with the event.</param> protected void OnTabSelected(TitleBarTabEventArgs e) { if (SelectedTabIndex != -1 && _previews.ContainsKey(SelectedTab.Content) && AeroPeekEnabled) { TaskbarManager.Instance.TabbedThumbnail.SetActiveTab(SelectedTab.Content); } _previousActiveTab = SelectedTab; if (TabSelected != null) { TabSelected(this, e); } }
/// <summary>Calls <see cref="CreateTab" />, adds the resulting tab to the <see cref="Tabs" /> collection, and activates it.</summary> public virtual void AddNewTab() { TitleBarTab newTab = null; if (AutoCreateTab) { newTab = CreateTab(); Tabs.Add(newTab); ResizeTabContents(newTab); SelectedTabIndex = _tabs.Count - 1; } var titleBarTabEventArgs = new TitleBarTabEventArgs { Tab = newTab, TabIndex = SelectedTabIndex, Action = TabControlAction.Selected, WasDragging = false }; TabCreated?.Invoke(this, titleBarTabEventArgs); }
/// <summary> /// Handler method that's called when a tab is clicked on. This is different from the <see cref="TitleBarTabs.TabSelected"/> event handler in that /// this is called even if the tab is currently active. This is used to show the toolbar for <see cref="ConnectionWindow"/> instances that /// automatically hide their toolbars when the connection's UI is focused on. /// </summary> /// <param name="sender">Object from which this event originated.</param> /// <param name="e">Arguments associated with this event.</param> private void MainForm_TabClicked(object sender, TitleBarTabEventArgs e) { // Only show the toolbar if the user clicked on an already-selected tab if (e.Tab.Content is ConnectionWindow && e.Tab == _previouslyClickedTab && !e.WasDragging) (e.Tab.Content as ConnectionWindow).ShowToolbar(); _previouslyClickedTab = e.Tab; }
/// <summary> /// Callback for the <see cref="TabClosed" /> event. Called when <see cref="TitleBarTab" /> is closed /// </summary> /// <param name="e">Arguments associated with the event.</param> public void OnTabClosed(TitleBarTabEventArgs e) { TabClosed?.Invoke(this, e); }