From: Stefan Csomor Date: Mon, 12 Jan 2009 20:14:39 +0000 (+0000) Subject: adding 10.4 build compatibility for osx cocoa, see #10361 X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/7ac5e1c9088dedba495f5af5dbfb23ca89487a78 adding 10.4 build compatibility for osx cocoa, see #10361 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58058 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/osx/carbon/font.h b/include/wx/osx/carbon/font.h index 6dd3efa68a..05f1b50601 100644 --- a/include/wx/osx/carbon/font.h +++ b/include/wx/osx/carbon/font.h @@ -63,7 +63,7 @@ public: bool Create(const wxNativeFontInfo& info); -#if wxOSX_USE_CARBON +#if wxOSX_USE_ATSU_TEXT bool MacCreateFromThemeFont( wxUint16 themeFontID ) ; #endif #if wxOSX_USE_CORE_TEXT diff --git a/include/wx/osx/cocoa/private.h b/include/wx/osx/cocoa/private.h index f46aeafa2f..d56945236f 100644 --- a/include/wx/osx/cocoa/private.h +++ b/include/wx/osx/cocoa/private.h @@ -20,6 +20,11 @@ #include +#if wxOSX_USE_ATSU_TEXT + // we need theming and atsu + #include +#endif + #ifdef __OBJC__ #import diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index bf9e05c417..f4dc7c1699 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -5060,7 +5060,7 @@ bool wxGenericListCtrl::Create(wxWindow *parent, if ( GetWindowVariant() == wxWINDOW_VARIANT_NORMAL ) { wxFont font; -#if wxOSX_USE_CARBON +#if wxOSX_USE_ATSU_TEXT font.MacCreateFromThemeFont( kThemeViewsFont ); #else font.MacCreateFromUIFont( kCTFontViewsFontType ); @@ -5077,7 +5077,7 @@ bool wxGenericListCtrl::Create(wxWindow *parent, if (m_headerWin) { wxFont font; -#if wxOSX_USE_CARBON +#if wxOSX_USE_ATSU_TEXT font.MacCreateFromThemeFont( kThemeSmallSystemFont ); #else font.MacCreateFromUIFont( kCTFontSystemFontType ); diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index 5baa32ad7f..8c57130d02 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -989,7 +989,7 @@ void wxGenericTreeCtrl::Init() m_lastOnSame = false; #if defined( __WXMAC__ ) -#if wxOSX_USE_CARBON +#if wxOSX_USE_ATSU_TEXT m_normalFont.MacCreateFromThemeFont( kThemeViewsFont ) ; #else m_normalFont.MacCreateFromUIFont( kCTFontViewsFontType ) ; diff --git a/src/osx/carbon/gdiobj.cpp b/src/osx/carbon/gdiobj.cpp index 9dcae80012..f768d01bea 100644 --- a/src/osx/carbon/gdiobj.cpp +++ b/src/osx/carbon/gdiobj.cpp @@ -64,7 +64,7 @@ const wxFont* wxStockGDIMac::GetFont(Item item) #if wxOSX_USE_COCOA_OR_CARBON case FONT_NORMAL: font = new wxFont; -#if wxOSX_USE_CARBON +#if wxOSX_USE_ATSU_TEXT font->MacCreateFromThemeFont(kThemeSystemFont); #else font->MacCreateFromUIFont(kCTFontSystemFontType); @@ -72,7 +72,7 @@ const wxFont* wxStockGDIMac::GetFont(Item item) break; case FONT_SMALL: font = new wxFont; -#if wxOSX_USE_CARBON +#if wxOSX_USE_ATSU_TEXT font->MacCreateFromThemeFont(kThemeSmallSystemFont); #else font->MacCreateFromUIFont(kCTFontSmallSystemFontType); diff --git a/src/osx/cocoa/glcanvas.mm b/src/osx/cocoa/glcanvas.mm index 0952fc18f3..ee5d515c4e 100644 --- a/src/osx/cocoa/glcanvas.mm +++ b/src/osx/cocoa/glcanvas.mm @@ -35,7 +35,6 @@ #include "wx/osx/private.h" - WXGLContext WXGLCreateContext( WXGLPixelFormat pixelFormat, WXGLContext shareContext ) { WXGLContext context = [[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext: shareContext]; @@ -78,9 +77,9 @@ WXGLPixelFormat WXGLChoosePixelFormat(const int *attribList) { NSOpenGLPFADoubleBuffer, NSOpenGLPFAMinimumPolicy, - NSOpenGLPFAColorSize,8, - NSOpenGLPFAAlphaSize,0, - NSOpenGLPFADepthSize,8, + NSOpenGLPFAColorSize,(NSOpenGLPixelFormatAttribute)8, + NSOpenGLPFAAlphaSize,(NSOpenGLPixelFormatAttribute)0, + NSOpenGLPFADepthSize,(NSOpenGLPixelFormatAttribute)8, (NSOpenGLPixelFormatAttribute)nil }; @@ -122,12 +121,12 @@ WXGLPixelFormat WXGLChoosePixelFormat(const int *attribList) case WX_GL_AUX_BUFFERS: data[p++] = NSOpenGLPFAAuxBuffers; - data[p++] = attribList[arg++]; + data[p++] = (NSOpenGLPixelFormatAttribute) attribList[arg++]; break; case WX_GL_MIN_RED: data[p++] = NSOpenGLPFAColorSize; - data[p++] = attribList[arg++]; + data[p++] = (NSOpenGLPixelFormatAttribute) attribList[arg++]; break; case WX_GL_MIN_GREEN: @@ -142,22 +141,22 @@ WXGLPixelFormat WXGLChoosePixelFormat(const int *attribList) case WX_GL_MIN_ALPHA: data[p++] = NSOpenGLPFAAlphaSize; - data[p++] = attribList[arg++]; + data[p++] = (NSOpenGLPixelFormatAttribute) attribList[arg++]; break; case WX_GL_DEPTH_SIZE: data[p++] = NSOpenGLPFADepthSize; - data[p++] = attribList[arg++]; + data[p++] = (NSOpenGLPixelFormatAttribute) attribList[arg++]; break; case WX_GL_STENCIL_SIZE: data[p++] = NSOpenGLPFAStencilSize; - data[p++] = attribList[arg++]; + data[p++] = (NSOpenGLPixelFormatAttribute) attribList[arg++]; break; case WX_GL_MIN_ACCUM_RED: data[p++] = NSOpenGLPFAAccumSize; - data[p++] = attribList[arg++]; + data[p++] = (NSOpenGLPixelFormatAttribute) attribList[arg++]; break; case WX_GL_MIN_ACCUM_GREEN: @@ -185,7 +184,7 @@ WXGLPixelFormat WXGLChoosePixelFormat(const int *attribList) } data[p++] = NSOpenGLPFASampleBuffers; - if ( (data[p++] = attribList[arg++]) == true ) + if ( (data[p++] = (NSOpenGLPixelFormatAttribute) attribList[arg++]) == true ) { // don't use software fallback data[p++] = NSOpenGLPFANoRecovery; @@ -202,7 +201,7 @@ WXGLPixelFormat WXGLChoosePixelFormat(const int *attribList) } data[p++] = NSOpenGLPFASamples; - data[p++] = attribList[arg++]; + data[p++] = (NSOpenGLPixelFormatAttribute) attribList[arg++]; break; } } @@ -212,7 +211,7 @@ WXGLPixelFormat WXGLChoosePixelFormat(const int *attribList) attribs = data; } - return [[NSOpenGLPixelFormat alloc] initWithAttributes:attribs]; + return [[NSOpenGLPixelFormat alloc] initWithAttributes:(NSOpenGLPixelFormatAttribute*) attribs]; } bool wxGLContext::SetCurrent(const wxGLCanvas& win) const diff --git a/src/osx/cocoa/taskbar.mm b/src/osx/cocoa/taskbar.mm index a5143fe0c9..b6d327b863 100644 --- a/src/osx/cocoa/taskbar.mm +++ b/src/osx/cocoa/taskbar.mm @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// File: src/cocoa/taskbar.mm +// File: src/osx/cocoa/taskbar.mm // Purpose: Implements wxTaskBarIcon class // Author: David Elliott // Modified by: @@ -21,21 +21,7 @@ #include "wx/taskbar.h" -#import -#import -#import -#import -#import -#import -#import -#import -#import - -#import -#import -#import - -#include "wx/cocoa/autorelease.h" +#include "wx/osx/private.h" // A category for methods that are only present in Panther's SDK @interface NSStatusItem(wxNSStatusItemPrePantherCompatibility) @@ -247,7 +233,7 @@ WX_NSMenu wxTaskBarIconDockImpl::CocoaDoGetDockNSMenu() bool wxTaskBarIconDockImpl::SetIcon(const wxIcon& icon, const wxString& tooltip) { - wxAutoNSAutoreleasePool pool; + wxMacAutoreleasePool pool; m_originalDockIcon = [[[NSApplication sharedApplication] applicationIconImage] retain]; //[[NSApplication sharedApplication] setApplicationIconImage:icon.GetNSImage()]; return true; @@ -282,7 +268,7 @@ wxTaskBarIconCustomStatusItemImpl::~wxTaskBarIconCustomStatusItemImpl() bool wxTaskBarIconCustomStatusItemImpl::SetIcon(const wxIcon& icon, const wxString& tooltip) { - wxAutoNSAutoreleasePool pool; + wxMacAutoreleasePool pool; if(!m_cocoaNSStatusItem) { m_cocoaNSStatusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength]; diff --git a/src/osx/core/printmac.cpp b/src/osx/core/printmac.cpp index 0fafe8105c..5256be6b13 100644 --- a/src/osx/core/printmac.cpp +++ b/src/osx/core/printmac.cpp @@ -257,7 +257,7 @@ bool wxMacCarbonPrintData::TransferFrom( const wxPrintData &data ) PMSetOrientation( (PMPageFormat) m_macPageFormat , ( data.GetOrientation() == wxLANDSCAPE ) ? kPMLandscape : kPMPortrait , false ) ; -#if wxOSX_USE_CARBON +#if 1 // wxOSX_USE_CARBON PMTag tag = kPMMaxSquareResolution; PMPrinterGetPrinterResolution(printer, tag, &res); PMSetResolution((PMPageFormat) m_macPageFormat, &res); @@ -502,7 +502,7 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt) PMResolution res; wxMacCarbonPrintData* nativeData = (wxMacCarbonPrintData*) (m_printDialogData.GetPrintData().GetNativeData()); -#if wxOSX_USE_CARBON +#if 1 // wxOSX_USE_CARBON PMGetResolution((PMPageFormat) (nativeData->m_macPageFormat), &res); #else PMPrinter printer; diff --git a/src/osx/listbox_osx.cpp b/src/osx/listbox_osx.cpp index 157eef3251..e138470cae 100644 --- a/src/osx/listbox_osx.cpp +++ b/src/osx/listbox_osx.cpp @@ -272,7 +272,7 @@ wxListBox::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) attr.colFg = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ); attr.colBg = wxSystemSettings::GetColour( wxSYS_COLOUR_LISTBOX ); -#if wxOSX_USE_CARBON +#if wxOSX_USE_ATSU_TEXT attr.font.MacCreateFromThemeFont(kThemeViewsFont); #else attr.font.MacCreateFromUIFont(kCTFontViewsFontType); diff --git a/src/osx/window_osx.cpp b/src/osx/window_osx.cpp index e482f1d0a0..dab34b2ad8 100644 --- a/src/osx/window_osx.cpp +++ b/src/osx/window_osx.cpp @@ -305,10 +305,43 @@ void wxWindowMac::DoSetWindowVariant( wxWindowVariant variant ) return; m_peer->SetControlSize( variant ); +#if wxOSX_USE_CARBON + ControlSize size ; + + // we will get that from the settings later + // and make this NORMAL later, but first + // we have a few calculations that we must fix + + switch ( variant ) + { + case wxWINDOW_VARIANT_NORMAL : + size = kControlSizeNormal; + break ; + + case wxWINDOW_VARIANT_SMALL : + size = kControlSizeSmall; + break ; + + case wxWINDOW_VARIANT_MINI : + // not always defined in the headers + size = 3 ; + break ; + + case wxWINDOW_VARIANT_LARGE : + size = kControlSizeLarge; + break ; + + default: + wxFAIL_MSG(_T("unexpected window variant")); + break ; + } + m_peer->SetData(kControlEntireControl, kControlSizeTag, &size ) ; +#endif + #if wxOSX_USE_COCOA_OR_CARBON wxFont font ; -#if wxOSX_USE_CARBON +#if wxOSX_USE_ATSU_TEXT ControlSize size ; ThemeFontID themeFont = kThemeSystemFont ; @@ -344,7 +377,6 @@ void wxWindowMac::DoSetWindowVariant( wxWindowVariant variant ) break ; } - m_peer->SetData(kControlEntireControl, kControlSizeTag, &size ) ; font.MacCreateFromThemeFont( themeFont ) ; #else CTFontUIFontType themeFont = kCTFontSystemFontType ;