Browse Source

New class: ImageComponent, which just displays an image.

tags/2021-05-28
Julian Storer 14 years ago
parent
commit
1fb8929c55
20 changed files with 363 additions and 6 deletions
  1. +6
    -0
      Builds/Linux/Makefile
  2. +6
    -0
      Builds/MacOSX/Juce.xcodeproj/project.pbxproj
  3. +2
    -0
      Builds/VisualStudio2005/Juce.vcproj
  4. +2
    -0
      Builds/VisualStudio2008/Juce.vcproj
  5. +2
    -0
      Builds/VisualStudio2008_DLL/Juce.vcproj
  6. +2
    -0
      Builds/VisualStudio2010/Juce.vcxproj
  7. +6
    -0
      Builds/VisualStudio2010/Juce.vcxproj.filters
  8. +6
    -0
      Builds/iOS/Juce.xcodeproj/project.pbxproj
  9. +4
    -0
      Juce.jucer
  10. +1
    -0
      amalgamation/juce_amalgamated_template.cpp
  11. +2
    -0
      extras/Introjucer/Source/Utility/jucer_PresetIDs.h
  12. +73
    -2
      juce_amalgamated.cpp
  13. +60
    -1
      juce_amalgamated.h
  14. +2
    -2
      src/audio/audio_file_formats/oggvorbis/vorbisfile.h
  15. +1
    -1
      src/core/juce_StandardHeader.h
  16. +89
    -0
      src/gui/components/controls/juce_ImageComponent.cpp
  17. +83
    -0
      src/gui/components/controls/juce_ImageComponent.h
  18. +10
    -0
      src/gui/graphics/contexts/juce_RectanglePlacement.cpp
  19. +3
    -0
      src/gui/graphics/contexts/juce_RectanglePlacement.h
  20. +3
    -0
      src/juce_app_includes.h

+ 6
- 0
Builds/Linux/Makefile View File

@@ -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"


+ 6
- 0
Builds/MacOSX/Juce.xcodeproj/project.pbxproj View File

@@ -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,


+ 2
- 0
Builds/VisualStudio2005/Juce.vcproj View File

@@ -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"/>


+ 2
- 0
Builds/VisualStudio2008/Juce.vcproj View File

@@ -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"/>


+ 2
- 0
Builds/VisualStudio2008_DLL/Juce.vcproj View File

@@ -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"/>


+ 2
- 0
Builds/VisualStudio2010/Juce.vcxproj View File

@@ -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"/>


+ 6
- 0
Builds/VisualStudio2010/Juce.vcxproj.filters View File

@@ -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>


+ 6
- 0
Builds/iOS/Juce.xcodeproj/project.pbxproj View File

@@ -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,


+ 4
- 0
Juce.jucer View File

@@ -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"/>


+ 1
- 0
amalgamation/juce_amalgamated_template.cpp View File

@@ -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"


+ 2
- 0
extras/Introjucer/Source/Utility/jucer_PresetIDs.h View File

@@ -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);


+ 73
- 2
juce_amalgamated.cpp View File

@@ -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


+ 60
- 1
juce_amalgamated.h View File

@@ -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__



+ 2
- 2
src/audio/audio_file_formats/oggvorbis/vorbisfile.h View File

@@ -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


+ 1
- 1
src/core/juce_StandardHeader.h View File

@@ -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
- 0
src/gui/components/controls/juce_ImageComponent.cpp View 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
- 0
src/gui/components/controls/juce_ImageComponent.h View 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__

+ 10
- 0
src/gui/graphics/contexts/juce_RectanglePlacement.cpp View File

@@ -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()
{


+ 3
- 0
src/gui/graphics/contexts/juce_RectanglePlacement.h View File

@@ -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


+ 3
- 0
src/juce_app_includes.h View File

@@ -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…
Cancel
Save