- GrafPtr savePort;
- GrafPtr grafPtr;
- RgnHandle savedClipRegion;
- SInt32 savedPenMode;
- wxCheckListBox* list;
- GetPort(&savePort);
- SetPort((**listHandle).port);
- grafPtr = (**listHandle).port ;
- // typecast our refCon
- list = (wxCheckListBox*) 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] ;
- int checked = list->m_checks[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 );
-
- wxFontRefData * font = (wxFontRefData*) (list->GetFont().GetRefData()) ;
-
- if ( font )
- {
- ::TextFont( font->m_macFontNum ) ;
- ::TextSize( font->m_macFontSize) ;
- ::TextFace( font->m_macFontStyle ) ;
- }
-
- ThemeButtonDrawInfo info ;
- info.state = kThemeStateActive ;
- info.value = checked ? kThemeButtonOn : kThemeButtonOff ;
- info.adornment = kThemeAdornmentNone ;
- Rect checkRect = *drawRect ;
-
-
- checkRect.left +=0 ;
- checkRect.top +=0 ;
- checkRect.right = checkRect.left + list->m_checkBoxWidth ;
- checkRect.bottom = checkRect.top + list->m_checkBoxHeight ;
- DrawThemeButton(&checkRect,kThemeCheckBox,
- &info,NULL,NULL, NULL,0);
-
- MoveTo(drawRect->left + 2 + list->m_checkBoxWidth+2, drawRect->top + list->m_TextBaseLineOffset );
-
- 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);
-}
-
-extern "C" void MacDrawStringCell(Rect *cellRect, Cell lCell, ListHandle theList, long refCon) ;
-
-static ListDefUPP macCheckListDefUPP = NULL ;