public override void RecordSetting(BaseItem item) { if (this.SettingsRecorded) return; ButtonItem button = item as ButtonItem; m_ButtonStyle = button.ButtonStyle; m_ImagePosition = button.ImagePosition; m_ImageFixedSize = button.ImageFixedSize; if (button.TextMarkupBody != null && button.TextMarkupBody.HasExpandElement) m_Text = button.Text; base.RecordSetting(item); }
public static KGFDialogWindow Create(EventHandler theCloseEvent, string theInfo, string theTitle, eIconStyle theIconStyle, eButtonStyle theButtonStyle) { LoadTextures(); KGFDialogWindow aWindow = ScriptableObject.CreateInstance <KGFDialogWindow>(); aWindow.itsInfo = theInfo; aWindow.itsTitle = theTitle; aWindow.itsButtonStyle = theButtonStyle; aWindow.itsIconStyle = theIconStyle; aWindow.itsEventClosed = theCloseEvent; aWindow.InitButtons(); aWindow.ShowUtility(); return(aWindow); }
public static KGFDialogWindow Create(EventHandler theCloseEvent, string theInfo, string theTitle, eIconStyle theIconStyle,eButtonStyle theButtonStyle) { LoadTextures(); KGFDialogWindow aWindow = ScriptableObject.CreateInstance<KGFDialogWindow>(); aWindow.itsInfo = theInfo; aWindow.itsTitle = theTitle; aWindow.itsButtonStyle = theButtonStyle; aWindow.itsIconStyle = theIconStyle; aWindow.itsEventClosed = theCloseEvent; aWindow.InitButtons(); aWindow.ShowUtility(); return aWindow; }
/// <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; m_ImagePosition = (eImagePosition)System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("ImagePosition")); m_ButtonStyle = (eButtonStyle)System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("ButtonStyle")); m_Checked = System.Xml.XmlConvert.ToBoolean(ItemXmlSource.GetAttribute("Checked")); m_VerticalPadding = System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("VerticalPadding")); m_HorizontalPadding = System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("HorizontalPadding")); m_MenuVisibility = (eMenuVisibility)System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("MenuVisibility")); m_RecentlyUsed = System.Xml.XmlConvert.ToBoolean(ItemXmlSource.GetAttribute("RecentlyUsed")); if (ItemXmlSource.HasAttribute("forecolor")) m_ForeColor = BarFunctions.ColorFromString(ItemXmlSource.GetAttribute("forecolor")); else m_ForeColor = System.Drawing.Color.Empty; if (ItemXmlSource.HasAttribute("hottrack")) m_HotTrackingStyle = (eHotTrackingStyle)System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("hottrack")); else m_HotTrackingStyle = eHotTrackingStyle.Default; if (ItemXmlSource.HasAttribute("hotclr")) m_HotForeColor = BarFunctions.ColorFromString(ItemXmlSource.GetAttribute("hotclr")); else m_HotForeColor = System.Drawing.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("optiongroup")) m_OptionGroup = ItemXmlSource.GetAttribute("optiongroup"); else m_OptionGroup = ""; if (ItemXmlSource.HasAttribute("fontbold")) m_FontBold = System.Xml.XmlConvert.ToBoolean(ItemXmlSource.GetAttribute("fontbold")); else m_FontBold = false; if (ItemXmlSource.HasAttribute("fontitalic")) m_FontItalic = System.Xml.XmlConvert.ToBoolean(ItemXmlSource.GetAttribute("fontitalic")); else m_FontItalic = false; if (ItemXmlSource.HasAttribute("fontunderline")) m_FontUnderline = System.Xml.XmlConvert.ToBoolean(ItemXmlSource.GetAttribute("fontunderline")); else m_FontUnderline = false; if (ItemXmlSource.HasAttribute("AlternateShortcutText")) m_AlternateShortcutText = ItemXmlSource.GetAttribute("AlternateShortcutText"); else m_AlternateShortcutText = ""; if (ItemXmlSource.HasAttribute("autoexpandclick")) m_AutoExpandOnClick = System.Xml.XmlConvert.ToBoolean(ItemXmlSource.GetAttribute("autoexpandclick")); else m_AutoExpandOnClick = false; if (ItemXmlSource.HasAttribute("CustomColorName")) m_CustomColorName = ItemXmlSource.GetAttribute("CustomColorName"); else m_CustomColorName = ""; if (ItemXmlSource.HasAttribute("ColorTable")) m_ColorTable = (eButtonColor)Enum.Parse(m_ColorTable.GetType(), ItemXmlSource.GetAttribute("ColorTable")); else m_ColorTable = eButtonColor.Orange; m_ImageIndex = -1; m_HoverImageIndex = -1; m_DisabledImageIndex = -1; m_PressedImageIndex = -1; m_Icon = null; m_Image = null; m_ImageSmall = null; m_HoverImage = null; m_DisabledImage = null; m_DisabledImageCustom = false; m_PressedImage = null; // 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("disabledimageindex")) m_DisabledImageIndex = System.Xml.XmlConvert.ToInt32(xmlElem.GetAttribute("disabledimageindex")); 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 "disabled": { m_DisabledImage = BarFunctions.DeserializeImage(xmlElem2); m_DisabledImageIndex = -1; m_DisabledImageCustom = true; break; } case "pressed": { m_PressedImage = BarFunctions.DeserializeImage(xmlElem2); m_PressedImageIndex = -1; break; } case "small": { m_ImageSmall = BarFunctions.DeserializeImage(xmlElem2); break; } } } break; } } this.OnImageChanged(); }
/// <summary> /// Creates new instance of ButtonItem and assigns the name and text to it. /// </summary> /// <param name="sItemName">Item name.</param> /// <param name="ItemText">item text.</param> public ButtonItem(string sItemName, string ItemText) : base(sItemName, ItemText) { m_IsContainer = false; m_Image = null; m_ImageIndex = -1; m_HoverImage = null; m_HoverImageIndex = -1; m_DisabledImage = null; m_DisabledImageIndex = -1; m_PressedImage = null; m_PressedImageIndex = -1; m_MouseOver = false; m_MouseDown = false; m_ButtonStyle = eButtonStyle.Default; m_ImagePosition = eImagePosition.Left; m_Font = null; m_ImageDrawRect = Rectangle.Empty; m_TextDrawRect = Rectangle.Empty; m_SubItemsRect = Rectangle.Empty; m_VerticalPadding = 0; m_HorizontalPadding = 0; m_AlternateShortcutText = ""; }