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