internal IPresenter OpenMdiTab(string tabName) { MdiTab tb = getMdiTabFromForm(tabName); IPresenter p1 = null; if (tb == null || !_view.mdiManager.TabGroups[0].Tabs.Contains(tb)) { switch (tabName) { case MdiTabKeys.Search: p1 = PresenterFactory.Instance.GetSearchPresenter(); p1.Show(); break; case MdiTabKeys.RtfEditor: p1 = PresenterFactory.Instance.GetRtfEditor(); p1.Show(); break; } } else { _view.mdiManager.TabGroups[0].Tabs[tabName].Activate(); p1 = (IPresenter)tb.Tag; } return(p1); }
/// <summary> /// Shows the smart part in the workspace. /// </summary> /// <param name="smartPart">The smart part to show</param> /// <param name="smartPartInfo">The associated smart part info for the smart part being shown.</param> protected virtual void OnShow(Control smartPart, UltraMdiTabSmartPartInfo smartPartInfo) { // create and show the tab MdiTab tab = this.CreateTab(smartPart, smartPartInfo); tab.Show(); }
/// <summary> /// Hides the smart part. /// </summary> protected virtual void OnHide(Control smartPart) { MdiTab tab = this.GetTab(smartPart); if (null != tab) { tab.Form.Hide(); } }
/// <summary> /// Activates the smart part within the workspace. /// </summary> /// <param name="smartPart">The smart part to activate</param> protected virtual void OnActivate(Control smartPart) { MdiTab tab = this.GetTab(smartPart); // AS 7/13/06 BR13877 // When a hidden tab is requesting to be activated, we need to // show the associated form. // tab.Show(); tab.Activate(); }
private Form GetNextWindow(Form mdiChild, bool forward) { if (mdiChild == null) { return(null); } if (_manager != null && manager.TabNavigationMode == MdiTabNavigationMode.VisibleOrder) { MdiTab mdiTab = manager.TabFromForm(mdiChild); MdiTab mdiTab2 = null; if (mdiTab != null) { mdiTab2 = mdiTab.GetNextPreviousTab(wrap: true, forward); } return(mdiTab2?.Form); } MdiClient mdiClient = Control.FromHandle(base.Handle) as MdiClient; int childIndex = mdiClient.Controls.GetChildIndex(mdiChild, throwException: false); if (childIndex < 0) { return(null); } int count = mdiClient.Controls.Count; Control control = null; if (forward) { for (int i = childIndex + 1; i < count * 2; i++) { Control control2 = mdiClient.Controls[i % count]; if (control2.CanSelect) { control = control2; break; } } } else { for (int num = childIndex - 1 + count; num > childIndex; num--) { Control control3 = mdiClient.Controls[num % count]; if (control3.CanSelect) { control = control3; break; } } } return(control as Form); }
private void ShowDifferences(string itemA, string itemB, DiffType diffType) { using (WaitCursor wc = new WaitCursor(this)) { try { Form frmNew; if (diffType == DiffType.Directory) { #pragma warning disable CA2000 // Dispose objects before losing scope. This modeless form is owned by the MDI parent window. frmNew = new DirDiffForm(); #pragma warning restore CA2000 // Dispose objects before losing scope this.RecentDirs.Add(BuildRecentItemMenuString(itemA, itemB), new string[] { itemA, itemB }); } else { // Use a FileDiffForm for file or text diffs. #pragma warning disable CA2000 // Dispose objects before losing scope. This modeless form is owned by the MDI parent window. frmNew = new FileDiffForm(); #pragma warning restore CA2000 // Dispose objects before losing scope if (diffType == DiffType.File) { this.RecentFiles.Add(BuildRecentItemMenuString(itemA, itemB), new string[] { itemA, itemB }); } } if (this.NewChildShouldBeMaximized) { frmNew.WindowState = FormWindowState.Maximized; } frmNew.MdiParent = this; IDifferenceForm frmDiff = (IDifferenceForm)frmNew; frmDiff.ShowDifferences(new ShowDiffArgs(itemA, itemB, diffType)); MdiTab tab = this.mdiTabStrip.FindTab(frmNew); if (tab != null) { tab.ToolTipText = frmDiff.ToolTipText; } } catch (Exception ex) { this.ReportError(ex.Message); } } }
private void ForceCloseTab(MdiTab tab) { MdiTab previousForceCloseTab = this.tabForcingClosed; try { this.tabForcingClosed = tab; tab.Form.Close(); } finally { this.tabForcingClosed = previousForceCloseTab; } }
private MdiTab getMdiTabFromForm(string name) { Form f2 = null; foreach (Form f in _view.MdiChildren) { if (f.Name.StartsWith(name, StringComparison.OrdinalIgnoreCase)) { f2 = f; break; } } MdiTab tb = _view.mdiManager.TabFromForm(f2); return(tb); }
private void RemoveSmartPart(Control smartPartControl) { // find the tab we contained the smartpart within MdiTab tab = this.GetTab(smartPartControl); // clean up the group<=>smartpart references this.composer.Remove(tab, smartPartControl); // TODO remove the control from the form // get rid of the tab if (tab.Form != null) { // don't allow it to be cancelled this.ForceCloseTab(tab); tab.Dispose(); } }
public override void Initialize(IComponent component) { base.Initialize(component); MdiTabStrip tabStrip = (MdiTabStrip)Control; MdiTab activeTab = new MdiTab(tabStrip); MdiTab inactiveTab = new MdiTab(tabStrip); MdiTab mouseOverTab = new MdiTab(tabStrip); tabStrip.LeftScrollTab.Visible = true; tabStrip.RightScrollTab.Visible = true; tabStrip.DropDownTab.Visible = true; activeTab.Form = new Form1(); tabStrip.ActiveTab = activeTab; tabStrip.Tabs.Add(activeTab); inactiveTab.Form = new Form2(); tabStrip.Tabs.Add(inactiveTab); mouseOverTab.Form = new Form3(); mouseOverTab.IsMouseOver = true; tabStrip.Tabs.Add(mouseOverTab); tabStrip.PerformLayout(); }
private void ApplySmartPartInfoHelper(MdiTab tab, UltraMdiTabSmartPartInfo smartPartInfo) { tab.Text = smartPartInfo.Title; tab.ToolTip = smartPartInfo.Description; //~ AS 7/21/06 BR14381 if (tab.Form != null) { tab.Form.Text = smartPartInfo.Title; } Image img = smartPartInfo.Image; if (img != null) { tab.Settings.TabAppearance.Image = img; } else if (tab.HasSettings && tab.Settings.HasTabAppearance) { tab.Settings.TabAppearance.Image = null; } }
private MdiTab CreateTab(Control smartPart, UltraMdiTabSmartPartInfo smartPartInfo) { if (this.MdiParent == null) { throw new InvalidOperationException(Properties.Resources.MdiParentNotSet); } // create an mdi form Form form = new Form(); form.MdiParent = this.MdiParent; string groupKey = smartPartInfo.PreferredGroup; // get the tab associated with that form MdiTab tab = this.TabFromForm(form); this.composer.Add(tab, smartPart); // add the control to the form and make it fill the mdi child smartPart.Dock = DockStyle.Fill; form.Controls.Add(smartPart); this.ApplySmartPartInfoHelper(tab, smartPartInfo); if (groupKey != null) { // if there's a group key, we'll use a helper class to put // the tab into the specified group using (TabDisplayingHelper tabHelper = new TabDisplayingHelper(this, groupKey)) tab.Show(); } else { tab.Show(); } return(tab); }
private void ApplyOptions() { // The MdiTabStrip manages its own visiblity by hiding when no tabs exist. However, // it respects the control's Enabled property when deciding whether to add or remove // tabs and toggle the visibility. this.mdiTabStrip.Enabled = Options.ShowMdiTabs; if (!Options.ShowMdiTabs) { // The strip is disabled, so we have to force visibility off since the strip // won't do any checking of tab existence now. this.mdiTabStrip.Visible = false; } else { // The strip is enabled, so we need to let the strip decide whether // it should be visible based on whether any tabs exist. this.mdiTabStrip.BeginUpdate(); this.mdiTabStrip.EndUpdate(); // Make sure all the tab tooltips are up-to-date since windows may have // been opened while the tab strip was disabled. foreach (Form child in this.MdiChildren) { // Not all MDI children implement IDifferenceForm (e.g., TextDiffForm doesn't). if (child is IDifferenceForm form) { MdiTab tab = this.mdiTabStrip.FindTab(child); if (tab != null && !string.IsNullOrEmpty(tab.ToolTipText)) { tab.ToolTipText = form.ToolTipText; } } } } }
private void ultraExplorerBar1_ItemClick(object sender, Infragistics.Win.UltraWinExplorerBar.ItemEventArgs e) { #region progress // show a progress bar in the status bar if (this.progressTimer != null && this.ProgressPanel != null && this.ProgressPanelLabel != null) { this.progressTimer.Stop(); this.progressPanel.ProgressBarInfo.Value = this.progressPanel.ProgressBarInfo.Minimum; this.progressPanelLabel.Text = string.Format("{0}: {1}%", Utilities.GetLocalizedString("Updating"), this.progressPanel.ProgressBarInfo.Value); this.progressTimer.Start(); } #endregion // progress frmContent frmContent = null; MdiTab mdiTab = null; // get the appropriate content form instance. If there is no instance yet, create one of the appropriate content type. switch (e.Item.Key) { case CUSTOMERS: mdiTab = this.ultraTabbedMdiManager1.TabFromKey(CUSTOMERS); frmContent = mdiTab == null ? new frmContent(OutlookCRM.Enums.ContentType.Customers) { MdiParent = this } : mdiTab.Form as frmContent; break; case ORDERS: mdiTab = this.ultraTabbedMdiManager1.TabFromKey(ORDERS); frmContent = mdiTab == null ? new frmContent(OutlookCRM.Enums.ContentType.Orders) { MdiParent = this } : mdiTab.Form as frmContent; break; case ORDERDETAILS: mdiTab = this.ultraTabbedMdiManager1.TabFromKey(ORDERDETAILS); frmContent = mdiTab == null ? new frmContent(OutlookCRM.Enums.ContentType.OrderDetails) { MdiParent = this } : mdiTab.Form as frmContent; break; case PRODUCTS: mdiTab = this.ultraTabbedMdiManager1.TabFromKey(PRODUCTS); frmContent = mdiTab == null ? new frmContent(OutlookCRM.Enums.ContentType.ProductSales) { MdiParent = this } : mdiTab.Form as frmContent; break; case CATEGORIES: mdiTab = this.ultraTabbedMdiManager1.TabFromKey(CATEGORIES); frmContent = mdiTab == null ? new frmContent(OutlookCRM.Enums.ContentType.SalesByCategory) { MdiParent = this } : mdiTab.Form as frmContent; break; case SHIPPERS: mdiTab = this.ultraTabbedMdiManager1.TabFromKey(SHIPPERS); frmContent = mdiTab == null ? new frmContent(OutlookCRM.Enums.ContentType.Shippers) { MdiParent = this } : mdiTab.Form as frmContent; break; default: mdiTab = this.ultraTabbedMdiManager1.TabFromKey(CONTENTEMPTY); frmContentEmpty frmContentEmpty = mdiTab == null ? new frmContentEmpty() { MdiParent = this } : mdiTab.Form as frmContentEmpty; if (frmContentEmpty != null) { frmContentEmpty.Show(); frmContentEmpty.Activate(); } break; } if (frmContent != null) { // show and activate the appropriate instance of the content form. frmContent.Show(); frmContent.Activate(); } }
/// <summary> /// Applies the smart part info to the smart part within the workspace. /// </summary> /// <param name="smartPart">The smart part to which the smart part info should be applied.</param> /// <param name="smartPartInfo">The smart part info to apply</param> protected virtual void OnApplySmartPartInfo(Control smartPart, UltraMdiTabSmartPartInfo smartPartInfo) { MdiTab tab = this.GetTab(smartPart); this.ApplySmartPartInfoHelper(tab, smartPartInfo); }
private void MdiTabContext_Opening(object sender, CancelEventArgs e) { MdiTab mouseOverTab = this.mdiTabStrip.FindTabAtScreenPoint(Cursor.Position); e.Cancel = mouseOverTab == null; }
private Control GetSmartPart(MdiTab tab) { return(this.composer[tab]); }