diff --git a/ui_darwin.h b/ui_darwin.h index ffd7c9c9..e70cd94a 100644 --- a/ui_darwin.h +++ b/ui_darwin.h @@ -16,20 +16,12 @@ struct uiDarwinControl { uiControl c; void (*Relayout)(uiDarwinControl *); }; -_UI_EXTERN uintmax_t uiDarwinControlType(void); -#define uiDarwinControl(this) ((uiDarwinControl *) uiIsA((this), uiDarwinControlType(), 1)) +#define uiDarwinControl(this) ((uiDarwinControl *) (this)) // TODO document _UI_EXTERN void uiDarwinControlTriggerRelayout(uiDarwinControl *); // TODO document -#define uiDarwinDefineControlWithOnDestroy(type, typefn, handlefield, onDestroy) \ - static uintmax_t _ ## type ## Type = 0; \ - uintmax_t typefn(void) \ - { \ - if (_ ## type ## Type == 0) \ - _ ## type ## Type = uiRegisterType(#type, uiDarwinControlType(), sizeof (type)); \ - return _ ## type ## Type; \ - } \ +#define uiDarwinDefineControlWithOnDestroy(type, handlefield, onDestroy) \ static void _ ## type ## CommitDestroy(uiControl *c) \ { \ type *this = type(c); \ @@ -49,8 +41,8 @@ _UI_EXTERN void uiDarwinControlTriggerRelayout(uiDarwinControl *); /* do nothing */ \ } -#define uiDarwinDefineControl(type, typefn, handlefield) \ - uiDarwinDefineControlWithOnDestroy(type, typefn, handlefield, (void) this;) +#define uiDarwinDefineControl(type, handlefield) \ + uiDarwinDefineControlWithOnDestroy(type, handlefield, (void) this;) #define uiDarwinFinishNewControl(variable, type) \ uiControl(variable)->CommitDestroy = _ ## type ## CommitDestroy; \ diff --git a/ui_haiku.hpp b/ui_haiku.hpp index 246d377d..bd2ae9c5 100644 --- a/ui_haiku.hpp +++ b/ui_haiku.hpp @@ -17,18 +17,10 @@ typedef struct uiHaikuControl uiHaikuControl; struct uiHaikuControl { uiControl c; }; -_UI_EXTERN uintmax_t uiHaikuControlType(void); -#define uiHaikuControl(this) ((uiHaikuControl *) uiIsA((this), uiHaikuControlType(), 1)) +#define uiHaikuControl(this) ((uiHaikuControl *) (this)) // TODO document -#define uiHaikuDefineControlWithOnDestroy(type, typefn, handlefield, onDestroy) \ - static uintmax_t _ ## type ## Type = 0; \ - uintmax_t typefn(void) \ - { \ - if (_ ## type ## Type == 0) \ - _ ## type ## Type = uiRegisterType(#type, uiHaikuControlType(), sizeof (type)); \ - return _ ## type ## Type; \ - } \ +#define uiHaikuDefineControlWithOnDestroy(type, handlefield, onDestroy) \ static void _ ## type ## CommitDestroy(uiControl *c) \ { \ type *hthis = type(c); \ @@ -44,8 +36,8 @@ _UI_EXTERN uintmax_t uiHaikuControlType(void); /* do nothing */ \ } -#define uiHaikuDefineControl(type, typefn, handlefield) \ - uiHaikuDefineControlWithOnDestroy(type, typefn, handlefield, (void) hthis;) +#define uiHaikuDefineControl(type, handlefield) \ + uiHaikuDefineControlWithOnDestroy(type, handlefield, (void) hthis;) #define uiHaikuFinishNewControl(variable, type) \ uiControl(variable)->CommitDestroy = _ ## type ## CommitDestroy; \ diff --git a/ui_unix.h b/ui_unix.h index f41a1301..75b14ac8 100644 --- a/ui_unix.h +++ b/ui_unix.h @@ -15,18 +15,10 @@ typedef struct uiUnixControl uiUnixControl; struct uiUnixControl { uiControl c; }; -_UI_EXTERN uintmax_t uiUnixControlType(void); -#define uiUnixControl(this) ((uiUnixControl *) uiIsA((this), uiUnixControlType(), 1)) +#define uiUnixControl(this) ((uiUnixControl *) (this)) // TODO document -#define uiUnixDefineControlWithOnDestroy(type, typefn, onDestroy) \ - static uintmax_t _ ## type ## Type = 0; \ - uintmax_t typefn(void) \ - { \ - if (_ ## type ## Type == 0) \ - _ ## type ## Type = uiRegisterType(#type, uiUnixControlType(), sizeof (type)); \ - return _ ## type ## Type; \ - } \ +#define uiUnixDefineControlWithOnDestroy(type, onDestroy) \ static void _ ## type ## CommitDestroy(uiControl *c) \ { \ type *this = type(c); \ @@ -42,8 +34,8 @@ _UI_EXTERN uintmax_t uiUnixControlType(void); /* do nothing */ \ } -#define uiUnixDefineControl(type, typefn) \ - uiUnixDefineControlWithOnDestroy(type, typefn, (void) this;) +#define uiUnixDefineControl(type) \ + uiUnixDefineControlWithOnDestroy(type, (void) this;) #define uiUnixFinishNewControl(variable, type) \ uiControl(variable)->CommitDestroy = _ ## type ## CommitDestroy; \ diff --git a/ui_windows.h b/ui_windows.h index 2fe6aad0..099b7f84 100644 --- a/ui_windows.h +++ b/ui_windows.h @@ -22,20 +22,12 @@ struct uiWindowsControl { void (*AssignControlIDZOrder)(uiWindowsControl *, LONG_PTR *, HWND *); void (*ArrangeChildrenControlIDsZOrder)(uiWindowsControl *); }; -_UI_EXTERN uintmax_t uiWindowsControlType(void); -#define uiWindowsControl(this) ((uiWindowsControl *) uiIsA((this), uiWindowsControlType(), 1)) +#define uiWindowsControl(this) ((uiWindowsControl *) (this)) // TODO document _UI_EXTERN void uiWindowsControlQueueRelayout(uiWindowsControl *); // TODO document -#define uiWindowsDefineControlWithOnDestroy(type, typefn, onDestroy) \ - static uintmax_t _ ## type ## Type = 0; \ - uintmax_t typefn(void) \ - { \ - if (_ ## type ## Type == 0) \ - _ ## type ## Type = uiRegisterType(#type, uiWindowsControlType(), sizeof (type)); \ - return _ ## type ## Type; \ - } \ +#define uiWindowsDefineControlWithOnDestroy(type, onDestroy) \ static void _ ## type ## CommitDestroy(uiControl *c) \ { \ type *me = type(c); \ @@ -70,8 +62,8 @@ _UI_EXTERN void uiWindowsControlQueueRelayout(uiWindowsControl *); /* do nothing */ \ } -#define uiWindowsDefineControl(type, typefn) \ - uiWindowsDefineControlWithOnDestroy(type, typefn, (void) me;) +#define uiWindowsDefineControl(type) \ + uiWindowsDefineControlWithOnDestroy(type, (void) me;) #define uiWindowsFinishNewControl(variable, type) \ uiControl(variable)->CommitDestroy = _ ## type ## CommitDestroy; \