本文整理汇总了C#中NSEvent.modifierFlags方法的典型用法代码示例。如果您正苦于以下问题:C# NSEvent.modifierFlags方法的具体用法?C# NSEvent.modifierFlags怎么用?C# NSEvent.modifierFlags使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NSEvent
的用法示例。
在下文中一共展示了NSEvent.modifierFlags方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: mouseDown
public new void mouseDown(NSEvent e)
{
if ((e.modifierFlags() & Enums.NSAlternateKeyMask) != 0)
{
DoBuildUsingNamesOrder();
SuperCall(NSPopUpButton.Class, "mouseDown:", e);
DoBuildUsingOffsetsOrder();
}
else
SuperCall(NSPopUpButton.Class, "mouseDown:", e);
}
示例2: DoArrowKeys
private bool DoArrowKeys(NSEvent evt)
{
bool command = (evt.modifierFlags() & Enums.NSCommandKeyMask) == Enums.NSCommandKeyMask;
bool option = (evt.modifierFlags() & Enums.NSAlternateKeyMask) == Enums.NSAlternateKeyMask;
bool shift = (evt.modifierFlags() & Enums.NSShiftKeyMask) == Enums.NSShiftKeyMask;
if (evt.keyCode() == Constants.LeftArrowKey)
{
if (command && option)
{
// Cycle down through document windows.
DoActivateLowerWindow();
return true;
}
else if (option && shift)
{
// Extend the selection to the left using the previous word (for some reason Cocoa
// does not call selectionRangeForProposedRange_granularity for this).
if (DoExtendSelectionLeft())
return true;
}
else if (option)
{
// Move the insertion point to the start of the previous word.
if (DoMoveSelectionLeft())
return true;
}
}
else if (evt.keyCode() == Constants.RightArrowKey)
{
if (command && option)
{
// Cycle up through document windows.
DoActivateHigherWindow();
return true;
}
else if (option && shift)
{
// Extend the selection to the right of the next word.
if (DoExtendSelectionRight())
return true;
}
else if (option)
{
// Move the insertion point after the end of the next word.
if (DoMoveSelectionRight())
return true;
}
}
else if (evt.keyCode() == Constants.UpArrowKey)
{
if (command && option)
{
// Toggle between *.cpp/*.c/*.m and *.hpp/*.h files.
DoToggleHeader();
return true;
}
}
return false;
}
示例3: DoDeleteKey
private bool DoDeleteKey(NSEvent evt)
{
if (evt.keyCode() == Constants.DeleteKey)
{
var range = selectedRange();
if ((evt.modifierFlags() & Enums.NSShiftKeyMask) == Enums.NSShiftKeyMask)
{
if (range.length == 0)
{
// Shift-delete deletes the current line
DoDeleteLine(range.location);
return true;
}
}
else if (range.length == 0)
{
TextController controller = (TextController) window().windowController();
if (controller.Language != null && !controller.UsesTabs && !NSObject.IsNullOrNil(controller.SpacesText))
{
// If we're inserting N spaces for tabs then delete should delete N spaces at a time.
int count = DoGetSpaceCount(string_(), range.location - 1);
int length = (int) controller.SpacesText.length();
if (count >= length)
{
setSelectedRange(new NSRange(range.location - length, length));
delete(this);
return true;
}
}
}
}
return false;
}
示例4: DoTabKey
private bool DoTabKey(NSEvent evt)
{
if (evt.keyCode() == Constants.TabKey)
{
TextController controller = (TextController) window().windowController();
if ((evt.modifierFlags() & Enums.NSAlternateKeyMask) != 0)
{
if ((evt.modifierFlags() & Enums.NSShiftKeyMask) == 0)
{
// Option-tab selects the prev identifier.
if (DoSelectNextIdentifier(controller))
return true;
}
else
{
// Option-shift-tab selects the prev identifier.
if (DoSelectPreviousIdentifier(controller))
return true;
}
}
else if ((evt.modifierFlags() & Enums.NSCommandKeyMask) != 0)
{
}
else if ((evt.modifierFlags() & Enums.NSControlKeyMask) != 0)
{
}
else if ((evt.modifierFlags() & Enums.NSShiftKeyMask) != 0)
{
// Shift-tab with at least one line selected unindents lines
var selRange = selectedRange();
if (DoSelectionCrossesLines(selRange))
{
controller.shiftLeft(this);
return true;
}
}
else
{
var selRange = selectedRange();
if (selRange.location > 0 && selRange.length > 1)
{
// Tab with at least one line selected indents lines
if (DoSelectionCrossesLines(selRange))
{
controller.shiftRight(this);
return true;
}
}
else if (selRange.location > 0 && selRange.length == 0)
{
// Tab with no selection at the end of a blank line indents like the previous line.
if (DoMatchPriorLineTabs(selRange.location))
return true;
}
if (controller.Language != null && !controller.UsesTabs)
{
if (!NSObject.IsNullOrNil(controller.SpacesText))
{
this.insertText(controller.SpacesText);
return true;
}
}
}
}
return false;
}