]> git.saurik.com Git - wxWidgets.git/blame - src/mac/ldef/extldef.h
minor additions to wxCmdLineParser tests
[wxWidgets.git] / src / mac / ldef / extldef.h
CommitLineData
7c551d95
SC
1#pragma once
2
03e11df5 3#if defined(__UNIX__)
5fde6fcc 4 #include <Carbon/Carbon.h>
03e11df5
GD
5#else
6 #include <Lists.h>
7#endif
7c551d95
SC
8#include <stdlib.h>
9
10#define kExtLDEFID 128 // resource id of our LDEF resource
11
12typedef void (*ExtLDEFDrawProcType)(Rect *r, Cell cell, ListHandle lh, long refcon);
13
14enum {
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
23typedef 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
31typedef 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
39typedef struct
40{
41 long refCon ;
42 ExtLDEFDrawProcUPP drawProc ;
43} ExtLDEFInfo ;
44
45static void NewExtLDEFInfo( ListHandle lh , ExtLDEFDrawProcType drawproc , long refcon ) ;
46static 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
54static void DisposeExtLDEFInfo( ListHandle lh) ;
55static void DisposeExtLDEFInfo( ListHandle lh)
56{
57 ExtLDEFInfo* info = (ExtLDEFInfo* ) (**lh).refCon ;
58 if ( info )
59 {
2f1ae414 60 #if !TARGET_CARBON
7c551d95 61 DisposeRoutineDescriptor( (RoutineDescriptor*) info->drawProc ) ;
2f1ae414 62 #endif
7c551d95
SC
63 free( (void*) (**lh).refCon ) ;
64 }
65}