/// <summary> /// Overloaded. Deserializes the Item from the XmlElement. /// </summary> /// <param name="ItemXmlSource">Source XmlElement.</param> public override void Deserialize(ItemSerializationContext context) { base.Deserialize(context); System.Xml.XmlElement ItemXmlSource = context.ItemXmlElement; if(ItemXmlSource.HasAttribute("forecolor")) m_ForeColor=BarFunctions.ColorFromString(ItemXmlSource.GetAttribute("forecolor")); else m_ForeColor=Color.Empty; // if(ItemXmlSource.HasAttribute("backcolor")) // m_BackColor=BarFunctions.ColorFromString(ItemXmlSource.GetAttribute("backcolor")); // else // m_BackColor=SystemColors.Control; if(ItemXmlSource.HasAttribute("hotclr")) m_HotForeColor=BarFunctions.ColorFromString(ItemXmlSource.GetAttribute("hotclr")); else m_HotForeColor=Color.Empty; if(ItemXmlSource.HasAttribute("hotfb")) m_HotFontBold=System.Xml.XmlConvert.ToBoolean(ItemXmlSource.GetAttribute("hotfb")); else m_HotFontBold=false; if(ItemXmlSource.HasAttribute("hotfu")) m_HotFontUnderline=System.Xml.XmlConvert.ToBoolean(ItemXmlSource.GetAttribute("hotfu")); else m_HotFontUnderline=false; if(ItemXmlSource.HasAttribute("itemimagesize")) m_ItemImageSize=(eBarImageSize)System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("itemimagesize")); else m_ItemImageSize=eBarImageSize.Default; if(ItemXmlSource.HasAttribute("enablescrollbuttons")) m_EnableScrollButtons=System.Xml.XmlConvert.ToBoolean(ItemXmlSource.GetAttribute("enablescrollbuttons")); else m_EnableScrollButtons=true; // Load Images foreach(System.Xml.XmlElement xmlElem in ItemXmlSource.ChildNodes) { if(xmlElem.Name=="images") { if(xmlElem.HasAttribute("imageindex")) m_ImageIndex=System.Xml.XmlConvert.ToInt32(xmlElem.GetAttribute("imageindex")); if(xmlElem.HasAttribute("hoverimageindex")) m_HoverImageIndex=System.Xml.XmlConvert.ToInt32(xmlElem.GetAttribute("hoverimageindex")); if(xmlElem.HasAttribute("pressedimageindex")) m_PressedImageIndex=System.Xml.XmlConvert.ToInt32(xmlElem.GetAttribute("pressedimageindex")); foreach(System.Xml.XmlElement xmlElem2 in xmlElem.ChildNodes) { switch(xmlElem2.GetAttribute("type")) { case "default": { m_Image=BarFunctions.DeserializeImage(xmlElem2); m_ImageIndex=-1; break; } case "icon": { m_Icon=BarFunctions.DeserializeIcon(xmlElem2); m_ImageIndex=-1; break; } case "hover": { m_HoverImage=BarFunctions.DeserializeImage(xmlElem2); m_HoverImageIndex=-1; break; } case "pressed": { m_PressedImage=BarFunctions.DeserializeImage(xmlElem2); m_PressedImageIndex=-1; break; } } } break; } } this.RefreshImageSize(); NeedRecalcSize=true; }
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; }