backported fixes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@19037 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -64,6 +64,9 @@ wxMacWindowClipper::wxMacWindowClipper( const wxWindow* win )
|
|||||||
|
|
||||||
if ( win )
|
if ( win )
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
|
// this clipping area was set to the parent window's drawing area, lead to problems
|
||||||
|
// with MacOSX controls drawing outside their wx' rectangle
|
||||||
RgnHandle insidergn = NewRgn() ;
|
RgnHandle insidergn = NewRgn() ;
|
||||||
int x = 0 , y = 0;
|
int x = 0 , y = 0;
|
||||||
wxWindow *parent = win->GetParent() ;
|
wxWindow *parent = win->GetParent() ;
|
||||||
@@ -77,6 +80,13 @@ wxMacWindowClipper::wxMacWindowClipper( const wxWindow* win )
|
|||||||
OffsetRgn( m_newClip , x , y ) ;
|
OffsetRgn( m_newClip , x , y ) ;
|
||||||
SetClip( m_newClip ) ;
|
SetClip( m_newClip ) ;
|
||||||
DisposeRgn( insidergn ) ;
|
DisposeRgn( insidergn ) ;
|
||||||
|
#endif
|
||||||
|
RgnHandle insidergn = NewRgn() ;
|
||||||
|
int x = 0 , y = 0;
|
||||||
|
win->MacWindowToRootWindow( &x,&y ) ;
|
||||||
|
CopyRgn( (RgnHandle) ((wxWindow*)win)->MacGetVisibleRegion().GetWXHRGN() , m_newClip ) ;
|
||||||
|
OffsetRgn( m_newClip , x , y ) ;
|
||||||
|
SetClip( m_newClip ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wxMacWindowClipper::~wxMacWindowClipper()
|
wxMacWindowClipper::~wxMacWindowClipper()
|
||||||
@@ -1369,6 +1379,21 @@ void wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y)
|
|||||||
{
|
{
|
||||||
Rect frame = { yy + line*(fi.descent + fi.ascent + fi.leading) ,xx , yy + (line+1)*(fi.descent + fi.ascent + fi.leading) , xx + 10000 } ;
|
Rect frame = { yy + line*(fi.descent + fi.ascent + fi.leading) ,xx , yy + (line+1)*(fi.descent + fi.ascent + fi.leading) , xx + 10000 } ;
|
||||||
CFStringRef mString = CFStringCreateWithBytes( NULL , (UInt8*) text + laststop , i - laststop , CFStringGetSystemEncoding(), false ) ;
|
CFStringRef mString = CFStringCreateWithBytes( NULL , (UInt8*) text + laststop , i - laststop , CFStringGetSystemEncoding(), false ) ;
|
||||||
|
if ( m_backgroundMode != wxTRANSPARENT )
|
||||||
|
{
|
||||||
|
Point bounds={0,0} ;
|
||||||
|
Rect background = frame ;
|
||||||
|
SInt16 baseline ;
|
||||||
|
::GetThemeTextDimensions( mString,
|
||||||
|
kThemeCurrentPortFont,
|
||||||
|
kThemeStateActive,
|
||||||
|
false,
|
||||||
|
&bounds,
|
||||||
|
&baseline );
|
||||||
|
background.right = background.left + bounds.h ;
|
||||||
|
background.bottom = background.top + bounds.v ;
|
||||||
|
::EraseRect( &background ) ;
|
||||||
|
}
|
||||||
::DrawThemeTextBox( mString,
|
::DrawThemeTextBox( mString,
|
||||||
kThemeCurrentPortFont,
|
kThemeCurrentPortFont,
|
||||||
kThemeStateActive,
|
kThemeStateActive,
|
||||||
@@ -1395,6 +1420,21 @@ void wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y)
|
|||||||
{
|
{
|
||||||
Rect frame = { yy + line*(fi.descent + fi.ascent + fi.leading) ,xx , yy + (line+1)*(fi.descent + fi.ascent + fi.leading) , xx + 10000 } ;
|
Rect frame = { yy + line*(fi.descent + fi.ascent + fi.leading) ,xx , yy + (line+1)*(fi.descent + fi.ascent + fi.leading) , xx + 10000 } ;
|
||||||
CFStringRef mString = CFStringCreateWithCString( NULL , text + laststop , kCFStringEncodingMacRoman ) ;
|
CFStringRef mString = CFStringCreateWithCString( NULL , text + laststop , kCFStringEncodingMacRoman ) ;
|
||||||
|
if ( m_backgroundMode != wxTRANSPARENT )
|
||||||
|
{
|
||||||
|
Point bounds={0,0} ;
|
||||||
|
Rect background = frame ;
|
||||||
|
SInt16 baseline ;
|
||||||
|
::GetThemeTextDimensions( mString,
|
||||||
|
kThemeCurrentPortFont,
|
||||||
|
kThemeStateActive,
|
||||||
|
false,
|
||||||
|
&bounds,
|
||||||
|
&baseline );
|
||||||
|
background.right = background.left + bounds.h ;
|
||||||
|
background.bottom = background.top + bounds.v ;
|
||||||
|
::EraseRect( &background ) ;
|
||||||
|
}
|
||||||
::DrawThemeTextBox( mString,
|
::DrawThemeTextBox( mString,
|
||||||
kThemeCurrentPortFont,
|
kThemeCurrentPortFont,
|
||||||
kThemeStateActive,
|
kThemeStateActive,
|
||||||
|
Binary file not shown.
@@ -768,46 +768,53 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
wxString wxTextCtrl::GetValue() const
|
wxString wxTextCtrl::GetValue() const
|
||||||
{
|
{
|
||||||
Size actualsize;
|
Size actualSize = 0;
|
||||||
|
wxString result ;
|
||||||
|
OSStatus err ;
|
||||||
if ( !m_macUsesTXN )
|
if ( !m_macUsesTXN )
|
||||||
{
|
{
|
||||||
::GetControlData( (ControlHandle) m_macControl, 0,
|
err = ::GetControlDataSize((ControlHandle) m_macControl, 0,
|
||||||
( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag,
|
( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag, &actualSize ) ;
|
||||||
32767 , wxBuffer , &actualsize ) ;
|
|
||||||
|
if ( err )
|
||||||
|
return wxEmptyString ;
|
||||||
|
|
||||||
|
if ( actualSize > 0 )
|
||||||
|
{
|
||||||
|
wxChar *ptr = result.GetWriteBuf(actualSize) ;
|
||||||
|
|
||||||
|
::GetControlData( (ControlHandle) m_macControl, 0,
|
||||||
|
( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag,
|
||||||
|
actualSize , ptr , &actualSize ) ;
|
||||||
|
ptr[actualSize] = 0 ;
|
||||||
|
result.UngetWriteBuf(actualSize) ;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Handle theText ;
|
Handle theText ;
|
||||||
OSStatus err = TXNGetDataEncoded( ((TXNObject) m_macTXN), kTXNStartOffset, kTXNEndOffset, &theText , kTXNTextData );
|
err = TXNGetDataEncoded( ((TXNObject) m_macTXN), kTXNStartOffset, kTXNEndOffset, &theText , kTXNTextData );
|
||||||
// all done
|
// all done
|
||||||
if ( err )
|
if ( err )
|
||||||
{
|
{
|
||||||
actualsize = 0 ;
|
actualSize = 0 ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
actualsize = GetHandleSize( theText ) ;
|
actualSize = GetHandleSize( theText ) ;
|
||||||
if (actualsize != 0)
|
if ( actualSize > 0 )
|
||||||
strncpy( wxBuffer , *theText , actualsize ) ;
|
{
|
||||||
DisposeHandle( theText ) ;
|
wxChar *ptr = result.GetWriteBuf(actualSize) ;
|
||||||
|
strncpy( ptr , *theText , actualSize ) ;
|
||||||
|
ptr[actualSize] = 0 ;
|
||||||
|
result.UngetWriteBuf( actualSize ) ;
|
||||||
|
}
|
||||||
|
DisposeHandle( theText ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxBuffer[actualsize] = 0 ;
|
return wxMacMakeStringFromMacString( result ) ;
|
||||||
|
|
||||||
wxString value;
|
|
||||||
|
|
||||||
if( wxApp::s_macDefaultEncodingIsPC )
|
|
||||||
{
|
|
||||||
value = wxMacMakePCStringFromMac( wxBuffer ) ;
|
|
||||||
value.Replace( "\r", "\n" );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
value = wxBuffer;
|
|
||||||
|
|
||||||
|
|
||||||
return value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxTextCtrl::GetSelection(long* from, long* to) const
|
void wxTextCtrl::GetSelection(long* from, long* to) const
|
||||||
@@ -830,7 +837,7 @@ void wxTextCtrl::SetValue(const wxString& st)
|
|||||||
if( wxApp::s_macDefaultEncodingIsPC )
|
if( wxApp::s_macDefaultEncodingIsPC )
|
||||||
{
|
{
|
||||||
value = wxMacMakeMacStringFromPC( st ) ;
|
value = wxMacMakeMacStringFromPC( st ) ;
|
||||||
value.Replace( "\n", "\r" );
|
// value.Replace( "\n", "\r" ); TODO this should be handled by the conversion
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
value = st;
|
value = st;
|
||||||
@@ -1206,7 +1213,7 @@ void wxTextCtrl::WriteText(const wxString& text)
|
|||||||
if( wxApp::s_macDefaultEncodingIsPC )
|
if( wxApp::s_macDefaultEncodingIsPC )
|
||||||
{
|
{
|
||||||
value = wxMacMakeMacStringFromPC( text ) ;
|
value = wxMacMakeMacStringFromPC( text ) ;
|
||||||
value.Replace( "\n", "\r" );
|
// value.Replace( "\n", "\r" ); // TODO this should be handled by the conversion
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
value = text ;
|
value = text ;
|
||||||
@@ -1543,9 +1550,7 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
|
|||||||
key == WXK_DELETE ||
|
key == WXK_DELETE ||
|
||||||
key == WXK_BACK)
|
key == WXK_BACK)
|
||||||
{
|
{
|
||||||
long t1 = 0xDEADBEEF ;
|
|
||||||
wxCommandEvent event1(wxEVT_COMMAND_TEXT_UPDATED, m_windowId);
|
wxCommandEvent event1(wxEVT_COMMAND_TEXT_UPDATED, m_windowId);
|
||||||
long t2 = 0xDEADBEEF ;
|
|
||||||
event1.SetString( GetValue() ) ;
|
event1.SetString( GetValue() ) ;
|
||||||
event1.SetEventObject( this );
|
event1.SetEventObject( this );
|
||||||
wxPostEvent(GetEventHandler(),event1);
|
wxPostEvent(GetEventHandler(),event1);
|
||||||
|
@@ -64,6 +64,9 @@ wxMacWindowClipper::wxMacWindowClipper( const wxWindow* win )
|
|||||||
|
|
||||||
if ( win )
|
if ( win )
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
|
// this clipping area was set to the parent window's drawing area, lead to problems
|
||||||
|
// with MacOSX controls drawing outside their wx' rectangle
|
||||||
RgnHandle insidergn = NewRgn() ;
|
RgnHandle insidergn = NewRgn() ;
|
||||||
int x = 0 , y = 0;
|
int x = 0 , y = 0;
|
||||||
wxWindow *parent = win->GetParent() ;
|
wxWindow *parent = win->GetParent() ;
|
||||||
@@ -77,6 +80,13 @@ wxMacWindowClipper::wxMacWindowClipper( const wxWindow* win )
|
|||||||
OffsetRgn( m_newClip , x , y ) ;
|
OffsetRgn( m_newClip , x , y ) ;
|
||||||
SetClip( m_newClip ) ;
|
SetClip( m_newClip ) ;
|
||||||
DisposeRgn( insidergn ) ;
|
DisposeRgn( insidergn ) ;
|
||||||
|
#endif
|
||||||
|
RgnHandle insidergn = NewRgn() ;
|
||||||
|
int x = 0 , y = 0;
|
||||||
|
win->MacWindowToRootWindow( &x,&y ) ;
|
||||||
|
CopyRgn( (RgnHandle) ((wxWindow*)win)->MacGetVisibleRegion().GetWXHRGN() , m_newClip ) ;
|
||||||
|
OffsetRgn( m_newClip , x , y ) ;
|
||||||
|
SetClip( m_newClip ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wxMacWindowClipper::~wxMacWindowClipper()
|
wxMacWindowClipper::~wxMacWindowClipper()
|
||||||
@@ -1369,6 +1379,21 @@ void wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y)
|
|||||||
{
|
{
|
||||||
Rect frame = { yy + line*(fi.descent + fi.ascent + fi.leading) ,xx , yy + (line+1)*(fi.descent + fi.ascent + fi.leading) , xx + 10000 } ;
|
Rect frame = { yy + line*(fi.descent + fi.ascent + fi.leading) ,xx , yy + (line+1)*(fi.descent + fi.ascent + fi.leading) , xx + 10000 } ;
|
||||||
CFStringRef mString = CFStringCreateWithBytes( NULL , (UInt8*) text + laststop , i - laststop , CFStringGetSystemEncoding(), false ) ;
|
CFStringRef mString = CFStringCreateWithBytes( NULL , (UInt8*) text + laststop , i - laststop , CFStringGetSystemEncoding(), false ) ;
|
||||||
|
if ( m_backgroundMode != wxTRANSPARENT )
|
||||||
|
{
|
||||||
|
Point bounds={0,0} ;
|
||||||
|
Rect background = frame ;
|
||||||
|
SInt16 baseline ;
|
||||||
|
::GetThemeTextDimensions( mString,
|
||||||
|
kThemeCurrentPortFont,
|
||||||
|
kThemeStateActive,
|
||||||
|
false,
|
||||||
|
&bounds,
|
||||||
|
&baseline );
|
||||||
|
background.right = background.left + bounds.h ;
|
||||||
|
background.bottom = background.top + bounds.v ;
|
||||||
|
::EraseRect( &background ) ;
|
||||||
|
}
|
||||||
::DrawThemeTextBox( mString,
|
::DrawThemeTextBox( mString,
|
||||||
kThemeCurrentPortFont,
|
kThemeCurrentPortFont,
|
||||||
kThemeStateActive,
|
kThemeStateActive,
|
||||||
@@ -1395,6 +1420,21 @@ void wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y)
|
|||||||
{
|
{
|
||||||
Rect frame = { yy + line*(fi.descent + fi.ascent + fi.leading) ,xx , yy + (line+1)*(fi.descent + fi.ascent + fi.leading) , xx + 10000 } ;
|
Rect frame = { yy + line*(fi.descent + fi.ascent + fi.leading) ,xx , yy + (line+1)*(fi.descent + fi.ascent + fi.leading) , xx + 10000 } ;
|
||||||
CFStringRef mString = CFStringCreateWithCString( NULL , text + laststop , kCFStringEncodingMacRoman ) ;
|
CFStringRef mString = CFStringCreateWithCString( NULL , text + laststop , kCFStringEncodingMacRoman ) ;
|
||||||
|
if ( m_backgroundMode != wxTRANSPARENT )
|
||||||
|
{
|
||||||
|
Point bounds={0,0} ;
|
||||||
|
Rect background = frame ;
|
||||||
|
SInt16 baseline ;
|
||||||
|
::GetThemeTextDimensions( mString,
|
||||||
|
kThemeCurrentPortFont,
|
||||||
|
kThemeStateActive,
|
||||||
|
false,
|
||||||
|
&bounds,
|
||||||
|
&baseline );
|
||||||
|
background.right = background.left + bounds.h ;
|
||||||
|
background.bottom = background.top + bounds.v ;
|
||||||
|
::EraseRect( &background ) ;
|
||||||
|
}
|
||||||
::DrawThemeTextBox( mString,
|
::DrawThemeTextBox( mString,
|
||||||
kThemeCurrentPortFont,
|
kThemeCurrentPortFont,
|
||||||
kThemeStateActive,
|
kThemeStateActive,
|
||||||
|
Binary file not shown.
@@ -768,46 +768,53 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
wxString wxTextCtrl::GetValue() const
|
wxString wxTextCtrl::GetValue() const
|
||||||
{
|
{
|
||||||
Size actualsize;
|
Size actualSize = 0;
|
||||||
|
wxString result ;
|
||||||
|
OSStatus err ;
|
||||||
if ( !m_macUsesTXN )
|
if ( !m_macUsesTXN )
|
||||||
{
|
{
|
||||||
::GetControlData( (ControlHandle) m_macControl, 0,
|
err = ::GetControlDataSize((ControlHandle) m_macControl, 0,
|
||||||
( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag,
|
( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag, &actualSize ) ;
|
||||||
32767 , wxBuffer , &actualsize ) ;
|
|
||||||
|
if ( err )
|
||||||
|
return wxEmptyString ;
|
||||||
|
|
||||||
|
if ( actualSize > 0 )
|
||||||
|
{
|
||||||
|
wxChar *ptr = result.GetWriteBuf(actualSize) ;
|
||||||
|
|
||||||
|
::GetControlData( (ControlHandle) m_macControl, 0,
|
||||||
|
( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag,
|
||||||
|
actualSize , ptr , &actualSize ) ;
|
||||||
|
ptr[actualSize] = 0 ;
|
||||||
|
result.UngetWriteBuf(actualSize) ;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Handle theText ;
|
Handle theText ;
|
||||||
OSStatus err = TXNGetDataEncoded( ((TXNObject) m_macTXN), kTXNStartOffset, kTXNEndOffset, &theText , kTXNTextData );
|
err = TXNGetDataEncoded( ((TXNObject) m_macTXN), kTXNStartOffset, kTXNEndOffset, &theText , kTXNTextData );
|
||||||
// all done
|
// all done
|
||||||
if ( err )
|
if ( err )
|
||||||
{
|
{
|
||||||
actualsize = 0 ;
|
actualSize = 0 ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
actualsize = GetHandleSize( theText ) ;
|
actualSize = GetHandleSize( theText ) ;
|
||||||
if (actualsize != 0)
|
if ( actualSize > 0 )
|
||||||
strncpy( wxBuffer , *theText , actualsize ) ;
|
{
|
||||||
DisposeHandle( theText ) ;
|
wxChar *ptr = result.GetWriteBuf(actualSize) ;
|
||||||
|
strncpy( ptr , *theText , actualSize ) ;
|
||||||
|
ptr[actualSize] = 0 ;
|
||||||
|
result.UngetWriteBuf( actualSize ) ;
|
||||||
|
}
|
||||||
|
DisposeHandle( theText ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxBuffer[actualsize] = 0 ;
|
return wxMacMakeStringFromMacString( result ) ;
|
||||||
|
|
||||||
wxString value;
|
|
||||||
|
|
||||||
if( wxApp::s_macDefaultEncodingIsPC )
|
|
||||||
{
|
|
||||||
value = wxMacMakePCStringFromMac( wxBuffer ) ;
|
|
||||||
value.Replace( "\r", "\n" );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
value = wxBuffer;
|
|
||||||
|
|
||||||
|
|
||||||
return value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxTextCtrl::GetSelection(long* from, long* to) const
|
void wxTextCtrl::GetSelection(long* from, long* to) const
|
||||||
@@ -830,7 +837,7 @@ void wxTextCtrl::SetValue(const wxString& st)
|
|||||||
if( wxApp::s_macDefaultEncodingIsPC )
|
if( wxApp::s_macDefaultEncodingIsPC )
|
||||||
{
|
{
|
||||||
value = wxMacMakeMacStringFromPC( st ) ;
|
value = wxMacMakeMacStringFromPC( st ) ;
|
||||||
value.Replace( "\n", "\r" );
|
// value.Replace( "\n", "\r" ); TODO this should be handled by the conversion
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
value = st;
|
value = st;
|
||||||
@@ -1206,7 +1213,7 @@ void wxTextCtrl::WriteText(const wxString& text)
|
|||||||
if( wxApp::s_macDefaultEncodingIsPC )
|
if( wxApp::s_macDefaultEncodingIsPC )
|
||||||
{
|
{
|
||||||
value = wxMacMakeMacStringFromPC( text ) ;
|
value = wxMacMakeMacStringFromPC( text ) ;
|
||||||
value.Replace( "\n", "\r" );
|
// value.Replace( "\n", "\r" ); // TODO this should be handled by the conversion
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
value = text ;
|
value = text ;
|
||||||
@@ -1543,9 +1550,7 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
|
|||||||
key == WXK_DELETE ||
|
key == WXK_DELETE ||
|
||||||
key == WXK_BACK)
|
key == WXK_BACK)
|
||||||
{
|
{
|
||||||
long t1 = 0xDEADBEEF ;
|
|
||||||
wxCommandEvent event1(wxEVT_COMMAND_TEXT_UPDATED, m_windowId);
|
wxCommandEvent event1(wxEVT_COMMAND_TEXT_UPDATED, m_windowId);
|
||||||
long t2 = 0xDEADBEEF ;
|
|
||||||
event1.SetString( GetValue() ) ;
|
event1.SetString( GetValue() ) ;
|
||||||
event1.SetEventObject( this );
|
event1.SetEventObject( this );
|
||||||
wxPostEvent(GetEventHandler(),event1);
|
wxPostEvent(GetEventHandler(),event1);
|
||||||
|
Reference in New Issue
Block a user