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_CaretComponent.h 2.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2017 - ROLI Ltd.
  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 5 End-User License
  8. Agreement and JUCE 5 Privacy Policy (both updated and effective as of the
  9. 27th April 2017).
  10. End User License Agreement: www.juce.com/juce-5-licence
  11. Privacy Policy: www.juce.com/juce-5-privacy-policy
  12. Or: You may also use this code under the terms of the GPL v3 (see
  13. www.gnu.org/licenses).
  14. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  15. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  16. DISCLAIMED.
  17. ==============================================================================
  18. */
  19. namespace juce
  20. {
  21. //==============================================================================
  22. /**
  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();
  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