eda, compiler, documentor: Proper prototypes for invoking virtual methods directly
[sdk] / samples / guiAndGfx / skinning / AcovelSkin.ec
index d5bef06..5918e86 100644 (file)
@@ -479,7 +479,7 @@ class AcovelSkin_FileDialog : FileDialog
    }
 }
 
-#define PUREVTBL(c)     ((int (**)())*(void **)((byte *)class(c).data + 4))
+#define PUREVTBL(c)     ((int (**)())*(void **)((byte *)class(c).data + sizeof(void *)))
 
 extern int __ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnApplyGraphics;
 extern int __ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnRedraw;
@@ -503,7 +503,7 @@ class AcovelSkin_Button : Button
    void OnRedraw(Surface surface)
    {
       int isDefault = (int)this.isDefault;
-      PUREVTBL(Button)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnRedraw](this, surface);
+      ((void (*)(Window, Surface))(void *)PUREVTBL(Button)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnRedraw])(this, surface);
       if(bevel || (bevelOver && (buttonState == down || buttonState == over || checked)))
       {
          Color c = steelBlue;
@@ -587,7 +587,7 @@ class AcovelSkin_ScrollBar : ScrollBar
 {
    void OnApplyGraphics()
    {
-      PUREVTBL(ScrollBar)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnApplyGraphics](this);
+      ((void (*)(Window))(void *)PUREVTBL(ScrollBar)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnApplyGraphics])(this);
 
       background = { skinBackground.r * 9 / 6, skinBackground.g * 9 / 6, skinBackground.b * 9 / 6 };
 
@@ -603,7 +603,7 @@ class AcovelSkin_DropBox : DropBox
 {
    void OnApplyGraphics()
    {
-      PUREVTBL(DropBox)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnApplyGraphics](this);
+      ((void (*)(Window))(void *)PUREVTBL(DropBox)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnApplyGraphics])(this);
       button.bitmap = { "<:ecere>elements/arrowDown.png", monochrome = true };
       background = skinBackground;
       foreground = skinForeground;
@@ -615,7 +615,7 @@ class AcovelSkin_ListBox : ListBox
 {
    void OnApplyGraphics()
    {
-      PUREVTBL(ListBox)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnApplyGraphics](this);
+      ((void (*)(Window))(void *)PUREVTBL(ListBox)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnApplyGraphics])(this);
       background = skinBackground;
       foreground = skinForeground;
       this.selectionColor = ::selectionColor;