]> git.mxchange.org Git - flightgear.git/commitdiff
HTML Property Browser: use radiobuttons for bools
authorTorsten Dreyer <torsten@ŧ3r.de>
Thu, 26 Feb 2015 17:14:09 +0000 (18:14 +0100)
committerTorsten Dreyer <torsten@ŧ3r.de>
Thu, 26 Feb 2015 17:14:09 +0000 (18:14 +0100)
src/Network/http/PropertyUriHandler.cxx

index 01b28c0f2a6f7548bee8ee07c455a92d7f441e0e..74d4eaf2b4614d7b08b039b9420331808b239674 100644 (file)
@@ -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() );