private void LoadCommonProperties(System.Xml.XmlElement xmlBar) { m_BarState = eBarState.Docked; this.Name = xmlBar.GetAttribute("name"); if (xmlBar.HasAttribute("candockleft")) m_CanDockLeft = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("candockleft")); if (xmlBar.HasAttribute("candockright")) m_CanDockRight = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("candockright")); if (xmlBar.HasAttribute("candocktop")) m_CanDockTop = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("candocktop")); if (xmlBar.HasAttribute("candockbottom")) m_CanDockBottom = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("candockbottom")); if (xmlBar.HasAttribute("candockdoc")) m_CanDockDocument = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("candockdoc")); if (xmlBar.HasAttribute("candocktab")) m_CanDockTab = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("candocktab")); if (xmlBar.HasAttribute("text")) this.Text = xmlBar.GetAttribute("text"); if (xmlBar.HasAttribute("dockline")) m_DockLine = System.Xml.XmlConvert.ToInt32(xmlBar.GetAttribute("dockline")); if (xmlBar.HasAttribute("dockoffset")) m_DockOffset = System.Xml.XmlConvert.ToInt32(xmlBar.GetAttribute("dockoffset")); if (xmlBar.HasAttribute("grabhandle")) m_GrabHandleStyle = (eGrabHandleStyle)System.Xml.XmlConvert.ToInt32(xmlBar.GetAttribute("grabhandle")); if (xmlBar.HasAttribute("menubar")) m_MenuBar = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("menubar")); if (xmlBar.HasAttribute("stretch")) m_DockStretch = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("stretch")); if (xmlBar.HasAttribute("wrapdock")) m_WrapItemsDock = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("wrapdock")); if (xmlBar.HasAttribute("wrapfloat")) m_WrapItemsFloat = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("wrapfloat")); if (xmlBar.HasAttribute("custom")) m_CustomBar = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("custom")); if (xmlBar.HasAttribute("canhide")) m_CanHide = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("canhide")); if (xmlBar.HasAttribute("imagesize")) m_ImageSize = (eBarImageSize)System.Xml.XmlConvert.ToInt32(xmlBar.GetAttribute("imagesize")); if (xmlBar.HasAttribute("itemsp")) m_ItemContainer.ItemSpacing = System.Xml.XmlConvert.ToInt32(xmlBar.GetAttribute("itemsp")); // else // m_ItemContainer.ItemSpacing=0; if (xmlBar.HasAttribute("backcolor")) m_ItemContainer.BackColor = BarFunctions.ColorFromString(xmlBar.GetAttribute("backcolor")); if (xmlBar.HasAttribute("layout")) m_ItemContainer.LayoutType = (eLayoutType)System.Xml.XmlConvert.ToInt32(xmlBar.GetAttribute("layout")); if (xmlBar.HasAttribute("eqbutton")) m_ItemContainer.EqualButtonSize = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("eqbutton")); if (xmlBar.HasAttribute("dborder")) m_DockedBorder = (eBorderType)System.Xml.XmlConvert.ToInt32(xmlBar.GetAttribute("dborder")); //else // m_DockedBorder=eBorderType.None; if (xmlBar.HasAttribute("acceptdrop")) m_AcceptDropItems = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("acceptdrop")); if (xmlBar.HasAttribute("slcolor")) m_SingleLineColor = BarFunctions.ColorFromString(xmlBar.GetAttribute("slcolor")); if (xmlBar.HasAttribute("captionbc")) m_CaptionBackColor = BarFunctions.ColorFromString(xmlBar.GetAttribute("captionbc")); if (xmlBar.HasAttribute("captionfc")) m_CaptionForeColor = BarFunctions.ColorFromString(xmlBar.GetAttribute("captionfc")); if (xmlBar.HasAttribute("dockwidth")) m_ItemContainer.MinWidth = System.Xml.XmlConvert.ToInt32(xmlBar.GetAttribute("dockwidth")); if (xmlBar.HasAttribute("dockheight")) m_ItemContainer.MinHeight = System.Xml.XmlConvert.ToInt32(xmlBar.GetAttribute("dockheight")); if (xmlBar.HasAttribute("splitwidthpercent")) m_SplitDockWidthPercent = System.Xml.XmlConvert.ToInt32(xmlBar.GetAttribute("splitwidthpercent")); else m_SplitDockWidthPercent = 0; if (xmlBar.HasAttribute("splitheightpercent")) m_SplitDockHeightPercent = System.Xml.XmlConvert.ToInt32(xmlBar.GetAttribute("splitheightpercent")); // else // m_SplitDockHeightPercent=0; if (xmlBar.HasAttribute("padbottom")) m_ItemContainer.PaddingBottom = System.Xml.XmlConvert.ToInt32(xmlBar.GetAttribute("padbottom")); if (xmlBar.HasAttribute("padleft")) m_ItemContainer.PaddingLeft = System.Xml.XmlConvert.ToInt32(xmlBar.GetAttribute("padleft")); if (xmlBar.HasAttribute("padright")) m_ItemContainer.PaddingRight = System.Xml.XmlConvert.ToInt32(xmlBar.GetAttribute("padright")); if (xmlBar.HasAttribute("padtop")) m_ItemContainer.PaddingTop = System.Xml.XmlConvert.ToInt32(xmlBar.GetAttribute("padtop")); if (xmlBar.HasAttribute("lockdockpos")) m_LockDockPosition = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("lockdockpos")); if (xmlBar.HasAttribute("canundock")) m_CanUndock = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("canundock")); if (xmlBar.HasAttribute("canreordertabs")) m_CanReorderTabs = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("canreordertabs")); if (xmlBar.HasAttribute("cantearoff")) m_CanTearOffTabs = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("cantearoff")); if (xmlBar.HasAttribute("canautohide")) m_CanAutoHide = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("canautohide")); if (xmlBar.HasAttribute("cancust")) m_ItemContainer.CanCustomize = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("cancust")); if (xmlBar.HasAttribute("tabalign")) m_DockTabAlignment = (eTabStripAlignment)System.Xml.XmlConvert.ToInt32(xmlBar.GetAttribute("tabalign")); if (xmlBar.HasAttribute("showtab")) m_AlwaysDisplayDockTab = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("showtab")); // TODO: Menu Merge Implementation //if(xmlBar.HasAttribute("merge")) // m_MergeEnabled=System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("merge")); if (xmlBar.HasAttribute("hidein")) m_HideFloatingInactive = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("hidein")); if (xmlBar.HasAttribute("themes")) { m_ThemeAware = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("themes")); m_ItemContainer.ThemeAware = m_ThemeAware; } if (xmlBar.HasAttribute("tabnav")) m_TabNavigation = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("tabnav")); if (xmlBar.HasAttribute("tooltips")) m_ShowToolTips = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("tooltips")); // else // m_ShowToolTips=true; if (xmlBar.HasAttribute("overflowmenu")) m_ItemContainer.MoreItemsOnMenu = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("overflowmenu")); // else // m_ItemContainer.MoreItemsOnMenu=false; if (xmlBar.HasAttribute("autocaptionmenu")) m_AutoCreateCaptionMenu = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("autocaptionmenu")); // else // m_AutoCreateCaptionMenu=true; if (xmlBar.HasAttribute("autocaptionsync")) this.AutoSyncBarCaption = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("autocaptionsync")); // else // this.AutoSyncBarCaption=false; if (xmlBar.HasAttribute("style")) { string sty = xmlBar.GetAttribute("style"); //if (sty == "5") // this.Style = eDotNetBarStyle.Office2007; //else this.Style = (eDotNetBarStyle)System.Xml.XmlConvert.ToInt32(sty); } // Load font information if it exists if (xmlBar.HasAttribute("fontname")) { string FontName = xmlBar.GetAttribute("fontname"); float FontSize = System.Xml.XmlConvert.ToSingle(xmlBar.GetAttribute("fontemsize")); System.Drawing.FontStyle FontStyle = (System.Drawing.FontStyle)System.Xml.XmlConvert.ToInt32(xmlBar.GetAttribute("fontstyle")); try { this.Font = new Font(FontName, FontSize, FontStyle); } catch (Exception) { this.Font = SystemFonts.MenuFont; // System.Windows.Forms.SystemInformation.MenuFont.Clone() as Font; } m_CustomFont = true; } if (xmlBar.HasAttribute("ahanim")) m_AutoHideAnimationTime = System.Xml.XmlConvert.ToInt32(xmlBar.GetAttribute("ahanim")); // else // m_AutoHideAnimationTime=100; if (xmlBar.HasAttribute("savelayout")) m_SaveLayoutChanges = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("savelayout")); // else // m_SaveLayoutChanges=true; }
/// <summary> /// Initializes a new instance of the Bar class. /// </summary> public Bar() { if (!ColorFunctions.ColorsLoaded) { NativeFunctions.RefreshSettings(); NativeFunctions.OnDisplayChange(); ColorFunctions.LoadColors(); } m_ColorScheme = new ColorScheme(); m_ParentItem = null; m_OldContainer = null; m_ClientRect = Rectangle.Empty; m_SideBarRect = Rectangle.Empty; m_SideBarImage = new SideBarImage(); m_ItemContainer = new GenericItemContainer(); m_ItemContainer.GlobalItem = false; m_ItemContainer.ContainerControl = this; m_ItemContainer.WrapItems = true; m_ItemContainer.Stretch = false; m_ItemContainer.Displayed = true; m_ItemContainer.SystemContainer = true; //m_ItemContainer.SetSystemItem(true); //m_OldParent=null; m_InitialContainerWidth = 164; //m_BarState=eBarState.Popup; m_BarState = eBarState.Docked; m_DockOffset = 0; m_DockLine = 0; m_GrabHandleStyle = eGrabHandleStyle.None; m_GrabHandleRect = Rectangle.Empty; m_Owner = null; m_MouseDownPt = Point.Empty; m_MouseDownSize = new Size(0, 0); m_MoveWindow = false; m_FloatingRect = Rectangle.Empty; m_SizeWindow = 0; m_LastDragRect = Rectangle.Empty; m_WrapItemsDock = false; m_WrapItemsFloat = true; m_DockStretch = false; m_MenuBar = false; this.Text = ""; m_Float = null; m_DockingInProgress = false; this.SetStyle(ControlStyles.Selectable, false); this.SetStyle(ControlStyles.UserPaint, true); this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); this.SetStyle(ControlStyles.Opaque, true); this.SetStyle(ControlStyles.ResizeRedraw, true); this.SetStyle(DisplayHelp.DoubleBufferFlag, true); this.SetStyle(ControlStyles.SupportsTransparentBackColor, true); this.TabStop = false; base.Font = SystemFonts.MenuFont; // System.Windows.Forms.SystemInformation.MenuFont.Clone() as Font; m_CanDockLeft = true; m_CanDockRight = true; m_CanDockTop = true; m_CanDockBottom = true; m_CanUndock = true; Microsoft.Win32.SystemEvents.UserPreferenceChanged += new Microsoft.Win32.UserPreferenceChangedEventHandler(PreferenceChanged); this.IsAccessible = true; m_SystemButtons.MouseDownAutoHideChanged += new EventHandler(this.SysButtonHideTooltip); m_SystemButtons.MouseDownCloseChanged += new EventHandler(this.SysButtonHideTooltip); m_SystemButtons.MouseDownCustomizeChanged += new EventHandler(this.SysButtonHideTooltip); m_SystemButtons.MouseOverAutoHideChanged += new EventHandler(this.SysButtonMouseOverAutoHide); m_SystemButtons.MouseOverCustomizeChanged += new EventHandler(this.SysButtonMouseOverCustomize); m_SystemButtons.MouseOverCloseChanged += new EventHandler(this.SysButtonMouseOverClose); }