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 3.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2013 - Raw Material Software 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. #ifndef JUCE_CARETCOMPONENT_H_INCLUDED
  18. #define JUCE_CARETCOMPONENT_H_INCLUDED
  19. //==============================================================================
  20. /**
  21. */
  22. class JUCE_API CaretComponent : public Component,
  23. private Timer
  24. {
  25. public:
  26. //==============================================================================
  27. /** Creates the caret component.
  28. The keyFocusOwner is an optional component which the caret will check, making
  29. itself visible only when the keyFocusOwner has keyboard focus.
  30. */
  31. CaretComponent (Component* keyFocusOwner);
  32. /** Destructor. */
  33. ~CaretComponent();
  34. //==============================================================================
  35. /** Sets the caret's position to place it next to the given character.
  36. The area is the rectangle containing the entire character that the caret is
  37. positioned on, so by default a vertical-line caret may choose to just show itself
  38. at the left of this area. You can override this method to customise its size.
  39. This method will also force the caret to reset its timer and become visible (if
  40. appropriate), so that as it moves, you can see where it is.
  41. */
  42. virtual void setCaretPosition (const Rectangle<int>& characterArea);
  43. /** A set of colour IDs to use to change the colour of various aspects of the caret.
  44. These constants can be used either via the Component::setColour(), or LookAndFeel::setColour()
  45. methods.
  46. @see Component::setColour, Component::findColour, LookAndFeel::setColour, LookAndFeel::findColour
  47. */
  48. enum ColourIds
  49. {
  50. caretColourId = 0x1000204, /**< The colour with which to draw the caret. */
  51. };
  52. //==============================================================================
  53. /** @internal */
  54. void paint (Graphics&) override;
  55. private:
  56. Component* owner;
  57. bool shouldBeShown() const;
  58. void timerCallback() override;
  59. JUCE_DECLARE_NON_COPYABLE (CaretComponent)
  60. };
  61. #endif // JUCE_CARETCOMPONENT_H_INCLUDED