SPAOP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ZoomPort.h
Go to the documentation of this file.
1 /*
2  * Copyright 2014 Martin Hansen
3  *
4  * This file is part of SPAOP (Spatial Audio Object Positioner).
5  *
6  * SPAOP is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * SPAOP is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with SPAOP. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef ZOOMPORT_H_INCLUDED
21 #define ZOOMPORT_H_INCLUDED
22 
23 #include <mutex>
24 #include "JuceHeader.h"
26 
27 namespace wonderjuce
28 {
29 
30 //==============================================================================
39 class ZoomPort : public Viewport
40 {
41 public:
43  ZoomPort(const String& componentName = String::empty);
44 
46  virtual ~ZoomPort();
47 
55  bool setWrappedComponent(ComponentWithFocusPoint* wrappedComponent);
56 
57  void paint (Graphics&);
58  void resized();
59 
67  void setZoomFactor(float zoomFactor);
68 
75  float getZoomFactor();
76 
77 private:
78  void setWrappedComponentsSize();
79 
80  ComponentWithFocusPoint* wrappedComponent_;
81  float zoom_; // zoom-factor
82  std::mutex setMutex_; // a mutex that guards setWrappedComponent
83 
84 
85  JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ZoomPort)
86 };
87 
88 }
89 
90 
91 #endif // ZOOMPORT_H_INCLUDED
An abstract class extending juce::Component, adding methods to query a "focus point".
Definition: ComponentWithFocusPoint.h:32
virtual ~ZoomPort()
Destructor.
Definition: ZoomPort.cpp:31
void paint(Graphics &)
Definition: ZoomPort.cpp:48
void setZoomFactor(float zoomFactor)
Sets the zoom-factor.
Definition: ZoomPort.cpp:58
void resized()
Definition: ZoomPort.cpp:53
float getZoomFactor()
Returns the current zoom-factor.
Definition: ZoomPort.cpp:75
A GUI component that wraps another ComponentWithFocusPoint, adding the ability to zoom in and out and...
Definition: ZoomPort.h:39
bool setWrappedComponent(ComponentWithFocusPoint *wrappedComponent)
Sets the component that is wrapped by this ZoomPort.
Definition: ZoomPort.cpp:35
ZoomPort(const String &componentName=String::empty)
Constructor.
Definition: ZoomPort.cpp:24