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
This commit is contained in:
@@ -63,7 +63,7 @@ public:
|
|||||||
|
|
||||||
bool Create(const wxNativeFontInfo& info);
|
bool Create(const wxNativeFontInfo& info);
|
||||||
|
|
||||||
#if wxOSX_USE_CARBON
|
#if wxOSX_USE_ATSU_TEXT
|
||||||
bool MacCreateFromThemeFont( wxUint16 themeFontID ) ;
|
bool MacCreateFromThemeFont( wxUint16 themeFontID ) ;
|
||||||
#endif
|
#endif
|
||||||
#if wxOSX_USE_CORE_TEXT
|
#if wxOSX_USE_CORE_TEXT
|
||||||
|
@@ -20,6 +20,11 @@
|
|||||||
|
|
||||||
#include <ApplicationServices/ApplicationServices.h>
|
#include <ApplicationServices/ApplicationServices.h>
|
||||||
|
|
||||||
|
#if wxOSX_USE_ATSU_TEXT
|
||||||
|
// we need theming and atsu
|
||||||
|
#include <Carbon/Carbon.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __OBJC__
|
#ifdef __OBJC__
|
||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
|
@@ -5060,7 +5060,7 @@ bool wxGenericListCtrl::Create(wxWindow *parent,
|
|||||||
if ( GetWindowVariant() == wxWINDOW_VARIANT_NORMAL )
|
if ( GetWindowVariant() == wxWINDOW_VARIANT_NORMAL )
|
||||||
{
|
{
|
||||||
wxFont font;
|
wxFont font;
|
||||||
#if wxOSX_USE_CARBON
|
#if wxOSX_USE_ATSU_TEXT
|
||||||
font.MacCreateFromThemeFont( kThemeViewsFont );
|
font.MacCreateFromThemeFont( kThemeViewsFont );
|
||||||
#else
|
#else
|
||||||
font.MacCreateFromUIFont( kCTFontViewsFontType );
|
font.MacCreateFromUIFont( kCTFontViewsFontType );
|
||||||
@@ -5077,7 +5077,7 @@ bool wxGenericListCtrl::Create(wxWindow *parent,
|
|||||||
if (m_headerWin)
|
if (m_headerWin)
|
||||||
{
|
{
|
||||||
wxFont font;
|
wxFont font;
|
||||||
#if wxOSX_USE_CARBON
|
#if wxOSX_USE_ATSU_TEXT
|
||||||
font.MacCreateFromThemeFont( kThemeSmallSystemFont );
|
font.MacCreateFromThemeFont( kThemeSmallSystemFont );
|
||||||
#else
|
#else
|
||||||
font.MacCreateFromUIFont( kCTFontSystemFontType );
|
font.MacCreateFromUIFont( kCTFontSystemFontType );
|
||||||
|
@@ -989,7 +989,7 @@ void wxGenericTreeCtrl::Init()
|
|||||||
m_lastOnSame = false;
|
m_lastOnSame = false;
|
||||||
|
|
||||||
#if defined( __WXMAC__ )
|
#if defined( __WXMAC__ )
|
||||||
#if wxOSX_USE_CARBON
|
#if wxOSX_USE_ATSU_TEXT
|
||||||
m_normalFont.MacCreateFromThemeFont( kThemeViewsFont ) ;
|
m_normalFont.MacCreateFromThemeFont( kThemeViewsFont ) ;
|
||||||
#else
|
#else
|
||||||
m_normalFont.MacCreateFromUIFont( kCTFontViewsFontType ) ;
|
m_normalFont.MacCreateFromUIFont( kCTFontViewsFontType ) ;
|
||||||
|
@@ -64,7 +64,7 @@ const wxFont* wxStockGDIMac::GetFont(Item item)
|
|||||||
#if wxOSX_USE_COCOA_OR_CARBON
|
#if wxOSX_USE_COCOA_OR_CARBON
|
||||||
case FONT_NORMAL:
|
case FONT_NORMAL:
|
||||||
font = new wxFont;
|
font = new wxFont;
|
||||||
#if wxOSX_USE_CARBON
|
#if wxOSX_USE_ATSU_TEXT
|
||||||
font->MacCreateFromThemeFont(kThemeSystemFont);
|
font->MacCreateFromThemeFont(kThemeSystemFont);
|
||||||
#else
|
#else
|
||||||
font->MacCreateFromUIFont(kCTFontSystemFontType);
|
font->MacCreateFromUIFont(kCTFontSystemFontType);
|
||||||
@@ -72,7 +72,7 @@ const wxFont* wxStockGDIMac::GetFont(Item item)
|
|||||||
break;
|
break;
|
||||||
case FONT_SMALL:
|
case FONT_SMALL:
|
||||||
font = new wxFont;
|
font = new wxFont;
|
||||||
#if wxOSX_USE_CARBON
|
#if wxOSX_USE_ATSU_TEXT
|
||||||
font->MacCreateFromThemeFont(kThemeSmallSystemFont);
|
font->MacCreateFromThemeFont(kThemeSmallSystemFont);
|
||||||
#else
|
#else
|
||||||
font->MacCreateFromUIFont(kCTFontSmallSystemFontType);
|
font->MacCreateFromUIFont(kCTFontSmallSystemFontType);
|
||||||
|
@@ -35,7 +35,6 @@
|
|||||||
|
|
||||||
#include "wx/osx/private.h"
|
#include "wx/osx/private.h"
|
||||||
|
|
||||||
|
|
||||||
WXGLContext WXGLCreateContext( WXGLPixelFormat pixelFormat, WXGLContext shareContext )
|
WXGLContext WXGLCreateContext( WXGLPixelFormat pixelFormat, WXGLContext shareContext )
|
||||||
{
|
{
|
||||||
WXGLContext context = [[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext: shareContext];
|
WXGLContext context = [[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext: shareContext];
|
||||||
@@ -78,9 +77,9 @@ WXGLPixelFormat WXGLChoosePixelFormat(const int *attribList)
|
|||||||
{
|
{
|
||||||
NSOpenGLPFADoubleBuffer,
|
NSOpenGLPFADoubleBuffer,
|
||||||
NSOpenGLPFAMinimumPolicy,
|
NSOpenGLPFAMinimumPolicy,
|
||||||
NSOpenGLPFAColorSize,8,
|
NSOpenGLPFAColorSize,(NSOpenGLPixelFormatAttribute)8,
|
||||||
NSOpenGLPFAAlphaSize,0,
|
NSOpenGLPFAAlphaSize,(NSOpenGLPixelFormatAttribute)0,
|
||||||
NSOpenGLPFADepthSize,8,
|
NSOpenGLPFADepthSize,(NSOpenGLPixelFormatAttribute)8,
|
||||||
(NSOpenGLPixelFormatAttribute)nil
|
(NSOpenGLPixelFormatAttribute)nil
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -122,12 +121,12 @@ WXGLPixelFormat WXGLChoosePixelFormat(const int *attribList)
|
|||||||
|
|
||||||
case WX_GL_AUX_BUFFERS:
|
case WX_GL_AUX_BUFFERS:
|
||||||
data[p++] = NSOpenGLPFAAuxBuffers;
|
data[p++] = NSOpenGLPFAAuxBuffers;
|
||||||
data[p++] = attribList[arg++];
|
data[p++] = (NSOpenGLPixelFormatAttribute) attribList[arg++];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WX_GL_MIN_RED:
|
case WX_GL_MIN_RED:
|
||||||
data[p++] = NSOpenGLPFAColorSize;
|
data[p++] = NSOpenGLPFAColorSize;
|
||||||
data[p++] = attribList[arg++];
|
data[p++] = (NSOpenGLPixelFormatAttribute) attribList[arg++];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WX_GL_MIN_GREEN:
|
case WX_GL_MIN_GREEN:
|
||||||
@@ -142,22 +141,22 @@ WXGLPixelFormat WXGLChoosePixelFormat(const int *attribList)
|
|||||||
|
|
||||||
case WX_GL_MIN_ALPHA:
|
case WX_GL_MIN_ALPHA:
|
||||||
data[p++] = NSOpenGLPFAAlphaSize;
|
data[p++] = NSOpenGLPFAAlphaSize;
|
||||||
data[p++] = attribList[arg++];
|
data[p++] = (NSOpenGLPixelFormatAttribute) attribList[arg++];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WX_GL_DEPTH_SIZE:
|
case WX_GL_DEPTH_SIZE:
|
||||||
data[p++] = NSOpenGLPFADepthSize;
|
data[p++] = NSOpenGLPFADepthSize;
|
||||||
data[p++] = attribList[arg++];
|
data[p++] = (NSOpenGLPixelFormatAttribute) attribList[arg++];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WX_GL_STENCIL_SIZE:
|
case WX_GL_STENCIL_SIZE:
|
||||||
data[p++] = NSOpenGLPFAStencilSize;
|
data[p++] = NSOpenGLPFAStencilSize;
|
||||||
data[p++] = attribList[arg++];
|
data[p++] = (NSOpenGLPixelFormatAttribute) attribList[arg++];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WX_GL_MIN_ACCUM_RED:
|
case WX_GL_MIN_ACCUM_RED:
|
||||||
data[p++] = NSOpenGLPFAAccumSize;
|
data[p++] = NSOpenGLPFAAccumSize;
|
||||||
data[p++] = attribList[arg++];
|
data[p++] = (NSOpenGLPixelFormatAttribute) attribList[arg++];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WX_GL_MIN_ACCUM_GREEN:
|
case WX_GL_MIN_ACCUM_GREEN:
|
||||||
@@ -185,7 +184,7 @@ WXGLPixelFormat WXGLChoosePixelFormat(const int *attribList)
|
|||||||
}
|
}
|
||||||
|
|
||||||
data[p++] = NSOpenGLPFASampleBuffers;
|
data[p++] = NSOpenGLPFASampleBuffers;
|
||||||
if ( (data[p++] = attribList[arg++]) == true )
|
if ( (data[p++] = (NSOpenGLPixelFormatAttribute) attribList[arg++]) == true )
|
||||||
{
|
{
|
||||||
// don't use software fallback
|
// don't use software fallback
|
||||||
data[p++] = NSOpenGLPFANoRecovery;
|
data[p++] = NSOpenGLPFANoRecovery;
|
||||||
@@ -202,7 +201,7 @@ WXGLPixelFormat WXGLChoosePixelFormat(const int *attribList)
|
|||||||
}
|
}
|
||||||
|
|
||||||
data[p++] = NSOpenGLPFASamples;
|
data[p++] = NSOpenGLPFASamples;
|
||||||
data[p++] = attribList[arg++];
|
data[p++] = (NSOpenGLPixelFormatAttribute) attribList[arg++];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -212,7 +211,7 @@ WXGLPixelFormat WXGLChoosePixelFormat(const int *attribList)
|
|||||||
attribs = data;
|
attribs = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
return [[NSOpenGLPixelFormat alloc] initWithAttributes:attribs];
|
return [[NSOpenGLPixelFormat alloc] initWithAttributes:(NSOpenGLPixelFormatAttribute*) attribs];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxGLContext::SetCurrent(const wxGLCanvas& win) const
|
bool wxGLContext::SetCurrent(const wxGLCanvas& win) const
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
// File: src/cocoa/taskbar.mm
|
// File: src/osx/cocoa/taskbar.mm
|
||||||
// Purpose: Implements wxTaskBarIcon class
|
// Purpose: Implements wxTaskBarIcon class
|
||||||
// Author: David Elliott
|
// Author: David Elliott
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -21,21 +21,7 @@
|
|||||||
|
|
||||||
#include "wx/taskbar.h"
|
#include "wx/taskbar.h"
|
||||||
|
|
||||||
#import <AppKit/NSApplication.h>
|
#include "wx/osx/private.h"
|
||||||
#import <AppKit/NSImage.h>
|
|
||||||
#import <AppKit/NSMenu.h>
|
|
||||||
#import <AppKit/NSMenuItem.h>
|
|
||||||
#import <AppKit/NSStatusBar.h>
|
|
||||||
#import <AppKit/NSStatusItem.h>
|
|
||||||
#import <AppKit/NSView.h>
|
|
||||||
#import <Foundation/NSArray.h>
|
|
||||||
#import <Foundation/NSEnumerator.h>
|
|
||||||
|
|
||||||
#import <AppKit/NSEvent.h>
|
|
||||||
#import <AppKit/NSWindow.h>
|
|
||||||
#import <AppKit/NSGraphicsContext.h>
|
|
||||||
|
|
||||||
#include "wx/cocoa/autorelease.h"
|
|
||||||
|
|
||||||
// A category for methods that are only present in Panther's SDK
|
// A category for methods that are only present in Panther's SDK
|
||||||
@interface NSStatusItem(wxNSStatusItemPrePantherCompatibility)
|
@interface NSStatusItem(wxNSStatusItemPrePantherCompatibility)
|
||||||
@@ -247,7 +233,7 @@ WX_NSMenu wxTaskBarIconDockImpl::CocoaDoGetDockNSMenu()
|
|||||||
|
|
||||||
bool wxTaskBarIconDockImpl::SetIcon(const wxIcon& icon, const wxString& tooltip)
|
bool wxTaskBarIconDockImpl::SetIcon(const wxIcon& icon, const wxString& tooltip)
|
||||||
{
|
{
|
||||||
wxAutoNSAutoreleasePool pool;
|
wxMacAutoreleasePool pool;
|
||||||
m_originalDockIcon = [[[NSApplication sharedApplication] applicationIconImage] retain];
|
m_originalDockIcon = [[[NSApplication sharedApplication] applicationIconImage] retain];
|
||||||
//[[NSApplication sharedApplication] setApplicationIconImage:icon.GetNSImage()];
|
//[[NSApplication sharedApplication] setApplicationIconImage:icon.GetNSImage()];
|
||||||
return true;
|
return true;
|
||||||
@@ -282,7 +268,7 @@ wxTaskBarIconCustomStatusItemImpl::~wxTaskBarIconCustomStatusItemImpl()
|
|||||||
|
|
||||||
bool wxTaskBarIconCustomStatusItemImpl::SetIcon(const wxIcon& icon, const wxString& tooltip)
|
bool wxTaskBarIconCustomStatusItemImpl::SetIcon(const wxIcon& icon, const wxString& tooltip)
|
||||||
{
|
{
|
||||||
wxAutoNSAutoreleasePool pool;
|
wxMacAutoreleasePool pool;
|
||||||
if(!m_cocoaNSStatusItem)
|
if(!m_cocoaNSStatusItem)
|
||||||
{
|
{
|
||||||
m_cocoaNSStatusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength];
|
m_cocoaNSStatusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength];
|
||||||
|
@@ -257,7 +257,7 @@ bool wxMacCarbonPrintData::TransferFrom( const wxPrintData &data )
|
|||||||
PMSetOrientation( (PMPageFormat) m_macPageFormat , ( data.GetOrientation() == wxLANDSCAPE ) ?
|
PMSetOrientation( (PMPageFormat) m_macPageFormat , ( data.GetOrientation() == wxLANDSCAPE ) ?
|
||||||
kPMLandscape : kPMPortrait , false ) ;
|
kPMLandscape : kPMPortrait , false ) ;
|
||||||
|
|
||||||
#if wxOSX_USE_CARBON
|
#if 1 // wxOSX_USE_CARBON
|
||||||
PMTag tag = kPMMaxSquareResolution;
|
PMTag tag = kPMMaxSquareResolution;
|
||||||
PMPrinterGetPrinterResolution(printer, tag, &res);
|
PMPrinterGetPrinterResolution(printer, tag, &res);
|
||||||
PMSetResolution((PMPageFormat) m_macPageFormat, &res);
|
PMSetResolution((PMPageFormat) m_macPageFormat, &res);
|
||||||
@@ -502,7 +502,7 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
|
|||||||
PMResolution res;
|
PMResolution res;
|
||||||
wxMacCarbonPrintData* nativeData = (wxMacCarbonPrintData*)
|
wxMacCarbonPrintData* nativeData = (wxMacCarbonPrintData*)
|
||||||
(m_printDialogData.GetPrintData().GetNativeData());
|
(m_printDialogData.GetPrintData().GetNativeData());
|
||||||
#if wxOSX_USE_CARBON
|
#if 1 // wxOSX_USE_CARBON
|
||||||
PMGetResolution((PMPageFormat) (nativeData->m_macPageFormat), &res);
|
PMGetResolution((PMPageFormat) (nativeData->m_macPageFormat), &res);
|
||||||
#else
|
#else
|
||||||
PMPrinter printer;
|
PMPrinter printer;
|
||||||
|
@@ -272,7 +272,7 @@ wxListBox::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
|
|||||||
|
|
||||||
attr.colFg = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT );
|
attr.colFg = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT );
|
||||||
attr.colBg = wxSystemSettings::GetColour( wxSYS_COLOUR_LISTBOX );
|
attr.colBg = wxSystemSettings::GetColour( wxSYS_COLOUR_LISTBOX );
|
||||||
#if wxOSX_USE_CARBON
|
#if wxOSX_USE_ATSU_TEXT
|
||||||
attr.font.MacCreateFromThemeFont(kThemeViewsFont);
|
attr.font.MacCreateFromThemeFont(kThemeViewsFont);
|
||||||
#else
|
#else
|
||||||
attr.font.MacCreateFromUIFont(kCTFontViewsFontType);
|
attr.font.MacCreateFromUIFont(kCTFontViewsFontType);
|
||||||
|
@@ -305,10 +305,43 @@ void wxWindowMac::DoSetWindowVariant( wxWindowVariant variant )
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
m_peer->SetControlSize( variant );
|
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<ControlSize>(kControlEntireControl, kControlSizeTag, &size ) ;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if wxOSX_USE_COCOA_OR_CARBON
|
#if wxOSX_USE_COCOA_OR_CARBON
|
||||||
wxFont font ;
|
wxFont font ;
|
||||||
|
|
||||||
#if wxOSX_USE_CARBON
|
#if wxOSX_USE_ATSU_TEXT
|
||||||
ControlSize size ;
|
ControlSize size ;
|
||||||
ThemeFontID themeFont = kThemeSystemFont ;
|
ThemeFontID themeFont = kThemeSystemFont ;
|
||||||
|
|
||||||
@@ -344,7 +377,6 @@ void wxWindowMac::DoSetWindowVariant( wxWindowVariant variant )
|
|||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_peer->SetData<ControlSize>(kControlEntireControl, kControlSizeTag, &size ) ;
|
|
||||||
font.MacCreateFromThemeFont( themeFont ) ;
|
font.MacCreateFromThemeFont( themeFont ) ;
|
||||||
#else
|
#else
|
||||||
CTFontUIFontType themeFont = kCTFontSystemFontType ;
|
CTFontUIFontType themeFont = kCTFontSystemFontType ;
|
||||||
|
Reference in New Issue
Block a user