// Note: The Init method is handled by the superclass. /// <summary> /// Caches the ChoiceGroupCollection received, since it's not guaranteed that /// tab information will be received before item information, and /// SilSidePane Items cannot be added to an SilSidePane without Tabs. /// </summary> /// <param name="groupCollection">Collection of groups for this sidebar.</param> public override void CreateUIForChoiceGroupCollection(ChoiceGroupCollection groupCollection) { #if USE_DOTNETBAR string sAreas = m_mediator.StringTbl.LocalizeAttributeValue("Areas"); foreach (ChoiceGroup group in groupCollection) { if (group.Label == sAreas) { group.ReferenceWidget = this.NavPane.NavigationBar; this.NavPane.NavigationBar.Tag = group; } else { MakeListControl(group); } } #else // Cache CGC m_choiceGroupCollectionCache = groupCollection; foreach (ChoiceGroup group in groupCollection) { if (group.Label == areasLabel) { group.ReferenceWidget = this.MyPanel; this.MyPanel.Tag = group; } else { MakeListControl(group); } } #endif }
/// <summary> /// create menus for the menubar /// </summary> /// <param name="groupCollection"></param> public void CreateUIForChoiceGroupCollection(ChoiceGroupCollection groupCollection) { foreach(ChoiceGroup group in groupCollection) { MakeMenu(m_menubar, group); } }
public void CreateUIForChoiceGroupCollection(ChoiceGroupCollection groupCollection) { bool weCreatedTheBarManager = GetCommandBarManager(); foreach(ChoiceGroup group in groupCollection) { CommandBar toolbar = new CommandBar(CommandBarStyle.ToolBar); toolbar.Tag = group; group.ReferenceWidget = toolbar; //whereas the system was designed to only populate groups when //the OnDisplay method is called on a group, //this particular widget really really wants to have all of the buttons //populated before it gets added to the window. //therefore, we don't hope this up but instead call a bogus OnDisplay() now. //toolbar.VisibleChanged += new System.EventHandler(group.OnDisplay); group.OnDisplay(null,null); this.m_commandBarManager.CommandBars.Add(toolbar); } if(weCreatedTheBarManager) m_window.Controls.Add(m_commandBarManager); }
// Note: Init method is handled by superclass. /// <summary> /// Create a menu, but not its items. /// </summary> /// <param name="groupCollection">Collection of menu definitions to create.</param> public override void CreateUIForChoiceGroupCollection(ChoiceGroupCollection groupCollection) { MenuStrip s = MyMenuStrip; //s.MouseEnter += s_MouseEnter; //new MouseEventHandler(s_MouseEnter); //s.MouseLeave +=s_MouseLeave; foreach (ChoiceGroup group in groupCollection) { string label = group.Label.Replace("_", "&"); ToolStripMenuItem item = new ToolStripMenuItem(); item.AccessibilityObject.Name = group.Id; item.Text = label; item.Tag = group; group.ReferenceWidget = item; s.Items.Add(item); // This next line deals with the chicken and egg problem of // the dynamic dropdown menus. Although we don't yet // know all the details (visibility, etc.) the dropdown // (and alt-key shortcuts) don't work properly without // being 'primed' with something before their first use. item_DropDownOpening(item, null); item.DropDownOpening += item_DropDownOpening; } }
public override void CreateUIForChoiceGroupCollection(ChoiceGroupCollection groupCollection) { MenuStrip myMenuStrip = MyMenuStrip; //s.MouseEnter += s_MouseEnter; //new MouseEventHandler(s_MouseEnter); //s.MouseLeave +=s_MouseLeave; foreach(ChoiceGroup group in groupCollection) { string label = group.Label.Replace("_", "&"); ToolStripMenuItem item = new ToolStripMenuItem(); item.AccessibilityObject.Name = group.Id; item.Text = label; item.Tag = group; group.ReferenceWidget = item; myMenuStrip.Items.Add(item); // This next line deals with the chicken and egg problem of // the dynamic dropdown menus. Although we don't yet // know all the details (visibility, etc.) the dropdown // (and alt-key shortcuts) don't work properly without // being 'primed' with something before their first use. item_DropDownOpening(item, null); item.DropDownOpening += item_DropDownOpening; } }
public void CreateUIForChoiceGroupCollection(ChoiceGroupCollection groupCollection) { bool weCreatedTheBarManager = GetCommandBarManager(); foreach (ChoiceGroup group in groupCollection) { CommandBar toolbar = new CommandBar(CommandBarStyle.ToolBar); toolbar.Tag = group; group.ReferenceWidget = toolbar; //whereas the system was designed to only populate groups when //the OnDisplay method is called on a group, //this particular widget really really wants to have all of the buttons //populated before it gets added to the window. //therefore, we don't hope this up but instead call a bogus OnDisplay() now. //toolbar.VisibleChanged += new System.EventHandler(group.OnDisplay); group.OnDisplay(null, null); this.m_commandBarManager.CommandBars.Add(toolbar); } if (weCreatedTheBarManager) { m_window.Controls.Add(m_commandBarManager); } }
/// <summary> /// create menus for the menubar /// </summary> /// <param name="groupCollection"></param> public void CreateUIForChoiceGroupCollection(ChoiceGroupCollection groupCollection) { foreach (ChoiceGroup group in groupCollection) { MakeMenu(m_menubar, group); } }
private void MakeTree(ChoiceGroupCollection groupCollection, string label, out OutlookBarBand band) { TreeView tree = new TreeView(); tree.Tag = groupCollection; tree.AfterSelect += new TreeViewEventHandler(OnTreeNodeSelected); band = new OutlookBarBand(label, tree); }
protected ChoiceGroup FindControlGroupById(string type, string id) { Assert.AreEqual("menu", type, "only looking up menus has been implemented"); ChoiceGroupCollection groupCollection = m_window.MenusChoiceGroupCollection; Assert.IsNotNull(groupCollection, "could not get the ChoiceGroupCollection for '" + type + "'."); //will throw an exception if it is not found. return(groupCollection.FindById(id)); }
public void CreateUIForChoiceGroupCollection(ChoiceGroupCollection groupCollection) { bool weCreatedTheBarManager = GetCommandBarManager(); m_commandBarManager.CommandBars.Add(m_menuBar); foreach(ChoiceGroup group in groupCollection) { MakeMenu(m_menuBar, group); } if(weCreatedTheBarManager) m_window.Controls.Add(m_commandBarManager); }
public void CreateUIForChoiceGroupCollection(ChoiceGroupCollection groupCollection) { bool weCreatedTheBarManager = GetCommandBarManager(); m_commandBarManager.CommandBars.Add(m_menuBar); foreach (ChoiceGroup group in groupCollection) { MakeMenu(m_menuBar, group); } if (weCreatedTheBarManager) { m_window.Controls.Add(m_commandBarManager); } }
// Note: The Init method is handled by the superclass. /// <summary> /// Overrides method to create main elements of the sidebar. /// </summary> /// <param name="groupCollection">Collection of groups for this sidebar.</param> public override void CreateUIForChoiceGroupCollection(ChoiceGroupCollection groupCollection) { string sAreas = m_mediator.StringTbl.LocalizeAttributeValue("Areas"); foreach (ChoiceGroup group in groupCollection) { if (group.Label == sAreas) { group.ReferenceWidget = this.NavPane.NavigationBar; this.NavPane.NavigationBar.Tag = group; } else { MakeListControl(group); } } }
// Note: Init method is handled by superclass. /// <summary> /// Create a menu, but not its items. /// </summary> /// <param name="groupCollection">Collection of menu definitions to create.</param> public override void CreateUIForChoiceGroupCollection(ChoiceGroupCollection groupCollection) { foreach (ChoiceGroup group in groupCollection) { string label = group.Label.Replace("_", "&"); MenuStrip s = MyMenuStrip; ToolStripMenuItem item = new ToolStripMenuItem(); item.Text = label; item.Tag = group; group.ReferenceWidget = item; s.Items.Add(item); item.MouseEnter += new EventHandler(item_MouseEnter); item.DropDownOpening += ItemDropDownOpening; // item.MouseEnter += ItemDropDownOpening; // TODO-Linux: just captuing DropDownOpening only shows menu if its been clicked on at least once. item.DropDownClosed += ItemDropDownClosed; } }
// Note: The Init method is handled by the superclass. /// <summary> /// Caches the ChoiceGroupCollection received, since it's not guaranteed that /// tab information will be received before item information, and /// SilSidePane Items cannot be added to an SilSidePane without Tabs. /// </summary> /// <param name="groupCollection">Collection of groups for this sidebar.</param> public override void CreateUIForChoiceGroupCollection(ChoiceGroupCollection groupCollection) { // Cache CGC m_choiceGroupCollectionCache = groupCollection; foreach (ChoiceGroup group in groupCollection) { if (group.Label == areasLabel) { group.ReferenceWidget = this.MyPanel; this.MyPanel.Tag = group; } else { MakeListControl(group); } } }
// Note: Init method is handled by superclass. /// <summary> /// Create a menu, but not its items. /// </summary> /// <param name="groupCollection">Collection of menu definitions to create.</param> public override void CreateUIForChoiceGroupCollection(ChoiceGroupCollection groupCollection) { foreach(ChoiceGroup group in groupCollection) { string label = group.Label.Replace("_", "&"); MenuStrip s = MyMenuStrip; ToolStripMenuItem item = new ToolStripMenuItem(); item.Text = label; item.Tag = group; group.ReferenceWidget = item; s.Items.Add(item); item.MouseEnter += new EventHandler(item_MouseEnter); item.DropDownOpening += ItemDropDownOpening; // item.MouseEnter += ItemDropDownOpening; // TODO-Linux: just captuing DropDownOpening only shows menu if its been clicked on at least once. item.DropDownClosed += ItemDropDownClosed; } }
public void CreateUIForChoiceGroupCollection(ChoiceGroupCollection groupCollection) { foreach (ChoiceGroup group in groupCollection) { // make band string label = group.Label; label = label.Replace("_", ""); OutlookBarBand band; if (group.HasSubGroups()) { MakeTree(groupCollection, label, out band); } else { band = new OutlookBarBand(label); } band.Tag = group; group.ReferenceWidget = band; // band.GotFocus += new System.EventHandler(group.OnDisplay); m_bar.Bands.Add(band); band.SmallImageList = m_smallImages.ImageList; band.LargeImageList = m_largeImages.ImageList; object s = m_mediator.PropertyTable.GetValue("SidebarSize"); if (s == null || (string)s == "small") { band.IconView = SidebarLibrary.WinControls.IconView.Small; } else { band.IconView = SidebarLibrary.WinControls.IconView.Large; } band.Background = SystemColors.AppWorkspace; band.TextColor = Color.White; //note that I had to fix the outlook bar code I downloaded to make this work. //so if we download a new one and it stops working, go fix it again. band.Font = new Font("Microsoft Sans Serif", 12); } }
// Note: Init method is handled by superclass. /// <summary> /// Create a menu, but not its items. /// </summary> /// <param name="groupCollection">Collection of menu definitions to create.</param> public override void CreateUIForChoiceGroupCollection(ChoiceGroupCollection groupCollection) { //for the automated gui testing bool accessibilityMode = GetStringRegistryValue("AccessibilityTestingMode", "false") == "true"; foreach (ChoiceGroup group in groupCollection) { Bar bar = MyBar; string label = group.Label.Replace("_", "&"); ButtonItem menu = new ButtonItem(group.Id, label); bar.Items.Add(menu); menu.Tag = group; group.ReferenceWidget = menu; menu.SubItems.Add(new ButtonItem("just to make popup happen")); menu.PopupOpen += new DevComponents.DotNetBar.DotNetBarManager.PopupOpenEventHandler(menu_PopupOpen); if (!accessibilityMode) { menu.PopupClose += new EventHandler(menu_PopupClose); } } }
/// <summary> /// Implement do-nothing method to keep the compiler happy. /// Subclasses override this method to do useful things. /// </summary> /// <param name="groupCollection">Collection of choices.</param> public virtual void CreateUIForChoiceGroupCollection(ChoiceGroupCollection groupCollection) { }
// Note: Init method is handled by superclass. /// <summary> /// Create a menu, but not its items. /// </summary> /// <param name="groupCollection">Collection of menu definitions to create.</param> public override void CreateUIForChoiceGroupCollection(ChoiceGroupCollection groupCollection) { //for the automated gui testing bool accessibilityMode = GetStringRegistryValue("AccessibilityTestingMode","false")=="true"; foreach(ChoiceGroup group in groupCollection) { Bar bar = MyBar; string label = group.Label.Replace("_", "&"); ButtonItem menu = new ButtonItem(group.Id, label); bar.Items.Add(menu); menu.Tag = group; group.ReferenceWidget = menu; menu.SubItems.Add(new ButtonItem("just to make popup happen")); menu.PopupOpen+=new DevComponents.DotNetBar.DotNetBarManager.PopupOpenEventHandler(menu_PopupOpen); if(!accessibilityMode) menu.PopupClose+=new EventHandler(menu_PopupClose); } }
/// <summary> /// Start the window almost from scratch. /// This is needed to fix the full refresh behavior of wiping out everything in the caches. /// </summary> protected void WarmBootPart1() { SaveSettings(); // Disable the mediator from processing messages. if (m_mediator != null) { m_mediator.MainWindow = null; m_mediator.ProcessMessages = false; m_mediator.RemoveColleague(this); } // m_mainSplitContainer is the only control created and added to this.Controls in // InitializeComponents(). Get rid of all the other collected controls -- they'll be // recreated by LoadUIFromXmlDocument(). this.SuspendLayout(); List<Control> toRemove = new List<Control>(); foreach (Control ctrl in Controls) { if (ctrl != m_mainSplitContainer) toRemove.Add(ctrl); } foreach (Control ctrl in toRemove) { Controls.Remove(ctrl); ctrl.Dispose(); } // close all dialogs owned by the main window foreach (Form f in OwnedForms) { // Don't close the import wizard just because creating a custom field // causes a full refresh. See LT-10193. if (f.Name != "LexImportWizard") f.Close(); } // Clear all the controls created in LoadUIFromXmlDocument(). m_rebarAdapter = null; m_sidebarAdapter = null; m_menuBarAdapter = null; m_adapters.Clear(); m_sidebar = null; m_menusChoiceGroupCollection.Clear(); m_menusChoiceGroupCollection = null; m_sidebarChoiceGroupCollection.Clear(); m_sidebarChoiceGroupCollection = null; m_toolbarsChoiceGroupCollection.Clear(); m_toolbarsChoiceGroupCollection = null; m_statusPanels.Clear(); // Refresh refills the status panels. // This is a patch - much like the one below on the mediator where it's checked for null. // If we (I) knew why this was getting called 'n' times and the value was null, I'd have fixed // it differently. if (m_mainContentControl != null) { m_mainContentControl.Dispose(); m_mainContentControl = null; } // Finish destroying the old mediator, and create a new one. if (m_mediator != null) { // First, we need to get rid of any existing DotNetBarManager object! (See LT-6481) if (m_mediator.PropertyTable.PropertyExists("DotNetBarManager")) { m_mediator.PropertyTable.SetPropertyDispose("DotNetBarManager", true); } m_mediator.Dispose(); } m_mediator = new Mediator(); // No broadcasting until it has our handle (see OnHandleCreated) m_mediator.SpecificToOneMainWindow = true; this.ResumeLayout(); }
/// <summary> /// Overrides method to create the toolbars, but witout the items on them, /// which are handled elsewhere. /// </summary> /// <param name="groupCollection">Collection of toolbar definitions to create.</param> public override void CreateUIForChoiceGroupCollection(ChoiceGroupCollection groupCollection) { m_choiceGroupCollection= groupCollection; DotNetBarManager manager = (DotNetBarManager)m_mediator.PropertyTable.GetValue("DotNetBarManager"); // manager.SaveLayout("testLayout.xml"); // If the menubar has already been added, remove it, // and re-add it after adding the toolbars, or it won't be at the top. Bar menuBar = null; foreach (Bar bar in manager.Bars) { if (bar.MenuBar) { menuBar = bar; bar.Name="menubar";//there may be some better place to put this, but I couldn't quickly find where the menubar is created. manager.Bars.Remove(menuBar); break; } } // Create new Bars. foreach(ChoiceGroup group in groupCollection) { Bar toolbar = new Bar(group.Id); toolbar.Name = group.Id; toolbar.CanHide = true; if( m_mediator.PropertyTable.GetBoolProperty("UseOffice2003Style", false)) { Manager.Style = eDotNetBarStyle.Office2003; toolbar.ThemeAware = false; toolbar.Style = eDotNetBarStyle.Office2003; toolbar.ItemsContainer.Style = eDotNetBarStyle.Office2003; toolbar.GrabHandleStyle = eGrabHandleStyle.Office2003; } else { toolbar.Style = eDotNetBarStyle.OfficeXP; toolbar.ItemsContainer.Style = eDotNetBarStyle.OfficeXP; toolbar.GrabHandleStyle = eGrabHandleStyle.StripeFlat; } toolbar.WrapItemsDock = true; toolbar.WrapItemsFloat = false; toolbar.Tag = group; toolbar.CanCustomize = false; toolbar.CanUndock = false; group.ReferenceWidget = toolbar; group.OnDisplay(null, null); // Ensure the toolbar has its items added. manager.Bars.Add(toolbar); toolbar.DockSide = eDockSide.Top; } // Re-add the menu bar if (menuBar != null) { manager.Bars.Add(menuBar);; menuBar.DockSide = eDockSide.Top; } DepersistLayout(); }
private void MakeTree(ChoiceGroupCollection groupCollection, string label, out OutlookBarBand band) { TreeView tree = new TreeView(); tree.Tag=groupCollection; tree.AfterSelect += new TreeViewEventHandler(OnTreeNodeSelected); band = new OutlookBarBand(label, tree); }
/// <summary> /// Overrides method to create the toolbars, but witout the items on them, /// which are handled elsewhere. /// </summary> /// <param name="groupCollection">Collection of toolbar definitions to create.</param> public override void CreateUIForChoiceGroupCollection(ChoiceGroupCollection groupCollection) { m_choiceGroupCollection = groupCollection; DotNetBarManager manager = (DotNetBarManager)m_mediator.PropertyTable.GetValue("DotNetBarManager"); // manager.SaveLayout("testLayout.xml"); // If the menubar has already been added, remove it, // and re-add it after adding the toolbars, or it won't be at the top. Bar menuBar = null; foreach (Bar bar in manager.Bars) { if (bar.MenuBar) { menuBar = bar; bar.Name = "menubar"; //there may be some better place to put this, but I couldn't quickly find where the menubar is created. manager.Bars.Remove(menuBar); break; } } // Create new Bars. foreach (ChoiceGroup group in groupCollection) { Bar toolbar = new Bar(group.Id); toolbar.Name = group.Id; toolbar.CanHide = true; if (m_mediator.PropertyTable.GetBoolProperty("UseOffice2003Style", false)) { Manager.Style = eDotNetBarStyle.Office2003; toolbar.ThemeAware = false; toolbar.Style = eDotNetBarStyle.Office2003; toolbar.ItemsContainer.Style = eDotNetBarStyle.Office2003; toolbar.GrabHandleStyle = eGrabHandleStyle.Office2003; } else { toolbar.Style = eDotNetBarStyle.OfficeXP; toolbar.ItemsContainer.Style = eDotNetBarStyle.OfficeXP; toolbar.GrabHandleStyle = eGrabHandleStyle.StripeFlat; } toolbar.WrapItemsDock = true; toolbar.WrapItemsFloat = false; toolbar.Tag = group; toolbar.CanCustomize = false; toolbar.CanUndock = false; group.ReferenceWidget = toolbar; group.OnDisplay(null, null); // Ensure the toolbar has its items added. manager.Bars.Add(toolbar); toolbar.DockSide = eDockSide.Top; } // Re-add the menu bar if (menuBar != null) { manager.Bars.Add(menuBar);; menuBar.DockSide = eDockSide.Top; } DepersistLayout(); }
/// <summary> /// Overrides method to create the toolbars, but witout the items on them, /// which are handled elsewhere. /// </summary> /// <param name="groupCollection">Collection of toolbar definitions to create.</param> public override void CreateUIForChoiceGroupCollection(ChoiceGroupCollection groupCollection) { m_choiceGroupCollection = groupCollection; InitializeToolStrips(); DepersistLayout(); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Load UI from an XML document /// </summary> /// <param name="configuration"></param> /// <param name="configurationPath"></param> /// ------------------------------------------------------------------------------------ protected virtual void LoadUIFromXmlDocument(XmlDocument configuration, string configurationPath) { SuspendLayoutAll(); bool wasCrashDuringPreviousStartup = File.Exists(CrashOnStartupDetectorPathName); if (!wasCrashDuringPreviousStartup) { // Create the crash detector file for next time. // Make sure the folder exists first. System.IO.Directory.CreateDirectory(CrashOnStartupDetectorPathName.Substring(0, CrashOnStartupDetectorPathName.LastIndexOf(Path.DirectorySeparatorChar))); using (System.IO.StreamWriter writer = System.IO.File.CreateText(CrashOnStartupDetectorPathName)) writer.Close(); } ErrorReporter.OkToInteractWithUser = !m_mediator.PropertyTable.GetBoolProperty("DoingAutomatedTest", false); m_windowConfigurationNode = configuration.SelectSingleNode("window"); PropertyTable.SetProperty("WindowConfiguration", m_windowConfigurationNode); PropertyTable.SetPropertyPersistence("WindowConfiguration", false); SetApplicationName(); //nb:some things might be sensitive to when this actually happens LoadDefaultProperties(m_windowConfigurationNode.SelectSingleNode("defaultProperties")); m_mediator.PropertyTable.SetProperty("window", this); m_mediator.PropertyTable.SetPropertyPersistence("window", false); LoadStringTableIfPresent(configurationPath); LoadResources(m_windowConfigurationNode.SelectSingleNode("resources")); //make the command set CommandSet commandset = new CommandSet(m_mediator); commandset.Init(m_windowConfigurationNode); m_mediator.Initialize(commandset); RestoreWindowSettings(wasCrashDuringPreviousStartup); Size restoreSize = Size; // Some of the listener initialization depends on PropertyTable initialization which // occurs in RestoreWindowSettings() above (e.g. LT-14150 re: 'sticky' spell checking). LoadListeners(m_windowConfigurationNode.SelectSingleNode("listeners")); // Note: This will throw an exception, if the Init method has already been called. // It is 'poor form' to try and add a colleague more than once, // even though we could cope with it. m_mediator.AddColleague(this); Assembly adaptorAssembly = GetAdapterAssembly(); m_mediator.PropertyTable.SetProperty("uiAdapter", adaptorAssembly); m_mediator.PropertyTable.SetPropertyPersistence("uiAdapter", false); //add the menubar Control menubar; m_menusChoiceGroupCollection = MakeMajorUIPortion( adaptorAssembly, m_windowConfigurationNode, "menubar", "XCore.MenuAdapter", out menubar, out m_menuBarAdapter); if (menubar != null && menubar.Parent != null) { System.Windows.Forms.Control parent = menubar.Parent; if (parent.AccessibleName == null) parent.AccessibleName = "ParentOf" + menubar.AccessibleName; } //add the toolbar System.Windows.Forms.Control rebar; m_toolbarsChoiceGroupCollection = MakeMajorUIPortion( adaptorAssembly, m_windowConfigurationNode, "toolbars", "XCore.ReBarAdapter", out rebar, out m_rebarAdapter); if (rebar != null && rebar.Parent != null) { if (rebar.Parent.AccessibleName == null) rebar.Parent.AccessibleName = "ParentOf" + rebar.AccessibleName; } // Start of main layout. // Add the sidebar. m_sidebarChoiceGroupCollection = MakeMajorUIPortion( adaptorAssembly, m_windowConfigurationNode, "sidebar", "XCore.SidebarAdapter", out m_sidebar, out m_sidebarAdapter); m_sidebar.AccessibleName = "SideBar"; // Remove m_sideBarPlaceholderPanel (a placeholder) and replace it with the real m_sidebar. m_sidebar.Dock = DockStyle.Fill; m_sidebar.TabStop = true; m_sidebar.TabIndex = 0; m_mainSplitContainer.FirstControl = m_sidebar; m_mainSplitContainer.Tag = "SidebarWidthGlobal"; m_mainSplitContainer.Panel1MinSize = CollapsingSplitContainer.kCollapsedSize; m_mainSplitContainer.Panel1Collapsed = !Mediator.PropertyTable.GetBoolProperty("ShowSidebar", false); // Andy Black wants to collapse it for one of his XCore apps. m_mainSplitContainer.Panel2Collapsed = false; // Never collapse the main content control, plus optional record list. int sd = Mediator.PropertyTable.GetIntProperty("SidebarWidthGlobal", 140); if (!m_mainSplitContainer.Panel1Collapsed) SetSplitContainerDistance(m_mainSplitContainer, sd); if (m_sideBarPlaceholderPanel != null) { m_sideBarPlaceholderPanel.Dispose(); m_sideBarPlaceholderPanel = null; } m_mainSplitContainer.FirstLabel = (string)Mediator.PropertyTable.GetValue("SidebarLabel"); m_mainSplitContainer.SecondLabel = (string)Mediator.PropertyTable.GetValue("AllButSidebarLabel"); // Maybe show the record list. m_recordBar.Dock = DockStyle.Fill; m_recordBar.TabStop = true; m_recordBar.TabIndex = 1; m_secondarySplitContainer.Panel1Collapsed = !Mediator.PropertyTable.GetBoolProperty("ShowRecordList", false); // Always show the main content control. m_secondarySplitContainer.Panel1MinSize = CollapsingSplitContainer.kCollapsedSize; m_secondarySplitContainer.Panel2Collapsed = false; m_secondarySplitContainer.Tag = "RecordListWidthGlobal"; sd = Mediator.PropertyTable.GetIntProperty("RecordListWidthGlobal", 200); SetSplitContainerDistance(m_secondarySplitContainer, sd); m_secondarySplitContainer.FirstLabel = (string)Mediator.PropertyTable.GetValue("RecordListLabel"); m_secondarySplitContainer.SecondLabel = (string)Mediator.PropertyTable.GetValue("MainContentLabel"); // End of main layout. CreateStatusBar(m_windowConfigurationNode); // Add the content control // Note: We should be able to do it directly, since everything needed is in the default properties. SetInitialContentObject(m_windowConfigurationNode); m_sidebarAdapter.FinishInit(); m_menuBarAdapter.FinishInit(); // Some adapters modify the window size, so reset it to what was in the XML file. // Technically, this should assert that they are the same, // as it should now never call this code. if (restoreSize != Size) { // It will be the same as what is now in the file and the prop table, // so skip updating the table. m_persistWindowSize = false; Size = restoreSize; m_persistWindowSize = true; } if (File.Exists(CrashOnStartupDetectorPathName)) // Have to check again, because unit test check deletes it in the RestoreWindowSettings method. File.Delete(CrashOnStartupDetectorPathName); // this.ResumeLayout(); // Don't resume until after the maio content control is added. ClearRecordBarList();//sets up event handling ResumeLayoutAll(); }
/// <summary> /// Do the bare minimum for use in tests /// </summary> /// <param name="configuration"></param> /// <param name="configurationPath"></param> protected override void LoadUIFromXmlDocument(XmlDocument configuration, string configurationPath) { m_windowConfigurationNode = configuration.SelectSingleNode("window"); ReplaceControlAssemblies(); PropertyTable.SetProperty("WindowConfiguration", m_windowConfigurationNode); PropertyTable.SetPropertyPersistence("WindowConfiguration", false); LoadDefaultProperties(m_windowConfigurationNode.SelectSingleNode("defaultProperties")); m_mediator.PropertyTable.SetProperty("window", this); m_mediator.PropertyTable.SetPropertyPersistence("window", false); CommandSet commandset = new CommandSet(m_mediator); commandset.Init(m_windowConfigurationNode); m_mediator.Initialize(commandset); LoadStringTableIfPresent(configurationPath); RestoreWindowSettings(false); m_mediator.AddColleague(this); m_menusChoiceGroupCollection = new ChoiceGroupCollection(m_mediator, null, m_windowConfigurationNode); m_sidebarChoiceGroupCollection = new ChoiceGroupCollection(m_mediator, null, m_windowConfigurationNode); m_toolbarsChoiceGroupCollection = new ChoiceGroupCollection(m_mediator, null, m_windowConfigurationNode); IntPtr handle = this.Handle; // create's a window handle for this form to allow processing broadcasted items. }
// Note: The Init method is handled by the superclass. /// <summary> /// Overrides method to create main elements of the sidebar. /// </summary> /// <param name="groupCollection">Collection of groups for this sidebar.</param> public override void CreateUIForChoiceGroupCollection(ChoiceGroupCollection groupCollection) { }
// Note: The Init method is handled by the superclass. /// <summary> /// Overrides method to create main elements of the sidebar. /// </summary> /// <param name="groupCollection">Collection of groups for this sidebar.</param> public override void CreateUIForChoiceGroupCollection(ChoiceGroupCollection groupCollection) { foreach(ChoiceGroup group in groupCollection) { string label = group.Label; label = label.Replace("_", ""); SideBarPanelItem panelItem = new SideBarPanelItem(group.Id, label); if (group.HasSubGroups()) MakeTree(group, label, ref panelItem); panelItem.Tag = group; group.ReferenceWidget = panelItem; SideBar sidebar = MySideBar; sidebar.Panels.Add(panelItem); sidebar.Images = m_smallImages.ImageList; panelItem.BackgroundStyle.BackColor1.Alpha = ((System.Byte)(255)); panelItem.BackgroundStyle.BackColor1.Color = System.Drawing.SystemColors.ControlLightLight; // // sideBarPanelItem1.BackgroundStyle.BackColor2 // panelItem.BackgroundStyle.BackColor2.Alpha = ((System.Byte)(255)); panelItem.BackgroundStyle.BackColor2.Color = System.Drawing.SystemColors.ControlDark; panelItem.BackgroundStyle.BackgroundImageAlpha = ((System.Byte)(255)); panelItem.BackgroundStyle.Border = DevComponents.DotNetBar.eBorderType.None; panelItem.BackgroundStyle.TextTrimming = System.Drawing.StringTrimming.EllipsisCharacter; panelItem.ItemImageSize = DevComponents.DotNetBar.eBarImageSize.Default; } MySideBar.ExpandedChange += new EventHandler(Sidebar_ExpandedChange); }
/// <summary> /// Overrides method to create the toolbars, but witout the items on them, /// which are handled elsewhere. /// </summary> /// <param name="groupCollection">Collection of toolbar definitions to create.</param> public override void CreateUIForChoiceGroupCollection(ChoiceGroupCollection groupCollection) { m_choiceGroupCollection= groupCollection; InitializeToolStrips(); DepersistLayout(); }
public void CreateUIForChoiceGroupCollection(ChoiceGroupCollection groupCollection) { foreach(ChoiceGroup group in groupCollection) { // make band string label = group.Label; label = label.Replace("_", ""); OutlookBarBand band; if (group.HasSubGroups()) { MakeTree(groupCollection, label, out band); } else { band = new OutlookBarBand(label); } band.Tag=group; group.ReferenceWidget = band; // band.GotFocus += new System.EventHandler(group.OnDisplay); m_bar.Bands.Add(band); band.SmallImageList = m_smallImages.ImageList; band.LargeImageList = m_largeImages.ImageList; object s = m_mediator.PropertyTable.GetValue("SidebarSize"); if (s ==null || (string)s=="small") band.IconView= SidebarLibrary.WinControls.IconView.Small; else band.IconView= SidebarLibrary.WinControls.IconView.Large; band.Background = SystemColors.AppWorkspace; band.TextColor = Color.White; //note that I had to fix the outlook bar code I downloaded to make this work. //so if we download a new one and it stops working, go fix it again. band.Font = new Font("Microsoft Sans Serif", 12); } }
protected ChoiceGroupCollection MakeGroupSet(XmlNode m_windowConfigurationNode, IUIAdapter adapter, string elementName) { XmlNode configurationNode = m_windowConfigurationNode.SelectSingleNode(elementName); if (configurationNode== null) return null; //the configuration did not specify anything for this user interface thatelement ChoiceGroupCollection groupset = new ChoiceGroupCollection (m_mediator, adapter,configurationNode); groupset.Init(); return groupset; }