-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGlassButtonSection.cs
48 lines (39 loc) · 1.73 KB
/
GlassButtonSection.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using System;
using System.Drawing;
using MonoTouch.UIKit;
namespace MonoTouch.Dialog.AddOn
{
public static class GlassButtonExtension
{
public static Element CreateGlassButtonElement(GlassButton button)
{
UIViewElement imageElement = new UIViewElement(null, button, true);
imageElement.Flags = UIViewElement.CellFlags.DisableSelection | UIViewElement.CellFlags.Transparent;
return imageElement;
}
public static GlassButton CreateGlassButton(string buttonLabelText)
{
return CreateGlassButton(buttonLabelText, DefaultColor, DefaultButtonWidth, DefaultButtonHeight, null);
}
public static GlassButton CreateGlassButton(string buttonLabelText, UIColor color)
{
return CreateGlassButton(buttonLabelText, color, DefaultButtonWidth, DefaultButtonHeight, null);
}
public static GlassButton CreateGlassButton(string buttonTitle, UIColor color, float width, float height, ButtonClickDelegate touchUpInside)
{
GlassButton button = new GlassButton(new RectangleF(0, 0, width, height));
button.NormalColor = color;
button.HighlightedColor = UIColor.LightGray;
button.SetTitleColor(UIColor.FromRGBA(255, 255, 255, 255), UIControlState.Normal);
button.SetTitleColor(UIColor.FromRGBA(0, 0, 0, 255), UIControlState.Highlighted);
button.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;
button.SetTitle(buttonTitle, UIControlState.Normal);
button.TouchUpInside += (s, e) => { if (touchUpInside != null) touchUpInside(s, e); };
return button;
}
public delegate void ButtonClickDelegate(object sender, EventArgs e);
public const float DefaultButtonHeight = 44;
public const float DefaultButtonWidth = 300;
public static UIColor DefaultColor = UIColor.FromRGB(0, 63, 107);
}
}