本文整理汇总了C#中Gdk.TriggersContextMenu方法的典型用法代码示例。如果您正苦于以下问题:C# Gdk.TriggersContextMenu方法的具体用法?C# Gdk.TriggersContextMenu怎么用?C# Gdk.TriggersContextMenu使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gdk
的用法示例。
在下文中一共展示了Gdk.TriggersContextMenu方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnPanelClick
protected override void OnPanelClick (Gdk.EventButton e, Placement placement)
{
if (e.TriggersContextMenu ()) {
CommandEntrySet opset = new CommandEntrySet ();
opset.AddItem (CommandSystemCommands.ToolbarList);
Gtk.Menu menu = manager.CreateMenu (opset);
menu.Popup (null, null, null, 0, e.Time);
}
base.OnPanelClick (e, placement);
}
示例2: OnButtonPressEvent
protected override bool OnButtonPressEvent (Gdk.EventButton evnt)
{
selectOnRelease = false;
if (!evnt.TriggersContextMenu ()) {
//Because we are blocking selection changes with SelectFunction base.OnButtonPressEvent
//can be called so expanders work. Another good effect is when expander is clicked
//SelectFunction is not called so selectOnRelease remains false.
//Which means no selection operation is performed in OnButtonReleaseEvent.
//When Shift is pressed we don't do our magic becasue:
//a) it works as expected((item is still selected when dragging starts
//(it's by nature of Shift selecting))
//b) we would have to simulate Shift selecting in OnButtonReleaseEvent
//which would mean we have to implement all selecting logic...
//Also notice that our magic is requiered only when item is selected.
if (GetPathAtPos ((int)evnt.X, (int)evnt.Y, out buttonPressPath) &&
((evnt.State & Gdk.ModifierType.ShiftMask) == 0) &&
Selection.PathIsSelected (buttonPressPath)) {
this.Selection.SelectFunction = (s, m, p, b) => {
selectOnRelease = true;
//Always returning false means we are blocking base.OnButtonPressEvent
//from doing any changes to selectiong we will do changes in OnButtonReleaseEvent
return false;
};
} else {
this.Selection.SelectFunction = (s, m, p, b) => {
return true;
};
}
return base.OnButtonPressEvent (evnt);
}
//pass click to base so it can update the selection
//unless the node is already selected, in which case we don't want to change the selection(deselect multi selection)
bool res = false;
if (!this.IsClickedNodeSelected ((int)evnt.X, (int)evnt.Y)) {
res = base.OnButtonPressEvent (evnt);
}
if (DoPopupMenu != null) {
DoPopupMenu (evnt);
return true;
}
return res;
}
示例3: OnButtonPressEvent
protected override bool OnButtonPressEvent (Gdk.EventButton evnt)
{
bool res = false;
bool withModifier = (evnt.State & selectionModifiers) != 0;
if (IsClickedNodeSelected ((int)evnt.X, (int)evnt.Y) && MultipleNodesSelected () && !withModifier) {
res = true;
}
if (!res)
res = base.OnButtonPressEvent (evnt);
if (DoPopupMenu != null && evnt.TriggersContextMenu ()) {
if (!workaroundBug2157)
DoPopupMenu (evnt);
return true;
}
return res;
}
示例4: OnButtonPressEvent
protected override bool OnButtonPressEvent (Gdk.EventButton evnt)
{
if (!evnt.TriggersContextMenu ()) {
return base.OnButtonPressEvent (evnt);
}
//pass click to base it it can update the selection
//unless the node is already selected, in which case we don't want to change the selection
bool res = false;
if (!IsClickedNodeSelected ((int)evnt.X, (int)evnt.Y)) {
res = base.OnButtonPressEvent (evnt);
}
if (DoPopupMenu != null) {
DoPopupMenu (evnt);
return true;
}
return res;
}
示例5: OnButtonPressEvent
protected override bool OnButtonPressEvent (Gdk.EventButton evnt)
{
bool keepPos = false;
double vpos = 0;
bool ctxMenu = evnt.TriggersContextMenu ();
bool handled = false;
if (!ctxMenu) {
TreePath path;
GetPathAtPos ((int)evnt.X, (int)evnt.Y, out path);
if (path != null && path.Depth == 2) {
vpos = Vadjustment.Value;
keepPos = true;
if (Selection.PathIsSelected (path) && Selection.GetSelectedRows ().Length == 1 && evnt.Button == 1) {
if (evnt.Type == Gdk.EventType.TwoButtonPress)
DiffLineActivated?.Invoke (this, EventArgs.Empty);
handled = true;
}
}
}
handled = handled || (
IsClickedNodeSelected ((int)evnt.X, (int)evnt.Y)
&& this.Selection.GetSelectedRows ().Length > 1
&& (evnt.State & selectionModifiers) == 0);
if (!handled)
handled = base.OnButtonPressEvent (evnt);
if (ctxMenu) {
if (DoPopupMenu != null)
DoPopupMenu (evnt);
handled = true;
}
if (keepPos)
Vadjustment.Value = vpos;
return handled;
示例6: OnButtonPressEvent
protected override bool OnButtonPressEvent(Gdk.EventButton ev)
{
if (!ev.TriggersContextMenu () && ev.Button == 1) {
foreach (ChartCursor cursor in cursors) {
int cx, cy;
GetPoint (cursor.Value, cursor.Value, out cx, out cy);
if (cursor.Dimension == AxisDimension.X) {
if (Math.Abs (ev.X - cx) <= 2 || (ev.Y < top && (Math.Abs (ev.X - cx) <= cursor.HandleSize/2))) {
activeCursor = cursor;
draggingCursor = true;
activeCursor.ShowValueLabel = true;
QueueDraw ();
break;
}
} else {
// Implement
}
}
if (enableSelection && !draggingCursor) {
selectionStart.Visible = true;
selectionEnd.Visible = true;
double x, y;
GetValue ((int)ev.X, (int)ev.Y, out x, out y);
// avoid cursor swaping
ChartCursor c1 = selectionStart;
ChartCursor c2 = selectionEnd;
c1.Value = x;
c2.Value = x;
activeCursor = selectionEnd;
activeCursor.ShowValueLabel = true;
draggingCursor = true;
QueueDraw ();
}
if (draggingCursor)
return true;
}
return base.OnButtonPressEvent (ev);
}
示例7: OnButtonReleaseEvent
protected override bool OnButtonReleaseEvent (Gdk.EventButton evnt)
{
if (tabActivated) {
tabActivated = false;
if (item.Status == DockItemStatus.AutoHide)
item.Status = DockItemStatus.Dockable;
else
item.Status = DockItemStatus.AutoHide;
}
else if (!evnt.TriggersContextMenu () && evnt.Button == 1) {
frame.DockInPlaceholder (item);
frame.HidePlaceholder ();
if (GdkWindow != null)
GdkWindow.Cursor = null;
frame.Toplevel.KeyPressEvent -= HeaderKeyPress;
frame.Toplevel.KeyReleaseEvent -= HeaderKeyRelease;
}
tabPressed = false;
return base.OnButtonReleaseEvent (evnt);
}
示例8: OnButtonPressEvent
protected override bool OnButtonPressEvent (Gdk.EventButton evnt)
{
if (evnt.TriggersContextMenu ()) {
item.ShowDockPopupMenu (evnt.Time);
return false;
} else if (evnt.Button == 1) {
if (evnt.Type == Gdk.EventType.ButtonPress) {
tabPressed = true;
pressX = evnt.X;
pressY = evnt.Y;
} else if (evnt.Type == Gdk.EventType.TwoButtonPress) {
tabActivated = true;
}
}
return base.OnButtonPressEvent (evnt);
}
示例9: OnButtonPressEvent
protected override bool OnButtonPressEvent (Gdk.EventButton evnt)
{
if (!evnt.TriggersContextMenu () && evnt.Button == 1)
PopupQuickFixMenu (evnt);
return base.OnButtonPressEvent (evnt);
}
示例10: OnButtonPressEvent
protected override bool OnButtonPressEvent (Gdk.EventButton e)
{
if (e.TriggersContextMenu ()) {
return base.OnButtonPressEvent (e);
}
if (e.Type == Gdk.EventType.ButtonPress) {
if (window != null) {
DestroyWindow ();
} else {
this.GrabFocus ();
if (DataProvider != null) {
DataProvider.Reset ();
if (DataProvider.IconCount > 0) {
window = new DropDownBoxListWindow (DataProvider);
window.list.SelectItem += delegate {
SetItem (window.list.Selection);
};
PositionListWindow ();
window.SelectItem (CurrentItem);
}
}
}
}
return base.OnButtonPressEvent (e);
}
示例11: OnButtonPressEvent
protected override bool OnButtonPressEvent (Gdk.EventButton evnt)
{
if (DoPopupMenu != null && evnt.TriggersContextMenu ()) {
int tab = FindTabAtPosition (evnt.XRoot, evnt.YRoot);
if (tab >= 0) {
DoPopupMenu (tab, evnt);
return true;
}
}
return base.OnButtonPressEvent (evnt);
}
示例12: OnButtonPressEvent
protected override bool OnButtonPressEvent (Gdk.EventButton e)
{
if (e.TriggersContextMenu ()) {
int sx,sy;
this.GdkWindow.GetOrigin (out sx, out sy);
int rx = (int)e.XRoot - sx;
int ry = (int)e.YRoot - sy;
foreach (DockToolbarPanel p in panels) {
if (p.Allocation.Contains (rx, ry))
OnPanelClick (e, p.Placement);
}
}
return base.OnButtonPressEvent (e);
}
示例13: OnButtonPressEvent
protected override bool OnButtonPressEvent (Gdk.EventButton evnt)
{
if (evnt.TriggersContextMenu ()) {
it.ShowDockPopupMenu (evnt.Time);
} else if (evnt.Button == 1) {
if (evnt.Type == Gdk.EventType.TwoButtonPress)
it.Status = DockItemStatus.Dockable;
else
AutoShow ();
}
return base.OnButtonPressEvent (evnt);
}
示例14: OnButtonPressEvent
protected override bool OnButtonPressEvent(Gdk.EventButton evnt)
{
if (evnt.TriggersContextMenu())
{
TabStrip tabStrip = null;
if (Parent is TabStrip.ITabStripBox)
tabStrip = ((TabStrip.ITabStripBox)Parent).TabStrip;
item.ShowDockPopupMenu(evnt.Time, tabStrip);
return false;
}
else if (evnt.Button == 1)
{
if (evnt.Type == Gdk.EventType.ButtonPress)
{
tabPressed = true;
pressX = evnt.X;
pressY = evnt.Y;
}
#if false
else if (evnt.Type == Gdk.EventType.TwoButtonPress)
{
tabActivated = true;
}
#endif
}
return base.OnButtonPressEvent(evnt);
}
示例15: OnButtonPressEvent
protected override bool OnButtonPressEvent (Gdk.EventButton evnt)
{
if (bar.Frame.OverlayWidgetVisible)
return false;
if (evnt.TriggersContextMenu ()) {
it.ShowDockPopupMenu (evnt.Time);
} else if (evnt.Button == 1) {
if (evnt.Type == Gdk.EventType.TwoButtonPress) {
// Instead of changing the state of the pad here, do it when the button is released.
// Changing the state will make this bar item to vanish before the ReleaseEvent is received, and in this
// case the ReleaseEvent may be fired on another widget that is taking the space of this bar item.
// This was happening for example with the feedback button.
itemActivated = true;
} else {
AutoShow ();
it.Present (true);
}
}
return true;
}