| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- 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);
- }
- }
|