本文整理汇总了C++中ModifierKeys::isCommandDown方法的典型用法代码示例。如果您正苦于以下问题:C++ ModifierKeys::isCommandDown方法的具体用法?C++ ModifierKeys::isCommandDown怎么用?C++ ModifierKeys::isCommandDown使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModifierKeys
的用法示例。
在下文中一共展示了ModifierKeys::isCommandDown方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: selectBasedOnModifiers
void selectBasedOnModifiers (TreeViewItem* const item, const ModifierKeys& modifiers)
{
TreeViewItem* firstSelected = 0;
if (modifiers.isShiftDown() && ((firstSelected = owner.getSelectedItem (0)) != 0))
{
TreeViewItem* const lastSelected = owner.getSelectedItem (owner.getNumSelectedItems() - 1);
jassert (lastSelected != 0);
int rowStart = firstSelected->getRowNumberInTree();
int rowEnd = lastSelected->getRowNumberInTree();
if (rowStart > rowEnd)
swapVariables (rowStart, rowEnd);
int ourRow = item->getRowNumberInTree();
int otherEnd = ourRow < rowEnd ? rowStart : rowEnd;
if (ourRow > otherEnd)
swapVariables (ourRow, otherEnd);
for (int i = ourRow; i <= otherEnd; ++i)
owner.getItemOnRow (i)->setSelected (true, false);
}
else
{
const bool cmd = modifiers.isCommandDown();
item->setSelected ((! cmd) || ! item->isSelected(), ! cmd);
}
}
示例2: selectRowsBasedOnModifierKeys
void ListBox::selectRowsBasedOnModifierKeys (const int row,
const ModifierKeys& mods,
const bool isMouseUpEvent)
{
if (multipleSelection && mods.isCommandDown())
{
flipRowSelection (row);
}
else if (multipleSelection && mods.isShiftDown() && lastRowSelected >= 0)
{
selectRangeOfRows (lastRowSelected, row);
}
else if ((! mods.isPopupMenu()) || ! isRowSelected (row))
{
selectRowInternal (row, false, ! (multipleSelection && (! isMouseUpEvent) && isRowSelected (row)), true);
}
}
示例3: buttonClicked
//.........这里部分代码省略.........
noteNumber = i;
}
}
}
else
{
//redraw and re-set what was previously there
//bit convoluted to clear everything above
//just to redraw it in a certain situation.
//Is there a better way to code it?
for (int row = 0; row < 12; row++)
{
if (padIndex == 0)
{
setKeyDisplay (PAD_SETTINGS->getSequencerMidiNote(row), true);
selectedKeys.addIfNotAlreadyThere(PAD_SETTINGS->getSequencerMidiNote(row));
}
}
}
recentlyUpdated = true;
}
}
}
//=========================================================================
//=========================================================================
//cmd-click to select mutiple notes for midi pads or custom scale for sequencer pads
else if (modifier.isCommandDown() == true)
{
//don't intially clear the keys
//=========================================================================
//MIDI MODE CMD-CLICK
//if the number of selected keys is less than the number of selected pads
if (selectedKeys.size() < selectedPads.size())
{
//cycle through the SELECTED KEYS in the order they were selected,
//applying them to the selected pads in the order they were selected.
for (int padIndex = 0; padIndex < selectedKeys.size(); padIndex++)
{
int padNum = selectedPads[padIndex];
if (PAD_SETTINGS->getMode() == 1) //Midi Mode
{
PAD_SETTINGS->setMidiNote(selectedKeys[padIndex]);
//update the GUI
if (padIndex == 0)
{
//add the key
setKeyDisplay (i, true);
selectedKeys.addIfNotAlreadyThere(i);
noteNumber = selectedKeys[0];
}
}
}