mirror of https://github.com/dcoredump/dexed.git
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.
78 lines
2.8 KiB
78 lines
2.8 KiB
/*
|
|
==============================================================================
|
|
|
|
This file is part of the JUCE library.
|
|
Copyright (c) 2013 - Raw Material Software Ltd.
|
|
|
|
Permission is granted to use this software under the terms of either:
|
|
a) the GPL v2 (or any later version)
|
|
b) the Affero GPL v3
|
|
|
|
Details of these licenses can be found at: www.gnu.org/licenses
|
|
|
|
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
|
|
------------------------------------------------------------------------------
|
|
|
|
To release a closed-source product which uses JUCE, commercial licenses are
|
|
available: visit www.juce.com for more information.
|
|
|
|
==============================================================================
|
|
*/
|
|
|
|
#ifndef JUCE_IMAGECOMPONENT_H_INCLUDED
|
|
#define JUCE_IMAGECOMPONENT_H_INCLUDED
|
|
|
|
|
|
//==============================================================================
|
|
/**
|
|
A component that simply displays an image.
|
|
|
|
Use setImage to give it an image, and it'll display it - simple as that!
|
|
*/
|
|
class JUCE_API ImageComponent : public Component,
|
|
public SettableTooltipClient
|
|
{
|
|
public:
|
|
//==============================================================================
|
|
/** Creates an ImageComponent. */
|
|
ImageComponent (const String& componentName = String::empty);
|
|
|
|
/** Destructor. */
|
|
~ImageComponent();
|
|
|
|
//==============================================================================
|
|
/** Sets the image that should be displayed. */
|
|
void setImage (const Image& newImage);
|
|
|
|
/** Sets the image that should be displayed, and its placement within the component. */
|
|
void setImage (const Image& newImage,
|
|
RectanglePlacement placementToUse);
|
|
|
|
/** Returns the current image. */
|
|
const Image& getImage() const;
|
|
|
|
/** Sets the method of positioning that will be used to fit the image within the component's bounds.
|
|
By default the positioning is centred, and will fit the image inside the component's bounds
|
|
whilst keeping its aspect ratio correct, but you can change it to whatever layout you need.
|
|
*/
|
|
void setImagePlacement (RectanglePlacement newPlacement);
|
|
|
|
/** Returns the current image placement. */
|
|
RectanglePlacement getImagePlacement() const;
|
|
|
|
//==============================================================================
|
|
/** @internal */
|
|
void paint (Graphics&) override;
|
|
|
|
private:
|
|
Image image;
|
|
RectanglePlacement placement;
|
|
|
|
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ImageComponent)
|
|
};
|
|
|
|
|
|
#endif // JUCE_IMAGECOMPONENT_H_INCLUDED
|
|
|