/// <summary> /// Creates a new code completion window. /// </summary> public PythonConsoleCompletionWindow(TextArea textArea, PythonTextEditor textEditor) : base(textArea) { // keep height automatic this.completionDataProvider = textEditor.CompletionProvider; this.textEditor = textEditor; this.CloseAutomatically = true; this.SizeToContent = SizeToContent.Height; this.MaxHeight = 300; this.Width = 250; this.Content = completionList; // prevent user from resizing window to 0x0 this.MinHeight = 15; this.MinWidth = 30; toolTip.PlacementTarget = this; toolTip.Placement = PlacementMode.Right; toolTip.Closed += toolTip_Closed; completionList.InsertionRequested += completionList_InsertionRequested; completionList.SelectionChanged += completionList_SelectionChanged; AttachEvents(); updateDescription = new DispatcherTimer(); updateDescription.Tick += new EventHandler(completionList_UpdateDescription); updateDescriptionInterval = TimeSpan.FromSeconds(0.3); EventInfo eventInfo = typeof(TextView).GetEvent("ScrollOffsetChanged"); Delegate methodDelegate = Delegate.CreateDelegate(eventInfo.EventHandlerType, (this as CompletionWindowBase), "TextViewScrollOffsetChanged"); eventInfo.RemoveEventHandler(this.TextArea.TextView, methodDelegate); }
/// <summary> /// Creates a new code completion window. /// </summary> public PythonConsoleCompletionWindow(TextArea textArea, PythonTextEditor textEditor) : base(textArea) { // keep height automatic this.completionDataProvider = textEditor.CompletionProvider; this.textEditor = textEditor; this.CloseAutomatically = true; this.SizeToContent = SizeToContent.Height; this.MaxHeight = 300; this.Width = 175; this.Content = completionList; // prevent user from resizing window to 0x0 this.MinHeight = 15; this.MinWidth = 30; toolTip.PlacementTarget = this; toolTip.Placement = PlacementMode.Right; toolTip.Closed += toolTip_Closed; completionList.InsertionRequested += completionList_InsertionRequested; completionList.SelectionChanged += completionList_SelectionChanged; AttachEvents(); updateDescription = new DispatcherTimer(); updateDescription.Tick += new EventHandler(completionList_UpdateDescription); updateDescriptionInterval = TimeSpan.FromSeconds(0.3); EventInfo eventInfo = typeof(TextView).GetEvent("ScrollOffsetChanged"); Delegate methodDelegate = Delegate.CreateDelegate(eventInfo.EventHandlerType, (this as CompletionWindowBase), "TextViewScrollOffsetChanged"); eventInfo.RemoveEventHandler(this.TextArea.TextView, methodDelegate); }