From d7d662bb3853a105daf48a87f5aec1d12e1b2f10 Mon Sep 17 00:00:00 2001 From: jules Date: Mon, 14 Apr 2014 16:53:16 +0100 Subject: [PATCH] Documentation improvement. --- .../memory/juce_SharedResourcePointer.h | 32 +++++++++++++++++++ .../juce_gui_extra/misc/juce_ColourSelector.h | 5 ++- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/modules/juce_core/memory/juce_SharedResourcePointer.h b/modules/juce_core/memory/juce_SharedResourcePointer.h index a3fbd788b2..d765af40c9 100644 --- a/modules/juce_core/memory/juce_SharedResourcePointer.h +++ b/modules/juce_core/memory/juce_SharedResourcePointer.h @@ -49,6 +49,38 @@ Note: the construction/deletion of the shared object must not involve any code that makes recursive calls to a SharedResourcePointer, or you'll cause a deadlock. + + Example: + @code + // An example of a class that contains the shared data you want to use. + struct MySharedData + { + // There's no need to ever create an instance of this class directly yourself, + // but it does need a public constructor that does the initialisation. + MySharedData() + { + sharedStuff = generateHeavyweightStuff(); + } + + Array sharedStuff; + }; + + struct DataUserClass + { + DataUserClass() + { + // Multiple instances of the DataUserClass will all have the same + // shared common instance of MySharedData referenced by their sharedData + // member variables. + useSharedStuff (sharedData->sharedStuff); + } + + // By keeping this pointer as a member variable, the shared resource + // is guaranteed to be available for as long as the DataUserClass object. + SharedResourcePointer sharedData; + }; + + @endcode */ template class SharedResourcePointer diff --git a/modules/juce_gui_extra/misc/juce_ColourSelector.h b/modules/juce_gui_extra/misc/juce_ColourSelector.h index a661801f15..2e256bd8d4 100644 --- a/modules/juce_gui_extra/misc/juce_ColourSelector.h +++ b/modules/juce_gui_extra/misc/juce_ColourSelector.h @@ -62,7 +62,7 @@ public: gapAroundColourSpaceComponent indicates how much of a gap to put around the colourspace and hue selector components. */ - ColourSelector (int sectionsToShow = (showAlphaChannel | showColourAtTop | showSliders | showColourspace), + ColourSelector (int flags = (showAlphaChannel | showColourAtTop | showSliders | showColourspace), int edgeGap = 4, int gapAroundColourSpaceComponent = 7); @@ -79,8 +79,7 @@ public: */ Colour getCurrentColour() const; - /** Changes the colour that is currently being shown. - */ + /** Changes the colour that is currently being shown. */ void setCurrentColour (Colour newColour); //==============================================================================