SPAOP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Public Member Functions | List of all members
wonderjuce::SourcePanel Class Reference

A GUI component that displays a two-dimensional view of a source's position and allows the re-positioning by mouse actions. More...

#include <SourcePanel.h>

Inheritance diagram for wonderjuce::SourcePanel:
Inheritance graph
[legend]
Collaboration diagram for wonderjuce::SourcePanel:
Collaboration graph
[legend]

Classes

class  Listener
 A class for receiving callbacks from a SourcePanel. More...
 

Public Member Functions

 SourcePanel (const String &componentName=String::empty)
 
virtual ~SourcePanel ()
 Destructor. More...
 
void paint (Graphics &g)
 
void mouseDown (const MouseEvent &event) override
 
void mouseDrag (const MouseEvent &event) override
 
void mouseUp (const MouseEvent &event) override
 
float getXPos ()
 Returns the x coordinate of the source controlled by this SourcePanel, normalized within [0.0 ; 1.0]. More...
 
float getYPos ()
 Returns the y coordinate of the source controlled by this SourcePanel, normalized within [0.0 ; 1.0]. More...
 
void addListener (Listener *listener)
 Adds a listener to be called when this panel's values change. More...
 
void removeListener (Listener *listener)
 Removes a previously-registered listener. More...
 
bool setSources (std::shared_ptr< const wonder::SourceCollection > sources)
 Sets the SourceCollection object that holds the information about the sources to be displayed. More...
 
bool setSource (int sourceID)
 Sets the ID of the source to be shown as the main source that can be controlled using this SourcePanel. More...
 
void setShowOtherSources (bool showOthers)
 Sets whether the other sources (not controlled by this panel) shall be shown. More...
 
bool showsOtherSources () const
 Returns the current showOtherSources setting. More...
 
float getFocusPointX ()
 Returns the x-coordinate of the "focus point". More...
 
float getFocusPointY ()
 Returns the y-coordinate of the "focus point". More...
 
Point< float > getFocusPoint ()
 Returns the "focus point", the point where this component shall be auto-centered (for example, when it is zoomed into). More...
 
- Public Member Functions inherited from wonderjuce::SourceDisplay
 SourceDisplay (const String &componentName=String::empty, int dotSize=10, int roomLineThickness=2, const Colour roomColour=Colours::yellow, const Colour bgColour=Colours::black)
 Constructor. More...
 
virtual ~SourceDisplay ()
 Destructor. More...
 
void paint (Graphics &g)
 Overriding juce::Component::paint, this will fill the display with its background colour and draw the speaker arrays. More...
 
void setPositionDotSize (int diameter)
 Sets the size of the dot indicating the source's position. More...
 
int getPositionDotSize () const
 Returns the size of the dot indicating the source's position (diameter in pixels). More...
 
bool setRoom (std::shared_ptr< const wonder::Room > room)
 Sets the wonder::Room object that is used for painting the positions of the speaker arrays. More...
 
void setShowNames (bool showNames)
 Sets whether the names of the sources shall be shown next to them. More...
 
bool showsNames () const
 Returns the current showNames setting. More...
 
- Public Member Functions inherited from wonderjuce::ComponentWithFocusPoint
 ComponentWithFocusPoint (const String &componentName=String::empty)
 Constructor. More...
 
virtual ~ComponentWithFocusPoint ()
 Destructor. More...
 

Additional Inherited Members

- Protected Member Functions inherited from wonderjuce::SourceDisplay
void paintSource (Graphics &g, const wonder::Source &source, uint8_t alpha=0xFF)
 Paints a wonder::Source. More...
 

Detailed Description

A GUI component that displays a two-dimensional view of a source's position and allows the re-positioning by mouse actions.

Constructor & Destructor Documentation

wonderjuce::SourcePanel::SourcePanel ( const String &  componentName = String::empty)
wonderjuce::SourcePanel::~SourcePanel ( )
virtual

Destructor.

Member Function Documentation

void wonderjuce::SourcePanel::addListener ( SourcePanel::Listener listener)

Adds a listener to be called when this panel's values change.

Point< float > wonderjuce::SourcePanel::getFocusPoint ( )
virtual

Returns the "focus point", the point where this component shall be auto-centered (for example, when it is zoomed into).

Returns
The "focus point", the point where this component shall be auto-centered (for example, when it is zoomed into). It contains relative coordinates within [0.0 ; 1.0].

Implements wonderjuce::ComponentWithFocusPoint.

float wonderjuce::SourcePanel::getFocusPointX ( )
virtual

Returns the x-coordinate of the "focus point".

Returns
The x-coordinate of the "focus point" as relative coordinate within [0.0 ; 1.0].

Implements wonderjuce::ComponentWithFocusPoint.

float wonderjuce::SourcePanel::getFocusPointY ( )
virtual

Returns the y-coordinate of the "focus point".

Returns
The y-coordinate of the "focus point" as relative coordinate within [0.0 ; 1.0].

Implements wonderjuce::ComponentWithFocusPoint.

float wonderjuce::SourcePanel::getXPos ( )

Returns the x coordinate of the source controlled by this SourcePanel, normalized within [0.0 ; 1.0].

Returns
The x coordinate of the source controlled by this SourcePanel, normalized within [0.0 ; 1.0].
float wonderjuce::SourcePanel::getYPos ( )

Returns the y coordinate of the source controlled by this SourcePanel, normalized within [0.0 ; 1.0].

Returns
The y coordinate of the source controlled by this SourcePanel, normalized within [0.0 ; 1.0].
void wonderjuce::SourcePanel::mouseDown ( const MouseEvent &  event)
override
See Also
juce::Component.
void wonderjuce::SourcePanel::mouseDrag ( const MouseEvent &  event)
override
See Also
juce::Component.
void wonderjuce::SourcePanel::mouseUp ( const MouseEvent &  event)
override
See Also
juce::Component.
void wonderjuce::SourcePanel::paint ( Graphics &  g)
See Also
juce::Component.
void wonderjuce::SourcePanel::removeListener ( SourcePanel::Listener listener)

Removes a previously-registered listener.

void wonderjuce::SourcePanel::setShowOtherSources ( bool  showOthers)

Sets whether the other sources (not controlled by this panel) shall be shown.

Parameters
showOtherstrue if the other sources (not controlled by this panel) shall be shown.
bool wonderjuce::SourcePanel::setSource ( int  sourceID)

Sets the ID of the source to be shown as the main source that can be controlled using this SourcePanel.

Parameters
sourceIDThe ID of the source to be shown as the main source.
Returns
true on success, false on failure (= if the sourceID was out of range).
bool wonderjuce::SourcePanel::setSources ( std::shared_ptr< const wonder::SourceCollection sources)

Sets the SourceCollection object that holds the information about the sources to be displayed.

This may only be set once.

Parameters
sourcesA (reference-counted) std::shared_ptr pointing to the SourceCollection object.
Returns
true on success, false otherwise.
bool wonderjuce::SourcePanel::showsOtherSources ( ) const

Returns the current showOtherSources setting.

If this is true, the other sources (not controlled by this panel) are shown.

Returns
The current showOtherSources setting. If this is true, the other sources (not controlled by this panel) are shown.