コード例 #1
0
ファイル: PropertyUIs.cpp プロジェクト: simonlmn/actracktive
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
ファイル: PropertyUIs.cpp プロジェクト: simonlmn/actracktive
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;
}