mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-01 17:47:24 +02:00
64 lines
1.7 KiB
C#
64 lines
1.7 KiB
C#
using System;
|
|
using Robust.Client.Interfaces.Graphics;
|
|
|
|
namespace Robust.Client.UserInterface
|
|
{
|
|
public partial class Control
|
|
{
|
|
private CursorShape _cursorShape;
|
|
private ICursor? _customCursor;
|
|
|
|
/// <summary>
|
|
/// Default common cursor shapes available in the UI.
|
|
/// </summary>
|
|
public enum CursorShape
|
|
{
|
|
Arrow,
|
|
IBeam,
|
|
Crosshair,
|
|
Hand,
|
|
HResize,
|
|
VResize,
|
|
/// <summary>
|
|
/// Special cursor shape indicating that <see cref="CustomCursorShape"/> is set and being used.
|
|
/// </summary>
|
|
Custom,
|
|
}
|
|
|
|
/// <summary>
|
|
/// The shape the cursor will get when being over this control.
|
|
/// </summary>
|
|
public CursorShape DefaultCursorShape
|
|
{
|
|
get => _cursorShape;
|
|
set
|
|
{
|
|
if (value == CursorShape.Custom)
|
|
{
|
|
throw new ArgumentException(
|
|
"Cannot set to CursorShape.Custom directly. Set CustomCursorShape instead.");
|
|
}
|
|
|
|
_cursorShape = value;
|
|
_customCursor = null;
|
|
UserInterfaceManagerInternal.CursorChanged(this);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Custom cursor shape to use.
|
|
/// </summary>
|
|
public ICursor? CustomCursorShape
|
|
{
|
|
get => _customCursor;
|
|
set
|
|
{
|
|
_customCursor = value;
|
|
_cursorShape = value == null ? CursorShape.Arrow : CursorShape.Custom;
|
|
|
|
UserInterfaceManagerInternal.CursorChanged(this);
|
|
}
|
|
}
|
|
}
|
|
}
|