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_ImageComponent.h 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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_IMAGECOMPONENT_H_INCLUDED
  18. #define JUCE_IMAGECOMPONENT_H_INCLUDED
  19. //==============================================================================
  20. /**
  21. A component that simply displays an image.
  22. Use setImage to give it an image, and it'll display it - simple as that!
  23. */
  24. class JUCE_API ImageComponent : public Component,
  25. public SettableTooltipClient
  26. {
  27. public:
  28. //==============================================================================
  29. /** Creates an ImageComponent. */
  30. ImageComponent (const String& componentName = String::empty);
  31. /** Destructor. */
  32. ~ImageComponent();
  33. //==============================================================================
  34. /** Sets the image that should be displayed. */
  35. void setImage (const Image& newImage);
  36. /** Sets the image that should be displayed, and its placement within the component. */
  37. void setImage (const Image& newImage,
  38. RectanglePlacement placementToUse);
  39. /** Returns the current image. */
  40. const Image& getImage() const;
  41. /** Sets the method of positioning that will be used to fit the image within the component's bounds.
  42. By default the positioning is centred, and will fit the image inside the component's bounds
  43. whilst keeping its aspect ratio correct, but you can change it to whatever layout you need.
  44. */
  45. void setImagePlacement (RectanglePlacement newPlacement);
  46. /** Returns the current image placement. */
  47. RectanglePlacement getImagePlacement() const;
  48. //==============================================================================
  49. /** @internal */
  50. void paint (Graphics&) override;
  51. private:
  52. Image image;
  53. RectanglePlacement placement;
  54. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ImageComponent)
  55. };
  56. #endif // JUCE_IMAGECOMPONENT_H_INCLUDED