From dfdb7f8107f2e093c892fb8498c6c22ae7a19a51 Mon Sep 17 00:00:00 2001 From: mfranz Date: Sun, 21 May 2006 22:14:18 +0000 Subject: [PATCH] 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!) --- src/GUI/AirportList.cxx | 1 + src/GUI/AirportList.hxx | 9 ++++++++- src/GUI/dialog.cxx | 2 +- src/GUI/dialog.hxx | 10 ++++++---- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/GUI/AirportList.cxx b/src/GUI/AirportList.cxx index 636232fee..89f22ead5 100644 --- a/src/GUI/AirportList.cxx +++ b/src/GUI/AirportList.cxx @@ -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) { diff --git a/src/GUI/AirportList.hxx b/src/GUI/AirportList.hxx index acac58bad..f4340d19c 100644 --- a/src/GUI/AirportList.hxx +++ b/src/GUI/AirportList.hxx @@ -8,13 +8,20 @@ #include + +// 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); diff --git a/src/GUI/dialog.cxx b/src/GUI/dialog.cxx index d99e2d843..4dcb8af45 100644 --- a/src/GUI/dialog.cxx +++ b/src/GUI/dialog.cxx @@ -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(obj)->id & FGCLASS_LIST)) { fgList *pl = static_cast(obj); pl->update(); } else diff --git a/src/GUI/dialog.hxx b/src/GUI/dialog.hxx index 2a3195cb1..802dea963 100644 --- a/src/GUI/dialog.hxx +++ b/src/GUI/dialog.hxx @@ -20,6 +20,9 @@ #include 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 { -- 2.39.5