Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

juce_ModifierKeys.cpp 1.6KB

9 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2015 - ROLI Ltd.
  5. Permission is granted to use this software under the terms of either:
  6. a) the GPL v2 (or any later version)
  7. b) the Affero GPL v3
  8. Details of these licenses can be found at: www.gnu.org/licenses
  9. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  11. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  12. ------------------------------------------------------------------------------
  13. To release a closed-source product which uses JUCE, commercial licenses are
  14. available: visit www.juce.com for more information.
  15. ==============================================================================
  16. */
  17. ModifierKeys::ModifierKeys() noexcept : flags (0) {}
  18. ModifierKeys::ModifierKeys (int rawFlags) noexcept : flags (rawFlags) {}
  19. ModifierKeys::ModifierKeys (const ModifierKeys& other) noexcept : flags (other.flags) {}
  20. ModifierKeys& ModifierKeys::operator= (const ModifierKeys other) noexcept
  21. {
  22. flags = other.flags;
  23. return *this;
  24. }
  25. ModifierKeys ModifierKeys::currentModifiers;
  26. ModifierKeys ModifierKeys::getCurrentModifiers() noexcept
  27. {
  28. return currentModifiers;
  29. }
  30. int ModifierKeys::getNumMouseButtonsDown() const noexcept
  31. {
  32. int num = 0;
  33. if (isLeftButtonDown()) ++num;
  34. if (isRightButtonDown()) ++num;
  35. if (isMiddleButtonDown()) ++num;
  36. return num;
  37. }