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


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

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


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

示例1: 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

示例2: keyPressed

//==============================================================================
bool CodeEditorComponent::keyPressed (const KeyPress& key)
{
    if (! TextEditorKeyMapper<CodeEditorComponent>::invokeKeyFunction (*this, key))
    {
        if (key == KeyPress::tabKey || key.getTextCharacter() == '\t')      handleTabKey();
        else if (key == KeyPress::returnKey)                                handleReturnKey();
        else if (key == KeyPress::escapeKey)                                handleEscapeKey();
        else if (key == KeyPress ('[', ModifierKeys::commandModifier, 0))   unindentSelection();
        else if (key == KeyPress (']', ModifierKeys::commandModifier, 0))   indentSelection();
        else if (key.getTextCharacter() >= ' ')                             insertTextAtCaret (String::charToString (key.getTextCharacter()));
        else                                                                return false;
    }

    pimpl->handleUpdateNowIfNeeded();
    return true;
}
开发者ID:grimtraveller,项目名称:mlrVST,代码行数:17,代码来源:juce_CodeEditorComponent.cpp

示例3: keyPressed

// Component::keyPressed  (  const KeyPress &  key   ) 
bool NumberBox::keyPressed(const KeyPress & key) {
  // Bouml preserved body begin 0004868D
	if(String("0123456789.,-+").indexOfChar(key.getTextCharacter()) > -1 || key == KeyPress::returnKey  || key.isKeyCode (KeyPress::escapeKey) )
	{
		TextEditor::keyPressed(key);
	}
	return false;
  // Bouml preserved body end 0004868D
}
开发者ID:Amcut,项目名称:pizmidi,代码行数:10,代码来源:NumberBox.cpp

示例4: keyPressed

bool MainContentComponent::keyPressed(const KeyPress& key)
{
    switch (key.getTextCharacter()) {
        case 'w':
            Copter->setBounds(xpos,ypos-=8,/*getWidth()*0.3,getHeight()*0.3*/80,60);
            return true;
            break;
            
        case 's':
            Copter->setBounds(xpos,ypos+=5,/*getWidth()*0.3,getHeight()*0.3*/80,60);
            return true;
            break;
            
    }
    return false;
}
开发者ID:RitheshKumar,项目名称:VoCopter-Project,代码行数:16,代码来源:MainComponent.cpp

示例5: addKeyPress

void KeyPressMappingSet::addKeyPress (const CommandID commandID, const KeyPress& newKeyPress, int insertIndex)
{
    // If you specify an upper-case letter but no shift key, how is the user supposed to press it!?
    // Stick to lower-case letters when defining a keypress, to avoid ambiguity.
    jassert (! (CharacterFunctions::isUpperCase (newKeyPress.getTextCharacter())
                 && ! newKeyPress.getModifiers().isShiftDown()));

    if (findCommandForKeyPress (newKeyPress) != commandID)
    {
        if (newKeyPress.isValid())
        {
            for (int i = mappings.size(); --i >= 0;)
            {
                if (mappings.getUnchecked(i)->commandID == commandID)
                {
                    mappings.getUnchecked(i)->keypresses.insert (insertIndex, newKeyPress);

                    sendChangeMessage();
                    return;
                }
            }

            if (const ApplicationCommandInfo* const ci = commandManager.getCommandForID (commandID))
            {
                CommandMapping* const cm = new CommandMapping();
                cm->commandID = commandID;
                cm->keypresses.add (newKeyPress);
                cm->wantsKeyUpDownCallbacks = (ci->flags & ApplicationCommandInfo::wantsKeyUpDownCallbacks) != 0;

                mappings.add (cm);
                sendChangeMessage();
            }
            else
            {
                // If you hit this, you're trying to attach a keypress to a command ID that
                // doesn't exist, so the key is not being attached.
                jassertfalse;
            }
        }
    }
}
开发者ID:RomanKubiak,项目名称:amnesia,代码行数:41,代码来源:juce_KeyPressMappingSet.cpp

示例6: keyPressed

bool TextBuffer::keyPressed (const KeyPress& key)
{

  //std::cout << "keyPressed: " << key.getTextDescription().toUTF8() << T("\n");
  if (isMatching()) 
    stopMatching();
  TextEditor::keyPressed(key);
  juce_wchar chr=key.getTextCharacter();
  CommandID com=CommandIDs::EditorTextChanged;

  if (key.getKeyCode()==KeyPress::returnKey)
    com=CommandIDs::EditorNewline;
  else if (key.getKeyCode()==KeyPress::backspaceKey)
    com=CommandIDs::EditorBackspace;
  else if (!testFlag(EditFlags::MatchingOff) &&
	   (chr==')' || ((textid==TextIDs::Sal) && chr=='}') || ((textid==TextIDs::Sal2) && chr=='}')))
    matchParens();
  colorizeAfterChange(com);
  setFlag(EditFlags::NeedsSave);
  return true;
}
开发者ID:josephzizys,项目名称:CM,代码行数:21,代码来源:TextEditor.cpp

示例7: keyPressed

//==============================================================================
bool CodeEditorComponent::keyPressed (const KeyPress& key)
{
    const bool moveInWholeWordSteps = key.getModifiers().isCtrlDown() || key.getModifiers().isAltDown();
    const bool shiftDown = key.getModifiers().isShiftDown();

    if (key.isKeyCode (KeyPress::leftKey))
    {
        cursorLeft (moveInWholeWordSteps, shiftDown);
    }
    else if (key.isKeyCode (KeyPress::rightKey))
    {
        cursorRight (moveInWholeWordSteps, shiftDown);
    }
    else if (key.isKeyCode (KeyPress::upKey))
    {
        if (key.getModifiers().isCtrlDown() && ! shiftDown)
            scrollDown();
#if JUCE_MAC
        else if (key.getModifiers().isCommandDown())
            goToStartOfDocument (shiftDown);
#endif
        else
            cursorUp (shiftDown);
    }
    else if (key.isKeyCode (KeyPress::downKey))
    {
        if (key.getModifiers().isCtrlDown() && ! shiftDown)
            scrollUp();
#if JUCE_MAC
        else if (key.getModifiers().isCommandDown())
            goToEndOfDocument (shiftDown);
#endif
        else
            cursorDown (shiftDown);
    }
    else if (key.isKeyCode (KeyPress::pageDownKey))
    {
        pageDown (shiftDown);
    }
    else if (key.isKeyCode (KeyPress::pageUpKey))
    {
        pageUp (shiftDown);
    }
    else if (key.isKeyCode (KeyPress::homeKey))
    {
        if (moveInWholeWordSteps)
            goToStartOfDocument (shiftDown);
        else
            goToStartOfLine (shiftDown);
    }
    else if (key.isKeyCode (KeyPress::endKey))
    {
        if (moveInWholeWordSteps)
            goToEndOfDocument (shiftDown);
        else
            goToEndOfLine (shiftDown);
    }
    else if (key.isKeyCode (KeyPress::backspaceKey))
    {
        backspace (moveInWholeWordSteps);
    }
    else if (key.isKeyCode (KeyPress::deleteKey))
    {
        deleteForward (moveInWholeWordSteps);
    }
    else if (key == KeyPress (T('c'), ModifierKeys::commandModifier, 0))
    {
        copy();
    }
    else if (key == KeyPress (T('x'), ModifierKeys::commandModifier, 0))
    {
        copyThenCut();
    }
    else if (key == KeyPress (T('v'), ModifierKeys::commandModifier, 0))
    {
        paste();
    }
    else if (key == KeyPress (T('z'), ModifierKeys::commandModifier, 0))
    {
        undo();
    }
    else if (key == KeyPress (T('y'), ModifierKeys::commandModifier, 0)
              || key == KeyPress (T('z'), ModifierKeys::commandModifier | ModifierKeys::shiftModifier, 0))
    {
        redo();
    }
    else if (key == KeyPress (T('a'), ModifierKeys::commandModifier, 0))
    {
        selectAll();
    }
    else if (key == KeyPress::tabKey || key.getTextCharacter() == '\t')
    {
        insertTabAtCaret();
    }
    else if (key == KeyPress::returnKey)
    {
        newTransaction();
        insertTextAtCaret (document.getNewLineCharacters());
    }
//.........这里部分代码省略.........
开发者ID:alessandropetrolati,项目名称:juced,代码行数:101,代码来源:juce_CodeEditorComponent.cpp


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