}
char *
-AirportList::getStringValue ()
+AirportList::getListStringValue ()
{
- return (char *)_airports->getAirport(getIntegerValue())->_id.c_str();
+ return (char *)_airports->getAirport(getListIntegerValue())->_id.c_str();
}
// end of AirportList.cxx
virtual ~AirportList ();
// FIXME: add other string value functions
- virtual char * getStringValue ();
+ virtual char * getListStringValue ();
private:
FGAirportList * _airports;
node->setFloatValue(object->getFloatValue());
break;
default:
- node->setStringValue(object->getStringValue());
+ // Special case to handle lists, as getStringValue cannot be overridden
+ if(object->getType() & PUCLASS_LIST)
+ {
+ node->setStringValue(((puList *) object)->getListStringValue());
+ }
+ else
+ {
+ node->setStringValue(object->getStringValue());
+ }
break;
}
}
puTextBox->enableInput();
}
setupObject(puTextBox,props);
- return puTextBox;
+ return puTextBox;
} else if (type == "select") {
vector<SGPropertyNode_ptr> value_nodes;
SGPropertyNode * selection_node =
puList::puList (int x, int y, int w, int h)
: puGroup(x, y)
{
+ type |= PUCLASS_LIST;
init(w, h);
}
puList::puList (int x, int y, int w, int h, char ** contents)
: puGroup(x, y)
{
+ type |= PUCLASS_LIST;
init(w, h);
newList(contents);
}
}
char *
-puList::getStringValue ()
+puList::getListStringValue ()
{
return _contents[_list_box->getIntegerValue()];
}
+int
+puList::getListIntegerValue()
+{
+ return _list_box->getIntegerValue();
+}
+
void
puList::init (int w, int h)
{
#include <plib/pu.h>
+# define PUCLASS_LIST 0x80000000 // Hopefully this value will never be used by plib
+# define PUCLASS_LIST 0x80000000 // Hopefully this value will never be used by plib
/**
* A scrolling list for PUI.
virtual void newList (char ** contents);
// TODO: other string value funcs
- virtual char * getStringValue ();
+ virtual char * getListStringValue ();
+ virtual int getListIntegerValue();
protected:
virtual void init (int w, int h);