1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Cleaned-up class inheritance visibilities and encapsulation for some internal classes.

This commit is contained in:
jules 2012-07-12 14:10:46 +01:00
parent 246cb94bb0
commit df729be74a
72 changed files with 373 additions and 375 deletions

View file

@ -488,7 +488,7 @@ public:
ScopedPointer<Component> appearanceEditorWindow; ScopedPointer<Component> appearanceEditorWindow;
private: private:
class AsyncQuitRetrier : public Timer class AsyncQuitRetrier : private Timer
{ {
public: public:
AsyncQuitRetrier() { startTimer (500); } AsyncQuitRetrier() { startTimer (500); }

View file

@ -155,11 +155,8 @@ NewFileWizard::NewFileWizard()
NewFileWizard::~NewFileWizard() NewFileWizard::~NewFileWizard()
{ {
clearSingletonInstance();
} }
juce_ImplementSingleton_SingleThreaded (NewFileWizard)
void NewFileWizard::addWizardsToMenu (PopupMenu& m) const void NewFileWizard::addWizardsToMenu (PopupMenu& m) const
{ {
for (int i = 0; i < wizards.size(); ++i) for (int i = 0; i < wizards.size(); ++i)

View file

@ -31,15 +31,13 @@
//============================================================================== //==============================================================================
class NewFileWizard : public DeletedAtShutdown class NewFileWizard : private DeletedAtShutdown
{ {
public: public:
//============================================================================== //==============================================================================
NewFileWizard(); NewFileWizard();
~NewFileWizard(); ~NewFileWizard();
juce_DeclareSingleton_SingleThreaded_Minimal (NewFileWizard);
//============================================================================== //==============================================================================
class Type class Type
{ {

View file

@ -135,7 +135,7 @@ void GroupTreeViewItem::addCreateFileMenuItems (PopupMenu& m)
m.addItem (1002, "Add Existing Files..."); m.addItem (1002, "Add Existing Files...");
m.addSeparator(); m.addSeparator();
NewFileWizard::getInstance()->addWizardsToMenu (m); NewFileWizard().addWizardsToMenu (m);
} }
void GroupTreeViewItem::processCreateFileMenuItem (int menuID) void GroupTreeViewItem::processCreateFileMenuItem (int menuID)
@ -146,7 +146,7 @@ void GroupTreeViewItem::processCreateFileMenuItem (int menuID)
case 1002: browseToAddExistingFiles(); break; case 1002: browseToAddExistingFiles(); break;
default: default:
NewFileWizard::getInstance()->runWizardFromMenu (menuID, item); NewFileWizard().runWizardFromMenu (menuID, item);
break; break;
} }
} }

View file

@ -27,7 +27,7 @@
//[MiscUserDefs] You can add your own user definitions and misc code here... //[MiscUserDefs] You can add your own user definitions and misc code here...
class RenderingTestCanvas : public Component, class RenderingTestCanvas : public Component,
public Timer private Timer
{ {
public: public:
RenderingTestCanvas (RenderingTestComponent& owner_) RenderingTestCanvas (RenderingTestComponent& owner_)

View file

@ -28,7 +28,7 @@
//============================================================================== //==============================================================================
class FontList : public DeletedAtShutdown class FontList : private DeletedAtShutdown
{ {
public: public:
FontList() FontList()

View file

@ -30,7 +30,7 @@
#endif #endif
//============================================================================== //==============================================================================
class CoreAudioInternal : public Timer class CoreAudioInternal : private Timer
{ {
public: public:
//============================================================================== //==============================================================================

View file

@ -166,8 +166,8 @@ bool AudioFormatWriter::writeFromAudioSampleBuffer (const AudioSampleBuffer& sou
} }
//============================================================================== //==============================================================================
class AudioFormatWriter::ThreadedWriter::Buffer : public TimeSliceClient, class AudioFormatWriter::ThreadedWriter::Buffer : public AbstractFifo,
public AbstractFifo private TimeSliceClient
{ {
public: public:
Buffer (TimeSliceThread& timeSliceThread_, AudioFormatWriter* writer_, int numChannels, int bufferSize_) Buffer (TimeSliceThread& timeSliceThread_, AudioFormatWriter* writer_, int numChannels, int bufferSize_)

View file

@ -30,7 +30,7 @@
//============================================================================== //==============================================================================
// Helper class to workaround carbon windows not getting mouse-moves.. // Helper class to workaround carbon windows not getting mouse-moves..
class FakeMouseMoveGenerator : public Timer class FakeMouseMoveGenerator : private Timer
{ {
public: public:
FakeMouseMoveGenerator() FakeMouseMoveGenerator()

View file

@ -46,7 +46,7 @@
AudioProcessorPlayer object. AudioProcessorPlayer object.
*/ */
class JUCE_API AudioProcessorGraph : public AudioProcessor, class JUCE_API AudioProcessorGraph : public AudioProcessor,
public AsyncUpdater private AsyncUpdater
{ {
public: public:
//============================================================================== //==============================================================================
@ -395,9 +395,6 @@ public:
void getStateInformation (juce::MemoryBlock& destData); void getStateInformation (juce::MemoryBlock& destData);
void setStateInformation (const void* data, int sizeInBytes); void setStateInformation (const void* data, int sizeInBytes);
/** @internal */
void handleAsyncUpdate();
private: private:
//============================================================================== //==============================================================================
ReferenceCountedArray <Node> nodes; ReferenceCountedArray <Node> nodes;
@ -415,9 +412,9 @@ private:
MidiBuffer* currentMidiInputBuffer; MidiBuffer* currentMidiInputBuffer;
MidiBuffer currentMidiOutputBuffer; MidiBuffer currentMidiOutputBuffer;
void handleAsyncUpdate();
void clearRenderingSequence(); void clearRenderingSequence();
void buildRenderingSequence(); void buildRenderingSequence();
bool isAnInputTo (uint32 possibleInputId, uint32 possibleDestinationId, int recursionCheck) const; bool isAnInputTo (uint32 possibleInputId, uint32 possibleDestinationId, int recursionCheck) const;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioProcessorGraph); JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioProcessorGraph);

View file

@ -24,8 +24,8 @@
*/ */
class ProcessorParameterPropertyComp : public PropertyComponent, class ProcessorParameterPropertyComp : public PropertyComponent,
public AudioProcessorListener, private AudioProcessorListener,
public Timer private Timer
{ {
public: public:
ProcessorParameterPropertyComp (const String& name, AudioProcessor& owner_, const int index_) ProcessorParameterPropertyComp (const String& name, AudioProcessor& owner_, const int index_)

View file

@ -67,7 +67,7 @@ private:
//============================================================================== //==============================================================================
class AudioDeviceSelectorComponent::MidiInputSelectorComponentListBox : public ListBox, class AudioDeviceSelectorComponent::MidiInputSelectorComponentListBox : public ListBox,
public ListBoxModel private ListBoxModel
{ {
public: public:
//============================================================================== //==============================================================================
@ -196,9 +196,9 @@ struct AudioDeviceSetupDetails
//============================================================================== //==============================================================================
class AudioDeviceSettingsPanel : public Component, class AudioDeviceSettingsPanel : public Component,
public ChangeListener, private ChangeListener,
public ComboBoxListener, // (can't use ComboBox::Listener due to idiotic VC2005 bug) private ComboBoxListener, // (can't use ComboBox::Listener due to idiotic VC2005 bug)
public ButtonListener private ButtonListener
{ {
public: public:
AudioDeviceSettingsPanel (AudioIODeviceType* type_, AudioDeviceSettingsPanel (AudioIODeviceType* type_,
@ -661,7 +661,7 @@ private:
public: public:
//============================================================================== //==============================================================================
class ChannelSelectorListBox : public ListBox, class ChannelSelectorListBox : public ListBox,
public ListBoxModel private ListBoxModel
{ {
public: public:
enum BoxType enum BoxType

View file

@ -37,8 +37,8 @@
@see AudioDeviceManager @see AudioDeviceManager
*/ */
class JUCE_API AudioDeviceSelectorComponent : public Component, class JUCE_API AudioDeviceSelectorComponent : public Component,
public ComboBoxListener, // (can't use ComboBox::Listener due to idiotic VC2005 bug) private ComboBoxListener, // (can't use ComboBox::Listener due to idiotic VC2005 bug)
public ChangeListener private ChangeListener
{ {
public: public:
//============================================================================== //==============================================================================
@ -78,10 +78,6 @@ public:
/** @internal */ /** @internal */
void resized(); void resized();
/** @internal */ /** @internal */
void comboBoxChanged (ComboBox*);
/** @internal */
void changeListenerCallback (ChangeBroadcaster*);
/** @internal */
void childBoundsChanged (Component*); void childBoundsChanged (Component*);
private: private:
@ -101,6 +97,8 @@ private:
ScopedPointer<ComboBox> midiOutputSelector; ScopedPointer<ComboBox> midiOutputSelector;
ScopedPointer<Label> midiInputsLabel, midiOutputLabel; ScopedPointer<Label> midiInputsLabel, midiOutputLabel;
void comboBoxChanged (ComboBox*);
void changeListenerCallback (ChangeBroadcaster*);
void updateAllControls(); void updateAllControls();
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioDeviceSelectorComponent); JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioDeviceSelectorComponent);

View file

@ -90,7 +90,7 @@ public:
~LevelDataSource() ~LevelDataSource()
{ {
owner.cache.removeTimeSliceClient (this); owner.cache.getTimeSliceThread().removeTimeSliceClient (this);
} }
enum { timeBeforeDeletingReader = 3000 }; enum { timeBeforeDeletingReader = 3000 };
@ -112,7 +112,7 @@ public:
if (lengthInSamples <= 0 || isFullyLoaded()) if (lengthInSamples <= 0 || isFullyLoaded())
reader = nullptr; reader = nullptr;
else else
owner.cache.addTimeSliceClient (this); owner.cache.getTimeSliceThread().addTimeSliceClient (this);
} }
} }
@ -127,7 +127,7 @@ public:
if (reader != nullptr) if (reader != nullptr)
{ {
lastReaderUseTime = Time::getMillisecondCounter(); lastReaderUseTime = Time::getMillisecondCounter();
owner.cache.addTimeSliceClient (this); owner.cache.getTimeSliceThread().addTimeSliceClient (this);
} }
} }

View file

@ -57,11 +57,11 @@ private:
//============================================================================== //==============================================================================
AudioThumbnailCache::AudioThumbnailCache (const int maxNumThumbsToStore_) AudioThumbnailCache::AudioThumbnailCache (const int maxNumThumbsToStore_)
: TimeSliceThread ("thumb cache"), : thread ("thumb cache"),
maxNumThumbsToStore (maxNumThumbsToStore_) maxNumThumbsToStore (maxNumThumbsToStore_)
{ {
jassert (maxNumThumbsToStore > 0); jassert (maxNumThumbsToStore > 0);
startThread (2); thread.startThread (2);
} }
AudioThumbnailCache::~AudioThumbnailCache() AudioThumbnailCache::~AudioThumbnailCache()

View file

@ -39,7 +39,7 @@
@see AudioThumbnail @see AudioThumbnail
*/ */
class JUCE_API AudioThumbnailCache : public TimeSliceThread class JUCE_API AudioThumbnailCache
{ {
public: public:
//============================================================================== //==============================================================================
@ -85,8 +85,13 @@ public:
*/ */
void writeToStream (OutputStream& stream); void writeToStream (OutputStream& stream);
/** Returns the thread that client thumbnails can use. */
TimeSliceThread& getTimeSliceThread() noexcept { return thread; }
private: private:
//============================================================================== //==============================================================================
TimeSliceThread thread;
class ThumbnailCacheEntry; class ThumbnailCacheEntry;
friend class OwnedArray<ThumbnailCacheEntry>; friend class OwnedArray<ThumbnailCacheEntry>;
OwnedArray<ThumbnailCacheEntry> thumbs; OwnedArray<ThumbnailCacheEntry> thumbs;

View file

@ -170,7 +170,7 @@ public:
ValueSource classes to allow Value objects to represent your own custom data items. ValueSource classes to allow Value objects to represent your own custom data items.
*/ */
class JUCE_API ValueSource : public SingleThreadedReferenceCountedObject, class JUCE_API ValueSource : public SingleThreadedReferenceCountedObject,
public AsyncUpdater private AsyncUpdater
{ {
public: public:
ValueSource(); ValueSource();

View file

@ -785,7 +785,7 @@ Identifier ValueTree::getPropertyName (const int index) const
//============================================================================== //==============================================================================
class ValueTreePropertyValueSource : public Value::ValueSource, class ValueTreePropertyValueSource : public Value::ValueSource,
public ValueTree::Listener private ValueTree::Listener
{ {
public: public:
ValueTreePropertyValueSource (const ValueTree& tree_, const Identifier& property_, ValueTreePropertyValueSource (const ValueTree& tree_, const Identifier& property_,
@ -803,6 +803,11 @@ public:
var getValue() const { return tree [property]; } var getValue() const { return tree [property]; }
void setValue (const var& newValue) { tree.setProperty (property, newValue, undoManager); } void setValue (const var& newValue) { tree.setProperty (property, newValue, undoManager); }
private:
ValueTree tree;
const Identifier property;
UndoManager* const undoManager;
void valueTreePropertyChanged (ValueTree& treeWhosePropertyHasChanged, void valueTreePropertyChanged (ValueTree& treeWhosePropertyHasChanged,
const Identifier& changedProperty) const Identifier& changedProperty)
{ {
@ -815,11 +820,6 @@ public:
void valueTreeChildOrderChanged (ValueTree&) {} void valueTreeChildOrderChanged (ValueTree&) {}
void valueTreeParentChanged (ValueTree&) {} void valueTreeParentChanged (ValueTree&) {}
private:
ValueTree tree;
const Identifier property;
UndoManager* const undoManager;
JUCE_DECLARE_NON_COPYABLE (ValueTreePropertyValueSource); JUCE_DECLARE_NON_COPYABLE (ValueTreePropertyValueSource);
}; };

View file

@ -48,7 +48,7 @@ class MemoryBlock;
@see InterprocessConnectionServer, Socket, NamedPipe @see InterprocessConnectionServer, Socket, NamedPipe
*/ */
class JUCE_API InterprocessConnection : public Thread class JUCE_API InterprocessConnection : private Thread
{ {
public: public:
//============================================================================== //==============================================================================

View file

@ -42,112 +42,111 @@ namespace ColourHelpers
+ g * g * 0.691f + g * g * 0.691f
+ b * b * 0.068f); + b * b * 0.068f);
} }
}
//============================================================================== //==============================================================================
struct HSB struct HSB
{
HSB (const Colour& col) noexcept
{ {
const int r = col.getRed(); HSB (const Colour& col) noexcept
const int g = col.getGreen();
const int b = col.getBlue();
const int hi = jmax (r, g, b);
const int lo = jmin (r, g, b);
if (hi != 0)
{ {
saturation = (hi - lo) / (float) hi; const int r = col.getRed();
const int g = col.getGreen();
const int b = col.getBlue();
if (saturation > 0) const int hi = jmax (r, g, b);
const int lo = jmin (r, g, b);
if (hi != 0)
{ {
const float invDiff = 1.0f / (hi - lo); saturation = (hi - lo) / (float) hi;
const float red = (hi - r) * invDiff; if (saturation > 0)
const float green = (hi - g) * invDiff; {
const float blue = (hi - b) * invDiff; const float invDiff = 1.0f / (hi - lo);
if (r == hi) const float red = (hi - r) * invDiff;
hue = blue - green; const float green = (hi - g) * invDiff;
else if (g == hi) const float blue = (hi - b) * invDiff;
hue = 2.0f + red - blue;
if (r == hi)
hue = blue - green;
else if (g == hi)
hue = 2.0f + red - blue;
else
hue = 4.0f + green - red;
hue *= 1.0f / 6.0f;
if (hue < 0)
++hue;
}
else else
hue = 4.0f + green - red; {
hue = 0;
hue *= 1.0f / 6.0f; }
if (hue < 0)
++hue;
} }
else else
{ {
hue = 0; saturation = hue = 0;
} }
brightness = hi / 255.0f;
} }
else
Colour toColour (const Colour& original) const noexcept
{ {
saturation = hue = 0; return Colour (hue, saturation, brightness, original.getAlpha());
} }
brightness = hi / 255.0f; static PixelARGB toRGB (float h, float s, float v, const uint8 alpha) noexcept
} {
v = jlimit (0.0f, 255.0f, v * 255.0f);
const uint8 intV = (uint8) roundToInt (v);
Colour toColour (const Colour& original) const noexcept if (s <= 0)
return PixelARGB (alpha, intV, intV, intV);
s = jmin (1.0f, s);
h = (h - std::floor (h)) * 6.0f + 0.00001f; // need a small adjustment to compensate for rounding errors
const float f = h - std::floor (h);
const uint8 x = (uint8) roundToInt (v * (1.0f - s));
if (h < 1.0f) return PixelARGB (alpha, intV, (uint8) roundToInt (v * (1.0f - (s * (1.0f - f)))), x);
if (h < 2.0f) return PixelARGB (alpha, (uint8) roundToInt (v * (1.0f - s * f)), intV, x);
if (h < 3.0f) return PixelARGB (alpha, x, intV, (uint8) roundToInt (v * (1.0f - (s * (1.0f - f)))));
if (h < 4.0f) return PixelARGB (alpha, x, (uint8) roundToInt (v * (1.0f - s * f)), intV);
if (h < 5.0f) return PixelARGB (alpha, (uint8) roundToInt (v * (1.0f - (s * (1.0f - f)))), x, intV);
else return PixelARGB (alpha, intV, x, (uint8) roundToInt (v * (1.0f - s * f)));
}
float hue, saturation, brightness;
};
//==============================================================================
struct YIQ
{ {
return Colour (hue, saturation, brightness, original.getAlpha()); YIQ (const Colour& c) noexcept
} {
const float r = c.getFloatRed();
const float g = c.getFloatGreen();
const float b = c.getFloatBlue();
static PixelARGB toRGB (float h, float s, float v, const uint8 alpha) noexcept y = 0.2999f * r + 0.5870f * g + 0.1140f * b;
{ i = 0.5957f * r - 0.2744f * g - 0.3212f * b;
v = jlimit (0.0f, 255.0f, v * 255.0f); q = 0.2114f * r - 0.5225f * g - 0.3113f * b;
const uint8 intV = (uint8) roundToInt (v); alpha = c.getFloatAlpha();
}
if (s <= 0) Colour toColour() const noexcept
return PixelARGB (alpha, intV, intV, intV); {
return Colour::fromFloatRGBA (y + 0.9563f * i + 0.6210f * q,
s = jmin (1.0f, s); y - 0.2721f * i - 0.6474f * q,
h = (h - std::floor (h)) * 6.0f + 0.00001f; // need a small adjustment to compensate for rounding errors y - 1.1070f * i + 1.7046f * q,
const float f = h - std::floor (h); alpha);
const uint8 x = (uint8) roundToInt (v * (1.0f - s)); }
if (h < 1.0f) return PixelARGB (alpha, intV, (uint8) roundToInt (v * (1.0f - (s * (1.0f - f)))), x);
if (h < 2.0f) return PixelARGB (alpha, (uint8) roundToInt (v * (1.0f - s * f)), intV, x);
if (h < 3.0f) return PixelARGB (alpha, x, intV, (uint8) roundToInt (v * (1.0f - (s * (1.0f - f)))));
if (h < 4.0f) return PixelARGB (alpha, x, (uint8) roundToInt (v * (1.0f - s * f)), intV);
if (h < 5.0f) return PixelARGB (alpha, (uint8) roundToInt (v * (1.0f - (s * (1.0f - f)))), x, intV);
else return PixelARGB (alpha, intV, x, (uint8) roundToInt (v * (1.0f - s * f)));
}
float hue, saturation, brightness;
};
//==============================================================================
struct YIQ
{
YIQ (const Colour& c) noexcept
{
const float r = c.getFloatRed();
const float g = c.getFloatGreen();
const float b = c.getFloatBlue();
y = 0.299900f * r + 0.587000f * g + 0.114000f * b;
i = 0.595716f * r - 0.274453f * g - 0.321264f * b;
q = 0.211456f * r - 0.522591f * g - 0.311350f * b;
alpha = c.getFloatAlpha();
}
Colour toColour() const noexcept
{
return Colour::fromFloatRGBA (y + 0.9563f * i + 0.6210f * q,
y - 0.2721f * i - 0.6474f * q,
y - 1.1070f * i + 1.7046f * q,
alpha);
}
float y, i, q, alpha;
};
float y, i, q, alpha;
};
}
//============================================================================== //==============================================================================
Colour::Colour() noexcept Colour::Colour() noexcept
@ -206,7 +205,7 @@ Colour Colour::fromFloatRGBA (const float red, const float green, const float bl
} }
Colour::Colour (const float hue, const float saturation, const float brightness, const float alpha) noexcept Colour::Colour (const float hue, const float saturation, const float brightness, const float alpha) noexcept
: argb (HSB::toRGB (hue, saturation, brightness, ColourHelpers::floatToUInt8 (alpha))) : argb (ColourHelpers::HSB::toRGB (hue, saturation, brightness, ColourHelpers::floatToUInt8 (alpha)))
{ {
} }
@ -216,7 +215,7 @@ Colour Colour::fromHSV (const float hue, const float saturation, const float bri
} }
Colour::Colour (const float hue, const float saturation, const float brightness, const uint8 alpha) noexcept Colour::Colour (const float hue, const float saturation, const float brightness, const uint8 alpha) noexcept
: argb (HSB::toRGB (hue, saturation, brightness, alpha)) : argb (ColourHelpers::HSB::toRGB (hue, saturation, brightness, alpha))
{ {
} }
@ -320,38 +319,38 @@ float Colour::getFloatAlpha() const noexcept { return getAlpha() / 255.0f; }
//============================================================================== //==============================================================================
void Colour::getHSB (float& h, float& s, float& v) const noexcept void Colour::getHSB (float& h, float& s, float& v) const noexcept
{ {
const HSB hsb (*this); const ColourHelpers::HSB hsb (*this);
h = hsb.hue; h = hsb.hue;
s = hsb.saturation; s = hsb.saturation;
v = hsb.brightness; v = hsb.brightness;
} }
float Colour::getHue() const noexcept { return HSB (*this).hue; } float Colour::getHue() const noexcept { return ColourHelpers::HSB (*this).hue; }
float Colour::getSaturation() const noexcept { return HSB (*this).saturation; } float Colour::getSaturation() const noexcept { return ColourHelpers::HSB (*this).saturation; }
float Colour::getBrightness() const noexcept { return HSB (*this).brightness; } float Colour::getBrightness() const noexcept { return ColourHelpers::HSB (*this).brightness; }
Colour Colour::withHue (float h) const noexcept { HSB hsb (*this); hsb.hue = h; return hsb.toColour (*this); } Colour Colour::withHue (float h) const noexcept { ColourHelpers::HSB hsb (*this); hsb.hue = h; return hsb.toColour (*this); }
Colour Colour::withSaturation (float s) const noexcept { HSB hsb (*this); hsb.saturation = s; return hsb.toColour (*this); } Colour Colour::withSaturation (float s) const noexcept { ColourHelpers::HSB hsb (*this); hsb.saturation = s; return hsb.toColour (*this); }
Colour Colour::withBrightness (float v) const noexcept { HSB hsb (*this); hsb.brightness = v; return hsb.toColour (*this); } Colour Colour::withBrightness (float v) const noexcept { ColourHelpers::HSB hsb (*this); hsb.brightness = v; return hsb.toColour (*this); }
//============================================================================== //==============================================================================
Colour Colour::withRotatedHue (const float amountToRotate) const noexcept Colour Colour::withRotatedHue (const float amountToRotate) const noexcept
{ {
HSB hsb (*this); ColourHelpers::HSB hsb (*this);
hsb.hue += amountToRotate; hsb.hue += amountToRotate;
return hsb.toColour (*this); return hsb.toColour (*this);
} }
Colour Colour::withMultipliedSaturation (const float amount) const noexcept Colour Colour::withMultipliedSaturation (const float amount) const noexcept
{ {
HSB hsb (*this); ColourHelpers::HSB hsb (*this);
hsb.saturation = jmin (1.0f, hsb.saturation * amount); hsb.saturation = jmin (1.0f, hsb.saturation * amount);
return hsb.toColour (*this); return hsb.toColour (*this);
} }
Colour Colour::withMultipliedBrightness (const float amount) const noexcept Colour Colour::withMultipliedBrightness (const float amount) const noexcept
{ {
HSB hsb (*this); ColourHelpers::HSB hsb (*this);
hsb.brightness = jmin (1.0f, hsb.brightness * amount); hsb.brightness = jmin (1.0f, hsb.brightness * amount);
return hsb.toColour (*this); return hsb.toColour (*this);
} }
@ -394,8 +393,8 @@ Colour Colour::contrasting (const float amount) const noexcept
Colour Colour::contrasting (const Colour& target, float minContrast) const noexcept Colour Colour::contrasting (const Colour& target, float minContrast) const noexcept
{ {
const YIQ bg (*this); const ColourHelpers::YIQ bg (*this);
YIQ fg (target); ColourHelpers::YIQ fg (target);
if (fabs (bg.y - fg.y) >= minContrast) if (fabs (bg.y - fg.y) >= minContrast)
return target; return target;

View file

@ -39,7 +39,7 @@ typedef Typeface::Ptr (*GetTypefaceForFont) (const Font&);
GetTypefaceForFont juce_getTypefaceForFont = nullptr; GetTypefaceForFont juce_getTypefaceForFont = nullptr;
//============================================================================== //==============================================================================
class TypefaceCache : public DeletedAtShutdown class TypefaceCache : private DeletedAtShutdown
{ {
public: public:
TypefaceCache() TypefaceCache()

View file

@ -23,8 +23,8 @@
============================================================================== ==============================================================================
*/ */
class ImageCache::Pimpl : public Timer, class ImageCache::Pimpl : private Timer,
public DeletedAtShutdown private DeletedAtShutdown
{ {
public: public:
Pimpl() Pimpl()

View file

@ -127,7 +127,7 @@ private:
}; };
//============================================================================== //==============================================================================
class FTTypefaceList : public DeletedAtShutdown class FTTypefaceList : private DeletedAtShutdown
{ {
public: public:
FTTypefaceList() FTTypefaceList()

View file

@ -87,7 +87,7 @@
*/ */
class JUCE_API KeyPressMappingSet : public KeyListener, class JUCE_API KeyPressMappingSet : public KeyListener,
public ChangeBroadcaster, public ChangeBroadcaster,
public FocusChangeListener private FocusChangeListener
{ {
public: public:
//============================================================================== //==============================================================================

View file

@ -208,10 +208,11 @@ public:
for (int i = desktop.getNumMouseSources(); --i >= 0;) for (int i = desktop.getNumMouseSources(); --i >= 0;)
{ {
MouseInputSource* const source = desktop.getMouseSource(i); MouseInputSource& source = *desktop.getMouseSource(i);
if (source->isDragging())
if (source.isDragging())
{ {
source->triggerFakeMove(); source.triggerFakeMove();
++numMiceDown; ++numMiceDown;
} }
} }

View file

@ -38,8 +38,8 @@
@see Component::enterModalState, Component::exitModalState, Component::isCurrentlyModal, @see Component::enterModalState, Component::exitModalState, Component::isCurrentlyModal,
Component::getCurrentlyModalComponent, Component::isCurrentlyBlockedByAnotherModalComponent Component::getCurrentlyModalComponent, Component::isCurrentlyBlockedByAnotherModalComponent
*/ */
class JUCE_API ModalComponentManager : public AsyncUpdater, class JUCE_API ModalComponentManager : private AsyncUpdater,
public DeletedAtShutdown private DeletedAtShutdown
{ {
public: public:
//============================================================================== //==============================================================================

View file

@ -40,7 +40,7 @@
@see FileListComponent, FileBrowserComponent @see FileListComponent, FileBrowserComponent
*/ */
class JUCE_API DirectoryContentsList : public ChangeBroadcaster, class JUCE_API DirectoryContentsList : public ChangeBroadcaster,
public TimeSliceClient private TimeSliceClient
{ {
public: public:
//============================================================================== //==============================================================================
@ -184,8 +184,6 @@ public:
//============================================================================== //==============================================================================
/** @internal */ /** @internal */
int useTimeSlice();
/** @internal */
TimeSliceThread& getTimeSliceThread() { return thread; } TimeSliceThread& getTimeSliceThread() { return thread; }
/** @internal */ /** @internal */
static int compareElements (const DirectoryContentsList::FileInfo* first, static int compareElements (const DirectoryContentsList::FileInfo* first,
@ -203,6 +201,7 @@ private:
ScopedPointer <DirectoryIterator> fileFindHandle; ScopedPointer <DirectoryIterator> fileFindHandle;
bool volatile shouldStop; bool volatile shouldStop;
int useTimeSlice();
void stopSearching(); void stopSearching();
void changed(); void changed();
bool checkNextFile (bool& hasChanged); bool checkNextFile (bool& hasChanged);

View file

@ -68,8 +68,8 @@
@see FileChooser @see FileChooser
*/ */
class JUCE_API FileChooserDialogBox : public ResizableWindow, class JUCE_API FileChooserDialogBox : public ResizableWindow,
public ButtonListener, // (can't use Button::Listener due to idiotic VC2005 bug) private ButtonListener, // (can't use Button::Listener due to idiotic VC2005 bug)
public FileBrowserListener private FileBrowserListener
{ {
public: public:
//============================================================================== //==============================================================================
@ -121,7 +121,7 @@ public:
/** Sets the size of this dialog box to its default and positions it either in the /** Sets the size of this dialog box to its default and positions it either in the
centre of the screen, or centred around a component that is provided. centre of the screen, or centred around a component that is provided.
*/ */
void centreWithDefaultSize (Component* componentToCentreAround = 0); void centreWithDefaultSize (Component* componentToCentreAround = nullptr);
//============================================================================== //==============================================================================
/** A set of colour IDs to use to change the colour of various aspects of the box. /** A set of colour IDs to use to change the colour of various aspects of the box.
@ -136,25 +136,18 @@ public:
titleTextColourId = 0x1000850, /**< The colour to use to draw the box's title. */ titleTextColourId = 0x1000850, /**< The colour to use to draw the box's title. */
}; };
//==============================================================================
/** @internal */
void buttonClicked (Button*);
/** @internal */
void closeButtonPressed();
/** @internal */
void selectionChanged();
/** @internal */
void fileClicked (const File&, const MouseEvent&);
/** @internal */
void fileDoubleClicked (const File&);
/** @internal */
void browserRootChanged (const File&);
private: private:
class ContentComponent; class ContentComponent;
ContentComponent* content; ContentComponent* content;
const bool warnAboutOverwritingExistingFiles; const bool warnAboutOverwritingExistingFiles;
void buttonClicked (Button*);
void closeButtonPressed();
void selectionChanged();
void fileClicked (const File&, const MouseEvent&);
void fileDoubleClicked (const File&);
void browserRootChanged (const File&);
void okButtonPressed(); void okButtonPressed();
void createNewFolder(); void createNewFolder();
void createNewFolderConfirmed (const String& name); void createNewFolderConfirmed (const String& name);

View file

@ -87,17 +87,17 @@ void FileListComponent::changeListenerCallback (ChangeBroadcaster*)
} }
//============================================================================== //==============================================================================
class FileListItemComponent : public Component, class FileListComponent::ItemComponent : public Component,
public TimeSliceClient, private TimeSliceClient,
public AsyncUpdater private AsyncUpdater
{ {
public: public:
FileListItemComponent (FileListComponent& owner_, TimeSliceThread& thread_) ItemComponent (FileListComponent& owner_, TimeSliceThread& thread_)
: owner (owner_), thread (thread_), index (0), highlighted (false) : owner (owner_), thread (thread_), index (0), highlighted (false)
{ {
} }
~FileListItemComponent() ~ItemComponent()
{ {
thread.removeTimeSliceClient (this); thread.removeTimeSliceClient (this);
} }
@ -213,7 +213,7 @@ private:
} }
} }
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FileListItemComponent); JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ItemComponent);
}; };
//============================================================================== //==============================================================================
@ -228,12 +228,12 @@ void FileListComponent::paintListBoxItem (int, Graphics&, int, int, bool)
Component* FileListComponent::refreshComponentForRow (int row, bool isSelected, Component* existingComponentToUpdate) Component* FileListComponent::refreshComponentForRow (int row, bool isSelected, Component* existingComponentToUpdate)
{ {
jassert (existingComponentToUpdate == nullptr || dynamic_cast <FileListItemComponent*> (existingComponentToUpdate) != nullptr); jassert (existingComponentToUpdate == nullptr || dynamic_cast <ItemComponent*> (existingComponentToUpdate) != nullptr);
FileListItemComponent* comp = static_cast <FileListItemComponent*> (existingComponentToUpdate); ItemComponent* comp = static_cast <ItemComponent*> (existingComponentToUpdate);
if (comp == nullptr) if (comp == nullptr)
comp = new FileListItemComponent (*this, fileList.getTimeSliceThread()); comp = new ItemComponent (*this, fileList.getTimeSliceThread());
DirectoryContentsList::FileInfo fileInfo; DirectoryContentsList::FileInfo fileInfo;
comp->update (fileList.getDirectory(), comp->update (fileList.getDirectory(),

View file

@ -80,26 +80,21 @@ public:
(and if the file isn't in the list, all other items will be deselected). */ (and if the file isn't in the list, all other items will be deselected). */
void setSelectedFile (const File&); void setSelectedFile (const File&);
//==============================================================================
/** @internal */
void changeListenerCallback (ChangeBroadcaster*);
/** @internal */
int getNumRows();
/** @internal */
void paintListBoxItem (int, Graphics&, int, int, bool);
/** @internal */
Component* refreshComponentForRow (int rowNumber, bool isRowSelected, Component* existingComponentToUpdate);
/** @internal */
void selectedRowsChanged (int lastRowSelected);
/** @internal */
void deleteKeyPressed (int currentSelectedRow);
/** @internal */
void returnKeyPressed (int currentSelectedRow);
private: private:
//============================================================================== //==============================================================================
File lastDirectory; File lastDirectory;
class ItemComponent;
void changeListenerCallback (ChangeBroadcaster*);
int getNumRows();
void paintListBoxItem (int, Graphics&, int, int, bool);
Component* refreshComponentForRow (int rowNumber, bool isRowSelected, Component* existingComponentToUpdate);
void selectedRowsChanged (int lastRowSelected);
void deleteKeyPressed (int currentSelectedRow);
void returnKeyPressed (int currentSelectedRow);
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FileListComponent); JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FileListComponent);
}; };

View file

@ -27,9 +27,9 @@ Image juce_createIconForFile (const File& file);
//============================================================================== //==============================================================================
class FileListTreeItem : public TreeViewItem, class FileListTreeItem : public TreeViewItem,
public TimeSliceClient, private TimeSliceClient,
public AsyncUpdater, private AsyncUpdater,
public ChangeListener private ChangeListener
{ {
public: public:
FileListTreeItem (FileTreeComponent& owner_, FileListTreeItem (FileTreeComponent& owner_,

View file

@ -33,7 +33,7 @@
/** /**
*/ */
class JUCE_API CaretComponent : public Component, class JUCE_API CaretComponent : public Component,
public Timer private Timer
{ {
public: public:
//============================================================================== //==============================================================================
@ -69,12 +69,12 @@ public:
//============================================================================== //==============================================================================
/** @internal */ /** @internal */
void paint (Graphics& g); void paint (Graphics& g);
/** @internal */
void timerCallback();
private: private:
Component* owner; Component* owner;
bool shouldBeShown() const; bool shouldBeShown() const;
void timerCallback();
JUCE_DECLARE_NON_COPYABLE (CaretComponent); JUCE_DECLARE_NON_COPYABLE (CaretComponent);
}; };

View file

@ -79,10 +79,10 @@ MultiDocumentPanel* MultiDocumentPanelWindow::getOwner() const noexcept
//============================================================================== //==============================================================================
class MDITabbedComponentInternal : public TabbedComponent class MultiDocumentPanel::TabbedComponentInternal : public TabbedComponent
{ {
public: public:
MDITabbedComponentInternal() TabbedComponentInternal()
: TabbedComponent (TabbedButtonBar::TabsAtTop) : TabbedComponent (TabbedButtonBar::TabsAtTop)
{ {
} }
@ -203,7 +203,7 @@ bool MultiDocumentPanel::addDocument (Component* const component,
{ {
if (tabComponent == nullptr && components.size() > numDocsBeforeTabsUsed) if (tabComponent == nullptr && components.size() > numDocsBeforeTabsUsed)
{ {
addAndMakeVisible (tabComponent = new MDITabbedComponentInternal()); addAndMakeVisible (tabComponent = new TabbedComponentInternal());
Array <Component*> temp (components); Array <Component*> temp (components);

View file

@ -29,7 +29,6 @@
#include "juce_TabbedComponent.h" #include "juce_TabbedComponent.h"
#include "../windows/juce_DocumentWindow.h" #include "../windows/juce_DocumentWindow.h"
class MultiDocumentPanel; class MultiDocumentPanel;
class MDITabbedComponentInternal;
//============================================================================== //==============================================================================
@ -293,8 +292,9 @@ private:
Colour backgroundColour; Colour backgroundColour;
int maximumNumDocuments, numDocsBeforeTabsUsed; int maximumNumDocuments, numDocsBeforeTabsUsed;
class TabbedComponentInternal;
friend class MultiDocumentPanelWindow; friend class MultiDocumentPanelWindow;
friend class MDITabbedComponentInternal; friend class TabbedComponentInternal;
Component* getContainerComp (Component* c) const; Component* getContainerComp (Component* c) const;
void updateOrder(); void updateOrder();

View file

@ -1605,7 +1605,7 @@ Button* LookAndFeel::createSliderButton (const bool isIncrement)
return new TextButton (isIncrement ? "+" : "-", String::empty); return new TextButton (isIncrement ? "+" : "-", String::empty);
} }
class SliderLabelComp : public Label class LookAndFeel::SliderLabelComp : public Label
{ {
public: public:
SliderLabelComp() : Label (String::empty, String::empty) {} SliderLabelComp() : Label (String::empty, String::empty) {}
@ -1827,7 +1827,7 @@ void LookAndFeel::drawDocumentWindowTitleBar (DocumentWindow& window,
} }
//============================================================================== //==============================================================================
class GlassWindowButton : public Button class LookAndFeel::GlassWindowButton : public Button
{ {
public: public:
//============================================================================== //==============================================================================
@ -1841,10 +1841,6 @@ public:
{ {
} }
~GlassWindowButton()
{
}
//============================================================================== //==============================================================================
void paintButton (Graphics& g, bool isMouseOverButton, bool isButtonDown) void paintButton (Graphics& g, bool isMouseOverButton, bool isButtonDown)
{ {

View file

@ -639,6 +639,9 @@ private:
virtual int getTabButtonBestWidth (int, const String&, int, Button&) { return 0; } virtual int getTabButtonBestWidth (int, const String&, int, Button&) { return 0; }
#endif #endif
class GlassWindowButton;
class SliderLabelComp;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (LookAndFeel); JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (LookAndFeel);
}; };

View file

@ -1244,7 +1244,7 @@ void PopupMenu::addCustomItem (const int itemResultId, CustomComponent* const cu
Colours::black, false, customComponent, nullptr, nullptr)); Colours::black, false, customComponent, nullptr, nullptr));
} }
class NormalComponentWrapper : public PopupMenu::CustomComponent class PopupMenu::NormalComponentWrapper : public PopupMenu::CustomComponent
{ {
public: public:
NormalComponentWrapper (Component* const comp, const int w, const int h, NormalComponentWrapper (Component* const comp, const int w, const int h,
@ -1301,7 +1301,7 @@ void PopupMenu::addSeparator()
} }
//============================================================================== //==============================================================================
class HeaderItemComponent : public PopupMenu::CustomComponent class PopupMenu::HeaderItemComponent : public PopupMenu::CustomComponent
{ {
public: public:
HeaderItemComponent (const String& name) HeaderItemComponent (const String& name)

View file

@ -478,6 +478,8 @@ private:
//============================================================================== //==============================================================================
class Item; class Item;
class ItemComponent; class ItemComponent;
class HeaderItemComponent;
class NormalComponentWrapper;
friend class MenuItemIterator; friend class MenuItemIterator;
friend class ItemComponent; friend class ItemComponent;

View file

@ -23,7 +23,7 @@
============================================================================== ==============================================================================
*/ */
class ShadowWindow : public Component class DropShadower::ShadowWindow : public Component
{ {
public: public:
ShadowWindow (Component& owner, const int type_, const Image shadowImageSections [12]) ShadowWindow (Component& owner, const int type_, const Image shadowImageSections [12])

View file

@ -59,6 +59,8 @@ public:
private: private:
//============================================================================== //==============================================================================
class ShadowWindow;
Component* owner; Component* owner;
OwnedArray<Component> shadowWindows; OwnedArray<Component> shadowWindows;
Image shadowImageSections[12]; Image shadowImageSections[12];

View file

@ -28,8 +28,8 @@ bool juce_performDragDropText (const String&, bool& shouldStop);
//============================================================================== //==============================================================================
class DragImageComponent : public Component, class DragAndDropContainer::DragImageComponent : public Component,
public Timer private Timer
{ {
public: public:
DragImageComponent (const Image& im, DragImageComponent (const Image& im,

View file

@ -170,6 +170,7 @@ protected:
private: private:
//============================================================================== //==============================================================================
class DragImageComponent;
friend class DragImageComponent; friend class DragImageComponent;
ScopedPointer <Component> dragImageComponent; ScopedPointer <Component> dragImageComponent;
String currentDragDesc; String currentDragDesc;

View file

@ -23,7 +23,7 @@
============================================================================== ==============================================================================
*/ */
class MouseInputSourceInternal : public AsyncUpdater class MouseInputSourceInternal : private AsyncUpdater
{ {
public: public:
//============================================================================== //==============================================================================

View file

@ -269,7 +269,7 @@ bool Desktop::isScreenSaverEnabled()
} }
//============================================================================== //==============================================================================
class DisplaySettingsChangeCallback : public DeletedAtShutdown class DisplaySettingsChangeCallback : private DeletedAtShutdown
{ {
public: public:
DisplaySettingsChangeCallback() DisplaySettingsChangeCallback()

View file

@ -1110,7 +1110,7 @@ private:
TemporaryImage offscreenImageGenerator; TemporaryImage offscreenImageGenerator;
//============================================================================== //==============================================================================
class WindowClassHolder : public DeletedAtShutdown class WindowClassHolder : private DeletedAtShutdown
{ {
public: public:
WindowClassHolder() WindowClassHolder()

View file

@ -24,7 +24,7 @@
*/ */
class ChoicePropertyComponent::RemapperValueSource : public Value::ValueSource, class ChoicePropertyComponent::RemapperValueSource : public Value::ValueSource,
public ValueListener private ValueListener
{ {
public: public:
RemapperValueSource (const Value& sourceValue_, const Array<var>& mappings_) RemapperValueSource (const Value& sourceValue_, const Array<var>& mappings_)
@ -34,8 +34,6 @@ public:
sourceValue.addListener (this); sourceValue.addListener (this);
} }
~RemapperValueSource() {}
var getValue() const var getValue() const
{ {
return mappings.indexOf (sourceValue.getValue()) + 1; return mappings.indexOf (sourceValue.getValue()) + 1;
@ -49,16 +47,15 @@ public:
sourceValue = remappedVal; sourceValue = remappedVal;
} }
protected:
Value sourceValue;
Array<var> mappings;
void valueChanged (Value&) void valueChanged (Value&)
{ {
sendChangeMessage (true); sendChangeMessage (true);
} }
protected:
//==============================================================================
Value sourceValue;
Array<var> mappings;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (RemapperValueSource); JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (RemapperValueSource);
}; };

View file

@ -23,12 +23,12 @@
============================================================================== ==============================================================================
*/ */
class PropertySectionComponent : public Component class PropertyPanel::SectionComponent : public Component
{ {
public: public:
PropertySectionComponent (const String& sectionTitle, SectionComponent (const String& sectionTitle,
const Array <PropertyComponent*>& newProperties, const Array <PropertyComponent*>& newProperties,
const bool sectionIsOpen_) const bool sectionIsOpen_)
: Component (sectionTitle), : Component (sectionTitle),
titleHeight (sectionTitle.isNotEmpty() ? 22 : 0), titleHeight (sectionTitle.isNotEmpty() ? 22 : 0),
sectionIsOpen (sectionIsOpen_) sectionIsOpen (sectionIsOpen_)
@ -42,7 +42,7 @@ public:
} }
} }
~PropertySectionComponent() ~SectionComponent()
{ {
propertyComps.clear(); propertyComps.clear();
} }
@ -127,7 +127,7 @@ private:
int titleHeight; int titleHeight;
bool sectionIsOpen; bool sectionIsOpen;
JUCE_DECLARE_NON_COPYABLE (PropertySectionComponent); JUCE_DECLARE_NON_COPYABLE (SectionComponent);
}; };
//============================================================================== //==============================================================================
@ -144,7 +144,7 @@ public:
for (int i = 0; i < sections.size(); ++i) for (int i = 0; i < sections.size(); ++i)
{ {
PropertySectionComponent* const section = sections.getUnchecked(i); SectionComponent* const section = sections.getUnchecked(i);
section->setBounds (0, y, width, section->getPreferredHeight()); section->setBounds (0, y, width, section->getPreferredHeight());
y = section->getBottom(); y = section->getBottom();
@ -165,17 +165,17 @@ public:
sections.clear(); sections.clear();
} }
void addSection (PropertySectionComponent* newSection) void addSection (SectionComponent* newSection)
{ {
sections.add (newSection); sections.add (newSection);
addAndMakeVisible (newSection, 0); addAndMakeVisible (newSection, 0);
} }
int getNumSections() const noexcept { return sections.size(); } int getNumSections() const noexcept { return sections.size(); }
PropertySectionComponent* getSection (const int index) const { return sections [index]; } SectionComponent* getSection (const int index) const { return sections [index]; }
private: private:
OwnedArray<PropertySectionComponent> sections; OwnedArray<SectionComponent> sections;
JUCE_DECLARE_NON_COPYABLE (PropertyHolderComponent); JUCE_DECLARE_NON_COPYABLE (PropertyHolderComponent);
}; };
@ -229,7 +229,7 @@ void PropertyPanel::addProperties (const Array <PropertyComponent*>& newProperti
if (propertyHolderComponent->getNumSections() == 0) if (propertyHolderComponent->getNumSections() == 0)
repaint(); repaint();
propertyHolderComponent->addSection (new PropertySectionComponent (String::empty, newProperties, true)); propertyHolderComponent->addSection (new SectionComponent (String::empty, newProperties, true));
updatePropHolderLayout(); updatePropHolderLayout();
} }
@ -242,7 +242,7 @@ void PropertyPanel::addSection (const String& sectionTitle,
if (propertyHolderComponent->getNumSections() == 0) if (propertyHolderComponent->getNumSections() == 0)
repaint(); repaint();
propertyHolderComponent->addSection (new PropertySectionComponent (sectionTitle, newProperties, shouldBeOpen)); propertyHolderComponent->addSection (new SectionComponent (sectionTitle, newProperties, shouldBeOpen));
updatePropHolderLayout(); updatePropHolderLayout();
} }
@ -271,7 +271,7 @@ StringArray PropertyPanel::getSectionNames() const
for (int i = 0; i < propertyHolderComponent->getNumSections(); ++i) for (int i = 0; i < propertyHolderComponent->getNumSections(); ++i)
{ {
PropertySectionComponent* const section = propertyHolderComponent->getSection (i); SectionComponent* const section = propertyHolderComponent->getSection (i);
if (section->getName().isNotEmpty()) if (section->getName().isNotEmpty())
s.add (section->getName()); s.add (section->getName());
@ -286,7 +286,7 @@ bool PropertyPanel::isSectionOpen (const int sectionIndex) const
for (int i = 0; i < propertyHolderComponent->getNumSections(); ++i) for (int i = 0; i < propertyHolderComponent->getNumSections(); ++i)
{ {
PropertySectionComponent* const section = propertyHolderComponent->getSection (i); SectionComponent* const section = propertyHolderComponent->getSection (i);
if (section->getName().isNotEmpty()) if (section->getName().isNotEmpty())
{ {
@ -306,7 +306,7 @@ void PropertyPanel::setSectionOpen (const int sectionIndex, const bool shouldBeO
for (int i = 0; i < propertyHolderComponent->getNumSections(); ++i) for (int i = 0; i < propertyHolderComponent->getNumSections(); ++i)
{ {
PropertySectionComponent* const section = propertyHolderComponent->getSection (i); SectionComponent* const section = propertyHolderComponent->getSection (i);
if (section->getName().isNotEmpty()) if (section->getName().isNotEmpty())
{ {
@ -327,7 +327,7 @@ void PropertyPanel::setSectionEnabled (const int sectionIndex, const bool should
for (int i = 0; i < propertyHolderComponent->getNumSections(); ++i) for (int i = 0; i < propertyHolderComponent->getNumSections(); ++i)
{ {
PropertySectionComponent* const section = propertyHolderComponent->getSection (i); SectionComponent* const section = propertyHolderComponent->getSection (i);
if (section->getName().isNotEmpty()) if (section->getName().isNotEmpty())
{ {

View file

@ -149,6 +149,8 @@ public:
void resized(); void resized();
private: private:
class SectionComponent;
Viewport viewport; Viewport viewport;
class PropertyHolderComponent; class PropertyHolderComponent;
PropertyHolderComponent* propertyHolderComponent; PropertyHolderComponent* propertyHolderComponent;

View file

@ -23,11 +23,11 @@
============================================================================== ==============================================================================
*/ */
class TextPropLabel : public Label class TextPropertyComponent::LabelComp : public Label
{ {
public: public:
TextPropLabel (TextPropertyComponent& owner_, LabelComp (TextPropertyComponent& owner_,
const int maxChars_, const bool isMultiline_) const int maxChars_, const bool isMultiline_)
: Label (String::empty, String::empty), : Label (String::empty, String::empty),
owner (owner_), owner (owner_),
maxChars (maxChars_), maxChars (maxChars_),
@ -100,7 +100,7 @@ String TextPropertyComponent::getText() const
void TextPropertyComponent::createEditor (const int maxNumChars, const bool isMultiLine) void TextPropertyComponent::createEditor (const int maxNumChars, const bool isMultiLine)
{ {
addAndMakeVisible (textEditor = new TextPropLabel (*this, maxNumChars, isMultiLine)); addAndMakeVisible (textEditor = new LabelComp (*this, maxNumChars, isMultiLine));
if (isMultiLine) if (isMultiLine)
{ {

View file

@ -75,20 +75,21 @@ public:
*/ */
virtual void setText (const String& newText); virtual void setText (const String& newText);
/** Returns the text that should be shown in the text editor. /** Returns the text that should be shown in the text editor. */
*/
virtual String getText() const; virtual String getText() const;
//============================================================================== //==============================================================================
/** @internal */ /** @internal */
void refresh(); void refresh();
/** @internal */
void textWasEdited();
private: private:
ScopedPointer<Label> textEditor; ScopedPointer<Label> textEditor;
class LabelComp;
friend class LabelComp;
void textWasEdited();
void createEditor (int maxNumChars, bool isMultiLine); void createEditor (int maxNumChars, bool isMultiLine);
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TextPropertyComponent); JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TextPropertyComponent);

View file

@ -23,11 +23,11 @@
============================================================================== ==============================================================================
*/ */
class ListBoxRowComponent : public Component, class ListBox::RowComponent : public Component,
public TooltipClient public TooltipClient
{ {
public: public:
ListBoxRowComponent (ListBox& owner_) RowComponent (ListBox& owner_)
: owner (owner_), row (-1), : owner (owner_), row (-1),
selected (false), isDragging (false), selectRowOnMouseUp (false) selected (false), isDragging (false), selectRowOnMouseUp (false)
{ {
@ -138,7 +138,7 @@ private:
int row; int row;
bool selected, isDragging, selectRowOnMouseUp; bool selected, isDragging, selectRowOnMouseUp;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ListBoxRowComponent); JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (RowComponent);
}; };
@ -157,12 +157,12 @@ public:
content->setWantsKeyboardFocus (false); content->setWantsKeyboardFocus (false);
} }
ListBoxRowComponent* getComponentForRow (const int row) const noexcept RowComponent* getComponentForRow (const int row) const noexcept
{ {
return rows [row % jmax (1, rows.size())]; return rows [row % jmax (1, rows.size())];
} }
ListBoxRowComponent* getComponentForRowIfOnscreen (const int row) const noexcept RowComponent* getComponentForRowIfOnscreen (const int row) const noexcept
{ {
return (row >= firstIndex && row < firstIndex + rows.size()) return (row >= firstIndex && row < firstIndex + rows.size())
? getComponentForRow (row) : nullptr; ? getComponentForRow (row) : nullptr;
@ -221,7 +221,7 @@ public:
while (numNeeded > rows.size()) while (numNeeded > rows.size())
{ {
ListBoxRowComponent* newRow = new ListBoxRowComponent (owner); RowComponent* newRow = new RowComponent (owner);
rows.add (newRow); rows.add (newRow);
getViewedComponent()->addAndMakeVisible (newRow); getViewedComponent()->addAndMakeVisible (newRow);
} }
@ -233,7 +233,7 @@ public:
for (int i = 0; i < numNeeded; ++i) for (int i = 0; i < numNeeded; ++i)
{ {
const int row = i + firstIndex; const int row = i + firstIndex;
ListBoxRowComponent* const rowComp = getComponentForRow (row); RowComponent* const rowComp = getComponentForRow (row);
if (rowComp != nullptr) if (rowComp != nullptr)
{ {
@ -320,7 +320,7 @@ public:
private: private:
ListBox& owner; ListBox& owner;
OwnedArray<ListBoxRowComponent> rows; OwnedArray<RowComponent> rows;
int firstIndex, firstWholeIndex, lastWholeIndex; int firstIndex, firstWholeIndex, lastWholeIndex;
bool hasUpdated; bool hasUpdated;
@ -619,7 +619,7 @@ int ListBox::getInsertionIndexForPosition (const int x, const int y) const noexc
Component* ListBox::getComponentForRowNumber (const int row) const noexcept Component* ListBox::getComponentForRowNumber (const int row) const noexcept
{ {
ListBoxRowComponent* const listRowComp = viewport->getComponentForRowIfOnscreen (row); RowComponent* const listRowComp = viewport->getComponentForRowIfOnscreen (row);
return listRowComp != nullptr ? static_cast <Component*> (listRowComp->customComponent) : nullptr; return listRowComp != nullptr ? static_cast <Component*> (listRowComp->customComponent) : nullptr;
} }

View file

@ -562,6 +562,7 @@ public:
private: private:
//============================================================================== //==============================================================================
class ListViewport; class ListViewport;
class RowComponent;
friend class ListViewport; friend class ListViewport;
friend class TableListBox; friend class TableListBox;
ListBoxModel* model; ListBoxModel* model;

View file

@ -23,7 +23,7 @@
============================================================================== ==============================================================================
*/ */
class DragOverlayComp : public Component class TableHeaderComponent::DragOverlayComp : public Component
{ {
public: public:
DragOverlayComp (const Image& image_) DragOverlayComp (const Image& image_)

View file

@ -407,6 +407,7 @@ private:
OwnedArray <ColumnInfo> columns; OwnedArray <ColumnInfo> columns;
Array <Listener*> listeners; Array <Listener*> listeners;
ScopedPointer <Component> dragOverlayComp; ScopedPointer <Component> dragOverlayComp;
class DragOverlayComp;
bool columnsChanged, columnsResized, sortChanged, menuActive, stretchToFit; bool columnsChanged, columnsResized, sortChanged, menuActive, stretchToFit;
int columnIdBeingResized, columnIdBeingDragged, initialColumnWidth; int columnIdBeingResized, columnIdBeingDragged, initialColumnWidth;

View file

@ -23,11 +23,11 @@
============================================================================== ==============================================================================
*/ */
class TableListRowComp : public Component, class TableListBox::RowComp : public Component,
public TooltipClient public TooltipClient
{ {
public: public:
TableListRowComp (TableListBox& owner_) RowComp (TableListBox& owner_)
: owner (owner_), row (-1), isSelected (false) : owner (owner_), row (-1), isSelected (false)
{ {
} }
@ -208,15 +208,15 @@ private:
int row; int row;
bool isSelected, isDragging, selectRowOnMouseUp; bool isSelected, isDragging, selectRowOnMouseUp;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TableListRowComp); JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (RowComp);
}; };
//============================================================================== //==============================================================================
class TableListBoxHeader : public TableHeaderComponent class TableListBox::Header : public TableHeaderComponent
{ {
public: public:
TableListBoxHeader (TableListBox& owner_) Header (TableListBox& owner_)
: owner (owner_) : owner (owner_)
{ {
} }
@ -248,7 +248,7 @@ private:
enum { autoSizeColumnId = 0xf836743, autoSizeAllId = 0xf836744 }; enum { autoSizeColumnId = 0xf836743, autoSizeAllId = 0xf836744 };
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TableListBoxHeader); JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Header);
}; };
//============================================================================== //==============================================================================
@ -260,7 +260,7 @@ TableListBox::TableListBox (const String& name, TableListBoxModel* const model_)
{ {
ListBox::model = this; ListBox::model = this;
setHeader (new TableListBoxHeader (*this)); setHeader (new Header (*this));
} }
TableListBox::~TableListBox() TableListBox::~TableListBox()
@ -342,7 +342,7 @@ Rectangle<int> TableListBox::getCellPosition (const int columnId, const int rowN
Component* TableListBox::getCellComponent (int columnId, int rowNumber) const Component* TableListBox::getCellComponent (int columnId, int rowNumber) const
{ {
TableListRowComp* const rowComp = dynamic_cast <TableListRowComp*> (getComponentForRowNumber (rowNumber)); RowComp* const rowComp = dynamic_cast <RowComp*> (getComponentForRowNumber (rowNumber));
return rowComp != nullptr ? rowComp->findChildComponentForColumn (columnId) : 0; return rowComp != nullptr ? rowComp->findChildComponentForColumn (columnId) : 0;
} }
@ -378,9 +378,9 @@ void TableListBox::paintListBoxItem (int, Graphics&, int, int, bool)
Component* TableListBox::refreshComponentForRow (int rowNumber, bool isRowSelected_, Component* existingComponentToUpdate) Component* TableListBox::refreshComponentForRow (int rowNumber, bool isRowSelected_, Component* existingComponentToUpdate)
{ {
if (existingComponentToUpdate == nullptr) if (existingComponentToUpdate == nullptr)
existingComponentToUpdate = new TableListRowComp (*this); existingComponentToUpdate = new RowComp (*this);
static_cast <TableListRowComp*> (existingComponentToUpdate)->update (rowNumber, isRowSelected_); static_cast <RowComp*> (existingComponentToUpdate)->update (rowNumber, isRowSelected_);
return existingComponentToUpdate; return existingComponentToUpdate;
} }
@ -456,7 +456,7 @@ void TableListBox::updateColumnComponents() const
for (int i = firstRow + getNumRowsOnScreen() + 2; --i >= firstRow;) for (int i = firstRow + getNumRowsOnScreen() + 2; --i >= firstRow;)
{ {
TableListRowComp* const rowComp = dynamic_cast <TableListRowComp*> (getComponentForRowNumber (i)); RowComp* const rowComp = dynamic_cast <RowComp*> (getComponentForRowNumber (i));
if (rowComp != nullptr) if (rowComp != nullptr)
rowComp->resized(); rowComp->resized();

View file

@ -324,6 +324,9 @@ public:
private: private:
//============================================================================== //==============================================================================
class Header;
class RowComp;
TableHeaderComponent* header; TableHeaderComponent* header;
TableListBoxModel* model; TableListBoxModel* model;
int columnIdNowBeingDragged; int columnIdNowBeingDragged;

View file

@ -857,7 +857,7 @@ private:
//============================================================================== //==============================================================================
class TextEditor::TextHolderComponent : public Component, class TextEditor::TextHolderComponent : public Component,
public Timer, public Timer,
public ValueListener private ValueListener
{ {
public: public:
TextHolderComponent (TextEditor& owner_) TextHolderComponent (TextEditor& owner_)

View file

@ -26,10 +26,10 @@
const char* const Toolbar::toolbarDragDescriptor = "_toolbarItem_"; const char* const Toolbar::toolbarDragDescriptor = "_toolbarItem_";
//============================================================================== //==============================================================================
class ToolbarSpacerComp : public ToolbarItemComponent class Toolbar::Spacer : public ToolbarItemComponent
{ {
public: public:
ToolbarSpacerComp (const int itemId_, const float fixedSize_, const bool drawBar_) Spacer (const int itemId_, const float fixedSize_, const bool drawBar_)
: ToolbarItemComponent (itemId_, String::empty, false), : ToolbarItemComponent (itemId_, String::empty, false),
fixedSize (fixedSize_), fixedSize (fixedSize_),
drawBar (drawBar_) drawBar (drawBar_)
@ -143,7 +143,7 @@ private:
const float fixedSize; const float fixedSize;
const bool drawBar; const bool drawBar;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ToolbarSpacerComp); JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Spacer);
}; };
//============================================================================== //==============================================================================
@ -159,7 +159,7 @@ public:
{ {
ToolbarItemComponent* const tc = owner_.items.getUnchecked(i); ToolbarItemComponent* const tc = owner_.items.getUnchecked(i);
if (dynamic_cast <ToolbarSpacerComp*> (tc) == nullptr && ! tc->isVisible()) if (dynamic_cast <Spacer*> (tc) == nullptr && ! tc->isVisible())
{ {
oldIndexes.insert (0, i); oldIndexes.insert (0, i);
addAndMakeVisible (tc, 0); addAndMakeVisible (tc, 0);
@ -274,11 +274,11 @@ void Toolbar::clear()
ToolbarItemComponent* Toolbar::createItem (ToolbarItemFactory& factory, const int itemId) ToolbarItemComponent* Toolbar::createItem (ToolbarItemFactory& factory, const int itemId)
{ {
if (itemId == ToolbarItemFactory::separatorBarId) if (itemId == ToolbarItemFactory::separatorBarId)
return new ToolbarSpacerComp (itemId, 0.1f, true); return new Spacer (itemId, 0.1f, true);
else if (itemId == ToolbarItemFactory::spacerId) else if (itemId == ToolbarItemFactory::spacerId)
return new ToolbarSpacerComp (itemId, 0.5f, false); return new Spacer (itemId, 0.5f, false);
else if (itemId == ToolbarItemFactory::flexibleSpacerId) else if (itemId == ToolbarItemFactory::flexibleSpacerId)
return new ToolbarSpacerComp (itemId, 0, false); return new Spacer (itemId, 0, false);
return factory.createItem (itemId); return factory.createItem (itemId);
} }
@ -451,7 +451,7 @@ void Toolbar::updateAllItemPositions (const bool animate)
tc->setStyle (toolbarStyle); tc->setStyle (toolbarStyle);
ToolbarSpacerComp* const spacer = dynamic_cast <ToolbarSpacerComp*> (tc); Spacer* const spacer = dynamic_cast <Spacer*> (tc);
int preferredSize = 1, minSize = 1, maxSize = 1; int preferredSize = 1, minSize = 1, maxSize = 1;
@ -647,12 +647,12 @@ void Toolbar::mouseDown (const MouseEvent&)
} }
//============================================================================== //==============================================================================
class ToolbarCustomisationDialog : public DialogWindow class Toolbar::CustomisationDialog : public DialogWindow
{ {
public: public:
ToolbarCustomisationDialog (ToolbarItemFactory& factory, CustomisationDialog (ToolbarItemFactory& factory,
Toolbar* const toolbar_, Toolbar* const toolbar_,
const int optionFlags) const int optionFlags)
: DialogWindow (TRANS("Add/remove items from toolbar"), Colours::white, true, true), : DialogWindow (TRANS("Add/remove items from toolbar"), Colours::white, true, true),
toolbar (toolbar_) toolbar (toolbar_)
{ {
@ -662,7 +662,7 @@ public:
positionNearBar(); positionNearBar();
} }
~ToolbarCustomisationDialog() ~CustomisationDialog()
{ {
toolbar->setEditingActive (false); toolbar->setEditingActive (false);
} }
@ -820,6 +820,6 @@ void Toolbar::showCustomisationDialog (ToolbarItemFactory& factory, const int op
{ {
setEditingActive (true); setEditingActive (true);
(new ToolbarCustomisationDialog (factory, this, optionFlags)) (new CustomisationDialog (factory, this, optionFlags))
->enterModalState (true, 0, true); ->enterModalState (true, 0, true);
} }

View file

@ -275,8 +275,6 @@ public:
/** @internal */ /** @internal */
void resized(); void resized();
/** @internal */ /** @internal */
void buttonClicked (Button*);
/** @internal */
void mouseDown (const MouseEvent&); void mouseDown (const MouseEvent&);
/** @internal */ /** @internal */
bool isInterestedInDragSource (const SourceDetails&); bool isInterestedInDragSource (const SourceDetails&);
@ -290,6 +288,8 @@ public:
void updateAllItemPositions (bool animate); void updateAllItemPositions (bool animate);
/** @internal */ /** @internal */
static ToolbarItemComponent* createItem (ToolbarItemFactory&, int itemId); static ToolbarItemComponent* createItem (ToolbarItemFactory&, int itemId);
/** @internal */
static const char* const toolbarDragDescriptor;
private: private:
//============================================================================== //==============================================================================
@ -299,10 +299,10 @@ private:
class MissingItemsComponent; class MissingItemsComponent;
friend class MissingItemsComponent; friend class MissingItemsComponent;
OwnedArray <ToolbarItemComponent> items; OwnedArray <ToolbarItemComponent> items;
class Spacer;
class CustomisationDialog;
friend class ItemDragAndDropOverlayComponent; void buttonClicked (Button*);
static const char* const toolbarDragDescriptor;
void addItemInternal (ToolbarItemFactory& factory, int itemId, int insertIndex); void addItemInternal (ToolbarItemFactory& factory, int itemId, int insertIndex);
ToolbarItemComponent* getNextActiveComponent (int index, int delta) const; ToolbarItemComponent* getNextActiveComponent (int index, int delta) const;

View file

@ -32,7 +32,7 @@ ToolbarItemFactory::~ToolbarItemFactory()
} }
//============================================================================== //==============================================================================
class ItemDragAndDropOverlayComponent : public Component class ToolbarItemComponent::ItemDragAndDropOverlayComponent : public Component
{ {
public: public:
ItemDragAndDropOverlayComponent() ItemDragAndDropOverlayComponent()

View file

@ -194,6 +194,7 @@ public:
private: private:
friend class Toolbar; friend class Toolbar;
class ItemDragAndDropOverlayComponent;
friend class ItemDragAndDropOverlayComponent; friend class ItemDragAndDropOverlayComponent;
const int itemId; const int itemId;
ToolbarEditingMode mode; ToolbarEditingMode mode;

View file

@ -23,12 +23,12 @@
============================================================================== ==============================================================================
*/ */
class TreeViewContentComponent : public Component, class TreeView::ContentComponent : public Component,
public TooltipClient, public TooltipClient,
public AsyncUpdater public AsyncUpdater
{ {
public: public:
TreeViewContentComponent (TreeView& owner_) ContentComponent (TreeView& owner_)
: owner (owner_), : owner (owner_),
buttonUnderMouse (nullptr), buttonUnderMouse (nullptr),
isDragging (false) isDragging (false)
@ -403,7 +403,7 @@ private:
owner.recalculateIfNeeded(); owner.recalculateIfNeeded();
} }
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TreeViewContentComponent); JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ContentComponent);
}; };
//============================================================================== //==============================================================================
@ -414,7 +414,7 @@ public:
void updateComponents (const bool triggerResize) void updateComponents (const bool triggerResize)
{ {
TreeViewContentComponent* const tvc = getContentComp(); ContentComponent* const tvc = getContentComp();
if (tvc != nullptr) if (tvc != nullptr)
{ {
@ -434,9 +434,9 @@ public:
updateComponents (hasScrolledSideways); updateComponents (hasScrolledSideways);
} }
TreeViewContentComponent* getContentComp() const noexcept ContentComponent* getContentComp() const noexcept
{ {
return static_cast <TreeViewContentComponent*> (getViewedComponent()); return static_cast <ContentComponent*> (getViewedComponent());
} }
bool keyPressed (const KeyPress& key) bool keyPressed (const KeyPress& key)
@ -467,7 +467,7 @@ TreeView::TreeView (const String& name)
openCloseButtonsVisible (true) openCloseButtonsVisible (true)
{ {
addAndMakeVisible (viewport); addAndMakeVisible (viewport);
viewport->setViewedComponent (new TreeViewContentComponent (*this)); viewport->setViewedComponent (new ContentComponent (*this));
setWantsKeyboardFocus (true); setWantsKeyboardFocus (true);
} }
@ -605,7 +605,7 @@ TreeViewItem* TreeView::getItemOnRow (int index) const
TreeViewItem* TreeView::getItemAt (int y) const noexcept TreeViewItem* TreeView::getItemAt (int y) const noexcept
{ {
TreeViewContentComponent* const tc = viewport->getContentComp(); ContentComponent* const tc = viewport->getContentComp();
Rectangle<int> pos; Rectangle<int> pos;
return tc->findItemAt (tc->getLocalPoint (this, Point<int> (0, y)).y, pos); return tc->findItemAt (tc->getLocalPoint (this, Point<int> (0, y)).y, pos);
} }

View file

@ -508,7 +508,6 @@ private:
unsigned int openness : 2; unsigned int openness : 2;
friend class TreeView; friend class TreeView;
friend class TreeViewContentComponent;
void updatePositions (int newY); void updatePositions (int newY);
int getIndentX() const noexcept; int getIndentX() const noexcept;
@ -791,14 +790,16 @@ public:
void itemDropped (const SourceDetails&); void itemDropped (const SourceDetails&);
private: private:
friend class TreeViewItem; class ContentComponent;
friend class TreeViewContentComponent;
class TreeViewport; class TreeViewport;
class InsertPointHighlight; class InsertPointHighlight;
class TargetGroupHighlight; class TargetGroupHighlight;
friend class TreeViewItem;
friend class ContentComponent;
friend class ScopedPointer<TreeViewport>; friend class ScopedPointer<TreeViewport>;
friend class ScopedPointer<InsertPointHighlight>; friend class ScopedPointer<InsertPointHighlight>;
friend class ScopedPointer<TargetGroupHighlight>; friend class ScopedPointer<TargetGroupHighlight>;
ScopedPointer<TreeViewport> viewport; ScopedPointer<TreeViewport> viewport;
CriticalSection nodeAlterationLock; CriticalSection nodeAlterationLock;
TreeViewItem* rootItem; TreeViewItem* rootItem;
@ -818,8 +819,8 @@ private:
struct InsertPoint; struct InsertPoint;
void showDragHighlight (const InsertPoint&) noexcept; void showDragHighlight (const InsertPoint&) noexcept;
void hideDragHighlight() noexcept; void hideDragHighlight() noexcept;
void handleDrag (const StringArray& files, const SourceDetails&); void handleDrag (const StringArray&, const SourceDetails&);
void handleDrop (const StringArray& files, const SourceDetails&); void handleDrop (const StringArray&, const SourceDetails&);
void toggleOpenSelectedItem(); void toggleOpenSelectedItem();
void moveOutOfSelectedItem(); void moveOutOfSelectedItem();
void moveIntoSelectedItem(); void moveIntoSelectedItem();

View file

@ -24,8 +24,8 @@
*/ */
/** Keeps track of the active top level window. */ /** Keeps track of the active top level window. */
class TopLevelWindowManager : public Timer, class TopLevelWindowManager : private Timer,
public DeletedAtShutdown private DeletedAtShutdown
{ {
public: public:
//============================================================================== //==============================================================================
@ -41,7 +41,12 @@ public:
juce_DeclareSingleton_SingleThreaded_Minimal (TopLevelWindowManager); juce_DeclareSingleton_SingleThreaded_Minimal (TopLevelWindowManager);
void timerCallback() void checkFocusAsync()
{
startTimer (10);
}
void checkFocus()
{ {
startTimer (jmin (1731, getTimerInterval() * 2)); startTimer (jmin (1731, getTimerInterval() * 2));
@ -80,14 +85,14 @@ public:
bool addWindow (TopLevelWindow* const w) bool addWindow (TopLevelWindow* const w)
{ {
windows.add (w); windows.add (w);
startTimer (10); checkFocusAsync();
return isWindowActive (w); return isWindowActive (w);
} }
void removeWindow (TopLevelWindow* const w) void removeWindow (TopLevelWindow* const w)
{ {
startTimer (10); checkFocusAsync();
if (currentActive == w) if (currentActive == w)
currentActive = nullptr; currentActive = nullptr;
@ -103,6 +108,11 @@ public:
private: private:
TopLevelWindow* currentActive; TopLevelWindow* currentActive;
void timerCallback()
{
checkFocus();
}
bool isWindowActive (TopLevelWindow* const tlw) const bool isWindowActive (TopLevelWindow* const tlw) const
{ {
return (tlw == currentActive return (tlw == currentActive
@ -119,8 +129,10 @@ juce_ImplementSingleton_SingleThreaded (TopLevelWindowManager)
void juce_CheckCurrentlyFocusedTopLevelWindow(); void juce_CheckCurrentlyFocusedTopLevelWindow();
void juce_CheckCurrentlyFocusedTopLevelWindow() void juce_CheckCurrentlyFocusedTopLevelWindow()
{ {
if (TopLevelWindowManager::getInstanceWithoutCreating() != nullptr) TopLevelWindowManager* const wm = TopLevelWindowManager::getInstanceWithoutCreating();
TopLevelWindowManager::getInstanceWithoutCreating()->startTimer (20);
if (wm != nullptr)
wm->checkFocusAsync();
} }
//============================================================================== //==============================================================================
@ -152,10 +164,12 @@ TopLevelWindow::~TopLevelWindow()
//============================================================================== //==============================================================================
void TopLevelWindow::focusOfChildComponentChanged (FocusChangeType) void TopLevelWindow::focusOfChildComponentChanged (FocusChangeType)
{ {
TopLevelWindowManager* const wm = TopLevelWindowManager::getInstance();
if (hasKeyboardFocus (true)) if (hasKeyboardFocus (true))
TopLevelWindowManager::getInstance()->timerCallback(); wm->checkFocus();
else else
TopLevelWindowManager::getInstance()->startTimer (10); wm->checkFocusAsync();
} }
void TopLevelWindow::setWindowActive (const bool isNowActive) void TopLevelWindow::setWindowActive (const bool isNowActive)

View file

@ -23,7 +23,7 @@
============================================================================== ==============================================================================
*/ */
class ColourComponentSlider : public Slider class ColourSelector::ColourComponentSlider : public Slider
{ {
public: public:
ColourComponentSlider (const String& name) ColourComponentSlider (const String& name)
@ -47,7 +47,7 @@ private:
}; };
//============================================================================== //==============================================================================
class ColourSpaceMarker : public Component class ColourSelector::ColourSpaceMarker : public Component
{ {
public: public:
ColourSpaceMarker() ColourSpaceMarker()
@ -71,13 +71,8 @@ private:
class ColourSelector::ColourSpaceView : public Component class ColourSelector::ColourSpaceView : public Component
{ {
public: public:
ColourSpaceView (ColourSelector& owner_, ColourSpaceView (ColourSelector& owner_, float& h_, float& s_, float& v_, const int edgeSize)
float& h_, float& s_, float& v_, : owner (owner_), h (h_), s (s_), v (v_), lastHue (0.0f), edge (edgeSize)
const int edgeSize)
: owner (owner_),
h (h_), s (s_), v (v_),
lastHue (0.0f),
edge (edgeSize)
{ {
addAndMakeVisible (&marker); addAndMakeVisible (&marker);
setMouseCursor (MouseCursor::CrosshairCursor); setMouseCursor (MouseCursor::CrosshairCursor);
@ -100,7 +95,6 @@ public:
for (int x = 0; x < width; ++x) for (int x = 0; x < width; ++x)
{ {
const float sat = x / (float) width; const float sat = x / (float) width;
pixels.setPixelColour (x, y, Colour (h, sat, val, 1.0f)); pixels.setPixelColour (x, y, Colour (h, sat, val, 1.0f));
} }
} }
@ -163,7 +157,7 @@ private:
}; };
//============================================================================== //==============================================================================
class HueSelectorMarker : public Component class ColourSelector::HueSelectorMarker : public Component
{ {
public: public:
HueSelectorMarker() HueSelectorMarker()
@ -173,14 +167,17 @@ public:
void paint (Graphics& g) void paint (Graphics& g)
{ {
const float w = (float) getWidth();
const float h = (float) getHeight();
Path p; Path p;
p.addTriangle (1.0f, 1.0f, p.addTriangle (1.0f, 1.0f,
getWidth() * 0.3f, getHeight() * 0.5f, w * 0.3f, h * 0.5f,
1.0f, getHeight() - 1.0f); 1.0f, h - 1.0f);
p.addTriangle (getWidth() - 1.0f, 1.0f, p.addTriangle (w - 1.0f, 1.0f,
getWidth() * 0.7f, getHeight() * 0.5f, w * 0.7f, h * 0.5f,
getWidth() - 1.0f, getHeight() - 1.0f); w - 1.0f, h - 1.0f);
g.setColour (Colours::white.withAlpha (0.75f)); g.setColour (Colours::white.withAlpha (0.75f));
g.fillPath (p); g.fillPath (p);
@ -197,13 +194,8 @@ private:
class ColourSelector::HueSelectorComp : public Component class ColourSelector::HueSelectorComp : public Component
{ {
public: public:
HueSelectorComp (ColourSelector& owner_, HueSelectorComp (ColourSelector& owner_, float& h_, float& s_, float& v_, const int edgeSize)
float& h_, float& s_, float& v_, : owner (owner_), h (h_), s (s_), v (v_), edge (edgeSize)
const int edgeSize)
: owner (owner_),
h (h_), s (s_), v (v_),
lastHue (0.0f),
edge (edgeSize)
{ {
addAndMakeVisible (&marker); addAndMakeVisible (&marker);
} }
@ -247,7 +239,6 @@ private:
float& h; float& h;
float& s; float& s;
float& v; float& v;
float lastHue;
HueSelectorMarker marker; HueSelectorMarker marker;
const int edge; const int edge;

View file

@ -134,6 +134,9 @@ private:
class ColourSpaceView; class ColourSpaceView;
class HueSelectorComp; class HueSelectorComp;
class SwatchComponent; class SwatchComponent;
class ColourComponentSlider;
class ColourSpaceMarker;
class HueSelectorMarker;
friend class ColourSpaceView; friend class ColourSpaceView;
friend class ScopedPointer<ColourSpaceView>; friend class ScopedPointer<ColourSpaceView>;
friend class HueSelectorComp; friend class HueSelectorComp;

View file

@ -347,8 +347,8 @@ private:
//============================================================================== //==============================================================================
class KeyMappingEditorComponent::TopLevelItem : public TreeViewItem, class KeyMappingEditorComponent::TopLevelItem : public TreeViewItem,
public ChangeListener, public ButtonListener,
public ButtonListener private ChangeListener
{ {
public: public:
TopLevelItem (KeyMappingEditorComponent& owner_) TopLevelItem (KeyMappingEditorComponent& owner_)

View file

@ -53,7 +53,7 @@
@endcode @endcode
*/ */
class JUCE_API SplashScreen : public Component, class JUCE_API SplashScreen : public Component,
public Timer, private Timer,
private DeletedAtShutdown private DeletedAtShutdown
{ {
public: public:
@ -129,9 +129,7 @@ public:
//============================================================================== //==============================================================================
/** @internal */ /** @internal */
void paint (Graphics& g); void paint (Graphics&);
/** @internal */
void timerCallback();
private: private:
//============================================================================== //==============================================================================
@ -139,6 +137,8 @@ private:
Time earliestTimeToDelete; Time earliestTimeToDelete;
int originalClickCounter; int originalClickCounter;
void timerCallback();
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (SplashScreen); JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (SplashScreen);
}; };

View file

@ -28,10 +28,6 @@
#if JUCE_WEB_BROWSER || DOXYGEN #if JUCE_WEB_BROWSER || DOXYGEN
#if ! DOXYGEN
class WebBrowserComponentInternal;
#endif
//============================================================================== //==============================================================================
/** /**
A component that displays an embedded web browser. A component that displays an embedded web browser.
@ -114,7 +110,8 @@ public:
private: private:
//============================================================================== //==============================================================================
WebBrowserComponentInternal* browser; class Pimpl;
Pimpl* browser;
bool blankPageShown, unloadPageWhenBrowserIsHidden; bool blankPageShown, unloadPageWhenBrowserIsHidden;
String lastURL; String lastURL;
StringArray lastHeaders; StringArray lastHeaders;

View file

@ -116,7 +116,7 @@ namespace juce {
#endif #endif
//============================================================================== //==============================================================================
class WebBrowserComponentInternal class WebBrowserComponent::Pimpl
#if JUCE_MAC #if JUCE_MAC
: public NSViewComponent : public NSViewComponent
#else #else
@ -124,7 +124,7 @@ class WebBrowserComponentInternal
#endif #endif
{ {
public: public:
WebBrowserComponentInternal (WebBrowserComponent* owner) Pimpl (WebBrowserComponent* owner)
{ {
#if JUCE_MAC #if JUCE_MAC
webView = [[WebView alloc] initWithFrame: NSMakeRect (0, 0, 100.0f, 100.0f) webView = [[WebView alloc] initWithFrame: NSMakeRect (0, 0, 100.0f, 100.0f)
@ -148,7 +148,7 @@ public:
#endif #endif
} }
~WebBrowserComponentInternal() ~Pimpl()
{ {
#if JUCE_MAC #if JUCE_MAC
[webView setPolicyDelegate: nil]; [webView setPolicyDelegate: nil];
@ -241,7 +241,7 @@ WebBrowserComponent::WebBrowserComponent (const bool unloadPageWhenBrowserIsHidd
{ {
setOpaque (true); setOpaque (true);
addAndMakeVisible (browser = new WebBrowserComponentInternal (this)); addAndMakeVisible (browser = new Pimpl (this));
} }
WebBrowserComponent::~WebBrowserComponent() WebBrowserComponent::~WebBrowserComponent()

View file

@ -24,17 +24,17 @@
*/ */
//============================================================================== //==============================================================================
class WebBrowserComponentInternal : public ActiveXControlComponent class WebBrowserComponent::Pimpl : public ActiveXControlComponent
{ {
public: public:
WebBrowserComponentInternal() Pimpl()
: browser (nullptr), : browser (nullptr),
connectionPoint (nullptr), connectionPoint (nullptr),
adviseCookie (0) adviseCookie (0)
{ {
} }
~WebBrowserComponentInternal() ~Pimpl()
{ {
if (connectionPoint != nullptr) if (connectionPoint != nullptr)
connectionPoint->Unadvise (adviseCookie); connectionPoint->Unadvise (adviseCookie);
@ -183,7 +183,7 @@ private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (EventHandler); JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (EventHandler);
}; };
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (WebBrowserComponentInternal); JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Pimpl);
}; };
@ -194,7 +194,7 @@ WebBrowserComponent::WebBrowserComponent (const bool unloadPageWhenBrowserIsHidd
unloadPageWhenBrowserIsHidden (unloadPageWhenBrowserIsHidden_) unloadPageWhenBrowserIsHidden (unloadPageWhenBrowserIsHidden_)
{ {
setOpaque (true); setOpaque (true);
addAndMakeVisible (browser = new WebBrowserComponentInternal()); addAndMakeVisible (browser = new Pimpl());
} }
WebBrowserComponent::~WebBrowserComponent() WebBrowserComponent::~WebBrowserComponent()

View file

@ -492,7 +492,7 @@ private:
ScopedPointer <DirectShowHelpers::VideoRenderer> videoRenderer; ScopedPointer <DirectShowHelpers::VideoRenderer> videoRenderer;
//====================================================================== //======================================================================
class NativeWindowClass : public DeletedAtShutdown class NativeWindowClass : private DeletedAtShutdown
{ {
private: private:
NativeWindowClass() NativeWindowClass()