blob: 9e3366dfa32ae9502673147802dd65f8d18ba326 (
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
|
using System;
using AppKit;
namespace Xamarin.PropertyEditing.Mac
{
internal class FocusableButton : NSButton
{
public override bool CanBecomeKeyView { get { return Enabled; } }
public FocusableButton ()
{
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;
}
public override bool BecomeFirstResponder ()
{
var willBecomeFirstResponder = base.BecomeFirstResponder ();
if (willBecomeFirstResponder) {
ScrollRectToVisible (Bounds);
}
return willBecomeFirstResponder;
}
}
}
|