git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54845
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
15 files changed:
-#define wxMAC_USE_PREMULTIPLIED_ALPHA 1
+#define wxOSX_USE_PREMULTIPLIED_ALPHA 1
static const int kBestByteAlignement = 16;
static const int kMaskBytesPerPixel = 1;
static const int kBestByteAlignement = 16;
static const int kMaskBytesPerPixel = 1;
-#if wxMAC_USE_PREMULTIPLIED_ALPHA
+#if wxOSX_USE_PREMULTIPLIED_ALPHA
// this must be non-premultiplied data
if ( a != 0xFF && a!= 0 )
{
// this must be non-premultiplied data
if ( a != 0xFF && a!= 0 )
{
-#if wxMAC_USE_PREMULTIPLIED_ALPHA
+#if wxOSX_USE_PREMULTIPLIED_ALPHA
alphaInfo = kCGImageAlphaPremultipliedFirst ;
#else
alphaInfo = kCGImageAlphaFirst ;
alphaInfo = kCGImageAlphaPremultipliedFirst ;
#else
alphaInfo = kCGImageAlphaFirst ;
unsigned char a = *sourcemask++;
*destination++ = a;
source++ ;
unsigned char a = *sourcemask++;
*destination++ = a;
source++ ;
-#if wxMAC_USE_PREMULTIPLIED_ALPHA
+#if wxOSX_USE_PREMULTIPLIED_ALPHA
*destination++ = ( (*source++) * a + 127 ) / 255;
*destination++ = ( (*source++) * a + 127 ) / 255;
*destination++ = ( (*source++) * a + 127 ) / 255;
*destination++ = ( (*source++) * a + 127 ) / 255;
*destination++ = ( (*source++) * a + 127 ) / 255;
*destination++ = ( (*source++) * a + 127 ) / 255;
const unsigned char a = *alpha++;
*destination++ = a ;
const unsigned char a = *alpha++;
*destination++ = a ;
- #if wxMAC_USE_PREMULTIPLIED_ALPHA
+ #if wxOSX_USE_PREMULTIPLIED_ALPHA
*destination++ = ((*data++) * a + 127) / 255 ;
*destination++ = ((*data++) * a + 127) / 255 ;
*destination++ = ((*data++) * a + 127) / 255 ;
*destination++ = ((*data++) * a + 127) / 255 ;
*destination++ = ((*data++) * a + 127) / 255 ;
*destination++ = ((*data++) * a + 127) / 255 ;
else if ( hasAlpha )
{
*alpha++ = a ;
else if ( hasAlpha )
{
*alpha++ = a ;
-#if wxMAC_USE_PREMULTIPLIED_ALPHA
+#if wxOSX_USE_PREMULTIPLIED_ALPHA
// this must be non-premultiplied data
if ( a != 0xFF && a!= 0 )
{
// this must be non-premultiplied data
if ( a != 0xFF && a!= 0 )
{
wxCFStringRef str( m_label, GetFont().GetEncoding() );
wxCFStringRef str( m_label, GetFont().GetEncoding() );
SInt16 baseline;
if ( m_font.MacGetThemeFontID() != kThemeCurrentPortFont )
{
SInt16 baseline;
if ( m_font.MacGetThemeFontID() != kThemeCurrentPortFont )
{
IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject)
wxColour::wxColour(const RGBColor& col)
{
InitRGBColor(col);
wxColour::wxColour(const RGBColor& col)
{
InitRGBColor(col);
void wxColour::GetRGBColor( RGBColor *col ) const
{
col->red = (m_red << 8) + m_red;
void wxColour::GetRGBColor( RGBColor *col ) const
{
col->red = (m_red << 8) + m_red;
m_cgColour.reset( col );
}
m_cgColour.reset( col );
}
void wxColour::InitRGBColor( const RGBColor& col )
{
m_red = col.red >> 8;
void wxColour::InitRGBColor( const RGBColor& col )
{
m_red = col.red >> 8;
-#if wxMAC_USE_RUN_APP_EVENT_LOOP
+#if wxOSX_USE_RUN_APP_EVENT_LOOP
int wxGUIEventLoop::Run()
{
int wxGUIEventLoop::Run()
{
Init(size, family, style, weight, underlined, faceName, encoding);
}
Init(size, family, style, weight, underlined, faceName, encoding);
}
wxFontRefData( wxUint32 coreTextFontType );
wxFontRefData( CTFontRef font );
wxFontRefData( CTFontDescriptorRef fontdescriptor, int size );
wxFontRefData( wxUint32 coreTextFontType );
wxFontRefData( CTFontRef font );
wxFontRefData( CTFontDescriptorRef fontdescriptor, int size );
const wxString& faceName,
wxFontEncoding encoding);
const wxString& faceName,
wxFontEncoding encoding);
void Init( CTFontRef font );
#endif
// font characterstics
void Init( CTFontRef font );
#endif
// font characterstics
bool m_noAA; // No anti-aliasing
public:
bool m_noAA; // No anti-aliasing
public:
FMFontFamily m_macFontFamily;
FMFontSize m_macFontSize;
FMFontStyle m_macFontStyle;
FMFontFamily m_macFontFamily;
FMFontSize m_macFontSize;
FMFontStyle m_macFontStyle;
// information here, as this speeds up and optimizes rendering
ThemeFontID m_macThemeFontID ;
#endif
// information here, as this speeds up and optimizes rendering
ThemeFontID m_macThemeFontID ;
#endif
wxCFRef<CTFontRef> m_ctFont;
wxCFRef<CTFontDescriptorRef> m_ctFontDescriptor;
#endif
wxCFRef<CTFontRef> m_ctFont;
wxCFRef<CTFontDescriptorRef> m_ctFontDescriptor;
#endif
-#if wxMAC_USE_CORE_TEXT || wxMAC_USE_ATSU_TEXT
+#if wxOSX_USE_CORE_TEXT || wxOSX_USE_ATSU_TEXT
ATSUStyle m_macATSUStyle ;
#endif
wxNativeFontInfo m_info;
ATSUStyle m_macATSUStyle ;
#endif
wxNativeFontInfo m_info;
m_faceName = faceName;
m_encoding = encoding;
m_noAA = false;
m_faceName = faceName;
m_encoding = encoding;
m_noAA = false;
m_macFontFamily = 0 ;
m_macFontSize = 0;
m_macFontStyle = 0;
m_macFontFamily = 0 ;
m_macFontSize = 0;
m_macFontStyle = 0;
m_macATSUAdditionalQDStyles = 0 ;
m_macThemeFontID = kThemeCurrentPortFont ;
#endif
m_macATSUAdditionalQDStyles = 0 ;
m_macThemeFontID = kThemeCurrentPortFont ;
#endif
-#if wxMAC_USE_CORE_TEXT || wxMAC_USE_ATSU_TEXT
+#if wxOSX_USE_CORE_TEXT || wxOSX_USE_ATSU_TEXT
m_macATSUStyle = NULL ;
#endif
}
wxFontRefData::~wxFontRefData()
{
m_macATSUStyle = NULL ;
#endif
}
wxFontRefData::~wxFontRefData()
{
-#if wxMAC_USE_CORE_TEXT || wxMAC_USE_ATSU_TEXT
+#if wxOSX_USE_CORE_TEXT || wxOSX_USE_ATSU_TEXT
if ( m_macATSUStyle )
{
::ATSUDisposeStyle((ATSUStyle)m_macATSUStyle);
if ( m_macATSUStyle )
{
::ATSUDisposeStyle((ATSUStyle)m_macATSUStyle);
void wxFontRefData::MacInvalidateNativeFont()
{
void wxFontRefData::MacInvalidateNativeFont()
{
m_ctFont.reset();
m_ctFontDescriptor.reset();
#endif
m_ctFont.reset();
m_ctFontDescriptor.reset();
#endif
-#if wxMAC_USE_CORE_TEXT || wxMAC_USE_ATSU_TEXT
+#if wxOSX_USE_CORE_TEXT || wxOSX_USE_ATSU_TEXT
if ( m_macATSUStyle )
{
::ATSUDisposeStyle((ATSUStyle)m_macATSUStyle);
if ( m_macATSUStyle )
{
::ATSUDisposeStyle((ATSUStyle)m_macATSUStyle);
/* from Core Text Manual Common Operations */
/* from Core Text Manual Common Operations */
void wxFontRefData::MacFindFont()
{
void wxFontRefData::MacFindFont()
{
if ( UMAGetSystemVersion() >= 0x1050 )
{
if ( m_faceName.empty() && m_family == wxDEFAULT )
if ( UMAGetSystemVersion() >= 0x1050 )
{
if ( m_faceName.empty() && m_family == wxDEFAULT )
OSStatus status = noErr;
CTFontDescriptorRef desc = m_ctFontDescriptor ;
ATSFontRef atsfont = CTFontGetPlatformFont( m_ctFont, &desc );
OSStatus status = noErr;
CTFontDescriptorRef desc = m_ctFontDescriptor ;
ATSFontRef atsfont = CTFontGetPlatformFont( m_ctFont, &desc );
{
OSStatus status = noErr;
Str255 qdFontName ;
{
OSStatus status = noErr;
Str255 qdFontName ;
bool wxFont::MacCreateFromUIFont(wxUint32 ctFontType )
{
bool wxFont::MacCreateFromUIFont(wxUint32 ctFontType )
{
bool wxFont::MacCreateFromThemeFont(wxUint16 themeFontID)
{
bool wxFont::MacCreateFromThemeFont(wxUint16 themeFontID)
{
if ( UMAGetSystemVersion() >= 0x1050)
{
return MacCreateFromUIFont(HIThemeGetUIFontType(themeFontID));
}
#endif
if ( UMAGetSystemVersion() >= 0x1050)
{
return MacCreateFromUIFont(HIThemeGetUIFontType(themeFontID));
}
#endif
return M_FONTDATA->GetNoAntiAliasing();
}
return M_FONTDATA->GetNoAntiAliasing();
}
short wxFont::MacGetFontNum() const
{
short wxFont::MacGetFontNum() const
{
-#if wxMAC_USE_CORE_TEXT || wxMAC_USE_ATSU_TEXT
+#if wxOSX_USE_CORE_TEXT || wxOSX_USE_ATSU_TEXT
void * wxFont::MacGetATSUStyle() const
{
wxCHECK_MSG( M_FONTDATA != NULL , NULL, wxT("invalid font") );
void * wxFont::MacGetATSUStyle() const
{
wxCHECK_MSG( M_FONTDATA != NULL , NULL, wxT("invalid font") );
const void * wxFont::MacGetCTFont() const
{
const void * wxFont::MacGetCTFont() const
{
-#if wxMAC_USE_EXPERIMENTAL_FONTDIALOG
+#if wxOSX_USE_EXPERIMENTAL_FONTDIALOG
IMPLEMENT_DYNAMIC_CLASS(wxFontDialog, wxDialog)
IMPLEMENT_DYNAMIC_CLASS(wxFontDialog, wxDialog)
case kEventFontSelection :
{
bool setup = false ;
case kEventFontSelection :
{
bool setup = false ;
if ( UMAGetSystemVersion() >= 0x1050 )
{
CTFontDescriptorRef descr;
if ( UMAGetSystemVersion() >= 0x1050 )
{
CTFontDescriptorRef descr;
ATSUFontID fontId = 0 ;
if ( !setup && (cEvent.GetParameter<ATSUFontID>(kEventParamATSUFontID, &fontId) == noErr) )
{
ATSUFontID fontId = 0 ;
if ( !setup && (cEvent.GetParameter<ATSUFontID>(kEventParamATSUFontID, &fontId) == noErr) )
{
fontdata.m_chosenFont.SetWeight(fontStyle & bold ? wxFONTWEIGHT_BOLD : wxFONTWEIGHT_NORMAL);
}
}
fontdata.m_chosenFont.SetWeight(fontStyle & bold ? wxFONTWEIGHT_BOLD : wxFONTWEIGHT_NORMAL);
}
}
-#endif // wxMAC_USE_ATSU_TEXT
+#endif // wxOSX_USE_ATSU_TEXT
// retrieving the color
RGBColor fontColor ;
// retrieving the color
RGBColor fontColor ;
if ( UMAGetSystemVersion() >= 0x1050 )
{
CTFontDescriptorRef descr = (CTFontDescriptorRef)font.MacGetCTFontDescriptor();
if ( UMAGetSystemVersion() >= 0x1050 )
{
CTFontDescriptorRef descr = (CTFontDescriptorRef)font.MacGetCTFontDescriptor();
if ( !setup )
{
ATSUStyle style = (ATSUStyle)font.MacGetATSUStyle();
if ( !setup )
{
ATSUStyle style = (ATSUStyle)font.MacGetATSUStyle();
#endif // !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
#endif // !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
-#endif // wxMAC_USE_EXPERIMENTAL_FONTDIALOG
+#endif // wxOSX_USE_EXPERIMENTAL_FONTDIALOG
#include "wx/cocoa/autorelease.h"
#include "wx/cocoa/string.h"
#include "wx/cocoa/autorelease.h"
#include "wx/cocoa/string.h"
-#if wxMAC_USE_EXPERIMENTAL_FONTDIALOG
+#if wxOSX_USE_EXPERIMENTAL_FONTDIALOG
#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>
#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>
wxArrayString fontFamilies ;
wxArrayString fontFamilies ;
-#if wxMAC_USE_ATSU_TEXT || wxMAC_USE_CORE_TEXT
+#if wxOSX_USE_ATSU_TEXT || wxOSX_USE_CORE_TEXT
//
// From Apple's QA 1471 http://developer.apple.com/qa/qa2006/qa1471.html
//
// From Apple's QA 1471 http://developer.apple.com/qa/qa2006/qa1471.html
-#if !wxMAC_USE_NATIVE_TOOLBAR
+#if !wxOSX_USE_NATIVE_TOOLBAR
-#if !wxMAC_USE_NATIVE_TOOLBAR
+#if !wxOSX_USE_NATIVE_TOOLBAR
if ( m_frameToolBar == toolbar )
return ;
if ( m_frameToolBar == toolbar )
return ;
-#if wxMAC_USE_NATIVE_TOOLBAR
+#if wxOSX_USE_NATIVE_TOOLBAR
if ( m_frameToolBar )
m_frameToolBar->MacInstallNativeToolbar( false ) ;
#endif
m_frameToolBar = toolbar ;
if ( m_frameToolBar )
m_frameToolBar->MacInstallNativeToolbar( false ) ;
#endif
m_frameToolBar = toolbar ;
-#if wxMAC_USE_NATIVE_TOOLBAR
+#if wxOSX_USE_NATIVE_TOOLBAR
if ( toolbar )
toolbar->MacInstallNativeToolbar( true ) ;
#endif
if ( toolbar )
toolbar->MacInstallNativeToolbar( true ) ;
#endif
-#if !wxMAC_USE_NATIVE_TOOLBAR
+#if !wxOSX_USE_NATIVE_TOOLBAR
// Use the 'real' position
GetToolBar()->SetSize(tx , ty , cw , th, wxSIZE_NO_ADJUSTMENTS );
#endif
// Use the 'real' position
GetToolBar()->SetSize(tx , ty , cw , th, wxSIZE_NO_ADJUSTMENTS );
#endif
-#define wxMAC_USE_CORE_TEXT 1
+#define wxOSX_USE_CORE_TEXT 1
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 && wxMAC_USE_CORE_TEXT
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 && wxOSX_USE_CORE_TEXT
CTFontRef wxMacCreateCTFont( const wxFont& font )
{
CTFontRef wxMacCreateCTFont( const wxFont& font )
{
wxMacCoreGraphicsFontData( wxGraphicsRenderer* renderer, const wxFont &font, const wxColour& col );
~wxMacCoreGraphicsFontData();
wxMacCoreGraphicsFontData( wxGraphicsRenderer* renderer, const wxFont &font, const wxColour& col );
~wxMacCoreGraphicsFontData();
virtual ATSUStyle GetATSUStyle() { return m_macATSUIStyle; }
#endif
virtual ATSUStyle GetATSUStyle() { return m_macATSUIStyle; }
#endif
CTFontRef GetCTFont() const { return m_ctFont ; }
#endif
wxColour GetColour() const { return m_colour ; }
CTFontRef GetCTFont() const { return m_ctFont ; }
#endif
wxColour GetColour() const { return m_colour ; }
private :
wxColour m_colour;
bool m_underlined;
private :
wxColour m_colour;
bool m_underlined;
ATSUStyle m_macATSUIStyle;
#endif
ATSUStyle m_macATSUIStyle;
#endif
wxCFRef< CTFontRef > m_ctFont;
#endif
#if wxOSX_USE_IPHONE
wxCFRef< CTFontRef > m_ctFont;
#endif
#if wxOSX_USE_IPHONE
m_colour = col;
m_underlined = font.GetUnderlined();
m_colour = col;
m_underlined = font.GetUnderlined();
m_ctFont.reset( wxMacCreateCTFont( font ) );
#endif
#if wxOSX_USE_IPHONE
m_uiFont = CreateUIFont(font);
wxMacCocoaRetain( m_uiFont );
#endif
m_ctFont.reset( wxMacCreateCTFont( font ) );
#endif
#if wxOSX_USE_IPHONE
m_uiFont = CreateUIFont(font);
wxMacCocoaRetain( m_uiFont );
#endif
OSStatus status = noErr;
m_macATSUIStyle = NULL;
OSStatus status = noErr;
m_macATSUIStyle = NULL;
wxMacCoreGraphicsFontData::~wxMacCoreGraphicsFontData()
{
wxMacCoreGraphicsFontData::~wxMacCoreGraphicsFontData()
{
if ( m_macATSUIStyle )
{
::ATSUDisposeStyle((ATSUStyle)m_macATSUIStyle);
if ( m_macATSUIStyle )
{
::ATSUDisposeStyle((ATSUStyle)m_macATSUIStyle);
if ( UMAGetSystemVersion() >= 0x1050 )
{
wxMacCoreGraphicsFontData* fref = (wxMacCoreGraphicsFontData*)m_font.GetRefData();
if ( UMAGetSystemVersion() >= 0x1050 )
{
wxMacCoreGraphicsFontData* fref = (wxMacCoreGraphicsFontData*)m_font.GetRefData();
{
DrawText(str, x, y, 0.0);
return;
}
#endif
{
DrawText(str, x, y, 0.0);
return;
}
#endif
wxMacCoreGraphicsFontData* fref = (wxMacCoreGraphicsFontData*)m_font.GetRefData();
CGContextSaveGState(m_cgContext);
wxMacCoreGraphicsFontData* fref = (wxMacCoreGraphicsFontData*)m_font.GetRefData();
CGContextSaveGState(m_cgContext);
if ( UMAGetSystemVersion() >= 0x1050 )
{
// default implementation takes care of rotation and calls non rotated DrawText afterwards
if ( UMAGetSystemVersion() >= 0x1050 )
{
// default implementation takes care of rotation and calls non rotated DrawText afterwards
{
OSStatus status = noErr;
ATSUTextLayout atsuLayout;
{
OSStatus status = noErr;
ATSUTextLayout atsuLayout;
// default implementation takes care of rotation and calls non rotated DrawText afterwards
wxGraphicsContext::DrawText( str, x, y, angle );
#endif
// default implementation takes care of rotation and calls non rotated DrawText afterwards
wxGraphicsContext::DrawText( str, x, y, angle );
#endif
if ( UMAGetSystemVersion() >= 0x1050 )
{
wxMacCoreGraphicsFontData* fref = (wxMacCoreGraphicsFontData*)m_font.GetRefData();
if ( UMAGetSystemVersion() >= 0x1050 )
{
wxMacCoreGraphicsFontData* fref = (wxMacCoreGraphicsFontData*)m_font.GetRefData();
{
OSStatus status = noErr;
{
OSStatus status = noErr;
wxMacCoreGraphicsFontData* fref = (wxMacCoreGraphicsFontData*)m_font.GetRefData();
wxCFStringRef text(str, wxLocale::GetSystemEncoding() );
wxMacCoreGraphicsFontData* fref = (wxMacCoreGraphicsFontData*)m_font.GetRefData();
wxCFStringRef text(str, wxLocale::GetSystemEncoding() );
if (text.empty())
return;
if (text.empty())
return;
{
wxMacCoreGraphicsFontData* fref = (wxMacCoreGraphicsFontData*)m_font.GetRefData();
CTFontRef font = fref->GetCTFont();
{
wxMacCoreGraphicsFontData* fref = (wxMacCoreGraphicsFontData*)m_font.GetRefData();
CTFontRef font = fref->GetCTFont();
{
OSStatus status = noErr;
ATSUTextLayout atsuLayout;
{
OSStatus status = noErr;
ATSUTextLayout atsuLayout;
::ATSUDisposeTextLayout(atsuLayout);
}
#endif
::ATSUDisposeTextLayout(atsuLayout);
}
#endif
// TODO core graphics text implementation here
#endif
}
// TODO core graphics text implementation here
#endif
}
HIThemeTextHorizontalFlush hFlush = kHIThemeTextHorizontalFlushLeft;
HIThemeTextInfo info;
bool setup = false;
HIThemeTextHorizontalFlush hFlush = kHIThemeTextHorizontalFlushLeft;
HIThemeTextInfo info;
bool setup = false;
if ( UMAGetSystemVersion() >= 0x1050 )
{
info.version = kHIThemeTextInfoVersionOne;
if ( UMAGetSystemVersion() >= 0x1050 )
{
info.version = kHIThemeTextInfoVersionOne;
if ( !setup )
{
info.version = kHIThemeTextInfoVersionZero;
if ( !setup )
{
info.version = kHIThemeTextInfoVersionZero;
}
attr |= kWindowCompositingAttribute;
}
attr |= kWindowCompositingAttribute;
-#if 0 // wxOSX_USE_CORE_GRAPHICS ; TODO : decide on overall handling of high dpi screens (pixel vs userscale)
+#if 0 // TODO : decide on overall handling of high dpi screens (pixel vs userscale)
attr |= kWindowFrameworkScaledAttribute;
#endif
attr |= kWindowFrameworkScaledAttribute;
#endif
wxCFStringRef str( m_label, GetFont().GetEncoding() );
wxCFStringRef str( m_label, GetFont().GetEncoding() );
SInt16 baseline;
if ( m_font.MacGetThemeFontID() != kThemeCurrentPortFont )
{
SInt16 baseline;
if ( m_font.MacGetThemeFontID() != kThemeCurrentPortFont )
{
m_controlHandle = NULL ;
}
m_controlHandle = NULL ;
}
-#if wxMAC_USE_NATIVE_TOOLBAR
+#if wxOSX_USE_NATIVE_TOOLBAR
if ( m_toolbarItemRef )
{
CFIndex count = CFGetRetainCount( m_toolbarItemRef ) ;
if ( m_toolbarItemRef )
{
CFIndex count = CFGetRetainCount( m_toolbarItemRef ) ;
CFRelease(m_toolbarItemRef);
m_toolbarItemRef = NULL;
}
CFRelease(m_toolbarItemRef);
m_toolbarItemRef = NULL;
}
-#endif // wxMAC_USE_NATIVE_TOOLBAR
+#endif // wxOSX_USE_NATIVE_TOOLBAR
void UpdateToggleImage( bool toggle );
void UpdateToggleImage( bool toggle );
-#if wxMAC_USE_NATIVE_TOOLBAR
+#if wxOSX_USE_NATIVE_TOOLBAR
void SetToolbarItemRef( HIToolbarItemRef ref )
{
if ( m_controlHandle )
void SetToolbarItemRef( HIToolbarItemRef ref )
{
if ( m_controlHandle )
{
m_controlHandle = NULL;
{
m_controlHandle = NULL;
-#if wxMAC_USE_NATIVE_TOOLBAR
+#if wxOSX_USE_NATIVE_TOOLBAR
m_toolbarItemRef = NULL;
m_index = -1;
#endif
m_toolbarItemRef = NULL;
m_index = -1;
#endif
wxCoord m_x;
wxCoord m_y;
wxCoord m_x;
wxCoord m_y;
-#if wxMAC_USE_NATIVE_TOOLBAR
+#if wxOSX_USE_NATIVE_TOOLBAR
HIToolbarItemRef m_toolbarItemRef;
// position in its toolbar, -1 means not inserted
CFIndex m_index;
HIToolbarItemRef m_toolbarItemRef;
// position in its toolbar, -1 means not inserted
CFIndex m_index;
DEFINE_ONE_SHOT_HANDLER_GETTER( wxMacToolBarToolEventHandler )
DEFINE_ONE_SHOT_HANDLER_GETTER( wxMacToolBarToolEventHandler )
-#if wxMAC_USE_NATIVE_TOOLBAR
+#if wxOSX_USE_NATIVE_TOOLBAR
static const EventTypeSpec toolBarEventList[] =
{
static const EventTypeSpec toolBarEventList[] =
{
}
else if ( IsButton() )
{
}
else if ( IsButton() )
{
-#if wxMAC_USE_NATIVE_TOOLBAR
+#if wxOSX_USE_NATIVE_TOOLBAR
if ( m_toolbarItemRef != NULL )
HIToolbarItemSetEnabled( m_toolbarItemRef, enable );
#endif
if ( m_toolbarItemRef != NULL )
HIToolbarItemSetEnabled( m_toolbarItemRef, enable );
#endif
else if ( IsControl() )
{
// embedded native controls are moved by the OS
else if ( IsControl() )
{
// embedded native controls are moved by the OS
-#if wxMAC_USE_NATIVE_TOOLBAR
+#if wxOSX_USE_NATIVE_TOOLBAR
if ( ((wxToolBar*)GetToolBar())->MacWantsNativeToolbar() == false )
#endif
{
if ( ((wxToolBar*)GetToolBar())->MacWantsNativeToolbar() == false )
#endif
{
ControlButtonContentInfo info;
wxMacCreateBitmapButton( &info, bmp );
SetControlData( m_controlHandle, 0, kControlIconContentTag, sizeof(info), (Ptr)&info );
ControlButtonContentInfo info;
wxMacCreateBitmapButton( &info, bmp );
SetControlData( m_controlHandle, 0, kControlIconContentTag, sizeof(info), (Ptr)&info );
-#if wxMAC_USE_NATIVE_TOOLBAR
+#if wxOSX_USE_NATIVE_TOOLBAR
if (m_toolbarItemRef != NULL)
{
ControlButtonContentInfo info2;
if (m_toolbarItemRef != NULL)
{
ControlButtonContentInfo info2;
ControlButtonContentInfo info;
wxMacCreateBitmapButton( &info, m_bmpNormal );
SetControlData( m_controlHandle, 0, kControlIconContentTag, sizeof(info), (Ptr)&info );
ControlButtonContentInfo info;
wxMacCreateBitmapButton( &info, m_bmpNormal );
SetControlData( m_controlHandle, 0, kControlIconContentTag, sizeof(info), (Ptr)&info );
-#if wxMAC_USE_NATIVE_TOOLBAR
+#if wxOSX_USE_NATIVE_TOOLBAR
if (m_toolbarItemRef != NULL)
{
ControlButtonContentInfo info2;
if (m_toolbarItemRef != NULL)
{
ControlButtonContentInfo info2;
m_defaultWidth = kwxMacToolBarToolDefaultWidth;
m_defaultHeight = kwxMacToolBarToolDefaultHeight;
m_defaultWidth = kwxMacToolBarToolDefaultWidth;
m_defaultHeight = kwxMacToolBarToolDefaultHeight;
-#if wxMAC_USE_NATIVE_TOOLBAR
+#if wxOSX_USE_NATIVE_TOOLBAR
m_macHIToolbarRef = NULL;
m_macUsesNativeToolbar = false;
#endif
m_macHIToolbarRef = NULL;
m_macUsesNativeToolbar = false;
#endif
-#if wxMAC_USE_NATIVE_TOOLBAR
+#if wxOSX_USE_NATIVE_TOOLBAR
static const EventTypeSpec kToolbarEvents[] =
{
{ kEventClassToolbar, kEventToolbarGetDefaultIdentifiers },
static const EventTypeSpec kToolbarEvents[] =
{
{ kEventClassToolbar, kEventToolbarGetDefaultIdentifiers },
-#endif // wxMAC_USE_NATIVE_TOOLBAR
+#endif // wxOSX_USE_NATIVE_TOOLBAR
// also for the toolbar we have the dual implementation:
// only when MacInstallNativeToolbar is called is the native toolbar set as the window toolbar
// also for the toolbar we have the dual implementation:
// only when MacInstallNativeToolbar is called is the native toolbar set as the window toolbar
-#if wxMAC_USE_NATIVE_TOOLBAR
+#if wxOSX_USE_NATIVE_TOOLBAR
if (parent->IsKindOf(CLASSINFO(wxFrame)) && wxSystemOptions::GetOptionInt(wxT("mac.toolbar.no-native")) != 1)
{
wxString labelStr = wxString::Format( wxT("%p"), this );
if (parent->IsKindOf(CLASSINFO(wxFrame)) && wxSystemOptions::GetOptionInt(wxT("mac.toolbar.no-native")) != 1)
{
wxString labelStr = wxString::Format( wxT("%p"), this );
HIToolbarSetDisplaySize( (HIToolbarRef) m_macHIToolbarRef, displaySize );
}
}
HIToolbarSetDisplaySize( (HIToolbarRef) m_macHIToolbarRef, displaySize );
}
}
-#endif // wxMAC_USE_NATIVE_TOOLBAR
+#endif // wxOSX_USE_NATIVE_TOOLBAR
return (err == noErr);
}
wxToolBar::~wxToolBar()
{
return (err == noErr);
}
wxToolBar::~wxToolBar()
{
-#if wxMAC_USE_NATIVE_TOOLBAR
+#if wxOSX_USE_NATIVE_TOOLBAR
if (m_macHIToolbarRef != NULL)
{
// if this is the installed toolbar, then deinstall it
if (m_macHIToolbarRef != NULL)
{
// if this is the installed toolbar, then deinstall it
-#if wxMAC_USE_NATIVE_TOOLBAR
+#if wxOSX_USE_NATIVE_TOOLBAR
bool ownToolbarInstalled = false;
MacTopLevelHasNativeToolbar( &ownToolbarInstalled );
if (ownToolbarInstalled)
bool ownToolbarInstalled = false;
MacTopLevelHasNativeToolbar( &ownToolbarInstalled );
if (ownToolbarInstalled)
-#if wxMAC_USE_NATIVE_TOOLBAR
+#if wxOSX_USE_NATIVE_TOOLBAR
bool ownToolbarInstalled;
MacTopLevelHasNativeToolbar( &ownToolbarInstalled );
bool ownToolbarInstalled;
MacTopLevelHasNativeToolbar( &ownToolbarInstalled );
void wxToolBar::DoGetSize( int *width, int *height ) const
{
void wxToolBar::DoGetSize( int *width, int *height ) const
{
-#if wxMAC_USE_NATIVE_TOOLBAR
+#if wxOSX_USE_NATIVE_TOOLBAR
Rect boundsR;
bool ownToolbarInstalled;
Rect boundsR;
bool ownToolbarInstalled;
{
wxToolBarBase::SetWindowStyleFlag( style );
{
wxToolBarBase::SetWindowStyleFlag( style );
-#if wxMAC_USE_NATIVE_TOOLBAR
+#if wxOSX_USE_NATIVE_TOOLBAR
if (m_macHIToolbarRef != NULL)
{
HIToolbarDisplayMode mode = kHIToolbarDisplayModeDefault;
if (m_macHIToolbarRef != NULL)
{
HIToolbarDisplayMode mode = kHIToolbarDisplayModeDefault;
-#if wxMAC_USE_NATIVE_TOOLBAR
+#if wxOSX_USE_NATIVE_TOOLBAR
bool wxToolBar::MacWantsNativeToolbar()
{
return m_macUsesNativeToolbar;
bool wxToolBar::MacWantsNativeToolbar()
{
return m_macUsesNativeToolbar;
bool lastIsRadio = false;
bool curIsRadio = false;
bool lastIsRadio = false;
bool curIsRadio = false;
-#if wxMAC_USE_NATIVE_TOOLBAR
+#if wxOSX_USE_NATIVE_TOOLBAR
CFIndex currentPosition = 0;
bool insertAll = false;
CFIndex currentPosition = 0;
bool insertAll = false;
else
x += cursize.x + kwxMacToolSpacing;
else
x += cursize.x + kwxMacToolSpacing;
-#if wxMAC_USE_NATIVE_TOOLBAR
+#if wxOSX_USE_NATIVE_TOOLBAR
// install in native HIToolbar
if ( refTB )
{
// install in native HIToolbar
if ( refTB )
{
m_defaultWidth = size.x + kwxMacToolBorder;
m_defaultHeight = size.y + kwxMacToolBorder;
m_defaultWidth = size.x + kwxMacToolBorder;
m_defaultHeight = size.y + kwxMacToolBorder;
-#if wxMAC_USE_NATIVE_TOOLBAR
+#if wxOSX_USE_NATIVE_TOOLBAR
if (m_macHIToolbarRef != NULL)
{
int maxs = wxMax( size.x, size.y );
if (m_macHIToolbarRef != NULL)
{
int maxs = wxMax( size.x, size.y );
{
wxWindow::MacSuperChangedPosition();
{
wxWindow::MacSuperChangedPosition();
-#if wxMAC_USE_NATIVE_TOOLBAR
+#if wxOSX_USE_NATIVE_TOOLBAR
if (! m_macUsesNativeToolbar )
Realize();
#else
if (! m_macUsesNativeToolbar )
Realize();
#else
ControlRef controlHandle = NULL;
OSStatus err = 0;
ControlRef controlHandle = NULL;
OSStatus err = 0;
-#if wxMAC_USE_NATIVE_TOOLBAR
+#if wxOSX_USE_NATIVE_TOOLBAR
wxString label = tool->GetLabel();
if (m_macHIToolbarRef && !label.empty() )
{
wxString label = tool->GetLabel();
if (m_macHIToolbarRef && !label.empty() )
{
// with the usual labels in wxStaticText sense
label = wxStripMenuCodes(label);
}
// with the usual labels in wxStaticText sense
label = wxStripMenuCodes(label);
}
-#endif // wxMAC_USE_NATIVE_TOOLBAR
+#endif // wxOSX_USE_NATIVE_TOOLBAR
switch (tool->GetStyle())
{
switch (tool->GetStyle())
{
toolrect.right = toolSize.x;
// in flat style we need a visual separator
toolrect.right = toolSize.x;
// in flat style we need a visual separator
-#if wxMAC_USE_NATIVE_TOOLBAR
+#if wxOSX_USE_NATIVE_TOOLBAR
if (m_macHIToolbarRef != NULL)
{
HIToolbarItemRef item;
if (m_macHIToolbarRef != NULL)
{
HIToolbarItemRef item;
-#endif // wxMAC_USE_NATIVE_TOOLBAR
+#endif // wxOSX_USE_NATIVE_TOOLBAR
CreateSeparatorControl( window, &toolrect, &controlHandle );
tool->SetControlHandle( controlHandle );
CreateSeparatorControl( window, &toolrect, &controlHandle );
tool->SetControlHandle( controlHandle );
behaviour, &info, 0, 0, 0, &controlHandle );
}
behaviour, &info, 0, 0, 0, &controlHandle );
}
-#if wxMAC_USE_NATIVE_TOOLBAR
+#if wxOSX_USE_NATIVE_TOOLBAR
if (m_macHIToolbarRef != NULL)
{
HIToolbarItemRef item;
if (m_macHIToolbarRef != NULL)
{
HIToolbarItemRef item;
-#endif // wxMAC_USE_NATIVE_TOOLBAR
+#endif // wxOSX_USE_NATIVE_TOOLBAR
wxMacReleaseBitmapButton( &info );
wxMacReleaseBitmapButton( &info );
case wxTOOL_STYLE_CONTROL:
case wxTOOL_STYLE_CONTROL:
-#if wxMAC_USE_NATIVE_TOOLBAR
+#if wxOSX_USE_NATIVE_TOOLBAR
if (m_macHIToolbarRef != NULL)
{
wxCHECK_MSG( tool->GetControl(), false, _T("control must be non-NULL") );
if (m_macHIToolbarRef != NULL)
{
wxCHECK_MSG( tool->GetControl(), false, _T("control must be non-NULL") );
wxSize sz = ((wxToolBarTool*)tool)->GetSize();
wxSize sz = ((wxToolBarTool*)tool)->GetSize();
-#if wxMAC_USE_NATIVE_TOOLBAR
+#if wxOSX_USE_NATIVE_TOOLBAR
CFIndex removeIndex = tool->GetIndex();
#endif
CFIndex removeIndex = tool->GetIndex();
#endif
-#if wxMAC_USE_NATIVE_TOOLBAR
+#if wxOSX_USE_NATIVE_TOOLBAR
if (m_macHIToolbarRef != NULL)
{
if ( removeIndex != -1 && m_macHIToolbarRef )
if (m_macHIToolbarRef != NULL)
{
if ( removeIndex != -1 && m_macHIToolbarRef )
tool2->SetPosition( pt );
tool2->SetPosition( pt );
-#if wxMAC_USE_NATIVE_TOOLBAR
+#if wxOSX_USE_NATIVE_TOOLBAR
if (m_macHIToolbarRef != NULL)
{
if ( removeIndex != -1 && tool2->GetIndex() > removeIndex )
if (m_macHIToolbarRef != NULL)
{
if ( removeIndex != -1 && tool2->GetIndex() > removeIndex )
void wxToolBar::OnPaint(wxPaintEvent& event)
{
void wxToolBar::OnPaint(wxPaintEvent& event)
{
-#if wxMAC_USE_NATIVE_TOOLBAR
+#if wxOSX_USE_NATIVE_TOOLBAR
if ( m_macUsesNativeToolbar )
{
event.Skip(true);
if ( m_macUsesNativeToolbar )
{
event.Skip(true);
void wxMacControl::SetFont( const wxFont & font , const wxColour& foreground , long windowStyle )
{
m_font = font;
void wxMacControl::SetFont( const wxFont & font , const wxColour& foreground , long windowStyle )
{
m_font = font;
if ( UMAGetSystemVersion() >= 0x1050 )
{
HIViewPartCode part = 0;
if ( UMAGetSystemVersion() >= 0x1050 )
{
HIViewPartCode part = 0;
ControlFontStyleRec fontStyle;
if ( font.MacGetThemeFontID() != kThemeCurrentPortFont )
{
ControlFontStyleRec fontStyle;
if ( font.MacGetThemeFontID() != kThemeCurrentPortFont )
{