mac setup window: clean up

This commit is contained in:
Hylke Bons 2012-12-06 11:19:20 +00:00
parent 990d1c3231
commit 683c0b7c63

View file

@ -22,7 +22,6 @@ using System.IO;
using MonoMac.Foundation; using MonoMac.Foundation;
using MonoMac.AppKit; using MonoMac.AppKit;
using MonoMac.ObjCRuntime;
namespace SparkleShare { namespace SparkleShare {
@ -52,36 +51,27 @@ namespace SparkleShare {
Center (); Center ();
string side_splash_path = Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "side-splash.png"); string side_splash_path = Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "side-splash.png");
this.side_splash = new NSImage (side_splash_path) { Size = new SizeF (150, 482) };
this.side_splash = new NSImage (side_splash_path) {
Size = new SizeF (150, 482)
};
this.side_splash_view = new NSImageView () { this.side_splash_view = new NSImageView () {
Image = this.side_splash, Image = this.side_splash,
Frame = new RectangleF (0, 0, 150, 482) Frame = new RectangleF (0, 0, 150, 482)
}; };
this.header_text_field = new NSTextField () { this.header_text_field = new SparkleLabel ("", NSTextAlignment.Left) {
Frame = new RectangleF (190, Frame.Height - 80, Frame.Width, 24), Frame = new RectangleF (190, Frame.Height - 80, Frame.Width, 24),
BackgroundColor = NSColor.WindowBackground, Font = NSFontManager.SharedFontManager.FontWithFamily (
Bordered = false,
Editable = false,
Font = NSFontManager.SharedFontManager.FontWithFamily (
"Lucida Grande", NSFontTraitMask.Bold, 0, 15), "Lucida Grande", NSFontTraitMask.Bold, 0, 15),
}; };
this.header_text_field.Cell.LineBreakMode = NSLineBreakMode.TruncatingTail; this.description_text_field = new SparkleLabel ("", NSTextAlignment.Left) {
Frame = new RectangleF (190, Frame.Height - 130, 640 - 240, 44),
this.description_text_field = new NSTextField () { Font = NSFontManager.SharedFontManager.FontWithFamily (
Frame = new RectangleF (190, Frame.Height - 130, 640 - 240, 44),
BackgroundColor = NSColor.WindowBackground,
Bordered = false,
Editable = false,
Font = NSFontManager.SharedFontManager.FontWithFamily (
"Lucida Grande", NSFontTraitMask.Condensed, 0, 13) "Lucida Grande", NSFontTraitMask.Condensed, 0, 13)
}; };
this.header_text_field.Cell.LineBreakMode = NSLineBreakMode.TruncatingTail;
if (Program.UI != null) if (Program.UI != null)
Program.UI.UpdateDockIconVisibility (); Program.UI.UpdateDockIconVisibility ();
} }
@ -101,13 +91,12 @@ namespace SparkleShare {
this.header_text_field.StringValue = Header; this.header_text_field.StringValue = Header;
this.description_text_field.StringValue = Description; this.description_text_field.StringValue = Description;
ContentView.AddSubview (this.side_splash_view);
ContentView.AddSubview (this.header_text_field); ContentView.AddSubview (this.header_text_field);
if (!string.IsNullOrEmpty (Description)) if (!string.IsNullOrEmpty (Description))
ContentView.AddSubview (this.description_text_field); ContentView.AddSubview (this.description_text_field);
ContentView.AddSubview (this.side_splash_view);
int i = 1; int i = 1;
int x = 0; int x = 0;
if (Buttons.Count > 0) { if (Buttons.Count > 0) {
@ -115,18 +104,18 @@ namespace SparkleShare {
foreach (NSButton button in Buttons) { foreach (NSButton button in Buttons) {
button.BezelStyle = NSBezelStyle.Rounded; button.BezelStyle = NSBezelStyle.Rounded;
button.Frame = new RectangleF (Frame.Width - 15 - x - (105 * i), 12, 105, 32); button.Frame = new RectangleF (Frame.Width - 15 - x - (105 * i), 12, 105, 32);
button.Font = SparkleUI.Font;
// Make the button a bit wider if the text is // Make the button a bit wider if the text is likely to be longer
// likely to be longer
if (button.Title.Contains (" ")) { if (button.Title.Contains (" ")) {
button.SizeToFit (); button.SizeToFit ();
button.Frame = new RectangleF (Frame.Width - 30 - 15 - (105 * (i - 1)) - button.Frame.Width, button.Frame = new RectangleF (Frame.Width - 30 - 15 - (105 * (i - 1)) - button.Frame.Width,
12, button.Frame.Width + 30, 32); 12, button.Frame.Width + 30, 32);
x += 22; x += 22;
} }
button.Font = SparkleUI.Font;
ContentView.AddSubview (button); ContentView.AddSubview (button);
i++; i++;
} }