control data support

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27500 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor 2004-05-29 14:51:29 +00:00
parent 997e843d51
commit 86d8b74439
2 changed files with 69 additions and 1 deletions

View File

@ -283,7 +283,10 @@ public :
{ {
return SetParameter<T>( inName, wxMacGetEventParamType<T>() , &data ) ; return SetParameter<T>( inName, wxMacGetEventParamType<T>() , &data ) ;
} }
UInt32 GetClass()
{
return ::GetEventClass( m_eventRef ) ;
}
UInt32 GetKind() UInt32 GetKind()
{ {
return ::GetEventKind( m_eventRef ) ; return ::GetEventKind( m_eventRef ) ;
@ -300,6 +303,52 @@ protected :
EventRef m_eventRef ; EventRef m_eventRef ;
} ; } ;
class wxMacControl
{
public :
wxMacControl( ControlRef control )
{
m_controlRef = control ;
}
wxMacControl( WXWidget control )
{
m_controlRef = (ControlRef) control ;
}
OSStatus SetData( ControlPartCode inPartCode , ResType inTag , Size inSize , const void * inData ) ;
OSStatus GetData( ControlPartCode inPartCode , ResType inTag , Size inBufferSize , void * inOutBuffer , Size * outActualSize ) ;
OSStatus GetDataSize( ControlPartCode inPartCode , ResType inTag , Size * outActualSize ) ;
Size GetDataSize( ControlPartCode inPartCode , ResType inTag )
{
Size sz ;
verify_noerr( GetDataSize( inPartCode , inTag , &sz ) ) ;
return sz ;
}
template <typename T> OSStatus SetData( ControlPartCode inPartCode , ResType inTag , T *data )
{
return SetData( inPartCode , inTag , sizeof( T ) , data ) ;
}
template <typename T> OSStatus SetData( ControlPartCode inPartCode , ResType inTag , T data )
{
return SetData( inPartCode , inTag , sizeof( T ) , &data ) ;
}
template <typename T> OSStatus GetData( ControlPartCode inPartCode , ResType inTag , T *data )
{
Size dummy ;
return GetData( inPartCode , inTag , sizeof( T ) , data , &dummy ) ;
}
template <typename T> T GetData( ControlPartCode inPartCode , ResType inTag )
{
T value ;
verify_noerr( GetData<T>( inPartCode , inTag , &value ) ) ;
return value ;
}
operator ControlRef () { return m_controlRef; }
operator ControlRef * () { return &m_controlRef; }
protected :
ControlRef m_controlRef ;
} ;
#endif // wxUSE_GUI #endif // wxUSE_GUI
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------

View File

@ -1286,6 +1286,25 @@ OSStatus wxMacCarbonEvent::SetParameter(EventParamName inName, EventParamType in
return ::SetEventParameter( m_eventRef , inName , inType , inBufferSize , 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 ) ;
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// debugging support // debugging support
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------