| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- using System;
- using System.Runtime.CompilerServices;
- namespace BansheeEngine
- {
- /// <summary>
- /// GUI element that displays text.
- /// </summary>
- public sealed class GUILabel : GUIElement
- {
- /// <summary>
- /// Creates a new label element.
- /// </summary>
- /// <param name="content">Content to display on the label.</param>
- /// <param name="style">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.</param>
- /// <param name="options">Options that allow you to control how is the element positioned and sized. This will
- /// override any similar options set by style.</param>
- public GUILabel(GUIContent content, string style, params GUIOption[] options)
- {
- Internal_CreateInstance(this, content, style, options);
- }
- /// <summary>
- /// Creates a new label element.
- /// </summary>
- /// <param name="content">Content to display on the label.</param>
- /// <param name="style">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.</param>
- public GUILabel(GUIContent content, string style = "")
- {
- Internal_CreateInstance(this, content, style, new GUIOption[0]);
- }
- /// <summary>
- /// Creates a new label element.
- /// </summary>
- /// <param name="content">Content to display on the label.</param>
- /// <param name="options">Options that allow you to control how is the element positioned and sized. This will
- /// override any similar options set by style.</param>
- public GUILabel(GUIContent content, params GUIOption[] options)
- {
- Internal_CreateInstance(this, content, "", options);
- }
- /// <summary>
- /// Updates the contents display on the label.
- /// </summary>
- /// <param name="content">Content to display on the label.</param>
- public void SetContent(GUIContent content)
- {
- Internal_SetContent(mCachedPtr, content);
- }
- /// <summary>
- /// Colors the element with a specific tint.
- /// </summary>
- /// <param name="color">Tint to apply to the element.</param>
- public void SetTint(Color color)
- {
- Internal_SetTint(mCachedPtr, color);
- }
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern void Internal_CreateInstance(GUILabel instance, GUIContent content, string style,
- GUIOption[] options);
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern void Internal_SetContent(IntPtr nativeInstance, GUIContent content);
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern void Internal_SetTint(IntPtr nativeInstance, Color color);
- }
- }
|