]> git.saurik.com Git - wxWidgets.git/commitdiff
adding 10.4 build compatibility for osx cocoa, see #10361
authorStefan Csomor <csomor@advancedconcepts.ch>
Mon, 12 Jan 2009 20:14:39 +0000 (20:14 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Mon, 12 Jan 2009 20:14:39 +0000 (20:14 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58058 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/osx/carbon/font.h
include/wx/osx/cocoa/private.h
src/generic/listctrl.cpp
src/generic/treectlg.cpp
src/osx/carbon/gdiobj.cpp
src/osx/cocoa/glcanvas.mm
src/osx/cocoa/taskbar.mm
src/osx/core/printmac.cpp
src/osx/listbox_osx.cpp
src/osx/window_osx.cpp

index 6dd3efa68a3c6bf28d5014d5a9688d4a7b5500b3..05f1b50601761235709891f6d512aaa404184a39 100644 (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
index f46aeafa2fe690706768605401b286171d0b5585..d56945236f75c3f925845380017482dacc1f4702 100644 (file)
 
 #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>
index bf9e05c4170e386692b983d57156e428829424d4..f4dc7c16994f2a0e1ec599ac4ad88e603509a556 100644 (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 );
index 5baa32ad7f29552fc90126b3cd0c73c5d91b8d2c..8c57130d025fcd08773cf410a217014076e9b087 100644 (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 ) ;
index 9dcae80012b43086d69c9270a738e79061278624..f768d01beafe46221e127003152f3c121247f456 100644 (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);
index 0952fc18f3477cd9de4d72aeaa9b9615143b34a6..ee5d515c4ec65adcd2a9a9702f2cfa20688e2f69 100644 (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
index a5143fe0c96050e86e8f7dafdff480abc93284a6..b6d327b863f991d1e14d5e71fc240b1bcbd7b354 100644 (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:
 
 #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];
index 0fafe8105c09d2ee5672bbfe5b68651dfaffb86d..5256be6b13d812612bbefba08627ab26620e8fea 100644 (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;
index 157eef3251e494a97498d95bff4f26975c5a5f0b..e138470caee91944ed8a8da4bc066ee755c9e393 100644 (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);
index e482f1d0a03d13375a81c33d8ab49071aee172f2..dab34b2ad87f963ba09f1c91506c8ef6486a9fcf 100644 (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 ;