Removed the typefn stuff from ui_*.h*.

This commit is contained in:
Pietro Gagliardi 2016-04-24 14:15:56 -04:00
parent 2870f3239d
commit 46391367fe
4 changed files with 16 additions and 48 deletions

View File

@ -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; \

View File

@ -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; \

View File

@ -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; \

View File

@ -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; \