From 257f17c858e6d7a9d482b6c7f87bcb4a2bef1af5 Mon Sep 17 00:00:00 2001 From: Jerome St-Louis Date: Wed, 8 Oct 2014 11:09:44 -0400 Subject: [PATCH] ecere/gui/controls/ToolTip: More null Virtual Methods fixes --- ecere/src/gui/controls/DropBox.ec | 28 +++++++++++++++++++++------- ecere/src/gui/controls/ToolTip.ec | 8 ++++---- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/ecere/src/gui/controls/DropBox.ec b/ecere/src/gui/controls/DropBox.ec index 9f56dbf..abed8ad 100644 --- a/ecere/src/gui/controls/DropBox.ec +++ b/ecere/src/gui/controls/DropBox.ec @@ -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) diff --git a/ecere/src/gui/controls/ToolTip.ec b/ecere/src/gui/controls/ToolTip.ec index 74a6f9f..4b9885e 100644 --- a/ecere/src/gui/controls/ToolTip.ec +++ b/ecere/src/gui/controls/ToolTip.ec @@ -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; } -- 1.8.3.1