]> git.mxchange.org Git - flightgear.git/commitdiff
the last patch fixed the AirportList ... and broke all other PUCLASS_LIST.;
authormfranz <mfranz>
Sun, 21 May 2006 22:14:18 +0000 (22:14 +0000)
committermfranz <mfranz>
Sun, 21 May 2006 22:14:18 +0000 (22:14 +0000)
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
src/GUI/AirportList.hxx
src/GUI/dialog.cxx
src/GUI/dialog.hxx

index 636232feeda3eaa662321456877b08578359204a..89f22ead57596a8b46c6ec1e45b6837abae1b62c 100644 (file)
@@ -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)
 {
index acac58badaf6e14a036b1bbdc501cd2cbefe04ac..f4340d19c8aefccd39e674314628afbd4d557cbc 100644 (file)
@@ -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);
index d99e2d8434ec82ff0451af47feeef969d0942593..4dcb8af457c61af8775232cb8bb6840af33327da 100644 (file)
@@ -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
index 2a3195cb170183e777c84903a59e73786096f0af..802dea963f299d54c5d4dd19398f0054ef668a81 100644 (file)
@@ -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 {