예제 #1
0
static gluit::Component::Ptr createNumericPropertyUI(ValueProperty<T>& property)
{
	gluit::Component::Ptr panel = gluit::Component::create<gluit::Component>();
	panel->setLayout(boost::make_shared<gluit::VerticalLayout>());
	panel->setActive(property.isEnabled());

	buildNumericPropertyUI(panel, property);

	property.onSelfChange.connect(
		Property::Signal::slot_type(&setComponentActive, ComponentWeakPtr(panel), boost::ref(property)).track(panel));
	property.onSelfChange.connect(
		Property::Signal::slot_type(&buildNumericPropertyUI<T>, ComponentWeakPtr(panel), boost::ref(property)).track(panel));

	return panel;
}
예제 #2
0
gluit::Component::Ptr createPropertyUI<ValueProperty<bool> >(ValueProperty<bool>& property)
{
	gluit::Component::Ptr panel = gluit::Component::create<gluit::Component>();
	panel->setLayout(boost::make_shared<gluit::VerticalLayout>());
	panel->setActive(property.isEnabled());

	gluit::Checkbox::Ptr propertyValue = gluit::Component::create<gluit::Checkbox>();
	propertyValue->setText(property.getName());
	propertyValue->setChecked(property.getValue());
	panel->add(propertyValue);

	property.onValueChange.connect(
		PropertyEvent<bool>::Signal::slot_type(&setCheckboxChecked, CheckboxWeakPtr(propertyValue), _1).track(propertyValue));
	propertyValue->onCheckChange.connect(boost::bind(&setPropertyValue<bool>, boost::ref(property), _1));

	property.onSelfChange.connect(
		Property::Signal::slot_type(&setComponentActive, ComponentWeakPtr(panel), boost::ref(property)).track(panel));

	return panel;
}