Set up all the control signatures and the framework for signature-based control types on OS X.

This commit is contained in:
Pietro Gagliardi 2016-04-24 15:46:29 -04:00
parent 24ac560f4b
commit b2c9577cb9
5 changed files with 33 additions and 9 deletions

View File

@ -8,4 +8,5 @@ CFILES += \
common/shouldquit.c
HFILES += \
common/controlsigs.h \
common/uipriv.h

19
common/controlsigs.h Normal file
View File

@ -0,0 +1,19 @@
// 24 april 2016
#define uiBoxSignature 0x426F784C
#define uiButtonSignature 0x42746F6E
#define uiCheckboxSignature 0x43686B62
#define uiComboboxSignature 0x436F6D62
#define uiDateTimePickerSignature 0x44545069
#define uiEntrySignature 0x456E7472
#define uiFontButtonSignature 0x466F6E42
#define uiGroupSignature 0x47727062
#define uiLabelSignature 0x4C61626C
#define uiMultilineEntrySignature 0x4D6C6E45
#define uiProgressbarSignature 0x50626172
#define uiRadioButtonsSignature 0x5264696F
#define uiSeparatorSignature 0x53657061
#define uiSliderSignature 0x536C6964
#define uiSpinboxSignature 0x5370696E
#define uiTabSignature 0x54616273
#define uiWindowSignature 0x57696E64

View File

@ -3,7 +3,9 @@
extern "C" {
#endif
// TODO stdlib.h needed?
#include <stdlib.h>
#include "controlsigs.h"
extern uiInitOptions options;

View File

@ -1,15 +1,6 @@
// 16 august 2015
#import "uipriv_darwin.h"
static uintmax_t type_uiDarwinControl = 0;
uintmax_t uiDarwinControlType(void)
{
if (type_uiDarwinControl == 0)
type_uiDarwinControl = uiRegisterType("uiDarwinControl", uiControlType(), sizeof (uiDarwinControl));
return type_uiDarwinControl;
}
void uiDarwinControlTriggerRelayout(uiDarwinControl *c)
{
uiControl *p;
@ -71,3 +62,10 @@ void uiDarwinSetControlFont(NSControl *c, NSControlSize size)
{
[c setFont:[NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:size]]];
}
#define uiDarwinControlSignature 0x44617277
uiDarwinControl *uiDarwinNewControl(size_t n, uint32_t typesig, const char *typename)
{
return uiDarwinControl(uiNewControl(n, uiDarwinControlSignature, typesig, typename));
}

View File

@ -44,6 +44,10 @@ _UI_EXTERN void uiDarwinControlTriggerRelayout(uiDarwinControl *);
#define uiDarwinDefineControl(type, handlefield) \
uiDarwinDefineControlWithOnDestroy(type, handlefield, (void) this;)
// TODO document
#define uiNewControl(type) uiDarwinNewControl(sizeof (type), type ## Signature, #type)
_UI_EXTERN uiDarwinControl *uiDarwinNewControl(size_t n, uint32_t typesig, const char *typename);
#define uiDarwinFinishNewControl(variable, type) \
uiControl(variable)->CommitDestroy = _ ## type ## CommitDestroy; \
uiControl(variable)->Handle = _ ## type ## Handle; \