first private implementation for MPRemoteCalls
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27006 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -816,8 +816,8 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
|
|||||||
| kControlWantsActivate | kControlHandlesTracking | kControlHasSpecialBackground
|
| kControlWantsActivate | kControlHandlesTracking | kControlHasSpecialBackground
|
||||||
| kControlGetsFocusOnClick | kControlSupportsLiveFeedback;
|
| kControlGetsFocusOnClick | kControlSupportsLiveFeedback;
|
||||||
/* create the control */
|
/* create the control */
|
||||||
m_macControl = (WXWidget) ::NewControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, "\p", true , featurSet, 0, featurSet, kControlUserPaneProc, (long) this );
|
verify_noerr( CreateUserPaneControl( MAC_WXHWND(GetParent()->MacGetTopLevelWindowRef()) , &bounds, featurSet , (ControlRef*) &m_macControl) ) ;
|
||||||
/* set up the mUP specific features and data */
|
|
||||||
wxMacWindowClipper c(this) ;
|
wxMacWindowClipper c(this) ;
|
||||||
STPTextPaneVars *varsp ;
|
STPTextPaneVars *varsp ;
|
||||||
mUPOpenControl( varsp, (ControlRef) m_macControl, m_windowStyle );
|
mUPOpenControl( varsp, (ControlRef) m_macControl, m_windowStyle );
|
||||||
@@ -1239,9 +1239,9 @@ long wxTextCtrl::GetInsertionPoint() const
|
|||||||
|
|
||||||
long wxTextCtrl::GetLastPosition() const
|
long wxTextCtrl::GetLastPosition() const
|
||||||
{
|
{
|
||||||
Handle theText ;
|
|
||||||
long actualsize = 0 ;
|
long actualsize = 0 ;
|
||||||
#if wxMAC_USE_MLTE
|
#if wxMAC_USE_MLTE
|
||||||
|
Handle theText ;
|
||||||
OSErr err = TXNGetDataEncoded( (TXNObject) m_macTXN, kTXNStartOffset, kTXNEndOffset, &theText , kTXNTextData );
|
OSErr err = TXNGetDataEncoded( (TXNObject) m_macTXN, kTXNStartOffset, kTXNEndOffset, &theText , kTXNTextData );
|
||||||
/* all done */
|
/* all done */
|
||||||
if ( err )
|
if ( err )
|
||||||
@@ -1320,16 +1320,112 @@ bool wxTextCtrl::LoadFile(const wxString& file)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class wxMacFunctor
|
||||||
|
{
|
||||||
|
public :
|
||||||
|
wxMacFunctor(){}
|
||||||
|
virtual ~wxMacFunctor() {}
|
||||||
|
virtual void* operator()() = 0 ;
|
||||||
|
static void* CallBackProc(void *param)
|
||||||
|
{
|
||||||
|
wxMacFunctor* f = (wxMacFunctor*) param ;
|
||||||
|
void *result = (*f)() ;
|
||||||
|
return result ;
|
||||||
|
}
|
||||||
|
} ;
|
||||||
|
|
||||||
|
template<typename classtype,typename param1type>
|
||||||
|
class wxMacObjectFunctor1 : public wxMacFunctor
|
||||||
|
{
|
||||||
|
typedef void (classtype::*function)( param1type p1 ) ;
|
||||||
|
typedef void (classtype::*ref_function)( const param1type& p1 ) ;
|
||||||
|
public :
|
||||||
|
wxMacObjectFunctor1( classtype *obj , function f , param1type p1 ) :
|
||||||
|
wxMacFunctor( )
|
||||||
|
{
|
||||||
|
m_object = obj ;
|
||||||
|
m_function = f ;
|
||||||
|
m_param1 = p1 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxMacObjectFunctor1( classtype *obj , ref_function f , param1type p1 ) :
|
||||||
|
wxMacFunctor( )
|
||||||
|
{
|
||||||
|
m_object = obj ;
|
||||||
|
m_refFunction = f ;
|
||||||
|
m_param1 = p1 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
~wxMacObjectFunctor1() {}
|
||||||
|
|
||||||
|
virtual void* operator()()
|
||||||
|
{
|
||||||
|
(m_object->*m_function)(m_param1) ;
|
||||||
|
return NULL ;
|
||||||
|
}
|
||||||
|
private :
|
||||||
|
classtype* m_object ;
|
||||||
|
param1type m_param1 ;
|
||||||
|
union
|
||||||
|
{
|
||||||
|
function m_function ;
|
||||||
|
ref_function m_refFunction ;
|
||||||
|
} ;
|
||||||
|
} ;
|
||||||
|
|
||||||
|
template<typename classtype, typename param1type>
|
||||||
|
void* wxMacMPRemoteCall( classtype *object , void (classtype::*function)( param1type p1 ) , param1type p1 )
|
||||||
|
{
|
||||||
|
wxMacObjectFunctor1<classtype,param1type> params(object,function,p1) ;
|
||||||
|
void *result =
|
||||||
|
MPRemoteCall( wxMacFunctor::CallBackProc , ¶ms , kMPOwningProcessRemoteContext ) ;
|
||||||
|
return result ;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename classtype, typename param1type>
|
||||||
|
void* wxMacMPRemoteCall( classtype *object , void (classtype::*function)( const param1type& p1 ) , param1type p1 )
|
||||||
|
{
|
||||||
|
wxMacObjectFunctor1<classtype,param1type> params(object,function,p1) ;
|
||||||
|
void *result =
|
||||||
|
MPRemoteCall( wxMacFunctor::CallBackProc , ¶ms , kMPOwningProcessRemoteContext ) ;
|
||||||
|
return result ;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename classtype, typename param1type>
|
||||||
|
void* wxMacMPRemoteGUICall( classtype *object , void (classtype::*function)( param1type p1 ) , param1type p1 )
|
||||||
|
{
|
||||||
|
wxMutexGuiLeave() ;
|
||||||
|
void *result = wxMacMPRemoteCall( object , function , p1 ) ;
|
||||||
|
wxMutexGuiEnter() ;
|
||||||
|
return result ;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename classtype, typename param1type>
|
||||||
|
void* wxMacMPRemoteGUICall( classtype *object , void (classtype::*function)( const param1type& p1 ) , param1type p1 )
|
||||||
|
{
|
||||||
|
wxMutexGuiLeave() ;
|
||||||
|
void *result = wxMacMPRemoteCall( object , function , p1 ) ;
|
||||||
|
wxMutexGuiEnter() ;
|
||||||
|
return result ;
|
||||||
|
}
|
||||||
|
|
||||||
void wxTextCtrl::WriteText(const wxString& str)
|
void wxTextCtrl::WriteText(const wxString& str)
|
||||||
{
|
{
|
||||||
|
if ( !wxIsMainThread() )
|
||||||
|
{
|
||||||
|
wxMacMPRemoteGUICall( this , &wxTextCtrl::WriteText , str ) ;
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
wxString st = str ;
|
wxString st = str ;
|
||||||
wxMacConvertNewlines13To10( &st ) ;
|
wxMacConvertNewlines13To10( &st ) ;
|
||||||
#if wxMAC_USE_MLTE
|
#if wxMAC_USE_MLTE
|
||||||
bool formerEditable = m_editable ;
|
bool formerEditable = m_editable ;
|
||||||
if ( !formerEditable )
|
if ( !formerEditable )
|
||||||
SetEditable(true) ;
|
SetEditable(true) ;
|
||||||
{
|
{
|
||||||
wxMacWindowStateSaver( this ) ;
|
wxMacWindowStateSaver s( this ) ;
|
||||||
long start , end , dummy ;
|
long start , end , dummy ;
|
||||||
GetSelection( &start , &dummy ) ;
|
GetSelection( &start , &dummy ) ;
|
||||||
SetTXNData( (STPTextPaneVars *)m_macTXNvars , (TXNObject) m_macTXN , st , kTXNUseCurrentSelection, kTXNUseCurrentSelection ) ;
|
SetTXNData( (STPTextPaneVars *)m_macTXNvars , (TXNObject) m_macTXN , st , kTXNUseCurrentSelection, kTXNUseCurrentSelection ) ;
|
||||||
@@ -1340,21 +1436,22 @@ void wxTextCtrl::WriteText(const wxString& str)
|
|||||||
SetEditable( formerEditable ) ;
|
SetEditable( formerEditable ) ;
|
||||||
|
|
||||||
MacRedrawControl() ;
|
MacRedrawControl() ;
|
||||||
#else
|
#else
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
|
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
|
||||||
wxMacCFStringHolder cf(st , m_font.GetEncoding() ) ;
|
wxMacCFStringHolder cf(st , m_font.GetEncoding() ) ;
|
||||||
CFStringRef value = cf ;
|
CFStringRef value = cf ;
|
||||||
SetControlData( (ControlRef) m_macControl , 0, kControlEditTextInsertCFStringRefTag,
|
SetControlData( (ControlRef) m_macControl , 0, kControlEditTextInsertCFStringRefTag,
|
||||||
sizeof(CFStringRef), &value );
|
sizeof(CFStringRef), &value );
|
||||||
#else
|
#else
|
||||||
wxString val = GetValue() ;
|
wxString val = GetValue() ;
|
||||||
long start , end ;
|
long start , end ;
|
||||||
GetSelection( &start , &end ) ;
|
GetSelection( &start , &end ) ;
|
||||||
val.Remove( start, end - start ) ;
|
val.Remove( start , end - start ) ;
|
||||||
val.insert( start , str ) ;
|
val.insert( start , str ) ;
|
||||||
SetValue( val ) ;
|
SetValue( val ) ;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxTextCtrl::AppendText(const wxString& text)
|
void wxTextCtrl::AppendText(const wxString& text)
|
||||||
@@ -1645,9 +1742,9 @@ int wxTextCtrl::GetLineLength(long lineNo) const
|
|||||||
|
|
||||||
wxString wxTextCtrl::GetLineText(long lineNo) const
|
wxString wxTextCtrl::GetLineText(long lineNo) const
|
||||||
{
|
{
|
||||||
Point curpt ;
|
|
||||||
wxString line ;
|
wxString line ;
|
||||||
#if wxMAC_USE_MLTE
|
#if wxMAC_USE_MLTE
|
||||||
|
Point curpt ;
|
||||||
wxString content = GetValue() ;
|
wxString content = GetValue() ;
|
||||||
|
|
||||||
if ( lineNo < GetNumberOfLines() )
|
if ( lineNo < GetNumberOfLines() )
|
||||||
|
Reference in New Issue
Block a user