当前位置: 首页>>代码示例>>C++>>正文


C++ Flags::stripCURSOR方法代码示例

本文整理汇总了C++中Flags::stripCURSOR方法的典型用法代码示例。如果您正苦于以下问题:C++ Flags::stripCURSOR方法的具体用法?C++ Flags::stripCURSOR怎么用?C++ Flags::stripCURSOR使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Flags的用法示例。


在下文中一共展示了Flags::stripCURSOR方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

TEST(Flags, stripCURSOR) {
  Flags mask = ModifierFlag::SHIFT_L | ModifierFlag::CONTROL_R | ModifierFlag::COMMAND_R;
  Flags flags = mask;
  EXPECT_EQ(mask, flags.stripCURSOR());

  flags.add(ModifierFlag::CURSOR);
  EXPECT_EQ(mask, flags.stripCURSOR());
}
开发者ID:CharlseLee,项目名称:KeyRemap4MacBook,代码行数:8,代码来源:test.cpp

示例2:

  void
  KeyCode::reverseNormalizeKey(KeyCode& key, Flags& flags, EventType eventType, KeyboardType keyboardType)
  {
    if (! Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_general_disable_numpad_hack)) {
      for (unsigned int i = 0; i < sizeof(fnkeyhack) / sizeof(fnkeyhack[0]); ++i) {
        if (fnkeyhack[i].reverse(key, flags, eventType)) break;
      }
    }

    if (keyboardType == KeyboardType::POWERBOOK ||
        keyboardType == KeyboardType::POWERBOOK_G4 ||
        keyboardType == KeyboardType::POWERBOOK_G4_TI) {
      if (key == KeyCode::ENTER) { key = KeyCode::ENTER_POWERBOOK; }
    }

    // ------------------------------------------------------------
    // Don't add ModifierFlag::FN automatically for F-keys, PageUp/PageDown/Home/End and Forward Delete.
    //
    // PageUp/PageDown/Home/End and Forward Delete are entered by fn+arrow, fn+delete normally,
    // And, from Cocoa Application, F-keys and PageUp,... keys have Fn modifier
    // even if Fn key is not pressed actually.
    // So, it's natural adding ModifierFlag::FN to these keys.
    // However, there is a reason we must not add ModifierFlag::FN to there keys.
    //
    // Mission Control may have "fn" as shortcut key.
    // If we add ModifierFlag::FN here,
    // "XXX to PageUp" launches Mission Control because Mission Control recognizes fn key was pressed.
    //
    // It's not intended behavior from users.
    // Therefore, we don't add ModifierFlag::FN for these keys.

    // ------------------------------------------------------------
    // set ModifierFlag::KEYPAD, ModifierFlag::CURSOR
    flags.stripCURSOR().stripKEYPAD();

    // Note: KEYPAD_CLEAR, KEYPAD_COMMA have no ModifierFlag::KEYPAD bit.
    if (key == KeyCode::KEYPAD_0 || key == KeyCode::KEYPAD_1 || key == KeyCode::KEYPAD_2 ||
        key == KeyCode::KEYPAD_3 || key == KeyCode::KEYPAD_4 || key == KeyCode::KEYPAD_5 ||
        key == KeyCode::KEYPAD_6 || key == KeyCode::KEYPAD_7 || key == KeyCode::KEYPAD_8 ||
        key == KeyCode::KEYPAD_9 ||
        key == KeyCode::KEYPAD_DOT ||
        key == KeyCode::KEYPAD_MULTIPLY ||
        key == KeyCode::KEYPAD_PLUS ||
        key == KeyCode::KEYPAD_SLASH ||
        key == KeyCode::KEYPAD_MINUS ||
        key == KeyCode::KEYPAD_EQUAL) {
      flags.add(ModifierFlag::KEYPAD);
    }

    if (key == KeyCode::CURSOR_UP ||
        key == KeyCode::CURSOR_DOWN ||
        key == KeyCode::CURSOR_LEFT ||
        key == KeyCode::CURSOR_RIGHT) {
      flags.add(ModifierFlag::CURSOR);
    }
  }
开发者ID:Bilalh,项目名称:KeyRemap4MacBook,代码行数:56,代码来源:KeyCode.cpp


注:本文中的Flags::stripCURSOR方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。