+#include "wx/mac/uma.h"
+
+#if PRAGMA_STRUCT_ALIGN
+ #pragma options align=mac68k
+#elif PRAGMA_STRUCT_PACKPUSH
+ #pragma pack(push, 2)
+#elif PRAGMA_STRUCT_PACK
+ #pragma pack(2)
+#endif
+
+typedef struct {
+ unsigned short instruction;
+ void (*function)();
+} ldefRec, *ldefPtr, **ldefHandle;
+
+#if PRAGMA_STRUCT_ALIGN
+ #pragma options align=reset
+#elif PRAGMA_STRUCT_PACKPUSH
+ #pragma pack(pop)
+#elif PRAGMA_STRUCT_PACK
+ #pragma pack()
+#endif
+
+extern "C"
+{
+static pascal void wxMacListDefinition( short message, Boolean isSelected, Rect *drawRect,
+ Cell cell, short dataOffset, short dataLength,
+ ListHandle listHandle ) ;
+}
+
+static pascal void wxMacListDefinition( short message, Boolean isSelected, Rect *drawRect,
+ Cell cell, short dataOffset, short dataLength,
+ ListHandle listHandle )
+{
+ FontInfo fontInfo;
+ GrafPtr savePort;
+ GrafPtr grafPtr;
+ RgnHandle savedClipRegion;
+ SInt32 savedPenMode;
+ wxListBox* list;
+ GetPort(&savePort);
+ SetPort((**listHandle).port);
+ grafPtr = (**listHandle).port ;
+ // typecast our refCon
+ list = (wxListBox*) GetControlReference( (ControlHandle) GetListRefCon(listHandle) );
+
+ // Calculate the cell rect.
+
+ switch( message ) {
+ case lInitMsg:
+ break;
+
+ case lCloseMsg:
+ break;
+
+ case lDrawMsg:
+ {
+ const wxString text = list->m_stringArray[cell.v] ;
+
+ // Save the current clip region, and set the clip region to the area we are about
+ // to draw.
+
+ savedClipRegion = NewRgn();
+ GetClip( savedClipRegion );
+
+ ClipRect( drawRect );
+ EraseRect( drawRect );
+
+ MoveTo(drawRect->left + 4 , drawRect->top + 10 );
+ ::TextFont( kFontIDMonaco ) ;
+ ::TextSize( 9 );
+ ::TextFace( 0 ) ;
+
+ DrawText(text, 0 , text.Length());
+ // If the cell is hilited, do the hilite now. Paint the cell contents with the
+ // appropriate QuickDraw transform mode.
+
+ if( isSelected ) {
+ savedPenMode = GetPortPenMode( (CGrafPtr) grafPtr );
+ SetPortPenMode( (CGrafPtr)grafPtr, hilitetransfermode );
+ PaintRect( drawRect );
+ SetPortPenMode( (CGrafPtr)grafPtr, savedPenMode );
+ }
+
+ // Restore the saved clip region.
+
+ SetClip( savedClipRegion );
+ DisposeRgn( savedClipRegion );
+ }
+ break;
+ case lHiliteMsg:
+
+ // Hilite or unhilite the cell. Paint the cell contents with the
+ // appropriate QuickDraw transform mode.
+
+ GetPort( &grafPtr );
+ savedPenMode = GetPortPenMode( (CGrafPtr)grafPtr );
+ SetPortPenMode( (CGrafPtr)grafPtr, hilitetransfermode );
+ PaintRect( drawRect );
+ SetPortPenMode( (CGrafPtr)grafPtr, savedPenMode );
+ break;
+ default :
+ break ;
+ }
+ SetPort(savePort);
+}