public void Init(ITextEditor editor, NSTextView text, LiveRange range, AnnotationAlignment alignment) { m_editor = editor; m_text = text; m_range = range; m_view = this["view"].To<AnnotateView>(); m_alignment = alignment; m_parent = m_text.window(); NSNotificationCenter.defaultCenter().addObserver_selector_name_object( this, "parentWillClose:", Externs.NSWindowWillCloseNotification, m_parent); m_text.superview().setPostsBoundsChangedNotifications(true); NSNotificationCenter.defaultCenter().addObserver_selector_name_object( this, "parentBoundsChanged:", Externs.NSViewBoundsDidChangeNotification, m_text.superview()); m_range.Changed += this.DoRangeChanged; }