#endif
#include "wx/mac/uma.h"
+#include "wx/mac/private.h"
// Item members
+
+#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)();
+} cdefRec, *cdefPtr, **cdefHandle;
+
+#if PRAGMA_STRUCT_ALIGN
+ #pragma options align=reset
+#elif PRAGMA_STRUCT_PACKPUSH
+ #pragma pack(pop)
+#elif PRAGMA_STRUCT_PACK
+ #pragma pack()
+#endif
+
ControlActionUPP wxMacLiveScrollbarActionUPP = NULL ;
+wxControl *wxFindControlFromMacControl(ControlHandle inControl ) ;
pascal void wxMacLiveScrollbarActionProc( ControlHandle control , ControlPartCode partCode ) ;
pascal void wxMacLiveScrollbarActionProc( ControlHandle control , ControlPartCode partCode )
}
ControlColorUPP wxMacSetupControlBackgroundUPP = NULL ;
+ControlDefUPP wxMacControlActionUPP = NULL ;
+
+pascal SInt32 wxMacControlDefintion(SInt16 varCode, ControlRef theControl, ControlDefProcMessage message, SInt32 param)
+{
+
+ wxControl* wx = (wxControl*) wxFindControlFromMacControl( theControl ) ;
+ if ( wx != NULL && wx->IsKindOf( CLASSINFO( wxControl ) ) )
+ {
+ if( message == drawCntl )
+ {
+ wxMacWindowClipper clip( wx ) ;
+ return InvokeControlDefUPP( varCode , theControl , message , param , (ControlDefUPP) wx->MacGetControlAction() ) ;
+ }
+ else
+ return InvokeControlDefUPP( varCode , theControl , message , param , (ControlDefUPP) wx->MacGetControlAction() ) ;
+ }
+ return NULL ;
+}
pascal OSStatus wxMacSetupControlBackground( ControlRef iControl , SInt16 iMessage , SInt16 iDepth , Boolean iIsColor )
{
wxControl::wxControl()
{
m_macControl = NULL ;
+ m_macControlAction = NULL ;
m_macHorizontalBorder = 0 ; // additional pixels around the real control
m_macVerticalBorder = 0 ;
m_backgroundColour = *wxWHITE;
wxControl::~wxControl()
{
m_isBeingDeleted = TRUE;
+ wxRemoveMacControlAssociation( this ) ;
// If we delete an item, we should initialize the parent panel,
// because it could now be invalid.
wxWindow *parent = GetParent() ;
m_macControlIsShown = true ;
wxAssociateControlWithMacControl( (ControlHandle) m_macControl , this ) ;
-
if ( wxMacSetupControlBackgroundUPP == NULL )
{
wxMacSetupControlBackgroundUPP = NewControlColorUPP( wxMacSetupControlBackground ) ;
}
+ if ( wxMacControlActionUPP == NULL )
+ {
+ wxMacControlActionUPP = NewControlDefUPP( wxMacControlDefintion ) ;
+ }
+#if TARGET_CARBON
+/*
+ only working under classic carbon
+ m_macControlAction = *(**(ControlHandle)m_macControl).contrlDefProc ;
+ (**(ControlHandle)m_macControl).contrlDefProc = (Handle) &wxMacControlActionUPP ;
+*/
+#else
+ m_macControlAction = *(**(ControlHandle)m_macControl).contrlDefProc ;
+
+ cdefHandle cdef ;
+ cdef = (cdefHandle) NewHandle( sizeof(cdefRec) ) ;
+ if ( (**(ControlHandle)m_macControl).contrlDefProc != NULL )
+ {
+ (**cdef).instruction = 0x4EF9; /* JMP instruction */
+ (**cdef).function = (void(*)()) wxMacControlActionUPP;
+ (**(ControlHandle)m_macControl).contrlDefProc = (Handle) cdef ;
+ }
+#endif
SetControlColorProc( (ControlHandle) m_macControl , wxMacSetupControlBackgroundUPP ) ;
// Adjust the controls size and position
void wxControl::MacRedrawControl()
{
- if ( (ControlHandle) m_macControl && MacGetRootWindow() )
+ if ( (ControlHandle) m_macControl && MacGetRootWindow() && m_macControlIsShown )
{
wxClientDC dc(this) ;
wxMacPortSetter helper(&dc) ;
-
- // the controls sometimes draw outside their boundaries, this
- // should be resolved differently but is not trivial (e.g. drop shadows)
- // since adding them to the border would yield in enormous gaps between
- // the controls
- Rect r = { 0 , 0 , 32000 , 32000 } ;
- ClipRect( &r ) ;
+ wxMacWindowClipper clipper(this) ;
wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
UMADrawControl( (ControlHandle) m_macControl ) ;
}
{
wxPaintDC dc(this) ;
wxMacPortSetter helper(&dc) ;
- // the controls sometimes draw outside their boundaries, this
- // should be resolved differently but is not trivial (e.g. drop shadows)
- // since adding them to the border would yield in enormous gaps between
- // the controls
- Rect r = { 0 , 0 , 32000 , 32000 } ;
- ClipRect( &r ) ;
-
+ wxMacWindowClipper clipper(this) ;
wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
UMADrawControl( (ControlHandle) m_macControl ) ;
}