//********************************** Banshee Engine (www.banshee3d.com) **************************************************// //**************** Copyright (c) 2016 Marko Pintera (marko.pintera@gmail.com). All rights reserved. **********************// using System; using System.Runtime.CompilerServices; namespace BansheeEngine { /** @addtogroup GUI_Engine * @{ */ /// /// Holds a set of styles that control how are GUI element types positioned and displayed in the GUI. Each element type /// can be assigned a specific style. /// public sealed class GUISkin : Resource { // Constructor for runtime use only (dummy parameter to differentiate from the normal constructor) private GUISkin(bool dummy) { } /// /// Creates a new empty GUI skin. /// public GUISkin() { Internal_CreateInstance(this); } /// /// Returns names of all GUI element styles registered on this skin. /// public string[] StyleNames { get { return Internal_GetStyleNames(mCachedPtr); } } /// /// Checks if the style with the specified name exists. /// /// Name of the style to look for. /// True if the style exists in this skin, false otherwise. public bool HasStyle(string name) { return Internal_HasStyle(mCachedPtr, name); } /// /// Returns a style for the specified GUI element type. /// /// Name of the style to look for. /// Found element style, or null if a style with the specified name was not found. public GUIElementStyle GetStyle(string name) { return Internal_GetStyle(mCachedPtr, name); } /// /// Sets a style for the specified GUI element type. /// /// Name of the style to add/modify. /// Style object containing style options. public void SetStyle(string name, GUIElementStyle style) { IntPtr stylePtr = IntPtr.Zero; if (style != null) stylePtr = style.GetCachedPtr(); Internal_SetStyle(mCachedPtr, name, stylePtr); } /// /// Removes a style from the skin. /// /// Name of the style to remove. public void RemoveStyle(string name) { Internal_RemoveStyle(mCachedPtr, name); } [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_CreateInstance(GUISkin instance); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool Internal_HasStyle(IntPtr thisPtr, string name); [MethodImpl(MethodImplOptions.InternalCall)] private static extern GUIElementStyle Internal_GetStyle(IntPtr thisPtr, string name); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_SetStyle(IntPtr thisPtr, string name, IntPtr style); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_RemoveStyle(IntPtr thisPtr, string name); [MethodImpl(MethodImplOptions.InternalCall)] private static extern string[] Internal_GetStyleNames(IntPtr thisPtr); } /** @} */ }