/// <summary>Initialise widget.</summary> /// <param name="ownerView">The owner of the widget.</param> /// <param name="gtkControl">The raw gtk control.</param> protected override void Initialise(ViewBase ownerView, GLib.Object gtkControl) { base.Initialise(ownerView, gtkControl); if (gtkControl is ScrolledWindow scroller) { textView = new TextView(); scroller.Add(textView); mainWidget = scroller; } else { textView = (TextView)gtkControl; mainWidget = textView; } mainWidget.Margin = 10; textView.PopulatePopup += OnPopulatePopupMenu; findView = new MarkdownFindView(); textView.Editable = false; textView.WrapMode = Gtk.WrapMode.Word; textView.VisibilityNotifyEvent += OnVisibilityNotify; textView.MotionNotifyEvent += OnMotionNotify; textView.WidgetEventAfter += OnWidgetEventAfter; CreateStyles(textView); mainWidget.ShowAll(); mainWidget.Destroyed += OnDestroyed; mainWidget.Realized += OnRealized; textView.FocusInEvent += OnGainFocus; textView.FocusOutEvent += OnLoseFocus; handCursor = new Gdk.Cursor(Gdk.CursorType.Hand2); regularCursor = new Gdk.Cursor(Gdk.CursorType.Xterm); textView.KeyPressEvent += OnTextViewKeyPress; }
/// <summary>Initialise widget.</summary> /// <param name="ownerView">The owner of the widget.</param> /// <param name="gtkControl">The raw gtk control.</param> protected override void Initialise(ViewBase ownerView, GLib.Object gtkControl) { container = (VBox)gtkControl; textView = (TextView)container.Children[0]; textView.PopulatePopup += OnPopulatePopupMenu; findView = new MarkdownFindView(); textView.Editable = false; textView.WrapMode = WrapMode.Word; textView.VisibilityNotifyEvent += OnVisibilityNotify; textView.MotionNotifyEvent += OnMotionNotify; textView.WidgetEventAfter += OnWidgetEventAfter; CreateStyles(textView); mainWidget = container; container.ShowAll(); mainWidget.Destroyed += OnDestroyed; handCursor = new Gdk.Cursor(Gdk.CursorType.Hand2); regularCursor = new Gdk.Cursor(Gdk.CursorType.Xterm); textView.KeyPressEvent += OnTextViewKeyPress; }