Browse Source

Tidied up a bunch of listener classes, making them child classes - e.g. ButtonListener becomes Button::Listener. Did this for ComboBox, Button, CameraDevice, Label, ScrollBar, Slider, TextEditor, TableHeaderComponent. (There are typedefs to make sure old code still works, though I might remove those in the future).

tags/2021-05-28
Julian Storer 15 years ago
parent
commit
907a9aaffe
70 changed files with 831 additions and 892 deletions
  1. +0
    -2
      Builds/MacOSX/Juce.xcodeproj/project.pbxproj
  2. +0
    -1
      Builds/VisualStudio2005/Juce.vcproj
  3. +0
    -1
      Builds/VisualStudio2008/Juce.vcproj
  4. +0
    -1
      Builds/VisualStudio2008_DLL/Juce.vcproj
  5. +0
    -1
      Builds/VisualStudio2010/Juce.vcxproj
  6. +0
    -3
      Builds/VisualStudio2010/Juce.vcxproj.filters
  7. +0
    -2
      Builds/iPhone/Juce.xcodeproj/project.pbxproj
  8. +0
    -2
      Juce.jucer
  9. +1
    -1
      extras/audio plugins/demo/Source/PluginEditor.cpp
  10. +1
    -1
      extras/audio plugins/demo/Source/PluginEditor.h
  11. +1
    -1
      extras/audio plugins/wrapper/Standalone/juce_StandaloneFilterWindow.h
  12. +1
    -1
      extras/browser plugins/demo/src/JuceBrowserPluginDemo.cpp
  13. +2
    -2
      extras/juce demo/Source/demos/AudioDemoPlaybackPage.h
  14. +3
    -3
      extras/juce demo/Source/demos/CameraDemo.cpp
  15. +2
    -2
      extras/juce demo/Source/demos/FontsAndTextDemo.cpp
  16. +2
    -2
      extras/juce demo/Source/demos/InterprocessCommsDemo.cpp
  17. +2
    -2
      extras/juce demo/Source/demos/RenderingTestComponent.h
  18. +1
    -1
      extras/juce demo/Source/demos/ThreadingDemo.cpp
  19. +1
    -1
      extras/juce demo/Source/demos/TreeViewDemo.cpp
  20. +2
    -2
      extras/juce demo/Source/demos/WebBrowserDemo.cpp
  21. +5
    -5
      extras/juce demo/Source/demos/WidgetsDemo.cpp
  22. +57
    -56
      juce_amalgamated.cpp
  23. +343
    -353
      juce_amalgamated.h
  24. +1
    -1
      src/audio/plugins/juce_PluginListComponent.h
  25. +1
    -1
      src/core/juce_StandardHeader.h
  26. +4
    -4
      src/gui/components/buttons/juce_Button.cpp
  27. +24
    -24
      src/gui/components/buttons/juce_Button.h
  28. +1
    -1
      src/gui/components/code_editor/juce_CodeEditorComponent.h
  29. +3
    -3
      src/gui/components/controls/juce_ComboBox.cpp
  30. +28
    -28
      src/gui/components/controls/juce_ComboBox.h
  31. +3
    -3
      src/gui/components/controls/juce_Label.cpp
  32. +35
    -42
      src/gui/components/controls/juce_Label.h
  33. +7
    -7
      src/gui/components/controls/juce_Slider.cpp
  34. +67
    -21
      src/gui/components/controls/juce_Slider.h
  35. +0
    -78
      src/gui/components/controls/juce_SliderListener.h
  36. +3
    -3
      src/gui/components/controls/juce_TableHeaderComponent.cpp
  37. +47
    -48
      src/gui/components/controls/juce_TableHeaderComponent.h
  38. +1
    -1
      src/gui/components/controls/juce_TableListBox.h
  39. +6
    -6
      src/gui/components/controls/juce_TextEditor.cpp
  40. +33
    -32
      src/gui/components/controls/juce_TextEditor.h
  41. +3
    -3
      src/gui/components/controls/juce_Toolbar.cpp
  42. +2
    -2
      src/gui/components/controls/juce_Toolbar.h
  43. +3
    -3
      src/gui/components/filebrowser/juce_FileBrowserComponent.h
  44. +1
    -1
      src/gui/components/filebrowser/juce_FileChooserDialogBox.h
  45. +1
    -1
      src/gui/components/filebrowser/juce_FileSearchPathListComponent.h
  46. +2
    -2
      src/gui/components/filebrowser/juce_FilenameComponent.h
  47. +5
    -4
      src/gui/components/juce_Component.cpp
  48. +1
    -1
      src/gui/components/keyboard/juce_KeyMappingEditorComponent.h
  49. +3
    -3
      src/gui/components/layout/juce_ScrollBar.cpp
  50. +34
    -34
      src/gui/components/layout/juce_ScrollBar.h
  51. +1
    -1
      src/gui/components/layout/juce_TabbedButtonBar.h
  52. +1
    -1
      src/gui/components/layout/juce_Viewport.h
  53. +1
    -1
      src/gui/components/menus/juce_MenuBarComponent.h
  54. +4
    -4
      src/gui/components/menus/juce_MenuBarModel.cpp
  55. +30
    -30
      src/gui/components/menus/juce_MenuBarModel.h
  56. +1
    -1
      src/gui/components/properties/juce_BooleanPropertyComponent.h
  57. +1
    -1
      src/gui/components/properties/juce_ButtonPropertyComponent.h
  58. +1
    -1
      src/gui/components/properties/juce_ChoicePropertyComponent.h
  59. +1
    -1
      src/gui/components/properties/juce_SliderPropertyComponent.h
  60. +2
    -2
      src/gui/components/special/juce_AudioDeviceSelectorComponent.cpp
  61. +2
    -2
      src/gui/components/special/juce_AudioDeviceSelectorComponent.h
  62. +1
    -1
      src/gui/components/special/juce_ColourSelector.h
  63. +1
    -1
      src/gui/components/special/juce_PreferencesPanel.h
  64. +1
    -1
      src/gui/components/windows/juce_AlertWindow.h
  65. +1
    -1
      src/gui/components/windows/juce_DocumentWindow.cpp
  66. +26
    -24
      src/gui/graphics/imaging/juce_CameraDevice.h
  67. +0
    -3
      src/juce_app_includes.h
  68. +6
    -6
      src/native/mac/juce_mac_CameraDevice.mm
  69. +1
    -1
      src/native/mac/juce_mac_MainMenu.mm
  70. +6
    -6
      src/native/windows/juce_win32_CameraDevice.cpp

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

@@ -607,7 +607,6 @@
1DB68310EA4D6180FF948AA0 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_ProgressBar.h; path = ../../src/gui/components/controls/juce_ProgressBar.h; sourceTree = SOURCE_ROOT; };
3CE16163A43A6E67428385EE = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_Slider.cpp; path = ../../src/gui/components/controls/juce_Slider.cpp; sourceTree = SOURCE_ROOT; };
E698677EEC8E88CAFF542764 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_Slider.h; path = ../../src/gui/components/controls/juce_Slider.h; sourceTree = SOURCE_ROOT; };
BBF1D5E94840603712BDB13D = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_SliderListener.h; path = ../../src/gui/components/controls/juce_SliderListener.h; sourceTree = SOURCE_ROOT; };
6BB68B37C7B0BB4DA8326647 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_TableHeaderComponent.cpp; path = ../../src/gui/components/controls/juce_TableHeaderComponent.cpp; sourceTree = SOURCE_ROOT; };
1EA844F7CC5377A14B0FD21C = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_TableHeaderComponent.h; path = ../../src/gui/components/controls/juce_TableHeaderComponent.h; sourceTree = SOURCE_ROOT; };
76E073B2A3F59A3ACD20CC87 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_TableListBox.cpp; path = ../../src/gui/components/controls/juce_TableListBox.cpp; sourceTree = SOURCE_ROOT; };
@@ -1319,7 +1318,6 @@
1DB68310EA4D6180FF948AA0,
3CE16163A43A6E67428385EE,
E698677EEC8E88CAFF542764,
BBF1D5E94840603712BDB13D,
6BB68B37C7B0BB4DA8326647,
1EA844F7CC5377A14B0FD21C,
76E073B2A3F59A3ACD20CC87,


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

@@ -491,7 +491,6 @@
<File RelativePath="..\..\src\gui\components\controls\juce_ProgressBar.h"/>
<File RelativePath="..\..\src\gui\components\controls\juce_Slider.cpp"/>
<File RelativePath="..\..\src\gui\components\controls\juce_Slider.h"/>
<File RelativePath="..\..\src\gui\components\controls\juce_SliderListener.h"/>
<File RelativePath="..\..\src\gui\components\controls\juce_TableHeaderComponent.cpp"/>
<File RelativePath="..\..\src\gui\components\controls\juce_TableHeaderComponent.h"/>
<File RelativePath="..\..\src\gui\components\controls\juce_TableListBox.cpp"/>


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

@@ -491,7 +491,6 @@
<File RelativePath="..\..\src\gui\components\controls\juce_ProgressBar.h"/>
<File RelativePath="..\..\src\gui\components\controls\juce_Slider.cpp"/>
<File RelativePath="..\..\src\gui\components\controls\juce_Slider.h"/>
<File RelativePath="..\..\src\gui\components\controls\juce_SliderListener.h"/>
<File RelativePath="..\..\src\gui\components\controls\juce_TableHeaderComponent.cpp"/>
<File RelativePath="..\..\src\gui\components\controls\juce_TableHeaderComponent.h"/>
<File RelativePath="..\..\src\gui\components\controls\juce_TableListBox.cpp"/>


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

@@ -493,7 +493,6 @@
<File RelativePath="..\..\src\gui\components\controls\juce_ProgressBar.h"/>
<File RelativePath="..\..\src\gui\components\controls\juce_Slider.cpp"/>
<File RelativePath="..\..\src\gui\components\controls\juce_Slider.h"/>
<File RelativePath="..\..\src\gui\components\controls\juce_SliderListener.h"/>
<File RelativePath="..\..\src\gui\components\controls\juce_TableHeaderComponent.cpp"/>
<File RelativePath="..\..\src\gui\components\controls\juce_TableHeaderComponent.h"/>
<File RelativePath="..\..\src\gui\components\controls\juce_TableListBox.cpp"/>


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

@@ -576,7 +576,6 @@
<ClInclude Include="..\..\src\gui\components\controls\juce_ListBox.h"/>
<ClInclude Include="..\..\src\gui\components\controls\juce_ProgressBar.h"/>
<ClInclude Include="..\..\src\gui\components\controls\juce_Slider.h"/>
<ClInclude Include="..\..\src\gui\components\controls\juce_SliderListener.h"/>
<ClInclude Include="..\..\src\gui\components\controls\juce_TableHeaderComponent.h"/>
<ClInclude Include="..\..\src\gui\components\controls\juce_TableListBox.h"/>
<ClInclude Include="..\..\src\gui\components\controls\juce_TextEditor.h"/>


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

@@ -1650,9 +1650,6 @@
<ClInclude Include="..\..\src\gui\components\controls\juce_Slider.h">
<Filter>Juce\Source\gui\components\controls</Filter>
</ClInclude>
<ClInclude Include="..\..\src\gui\components\controls\juce_SliderListener.h">
<Filter>Juce\Source\gui\components\controls</Filter>
</ClInclude>
<ClInclude Include="..\..\src\gui\components\controls\juce_TableHeaderComponent.h">
<Filter>Juce\Source\gui\components\controls</Filter>
</ClInclude>


+ 0
- 2
Builds/iPhone/Juce.xcodeproj/project.pbxproj View File

@@ -607,7 +607,6 @@
1DB68310EA4D6180FF948AA0 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_ProgressBar.h; path = ../../src/gui/components/controls/juce_ProgressBar.h; sourceTree = SOURCE_ROOT; };
3CE16163A43A6E67428385EE = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_Slider.cpp; path = ../../src/gui/components/controls/juce_Slider.cpp; sourceTree = SOURCE_ROOT; };
E698677EEC8E88CAFF542764 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_Slider.h; path = ../../src/gui/components/controls/juce_Slider.h; sourceTree = SOURCE_ROOT; };
BBF1D5E94840603712BDB13D = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_SliderListener.h; path = ../../src/gui/components/controls/juce_SliderListener.h; sourceTree = SOURCE_ROOT; };
6BB68B37C7B0BB4DA8326647 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_TableHeaderComponent.cpp; path = ../../src/gui/components/controls/juce_TableHeaderComponent.cpp; sourceTree = SOURCE_ROOT; };
1EA844F7CC5377A14B0FD21C = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_TableHeaderComponent.h; path = ../../src/gui/components/controls/juce_TableHeaderComponent.h; sourceTree = SOURCE_ROOT; };
76E073B2A3F59A3ACD20CC87 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_TableListBox.cpp; path = ../../src/gui/components/controls/juce_TableListBox.cpp; sourceTree = SOURCE_ROOT; };
@@ -1319,7 +1318,6 @@
1DB68310EA4D6180FF948AA0,
3CE16163A43A6E67428385EE,
E698677EEC8E88CAFF542764,
BBF1D5E94840603712BDB13D,
6BB68B37C7B0BB4DA8326647,
1EA844F7CC5377A14B0FD21C,
76E073B2A3F59A3ACD20CC87,


+ 0
- 2
Juce.jucer View File

@@ -619,8 +619,6 @@
file="src/gui/components/controls/juce_Slider.cpp"/>
<FILE id="dvlZ7M2B1" name="juce_Slider.h" compile="0" resource="0"
file="src/gui/components/controls/juce_Slider.h"/>
<FILE id="HpGigit7h" name="juce_SliderListener.h" compile="0" resource="0"
file="src/gui/components/controls/juce_SliderListener.h"/>
<FILE id="dkEQwSTAl" name="juce_TableHeaderComponent.cpp" compile="1"
resource="0" file="src/gui/components/controls/juce_TableHeaderComponent.cpp"/>
<FILE id="EJ1tYAzIS" name="juce_TableHeaderComponent.h" compile="0"


+ 1
- 1
extras/audio plugins/demo/Source/PluginEditor.cpp View File

@@ -93,7 +93,7 @@ void JuceDemoPluginAudioProcessorEditor::timerCallback()
delaySlider->setValue (ourProcessor->delay, false);
}
// This is our SliderListener callback, when the user drags a slider.
// This is our Slider::Listener callback, when the user drags a slider.
void JuceDemoPluginAudioProcessorEditor::sliderValueChanged (Slider* slider)
{
if (slider == gainSlider)


+ 1
- 1
extras/audio plugins/demo/Source/PluginEditor.h View File

@@ -20,7 +20,7 @@
/** This is the editor component that our filter will display.
*/
class JuceDemoPluginAudioProcessorEditor : public AudioProcessorEditor,
public SliderListener,
public Slider::Listener,
public Timer
{
public:


+ 1
- 1
extras/audio plugins/wrapper/Standalone/juce_StandaloneFilterWindow.h View File

@@ -38,7 +38,7 @@
that the other plugin wrappers use.
*/
class StandaloneFilterWindow : public DocumentWindow,
public ButtonListener
public Button::Listener
{
public:
//==============================================================================


+ 1
- 1
extras/browser plugins/demo/src/JuceBrowserPluginDemo.cpp View File

@@ -31,7 +31,7 @@
This is our top-level component for our plugin..
*/
class JuceDemoBrowserPlugin : public BrowserPluginComponent,
public ButtonListener
public Button::Listener
{
public:
JuceDemoBrowserPlugin()


+ 2
- 2
extras/juce demo/Source/demos/AudioDemoPlaybackPage.h View File

@@ -39,8 +39,8 @@ class DemoThumbnailComp;
*/
class AudioDemoPlaybackPage : public Component,
public FileBrowserListener,
public ButtonListener,
public SliderListener
public Button::Listener,
public Slider::Listener
{
public:
//==============================================================================


+ 3
- 3
extras/juce demo/Source/demos/CameraDemo.cpp View File

@@ -30,9 +30,9 @@
//==============================================================================
class CameraDemo : public Component,
public ComboBoxListener,
public ButtonListener,
public CameraImageListener
public ComboBox::Listener,
public Button::Listener,
public CameraDevice::Listener
{
public:
//==============================================================================


+ 2
- 2
extras/juce demo/Source/demos/FontsAndTextDemo.cpp View File

@@ -29,8 +29,8 @@
//==============================================================================
class FontsAndTextDemo : public Component,
public ListBoxModel,
public ButtonListener,
public SliderListener
public Button::Listener,
public Slider::Listener
{
Array<Font> fonts;
ListBox* listBox;


+ 2
- 2
extras/juce demo/Source/demos/InterprocessCommsDemo.cpp View File

@@ -28,8 +28,8 @@
//==============================================================================
class InterprocessCommsDemo : public Component,
public ButtonListener,
public ComboBoxListener
public Button::Listener,
public ComboBox::Listener
{
public:
//==============================================================================


+ 2
- 2
extras/juce demo/Source/demos/RenderingTestComponent.h View File

@@ -38,8 +38,8 @@ class RenderingTestCanvas;
//[/Comments]
*/
class RenderingTestComponent : public Component,
public ComboBoxListener,
public SliderListener
public ComboBox::Listener,
public Slider::Listener
{
public:
//==============================================================================


+ 1
- 1
extras/juce demo/Source/demos/ThreadingDemo.cpp View File

@@ -211,7 +211,7 @@ public:
//==============================================================================
class ThreadingDemo : public Component,
public Timer,
public ButtonListener
public Button::Listener
{
bool isUsingPool;
ThreadPool pool;


+ 1
- 1
extras/juce demo/Source/demos/TreeViewDemo.cpp View File

@@ -118,7 +118,7 @@ public:
//==============================================================================
class TreeViewDemo : public Component,
public DragAndDropContainer,
public ButtonListener
public Button::Listener
{
XmlElement* treeXml;


+ 2
- 2
extras/juce demo/Source/demos/WebBrowserDemo.cpp View File

@@ -65,8 +65,8 @@ private:
//==============================================================================
class WebBrowserDemo : public Component,
public TextEditorListener,
public ButtonListener
public TextEditor::Listener,
public Button::Listener
{
public:
//==============================================================================


+ 5
- 5
extras/juce demo/Source/demos/WidgetsDemo.cpp View File

@@ -477,7 +477,7 @@ static Component* createRadioButtonPage()
//==============================================================================
class ButtonsPage : public Component,
public ButtonListener
public Button::Listener
{
public:
ButtonsPage (ButtonListener* buttonListener)
@@ -643,8 +643,8 @@ static Component* createMiscPage()
//==============================================================================
class ToolbarDemoComp : public Component,
public SliderListener,
public ButtonListener
public Slider::Listener,
public Button::Listener
{
public:
ToolbarDemoComp()
@@ -917,7 +917,7 @@ private:
//==============================================================================
class DemoTabbedComponent : public TabbedComponent,
public ButtonListener
public Button::Listener
{
public:
DemoTabbedComponent()
@@ -1115,7 +1115,7 @@ public:
const int numGroups = 4;
class WidgetsDemo : public Component,
public ButtonListener
public Button::Listener
{
TextButton* menuButton;
ToggleButton* enableButton;


+ 57
- 56
juce_amalgamated.cpp View File

@@ -41362,7 +41362,7 @@ void Component::takeKeyboardFocus (const FocusChangeType cause)

if (peer->isFocused() && currentlyFocusedComponent != this)
{
Component* const componentLosingFocus = currentlyFocusedComponent;
SafePointer<Component> componentLosingFocus (currentlyFocusedComponent);

currentlyFocusedComponent = this;

@@ -41370,7 +41370,7 @@ void Component::takeKeyboardFocus (const FocusChangeType cause)

// call this after setting currentlyFocusedComponent so that the one that's
// losing it has a chance to see where focus is going
if (componentLosingFocus->isValidComponent())
if (componentLosingFocus != 0)
componentLosingFocus->internalFocusLoss (cause);

if (currentlyFocusedComponent == this)
@@ -41502,11 +41502,12 @@ Component* JUCE_CALLTYPE Component::getCurrentlyFocusedComponent() throw()
void Component::giveAwayFocus()
{
// use a copy so we can clear the value before the call
Component* const componentLosingFocus = currentlyFocusedComponent;
SafePointer<Component> componentLosingFocus (currentlyFocusedComponent);

currentlyFocusedComponent = 0;
Desktop::getInstance().triggerFocusCallback();

if (componentLosingFocus->isValidComponent())
if (componentLosingFocus != 0)
componentLosingFocus->internalFocusLoss (focusChangedDirectly);
}

@@ -42539,12 +42540,12 @@ void Button::handleCommandMessage (int commandId)
}
}

void Button::addButtonListener (ButtonListener* const newListener)
void Button::addButtonListener (Listener* const newListener)
{
buttonListeners.add (newListener);
}

void Button::removeButtonListener (ButtonListener* const listener)
void Button::removeButtonListener (Listener* const listener)
{
buttonListeners.remove (listener);
}
@@ -42565,7 +42566,7 @@ void Button::sendClickMessage (const ModifierKeys& modifiers)
clicked (modifiers);

if (! checker.shouldBailOut())
buttonListeners.callChecked (checker, &ButtonListener::buttonClicked, this);
buttonListeners.callChecked (checker, &Listener::buttonClicked, this);
}

void Button::sendStateMessage()
@@ -42575,7 +42576,7 @@ void Button::sendStateMessage()
buttonStateChanged();

if (! checker.shouldBailOut())
buttonListeners.callChecked (checker, &ButtonListener::buttonStateChanged, this);
buttonListeners.callChecked (checker, &Listener::buttonStateChanged, this);
}

void Button::paint (Graphics& g)
@@ -46956,12 +46957,12 @@ void ComboBox::mouseUp (const MouseEvent& e2)
}
}

void ComboBox::addListener (ComboBoxListener* const listener) throw()
void ComboBox::addListener (Listener* const listener) throw()
{
listeners.add (listener);
}

void ComboBox::removeListener (ComboBoxListener* const listener) throw()
void ComboBox::removeListener (Listener* const listener) throw()
{
listeners.remove (listener);
}
@@ -46969,7 +46970,7 @@ void ComboBox::removeListener (ComboBoxListener* const listener) throw()
void ComboBox::handleAsyncUpdate()
{
Component::BailOutChecker checker (this);
listeners.callChecked (checker, &ComboBoxListener::comboBoxChanged, this);
listeners.callChecked (checker, &Listener::comboBoxChanged, this);
}

END_JUCE_NAMESPACE
@@ -47342,12 +47343,12 @@ KeyboardFocusTraverser* Label::createFocusTraverser()
return new LabelKeyboardFocusTraverser();
}

void Label::addListener (LabelListener* const listener) throw()
void Label::addListener (Listener* const listener) throw()
{
listeners.add (listener);
}

void Label::removeListener (LabelListener* const listener) throw()
void Label::removeListener (Listener* const listener) throw()
{
listeners.remove (listener);
}
@@ -47355,7 +47356,7 @@ void Label::removeListener (LabelListener* const listener) throw()
void Label::callChangeListeners()
{
Component::BailOutChecker checker (this);
listeners.callChecked (checker, &LabelListener::labelTextChanged, this);
listeners.callChecked (checker, &Listener::labelTextChanged, this);
}

void Label::textEditorTextChanged (TextEditor& ed)
@@ -48580,7 +48581,7 @@ void Slider::handleAsyncUpdate()
cancelPendingUpdate();

Component::BailOutChecker checker (this);
listeners.callChecked (checker, &SliderListener::sliderValueChanged, this);
listeners.callChecked (checker, &Listener::sliderValueChanged, this);
}

void Slider::sendDragStart()
@@ -48588,7 +48589,7 @@ void Slider::sendDragStart()
startedDragging();

Component::BailOutChecker checker (this);
listeners.callChecked (checker, &SliderListener::sliderDragStarted, this);
listeners.callChecked (checker, &Listener::sliderDragStarted, this);
}

void Slider::sendDragEnd()
@@ -48598,15 +48599,15 @@ void Slider::sendDragEnd()
sliderBeingDragged = -1;

Component::BailOutChecker checker (this);
listeners.callChecked (checker, &SliderListener::sliderDragEnded, this);
listeners.callChecked (checker, &Listener::sliderDragEnded, this);
}

void Slider::addListener (SliderListener* const listener)
void Slider::addListener (Listener* const listener)
{
listeners.add (listener);
}

void Slider::removeListener (SliderListener* const listener)
void Slider::removeListener (Listener* const listener)
{
listeners.remove (listener);
}
@@ -49836,11 +49837,11 @@ void Slider::mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float w
}
}

void SliderListener::sliderDragStarted (Slider*)
void Slider::Listener::sliderDragStarted (Slider*)
{
}

void SliderListener::sliderDragEnded (Slider*)
void Slider::Listener::sliderDragEnded (Slider*)
{
}

@@ -50299,12 +50300,12 @@ void TableHeaderComponent::restoreFromString (const String& storedVersion)
}
}

void TableHeaderComponent::addListener (TableHeaderListener* const newListener)
void TableHeaderComponent::addListener (Listener* const newListener)
{
listeners.addIfNotAlreadyThere (newListener);
}

void TableHeaderComponent::removeListener (TableHeaderListener* const listenerToRemove)
void TableHeaderComponent::removeListener (Listener* const listenerToRemove)
{
listeners.removeValue (listenerToRemove);
}
@@ -50742,7 +50743,7 @@ void TableHeaderComponent::showColumnChooserMenu (const int columnIdClicked)
}
}

void TableHeaderListener::tableColumnDraggingChanged (TableHeaderComponent*, int)
void TableHeaderComponent::Listener::tableColumnDraggingChanged (TableHeaderComponent*, int)
{
}

@@ -52504,12 +52505,12 @@ void TextEditor::escapePressed()
postCommandMessage (TextEditorDefs::escapeKeyMessageId);
}

void TextEditor::addListener (TextEditorListener* const newListener)
void TextEditor::addListener (Listener* const newListener)
{
listeners.add (newListener);
}

void TextEditor::removeListener (TextEditorListener* const listenerToRemove)
void TextEditor::removeListener (Listener* const listenerToRemove)
{
listeners.remove (listenerToRemove);
}
@@ -53426,19 +53427,19 @@ void TextEditor::handleCommandMessage (const int commandId)
switch (commandId)
{
case TextEditorDefs::textChangeMessageId:
listeners.callChecked (checker, &TextEditorListener::textEditorTextChanged, (TextEditor&) *this);
listeners.callChecked (checker, &Listener::textEditorTextChanged, (TextEditor&) *this);
break;

case TextEditorDefs::returnKeyMessageId:
listeners.callChecked (checker, &TextEditorListener::textEditorReturnKeyPressed, (TextEditor&) *this);
listeners.callChecked (checker, &Listener::textEditorReturnKeyPressed, (TextEditor&) *this);
break;

case TextEditorDefs::escapeKeyMessageId:
listeners.callChecked (checker, &TextEditorListener::textEditorEscapeKeyPressed, (TextEditor&) *this);
listeners.callChecked (checker, &Listener::textEditorEscapeKeyPressed, (TextEditor&) *this);
break;

case TextEditorDefs::focusLossMessageId:
listeners.callChecked (checker, &TextEditorListener::textEditorFocusLost, (TextEditor&) *this);
listeners.callChecked (checker, &Listener::textEditorFocusLost, (TextEditor&) *this);
break;

default:
@@ -53989,7 +53990,7 @@ private:
ToolbarSpacerComp& operator= (const ToolbarSpacerComp&);
};

class MissingItemsComponent : public PopupMenuCustomComponent
class Toolbar::MissingItemsComponent : public PopupMenuCustomComponent
{
public:
MissingItemsComponent (Toolbar& owner_, const int height_)
@@ -54590,8 +54591,8 @@ private:
Toolbar* const toolbar;

class CustomiserPanel : public Component,
private ComboBoxListener,
private ButtonListener
private ComboBox::Listener,
private Button::Listener
{
public:
CustomiserPanel (ToolbarItemFactory& factory_,
@@ -61949,12 +61950,12 @@ void ScrollBar::setButtonRepeatSpeed (const int initialDelayInMillisecs_,
}
}

void ScrollBar::addListener (ScrollBarListener* const listener)
void ScrollBar::addListener (Listener* const listener)
{
listeners.add (listener);
}

void ScrollBar::removeListener (ScrollBarListener* const listener)
void ScrollBar::removeListener (Listener* const listener)
{
listeners.remove (listener);
}
@@ -61962,7 +61963,7 @@ void ScrollBar::removeListener (ScrollBarListener* const listener)
void ScrollBar::handleAsyncUpdate()
{
double start = visibleRange.getStart(); // (need to use a temp variable for VC7 compatibility)
listeners.call (&ScrollBarListener::scrollBarMoved, this, start);
listeners.call (&Listener::scrollBarMoved, this, start);
}

void ScrollBar::updateThumbPosition()
@@ -67839,12 +67840,12 @@ void MenuBarModel::setApplicationCommandManagerToWatch (ApplicationCommandManage
}
}

void MenuBarModel::addListener (MenuBarModelListener* const newListener) throw()
void MenuBarModel::addListener (Listener* const newListener) throw()
{
listeners.add (newListener);
}

void MenuBarModel::removeListener (MenuBarModelListener* const listenerToRemove) throw()
void MenuBarModel::removeListener (Listener* const listenerToRemove) throw()
{
// Trying to remove a listener that isn't on the list!
// If this assertion happens because this object is a dangling pointer, make sure you've not
@@ -67856,12 +67857,12 @@ void MenuBarModel::removeListener (MenuBarModelListener* const listenerToRemove)

void MenuBarModel::handleAsyncUpdate()
{
listeners.call (&MenuBarModelListener::menuBarItemsChanged, this);
listeners.call (&Listener::menuBarItemsChanged, this);
}

void MenuBarModel::applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo& info)
{
listeners.call (&MenuBarModelListener::menuCommandInvoked, this, info);
listeners.call (&Listener::menuCommandInvoked, this, info);
}

void MenuBarModel::applicationCommandListChanged()
@@ -72019,9 +72020,9 @@ private:
};

class AudioDeviceSettingsPanel : public Component,
public ComboBoxListener,
public ChangeListener,
public ButtonListener
public ComboBox::Listener,
public Button::Listener
{
public:
AudioDeviceSettingsPanel (AudioIODeviceType* type_,
@@ -77221,7 +77222,7 @@ END_JUCE_NAMESPACE
/*** Start of inlined file: juce_DocumentWindow.cpp ***/
BEGIN_JUCE_NAMESPACE

class DocumentWindow::ButtonListenerProxy : public ButtonListener
class DocumentWindow::ButtonListenerProxy : public Button::Listener
{
public:
ButtonListenerProxy (DocumentWindow& owner_)
@@ -252282,7 +252283,7 @@ public:
mediaControl->Run();
}

void addListener (CameraImageListener* listenerToAdd)
void addListener (CameraDevice::Listener* listenerToAdd)
{
const ScopedLock sl (listenerLock);

@@ -252292,7 +252293,7 @@ public:
listeners.addIfNotAlreadyThere (listenerToAdd);
}

void removeListener (CameraImageListener* listenerToRemove)
void removeListener (CameraDevice::Listener* listenerToRemove)
{
const ScopedLock sl (listenerLock);
listeners.removeValue (listenerToRemove);
@@ -252307,7 +252308,7 @@ public:

for (int i = listeners.size(); --i >= 0;)
{
CameraImageListener* const l = listeners[i];
CameraDevice::Listener* const l = listeners[i];

if (l != 0)
l->imageReceived (image);
@@ -252586,7 +252587,7 @@ private:
};

ComSmartPtr <GrabberCallback> callback;
Array <CameraImageListener*> listeners;
Array <CameraDevice::Listener*> listeners;
CriticalSection listenerLock;

DShowCameraDeviceInteral (const DShowCameraDeviceInteral&);
@@ -252642,7 +252643,7 @@ void CameraDevice::stopRecording()
}
}

void CameraDevice::addListener (CameraImageListener* listenerToAdd)
void CameraDevice::addListener (Listener* listenerToAdd)
{
DShowCameraDeviceInteral* const d = (DShowCameraDeviceInteral*) internal;

@@ -252650,7 +252651,7 @@ void CameraDevice::addListener (CameraImageListener* listenerToAdd)
d->addListener (listenerToAdd);
}

void CameraDevice::removeListener (CameraImageListener* listenerToRemove)
void CameraDevice::removeListener (Listener* listenerToRemove)
{
DShowCameraDeviceInteral* const d = (DShowCameraDeviceInteral*) internal;

@@ -272769,7 +272770,7 @@ using namespace JUCE_NAMESPACE;
@end
BEGIN_JUCE_NAMESPACE

class JuceMainMenuHandler : private MenuBarModelListener,
class JuceMainMenuHandler : private MenuBarModel::Listener,
private DeletedAtShutdown
{
public:
@@ -277376,7 +277377,7 @@ public:
}
}

void addListener (CameraImageListener* listenerToAdd)
void addListener (CameraDevice::Listener* listenerToAdd)
{
const ScopedLock sl (listenerLock);

@@ -277386,7 +277387,7 @@ public:
listeners.addIfNotAlreadyThere (listenerToAdd);
}

void removeListener (CameraImageListener* listenerToRemove)
void removeListener (CameraDevice::Listener* listenerToRemove)
{
const ScopedLock sl (listenerLock);
listeners.removeValue (listenerToRemove);
@@ -277408,7 +277409,7 @@ public:

for (int i = listeners.size(); --i >= 0;)
{
CameraImageListener* const l = listeners[i];
CameraDevice::Listener* const l = listeners[i];

if (l != 0)
l->imageReceived (image);
@@ -277425,7 +277426,7 @@ public:
QTCaptureCallbackDelegate* callbackDelegate;
String openingError;

Array<CameraImageListener*> listeners;
Array<CameraDevice::Listener*> listeners;
CriticalSection listenerLock;
};

@@ -277599,13 +277600,13 @@ void CameraDevice::stopRecording()
}
}

void CameraDevice::addListener (CameraImageListener* listenerToAdd)
void CameraDevice::addListener (Listener* listenerToAdd)
{
if (listenerToAdd != 0)
static_cast <QTCameraDeviceInteral*> (internal)->addListener (listenerToAdd);
}

void CameraDevice::removeListener (CameraImageListener* listenerToRemove)
void CameraDevice::removeListener (Listener* listenerToRemove)
{
if (listenerToRemove != 0)
static_cast <QTCameraDeviceInteral*> (internal)->removeListener (listenerToRemove);


+ 343
- 353
juce_amalgamated.h
File diff suppressed because it is too large
View File


+ 1
- 1
src/audio/plugins/juce_PluginListComponent.h View File

@@ -41,7 +41,7 @@
class JUCE_API PluginListComponent : public Component,
public ListBoxModel,
public ChangeListener,
public ButtonListener,
public Button::Listener,
public Timer
{
public:


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

@@ -33,7 +33,7 @@
*/
#define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 52
#define JUCE_BUILDNUMBER 41
#define JUCE_BUILDNUMBER 42
/** Current Juce version number.


+ 4
- 4
src/gui/components/buttons/juce_Button.cpp View File

@@ -351,12 +351,12 @@ void Button::handleCommandMessage (int commandId)
}
//==============================================================================
void Button::addButtonListener (ButtonListener* const newListener)
void Button::addButtonListener (Listener* const newListener)
{
buttonListeners.add (newListener);
}
void Button::removeButtonListener (ButtonListener* const listener)
void Button::removeButtonListener (Listener* const listener)
{
buttonListeners.remove (listener);
}
@@ -377,7 +377,7 @@ void Button::sendClickMessage (const ModifierKeys& modifiers)
clicked (modifiers);
if (! checker.shouldBailOut())
buttonListeners.callChecked (checker, &ButtonListener::buttonClicked, this);
buttonListeners.callChecked (checker, &Listener::buttonClicked, this);
}
void Button::sendStateMessage()
@@ -387,7 +387,7 @@ void Button::sendStateMessage()
buttonStateChanged();
if (! checker.shouldBailOut())
buttonListeners.callChecked (checker, &ButtonListener::buttonStateChanged, this);
buttonListeners.callChecked (checker, &Listener::buttonStateChanged, this);
}
//==============================================================================


+ 24
- 24
src/gui/components/buttons/juce_Button.h View File

@@ -32,27 +32,6 @@
#include "../../../containers/juce_SortedSet.h"
#include "../../../containers/juce_Value.h"
#include "../windows/juce_TooltipWindow.h"
class Button;
//==============================================================================
/**
Used to receive callbacks when a button is clicked.
@see Button::addButtonListener, Button::removeButtonListener
*/
class JUCE_API ButtonListener
{
public:
/** Destructor. */
virtual ~ButtonListener() {}
/** Called when the button is clicked. */
virtual void buttonClicked (Button* button) = 0;
/** Called when the button's state changes. */
virtual void buttonStateChanged (Button*) {}
};
//==============================================================================
@@ -191,19 +170,37 @@ public:
int getRadioGroupId() const throw() { return radioGroupId; }
//==============================================================================
/**
Used to receive callbacks when a button is clicked.
@see Button::addButtonListener, Button::removeButtonListener
*/
class JUCE_API Listener
{
public:
/** Destructor. */
virtual ~Listener() {}
/** Called when the button is clicked. */
virtual void buttonClicked (Button* button) = 0;
/** Called when the button's state changes. */
virtual void buttonStateChanged (Button*) {}
};
/** Registers a listener to receive events when this button's state changes.
If the listener is already registered, this will not register it again.
@see removeButtonListener
*/
void addButtonListener (ButtonListener* newListener);
void addButtonListener (Listener* newListener);
/** Removes a previously-registered button listener
@see addButtonListener
*/
void removeButtonListener (ButtonListener* listener);
void removeButtonListener (Listener* listener);
//==============================================================================
/** Causes the button to act as if it's been clicked.
@@ -471,7 +468,7 @@ private:
Array <KeyPress> shortcuts;
Component::SafePointer<Component> keySource;
String text;
ListenerList <ButtonListener> buttonListeners;
ListenerList <Listener> buttonListeners;
class RepeatTimer;
friend class RepeatTimer;
@@ -507,5 +504,8 @@ private:
Button& operator= (const Button&);
};
/** This typedef is just for compatibility with old code - newer code should use Button::Listener instead. */
typedef Button::Listener ButtonListener;
#endif // __JUCE_BUTTON_JUCEHEADER__

+ 1
- 1
src/gui/components/code_editor/juce_CodeEditorComponent.h View File

@@ -43,7 +43,7 @@
class JUCE_API CodeEditorComponent : public Component,
public TextInputTarget,
public Timer,
public ScrollBarListener,
public ScrollBar::Listener,
public CodeDocument::Listener,
public AsyncUpdater
{


+ 3
- 3
src/gui/components/controls/juce_ComboBox.cpp View File

@@ -623,12 +623,12 @@ void ComboBox::mouseUp (const MouseEvent& e2)
}
//==============================================================================
void ComboBox::addListener (ComboBoxListener* const listener) throw()
void ComboBox::addListener (Listener* const listener) throw()
{
listeners.add (listener);
}
void ComboBox::removeListener (ComboBoxListener* const listener) throw()
void ComboBox::removeListener (Listener* const listener) throw()
{
listeners.remove (listener);
}
@@ -636,7 +636,7 @@ void ComboBox::removeListener (ComboBoxListener* const listener) throw()
void ComboBox::handleAsyncUpdate()
{
Component::BailOutChecker checker (this);
listeners.callChecked (checker, &ComboBoxListener::comboBoxChanged, this);
listeners.callChecked (checker, &Listener::comboBoxChanged, this);
}


+ 28
- 28
src/gui/components/controls/juce_ComboBox.h View File

@@ -29,28 +29,6 @@
#include "juce_Label.h"
#include "../../../text/juce_StringArray.h"
#include "../../../containers/juce_Value.h"
class ComboBox;
//==============================================================================
/**
A class for receiving events from a ComboBox.
You can register a ComboBoxListener with a ComboBox using the ComboBox::addListener()
method, and it will be called when the selected item in the box changes.
@see ComboBox::addListener, ComboBox::removeListener
*/
class JUCE_API ComboBoxListener
{
public:
/** Destructor. */
virtual ~ComboBoxListener() {}
/** Called when a ComboBox has its selected item changed.
*/
virtual void comboBoxChanged (ComboBox* comboBoxThatHasChanged) = 0;
};
//==============================================================================
@@ -64,14 +42,14 @@ public:
either be read-only text, or editable.
To find out when the user selects a different item or edits the text, you
can register a ComboBoxListener to receive callbacks.
can register a ComboBox::Listener to receive callbacks.
@see ComboBoxListener
@see ComboBox::Listener
*/
class JUCE_API ComboBox : public Component,
public SettableTooltipClient,
private LabelListener,
private AsyncUpdater,
private Label::Listener,
private Value::Listener
{
public:
@@ -286,11 +264,29 @@ public:
void showPopup();
//==============================================================================
/**
A class for receiving events from a ComboBox.
You can register a ComboBox::Listener with a ComboBox using the ComboBox::addListener()
method, and it will be called when the selected item in the box changes.
@see ComboBox::addListener, ComboBox::removeListener
*/
class JUCE_API Listener
{
public:
/** Destructor. */
virtual ~Listener() {}
/** Called when a ComboBox has its selected item changed. */
virtual void comboBoxChanged (ComboBox* comboBoxThatHasChanged) = 0;
};
/** Registers a listener that will be called when the box's content changes. */
void addListener (ComboBoxListener* listener) throw();
void addListener (Listener* listener) throw();
/** Deregisters a previously-registered listener. */
void removeListener (ComboBoxListener* listener) throw();
void removeListener (Listener* listener) throw();
//==============================================================================
/** Sets a message to display when there is no item currently selected.
@@ -398,7 +394,7 @@ private:
Value currentId;
int lastCurrentId;
bool isButtonDown, separatorPending, menuActive, textIsCustom;
ListenerList <ComboBoxListener> listeners;
ListenerList <Listener> listeners;
ScopedPointer<Label> label;
String textWhenNothingSelected, noChoicesMessage;
@@ -409,4 +405,8 @@ private:
ComboBox& operator= (const ComboBox&);
};
/** This typedef is just for compatibility with old code - newer code should use the ComboBox::Listener class directly. */
typedef ComboBox::Listener ComboBoxListener;
#endif // __JUCE_COMBOBOX_JUCEHEADER__

+ 3
- 3
src/gui/components/controls/juce_Label.cpp View File

@@ -403,12 +403,12 @@ KeyboardFocusTraverser* Label::createFocusTraverser()
}
//==============================================================================
void Label::addListener (LabelListener* const listener) throw()
void Label::addListener (Listener* const listener) throw()
{
listeners.add (listener);
}
void Label::removeListener (LabelListener* const listener) throw()
void Label::removeListener (Listener* const listener) throw()
{
listeners.remove (listener);
}
@@ -416,7 +416,7 @@ void Label::removeListener (LabelListener* const listener) throw()
void Label::callChangeListeners()
{
Component::BailOutChecker checker (this);
listeners.callChecked (checker, &LabelListener::labelTextChanged, this);
listeners.callChecked (checker, &Listener::labelTextChanged, this);
}
//==============================================================================


+ 35
- 42
src/gui/components/controls/juce_Label.h View File

@@ -27,30 +27,6 @@
#define __JUCE_LABEL_JUCEHEADER__
#include "juce_TextEditor.h"
class Label;
//==============================================================================
/**
A class for receiving events from a Label.
You can register a LabelListener with a Label using the Label::addListener()
method, and it will be called when the text of the label changes, either because
of a call to Label::setText() or by the user editing the text (if the label is
editable).
@see Label::addListener, Label::removeListener
*/
class JUCE_API LabelListener
{
public:
/** Destructor. */
virtual ~LabelListener() {}
/** Called when a Label's text has changed.
*/
virtual void labelTextChanged (Label* labelThatHasChanged) = 0;
};
//==============================================================================
@@ -60,7 +36,7 @@ public:
*/
class JUCE_API Label : public Component,
public SettableTooltipClient,
protected TextEditorListener,
protected TextEditor::Listener,
private ComponentListener,
private Value::Listener
{
@@ -81,11 +57,10 @@ public:
/** Changes the label text.
If broadcastChangeMessage is true and the new text is different to the current
text, then the class will broadcast a change message to any LabelListeners that
are registered.
text, then the class will broadcast a change message to any Label::Listener objects
that are registered.
*/
void setText (const String& newText,
bool broadcastChangeMessage);
void setText (const String& newText, bool broadcastChangeMessage);
/** Returns the label's current text.
@@ -195,11 +170,32 @@ public:
float getMinimumHorizontalScale() const throw() { return minimumHorizontalScale; }
//==============================================================================
/**
A class for receiving events from a Label.
You can register a Label::Listener with a Label using the Label::addListener()
method, and it will be called when the text of the label changes, either because
of a call to Label::setText() or by the user editing the text (if the label is
editable).
@see Label::addListener, Label::removeListener
*/
class JUCE_API Listener
{
public:
/** Destructor. */
virtual ~Listener() {}
/** Called when a Label's text has changed.
*/
virtual void labelTextChanged (Label* labelThatHasChanged) = 0;
};
/** Registers a listener that will be called when the label's text changes. */
void addListener (LabelListener* listener) throw();
void addListener (Listener* listener) throw();
/** Deregisters a previously-registered listener. */
void removeListener (LabelListener* listener) throw();
void removeListener (Listener* listener) throw();
//==============================================================================
/** Makes the label turn into a TextEditor when clicked.
@@ -262,26 +258,20 @@ public:
protected:
/** Creates the TextEditor component that will be used when the user has clicked on the label.
Subclasses can override this if they need to customise this component in some way.
*/
virtual TextEditor* createEditorComponent();
/** Called after the user changes the text.
*/
/** Called after the user changes the text. */
virtual void textWasEdited();
/** Called when the text has been altered.
*/
/** Called when the text has been altered. */
virtual void textWasChanged();
/** Called when the text editor has just appeared, due to a user click or other
focus change.
*/
/** Called when the text editor has just appeared, due to a user click or other focus change. */
virtual void editorShown (TextEditor* editorComponent);
/** Called when the text editor is going to be deleted, after editing has finished.
*/
/** Called when the text editor is going to be deleted, after editing has finished. */
virtual void editorAboutToBeHidden (TextEditor* editorComponent);
//==============================================================================
@@ -326,7 +316,7 @@ private:
Font font;
Justification justification;
ScopedPointer <TextEditor> editor;
ListenerList <LabelListener> listeners;
ListenerList <Listener> listeners;
Component::SafePointer<Component> ownerComponent;
int horizontalBorderSize, verticalBorderSize;
float minimumHorizontalScale;
@@ -342,5 +332,8 @@ private:
Label& operator= (const Label&);
};
/** This typedef is just for compatibility with old code - newer code should use the Label::Listener class directly. */
typedef Label::Listener LabelListener;
#endif // __JUCE_LABEL_JUCEHEADER__

+ 7
- 7
src/gui/components/controls/juce_Slider.cpp View File

@@ -159,7 +159,7 @@ void Slider::handleAsyncUpdate()
cancelPendingUpdate();
Component::BailOutChecker checker (this);
listeners.callChecked (checker, &SliderListener::sliderValueChanged, this);
listeners.callChecked (checker, &Listener::sliderValueChanged, this);
}
void Slider::sendDragStart()
@@ -167,7 +167,7 @@ void Slider::sendDragStart()
startedDragging();
Component::BailOutChecker checker (this);
listeners.callChecked (checker, &SliderListener::sliderDragStarted, this);
listeners.callChecked (checker, &Listener::sliderDragStarted, this);
}
void Slider::sendDragEnd()
@@ -177,15 +177,15 @@ void Slider::sendDragEnd()
sliderBeingDragged = -1;
Component::BailOutChecker checker (this);
listeners.callChecked (checker, &SliderListener::sliderDragEnded, this);
listeners.callChecked (checker, &Listener::sliderDragEnded, this);
}
void Slider::addListener (SliderListener* const listener)
void Slider::addListener (Listener* const listener)
{
listeners.add (listener);
}
void Slider::removeListener (SliderListener* const listener)
void Slider::removeListener (Listener* const listener)
{
listeners.remove (listener);
}
@@ -1423,11 +1423,11 @@ void Slider::mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float w
}
}
void SliderListener::sliderDragStarted (Slider*)
void Slider::Listener::sliderDragStarted (Slider*)
{
}
void SliderListener::sliderDragEnded (Slider*)
void Slider::Listener::sliderDragEnded (Slider*)
{
}


+ 67
- 21
src/gui/components/controls/juce_Slider.h View File

@@ -26,7 +26,6 @@
#ifndef __JUCE_SLIDER_JUCEHEADER__
#define __JUCE_SLIDER_JUCEHEADER__
#include "juce_SliderListener.h"
#include "juce_Label.h"
#include "../buttons/juce_Button.h"
#include "../../../events/juce_AsyncUpdater.h"
@@ -49,16 +48,16 @@
some of the virtual methods, such as changing the scaling, changing the format of
the text display, custom ways of limiting the values, etc.
You can register SliderListeners with a slider, which will be informed when the value
changes, or a subclass can override valueChanged() to be informed synchronously.
You can register Slider::Listener objects with a slider, and they'll be called when
the value changes.
@see SliderListener
@see Slider::Listener
*/
class JUCE_API Slider : public Component,
public SettableTooltipClient,
private AsyncUpdater,
private ButtonListener,
private LabelListener,
private Button::Listener,
private Label::Listener,
private Value::Listener
{
public:
@@ -333,7 +332,7 @@ public:
//==============================================================================
/** Changes the slider's current value.
This will trigger a callback to SliderListener::sliderValueChanged() for any listeners
This will trigger a callback to Slider::Listener::sliderValueChanged() for any listeners
that are registered, and will synchronously call the valueChanged() method in case subclasses
want to handle it.
@@ -341,8 +340,8 @@ public:
minimum and maximum range, and will be snapped to the
nearest interval if one has been set
@param sendUpdateMessage if false, a change to the value will not trigger a call to
any SliderListeners or the valueChanged() method
@param sendMessageSynchronously if true, then a call to the SliderListeners will be made
any Slider::Listeners or the valueChanged() method
@param sendMessageSynchronously if true, then a call to the Slider::Listeners will be made
synchronously; if false, it will be asynchronous
*/
void setValue (double newValue,
@@ -408,7 +407,7 @@ public:
/** For a slider with two or three thumbs, this sets the lower of its values.
This will trigger a callback to SliderListener::sliderValueChanged() for any listeners
This will trigger a callback to Slider::Listener::sliderValueChanged() for any listeners
that are registered, and will synchronously call the valueChanged() method in case subclasses
want to handle it.
@@ -416,8 +415,8 @@ public:
minimum and maximum range, and will be snapped to the nearest
interval if one has been set.
@param sendUpdateMessage if false, a change to the value will not trigger a call to
any SliderListeners or the valueChanged() method
@param sendMessageSynchronously if true, then a call to the SliderListeners will be made
any Slider::Listeners or the valueChanged() method
@param sendMessageSynchronously if true, then a call to the Slider::Listeners will be made
synchronously; if false, it will be asynchronous
@param allowNudgingOfOtherValues if false, this value will be restricted to being below the
max value (in a two-value slider) or the mid value (in a three-value
@@ -450,7 +449,7 @@ public:
/** For a slider with two or three thumbs, this sets the lower of its values.
This will trigger a callback to SliderListener::sliderValueChanged() for any listeners
This will trigger a callback to Slider::Listener::sliderValueChanged() for any listeners
that are registered, and will synchronously call the valueChanged() method in case subclasses
want to handle it.
@@ -458,8 +457,8 @@ public:
minimum and maximum range, and will be snapped to the nearest
interval if one has been set.
@param sendUpdateMessage if false, a change to the value will not trigger a call to
any SliderListeners or the valueChanged() method
@param sendMessageSynchronously if true, then a call to the SliderListeners will be made
any Slider::Listeners or the valueChanged() method
@param sendMessageSynchronously if true, then a call to the Slider::Listeners will be made
synchronously; if false, it will be asynchronous
@param allowNudgingOfOtherValues if false, this value will be restricted to being above the
min value (in a two-value slider) or the mid value (in a three-value
@@ -473,11 +472,55 @@ public:
bool allowNudgingOfOtherValues = false);
//==============================================================================
/** A class for receiving callbacks from a Slider.
To be told when a slider's value changes, you can register a Slider::Listener
object using Slider::addListener().
@see Slider::addListener, Slider::removeListener
*/
class JUCE_API Listener
{
public:
//==============================================================================
/** Destructor. */
virtual ~Listener() {}
//==============================================================================
/** Called when the slider's value is changed.
This may be caused by dragging it, or by typing in its text entry box,
or by a call to Slider::setValue().
You can find out the new value using Slider::getValue().
@see Slider::valueChanged
*/
virtual void sliderValueChanged (Slider* slider) = 0;
//==============================================================================
/** Called when the slider is about to be dragged.
This is called when a drag begins, then it's followed by multiple calls
to sliderValueChanged(), and then sliderDragEnded() is called after the
user lets go.
@see sliderDragEnded, Slider::startedDragging
*/
virtual void sliderDragStarted (Slider* slider);
/** Called after a drag operation has finished.
@see sliderDragStarted, Slider::stoppedDragging
*/
virtual void sliderDragEnded (Slider* slider);
};
/** Adds a listener to be called when this slider's value changes. */
void addListener (SliderListener* listener);
void addListener (Listener* listener);
/** Removes a previously-registered listener. */
void removeListener (SliderListener* listener);
void removeListener (Listener* listener);
//==============================================================================
/** This lets you choose whether double-clicking moves the slider to a given position.
@@ -563,19 +606,19 @@ public:
//==============================================================================
/** Callback to indicate that the user is about to start dragging the slider.
@see SliderListener::sliderDragStarted
@see Slider::Listener::sliderDragStarted
*/
virtual void startedDragging();
/** Callback to indicate that the user has just stopped dragging the slider.
@see SliderListener::sliderDragEnded
@see Slider::Listener::sliderDragEnded
*/
virtual void stoppedDragging();
/** Callback to indicate that the user has just moved the slider.
@see SliderListener::sliderValueChanged
@see Slider::Listener::sliderValueChanged
*/
virtual void valueChanged();
@@ -749,7 +792,7 @@ protected:
int getNumDecimalPlacesToDisplay() const throw() { return numDecimalPlaces; }
private:
ListenerList <SliderListener> listeners;
ListenerList <Listener> listeners;
Value currentValue, valueMin, valueMax;
double lastCurrentValue, lastValueMin, lastValueMax;
double minimum, maximum, interval, doubleClickReturnValue;
@@ -793,5 +836,8 @@ private:
Slider& operator= (const Slider&);
};
/** This typedef is just for compatibility with old code - newer code should use the Slider::Listener class directly. */
typedef Slider::Listener SliderListener;
#endif // __JUCE_SLIDER_JUCEHEADER__

+ 0
- 78
src/gui/components/controls/juce_SliderListener.h View File

@@ -1,78 +0,0 @@
/*
==============================================================================
This file is part of the JUCE library - "Jules' Utility Class Extensions"
Copyright 2004-10 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_SLIDERLISTENER_JUCEHEADER__
#define __JUCE_SLIDERLISTENER_JUCEHEADER__
class Slider;
//==============================================================================
/**
A class for receiving callbacks from a Slider.
To be told when a slider's value changes, you can register a SliderListener
object using Slider::addListener().
@see Slider::addListener, Slider::removeListener
*/
class JUCE_API SliderListener
{
public:
//==============================================================================
/** Destructor. */
virtual ~SliderListener() {}
//==============================================================================
/** Called when the slider's value is changed.
This may be caused by dragging it, or by typing in its text entry box,
or by a call to Slider::setValue().
You can find out the new value using Slider::getValue().
@see Slider::valueChanged
*/
virtual void sliderValueChanged (Slider* slider) = 0;
//==============================================================================
/** Called when the slider is about to be dragged.
This is called when a drag begins, then it's followed by multiple calls
to sliderValueChanged(), and then sliderDragEnded() is called after the
user lets go.
@see sliderDragEnded, Slider::startedDragging
*/
virtual void sliderDragStarted (Slider* slider);
/** Called after a drag operation has finished.
@see sliderDragStarted, Slider::stoppedDragging
*/
virtual void sliderDragEnded (Slider* slider);
};
#endif // __JUCE_SLIDERLISTENER_JUCEHEADER__

+ 3
- 3
src/gui/components/controls/juce_TableHeaderComponent.cpp View File

@@ -492,12 +492,12 @@ void TableHeaderComponent::restoreFromString (const String& storedVersion)
}
//==============================================================================
void TableHeaderComponent::addListener (TableHeaderListener* const newListener)
void TableHeaderComponent::addListener (Listener* const newListener)
{
listeners.addIfNotAlreadyThere (newListener);
}
void TableHeaderComponent::removeListener (TableHeaderListener* const listenerToRemove)
void TableHeaderComponent::removeListener (Listener* const listenerToRemove)
{
listeners.removeValue (listenerToRemove);
}
@@ -937,7 +937,7 @@ void TableHeaderComponent::showColumnChooserMenu (const int columnIdClicked)
}
}
void TableHeaderListener::tableColumnDraggingChanged (TableHeaderComponent*, int)
void TableHeaderComponent::Listener::tableColumnDraggingChanged (TableHeaderComponent*, int)
{
}


+ 47
- 48
src/gui/components/controls/juce_TableHeaderComponent.h View File

@@ -29,50 +29,6 @@
#include "../menus/juce_PopupMenu.h"
#include "../../../events/juce_AsyncUpdater.h"
class TableHeaderComponent;
//==============================================================================
/**
Receives events from a TableHeaderComponent when columns are resized, moved, etc.
You can register one of these objects for table events using TableHeaderComponent::addListener()
and TableHeaderComponent::removeListener().
@see TableHeaderComponent
*/
class JUCE_API TableHeaderListener
{
public:
//==============================================================================
TableHeaderListener() {}
/** Destructor. */
virtual ~TableHeaderListener() {}
//==============================================================================
/** This is called when some of the table's columns are added, removed, hidden,
or rearranged.
*/
virtual void tableColumnsChanged (TableHeaderComponent* tableHeader) = 0;
/** This is called when one or more of the table's columns are resized.
*/
virtual void tableColumnsResized (TableHeaderComponent* tableHeader) = 0;
/** This is called when the column by which the table should be sorted is changed.
*/
virtual void tableSortOrderChanged (TableHeaderComponent* tableHeader) = 0;
/** This is called when the user begins or ends dragging one of the columns around.
When the user starts dragging a column, this is called with the ID of that
column. When they finish dragging, it is called again with 0 as the ID.
*/
virtual void tableColumnDraggingChanged (TableHeaderComponent* tableHeader,
int columnIdNowBeingDragged);
};
//==============================================================================
/**
@@ -86,7 +42,7 @@ public:
To use one of these, create it and use addColumn() to add all the columns that you need.
Each column must be given a unique ID number that's used to refer to it.
@see TableListBox, TableHeaderListener
@see TableListBox, TableHeaderComponent::Listener
*/
class JUCE_API TableHeaderComponent : public Component,
private AsyncUpdater
@@ -340,11 +296,51 @@ public:
void restoreFromString (const String& storedVersion);
//==============================================================================
/**
Receives events from a TableHeaderComponent when columns are resized, moved, etc.
You can register one of these objects for table events using TableHeaderComponent::addListener()
and TableHeaderComponent::removeListener().
@see TableHeaderComponent
*/
class JUCE_API Listener
{
public:
//==============================================================================
Listener() {}
/** Destructor. */
virtual ~Listener() {}
//==============================================================================
/** This is called when some of the table's columns are added, removed, hidden,
or rearranged.
*/
virtual void tableColumnsChanged (TableHeaderComponent* tableHeader) = 0;
/** This is called when one or more of the table's columns are resized.
*/
virtual void tableColumnsResized (TableHeaderComponent* tableHeader) = 0;
/** This is called when the column by which the table should be sorted is changed.
*/
virtual void tableSortOrderChanged (TableHeaderComponent* tableHeader) = 0;
/** This is called when the user begins or ends dragging one of the columns around.
When the user starts dragging a column, this is called with the ID of that
column. When they finish dragging, it is called again with 0 as the ID.
*/
virtual void tableColumnDraggingChanged (TableHeaderComponent* tableHeader,
int columnIdNowBeingDragged);
};
/** Adds a listener to be informed about things that happen to the header. */
void addListener (TableHeaderListener* newListener);
void addListener (Listener* newListener);
/** Removes a previously-registered listener. */
void removeListener (TableHeaderListener* listenerToRemove);
void removeListener (Listener* listenerToRemove);
//==============================================================================
/** This can be overridden to handle a mouse-click on one of the column headers.
@@ -412,7 +408,7 @@ private:
};
OwnedArray <ColumnInfo> columns;
Array <TableHeaderListener*> listeners;
Array <Listener*> listeners;
ScopedPointer <Component> dragOverlayComp;
bool columnsChanged, columnsResized, sortChanged, menuActive, stretchToFit;
@@ -433,5 +429,8 @@ private:
TableHeaderComponent operator= (const TableHeaderComponent&);
};
/** This typedef is just for compatibility with old code - newer code should use the TableHeaderComponent::Listener class directly. */
typedef TableHeaderComponent::Listener TableHeaderListener;
#endif // __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__

+ 1
- 1
src/gui/components/controls/juce_TableListBox.h View File

@@ -199,7 +199,7 @@ public:
*/
class JUCE_API TableListBox : public ListBox,
private ListBoxModel,
private TableHeaderListener
private TableHeaderComponent::Listener
{
public:
//==============================================================================


+ 6
- 6
src/gui/components/controls/juce_TextEditor.cpp View File

@@ -1274,12 +1274,12 @@ void TextEditor::escapePressed()
postCommandMessage (TextEditorDefs::escapeKeyMessageId);
}
void TextEditor::addListener (TextEditorListener* const newListener)
void TextEditor::addListener (Listener* const newListener)
{
listeners.add (newListener);
}
void TextEditor::removeListener (TextEditorListener* const listenerToRemove)
void TextEditor::removeListener (Listener* const listenerToRemove)
{
listeners.remove (listenerToRemove);
}
@@ -2207,19 +2207,19 @@ void TextEditor::handleCommandMessage (const int commandId)
switch (commandId)
{
case TextEditorDefs::textChangeMessageId:
listeners.callChecked (checker, &TextEditorListener::textEditorTextChanged, (TextEditor&) *this);
listeners.callChecked (checker, &Listener::textEditorTextChanged, (TextEditor&) *this);
break;
case TextEditorDefs::returnKeyMessageId:
listeners.callChecked (checker, &TextEditorListener::textEditorReturnKeyPressed, (TextEditor&) *this);
listeners.callChecked (checker, &Listener::textEditorReturnKeyPressed, (TextEditor&) *this);
break;
case TextEditorDefs::escapeKeyMessageId:
listeners.callChecked (checker, &TextEditorListener::textEditorEscapeKeyPressed, (TextEditor&) *this);
listeners.callChecked (checker, &Listener::textEditorEscapeKeyPressed, (TextEditor&) *this);
break;
case TextEditorDefs::focusLossMessageId:
listeners.callChecked (checker, &TextEditorListener::textEditorFocusLost, (TextEditor&) *this);
listeners.callChecked (checker, &Listener::textEditorFocusLost, (TextEditor&) *this);
break;
default:


+ 33
- 32
src/gui/components/controls/juce_TextEditor.h View File

@@ -34,33 +34,6 @@
#include "../menus/juce_PopupMenu.h"
#include "../../../containers/juce_Value.h"
#include "../keyboard/juce_TextInputTarget.h"
class TextEditor;
//==============================================================================
/**
Receives callbacks from a TextEditor component when it changes.
@see TextEditor::addListener
*/
class JUCE_API TextEditorListener
{
public:
/** Destructor. */
virtual ~TextEditorListener() {}
/** Called when the user changes the text in some way. */
virtual void textEditorTextChanged (TextEditor& editor) = 0;
/** Called when the user presses the return key. */
virtual void textEditorReturnKeyPressed (TextEditor& editor) = 0;
/** Called when the user presses the escape key. */
virtual void textEditorEscapeKeyPressed (TextEditor& editor) = 0;
/** Called when the text editor loses focus. */
virtual void textEditorFocusLost (TextEditor& editor) = 0;
};
//==============================================================================
@@ -70,7 +43,7 @@ public:
A TextEditor can either be in single- or multi-line mode, and supports mixed
fonts and colours.
@see TextEditorListener, Label
@see TextEditor::Listener, Label
*/
class JUCE_API TextEditor : public Component,
public TextInputTarget,
@@ -117,7 +90,7 @@ public:
/** Changes the behaviour of the return key.
If set to true, the return key will insert a new-line into the text; if false
it will trigger a call to the TextEditorListener::textEditorReturnKeyPressed()
it will trigger a call to the TextEditor::Listener::textEditorReturnKeyPressed()
method. By default this is set to false, and when true it will only insert
new-lines when in multi-line mode (see setMultiLine()).
*/
@@ -328,17 +301,41 @@ public:
void setScrollBarButtonVisibility (bool buttonsVisible);
//==============================================================================
/**
Receives callbacks from a TextEditor component when it changes.
@see TextEditor::addListener
*/
class JUCE_API Listener
{
public:
/** Destructor. */
virtual ~Listener() {}
/** Called when the user changes the text in some way. */
virtual void textEditorTextChanged (TextEditor& editor) = 0;
/** Called when the user presses the return key. */
virtual void textEditorReturnKeyPressed (TextEditor& editor) = 0;
/** Called when the user presses the escape key. */
virtual void textEditorEscapeKeyPressed (TextEditor& editor) = 0;
/** Called when the text editor loses focus. */
virtual void textEditorFocusLost (TextEditor& editor) = 0;
};
/** Registers a listener to be told when things happen to the text.
@see removeListener
*/
void addListener (TextEditorListener* newListener);
void addListener (Listener* newListener);
/** Deregisters a listener.
@see addListener
*/
void removeListener (TextEditorListener* listenerToRemove);
void removeListener (Listener* listenerToRemove);
//==============================================================================
/** Returns the entire contents of the editor. */
@@ -661,7 +658,7 @@ private:
} dragType;
String allowedCharacters;
ListenerList <TextEditorListener> listeners;
ListenerList <Listener> listeners;
void coalesceSimilarSections();
void splitSection (int sectionIndex, int charToSplitAt);
@@ -691,4 +688,8 @@ private:
TextEditor& operator= (const TextEditor&);
};
/** This typedef is just for compatibility with old code - newer code should use the TextEditor::Listener class directly. */
typedef TextEditor::Listener TextEditorListener;
#endif // __JUCE_TEXTEDITOR_JUCEHEADER__

+ 3
- 3
src/gui/components/controls/juce_Toolbar.cpp View File

@@ -172,7 +172,7 @@ private:
};
//==============================================================================
class MissingItemsComponent : public PopupMenuCustomComponent
class Toolbar::MissingItemsComponent : public PopupMenuCustomComponent
{
public:
MissingItemsComponent (Toolbar& owner_, const int height_)
@@ -782,8 +782,8 @@ private:
Toolbar* const toolbar;
class CustomiserPanel : public Component,
private ComboBoxListener,
private ButtonListener
private ComboBox::Listener,
private Button::Listener
{
public:
CustomiserPanel (ToolbarItemFactory& factory_,


+ 2
- 2
src/gui/components/controls/juce_Toolbar.h View File

@@ -31,7 +31,6 @@
#include "../buttons/juce_Button.h"
class ToolbarItemComponent;
class ToolbarItemFactory;
class MissingItemsComponent;
//==============================================================================
@@ -54,7 +53,7 @@ class MissingItemsComponent;
class JUCE_API Toolbar : public Component,
public DragAndDropContainer,
public DragAndDropTarget,
private ButtonListener
private Button::Listener
{
public:
//==============================================================================
@@ -299,6 +298,7 @@ private:
bool vertical, isEditingActive;
ToolbarItemStyle toolbarStyle;
ComponentAnimator animator;
class MissingItemsComponent;
friend class MissingItemsComponent;
Array <ToolbarItemComponent*> items;


+ 3
- 3
src/gui/components/filebrowser/juce_FileBrowserComponent.h View File

@@ -48,9 +48,9 @@
class JUCE_API FileBrowserComponent : public Component,
public ChangeBroadcaster,
private FileBrowserListener,
private TextEditorListener,
private ButtonListener,
private ComboBoxListener,
private TextEditor::Listener,
private Button::Listener,
private ComboBox::Listener,
private FileFilter
{
public:


+ 1
- 1
src/gui/components/filebrowser/juce_FileChooserDialogBox.h View File

@@ -66,7 +66,7 @@
@see FileChooser
*/
class JUCE_API FileChooserDialogBox : public ResizableWindow,
public ButtonListener,
public Button::Listener,
public FileBrowserListener
{
public:


+ 1
- 1
src/gui/components/filebrowser/juce_FileSearchPathListComponent.h View File

@@ -43,7 +43,7 @@
class JUCE_API FileSearchPathListComponent : public Component,
public SettableTooltipClient,
public FileDragAndDropTarget,
private ButtonListener,
private Button::Listener,
private ListBoxModel
{
public:


+ 2
- 2
src/gui/components/filebrowser/juce_FilenameComponent.h View File

@@ -72,8 +72,8 @@ class JUCE_API FilenameComponent : public Component,
public SettableTooltipClient,
public FileDragAndDropTarget,
private AsyncUpdater,
private ButtonListener,
private ComboBoxListener
private Button::Listener,
private ComboBox::Listener
{
public:
//==============================================================================


+ 5
- 4
src/gui/components/juce_Component.cpp View File

@@ -2907,7 +2907,7 @@ void Component::takeKeyboardFocus (const FocusChangeType cause)
if (peer->isFocused() && currentlyFocusedComponent != this)
{
Component* const componentLosingFocus = currentlyFocusedComponent;
SafePointer<Component> componentLosingFocus (currentlyFocusedComponent);
currentlyFocusedComponent = this;
@@ -2915,7 +2915,7 @@ void Component::takeKeyboardFocus (const FocusChangeType cause)
// call this after setting currentlyFocusedComponent so that the one that's
// losing it has a chance to see where focus is going
if (componentLosingFocus->isValidComponent())
if (componentLosingFocus != 0)
componentLosingFocus->internalFocusLoss (cause);
if (currentlyFocusedComponent == this)
@@ -3047,11 +3047,12 @@ Component* JUCE_CALLTYPE Component::getCurrentlyFocusedComponent() throw()
void Component::giveAwayFocus()
{
// use a copy so we can clear the value before the call
Component* const componentLosingFocus = currentlyFocusedComponent;
SafePointer<Component> componentLosingFocus (currentlyFocusedComponent);
currentlyFocusedComponent = 0;
Desktop::getInstance().triggerFocusCallback();
if (componentLosingFocus->isValidComponent())
if (componentLosingFocus != 0)
componentLosingFocus->internalFocusLoss (focusChangedDirectly);
}


+ 1
- 1
src/gui/components/keyboard/juce_KeyMappingEditorComponent.h View File

@@ -41,7 +41,7 @@
class JUCE_API KeyMappingEditorComponent : public Component,
public TreeViewItem,
public ChangeListener,
private ButtonListener
private Button::Listener
{
public:
//==============================================================================


+ 3
- 3
src/gui/components/layout/juce_ScrollBar.cpp View File

@@ -186,12 +186,12 @@ void ScrollBar::setButtonRepeatSpeed (const int initialDelayInMillisecs_,
}
//==============================================================================
void ScrollBar::addListener (ScrollBarListener* const listener)
void ScrollBar::addListener (Listener* const listener)
{
listeners.add (listener);
}
void ScrollBar::removeListener (ScrollBarListener* const listener)
void ScrollBar::removeListener (Listener* const listener)
{
listeners.remove (listener);
}
@@ -199,7 +199,7 @@ void ScrollBar::removeListener (ScrollBarListener* const listener)
void ScrollBar::handleAsyncUpdate()
{
double start = visibleRange.getStart(); // (need to use a temp variable for VC7 compatibility)
listeners.call (&ScrollBarListener::scrollBarMoved, this, start);
listeners.call (&Listener::scrollBarMoved, this, start);
}
//==============================================================================


+ 34
- 34
src/gui/components/layout/juce_ScrollBar.h View File

@@ -30,32 +30,6 @@
#include "../../../containers/juce_Range.h"
#include "../../../events/juce_Timer.h"
#include "../buttons/juce_Button.h"
class ScrollBar;
//==============================================================================
/**
A class for receiving events from a ScrollBar.
You can register a ScrollBarListener with a ScrollBar using the ScrollBar::addListener()
method, and it will be called when the bar's position changes.
@see ScrollBar::addListener, ScrollBar::removeListener
*/
class JUCE_API ScrollBarListener
{
public:
/** Destructor. */
virtual ~ScrollBarListener() {}
/** Called when a ScrollBar is moved.
@param scrollBarThatHasMoved the bar that has moved
@param newRangeStart the new range start of this bar
*/
virtual void scrollBarMoved (ScrollBar* scrollBarThatHasMoved,
double newRangeStart) = 0;
};
//==============================================================================
@@ -66,7 +40,7 @@ public:
sets the range of values it can represent. Then you can use setCurrentRange() to
change the position and size of the scrollbar's 'thumb'.
Registering a ScrollBarListener with the scrollbar will allow you to find out when
Registering a ScrollBar::Listener with the scrollbar will allow you to find out when
the user moves it, and you can use the getCurrentRangeStart() to find out where
they moved it to.
@@ -76,7 +50,7 @@ public:
For most purposes, it's probably easier to use a ViewportContainer or ListBox
instead of handling a scrollbar directly.
@see ScrollBarListener
@see ScrollBar::Listener
*/
class JUCE_API ScrollBar : public Component,
public AsyncUpdater,
@@ -166,7 +140,7 @@ public:
/** Changes the position of the scrollbar's 'thumb'.
If this method call actually changes the scrollbar's position, it will trigger an
asynchronous call to ScrollBarListener::scrollBarMoved() for all the listeners that
asynchronous call to ScrollBar::Listener::scrollBarMoved() for all the listeners that
are registered.
@see getCurrentRange. setCurrentRangeStart
@@ -179,7 +153,7 @@ public:
changing the size, you can use setCurrentRangeStart().
If this method call actually changes the scrollbar's position, it will trigger an
asynchronous call to ScrollBarListener::scrollBarMoved() for all the listeners that
asynchronous call to ScrollBar::Listener::scrollBarMoved() for all the listeners that
are registered.
@param newStart the top (or left) of the thumb, in the range
@@ -198,7 +172,7 @@ public:
that the maximum thumb start position is (getMaximumRangeLimit() - getCurrentRangeSize()).
If this method call actually changes the scrollbar's position, it will trigger an
asynchronous call to ScrollBarListener::scrollBarMoved() for all the listeners that
asynchronous call to ScrollBar::Listener::scrollBarMoved() for all the listeners that
are registered.
@see setCurrentRange
@@ -287,11 +261,34 @@ public:
};
//==============================================================================
/**
A class for receiving events from a ScrollBar.
You can register a ScrollBar::Listener with a ScrollBar using the ScrollBar::addListener()
method, and it will be called when the bar's position changes.
@see ScrollBar::addListener, ScrollBar::removeListener
*/
class JUCE_API Listener
{
public:
/** Destructor. */
virtual ~Listener() {}
/** Called when a ScrollBar is moved.
@param scrollBarThatHasMoved the bar that has moved
@param newRangeStart the new range start of this bar
*/
virtual void scrollBarMoved (ScrollBar* scrollBarThatHasMoved,
double newRangeStart) = 0;
};
/** Registers a listener that will be called when the scrollbar is moved. */
void addListener (ScrollBarListener* listener);
void addListener (Listener* listener);
/** Deregisters a previously-registered listener. */
void removeListener (ScrollBarListener* listener);
void removeListener (Listener* listener);
//==============================================================================
/** @internal */
@@ -326,7 +323,7 @@ private:
class ScrollbarButton;
friend class ScopedPointer<ScrollbarButton>;
ScopedPointer<ScrollbarButton> upButton, downButton;
ListenerList <ScrollBarListener> listeners;
ListenerList <Listener> listeners;
void updateThumbPosition();
void timerCallback();
@@ -335,5 +332,8 @@ private:
ScrollBar& operator= (const ScrollBar&);
};
/** This typedef is just for compatibility with old code - newer code should use the ScrollBar::Listener class directly. */
typedef ScrollBar::Listener ScrollBarListener;
#endif // __JUCE_SCROLLBAR_JUCEHEADER__

+ 1
- 1
src/gui/components/layout/juce_TabbedButtonBar.h View File

@@ -105,7 +105,7 @@ private:
*/
class JUCE_API TabbedButtonBar : public Component,
public ChangeBroadcaster,
public ButtonListener
public Button::Listener
{
public:
//==============================================================================


+ 1
- 1
src/gui/components/layout/juce_Viewport.h View File

@@ -44,7 +44,7 @@
*/
class JUCE_API Viewport : public Component,
private ComponentListener,
private ScrollBarListener
private ScrollBar::Listener
{
public:
//==============================================================================


+ 1
- 1
src/gui/components/menus/juce_MenuBarComponent.h View File

@@ -36,7 +36,7 @@
@see MenuBarModel
*/
class JUCE_API MenuBarComponent : public Component,
private MenuBarModelListener,
private MenuBarModel::Listener,
private Timer
{
public:


+ 4
- 4
src/gui/components/menus/juce_MenuBarModel.cpp View File

@@ -61,12 +61,12 @@ void MenuBarModel::setApplicationCommandManagerToWatch (ApplicationCommandManage
}
}
void MenuBarModel::addListener (MenuBarModelListener* const newListener) throw()
void MenuBarModel::addListener (Listener* const newListener) throw()
{
listeners.add (newListener);
}
void MenuBarModel::removeListener (MenuBarModelListener* const listenerToRemove) throw()
void MenuBarModel::removeListener (Listener* const listenerToRemove) throw()
{
// Trying to remove a listener that isn't on the list!
// If this assertion happens because this object is a dangling pointer, make sure you've not
@@ -79,12 +79,12 @@ void MenuBarModel::removeListener (MenuBarModelListener* const listenerToRemove)
//==============================================================================
void MenuBarModel::handleAsyncUpdate()
{
listeners.call (&MenuBarModelListener::menuBarItemsChanged, this);
listeners.call (&Listener::menuBarItemsChanged, this);
}
void MenuBarModel::applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo& info)
{
listeners.call (&MenuBarModelListener::menuCommandInvoked, this, info);
listeners.call (&Listener::menuCommandInvoked, this, info);
}
void MenuBarModel::applicationCommandListChanged()


+ 30
- 30
src/gui/components/menus/juce_MenuBarModel.h View File

@@ -27,32 +27,6 @@
#define __JUCE_MENUBARMODEL_JUCEHEADER__
#include "juce_PopupMenu.h"
class MenuBarModel;
//==============================================================================
/**
A class to receive callbacks when a MenuBarModel changes.
@see MenuBarModel::addListener, MenuBarModel::removeListener, MenuBarModel::menuItemsChanged
*/
class JUCE_API MenuBarModelListener
{
public:
/** Destructor. */
virtual ~MenuBarModelListener() {}
//==============================================================================
/** This callback is made when items are changed in the menu bar model.
*/
virtual void menuBarItemsChanged (MenuBarModel* menuBarModel) = 0;
/** This callback is made when an application command is invoked that
is represented by one of the items in the menu bar model.
*/
virtual void menuCommandInvoked (MenuBarModel* menuBarModel,
const ApplicationCommandTarget::InvocationInfo& info) = 0;
};
//==============================================================================
@@ -62,7 +36,7 @@ public:
This class is used to tell a MenuBar what menus to show, and to respond
to a menu being selected.
@see MenuBarModelListener, MenuBarComponent, PopupMenu
@see MenuBarModel::Listener, MenuBarComponent, PopupMenu
*/
class JUCE_API MenuBarModel : private AsyncUpdater,
private ApplicationCommandManagerListener
@@ -97,6 +71,29 @@ public:
*/
void setApplicationCommandManagerToWatch (ApplicationCommandManager* manager) throw();
//==============================================================================
/** A class to receive callbacks when a MenuBarModel changes.
@see MenuBarModel::addListener, MenuBarModel::removeListener, MenuBarModel::menuItemsChanged
*/
class JUCE_API Listener
{
public:
/** Destructor. */
virtual ~Listener() {}
//==============================================================================
/** This callback is made when items are changed in the menu bar model.
*/
virtual void menuBarItemsChanged (MenuBarModel* menuBarModel) = 0;
/** This callback is made when an application command is invoked that
is represented by one of the items in the menu bar model.
*/
virtual void menuCommandInvoked (MenuBarModel* menuBarModel,
const ApplicationCommandTarget::InvocationInfo& info) = 0;
};
/** Registers a listener for callbacks when the menu items in this model change.
The listener object will get callbacks when this object's menuItemsChanged()
@@ -104,13 +101,13 @@ public:
@see removeListener
*/
void addListener (MenuBarModelListener* listenerToAdd) throw();
void addListener (Listener* listenerToAdd) throw();
/** Removes a listener.
@see addListener
*/
void removeListener (MenuBarModelListener* listenerToRemove) throw();
void removeListener (Listener* listenerToRemove) throw();
//==============================================================================
/** This method must return a list of the names of the menus. */
@@ -172,11 +169,14 @@ public:
private:
ApplicationCommandManager* manager;
ListenerList <MenuBarModelListener> listeners;
ListenerList <Listener> listeners;
MenuBarModel (const MenuBarModel&);
MenuBarModel& operator= (const MenuBarModel&);
};
/** This typedef is just for compatibility with old code - newer code should use the MenuBarModel::Listener class directly. */
typedef MenuBarModel::Listener MenuBarModelListener;
#endif // __JUCE_MENUBARMODEL_JUCEHEADER__

+ 1
- 1
src/gui/components/properties/juce_BooleanPropertyComponent.h View File

@@ -40,7 +40,7 @@
@see PropertyComponent
*/
class JUCE_API BooleanPropertyComponent : public PropertyComponent,
private ButtonListener
private Button::Listener
{
protected:
//==============================================================================


+ 1
- 1
src/gui/components/properties/juce_ButtonPropertyComponent.h View File

@@ -40,7 +40,7 @@
@see PropertyComponent
*/
class JUCE_API ButtonPropertyComponent : public PropertyComponent,
private ButtonListener
private Button::Listener
{
public:
//==============================================================================


+ 1
- 1
src/gui/components/properties/juce_ChoicePropertyComponent.h View File

@@ -50,7 +50,7 @@
@see PropertyComponent, PropertyPanel
*/
class JUCE_API ChoicePropertyComponent : public PropertyComponent,
private ComboBoxListener
private ComboBox::Listener
{
protected:
/** Creates the component.


+ 1
- 1
src/gui/components/properties/juce_SliderPropertyComponent.h View File

@@ -37,7 +37,7 @@
@see PropertyComponent, Slider
*/
class JUCE_API SliderPropertyComponent : public PropertyComponent,
private SliderListener
private Slider::Listener
{
protected:
//==============================================================================


+ 2
- 2
src/gui/components/special/juce_AudioDeviceSelectorComponent.cpp View File

@@ -207,9 +207,9 @@ private:
//==============================================================================
class AudioDeviceSettingsPanel : public Component,
public ComboBoxListener,
public ChangeListener,
public ButtonListener
public ComboBox::Listener,
public Button::Listener
{
public:
AudioDeviceSettingsPanel (AudioIODeviceType* type_,


+ 2
- 2
src/gui/components/special/juce_AudioDeviceSelectorComponent.h View File

@@ -40,8 +40,8 @@
@see AudioDeviceManager
*/
class JUCE_API AudioDeviceSelectorComponent : public Component,
public ComboBoxListener,
public ButtonListener,
public ComboBox::Listener,
public Button::Listener,
public ChangeListener
{
public:


+ 1
- 1
src/gui/components/special/juce_ColourSelector.h View File

@@ -41,7 +41,7 @@
*/
class JUCE_API ColourSelector : public Component,
public ChangeBroadcaster,
protected SliderListener
protected Slider::Listener
{
public:
//==============================================================================


+ 1
- 1
src/gui/components/special/juce_PreferencesPanel.h View File

@@ -49,7 +49,7 @@
for each of these pages.
*/
class JUCE_API PreferencesPanel : public Component,
private ButtonListener
private Button::Listener
{
public:
//==============================================================================


+ 1
- 1
src/gui/components/windows/juce_AlertWindow.h View File

@@ -46,7 +46,7 @@
@see ThreadWithProgressWindow
*/
class JUCE_API AlertWindow : public TopLevelWindow,
private ButtonListener
private Button::Listener
{
public:
//==============================================================================


+ 1
- 1
src/gui/components/windows/juce_DocumentWindow.cpp View File

@@ -34,7 +34,7 @@ BEGIN_JUCE_NAMESPACE
//==============================================================================
class DocumentWindow::ButtonListenerProxy : public ButtonListener
class DocumentWindow::ButtonListenerProxy : public Button::Listener
{
public:
ButtonListenerProxy (DocumentWindow& owner_)


+ 26
- 24
src/gui/graphics/imaging/juce_CameraDevice.h View File

@@ -28,31 +28,10 @@
#if JUCE_USE_CAMERA || DOXYGEN
//==============================================================================
/**
Receives callbacks with images from a CameraDevice.
@see CameraDevice::addListener
*/
class CameraImageListener
{
public:
CameraImageListener() {}
virtual ~CameraImageListener() {}
/** This method is called when a new image arrives.
This may be called by any thread, so be careful about thread-safety,
and make sure that you process the data as quickly as possible to
avoid glitching!
*/
virtual void imageReceived (const Image& image) = 0;
};
//==============================================================================
/**
Controls any camera capture devices that might be available.
Controls any video capture devices that might be available.
Use getAvailableDevices() to list the devices that are attached to the
system, then call openDevice to open one for use. Once you have a CameraDevice
@@ -128,16 +107,36 @@ public:
const Time getTimeOfFirstRecordedFrame() const;
//==============================================================================
/**
Receives callbacks with images from a CameraDevice.
@see CameraDevice::addListener
*/
class JUCE_API Listener
{
public:
Listener() {}
virtual ~Listener() {}
/** This method is called when a new image arrives.
This may be called by any thread, so be careful about thread-safety,
and make sure that you process the data as quickly as possible to
avoid glitching!
*/
virtual void imageReceived (const Image& image) = 0;
};
/** Adds a listener to receive images from the camera.
Be very careful not to delete the listener without first removing it by calling
removeListener().
*/
void addListener (CameraImageListener* listenerToAdd);
void addListener (Listener* listenerToAdd);
/** Removes a listener that was previously added with addListener().
*/
void removeListener (CameraImageListener* listenerToRemove);
void removeListener (Listener* listenerToRemove);
//==============================================================================
@@ -156,6 +155,9 @@ private:
CameraDevice& operator= (const CameraDevice&);
};
/** This typedef is just for compatibility with old code - newer code should use the CameraDevice::Listener class directly. */
typedef CameraDevice::Listener CameraImageListener;
#endif
#endif // __JUCE_CAMERADEVICE_JUCEHEADER__

+ 0
- 3
src/juce_app_includes.h View File

@@ -326,9 +326,6 @@
#ifndef __JUCE_SLIDER_JUCEHEADER__
#include "gui/components/controls/juce_Slider.h"
#endif
#ifndef __JUCE_SLIDERLISTENER_JUCEHEADER__
#include "gui/components/controls/juce_SliderListener.h"
#endif
#ifndef __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
#include "gui/components/controls/juce_TableHeaderComponent.h"
#endif


+ 6
- 6
src/native/mac/juce_mac_CameraDevice.mm View File

@@ -160,7 +160,7 @@ public:
}
}
void addListener (CameraImageListener* listenerToAdd)
void addListener (CameraDevice::Listener* listenerToAdd)
{
const ScopedLock sl (listenerLock);
@@ -170,7 +170,7 @@ public:
listeners.addIfNotAlreadyThere (listenerToAdd);
}
void removeListener (CameraImageListener* listenerToRemove)
void removeListener (CameraDevice::Listener* listenerToRemove)
{
const ScopedLock sl (listenerLock);
listeners.removeValue (listenerToRemove);
@@ -192,7 +192,7 @@ public:
for (int i = listeners.size(); --i >= 0;)
{
CameraImageListener* const l = listeners[i];
CameraDevice::Listener* const l = listeners[i];
if (l != 0)
l->imageReceived (image);
@@ -209,7 +209,7 @@ public:
QTCaptureCallbackDelegate* callbackDelegate;
String openingError;
Array<CameraImageListener*> listeners;
Array<CameraDevice::Listener*> listeners;
CriticalSection listenerLock;
};
@@ -385,13 +385,13 @@ void CameraDevice::stopRecording()
}
}
void CameraDevice::addListener (CameraImageListener* listenerToAdd)
void CameraDevice::addListener (Listener* listenerToAdd)
{
if (listenerToAdd != 0)
static_cast <QTCameraDeviceInteral*> (internal)->addListener (listenerToAdd);
}
void CameraDevice::removeListener (CameraImageListener* listenerToRemove)
void CameraDevice::removeListener (Listener* listenerToRemove)
{
if (listenerToRemove != 0)
static_cast <QTCameraDeviceInteral*> (internal)->removeListener (listenerToRemove);


+ 1
- 1
src/native/mac/juce_mac_MainMenu.mm View File

@@ -53,7 +53,7 @@ BEGIN_JUCE_NAMESPACE
//==============================================================================
class JuceMainMenuHandler : private MenuBarModelListener,
class JuceMainMenuHandler : private MenuBarModel::Listener,
private DeletedAtShutdown
{
public:


+ 6
- 6
src/native/windows/juce_win32_CameraDevice.cpp View File

@@ -338,7 +338,7 @@ public:
}
//==============================================================================
void addListener (CameraImageListener* listenerToAdd)
void addListener (CameraDevice::Listener* listenerToAdd)
{
const ScopedLock sl (listenerLock);
@@ -348,7 +348,7 @@ public:
listeners.addIfNotAlreadyThere (listenerToAdd);
}
void removeListener (CameraImageListener* listenerToRemove)
void removeListener (CameraDevice::Listener* listenerToRemove)
{
const ScopedLock sl (listenerLock);
listeners.removeValue (listenerToRemove);
@@ -363,7 +363,7 @@ public:
for (int i = listeners.size(); --i >= 0;)
{
CameraImageListener* const l = listeners[i];
CameraDevice::Listener* const l = listeners[i];
if (l != 0)
l->imageReceived (image);
@@ -647,7 +647,7 @@ private:
};
ComSmartPtr <GrabberCallback> callback;
Array <CameraImageListener*> listeners;
Array <CameraDevice::Listener*> listeners;
CriticalSection listenerLock;
//==============================================================================
@@ -706,7 +706,7 @@ void CameraDevice::stopRecording()
}
}
void CameraDevice::addListener (CameraImageListener* listenerToAdd)
void CameraDevice::addListener (Listener* listenerToAdd)
{
DShowCameraDeviceInteral* const d = (DShowCameraDeviceInteral*) internal;
@@ -714,7 +714,7 @@ void CameraDevice::addListener (CameraImageListener* listenerToAdd)
d->addListener (listenerToAdd);
}
void CameraDevice::removeListener (CameraImageListener* listenerToRemove)
void CameraDevice::removeListener (Listener* listenerToRemove)
{
DShowCameraDeviceInteral* const d = (DShowCameraDeviceInteral*) internal;


Loading…
Cancel
Save