juce_CachedComponentImage.h 2.5 KB

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