X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/655719367ac5e131d9642e5783f3ecf64d1a3385..02f463e9cc49326438c4b2f8dfb28dc4ecf7557e:/src/mac/carbon/utils.cpp diff --git a/src/mac/carbon/utils.cpp b/src/mac/carbon/utils.cpp index ce536a4832..258c28bcf1 100644 --- a/src/mac/carbon/utils.cpp +++ b/src/mac/carbon/utils.cpp @@ -1281,11 +1281,64 @@ OSStatus wxMacCarbonEvent::GetParameter(EventParamName inName, EventParamType in return ::GetEventParameter( m_eventRef , inName , inDesiredType , NULL , inBufferSize , NULL , outData ) ; } -OSStatus wxMacCarbonEvent::SetParameter(EventParamName inName, EventParamType inType, UInt32 inBufferSize, void * inData) +OSStatus wxMacCarbonEvent::SetParameter(EventParamName inName, EventParamType inType, UInt32 inBufferSize, const void * inData) { return ::SetEventParameter( m_eventRef , inName , inType , inBufferSize , inData ) ; } +// ---------------------------------------------------------------------------- +// Control Access Support +// ---------------------------------------------------------------------------- + +OSStatus wxMacControl::GetData(ControlPartCode inPartCode , ResType inTag , Size inBufferSize , void * inOutBuffer , Size * outActualSize ) +{ + return ::GetControlData( m_controlRef , inPartCode , inTag , inBufferSize , inOutBuffer , outActualSize ) ; +} + +OSStatus wxMacControl::GetDataSize(ControlPartCode inPartCode , ResType inTag , Size * outActualSize ) +{ + return ::GetControlDataSize( m_controlRef , inPartCode , inTag , outActualSize ) ; +} + +OSStatus wxMacControl::SetData(ControlPartCode inPartCode , ResType inTag , Size inSize , const void * inData) +{ + return ::SetControlData( m_controlRef , inPartCode , inTag , inSize , inData ) ; +} + +OSStatus wxMacControl::SendEvent( EventRef event , OptionBits inOptions ) +{ +#if TARGET_API_MAC_OSX + return SendEventToEventTargetWithOptions( event, + HIObjectGetEventTarget( (HIObjectRef) m_controlRef ), inOptions ); +#else + #pragma unused(inOptions) + return SendEventToEventTarget(event,GetControlEventTarget( m_controlRef ) ) ; +#endif +} + +OSStatus wxMacControl::SendHICommand( HICommand &command , OptionBits inOptions ) +{ + wxMacCarbonEvent event( kEventClassCommand , kEventCommandProcess ) ; + event.SetParameter(kEventParamDirectObject,command) ; + return SendEvent( event , inOptions ) ; +} + +OSStatus wxMacControl::SendHICommand( UInt32 commandID , OptionBits inOptions ) +{ + HICommand command ; + memset( &command, 0 , sizeof(command) ) ; + command.commandID = commandID ; + return SendHICommand( command , inOptions ) ; +} + +void wxMacControl::Flash( ControlPartCode part , UInt32 ticks ) +{ + HiliteControl( m_controlRef , part ) ; + unsigned long finalTicks ; + Delay( ticks , &finalTicks ) ; + HiliteControl( m_controlRef , kControlNoPart ) ; +} + // ---------------------------------------------------------------------------- // debugging support // ----------------------------------------------------------------------------