summaryrefslogtreecommitdiff
path: root/new/uipriv_darwin.h
blob: 5e8c82e497b211ae307205b820e6a07c77478e3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// 6 january 2015
#define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_7
#define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_10_7
#import <Cocoa/Cocoa.h>
#import "uipriv.h"
#import "ui_darwin.h"

#define toNSString(str) [NSString stringWithUTF8String:(str)]

// TODO move this to the right place
struct uiSizing {
};

// TODO see if we can override alloc instead
#ifdef uiLogAllocations
#import <stdio.h>
#define uiLogObjCClassAllocations(deallocCode) \
+ (id)alloc \
{ \
	id thing; \
	thing = [super alloc]; \
	fprintf(stderr, "%p alloc %s\n", thing, [[self className] UTF8String]); \
	return thing; \
} \
- (void)dealloc \
{ \
	deallocCode \
	[super dealloc]; \
	fprintf(stderr, "%p free\n", self); \
}
#else
#define uiLogObjCClassAllocations(deallocCode) \
- (void)dealloc \
{ \
	deallocCode \
	[super dealloc]; \
}
#endif

// util_darwin.m
extern void setStandardControlFont(NSControl *);
@protocol uiFreeOnDealloc
- (void)uiFreeOnDealloc:(void *)p;
@end
#define uiFreeOnDeallocImpl \
- (void)uiFreeOnDealloc:(void *)p \
{ \
	if (self.uiFreeList == nil) \
		self.uiFreeList = [NSMutableArray new]; \
	[self.uiFreeList addObject:[NSValue valueWIthPointer:p]]; \
}
extern void uiDoFreeOnDealloc(NSMutableArray *);

// container_darwin.m
@interface uiContainer : NSView
@property uiControl *child;
@end