juce_PropertyComponent.cpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2013 - Raw Material Software Ltd.
  5. Permission is granted to use this software under the terms of either:
  6. a) the GPL v2 (or any later version)
  7. b) the Affero GPL v3
  8. Details of these licenses can be found at: www.gnu.org/licenses
  9. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  11. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  12. ------------------------------------------------------------------------------
  13. To release a closed-source product which uses JUCE, commercial licenses are
  14. available: visit www.juce.com for more information.
  15. ==============================================================================
  16. */
  17. PropertyComponent::PropertyComponent (const String& name, const int preferredHeight_)
  18. : Component (name), preferredHeight (preferredHeight_)
  19. {
  20. jassert (name.isNotEmpty());
  21. }
  22. PropertyComponent::~PropertyComponent() {}
  23. void PropertyComponent::paint (Graphics& g)
  24. {
  25. LookAndFeel& lf = getLookAndFeel();
  26. lf.drawPropertyComponentBackground (g, getWidth(), getHeight(), *this);
  27. lf.drawPropertyComponentLabel (g, getWidth(), getHeight(), *this);
  28. }
  29. void PropertyComponent::resized()
  30. {
  31. if (Component* const c = getChildComponent(0))
  32. c->setBounds (getLookAndFeel().getPropertyComponentContentPosition (*this));
  33. }
  34. void PropertyComponent::enablementChanged()
  35. {
  36. repaint();
  37. }