mirror of
https://github.com/wxWidgets/wxWidgets.git
synced 2026-09-28 15:50:17 +08:00
Merge pull request #194 from vadz/remove-osx-carbon
Remove wxOSX/Carbon port
This commit is contained in:
@@ -26,7 +26,7 @@ wxWidgets currently supports the following primary platforms:
|
||||
|
||||
- Windows XP, Vista, 7, 8 and 10 (32/64 bits).
|
||||
- Most Unix variants using the GTK+ toolkit (version 2.6 or newer or 3.x).
|
||||
- Mac OS X (10.7 or newer) using Cocoa (32/64 bits) or Carbon (32 only).
|
||||
- Mac OS X (10.7 or newer) using Cocoa (32/64 bits).
|
||||
|
||||
Most popular C++ compilers are supported including but not limited to:
|
||||
|
||||
|
||||
@@ -244,10 +244,6 @@ set theProject to {projectName:"", conditions:{}, bklfiles:{¬
|
||||
{label:"libscintilla", entries:{"$(wxscintilla)"}, targets:{"dynamic", "static", "wxscintilla"}}, ¬
|
||||
{label:"libexpat", entries:{"$(wxexpat)"}, targets:{"dynamic", "static", "wxexpat"}} ¬
|
||||
}}
|
||||
set conditions of theProject to {"PLATFORM_MACOSX=='1'", "TOOLKIT=='OSX_CARBON'", "WXUNIV=='0'", "USE_GUI=='1' and WXUNIV=='0'"}
|
||||
set projectName of theProject to "wxcarbon"
|
||||
makeProject(theProject)
|
||||
|
||||
set conditions of theProject to {"PLATFORM_MACOSX=='1'", "TOOLKIT=='OSX_COCOA'", "WXUNIV=='0'", "USE_GUI=='1' and WXUNIV=='0'"}
|
||||
set projectName of theProject to "wxcocoa"
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ reads in the files lists from the files.bkl in the build/bakefiles directory, ev
|
||||
conditions in these definitions and then adds the correct files to the newly created Xcode
|
||||
projects
|
||||
|
||||
if you only need a specific target and not all three of them (carbon, cocoa, iphone) then you can
|
||||
if you only need a specific target and not all of them (cocoa, iphone) then you can
|
||||
comment the unneeded makeProject calls.
|
||||
|
||||
Prerequisites
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
WXTOOLKIT = carbon
|
||||
WXTOOLKITUPPER = CARBON
|
||||
|
||||
#include "wx.xcconfig"
|
||||
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.5
|
||||
SDKROOT = macosx10.6
|
||||
|
||||
GCC_VERSION[arch=ppc] = 4.0
|
||||
|
||||
ARCHS = ppc i386
|
||||
VALID_ARCHS = ppc i386
|
||||
|
||||
OTHER_LDFLAGS = -framework WebKit -framework IOKit -framework Carbon -framework Cocoa -framework AudioToolbox -framework AGL -framework OpenGL -framework QuickTime
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+47
-106
File diff suppressed because it is too large
Load Diff
@@ -27,6 +27,9 @@ Changes in behaviour not resulting in compilation errors
|
||||
- Using invalid flags with wxBoxSizer or wxGridSizer items now triggers asserts
|
||||
when done from the code or error messages when done in XRC.
|
||||
|
||||
- wxOSX/Carbon port doesn't exist any more, wxOSX/Cocoa will be silently used
|
||||
instead even if configure --with-osx_carbon option is used.
|
||||
|
||||
Changes in behaviour which may result in build errors
|
||||
-----------------------------------------------------
|
||||
|
||||
|
||||
@@ -37,11 +37,10 @@ using @ifdef_ and not @if_.
|
||||
Notice that for compatibility reasons, this symbol is defined for console
|
||||
applications under Windows as well, but it should only be used in the GUI code
|
||||
while <tt>__WINDOWS__</tt> should be used for the platform tests.}
|
||||
@itemdef{__WXOSX__, OS X GUI using any Apple widget framework (Carbon, AppKit or UIKit)}
|
||||
@itemdef{__WXOSX__, OS X GUI using any Apple widget framework (AppKit or UIKit)}
|
||||
@itemdef{__WXOSX_IPHONE__, OS X iPhone (UIKit)}
|
||||
@itemdef{__WXOSX_CARBON__, Mac OS X using Carbon}
|
||||
@itemdef{__WXOSX_COCOA__, Mac OS X using Cocoa (AppKit)}
|
||||
@itemdef{__WXOSX_MAC__, Mac OS X (Carbon or Cocoa)}
|
||||
@itemdef{__WXOSX_MAC__, Mac OS X (Cocoa)}
|
||||
@itemdef{__WXPM__, OS/2 native Presentation Manager (not used any longer).}
|
||||
@itemdef{__WXSTUBS__, Stubbed version ('template' wxWin implementation)}
|
||||
@itemdef{__WXXT__, Xt; mutually exclusive with WX_MOTIF, not implemented in wxWidgets 2.x}
|
||||
@@ -52,17 +51,13 @@ while <tt>__WINDOWS__</tt> should be used for the platform tests.}
|
||||
@itemdef{__X__, any X11-based GUI toolkit except GTK+}
|
||||
@endDefList
|
||||
|
||||
There are two wxWidgets ports to Mac OS X. One of them, wxOSX is the successor of the
|
||||
venerable wxMac, it currently exists in three versions: Carbon and Cocoa for the
|
||||
desktop and a very early iPhone port. And there is the Cocoa port named wxCocoa
|
||||
which has not been updated very actively since beginning 2008. To summarize:
|
||||
wxOSX is the successor of the venerable wxMac, it currently exists in two
|
||||
versions: Cocoa for the desktop and a very early iPhone port. To summarize:
|
||||
|
||||
@li If you want to test for wxOSX on the desktop, use
|
||||
<tt>__WXOSX_MAC__</tt>.
|
||||
@li If you want to test for wxOSX on the iPhone, use
|
||||
<tt>__WXOSX_IPHONE__</tt>.
|
||||
@li If you want to test for a particular GUI Mac port under OS X, use
|
||||
<tt>__WXOSX_CARBON__</tt> or <tt>__WXOSX_COCOA__</tt>.
|
||||
@li If you want to test for any port under Mac OS X, including, for
|
||||
example, wxGTK and also wxBase, use <tt>__DARWIN__</tt> (see below).
|
||||
|
||||
|
||||
@@ -89,13 +89,12 @@ mature. Both ports work on almost any Unix system (Linux, FreeBSD, OpenBSD,
|
||||
NetBSD, Solaris, AIX, ...) and require GTK+ 2.6 or later or GTK+ 3.x. The
|
||||
primary supported compiler is GNU g++.
|
||||
|
||||
@li wxOSX: wxOSX/Cocoa is the primary port for Apple computers, replacing the
|
||||
older and now deprecated wxOSX/Carbon port. wxOSX/Cocoa supports 32 or 64 bit
|
||||
Intel Macs running OS X 10.7 or later. The port can be built either with g++
|
||||
or clang.
|
||||
@li wxOSX: wxOSX/Cocoa is the only port for Apple computers. wxOSX/Cocoa
|
||||
supports 32 or 64 bit Intel Macs running OS X 10.7 or later. The port can be
|
||||
built either with g++ or clang.
|
||||
|
||||
Other platforms (e.g. iOS), compilers (Borland C++ under Windows,
|
||||
Sun CC, HP-UX aCC, IBM xlC or SGI mipsPro under Unix) and ports (wxOSX/Carbon,
|
||||
Sun CC, HP-UX aCC, IBM xlC or SGI mipsPro under Unix) and ports (
|
||||
wxGTK1, wxX11, wxDFB, wxPM...) are also supported but to a lesser extent.
|
||||
Please see the @subpage page_port "platform details page" for more information.
|
||||
|
||||
|
||||
@@ -61,9 +61,8 @@ distribution.
|
||||
|
||||
@subsection page_port_wxosx_cocoa wxOSX/Cocoa
|
||||
|
||||
wxOSX/Cocoa is the currently recommended port of wxWidgets for the Macintosh OS
|
||||
platform. It requires OS X 10.7 or later and, unlike wxOSX/Carbon, fully
|
||||
supports 64 bit builds.
|
||||
wxOSX/Cocoa is the only port of wxWidgets for the OS X platform. It requires
|
||||
OS X 10.7 or later and fully supports 64 bit builds.
|
||||
|
||||
This is the default port when building wxOSX, but in order to select it
|
||||
explicitly you can use
|
||||
@@ -74,28 +73,6 @@ For further information, please see the files in @c docs/osx in the
|
||||
distribution.
|
||||
|
||||
|
||||
@subsection page_port_wxosx_carbon wxOSX/Carbon
|
||||
|
||||
wxOSX/Carbon is an older port of wxWidgets for the Macintosh OS platform. Currently
|
||||
OS X 10.5 or higher are supported. wxOSX/Carbon can be compiled both using
|
||||
Apple's command line developer tools as well as Apple's Xcode IDE. wxOSX/Carbon
|
||||
supports Intel and PowerPC architectures and can be used to produce
|
||||
"universal binaries" in order create application which can run both
|
||||
architecture. Unfortunately, wxOSX/Carbon does not support any 64-bit
|
||||
architecture since Apple decided not to port its Carbon API entirely to 64-bit.
|
||||
|
||||
@note Carbon has been deprecated by Apple as of OS X 10.5 and will likely be
|
||||
removed entirely in a future OS version. It's recommended you look into
|
||||
switching your app over to wxOSX/Cocoa as soon as possible.
|
||||
|
||||
To build wxWidgets using wxOSX/Carbon you need to do
|
||||
|
||||
@verbatim configure --with-osx_carbon @endverbatim
|
||||
|
||||
For further information, please see the files in @c docs/osx in the
|
||||
distribution.
|
||||
|
||||
|
||||
|
||||
|
||||
@section page_port_wxx11 wxX11
|
||||
@@ -207,7 +184,6 @@ necessary to use the underlying toolkit API directly:
|
||||
- GLib docs at http://library.gnome.org/devel/glib/unstable/
|
||||
- GObject docs at http://library.gnome.org/devel/gobject/unstable/
|
||||
- Pango docs at http://library.gnome.org/devel/pango/unstable/
|
||||
- wxMac port uses the Carbon API: see Carbon docs at http://developer.apple.com/carbon
|
||||
- wxCocoa port uses the Cocoa API: see Cocoa docs at http://developer.apple.com/cocoa
|
||||
- wxOSX port uses the Cocoa API: see Cocoa docs at http://developer.apple.com/cocoa
|
||||
|
||||
*/
|
||||
|
||||
@@ -34,7 +34,7 @@ disadvantage is that it the widget will look the same on all platforms, and
|
||||
thus it may not integrate well with the native look and feel.
|
||||
|
||||
The second method is to build it directly upon the native toolkits of the
|
||||
platforms you want to support (e.g. GTK+, Carbon and GDI). In this way you'll
|
||||
platforms you want to support (e.g. GTK+, Cocoa and GDI). In this way you'll
|
||||
get a @b native widget. This method in fact has the advantage of a native look
|
||||
and feel but requires different implementations and thus more work.
|
||||
|
||||
|
||||
+5
-27
@@ -1,11 +1,7 @@
|
||||
wxWidgets for Mac OS X installation
|
||||
-----------------------------------
|
||||
|
||||
wxWidgets can be compiled using Apple's Cocoa or Carbon libraries.
|
||||
Cocoa is the more modern library, and Carbon is the older deprecated library.
|
||||
|
||||
In wxWidgets 3, Cocoa is the recommended library. While Carbon is still
|
||||
supported by Apple, little new work is being done in Carbon.
|
||||
wxWidgets can be compiled using Apple's Cocoa library.
|
||||
|
||||
Most Mac OS X developers should start by downloading and installing Xcode
|
||||
from http://developer.apple.com. It is a free IDE from Apple that provides
|
||||
@@ -18,10 +14,6 @@ Next use Terminal (under Applications, Utilities, Terminal) to access a command
|
||||
prompt. Use cd to change directories to your wxWidgets directory and execute
|
||||
one of the following sets of commands from the wxWidgets directory.
|
||||
|
||||
For Carbon, you'll need to have Xcode 3.x installed (you can also have Xcode 4.x
|
||||
installed, but the Carbon build needs 3.x, and the /Developer directory which is
|
||||
installed when you install Xcode 3.x.
|
||||
|
||||
---------
|
||||
|
||||
mkdir build-cocoa-debug
|
||||
@@ -34,22 +26,9 @@ cd demos; make;cd ..
|
||||
|
||||
---------
|
||||
|
||||
# Build the library for Carbon (old, deprecated, 32 bits only)
|
||||
mkdir build-carbon-debug
|
||||
cd build-carbon-debug
|
||||
../configure --with-carbon --enable-debug --disable-shared --enable-macosx_arch=i386 --with-macosx-sdk=/Developer/SDKs/MacOSX10.6.sdk CC=/Developer/usr/bin/gcc-4.2 CXX=/Developer/usr/bin/g++-4.2 LD=/Developer/usr/bin/ld
|
||||
make
|
||||
# Build the samples and demos
|
||||
cd samples;make;cd ..
|
||||
cd demos; make;cd ..
|
||||
|
||||
---------
|
||||
|
||||
After the compilation completes, use Finder to run the samples and demos
|
||||
Go to build-cocoa-debug/samples to experiment with the Cocoa samples.
|
||||
Go to build-cocoa-debug/demos to experiment with the Cocoa demos.
|
||||
Go to build-carbon-debug/samples to experiment with the Carbon samples.
|
||||
Go to build-carbon-debug/demos to experiment with the Carbon demos.
|
||||
Double-click on the executables which have an icon showing three small squares.
|
||||
The source code for the samples is in wxWidgets/samples
|
||||
The source code for the demos is in wxWidgets/demos
|
||||
@@ -92,8 +71,7 @@ Apple Developer Tools: Xcode
|
||||
----------------------------
|
||||
|
||||
You can use the project in build/osx/wxcocoa.xcodeproj to build the Cocoa
|
||||
version of wxWidgets (wxOSX/Cocoa) and build/osx/wxcarbon.xcodeproj to
|
||||
build the Carbon version of wxWidgets (wxOSX/Carbon). There are also sample
|
||||
version of wxWidgets (wxOSX/Cocoa). There are also sample
|
||||
projects supplied with the minimal sample.
|
||||
|
||||
Notice that the command line build above builds not just the library itself but
|
||||
@@ -112,9 +90,9 @@ to create universal binaries.
|
||||
|
||||
If using the Apple command line tools, pass --enable-universal_binary when
|
||||
configuring wxWidgets. This will create the libraries for all the supported
|
||||
architectures, currently ppc, i386 and x86_64 when using Cocoa (Carbon isn't
|
||||
available in 64 bit builds). You may explicitly specify the architectures to
|
||||
use as a comma-separated list, e.g. --enable-universal_binary=i386,x86_64.
|
||||
architectures, currently ppc, i386 and x86_64 . You may explicitly specify
|
||||
the architectures to use as a comma-separated list,
|
||||
e.g. --enable-universal_binary=i386,x86_64.
|
||||
|
||||
Notice that if you use wx-config --libs to link your application, the -arch
|
||||
flags are not added automatically as it is possible to link e.g. x86_64-only
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ wxWidgets currently supports the following primary platforms:
|
||||
|
||||
* Windows XP, Vista, 7, 8 and 10 (32/64 bits).
|
||||
* Most Unix variants using the GTK+ toolkit (version 2.6 or newer)
|
||||
* Mac OS X (10.7 or newer) using Cocoa (32/64 bits) or Carbon (32 only)
|
||||
* Mac OS X (10.7 or newer) using Cocoa (32/64 bits)
|
||||
|
||||
There is some support for the following platforms:
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
# elif !defined(__WXMOTIF__) && \
|
||||
!defined(__WXMSW__) && \
|
||||
!defined(__WXGTK__) && \
|
||||
!defined(__WXOSX_CARBON__) && \
|
||||
!defined(__WXOSX_COCOA__) && \
|
||||
!defined(__WXOSX_IPHONE__) && \
|
||||
!defined(__X__) && \
|
||||
@@ -2991,12 +2990,6 @@ typedef unsigned long WXDWORD;
|
||||
typedef unsigned short WXWORD;
|
||||
|
||||
typedef WX_OPAQUE_TYPE(PicHandle ) * WXHMETAFILE ;
|
||||
#if wxOSX_USE_CARBON
|
||||
typedef struct OpaqueControlRef* WXWidget ;
|
||||
typedef struct OpaqueWindowPtr* WXWindow ;
|
||||
typedef struct __AGLPixelFormatRec *WXGLPixelFormat;
|
||||
typedef struct __AGLContextRec *WXGLContext;
|
||||
#endif
|
||||
|
||||
typedef void* WXDisplay;
|
||||
|
||||
@@ -3041,9 +3034,6 @@ DECLARE_WXMAC_OPAQUE_REF( MenuRef )
|
||||
|
||||
typedef IconRef WXHICON ;
|
||||
typedef HIShapeRef WXHRGN;
|
||||
#if wxOSX_USE_CARBON
|
||||
typedef MenuRef WXHMENU;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -385,7 +385,7 @@ private:
|
||||
|
||||
#endif // wxUSE_SPINCTRL
|
||||
|
||||
#if defined(wxHAS_GENERIC_DATAVIEWCTRL) || defined(__WXOSX_CARBON__)
|
||||
#if defined(wxHAS_GENERIC_DATAVIEWCTRL)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxDataViewChoiceRenderer
|
||||
@@ -432,7 +432,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
#endif // generic or Carbon versions
|
||||
#endif // generic version
|
||||
|
||||
#if defined(wxHAS_GENERIC_DATAVIEWCTRL) || defined(__WXGTK__)
|
||||
|
||||
|
||||
@@ -285,17 +285,6 @@ public:
|
||||
}
|
||||
#endif // wxUSE_DATETIME
|
||||
|
||||
#if defined( __WXOSX_MAC__ ) && wxOSX_USE_CARBON
|
||||
bool MacSetTypeAndCreator( wxUint32 type , wxUint32 creator ) ;
|
||||
bool MacGetTypeAndCreator( wxUint32 *type , wxUint32 *creator ) const;
|
||||
// gets the 'common' type and creator for a certain extension
|
||||
static bool MacFindDefaultTypeAndCreator( const wxString& ext , wxUint32 *type , wxUint32 *creator ) ;
|
||||
// registers application defined extensions and their default type and creator
|
||||
static void MacRegisterDefaultTypeAndCreator( const wxString& ext , wxUint32 type , wxUint32 creator ) ;
|
||||
// looks up the appropriate type and creator from the registration and then sets
|
||||
bool MacSetDefaultTypeAndCreator() ;
|
||||
#endif
|
||||
|
||||
// various file/dir operations
|
||||
|
||||
// retrieve the value of the current working directory
|
||||
|
||||
@@ -171,10 +171,6 @@ public:
|
||||
wxUint32 m_atsuFontID;
|
||||
// the qd styles that are not intrinsic to the font above
|
||||
wxInt16 m_atsuAdditionalQDStyles;
|
||||
#if wxOSX_USE_CARBON
|
||||
wxInt16 m_qdFontFamily;
|
||||
wxInt16 m_qdFontStyle;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
int m_pointSize;
|
||||
|
||||
@@ -29,8 +29,6 @@ extern WXDLLIMPEXP_DATA_CORE(const char) wxListCtrlNameStr[];
|
||||
|
||||
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
|
||||
#include "wx/msw/listctrl.h"
|
||||
#elif defined(__WXMAC__) && !defined(__WXUNIVERSAL__) && wxOSX_USE_CARBON
|
||||
#include "wx/osx/listctrl.h"
|
||||
#elif defined(__WXQT__) && !defined(__WXUNIVERSAL__)
|
||||
#include "wx/qt/listctrl.h"
|
||||
#else
|
||||
|
||||
@@ -218,13 +218,6 @@ protected:
|
||||
virtual void DoMoveWindow(int x, int y, int w, int h) wxOVERRIDE;
|
||||
wxSize DoGetBestSize() const wxOVERRIDE;
|
||||
|
||||
//FIXME: This is nasty... find a better way to work around
|
||||
//inheritance issues
|
||||
#if defined(__WXOSX_CARBON__)
|
||||
virtual void MacVisibilityChanged();
|
||||
|
||||
friend class wxQTMediaBackend;
|
||||
#endif
|
||||
class wxMediaBackend* m_imp;
|
||||
bool m_bLoaded;
|
||||
|
||||
|
||||
@@ -119,15 +119,6 @@ public:
|
||||
bool MacSendKeyUpEvent( wxWindow* focus , long keyval , long modifiers , long when , wxChar uniChar ) ;
|
||||
bool MacSendCharEvent( wxWindow* focus , long keymessage , long modifiers , long when , wxChar uniChar ) ;
|
||||
void MacCreateKeyEvent( wxKeyEvent& event, wxWindow* focus , long keymessage , long modifiers , long when , wxChar uniChar ) ;
|
||||
#if wxOSX_USE_CARBON
|
||||
// we only have applescript on these
|
||||
virtual short MacHandleAEODoc(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ;
|
||||
virtual short MacHandleAEGURL(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ;
|
||||
virtual short MacHandleAEPDoc(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ;
|
||||
virtual short MacHandleAEOApp(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ;
|
||||
virtual short MacHandleAEQuit(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ;
|
||||
virtual short MacHandleAERApp(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ;
|
||||
#endif
|
||||
// in response of an openFiles message with Cocoa and an
|
||||
// open-document apple event
|
||||
virtual void MacOpenFiles(const wxArrayString &fileNames) ;
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* Name: wx/osx/carbon/chkconf.h
|
||||
* Purpose: Compiler-specific configuration checking
|
||||
* Author: Julian Smart
|
||||
* Modified by:
|
||||
* Created: 01/02/97
|
||||
* Copyright: (c) Julian Smart
|
||||
* Licence: wxWindows licence
|
||||
*/
|
||||
|
||||
#ifndef _WX_OSX_CARBON_CHKCONF_H_
|
||||
#define _WX_OSX_CARBON_CHKCONF_H_
|
||||
|
||||
/*
|
||||
* native (1) or emulated (0) toolbar
|
||||
* also support old notation wxMAC_USE_NATIVE_TOOLBAR
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifdef wxMAC_USE_NATIVE_TOOLBAR
|
||||
#define wxOSX_USE_NATIVE_TOOLBAR wxMAC_USE_NATIVE_TOOLBAR
|
||||
#endif
|
||||
|
||||
#ifndef wxOSX_USE_NATIVE_TOOLBAR
|
||||
#define wxOSX_USE_NATIVE_TOOLBAR 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* text rendering system
|
||||
*/
|
||||
|
||||
#define wxOSX_USE_ATSU_TEXT 1
|
||||
|
||||
/*
|
||||
* Audio System
|
||||
*/
|
||||
|
||||
#define wxOSX_USE_QUICKTIME 1
|
||||
#define wxOSX_USE_AUDIOTOOLBOX 0
|
||||
|
||||
#endif
|
||||
/* _WX_OSX_CARBON_CHKCONF_H_ */
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/osx/carbon/evtloop.h
|
||||
// Purpose: declaration of wxEventLoop for wxMac
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 2006-01-12
|
||||
// Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_MAC_CARBON_EVTLOOP_H_
|
||||
#define _WX_MAC_CARBON_EVTLOOP_H_
|
||||
|
||||
struct OpaqueEventRef;
|
||||
typedef OpaqueEventRef *EventRef;
|
||||
|
||||
class WXDLLIMPEXP_CORE wxGUIEventLoop : public wxCFEventLoop
|
||||
{
|
||||
public:
|
||||
wxGUIEventLoop();
|
||||
|
||||
virtual void WakeUp();
|
||||
|
||||
protected:
|
||||
virtual int DoDispatchTimeout(unsigned long timeout);
|
||||
|
||||
virtual void OSXDoRun();
|
||||
virtual void OSXDoStop();
|
||||
|
||||
virtual CFRunLoopRef CFGetCurrentRunLoop() const;
|
||||
};
|
||||
|
||||
#endif // _WX_MAC_CARBON_EVTLOOP_H_
|
||||
|
||||
@@ -1,117 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/osx/carbon/mimetype.h
|
||||
// Purpose: Mac Carbon implementation for wx mime-related classes
|
||||
// Author: Ryan Norton
|
||||
// Modified by:
|
||||
// Created: 04/16/2005
|
||||
// Copyright: (c) 2005 Ryan Norton (<wxprojects@comcast.net>)
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _MIMETYPE_IMPL_H
|
||||
#define _MIMETYPE_IMPL_H
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/mimetype.h"
|
||||
|
||||
|
||||
class wxMimeTypesManagerImpl
|
||||
{
|
||||
public :
|
||||
//kinda kooky but in wxMimeTypesManager::EnsureImpl it doesn't call
|
||||
//initialize, so we do it ourselves
|
||||
wxMimeTypesManagerImpl() : m_hIC(NULL) { Initialize(); }
|
||||
~wxMimeTypesManagerImpl() { ClearData(); }
|
||||
|
||||
// load all data into memory - done when it is needed for the first time
|
||||
void Initialize(int mailcapStyles = wxMAILCAP_STANDARD,
|
||||
const wxString& extraDir = wxEmptyString);
|
||||
|
||||
// and delete the data here
|
||||
void ClearData();
|
||||
|
||||
// implement containing class functions
|
||||
wxFileType *GetFileTypeFromExtension(const wxString& ext);
|
||||
wxFileType *GetOrAllocateFileTypeFromExtension(const wxString& ext) ;
|
||||
wxFileType *GetFileTypeFromMimeType(const wxString& mimeType);
|
||||
|
||||
size_t EnumAllFileTypes(wxArrayString& mimetypes);
|
||||
|
||||
void AddFallback(const wxFileTypeInfo& ft) { m_fallbacks.Add(ft); }
|
||||
|
||||
// create a new filetype association
|
||||
wxFileType *Associate(const wxFileTypeInfo& ftInfo);
|
||||
// remove association
|
||||
bool Unassociate(wxFileType *ft);
|
||||
|
||||
private:
|
||||
wxArrayFileTypeInfo m_fallbacks;
|
||||
void* m_hIC;
|
||||
void** m_hDatabase;
|
||||
long m_lCount;
|
||||
|
||||
void* pReserved1;
|
||||
void* pReserved2;
|
||||
void* pReserved3;
|
||||
void* pReserved4;
|
||||
void* pReserved5;
|
||||
void* pReserved6;
|
||||
|
||||
friend class wxFileTypeImpl;
|
||||
};
|
||||
|
||||
class wxFileTypeImpl
|
||||
{
|
||||
public:
|
||||
//kind of nutty, but mimecmn.cpp creates one with an empty new
|
||||
wxFileTypeImpl() : m_manager(NULL) {}
|
||||
~wxFileTypeImpl() {} //for those broken compilers
|
||||
|
||||
// implement accessor functions
|
||||
bool GetExtensions(wxArrayString& extensions);
|
||||
bool GetMimeType(wxString *mimeType) const;
|
||||
bool GetMimeTypes(wxArrayString& mimeTypes) const;
|
||||
bool GetIcon(wxIconLocation *iconLoc) const;
|
||||
bool GetDescription(wxString *desc) const;
|
||||
bool GetOpenCommand(wxString *openCmd,
|
||||
const wxFileType::MessageParameters&) const;
|
||||
bool GetPrintCommand(wxString *printCmd,
|
||||
const wxFileType::MessageParameters&) const;
|
||||
|
||||
size_t GetAllCommands(wxArrayString * verbs, wxArrayString * commands,
|
||||
const wxFileType::MessageParameters& params) const;
|
||||
|
||||
// remove the record for this file type
|
||||
// probably a mistake to come here, use wxMimeTypesManager.Unassociate (ft) instead
|
||||
bool Unassociate(wxFileType *ft)
|
||||
{
|
||||
return m_manager->Unassociate(ft);
|
||||
}
|
||||
|
||||
// set an arbitrary command, ask confirmation if it already exists and
|
||||
// overwriteprompt is TRUE
|
||||
bool SetCommand(const wxString& cmd, const wxString& verb, bool overwriteprompt = true);
|
||||
bool SetDefaultIcon(const wxString& strIcon = wxEmptyString, int index = 0);
|
||||
|
||||
private:
|
||||
void Init(wxMimeTypesManagerImpl *manager, long lIndex)
|
||||
{ m_manager=(manager); m_lIndex=(lIndex); }
|
||||
|
||||
// helper function
|
||||
wxString GetCommand(const wxString& verb) const;
|
||||
|
||||
wxMimeTypesManagerImpl *m_manager;
|
||||
long m_lIndex;
|
||||
|
||||
void* pReserved1;
|
||||
void* pReserved2;
|
||||
void* pReserved3;
|
||||
void* pReserved4;
|
||||
void* pReserved5;
|
||||
void* pReserved6;
|
||||
|
||||
friend class wxMimeTypesManagerImpl;
|
||||
};
|
||||
|
||||
#endif
|
||||
//_MIMETYPE_H
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,52 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/osx/carbon/private/mactext.h
|
||||
// Purpose: private wxMacTextControl base class
|
||||
// Author: Stefan Csomor
|
||||
// Modified by:
|
||||
// Created: 03/02/99
|
||||
// Copyright: (c) Stefan Csomor
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_MAC_PRIVATE_MACTEXT_H_
|
||||
#define _WX_MAC_PRIVATE_MACTEXT_H_
|
||||
|
||||
#include "wx/osx/private.h"
|
||||
|
||||
// implementation exposed, so that search control can pull it
|
||||
|
||||
class wxMacUnicodeTextControl : public wxMacControl, public wxTextWidgetImpl
|
||||
{
|
||||
public :
|
||||
wxMacUnicodeTextControl( wxTextCtrl *wxPeer ) ;
|
||||
wxMacUnicodeTextControl( wxTextCtrl *wxPeer,
|
||||
const wxString& str,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size, long style ) ;
|
||||
virtual ~wxMacUnicodeTextControl();
|
||||
|
||||
virtual bool CanFocus() const
|
||||
{ return true; }
|
||||
virtual void VisibilityChanged(bool shown);
|
||||
virtual wxString GetStringValue() const ;
|
||||
virtual void SetStringValue( const wxString &str) ;
|
||||
virtual void Copy();
|
||||
virtual void Cut();
|
||||
virtual void Paste();
|
||||
virtual bool CanPaste() const;
|
||||
virtual void SetEditable(bool editable) ;
|
||||
virtual void GetSelection( long* from, long* to) const ;
|
||||
virtual void SetSelection( long from , long to ) ;
|
||||
virtual void WriteText(const wxString& str) ;
|
||||
|
||||
protected :
|
||||
void InstallEventHandlers();
|
||||
|
||||
// contains the tag for the content (is different for password and non-password controls)
|
||||
OSType m_valueTag ;
|
||||
WXEVENTHANDLERREF m_macTextCtrlEventHandler ;
|
||||
public :
|
||||
ControlEditTextSelectionRec m_selection ;
|
||||
};
|
||||
|
||||
#endif // _WX_MAC_PRIVATE_MACTEXT_H_
|
||||
@@ -60,17 +60,6 @@ private:
|
||||
|
||||
WXDLLIMPEXP_CORE wxPrintNativeDataBase* wxOSXCreatePrintData();
|
||||
|
||||
#if wxOSX_USE_CARBON
|
||||
class WXDLLIMPEXP_CORE wxOSXCarbonPrintData : public wxOSXPrintData
|
||||
{
|
||||
public:
|
||||
wxOSXCarbonPrintData();
|
||||
virtual ~wxOSXCarbonPrintData();
|
||||
private:
|
||||
wxDECLARE_DYNAMIC_CLASS(wxOSXCarbonPrintData);
|
||||
} ;
|
||||
#endif
|
||||
|
||||
#if wxOSX_USE_COCOA
|
||||
class WXDLLIMPEXP_CORE wxOSXCocoaPrintData : public wxOSXPrintData
|
||||
{
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/osx/carbon/private/timer.h
|
||||
// Purpose: wxTimer class
|
||||
// Author: Stefan Csomor
|
||||
// Created: 1998-01-01
|
||||
// Copyright: (c) Stefan Csomor
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_MAC_PRIVATE_TIMER_H_
|
||||
#define _WX_MAC_PRIVATE_TIMER_H_
|
||||
|
||||
#include "wx/private/timer.h"
|
||||
|
||||
struct MacTimerInfo;
|
||||
|
||||
class WXDLLIMPEXP_CORE wxCarbonTimerImpl : public wxTimerImpl
|
||||
{
|
||||
public:
|
||||
wxCarbonTimerImpl(wxTimer *timer);
|
||||
virtual ~wxCarbonTimerImpl();
|
||||
|
||||
virtual bool Start(int milliseconds = -1, bool one_shot = false);
|
||||
virtual void Stop();
|
||||
|
||||
virtual bool IsRunning() const;
|
||||
|
||||
private:
|
||||
MacTimerInfo *m_info;
|
||||
};
|
||||
|
||||
#endif // _WX_MAC_PRIVATE_TIMER_H_
|
||||
@@ -1,64 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/osx/carbon/statbmp.h
|
||||
// Purpose: wxStaticBitmap class
|
||||
// Author: Stefan Csomor
|
||||
// Modified by:
|
||||
// Created: 1998-01-01
|
||||
// Copyright: (c) Stefan Csomor
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_STATBMP_H_
|
||||
#define _WX_STATBMP_H_
|
||||
|
||||
#include "wx/icon.h"
|
||||
|
||||
class WXDLLIMPEXP_CORE wxStaticBitmap: public wxStaticBitmapBase
|
||||
{
|
||||
wxDECLARE_DYNAMIC_CLASS(wxStaticBitmap);
|
||||
public:
|
||||
wxStaticBitmap() { }
|
||||
|
||||
wxStaticBitmap(wxWindow *parent, wxWindowID id,
|
||||
const wxBitmap& label,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxStaticBitmapNameStr)
|
||||
{
|
||||
Create(parent, id, label, pos, size, style, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent, wxWindowID id,
|
||||
const wxBitmap& label,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxStaticBitmapNameStr);
|
||||
|
||||
virtual void SetBitmap(const wxBitmap& bitmap);
|
||||
|
||||
virtual void Command(wxCommandEvent& WXUNUSED(event)) {}
|
||||
virtual void ProcessCommand(wxCommandEvent& WXUNUSED(event)) {}
|
||||
void OnPaint( wxPaintEvent &event ) ;
|
||||
|
||||
wxBitmap GetBitmap() const { return m_bitmap; }
|
||||
wxIcon GetIcon() const
|
||||
{
|
||||
// icons and bitmaps are really the same thing in wxMac
|
||||
return (const wxIcon &)m_bitmap;
|
||||
}
|
||||
void SetIcon(const wxIcon& icon) { SetBitmap( (const wxBitmap &)icon ) ; }
|
||||
|
||||
// overridden base class virtuals
|
||||
virtual bool AcceptsFocus() const { return false; }
|
||||
|
||||
protected:
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
|
||||
wxBitmap m_bitmap;
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
};
|
||||
|
||||
#endif
|
||||
// _WX_STATBMP_H_
|
||||
@@ -74,8 +74,6 @@
|
||||
|
||||
#if wxOSX_USE_IPHONE
|
||||
#include "wx/osx/iphone/chkconf.h"
|
||||
#elif wxOSX_USE_CARBON
|
||||
#include "wx/osx/carbon/chkconf.h"
|
||||
#elif wxOSX_USE_COCOA
|
||||
#include "wx/osx/cocoa/chkconf.h"
|
||||
#endif
|
||||
|
||||
@@ -26,11 +26,7 @@ class wxComboWidgetImpl;
|
||||
// Combobox item
|
||||
class WXDLLIMPEXP_CORE wxComboBox :
|
||||
public wxWindowWithItems<
|
||||
#if wxOSX_USE_CARBON
|
||||
wxNavigationEnabled<wxControl>,
|
||||
#else
|
||||
wxControl,
|
||||
#endif
|
||||
wxComboBoxBase>
|
||||
{
|
||||
wxDECLARE_DYNAMIC_CLASS(wxComboBox);
|
||||
@@ -38,12 +34,6 @@ class WXDLLIMPEXP_CORE wxComboBox :
|
||||
public:
|
||||
virtual ~wxComboBox();
|
||||
|
||||
#if wxOSX_USE_CARBON
|
||||
// forward these functions to all subcontrols
|
||||
virtual bool Enable(bool enable = true);
|
||||
virtual bool Show(bool show = true);
|
||||
#endif
|
||||
|
||||
// callback functions
|
||||
virtual void DelegateTextChanged( const wxString& value );
|
||||
virtual void DelegateChoice( const wxString& value );
|
||||
@@ -105,38 +95,6 @@ class WXDLLIMPEXP_CORE wxComboBox :
|
||||
|
||||
virtual void SetValue(const wxString& value);
|
||||
// these methods are provided by wxTextEntry for the native impl.
|
||||
#if wxOSX_USE_CARBON
|
||||
// Text field functions
|
||||
virtual wxString GetValue() const;
|
||||
virtual void WriteText(const wxString& text);
|
||||
|
||||
// Clipboard operations
|
||||
virtual void Copy();
|
||||
virtual void Cut();
|
||||
virtual void Paste();
|
||||
virtual void SetInsertionPoint(long pos);
|
||||
virtual void SetInsertionPointEnd();
|
||||
virtual long GetInsertionPoint() const;
|
||||
virtual wxTextPos GetLastPosition() const;
|
||||
virtual void Replace(long from, long to, const wxString& value);
|
||||
virtual void Remove(long from, long to);
|
||||
virtual void SetEditable(bool editable);
|
||||
virtual bool IsEditable() const;
|
||||
|
||||
virtual void Undo();
|
||||
virtual void Redo();
|
||||
virtual void SelectAll();
|
||||
|
||||
virtual bool CanCopy() const;
|
||||
virtual bool CanCut() const;
|
||||
virtual bool CanPaste() const;
|
||||
virtual bool CanUndo() const;
|
||||
virtual bool CanRedo() const;
|
||||
|
||||
virtual wxClientDataType GetClientDataType() const;
|
||||
|
||||
virtual wxTextWidgetImpl* GetTextPeer() const;
|
||||
#endif // wxOSX_USE_CARBON
|
||||
|
||||
#if wxOSX_USE_COCOA
|
||||
virtual void Popup();
|
||||
@@ -157,16 +115,10 @@ protected:
|
||||
virtual void DoClear();
|
||||
|
||||
// wxTextEntry functions
|
||||
#if wxOSX_USE_CARBON
|
||||
virtual wxString DoGetValue() const;
|
||||
#endif
|
||||
virtual wxWindow *GetEditableWindow() { return this; }
|
||||
|
||||
// override the base class virtuals involved in geometry calculations
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
#if wxOSX_USE_CARBON
|
||||
virtual void DoMoveWindow(int x, int y, int width, int height);
|
||||
#endif
|
||||
|
||||
virtual int DoInsertItems(const wxArrayStringsAdapter& items,
|
||||
unsigned int pos,
|
||||
@@ -175,9 +127,6 @@ protected:
|
||||
virtual void DoSetItemClientData(unsigned int n, void* clientData);
|
||||
virtual void * DoGetItemClientData(unsigned int n) const;
|
||||
|
||||
#if wxOSX_USE_CARBON
|
||||
virtual void SetClientDataType(wxClientDataType clientDataItemsType);
|
||||
#endif
|
||||
|
||||
virtual void EnableTextChangedEvents(bool enable);
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#define __BSD__ 1
|
||||
#define __DARWIN__ 1
|
||||
#define wx_USE_NANOX 0
|
||||
#define TARGET_CARBON 1
|
||||
|
||||
#define HAVE_EXPLICIT 1
|
||||
#define HAVE_VA_COPY 1
|
||||
|
||||
@@ -12,11 +12,7 @@
|
||||
|
||||
#include "wx/dataview.h"
|
||||
|
||||
#if wxOSX_USE_CARBON
|
||||
typedef wxMacControl wxWidgetImplType;
|
||||
#else
|
||||
typedef wxWidgetImpl wxWidgetImplType;
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// Helper functions for dataview implementation on OSX
|
||||
|
||||
@@ -128,11 +128,7 @@ class wxSearchCtrl;
|
||||
|
||||
WXDLLIMPEXP_CORE wxWindowMac * wxFindWindowFromWXWidget(WXWidget inControl );
|
||||
|
||||
#if wxOSX_USE_CARBON
|
||||
typedef wxMacControl wxWidgetImplType;
|
||||
#else
|
||||
typedef wxWidgetImpl wxWidgetImplType;
|
||||
#endif
|
||||
|
||||
#if wxUSE_MENUS
|
||||
class wxMenuItemImpl : public wxObject
|
||||
|
||||
@@ -29,8 +29,6 @@ enum wxDateTimeWidgetKind
|
||||
class wxDateTimeWidgetImpl
|
||||
#if wxOSX_USE_COCOA
|
||||
: public wxWidgetCocoaImpl
|
||||
#elif wxOSX_USE_CARBON
|
||||
: public wxMacControl
|
||||
#else
|
||||
#error "Unsupported platform"
|
||||
#endif
|
||||
@@ -58,10 +56,6 @@ protected:
|
||||
: wxWidgetCocoaImpl(wxpeer, view)
|
||||
{
|
||||
}
|
||||
#elif wxOSX_USE_CARBON
|
||||
// There is no Carbon implementation of this control yet so we don't need
|
||||
// any ctor for it yet but it should be added here if Carbon version is
|
||||
// written later.
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -13,11 +13,7 @@
|
||||
#ifndef _WX_OSX_EVTLOOP_H_
|
||||
#define _WX_OSX_EVTLOOP_H_
|
||||
|
||||
#ifdef __WXOSX_COCOA__
|
||||
#include "wx/osx/cocoa/evtloop.h"
|
||||
#else
|
||||
#include "wx/osx/carbon/evtloop.h"
|
||||
#endif
|
||||
#include "wx/osx/cocoa/evtloop.h"
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxWindow;
|
||||
class WXDLLIMPEXP_FWD_CORE wxNonOwnedWindow;
|
||||
|
||||
@@ -139,14 +139,6 @@ public:
|
||||
|
||||
// Mac-specific, risks to change, don't use in portable code
|
||||
|
||||
#if wxOSX_USE_CARBON && wxOSX_USE_ATSU_TEXT
|
||||
wxUint16 MacGetThemeFontID() const ;
|
||||
|
||||
// 'old' Quickdraw accessors
|
||||
short MacGetFontNum() const;
|
||||
wxByte MacGetFontStyle() const;
|
||||
#endif
|
||||
|
||||
#if wxOSX_USE_COCOA_OR_CARBON
|
||||
CGFontRef OSXGetCGFont() const;
|
||||
#endif
|
||||
|
||||
@@ -131,20 +131,6 @@ public:
|
||||
|
||||
// implementation-only from now on
|
||||
|
||||
#if wxOSX_USE_CARBON
|
||||
// Unlike some other platforms, this must get called if you override it,
|
||||
// i.e. don't forget "event.Skip()" in your EVT_SIZE handler
|
||||
void OnSize(wxSizeEvent& event);
|
||||
|
||||
virtual void MacSuperChangedPosition();
|
||||
virtual void MacTopLevelWindowChangedPosition();
|
||||
virtual void MacVisibilityChanged();
|
||||
|
||||
void MacUpdateView();
|
||||
|
||||
GLint GetAglBufferName() const { return m_bufferName; }
|
||||
#endif
|
||||
|
||||
protected:
|
||||
WXGLPixelFormat m_glFormat;
|
||||
|
||||
|
||||
@@ -167,10 +167,6 @@ protected:
|
||||
wxArrayPtrVoid m_itemsClientData;
|
||||
|
||||
private:
|
||||
#ifdef __WXOSX_CARBON__
|
||||
// It needs to call our CalcAndSendEvent().
|
||||
friend class wxMacDataBrowserListControl;
|
||||
#endif // Carbon
|
||||
|
||||
wxDECLARE_DYNAMIC_CLASS(wxListBox);
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
|
||||
#if wxOSX_USE_IPHONE
|
||||
#include "wx/osx/iphone/private.h"
|
||||
#elif wxOSX_USE_CARBON
|
||||
#include "wx/osx/carbon/private.h"
|
||||
#elif wxOSX_USE_COCOA
|
||||
#include "wx/osx/cocoa/private.h"
|
||||
#elif wxUSE_GUI
|
||||
|
||||
@@ -1,5 +1 @@
|
||||
#ifdef __WXMAC_CLASSIC__
|
||||
#include "wx/osx/classic/private/print.h"
|
||||
#else
|
||||
#include "wx/osx/carbon/private/print.h"
|
||||
#endif
|
||||
|
||||
@@ -1,11 +1,3 @@
|
||||
/* common warning snippet for all osx direct includes */
|
||||
|
||||
#ifndef wxOSX_USE_CARBON
|
||||
#error "this files should only be included after platform.h was included"
|
||||
#endif
|
||||
|
||||
#if 1 // revert to wxOSX_USE_COCOA_OR_IPHONE in case of problems
|
||||
#include "wx/osx/core/private/timer.h"
|
||||
#elif wxOSX_USE_CARBON
|
||||
#include "wx/osx/carbon/private/timer.h"
|
||||
#endif
|
||||
|
||||
@@ -34,16 +34,6 @@ public :
|
||||
// does the true work of stopping and cleaning up
|
||||
virtual void DoStop() = 0;
|
||||
|
||||
#if wxOSX_USE_CARBON
|
||||
// can be called by a timer for repeated tasks during playback
|
||||
virtual void SoundTask();
|
||||
|
||||
protected :
|
||||
void CreateAndStartTimer();
|
||||
|
||||
wxSoundTimer* m_pTimer;
|
||||
#endif // wxOSX_USE_CARBON
|
||||
|
||||
protected:
|
||||
unsigned int m_flags;
|
||||
bool m_markedForDeletion;
|
||||
|
||||
@@ -1,6 +1,2 @@
|
||||
#if wxOSX_USE_CARBON
|
||||
#include "wx/osx/carbon/statbmp.h"
|
||||
#else
|
||||
#define wxGenericStaticBitmap wxStaticBitmap
|
||||
#include "wx/generic/statbmpg.h"
|
||||
#endif
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
#if wxOSX_USE_CARBON
|
||||
#include "wx/osx/carbon/uma.h"
|
||||
#endif
|
||||
|
||||
@@ -19,10 +19,7 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
|
||||
class WXDLLIMPEXP_FWD_CORE wxPanel;
|
||||
class WXDLLIMPEXP_FWD_CORE wxNonOwnedWindow;
|
||||
|
||||
#if wxOSX_USE_CARBON
|
||||
class WXDLLIMPEXP_FWD_CORE wxMacControl ;
|
||||
typedef wxMacControl wxOSXWidgetImpl;
|
||||
#elif wxOSX_USE_COCOA_OR_IPHONE
|
||||
#if wxOSX_USE_COCOA_OR_IPHONE
|
||||
class WXDLLIMPEXP_FWD_CORE wxWidgetImpl ;
|
||||
typedef wxWidgetImpl wxOSXWidgetImpl;
|
||||
#endif
|
||||
|
||||
@@ -13,9 +13,7 @@
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if defined(__WXMAC__) && wxOSX_USE_CARBON
|
||||
#define wxHAS_NATIVE_OVERLAY 1
|
||||
#elif defined(__WXDFB__)
|
||||
#if defined(__WXDFB__)
|
||||
#define wxHAS_NATIVE_OVERLAY 1
|
||||
#else
|
||||
// don't define wxHAS_NATIVE_OVERLAY
|
||||
|
||||
@@ -289,10 +289,6 @@
|
||||
/* __DARWIN__ is our own define to mean OS X or pure Darwin */
|
||||
# ifndef __DARWIN__
|
||||
# define __DARWIN__ 1
|
||||
# endif
|
||||
/* NOTE: TARGET_CARBON is actually a 0/1 and must be 1 for OS X */
|
||||
# ifndef TARGET_CARBON
|
||||
# define TARGET_CARBON 1
|
||||
# endif
|
||||
/* OS X uses unsigned long size_t for both ILP32 and LP64 modes. */
|
||||
# if !defined(wxSIZE_T_IS_UINT) && !defined(wxSIZE_T_IS_ULONG)
|
||||
@@ -415,10 +411,10 @@
|
||||
whatever reason.
|
||||
|
||||
The primary symbol remains __WXOSX_XXX__ one, __WXOSX__ exists to allow
|
||||
checking for any OS X port (Carbon and Cocoa) and __WXMAC__ is an old name
|
||||
checking for any OS X port (Cocoa) and __WXMAC__ is an old name
|
||||
for it.
|
||||
*/
|
||||
#if defined(__WXOSX_CARBON__) || defined(__WXOSX_COCOA__) || defined(__WXOSX_IPHONE__)
|
||||
#if defined(__WXOSX_COCOA__) || defined(__WXOSX_IPHONE__)
|
||||
# ifndef __WXOSX__
|
||||
# define __WXOSX__ 1
|
||||
# endif
|
||||
@@ -435,8 +431,8 @@
|
||||
# error "incorrect SDK for an iPhone build"
|
||||
# endif
|
||||
# else
|
||||
# if wxUSE_GUI && !(defined(__WXOSX_CARBON__) || defined(__WXOSX_COCOA__))
|
||||
# error "one of __WXOSX_IPHONE__, __WXOSX_CARBON__ or __WXOSX_COCOA__ must be defined for the GUI build"
|
||||
# if wxUSE_GUI && !defined(__WXOSX_COCOA__)
|
||||
# error "one of __WXOSX_IPHONE__ or __WXOSX_COCOA__ must be defined for the GUI build"
|
||||
# endif
|
||||
# if !( defined(TARGET_OS_MAC) && TARGET_OS_MAC )
|
||||
# error "incorrect SDK for a Mac OS X build"
|
||||
|
||||
@@ -75,8 +75,8 @@ enum wxPortId
|
||||
wxPORT_X11 = 1 << 5, // wxX11, using wxUniversal
|
||||
wxPORT_PM = 1 << 6, // wxOS2, using OS/2 Presentation Manager
|
||||
wxPORT_OS2 = wxPORT_PM, // wxOS2, using OS/2 Presentation Manager
|
||||
wxPORT_MAC = 1 << 7, // wxOSX (former wxMac), using Cocoa, Carbon or iPhone API
|
||||
wxPORT_OSX = wxPORT_MAC, // wxOSX, using Cocoa, Carbon or iPhone API
|
||||
wxPORT_MAC = 1 << 7, // wxOSX (former wxMac), using Cocoa or iPhone API
|
||||
wxPORT_OSX = wxPORT_MAC, // wxOSX, using Cocoa or iPhone API
|
||||
wxPORT_COCOA = 1 << 8, // wxCocoa, using Cocoa NextStep/Mac API
|
||||
wxPORT_WINCE = 1 << 9, // wxWinCE, toolkit is WinCE SDK API
|
||||
wxPORT_QT = 1 << 10 // wxQT, using QT4
|
||||
|
||||
@@ -926,8 +926,7 @@ protected:
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
typedef wxRibbonMSWArtProvider wxRibbonDefaultArtProvider;
|
||||
#elif defined(__WXOSX_CARBON__) || \
|
||||
defined(__WXOSX_COCOA__) || \
|
||||
#elif defined(__WXOSX_COCOA__) || \
|
||||
defined(__WXOSX_IPHONE__)
|
||||
// TODO: Once implemented, change typedef to OSX
|
||||
// typedef wxRibbonOSXArtProvider wxRibbonDefaultArtProvider;
|
||||
|
||||
+2
-6
@@ -58,12 +58,8 @@
|
||||
// must do everything ourselves
|
||||
#undef wxHAS_NATIVE_ENABLED_MANAGEMENT
|
||||
#elif defined(__WXOSX__)
|
||||
#if wxOSX_USE_CARBON
|
||||
#define wxHAS_NATIVE_ENABLED_MANAGEMENT
|
||||
#else
|
||||
// must do everything ourselves
|
||||
#undef wxHAS_NATIVE_ENABLED_MANAGEMENT
|
||||
#endif
|
||||
// must do everything ourselves
|
||||
#undef wxHAS_NATIVE_ENABLED_MANAGEMENT
|
||||
#else
|
||||
#define wxHAS_NATIVE_ENABLED_MANAGEMENT
|
||||
#endif
|
||||
|
||||
+1
-2
@@ -1000,8 +1000,7 @@ public:
|
||||
virtual void MacNewFile();
|
||||
|
||||
/**
|
||||
Called in response of an openFiles message with Cocoa, or an
|
||||
"open-document" Apple event with Carbon.
|
||||
Called in response of an openFiles message.
|
||||
|
||||
You need to override this method in order to open one or more document
|
||||
files after the user double clicked on it or if the files and/or
|
||||
|
||||
@@ -85,11 +85,7 @@
|
||||
bitmap but uses a standard id would display a label too.
|
||||
@style{wxBORDER_NONE}
|
||||
Creates a button without border. This is currently implemented in MSW,
|
||||
GTK2 and OSX/Cocoa and OSX/Carbon ports but in the latter only applies
|
||||
to buttons with bitmaps and using bitmap of one of the standard sizes
|
||||
only, namely 128*128, 48*48, 24*24 or 16*16. In all the other cases
|
||||
wxBORDER_NONE is ignored under OSX/Carbon (these restrictions don't
|
||||
exist in OSX/Cocoa however).
|
||||
GTK2 and OSX/Cocoa.
|
||||
@endStyleTable
|
||||
|
||||
@beginEventEmissionTable{wxCommandEvent}
|
||||
|
||||
@@ -182,9 +182,6 @@ public:
|
||||
@return
|
||||
@true if this item should be enabled, @false otherwise.
|
||||
|
||||
@note Currently disabling items is not supported by the wxOSX/Carbon
|
||||
implementation.
|
||||
|
||||
@since 2.9.2
|
||||
*/
|
||||
virtual bool IsEnabled(const wxDataViewItem &item,
|
||||
@@ -1274,8 +1271,6 @@ public:
|
||||
|
||||
Doesn't do anything if the item or this column is not editable.
|
||||
|
||||
@note Currently not implemented in wxOSX/Carbon.
|
||||
|
||||
@since 2.9.4
|
||||
*/
|
||||
virtual void EditItem(const wxDataViewItem& item, const wxDataViewColumn *column);
|
||||
|
||||
@@ -31,8 +31,8 @@ const char wxMessageBoxCaptionStr[] = "Message";
|
||||
Puts a Help button to the message box. This button can have special
|
||||
appearance or be specially positioned if its label is not changed from
|
||||
the default one. Notice that using this button is not supported when
|
||||
showing a message box from non-main thread in wxOSX/Cocoa and it is not
|
||||
supported in wxOSX/Carbon at all. Available since wxWidgets 2.9.3.
|
||||
showing a message box from non-main thread in wxOSX/Cocoa.
|
||||
Available since wxWidgets 2.9.3.
|
||||
@style{wxNO_DEFAULT}
|
||||
Makes the "No" button default, can only be used with @c wxYES_NO.
|
||||
@style{wxCANCEL_DEFAULT}
|
||||
|
||||
@@ -1279,7 +1279,7 @@ public:
|
||||
The returned number is the number of logical lines, i.e. just the count
|
||||
of the number of newline characters in the control + 1, for wxGTK and
|
||||
wxOSX/Cocoa ports while it is the number of physical lines, i.e. the
|
||||
count of lines actually shown in the control, in wxMSW and wxOSX/Carbon.
|
||||
count of lines actually shown in the control, in wxMSW.
|
||||
Because of this discrepancy, it is not recommended to use this function.
|
||||
|
||||
@remarks
|
||||
|
||||
@@ -588,7 +588,7 @@ public:
|
||||
@param vflag
|
||||
Whether the vertical scroll bar should always be visible.
|
||||
|
||||
@remarks This function is currently only implemented under Mac/Carbon.
|
||||
@remarks This function is currently not implemented.
|
||||
*/
|
||||
virtual void AlwaysShowScrollbars(bool hflag = true, bool vflag = true);
|
||||
|
||||
@@ -2750,9 +2750,7 @@ public:
|
||||
animation time for the current platform is used.
|
||||
|
||||
@note Currently this function is only implemented in wxMSW and wxOSX
|
||||
(for wxTopLevelWindows only in Carbon version and for any kind of
|
||||
windows in Cocoa) and does the same thing as Show() in the other
|
||||
ports.
|
||||
and does the same thing as Show() in the other ports.
|
||||
|
||||
@since 2.9.0
|
||||
|
||||
|
||||
@@ -178,9 +178,6 @@ bool MyApp::OnInit()
|
||||
new wxDocTemplate(docManager, "Drawing", "*.drw", "", "drw",
|
||||
"Drawing Doc", "Drawing View",
|
||||
CLASSINFO(DrawingDocument), CLASSINFO(DrawingView));
|
||||
#if defined( __WXMAC__ ) && wxOSX_USE_CARBON
|
||||
wxFileName::MacRegisterDefaultTypeAndCreator("drw" , 'WXMB' , 'WXMA');
|
||||
#endif
|
||||
|
||||
if ( m_mode == Mode_Single )
|
||||
{
|
||||
@@ -194,9 +191,6 @@ bool MyApp::OnInit()
|
||||
new wxDocTemplate(docManager, "Text", "*.txt;*.text", "", "txt;text",
|
||||
"Text Doc", "Text View",
|
||||
CLASSINFO(TextEditDocument), CLASSINFO(TextEditView));
|
||||
#if defined( __WXMAC__ ) && wxOSX_USE_CARBON
|
||||
wxFileName::MacRegisterDefaultTypeAndCreator("txt" , 'TEXT' , 'WXMA');
|
||||
#endif
|
||||
// Create a template relating image documents to their views
|
||||
new wxDocTemplate(docManager, "Image", "*.png;*.jpg", "", "png;jpg",
|
||||
"Image Doc", "Image View",
|
||||
|
||||
@@ -27,8 +27,6 @@
|
||||
//
|
||||
// 1) Certain backends can't play the same media file at the same time (MCI,
|
||||
// Cocoa NSMovieView-Quicktime).
|
||||
// 2) Positioning on Mac Carbon is messed up if put in a sub-control like a
|
||||
// Notebook (like this sample does).
|
||||
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
// ============================================================================
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>$(PRODUCT_NAME) version 3.1.0, (c) 2005-2016 wxWidgets</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>wxmac.icns</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.wxwidgets.samples.$(PRODUCT_NAME:rfc1034identifier)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleLocalizations</key>
|
||||
<array>
|
||||
<string>de</string>
|
||||
<string>en</string>
|
||||
<string>fr</string>
|
||||
<string>it</string>
|
||||
</array>
|
||||
<key>CFBundleLongVersionString</key>
|
||||
<string>3.1.0, (c) 2005-2016 wxWidgets</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>3.1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>3.1.0</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright 2005-2016 wxWidgets</string>
|
||||
</dict>
|
||||
</plist>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -113,7 +113,6 @@
|
||||
|
||||
/* PowerPC Darwin & Mac OS X */
|
||||
#undef __POWERPC__
|
||||
#undef TARGET_CARBON
|
||||
|
||||
/* Hack to make IOGraphicsTypes.h not define Point conflicting with MacTypes */
|
||||
#undef __Point__
|
||||
|
||||
@@ -1647,7 +1647,7 @@ bool wxDataViewSpinRenderer::GetValue( wxVariant &value ) const
|
||||
// wxDataViewChoiceRenderer
|
||||
// -------------------------------------
|
||||
|
||||
#if defined(wxHAS_GENERIC_DATAVIEWCTRL) || defined(__WXOSX_CARBON__)
|
||||
#if defined(wxHAS_GENERIC_DATAVIEWCTRL)
|
||||
|
||||
wxDataViewChoiceRenderer::wxDataViewChoiceRenderer( const wxArrayString& choices, wxDataViewCellMode mode, int alignment ) :
|
||||
wxDataViewCustomRenderer(wxT("string"), mode, alignment )
|
||||
|
||||
@@ -407,10 +407,6 @@ bool wxDocument::OnSaveDocument(const wxString& file)
|
||||
Modify(false);
|
||||
SetFilename(file);
|
||||
SetDocumentSaved(true);
|
||||
#if defined( __WXOSX_MAC__ ) && wxOSX_USE_CARBON
|
||||
wxFileName fn(file) ;
|
||||
fn.MacSetDefaultTypeAndCreator() ;
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1033,10 +1033,6 @@ bool wxFileConfig::Flush(bool /* bCurrentOnly */)
|
||||
|
||||
ResetDirty();
|
||||
|
||||
#if defined( __WXOSX_MAC__ ) && wxOSX_USE_CARBON
|
||||
m_fnLocalFile.MacSetTypeAndCreator('TEXT', 'ttxt');
|
||||
#endif // __WXMAC__
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1435,8 +1435,6 @@ wxString wxGetOSDirectory()
|
||||
}
|
||||
|
||||
return wxString(buf);
|
||||
#elif defined(__WXMAC__) && wxOSX_USE_CARBON
|
||||
return wxMacFindFolderNoSeparator(kOnSystemDisk, 'macs', false);
|
||||
#else
|
||||
return wxEmptyString;
|
||||
#endif
|
||||
|
||||
@@ -1227,8 +1227,6 @@ wxString wxFileName::GetTempDir()
|
||||
{
|
||||
wxLogLastError(wxT("GetTempPath"));
|
||||
}
|
||||
#elif defined(__WXMAC__) && wxOSX_USE_CARBON
|
||||
dir = wxMacFindFolderNoSeparator(short(kOnSystemDisk), kTemporaryFolderType, kCreateFolder);
|
||||
#endif // systems with native way
|
||||
}
|
||||
|
||||
@@ -2777,142 +2775,3 @@ wxString wxFileName::GetHumanReadableSize(const wxString& failmsg,
|
||||
|
||||
#endif // wxUSE_LONGLONG
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Mac-specific functions
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if defined( __WXOSX_MAC__ ) && wxOSX_USE_CARBON
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
class MacDefaultExtensionRecord
|
||||
{
|
||||
public:
|
||||
MacDefaultExtensionRecord()
|
||||
{
|
||||
m_type =
|
||||
m_creator = 0 ;
|
||||
}
|
||||
|
||||
// default copy ctor, assignment operator and dtor are ok
|
||||
|
||||
MacDefaultExtensionRecord(const wxString& ext, OSType type, OSType creator)
|
||||
: m_ext(ext)
|
||||
{
|
||||
m_type = type;
|
||||
m_creator = creator;
|
||||
}
|
||||
|
||||
wxString m_ext;
|
||||
OSType m_type;
|
||||
OSType m_creator;
|
||||
};
|
||||
|
||||
WX_DECLARE_OBJARRAY(MacDefaultExtensionRecord, MacDefaultExtensionArray);
|
||||
|
||||
bool gMacDefaultExtensionsInited = false;
|
||||
|
||||
#include "wx/arrimpl.cpp"
|
||||
|
||||
WX_DEFINE_EXPORTED_OBJARRAY(MacDefaultExtensionArray);
|
||||
|
||||
MacDefaultExtensionArray gMacDefaultExtensions;
|
||||
|
||||
// load the default extensions
|
||||
const MacDefaultExtensionRecord gDefaults[] =
|
||||
{
|
||||
MacDefaultExtensionRecord( "txt", 'TEXT', 'ttxt' ),
|
||||
MacDefaultExtensionRecord( "tif", 'TIFF', '****' ),
|
||||
MacDefaultExtensionRecord( "jpg", 'JPEG', '****' ),
|
||||
};
|
||||
|
||||
void MacEnsureDefaultExtensionsLoaded()
|
||||
{
|
||||
if ( !gMacDefaultExtensionsInited )
|
||||
{
|
||||
// we could load the pc exchange prefs here too
|
||||
for ( size_t i = 0 ; i < WXSIZEOF( gDefaults ) ; ++i )
|
||||
{
|
||||
gMacDefaultExtensions.Add( gDefaults[i] ) ;
|
||||
}
|
||||
gMacDefaultExtensionsInited = true;
|
||||
}
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
bool wxFileName::MacSetTypeAndCreator( wxUint32 type , wxUint32 creator )
|
||||
{
|
||||
FSRef fsRef ;
|
||||
FSCatalogInfo catInfo;
|
||||
FileInfo *finfo ;
|
||||
|
||||
if ( wxMacPathToFSRef( GetFullPath() , &fsRef ) == noErr )
|
||||
{
|
||||
if ( FSGetCatalogInfo (&fsRef, kFSCatInfoFinderInfo, &catInfo, NULL, NULL, NULL) == noErr )
|
||||
{
|
||||
finfo = (FileInfo*)&catInfo.finderInfo;
|
||||
finfo->fileType = type ;
|
||||
finfo->fileCreator = creator ;
|
||||
FSSetCatalogInfo( &fsRef, kFSCatInfoFinderInfo, &catInfo ) ;
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
bool wxFileName::MacGetTypeAndCreator( wxUint32 *type , wxUint32 *creator ) const
|
||||
{
|
||||
FSRef fsRef ;
|
||||
FSCatalogInfo catInfo;
|
||||
FileInfo *finfo ;
|
||||
|
||||
if ( wxMacPathToFSRef( GetFullPath() , &fsRef ) == noErr )
|
||||
{
|
||||
if ( FSGetCatalogInfo (&fsRef, kFSCatInfoFinderInfo, &catInfo, NULL, NULL, NULL) == noErr )
|
||||
{
|
||||
finfo = (FileInfo*)&catInfo.finderInfo;
|
||||
*type = finfo->fileType ;
|
||||
*creator = finfo->fileCreator ;
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
bool wxFileName::MacSetDefaultTypeAndCreator()
|
||||
{
|
||||
wxUint32 type , creator ;
|
||||
if ( wxFileName::MacFindDefaultTypeAndCreator(GetExt() , &type ,
|
||||
&creator ) )
|
||||
{
|
||||
return MacSetTypeAndCreator( type , creator ) ;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool wxFileName::MacFindDefaultTypeAndCreator( const wxString& ext , wxUint32 *type , wxUint32 *creator )
|
||||
{
|
||||
MacEnsureDefaultExtensionsLoaded() ;
|
||||
wxString extl = ext.Lower() ;
|
||||
for( int i = gMacDefaultExtensions.Count() - 1 ; i >= 0 ; --i )
|
||||
{
|
||||
if ( gMacDefaultExtensions.Item(i).m_ext == extl )
|
||||
{
|
||||
*type = gMacDefaultExtensions.Item(i).m_type ;
|
||||
*creator = gMacDefaultExtensions.Item(i).m_creator ;
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
void wxFileName::MacRegisterDefaultTypeAndCreator( const wxString& ext , wxUint32 type , wxUint32 creator )
|
||||
{
|
||||
MacEnsureDefaultExtensionsLoaded();
|
||||
MacDefaultExtensionRecord rec(ext.Lower(), type, creator);
|
||||
gMacDefaultExtensions.Add( rec );
|
||||
}
|
||||
|
||||
#endif // defined( __WXOSX_MAC__ ) && wxOSX_USE_CARBON
|
||||
|
||||
@@ -273,14 +273,7 @@ wxIcon wxIconBundle::GetIcon(const wxSize& size, int flags) const
|
||||
}
|
||||
}
|
||||
|
||||
#if defined( __WXMAC__ ) && wxOSX_USE_CARBON
|
||||
if (!iconBest.IsOk())
|
||||
return wxNullIcon;
|
||||
|
||||
return wxIcon(iconBest.GetHICON(), size);
|
||||
#else
|
||||
return iconBest;
|
||||
#endif
|
||||
}
|
||||
|
||||
wxIcon wxIconBundle::GetIconOfExactSize(const wxSize& size) const
|
||||
|
||||
@@ -462,19 +462,6 @@ void wxMediaCtrl::DoMoveWindow(int x, int y, int w, int h)
|
||||
m_imp->Move(x, y, w, h);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// wxMediaCtrl::MacVisibilityChanged
|
||||
//---------------------------------------------------------------------------
|
||||
#ifdef __WXOSX_CARBON__
|
||||
void wxMediaCtrl::MacVisibilityChanged()
|
||||
{
|
||||
wxControl::MacVisibilityChanged();
|
||||
|
||||
if(m_imp)
|
||||
m_imp->MacVisibilityChanged();
|
||||
}
|
||||
#endif
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
//
|
||||
// wxMediaBackendCommonBase
|
||||
|
||||
@@ -678,11 +678,7 @@ void wxListLineData::ApplyAttributes(wxDC *dc,
|
||||
|
||||
wxWindow * const listctrl = m_owner->GetParent();
|
||||
|
||||
const bool hasFocus = listctrl->HasFocus()
|
||||
#if defined(__WXMAC__) && !defined(__WXUNIVERSAL__) && wxOSX_USE_CARBON
|
||||
&& IsControlActive( (ControlRef)listctrl->GetHandle() )
|
||||
#endif
|
||||
;
|
||||
const bool hasFocus = listctrl->HasFocus();
|
||||
|
||||
// fg colour
|
||||
|
||||
|
||||
@@ -770,7 +770,7 @@ wxSize wxRendererGeneric::GetCollapseButtonSize(wxWindow *WXUNUSED(win), wxDC& W
|
||||
}
|
||||
|
||||
void
|
||||
wxRendererGeneric::DrawItemSelectionRect(wxWindow * win,
|
||||
wxRendererGeneric::DrawItemSelectionRect(wxWindow * WXUNUSED(win),
|
||||
wxDC& dc,
|
||||
const wxRect& rect,
|
||||
int flags)
|
||||
@@ -793,11 +793,7 @@ wxRendererGeneric::DrawItemSelectionRect(wxWindow * win,
|
||||
}
|
||||
|
||||
dc.SetBrush(brush);
|
||||
bool drawFocusRect = (flags & wxCONTROL_CURRENT) && (flags & wxCONTROL_FOCUSED)
|
||||
#if defined( __WXMAC__ ) && !defined(__WXUNIVERSAL__) && wxOSX_USE_CARBON
|
||||
&& IsControlActive( (ControlRef)win->GetHandle() )
|
||||
#endif
|
||||
;
|
||||
bool drawFocusRect = (flags & wxCONTROL_CURRENT) && (flags & wxCONTROL_FOCUSED);
|
||||
|
||||
if ( drawFocusRect && !(flags & wxCONTROL_CELL) )
|
||||
dc.SetPen( *wxBLACK_PEN );
|
||||
@@ -813,9 +809,6 @@ wxRendererGeneric::DrawItemSelectionRect(wxWindow * win,
|
||||
|
||||
DrawSelectedCellFocusRect(dc, focusRect);
|
||||
}
|
||||
|
||||
// it's unused everywhere except in wxOSX/Carbon
|
||||
wxUnusedVar(win);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -440,14 +440,6 @@ wxTreeTextCtrl::wxTreeTextCtrl(wxGenericTreeCtrl *owner,
|
||||
rect.y -= 2;
|
||||
rect.width += 8;
|
||||
rect.height += 4;
|
||||
#elif defined(wxOSX_USE_CARBON) && wxOSX_USE_CARBON
|
||||
int bestHeight = GetBestSize().y - 8;
|
||||
if ( rect.height > bestHeight )
|
||||
{
|
||||
int diff = rect.height - bestHeight;
|
||||
rect.height -= diff;
|
||||
rect.y += diff / 2;
|
||||
}
|
||||
#endif // platforms
|
||||
|
||||
(void)Create(m_owner, wxID_ANY, m_startValue,
|
||||
@@ -2591,11 +2583,7 @@ void wxGenericTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc)
|
||||
else
|
||||
{
|
||||
int flags = wxCONTROL_SELECTED;
|
||||
if (m_hasFocus
|
||||
#if defined( __WXMAC__ ) && !defined(__WXUNIVERSAL__) && wxOSX_USE_CARBON // TODO CS
|
||||
&& IsControlActive( (ControlRef)GetHandle() )
|
||||
#endif
|
||||
)
|
||||
if (m_hasFocus)
|
||||
flags |= wxCONTROL_FOCUSED;
|
||||
if ((item == m_current) && (m_hasFocus))
|
||||
flags |= wxCONTROL_CURRENT;
|
||||
@@ -2788,15 +2776,7 @@ wxGenericTreeCtrl::PaintLevel(wxGenericTreeItem *item,
|
||||
wxTRANSPARENT_PEN;
|
||||
|
||||
wxColour colText;
|
||||
if ( item->IsSelected()
|
||||
#if defined( __WXMAC__ ) && !defined(__WXUNIVERSAL__) && wxOSX_USE_CARBON // TODO CS
|
||||
// On wxMac, if the tree doesn't have the focus we draw an empty
|
||||
// rectangle, so we want to make sure that the text is visible
|
||||
// against the normal background, not the highlightbackground, so
|
||||
// don't use the highlight text colour unless we have the focus.
|
||||
&& m_hasFocus && IsControlActive( (ControlRef)GetHandle() )
|
||||
#endif
|
||||
)
|
||||
if ( item->IsSelected() )
|
||||
{
|
||||
#ifdef __WXMAC__
|
||||
colText = *wxWHITE;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,87 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/osx/carbon/aboutdlg.cpp
|
||||
// Purpose: native wxAboutBox() implementation for wxMac
|
||||
// Author: Vadim Zeitlin
|
||||
// Created: 2006-10-08
|
||||
// Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// for compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#if wxUSE_ABOUTDLG
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#endif //WX_PRECOMP
|
||||
|
||||
#include "wx/aboutdlg.h"
|
||||
#include "wx/generic/aboutdlgg.h"
|
||||
|
||||
#include "wx/osx/private.h"
|
||||
|
||||
// helper class for HIAboutBox options
|
||||
class AboutBoxOptions : public wxCFRef<CFMutableDictionaryRef>
|
||||
{
|
||||
public:
|
||||
AboutBoxOptions() : wxCFRef<CFMutableDictionaryRef>
|
||||
(
|
||||
CFDictionaryCreateMutable
|
||||
(
|
||||
kCFAllocatorDefault,
|
||||
4, // there are at most 4 values
|
||||
&kCFTypeDictionaryKeyCallBacks,
|
||||
&kCFTypeDictionaryValueCallBacks
|
||||
)
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
void Set(CFStringRef key, const wxString& value)
|
||||
{
|
||||
CFDictionarySetValue(*this, key, wxCFStringRef(value));
|
||||
}
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
void wxAboutBox(const wxAboutDialogInfo& info, wxWindow *parent)
|
||||
{
|
||||
// Mac native about box currently can show only name, version, copyright
|
||||
// and description fields and we also shoehorn the credits text into the
|
||||
// description but if we have anything else we must use the generic version
|
||||
|
||||
if ( info.IsSimple() )
|
||||
{
|
||||
AboutBoxOptions opts;
|
||||
|
||||
opts.Set(kHIAboutBoxNameKey, info.GetName());
|
||||
|
||||
if ( info.HasVersion() )
|
||||
opts.Set(kHIAboutBoxVersionKey,info.GetLongVersion());
|
||||
|
||||
if ( info.HasCopyright() )
|
||||
opts.Set(kHIAboutBoxCopyrightKey, info.GetCopyrightToDisplay());
|
||||
|
||||
opts.Set(kHIAboutBoxDescriptionKey, info.GetDescriptionAndCredits());
|
||||
|
||||
HIAboutBox(opts);
|
||||
}
|
||||
else // simple "native" version is not enough
|
||||
{
|
||||
// we need to use the full-blown generic version
|
||||
wxGenericAboutBox(info, parent);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // wxUSE_ABOUTDLG
|
||||
@@ -1,122 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/osx/carbon/anybutton.cpp
|
||||
// Purpose: wxAnyButton
|
||||
// Author: Stefan Csomor
|
||||
// Created: 1998-01-01 (extracted from button.cpp)
|
||||
// Copyright: (c) Stefan Csomor
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#include "wx/anybutton.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/panel.h"
|
||||
#include "wx/toplevel.h"
|
||||
#include "wx/dcclient.h"
|
||||
#endif
|
||||
|
||||
#include "wx/stockitem.h"
|
||||
|
||||
#include "wx/osx/private.h"
|
||||
|
||||
wxSize wxAnyButton::DoGetBestSize() const
|
||||
{
|
||||
if ( GetId() == wxID_HELP )
|
||||
return wxSize( 20 , 20 ) ;
|
||||
|
||||
wxSize sz = GetDefaultSize() ;
|
||||
|
||||
switch (GetWindowVariant())
|
||||
{
|
||||
case wxWINDOW_VARIANT_NORMAL:
|
||||
case wxWINDOW_VARIANT_LARGE:
|
||||
sz.y = 20 ;
|
||||
break;
|
||||
|
||||
case wxWINDOW_VARIANT_SMALL:
|
||||
sz.y = 17 ;
|
||||
break;
|
||||
|
||||
case wxWINDOW_VARIANT_MINI:
|
||||
sz.y = 15 ;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
#if wxOSX_USE_CARBON
|
||||
Rect bestsize = { 0 , 0 , 0 , 0 } ;
|
||||
GetPeer()->GetBestRect( &bestsize ) ;
|
||||
|
||||
int wBtn;
|
||||
if ( GetBitmapLabel().IsOk() )
|
||||
{
|
||||
sz.x = bestsize.right - bestsize.left ;
|
||||
sz.y = bestsize.bottom - bestsize.top ;
|
||||
sz.x = sz.x + MacGetLeftBorderSize() +
|
||||
MacGetRightBorderSize();
|
||||
sz.y = sz.y + MacGetTopBorderSize() +
|
||||
MacGetBottomBorderSize();
|
||||
wBtn = sz.x;
|
||||
}
|
||||
else if ( EmptyRect( &bestsize ) || ( GetWindowStyle() & wxBU_EXACTFIT) )
|
||||
{
|
||||
Point bounds;
|
||||
|
||||
ControlFontStyleRec controlFont;
|
||||
OSStatus err = GetPeer()->GetData<ControlFontStyleRec>( kControlEntireControl, kControlFontStyleTag, &controlFont );
|
||||
verify_noerr( err );
|
||||
|
||||
// GetThemeTextDimensions will cache strings and the documentation
|
||||
// says not to use the NoCopy string creation calls.
|
||||
// This also means that we can't use CFSTR without
|
||||
// -fno-constant-cfstrings if the library might be unloaded,
|
||||
// as GetThemeTextDimensions may cache a pointer to our
|
||||
// unloaded segment.
|
||||
wxCFStringRef str( !m_label.empty() ? m_label : wxString(" "),
|
||||
GetFont().GetEncoding() );
|
||||
|
||||
#if wxOSX_USE_ATSU_TEXT
|
||||
SInt16 baseline;
|
||||
if ( m_font.MacGetThemeFontID() != kThemeCurrentPortFont )
|
||||
{
|
||||
err = GetThemeTextDimensions(
|
||||
(CFStringRef)str,
|
||||
m_font.MacGetThemeFontID(), kThemeStateActive, false, &bounds, &baseline );
|
||||
verify_noerr( err );
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
wxClientDC dc(const_cast<wxAnyButton*>(this));
|
||||
wxCoord width, height ;
|
||||
dc.GetTextExtent( m_label , &width, &height);
|
||||
bounds.h = width;
|
||||
bounds.v = height;
|
||||
}
|
||||
|
||||
wBtn = bounds.h + sz.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
wBtn = bestsize.right - bestsize.left ;
|
||||
// non 'normal' window variants don't return the correct height
|
||||
// sz.y = bestsize.bottom - bestsize.top ;
|
||||
}
|
||||
if ((wBtn > sz.x) || ( GetWindowStyle() & wxBU_EXACTFIT))
|
||||
sz.x = wBtn;
|
||||
#endif
|
||||
|
||||
return sz ;
|
||||
}
|
||||
|
||||
wxSize wxAnyButton::GetDefaultSize()
|
||||
{
|
||||
int wBtn = 70 ;
|
||||
int hBtn = 20 ;
|
||||
|
||||
return wxSize(wBtn, hBtn);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,150 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/osx/carbon/bmpbuttn.cpp
|
||||
// Purpose: wxBitmapButton
|
||||
// Author: Stefan Csomor
|
||||
// Modified by:
|
||||
// Created: 1998-01-01
|
||||
// Copyright: (c) Stefan Csomor
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#if wxUSE_BMPBUTTON
|
||||
|
||||
#include "wx/bmpbuttn.h"
|
||||
#include "wx/image.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/dcmemory.h"
|
||||
#endif
|
||||
|
||||
#include "wx/osx/private.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
// define a derived class to override SetBitmap() and also to provide
|
||||
// InitButtonContentInfo() helper used by CreateBitmapButton()
|
||||
class wxMacBitmapButton : public wxMacControl, public wxButtonImpl
|
||||
{
|
||||
public:
|
||||
wxMacBitmapButton(wxWindowMac* peer, const wxBitmap& bitmap, int style)
|
||||
: wxMacControl(peer)
|
||||
{
|
||||
// decide what kind of contents the button will have: we want to use an
|
||||
// icon for buttons with wxBORDER_NONE style as bevel buttons always do
|
||||
// have a border but icons are limited to a few standard sizes only and
|
||||
// are resized by the system with extremely ugly results if they don't
|
||||
// fit (in the past we also tried being smart and pasting a bitmap
|
||||
// instead of a larger square icon to avoid resizing but this resulted
|
||||
// in buttons having different size than specified by wx API and
|
||||
// breaking the layouts and still didn't look good so we don't even try
|
||||
// to do this any more)
|
||||
m_isIcon = (style & wxBORDER_NONE) &&
|
||||
bitmap.IsOk() && IsOfStandardSize(bitmap);
|
||||
}
|
||||
|
||||
virtual void SetBitmap(const wxBitmap& bitmap)
|
||||
{
|
||||
// unfortunately we can't avoid the ugly resizing problem mentioned
|
||||
// above if a bitmap of supported size was used initially but was
|
||||
// replaced with another one later as the control was already created
|
||||
// as an icon control (although maybe we ought to recreate it?)
|
||||
ControlButtonContentInfo info;
|
||||
InitButtonContentInfo(info, bitmap);
|
||||
|
||||
if ( info.contentType == kControlContentIconRef )
|
||||
SetData(kControlIconPart, kControlIconContentTag, info);
|
||||
else if ( info.contentType != kControlNoContent )
|
||||
SetData(kControlButtonPart, kControlBevelButtonContentTag, info);
|
||||
|
||||
wxMacReleaseBitmapButton(&info);
|
||||
}
|
||||
|
||||
void InitButtonContentInfo(ControlButtonContentInfo& info,
|
||||
const wxBitmap& bitmap)
|
||||
{
|
||||
wxMacCreateBitmapButton(&info, bitmap,
|
||||
m_isIcon ? kControlContentIconRef : 0);
|
||||
}
|
||||
|
||||
void SetPressedBitmap( const wxBitmap& WXUNUSED(bitmap) )
|
||||
{
|
||||
// not implemented under Carbon
|
||||
}
|
||||
|
||||
private:
|
||||
// helper function: returns true if the given bitmap is of one of standard
|
||||
// sizes supported by OS X icons
|
||||
static bool IsOfStandardSize(const wxBitmap& bmp)
|
||||
{
|
||||
const int w = bmp.GetWidth();
|
||||
|
||||
return bmp.GetHeight() == w &&
|
||||
(w == 128 || w == 48 || w == 32 || w == 16);
|
||||
}
|
||||
|
||||
|
||||
// true if this is an icon control, false if it's a bevel button
|
||||
bool m_isIcon;
|
||||
|
||||
wxDECLARE_NO_COPY_CLASS(wxMacBitmapButton);
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
wxWidgetImplType* wxWidgetImpl::CreateBitmapButton( wxWindowMac* wxpeer,
|
||||
wxWindowMac* parent,
|
||||
wxWindowID WXUNUSED(id),
|
||||
const wxBitmap& bitmap,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long style,
|
||||
long WXUNUSED(extraStyle))
|
||||
{
|
||||
wxMacBitmapButton* peer = new wxMacBitmapButton(wxpeer, bitmap, style);
|
||||
|
||||
OSStatus err;
|
||||
WXWindow macParent = MAC_WXHWND(parent->MacGetTopLevelWindowRef());
|
||||
Rect bounds = wxMacGetBoundsForControl( wxpeer, pos, size );
|
||||
|
||||
ControlButtonContentInfo info;
|
||||
peer->InitButtonContentInfo(info, bitmap);
|
||||
|
||||
if ( info.contentType == kControlContentIconRef )
|
||||
{
|
||||
err = CreateIconControl
|
||||
(
|
||||
macParent,
|
||||
&bounds,
|
||||
&info,
|
||||
false,
|
||||
peer->GetControlRefAddr()
|
||||
);
|
||||
}
|
||||
else // normal bevel button
|
||||
{
|
||||
err = CreateBevelButtonControl
|
||||
(
|
||||
macParent,
|
||||
&bounds,
|
||||
CFSTR(""),
|
||||
style & wxBU_AUTODRAW ? kControlBevelButtonSmallBevel
|
||||
: kControlBevelButtonNormalBevel,
|
||||
kControlBehaviorOffsetContents,
|
||||
&info,
|
||||
0, // menu id (no associated menu)
|
||||
0, // menu behaviour (unused)
|
||||
0, // menu placement (unused too)
|
||||
peer->GetControlRefAddr()
|
||||
);
|
||||
}
|
||||
|
||||
verify_noerr( err );
|
||||
|
||||
wxMacReleaseBitmapButton( &info );
|
||||
return peer;
|
||||
}
|
||||
|
||||
#endif // wxUSE_BMPBUTTON
|
||||
@@ -1,120 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/osx/carbon/button.cpp
|
||||
// Purpose: wxButton
|
||||
// Author: Stefan Csomor
|
||||
// Modified by:
|
||||
// Created: 1998-01-01
|
||||
// Copyright: (c) Stefan Csomor
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#include "wx/button.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/panel.h"
|
||||
#include "wx/toplevel.h"
|
||||
#include "wx/dcclient.h"
|
||||
#endif
|
||||
|
||||
#include "wx/stockitem.h"
|
||||
|
||||
#include "wx/osx/private.h"
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
wxWidgetImplType* wxWidgetImpl::CreateButton( wxWindowMac* wxpeer,
|
||||
wxWindowMac* parent,
|
||||
wxWindowID id,
|
||||
const wxString& label,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long WXUNUSED(style),
|
||||
long WXUNUSED(extraStyle))
|
||||
{
|
||||
OSStatus err;
|
||||
Rect bounds = wxMacGetBoundsForControl( wxpeer , pos , size ) ;
|
||||
wxMacControl* peer = new wxMacControl(wxpeer) ;
|
||||
if ( id == wxID_HELP )
|
||||
{
|
||||
ControlButtonContentInfo info ;
|
||||
info.contentType = kControlContentIconRef ;
|
||||
GetIconRef(kOnSystemDisk, kSystemIconsCreator, kHelpIcon, &info.u.iconRef);
|
||||
err = CreateRoundButtonControl(
|
||||
MAC_WXHWND(parent->MacGetTopLevelWindowRef()),
|
||||
&bounds, kControlRoundButtonNormalSize,
|
||||
&info, peer->GetControlRefAddr() );
|
||||
}
|
||||
else if ( label.Find('\n' ) == wxNOT_FOUND && label.Find('\r' ) == wxNOT_FOUND)
|
||||
{
|
||||
// Button height is static in Mac, can't be changed, so we need to force it here
|
||||
int maxHeight;
|
||||
switch (wxpeer->GetWindowVariant() )
|
||||
{
|
||||
default:
|
||||
wxFAIL_MSG( "unknown window variant" );
|
||||
// fall through
|
||||
|
||||
case wxWINDOW_VARIANT_NORMAL:
|
||||
case wxWINDOW_VARIANT_LARGE:
|
||||
maxHeight = 20 ;
|
||||
break;
|
||||
case wxWINDOW_VARIANT_SMALL:
|
||||
maxHeight = 17;
|
||||
break;
|
||||
case wxWINDOW_VARIANT_MINI:
|
||||
maxHeight = 15;
|
||||
}
|
||||
bounds.bottom = bounds.top + maxHeight ;
|
||||
wxpeer->SetMaxSize( wxSize( wxpeer->GetMaxWidth() , maxHeight ));
|
||||
err = CreatePushButtonControl(
|
||||
MAC_WXHWND(parent->MacGetTopLevelWindowRef()),
|
||||
&bounds, CFSTR(""), peer->GetControlRefAddr() );
|
||||
}
|
||||
else
|
||||
{
|
||||
ControlButtonContentInfo info ;
|
||||
info.contentType = kControlNoContent ;
|
||||
err = CreateBevelButtonControl(
|
||||
MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds, CFSTR(""),
|
||||
kControlBevelButtonLargeBevel, kControlBehaviorPushbutton,
|
||||
&info, 0, 0, 0, peer->GetControlRefAddr() );
|
||||
}
|
||||
verify_noerr( err );
|
||||
return peer;
|
||||
}
|
||||
|
||||
void wxMacControl::SetDefaultButton( bool isDefault )
|
||||
{
|
||||
SetData(kControlButtonPart , kControlPushButtonDefaultTag , (Boolean) isDefault ) ;
|
||||
}
|
||||
|
||||
wxWidgetImplType* wxWidgetImpl::CreateDisclosureTriangle( wxWindowMac* wxpeer,
|
||||
wxWindowMac* parent,
|
||||
wxWindowID WXUNUSED(id),
|
||||
const wxString& label,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long WXUNUSED(style),
|
||||
long WXUNUSED(extraStyle))
|
||||
{
|
||||
Rect bounds = wxMacGetBoundsForControl( wxpeer , pos , size ) ;
|
||||
wxMacControl* peer = new wxMacControl(wxpeer) ;
|
||||
|
||||
OSStatus err = CreateDisclosureTriangleControl(
|
||||
MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds,
|
||||
kControlDisclosureTrianglePointDefault,
|
||||
wxCFStringRef( label ),
|
||||
0, // closed
|
||||
TRUE, // draw title
|
||||
TRUE, // auto toggle back and forth
|
||||
peer->GetControlRefAddr() );
|
||||
|
||||
verify_noerr( err );
|
||||
return peer;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/osx/carbon/checkbox.cpp
|
||||
// Purpose: wxCheckBox
|
||||
// Author: Stefan Csomor
|
||||
// Modified by:
|
||||
// Created: 04/01/98
|
||||
// Copyright: (c) Stefan Csomor
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#if wxUSE_CHECKBOX
|
||||
|
||||
#include "wx/checkbox.h"
|
||||
#include "wx/osx/uma.h"
|
||||
|
||||
wxWidgetImplType* wxWidgetImpl::CreateCheckBox( wxWindowMac* wxpeer,
|
||||
wxWindowMac* parent,
|
||||
wxWindowID WXUNUSED(id),
|
||||
const wxString& WXUNUSED(label),
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long style,
|
||||
long WXUNUSED(extraStyle))
|
||||
{
|
||||
Rect bounds = wxMacGetBoundsForControl( wxpeer , pos , size ) ;
|
||||
wxMacControl* peer = new wxMacControl(wxpeer) ;
|
||||
|
||||
verify_noerr( CreateCheckBoxControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds ,
|
||||
CFSTR("") , 0 , false , peer->GetControlRefAddr() ) );
|
||||
SInt32 maxValue = 1 /* kControlCheckboxCheckedValue */;
|
||||
if (style & wxCHK_3STATE)
|
||||
maxValue = 2 /* kControlCheckboxMixedValue */;
|
||||
|
||||
peer->SetMaximum( maxValue ) ;
|
||||
|
||||
return peer;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,65 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/osx/carbon/choice.cpp
|
||||
// Purpose: wxChoice
|
||||
// Author: Stefan Csomor
|
||||
// Modified by:
|
||||
// Created: 1998-01-01
|
||||
// Copyright: (c) Stefan Csomor
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#if wxUSE_CHOICE
|
||||
|
||||
#include "wx/choice.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/menu.h"
|
||||
#include "wx/dcclient.h"
|
||||
#endif
|
||||
|
||||
#include "wx/osx/private.h"
|
||||
|
||||
// adapt the number offset (mac menu are 1 based)
|
||||
|
||||
class wxMacChoiceCarbonControl : public wxMacControl
|
||||
{
|
||||
public :
|
||||
wxMacChoiceCarbonControl( wxWindowMac* peer ) : wxMacControl( peer )
|
||||
{
|
||||
}
|
||||
|
||||
void SetValue(wxInt32 v)
|
||||
{
|
||||
wxMacControl::SetValue( v + 1 );
|
||||
}
|
||||
|
||||
wxInt32 GetValue() const
|
||||
{
|
||||
return wxMacControl::GetValue() - 1;
|
||||
}
|
||||
};
|
||||
|
||||
wxWidgetImplType* wxWidgetImpl::CreateChoice( wxWindowMac* wxpeer,
|
||||
wxWindowMac* parent,
|
||||
wxWindowID WXUNUSED(id),
|
||||
wxMenu* menu,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long WXUNUSED(style),
|
||||
long WXUNUSED(extraStyle))
|
||||
{
|
||||
Rect bounds = wxMacGetBoundsForControl( wxpeer , pos , size );
|
||||
|
||||
wxMacControl* peer = new wxMacChoiceCarbonControl( wxpeer ) ;
|
||||
OSStatus err = CreatePopupButtonControl(
|
||||
MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") ,
|
||||
-12345 , false /* no variable width */ , 0 , 0 , 0 , peer->GetControlRefAddr() );
|
||||
verify_noerr( err );
|
||||
|
||||
peer->SetData<MenuHandle>( kControlNoPart , kControlPopupButtonMenuHandleTag , (MenuHandle) menu->GetHMenu() ) ;
|
||||
return peer;
|
||||
}
|
||||
|
||||
#endif // wxUSE_CHOICE
|
||||
@@ -75,16 +75,5 @@ void wxControl::OnKeyDown( wxKeyEvent &WXUNUSED(event) )
|
||||
if ( GetPeer() == NULL || !GetPeer()->IsOk() )
|
||||
return;
|
||||
|
||||
#if wxOSX_USE_CARBON
|
||||
UInt32 keyCode, modifiers;
|
||||
char charCode;
|
||||
|
||||
GetEventParameter( (EventRef)wxTheApp->MacGetCurrentEvent(), kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode );
|
||||
GetEventParameter( (EventRef)wxTheApp->MacGetCurrentEvent(), kEventParamKeyMacCharCodes, typeChar, NULL, 1, NULL, &charCode );
|
||||
GetEventParameter( (EventRef)wxTheApp->MacGetCurrentEvent(), kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers );
|
||||
|
||||
GetPeer()->HandleKey( keyCode, charCode, modifiers );
|
||||
#else
|
||||
// TODO
|
||||
#endif
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -105,46 +105,6 @@ void wxWindowDCImpl::DoGetSize( int* width, int* height ) const
|
||||
*height = m_height;
|
||||
}
|
||||
|
||||
#if wxOSX_USE_CARBON
|
||||
wxBitmap wxWindowDCImpl::DoGetAsBitmap(const wxRect *subrect) const
|
||||
{
|
||||
// wxScreenDC is derived from wxWindowDC, so a screen dc will
|
||||
// call this method when a Blit is performed with it as a source.
|
||||
if (!m_window)
|
||||
return wxNullBitmap;
|
||||
|
||||
ControlRef handle = (ControlRef) m_window->GetHandle();
|
||||
if ( !handle )
|
||||
return wxNullBitmap;
|
||||
|
||||
HIRect rect;
|
||||
CGImageRef image;
|
||||
CGContextRef context;
|
||||
|
||||
HIViewCreateOffscreenImage( handle, 0, &rect, &image);
|
||||
|
||||
|
||||
int width = subrect != NULL ? subrect->width : (int)rect.size.width;
|
||||
int height = subrect != NULL ? subrect->height : (int)rect.size.height ;
|
||||
|
||||
wxBitmap bmp = wxBitmap(width, height, 32);
|
||||
|
||||
context = (CGContextRef)bmp.GetHBITMAP();
|
||||
|
||||
CGContextSaveGState(context);
|
||||
|
||||
CGContextTranslateCTM( context, 0, height );
|
||||
CGContextScaleCTM( context, 1, -1 );
|
||||
|
||||
if ( subrect )
|
||||
rect = CGRectOffset( rect, -subrect->x, -subrect->y ) ;
|
||||
CGContextDrawImage( context, rect, image );
|
||||
|
||||
CGContextRestoreGState(context);
|
||||
return bmp;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wxClientDCImpl
|
||||
*/
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/osx/carbon/dialog.cpp
|
||||
// Purpose: wxDialog class
|
||||
// Author: Stefan Csomor
|
||||
// Modified by:
|
||||
// Created: 1998-01-01
|
||||
// Copyright: (c) Stefan Csomor
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#include "wx/dialog.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/app.h"
|
||||
#include "wx/utils.h"
|
||||
#include "wx/frame.h"
|
||||
#include "wx/settings.h"
|
||||
#endif // WX_PRECOMP
|
||||
|
||||
#include "wx/osx/private.h"
|
||||
#include "wx/evtloop.h"
|
||||
|
||||
void wxDialog::EndWindowModal()
|
||||
{
|
||||
// Nothing to do for now.
|
||||
}
|
||||
|
||||
void wxDialog::DoShowWindowModal()
|
||||
{
|
||||
// If someone wants to add support for this to wxOSX Carbon, here would
|
||||
// be the place to start: http://trac.wxwidgets.org/ticket/9459
|
||||
// Unfortunately, supporting sheets in Carbon isn't as straightforward
|
||||
// as with Cocoa, so it will probably take some tweaking.
|
||||
|
||||
m_modality = wxDIALOG_MODALITY_APP_MODAL;
|
||||
ShowModal();
|
||||
SendWindowModalDialogEvent ( wxEVT_WINDOW_MODAL_DIALOG_CLOSED );
|
||||
}
|
||||
@@ -1,148 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/osx/carbon/dirdlg.cpp
|
||||
// Purpose: wxDirDialog
|
||||
// Author: Stefan Csomor
|
||||
// Modified by:
|
||||
// Created: 1998-01-01
|
||||
// Copyright: (c) Stefan Csomor
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#if wxUSE_DIRDLG && !defined(__WXUNIVERSAL__)
|
||||
|
||||
#include "wx/dirdlg.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/utils.h"
|
||||
#include "wx/dialog.h"
|
||||
#endif // WX_PRECOMP
|
||||
|
||||
#include "wx/filename.h"
|
||||
#include "wx/modalhook.h"
|
||||
|
||||
#include "wx/osx/private.h"
|
||||
|
||||
wxIMPLEMENT_CLASS(wxDirDialog, wxDialog);
|
||||
|
||||
static pascal void NavEventProc(
|
||||
NavEventCallbackMessage inSelector,
|
||||
NavCBRecPtr ioParams,
|
||||
NavCallBackUserData ioUserData );
|
||||
|
||||
static NavEventUPP sStandardNavEventFilter = NewNavEventUPP(NavEventProc);
|
||||
|
||||
static pascal void NavEventProc(
|
||||
NavEventCallbackMessage inSelector,
|
||||
NavCBRecPtr ioParams,
|
||||
NavCallBackUserData ioUserData )
|
||||
{
|
||||
wxDirDialog * data = ( wxDirDialog *) ioUserData ;
|
||||
if ( inSelector == kNavCBStart )
|
||||
{
|
||||
if (data && !data->GetPath().empty() )
|
||||
{
|
||||
// Set default location for the modern Navigation APIs
|
||||
// Apple Technical Q&A 1151
|
||||
FSRef theFile;
|
||||
wxMacPathToFSRef(data->GetPath(), &theFile);
|
||||
AEDesc theLocation = { typeNull, NULL };
|
||||
if (noErr == ::AECreateDesc(typeFSRef, &theFile, sizeof(FSRef), &theLocation))
|
||||
::NavCustomControl(ioParams->context, kNavCtlSetLocation, (void *) &theLocation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void wxDirDialog::Init()
|
||||
{
|
||||
}
|
||||
|
||||
void wxDirDialog::Create(wxWindow *parent,
|
||||
const wxString& message,
|
||||
const wxString& defaultPath,
|
||||
long style,
|
||||
const wxPoint& WXUNUSED(pos),
|
||||
const wxSize& WXUNUSED(size),
|
||||
const wxString& WXUNUSED(name))
|
||||
{
|
||||
wxASSERT_MSG( NavServicesAvailable() , wxT("Navigation Services are not running") ) ;
|
||||
m_parent = parent;
|
||||
|
||||
SetMessage( message );
|
||||
SetWindowStyle(style);
|
||||
SetPath(defaultPath);
|
||||
}
|
||||
|
||||
int wxDirDialog::ShowModal()
|
||||
{
|
||||
WX_HOOK_MODAL_DIALOG();
|
||||
|
||||
NavDialogRef dialog = NULL;
|
||||
NavDialogCreationOptions options;
|
||||
NavReplyRecord reply ;
|
||||
bool disposeReply = false ;
|
||||
OSStatus err = noErr;
|
||||
|
||||
err = NavGetDefaultDialogCreationOptions(&options);
|
||||
options.optionFlags &= ~kNavAllowMultipleFiles;
|
||||
if (err == noErr)
|
||||
{
|
||||
wxCFStringRef message(m_message, GetFont().GetEncoding());
|
||||
options.message = message;
|
||||
err = NavCreateChooseFolderDialog(&options, sStandardNavEventFilter , NULL, this , &dialog);
|
||||
if (err == noErr)
|
||||
{
|
||||
wxDialog::OSXBeginModalDialog();
|
||||
err = NavDialogRun(dialog);
|
||||
wxDialog::OSXEndModalDialog();
|
||||
if ( err == noErr )
|
||||
{
|
||||
err = NavDialogGetReply(dialog, &reply);
|
||||
disposeReply = true ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( err == noErr )
|
||||
{
|
||||
if ( reply.validRecord )
|
||||
{
|
||||
FSRef folderInfo;
|
||||
AEDesc specDesc ;
|
||||
|
||||
OSErr err = ::AECoerceDesc( &reply.selection , typeFSRef, &specDesc);
|
||||
if ( err != noErr )
|
||||
{
|
||||
m_path = wxEmptyString ;
|
||||
}
|
||||
else
|
||||
{
|
||||
folderInfo = **(FSRef**) specDesc.dataHandle;
|
||||
m_path = wxMacFSRefToPath( &folderInfo ) ;
|
||||
if (specDesc.dataHandle != nil)
|
||||
{
|
||||
::AEDisposeDesc(&specDesc);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
err = paramErr ; // could be any error, only used for giving back wxID_CANCEL
|
||||
}
|
||||
}
|
||||
|
||||
if ( disposeReply )
|
||||
::NavDisposeReply(&reply);
|
||||
|
||||
// apparently cancelling shouldn't change m_path
|
||||
if ( err != noErr && err != userCanceledErr )
|
||||
m_path = wxEmptyString ;
|
||||
|
||||
if ( dialog )
|
||||
::NavDialogDispose(dialog);
|
||||
|
||||
return (err == noErr) ? wxID_OK : wxID_CANCEL ;
|
||||
}
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,198 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/osx/carbon/drawer.cpp
|
||||
// Purpose: Drawer child window classes.
|
||||
// Drawer windows appear under their parent window and
|
||||
// behave like a drawer, opening and closing to reveal
|
||||
// content that does not need to be visible at all times.
|
||||
// Author: Jason Bagley
|
||||
// Modified by: Ryan Norton (To make it work :), plus bug fixes)
|
||||
// Created: 2004-30-01
|
||||
// Copyright: (c) Jason Bagley; Art & Logic, Inc.
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#include "wx/osx/private.h"
|
||||
|
||||
#if defined( __WXMAC__ )
|
||||
|
||||
#include "wx/osx/carbon/drawer.h"
|
||||
|
||||
wxIMPLEMENT_DYNAMIC_CLASS(wxDrawerWindow, wxWindow);
|
||||
|
||||
// Use constants for now.
|
||||
// These can be made into member variables and set dynamically.
|
||||
const int kLeadingOffset = 20;
|
||||
const int kTrailingOffset = 20;
|
||||
|
||||
|
||||
// Converts Mac window edge constants to wxDirections, wxLEFT, wxRIGHT, etc.
|
||||
static wxDirection WindowEdgeToDirection(OptionBits edge);
|
||||
|
||||
// Convert wxDirections to MAc window edge constants.
|
||||
static OptionBits DirectionToWindowEdge(wxDirection direction);
|
||||
|
||||
|
||||
wxDrawerWindow::wxDrawerWindow()
|
||||
{
|
||||
}
|
||||
|
||||
wxDrawerWindow::~wxDrawerWindow()
|
||||
{
|
||||
SendDestroyEvent();
|
||||
Show(FALSE);
|
||||
}
|
||||
|
||||
bool wxDrawerWindow::Create(wxWindow *parent,
|
||||
wxWindowID id, const wxString& WXUNUSED(title),
|
||||
wxSize size, wxDirection edge, const wxString& name)
|
||||
{
|
||||
wxASSERT_MSG(NULL != parent, wxT("wxDrawerWindows must be attached to a parent window."));
|
||||
|
||||
// Constrain the drawer size to the parent window.
|
||||
const wxSize parentSize(parent->GetClientSize());
|
||||
if (wxLEFT == edge || wxRIGHT == edge)
|
||||
{
|
||||
if (size.GetHeight() > parentSize.GetHeight())
|
||||
size.SetHeight(parentSize.GetHeight() - (kLeadingOffset + kTrailingOffset));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (size.GetWidth() > parentSize.GetWidth())
|
||||
size.SetWidth(parentSize.GetWidth() - (kLeadingOffset + kTrailingOffset));
|
||||
}
|
||||
|
||||
// Create the drawer window.
|
||||
const wxPoint pos(0, 0);
|
||||
const wxSize dummySize(0,0);
|
||||
const long style = wxFRAME_DRAWER;
|
||||
|
||||
bool success = wxNonOwnedWindow::Create(parent, id, pos, size, style, name);
|
||||
if (success)
|
||||
{
|
||||
// this->MacCreateRealWindow(pos, size, style, name);
|
||||
success = (GetWXWindow() != NULL);
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
// Use drawer brush.
|
||||
SetBackgroundColour( wxColour( wxMacCreateCGColorFromHITheme( kThemeBrushDrawerBackground ) ) );
|
||||
::SetThemeWindowBackground((WindowRef)GetWXWindow(), kThemeBrushDrawerBackground, false);
|
||||
|
||||
// Leading and trailing offset are gaps from parent window edges
|
||||
// to where the drawer starts.
|
||||
::SetDrawerOffsets((WindowRef)GetWXWindow() , kLeadingOffset, kTrailingOffset);
|
||||
|
||||
// Set the drawers parent.
|
||||
// Is there a better way to get the parent's WindowRef?
|
||||
wxTopLevelWindow* tlwParent = wxDynamicCast(parent, wxTopLevelWindow);
|
||||
if (NULL != tlwParent)
|
||||
{
|
||||
OSStatus status = ::SetDrawerParent((WindowRef) GetWXWindow(),
|
||||
(WindowRef)tlwParent->GetWXWindow());
|
||||
success = (noErr == status);
|
||||
}
|
||||
else
|
||||
success = false;
|
||||
}
|
||||
|
||||
return success && SetPreferredEdge(edge);
|
||||
}
|
||||
|
||||
wxDirection wxDrawerWindow::GetCurrentEdge() const
|
||||
{
|
||||
const OptionBits edge = ::GetDrawerCurrentEdge((WindowRef)GetWXWindow());
|
||||
return WindowEdgeToDirection(edge);
|
||||
}
|
||||
|
||||
wxDirection wxDrawerWindow::GetPreferredEdge() const
|
||||
{
|
||||
const OptionBits edge = ::GetDrawerPreferredEdge((WindowRef)GetWXWindow());
|
||||
return WindowEdgeToDirection(edge);
|
||||
}
|
||||
|
||||
bool wxDrawerWindow::IsOpen() const
|
||||
{
|
||||
WindowDrawerState state = ::GetDrawerState((WindowRef)GetWXWindow());
|
||||
return (state == kWindowDrawerOpen || state == kWindowDrawerOpening);
|
||||
}
|
||||
|
||||
bool wxDrawerWindow::Open(bool show)
|
||||
{
|
||||
static const Boolean kAsynchronous = true;
|
||||
OSStatus status = noErr;
|
||||
|
||||
if (show)
|
||||
{
|
||||
const OptionBits preferredEdge = ::GetDrawerPreferredEdge((WindowRef)GetWXWindow());
|
||||
status = ::OpenDrawer((WindowRef)GetWXWindow(), preferredEdge, kAsynchronous);
|
||||
}
|
||||
else
|
||||
status = ::CloseDrawer((WindowRef)GetWXWindow(), kAsynchronous);
|
||||
|
||||
return (noErr == status);
|
||||
}
|
||||
|
||||
bool wxDrawerWindow::SetPreferredEdge(wxDirection edge)
|
||||
{
|
||||
const OSStatus status = ::SetDrawerPreferredEdge((WindowRef)GetWXWindow(),
|
||||
DirectionToWindowEdge(edge));
|
||||
return (noErr == status);
|
||||
}
|
||||
|
||||
|
||||
OptionBits DirectionToWindowEdge(wxDirection direction)
|
||||
{
|
||||
OptionBits edge;
|
||||
switch (direction)
|
||||
{
|
||||
case wxTOP:
|
||||
edge = kWindowEdgeTop;
|
||||
break;
|
||||
|
||||
case wxBOTTOM:
|
||||
edge = kWindowEdgeBottom;
|
||||
break;
|
||||
|
||||
case wxRIGHT:
|
||||
edge = kWindowEdgeRight;
|
||||
break;
|
||||
|
||||
case wxLEFT:
|
||||
default:
|
||||
edge = kWindowEdgeLeft;
|
||||
break;
|
||||
}
|
||||
return edge;
|
||||
}
|
||||
|
||||
wxDirection WindowEdgeToDirection(OptionBits edge)
|
||||
{
|
||||
wxDirection direction;
|
||||
switch (edge)
|
||||
{
|
||||
case kWindowEdgeTop:
|
||||
direction = wxTOP;
|
||||
break;
|
||||
|
||||
case kWindowEdgeBottom:
|
||||
direction = wxBOTTOM;
|
||||
break;
|
||||
|
||||
case kWindowEdgeRight:
|
||||
direction = wxRIGHT;
|
||||
break;
|
||||
|
||||
case kWindowEdgeDefault: // store current preferred and return that here?
|
||||
case kWindowEdgeLeft:
|
||||
default:
|
||||
direction = wxLEFT;
|
||||
break;
|
||||
}
|
||||
|
||||
return direction;
|
||||
}
|
||||
|
||||
#endif // defined( __WXMAC__ )
|
||||
@@ -1,184 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/osx/carbon/evtloop.cpp
|
||||
// Purpose: implementation of wxEventLoop for wxMac
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 2006-01-12
|
||||
// Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// for compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#include "wx/evtloop.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/app.h"
|
||||
#include "wx/log.h"
|
||||
#endif // WX_PRECOMP
|
||||
|
||||
#if wxUSE_GUI
|
||||
#include "wx/nonownedwnd.h"
|
||||
#endif
|
||||
|
||||
#include "wx/osx/private.h"
|
||||
|
||||
// ============================================================================
|
||||
// wxEventLoop implementation
|
||||
// ============================================================================
|
||||
|
||||
wxGUIEventLoop::wxGUIEventLoop()
|
||||
{
|
||||
}
|
||||
|
||||
static void DispatchAndReleaseEvent(EventRef theEvent)
|
||||
{
|
||||
if ( wxTheApp )
|
||||
wxTheApp->MacSetCurrentEvent( theEvent, NULL );
|
||||
|
||||
OSStatus status = SendEventToEventTarget(theEvent, GetEventDispatcherTarget());
|
||||
if (status == eventNotHandledErr && wxTheApp)
|
||||
wxTheApp->MacHandleUnhandledEvent(theEvent);
|
||||
|
||||
ReleaseEvent( theEvent );
|
||||
}
|
||||
|
||||
int wxGUIEventLoop::DoDispatchTimeout(unsigned long timeout)
|
||||
{
|
||||
wxMacAutoreleasePool autoreleasepool;
|
||||
|
||||
EventRef event;
|
||||
OSStatus status = ReceiveNextEvent(0, NULL, timeout/1000, true, &event);
|
||||
switch ( status )
|
||||
{
|
||||
default:
|
||||
wxFAIL_MSG( "unexpected ReceiveNextEvent() error" );
|
||||
// fall through
|
||||
|
||||
case eventLoopTimedOutErr:
|
||||
return -1;
|
||||
|
||||
case eventLoopQuitErr:
|
||||
// according to QA1061 this may also occur
|
||||
// when a WakeUp Process is executed
|
||||
return 0;
|
||||
|
||||
case noErr:
|
||||
DispatchAndReleaseEvent(event);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
void wxGUIEventLoop::WakeUp()
|
||||
{
|
||||
// If there's already one or more events in the queue then there's no need
|
||||
// to post another one.
|
||||
if ( GetNumEventsInQueue( GetMainEventQueue() ) > 0 )
|
||||
return;
|
||||
|
||||
OSStatus err = noErr;
|
||||
wxMacCarbonEvent wakeupEvent;
|
||||
wakeupEvent.Create( 'WXMC', 'WXMC', GetCurrentEventTime(),
|
||||
kEventAttributeNone );
|
||||
err = PostEventToQueue(GetMainEventQueue(), wakeupEvent,
|
||||
kEventPriorityLow );
|
||||
}
|
||||
|
||||
void wxGUIEventLoop::OSXDoRun()
|
||||
{
|
||||
wxMacAutoreleasePool autoreleasepool;
|
||||
|
||||
while (!m_shouldExit)
|
||||
{
|
||||
RunApplicationEventLoop();
|
||||
}
|
||||
|
||||
// Force enclosing event loop to temporarily exit and check
|
||||
// if it should be stopped.
|
||||
QuitApplicationEventLoop();
|
||||
}
|
||||
|
||||
void wxGUIEventLoop::OSXDoStop()
|
||||
{
|
||||
QuitApplicationEventLoop();
|
||||
}
|
||||
|
||||
CFRunLoopRef wxGUIEventLoop::CFGetCurrentRunLoop() const
|
||||
{
|
||||
return wxCFEventLoop::CFGetCurrentRunLoop();
|
||||
}
|
||||
|
||||
// TODO move into a evtloop_osx.cpp
|
||||
|
||||
wxModalEventLoop::wxModalEventLoop(wxWindow *modalWindow)
|
||||
{
|
||||
m_modalWindow = wxDynamicCast(modalWindow, wxNonOwnedWindow);
|
||||
wxASSERT_MSG( m_modalWindow != NULL, "must pass in a toplevel window for modal event loop" );
|
||||
m_modalNativeWindow = m_modalWindow->GetWXWindow();
|
||||
}
|
||||
|
||||
wxModalEventLoop::wxModalEventLoop(WXWindow modalNativeWindow)
|
||||
{
|
||||
m_modalWindow = NULL;
|
||||
wxASSERT_MSG( modalNativeWindow != NULL, "must pass in a toplevel window for modal event loop" );
|
||||
m_modalNativeWindow = modalNativeWindow;
|
||||
}
|
||||
|
||||
// END move into a evtloop_osx.cpp
|
||||
|
||||
void wxModalEventLoop::OSXDoRun()
|
||||
{
|
||||
wxWindowDisabler disabler(m_modalWindow);
|
||||
wxMacAutoreleasePool autoreleasepool;
|
||||
|
||||
bool resetGroupParent = false;
|
||||
|
||||
WindowGroupRef windowGroup = NULL;
|
||||
WindowGroupRef formerParentGroup = NULL;
|
||||
|
||||
// make sure modal dialogs are in the right layer so that they are not covered
|
||||
if ( m_modalWindow != NULL )
|
||||
{
|
||||
if ( m_modalWindow->GetParent() == NULL )
|
||||
{
|
||||
windowGroup = GetWindowGroup(m_modalNativeWindow) ;
|
||||
if ( windowGroup != GetWindowGroupOfClass( kMovableModalWindowClass ) )
|
||||
{
|
||||
formerParentGroup = GetWindowGroupParent( windowGroup );
|
||||
SetWindowGroupParent( windowGroup, GetWindowGroupOfClass( kMovableModalWindowClass ) );
|
||||
resetGroupParent = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_modalWindow->SetFocus();
|
||||
|
||||
RunAppModalLoopForWindow(m_modalNativeWindow);
|
||||
|
||||
if ( resetGroupParent )
|
||||
{
|
||||
SetWindowGroupParent( windowGroup , formerParentGroup );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void wxModalEventLoop::OSXDoStop()
|
||||
{
|
||||
wxMacAutoreleasePool autoreleasepool;
|
||||
QuitAppModalLoopForWindow(m_modalNativeWindow);
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -157,11 +157,6 @@ protected:
|
||||
void Init();
|
||||
public:
|
||||
bool m_fontValid;
|
||||
#if wxOSX_USE_CARBON && wxOSX_USE_ATSU_TEXT
|
||||
// for true theming support we must store the correct font
|
||||
// information here, as this speeds up and optimizes rendering
|
||||
ThemeFontID m_macThemeFontID ;
|
||||
#endif
|
||||
wxCFRef<CTFontRef> m_ctFont;
|
||||
#if wxOSX_USE_ATSU_TEXT
|
||||
void CreateATSUFont();
|
||||
@@ -185,9 +180,6 @@ wxFontRefData::wxFontRefData(const wxFontRefData& data) : wxGDIRefData()
|
||||
Init();
|
||||
m_info = data.m_info;
|
||||
m_fontValid = data.m_fontValid;
|
||||
#if wxOSX_USE_CARBON && wxOSX_USE_ATSU_TEXT
|
||||
m_macThemeFontID = data.m_macThemeFontID;
|
||||
#endif
|
||||
m_ctFont = data.m_ctFont;
|
||||
m_cgFont = data.m_cgFont;
|
||||
#if wxOSX_USE_ATSU_TEXT
|
||||
@@ -219,9 +211,6 @@ static CTFontDescriptorRef wxMacCreateCTFontDescriptor(CFStringRef iFamilyName,
|
||||
|
||||
void wxFontRefData::Init()
|
||||
{
|
||||
#if wxOSX_USE_CARBON && wxOSX_USE_ATSU_TEXT
|
||||
m_macThemeFontID = kThemeCurrentPortFont ;
|
||||
#endif
|
||||
#if wxOSX_USE_ATSU_TEXT
|
||||
m_macATSUStyle = NULL ;
|
||||
#endif
|
||||
@@ -244,9 +233,6 @@ void wxFontRefData::Free()
|
||||
m_ctFont.reset();
|
||||
m_cgFont.reset();
|
||||
#if wxOSX_USE_ATSU_TEXT
|
||||
#if wxOSX_USE_CARBON
|
||||
m_macThemeFontID = kThemeCurrentPortFont ;
|
||||
#endif
|
||||
if ( m_macATSUStyle )
|
||||
{
|
||||
::ATSUDisposeStyle((ATSUStyle)m_macATSUStyle);
|
||||
@@ -313,10 +299,8 @@ wxFontRefData::wxFontRefData(wxOSXSystemFont font, int size)
|
||||
}
|
||||
#if wxOSX_USE_ATSU_TEXT
|
||||
{
|
||||
#if !wxOSX_USE_CARBON
|
||||
// not needed outside
|
||||
ThemeFontID m_macThemeFontID = kThemeSystemFont;
|
||||
#endif
|
||||
switch( font )
|
||||
{
|
||||
case wxOSX_SYSTEM_FONT_NORMAL:
|
||||
@@ -826,37 +810,6 @@ wxFontEncoding wxFont::GetEncoding() const
|
||||
return M_FONTDATA->GetEncoding() ;
|
||||
}
|
||||
|
||||
#if wxOSX_USE_ATSU_TEXT && wxOSX_USE_CARBON
|
||||
|
||||
short wxFont::MacGetFontNum() const
|
||||
{
|
||||
wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") );
|
||||
|
||||
// cast away constness otherwise lazy font resolution is not possible
|
||||
const_cast<wxFont *>(this)->RealizeResource();
|
||||
|
||||
return M_FONTDATA->m_info.m_qdFontFamily;
|
||||
}
|
||||
|
||||
wxByte wxFont::MacGetFontStyle() const
|
||||
{
|
||||
wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") );
|
||||
|
||||
// cast away constness otherwise lazy font resolution is not possible
|
||||
const_cast<wxFont *>(this)->RealizeResource();
|
||||
|
||||
return M_FONTDATA->m_info.m_qdFontStyle;
|
||||
}
|
||||
|
||||
wxUint16 wxFont::MacGetThemeFontID() const
|
||||
{
|
||||
wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") );
|
||||
|
||||
return M_FONTDATA->m_macThemeFontID;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if wxOSX_USE_ATSU_TEXT
|
||||
void * wxFont::MacGetATSUStyle() const
|
||||
{
|
||||
@@ -1020,10 +973,6 @@ void wxNativeFontInfo::Init()
|
||||
m_atsuFontID = 0 ;
|
||||
m_atsuAdditionalQDStyles = 0;
|
||||
m_atsuFontValid = false;
|
||||
#if wxOSX_USE_CARBON
|
||||
m_qdFontStyle = 0;
|
||||
m_qdFontFamily = 0;
|
||||
#endif
|
||||
#endif
|
||||
m_pointSize = 0;
|
||||
m_family = wxFONTFAMILY_DEFAULT;
|
||||
@@ -1069,11 +1018,9 @@ void wxNativeFontInfo::EnsureValid()
|
||||
#if wxOSX_USE_ATSU_TEXT
|
||||
if ( !m_atsuFontValid )
|
||||
{
|
||||
#if !wxOSX_USE_CARBON
|
||||
// not needed outside
|
||||
wxInt16 m_qdFontFamily;
|
||||
wxInt16 m_qdFontStyle;
|
||||
#endif
|
||||
wxCFStringRef cf( m_faceName, wxLocale::GetSystemEncoding() );
|
||||
ATSFontFamilyRef atsfamily = ATSFontFamilyFindFromName( cf , kATSOptionFlagsDefault );
|
||||
if ( atsfamily == (ATSFontFamilyRef) -1 )
|
||||
@@ -1118,10 +1065,6 @@ void wxNativeFontInfo::Init(const wxNativeFontInfo& info)
|
||||
m_atsuFontValid = info.m_atsuFontValid;
|
||||
m_atsuFontID = info.m_atsuFontID ;
|
||||
m_atsuAdditionalQDStyles = info.m_atsuAdditionalQDStyles;
|
||||
#if wxOSX_USE_CARBON
|
||||
m_qdFontFamily = info.m_qdFontFamily;
|
||||
m_qdFontStyle = info.m_qdFontStyle;
|
||||
#endif
|
||||
#endif
|
||||
m_pointSize = info.m_pointSize;
|
||||
m_family = info.m_family;
|
||||
|
||||
@@ -53,149 +53,6 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxFontDialog, wxDialog);
|
||||
// wxFontDialog
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#if wxOSX_USE_CARBON
|
||||
|
||||
static const EventTypeSpec eventList[] =
|
||||
{
|
||||
{ kEventClassFont, kEventFontSelection } ,
|
||||
} ;
|
||||
|
||||
|
||||
pascal OSStatus
|
||||
wxMacCarbonFontPanelHandler(EventHandlerCallRef WXUNUSED(nextHandler),
|
||||
EventRef event,
|
||||
void *userData)
|
||||
{
|
||||
OSStatus result = eventNotHandledErr ;
|
||||
wxFontDialog *fontdialog = (wxFontDialog*) userData ;
|
||||
wxFontData& fontdata= fontdialog->GetFontData() ;
|
||||
|
||||
wxMacCarbonEvent cEvent( event );
|
||||
switch(cEvent.GetKind())
|
||||
{
|
||||
case kEventFontSelection :
|
||||
{
|
||||
bool setup = false ;
|
||||
if ( !setup )
|
||||
{
|
||||
CTFontDescriptorRef descr;
|
||||
if ( cEvent.GetParameter<CTFontDescriptorRef>( kEventParamCTFontDescriptor, typeCTFontDescriptorRef, &descr ) == noErr )
|
||||
{
|
||||
wxFont font;
|
||||
wxNativeFontInfo fontinfo;
|
||||
fontinfo.Init(descr);
|
||||
font.Create(fontinfo);
|
||||
fontdata.SetChosenFont( font ) ;
|
||||
setup = true;
|
||||
}
|
||||
}
|
||||
#if wxOSX_USE_ATSU_TEXT
|
||||
ATSUFontID fontId = 0 ;
|
||||
if ( !setup && (cEvent.GetParameter<ATSUFontID>(kEventParamATSUFontID, &fontId) == noErr) )
|
||||
{
|
||||
FMFontStyle fontStyle = cEvent.GetParameter<FMFontStyle>(kEventParamFMFontStyle);
|
||||
FMFontSize fontSize = cEvent.GetParameter<FMFontSize>(kEventParamFMFontSize);
|
||||
|
||||
CFStringRef cfName = NULL;
|
||||
#if 1
|
||||
FMFontFamily fontFamily = cEvent.GetParameter<FMFontFamily>(kEventParamFMFontFamily);
|
||||
ATSFontFamilyRef atsfontfamilyref = FMGetATSFontFamilyRefFromFontFamily( fontFamily ) ;
|
||||
OSStatus err = ATSFontFamilyGetName( atsfontfamilyref , kATSOptionFlagsDefault , &cfName ) ;
|
||||
if ( err != noErr )
|
||||
{
|
||||
wxFAIL_MSG("ATSFontFamilyGetName failed");
|
||||
}
|
||||
#else
|
||||
// we don't use the ATSU naming anymore
|
||||
ByteCount actualLength = 0;
|
||||
char *c = NULL;
|
||||
OSStatus err = ATSUFindFontName(fontId , kFontFamilyName, kFontUnicodePlatform, kFontNoScriptCode,
|
||||
kFontNoLanguageCode , 0 , NULL , &actualLength , NULL );
|
||||
if ( err == noErr)
|
||||
{
|
||||
actualLength += 1 ;
|
||||
char *c = (char*)malloc( actualLength );
|
||||
err = ATSUFindFontName(fontId, kFontFamilyName, kFontUnicodePlatform, kFontNoScriptCode,
|
||||
kFontNoLanguageCode, actualLength, c , NULL, NULL);
|
||||
cfName = CFStringCreateWithCharacters(NULL, (UniChar*) c, (actualLength-1) >> 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
err = ATSUFindFontName(fontId , kFontFamilyName, kFontNoPlatformCode, kFontNoScriptCode,
|
||||
kFontNoLanguageCode , 0 , NULL , &actualLength , NULL );
|
||||
if ( err == noErr )
|
||||
{
|
||||
actualLength += 1 ;
|
||||
c = (char*)malloc(actualLength);
|
||||
err = ATSUFindFontName(fontId, kFontFamilyName, kFontNoPlatformCode, kFontNoScriptCode,
|
||||
kFontNoLanguageCode, actualLength, c , NULL, NULL);
|
||||
c[actualLength-1] = 0;
|
||||
cfName = CFStringCreateWithCString(NULL, c, kCFStringEncodingMacRoman );
|
||||
}
|
||||
}
|
||||
if ( c!=NULL )
|
||||
free(c);
|
||||
#endif
|
||||
if ( cfName!=NULL )
|
||||
{
|
||||
fontdata.m_chosenFont.SetFaceName(wxCFStringRef(cfName).AsString(wxLocale::GetSystemEncoding()));
|
||||
fontdata.m_chosenFont.SetPointSize(fontSize);
|
||||
fontdata.m_chosenFont.SetStyle(fontStyle & italic ? wxFONTSTYLE_ITALIC : wxFONTSTYLE_NORMAL);
|
||||
fontdata.m_chosenFont.SetUnderlined((fontStyle & underline)!=0);
|
||||
fontdata.m_chosenFont.SetWeight(fontStyle & bold ? wxFONTWEIGHT_BOLD : wxFONTWEIGHT_NORMAL);
|
||||
}
|
||||
}
|
||||
#endif // wxOSX_USE_ATSU_TEXT
|
||||
|
||||
// retrieving the color
|
||||
RGBColor fontColor ;
|
||||
if ( cEvent.GetParameter<RGBColor>(kEventParamFontColor, &fontColor) == noErr )
|
||||
{
|
||||
fontdata.m_fontColour = fontColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
CFDictionaryRef dict ;
|
||||
if ( cEvent.GetParameter<CFDictionaryRef>(kEventParamDictionary, &dict) == noErr )
|
||||
{
|
||||
CFDictionaryRef attributesDict ;
|
||||
if ( CFDictionaryGetValueIfPresent(dict, kFontPanelAttributesKey, (const void **)&attributesDict) )
|
||||
{
|
||||
CFDataRef tagsData;
|
||||
CFDataRef sizesData;
|
||||
CFDataRef valuesData;
|
||||
if ( CFDictionaryGetValueIfPresent(attributesDict, kFontPanelAttributeTagsKey, (const void **)&tagsData) &&
|
||||
CFDictionaryGetValueIfPresent(attributesDict, kFontPanelAttributeSizesKey, (const void **)&sizesData) &&
|
||||
CFDictionaryGetValueIfPresent(attributesDict, kFontPanelAttributeValuesKey, (const void **)&valuesData) )
|
||||
{
|
||||
ItemCount count = CFDataGetLength(tagsData)/sizeof(ATSUAttributeTag);
|
||||
ATSUAttributeTag *tagPtr = (ATSUAttributeTag *)CFDataGetBytePtr(tagsData);
|
||||
ByteCount *sizePtr = (ByteCount *)CFDataGetBytePtr(sizesData);
|
||||
UInt32 *bytePtr = (UInt32*)CFDataGetBytePtr(valuesData);
|
||||
ATSUAttributeValuePtr valuesPtr = bytePtr ;
|
||||
for ( ItemCount i = 0 ; i < count ; ++i)
|
||||
{
|
||||
if ( tagPtr[i] == kATSUColorTag && sizePtr[i] == sizeof(RGBColor))
|
||||
{
|
||||
fontdata.m_fontColour = *(RGBColor *)valuesPtr;
|
||||
break ;
|
||||
}
|
||||
bytePtr = (UInt32*)( (UInt8*)bytePtr + sizePtr[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break ;
|
||||
}
|
||||
|
||||
return result ;
|
||||
}
|
||||
|
||||
DEFINE_ONE_SHOT_HANDLER_GETTER( wxMacCarbonFontPanelHandler )
|
||||
#endif
|
||||
|
||||
wxFontDialog::wxFontDialog()
|
||||
{
|
||||
}
|
||||
@@ -229,36 +86,9 @@ int wxFontDialog::ShowModal()
|
||||
{
|
||||
WX_HOOK_MODAL_DIALOG();
|
||||
|
||||
#if wxOSX_USE_CARBON
|
||||
|
||||
OSStatus err ;
|
||||
wxFont font = *wxNORMAL_FONT ;
|
||||
if ( m_fontData.m_initialFont.IsOk() )
|
||||
{
|
||||
font = m_fontData.m_initialFont ;
|
||||
}
|
||||
|
||||
CTFontDescriptorRef descr = (CTFontDescriptorRef) CTFontCopyFontDescriptor( (CTFontRef) font.OSXGetCTFont() );
|
||||
err = SetFontInfoForSelection (kFontSelectionCoreTextType,1, &descr , NULL);
|
||||
CFRelease( descr );
|
||||
|
||||
// just clicking on ENTER will not send us any font setting event, therefore we have to make sure
|
||||
// that field is already correct
|
||||
m_fontData.m_chosenFont = font ;
|
||||
|
||||
EventHandlerRef handler ;
|
||||
|
||||
err = InstallApplicationEventHandler( GetwxMacCarbonFontPanelHandlerUPP(), GetEventTypeCount(eventList), eventList, this , &handler );
|
||||
|
||||
if ( !FPIsFontPanelVisible() )
|
||||
FPShowHideFontPanel();
|
||||
#endif
|
||||
wxDialog::OSXBeginModalDialog();
|
||||
int retval = RunMixedFontDialog(this);
|
||||
wxDialog::OSXEndModalDialog();
|
||||
#if wxOSX_USE_CARBON
|
||||
::RemoveEventHandler(handler);
|
||||
#endif
|
||||
|
||||
return retval ;
|
||||
}
|
||||
|
||||
@@ -148,13 +148,6 @@ int RunMixedFontDialog(wxFontDialog* dialog)
|
||||
// setting up the ok/cancel buttons
|
||||
NSFontPanel* fontPanel = [NSFontPanel sharedFontPanel] ;
|
||||
|
||||
// adjust modality for carbon environment
|
||||
#if wxOSX_USE_CARBON
|
||||
WindowRef carbonWindowRef = (WindowRef)[fontPanel windowRef] ;
|
||||
SetWindowModality(carbonWindowRef, kWindowModalityAppModal , 0) ;
|
||||
SetWindowGroup(carbonWindowRef , GetWindowGroupOfClass(kMovableModalWindowClass));
|
||||
#endif
|
||||
|
||||
[fontPanel setFloatingPanel:NO] ;
|
||||
[[fontPanel standardWindowButton:NSWindowCloseButton] setEnabled:NO] ;
|
||||
|
||||
@@ -193,14 +186,9 @@ int RunMixedFontDialog(wxFontDialog* dialog)
|
||||
|
||||
// if we don't reenable it, FPShowHideFontPanel does not work
|
||||
[[fontPanel standardWindowButton:NSWindowCloseButton] setEnabled:YES] ;
|
||||
#if wxOSX_USE_CARBON
|
||||
if( FPIsFontPanelVisible())
|
||||
FPShowHideFontPanel() ;
|
||||
#else
|
||||
// we must pick the selection before closing, otherwise a native textcontrol interferes
|
||||
NSFont* theFont = [fontPanel panelConvertFont:[NSFont userFontOfSize:0]];
|
||||
[fontPanel close];
|
||||
#endif
|
||||
|
||||
if ( [accessoryView closedWithOk])
|
||||
{
|
||||
|
||||
@@ -215,9 +215,7 @@ void wxFrame::DetachMenuBar()
|
||||
|
||||
void wxFrame::AttachMenuBar( wxMenuBar *menuBar )
|
||||
{
|
||||
#if wxOSX_USE_CARBON
|
||||
wxFrame* tlf = wxDynamicCast( wxNonOwnedWindow::GetFromWXWindow( (WXWindow) FrontNonFloatingWindow() ) , wxFrame );
|
||||
#elif wxOSX_USE_COCOA
|
||||
#if wxOSX_USE_COCOA
|
||||
wxFrame* tlf = wxDynamicCast( wxNonOwnedWindow::GetFromWXWindow( wxOSXGetMainWindow() ) , wxFrame );
|
||||
#else
|
||||
wxFrame* tlf = wxDynamicCast( wxTheApp->GetTopWindow(), wxFrame );
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/osx/carbon/gauge.cpp
|
||||
// Purpose: wxGauge class
|
||||
// Author: Stefan Csomor
|
||||
// Modified by:
|
||||
// Created: 1998-01-01
|
||||
// Copyright: (c) Stefan Csomor
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#if wxUSE_GAUGE
|
||||
|
||||
#include "wx/gauge.h"
|
||||
|
||||
#include "wx/osx/private.h"
|
||||
|
||||
class wxMacGaugeCarbonControl : public wxMacControl
|
||||
{
|
||||
public :
|
||||
wxMacGaugeCarbonControl( wxWindowMac* peer ) : wxMacControl( peer )
|
||||
{
|
||||
}
|
||||
|
||||
void SetMaximum(wxInt32 v)
|
||||
{
|
||||
// switch back to determinate mode if not there already
|
||||
if ( GetData<Boolean>( kControlNoPart, kControlProgressBarIndeterminateTag ) != false )
|
||||
{
|
||||
SetData<Boolean>( kControlNoPart, kControlProgressBarIndeterminateTag, (Boolean)false );
|
||||
}
|
||||
|
||||
wxMacControl::SetMaximum( v ) ;
|
||||
}
|
||||
|
||||
void SetValue(wxInt32 v)
|
||||
{
|
||||
// switch back to determinate mode if not there already
|
||||
if ( GetData<Boolean>( kControlNoPart, kControlProgressBarIndeterminateTag ) != false )
|
||||
{
|
||||
SetData<Boolean>( kControlNoPart, kControlProgressBarIndeterminateTag, (Boolean)false );
|
||||
}
|
||||
|
||||
wxMacControl::SetValue( v ) ;
|
||||
|
||||
// turn off animation in the unnecessary situations as this is consuming a lot of CPU otherwise
|
||||
Boolean shouldAnimate = ( v > 0 && v < GetMaximum() ) ;
|
||||
if ( GetData<Boolean>( kControlEntireControl, kControlProgressBarAnimatingTag ) != shouldAnimate )
|
||||
{
|
||||
SetData<Boolean>( kControlEntireControl, kControlProgressBarAnimatingTag, shouldAnimate ) ;
|
||||
if ( !shouldAnimate )
|
||||
SetNeedsDisplay(NULL) ;
|
||||
}
|
||||
}
|
||||
|
||||
void PulseGauge()
|
||||
{
|
||||
if ( GetData<Boolean>( kControlNoPart, kControlProgressBarIndeterminateTag ) != true )
|
||||
{
|
||||
SetData<Boolean>( kControlNoPart, kControlProgressBarIndeterminateTag, true);
|
||||
}
|
||||
|
||||
if ( GetData<Boolean>( kControlEntireControl, kControlProgressBarAnimatingTag ) != true )
|
||||
{
|
||||
SetData<Boolean>( kControlEntireControl, kControlProgressBarAnimatingTag, true ) ;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
wxWidgetImplType* wxWidgetImpl::CreateGauge( wxWindowMac* wxpeer,
|
||||
wxWindowMac* parent,
|
||||
wxWindowID WXUNUSED(id),
|
||||
wxInt32 value,
|
||||
wxInt32 minimum,
|
||||
wxInt32 maximum,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long WXUNUSED(style),
|
||||
long WXUNUSED(extraStyle))
|
||||
{
|
||||
Rect bounds = wxMacGetBoundsForControl( wxpeer, pos, size );
|
||||
wxMacGaugeCarbonControl* peer = new wxMacGaugeCarbonControl( wxpeer );
|
||||
OSStatus err = CreateProgressBarControl(
|
||||
MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds,
|
||||
value, minimum, maximum, false /* not indeterminate */, peer->GetControlRefAddr() );
|
||||
verify_noerr( err );
|
||||
if ( value == 0 )
|
||||
peer->SetData<Boolean>( kControlEntireControl, kControlProgressBarAnimatingTag, (Boolean)false );
|
||||
return peer;
|
||||
}
|
||||
|
||||
#endif // wxUSE_GAUGE
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -98,9 +98,6 @@ OSStatus wxMacDrawCGImage(
|
||||
const CGRect * inBounds,
|
||||
CGImageRef inImage)
|
||||
{
|
||||
#if wxOSX_USE_CARBON
|
||||
return HIViewDrawCGImage( inContext, inBounds, inImage );
|
||||
#else
|
||||
CGContextSaveGState(inContext);
|
||||
CGContextTranslateCTM(inContext, inBounds->origin.x, inBounds->origin.y + inBounds->size.height);
|
||||
CGRect r = *inBounds;
|
||||
@@ -109,7 +106,6 @@ OSStatus wxMacDrawCGImage(
|
||||
CGContextDrawImage(inContext, r, inImage );
|
||||
CGContextRestoreGState(inContext);
|
||||
return noErr;
|
||||
#endif
|
||||
}
|
||||
|
||||
CGColorRef wxMacCreateCGColor( const wxColour& col )
|
||||
@@ -1330,10 +1326,6 @@ class WXDLLEXPORT wxMacCoreGraphicsContext : public wxGraphicsContext
|
||||
public:
|
||||
wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer, CGContextRef cgcontext, wxDouble width = 0, wxDouble height = 0 );
|
||||
|
||||
#if wxOSX_USE_CARBON
|
||||
wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer, WindowRef window );
|
||||
#endif
|
||||
|
||||
wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer, wxWindow* window );
|
||||
|
||||
wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer);
|
||||
@@ -1459,11 +1451,7 @@ private:
|
||||
virtual void DoDrawRotatedText( const wxString &str, wxDouble x, wxDouble y, wxDouble angle ) wxOVERRIDE;
|
||||
|
||||
CGContextRef m_cgContext;
|
||||
#if wxOSX_USE_CARBON
|
||||
WindowRef m_windowRef;
|
||||
#else
|
||||
WXWidget m_view;
|
||||
#endif
|
||||
bool m_contextSynthesized;
|
||||
CGAffineTransform m_windowTransform;
|
||||
bool m_invisible;
|
||||
@@ -1524,9 +1512,6 @@ void wxMacCoreGraphicsContext::Init()
|
||||
m_contextSynthesized = false;
|
||||
m_width = 0;
|
||||
m_height = 0;
|
||||
#if wxOSX_USE_CARBON
|
||||
m_windowRef = NULL;
|
||||
#endif
|
||||
#if wxOSX_USE_COCOA_OR_IPHONE
|
||||
m_view = NULL;
|
||||
#endif
|
||||
@@ -1543,15 +1528,6 @@ wxMacCoreGraphicsContext::wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer
|
||||
m_height = height;
|
||||
}
|
||||
|
||||
#if wxOSX_USE_CARBON
|
||||
wxMacCoreGraphicsContext::wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer, WindowRef window ): wxGraphicsContext(renderer)
|
||||
{
|
||||
Init();
|
||||
m_windowRef = window;
|
||||
m_enableOffset = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
wxMacCoreGraphicsContext::wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer, wxWindow* window ): wxGraphicsContext(renderer)
|
||||
{
|
||||
Init();
|
||||
@@ -1655,13 +1631,6 @@ bool wxMacCoreGraphicsContext::EnsureIsValid()
|
||||
{
|
||||
m_invisible = true;
|
||||
}
|
||||
#endif
|
||||
#if wxOSX_USE_CARBON
|
||||
OSStatus status = QDBeginCGContext( GetWindowPort( m_windowRef ) , &m_cgContext );
|
||||
if ( status != noErr )
|
||||
{
|
||||
wxFAIL_MSG("Cannot nest wxDCs on the same window");
|
||||
}
|
||||
#endif
|
||||
if ( m_cgContext )
|
||||
{
|
||||
@@ -2114,9 +2083,6 @@ void wxMacCoreGraphicsContext::SetNativeContext( CGContextRef cg )
|
||||
CGContextRestoreGState( m_cgContext );
|
||||
if ( m_contextSynthesized )
|
||||
{
|
||||
#if wxOSX_USE_CARBON
|
||||
QDEndCGContext( GetWindowPort( m_windowRef ) , &m_cgContext);
|
||||
#endif
|
||||
#if wxOSX_USE_COCOA
|
||||
wxOSXUnlockFocus(m_view);
|
||||
#endif
|
||||
@@ -2226,18 +2192,6 @@ void wxMacCoreGraphicsContext::DrawIcon( const wxIcon &icon, wxDouble x, wxDoubl
|
||||
if (m_composition == wxCOMPOSITION_DEST)
|
||||
return;
|
||||
|
||||
#if wxOSX_USE_CARBON
|
||||
{
|
||||
CGContextSaveGState( m_cgContext );
|
||||
CGContextTranslateCTM( m_cgContext,(CGFloat) x ,(CGFloat) (y + h) );
|
||||
CGContextScaleCTM( m_cgContext, 1, -1 );
|
||||
CGRect r = CGRectMake( (CGFloat) 0.0 , (CGFloat) 0.0 , (CGFloat) w , (CGFloat) h );
|
||||
PlotIconRefInContext( m_cgContext , &r , kAlignNone , kTransformNone ,
|
||||
NULL , kPlotIconRefNormalFlags , icon.GetHICON() );
|
||||
CGContextRestoreGState( m_cgContext );
|
||||
}
|
||||
#endif
|
||||
|
||||
#if wxOSX_USE_COCOA
|
||||
{
|
||||
CGRect r = CGRectMake( (CGFloat) x , (CGFloat) y , (CGFloat) w , (CGFloat) h );
|
||||
@@ -2717,14 +2671,8 @@ wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContextFromNativeContext( v
|
||||
|
||||
wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContextFromNativeWindow( void * window )
|
||||
{
|
||||
#if wxOSX_USE_CARBON
|
||||
wxMacCoreGraphicsContext* context = new wxMacCoreGraphicsContext(this,(WindowRef)window);
|
||||
context->EnableOffset(true);
|
||||
return context;
|
||||
#else
|
||||
wxUnusedVar(window);
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContext( wxWindow* window )
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user