//********************************** 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
* @{
*/
///
/// GUI element that displays text.
///
public sealed class GUILabel : GUIElement
{
///
/// Creates a new label element.
///
/// Content to display on the label.
/// Optional style to use for the element. Style controls the look of the element, as well as
/// default layout options. Style will be retrieved from the active GUISkin. If not specified
/// default element style is used.
/// Options that allow you to control how is the element positioned and sized. This will
/// override any similar options set by style.
public GUILabel(GUIContent content, string style, params GUIOption[] options)
{
Internal_CreateInstance(this, ref content, style, options);
}
///
/// Creates a new label element.
///
/// Content to display on the label.
/// Optional style to use for the element. Style controls the look of the element, as well as
/// default layout options. Style will be retrieved from the active GUISkin. If not specified
/// default element style is used.
public GUILabel(GUIContent content, string style = "")
{
Internal_CreateInstance(this, ref content, style, new GUIOption[0]);
}
///
/// Creates a new label element.
///
/// Content to display on the label.
/// Options that allow you to control how is the element positioned and sized. This will
/// override any similar options set by style.
public GUILabel(GUIContent content, params GUIOption[] options)
{
Internal_CreateInstance(this, ref content, "", options);
}
///
/// Updates the contents display on the label.
///
/// Content to display on the label.
public void SetContent(GUIContent content)
{
Internal_SetContent(mCachedPtr, ref content);
}
///
/// Colors the element with a specific tint.
///
/// Tint to apply to the element.
public void SetTint(Color color)
{
Internal_SetTint(mCachedPtr, ref color);
}
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Internal_CreateInstance(GUILabel instance, ref GUIContent content, string style,
GUIOption[] options);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Internal_SetContent(IntPtr nativeInstance, ref GUIContent content);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Internal_SetTint(IntPtr nativeInstance, ref Color color);
}
/** @} */
}