protected OptionPathMonobjc(NSRect aRect, Option aOption) : base(aOption) { iView = new NSView(); iTextField = new NSTextField(); iTextField.SetTitleWithMnemonic(new NSString(iOption.Value)); iTextField.IsEditable = false; iTextField.IsSelectable = false; //textField.AutoresizingMask = NSResizingFlags.NSViewWidthSizable | NSResizingFlags.NSViewMaxXMargin | NSResizingFlags.NSViewMaxYMargin; iButtonChange = new NSButton(); iButtonChange.BezelStyle = NSBezelStyle.NSRoundedBezelStyle; iButtonChange.Title = new NSString("Change..."); iButtonChange.SizeToFit(); iButtonChange.ActionEvent += ActionEventChange; float height = 60 + iButtonChange.Frame.Height; iView.Frame = new NSRect(aRect.MinX, aRect.MinY - height, aRect.Width, height); iTextField.Frame = new NSRect(0, height - 60, aRect.Width, 60); iButtonChange.Frame = new NSRect(iView.Frame.Width - iButtonChange.Frame.Width, iTextField.Frame.MinY - iButtonChange.Frame.Height, iButtonChange.Frame.Width, iButtonChange.Frame.Height); iView.AddSubview(iTextField); iView.AddSubview(iButtonChange); }
public OptionPageMonobjc(IOptionPage aOptionsPage, NSRect aFrameRect) { iName = aOptionsPage.Name; iView = new NSView(aFrameRect); iControls = new List <IOptionMonobjc>(); float y = iView.Frame.Height - 10; float mid = iView.Frame.Width * 0.5f; foreach (Option option in aOptionsPage.Options) { NSTextField label = new NSTextField(); label.SetTitleWithMnemonic(new NSString(option.Name + ":")); label.IsSelectable = false; label.IsEditable = false; label.IsBordered = false; label.DrawsBackground = false; label.Alignment = NSTextAlignment.NSLeftTextAlignment; label.SizeToFit(); label.Frame = new NSRect(10, y - label.Frame.Height, mid - 20, label.Frame.Height); iView.AddSubview(label); IOptionMonobjc o = null; if (option is OptionEnum || option is OptionNetworkInterface) { o = new OptionNetworkInterfaceMonobjc(new NSRect(mid, y, mid - 10, 20), option); } else if (option is OptionFilePath) { o = new OptionFilePathMonobjc(new NSRect(mid, y, mid - 10, 20), option); } else if (option is OptionFolderPath) { o = new OptionFolderPathMonobjc(new NSRect(mid, y, mid - 10, 20), option); } else if (option is OptionBool) { o = new OptionBoolMonobjc(new NSRect(mid, y, mid - 10, 20), option); } else if (option is OptionListFolderPath) { o = new OptionListFolderPathMonobjc(new NSRect(mid, y, mid - 10, 20), option); } if (o != null) { iView.AddSubview(o.View); y -= o.Height; iControls.Add(o); } } }