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)
|
AirportList::AirportList (int x, int y, int width, int height)
|
||||||
: puList(x, y, width, height),
|
: puList(x, y, width, height),
|
||||||
|
GUI_ID(FGCLASS_AIRPORTLIST),
|
||||||
_airports(globals->get_airports()),
|
_airports(globals->get_airports()),
|
||||||
_content(0)
|
_content(0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,13 +8,20 @@
|
||||||
|
|
||||||
#include <plib/pu.h>
|
#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"
|
#include "puList.hxx"
|
||||||
|
|
||||||
SG_USING_STD(string);
|
SG_USING_STD(string);
|
||||||
|
|
||||||
class FGAirportList;
|
class FGAirportList;
|
||||||
|
|
||||||
class AirportList : public puList
|
class AirportList : public puList, public GUI_ID
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AirportList (int x, int y, int width, int height);
|
AirportList (int x, int y, int width, int height);
|
||||||
|
|
|
@ -384,7 +384,7 @@ FGDialog::updateValues (const char * objectName)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
puObject *obj = _propertyObjects[i]->object;
|
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);
|
fgList *pl = static_cast<fgList *>(obj);
|
||||||
pl->update();
|
pl->update();
|
||||||
} else
|
} else
|
||||||
|
|
|
@ -20,6 +20,9 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
SG_USING_STD(vector);
|
SG_USING_STD(vector);
|
||||||
|
|
||||||
|
#include "AirportList.hxx"
|
||||||
|
|
||||||
|
|
||||||
class FGDialog;
|
class FGDialog;
|
||||||
class FGBinding;
|
class FGBinding;
|
||||||
class NewGUI;
|
class NewGUI;
|
||||||
|
@ -199,12 +202,11 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class fgList : public fgValueList, public puList {
|
class fgList : public fgValueList, public puList, public GUI_ID {
|
||||||
public:
|
public:
|
||||||
fgList(int x1, int y1, int x2, int y2, SGPropertyNode *p, int sw) :
|
fgList(int x1, int y1, int x2, int y2, SGPropertyNode *p, int sw) :
|
||||||
fgValueList(p), puList(x1, y1, x2, y2, _list, sw) {}
|
fgValueList(p), puList(x1, y1, x2, y2, _list, sw), GUI_ID(FGCLASS_LIST) {}
|
||||||
virtual void update();
|
void update();
|
||||||
virtual const char *getTypeString() { return "fgList"; }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class fgComboBox : public fgValueList, public puaComboBox {
|
class fgComboBox : public fgValueList, public puaComboBox {
|
||||||
|
|
Loading…
Add table
Reference in a new issue