mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-02-03 03:30:06 +00:00
New class: ImageComponent, which just displays an image.
This commit is contained in:
parent
fa04e0cf93
commit
1fb8929c55
20 changed files with 363 additions and 6 deletions
|
|
@ -140,6 +140,7 @@ OBJECTS := \
|
|||
$(OBJDIR)/juce_CodeEditorComponent_6fe4a170.o \
|
||||
$(OBJDIR)/juce_CPlusPlusCodeTokeniser_6b8548a9.o \
|
||||
$(OBJDIR)/juce_ComboBox_bcb5e365.o \
|
||||
$(OBJDIR)/juce_ImageComponent_1f90572a.o \
|
||||
$(OBJDIR)/juce_Label_7af0aab6.o \
|
||||
$(OBJDIR)/juce_ListBox_d4a8704f.o \
|
||||
$(OBJDIR)/juce_ProgressBar_38bc3ba8.o \
|
||||
|
|
@ -888,6 +889,11 @@ $(OBJDIR)/juce_ComboBox_bcb5e365.o: ../../src/gui/components/controls/juce_Combo
|
|||
@echo "Compiling juce_ComboBox.cpp"
|
||||
@$(CXX) $(CXXFLAGS) -o "$@" -c "$<"
|
||||
|
||||
$(OBJDIR)/juce_ImageComponent_1f90572a.o: ../../src/gui/components/controls/juce_ImageComponent.cpp
|
||||
-@mkdir -p $(OBJDIR)
|
||||
@echo "Compiling juce_ImageComponent.cpp"
|
||||
@$(CXX) $(CXXFLAGS) -o "$@" -c "$<"
|
||||
|
||||
$(OBJDIR)/juce_Label_7af0aab6.o: ../../src/gui/components/controls/juce_Label.cpp
|
||||
-@mkdir -p $(OBJDIR)
|
||||
@echo "Compiling juce_Label.cpp"
|
||||
|
|
|
|||
|
|
@ -109,6 +109,7 @@
|
|||
DA5DA96B9D1A26342D9278B6 = { isa = PBXBuildFile; fileRef = 04F48B09426293224576DA9A; };
|
||||
CA49EF43B1478B146ADBBF62 = { isa = PBXBuildFile; fileRef = 346CC505FAFEE9451040108D; };
|
||||
FE6F6A4946B7E4F6C9F44C4A = { isa = PBXBuildFile; fileRef = ADC16C18C8237A7F8E35E37A; };
|
||||
28254F1E6E686CF6F29AE56A = { isa = PBXBuildFile; fileRef = 0D3FA24FF38399E0EDA80860; };
|
||||
9EA7FEF4CAD2BF46DD3596DA = { isa = PBXBuildFile; fileRef = 7330A9643F50DE8BEACDBB61; };
|
||||
D1400B3D9D07FA9E8BAA21CB = { isa = PBXBuildFile; fileRef = 1BC6C010045A06BDB4C684F6; };
|
||||
716823F3B5437A20FCADA50E = { isa = PBXBuildFile; fileRef = 71B6CE03D6DB07BB293C8206; };
|
||||
|
|
@ -616,6 +617,8 @@
|
|||
3384A91143018ED9346E4118 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_CPlusPlusCodeTokeniser.h; path = ../../src/gui/components/code_editor/juce_CPlusPlusCodeTokeniser.h; sourceTree = SOURCE_ROOT; };
|
||||
ADC16C18C8237A7F8E35E37A = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_ComboBox.cpp; path = ../../src/gui/components/controls/juce_ComboBox.cpp; sourceTree = SOURCE_ROOT; };
|
||||
D8EB3EA456D9FCC211CD1ED5 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_ComboBox.h; path = ../../src/gui/components/controls/juce_ComboBox.h; sourceTree = SOURCE_ROOT; };
|
||||
0D3FA24FF38399E0EDA80860 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_ImageComponent.cpp; path = ../../src/gui/components/controls/juce_ImageComponent.cpp; sourceTree = SOURCE_ROOT; };
|
||||
CA3454A9B6F80A2F4735C37E = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_ImageComponent.h; path = ../../src/gui/components/controls/juce_ImageComponent.h; sourceTree = SOURCE_ROOT; };
|
||||
7330A9643F50DE8BEACDBB61 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_Label.cpp; path = ../../src/gui/components/controls/juce_Label.cpp; sourceTree = SOURCE_ROOT; };
|
||||
C0CC0FA84A4F7AA76C1611CB = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_Label.h; path = ../../src/gui/components/controls/juce_Label.h; sourceTree = SOURCE_ROOT; };
|
||||
1BC6C010045A06BDB4C684F6 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_ListBox.cpp; path = ../../src/gui/components/controls/juce_ListBox.cpp; sourceTree = SOURCE_ROOT; };
|
||||
|
|
@ -1377,6 +1380,8 @@
|
|||
BCB2FFE7C2A4084A267F57F2 = { isa = PBXGroup; children = (
|
||||
ADC16C18C8237A7F8E35E37A,
|
||||
D8EB3EA456D9FCC211CD1ED5,
|
||||
0D3FA24FF38399E0EDA80860,
|
||||
CA3454A9B6F80A2F4735C37E,
|
||||
7330A9643F50DE8BEACDBB61,
|
||||
C0CC0FA84A4F7AA76C1611CB,
|
||||
1BC6C010045A06BDB4C684F6,
|
||||
|
|
@ -2133,6 +2138,7 @@
|
|||
DA5DA96B9D1A26342D9278B6,
|
||||
CA49EF43B1478B146ADBBF62,
|
||||
FE6F6A4946B7E4F6C9F44C4A,
|
||||
28254F1E6E686CF6F29AE56A,
|
||||
9EA7FEF4CAD2BF46DD3596DA,
|
||||
D1400B3D9D07FA9E8BAA21CB,
|
||||
716823F3B5437A20FCADA50E,
|
||||
|
|
|
|||
|
|
@ -472,6 +472,8 @@
|
|||
<Filter Name="controls">
|
||||
<File RelativePath="..\..\src\gui\components\controls\juce_ComboBox.cpp"/>
|
||||
<File RelativePath="..\..\src\gui\components\controls\juce_ComboBox.h"/>
|
||||
<File RelativePath="..\..\src\gui\components\controls\juce_ImageComponent.cpp"/>
|
||||
<File RelativePath="..\..\src\gui\components\controls\juce_ImageComponent.h"/>
|
||||
<File RelativePath="..\..\src\gui\components\controls\juce_Label.cpp"/>
|
||||
<File RelativePath="..\..\src\gui\components\controls\juce_Label.h"/>
|
||||
<File RelativePath="..\..\src\gui\components\controls\juce_ListBox.cpp"/>
|
||||
|
|
|
|||
|
|
@ -472,6 +472,8 @@
|
|||
<Filter Name="controls">
|
||||
<File RelativePath="..\..\src\gui\components\controls\juce_ComboBox.cpp"/>
|
||||
<File RelativePath="..\..\src\gui\components\controls\juce_ComboBox.h"/>
|
||||
<File RelativePath="..\..\src\gui\components\controls\juce_ImageComponent.cpp"/>
|
||||
<File RelativePath="..\..\src\gui\components\controls\juce_ImageComponent.h"/>
|
||||
<File RelativePath="..\..\src\gui\components\controls\juce_Label.cpp"/>
|
||||
<File RelativePath="..\..\src\gui\components\controls\juce_Label.h"/>
|
||||
<File RelativePath="..\..\src\gui\components\controls\juce_ListBox.cpp"/>
|
||||
|
|
|
|||
|
|
@ -474,6 +474,8 @@
|
|||
<Filter Name="controls">
|
||||
<File RelativePath="..\..\src\gui\components\controls\juce_ComboBox.cpp"/>
|
||||
<File RelativePath="..\..\src\gui\components\controls\juce_ComboBox.h"/>
|
||||
<File RelativePath="..\..\src\gui\components\controls\juce_ImageComponent.cpp"/>
|
||||
<File RelativePath="..\..\src\gui\components\controls\juce_ImageComponent.h"/>
|
||||
<File RelativePath="..\..\src\gui\components\controls\juce_Label.cpp"/>
|
||||
<File RelativePath="..\..\src\gui\components\controls\juce_Label.h"/>
|
||||
<File RelativePath="..\..\src\gui\components\controls\juce_ListBox.cpp"/>
|
||||
|
|
|
|||
|
|
@ -223,6 +223,7 @@
|
|||
<ClCompile Include="..\..\src\gui\components\code_editor\juce_CodeEditorComponent.cpp"/>
|
||||
<ClCompile Include="..\..\src\gui\components\code_editor\juce_CPlusPlusCodeTokeniser.cpp"/>
|
||||
<ClCompile Include="..\..\src\gui\components\controls\juce_ComboBox.cpp"/>
|
||||
<ClCompile Include="..\..\src\gui\components\controls\juce_ImageComponent.cpp"/>
|
||||
<ClCompile Include="..\..\src\gui\components\controls\juce_Label.cpp"/>
|
||||
<ClCompile Include="..\..\src\gui\components\controls\juce_ListBox.cpp"/>
|
||||
<ClCompile Include="..\..\src\gui\components\controls\juce_ProgressBar.cpp"/>
|
||||
|
|
@ -591,6 +592,7 @@
|
|||
<ClInclude Include="..\..\src\gui\components\code_editor\juce_CodeTokeniser.h"/>
|
||||
<ClInclude Include="..\..\src\gui\components\code_editor\juce_CPlusPlusCodeTokeniser.h"/>
|
||||
<ClInclude Include="..\..\src\gui\components\controls\juce_ComboBox.h"/>
|
||||
<ClInclude Include="..\..\src\gui\components\controls\juce_ImageComponent.h"/>
|
||||
<ClInclude Include="..\..\src\gui\components\controls\juce_Label.h"/>
|
||||
<ClInclude Include="..\..\src\gui\components\controls\juce_ListBox.h"/>
|
||||
<ClInclude Include="..\..\src\gui\components\controls\juce_ProgressBar.h"/>
|
||||
|
|
|
|||
|
|
@ -529,6 +529,9 @@
|
|||
<ClCompile Include="..\..\src\gui\components\controls\juce_ComboBox.cpp">
|
||||
<Filter>Juce\Source\gui\components\controls</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\gui\components\controls\juce_ImageComponent.cpp">
|
||||
<Filter>Juce\Source\gui\components\controls</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\gui\components\controls\juce_Label.cpp">
|
||||
<Filter>Juce\Source\gui\components\controls</Filter>
|
||||
</ClCompile>
|
||||
|
|
@ -1707,6 +1710,9 @@
|
|||
<ClInclude Include="..\..\src\gui\components\controls\juce_ComboBox.h">
|
||||
<Filter>Juce\Source\gui\components\controls</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\gui\components\controls\juce_ImageComponent.h">
|
||||
<Filter>Juce\Source\gui\components\controls</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\gui\components\controls\juce_Label.h">
|
||||
<Filter>Juce\Source\gui\components\controls</Filter>
|
||||
</ClInclude>
|
||||
|
|
|
|||
|
|
@ -109,6 +109,7 @@
|
|||
DA5DA96B9D1A26342D9278B6 = { isa = PBXBuildFile; fileRef = 04F48B09426293224576DA9A; };
|
||||
CA49EF43B1478B146ADBBF62 = { isa = PBXBuildFile; fileRef = 346CC505FAFEE9451040108D; };
|
||||
FE6F6A4946B7E4F6C9F44C4A = { isa = PBXBuildFile; fileRef = ADC16C18C8237A7F8E35E37A; };
|
||||
28254F1E6E686CF6F29AE56A = { isa = PBXBuildFile; fileRef = 0D3FA24FF38399E0EDA80860; };
|
||||
9EA7FEF4CAD2BF46DD3596DA = { isa = PBXBuildFile; fileRef = 7330A9643F50DE8BEACDBB61; };
|
||||
D1400B3D9D07FA9E8BAA21CB = { isa = PBXBuildFile; fileRef = 1BC6C010045A06BDB4C684F6; };
|
||||
716823F3B5437A20FCADA50E = { isa = PBXBuildFile; fileRef = 71B6CE03D6DB07BB293C8206; };
|
||||
|
|
@ -616,6 +617,8 @@
|
|||
3384A91143018ED9346E4118 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_CPlusPlusCodeTokeniser.h; path = ../../src/gui/components/code_editor/juce_CPlusPlusCodeTokeniser.h; sourceTree = SOURCE_ROOT; };
|
||||
ADC16C18C8237A7F8E35E37A = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_ComboBox.cpp; path = ../../src/gui/components/controls/juce_ComboBox.cpp; sourceTree = SOURCE_ROOT; };
|
||||
D8EB3EA456D9FCC211CD1ED5 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_ComboBox.h; path = ../../src/gui/components/controls/juce_ComboBox.h; sourceTree = SOURCE_ROOT; };
|
||||
0D3FA24FF38399E0EDA80860 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_ImageComponent.cpp; path = ../../src/gui/components/controls/juce_ImageComponent.cpp; sourceTree = SOURCE_ROOT; };
|
||||
CA3454A9B6F80A2F4735C37E = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_ImageComponent.h; path = ../../src/gui/components/controls/juce_ImageComponent.h; sourceTree = SOURCE_ROOT; };
|
||||
7330A9643F50DE8BEACDBB61 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_Label.cpp; path = ../../src/gui/components/controls/juce_Label.cpp; sourceTree = SOURCE_ROOT; };
|
||||
C0CC0FA84A4F7AA76C1611CB = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_Label.h; path = ../../src/gui/components/controls/juce_Label.h; sourceTree = SOURCE_ROOT; };
|
||||
1BC6C010045A06BDB4C684F6 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_ListBox.cpp; path = ../../src/gui/components/controls/juce_ListBox.cpp; sourceTree = SOURCE_ROOT; };
|
||||
|
|
@ -1377,6 +1380,8 @@
|
|||
BCB2FFE7C2A4084A267F57F2 = { isa = PBXGroup; children = (
|
||||
ADC16C18C8237A7F8E35E37A,
|
||||
D8EB3EA456D9FCC211CD1ED5,
|
||||
0D3FA24FF38399E0EDA80860,
|
||||
CA3454A9B6F80A2F4735C37E,
|
||||
7330A9643F50DE8BEACDBB61,
|
||||
C0CC0FA84A4F7AA76C1611CB,
|
||||
1BC6C010045A06BDB4C684F6,
|
||||
|
|
@ -2137,6 +2142,7 @@
|
|||
DA5DA96B9D1A26342D9278B6,
|
||||
CA49EF43B1478B146ADBBF62,
|
||||
FE6F6A4946B7E4F6C9F44C4A,
|
||||
28254F1E6E686CF6F29AE56A,
|
||||
9EA7FEF4CAD2BF46DD3596DA,
|
||||
D1400B3D9D07FA9E8BAA21CB,
|
||||
716823F3B5437A20FCADA50E,
|
||||
|
|
|
|||
|
|
@ -582,6 +582,10 @@
|
|||
file="src/gui/components/controls/juce_ComboBox.cpp"/>
|
||||
<FILE id="Uo2wIjaGP" name="juce_ComboBox.h" compile="0" resource="0"
|
||||
file="src/gui/components/controls/juce_ComboBox.h"/>
|
||||
<FILE id="R1Ygsn" name="juce_ImageComponent.cpp" compile="1" resource="0"
|
||||
file="src/gui/components/controls/juce_ImageComponent.cpp"/>
|
||||
<FILE id="kRFEoL" name="juce_ImageComponent.h" compile="0" resource="0"
|
||||
file="src/gui/components/controls/juce_ImageComponent.h"/>
|
||||
<FILE id="fDsSSPSQy" name="juce_Label.cpp" compile="1" resource="0"
|
||||
file="src/gui/components/controls/juce_Label.cpp"/>
|
||||
<FILE id="LkZfmqaQt" name="juce_Label.h" compile="0" resource="0" file="src/gui/components/controls/juce_Label.h"/>
|
||||
|
|
|
|||
|
|
@ -245,6 +245,7 @@
|
|||
#include "../src/gui/components/code_editor/juce_CodeEditorComponent.cpp"
|
||||
#include "../src/gui/components/code_editor/juce_CPlusPlusCodeTokeniser.cpp"
|
||||
#include "../src/gui/components/controls/juce_ComboBox.cpp"
|
||||
#include "../src/gui/components/controls/juce_ImageComponent.cpp"
|
||||
#include "../src/gui/components/controls/juce_Label.cpp"
|
||||
#include "../src/gui/components/controls/juce_ListBox.cpp"
|
||||
#include "../src/gui/components/controls/juce_ProgressBar.cpp"
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ namespace Ids
|
|||
DECLARE_ID (readOnly);
|
||||
DECLARE_ID (editMode);
|
||||
DECLARE_ID (justification);
|
||||
DECLARE_ID (placement);
|
||||
DECLARE_ID (items);
|
||||
DECLARE_ID (editable);
|
||||
DECLARE_ID (textJustification);
|
||||
|
|
@ -110,6 +111,7 @@ namespace Ids
|
|||
DECLARE_ID (rootItemVisible);
|
||||
DECLARE_ID (openByDefault);
|
||||
DECLARE_ID (locked);
|
||||
DECLARE_ID (image);
|
||||
DECLARE_ID (tooltip);
|
||||
DECLARE_ID (memberName);
|
||||
DECLARE_ID (focusOrder);
|
||||
|
|
|
|||
|
|
@ -47856,6 +47856,67 @@ END_JUCE_NAMESPACE
|
|||
/*** End of inlined file: juce_ComboBox.cpp ***/
|
||||
|
||||
|
||||
/*** Start of inlined file: juce_ImageComponent.cpp ***/
|
||||
BEGIN_JUCE_NAMESPACE
|
||||
|
||||
ImageComponent::ImageComponent (const String& componentName)
|
||||
: Component (componentName),
|
||||
placement (RectanglePlacement::centred)
|
||||
{
|
||||
}
|
||||
|
||||
ImageComponent::~ImageComponent()
|
||||
{
|
||||
}
|
||||
|
||||
void ImageComponent::setImage (const Image& newImage)
|
||||
{
|
||||
if (image != newImage)
|
||||
{
|
||||
image = newImage;
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
|
||||
void ImageComponent::setImage (const Image& newImage, const RectanglePlacement& placementToUse)
|
||||
{
|
||||
if (image != newImage || placement != placementToUse)
|
||||
{
|
||||
image = newImage;
|
||||
placement = placementToUse;
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
|
||||
void ImageComponent::setImagePlacement (const RectanglePlacement& newPlacement)
|
||||
{
|
||||
if (placement != newPlacement)
|
||||
{
|
||||
placement = newPlacement;
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
|
||||
const Image ImageComponent::getImage() const
|
||||
{
|
||||
return image;
|
||||
}
|
||||
|
||||
const RectanglePlacement ImageComponent::getImagePlacement() const
|
||||
{
|
||||
return placement;
|
||||
}
|
||||
|
||||
void ImageComponent::paint (Graphics& g)
|
||||
{
|
||||
g.setOpacity (1.0f);
|
||||
g.drawImageWithin (image, 0, 0, getWidth(), getHeight(), placement, false);
|
||||
}
|
||||
|
||||
END_JUCE_NAMESPACE
|
||||
/*** End of inlined file: juce_ImageComponent.cpp ***/
|
||||
|
||||
|
||||
/*** Start of inlined file: juce_Label.cpp ***/
|
||||
BEGIN_JUCE_NAMESPACE
|
||||
|
||||
|
|
@ -86423,6 +86484,16 @@ RectanglePlacement& RectanglePlacement::operator= (const RectanglePlacement& oth
|
|||
return *this;
|
||||
}
|
||||
|
||||
bool RectanglePlacement::operator== (const RectanglePlacement& other) const throw()
|
||||
{
|
||||
return flags == other.flags;
|
||||
}
|
||||
|
||||
bool RectanglePlacement::operator!= (const RectanglePlacement& other) const throw()
|
||||
{
|
||||
return flags != other.flags;
|
||||
}
|
||||
|
||||
void RectanglePlacement::applyTo (double& x, double& y, double& w, double& h,
|
||||
const double dx, const double dy, const double dw, const double dh) const throw()
|
||||
{
|
||||
|
|
@ -130356,7 +130427,7 @@ typedef struct {
|
|||
* ov_open() to avoid problems with incompatible crt.o version linking
|
||||
* issues. */
|
||||
|
||||
static int _ov_header_fseek_wrap(FILE *f,ogg_int64_t off,int whence){
|
||||
/*static int _ov_header_fseek_wrap(FILE *f,ogg_int64_t off,int whence){
|
||||
if(f==NULL)return(-1);
|
||||
|
||||
#ifdef __MINGW32__
|
||||
|
|
@ -130366,7 +130437,7 @@ static int _ov_header_fseek_wrap(FILE *f,ogg_int64_t off,int whence){
|
|||
#else
|
||||
return fseek(f,off,whence);
|
||||
#endif
|
||||
}
|
||||
}*/
|
||||
|
||||
/* These structs below (OV_CALLBACKS_DEFAULT etc) are defined here as
|
||||
* static data. That means that every file which includes this header
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ namespace JuceDummyNamespace {}
|
|||
*/
|
||||
#define JUCE_MAJOR_VERSION 1
|
||||
#define JUCE_MINOR_VERSION 53
|
||||
#define JUCE_BUILDNUMBER 64
|
||||
#define JUCE_BUILDNUMBER 65
|
||||
|
||||
/** Current Juce version number.
|
||||
|
||||
|
|
@ -28462,6 +28462,9 @@ public:
|
|||
/** Copies another RectanglePlacement object. */
|
||||
RectanglePlacement& operator= (const RectanglePlacement& other) throw();
|
||||
|
||||
bool operator== (const RectanglePlacement& other) const throw();
|
||||
bool operator!= (const RectanglePlacement& other) const throw();
|
||||
|
||||
/** Flag values that can be combined and used in the constructor. */
|
||||
enum
|
||||
{
|
||||
|
|
@ -52020,6 +52023,62 @@ private:
|
|||
#endif
|
||||
#ifndef __JUCE_COMBOBOX_JUCEHEADER__
|
||||
|
||||
#endif
|
||||
#ifndef __JUCE_IMAGECOMPONENT_JUCEHEADER__
|
||||
|
||||
/*** Start of inlined file: juce_ImageComponent.h ***/
|
||||
#ifndef __JUCE_IMAGECOMPONENT_JUCEHEADER__
|
||||
#define __JUCE_IMAGECOMPONENT_JUCEHEADER__
|
||||
|
||||
/**
|
||||
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,
|
||||
const 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 (const RectanglePlacement& newPlacement);
|
||||
|
||||
/** Returns the current image placement. */
|
||||
const RectanglePlacement getImagePlacement() const;
|
||||
|
||||
/** @internal */
|
||||
void paint (Graphics& g);
|
||||
|
||||
private:
|
||||
Image image;
|
||||
RectanglePlacement placement;
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ImageComponent);
|
||||
};
|
||||
|
||||
#endif // __JUCE_IMAGECOMPONENT_JUCEHEADER__
|
||||
/*** End of inlined file: juce_ImageComponent.h ***/
|
||||
|
||||
|
||||
#endif
|
||||
#ifndef __JUCE_LABEL_JUCEHEADER__
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ typedef struct {
|
|||
* ov_open() to avoid problems with incompatible crt.o version linking
|
||||
* issues. */
|
||||
|
||||
static int _ov_header_fseek_wrap(FILE *f,ogg_int64_t off,int whence){
|
||||
/*static int _ov_header_fseek_wrap(FILE *f,ogg_int64_t off,int whence){
|
||||
if(f==NULL)return(-1);
|
||||
|
||||
#ifdef __MINGW32__
|
||||
|
|
@ -60,7 +60,7 @@ static int _ov_header_fseek_wrap(FILE *f,ogg_int64_t off,int whence){
|
|||
#else
|
||||
return fseek(f,off,whence);
|
||||
#endif
|
||||
}
|
||||
}*/
|
||||
|
||||
/* These structs below (OV_CALLBACKS_DEFAULT etc) are defined here as
|
||||
* static data. That means that every file which includes this header
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
*/
|
||||
#define JUCE_MAJOR_VERSION 1
|
||||
#define JUCE_MINOR_VERSION 53
|
||||
#define JUCE_BUILDNUMBER 64
|
||||
#define JUCE_BUILDNUMBER 65
|
||||
|
||||
/** Current Juce version number.
|
||||
|
||||
|
|
|
|||
89
src/gui/components/controls/juce_ImageComponent.cpp
Normal file
89
src/gui/components/controls/juce_ImageComponent.cpp
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
/*
|
||||
==============================================================================
|
||||
|
||||
This file is part of the JUCE library - "Jules' Utility Class Extensions"
|
||||
Copyright 2004-11 by Raw Material Software Ltd.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
JUCE can be redistributed and/or modified under the terms of the GNU General
|
||||
Public License (Version 2), as published by the Free Software Foundation.
|
||||
A copy of the license is included in the JUCE distribution, or can be found
|
||||
online 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.rawmaterialsoftware.com/juce for more information.
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#include "../../../core/juce_StandardHeader.h"
|
||||
|
||||
BEGIN_JUCE_NAMESPACE
|
||||
|
||||
#include "juce_ImageComponent.h"
|
||||
|
||||
|
||||
//==============================================================================
|
||||
ImageComponent::ImageComponent (const String& componentName)
|
||||
: Component (componentName),
|
||||
placement (RectanglePlacement::centred)
|
||||
{
|
||||
}
|
||||
|
||||
ImageComponent::~ImageComponent()
|
||||
{
|
||||
}
|
||||
|
||||
void ImageComponent::setImage (const Image& newImage)
|
||||
{
|
||||
if (image != newImage)
|
||||
{
|
||||
image = newImage;
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
|
||||
void ImageComponent::setImage (const Image& newImage, const RectanglePlacement& placementToUse)
|
||||
{
|
||||
if (image != newImage || placement != placementToUse)
|
||||
{
|
||||
image = newImage;
|
||||
placement = placementToUse;
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
|
||||
void ImageComponent::setImagePlacement (const RectanglePlacement& newPlacement)
|
||||
{
|
||||
if (placement != newPlacement)
|
||||
{
|
||||
placement = newPlacement;
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
|
||||
const Image ImageComponent::getImage() const
|
||||
{
|
||||
return image;
|
||||
}
|
||||
|
||||
const RectanglePlacement ImageComponent::getImagePlacement() const
|
||||
{
|
||||
return placement;
|
||||
}
|
||||
|
||||
void ImageComponent::paint (Graphics& g)
|
||||
{
|
||||
g.setOpacity (1.0f);
|
||||
g.drawImageWithin (image, 0, 0, getWidth(), getHeight(), placement, false);
|
||||
}
|
||||
|
||||
|
||||
END_JUCE_NAMESPACE
|
||||
83
src/gui/components/controls/juce_ImageComponent.h
Normal file
83
src/gui/components/controls/juce_ImageComponent.h
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
/*
|
||||
==============================================================================
|
||||
|
||||
This file is part of the JUCE library - "Jules' Utility Class Extensions"
|
||||
Copyright 2004-11 by Raw Material Software Ltd.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
JUCE can be redistributed and/or modified under the terms of the GNU General
|
||||
Public License (Version 2), as published by the Free Software Foundation.
|
||||
A copy of the license is included in the JUCE distribution, or can be found
|
||||
online 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.rawmaterialsoftware.com/juce for more information.
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#ifndef __JUCE_IMAGECOMPONENT_JUCEHEADER__
|
||||
#define __JUCE_IMAGECOMPONENT_JUCEHEADER__
|
||||
|
||||
#include "../juce_Component.h"
|
||||
#include "../mouse/juce_TooltipClient.h"
|
||||
|
||||
|
||||
//==============================================================================
|
||||
/**
|
||||
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,
|
||||
const 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 (const RectanglePlacement& newPlacement);
|
||||
|
||||
/** Returns the current image placement. */
|
||||
const RectanglePlacement getImagePlacement() const;
|
||||
|
||||
|
||||
//==============================================================================
|
||||
/** @internal */
|
||||
void paint (Graphics& g);
|
||||
|
||||
private:
|
||||
Image image;
|
||||
RectanglePlacement placement;
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ImageComponent);
|
||||
};
|
||||
|
||||
|
||||
#endif // __JUCE_IMAGECOMPONENT_JUCEHEADER__
|
||||
|
|
@ -42,6 +42,16 @@ RectanglePlacement& RectanglePlacement::operator= (const RectanglePlacement& oth
|
|||
return *this;
|
||||
}
|
||||
|
||||
bool RectanglePlacement::operator== (const RectanglePlacement& other) const throw()
|
||||
{
|
||||
return flags == other.flags;
|
||||
}
|
||||
|
||||
bool RectanglePlacement::operator!= (const RectanglePlacement& other) const throw()
|
||||
{
|
||||
return flags != other.flags;
|
||||
}
|
||||
|
||||
void RectanglePlacement::applyTo (double& x, double& y, double& w, double& h,
|
||||
const double dx, const double dy, const double dw, const double dh) const throw()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -51,6 +51,9 @@ public:
|
|||
/** Copies another RectanglePlacement object. */
|
||||
RectanglePlacement& operator= (const RectanglePlacement& other) throw();
|
||||
|
||||
bool operator== (const RectanglePlacement& other) const throw();
|
||||
bool operator!= (const RectanglePlacement& other) const throw();
|
||||
|
||||
//==============================================================================
|
||||
/** Flag values that can be combined and used in the constructor. */
|
||||
enum
|
||||
|
|
|
|||
|
|
@ -311,6 +311,9 @@
|
|||
#ifndef __JUCE_COMBOBOX_JUCEHEADER__
|
||||
#include "gui/components/controls/juce_ComboBox.h"
|
||||
#endif
|
||||
#ifndef __JUCE_IMAGECOMPONENT_JUCEHEADER__
|
||||
#include "gui/components/controls/juce_ImageComponent.h"
|
||||
#endif
|
||||
#ifndef __JUCE_LABEL_JUCEHEADER__
|
||||
#include "gui/components/controls/juce_Label.h"
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue