本文整理汇总了C#中Gtk.KeyPressEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# KeyPressEventArgs类的具体用法?C# KeyPressEventArgs怎么用?C# KeyPressEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
KeyPressEventArgs类属于Gtk命名空间,在下文中一共展示了KeyPressEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnEditKeyPress
void OnEditKeyPress (object sender, KeyPressEventArgs args)
{
if (currentCompletionData != null) {
char keyChar = (char)args.Event.Key;
if ((args.Event.Key == Gdk.Key.Down || args.Event.Key == Gdk.Key.Up)) {
keyChar = '\0';
}
var retVal = CompletionWindowManager.PreProcessKeyEvent (args.Event.Key, keyChar, args.Event.State);
CompletionWindowManager.PostProcessKeyEvent (args.Event.Key, keyChar, args.Event.State);
args.RetVal = retVal;
}
Application.Invoke (delegate {
char c = (char)Gdk.Keyval.ToUnicode (args.Event.KeyValue);
if (currentCompletionData == null && IsCompletionChar (c)) {
string exp = entry.Text.Substring (0, entry.CursorPosition);
currentCompletionData = GetCompletionData (exp);
if (currentCompletionData != null) {
DebugCompletionDataList dataList = new DebugCompletionDataList (currentCompletionData);
CodeCompletionContext ctx = ((ICompletionWidget)this).CreateCodeCompletionContext (entry.CursorPosition - currentCompletionData.ExpressionLength);
CompletionWindowManager.ShowWindow (null, c, dataList, this, ctx);
}
}
});
}
示例2: OnKeyPress
/* change view angle, exit upon ESC */
public void OnKeyPress(object o, KeyPressEventArgs args)
{
switch (args.Event.Key) {
case Gdk.Key.z:
view_rotz += 5.0f;
break;
case Gdk.Key.Z:
view_rotz -= 5.0f;
break;
case Gdk.Key.Up:
view_rotx += 5.0f;
break;
case Gdk.Key.Down:
view_rotx -= 5.0f;
break;
case Gdk.Key.Left:
view_roty += 5.0f;
break;
case Gdk.Key.Right:
view_roty -= 5.0f;
break;
case Gdk.Key.Escape:
Gtk.Application.Quit ();
break;
default:
return;
}
GdkWindow.InvalidateRect (Allocation, false);
}
示例3: OnKeyPressEvent
protected void OnKeyPressEvent(object o, KeyPressEventArgs e)
{
if (e.Event.Key == Gdk.Key.Return)
{
Respond(ResponseType.Ok);
Hide();
}
}
示例4: HandleKeyPressed
void HandleKeyPressed(object o, KeyPressEventArgs args)
{
if (CurrentlySelected == null)
return;
if (args.Event.Key == Gdk.Key.Return && IconDoubleClicked != null)
IconDoubleClicked (this, EventArgs.Empty);
}
示例5: OnKeyPress
public void OnKeyPress(object sender, KeyPressEventArgs args)
{
if (args.Event.Key.Equals(Gdk.Key.Return))
{
Debug.Assert(Visible);
Debug.Assert(!string.IsNullOrWhiteSpace(cbCompletions.ActiveText));
SelectedCompletion = cbCompletions.ActiveText;
CompletionSelected();
}
}
示例6: Parse
public static string Parse(KeyPressEventArgs keyPress)
{
string gtkKey = keyPress.Event.Key.ToString ().ToLower ();
if (telnetKeys.Contains (gtkKey))
return gtkKey;
if(tranlsateKey(ref gtkKey))
return gtkKey;
if(tryAsDigit(ref gtkKey))
return gtkKey;
if (gtkKey.Length == 1)
return gtkKey;
return string.Empty;
}
示例7: OnValueTableKeyPressEvent
protected void OnValueTableKeyPressEvent(object o, KeyPressEventArgs args)
{
try
{
if (args.Event.Key == Gdk.Key.Delete)
{
TreeIter iter;
table.GetIter(out iter, ValueTable.Selection.GetSelectedRows()[0]);
int index = table.GetPath(iter).Indices[0];
if (index == 0 && fst.HasReferenceImage) { fst.RemovReferenceImage(); }
else if (fst.HasReferenceImage) { fst.RemoveFilterImage(index - 1); }
else { fst.RemoveFilterImage(index); }
saved = false;
UpdateTable();
}
}
catch (Exception ex) { ErrorReport.ReportError("ValueTableKeyPress (Create Filterset)", ex); }
}
示例8: HandleSlideViewKeyPressEvent
protected virtual void HandleSlideViewKeyPressEvent(object sender, KeyPressEventArgs args)
{
switch(args.Event.Key) {
case Gdk.Key.Left:
slide_show_view.Pause();
slide_show_view.Previous();
args.RetVal = true;
break;
case Gdk.Key.Right:
slide_show_view.Pause();
slide_show_view.Next();
args.RetVal = true;
break;
case Gdk.Key.Escape:
slide_show_view.Stop();
slide_show_view.Destroy ();
args.RetVal = true;
this.Destroy ();
AddSlideDialogRunner.Dialog.Visible = true;
AddSlideDialogRunner.Run ();
AddSlideDialogRunner.ProcessResponse ();
break;
}
}
示例9: OniFolderIconViewKeyPress
private void OniFolderIconViewKeyPress(object o, KeyPressEventArgs args)
{
switch(args.Event.Key)
{
case Gdk.Key.Delete:
iFolderHolder holder = iFoldersIconView.SelectedFolder;
if (holder != null)
{
if (holder.iFolder.IsSubscription)
{
DomainInformation domain =
domainController.GetDomain(holder.iFolder.DomainID);
if (domain == null ||
domain.MemberUserID == holder.iFolder.OwnerID)
{
DeleteSelectedFolderFromServer();
}
else
{
RemoveMembershipFromSelectedFolder();
}
}
else
{
RemoveSelectedFolderHandler();
}
}
break;
default:
break;
}
}
示例10: OnKeyPressEvent
/// <summary>
/// Closes window on Escape press.
/// </summary>
/// <param name="sender">Sender.</param>
/// <param name="args">Event arguments.</param>
private void OnKeyPressEvent(object sender, KeyPressEventArgs args)
{
if (args.Event.Key == Gdk.Key.Escape)
this.Destroy();
}
示例11: OnKeyPressEvent
void OnKeyPressEvent (object sender, KeyPressEventArgs args)
{
// Delete the currently selected breakpoint(s) with any delete key
switch (args.Event.Key) {
case Gdk.Key.Delete:
case Gdk.Key.KP_Delete:
case Gdk.Key.BackSpace:
// Delete the selected breakpoints
bool deleted = false;
DebuggingService.Breakpoints.BreakpointRemoved -= breakpointRemovedHandler;
foreach (TreePath path in tree.Selection.GetSelectedRows ()) {
TreeIter iter;
if (!store.GetIter (out iter, path))
continue;
var bp = (Breakpoint) store.GetValue (iter, (int) Columns.Breakpoint);
bps.Remove (bp);
deleted = true;
}
DebuggingService.Breakpoints.BreakpointRemoved += breakpointRemovedHandler;
if (deleted) {
args.RetVal = true;
UpdateDisplay ();
}
break;
}
}
示例12: ShortcutHandle
/// <summary>
/// Shortcuts
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
/// <returns></returns>
public static bool ShortcutHandle(object sender, KeyPressEventArgs e)
{
bool rt = false;
try
{
foreach (Core.Shortcut shortcut in Configuration.ShortcutKeylist)
{
if (shortcut.control == (e.Event.State == Gdk.ModifierType.ControlMask)
&& shortcut.keys == Core.ConvertKey(e.Event.Key) && shortcut.alt == (e.Event.State == Gdk.ModifierType.Mod1Mask))
{
Parser.parse(shortcut.data);
rt = true;
}
}
e.RetVal = rt;
}
catch (Exception fail)
{
Core.handleException(fail);
}
return rt;
}
示例13: MainWindow_KeyPressEvent
void MainWindow_KeyPressEvent(object o, KeyPressEventArgs e)
{
if (!pressed_keys.Contains (e.Event.Key))
{
pressed_keys.Add (e.Event.Key);
Logger.Log ("Key press: " + e.Event.Key.ToString ());
}
if (e.Event.Key == Gdk.Key.Control_L || e.Event.Key == Gdk.Key.Control_R)
{
cmd_map.On (true);
}
// Give the Canvas (and by extension the tools)
// first shot at handling the event if
// the mouse pointer is on the canvas
if (IsMouseOnCanvas() || canvas_pad.Canvas.HasFocus)
{
canvas_pad.Canvas.DoKeyPressEvent (o, e);
}
}
示例14: PintaCanvas_KeyPressEvent
private void PintaCanvas_KeyPressEvent(object o, KeyPressEventArgs e)
{
// Give the current tool a chance to handle the key press
PintaCore.Tools.CurrentTool.DoKeyPress (this, e);
// If the tool didn't consume it, see if its a toolbox shortcut
if (e.RetVal == null || !(bool)e.RetVal)
if (FilterModifierKeys (e.Event.State) == ModifierType.None)
PintaCore.Tools.SetCurrentTool (e.Event.Key);
}
示例15: OniFolderIconViewKeyPress
private void OniFolderIconViewKeyPress(object o, KeyPressEventArgs args)
{
switch(args.Event.Key)
{
case Gdk.Key.Delete:
iFolderHolder holder = iFolderIconView.SelectedFolder;
if (holder != null)
{
if (holder.iFolder.IsSubscription)
{
if ( holder.iFolder.CurrentUserID== holder.iFolder.OwnerID)
{
DeleteSelectedFolderFromServer();
}
else
{
RemoveMembershipFromSelectedFolder();
}
}
else
{
RemoveSelectedFolderHandler();
}
}
break;
default:
break;
}
}