cleanup for 10.5
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42012 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -300,13 +300,16 @@ wxSize wxChoice::DoGetBestSize() const
|
|||||||
int wLine;
|
int wLine;
|
||||||
|
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
long metric ;
|
SInt32 metric ;
|
||||||
|
|
||||||
GetThemeMetric( kThemeMetricPopupButtonHeight , &metric );
|
GetThemeMetric( kThemeMetricPopupButtonHeight , &metric );
|
||||||
lbHeight = metric ;
|
lbHeight = metric ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{
|
{
|
||||||
|
#if wxMAC_USE_CORE_GRAPHICS
|
||||||
|
wxClientDC dc(const_cast<wxChoice*>(this));
|
||||||
|
#else
|
||||||
wxMacPortStateHelper st( UMAGetWindowPort( (WindowRef) MacGetTopLevelWindowRef() ) ) ;
|
wxMacPortStateHelper st( UMAGetWindowPort( (WindowRef) MacGetTopLevelWindowRef() ) ) ;
|
||||||
if ( m_font.Ok() )
|
if ( m_font.Ok() )
|
||||||
{
|
{
|
||||||
@@ -320,12 +323,16 @@ wxSize wxChoice::DoGetBestSize() const
|
|||||||
::TextSize( 9 ) ;
|
::TextSize( 9 ) ;
|
||||||
::TextFace( 0 ) ;
|
::TextFace( 0 ) ;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
// Find the widest line
|
// Find the widest line
|
||||||
for(unsigned int i = 0; i < GetCount(); i++)
|
for(unsigned int i = 0; i < GetCount(); i++)
|
||||||
{
|
{
|
||||||
wxString str(GetString(i));
|
wxString str(GetString(i));
|
||||||
|
#if wxMAC_USE_CORE_GRAPHICS
|
||||||
|
wxCoord width, height ;
|
||||||
|
dc.GetTextExtent( str , &width, &height);
|
||||||
|
wLine = width ;
|
||||||
|
#else
|
||||||
#if wxUSE_UNICODE
|
#if wxUSE_UNICODE
|
||||||
Point bounds = { 0, 0 } ;
|
Point bounds = { 0, 0 } ;
|
||||||
SInt16 baseline ;
|
SInt16 baseline ;
|
||||||
@@ -341,15 +348,20 @@ wxSize wxChoice::DoGetBestSize() const
|
|||||||
#else
|
#else
|
||||||
wLine = ::TextWidth( str.c_str() , 0 , str.length() ) ;
|
wLine = ::TextWidth( str.c_str() , 0 , str.length() ) ;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
lbWidth = wxMax( lbWidth, wLine ) ;
|
lbWidth = wxMax( lbWidth, wLine ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add room for the popup arrow
|
// Add room for the popup arrow
|
||||||
lbWidth += 2 * lbHeight ;
|
lbWidth += 2 * lbHeight ;
|
||||||
|
#if wxMAC_USE_CORE_GRAPHICS
|
||||||
|
wxCoord width, height ;
|
||||||
|
dc.GetTextExtent( wxT("X"), &width, &height);
|
||||||
|
int cx = width ;
|
||||||
|
#else
|
||||||
// And just a bit more
|
// And just a bit more
|
||||||
int cx = ::TextWidth( "X" , 0 , 1 ) ;
|
int cx = ::TextWidth( "X" , 0 , 1 ) ;
|
||||||
|
#endif
|
||||||
lbWidth += cx ;
|
lbWidth += cx ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -311,8 +311,10 @@ void wxBitmapDataObject::Clear()
|
|||||||
{
|
{
|
||||||
if (m_pictHandle != NULL)
|
if (m_pictHandle != NULL)
|
||||||
{
|
{
|
||||||
|
#ifndef __LP64__
|
||||||
if (m_pictCreated)
|
if (m_pictCreated)
|
||||||
KillPicture( (PicHandle)m_pictHandle );
|
KillPicture( (PicHandle)m_pictHandle );
|
||||||
|
#endif
|
||||||
m_pictHandle = NULL;
|
m_pictHandle = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -356,6 +358,7 @@ bool wxBitmapDataObject::SetData( size_t nSize, const void *pBuf )
|
|||||||
|
|
||||||
// ownership is transferred to the bitmap
|
// ownership is transferred to the bitmap
|
||||||
m_pictCreated = false;
|
m_pictCreated = false;
|
||||||
|
#ifndef __LP64__
|
||||||
Rect frame;
|
Rect frame;
|
||||||
wxMacGetPictureBounds( picHandle, &frame );
|
wxMacGetPictureBounds( picHandle, &frame );
|
||||||
|
|
||||||
@@ -366,6 +369,7 @@ bool wxBitmapDataObject::SetData( size_t nSize, const void *pBuf )
|
|||||||
mdc.SelectObject( m_bitmap );
|
mdc.SelectObject( m_bitmap );
|
||||||
mf.Play( &mdc );
|
mf.Play( &mdc );
|
||||||
mdc.SelectObject( wxNullBitmap );
|
mdc.SelectObject( wxNullBitmap );
|
||||||
|
#endif
|
||||||
|
|
||||||
return m_bitmap.Ok();
|
return m_bitmap.Ok();
|
||||||
}
|
}
|
||||||
|
@@ -247,6 +247,9 @@ wxSize wxListBox::DoGetBestSize() const
|
|||||||
int wLine;
|
int wLine;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
#if wxMAC_USE_CORE_GRAPHICS
|
||||||
|
wxClientDC dc(const_cast<wxListBox*>(this));
|
||||||
|
#else
|
||||||
wxMacPortStateHelper st( UMAGetWindowPort( (WindowRef)MacGetTopLevelWindowRef() ) );
|
wxMacPortStateHelper st( UMAGetWindowPort( (WindowRef)MacGetTopLevelWindowRef() ) );
|
||||||
|
|
||||||
// TODO: clean this up
|
// TODO: clean this up
|
||||||
@@ -262,12 +265,16 @@ wxSize wxListBox::DoGetBestSize() const
|
|||||||
::TextSize( 9 );
|
::TextSize( 9 );
|
||||||
::TextFace( 0 );
|
::TextFace( 0 );
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
// Find the widest line
|
// Find the widest line
|
||||||
for (unsigned int i = 0; i < GetCount(); i++)
|
for (unsigned int i = 0; i < GetCount(); i++)
|
||||||
{
|
{
|
||||||
wxString str( GetString( i ) );
|
wxString str( GetString( i ) );
|
||||||
|
#if wxMAC_USE_CORE_GRAPHICS
|
||||||
|
wxCoord width, height ;
|
||||||
|
dc.GetTextExtent( str , &width, &height);
|
||||||
|
wLine = width ;
|
||||||
|
#else
|
||||||
#if wxUSE_UNICODE
|
#if wxUSE_UNICODE
|
||||||
Point bounds = {0, 0};
|
Point bounds = {0, 0};
|
||||||
SInt16 baseline;
|
SInt16 baseline;
|
||||||
@@ -286,6 +293,7 @@ wxSize wxListBox::DoGetBestSize() const
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
lbWidth = wxMax( lbWidth, wLine );
|
lbWidth = wxMax( lbWidth, wLine );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add room for the scrollbar
|
// Add room for the scrollbar
|
||||||
@@ -293,7 +301,13 @@ wxSize wxListBox::DoGetBestSize() const
|
|||||||
|
|
||||||
// And just a bit more
|
// And just a bit more
|
||||||
int cy = 12;
|
int cy = 12;
|
||||||
|
#if wxMAC_USE_CORE_GRAPHICS
|
||||||
|
wxCoord width, height ;
|
||||||
|
dc.GetTextExtent( wxT("X") , &width, &height);
|
||||||
|
int cx = width ;
|
||||||
|
#else
|
||||||
int cx = ::TextWidth( "X", 0, 1 );
|
int cx = ::TextWidth( "X", 0, 1 );
|
||||||
|
#endif
|
||||||
lbWidth += cx;
|
lbWidth += cx;
|
||||||
|
|
||||||
// don't make the listbox too tall (limit height to around 10 items)
|
// don't make the listbox too tall (limit height to around 10 items)
|
||||||
|
@@ -91,6 +91,13 @@ wxSize wxStaticText::DoGetBestSize() const
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#if wxMAC_USE_CORE_GRAPHICS
|
||||||
|
wxClientDC dc(const_cast<wxStaticText*>(this));
|
||||||
|
wxCoord width, height ;
|
||||||
|
dc.GetTextExtent( m_label , &width, &height);
|
||||||
|
bounds.h = width;
|
||||||
|
bounds.v = height;
|
||||||
|
#else
|
||||||
wxMacWindowStateSaver sv( this );
|
wxMacWindowStateSaver sv( this );
|
||||||
::TextFont( m_font.MacGetFontNum() );
|
::TextFont( m_font.MacGetFontNum() );
|
||||||
::TextSize( (short)(m_font.MacGetFontSize()) );
|
::TextSize( (short)(m_font.MacGetFontSize()) );
|
||||||
@@ -100,6 +107,7 @@ wxSize wxStaticText::DoGetBestSize() const
|
|||||||
(!m_label.empty() ? (CFStringRef)str : CFSTR(" ")),
|
(!m_label.empty() ? (CFStringRef)str : CFSTR(" ")),
|
||||||
kThemeCurrentPortFont, kThemeStateActive, false, &bounds, &baseline );
|
kThemeCurrentPortFont, kThemeStateActive, false, &bounds, &baseline );
|
||||||
verify_noerr( err );
|
verify_noerr( err );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_label.empty() )
|
if ( m_label.empty() )
|
||||||
|
@@ -130,7 +130,7 @@ static pascal OSStatus KeyboardEventHandler( EventHandlerCallRef handler , Event
|
|||||||
UInt32 when = EventTimeToTicks( GetEventTime( event ) ) ;
|
UInt32 when = EventTimeToTicks( GetEventTime( event ) ) ;
|
||||||
|
|
||||||
#if wxUSE_UNICODE
|
#if wxUSE_UNICODE
|
||||||
UInt32 dataSize = 0 ;
|
ByteCount dataSize = 0 ;
|
||||||
if ( GetEventParameter( event, kEventParamKeyUnicodes, typeUnicodeText, NULL, 0 , &dataSize, NULL ) == noErr )
|
if ( GetEventParameter( event, kEventParamKeyUnicodes, typeUnicodeText, NULL, 0 , &dataSize, NULL ) == noErr )
|
||||||
{
|
{
|
||||||
UniChar buf[2] ;
|
UniChar buf[2] ;
|
||||||
@@ -359,7 +359,7 @@ static void SetupMouseEvent( wxMouseEvent &wxevent , wxMacCarbonEvent &cEvent )
|
|||||||
wxevent.SetEventType( wxEVT_MOUSEWHEEL ) ;
|
wxevent.SetEventType( wxEVT_MOUSEWHEEL ) ;
|
||||||
|
|
||||||
// EventMouseWheelAxis axis = cEvent.GetParameter<EventMouseWheelAxis>(kEventParamMouseWheelAxis, typeMouseWheelAxis) ;
|
// EventMouseWheelAxis axis = cEvent.GetParameter<EventMouseWheelAxis>(kEventParamMouseWheelAxis, typeMouseWheelAxis) ;
|
||||||
SInt32 delta = cEvent.GetParameter<SInt32>(kEventParamMouseWheelDelta, typeLongInteger) ;
|
SInt32 delta = cEvent.GetParameter<SInt32>(kEventParamMouseWheelDelta, typeSInt32) ;
|
||||||
|
|
||||||
wxevent.m_wheelRotation = delta;
|
wxevent.m_wheelRotation = delta;
|
||||||
wxevent.m_wheelDelta = 1;
|
wxevent.m_wheelDelta = 1;
|
||||||
@@ -467,7 +467,7 @@ pascal OSStatus wxMacTopLevelMouseEventHandler( EventHandlerCallRef handler , Ev
|
|||||||
|
|
||||||
if ( window )
|
if ( window )
|
||||||
{
|
{
|
||||||
QDGlobalToLocalPoint( UMAGetWindowPort(window ) , &windowMouseLocation ) ;
|
wxMacGlobalToLocal( window, &windowMouseLocation ) ;
|
||||||
|
|
||||||
if ( wxApp::s_captureWindow
|
if ( wxApp::s_captureWindow
|
||||||
#if !NEW_CAPTURE_HANDLING
|
#if !NEW_CAPTURE_HANDLING
|
||||||
@@ -980,10 +980,18 @@ void wxTopLevelWindowMac::Maximize(bool maximize)
|
|||||||
Point idealSize = { 0 , 0 } ;
|
Point idealSize = { 0 , 0 } ;
|
||||||
if ( maximize )
|
if ( maximize )
|
||||||
{
|
{
|
||||||
|
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
|
||||||
|
HIRect bounds ;
|
||||||
|
HIWindowGetAvailablePositioningBounds(kCGNullDirectDisplay,kHICoordSpace72DPIGlobal,
|
||||||
|
&bounds);
|
||||||
|
idealSize.h = bounds.size.width;
|
||||||
|
idealSize.v = bounds.size.height;
|
||||||
|
#else
|
||||||
Rect rect ;
|
Rect rect ;
|
||||||
GetAvailableWindowPositioningBounds(GetMainDevice(),&rect) ;
|
GetAvailableWindowPositioningBounds(GetMainDevice(),&rect) ;
|
||||||
idealSize.h = rect.right - rect.left ;
|
idealSize.h = rect.right - rect.left ;
|
||||||
idealSize.v = rect.bottom - rect.top ;
|
idealSize.v = rect.bottom - rect.top ;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
ZoomWindowIdeal( (WindowRef)m_macWindow , maximize ? inZoomOut : inZoomIn , &idealSize ) ;
|
ZoomWindowIdeal( (WindowRef)m_macWindow , maximize ? inZoomOut : inZoomIn , &idealSize ) ;
|
||||||
}
|
}
|
||||||
@@ -1157,8 +1165,12 @@ void wxTopLevelWindowMac::MacCreateRealWindow(
|
|||||||
{
|
{
|
||||||
WindowDefSpec customWindowDefSpec;
|
WindowDefSpec customWindowDefSpec;
|
||||||
customWindowDefSpec.defType = kWindowDefProcPtr;
|
customWindowDefSpec.defType = kWindowDefProcPtr;
|
||||||
customWindowDefSpec.u.defProc = NewWindowDefUPP(wxShapedMacWindowDef);
|
customWindowDefSpec.u.defProc =
|
||||||
|
#ifdef __LP64__
|
||||||
|
(WindowDefUPP) wxShapedMacWindowDef;
|
||||||
|
#else
|
||||||
|
NewWindowDefUPP(wxShapedMacWindowDef);
|
||||||
|
#endif
|
||||||
err = ::CreateCustomWindow( &customWindowDefSpec, wclass,
|
err = ::CreateCustomWindow( &customWindowDefSpec, wclass,
|
||||||
attr, &theBoundsRect,
|
attr, &theBoundsRect,
|
||||||
(WindowRef*) &m_macWindow);
|
(WindowRef*) &m_macWindow);
|
||||||
@@ -1604,7 +1616,7 @@ bool wxTopLevelWindowMac::SetShape(const wxRegion& region)
|
|||||||
DisposeRgn(oldRgn);
|
DisposeRgn(oldRgn);
|
||||||
|
|
||||||
// Save the region so we can use it later
|
// Save the region so we can use it later
|
||||||
SetWRefCon((WindowRef)MacGetWindowRef(), (SInt32)shapeRegion);
|
SetWRefCon((WindowRef)MacGetWindowRef(), (URefCon)shapeRegion);
|
||||||
|
|
||||||
// inform the window manager that the window has changed shape
|
// inform the window manager that the window has changed shape
|
||||||
ReshapeCustomWindow((WindowRef)MacGetWindowRef());
|
ReshapeCustomWindow((WindowRef)MacGetWindowRef());
|
||||||
@@ -1620,13 +1632,12 @@ bool wxTopLevelWindowMac::SetShape(const wxRegion& region)
|
|||||||
static void wxShapedMacWindowGetPos(WindowRef window, Rect* inRect)
|
static void wxShapedMacWindowGetPos(WindowRef window, Rect* inRect)
|
||||||
{
|
{
|
||||||
GetWindowPortBounds(window, inRect);
|
GetWindowPortBounds(window, inRect);
|
||||||
Point pt = { inRect->left, inRect->top };
|
Point pt = { inRect->top ,inRect->left };
|
||||||
|
wxMacLocalToGlobal( window, &pt ) ;
|
||||||
QDLocalToGlobalPoint( GetWindowPort(window), &pt ) ;
|
inRect->bottom += pt.v - inRect->top;
|
||||||
|
inRect->right += pt.h - inRect->left;
|
||||||
inRect->top = pt.v;
|
inRect->top = pt.v;
|
||||||
inRect->left = pt.h;
|
inRect->left = pt.h;
|
||||||
inRect->bottom += pt.v;
|
|
||||||
inRect->right += pt.h;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static SInt32 wxShapedMacWindowGetFeatures(WindowRef window, SInt32 param)
|
static SInt32 wxShapedMacWindowGetFeatures(WindowRef window, SInt32 param)
|
||||||
|
Reference in New Issue
Block a user