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.

73 lines
2.5KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE 6 technical preview.
  4. Copyright (c) 2020 - Raw Material Software Limited
  5. You may use this code under the terms of the GPL v3
  6. (see www.gnu.org/licenses).
  7. For this technical preview, this file is not subject to commercial licensing.
  8. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  9. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  10. DISCLAIMED.
  11. ==============================================================================
  12. */
  13. namespace juce
  14. {
  15. //==============================================================================
  16. /**
  17. A component that simply displays an image.
  18. Use setImage to give it an image, and it'll display it - simple as that!
  19. @tags{GUI}
  20. */
  21. class JUCE_API ImageComponent : public Component,
  22. public SettableTooltipClient
  23. {
  24. public:
  25. //==============================================================================
  26. /** Creates an ImageComponent. */
  27. ImageComponent (const String& componentName = String());
  28. /** Destructor. */
  29. ~ImageComponent() override;
  30. //==============================================================================
  31. /** Sets the image that should be displayed. */
  32. void setImage (const Image& newImage);
  33. /** Sets the image that should be displayed, and its placement within the component. */
  34. void setImage (const Image& newImage,
  35. RectanglePlacement placementToUse);
  36. /** Returns the current image. */
  37. const Image& getImage() const;
  38. /** Sets the method of positioning that will be used to fit the image within the component's bounds.
  39. By default the positioning is centred, and will fit the image inside the component's bounds
  40. whilst keeping its aspect ratio correct, but you can change it to whatever layout you need.
  41. */
  42. void setImagePlacement (RectanglePlacement newPlacement);
  43. /** Returns the current image placement. */
  44. RectanglePlacement getImagePlacement() const;
  45. //==============================================================================
  46. /** @internal */
  47. void paint (Graphics&) override;
  48. private:
  49. Image image;
  50. RectanglePlacement placement;
  51. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ImageComponent)
  52. };
  53. } // namespace juce