Ooui-tws-port/Ooui/Button.cs

44 lines
954 B
C#
Raw Normal View History

2017-06-12 19:09:09 +00:00
using System;
2017-06-19 01:38:00 +00:00
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
2017-06-12 19:09:09 +00:00
namespace Ooui
{
2017-06-13 07:03:01 +00:00
public class Button : FormControl
2017-06-12 19:09:09 +00:00
{
2017-06-19 01:38:00 +00:00
ButtonType typ = ButtonType.Submit;
public ButtonType Type {
get => typ;
set => SetProperty (ref typ, value, "type");
}
2017-06-15 06:10:58 +00:00
public event EventHandler Clicked {
2017-06-15 07:58:55 +00:00
add => AddEventListener ("click", value);
remove => RemoveEventListener ("click", value);
2017-06-15 06:10:58 +00:00
}
2017-06-14 23:48:42 +00:00
public Button ()
2017-06-15 06:20:51 +00:00
: base ("button")
2017-06-14 23:48:42 +00:00
{
}
public Button (string text)
2017-06-15 06:20:51 +00:00
: this ()
2017-06-14 23:48:42 +00:00
{
Text = text;
}
2017-06-12 19:09:09 +00:00
}
2017-06-19 01:38:00 +00:00
[JsonConverter (typeof (StringEnumConverter))]
public enum ButtonType
{
[EnumMember (Value = "submit")]
Submit,
[EnumMember (Value = "reset")]
Reset,
[EnumMember (Value = "button")]
Button,
}
2017-06-12 19:09:09 +00:00
}