internal bool ShowListWindow(char firstChar, ICompletionDataList list, ICompletionWidget completionWidget, CodeCompletionContext completionContext, System.Action closedDelegate) { if (mutableList != null) { mutableList.Changing -= OnCompletionDataChanging; mutableList.Changed -= OnCompletionDataChanged; HideFooter(); } //initialWordLength = 0; this.completionDataList = list; this.CompleteWithSpaceOrPunctuation = true; //MonoDevelop.Core.PropertyService.Get ("CompleteWithSpaceOrPunctuation", true); this.CodeCompletionContext = completionContext; this.closedDelegate = closedDelegate; mutableList = completionDataList as IMutableCompletionDataList; List.PreviewCompletionString = completionDataList.CompletionSelectionMode == CompletionSelectionMode.OwnTextField; if (mutableList != null) { mutableList.Changing += OnCompletionDataChanging; mutableList.Changed += OnCompletionDataChanged; if (mutableList.IsChanging) { OnCompletionDataChanging(null, null); } } this.CompletionWidget = completionWidget; if (FillList()) { // not neccessarry, because list window is not reused anymore: // Reset (true); this.AutoSelect = list.AutoSelect; this.AutoCompleteEmptyMatch = list.AutoCompleteEmptyMatch; // makes control-space in midle of words to work string text = completionWidget.GetCompletionText(completionContext, false); DefaultCompletionString = completionDataList.DefaultCompletionString ?? ""; if (text.Length == 0) { UpdateWordSelection(); initialWordLength = 0; //completionWidget.SelectedLength; ResetSizes(); ShowAll(); UpdateWordSelection(); //if there is only one matching result we take it by default if (completionDataList.AutoCompleteUniqueMatch && IsUniqueMatch && !IsChanging) { CompleteWord(); CompletionWindowManager.HideWindow(); } return(true); } initialWordLength = text.Length /*+ completionWidget.SelectedLength*/; PartialWord = text; UpdateWordSelection(); //if there is only one matching result we take it by default if (completionDataList.AutoCompleteUniqueMatch && IsUniqueMatch && !IsChanging) { CompleteWord(); CompletionWindowManager.HideWindow(); } else { ResetSizes(); ShowAll(); } return(true); } CompletionWindowManager.HideWindow(); return(false); }
protected override void DoubleClick() { CompleteWord(); CompletionWindowManager.HideWindow(); }
public bool PreProcessKeyEvent(Gdk.Key key, char keyChar, Gdk.ModifierType modifier, out KeyActions ka) { ka = KeyActions.None; bool keyHandled = false; //foreach (ICompletionKeyHandler handler in CompletionDataList.KeyHandler) { /* if (handler.ProcessKey (this, key, keyChar, modifier, out ka)) { * keyHandled = true; * break; * }*/ //} if (!keyHandled) { ka = ProcessKey(key, keyChar, modifier); } if ((ka & KeyActions.Complete) != 0) { //bool completed = CompleteWord(); //NOTE: this passes the enter keystroke through to the editor if the current item is an exact match //if (!completed) { // CompletionWindowManager.HideWindow (); // return false; //} } if ((ka & KeyActions.CloseWindow) != 0) { CompletionWindowManager.HideWindow(); } if ((ka & KeyActions.Ignore) != 0) { return(true); } if ((ka & KeyActions.Process) != 0) { if (key == Gdk.Key.Left || key == Gdk.Key.Right) { // Close if there's a modifier active EXCEPT lock keys and Modifiers // Makes an exception for Mod1Mask (usually alt), shift, control, meta and super // This prevents the window from closing if the num/scroll/caps lock are active // FIXME: modifier mappings depend on X server settings // if ((modifier & ~(Gdk.ModifierType.LockMask | (Gdk.ModifierType.ModifierMask & ~(Gdk.ModifierType.ShiftMask | Gdk.ModifierType.Mod1Mask | Gdk.ModifierType.ControlMask | Gdk.ModifierType.MetaMask | Gdk.ModifierType.SuperMask)))) != 0) { // this version doesn't work for my system - seems that I've a modifier active // that gdk doesn't know about. How about the 2nd version - should close on left/rigt + shift/mod1/control/meta/super if ((modifier & (Gdk.ModifierType.ShiftMask | Gdk.ModifierType.Mod1Mask | Gdk.ModifierType.ControlMask | Gdk.ModifierType.MetaMask | Gdk.ModifierType.SuperMask)) != 0) { CompletionWindowManager.HideWindow(); return(false); } if (declarationviewwindow.Multiple) { if (key == Gdk.Key.Left) { declarationviewwindow.OverloadLeft(); } else { declarationviewwindow.OverloadRight(); } UpdateDeclarationView(); } else { CompletionWindowManager.HideWindow(); return(false); } return(true); } if (completionDataList != null && completionDataList.CompletionSelectionMode == CompletionSelectionMode.OwnTextField) { return(true); } } return(false); }