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


C++ ModifierKeys类代码示例

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


在下文中一共展示了ModifierKeys类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
        }
    }
开发者ID:Labmind,项目名称:GUI,代码行数:29,代码来源:juce_TreeView.cpp

示例2: mouseDrag

void HoaMap::mouseDrag (const MouseEvent &event)
{
    Point<float> mouse = event.getPosition().toFloat();
    Point<float> newPos;
    ModifierKeys modifierKey = event.mods;
    // conversion en cartesien :
    //mouse.applyTransform(AffineTransform::translation(m_padding, m_padding));
    mouse.applyTransform(AffineTransform::fromTargetPoints(0, 0, -1, 1,
                                                           getPadWidth(), 0, 1, 1,
                                                           getPadWidth(), getPadWidth(), 1, -1));
    
    newPos = mouse;
    
    if (m_sourcePointed >= 0 && m_sourcePointed < m_nbSources) {
        setMouseCursor(MouseCursor::DraggingHandCursor);
        m_sources_dragState[m_sourcePointed] = -1; // reset dragging state
        m_sources_ValueChanged[m_sourcePointed] = 1;
        if (modifierKey.isShiftDown()) { // constrain move to distance
            setPolarCoordinates(m_sourcePointed, Tools::radius(newPos.x, newPos.y), m_sources[m_sourcePointed].getAzimuth());
        }
        else if (modifierKey.isCtrlDown()) { // constrain move to angle
            setPolarCoordinates(m_sourcePointed, m_sources[m_sourcePointed].getRadius(), Tools::angle(newPos.x, newPos.y));
        }
        else {
            setCartesianCoordinates(m_sourcePointed, newPos.x, newPos.y, sendNotificationSync);
        }
    }
}
开发者ID:dimibil,项目名称:HoaLibrary,代码行数:28,代码来源:HoaMap.cpp

示例3: modifierKeysChanged

void Ambix_encoderAudioProcessorEditor::modifierKeysChanged(const ModifierKeys &modifiers)
{
    
    if (modifiers.isShiftDown())
    {
        sld_el->setColour (Slider::thumbColourId, Colours::black);
        sld_el->setEnabled(false);
    }
    else
    {
        sld_el->setColour (Slider::thumbColourId, Colours::grey);
        sld_el->setEnabled(true);
    }
    
    
    if (modifiers.isCtrlDown())
    {
        sld_az->setColour (Slider::thumbColourId, Colours::black);
        sld_az->setEnabled(false);
    }
    else
    {
        sld_az->setColour (Slider::thumbColourId, Colours::grey);
        sld_az->setEnabled(true);
    }
    
}
开发者ID:JayaWei,项目名称:ambix,代码行数:27,代码来源:PluginEditor.cpp

示例4: buttonClicked

void BigClockEditor::buttonClicked (Button* buttonThatWasClicked) {
    ModifierKeys mousebutton = ModifierKeys::getCurrentModifiers();
    if (!mousebutton.isPopupMenu()) {
		if (buttonThatWasClicked==runButton)
		{
			getFilter()->setParameter(kRunWatch,1.f-getFilter()->getParameter(kRunWatch));
		}
		else if (buttonThatWasClicked==resetButton)
		{
			getFilter()->setParameter(kClearWatch,1.f);
		}
		else if (buttonThatWasClicked==infoLabel)
		{
			bool samplemode = getFilter()->getParameter(kSamples)>=0.5f;
			if (barsbeats && !samplemode) {
				barsbeats=false;
				getFilter()->setParameter(kBarsBeats, 0.0);
				getFilter()->setParameter(kSamples, 0.0);
			}
			else if (!barsbeats && !samplemode) {
				getFilter()->setParameter(kSamples, 1.0);
			}
			else if (samplemode) {
				barsbeats=true;
				getFilter()->setParameter(kBarsBeats, 1.0);
				getFilter()->setParameter(kSamples, 0.0);
			}
			updateParametersFromFilter();
		}
    }
}
开发者ID:Amcut,项目名称:pizmidi,代码行数:31,代码来源:BigClockEditor.cpp

示例5: mouseDown

void ChannelStripComponent::mouseDown(const MouseEvent &) {

	ModifierKeys modifiers = ModifierKeys::getCurrentModifiersRealtime();

	// check the mod keys ..
	if (modifiers.isPopupMenu() || modifiers.isCtrlDown())
	{
		ScopedPointer<PopupMenu> arrangeMenu_ = new PopupMenu();
		arrangeMenu_->clear();
		arrangeMenu_->addCommandItem(&_commands, MainWindow::showArrangement);
		arrangeMenu_->show();
	}
}
开发者ID:dmtaudio,项目名称:mordaw,代码行数:13,代码来源:ChannelStripComponent.cpp

示例6: setButtons

    //==============================================================================
    // (returns true if the button change caused a modal event loop)
    bool setButtons (const Point<int>& screenPos, const Time& time, const ModifierKeys& newButtonState)
    {
        if (buttonState == newButtonState)
            return false;

        // (avoid sending a spurious mouse-drag when we receive a mouse-up)
        if (! (isDragging() && ! newButtonState.isAnyMouseButtonDown()))
            setScreenPos (screenPos, time, false);

        // (ignore secondary clicks when there's already a button down)
        if (buttonState.isAnyMouseButtonDown() == newButtonState.isAnyMouseButtonDown())
        {
            buttonState = newButtonState;
            return false;
        }

        const int lastCounter = mouseEventCounter;

        if (buttonState.isAnyMouseButtonDown())
        {
            Component* const current = getComponentUnderMouse();

            if (current != nullptr)
            {
                const ModifierKeys oldMods (getCurrentModifiers());
                buttonState = newButtonState; // must change this before calling sendMouseUp, in case it runs a modal loop

                sendMouseUp (current, screenPos + unboundedMouseOffset, time, oldMods);
            }

            enableUnboundedMouseMovement (false, false);
        }

        buttonState = newButtonState;

        if (buttonState.isAnyMouseButtonDown())
        {
            Desktop::getInstance().incrementMouseClickCounter();

            Component* const current = getComponentUnderMouse();

            if (current != nullptr)
            {
                registerMouseDown (screenPos, time, current, buttonState);
                sendMouseDown (current, screenPos, time);
            }
        }

        return lastCounter != mouseEventCounter;
    }
开发者ID:zabrus,项目名称:JUCE,代码行数:52,代码来源:juce_MouseInputSource.cpp

示例7: setPlayType

bool ApplicationSettingsFile::Load(File file)
{
	if (!file.exists())
		return false;

	configFile = file.getFullPathName();
	String jsonString = file.loadFileAsString();
	var json;
	Result result = JSON::parse(jsonString, json);
	if (result.ok())
	{
		DynamicObject* obj = json.getDynamicObject();
		if (obj == nullptr)
			return false;

		if(obj->hasProperty("PlayType"))
			setPlayType((SoundPlayType)(int)obj->getProperty("PlayType"));
		if (obj->hasProperty("UseGlobalHooks"))
			setUseGlobalHooks((bool)obj->getProperty("UseGlobalHooks"));

		if (obj->hasProperty("StopAllSoundKeyPresses"))
		{
			var keyPresses = obj->getProperty("StopAllSoundKeyPresses");
			if (keyPresses.isArray())
			{
				for (int i = 0; i < keyPresses.size(); ++i)
				{
					var jsonKeyPress(keyPresses[i]);
					if (jsonKeyPress.isVoid())
						continue;

					DynamicObject* jsonKeyPressObj = jsonKeyPress.getDynamicObject();
					if (jsonKeyPressObj == nullptr)
						continue;

					int keyCode = (int)jsonKeyPressObj->getProperty("KeyCode");
					int modifierFlags = (int)jsonKeyPressObj->getProperty("ModifierFlags");
					juce::juce_wchar textCharacter = (juce_wchar)((int)jsonKeyPressObj->getProperty("TextCharacter"));
					ModifierKeys modifierKeys;
					modifierKeys = modifierKeys.withFlags(modifierFlags);
					KeyPress keyPress(keyCode, modifierKeys, textCharacter);
					stopAllSoundsKeys.add(keyPress);
				}
			}
		}
	}

	return true;
}
开发者ID:Nimgoble,项目名称:GlobalHooksTest,代码行数:49,代码来源:ApplicationSettingsFile.cpp

示例8: handleTaskBarEvent

    void handleTaskBarEvent (const LPARAM lParam)
    {
        if (owner.isCurrentlyBlockedByAnotherModalComponent())
        {
            if (lParam == WM_LBUTTONDOWN || lParam == WM_RBUTTONDOWN
                    || lParam == WM_LBUTTONDBLCLK || lParam == WM_LBUTTONDBLCLK)
            {
                Component* const current = Component::getCurrentlyModalComponent();

                if (current != nullptr)
                    current->inputAttemptWhenModal();
            }
        }
        else
        {
            ModifierKeys eventMods (ModifierKeys::getCurrentModifiersRealtime());

            if (lParam == WM_LBUTTONDOWN || lParam == WM_LBUTTONDBLCLK)
                eventMods = eventMods.withFlags (ModifierKeys::leftButtonModifier);
            else if (lParam == WM_RBUTTONDOWN || lParam == WM_RBUTTONDBLCLK)
                eventMods = eventMods.withFlags (ModifierKeys::rightButtonModifier);
            else if (lParam == WM_LBUTTONUP || lParam == WM_RBUTTONUP)
                eventMods = eventMods.withoutMouseButtons();

            const MouseEvent e (Desktop::getInstance().getMainMouseSource(),
                                Point<int>(), eventMods, &owner, &owner, Time (getMouseEventTime()),
                                Point<int>(), Time (getMouseEventTime()), 1, false);

            if (lParam == WM_LBUTTONDOWN || lParam == WM_RBUTTONDOWN)
            {
                SetFocus (iconData.hWnd);
                SetForegroundWindow (iconData.hWnd);
                owner.mouseDown (e);
            }
            else if (lParam == WM_LBUTTONUP || lParam == WM_RBUTTONUP)
            {
                owner.mouseUp (e);
            }
            else if (lParam == WM_LBUTTONDBLCLK || lParam == WM_LBUTTONDBLCLK)
            {
                owner.mouseDoubleClick (e);
            }
            else if (lParam == WM_MOUSEMOVE)
            {
                owner.mouseMove (e);
            }
        }
    }
开发者ID:jjwheeler,项目名称:GUI,代码行数:48,代码来源:juce_win32_SystemTrayIcon.cpp

示例9: handleEvent

    //==============================================================================
    void handleEvent (ComponentPeer* const newPeer, Point<int> positionWithinPeer, Time time, const ModifierKeys newMods)
    {
        jassert (newPeer != nullptr);
        lastTime = time;
        ++mouseEventCounter;
        const Point<int> screenPos (newPeer->localToGlobal (positionWithinPeer));

        if (isDragging() && newMods.isAnyMouseButtonDown())
        {
            setScreenPos (screenPos, time, false);
        }
        else
        {
            setPeer (newPeer, screenPos, time);

            if (ComponentPeer* peer = getPeer())
            {
                if (setButtons (screenPos, time, newMods))
                    return; // some modal events have been dispatched, so the current event is now out-of-date

                peer = getPeer();
                if (peer != nullptr)
                    setScreenPos (screenPos, time, false);
            }
        }
    }
开发者ID:AGenews,项目名称:GUI,代码行数:27,代码来源:juce_MouseInputSource.cpp

示例10: handleEvent

    //==============================================================================
    void handleEvent (ComponentPeer& newPeer, Point<float> positionWithinPeer, Time time,
                      const ModifierKeys newMods, float newPressure)
    {
        lastTime = time;
        const bool pressureChanged = (pressure != newPressure);
        pressure = newPressure;
        ++mouseEventCounter;
        const Point<float> screenPos (newPeer.localToGlobal (positionWithinPeer));

        if (isDragging() && newMods.isAnyMouseButtonDown())
        {
            setScreenPos (screenPos, time, pressureChanged);
        }
        else
        {
            setPeer (newPeer, screenPos, time);

            if (ComponentPeer* peer = getPeer())
            {
                if (setButtons (screenPos, time, newMods))
                    return; // some modal events have been dispatched, so the current event is now out-of-date

                peer = getPeer();

                if (peer != nullptr)
                    setScreenPos (screenPos, time, pressureChanged);
            }
        }
    }
开发者ID:EthanZuo,项目名称:JUCE,代码行数:30,代码来源:juce_MouseInputSource.cpp

示例11: clicked

void TabBarButton::clicked (const ModifierKeys& mods)
{
    if (mods.isPopupMenu())
        owner.popupMenuClickOnTab (getIndex(), getButtonText());
    else
        owner.setCurrentTabIndex (getIndex());
}
开发者ID:sonic59,项目名称:JuceS1Text,代码行数:7,代码来源:juce_TabbedButtonBar.cpp

示例12: 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);
    }
}
开发者ID:sonic59,项目名称:JuceEditor,代码行数:17,代码来源:juce_ListBox.cpp

示例13: if

void TrackMixerComponent::buttonStateChanged(Button* button)
{
    // if button is clicked mute or solo track
    if(button == _muteButton)
        _engine.getMixer();
    else if(button == _soloButton)
        _engine.getMixer()->soloTrack(_trackID);
	ModifierKeys modifiers = ModifierKeys::getCurrentModifiersRealtime();

	// menu for adding tracks
	if (modifiers.isPopupMenu() || modifiers.isCtrlDown())
	{
		ScopedPointer<PopupMenu> arrangeMenu_ = new PopupMenu();
		arrangeMenu_->clear();
		arrangeMenu_->addCommandItem(&_commands, ProjectManager::addTrack);
		arrangeMenu_->show();
	}
}
开发者ID:dmtaudio,项目名称:mordaw,代码行数:18,代码来源:TrackComponent.cpp

示例14: registerMouseDown

    void registerMouseDown (const Point<int>& screenPos, const Time& time,
                            Component* const component, const ModifierKeys& modifiers) noexcept
    {
        for (int i = numElementsInArray (mouseDowns); --i > 0;)
            mouseDowns[i] = mouseDowns[i - 1];

        mouseDowns[0].position = screenPos;
        mouseDowns[0].time = time;
        mouseDowns[0].component = component;
        mouseDowns[0].buttons = modifiers.withOnlyMouseButtons();
        mouseMovedSignificantlySincePressed = false;
    }
开发者ID:zabrus,项目名称:JUCE,代码行数:12,代码来源:juce_MouseInputSource.cpp

示例15: keyPressed

bool ScumblerComponent::keyPressed(const KeyPress& key)
{
   bool retval = false;
   if (key.isKeyCode(KeyPress::tabKey))
   {
      ModifierKeys mod = key.getModifiers();
      if (mod.isShiftDown())
      {
         fScumbler->ActivatePreviousTrack();
      }
      else
      {
         fScumbler->ActivateNextTrack();
      }
      retval = true;
   } 
   else
   {
      retval = false;
   }
   return retval;
}
开发者ID:alessandrostone,项目名称:scumbler,代码行数:22,代码来源:ScumblerComponent.cpp


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