The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
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.

68 lines
2.4KB

  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. #pragma once
  18. //==============================================================================
  19. /**
  20. Base class used internally for structures that can store cached images of
  21. component state.
  22. Most people are unlikely to ever need to know about this class - it's really
  23. only for power-users!
  24. @see Component::setCachedComponentImage
  25. */
  26. class JUCE_API CachedComponentImage
  27. {
  28. public:
  29. CachedComponentImage() noexcept {}
  30. virtual ~CachedComponentImage() {}
  31. //==============================================================================
  32. /** Called as part of the parent component's paint method, this must draw
  33. the given component into the target graphics context, using the cached
  34. version where possible.
  35. */
  36. virtual void paint (Graphics&) = 0;
  37. /** Invalidates all cached image data.
  38. @returns true if the peer should also be repainted, or false if this object
  39. handles all repaint work internally.
  40. */
  41. virtual bool invalidateAll() = 0;
  42. /** Invalidates a section of the cached image data.
  43. @returns true if the peer should also be repainted, or false if this object
  44. handles all repaint work internally.
  45. */
  46. virtual bool invalidate (const Rectangle<int>& area) = 0;
  47. /** Called to indicate that the component is no longer active, so
  48. any cached data should be released if possible.
  49. */
  50. virtual void releaseResources() = 0;
  51. };