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


C++ KeyPress::isKeyCode方法代码示例

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


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

示例1: keyPressed

bool AlertWindow::keyPressed (const KeyPress& key)
{
    for (int i = buttons.size(); --i >= 0;)
    {
        TextButton* const b = buttons.getUnchecked(i);

        if (b->isRegisteredForShortcut (key))
        {
            b->triggerClick();
            return true;
        }
    }

    if (key.isKeyCode (KeyPress::escapeKey) && escapeKeyCancels && buttons.size() == 0)
    {
        exitModalState (0);
        return true;
    }
    else if (key.isKeyCode (KeyPress::returnKey) && buttons.size() == 1)
    {
        buttons.getUnchecked(0)->triggerClick();
        return true;
    }

    return false;
}
开发者ID:Amcut,项目名称:pizmidi,代码行数:26,代码来源:juce_AlertWindow.cpp

示例2: keyPressed

bool ComponentLayoutEditor::keyPressed (const KeyPress& key)
{
    const bool snap = key.getModifiers().isAltDown();
    const bool stretch = key.getModifiers().isShiftDown();

    const int amount = snap ? document.getSnappingGridSize() + 1
                            : 1;

    if (key.isKeyCode (KeyPress::rightKey))
    {
        moveOrStretch (layout, amount, 0, snap, stretch);
    }
    else if (key.isKeyCode (KeyPress::downKey))
    {
        moveOrStretch (layout, 0,amount, snap, stretch);
    }
    else if (key.isKeyCode (KeyPress::leftKey))
    {
        moveOrStretch (layout, -amount, 0, snap, stretch);
    }
    else if (key.isKeyCode (KeyPress::upKey))
    {
        moveOrStretch (layout, 0, -amount, snap, stretch);
    }
    else
    {
        return false;
    }

    return true;
}
开发者ID:AlessandroGiacomini,项目名称:pyplasm,代码行数:31,代码来源:jucer_ComponentLayoutEditor.cpp

示例3: keyPressed

//==============================================================================
bool ComboBox::keyPressed (const KeyPress& key)
{
    if (key.isKeyCode (KeyPress::upKey) || key.isKeyCode (KeyPress::leftKey))
    {
        int index = getSelectedItemIndex() - 1;

        while (index >= 0 && ! selectIfEnabled (index))
            --index;

        return true;
    }
    else if (key.isKeyCode (KeyPress::downKey) || key.isKeyCode (KeyPress::rightKey))
    {
        int index = getSelectedItemIndex() + 1;

        while (index < getNumItems() && ! selectIfEnabled (index))
            ++index;

        return true;
    }
    else if (key.isKeyCode (KeyPress::returnKey))
    {
        showPopup();
        return true;
    }

    return false;
}
开发者ID:sonic59,项目名称:JuceS1Text,代码行数:29,代码来源:juce_ComboBox.cpp

示例4: keyPressed

bool CommandTable::keyPressed(const KeyPress& k) {
  if (k.isKeyCode(KeyPress::deleteKey) && getSelectedRow() != -1) {
    bool last = getSelectedRow() == getNumRows() - 1;
    ((CommandTableModel*)getModel())->removeRow(static_cast<size_t>(getSelectedRow()));
    updateContent();
    if (last) {
      // keep selection at the end
      selectRow(getNumRows() - 1);
    }
    return true;
  }
  if (k.isKeyCode(KeyPress::downKey) && getSelectedRow() != -1 && getSelectedRow() < getNumRows() - 1) {
    selectRow(getSelectedRow() + 1);
    return true;
  }
  if (k.isKeyCode(KeyPress::upKey) && getSelectedRow() > 0 && getNumRows() > 1) {
    selectRow(getSelectedRow() - 1);
    return true;
  }
  if (k.isKeyCode(KeyPress::pageUpKey) && getNumRows() > 0) {
    selectRow(0);
    return true;
  }
  if (k.isKeyCode(KeyPress::pageDownKey) && getNumRows() > 0) {
    selectRow(getNumRows() - 1);
    return true;
  }
  return false;
}
开发者ID:Snaptags,项目名称:MIDI2LR,代码行数:29,代码来源:CommandTable.cpp

示例5: keyPressed

bool JucerDocumentEditor::keyPressed (const KeyPress& key)
{
    if (key.isKeyCode (KeyPress::deleteKey) || key.isKeyCode (KeyPress::backspaceKey))
    {
        IntrojucerApp::getCommandManager().invokeDirectly (StandardApplicationCommandIDs::del, true);
        return true;
    }

    return false;
}
开发者ID:Xaetrz,项目名称:AddSyn,代码行数:10,代码来源:jucer_JucerDocumentEditor.cpp

示例6: keyPressed

bool GraphComponent::keyPressed (const KeyPress& key)
{
    if (key.isKeyCode (KeyPress::leftKey))
    {
        for (int i = 0; i < selectedNodes.getNumSelected (); i++)
        {
            GraphNodeComponent* selected = selectedNodes.getSelectedItem (i);
            if (selected != inputs && selected != outputs)
                selected->setTopLeftPosition (selected->getX() - 1, selected->getY());
        }
    }
    else if (key.isKeyCode (KeyPress::rightKey))
    {
        for (int i = 0; i < selectedNodes.getNumSelected (); i++)
        {
            GraphNodeComponent* selected = selectedNodes.getSelectedItem (i);
            if (selected != inputs && selected != outputs)
                selected->setTopLeftPosition (selected->getX() + 1, selected->getY());
        }
    }
    else if (key.isKeyCode (KeyPress::upKey))
    {
        for (int i = 0; i < selectedNodes.getNumSelected (); i++)
        {
            GraphNodeComponent* selected = selectedNodes.getSelectedItem (i);
            if (selected != inputs && selected != outputs)
                selected->setTopLeftPosition (selected->getX(), selected->getY() - 1);
        }
    }
    else if (key.isKeyCode (KeyPress::downKey))
    {
        for (int i = 0; i < selectedNodes.getNumSelected (); i++)
        {
            GraphNodeComponent* selected = selectedNodes.getSelectedItem (i);
            if (selected != inputs && selected != outputs)
                selected->setTopLeftPosition (selected->getX(), selected->getY() + 1);
        }
    }
    else if (key.isKeyCode (KeyPress::deleteKey))
    {
        closeSelectedPlugins ();
    }
    else
    {
        return Component::keyPressed (key);
    }

    return true;
}
开发者ID:alessandropetrolati,项目名称:juced,代码行数:49,代码来源:GraphComponent.cpp

示例7: keyPressed

//==============================================================================
bool CodeEditorComponent::keyPressed (const KeyPress& key)
{
    if (! TextEditorKeyMapper<CodeEditorComponent>::invokeKeyFunction (*this, key))
    {
        if (key == KeyPress::tabKey || key.getTextCharacter() == '\t')
        {
            insertTabAtCaret();
        }
        else if (key == KeyPress::returnKey)
        {
            newTransaction();
            insertTextAtCaret (document.getNewLineCharacters());
        }
        else if (key.isKeyCode (KeyPress::escapeKey))
        {
            newTransaction();
        }
        else if (key.getTextCharacter() >= ' ')
        {
            insertTextAtCaret (String::charToString (key.getTextCharacter()));
        }
        else
        {
            return false;
        }
    }

    return true;
}
开发者ID:SonicPotions,项目名称:editor,代码行数:30,代码来源:juce_CodeEditorComponent.cpp

示例8: keyPressed

bool ColumnFileBrowserContents::keyPressed (const KeyPress& key)
{
    if (key.isKeyCode (KeyPress::leftKey))
    {
        if (activeColumn != 0)
        {
            FileListComponent* list = dynamic_cast<FileListComponent*> (columns[activeColumn]->getDisplayComponent());
            list->deselectAllRows();
            
            int newActiveColumn = jmax (0, activeColumn - 1);
            columns[newActiveColumn]->selectionChanged();
            columns[newActiveColumn]->grabKeyboardFocus();
        }
        
        return true;
    }
    else if (key.isKeyCode (KeyPress::rightKey))
    {
        if (columns[activeColumn]->getNumSelectedFiles() == 1
            && columns[activeColumn]->getSelectedFile (0).isDirectory()
            && getNumValidChildFiles (columns[activeColumn]->getSelectedFile (0)) > 0)
        {
            int newActiveColumn = activeColumn + 1;
            addColumn (columns[activeColumn]->getSelectedFile (0));
            
            FileListComponent* list = dynamic_cast<FileListComponent*> (columns[newActiveColumn]->getDisplayComponent());

            if (list != nullptr)
            {
                ListBoxModel* model = list->getModel();
                
                if (model != nullptr)
                {
                    if (model->getNumRows() > 0)
                    {
                        columns[newActiveColumn]->grabKeyboardFocus();
                        list->selectRow (0);
                    }
                }
            }
        }
        
        return true;
    }
    
    return false;
}
开发者ID:dennyabrain,项目名称:DISTRHO,代码行数:47,代码来源:dRowAudio_ColumnFileBrowser.cpp

示例9: keyPressed

bool Button::keyPressed (const KeyPress& key)
{
    if (isEnabled() && key.isKeyCode (KeyPress::returnKey))
    {
        triggerClick();
        return true;
    }

    return false;
}
开发者ID:2DaT,项目名称:Obxd,代码行数:10,代码来源:juce_Button.cpp

示例10: keyPressed

bool CallOutBox::keyPressed (const KeyPress& key)
{
    if (key.isKeyCode (KeyPress::escapeKey))
    {
        inputAttemptWhenModal();
        return true;
    }

    return false;
}
开发者ID:ElePhontitis,项目名称:Juce,代码行数:10,代码来源:juce_CallOutBox.cpp

示例11: keyPressed

bool MenuBarComponent::keyPressed (const KeyPress& key)
{
    bool used = false;
    const int numMenus = menuNames.size();
    const int currentIndex = jlimit (0, menuNames.size() - 1, currentPopupIndex);

    if (key.isKeyCode (KeyPress::leftKey))
    {
        showMenu ((currentIndex + numMenus - 1) % numMenus);
        used = true;
    }
    else if (key.isKeyCode (KeyPress::rightKey))
    {
        showMenu ((currentIndex + 1) % numMenus);
        used = true;
    }

    return used;
}
开发者ID:sonic59,项目名称:JuceText,代码行数:19,代码来源:juce_MenuBarComponent.cpp

示例12:

bool ApiCollection::MethodItem::keyPressed(const KeyPress& key)
{
	if (key.isKeyCode(KeyPress::returnKey))
	{
		insertIntoCodeEditor();
		return true;
	}

	return false;
}
开发者ID:christophhart,项目名称:HISE,代码行数:10,代码来源:ApiBrowser.cpp

示例13: keyPressed

bool SlicerChannelSelectorComponent::keyPressed (const KeyPress& key, Component* originatingComponent)
{
    // Collapse component by clicking "ESC" key either on component or in the TextEditor
    if ( (dynamic_cast<TextEditor*> (originatingComponent) != nullptr
            || originatingComponent == this)
        && key.isKeyCode (KeyPress::escapeKey))
    {
        setCollapsed (true);
    }

    return false;
}
开发者ID:cstawarz,项目名称:open-ephys-plugin-gui,代码行数:12,代码来源:ChannelSelector.cpp

示例14: keyPressed

bool ScrollBar::keyPressed (const KeyPress& key)
{
    if (! isVisible())
        return false;

    if (key.isKeyCode (KeyPress::upKey)
         || key.isKeyCode (KeyPress::leftKey))          moveScrollbarInSteps (-1);
    else if (key.isKeyCode (KeyPress::downKey)
              || key.isKeyCode (KeyPress::rightKey))    moveScrollbarInSteps (1);
    else if (key.isKeyCode (KeyPress::pageUpKey))       moveScrollbarInPages (-1);
    else if (key.isKeyCode (KeyPress::pageDownKey))     moveScrollbarInPages (1);
    else if (key.isKeyCode (KeyPress::homeKey))         scrollToTop();
    else if (key.isKeyCode (KeyPress::endKey))          scrollToBottom();
    else                                                return false;

    return true;
}
开发者ID:sonic59,项目名称:JuceS1Text,代码行数:17,代码来源:juce_ScrollBar.cpp

示例15: keyPressed

//==============================================================================
bool ComboBox::keyPressed (const KeyPress& key)
{
    bool used = false;

    if (key.isKeyCode (KeyPress::upKey)
        || key.isKeyCode (KeyPress::leftKey))
    {
        setSelectedItemIndex (jmax (0, getSelectedItemIndex() - 1));
        used = true;
    }
    else if (key.isKeyCode (KeyPress::downKey)
              || key.isKeyCode (KeyPress::rightKey))
    {
        setSelectedItemIndex (jmin (getSelectedItemIndex() + 1, getNumItems() - 1));
        used = true;
    }
    else if (key.isKeyCode (KeyPress::returnKey))
    {
        showPopup();
        used = true;
    }

    return used;
}
开发者ID:alessandropetrolati,项目名称:juced,代码行数:25,代码来源:juce_ComboBox.cpp


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