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.

82 lines
2.9KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2020 - Raw Material Software Limited
  5. JUCE is an open source library subject to commercial or open-source
  6. licensing.
  7. By using JUCE, you agree to the terms of both the JUCE 6 End-User License
  8. Agreement and JUCE Privacy Policy (both effective as of the 16th June 2020).
  9. End User License Agreement: www.juce.com/juce-6-licence
  10. Privacy Policy: www.juce.com/juce-privacy-policy
  11. Or: You may also use this code under the terms of the GPL v3 (see
  12. www.gnu.org/licenses).
  13. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  14. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  15. DISCLAIMED.
  16. ==============================================================================
  17. */
  18. namespace juce
  19. {
  20. //==============================================================================
  21. /**
  22. @tags{GUI}
  23. */
  24. class JUCE_API CaretComponent : public Component,
  25. private Timer
  26. {
  27. public:
  28. //==============================================================================
  29. /** Creates the caret component.
  30. The keyFocusOwner is an optional component which the caret will check, making
  31. itself visible only when the keyFocusOwner has keyboard focus.
  32. */
  33. CaretComponent (Component* keyFocusOwner);
  34. /** Destructor. */
  35. ~CaretComponent() override;
  36. //==============================================================================
  37. /** Sets the caret's position to place it next to the given character.
  38. The area is the rectangle containing the entire character that the caret is
  39. positioned on, so by default a vertical-line caret may choose to just show itself
  40. at the left of this area. You can override this method to customise its size.
  41. This method will also force the caret to reset its timer and become visible (if
  42. appropriate), so that as it moves, you can see where it is.
  43. */
  44. virtual void setCaretPosition (const Rectangle<int>& characterArea);
  45. /** A set of colour IDs to use to change the colour of various aspects of the caret.
  46. These constants can be used either via the Component::setColour(), or LookAndFeel::setColour()
  47. methods.
  48. @see Component::setColour, Component::findColour, LookAndFeel::setColour, LookAndFeel::findColour
  49. */
  50. enum ColourIds
  51. {
  52. caretColourId = 0x1000204, /**< The colour with which to draw the caret. */
  53. };
  54. //==============================================================================
  55. /** @internal */
  56. void paint (Graphics&) override;
  57. private:
  58. Component* owner;
  59. bool shouldBeShown() const;
  60. void timerCallback() override;
  61. JUCE_DECLARE_NON_COPYABLE (CaretComponent)
  62. };
  63. } // namespace juce