ecere/gui/controls/ToolTip: More null Virtual Methods fixes
authorJerome St-Louis <jerome@ecere.com>
Wed, 8 Oct 2014 15:09:44 +0000 (11:09 -0400)
committerJerome St-Louis <jerome@ecere.com>
Thu, 15 Oct 2015 00:19:20 +0000 (20:19 -0400)
ecere/src/gui/controls/DropBox.ec
ecere/src/gui/controls/ToolTip.ec

index 9f56dbf..abed8ad 100644 (file)
@@ -102,7 +102,10 @@ public:
             {
                char tempString[4096];
                if(currentRow)
-                  editBox.contents = ((const char *(*)(void *, void *, char *, void *, bool *))(void *)dataType._vTbl[__ecereVMethodID_class_OnGetString])(dataType, currentRow.GetData(null), tempString, null, null);
+               {
+                  const char *(* onGetString)(void *, void *, char *, void *, bool *) = (void *)dataType._vTbl[__ecereVMethodID_class_OnGetString];
+                  editBox.contents = onGetString(dataType, currentRow.GetData(null), tempString, null, null);
+               }
                else
                   editBox.contents = "";
             }
@@ -402,7 +405,10 @@ public:
          {
             char tempString[4096];
             if(currentRow)
-               editBox.contents = ((const char *(*)(void *, void *, char *, void *, bool *))(void *)dataType._vTbl[__ecereVMethodID_class_OnGetString])(dataType, currentRow.GetData(null), tempString, null, null);
+            {
+               const char *(* onGetString)(void *, void *, char *, void *, bool *) = (void *)dataType._vTbl[__ecereVMethodID_class_OnGetString];
+               editBox.contents = onGetString(dataType, currentRow.GetData(null), tempString, null, null);
+            }
             else
                editBox.contents = "";
          }
@@ -578,7 +584,10 @@ private:
                {
                   char tempString[4096];
                   if(currentRow)
-                     editBox.contents = ((const char *(*)(void *, void *, char *, void *, bool *))(void *)dataType._vTbl[__ecereVMethodID_class_OnGetString])(dataType, currentRow.GetData(null), tempString, null, null);
+                  {
+                     const char *(* onGetString)(void *, void *, char *, void *, bool *) = (void *)dataType._vTbl[__ecereVMethodID_class_OnGetString];
+                     editBox.contents = onGetString(dataType, currentRow.GetData(null), tempString, null, null);
+                  }
                   else
                      editBox.contents = "";
                }
@@ -639,9 +648,11 @@ private:
          if(currentRow)
          {
             DataDisplayFlags displayFlags { active = active, current = true, dropBox = true, selected = true, fullRow = true };
-            ((void (*)(void *, void *, void *, int, int, int, void *, uint, uint))(void *)dataType._vTbl[__ecereVMethodID_class_OnDisplay])(dataType, currentRow.GetData(null), surface, 3,
-               1+(clientSize.h - listBox.rowHeight) / 2, clientSize.w - (button.visible ? button.size.w : 0) - 3,
-               field.userData, alignment, displayFlags);
+            void (* onDisplay)(void *, void *, void *, int, int, int, void *, uint, uint) = (void *)dataType._vTbl[__ecereVMethodID_class_OnDisplay];
+            if(onDisplay)
+               onDisplay(dataType, currentRow.GetData(null), surface, 3,
+                  1+(clientSize.h - listBox.rowHeight) / 2, clientSize.w - (button.visible ? button.size.w : 0) - 3,
+                  field.userData, alignment, displayFlags);
          }
          else
             surface.WriteText(2,2, "(none)", 6);
@@ -875,7 +886,10 @@ private:
          {
             char tempString[4096];
             if(currentRow)
-               editBox.contents = ((const char *(*)(void *, void *, char *, void *, bool *))(void *)dataType._vTbl[__ecereVMethodID_class_OnGetString])(dataType, currentRow.GetData(null), tempString, null, null);
+            {
+               const char *(* onGetString)(void *, void *, char *, void *, bool *) = (void *)dataType._vTbl[__ecereVMethodID_class_OnGetString];
+               editBox.contents = onGetString(dataType, currentRow.GetData(null), tempString, null, null);
+            }
             else
                editBox.contents = "";
             if(active)
index 74a6f9f..4b9885e 100644 (file)
@@ -186,7 +186,7 @@ public class ToolTip : Window
          toolTip.closeTimer.Stop();
          if(!mods.isSideEffect && !toolTip.created && rootWindow.active)
             toolTip.timer.Start();
-         return toolTip.OrigOnMouseOver(this, x, y, mods);
+         return toolTip.OrigOnMouseOver ? toolTip.OrigOnMouseOver(this, x, y, mods) : true;
       }
       return true;
    }
@@ -198,7 +198,7 @@ public class ToolTip : Window
       {
          toolTip.timer.Stop();
          toolTip.closeTimer.Start();
-         return toolTip.OrigOnMouseLeave(this, mods);
+         return toolTip.OrigOnMouseLeave ? toolTip.OrigOnMouseLeave(this, mods) : true;
       }
       return true;
    }
@@ -210,7 +210,7 @@ public class ToolTip : Window
       {
          toolTip.timer.Stop();
          toolTip.Destroy(0);
-         return toolTip.OrigOnLeftButtonDown(this, x, y, mods);
+         return toolTip.OrigOnLeftButtonDown ? toolTip.OrigOnLeftButtonDown(this, x, y, mods) : true;
       }
       return true;
    }
@@ -227,7 +227,7 @@ public class ToolTip : Window
             toolTip.timer.Stop();
             toolTip.timer.Start();
          }
-         return toolTip.OrigOnMouseMove(this, x, y, mods);
+         return toolTip.OrigOnMouseMove ? toolTip.OrigOnMouseMove(this, x, y, mods) : true;
       }
       return true;
    }