]> git.saurik.com Git - wxWidgets.git/blob - src/mac/ldef/extldef.h
Changed the pragmas to allow debugging under Linux
[wxWidgets.git] / src / mac / ldef / extldef.h
1 #pragma once
2
3 #if defined(__UNIX__)
4 #include <Carbon/Carbon.h>
5 #else
6 #include <Lists.h>
7 #endif
8 #include <stdlib.h>
9
10 #define kExtLDEFID 128 // resource id of our LDEF resource
11
12 typedef void (*ExtLDEFDrawProcType)(Rect *r, Cell cell, ListHandle lh, long refcon);
13
14 enum {
15 uppExtLDEFDrawProcInfo = kCStackBased
16 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(Rect *)))
17 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Cell)))
18 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(ListHandle)))
19 | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(long)))
20 };
21
22 #if USESROUTINEDESCRIPTORS
23 typedef UniversalProcPtr ExtLDEFDrawProcUPP;
24
25 #define CallExtLDEFDrawProc(userRoutine, r, cell, lh , refcon ) \
26 CallUniversalProc((UniversalProcPtr)(userRoutine), uppExtLDEFDrawProcInfo, r, cell, lh , refcon )
27 #define NewExtLDEFDrawProc(userRoutine) \
28 (ExtLDEFDrawProcUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppExtLDEFDrawProcInfo, GetCurrentISA())
29
30 #else
31 typedef ExtLDEFDrawProcType ExtLDEFDrawProcUPP;
32
33 #define CallExtLDEFDrawProc(userRoutine, r, cell, lh , refcon) \
34 (*(userRoutine))(r, cell, lh, refcon)
35 #define NewExtLDEFDrawProc(userRoutine) \
36 (ExtLDEFDrawProcUPP)(userRoutine)
37 #endif
38
39 typedef struct
40 {
41 long refCon ;
42 ExtLDEFDrawProcUPP drawProc ;
43 } ExtLDEFInfo ;
44
45 static void NewExtLDEFInfo( ListHandle lh , ExtLDEFDrawProcType drawproc , long refcon ) ;
46 static void NewExtLDEFInfo( ListHandle lh , ExtLDEFDrawProcType drawproc , long refcon )
47 {
48 ExtLDEFInfo* info = (ExtLDEFInfo* ) malloc( sizeof( ExtLDEFInfo ) ) ;
49 info->drawProc = NewExtLDEFDrawProc( drawproc ) ;
50 info->refCon = refcon ;
51 (**lh).refCon = (long) info ;
52 }
53
54 static void DisposeExtLDEFInfo( ListHandle lh) ;
55 static void DisposeExtLDEFInfo( ListHandle lh)
56 {
57 ExtLDEFInfo* info = (ExtLDEFInfo* ) (**lh).refCon ;
58 if ( info )
59 {
60 #if !TARGET_CARBON
61 DisposeRoutineDescriptor( (RoutineDescriptor*) info->drawProc ) ;
62 #endif
63 free( (void*) (**lh).refCon ) ;
64 }
65 }