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:
Stefan Csomor 2009-01-12 20:14:39 +00:00
parent a2580e1c49
commit 7ac5e1c908
10 changed files with 64 additions and 42 deletions

View File

@ -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

View File

@ -20,6 +20,11 @@
#include <ApplicationServices/ApplicationServices.h>
#if wxOSX_USE_ATSU_TEXT
// we need theming and atsu
#include <Carbon/Carbon.h>
#endif
#ifdef __OBJC__
#import <Cocoa/Cocoa.h>

View File

@ -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 );

View File

@ -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 ) ;

View File

@ -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);

View File

@ -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

View File

@ -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 <AppKit/NSApplication.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"
#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];

View File

@ -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;

View File

@ -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);

View File

@ -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<ControlSize>(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<ControlSize>(kControlEntireControl, kControlSizeTag, &size ) ;
font.MacCreateFromThemeFont( themeFont ) ;
#else
CTFontUIFontType themeFont = kCTFontSystemFontType ;