void QuickSearchText_KeyPressed(object sender, Xwt.KeyEventArgs e) { if (e.Key == Xwt.Key.Escape) { QuickSearchText.Text = ""; QuickSearchBox.Visible = false; ListingView.AllowedToPoint.Clear(); return; } //search for good items ListingView.Sensitive = false; ListingView.AllowedToPoint.Clear(); foreach (ListView2Item lvi in ListingView.Items) { if (lvi.Data[1].ToString().StartsWith(QuickSearchText.Text)) { ListingView.AllowedToPoint.Add(lvi.RowNo); } } ListingView.Sensitive = true; //set pointer to the first good item (if need) if (ListingView.AllowedToPoint.Count > 0) { if (ListingView.SelectedRow < ListingView.AllowedToPoint[0] || ListingView.SelectedRow > ListingView.AllowedToPoint[ListingView.AllowedToPoint.Count - 1] ) { ListingView.SelectedRow = ListingView.AllowedToPoint[0]; ListingView.ScrollToRow(ListingView.AllowedToPoint[0]); } } }
void UrlBox_KeyReleased(object sender, Xwt.KeyEventArgs e) { if (e.Key == Xwt.Key.Return) { LoadDir(UrlBox.Text); } }
void OnWorkItemKeyPressed (object sender, KeyEventArgs e) { if (e.Modifiers == ModifierKeys.Control && (e.Key == Key.c || e.Key == Key.C)) { CopySelectedToClipBoard(); } }
protected void Entry_defchar_KeyPressed(object sender, KeyEventArgs e) { Console.WriteLine(e.NativeKeyCode); if (!entry_defchar.HasFocus) return; entry_defchar.Text = ((char)e.NativeKeyCode).ToString(); e.Handled = true; }
protected void Entry2_KeyPressed(object sender, KeyEventArgs e) { if (!entry2.HasFocus) return; char c = (char)e.NativeKeyCode; entry2.Text = c.ToString(); entry1.Text = ((int)c).ToString(); e.Handled = true; OnChange(new EventArgs()); }
private void HandleKeyPressed(object sender, KeyEventArgs e) { e.Handled = true; var entryKey = Gdk.Keymap.Default.GetEntriesForKeyval((uint)e.Key)[0].Keycode; var key = X11ToKeyScanCodeConverter.Instance.GetScanCode((int)entryKey); if(key != null) { handler.KeyPressed(key.Value); return; } Logger.LogAs(this, LogLevel.Warning, "Unhandled keycode: {0}", entryKey); }
void CLIprompt_KeyReleased(object sender, Xwt.KeyEventArgs e) { if (e.Key == Xwt.Key.Return) { if (System.Text.RegularExpressions.Regex.Match(CLIprompt.Text, "cd|chdir|md|rd|del|deltree|move|copy|cls").Success) { CLIprompt.Text = ""; //todo: обработка встроенных комманд return; } CLIoutput.Visible = true; string stdin = CLIprompt.Text; CLIprompt.Text = ""; CLIoutput.Text += stdin; FS.CLIstdinWriteLine(stdin); } }
void ListingView_KeyReleased(object sender, Xwt.KeyEventArgs e) { if (e.Key == Xwt.Key.Return && ListingView.SelectedRow > -1) { NavigateTo(ListingView.PointedItem.Data[dfURL].ToString()); return; } if ((int)e.Key < 65000) //keys before 65000th are characters, numbers & other human stuff { QuickSearchText.Text += e.Key.ToString(); QuickSearchBox.Visible = true; QuickSearchText.SetFocus(); return; } if (Utilities.GetXwtBackendName() == "WPF") { ListingView.OnKeyPressed(e); } }
void Layout_KeyPressed(object sender, KeyEventArgs e) { //See GH issue #10 Console.WriteLine("LV2 DEBUG: pressed {0}, repeat={1}, handled={2}",e.Key,e.IsRepeat,e.Handled); //УБРАТЬ!!! //currently, the keyboard feel is same as in Norton & Total Commanders switch (e.Key) { case Key.Up: //[↑] - move cursor up _SetPointerByCondition(-1); e.Handled = true; return; case Key.Down: //[↓] - move cursor bottom _SetPointerByCondition(+1); e.Handled = true; return; case Key.Insert: //[Ins] - set selection & move pointer bottom _SelectItem(PointedItem); _SetPointerByCondition(+1); e.Handled = true; return; case Key.Return: //[↵] - same as double click PointedItem.OnDblClick(); e.Handled = true; return; case Key.NumPadMultiply: //gray [*] - invert selection InvertSelection(); e.Handled = true; return; case Key.Home: _SetPoint(Items[0]); return; case Key.End: _SetPoint(Items[Items.Count-1]); return; } }
protected override void OnKeyPressed(KeyEventArgs args) { base.OnKeyPressed(args); switch (args.Key) { case Key.Delete: TreeStore currentStore = DataSource as TreeStore; if (currentStore != null) { TreeNavigator selected = currentStore.GetNavigatorAt(SelectedRow); if (selected != null) { Dialog d = new Dialog(); d.Title = "Remove this scan"; VBox nameList = new VBox(); ScrollView nameListScroll = new ScrollView(nameList); foreach (TreePosition selectPos in SelectedRows) { nameList.PackStart( new Label(currentStore.GetNavigatorAt(selectPos) .GetValue(isFiltered ? nameColFilter : nameCol)) ); } TextLayout text = new TextLayout(); text.Text = "M"; double textHeight = text.GetSize().Height; text.Dispose(); nameListScroll.MinHeight = Math.Min(10, SelectedRows.Length) * textHeight; d.Content = nameListScroll; d.Buttons.Add(new DialogButton(Command.Delete)); d.Buttons.Add(new DialogButton(Command.Cancel)); Command r = d.Run(); if (r != null && r.Id == Command.Delete.Id) { foreach (TreePosition selectPos in SelectedRows) { string name = currentStore.GetNavigatorAt(selectPos) .GetValue(isFiltered ? nameColFilter : nameCol); if (!string.IsNullOrEmpty(name)) { currentStore.GetNavigatorAt(selectPos).Remove(); scanCollection.RemoveAll(scan => scan.Name == name); } } } d.Dispose(); } } break; } }
/// <summary> /// Key events! /// </summary> private void InnerTextEntry_KeyPressed(object sender, KeyEventArgs e) { switch (e.Key) { case Key.Down: SelectionDown(); break; case Key.Up: SelectionUp(); break; case Key.Return: if (HelperListView.SelectedRow >= 0) { InnerTextEntry.Text = ActiveList[HelperListView.SelectedRow]; changed(sender, e); } break; } }
internal void HandleKeyPressed(object sender, KeyEventArgs e) { e.Handled = true; if (e.Modifiers.HasFlag(ModifierKeys.Control)) { switch (e.Key) { case Key.a: case Key.A: SelectAll(); break; case Key.x: case Key.X: Cut(); break; case Key.c: case Key.C: Copy(); break; case Key.v: case Key.V: Paste(); break; } } switch (e.Key) { case Key.Home: editor.Caret.Column = 1; Deselect(); break; case Key.Up: MoveCursorUp(); break; case Key.Down: MoveCursorDown(); break; case Key.Left: MoveCursorLeft(); break; case Key.Right: MoveCursorRight(); break; case Key.Delete: DeleteText(false); break; case Key.BackSpace: DeleteText(true); break; case Key.Tab: InsertText("\t"); break; default: e.Handled = false; break; } if (e.Handled) { editor.ResetCaretState(); } }
private void GlobalKeyPressed(object sender, KeyEventArgs e) { if (e.Modifiers.HasFlag(ModifierKeys.Command) || e.Modifiers.HasFlag(ModifierKeys.Control)) { switch (e.Key) { case Key.s: SaveAll(); break; } } e.Handled = true; }
public void OnKeyPressed(KeyEventArgs args) { Parent.OnKeyPressed (args); }
protected override void OnKeyPressed(KeyEventArgs e) { base.OnKeyReleased(e); switch (e.Key) { case Key.Left: { Source.MoveCaret(Direction.Left, (e.Modifiers & ModifierKeys.Control) == ModifierKeys.Control, (e.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift); } break; case Key.Right: { Source.MoveCaret(Direction.Right, (e.Modifiers & ModifierKeys.Control) == ModifierKeys.Control); } break; default: if (e.Modifiers == ModifierKeys.None) { switch (e.Key) { case Key.Return: { Source.InsertText("\n\n"); } break; case Key.Up: { Source.MoveCaret(Direction.Up); } break; case Key.Down: { Source.MoveCaret(Direction.Down); } break; case Key.BackSpace: { Source.RemoveCaretLeft((e.Modifiers & ModifierKeys.Control) == ModifierKeys.Control); } break; case Key.Delete: { Source.RemoveCaretRight((e.Modifiers & ModifierKeys.Control) == ModifierKeys.Control); } break; } } else if (e.Modifiers == ModifierKeys.Control) { switch (e.Key) { case Key.BackSpace: { Source.RemoveCaretLeft((e.Modifiers & ModifierKeys.Control) == ModifierKeys.Control); } break; case Key.Delete: { Source.RemoveCaretRight((e.Modifiers & ModifierKeys.Control) == ModifierKeys.Control); } break; } } break; } }
protected internal virtual void OnKeyReleased(KeyEventArgs args) { if (keyReleased != null) keyReleased (this, args); }
//PUBLIC MEMBERS /// <summary>Imitates a press of a keyboard key</summary> /// <param name="kea">The key to be "pressed"</param> public new void OnKeyPressed(Xwt.KeyEventArgs kea) { base.OnKeyPressed(kea); }
//todo: doesn't fire every time when Enter (Return) is pressing, thus it's need to be fixed. Possibly, due to XWT peculiarity (input focus doesn't sets as fully as required). private void t_KeyPressed(object sender, KeyEventArgs e) { if (e.Key == Key.Escape) { SetEditInput(null); } l.Text = t.Text; if (e.Key == Key.Return) { SetEditInput(false); } }
protected override void OnKeyPressed(KeyEventArgs args) { switch (args.Key) { case Key.Delete: Tuple<MarkerNode, MarkerEdge> edge = GetEdgeAt(mousePosition); if (edge != null) { edge.Item1.RemoveEdge(edge.Item2); QueueDraw(); EmitDataChanged(); } else { PipelineNode node = GetNodeAt(mousePosition, true); if (node != null) { RemoveNode(node); QueueDraw(); EmitDataChanged(); } } break; } }
/// <summary> /// Called on KeyPress event. /// </summary> /// <param name="args">An instance that contains the event data.</param> protected override void OnKeyPressed(KeyEventArgs args) { base.OnKeyPressed(args); if (args.Handled) return; args.Handled = ActualController.HandleKeyDown(this, args.ToOxyKeyEventArgs()); }
protected override void OnKeyPressed(KeyEventArgs args) { base.OnKeyPressed(args); if (args.Modifiers.HasFlag(ModifierKeys.Command) || args.Modifiers.HasFlag(ModifierKeys.Control)) { switch (args.Key) { case Key.z: scan.Mask.Undo(); QueueDraw(); break; } } }
protected override void OnKeyReleased(KeyEventArgs args) { base.OnKeyPressed(args); fileTree.Filter(Text); }
void CommandBox_KeyReleased(object sender, KeyEventArgs e) { if (e.Key == Key.Return) { if(CommandBox.Text == "q") { Close(); return; } if(CommandBox.Text == "q!") { Plugin.SaveFile(); Close(); return; } SendCommand(CommandBox.Text); } }
void HandleKeyPressEvent(object o, Gtk.KeyPressEventArgs args) { Key k = (Key)args.Event.KeyValue; ModifierKeys m = ModifierKeys.None; if ((args.Event.State & Gdk.ModifierType.ShiftMask) != 0) m |= ModifierKeys.Shift; if ((args.Event.State & Gdk.ModifierType.ControlMask) != 0) m |= ModifierKeys.Control; if ((args.Event.State & Gdk.ModifierType.Mod1Mask) != 0) m |= ModifierKeys.Alt; KeyEventArgs kargs = new KeyEventArgs (k, m, false, (long)args.Event.Time); ApplicationContext.InvokeUserCode (delegate { EventSink.OnKeyPressed (kargs); }); if (kargs.Handled) args.RetVal = true; }
protected override void OnKeyReleased(KeyEventArgs args) { bool modified = false; foreach (Interaction interaction in plotCanvas.interactions) { modified |= interaction.OnKeyReleased (args, plotCanvas); } CheckForRedraw (modified); }
public void OnKeyReleased(KeyEventArgs args) { Parent.OnKeyReleased (args); }
void SendKeyPress(KeyEventArgs ka) { if (SearchEntryKeyPressed != null) SearchEntryKeyPressed(this, ka); }
void HandleKeyPressEvent(object o, Gtk.KeyPressEventArgs args) { Key k = (Key)args.Event.KeyValue; ModifierKeys m = args.Event.State.ToXwtValue (); KeyEventArgs kargs = new KeyEventArgs (k, m, false, (long)args.Event.Time); ApplicationContext.InvokeUserCode (delegate { EventSink.OnKeyPressed (kargs); }); if (kargs.Handled) args.RetVal = true; }
public virtual bool OnKeyReleased(KeyEventArgs args, PlotCanvas pc) { return false; }
void Layout_KeyReleased(object sender, KeyEventArgs e) { switch (e.Key) { case Key.Escape: CommandBox.SetFocus(); return; case Key.F10: case Key.q: Close(); return; } }
public override bool OnKeyReleased(KeyEventArgs args, PlotCanvas pc) { key = args.Key; return false; }
void HandleKeyReleaseEvent(object o, Gtk.KeyReleaseEventArgs args) { Key k = (Key)args.Event.KeyValue; ModifierKeys m = ModifierKeys.None; if ((args.Event.State & Gdk.ModifierType.ShiftMask) != 0) m |= ModifierKeys.Shift; if ((args.Event.State & Gdk.ModifierType.ControlMask) != 0) m |= ModifierKeys.Control; if ((args.Event.State & Gdk.ModifierType.Mod1Mask) != 0) m |= ModifierKeys.Alt; KeyEventArgs kargs = new KeyEventArgs (k, m, false, (long)args.Event.Time); Toolkit.Invoke (delegate { EventSink.OnKeyReleased (kargs); }); if (kargs.IsEventCanceled) args.RetVal = true; }
protected override void OnKeyPressed (KeyEventArgs args) { uint unicodeChar = (uint)args.Key; var filteredModifiers = args.Modifiers & (ModifierKeys.Shift | ModifierKeys.Command | ModifierKeys.Control); HexEditorData.EditMode.InternalHandleKeypress (this, args.Key, unicodeChar, filteredModifiers); args.Handled = true; }
WPFToolbar (ToolBar toolbar) : base (toolbar) { this.toolbar = toolbar; toolbar.ConfigurationMenu.SelectionChanged += (o, e) => { var comboMenu = (ComboMenu<IConfigurationModel>)o; var newModel = e.Added; if (newModel == null) return; Runtime.RunInMainThread(() => { ActiveConfiguration = newModel; if (ConfigurationChanged != null) ConfigurationChanged(o, e); }); }; toolbar.RuntimeMenu.SelectionChanged += (o, e) => { var newModel = e.Added; if (newModel == null) return; using (var mutableModel = newModel.GetMutableModel()) { Runtime.RunInMainThread(() => { ActiveRuntime = newModel; var ea = new MonoDevelop.Components.MainToolbar.HandledEventArgs(); if (RuntimeChanged != null) RuntimeChanged(o, ea); if (ea.Handled) ActiveRuntime = e.Removed; }); } }; toolbar.RunButton.Click += (o, e) => { if (RunButtonClicked != null) RunButtonClicked (o, e); }; toolbar.SearchBar.SearchBar.TextChanged += (o, e) => { if (string.IsNullOrEmpty (SearchText) || SearchText == SearchPlaceholderMessage) return; if (SearchEntryChanged != null) SearchEntryChanged (o, e); }; toolbar.SearchBar.SearchBar.LostKeyboardFocus += (o, e) => { if (SearchEntryLostFocus != null) SearchEntryLostFocus (o, e); toolbar.SearchBar.SearchText = toolbar.SearchBar.PlaceholderText; }; toolbar.SearchBar.SearchBar.GotKeyboardFocus += (o, e) => { SearchEntryActivated?.Invoke (o, e); }; toolbar.SearchBar.SearchBar.SizeChanged += (o, e) => { if (SearchEntryResized != null) SearchEntryResized (o, e); }; toolbar.SearchBar.SearchBar.PreviewKeyDown += (o, e) => { var ka = new KeyEventArgs(KeyboardUtil.TranslateToXwtKey(e.Key), KeyboardUtil.GetModifiers(), e.IsRepeat, e.Timestamp); SendKeyPress(ka); e.Handled = ka.Handled; }; toolbar.SearchBar.ClearIconClicked += (o, e) => { SendKeyPress(new KeyEventArgs(Xwt.Key.Escape, KeyboardUtil.GetModifiers(), false, 0)); }; }
void SendKeyPress(KeyEventArgs ka) { if (ka.Key == Xwt.Key.Escape) SearchText = string.Empty; if (SearchEntryKeyPressed != null) SearchEntryKeyPressed(this, ka); }