Beispiel #1
0
        /// <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);
        }
Beispiel #2
0
        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;
        }
        public NSView CreateView()
        {
            var scrollView = new NSScrollView();

            if (vert)
            {
                scrollView.HasVerticalScroller = true;
                scroller = scrollView.VerticalScroller;
            }
            else
            {
                scrollView.HasHorizontalScroller = true;
                scroller = scrollView.HorizontalScroller;
            }
            scroller.RemoveFromSuperview();
            scroller.Frame = Bounds.ToCGRect();

            scroller.DoubleValue = 0.0;
            scroller.Activated  += HandleScroller;

            UpdateScroller();
            return(scroller);
        }