1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-08 04:20:09 +00:00

Added Value support to Labels and ComboBoxes. Altered all the PropertyComponent classes so that as well as being used as abstract base classes, they can now also be instantiated directly as controllers for a Value. This allows property panels to be built to control a set of Value objects without writing any custom classes.

This commit is contained in:
Julian Storer 2010-01-15 15:39:39 +00:00
parent 55306275b1
commit e73a0fb874
17 changed files with 129392 additions and 181113 deletions

View file

@ -39,16 +39,42 @@ BooleanPropertyComponent::BooleanPropertyComponent (const String& name,
onText (buttonTextWhenTrue),
offText (buttonTextWhenFalse)
{
addAndMakeVisible (button = new ToggleButton (String::empty));
button->setClickingTogglesState (false);
createButton();
button->addButtonListener (this);
}
BooleanPropertyComponent::BooleanPropertyComponent (const Value& valueToControl,
const String& name,
const String& buttonText)
: PropertyComponent (name)
{
createButton();
button->setButtonText (buttonText);
button->getToggleStateValue().referTo (valueToControl);
button->setClickingTogglesState (true);
}
BooleanPropertyComponent::~BooleanPropertyComponent()
{
deleteAllChildren();
}
void BooleanPropertyComponent::createButton()
{
addAndMakeVisible (button = new ToggleButton (String::empty));
button->setClickingTogglesState (false);
}
void BooleanPropertyComponent::setState (const bool newState)
{
button->setToggleState (newState, true);
}
bool BooleanPropertyComponent::getState() const
{
return button->getToggleState();
}
void BooleanPropertyComponent::paint (Graphics& g)
{
PropertyComponent::paint (g);