1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-11-08 11:17:19 -05:00
OpenDiablo2/OpenDiablo2.Common/Interfaces/IButton.cs

59 lines
1.7 KiB
C#
Raw Normal View History

2018-11-26 18:18:23 -05:00
using System;
using System.Drawing;
namespace OpenDiablo2.Common.Interfaces
{
2018-11-26 19:07:46 -05:00
/// <summary>
/// A callback that is executed the button is activated (clicked).
/// </summary>
2018-11-26 18:18:23 -05:00
public delegate void OnActivateDelegate();
2018-11-26 19:07:46 -05:00
/// <summary>
/// A callback that is executed if the button is toggled.
/// </summary>
/// <param name="isToggled">When enabled, this is true, otherwise false</param>
2018-11-26 18:18:23 -05:00
public delegate void OnToggleDelegate(bool isToggled);
2018-11-26 19:07:46 -05:00
/// <summary>
/// Represents a visual button on the screen.
/// </summary>
2018-11-26 18:18:23 -05:00
public interface IButton : IDisposable
{
2018-11-26 19:07:46 -05:00
/// <summary>
/// Assigning a function to this property will cause that function to be called
/// when a button is pressed.
/// </summary>
2018-11-26 18:18:23 -05:00
OnActivateDelegate OnActivate { get; set; }
2018-11-26 19:07:46 -05:00
/// <summary>
/// If false, the button is visually darkened, and will ignore all user input.
/// </summary>
2018-11-26 18:18:23 -05:00
bool Enabled { get; set; }
2018-11-26 19:07:46 -05:00
/// <summary>
/// The position of the button on the screen.
/// </summary>
2018-11-26 18:18:23 -05:00
Point Location { get; set; }
2018-11-26 19:07:46 -05:00
/// <summary>
/// Assigning a function to this property will cause that function to be called
/// when the button is toggled on or off.
/// </summary>
2018-11-26 18:18:23 -05:00
OnToggleDelegate OnToggle { get; set; }
2018-11-26 19:07:46 -05:00
2018-11-26 18:18:23 -05:00
string Text { get; set; }
2018-11-26 19:07:46 -05:00
/// <summary>
/// Allows the button to update its internal state.
/// Call this in the Update method of your scene.
/// </summary>
2018-11-26 18:18:23 -05:00
void Update();
2018-11-26 19:07:46 -05:00
/// <summary>
/// Renders the button to the screen.
/// Call this in the render method of your scene.
/// </summary>
2018-11-26 18:18:23 -05:00
void Render();
}
}