/// <summary> /// Sets up the view and sets event handlers /// </summary> void Build(CGRect rect) { var scrollWidth = NSScroller.ScrollerWidthForControlSize(NSControlSize.Regular); var scrollFrame = new CGRect(rect.Right - scrollWidth, rect.Y, scrollWidth, rect.Height); scroller = new NSScroller(scrollFrame); scroller.ScrollerStyle = NSScrollerStyle.Legacy; scroller.DoubleValue = 0.0; scroller.KnobProportion = 0.1f; scroller.Enabled = false; AddSubview(scroller); scroller.Activated += ScrollerActivated; var terminalFrame = new CGRect(rect.X, rect.Y, rect.Width - scrollWidth, rect.Height); terminalView = new TerminalView(terminalFrame); var t = terminalView.Terminal; terminalView.UserInput = HandleUserInput; terminalView.SizeChanged += HandleSizeChanged; terminalView.TerminalScrolled += HandleTerminalScrolled; terminalView.CanScrollChanged += HandleTerminalCanScrollChanged; terminalView.TitleChanged += (TerminalView sender, string title) => { TitleChanged?.Invoke(title); }; AddSubview(terminalView); }
public override void Layout() { var viewFrame = Frame; var scrollWidth = NSScroller.ScrollerWidthForControlSize(NSControlSize.Regular); var scrollFrame = new CGRect(viewFrame.Right - scrollWidth, viewFrame.Y, scrollWidth, viewFrame.Height); viewFrame = new CGRect(viewFrame.X, viewFrame.Y, viewFrame.Width - scrollWidth, viewFrame.Height); scroller.Frame = scrollFrame; terminalView.Frame = viewFrame; }