blob: 8548985e9ba1ed1cbe6acedda86d08f5ad27d110 (
plain)
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
|
using System;
using AppKit;
namespace Xamarin.PropertyEditing.Mac
{
internal class FocusableBooleanButton : ProxyResponderButton
{
public override bool CanBecomeKeyView { get { return Enabled; } }
public FocusableBooleanButton ()
{
AllowsExpansionToolTips = true;
AllowsMixedState = true;
Cell.LineBreakMode = NSLineBreakMode.TruncatingTail;
Cell.UsesSingleLineMode = true;
ControlSize = NSControlSize.Small;
Font = NSFont.SystemFontOfSize (NSFont.SystemFontSizeForControlSize (NSControlSize.Small));
Title = string.Empty;
TranslatesAutoresizingMaskIntoConstraints = false;
SetButtonType (NSButtonType.Switch);
}
public override bool BecomeFirstResponder ()
{
var willBecomeFirstResponder = base.BecomeFirstResponder ();
if (willBecomeFirstResponder) {
ScrollRectToVisible (Bounds);
}
return willBecomeFirstResponder;
}
}
}
|