mac about: add keyboard shortcut to close window
This commit is contained in:
parent
4f3c9b9757
commit
5f5bd7300e
|
@ -30,11 +30,12 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public SparkleAboutController Controller = new SparkleAboutController ();
|
public SparkleAboutController Controller = new SparkleAboutController ();
|
||||||
|
|
||||||
private NSImage AboutImage;
|
private NSImage about_image;
|
||||||
private NSImageView AboutImageView;
|
private NSImageView about_image_view;
|
||||||
private NSTextField VersionTextField;
|
private NSTextField version_text_field;
|
||||||
private NSTextField UpdatesTextField;
|
private NSTextField updates_text_field;
|
||||||
private NSTextField CreditsTextField;
|
private NSTextField credits_text_field;
|
||||||
|
private NSButton hidden_close_button;
|
||||||
|
|
||||||
|
|
||||||
public SparkleAbout (IntPtr handle) : base (handle) { }
|
public SparkleAbout (IntPtr handle) : base (handle) { }
|
||||||
|
@ -54,6 +55,18 @@ namespace SparkleShare {
|
||||||
HasShadow = true;
|
HasShadow = true;
|
||||||
BackingType = NSBackingStore.Buffered;
|
BackingType = NSBackingStore.Buffered;
|
||||||
|
|
||||||
|
this.hidden_close_button = new NSButton () {
|
||||||
|
Frame = new RectangleF (0, 0, 0, 0),
|
||||||
|
KeyEquivalentModifierMask = NSEventModifierMask.CommandKeyMask,
|
||||||
|
KeyEquivalent = "w"
|
||||||
|
};
|
||||||
|
|
||||||
|
this.hidden_close_button.Activated += delegate {
|
||||||
|
Controller.WindowClosed ();
|
||||||
|
};
|
||||||
|
|
||||||
|
ContentView.AddSubview (this.hidden_close_button);
|
||||||
|
|
||||||
CreateAbout ();
|
CreateAbout ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,8 +92,8 @@ namespace SparkleShare {
|
||||||
using (var a = new NSAutoreleasePool ())
|
using (var a = new NSAutoreleasePool ())
|
||||||
{
|
{
|
||||||
InvokeOnMainThread (delegate {
|
InvokeOnMainThread (delegate {
|
||||||
UpdatesTextField.StringValue = "A newer version (" + new_version + ") is available!";
|
this.updates_text_field.StringValue = "A newer version (" + new_version + ") is available!";
|
||||||
UpdatesTextField.TextColor =
|
this.updates_text_field.TextColor =
|
||||||
NSColor.FromCalibratedRgba (0.45f, 0.62f, 0.81f, 1.0f);
|
NSColor.FromCalibratedRgba (0.45f, 0.62f, 0.81f, 1.0f);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -90,8 +103,8 @@ namespace SparkleShare {
|
||||||
using (var a = new NSAutoreleasePool ())
|
using (var a = new NSAutoreleasePool ())
|
||||||
{
|
{
|
||||||
InvokeOnMainThread (delegate {
|
InvokeOnMainThread (delegate {
|
||||||
UpdatesTextField.StringValue = "You are running the latest version.";
|
this.updates_text_field.StringValue = "You are running the latest version.";
|
||||||
UpdatesTextField.TextColor =
|
this.updates_text_field.TextColor =
|
||||||
NSColor.FromCalibratedRgba (0.45f, 0.62f, 0.81f, 1.0f);
|
NSColor.FromCalibratedRgba (0.45f, 0.62f, 0.81f, 1.0f);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -101,8 +114,8 @@ namespace SparkleShare {
|
||||||
using (var a = new NSAutoreleasePool ())
|
using (var a = new NSAutoreleasePool ())
|
||||||
{
|
{
|
||||||
InvokeOnMainThread (delegate {
|
InvokeOnMainThread (delegate {
|
||||||
UpdatesTextField.StringValue = "Checking for updates...";
|
this.updates_text_field.StringValue = "Checking for updates...";
|
||||||
UpdatesTextField.TextColor =
|
this.updates_text_field.TextColor =
|
||||||
NSColor.FromCalibratedRgba (0.45f, 0.62f, 0.81f, 1.0f); // Tango Sky Blue #1
|
NSColor.FromCalibratedRgba (0.45f, 0.62f, 0.81f, 1.0f); // Tango Sky Blue #1
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -117,17 +130,17 @@ namespace SparkleShare {
|
||||||
string about_image_path = Path.Combine (NSBundle.MainBundle.ResourcePath,
|
string about_image_path = Path.Combine (NSBundle.MainBundle.ResourcePath,
|
||||||
"Pixmaps", "about.png");
|
"Pixmaps", "about.png");
|
||||||
|
|
||||||
AboutImage = new NSImage (about_image_path) {
|
this.about_image = new NSImage (about_image_path) {
|
||||||
Size = new SizeF (640, 260)
|
Size = new SizeF (640, 260)
|
||||||
};
|
};
|
||||||
|
|
||||||
AboutImageView = new NSImageView () {
|
this.about_image_view = new NSImageView () {
|
||||||
Image = AboutImage,
|
Image = this.about_image,
|
||||||
Frame = new RectangleF (0, 0, 640, 260)
|
Frame = new RectangleF (0, 0, 640, 260)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
VersionTextField = new NSTextField () {
|
this.version_text_field = new NSTextField () {
|
||||||
StringValue = "version " + Controller.RunningVersion,
|
StringValue = "version " + Controller.RunningVersion,
|
||||||
Frame = new RectangleF (295, 140, 318, 22),
|
Frame = new RectangleF (295, 140, 318, 22),
|
||||||
BackgroundColor = NSColor.White,
|
BackgroundColor = NSColor.White,
|
||||||
|
@ -139,7 +152,7 @@ namespace SparkleShare {
|
||||||
("Lucida Grande", NSFontTraitMask.Unbold, 0, 11)
|
("Lucida Grande", NSFontTraitMask.Unbold, 0, 11)
|
||||||
};
|
};
|
||||||
|
|
||||||
UpdatesTextField = new NSTextField () {
|
this.updates_text_field = new NSTextField () {
|
||||||
StringValue = "Checking for updates...",
|
StringValue = "Checking for updates...",
|
||||||
Frame = new RectangleF (295, Frame.Height - 232, 318, 98),
|
Frame = new RectangleF (295, Frame.Height - 232, 318, 98),
|
||||||
Bordered = false,
|
Bordered = false,
|
||||||
|
@ -151,7 +164,7 @@ namespace SparkleShare {
|
||||||
NSColor.FromCalibratedRgba (0.45f, 0.62f, 0.81f, 1.0f) // Tango Sky Blue #1
|
NSColor.FromCalibratedRgba (0.45f, 0.62f, 0.81f, 1.0f) // Tango Sky Blue #1
|
||||||
};
|
};
|
||||||
|
|
||||||
CreditsTextField = new NSTextField () {
|
this.credits_text_field = new NSTextField () {
|
||||||
StringValue = @"Copyright © 2010–" + DateTime.Now.Year + " Hylke Bons and others." +
|
StringValue = @"Copyright © 2010–" + DateTime.Now.Year + " Hylke Bons and others." +
|
||||||
"\n" +
|
"\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
|
@ -176,11 +189,11 @@ namespace SparkleShare {
|
||||||
// NSWorkspace.SharedWorkspace.OpenUrl (url);
|
// NSWorkspace.SharedWorkspace.OpenUrl (url);
|
||||||
// };
|
// };
|
||||||
|
|
||||||
ContentView.AddSubview (AboutImageView);
|
ContentView.AddSubview (this.about_image_view);
|
||||||
|
|
||||||
ContentView.AddSubview (VersionTextField);
|
ContentView.AddSubview (this.version_text_field);
|
||||||
ContentView.AddSubview (UpdatesTextField);
|
ContentView.AddSubview (this.updates_text_field);
|
||||||
ContentView.AddSubview (CreditsTextField);
|
ContentView.AddSubview (this.credits_text_field);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue