LP64 additions
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@46051 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -84,19 +84,24 @@ public:
|
||||
|
||||
// Mac-specific, risks to change, don't use in portable code
|
||||
|
||||
#ifndef __LP64__
|
||||
// 'old' Quickdraw accessors
|
||||
|
||||
short MacGetFontNum() const;
|
||||
short MacGetFontSize() const;
|
||||
wxByte MacGetFontStyle() const;
|
||||
|
||||
// 'new' ATSUI accessors
|
||||
|
||||
wxUint32 MacGetATSUFontID() const;
|
||||
wxUint32 MacGetATSUAdditionalQDStyles() const;
|
||||
wxUint16 MacGetThemeFontID() const ;
|
||||
|
||||
// Returns an ATSUStyle not ATSUStyle*
|
||||
void* MacGetATSUStyle() const ;
|
||||
#else
|
||||
const void * MacGetCTFont() const;
|
||||
// soon to be removed for 64bit, Returns an ATSUStyle not ATSUStyle*
|
||||
void* MacGetATSUStyle() const ;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
void Unshare();
|
||||
|
@@ -1227,7 +1227,11 @@ public:
|
||||
|
||||
// returns a Pict from the bitmap content
|
||||
PicHandle GetPictHandle();
|
||||
#ifdef __LP64__
|
||||
CGContextRef GetHBITMAP(CGContextRef * mask = NULL ) const;
|
||||
#else
|
||||
GWorldPtr GetHBITMAP(GWorldPtr * mask = NULL ) const;
|
||||
#endif
|
||||
void UpdateAlphaMask() const;
|
||||
|
||||
private :
|
||||
@@ -1247,10 +1251,15 @@ private :
|
||||
#endif
|
||||
IconRef m_iconRef;
|
||||
PicHandle m_pictHandle;
|
||||
GWorldPtr m_hBitmap;
|
||||
GWorldPtr m_hMaskBitmap;
|
||||
wxMemoryBuffer m_maskMemBuf;
|
||||
int m_maskBytesPerRow;
|
||||
#ifdef __LP64__
|
||||
CGContextRef m_hBitmap;
|
||||
CGContextRef m_hMaskBitmap;
|
||||
#else
|
||||
GWorldPtr m_hBitmap;
|
||||
GWorldPtr m_hMaskBitmap;
|
||||
#endif
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxIconRefData : public wxGDIRefData
|
||||
|
@@ -204,6 +204,9 @@ bool wxBitmapRefData::Create( int w , int h , int d )
|
||||
verify_noerr( NewGWorldFromPtr( (GWorldPtr*) &m_hBitmap , k32ARGBPixelFormat , &rect , NULL , NULL , 0 ,
|
||||
(char*) data , m_bytesPerRow ) ) ;
|
||||
wxASSERT_MSG( m_hBitmap , wxT("Unable to create GWorld context") ) ;
|
||||
#else
|
||||
m_hBitmap = CGBitmapContextCreate((char*) data, m_width, m_height, 8, m_bytesPerRow, wxMacGetGenericRGBColorSpace(), kCGImageAlphaNoneSkipFirst );
|
||||
wxASSERT_MSG( m_hBitmap , wxT("Unable to create CGBitmapContext context") ) ;
|
||||
#endif
|
||||
m_ok = ( m_hBitmap != NULL ) ;
|
||||
|
||||
@@ -307,14 +310,16 @@ IconRef wxBitmapRefData::GetIconRef()
|
||||
|
||||
IconFamilyHandle iconFamily = NULL ;
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
if ( UMAGetSystemVersion() < 0x1040 )
|
||||
{
|
||||
iconFamily = (IconFamilyHandle) NewHandle( 8 ) ;
|
||||
(**iconFamily).resourceType = kIconFamilyType ;
|
||||
(**iconFamily).resourceSize = sizeof(OSType) + sizeof(Size);
|
||||
#else
|
||||
// test this solution on big endian as well
|
||||
}
|
||||
else
|
||||
{
|
||||
iconFamily = (IconFamilyHandle) NewHandle( 0 ) ;
|
||||
#endif
|
||||
}
|
||||
|
||||
int w = GetWidth() ;
|
||||
int h = GetHeight() ;
|
||||
@@ -326,23 +331,39 @@ IconRef wxBitmapRefData::GetIconRef()
|
||||
switch (sz)
|
||||
{
|
||||
case 128:
|
||||
#if 0 // for later
|
||||
dataType = kIconServices128PixelDataARGB ;
|
||||
#else
|
||||
dataType = kThumbnail32BitData ;
|
||||
maskType = kThumbnail8BitMask ;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 48:
|
||||
#if 0 // for later
|
||||
dataType = kIconServices48PixelDataARGB ;
|
||||
#else
|
||||
dataType = kHuge32BitData ;
|
||||
maskType = kHuge8BitMask ;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 32:
|
||||
#if 0 // for later
|
||||
dataType = kIconServices32PixelDataARGB ;
|
||||
#else
|
||||
dataType = kLarge32BitData ;
|
||||
maskType = kLarge8BitMask ;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 16:
|
||||
#if 0 // for later
|
||||
dataType = kIconServices16PixelDataARGB ;
|
||||
#else
|
||||
dataType = kSmall32BitData ;
|
||||
maskType = kSmall8BitMask ;
|
||||
#endif
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -351,6 +372,13 @@ IconRef wxBitmapRefData::GetIconRef()
|
||||
|
||||
if ( dataType != 0 )
|
||||
{
|
||||
#if 0 // for later
|
||||
Handle data = NULL ;
|
||||
PtrToHand(GetRawAccess(), &data, sz * sz * 4);
|
||||
OSStatus err = SetIconFamilyData( iconFamily, dataType , data );
|
||||
wxASSERT_MSG( err == noErr , wxT("Error when adding bitmap") );
|
||||
DisposeHandle( data );
|
||||
#else
|
||||
// setup the header properly
|
||||
|
||||
Handle data = NULL ;
|
||||
@@ -418,6 +446,7 @@ IconRef wxBitmapRefData::GetIconRef()
|
||||
HUnlock( maskdata ) ;
|
||||
DisposeHandle( data ) ;
|
||||
DisposeHandle( maskdata ) ;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -633,7 +662,11 @@ CGImageRef wxBitmapRefData::CGImageCreate() const
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef __LP64__
|
||||
GWorldPtr wxBitmapRefData::GetHBITMAP(GWorldPtr* mask) const
|
||||
#else
|
||||
CGContextRef wxBitmapRefData::GetHBITMAP(CGContextRef* mask) const
|
||||
#endif
|
||||
{
|
||||
wxCHECK_MSG( Ok(), NULL, wxT("invalid bitmap") );
|
||||
if ( mask )
|
||||
@@ -641,7 +674,13 @@ GWorldPtr wxBitmapRefData::GetHBITMAP(GWorldPtr* mask) const
|
||||
*mask = NULL ;
|
||||
if ( m_bitmapMask )
|
||||
{
|
||||
*mask = (GWorldPtr) m_bitmapMask->GetHBITMAP() ;
|
||||
*mask =
|
||||
#ifndef __LP64__
|
||||
(GWorldPtr)
|
||||
#else
|
||||
(CGContextRef)
|
||||
#endif
|
||||
m_bitmapMask->GetHBITMAP() ;
|
||||
}
|
||||
else if ( m_hasAlpha )
|
||||
{
|
||||
@@ -711,19 +750,27 @@ void wxBitmapRefData::Free()
|
||||
KillPicture( m_pictHandle ) ;
|
||||
m_pictHandle = NULL ;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( m_hBitmap )
|
||||
{
|
||||
#ifndef __LP64__
|
||||
DisposeGWorld( MAC_WXHBITMAP(m_hBitmap) ) ;
|
||||
#else
|
||||
CGContextRelease(m_hBitmap);
|
||||
#endif
|
||||
m_hBitmap = NULL ;
|
||||
}
|
||||
|
||||
if ( m_hMaskBitmap )
|
||||
{
|
||||
#ifndef __LP64__
|
||||
DisposeGWorld( MAC_WXHBITMAP(m_hMaskBitmap) ) ;
|
||||
#else
|
||||
CGContextRelease(m_hMaskBitmap);
|
||||
#endif
|
||||
m_hMaskBitmap = NULL ;
|
||||
}
|
||||
#endif
|
||||
if (m_bitmapMask)
|
||||
{
|
||||
delete m_bitmapMask;
|
||||
@@ -1098,6 +1145,8 @@ wxBitmap::wxBitmap(const wxImage& image, int depth)
|
||||
|
||||
unsigned char* destination = (unsigned char*) BeginRawAccess() ;
|
||||
register unsigned char* data = image.GetData();
|
||||
if ( destination != NULL && data != NULL )
|
||||
{
|
||||
const unsigned char *alpha = hasAlpha ? image.GetAlpha() : NULL ;
|
||||
|
||||
for (int y = 0; y < height; y++)
|
||||
@@ -1130,6 +1179,7 @@ wxBitmap::wxBitmap(const wxImage& image, int depth)
|
||||
}
|
||||
|
||||
EndRawAccess() ;
|
||||
}
|
||||
if ( image.HasMask() )
|
||||
SetMask( new wxMask( *this , wxColour( image.GetMaskRed() , image.GetMaskGreen() , image.GetMaskBlue() ) ) ) ;
|
||||
}
|
||||
@@ -1361,7 +1411,11 @@ void wxBitmap::SetMask(wxMask *mask)
|
||||
|
||||
WXHBITMAP wxBitmap::GetHBITMAP(WXHBITMAP* mask) const
|
||||
{
|
||||
#ifdef __LP64__
|
||||
return WXHBITMAP(M_BITMAPDATA->GetHBITMAP((CGContextRef*)mask));
|
||||
#else
|
||||
return WXHBITMAP(M_BITMAPDATA->GetHBITMAP((GWorldPtr*)mask));
|
||||
#endif
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@@ -297,7 +297,7 @@ wxMacCoreGraphicsPenData::wxMacCoreGraphicsPenData( wxGraphicsRenderer* renderer
|
||||
{
|
||||
Init();
|
||||
|
||||
float components[4] = { pen.GetColour().Red() / 255.0 , pen.GetColour().Green() / 255.0 ,
|
||||
CGFloat components[4] = { pen.GetColour().Red() / 255.0 , pen.GetColour().Green() / 255.0 ,
|
||||
pen.GetColour().Blue() / 255.0 , pen.GetColour().Alpha() / 255.0 } ;
|
||||
m_color.Set( CGColorCreate( wxMacGetGenericRGBColorSpace() , components ) ) ;
|
||||
|
||||
@@ -553,14 +553,14 @@ wxMacCoreGraphicsBrushData::wxMacCoreGraphicsBrushData(wxGraphicsRenderer* rende
|
||||
// as close as we can get, unfortunately < 10.4 things get difficult
|
||||
RGBColor color;
|
||||
GetThemeBrushAsColor( brush.MacGetTheme(), 32, true, &color );
|
||||
float components[4] = { (CGFloat) color.red / 65536,
|
||||
CGFloat components[4] = { (CGFloat) color.red / 65536,
|
||||
(CGFloat) color.green / 65536, (CGFloat) color.blue / 65536, 1 } ;
|
||||
m_color.Set( CGColorCreate( wxMacGetGenericRGBColorSpace() , components ) ) ;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
float components[4] = { brush.GetColour().Red() / 255.0 , brush.GetColour().Green() / 255.0 ,
|
||||
CGFloat components[4] = { brush.GetColour().Red() / 255.0 , brush.GetColour().Green() / 255.0 ,
|
||||
brush.GetColour().Blue() / 255.0 , brush.GetColour().Alpha() / 255.0 } ;
|
||||
m_color.Set( CGColorCreate( wxMacGetGenericRGBColorSpace() , components ) ) ;
|
||||
}
|
||||
@@ -697,7 +697,7 @@ wxMacCoreGraphicsFontData::wxMacCoreGraphicsFontData(wxGraphicsRenderer* rendere
|
||||
|
||||
// we need the scale here ...
|
||||
|
||||
Fixed atsuSize = IntToFixed( int( 1 * font.MacGetFontSize()) );
|
||||
Fixed atsuSize = IntToFixed( int( 1 * font.GetPointSize()) );
|
||||
RGBColor atsuColor = MAC_WXCOLORREF( col.GetPixel() );
|
||||
ATSUAttributeTag atsuTags[] =
|
||||
{
|
||||
@@ -1320,7 +1320,12 @@ void wxMacCoreGraphicsContext::EnsureIsValid()
|
||||
{
|
||||
if ( !m_cgContext )
|
||||
{
|
||||
OSStatus status = QDBeginCGContext( GetWindowPort( m_windowRef ) , &m_cgContext );
|
||||
OSStatus status =
|
||||
#ifndef __LP64__
|
||||
QDBeginCGContext( GetWindowPort( m_windowRef ) , &m_cgContext );
|
||||
#else
|
||||
paramErr;
|
||||
#endif
|
||||
wxASSERT_MSG( status == noErr , wxT("Cannot nest wxDCs on the same window") );
|
||||
|
||||
CGContextConcatCTM( m_cgContext, m_windowTransform );
|
||||
@@ -1551,7 +1556,11 @@ void wxMacCoreGraphicsContext::SetNativeContext( CGContextRef cg )
|
||||
CGContextRestoreGState( m_cgContext );
|
||||
CGContextRestoreGState( m_cgContext );
|
||||
if ( m_releaseContext )
|
||||
{
|
||||
#ifndef __LP64__
|
||||
QDEndCGContext( GetWindowPort( m_windowRef ) , &m_cgContext);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
CGContextRelease(m_cgContext);
|
||||
}
|
||||
|
@@ -2667,7 +2667,9 @@ void wxMacDataBrowserListCtrlControl::DrawItem(
|
||||
Rect enclosingRect;
|
||||
CGRect enclosingCGRect, iconCGRect, textCGRect;
|
||||
Boolean active;
|
||||
#ifndef __LP64__
|
||||
ThemeDrawingState savedState = NULL;
|
||||
#endif
|
||||
CGContextRef context = (CGContextRef)list->MacGetDrawingContext();
|
||||
RGBColor labelColor;
|
||||
labelColor.red = 0;
|
||||
@@ -2698,8 +2700,9 @@ void wxMacDataBrowserListCtrlControl::DrawItem(
|
||||
}
|
||||
if (itemState == kDataBrowserItemIsSelected)
|
||||
{
|
||||
|
||||
#ifndef __LP64__
|
||||
GetThemeDrawingState(&savedState);
|
||||
#endif
|
||||
|
||||
if (active && hasFocus)
|
||||
{
|
||||
@@ -2763,19 +2766,29 @@ void wxMacDataBrowserListCtrlControl::DrawItem(
|
||||
}
|
||||
|
||||
HIThemeTextHorizontalFlush hFlush = kHIThemeTextHorizontalFlushLeft;
|
||||
UInt16 fontID = kThemeViewsFont;
|
||||
HIThemeTextInfo info;
|
||||
|
||||
#ifdef __LP64__
|
||||
info.version = kHIThemeTextInfoVersionOne;
|
||||
info.fontID = kThemeViewsFont;
|
||||
if (font.Ok())
|
||||
{
|
||||
info.fontID = kThemeSpecifiedFont;
|
||||
info.font = (CTFontRef) font.MacGetCTFont();
|
||||
}
|
||||
#else
|
||||
info.version = kHIThemeTextInfoVersionZero;
|
||||
info.fontID = kThemeViewsFont;
|
||||
|
||||
if (font.Ok())
|
||||
{
|
||||
if (font.GetFamily() != wxFONTFAMILY_DEFAULT)
|
||||
fontID = font.MacGetThemeFontID();
|
||||
info.fontID = font.MacGetThemeFontID();
|
||||
|
||||
// FIXME: replace these with CG or ATSUI calls so we can remove this #ifndef.
|
||||
#ifndef __LP64__
|
||||
::TextSize( (short)(font.MacGetFontSize()) ) ;
|
||||
::TextFace( font.MacGetFontStyle() ) ;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
wxListItem item;
|
||||
list->GetColumn(listColumn, item);
|
||||
@@ -2792,10 +2805,7 @@ void wxMacDataBrowserListCtrlControl::DrawItem(
|
||||
}
|
||||
}
|
||||
|
||||
HIThemeTextInfo info;
|
||||
info.version = kHIThemeTextInfoVersionZero;
|
||||
info.state = active ? kThemeStateActive : kThemeStateInactive;
|
||||
info.fontID = fontID;
|
||||
info.horizontalFlushness = hFlush;
|
||||
info.verticalFlushness = kHIThemeTextVerticalFlushCenter;
|
||||
info.options = kHIThemeTextBoxOptionNone;
|
||||
@@ -2811,8 +2821,10 @@ void wxMacDataBrowserListCtrlControl::DrawItem(
|
||||
|
||||
CGContextRestoreGState(context);
|
||||
|
||||
#ifndef __LP64__
|
||||
if (savedState != NULL)
|
||||
SetThemeDrawingState(savedState, true);
|
||||
#endif
|
||||
}
|
||||
|
||||
OSStatus wxMacDataBrowserListCtrlControl::GetSetItemData(DataBrowserItemID itemID,
|
||||
|
@@ -57,6 +57,14 @@
|
||||
#include <QuickTime/QuickTimeComponents.h>
|
||||
#endif
|
||||
|
||||
#if !defined(__DARWIN__) || !defined(__LP64__)
|
||||
#define USE_QUICKTIME 1
|
||||
#else
|
||||
#define USE_QUICKTIME 0
|
||||
#endif
|
||||
|
||||
#if USE_QUICKTIME
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Height and Width of movie controller in the movie control (apple samples)
|
||||
//---------------------------------------------------------------------------
|
||||
@@ -1226,6 +1234,8 @@ pascal OSStatus wxQTMediaBackend::WindowEventHandler(
|
||||
return eventNotHandledErr;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// in source file that contains stuff you don't directly use
|
||||
#include "wx/html/forcelnk.h"
|
||||
FORCE_LINK_ME(basewxmediabackends)
|
||||
|
@@ -79,6 +79,13 @@
|
||||
static wxTimer* lastSoundTimer=NULL;
|
||||
static bool lastSoundIsPlaying=false;
|
||||
|
||||
#if !defined(__DARWIN__) || !defined(__LP64__)
|
||||
#define USE_QUICKTIME 1
|
||||
#else
|
||||
#define USE_QUICKTIME 0
|
||||
#endif
|
||||
|
||||
#if USE_QUICKTIME
|
||||
// ------------------------------------------------------------------
|
||||
// wxQTTimer - Handle Asyncronous Playing
|
||||
// ------------------------------------------------------------------
|
||||
@@ -244,6 +251,8 @@ inline bool wxInitQT ()
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
wxSound::wxSound()
|
||||
: m_hSnd(NULL), m_waveLength(0), m_pTimer(NULL), m_type(wxSound_NONE)
|
||||
{
|
||||
@@ -296,6 +305,8 @@ bool wxSound::DoPlay(unsigned flags) const
|
||||
{
|
||||
Stop();
|
||||
|
||||
#if USE_QUICKTIME
|
||||
|
||||
Movie movie;
|
||||
|
||||
switch(m_type)
|
||||
@@ -439,6 +450,7 @@ bool wxSound::DoPlay(unsigned flags) const
|
||||
|
||||
DisposeMovie(movie);
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -460,10 +472,13 @@ void wxSound::Stop()
|
||||
|
||||
void* wxSound::GetHandle()
|
||||
{
|
||||
#if USE_QUICKTIME
|
||||
if(m_type == wxSound_RESOURCE)
|
||||
return (void*) ((wxSMTimer*)m_pTimer)->GetChannel();
|
||||
|
||||
return (void*) ((wxQTTimer*) m_pTimer)->GetMovie();
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif //wxUSE_SOUND
|
||||
|
@@ -96,6 +96,7 @@ wxSize wxStaticText::DoGetBestSize() const
|
||||
SInt16 baseline;
|
||||
wxMacCFStringHolder str( m_label, m_font.GetEncoding() );
|
||||
|
||||
#ifndef __LP64__
|
||||
if ( m_font.MacGetThemeFontID() != kThemeCurrentPortFont )
|
||||
{
|
||||
err = GetThemeTextDimensions(
|
||||
@@ -104,6 +105,7 @@ wxSize wxStaticText::DoGetBestSize() const
|
||||
verify_noerr( err );
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
#if wxMAC_USE_CORE_GRAPHICS
|
||||
wxClientDC dc(const_cast<wxStaticText*>(this));
|
||||
|
@@ -1002,6 +1002,7 @@ void wxMacControl::SuperChangedPosition()
|
||||
void wxMacControl::SetFont( const wxFont & font , const wxColour& foreground , long windowStyle )
|
||||
{
|
||||
m_font = font;
|
||||
#ifndef __LP64__
|
||||
ControlFontStyleRec fontStyle;
|
||||
if ( font.MacGetThemeFontID() != kThemeCurrentPortFont )
|
||||
{
|
||||
@@ -1052,6 +1053,7 @@ void wxMacControl::SetFont( const wxFont & font , const wxColour& foreground , l
|
||||
}
|
||||
|
||||
::SetControlFontStyle( m_controlRef , &fontStyle );
|
||||
#endif
|
||||
}
|
||||
|
||||
void wxMacControl::SetBackground( const wxBrush &WXUNUSED(brush) )
|
||||
|
Reference in New Issue
Block a user