the last patch fixed the AirportList ... and broke all other PUCLASS_LIST.;
Unfortunately, there's no simple way to distinguish them. plib has no user defined widget classes, and getTypeString() -- which could be used for that -- isn't virtual. Sigh. I'll discuss the problem on the plib list. For now I can only offer an ugly workaround. (Don't look closely!)
This commit is contained in:
parent
24981fd043
commit
dfdb7f8107
4 changed files with 16 additions and 6 deletions
|
@ -7,6 +7,7 @@
|
|||
|
||||
AirportList::AirportList (int x, int y, int width, int height)
|
||||
: puList(x, y, width, height),
|
||||
GUI_ID(FGCLASS_AIRPORTLIST),
|
||||
_airports(globals->get_airports()),
|
||||
_content(0)
|
||||
{
|
||||
|
|
|
@ -8,13 +8,20 @@
|
|||
|
||||
#include <plib/pu.h>
|
||||
|
||||
|
||||
// ugly temproary workaround for plib's lack of user defined class ids FIXME
|
||||
#define FGCLASS_LIST 0x00000001
|
||||
#define FGCLASS_AIRPORTLIST 0x00000002
|
||||
class GUI_ID { public: GUI_ID(int id) : id(id) {} int id; };
|
||||
|
||||
|
||||
#include "puList.hxx"
|
||||
|
||||
SG_USING_STD(string);
|
||||
|
||||
class FGAirportList;
|
||||
|
||||
class AirportList : public puList
|
||||
class AirportList : public puList, public GUI_ID
|
||||
{
|
||||
public:
|
||||
AirportList (int x, int y, int width, int height);
|
||||
|
|
|
@ -384,7 +384,7 @@ FGDialog::updateValues (const char * objectName)
|
|||
continue;
|
||||
|
||||
puObject *obj = _propertyObjects[i]->object;
|
||||
if (!strcmp(obj->getTypeString(), "fgList")) {
|
||||
if ((obj->getType() & PUCLASS_LIST) && (dynamic_cast<GUI_ID *>(obj)->id & FGCLASS_LIST)) {
|
||||
fgList *pl = static_cast<fgList *>(obj);
|
||||
pl->update();
|
||||
} else
|
||||
|
|
|
@ -20,6 +20,9 @@
|
|||
#include <vector>
|
||||
SG_USING_STD(vector);
|
||||
|
||||
#include "AirportList.hxx"
|
||||
|
||||
|
||||
class FGDialog;
|
||||
class FGBinding;
|
||||
class NewGUI;
|
||||
|
@ -199,12 +202,11 @@ private:
|
|||
};
|
||||
|
||||
|
||||
class fgList : public fgValueList, public puList {
|
||||
class fgList : public fgValueList, public puList, public GUI_ID {
|
||||
public:
|
||||
fgList(int x1, int y1, int x2, int y2, SGPropertyNode *p, int sw) :
|
||||
fgValueList(p), puList(x1, y1, x2, y2, _list, sw) {}
|
||||
virtual void update();
|
||||
virtual const char *getTypeString() { return "fgList"; }
|
||||
fgValueList(p), puList(x1, y1, x2, y2, _list, sw), GUI_ID(FGCLASS_LIST) {}
|
||||
void update();
|
||||
};
|
||||
|
||||
class fgComboBox : public fgValueList, public puaComboBox {
|
||||
|
|
Loading…
Reference in a new issue