From 4b5dec2cae49da0fcfc0d0fe12e0b605748a4ae2 Mon Sep 17 00:00:00 2001 From: Torsten Dreyer Date: Thu, 26 Feb 2015 18:14:09 +0100 Subject: [PATCH] HTML Property Browser: use radiobuttons for bools --- src/Network/http/PropertyUriHandler.cxx | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/Network/http/PropertyUriHandler.cxx b/src/Network/http/PropertyUriHandler.cxx index 01b28c0f2..74d4eaf2b 100644 --- a/src/Network/http/PropertyUriHandler.cxx +++ b/src/Network/http/PropertyUriHandler.cxx @@ -158,7 +158,26 @@ static DOMElement * renderPropertyValueElement( SGPropertyNode_ptr node ) DOMNode * root; - if( len < 60 ) { + if( node->getType() == simgear::props::BOOL ) { + root = new DOMNode( "span" ); + + root->addChild( new DOMNode("span"))->addChild( new DOMTextElement("true") ); + DOMNode * radio = root->addChild(new DOMNode( "input" )) + ->setAttribute( "type", "radio" ) + ->setAttribute( "name", node->getDisplayName() ) + ->setAttribute( "value", "true" ); + if( node->getBoolValue() ) + radio->setAttribute( "checked", "checked" ); + + root->addChild( new DOMNode("span"))->addChild( new DOMTextElement("false") ); + radio = root->addChild(new DOMNode( "input" )) + ->setAttribute( "type", "radio" ) + ->setAttribute( "name", node->getDisplayName() ) + ->setAttribute( "value", "false" ); + if( !node->getBoolValue() ) + radio->setAttribute( "checked", "checked" ); + + } else if( len < 60 ) { root = new DOMNode( "input" ); root->setAttribute( "type", "text" ); root->setAttribute( "name", node->getDisplayName() ); -- 2.39.5