You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
3.2KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCETICE project - Copyright 2009 by Lucio Asnaghi.
  4. JUCETICE is based around the JUCE library - "Jules' Utility Class Extensions"
  5. Copyright 2007 by Julian Storer.
  6. ------------------------------------------------------------------------------
  7. JUCE and JUCETICE can be redistributed and/or modified under the terms of
  8. the GNU General Public License, as published by the Free Software Foundation;
  9. either version 2 of the License, or (at your option) any later version.
  10. JUCE and JUCETICE are distributed in the hope that they will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with JUCE and JUCETICE; if not, visit www.gnu.org/licenses or write to
  16. Free Software Foundation, Inc., 59 Temple Place, Suite 330,
  17. Boston, MA 02111-1307 USA
  18. ==============================================================================
  19. */
  20. BEGIN_JUCE_NAMESPACE
  21. //==============================================================================
  22. void ViewportListener::viewedComponentChanged (JuceticeViewport* const viewportThatChanged,
  23. Component* const newViewedComponent)
  24. {
  25. }
  26. void ViewportListener::visibleAreaChanged (JuceticeViewport* const viewportThatChanged,
  27. int visibleX, int visibleY,
  28. int visibleW, int visibleH)
  29. {
  30. }
  31. //==============================================================================
  32. JuceticeViewport::JuceticeViewport (const String& componentName)
  33. : Viewport (componentName)
  34. {
  35. }
  36. JuceticeViewport::~JuceticeViewport()
  37. {
  38. }
  39. void JuceticeViewport::visibleAreaChanged (const Rectangle<int>& newVisibleArea)
  40. {
  41. for (int i = viewportListeners.size(); --i >= 0;)
  42. {
  43. ((ViewportListener*) viewportListeners.getUnchecked (i))
  44. ->visibleAreaChanged (this, newVisibleArea.getX(), newVisibleArea.getY(),
  45. newVisibleArea.getWidth(), newVisibleArea.getHeight());
  46. }
  47. }
  48. void JuceticeViewport::viewedComponentChanged (Component* newComponent)
  49. {
  50. for (int i = viewportListeners.size(); --i >= 0;)
  51. {
  52. ((ViewportListener*) viewportListeners.getUnchecked (i))
  53. ->viewedComponentChanged (this, newComponent);
  54. }
  55. }
  56. //==============================================================================
  57. void JuceticeViewport::addListener (ViewportListener* const newListener) throw()
  58. {
  59. viewportListeners.addIfNotAlreadyThere (newListener);
  60. }
  61. void JuceticeViewport::removeListener (ViewportListener* const listenerToRemove) throw()
  62. {
  63. int index = viewportListeners.indexOf (listenerToRemove);
  64. if (index >= 0)
  65. viewportListeners.remove (index);
  66. }
  67. void JuceticeViewport::notifyComponentChanged ()
  68. {
  69. for (int i = viewportListeners.size(); --i >= 0;)
  70. {
  71. ((ViewportListener*) viewportListeners.getUnchecked (i))
  72. ->viewedComponentChanged (this, getViewedComponent ());
  73. }
  74. }
  75. END_JUCE_NAMESPACE