Remove wxOSX/Carbon support.
Cocoa has been the default toolkit in wxWidgets for a long time. There is really no good reason to use Carbon in 2016 and this removes a lot of unused and unmaintained code.
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
@@ -1,287 +0,0 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 45;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
404BEE6110EC83280080E2B8 /* libwx_osx_carbon_static.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libwx_osx_carbon_static.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
409C323613B27E1D0009CB3C /* wxdebug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = wxdebug.xcconfig; sourceTree = "<group>"; };
|
||||
409C323713B27E1D0009CB3C /* wxrelease.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = wxrelease.xcconfig; sourceTree = "<group>"; };
|
||||
40E3507E10EF2C130029DC34 /* wxcarbon.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = wxcarbon.xcconfig; sourceTree = "<group>"; };
|
||||
D2AAC0C705546C1D00DB518D /* libwx_osx_carbon.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libwx_osx_carbon.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
404BEE5F10EC83280080E2B8 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
D2AAC0C505546C1D00DB518D /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
034768DFFF38A50411DB9C8B /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D2AAC0C705546C1D00DB518D /* libwx_osx_carbon.dylib */,
|
||||
404BEE6110EC83280080E2B8 /* libwx_osx_carbon_static.a */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
0867D691FE84028FC02AAC07 /* wxcocoa */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
40E3507E10EF2C130029DC34 /* wxcarbon.xcconfig */,
|
||||
409C323613B27E1D0009CB3C /* wxdebug.xcconfig */,
|
||||
409C323713B27E1D0009CB3C /* wxrelease.xcconfig */,
|
||||
034768DFFF38A50411DB9C8B /* Products */,
|
||||
);
|
||||
name = wxcocoa;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
404BEE5D10EC83280080E2B8 /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
D2AAC0C305546C1D00DB518D /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXHeadersBuildPhase section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
404BEE6010EC83280080E2B8 /* static */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 404BEE6410EC83480080E2B8 /* Build configuration list for PBXNativeTarget "static" */;
|
||||
buildPhases = (
|
||||
404B023E10EC882E0080E2B8 /* ShellScript */,
|
||||
404BEE5D10EC83280080E2B8 /* Headers */,
|
||||
404BEE5E10EC83280080E2B8 /* Sources */,
|
||||
404BEE5F10EC83280080E2B8 /* Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = static;
|
||||
productName = static;
|
||||
productReference = 404BEE6110EC83280080E2B8 /* libwx_osx_carbon_static.a */;
|
||||
productType = "com.apple.product-type.library.static";
|
||||
};
|
||||
D2AAC0C605546C1D00DB518D /* dynamic */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 1DEB917D08733D990010E9CD /* Build configuration list for PBXNativeTarget "dynamic" */;
|
||||
buildPhases = (
|
||||
404B023C10EC88180080E2B8 /* ShellScript */,
|
||||
D2AAC0C305546C1D00DB518D /* Headers */,
|
||||
D2AAC0C405546C1D00DB518D /* Sources */,
|
||||
D2AAC0C505546C1D00DB518D /* Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = dynamic;
|
||||
productName = wxcocoa;
|
||||
productReference = D2AAC0C705546C1D00DB518D /* libwx_osx_carbon.dylib */;
|
||||
productType = "com.apple.product-type.library.dynamic";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
0867D690FE84028FC02AAC07 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
buildConfigurationList = 1DEB918108733D990010E9CD /* Build configuration list for PBXProject "wxcarbon_in" */;
|
||||
compatibilityVersion = "Xcode 3.1";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 1;
|
||||
knownRegions = (
|
||||
English,
|
||||
Japanese,
|
||||
French,
|
||||
German,
|
||||
);
|
||||
mainGroup = 0867D691FE84028FC02AAC07 /* wxcocoa */;
|
||||
productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
D2AAC0C605546C1D00DB518D /* dynamic */,
|
||||
404BEE6010EC83280080E2B8 /* static */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
404B023C10EC88180080E2B8 /* ShellScript */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${WXROOT}/distrib/mac/pbsetup-sh\" \"${WXROOT}/src\" \"${WXROOT}/build/osx/setup/${WXTOOLKIT}\"";
|
||||
};
|
||||
404B023E10EC882E0080E2B8 /* ShellScript */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${WXROOT}/distrib/mac/pbsetup-sh\" \"${WXROOT}/src\" \"${WXROOT}/build/osx/setup/${WXTOOLKIT}\"";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
404BEE5E10EC83280080E2B8 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
D2AAC0C405546C1D00DB518D /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
1DEB917E08733D990010E9CD /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 40E3507E10EF2C130029DC34 /* wxcarbon.xcconfig */;
|
||||
buildSettings = {
|
||||
EXECUTABLE_PREFIX = lib;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"$(GCC_PREPROCESSOR_DEFINITIONS)",
|
||||
WXMAKINGDLL,
|
||||
"wxUSE_BASE=1",
|
||||
);
|
||||
INSTALL_PATH = "@executable_path/../Frameworks/";
|
||||
OTHER_LDFLAGS = "$(OTHER_LDFLAGS)";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
1DEB917F08733D990010E9CD /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 40E3507E10EF2C130029DC34 /* wxcarbon.xcconfig */;
|
||||
buildSettings = {
|
||||
EXECUTABLE_PREFIX = lib;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"$(GCC_PREPROCESSOR_DEFINITIONS)",
|
||||
WXMAKINGDLL,
|
||||
"wxUSE_BASE=1",
|
||||
);
|
||||
INSTALL_PATH = "@executable_path/../Frameworks/";
|
||||
OTHER_LDFLAGS = "$(OTHER_LDFLAGS)";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
1DEB918208733D990010E9CD /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 409C323613B27E1D0009CB3C /* wxdebug.xcconfig */;
|
||||
buildSettings = {
|
||||
WXROOT = "$(PROJECT_DIR)/../..";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
1DEB918308733D990010E9CD /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 409C323713B27E1D0009CB3C /* wxrelease.xcconfig */;
|
||||
buildSettings = {
|
||||
WXROOT = "$(PROJECT_DIR)/../..";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
404BEE6210EC832A0080E2B8 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 40E3507E10EF2C130029DC34 /* wxcarbon.xcconfig */;
|
||||
buildSettings = {
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"$(GCC_PREPROCESSOR_DEFINITIONS)",
|
||||
"wxUSE_BASE=1",
|
||||
);
|
||||
PRODUCT_NAME = "$(PRODUCT_NAME)_static";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
404BEE6310EC832A0080E2B8 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 40E3507E10EF2C130029DC34 /* wxcarbon.xcconfig */;
|
||||
buildSettings = {
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"$(GCC_PREPROCESSOR_DEFINITIONS)",
|
||||
"wxUSE_BASE=1",
|
||||
);
|
||||
PRODUCT_NAME = "$(PRODUCT_NAME)_static";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
1DEB917D08733D990010E9CD /* Build configuration list for PBXNativeTarget "dynamic" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
1DEB917E08733D990010E9CD /* Debug */,
|
||||
1DEB917F08733D990010E9CD /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
1DEB918108733D990010E9CD /* Build configuration list for PBXProject "wxcarbon_in" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
1DEB918208733D990010E9CD /* Debug */,
|
||||
1DEB918308733D990010E9CD /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
404BEE6410EC83480080E2B8 /* Build configuration list for PBXNativeTarget "static" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
404BEE6210EC832A0080E2B8 /* Debug */,
|
||||
404BEE6310EC832A0080E2B8 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 0867D690FE84028FC02AAC07 /* Project object */;
|
||||
}
|
69
configure
vendored
69
configure
vendored
@@ -1070,11 +1070,9 @@ enable_universal
|
||||
with_themes
|
||||
with_gtk
|
||||
with_motif
|
||||
with_osx_carbon
|
||||
with_osx_cocoa
|
||||
with_osx_iphone
|
||||
with_osx
|
||||
with_carbon
|
||||
with_cocoa
|
||||
with_iphone
|
||||
with_mac
|
||||
@@ -2295,11 +2293,9 @@ Optional Packages:
|
||||
--with-themes=all|list use only the specified comma-separated list of wxUniversal themes
|
||||
--with-gtk[=VERSION] use GTK+, VERSION can be 3, 2 (default), 1 or "any"
|
||||
--with-motif use Motif/Lesstif
|
||||
--with-osx_carbon use Mac OS X (Carbon)
|
||||
--with-osx_cocoa use Mac OS X (Cocoa)
|
||||
--with-osx_iphone use iPhone OS X port
|
||||
--with-osx use Mac OS X (default port, Cocoa)
|
||||
--with-carbon same as --with-osx_carbon
|
||||
--with-cocoa same as --with-osx_cocoa
|
||||
--with-iphone same as --with-osx_iphone
|
||||
--with-mac same as --with-osx
|
||||
@@ -3690,10 +3686,9 @@ USE_ALPHA=
|
||||
|
||||
NEEDS_D_REENTRANT_FOR_R_FUNCS=0
|
||||
|
||||
ALL_TOOLKITS="GTK OSX_CARBON OSX_COCOA OSX_IPHONE MOTIF MSW X11 DFB QT"
|
||||
ALL_TOOLKITS="GTK OSX_COCOA OSX_IPHONE MOTIF MSW X11 DFB QT"
|
||||
|
||||
DEFAULT_wxUSE_GTK=0
|
||||
DEFAULT_wxUSE_OSX_CARBON=0
|
||||
DEFAULT_wxUSE_OSX_COCOA=0
|
||||
DEFAULT_wxUSE_OSX_IPHONE=0
|
||||
DEFAULT_wxUSE_MOTIF=0
|
||||
@@ -3703,7 +3698,6 @@ DEFAULT_wxUSE_DFB=0
|
||||
DEFAULT_wxUSE_QT=0
|
||||
|
||||
DEFAULT_DEFAULT_wxUSE_GTK=0
|
||||
DEFAULT_DEFAULT_wxUSE_OSX_CARBON=0
|
||||
DEFAULT_DEFAULT_wxUSE_OSX_COCOA=0
|
||||
DEFAULT_DEFAULT_wxUSE_OSX_IPHONE=0
|
||||
DEFAULT_DEFAULT_wxUSE_MOTIF=0
|
||||
@@ -4349,12 +4343,6 @@ if test "${with_motif+set}" = set; then :
|
||||
fi
|
||||
|
||||
|
||||
# Check whether --with-osx_carbon was given.
|
||||
if test "${with_osx_carbon+set}" = set; then :
|
||||
withval=$with_osx_carbon; wxUSE_OSX_CARBON="$withval" CACHE_OSX_CARBON=1 TOOLKIT_GIVEN=1
|
||||
fi
|
||||
|
||||
|
||||
# Check whether --with-osx_cocoa was given.
|
||||
if test "${with_osx_cocoa+set}" = set; then :
|
||||
withval=$with_osx_cocoa; wxUSE_OSX_COCOA="$withval" CACHE_OSX_COCOA=1 TOOLKIT_GIVEN=1
|
||||
@@ -4373,12 +4361,6 @@ if test "${with_osx+set}" = set; then :
|
||||
fi
|
||||
|
||||
|
||||
# Check whether --with-carbon was given.
|
||||
if test "${with_carbon+set}" = set; then :
|
||||
withval=$with_carbon; wxUSE_OSX_CARBON="$withval" CACHE_OSX_CARBON=1 TOOLKIT_GIVEN=1
|
||||
fi
|
||||
|
||||
|
||||
# Check whether --with-cocoa was given.
|
||||
if test "${with_cocoa+set}" = set; then :
|
||||
withval=$with_cocoa; wxUSE_OSX_COCOA="$withval" CACHE_OSX_COCOA=1 TOOLKIT_GIVEN=1
|
||||
@@ -4559,7 +4541,7 @@ if test "$wxUSE_GUI" = "yes"; then
|
||||
done
|
||||
fi
|
||||
|
||||
NUM_TOOLKITS=`expr ${wxUSE_GTK:-0} + ${wxUSE_OSX_CARBON:-0} \
|
||||
NUM_TOOLKITS=`expr ${wxUSE_GTK:-0} \
|
||||
+ ${wxUSE_OSX_COCOA:-0} + ${wxUSE_OSX_IPHONE:-0} + ${wxUSE_DFB:-0} \
|
||||
+ ${wxUSE_MOTIF:-0} + ${wxUSE_MSW:-0} \
|
||||
+ ${wxUSE_X11:-0} + ${wxUSE_QT:-0}`
|
||||
@@ -4595,8 +4577,7 @@ $as_echo "base only" >&6; }
|
||||
fi
|
||||
|
||||
wxUSE_MAC=0
|
||||
if test "$wxUSE_OSX_CARBON" = 1 \
|
||||
-o "$wxUSE_OSX_COCOA" = 1 \
|
||||
if test "$wxUSE_OSX_COCOA" = 1 \
|
||||
-o "$wxUSE_OSX_IPHONE" = 1; then
|
||||
wxUSE_MAC=1
|
||||
fi
|
||||
@@ -27030,35 +27011,6 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$wxUSE_OSX_CARBON" = 1; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler syntax to enable Pascal strings" >&5
|
||||
$as_echo_n "checking for compiler syntax to enable Pascal strings... " >&6; }
|
||||
if test "$GCC" = yes; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: gcc" >&5
|
||||
$as_echo "gcc" >&6; }
|
||||
CPPFLAGS_PASCAL="-fpascal-strings"
|
||||
elif test "`echo $CXX | sed -e 's@.*/@@'`" = "xlC"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: xlc" >&5
|
||||
$as_echo "xlc" >&6; }
|
||||
CPPFLAGS_PASCAL="-qmacpstr"
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5
|
||||
$as_echo "none" >&6; }
|
||||
fi
|
||||
|
||||
if test "x$wxUSE_UNIX" = "xyes"; then
|
||||
CPPFLAGS="$CPPFLAGS_PASCAL -I/Developer/Headers/FlatCarbon $CPPFLAGS"
|
||||
else
|
||||
CPPFLAGS="$CPPFLAGS_PASCAL -DTARGET_CARBON $CPPFLAGS"
|
||||
fi
|
||||
|
||||
TOOLKIT=OSX_CARBON
|
||||
GUIDIST=OSX_CARBON_DIST
|
||||
WXBASEPORT="_carbon"
|
||||
|
||||
TOOLCHAIN_DEFS="${TOOLCHAIN_DEFS} -D__WXMAC__ -D__WXOSX__"
|
||||
fi
|
||||
|
||||
if test "$wxUSE_OSX_COCOA" = 1; then
|
||||
TOOLKIT=OSX_COCOA
|
||||
GUIDIST=OSX_COCOA_DIST
|
||||
@@ -28267,7 +28219,7 @@ USE_OPENGL=0
|
||||
if test "$wxUSE_OPENGL" = "yes" -o "$wxUSE_OPENGL" = "auto"; then
|
||||
|
||||
|
||||
if test "$wxUSE_OSX_CARBON" = 1 -o "$wxUSE_OSX_COCOA" = 1; then
|
||||
if test "$wxUSE_OSX_COCOA" = 1; then
|
||||
OPENGL_LIBS="-framework OpenGL -framework AGL"
|
||||
elif test "$wxUSE_MSW" = 1; then
|
||||
OPENGL_LIBS="-lopengl32 -lglu32"
|
||||
@@ -29902,7 +29854,7 @@ TOOLCHAIN_NAME="${TOOLKIT_DIR}${TOOLKIT_VERSION}${WIDGET_SET}${lib_unicode_suffi
|
||||
TOOLCHAIN_FULLNAME="${HOST_PREFIX}${TOOLKIT_DIR}${TOOLKIT_VERSION}${WIDGET_SET}-${WX_CHARTYPE}${config_linkage_component}-${WX_RELEASE}${WX_FLAVOUR}"
|
||||
|
||||
|
||||
if test "$wxUSE_OSX_CARBON" = 1 -o "$wxUSE_OSX_COCOA" = 1; then
|
||||
if test "$wxUSE_OSX_COCOA" = 1; then
|
||||
WX_LIBRARY_BASENAME_NOGUI="wx_base${lib_unicode_suffix}${WX_LIB_FLAVOUR}"
|
||||
else
|
||||
WX_LIBRARY_BASENAME_NOGUI="wx_base${WXBASEPORT}${lib_unicode_suffix}${WX_LIB_FLAVOUR}"
|
||||
@@ -35166,13 +35118,13 @@ if test "$wxUSE_BUSYINFO" = "yes"; then
|
||||
fi
|
||||
|
||||
if test "$wxUSE_HOTKEY" = "yes"; then
|
||||
if test "$wxUSE_MSW" != 1 -a "$wxUSE_OSX_COCOA" != 1 -a "$wxUSE_OSX_CARBON" != 1; then
|
||||
if test "$wxUSE_MSW" != 1 -a "$wxUSE_OSX_COCOA" != 1; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Hot keys not supported by the current toolkit, disabled" >&5
|
||||
$as_echo "$as_me: WARNING: Hot keys not supported by the current toolkit, disabled" >&2;}
|
||||
wxUSE_HOTKEY=no
|
||||
fi
|
||||
elif test "$wxUSE_HOTKEY" = "auto"; then
|
||||
if test "$wxUSE_MSW" = 1 -o "$wxUSE_OSX_COCOA" = 1 -o "$wxUSE_OSX_CARBON" = 1; then
|
||||
if test "$wxUSE_MSW" = 1 -o "$wxUSE_OSX_COCOA" = 1; then
|
||||
wxUSE_HOTKEY=yes
|
||||
fi
|
||||
fi
|
||||
@@ -40815,15 +40767,9 @@ fi
|
||||
|
||||
MACSETFILE="\$(SETFILE)"
|
||||
|
||||
if test "$wxUSE_OSX_CARBON" = 1; then
|
||||
POSTLINK_COMMAND="\$(REZ) -d __DARWIN__ -t APPL Carbon.r -o"
|
||||
RESCOMP="$REZ"
|
||||
WXCONFIG_RESFLAGS="-d __DARWIN__ -t APPL Carbon.r -o"
|
||||
else
|
||||
POSTLINK_COMMAND="cat /dev/null | \$(REZ) -d __DARWIN__ -t APPL ${LIBWXMACRES}"
|
||||
RESCOMP="cat /dev/null \| $REZ"
|
||||
WXCONFIG_RESFLAGS="-d __DARWIN__ -t APPL \$libdir/$WX_RESOURCES_MACOSX_ASCII"
|
||||
fi
|
||||
|
||||
else
|
||||
MACSETFILE="@true"
|
||||
@@ -42691,3 +42637,4 @@ echo " libmspack ${wxUSE_LIBMSPAC
|
||||
echo " sdl ${wxUSE_LIBSDL}"
|
||||
|
||||
echo ""
|
||||
|
||||
|
58
configure.in
58
configure.in
@@ -99,12 +99,11 @@ NEEDS_D_REENTRANT_FOR_R_FUNCS=0
|
||||
dnl the list of all available toolkits
|
||||
dnl
|
||||
dnl update NUM_TOOLKITS calculation below when adding a new toolkit here!
|
||||
ALL_TOOLKITS="GTK OSX_CARBON OSX_COCOA OSX_IPHONE MOTIF MSW X11 DFB QT"
|
||||
ALL_TOOLKITS="GTK OSX_COCOA OSX_IPHONE MOTIF MSW X11 DFB QT"
|
||||
|
||||
dnl NB: these wxUSE_XXX constants have value of 0 or 1 unlike all the other ones
|
||||
dnl which are either yes or no
|
||||
DEFAULT_wxUSE_GTK=0
|
||||
DEFAULT_wxUSE_OSX_CARBON=0
|
||||
DEFAULT_wxUSE_OSX_COCOA=0
|
||||
DEFAULT_wxUSE_OSX_IPHONE=0
|
||||
DEFAULT_wxUSE_MOTIF=0
|
||||
@@ -117,7 +116,6 @@ dnl these are the values which are really default for the given platform:
|
||||
dnl they're used if no --with-<toolkit> options were given to detect the
|
||||
dnl toolkit to use by default for the target platform
|
||||
DEFAULT_DEFAULT_wxUSE_GTK=0
|
||||
DEFAULT_DEFAULT_wxUSE_OSX_CARBON=0
|
||||
DEFAULT_DEFAULT_wxUSE_OSX_COCOA=0
|
||||
DEFAULT_DEFAULT_wxUSE_OSX_IPHONE=0
|
||||
DEFAULT_DEFAULT_wxUSE_MOTIF=0
|
||||
@@ -420,11 +418,9 @@ dnl we use AC_ARG_WITH and not WX_ARG_WITH for the toolkit options as they
|
||||
dnl shouldn't default to wxUSE_ALL_FEATURES
|
||||
AC_ARG_WITH(gtk, [[ --with-gtk[=VERSION] use GTK+, VERSION can be 3, 2 (default), 1 or "any"]], [wxUSE_GTK="$withval" CACHE_GTK=1 TOOLKIT_GIVEN=1])
|
||||
AC_ARG_WITH(motif, [ --with-motif use Motif/Lesstif], [wxUSE_MOTIF="$withval" CACHE_MOTIF=1 TOOLKIT_GIVEN=1])
|
||||
AC_ARG_WITH(osx_carbon, [ --with-osx_carbon use Mac OS X (Carbon)], [wxUSE_OSX_CARBON="$withval" CACHE_OSX_CARBON=1 TOOLKIT_GIVEN=1])
|
||||
AC_ARG_WITH(osx_cocoa, [ --with-osx_cocoa use Mac OS X (Cocoa)], [wxUSE_OSX_COCOA="$withval" CACHE_OSX_COCOA=1 TOOLKIT_GIVEN=1])
|
||||
AC_ARG_WITH(osx_iphone, [ --with-osx_iphone use iPhone OS X port], [wxUSE_OSX_IPHONE="$withval" CACHE_OSX_IPHONE=1 TOOLKIT_GIVEN=1])
|
||||
AC_ARG_WITH(osx, [ --with-osx use Mac OS X (default port, Cocoa)], [wxUSE_OSX_COCOA="$withval" CACHE_OSX_COCOA=1 TOOLKIT_GIVEN=1])
|
||||
AC_ARG_WITH(carbon, [ --with-carbon same as --with-osx_carbon], [wxUSE_OSX_CARBON="$withval" CACHE_OSX_CARBON=1 TOOLKIT_GIVEN=1])
|
||||
AC_ARG_WITH(cocoa, [ --with-cocoa same as --with-osx_cocoa], [wxUSE_OSX_COCOA="$withval" CACHE_OSX_COCOA=1 TOOLKIT_GIVEN=1])
|
||||
AC_ARG_WITH(iphone, [ --with-iphone same as --with-osx_iphone], [wxUSE_OSX_IPHONE="$withval" CACHE_OSX_IPHONE=1 TOOLKIT_GIVEN=1])
|
||||
AC_ARG_WITH(mac, [ --with-mac same as --with-osx], [wxUSE_OSX_COCOA="$withval" CACHE_OSX_COCOA=1 TOOLKIT_GIVEN=1])
|
||||
@@ -485,7 +481,7 @@ if test "$wxUSE_GUI" = "yes"; then
|
||||
|
||||
dnl we suppose that expr is available (maybe there is a better way to do
|
||||
dnl this? what about using ALL_TOOLKITS? TODO)
|
||||
NUM_TOOLKITS=`expr ${wxUSE_GTK:-0} + ${wxUSE_OSX_CARBON:-0} \
|
||||
NUM_TOOLKITS=`expr ${wxUSE_GTK:-0} \
|
||||
+ ${wxUSE_OSX_COCOA:-0} + ${wxUSE_OSX_IPHONE:-0} + ${wxUSE_DFB:-0} \
|
||||
+ ${wxUSE_MOTIF:-0} + ${wxUSE_MSW:-0} \
|
||||
+ ${wxUSE_X11:-0} + ${wxUSE_QT:-0}`
|
||||
@@ -518,8 +514,7 @@ else
|
||||
fi
|
||||
|
||||
wxUSE_MAC=0
|
||||
if test "$wxUSE_OSX_CARBON" = 1 \
|
||||
-o "$wxUSE_OSX_COCOA" = 1 \
|
||||
if test "$wxUSE_OSX_COCOA" = 1 \
|
||||
-o "$wxUSE_OSX_IPHONE" = 1; then
|
||||
wxUSE_MAC=1
|
||||
fi
|
||||
@@ -3274,39 +3269,6 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$wxUSE_OSX_CARBON" = 1; then
|
||||
AC_MSG_CHECKING([for compiler syntax to enable Pascal strings])
|
||||
if test "$GCC" = yes; then
|
||||
AC_MSG_RESULT([gcc])
|
||||
CPPFLAGS_PASCAL="-fpascal-strings"
|
||||
elif test "`echo $CXX | sed -e 's@.*/@@'`" = "xlC"; then
|
||||
AC_MSG_RESULT([xlc])
|
||||
CPPFLAGS_PASCAL="-qmacpstr"
|
||||
else
|
||||
AC_MSG_RESULT([none])
|
||||
fi
|
||||
|
||||
if test "x$wxUSE_UNIX" = "xyes"; then
|
||||
CPPFLAGS="$CPPFLAGS_PASCAL -I/Developer/Headers/FlatCarbon $CPPFLAGS"
|
||||
else
|
||||
dnl platform.h needs TARGET_CARBON before setup.h
|
||||
CPPFLAGS="$CPPFLAGS_PASCAL -DTARGET_CARBON $CPPFLAGS"
|
||||
fi
|
||||
|
||||
TOOLKIT=OSX_CARBON
|
||||
dnl we can't call this MAC_DIST or autoconf thinks its a macro
|
||||
GUIDIST=OSX_CARBON_DIST
|
||||
dnl wxMac version of wxBase and wxCocoa or wxBase-only built on Darwin
|
||||
dnl are different, so they need different names:
|
||||
WXBASEPORT="_carbon"
|
||||
|
||||
dnl in addition to defining __WXOSX_CARBON__ for this toolkit we want
|
||||
dnl to also define these extra symbols to make it possible to test for
|
||||
dnl any Mac port (__WXMAC__ is for backwards compatibility, __WXOSX__
|
||||
dnl is a new name)
|
||||
TOOLCHAIN_DEFS="${TOOLCHAIN_DEFS} -D__WXMAC__ -D__WXOSX__"
|
||||
fi
|
||||
|
||||
if test "$wxUSE_OSX_COCOA" = 1; then
|
||||
TOOLKIT=OSX_COCOA
|
||||
GUIDIST=OSX_COCOA_DIST
|
||||
@@ -3462,7 +3424,7 @@ if test "$wxUSE_OPENGL" = "yes" -o "$wxUSE_OPENGL" = "auto"; then
|
||||
|
||||
dnl look in glcanvas.h for the list of platforms supported by wxGlCanvas:
|
||||
|
||||
if test "$wxUSE_OSX_CARBON" = 1 -o "$wxUSE_OSX_COCOA" = 1; then
|
||||
if test "$wxUSE_OSX_COCOA" = 1; then
|
||||
OPENGL_LIBS="-framework OpenGL -framework AGL"
|
||||
elif test "$wxUSE_MSW" = 1; then
|
||||
OPENGL_LIBS="-lopengl32 -lglu32"
|
||||
@@ -3709,7 +3671,7 @@ dnl library link name
|
||||
dnl These just save us from exporting lib_{unicode,flavour}_suffix.
|
||||
dnl If we ever need to do that, we won't need to keep these.
|
||||
|
||||
if test "$wxUSE_OSX_CARBON" = 1 -o "$wxUSE_OSX_COCOA" = 1; then
|
||||
if test "$wxUSE_OSX_COCOA" = 1; then
|
||||
WX_LIBRARY_BASENAME_NOGUI="wx_base${lib_unicode_suffix}${WX_LIB_FLAVOUR}"
|
||||
else
|
||||
WX_LIBRARY_BASENAME_NOGUI="wx_base${WXBASEPORT}${lib_unicode_suffix}${WX_LIB_FLAVOUR}"
|
||||
@@ -5620,12 +5582,12 @@ if test "$wxUSE_BUSYINFO" = "yes"; then
|
||||
fi
|
||||
|
||||
if test "$wxUSE_HOTKEY" = "yes"; then
|
||||
if test "$wxUSE_MSW" != 1 -a "$wxUSE_OSX_COCOA" != 1 -a "$wxUSE_OSX_CARBON" != 1; then
|
||||
if test "$wxUSE_MSW" != 1 -a "$wxUSE_OSX_COCOA" != 1; then
|
||||
AC_MSG_WARN([Hot keys not supported by the current toolkit, disabled])
|
||||
wxUSE_HOTKEY=no
|
||||
fi
|
||||
elif test "$wxUSE_HOTKEY" = "auto"; then
|
||||
if test "$wxUSE_MSW" = 1 -o "$wxUSE_OSX_COCOA" = 1 -o "$wxUSE_OSX_CARBON" = 1; then
|
||||
if test "$wxUSE_MSW" = 1 -o "$wxUSE_OSX_COCOA" = 1; then
|
||||
wxUSE_HOTKEY=yes
|
||||
fi
|
||||
fi
|
||||
@@ -7861,15 +7823,9 @@ if test "$wxUSE_MAC" = 1; then
|
||||
|
||||
dnl resources are bundled both with shared library and applications
|
||||
dnl since the carb resource *must* be included in the application
|
||||
if test "$wxUSE_OSX_CARBON" = 1; then
|
||||
POSTLINK_COMMAND="\$(REZ) -d __DARWIN__ -t APPL Carbon.r -o"
|
||||
RESCOMP="$REZ"
|
||||
WXCONFIG_RESFLAGS="-d __DARWIN__ -t APPL Carbon.r -o"
|
||||
else
|
||||
POSTLINK_COMMAND="cat /dev/null | \$(REZ) -d __DARWIN__ -t APPL ${LIBWXMACRES}"
|
||||
RESCOMP="cat /dev/null \| $REZ"
|
||||
WXCONFIG_RESFLAGS="-d __DARWIN__ -t APPL \$libdir/$WX_RESOURCES_MACOSX_ASCII"
|
||||
fi
|
||||
|
||||
else
|
||||
dnl default value is to (silently) do nothing in the makefile
|
||||
|
@@ -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.
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -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
|
||||
|
||||
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
|
||||
|
@@ -415,10 +415,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 +435,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;
|
||||
|
@@ -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
|
||||
#else
|
||||
#define wxHAS_NATIVE_ENABLED_MANAGEMENT
|
||||
#endif
|
||||
|
@@ -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>
|
@@ -1,339 +0,0 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 45;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
405B1A9910EF228C00676938 /* minimal.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 405B1A9810EF228C00676938 /* minimal.cpp */; };
|
||||
405B1AC310EF253300676938 /* minimal.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 405B1A9810EF228C00676938 /* minimal.cpp */; };
|
||||
40E3518B10EF314A0029DC34 /* libwx_osx_carbon_static.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 40E3518410EF30F90029DC34 /* libwx_osx_carbon_static.a */; };
|
||||
40E3518C10EF31550029DC34 /* libwx_osx_carbon.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 40E3518210EF30F90029DC34 /* libwx_osx_carbon.dylib */; };
|
||||
40E3519010EF320E0029DC34 /* libwx_osx_carbon.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 40E3518210EF30F90029DC34 /* libwx_osx_carbon.dylib */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
40E3518110EF30F90029DC34 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 40E3517C10EF30F90029DC34 /* wxcarbon.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = D2AAC0C705546C1D00DB518D;
|
||||
remoteInfo = dynamic;
|
||||
};
|
||||
40E3518310EF30F90029DC34 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 40E3517C10EF30F90029DC34 /* wxcarbon.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 404BEE6110EC83280080E2B8;
|
||||
remoteInfo = static;
|
||||
};
|
||||
40E3518710EF31300029DC34 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 40E3517C10EF30F90029DC34 /* wxcarbon.xcodeproj */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 363401F972C53D8EBD3D4BD9;
|
||||
remoteInfo = dynamic;
|
||||
};
|
||||
40E3518910EF313A0029DC34 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 40E3517C10EF30F90029DC34 /* wxcarbon.xcodeproj */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = BAB02EC06578349A9171CCAC;
|
||||
remoteInfo = static;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
405B1A9410EF209B00676938 /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
40E3519010EF320E0029DC34 /* libwx_osx_carbon.dylib in CopyFiles */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
405B1A9810EF228C00676938 /* minimal.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = minimal.cpp; sourceTree = "<group>"; };
|
||||
405B1ACB10EF253300676938 /* minimal_carbon.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = minimal_carbon.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
4073593F1370888D0077DE1B /* Info_carbon.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info_carbon.plist; sourceTree = "<group>"; };
|
||||
40A9683713B281D700B0D0DD /* wxdebug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = wxdebug.xcconfig; path = ../../build/osx/wxdebug.xcconfig; sourceTree = SOURCE_ROOT; };
|
||||
40A9683813B281D700B0D0DD /* wxrelease.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = wxrelease.xcconfig; path = ../../build/osx/wxrelease.xcconfig; sourceTree = SOURCE_ROOT; };
|
||||
40E3517C10EF30F90029DC34 /* wxcarbon.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = wxcarbon.xcodeproj; path = ../../build/osx/wxcarbon.xcodeproj; sourceTree = SOURCE_ROOT; };
|
||||
40E3518610EF31130029DC34 /* wxcarbon.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = wxcarbon.xcconfig; path = ../../build/osx/wxcarbon.xcconfig; sourceTree = SOURCE_ROOT; };
|
||||
8D1107320486CEB800E47090 /* minimal_carbon.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = minimal_carbon.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
405B1AC410EF253300676938 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
40E3518B10EF314A0029DC34 /* libwx_osx_carbon_static.a in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
8D11072E0486CEB800E47090 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
40E3518C10EF31550029DC34 /* libwx_osx_carbon.dylib in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
19C28FACFE9D520D11CA2CBB /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8D1107320486CEB800E47090 /* minimal_carbon.app */,
|
||||
405B1ACB10EF253300676938 /* minimal_carbon.app */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
29B97314FDCFA39411CA2CEA /* minimal_cocoa */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4073593F1370888D0077DE1B /* Info_carbon.plist */,
|
||||
40E3518610EF31130029DC34 /* wxcarbon.xcconfig */,
|
||||
40A9683713B281D700B0D0DD /* wxdebug.xcconfig */,
|
||||
40A9683813B281D700B0D0DD /* wxrelease.xcconfig */,
|
||||
40E3517C10EF30F90029DC34 /* wxcarbon.xcodeproj */,
|
||||
405B1A9710EF227D00676938 /* src */,
|
||||
19C28FACFE9D520D11CA2CBB /* Products */,
|
||||
);
|
||||
name = minimal_cocoa;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
405B1A9710EF227D00676938 /* src */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
405B1A9810EF228C00676938 /* minimal.cpp */,
|
||||
);
|
||||
name = src;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
40E3517D10EF30F90029DC34 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
40E3518210EF30F90029DC34 /* libwx_osx_carbon.dylib */,
|
||||
40E3518410EF30F90029DC34 /* libwx_osx_carbon_static.a */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
405B1ABF10EF253300676938 /* static */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 405B1AC810EF253300676938 /* Build configuration list for PBXNativeTarget "static" */;
|
||||
buildPhases = (
|
||||
405B1AC210EF253300676938 /* Sources */,
|
||||
405B1AC410EF253300676938 /* Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
40E3518A10EF313A0029DC34 /* PBXTargetDependency */,
|
||||
);
|
||||
name = static;
|
||||
productInstallPath = "$(HOME)/Applications";
|
||||
productName = minimal_cocoa;
|
||||
productReference = 405B1ACB10EF253300676938 /* minimal_carbon.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
8D1107260486CEB800E47090 /* dynamic */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "dynamic" */;
|
||||
buildPhases = (
|
||||
8D11072C0486CEB800E47090 /* Sources */,
|
||||
8D11072E0486CEB800E47090 /* Frameworks */,
|
||||
405B1A9410EF209B00676938 /* CopyFiles */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
40E3518810EF31300029DC34 /* PBXTargetDependency */,
|
||||
);
|
||||
name = dynamic;
|
||||
productInstallPath = "$(HOME)/Applications";
|
||||
productName = minimal_cocoa;
|
||||
productReference = 8D1107320486CEB800E47090 /* minimal_carbon.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
29B97313FDCFA39411CA2CEA /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "minimal_carbon" */;
|
||||
compatibilityVersion = "Xcode 3.1";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 1;
|
||||
knownRegions = (
|
||||
English,
|
||||
Japanese,
|
||||
French,
|
||||
German,
|
||||
);
|
||||
mainGroup = 29B97314FDCFA39411CA2CEA /* minimal_cocoa */;
|
||||
projectDirPath = "";
|
||||
projectReferences = (
|
||||
{
|
||||
ProductGroup = 40E3517D10EF30F90029DC34 /* Products */;
|
||||
ProjectRef = 40E3517C10EF30F90029DC34 /* wxcarbon.xcodeproj */;
|
||||
},
|
||||
);
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
8D1107260486CEB800E47090 /* dynamic */,
|
||||
405B1ABF10EF253300676938 /* static */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXReferenceProxy section */
|
||||
40E3518210EF30F90029DC34 /* libwx_osx_carbon.dylib */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = "compiled.mach-o.dylib";
|
||||
path = libwx_osx_carbon.dylib;
|
||||
remoteRef = 40E3518110EF30F90029DC34 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
40E3518410EF30F90029DC34 /* libwx_osx_carbon_static.a */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = archive.ar;
|
||||
path = libwx_osx_carbon_static.a;
|
||||
remoteRef = 40E3518310EF30F90029DC34 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
/* End PBXReferenceProxy section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
405B1AC210EF253300676938 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
405B1AC310EF253300676938 /* minimal.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
8D11072C0486CEB800E47090 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
405B1A9910EF228C00676938 /* minimal.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
40E3518810EF31300029DC34 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
name = dynamic;
|
||||
targetProxy = 40E3518710EF31300029DC34 /* PBXContainerItemProxy */;
|
||||
};
|
||||
40E3518A10EF313A0029DC34 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
name = static;
|
||||
targetProxy = 40E3518910EF313A0029DC34 /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
405B1AC910EF253300676938 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 40E3518610EF31130029DC34 /* wxcarbon.xcconfig */;
|
||||
buildSettings = {
|
||||
OTHER_LDFLAGS = "$(OTHER_LDFLAGS)";
|
||||
PRODUCT_NAME = minimal_carbon;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
405B1ACA10EF253300676938 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 40E3518610EF31130029DC34 /* wxcarbon.xcconfig */;
|
||||
buildSettings = {
|
||||
OTHER_LDFLAGS = "$(OTHER_LDFLAGS)";
|
||||
PRODUCT_NAME = minimal_carbon;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
C01FCF4B08A954540054247B /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 40E3518610EF31130029DC34 /* wxcarbon.xcconfig */;
|
||||
buildSettings = {
|
||||
PRODUCT_NAME = minimal_carbon;
|
||||
WXROOT = "$(PROJECT_DIR)/../..";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
C01FCF4C08A954540054247B /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 40E3518610EF31130029DC34 /* wxcarbon.xcconfig */;
|
||||
buildSettings = {
|
||||
PRODUCT_NAME = minimal_carbon;
|
||||
WXROOT = "$(PROJECT_DIR)/../..";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
C01FCF4F08A954540054247B /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 40A9683713B281D700B0D0DD /* wxdebug.xcconfig */;
|
||||
buildSettings = {
|
||||
INFOPLIST_FILE = Info_carbon.plist;
|
||||
WXROOT = "$(PROJECT_DIR)/../..";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
C01FCF5008A954540054247B /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
INFOPLIST_FILE = Info_carbon.plist;
|
||||
WXROOT = "$(PROJECT_DIR)/../..";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
405B1AC810EF253300676938 /* Build configuration list for PBXNativeTarget "static" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
405B1AC910EF253300676938 /* Debug */,
|
||||
405B1ACA10EF253300676938 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "dynamic" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
C01FCF4B08A954540054247B /* Debug */,
|
||||
C01FCF4C08A954540054247B /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
C01FCF4E08A954540054247B /* Build configuration list for PBXProject "minimal_carbon" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
C01FCF4F08A954540054247B /* Debug */,
|
||||
C01FCF5008A954540054247B /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
|
||||
}
|
@@ -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;
|
||||
|
@@ -37,245 +37,8 @@ extern WXDLLEXPORT_DATA(const char) wxWebKitCtrlNameStr[] = "webkitctrl";
|
||||
wxIMPLEMENT_DYNAMIC_CLASS(wxWebKitCtrl, wxControl);
|
||||
|
||||
wxBEGIN_EVENT_TABLE(wxWebKitCtrl, wxControl)
|
||||
#if defined(__WXMAC__) && wxOSX_USE_CARBON
|
||||
EVT_SIZE(wxWebKitCtrl::OnSize)
|
||||
#endif
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
#if defined(__WXOSX__) && wxOSX_USE_CARBON
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Carbon Events handlers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// prototype for function in src/osx/carbon/nonownedwnd.cpp
|
||||
void SetupMouseEvent( wxMouseEvent &wxevent , wxMacCarbonEvent &cEvent );
|
||||
|
||||
static const EventTypeSpec eventList[] =
|
||||
{
|
||||
//{ kEventClassControl, kEventControlTrack } ,
|
||||
{ kEventClassMouse, kEventMouseUp },
|
||||
{ kEventClassMouse, kEventMouseDown },
|
||||
{ kEventClassMouse, kEventMouseMoved },
|
||||
{ kEventClassMouse, kEventMouseDragged },
|
||||
|
||||
{ kEventClassKeyboard, kEventRawKeyDown } ,
|
||||
{ kEventClassKeyboard, kEventRawKeyRepeat } ,
|
||||
{ kEventClassKeyboard, kEventRawKeyUp } ,
|
||||
{ kEventClassKeyboard, kEventRawKeyModifiersChanged } ,
|
||||
|
||||
{ kEventClassTextInput, kEventTextInputUnicodeForKeyEvent } ,
|
||||
{ kEventClassTextInput, kEventTextInputUpdateActiveInputArea } ,
|
||||
|
||||
#if DEBUG_WEBKIT_SIZING == 1
|
||||
{ kEventClassControl, kEventControlBoundsChanged } ,
|
||||
#endif
|
||||
};
|
||||
|
||||
// mix this in from window.cpp
|
||||
pascal OSStatus wxMacUnicodeTextEventHandler( EventHandlerCallRef handler , EventRef event , void *data ) ;
|
||||
|
||||
// NOTE: This is mostly taken from KeyboardEventHandler in toplevel.cpp, but
|
||||
// that expects the data pointer is a top-level window, so I needed to change
|
||||
// that in this case. However, once 2.8 is out, we should factor out the common logic
|
||||
// among the two functions and merge them.
|
||||
static pascal OSStatus wxWebKitKeyEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
|
||||
{
|
||||
OSStatus result = eventNotHandledErr ;
|
||||
wxMacCarbonEvent cEvent( event ) ;
|
||||
|
||||
wxWebKitCtrl* thisWindow = (wxWebKitCtrl*) data ;
|
||||
wxWindow* focus = thisWindow ;
|
||||
|
||||
unsigned char charCode ;
|
||||
wxChar uniChar[2] ;
|
||||
uniChar[0] = 0;
|
||||
uniChar[1] = 0;
|
||||
|
||||
UInt32 keyCode ;
|
||||
UInt32 modifiers ;
|
||||
UInt32 when = EventTimeToTicks( GetEventTime( event ) ) ;
|
||||
|
||||
#if wxUSE_UNICODE
|
||||
ByteCount dataSize = 0 ;
|
||||
if ( GetEventParameter( event, kEventParamKeyUnicodes, typeUnicodeText, NULL, 0 , &dataSize, NULL ) == noErr )
|
||||
{
|
||||
UniChar buf[2] ;
|
||||
int numChars = dataSize / sizeof( UniChar) + 1;
|
||||
|
||||
UniChar* charBuf = buf ;
|
||||
|
||||
if ( numChars * 2 > 4 )
|
||||
charBuf = new UniChar[ numChars ] ;
|
||||
GetEventParameter( event, kEventParamKeyUnicodes, typeUnicodeText, NULL, dataSize , NULL , charBuf ) ;
|
||||
charBuf[ numChars - 1 ] = 0;
|
||||
|
||||
#if SIZEOF_WCHAR_T == 2
|
||||
uniChar = charBuf[0] ;
|
||||
#else
|
||||
wxMBConvUTF16 converter ;
|
||||
converter.MB2WC( uniChar , (const char*)charBuf , 2 ) ;
|
||||
#endif
|
||||
|
||||
if ( numChars * 2 > 4 )
|
||||
delete[] charBuf ;
|
||||
}
|
||||
#endif
|
||||
|
||||
GetEventParameter( event, kEventParamKeyMacCharCodes, typeChar, NULL, 1, NULL, &charCode );
|
||||
GetEventParameter( event, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode );
|
||||
GetEventParameter( event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers );
|
||||
|
||||
UInt32 message = (keyCode << 8) + charCode;
|
||||
switch ( GetEventKind( event ) )
|
||||
{
|
||||
case kEventRawKeyRepeat :
|
||||
case kEventRawKeyDown :
|
||||
{
|
||||
WXEVENTREF formerEvent = wxTheApp->MacGetCurrentEvent() ;
|
||||
WXEVENTHANDLERCALLREF formerHandler = wxTheApp->MacGetCurrentEventHandlerCallRef() ;
|
||||
wxTheApp->MacSetCurrentEvent( event , handler ) ;
|
||||
if ( /* focus && */ wxTheApp->MacSendKeyDownEvent(
|
||||
focus , message , modifiers , when , uniChar[0] ) )
|
||||
{
|
||||
result = noErr ;
|
||||
}
|
||||
wxTheApp->MacSetCurrentEvent( formerEvent , formerHandler ) ;
|
||||
}
|
||||
break ;
|
||||
|
||||
case kEventRawKeyUp :
|
||||
if ( /* focus && */ wxTheApp->MacSendKeyUpEvent(
|
||||
focus , message , modifiers , when , uniChar[0] ) )
|
||||
{
|
||||
result = noErr ;
|
||||
}
|
||||
break ;
|
||||
|
||||
case kEventRawKeyModifiersChanged :
|
||||
{
|
||||
wxKeyEvent event(wxEVT_KEY_DOWN);
|
||||
|
||||
event.m_shiftDown = modifiers & shiftKey;
|
||||
event.m_rawControlDown = modifiers & controlKey;
|
||||
event.m_altDown = modifiers & optionKey;
|
||||
event.m_controlDown = modifiers & cmdKey;
|
||||
|
||||
#if wxUSE_UNICODE
|
||||
event.m_uniChar = uniChar[0] ;
|
||||
#endif
|
||||
|
||||
event.SetTimestamp(when);
|
||||
event.SetEventObject(focus);
|
||||
|
||||
if ( /* focus && */ (modifiers ^ wxApp::s_lastModifiers ) & controlKey )
|
||||
{
|
||||
event.m_keyCode = WXK_RAW_CONTROL ;
|
||||
event.SetEventType( ( modifiers & controlKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ;
|
||||
focus->GetEventHandler()->ProcessEvent( event ) ;
|
||||
}
|
||||
if ( /* focus && */ (modifiers ^ wxApp::s_lastModifiers ) & shiftKey )
|
||||
{
|
||||
event.m_keyCode = WXK_SHIFT ;
|
||||
event.SetEventType( ( modifiers & shiftKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ;
|
||||
focus->GetEventHandler()->ProcessEvent( event ) ;
|
||||
}
|
||||
if ( /* focus && */ (modifiers ^ wxApp::s_lastModifiers ) & optionKey )
|
||||
{
|
||||
event.m_keyCode = WXK_ALT ;
|
||||
event.SetEventType( ( modifiers & optionKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ;
|
||||
focus->GetEventHandler()->ProcessEvent( event ) ;
|
||||
}
|
||||
if ( /* focus && */ (modifiers ^ wxApp::s_lastModifiers ) & cmdKey )
|
||||
{
|
||||
event.m_keyCode = WXK_CONTROL ;
|
||||
event.SetEventType( ( modifiers & cmdKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ;
|
||||
focus->GetEventHandler()->ProcessEvent( event ) ;
|
||||
}
|
||||
|
||||
wxApp::s_lastModifiers = modifiers ;
|
||||
}
|
||||
break ;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return result ;
|
||||
}
|
||||
|
||||
static pascal OSStatus wxWebKitCtrlEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
|
||||
{
|
||||
OSStatus result = eventNotHandledErr ;
|
||||
|
||||
wxMacCarbonEvent cEvent( event ) ;
|
||||
|
||||
ControlRef controlRef ;
|
||||
wxWebKitCtrl* thisWindow = (wxWebKitCtrl*) data ;
|
||||
wxNonOwnedWindow* tlw = NULL;
|
||||
if (thisWindow)
|
||||
tlw = thisWindow->MacGetTopLevelWindow();
|
||||
|
||||
cEvent.GetParameter( kEventParamDirectObject , &controlRef ) ;
|
||||
|
||||
wxWindow* currentMouseWindow = thisWindow ;
|
||||
|
||||
if ( wxApp::s_captureWindow )
|
||||
currentMouseWindow = wxApp::s_captureWindow;
|
||||
|
||||
switch ( GetEventClass( event ) )
|
||||
{
|
||||
case kEventClassKeyboard:
|
||||
{
|
||||
result = wxWebKitKeyEventHandler(handler, event, data);
|
||||
break;
|
||||
}
|
||||
|
||||
case kEventClassTextInput:
|
||||
{
|
||||
result = wxMacUnicodeTextEventHandler(handler, event, data);
|
||||
break;
|
||||
}
|
||||
|
||||
case kEventClassMouse:
|
||||
{
|
||||
switch ( GetEventKind( event ) )
|
||||
{
|
||||
case kEventMouseDragged :
|
||||
case kEventMouseMoved :
|
||||
case kEventMouseDown :
|
||||
case kEventMouseUp :
|
||||
{
|
||||
wxMouseEvent wxevent(wxEVT_LEFT_DOWN);
|
||||
SetupMouseEvent( wxevent , cEvent ) ;
|
||||
|
||||
currentMouseWindow->ScreenToClient( &wxevent.m_x , &wxevent.m_y ) ;
|
||||
wxevent.SetEventObject( currentMouseWindow ) ;
|
||||
wxevent.SetId( currentMouseWindow->GetId() ) ;
|
||||
|
||||
if ( currentMouseWindow->GetEventHandler()->ProcessEvent(wxevent) )
|
||||
{
|
||||
result = noErr;
|
||||
}
|
||||
|
||||
break; // this should enable WebKit to fire mouse dragged and mouse up events...
|
||||
}
|
||||
default :
|
||||
break ;
|
||||
}
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
result = CallNextEventHandler(handler, event);
|
||||
return result ;
|
||||
}
|
||||
|
||||
DEFINE_ONE_SHOT_HANDLER_GETTER( wxWebKitCtrlEventHandler )
|
||||
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxWebKit Events
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -428,29 +191,11 @@ bool wxWebKitCtrl::Create(wxWindow *parent,
|
||||
// now create and attach WebKit view...
|
||||
DontCreatePeer();
|
||||
wxControl::Create(parent, winID, pos, size, style , validator , name);
|
||||
#if wxOSX_USE_CARBON
|
||||
wxMacControl* peer = new wxMacControl(this);
|
||||
WebInitForCarbon();
|
||||
HIWebViewCreate( peer->GetControlRefAddr() );
|
||||
|
||||
m_webView = (WebView*) HIWebViewGetWebView( peer->GetControlRef() );
|
||||
|
||||
HIViewChangeFeatures( peer->GetControlRef() , kHIViewIsOpaque , 0 ) ;
|
||||
InstallControlEventHandler( peer->GetControlRef() , GetwxWebKitCtrlEventHandlerUPP(),
|
||||
GetEventTypeCount(eventList), eventList, this,
|
||||
(EventHandlerRef *)&m_webKitCtrlEventHandler);
|
||||
|
||||
SetPeer(peer);
|
||||
#else
|
||||
NSRect r = wxOSXGetFrameForControl( this, pos , size ) ;
|
||||
m_webView = [[WebView alloc] initWithFrame:r frameName:@"webkitFrame" groupName:@"webkitGroup"];
|
||||
|
||||
SetPeer(new wxWidgetCocoaImpl( this, m_webView ));
|
||||
#endif
|
||||
MacPostControlCreate(pos, size);
|
||||
#if wxOSX_USE_CARBON
|
||||
HIViewSetVisible( GetPeer()->GetControlRef(), true );
|
||||
#endif
|
||||
[m_webView setHidden:false];
|
||||
|
||||
|
||||
@@ -690,85 +435,10 @@ wxString wxWebKitCtrl::RunScript(const wxString& javascript){
|
||||
}
|
||||
|
||||
void wxWebKitCtrl::OnSize(wxSizeEvent &event){
|
||||
#if defined(__WXMAC__) && wxOSX_USE_CARBON
|
||||
// This is a nasty hack because WebKit seems to lose its position when it is embedded
|
||||
// in a control that is not itself the content view for a TLW.
|
||||
// I put it in OnSize because these calcs are not perfect, and in fact are basically
|
||||
// guesses based on reverse engineering, so it's best to give people the option of
|
||||
// overriding OnSize with their own calcs if need be.
|
||||
// I also left some test debugging print statements as a convenience if a(nother)
|
||||
// problem crops up.
|
||||
|
||||
wxWindow* tlw = MacGetTopLevelWindow();
|
||||
|
||||
NSRect frame = [(WebView*)m_webView frame];
|
||||
NSRect bounds = [(WebView*)m_webView bounds];
|
||||
|
||||
#if DEBUG_WEBKIT_SIZING
|
||||
fprintf(stderr,"Carbon window x=%d, y=%d, width=%d, height=%d\n", GetPosition().x, GetPosition().y, GetSize().x, GetSize().y);
|
||||
fprintf(stderr, "Cocoa window frame x=%G, y=%G, width=%G, height=%G\n", frame.origin.x, frame.origin.y, frame.size.width, frame.size.height);
|
||||
fprintf(stderr, "Cocoa window bounds x=%G, y=%G, width=%G, height=%G\n", bounds.origin.x, bounds.origin.y, bounds.size.width, bounds.size.height);
|
||||
#endif
|
||||
|
||||
// This must be the case that Apple tested with, because well, in this one case
|
||||
// we don't need to do anything! It just works. ;)
|
||||
if (GetParent() == tlw){
|
||||
return;
|
||||
}
|
||||
|
||||
// since we no longer use parent coordinates, we always want 0,0.
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
|
||||
HIRect rect;
|
||||
rect.origin.x = x;
|
||||
rect.origin.y = y;
|
||||
|
||||
#if DEBUG_WEBKIT_SIZING
|
||||
printf("Before conversion, origin is: x = %d, y = %d\n", x, y);
|
||||
#endif
|
||||
|
||||
// NB: In most cases, when calling HIViewConvertRect, what people want is to use GetRootControl(),
|
||||
// and this tripped me up at first. But in fact, what we want is the root view, because we need to
|
||||
// make the y origin relative to the very top of the window, not its contents, since we later flip
|
||||
// the y coordinate for Cocoa.
|
||||
HIViewConvertRect (&rect, GetPeer()->GetControlRef(),
|
||||
HIViewGetRoot( (WindowRef) MacGetTopLevelWindowRef() ) );
|
||||
|
||||
x = (int)rect.origin.x;
|
||||
y = (int)rect.origin.y;
|
||||
|
||||
#if DEBUG_WEBKIT_SIZING
|
||||
printf("Moving Cocoa frame origin to: x = %d, y = %d\n", x, y);
|
||||
#endif
|
||||
|
||||
if (tlw){
|
||||
//flip the y coordinate to convert to Cocoa coordinates
|
||||
y = tlw->GetSize().y - ((GetSize().y) + y);
|
||||
}
|
||||
|
||||
#if DEBUG_WEBKIT_SIZING
|
||||
printf("y = %d after flipping value\n", y);
|
||||
#endif
|
||||
|
||||
frame.origin.x = x;
|
||||
frame.origin.y = y;
|
||||
[(WebView*)m_webView setFrame:frame];
|
||||
|
||||
if (IsShown())
|
||||
[(WebView*)m_webView display];
|
||||
#endif
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void wxWebKitCtrl::MacVisibilityChanged(){
|
||||
#if defined(__WXMAC__) && wxOSX_USE_CARBON
|
||||
bool isHidden = !IsControlVisible( GetPeer()->GetControlRef());
|
||||
if (!isHidden)
|
||||
[(WebView*)m_webView display];
|
||||
|
||||
[m_webView setHidden:isHidden];
|
||||
#endif
|
||||
}
|
||||
|
||||
//------------------------------------------------------------
|
||||
|
@@ -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);
|
||||
}
|
@@ -44,11 +44,7 @@
|
||||
#include <string.h>
|
||||
|
||||
// mac
|
||||
#if wxOSX_USE_CARBON
|
||||
#include "wx/osx/uma.h"
|
||||
#else
|
||||
#include "wx/osx/private.h"
|
||||
#endif
|
||||
|
||||
#if defined(WXMAKINGDLL_CORE)
|
||||
# include <mach-o/dyld.h>
|
||||
@@ -75,214 +71,6 @@ wxString wxApp::s_macHelpMenuTitleName = wxT("&Help") ;
|
||||
|
||||
bool wxApp::sm_isEmbedded = false; // Normally we're not a plugin
|
||||
|
||||
#if wxOSX_USE_CARBON
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Core Apple Event Support
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
AEEventHandlerUPP sODocHandler = NULL ;
|
||||
AEEventHandlerUPP sGURLHandler = NULL ;
|
||||
AEEventHandlerUPP sOAppHandler = NULL ;
|
||||
AEEventHandlerUPP sPDocHandler = NULL ;
|
||||
AEEventHandlerUPP sRAppHandler = NULL ;
|
||||
AEEventHandlerUPP sQuitHandler = NULL ;
|
||||
|
||||
pascal OSErr AEHandleODoc( const AppleEvent *event , AppleEvent *reply , SRefCon refcon ) ;
|
||||
pascal OSErr AEHandleOApp( const AppleEvent *event , AppleEvent *reply , SRefCon refcon ) ;
|
||||
pascal OSErr AEHandlePDoc( const AppleEvent *event , AppleEvent *reply , SRefCon refcon ) ;
|
||||
pascal OSErr AEHandleQuit( const AppleEvent *event , AppleEvent *reply , SRefCon refcon ) ;
|
||||
pascal OSErr AEHandleRApp( const AppleEvent *event , AppleEvent *reply , SRefCon refcon ) ;
|
||||
pascal OSErr AEHandleGURL( const AppleEvent *event , AppleEvent *reply , SRefCon refcon ) ;
|
||||
|
||||
pascal OSErr AEHandleODoc( const AppleEvent *event , AppleEvent *reply , SRefCon WXUNUSED(refcon) )
|
||||
{
|
||||
return wxTheApp->MacHandleAEODoc( (AppleEvent*) event , reply) ;
|
||||
}
|
||||
|
||||
pascal OSErr AEHandleOApp( const AppleEvent *event , AppleEvent *reply , SRefCon WXUNUSED(refcon) )
|
||||
{
|
||||
return wxTheApp->MacHandleAEOApp( (AppleEvent*) event , reply ) ;
|
||||
}
|
||||
|
||||
pascal OSErr AEHandlePDoc( const AppleEvent *event , AppleEvent *reply , SRefCon WXUNUSED(refcon) )
|
||||
{
|
||||
return wxTheApp->MacHandleAEPDoc( (AppleEvent*) event , reply ) ;
|
||||
}
|
||||
|
||||
pascal OSErr AEHandleQuit( const AppleEvent *event , AppleEvent *reply , SRefCon WXUNUSED(refcon) )
|
||||
{
|
||||
return wxTheApp->MacHandleAEQuit( (AppleEvent*) event , reply) ;
|
||||
}
|
||||
|
||||
pascal OSErr AEHandleRApp( const AppleEvent *event , AppleEvent *reply , SRefCon WXUNUSED(refcon) )
|
||||
{
|
||||
return wxTheApp->MacHandleAERApp( (AppleEvent*) event , reply) ;
|
||||
}
|
||||
|
||||
pascal OSErr AEHandleGURL( const AppleEvent *event , AppleEvent *reply , SRefCon WXUNUSED(refcon) )
|
||||
{
|
||||
return wxTheApp->MacHandleAEGURL((WXEVENTREF *)event , reply) ;
|
||||
}
|
||||
|
||||
|
||||
// AEODoc Calls MacOpenFiles with all of the files passed
|
||||
|
||||
short wxApp::MacHandleAEODoc(const WXEVENTREF event, WXEVENTREF WXUNUSED(reply))
|
||||
{
|
||||
AEDescList docList;
|
||||
AEKeyword keywd;
|
||||
DescType returnedType;
|
||||
Size actualSize;
|
||||
long itemsInList;
|
||||
OSErr err;
|
||||
short i;
|
||||
|
||||
err = AEGetParamDesc((AppleEvent *)event, keyDirectObject, typeAEList,&docList);
|
||||
if (err != noErr)
|
||||
return err;
|
||||
|
||||
err = AECountItems(&docList, &itemsInList);
|
||||
if (err != noErr)
|
||||
return err;
|
||||
|
||||
ProcessSerialNumber PSN ;
|
||||
PSN.highLongOfPSN = 0 ;
|
||||
PSN.lowLongOfPSN = kCurrentProcess ;
|
||||
SetFrontProcess( &PSN ) ;
|
||||
|
||||
wxString fName ;
|
||||
FSRef theRef ;
|
||||
|
||||
wxArrayString fileNames;
|
||||
for (i = 1; i <= itemsInList; i++)
|
||||
{
|
||||
err = AEGetNthPtr(
|
||||
&docList, i, typeFSRef, &keywd, &returnedType,
|
||||
(Ptr)&theRef, sizeof(theRef), &actualSize);
|
||||
|
||||
if ( err != noErr)
|
||||
return err;
|
||||
|
||||
fName = wxMacFSRefToPath( &theRef ) ;
|
||||
|
||||
fileNames.Add(fName);
|
||||
}
|
||||
|
||||
MacOpenFiles(fileNames);
|
||||
|
||||
return noErr;
|
||||
}
|
||||
|
||||
// AEODoc Calls MacOpenURL on the url passed
|
||||
|
||||
short wxApp::MacHandleAEGURL(const WXEVENTREF event, WXEVENTREF WXUNUSED(reply))
|
||||
{
|
||||
DescType returnedType;
|
||||
Size actualSize;
|
||||
char url[255];
|
||||
OSErr err = AEGetParamPtr((AppleEvent *)event, keyDirectObject, typeChar,
|
||||
&returnedType, url, sizeof(url)-1,
|
||||
&actualSize);
|
||||
if (err != noErr)
|
||||
return err;
|
||||
|
||||
url[actualSize] = '\0'; // Terminate the C string
|
||||
|
||||
ProcessSerialNumber PSN ;
|
||||
PSN.highLongOfPSN = 0 ;
|
||||
PSN.lowLongOfPSN = kCurrentProcess ;
|
||||
SetFrontProcess( &PSN ) ;
|
||||
|
||||
MacOpenURL(wxString(url, wxConvUTF8));
|
||||
|
||||
return noErr;
|
||||
}
|
||||
|
||||
// AEPDoc Calls MacPrintFile on each of the files passed
|
||||
|
||||
short wxApp::MacHandleAEPDoc(const WXEVENTREF event , WXEVENTREF WXUNUSED(reply))
|
||||
{
|
||||
AEDescList docList;
|
||||
AEKeyword keywd;
|
||||
DescType returnedType;
|
||||
Size actualSize;
|
||||
long itemsInList;
|
||||
OSErr err;
|
||||
short i;
|
||||
|
||||
err = AEGetParamDesc((AppleEvent *)event, keyDirectObject, typeAEList,&docList);
|
||||
if (err != noErr)
|
||||
return err;
|
||||
|
||||
err = AECountItems(&docList, &itemsInList);
|
||||
if (err != noErr)
|
||||
return err;
|
||||
|
||||
ProcessSerialNumber PSN ;
|
||||
PSN.highLongOfPSN = 0 ;
|
||||
PSN.lowLongOfPSN = kCurrentProcess ;
|
||||
SetFrontProcess( &PSN ) ;
|
||||
|
||||
wxString fName ;
|
||||
FSRef theRef ;
|
||||
|
||||
wxArrayString fileNames;
|
||||
|
||||
for (i = 1; i <= itemsInList; i++)
|
||||
{
|
||||
err = AEGetNthPtr(
|
||||
&docList, i, typeFSRef, &keywd, &returnedType,
|
||||
(Ptr)&theRef, sizeof(theRef), &actualSize);
|
||||
|
||||
if ( err != noErr)
|
||||
return err;
|
||||
|
||||
fName = wxMacFSRefToPath( &theRef ) ;
|
||||
fileNames.Add( fName );
|
||||
}
|
||||
|
||||
MacPrintFiles(fileNames);
|
||||
|
||||
return noErr;
|
||||
}
|
||||
|
||||
// AEOApp calls MacNewFile
|
||||
|
||||
short wxApp::MacHandleAEOApp(const WXEVENTREF WXUNUSED(event) , WXEVENTREF WXUNUSED(reply))
|
||||
{
|
||||
MacNewFile() ;
|
||||
return noErr ;
|
||||
}
|
||||
|
||||
// AEQuit attempts to quit the application
|
||||
|
||||
short wxApp::MacHandleAEQuit(const WXEVENTREF WXUNUSED(event) , WXEVENTREF WXUNUSED(reply))
|
||||
{
|
||||
wxCloseEvent event(wxEVT_QUERY_END_SESSION, wxID_ANY);
|
||||
event.SetEventObject(this);
|
||||
event.SetCanVeto(true);
|
||||
ProcessEvent(event);
|
||||
if ( !event.GetVeto() )
|
||||
{
|
||||
wxCloseEvent event(wxEVT_END_SESSION, wxID_ANY);
|
||||
event.SetEventObject(this);
|
||||
event.SetCanVeto(false);
|
||||
ProcessEvent(event);
|
||||
}
|
||||
return noErr ;
|
||||
}
|
||||
|
||||
// AEROApp calls MacReopenApp
|
||||
|
||||
short wxApp::MacHandleAERApp(const WXEVENTREF WXUNUSED(event) , WXEVENTREF WXUNUSED(reply))
|
||||
{
|
||||
MacReopenApp() ;
|
||||
|
||||
return noErr ;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Support Routines linking the Mac...File Calls to the Document Manager
|
||||
@@ -445,347 +233,6 @@ bool wxApp::OSXOnShouldTerminate()
|
||||
}
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Macintosh CommandID support - converting between native and wx IDs
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
// if no native match they just return the passed-in id
|
||||
|
||||
#if wxOSX_USE_CARBON
|
||||
|
||||
// platform specific static variables
|
||||
static const short kwxMacAppleMenuId = 1 ;
|
||||
|
||||
struct IdPair
|
||||
{
|
||||
UInt32 macId ;
|
||||
int wxId ;
|
||||
} ;
|
||||
|
||||
IdPair gCommandIds [] =
|
||||
{
|
||||
{ kHICommandCut , wxID_CUT } ,
|
||||
{ kHICommandCopy , wxID_COPY } ,
|
||||
{ kHICommandPaste , wxID_PASTE } ,
|
||||
{ kHICommandSelectAll , wxID_SELECTALL } ,
|
||||
{ kHICommandClear , wxID_CLEAR } ,
|
||||
{ kHICommandUndo , wxID_UNDO } ,
|
||||
{ kHICommandRedo , wxID_REDO } ,
|
||||
} ;
|
||||
|
||||
int wxMacCommandToId( UInt32 macCommandId )
|
||||
{
|
||||
int wxid = 0 ;
|
||||
|
||||
switch ( macCommandId )
|
||||
{
|
||||
case kHICommandPreferences :
|
||||
wxid = wxApp::s_macPreferencesMenuItemId ;
|
||||
break ;
|
||||
|
||||
case kHICommandQuit :
|
||||
wxid = wxApp::s_macExitMenuItemId ;
|
||||
break ;
|
||||
|
||||
case kHICommandAbout :
|
||||
wxid = wxApp::s_macAboutMenuItemId ;
|
||||
break ;
|
||||
|
||||
default :
|
||||
{
|
||||
for ( size_t i = 0 ; i < WXSIZEOF(gCommandIds) ; ++i )
|
||||
{
|
||||
if ( gCommandIds[i].macId == macCommandId )
|
||||
{
|
||||
wxid = gCommandIds[i].wxId ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
break ;
|
||||
}
|
||||
|
||||
if ( wxid == 0 )
|
||||
wxid = (int) macCommandId ;
|
||||
|
||||
return wxid ;
|
||||
}
|
||||
|
||||
UInt32 wxIdToMacCommand( int wxId )
|
||||
{
|
||||
UInt32 macId = 0 ;
|
||||
|
||||
if ( wxId == wxApp::s_macPreferencesMenuItemId )
|
||||
macId = kHICommandPreferences ;
|
||||
else if (wxId == wxApp::s_macExitMenuItemId)
|
||||
macId = kHICommandQuit ;
|
||||
else if (wxId == wxApp::s_macAboutMenuItemId)
|
||||
macId = kHICommandAbout ;
|
||||
else
|
||||
{
|
||||
for ( size_t i = 0 ; i < WXSIZEOF(gCommandIds) ; ++i )
|
||||
{
|
||||
if ( gCommandIds[i].wxId == wxId )
|
||||
{
|
||||
macId = gCommandIds[i].macId ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( macId == 0 )
|
||||
macId = (int) wxId ;
|
||||
|
||||
return macId ;
|
||||
}
|
||||
|
||||
wxMenu* wxFindMenuFromMacCommand( const HICommand &command , wxMenuItem* &item )
|
||||
{
|
||||
wxMenu* itemMenu = NULL ;
|
||||
#ifndef __WXUNIVERSAL__
|
||||
int id = 0 ;
|
||||
|
||||
// for 'standard' commands which don't have a wx-menu
|
||||
if ( command.commandID == kHICommandPreferences || command.commandID == kHICommandQuit || command.commandID == kHICommandAbout )
|
||||
{
|
||||
id = wxMacCommandToId( command.commandID ) ;
|
||||
|
||||
wxMenuBar* mbar = wxMenuBar::MacGetInstalledMenuBar() ;
|
||||
if ( mbar )
|
||||
item = mbar->FindItem( id , &itemMenu ) ;
|
||||
}
|
||||
else if ( command.commandID != 0 && command.menu.menuRef != 0 && command.menu.menuItemIndex != 0 )
|
||||
{
|
||||
id = wxMacCommandToId( command.commandID ) ;
|
||||
// make sure it is one of our own menus, or of the 'synthetic' apple and help menus , otherwise don't touch
|
||||
MenuItemIndex firstUserHelpMenuItem ;
|
||||
static MenuHandle helpMenuHandle = NULL ;
|
||||
if ( helpMenuHandle == NULL )
|
||||
{
|
||||
if ( UMAGetHelpMenuDontCreate( &helpMenuHandle , &firstUserHelpMenuItem) != noErr )
|
||||
helpMenuHandle = NULL ;
|
||||
}
|
||||
|
||||
// is it part of the application or the Help menu, then look for the id directly
|
||||
if ( ( GetMenuHandle( kwxMacAppleMenuId ) != NULL && command.menu.menuRef == GetMenuHandle( kwxMacAppleMenuId ) ) ||
|
||||
( helpMenuHandle != NULL && command.menu.menuRef == helpMenuHandle ) ||
|
||||
wxMenuBar::MacGetWindowMenuHMenu() != NULL && command.menu.menuRef == wxMenuBar::MacGetWindowMenuHMenu() )
|
||||
{
|
||||
wxMenuBar* mbar = wxMenuBar::MacGetInstalledMenuBar() ;
|
||||
if ( mbar )
|
||||
item = mbar->FindItem( id , &itemMenu ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
URefCon refCon = 0 ;
|
||||
|
||||
GetMenuItemRefCon( command.menu.menuRef , command.menu.menuItemIndex , &refCon ) ;
|
||||
itemMenu = wxFindMenuFromMacMenu( command.menu.menuRef ) ;
|
||||
if ( itemMenu != NULL && refCon != 0)
|
||||
item = (wxMenuItem*) refCon;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return itemMenu ;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Carbon Event Handler
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
#if wxOSX_USE_CARBON
|
||||
|
||||
static const EventTypeSpec eventList[] =
|
||||
{
|
||||
{ kEventClassCommand, kEventProcessCommand } ,
|
||||
{ kEventClassCommand, kEventCommandUpdateStatus } ,
|
||||
|
||||
{ kEventClassMenu, kEventMenuOpening },
|
||||
{ kEventClassMenu, kEventMenuClosed },
|
||||
{ kEventClassMenu, kEventMenuTargetItem },
|
||||
|
||||
{ kEventClassApplication , kEventAppActivated } ,
|
||||
{ kEventClassApplication , kEventAppDeactivated } ,
|
||||
// handling the quit event is not recommended by apple
|
||||
// rather using the quit apple event - which we do
|
||||
|
||||
{ kEventClassAppleEvent , kEventAppleEvent } ,
|
||||
|
||||
{ kEventClassMouse , kEventMouseDown } ,
|
||||
{ kEventClassMouse , kEventMouseMoved } ,
|
||||
{ kEventClassMouse , kEventMouseUp } ,
|
||||
{ kEventClassMouse , kEventMouseDragged } ,
|
||||
{ 'WXMC' , 'WXMC' }
|
||||
} ;
|
||||
|
||||
static pascal OSStatus
|
||||
wxMacAppMenuEventHandler( EventHandlerCallRef WXUNUSED(handler),
|
||||
EventRef event,
|
||||
void *WXUNUSED(data) )
|
||||
{
|
||||
wxMacCarbonEvent cEvent( event ) ;
|
||||
MenuRef menuRef = cEvent.GetParameter<MenuRef>(kEventParamDirectObject) ;
|
||||
#ifndef __WXUNIVERSAL__
|
||||
wxMenu* menu = wxFindMenuFromMacMenu( menuRef ) ;
|
||||
|
||||
if ( menu )
|
||||
{
|
||||
switch (GetEventKind(event))
|
||||
{
|
||||
case kEventMenuOpening:
|
||||
menu->HandleMenuOpened();
|
||||
break;
|
||||
|
||||
case kEventMenuClosed:
|
||||
menu->HandleMenuClosed();
|
||||
break;
|
||||
|
||||
case kEventMenuTargetItem:
|
||||
{
|
||||
HICommand command ;
|
||||
|
||||
command.menu.menuRef = menuRef;
|
||||
command.menu.menuItemIndex = cEvent.GetParameter<MenuItemIndex>(kEventParamMenuItemIndex,typeMenuItemIndex) ;
|
||||
command.commandID = cEvent.GetParameter<MenuCommand>(kEventParamMenuCommand,typeMenuCommand) ;
|
||||
if (command.commandID != 0)
|
||||
{
|
||||
wxMenuItem* item = NULL ;
|
||||
wxMenu* itemMenu = wxFindMenuFromMacCommand( command , item ) ;
|
||||
if ( itemMenu && item )
|
||||
itemMenu->HandleMenuItemHighlighted( item );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
wxFAIL_MSG(wxT("Unexpected menu event kind"));
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
return eventNotHandledErr;
|
||||
}
|
||||
|
||||
static pascal OSStatus
|
||||
wxMacAppCommandEventHandler( EventHandlerCallRef WXUNUSED(handler) ,
|
||||
EventRef event ,
|
||||
void *WXUNUSED(data) )
|
||||
{
|
||||
OSStatus result = eventNotHandledErr ;
|
||||
|
||||
HICommand command ;
|
||||
|
||||
wxMacCarbonEvent cEvent( event ) ;
|
||||
cEvent.GetParameter<HICommand>(kEventParamDirectObject,typeHICommand,&command) ;
|
||||
|
||||
wxMenuItem* item = NULL ;
|
||||
wxMenu* itemMenu = wxFindMenuFromMacCommand( command , item ) ;
|
||||
|
||||
if ( item )
|
||||
{
|
||||
wxASSERT( itemMenu != NULL ) ;
|
||||
|
||||
switch ( cEvent.GetKind() )
|
||||
{
|
||||
case kEventProcessCommand :
|
||||
if ( itemMenu->HandleCommandProcess( item ) )
|
||||
result = noErr;
|
||||
break ;
|
||||
|
||||
case kEventCommandUpdateStatus:
|
||||
if ( itemMenu->HandleCommandUpdateStatus( item ) )
|
||||
result = noErr;
|
||||
break ;
|
||||
|
||||
default :
|
||||
break ;
|
||||
}
|
||||
}
|
||||
return result ;
|
||||
}
|
||||
|
||||
static pascal OSStatus
|
||||
wxMacAppApplicationEventHandler( EventHandlerCallRef WXUNUSED(handler) ,
|
||||
EventRef event ,
|
||||
void *WXUNUSED(data) )
|
||||
{
|
||||
OSStatus result = eventNotHandledErr ;
|
||||
switch ( GetEventKind( event ) )
|
||||
{
|
||||
case kEventAppActivated :
|
||||
if ( wxTheApp )
|
||||
wxTheApp->SetActive( true , NULL ) ;
|
||||
result = noErr ;
|
||||
break ;
|
||||
|
||||
case kEventAppDeactivated :
|
||||
if ( wxTheApp )
|
||||
wxTheApp->SetActive( false , NULL ) ;
|
||||
result = noErr ;
|
||||
break ;
|
||||
|
||||
default :
|
||||
break ;
|
||||
}
|
||||
|
||||
return result ;
|
||||
}
|
||||
|
||||
pascal OSStatus wxMacAppEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
|
||||
{
|
||||
EventRef formerEvent = (EventRef) wxTheApp->MacGetCurrentEvent() ;
|
||||
EventHandlerCallRef formerEventHandlerCallRef = (EventHandlerCallRef) wxTheApp->MacGetCurrentEventHandlerCallRef() ;
|
||||
wxTheApp->MacSetCurrentEvent( event , handler ) ;
|
||||
|
||||
OSStatus result = eventNotHandledErr ;
|
||||
switch ( GetEventClass( event ) )
|
||||
{
|
||||
#ifndef __LP64__
|
||||
case kEventClassCommand :
|
||||
result = wxMacAppCommandEventHandler( handler , event , data ) ;
|
||||
break ;
|
||||
#endif
|
||||
case kEventClassApplication :
|
||||
result = wxMacAppApplicationEventHandler( handler , event , data ) ;
|
||||
break ;
|
||||
#ifndef __LP64__
|
||||
case kEventClassMenu :
|
||||
result = wxMacAppMenuEventHandler( handler , event , data ) ;
|
||||
break ;
|
||||
|
||||
case kEventClassMouse :
|
||||
{
|
||||
wxMacCarbonEvent cEvent( event ) ;
|
||||
|
||||
WindowRef window ;
|
||||
Point screenMouseLocation = cEvent.GetParameter<Point>(kEventParamMouseLocation) ;
|
||||
::FindWindow(screenMouseLocation, &window);
|
||||
// only send this event in case it had not already been sent to a tlw, as we get
|
||||
// double events otherwise (in case event.skip) was called
|
||||
if ( window == NULL )
|
||||
result = wxMacTopLevelMouseEventHandler( handler , event , NULL ) ;
|
||||
}
|
||||
break ;
|
||||
#endif
|
||||
case kEventClassAppleEvent :
|
||||
result = AEProcessEvent(event);
|
||||
break ;
|
||||
|
||||
default :
|
||||
break ;
|
||||
}
|
||||
|
||||
wxTheApp->MacSetCurrentEvent( formerEvent, formerEventHandlerCallRef ) ;
|
||||
|
||||
return result ;
|
||||
}
|
||||
|
||||
DEFINE_ONE_SHOT_HANDLER_GETTER( wxMacAppEventHandler )
|
||||
#endif
|
||||
|
||||
#if wxDEBUG_LEVEL && wxOSX_USE_COCOA_OR_CARBON
|
||||
|
||||
pascal static void
|
||||
@@ -895,14 +342,6 @@ bool wxApp::Initialize(int& argc, wxChar **argv)
|
||||
return true;
|
||||
}
|
||||
|
||||
#if wxOSX_USE_CARBON
|
||||
bool wxApp::CallOnInit()
|
||||
{
|
||||
wxMacAutoreleasePool autoreleasepool;
|
||||
return OnInit();
|
||||
}
|
||||
#endif
|
||||
|
||||
bool wxApp::OnInitGui()
|
||||
{
|
||||
if ( !wxAppBase::OnInitGui() )
|
||||
@@ -926,77 +365,6 @@ int wxApp::OnRun()
|
||||
return wxAppBase::OnRun();
|
||||
}
|
||||
|
||||
#if wxOSX_USE_CARBON
|
||||
bool wxApp::DoInitGui()
|
||||
{
|
||||
InstallStandardEventHandler( GetApplicationEventTarget() ) ;
|
||||
if (!sm_isEmbedded)
|
||||
{
|
||||
InstallApplicationEventHandler(
|
||||
GetwxMacAppEventHandlerUPP(),
|
||||
GetEventTypeCount(eventList), eventList, wxTheApp, (EventHandlerRef *)&(wxTheApp->m_macEventHandler));
|
||||
}
|
||||
|
||||
if (!sm_isEmbedded)
|
||||
{
|
||||
sODocHandler = NewAEEventHandlerUPP(AEHandleODoc) ;
|
||||
sGURLHandler = NewAEEventHandlerUPP(AEHandleGURL) ;
|
||||
sOAppHandler = NewAEEventHandlerUPP(AEHandleOApp) ;
|
||||
sPDocHandler = NewAEEventHandlerUPP(AEHandlePDoc) ;
|
||||
sRAppHandler = NewAEEventHandlerUPP(AEHandleRApp) ;
|
||||
sQuitHandler = NewAEEventHandlerUPP(AEHandleQuit) ;
|
||||
|
||||
AEInstallEventHandler( kCoreEventClass , kAEOpenDocuments ,
|
||||
sODocHandler , 0 , FALSE ) ;
|
||||
AEInstallEventHandler( kInternetEventClass, kAEGetURL,
|
||||
sGURLHandler , 0 , FALSE ) ;
|
||||
AEInstallEventHandler( kCoreEventClass , kAEOpenApplication ,
|
||||
sOAppHandler , 0 , FALSE ) ;
|
||||
AEInstallEventHandler( kCoreEventClass , kAEPrintDocuments ,
|
||||
sPDocHandler , 0 , FALSE ) ;
|
||||
AEInstallEventHandler( kCoreEventClass , kAEReopenApplication ,
|
||||
sRAppHandler , 0 , FALSE ) ;
|
||||
AEInstallEventHandler( kCoreEventClass , kAEQuitApplication ,
|
||||
sQuitHandler , 0 , FALSE ) ;
|
||||
}
|
||||
|
||||
if ( !wxMacInitCocoa() )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void wxApp::DoCleanUp()
|
||||
{
|
||||
if (!sm_isEmbedded)
|
||||
RemoveEventHandler( (EventHandlerRef)(wxTheApp->m_macEventHandler) );
|
||||
|
||||
if (!sm_isEmbedded)
|
||||
{
|
||||
AERemoveEventHandler( kCoreEventClass , kAEOpenDocuments ,
|
||||
sODocHandler , FALSE ) ;
|
||||
AERemoveEventHandler( kInternetEventClass, kAEGetURL,
|
||||
sGURLHandler , FALSE ) ;
|
||||
AERemoveEventHandler( kCoreEventClass , kAEOpenApplication ,
|
||||
sOAppHandler , FALSE ) ;
|
||||
AERemoveEventHandler( kCoreEventClass , kAEPrintDocuments ,
|
||||
sPDocHandler , FALSE ) ;
|
||||
AERemoveEventHandler( kCoreEventClass , kAEReopenApplication ,
|
||||
sRAppHandler , FALSE ) ;
|
||||
AERemoveEventHandler( kCoreEventClass , kAEQuitApplication ,
|
||||
sQuitHandler , FALSE ) ;
|
||||
|
||||
DisposeAEEventHandlerUPP( sODocHandler ) ;
|
||||
DisposeAEEventHandlerUPP( sGURLHandler ) ;
|
||||
DisposeAEEventHandlerUPP( sOAppHandler ) ;
|
||||
DisposeAEEventHandlerUPP( sPDocHandler ) ;
|
||||
DisposeAEEventHandlerUPP( sRAppHandler ) ;
|
||||
DisposeAEEventHandlerUPP( sQuitHandler ) ;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void wxApp::CleanUp()
|
||||
{
|
||||
wxMacAutoreleasePool autoreleasepool;
|
||||
@@ -1410,30 +778,6 @@ int wxMacKeyCodeToModifier(wxKeyCode key)
|
||||
|
||||
// defined in utils.mm
|
||||
|
||||
#elif wxOSX_USE_CARBON
|
||||
|
||||
wxMouseState wxGetMouseState()
|
||||
{
|
||||
wxMouseState ms;
|
||||
|
||||
wxPoint pt = wxGetMousePosition();
|
||||
ms.SetX(pt.x);
|
||||
ms.SetY(pt.y);
|
||||
|
||||
UInt32 buttons = GetCurrentButtonState();
|
||||
ms.SetLeftDown( (buttons & 0x01) != 0 );
|
||||
ms.SetMiddleDown( (buttons & 0x04) != 0 );
|
||||
ms.SetRightDown( (buttons & 0x02) != 0 );
|
||||
|
||||
UInt32 modifiers = GetCurrentKeyModifiers();
|
||||
ms.SetRawControlDown(modifiers & controlKey);
|
||||
ms.SetShiftDown(modifiers & shiftKey);
|
||||
ms.SetAltDown(modifiers & optionKey);
|
||||
ms.SetControlDown(modifiers & cmdKey);
|
||||
|
||||
return ms;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// TODO : once the new key/char handling is tested, move all the code to wxWindow
|
||||
@@ -1469,79 +813,6 @@ bool wxApp::MacSendCharEvent( wxWindow* focus , long keymessage , long modifiers
|
||||
|
||||
bool handled = false ;
|
||||
|
||||
#if wxOSX_USE_CARBON
|
||||
long keyval = event.m_keyCode ;
|
||||
|
||||
{
|
||||
wxKeyEvent eventCharHook(wxEVT_CHAR_HOOK, event);
|
||||
handled = focus->HandleWindowEvent( eventCharHook );
|
||||
if ( handled && eventCharHook.IsNextEventAllowed() )
|
||||
handled = false ;
|
||||
}
|
||||
|
||||
if ( !handled )
|
||||
{
|
||||
handled = focus->HandleWindowEvent( event ) ;
|
||||
}
|
||||
|
||||
if ( !handled && (keyval == WXK_TAB) )
|
||||
{
|
||||
wxWindow* iter = focus->GetParent() ;
|
||||
while ( iter && !handled )
|
||||
{
|
||||
if ( iter->HasFlag( wxTAB_TRAVERSAL ) )
|
||||
{
|
||||
wxNavigationKeyEvent new_event;
|
||||
new_event.SetEventObject( focus );
|
||||
new_event.SetDirection( !event.ShiftDown() );
|
||||
/* CTRL-TAB changes the (parent) window, i.e. switch notebook page */
|
||||
new_event.SetWindowChange( event.ControlDown() );
|
||||
new_event.SetCurrentFocus( focus );
|
||||
handled = focus->GetParent()->HandleWindowEvent( new_event );
|
||||
if ( handled && new_event.GetSkipped() )
|
||||
handled = false ;
|
||||
}
|
||||
|
||||
iter = iter->GetParent() ;
|
||||
}
|
||||
}
|
||||
|
||||
// backdoor handler for default return and command escape
|
||||
if ( !handled && (!focus->IsKindOf(CLASSINFO(wxControl) ) || !focus->AcceptsFocus() ) )
|
||||
{
|
||||
// if window is not having a focus still testing for default enter or cancel
|
||||
// TODO: add the UMA version for ActiveNonFloatingWindow
|
||||
#ifndef __LP64__
|
||||
wxWindow* focus = wxNonOwnedWindow::GetFromWXWindow( (WXWindow) FrontWindow() ) ;
|
||||
if ( focus )
|
||||
{
|
||||
if ( keyval == WXK_RETURN || keyval == WXK_NUMPAD_ENTER )
|
||||
{
|
||||
wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(focus), wxTopLevelWindow);
|
||||
if ( tlw && tlw->GetDefaultItem() )
|
||||
{
|
||||
wxButton *def = wxDynamicCast(tlw->GetDefaultItem(), wxButton);
|
||||
if ( def && def->IsEnabled() )
|
||||
{
|
||||
wxCommandEvent event(wxEVT_BUTTON, def->GetId() );
|
||||
event.SetEventObject(def);
|
||||
def->Command(event);
|
||||
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (keyval == WXK_ESCAPE || (keyval == '.' && modifiers & cmdKey ) )
|
||||
{
|
||||
// generate wxID_CANCEL if command-. or <esc> has been pressed (typically in dialogs)
|
||||
wxCommandEvent new_event(wxEVT_BUTTON,wxID_CANCEL);
|
||||
new_event.SetEventObject( focus );
|
||||
handled = focus->HandleWindowEvent( new_event );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
return handled ;
|
||||
}
|
||||
|
||||
@@ -1643,12 +914,4 @@ void wxApp::MacCreateKeyEvent( wxKeyEvent& event, wxWindow* focus , long keymess
|
||||
|
||||
void wxApp::MacHideApp()
|
||||
{
|
||||
#if wxOSX_USE_CARBON
|
||||
wxMacCarbonEvent event( kEventClassCommand , kEventCommandProcess );
|
||||
HICommand command;
|
||||
memset( &command, 0 , sizeof(command) );
|
||||
command.commandID = kHICommandHide ;
|
||||
event.SetParameter<HICommand>(kEventParamDirectObject, command );
|
||||
SendEventToApplication( event );
|
||||
#endif
|
||||
}
|
||||
|
@@ -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
|
||||
}
|
||||
|
@@ -38,10 +38,6 @@ public:
|
||||
#if wxOSX_USE_COCOA_OR_CARBON
|
||||
if ( m_hCursor != NULL )
|
||||
return true;
|
||||
#if wxOSX_USE_CARBON
|
||||
if ( m_themeCursor != -1 )
|
||||
return true;
|
||||
#endif
|
||||
|
||||
return false;
|
||||
#else
|
||||
@@ -53,12 +49,6 @@ public:
|
||||
protected:
|
||||
#if wxOSX_USE_COCOA
|
||||
WX_NSCursor m_hCursor;
|
||||
#elif wxOSX_USE_CARBON
|
||||
WXHCURSOR m_hCursor;
|
||||
bool m_disposeHandle;
|
||||
bool m_releaseHandle;
|
||||
bool m_isColorCursor;
|
||||
long m_themeCursor;
|
||||
#elif wxOSX_USE_IPHONE
|
||||
void* m_hCursor;
|
||||
#endif
|
||||
@@ -209,33 +199,9 @@ ClassicCursor gMacCursors[kwxCursorLast+1] =
|
||||
|
||||
wxCursor gMacCurrentCursor ;
|
||||
|
||||
#if wxOSX_USE_CARBON
|
||||
CursHandle wxGetStockCursor( int number )
|
||||
{
|
||||
wxASSERT_MSG( number >= 0 && number <=kwxCursorLast , wxT("invalid stock cursor id") ) ;
|
||||
CursHandle c = (CursHandle) NewHandle( sizeof(Cursor) ) ;
|
||||
memcpy( *c, &gMacCursors[number], sizeof(Cursor) ) ;
|
||||
|
||||
#ifndef WORDS_BIGENDIAN
|
||||
short *sptr = (short*) *c ;
|
||||
for ( int i = 0 ; i < 2 * 16 /* image and mask */ ; ++i, ++sptr )
|
||||
{
|
||||
*sptr = CFSwapInt16( *sptr ) ;
|
||||
}
|
||||
#endif
|
||||
return c ;
|
||||
}
|
||||
#endif
|
||||
|
||||
wxCursorRefData::wxCursorRefData()
|
||||
{
|
||||
m_hCursor = NULL;
|
||||
#if wxOSX_USE_CARBON
|
||||
m_disposeHandle = false;
|
||||
m_releaseHandle = false;
|
||||
m_isColorCursor = false;
|
||||
m_themeCursor = -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
wxCursorRefData::wxCursorRefData(const wxCursorRefData& cursor) : wxGDIRefData()
|
||||
@@ -244,12 +210,6 @@ wxCursorRefData::wxCursorRefData(const wxCursorRefData& cursor) : wxGDIRefData()
|
||||
|
||||
#if wxOSX_USE_COCOA
|
||||
m_hCursor = (WX_NSCursor) wxMacCocoaRetain(cursor.m_hCursor);
|
||||
#elif wxOSX_USE_CARBON
|
||||
// FIXME: need to copy the cursor
|
||||
m_disposeHandle = false;
|
||||
m_releaseHandle = false;
|
||||
m_isColorCursor = cursor.m_isColorCursor;
|
||||
m_themeCursor = cursor.m_themeCursor;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -258,22 +218,6 @@ wxCursorRefData::~wxCursorRefData()
|
||||
#if wxOSX_USE_COCOA
|
||||
if ( m_hCursor )
|
||||
wxMacCocoaRelease(m_hCursor);
|
||||
#elif wxOSX_USE_CARBON
|
||||
if ( m_isColorCursor )
|
||||
{
|
||||
#ifndef __LP64__
|
||||
::DisposeCCursor( (CCrsrHandle) m_hCursor ) ;
|
||||
#endif
|
||||
}
|
||||
else if ( m_disposeHandle )
|
||||
{
|
||||
::DisposeHandle( (Handle ) m_hCursor ) ;
|
||||
}
|
||||
else if ( m_releaseHandle )
|
||||
{
|
||||
// we don't release the resource since it may already
|
||||
// be in use again
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -303,29 +247,6 @@ WXHCURSOR wxCursor::GetHCURSOR() const
|
||||
return (M_CURSORDATA ? M_CURSORDATA->m_hCursor : 0);
|
||||
}
|
||||
|
||||
#if wxOSX_USE_CARBON
|
||||
short GetCTabIndex( CTabHandle colors , RGBColor *col )
|
||||
{
|
||||
short retval = 0 ;
|
||||
unsigned long bestdiff = 0xFFFF ;
|
||||
|
||||
for ( int i = 0 ; i < (**colors).ctSize ; ++i )
|
||||
{
|
||||
unsigned long diff = abs(col->red - (**colors).ctTable[i].rgb.red ) +
|
||||
abs(col->green - (**colors).ctTable[i].rgb.green ) +
|
||||
abs(col->blue - (**colors).ctTable[i].rgb.blue ) ;
|
||||
|
||||
if ( diff < bestdiff )
|
||||
{
|
||||
bestdiff = diff ;
|
||||
retval = (**colors).ctTable[i].value ;
|
||||
}
|
||||
}
|
||||
|
||||
return retval ;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if wxUSE_IMAGE
|
||||
|
||||
void wxCursor::CreateFromImage(const wxImage & image)
|
||||
@@ -341,137 +262,6 @@ void wxCursor::CreateFromImage(const wxImage & image)
|
||||
M_CURSORDATA->m_hCursor = wxMacCocoaCreateCursorFromCGImage( cgimage, hotSpotX, hotSpotY );
|
||||
CFRelease( cgimage );
|
||||
}
|
||||
#elif wxOSX_USE_CARBON
|
||||
#ifndef __LP64__
|
||||
int w = 16;
|
||||
int h = 16;
|
||||
|
||||
int image_w = image.GetWidth();
|
||||
int image_h = image.GetHeight();
|
||||
|
||||
wxASSERT_MSG( hotSpotX >= 0 && hotSpotX < image_w &&
|
||||
hotSpotY >= 0 && hotSpotY < image_h,
|
||||
wxT("invalid cursor hot spot coordinates") );
|
||||
|
||||
wxImage image16(image); // final image of correct size
|
||||
|
||||
// if image is too small then place it in the center, resize it if too big
|
||||
if ((w > image_w) && (h > image_h))
|
||||
{
|
||||
wxPoint offset((w - image_w) / 2, (h - image_h) / 2);
|
||||
hotSpotX = hotSpotX + offset.x;
|
||||
hotSpotY = hotSpotY + offset.y;
|
||||
|
||||
image16 = image.Size(wxSize(w, h), offset);
|
||||
}
|
||||
else if ((w != image_w) || (h != image_h))
|
||||
{
|
||||
hotSpotX = int(hotSpotX * double(w) / double(image_w));
|
||||
hotSpotY = int(hotSpotY * double(h) / double(image_h));
|
||||
|
||||
image16 = image.Scale(w, h);
|
||||
}
|
||||
|
||||
unsigned char * rgbBits = image16.GetData();
|
||||
bool bHasMask = image16.HasMask() ;
|
||||
|
||||
PixMapHandle pm = (PixMapHandle) NewHandleClear( sizeof(PixMap) ) ;
|
||||
short extent = 16 ;
|
||||
short bytesPerPixel = 1 ;
|
||||
short depth = 8 ;
|
||||
Rect bounds = { 0 , 0 , extent , extent } ;
|
||||
CCrsrHandle ch = (CCrsrHandle) NewHandleClear( sizeof(CCrsr) ) ;
|
||||
CTabHandle newColors = GetCTable( 8 ) ;
|
||||
HandToHand( (Handle *) &newColors );
|
||||
|
||||
// set the values to the indices
|
||||
for ( int i = 0 ; i < (**newColors).ctSize ; ++i )
|
||||
{
|
||||
(**newColors).ctTable[i].value = i ;
|
||||
}
|
||||
|
||||
HLock( (Handle)ch );
|
||||
(**ch).crsrType = 0x8001; // color cursors
|
||||
(**ch).crsrMap = pm;
|
||||
short bytesPerRow = bytesPerPixel * extent;
|
||||
|
||||
(**pm).baseAddr = 0;
|
||||
(**pm).rowBytes = bytesPerRow | 0x8000;
|
||||
(**pm).bounds = bounds;
|
||||
(**pm).pmVersion = 0;
|
||||
(**pm).packType = 0;
|
||||
(**pm).packSize = 0;
|
||||
(**pm).hRes = 0x00480000; // 72 DPI default res
|
||||
(**pm).vRes = 0x00480000; // 72 DPI default res
|
||||
(**pm).pixelSize = depth;
|
||||
(**pm).pixelType = 0;
|
||||
(**pm).cmpCount = 1;
|
||||
(**pm).cmpSize = depth;
|
||||
(**pm).pmTable = newColors;
|
||||
|
||||
(**ch).crsrData = NewHandleClear( extent * bytesPerRow ) ;
|
||||
(**ch).crsrXData = NULL ;
|
||||
(**ch).crsrXValid = 0;
|
||||
(**ch).crsrXHandle = NULL;
|
||||
|
||||
(**ch).crsrHotSpot.h = hotSpotX ;
|
||||
(**ch).crsrHotSpot.v = hotSpotY ;
|
||||
(**ch).crsrXTable = 0 ;
|
||||
(**ch).crsrID = GetCTSeed() ;
|
||||
|
||||
memset( (**ch).crsr1Data , 0 , sizeof( Bits16 ) ) ;
|
||||
memset( (**ch).crsrMask , 0 , sizeof( Bits16 ) ) ;
|
||||
|
||||
unsigned char mr = image16.GetMaskRed() ;
|
||||
unsigned char mg = image16.GetMaskGreen() ;
|
||||
unsigned char mb = image16.GetMaskBlue() ;
|
||||
|
||||
for ( int y = 0 ; y < h ; ++y )
|
||||
{
|
||||
short rowbits = 0, maskbits = 0 ;
|
||||
|
||||
for ( int x = 0 ; x < w ; ++x )
|
||||
{
|
||||
long pos = (y * w + x) * 3;
|
||||
|
||||
unsigned char r = rgbBits[pos] ;
|
||||
unsigned char g = rgbBits[pos + 1] ;
|
||||
unsigned char b = rgbBits[pos + 2] ;
|
||||
RGBColor col = { 0xFFFF, 0xFFFF, 0xFFFF } ;
|
||||
|
||||
if ( bHasMask && r == mr && g == mg && b == mb )
|
||||
{
|
||||
// masked area, does not appear anywhere
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( (int)r + (int)g + (int)b < 0x0200 )
|
||||
rowbits |= ( 1 << (15 - x) ) ;
|
||||
|
||||
maskbits |= ( 1 << (15 - x) ) ;
|
||||
|
||||
wxColor( r , g , b ).GetRGBColor( &col );
|
||||
}
|
||||
|
||||
*((*(**ch).crsrData) + y * bytesPerRow + x) =
|
||||
GetCTabIndex( newColors , &col) ;
|
||||
}
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
(**ch).crsr1Data[y] = rowbits ;
|
||||
(**ch).crsrMask[y] = maskbits ;
|
||||
#else
|
||||
(**ch).crsr1Data[y] = CFSwapInt16(rowbits) ;
|
||||
(**ch).crsrMask[y] = CFSwapInt16(maskbits) ;
|
||||
#endif
|
||||
}
|
||||
|
||||
if ( !bHasMask )
|
||||
memcpy( (**ch).crsrMask , (**ch).crsr1Data , sizeof( Bits16) ) ;
|
||||
|
||||
HUnlock( (Handle)ch ) ;
|
||||
M_CURSORDATA->m_hCursor = ch ;
|
||||
M_CURSORDATA->m_isColorCursor = true ;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -484,41 +274,6 @@ wxCursor::wxCursor(const wxString& cursor_file, wxBitmapType flags, int hotSpotX
|
||||
{
|
||||
#if wxOSX_USE_COCOA
|
||||
wxFAIL_MSG( wxT("Not implemented") );
|
||||
#elif wxOSX_USE_CARBON
|
||||
#ifndef __LP64__
|
||||
Str255 theName ;
|
||||
wxMacStringToPascal( cursor_file , theName ) ;
|
||||
|
||||
Handle resHandle = ::GetNamedResource( 'crsr' , theName ) ;
|
||||
if ( resHandle )
|
||||
{
|
||||
short theId = -1 ;
|
||||
OSType theType ;
|
||||
|
||||
GetResInfo( resHandle , &theId , &theType , theName ) ;
|
||||
ReleaseResource( resHandle ) ;
|
||||
|
||||
M_CURSORDATA->m_hCursor = GetCCursor( theId ) ;
|
||||
if ( M_CURSORDATA->m_hCursor )
|
||||
M_CURSORDATA->m_isColorCursor = true ;
|
||||
}
|
||||
else
|
||||
{
|
||||
Handle resHandle = ::GetNamedResource( 'CURS' , theName ) ;
|
||||
if ( resHandle )
|
||||
{
|
||||
short theId = -1 ;
|
||||
OSType theType ;
|
||||
|
||||
GetResInfo( resHandle , &theId , &theType , theName ) ;
|
||||
ReleaseResource( resHandle ) ;
|
||||
|
||||
M_CURSORDATA->m_hCursor = GetCursor( theId ) ;
|
||||
if ( M_CURSORDATA->m_hCursor )
|
||||
M_CURSORDATA->m_releaseHandle = true ;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
else
|
||||
@@ -544,117 +299,6 @@ void wxCursor::InitFromStock(wxStockCursor cursor_type)
|
||||
m_refData = new wxCursorRefData;
|
||||
#if wxOSX_USE_COCOA
|
||||
M_CURSORDATA->m_hCursor = wxMacCocoaCreateStockCursor( cursor_type );
|
||||
#elif wxOSX_USE_CARBON
|
||||
switch (cursor_type)
|
||||
{
|
||||
case wxCURSOR_COPY_ARROW:
|
||||
M_CURSORDATA->m_themeCursor = kThemeCopyArrowCursor;
|
||||
break;
|
||||
|
||||
case wxCURSOR_WAIT:
|
||||
M_CURSORDATA->m_themeCursor = kThemeWatchCursor;
|
||||
break;
|
||||
|
||||
case wxCURSOR_IBEAM:
|
||||
M_CURSORDATA->m_themeCursor = kThemeIBeamCursor;
|
||||
break;
|
||||
|
||||
case wxCURSOR_CROSS:
|
||||
M_CURSORDATA->m_themeCursor = kThemeCrossCursor;
|
||||
break;
|
||||
|
||||
case wxCURSOR_SIZENWSE:
|
||||
M_CURSORDATA->m_hCursor = wxGetStockCursor(kwxCursorSizeNWSE);
|
||||
break;
|
||||
|
||||
case wxCURSOR_SIZENESW:
|
||||
M_CURSORDATA->m_hCursor = wxGetStockCursor(kwxCursorSizeNESW);
|
||||
break;
|
||||
|
||||
case wxCURSOR_SIZEWE:
|
||||
M_CURSORDATA->m_themeCursor = kThemeResizeLeftRightCursor;
|
||||
break;
|
||||
|
||||
case wxCURSOR_SIZENS:
|
||||
M_CURSORDATA->m_hCursor = wxGetStockCursor(kwxCursorSizeNS);
|
||||
break;
|
||||
|
||||
case wxCURSOR_SIZING:
|
||||
M_CURSORDATA->m_hCursor = wxGetStockCursor(kwxCursorSize);
|
||||
break;
|
||||
|
||||
case wxCURSOR_HAND:
|
||||
M_CURSORDATA->m_themeCursor = kThemePointingHandCursor;
|
||||
break;
|
||||
|
||||
case wxCURSOR_BULLSEYE:
|
||||
M_CURSORDATA->m_hCursor = wxGetStockCursor(kwxCursorBullseye);
|
||||
break;
|
||||
|
||||
case wxCURSOR_PENCIL:
|
||||
M_CURSORDATA->m_hCursor = wxGetStockCursor(kwxCursorPencil);
|
||||
break;
|
||||
|
||||
case wxCURSOR_MAGNIFIER:
|
||||
M_CURSORDATA->m_hCursor = wxGetStockCursor(kwxCursorMagnifier);
|
||||
break;
|
||||
|
||||
case wxCURSOR_NO_ENTRY:
|
||||
M_CURSORDATA->m_hCursor = wxGetStockCursor(kwxCursorNoEntry);
|
||||
break;
|
||||
|
||||
case wxCURSOR_WATCH:
|
||||
M_CURSORDATA->m_themeCursor = kThemeWatchCursor;
|
||||
break;
|
||||
|
||||
case wxCURSOR_PAINT_BRUSH:
|
||||
M_CURSORDATA->m_hCursor = wxGetStockCursor(kwxCursorPaintBrush);
|
||||
break;
|
||||
|
||||
case wxCURSOR_POINT_LEFT:
|
||||
M_CURSORDATA->m_hCursor = wxGetStockCursor(kwxCursorPointLeft);
|
||||
break;
|
||||
|
||||
case wxCURSOR_POINT_RIGHT:
|
||||
M_CURSORDATA->m_hCursor = wxGetStockCursor(kwxCursorPointRight);
|
||||
break;
|
||||
|
||||
case wxCURSOR_QUESTION_ARROW:
|
||||
M_CURSORDATA->m_hCursor = wxGetStockCursor(kwxCursorQuestionArrow);
|
||||
break;
|
||||
|
||||
case wxCURSOR_BLANK:
|
||||
M_CURSORDATA->m_hCursor = wxGetStockCursor(kwxCursorBlank);
|
||||
break;
|
||||
|
||||
case wxCURSOR_RIGHT_ARROW:
|
||||
M_CURSORDATA->m_hCursor = wxGetStockCursor(kwxCursorRightArrow);
|
||||
break;
|
||||
|
||||
case wxCURSOR_SPRAYCAN:
|
||||
M_CURSORDATA->m_hCursor = wxGetStockCursor(kwxCursorRoller);
|
||||
break;
|
||||
|
||||
case wxCURSOR_OPEN_HAND:
|
||||
M_CURSORDATA->m_themeCursor = kThemeOpenHandCursor;
|
||||
break;
|
||||
|
||||
case wxCURSOR_CLOSED_HAND:
|
||||
M_CURSORDATA->m_themeCursor = kThemeClosedHandCursor;
|
||||
break;
|
||||
|
||||
case wxCURSOR_CHAR:
|
||||
case wxCURSOR_ARROW:
|
||||
case wxCURSOR_LEFT_BUTTON:
|
||||
case wxCURSOR_RIGHT_BUTTON:
|
||||
case wxCURSOR_MIDDLE_BUTTON:
|
||||
default:
|
||||
M_CURSORDATA->m_themeCursor = kThemeArrowCursor;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( M_CURSORDATA->m_themeCursor == -1 )
|
||||
M_CURSORDATA->m_releaseHandle = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -664,24 +308,6 @@ void wxCursor::MacInstall() const
|
||||
#if wxOSX_USE_COCOA
|
||||
if ( IsOk() )
|
||||
wxMacCocoaSetCursor( M_CURSORDATA->m_hCursor );
|
||||
#elif wxOSX_USE_CARBON
|
||||
if ( m_refData && M_CURSORDATA->m_themeCursor != -1 )
|
||||
{
|
||||
SetThemeCursor( M_CURSORDATA->m_themeCursor ) ;
|
||||
}
|
||||
else if ( m_refData && M_CURSORDATA->m_hCursor )
|
||||
{
|
||||
#ifndef __LP64__
|
||||
if ( M_CURSORDATA->m_isColorCursor )
|
||||
::SetCCursor( (CCrsrHandle) M_CURSORDATA->m_hCursor ) ;
|
||||
else
|
||||
::SetCursor( * (CursHandle) M_CURSORDATA->m_hCursor ) ;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
SetThemeCursor( kThemeArrowCursor ) ;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
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
|
@@ -1,422 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/osx/carbon/dnd.cpp
|
||||
// Purpose: wxDropTarget, wxDropSource implementations
|
||||
// Author: Stefan Csomor
|
||||
// Modified by:
|
||||
// Created: 1998-01-01
|
||||
// Copyright: (c) 1998 Stefan Csomor
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
|
||||
#include "wx/dnd.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/app.h"
|
||||
#include "wx/toplevel.h"
|
||||
#include "wx/gdicmn.h"
|
||||
#endif // WX_PRECOMP
|
||||
|
||||
#include "wx/osx/private.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// globals
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
typedef struct
|
||||
{
|
||||
wxWindow *m_currentTargetWindow;
|
||||
wxDropTarget *m_currentTarget;
|
||||
wxDropSource *m_currentSource;
|
||||
wxDragResult m_result;
|
||||
int m_flags;
|
||||
} MacTrackingGlobals;
|
||||
|
||||
MacTrackingGlobals gTrackingGlobals;
|
||||
|
||||
void wxMacEnsureTrackingHandlersInstalled();
|
||||
|
||||
OSStatus wxMacPromiseKeeper(PasteboardRef WXUNUSED(inPasteboard),
|
||||
PasteboardItemID WXUNUSED(inItem),
|
||||
CFStringRef WXUNUSED(inFlavorType),
|
||||
void * WXUNUSED(inContext))
|
||||
{
|
||||
OSStatus err = noErr;
|
||||
|
||||
// we might add promises here later, inContext is the wxDropSource*
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
wxDropTarget::wxDropTarget( wxDataObject *data )
|
||||
: wxDropTargetBase( data )
|
||||
{
|
||||
wxMacEnsureTrackingHandlersInstalled();
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// wxDropSource
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
wxDropSource::wxDropSource(wxWindow *win,
|
||||
const wxCursor &cursorCopy,
|
||||
const wxCursor &cursorMove,
|
||||
const wxCursor &cursorStop)
|
||||
: wxDropSourceBase(cursorCopy, cursorMove, cursorStop)
|
||||
{
|
||||
wxMacEnsureTrackingHandlersInstalled();
|
||||
|
||||
m_window = win;
|
||||
}
|
||||
|
||||
wxDropSource* wxDropSource::GetCurrentDropSource()
|
||||
{
|
||||
return gTrackingGlobals.m_currentSource;
|
||||
}
|
||||
|
||||
wxDropSource::wxDropSource(wxDataObject& data,
|
||||
wxWindow *win,
|
||||
const wxCursor &cursorCopy,
|
||||
const wxCursor &cursorMove,
|
||||
const wxCursor &cursorStop)
|
||||
: wxDropSourceBase(cursorCopy, cursorMove, cursorStop)
|
||||
{
|
||||
wxMacEnsureTrackingHandlersInstalled();
|
||||
|
||||
SetData( data );
|
||||
m_window = win;
|
||||
}
|
||||
|
||||
wxDragResult wxDropSource::DoDragDrop(int flags)
|
||||
{
|
||||
wxASSERT_MSG( m_data, wxT("Drop source: no data") );
|
||||
|
||||
if ((m_data == NULL) || (m_data->GetFormatCount() == 0))
|
||||
return (wxDragResult)wxDragNone;
|
||||
|
||||
DragReference theDrag;
|
||||
RgnHandle dragRegion;
|
||||
OSStatus err = noErr;
|
||||
PasteboardRef pasteboard;
|
||||
|
||||
// add data to drag
|
||||
|
||||
err = PasteboardCreate( kPasteboardUniqueName, &pasteboard );
|
||||
if ( err != noErr )
|
||||
return wxDragNone;
|
||||
|
||||
// we add a dummy promise keeper because of strange messages when linking against carbon debug
|
||||
err = PasteboardSetPromiseKeeper( pasteboard, wxMacPromiseKeeper, this );
|
||||
if ( err != noErr )
|
||||
{
|
||||
CFRelease( pasteboard );
|
||||
return wxDragNone;
|
||||
}
|
||||
|
||||
err = PasteboardClear( pasteboard );
|
||||
if ( err != noErr )
|
||||
{
|
||||
CFRelease( pasteboard );
|
||||
return wxDragNone;
|
||||
}
|
||||
PasteboardSynchronize( pasteboard );
|
||||
|
||||
m_data->AddToPasteboard( pasteboard, 1 );
|
||||
|
||||
if (NewDragWithPasteboard( pasteboard , &theDrag) != noErr)
|
||||
{
|
||||
CFRelease( pasteboard );
|
||||
return wxDragNone;
|
||||
}
|
||||
|
||||
dragRegion = NewRgn();
|
||||
RgnHandle tempRgn = NewRgn();
|
||||
|
||||
EventRecord rec;
|
||||
ConvertEventRefToEventRecord( (EventRef) wxTheApp->MacGetCurrentEvent(), &rec );
|
||||
|
||||
const short dragRegionOuterBoundary = 10;
|
||||
const short dragRegionInnerBoundary = 9;
|
||||
|
||||
SetRectRgn(
|
||||
dragRegion,
|
||||
rec.where.h - dragRegionOuterBoundary,
|
||||
rec.where.v - dragRegionOuterBoundary,
|
||||
rec.where.h + dragRegionOuterBoundary,
|
||||
rec.where.v + dragRegionOuterBoundary );
|
||||
|
||||
SetRectRgn(
|
||||
tempRgn,
|
||||
rec.where.h - dragRegionInnerBoundary,
|
||||
rec.where.v - dragRegionInnerBoundary,
|
||||
rec.where.h + dragRegionInnerBoundary,
|
||||
rec.where.v + dragRegionInnerBoundary );
|
||||
|
||||
DiffRgn( dragRegion, tempRgn, dragRegion );
|
||||
DisposeRgn( tempRgn );
|
||||
|
||||
// TODO: work with promises in order to return data
|
||||
// only when drag was successfully completed
|
||||
|
||||
gTrackingGlobals.m_currentSource = this;
|
||||
gTrackingGlobals.m_result = wxDragNone;
|
||||
gTrackingGlobals.m_flags = flags;
|
||||
|
||||
err = TrackDrag( theDrag, &rec, dragRegion );
|
||||
|
||||
DisposeRgn( dragRegion );
|
||||
DisposeDrag( theDrag );
|
||||
CFRelease( pasteboard );
|
||||
gTrackingGlobals.m_currentSource = NULL;
|
||||
|
||||
return gTrackingGlobals.m_result;
|
||||
}
|
||||
|
||||
bool gTrackingGlobalsInstalled = false;
|
||||
|
||||
// passing the globals via refcon is not needed by the CFM and later architectures anymore
|
||||
// but I'll leave it in there, just in case...
|
||||
|
||||
pascal OSErr wxMacWindowDragTrackingHandler(
|
||||
DragTrackingMessage theMessage, WindowPtr theWindow,
|
||||
void *handlerRefCon, DragReference theDrag );
|
||||
pascal OSErr wxMacWindowDragReceiveHandler(
|
||||
WindowPtr theWindow, void *handlerRefCon,
|
||||
DragReference theDrag );
|
||||
|
||||
void wxMacEnsureTrackingHandlersInstalled()
|
||||
{
|
||||
if ( !gTrackingGlobalsInstalled )
|
||||
{
|
||||
OSStatus err;
|
||||
|
||||
err = InstallTrackingHandler( NewDragTrackingHandlerUPP(wxMacWindowDragTrackingHandler), 0L, &gTrackingGlobals );
|
||||
verify_noerr( err );
|
||||
|
||||
err = InstallReceiveHandler( NewDragReceiveHandlerUPP(wxMacWindowDragReceiveHandler), 0L, &gTrackingGlobals );
|
||||
verify_noerr( err );
|
||||
|
||||
gTrackingGlobalsInstalled = true;
|
||||
}
|
||||
}
|
||||
|
||||
pascal OSErr wxMacWindowDragTrackingHandler(
|
||||
DragTrackingMessage theMessage, WindowPtr theWindow,
|
||||
void *handlerRefCon, DragReference theDrag )
|
||||
{
|
||||
MacTrackingGlobals* trackingGlobals = (MacTrackingGlobals*) handlerRefCon;
|
||||
|
||||
Point mouse, localMouse;
|
||||
DragAttributes attributes;
|
||||
|
||||
GetDragAttributes( theDrag, &attributes );
|
||||
PasteboardRef pasteboard = 0;
|
||||
GetDragPasteboard( theDrag, &pasteboard );
|
||||
wxNonOwnedWindow* toplevel = wxNonOwnedWindow::GetFromWXWindow( (WXWindow) theWindow );
|
||||
|
||||
bool optionDown = GetCurrentKeyModifiers() & optionKey;
|
||||
wxDragResult result = optionDown ? wxDragCopy : wxDragMove;
|
||||
|
||||
switch (theMessage)
|
||||
{
|
||||
case kDragTrackingEnterHandler:
|
||||
case kDragTrackingLeaveHandler:
|
||||
break;
|
||||
|
||||
case kDragTrackingEnterWindow:
|
||||
if (trackingGlobals != NULL)
|
||||
{
|
||||
trackingGlobals->m_currentTargetWindow = NULL;
|
||||
trackingGlobals->m_currentTarget = NULL;
|
||||
}
|
||||
break;
|
||||
|
||||
case kDragTrackingInWindow:
|
||||
if (trackingGlobals == NULL)
|
||||
break;
|
||||
if (toplevel == NULL)
|
||||
break;
|
||||
|
||||
GetDragMouse( theDrag, &mouse, 0L );
|
||||
{
|
||||
int x = mouse.h ;
|
||||
int y = mouse.v ;
|
||||
toplevel->GetNonOwnedPeer()->ScreenToWindow( &x, &y );
|
||||
localMouse.h = x;
|
||||
localMouse.v = y;
|
||||
|
||||
{
|
||||
wxWindow *win = NULL;
|
||||
ControlPartCode controlPart;
|
||||
ControlRef control = FindControlUnderMouse( localMouse, theWindow, &controlPart );
|
||||
if ( control )
|
||||
win = wxFindWindowFromWXWidget( (WXWidget) control );
|
||||
else
|
||||
win = toplevel;
|
||||
|
||||
int localx, localy;
|
||||
localx = localMouse.h;
|
||||
localy = localMouse.v;
|
||||
|
||||
if ( win )
|
||||
win->MacRootWindowToWindow( &localx, &localy );
|
||||
if ( win != trackingGlobals->m_currentTargetWindow )
|
||||
{
|
||||
if ( trackingGlobals->m_currentTargetWindow )
|
||||
{
|
||||
// this window is left
|
||||
if ( trackingGlobals->m_currentTarget )
|
||||
{
|
||||
HideDragHilite( theDrag );
|
||||
trackingGlobals->m_currentTarget->SetCurrentDragPasteboard( pasteboard );
|
||||
trackingGlobals->m_currentTarget->OnLeave();
|
||||
trackingGlobals->m_currentTarget = NULL;
|
||||
trackingGlobals->m_currentTargetWindow = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if ( win )
|
||||
{
|
||||
// this window is entered
|
||||
trackingGlobals->m_currentTargetWindow = win;
|
||||
trackingGlobals->m_currentTarget = win->GetDropTarget();
|
||||
{
|
||||
if ( trackingGlobals->m_currentTarget )
|
||||
{
|
||||
trackingGlobals->m_currentTarget->SetCurrentDragPasteboard( pasteboard );
|
||||
result = trackingGlobals->m_currentTarget->OnEnter( localx, localy, result );
|
||||
}
|
||||
|
||||
if ( result != wxDragNone )
|
||||
{
|
||||
int x, y;
|
||||
|
||||
x = y = 0;
|
||||
win->MacWindowToRootWindow( &x, &y );
|
||||
RgnHandle hiliteRgn = NewRgn();
|
||||
Rect r = { y, x, y + win->GetSize().y, x + win->GetSize().x };
|
||||
RectRgn( hiliteRgn, &r );
|
||||
ShowDragHilite( theDrag, hiliteRgn, true );
|
||||
DisposeRgn( hiliteRgn );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( trackingGlobals->m_currentTarget )
|
||||
{
|
||||
trackingGlobals->m_currentTarget->SetCurrentDragPasteboard( pasteboard );
|
||||
result = trackingGlobals->m_currentTarget->OnDragOver( localx, localy, result );
|
||||
}
|
||||
}
|
||||
|
||||
// set cursor for OnEnter and OnDragOver
|
||||
if ( trackingGlobals->m_currentSource && !trackingGlobals->m_currentSource->GiveFeedback( result ) )
|
||||
{
|
||||
if ( !trackingGlobals->m_currentSource->MacInstallDefaultCursor( result ) )
|
||||
{
|
||||
wxStockCursor cursorID = wxCURSOR_NONE;
|
||||
|
||||
switch (result)
|
||||
{
|
||||
case wxDragCopy:
|
||||
cursorID = wxCURSOR_COPY_ARROW;
|
||||
break;
|
||||
|
||||
case wxDragMove:
|
||||
cursorID = wxCURSOR_ARROW;
|
||||
break;
|
||||
|
||||
case wxDragNone:
|
||||
cursorID = wxCURSOR_NO_ENTRY;
|
||||
break;
|
||||
|
||||
case wxDragError:
|
||||
case wxDragLink:
|
||||
case wxDragCancel:
|
||||
default:
|
||||
// put these here to make gcc happy
|
||||
;
|
||||
}
|
||||
|
||||
if (cursorID != wxCURSOR_NONE)
|
||||
{
|
||||
wxCursor cursor( cursorID );
|
||||
cursor.MacInstall();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case kDragTrackingLeaveWindow:
|
||||
if (trackingGlobals == NULL)
|
||||
break;
|
||||
|
||||
if (trackingGlobals->m_currentTarget)
|
||||
{
|
||||
trackingGlobals->m_currentTarget->SetCurrentDragPasteboard( pasteboard );
|
||||
trackingGlobals->m_currentTarget->OnLeave();
|
||||
HideDragHilite( theDrag );
|
||||
trackingGlobals->m_currentTarget = NULL;
|
||||
}
|
||||
trackingGlobals->m_currentTargetWindow = NULL;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return noErr;
|
||||
}
|
||||
|
||||
pascal OSErr wxMacWindowDragReceiveHandler(
|
||||
WindowPtr theWindow,
|
||||
void *handlerRefCon,
|
||||
DragReference theDrag)
|
||||
{
|
||||
MacTrackingGlobals* trackingGlobals = (MacTrackingGlobals*)handlerRefCon;
|
||||
if ( trackingGlobals->m_currentTarget )
|
||||
{
|
||||
Point mouse, localMouse;
|
||||
int localx, localy;
|
||||
|
||||
PasteboardRef pasteboard = 0;
|
||||
GetDragPasteboard( theDrag, &pasteboard );
|
||||
trackingGlobals->m_currentTarget->SetCurrentDragPasteboard( pasteboard );
|
||||
GetDragMouse( theDrag, &mouse, 0L );
|
||||
localMouse = mouse;
|
||||
localx = localMouse.h;
|
||||
localy = localMouse.v;
|
||||
wxNonOwnedWindow* tlw = wxNonOwnedWindow::GetFromWXWindow((WXWindow) theWindow);
|
||||
if ( tlw )
|
||||
tlw->GetNonOwnedPeer()->ScreenToWindow( &localx, &localy );
|
||||
|
||||
// TODO : should we use client coordinates?
|
||||
if ( trackingGlobals->m_currentTargetWindow )
|
||||
trackingGlobals->m_currentTargetWindow->MacRootWindowToWindow( &localx, &localy );
|
||||
if ( trackingGlobals->m_currentTarget->OnDrop( localx, localy ) )
|
||||
{
|
||||
// the option key indicates copy in Mac UI, if it's not pressed do
|
||||
// move by default if it's allowed at all
|
||||
wxDragResult
|
||||
result = !(trackingGlobals->m_flags & wxDrag_AllowMove) ||
|
||||
(GetCurrentKeyModifiers() & optionKey)
|
||||
? wxDragCopy
|
||||
: wxDragMove;
|
||||
trackingGlobals->m_result =
|
||||
trackingGlobals->m_currentTarget->OnData( localx, localy, result );
|
||||
}
|
||||
}
|
||||
|
||||
return noErr;
|
||||
}
|
||||
|
||||
#endif // wxUSE_DRAG_AND_DROP
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -1,625 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/osx/carbon/filedlg.cpp
|
||||
// Purpose: wxFileDialog
|
||||
// Author: Stefan Csomor
|
||||
// Modified by:
|
||||
// Created: 1998-01-01
|
||||
// Copyright: (c) Stefan Csomor
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#if wxUSE_FILEDLG
|
||||
|
||||
#include "wx/filedlg.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/intl.h"
|
||||
#include "wx/app.h"
|
||||
#include "wx/utils.h"
|
||||
#include "wx/dialog.h"
|
||||
#endif
|
||||
|
||||
#include "wx/tokenzr.h"
|
||||
#include "wx/filename.h"
|
||||
|
||||
#include "wx/osx/private.h"
|
||||
#include "wx/modalhook.h"
|
||||
|
||||
#ifndef __DARWIN__
|
||||
#include <Navigation.h>
|
||||
#include "PLStringFuncs.h"
|
||||
#endif
|
||||
|
||||
wxIMPLEMENT_CLASS(wxFileDialog, wxFileDialogBase);
|
||||
|
||||
// the data we need to pass to our standard file hook routine
|
||||
// includes a pointer to the dialog, a pointer to the standard
|
||||
// file reply record (so we can inspect the current selection)
|
||||
// and a copy of the "previous" file spec of the reply record
|
||||
// so we can see if the selection has changed
|
||||
|
||||
class OpenUserDataRec
|
||||
{
|
||||
public:
|
||||
OpenUserDataRec( wxFileDialog* dialog );
|
||||
|
||||
bool FilterCallback( AEDesc *theItem, void *info, NavFilterModes filterMode );
|
||||
void EventProc( NavEventCallbackMessage inSelector, NavCBRecPtr ioParams );
|
||||
|
||||
int GetCurrentFilter() const {return m_currentfilter;}
|
||||
CFArrayRef GetMenuItems() const { return m_menuitems;}
|
||||
|
||||
|
||||
private:
|
||||
void EventProcCBEvent( NavCBRecPtr ioParams );
|
||||
void EventProcCBEventMouseDown( NavCBRecPtr ioParams);
|
||||
void EventProcCBStart( NavCBRecPtr ioParams );
|
||||
void EventProcCBPopupMenuSelect( NavCBRecPtr ioParams );
|
||||
void EventProcCBCustomize( NavCBRecPtr ioParams );
|
||||
void EventProcCBAdjustRect( NavCBRecPtr ioParams );
|
||||
bool CheckFile( const wxString &filename , OSType type);
|
||||
void MakeUserDataRec( const wxString& filter);
|
||||
|
||||
wxFileDialog* m_dialog;
|
||||
int m_currentfilter;
|
||||
wxString m_defaultLocation;
|
||||
wxArrayString m_extensions;
|
||||
wxArrayLong m_filtermactypes;
|
||||
CFMutableArrayRef m_menuitems;
|
||||
wxArrayString m_name;
|
||||
bool m_saveMode;
|
||||
SInt16 m_lastRight;
|
||||
SInt16 m_lastBottom;
|
||||
bool m_controlAdded;
|
||||
};
|
||||
|
||||
OpenUserDataRec::OpenUserDataRec( wxFileDialog* d)
|
||||
{
|
||||
m_dialog = d;
|
||||
m_controlAdded = false;
|
||||
m_saveMode = m_dialog->HasFdFlag(wxFD_SAVE);
|
||||
|
||||
m_defaultLocation = m_dialog->GetDirectory();
|
||||
MakeUserDataRec(m_dialog->GetWildcard());
|
||||
m_currentfilter = m_dialog->GetFilterIndex();
|
||||
|
||||
m_menuitems = NULL;
|
||||
|
||||
size_t numFilters = m_extensions.GetCount();
|
||||
if (numFilters)
|
||||
{
|
||||
m_menuitems = CFArrayCreateMutable( kCFAllocatorDefault ,
|
||||
numFilters , &kCFTypeArrayCallBacks ) ;
|
||||
for ( size_t i = 0 ; i < numFilters ; ++i )
|
||||
{
|
||||
CFArrayAppendValue( m_menuitems , (CFStringRef) wxCFStringRef( m_name[i] ) ) ;
|
||||
}
|
||||
}
|
||||
m_lastRight = m_lastBottom = 0;
|
||||
}
|
||||
|
||||
void OpenUserDataRec::EventProc(NavEventCallbackMessage inSelector,NavCBRecPtr ioParams)
|
||||
{
|
||||
switch (inSelector)
|
||||
{
|
||||
case kNavCBEvent:
|
||||
EventProcCBEvent(ioParams);
|
||||
break;
|
||||
case kNavCBStart:
|
||||
EventProcCBStart(ioParams);
|
||||
break;
|
||||
case kNavCBPopupMenuSelect:
|
||||
EventProcCBPopupMenuSelect(ioParams);
|
||||
break;
|
||||
case kNavCBCustomize:
|
||||
EventProcCBCustomize(ioParams);
|
||||
break;
|
||||
case kNavCBAdjustRect:
|
||||
EventProcCBAdjustRect(ioParams);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void OpenUserDataRec::EventProcCBEvent(NavCBRecPtr callBackParms)
|
||||
{
|
||||
switch (callBackParms->eventData.eventDataParms.event->what)
|
||||
{
|
||||
case mouseDown:
|
||||
{
|
||||
EventProcCBEventMouseDown(callBackParms);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OpenUserDataRec::EventProcCBEventMouseDown(NavCBRecPtr callBackParms)
|
||||
{
|
||||
EventRecord *evt = callBackParms->eventData.eventDataParms.event;
|
||||
Point where = evt->where;
|
||||
QDGlobalToLocalPoint(GetWindowPort(callBackParms->window), &where);
|
||||
|
||||
ControlRef whichControl = FindControlUnderMouse(where, callBackParms->window, NULL);
|
||||
if (whichControl != NULL)
|
||||
{
|
||||
ControlKind theKind;
|
||||
GetControlKind(whichControl, &theKind);
|
||||
|
||||
// Moving the focus if we clicked in an focusable control
|
||||
if ((theKind.kind == kControlKindEditUnicodeText) ||
|
||||
(theKind.kind == kControlKindEditText) ||
|
||||
(theKind.kind == kControlKindDataBrowser) ||
|
||||
(theKind.kind == kControlKindListBox))
|
||||
{
|
||||
ControlRef currentlyFocusedControl;
|
||||
GetKeyboardFocus(callBackParms->window, ¤tlyFocusedControl);
|
||||
if (currentlyFocusedControl != whichControl)
|
||||
SetKeyboardFocus(callBackParms->window, whichControl, kControlFocusNextPart);
|
||||
}
|
||||
HandleControlClick(whichControl, where, evt->modifiers, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenUserDataRec::EventProcCBStart(NavCBRecPtr ioParams)
|
||||
{
|
||||
if (!m_defaultLocation.empty())
|
||||
{
|
||||
// Set default location for the modern Navigation APIs
|
||||
// Apple Technical Q&A 1151
|
||||
FSRef theFile;
|
||||
wxMacPathToFSRef(m_defaultLocation, &theFile);
|
||||
AEDesc theLocation = { typeNull, NULL };
|
||||
if (noErr == ::AECreateDesc(typeFSRef, &theFile, sizeof(FSRef), &theLocation))
|
||||
::NavCustomControl(ioParams->context, kNavCtlSetLocation, (void *) &theLocation);
|
||||
}
|
||||
|
||||
if( m_extensions.GetCount() > 0 )
|
||||
{
|
||||
NavMenuItemSpec menuItem;
|
||||
memset( &menuItem, 0, sizeof(menuItem) );
|
||||
menuItem.version = kNavMenuItemSpecVersion;
|
||||
menuItem.menuType = m_currentfilter;
|
||||
::NavCustomControl(ioParams->context, kNavCtlSelectCustomType, &menuItem);
|
||||
}
|
||||
|
||||
if (m_dialog->GetExtraControl())
|
||||
{
|
||||
m_controlAdded = true;
|
||||
ControlRef ref = m_dialog->GetExtraControl()->GetPeer()->GetControlRef();
|
||||
NavCustomControl(ioParams->context, kNavCtlAddControl, ref);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void OpenUserDataRec::EventProcCBPopupMenuSelect(NavCBRecPtr ioParams)
|
||||
{
|
||||
NavMenuItemSpec * menu = (NavMenuItemSpec *) ioParams->eventData.eventDataParms.param ;
|
||||
const size_t numFilters = m_extensions.GetCount();
|
||||
|
||||
if ( menu->menuType < numFilters )
|
||||
{
|
||||
m_currentfilter = menu->menuType ;
|
||||
if ( m_saveMode )
|
||||
{
|
||||
int i = menu->menuType ;
|
||||
|
||||
// isolate the first extension string
|
||||
wxString firstExtension = m_extensions[i].BeforeFirst('|').BeforeFirst(';');
|
||||
|
||||
wxString extension = firstExtension.AfterLast('.') ;
|
||||
wxString sfilename ;
|
||||
|
||||
wxCFStringRef cfString( wxCFRetain( NavDialogGetSaveFileName( ioParams->context ) ) );
|
||||
sfilename = cfString.AsString() ;
|
||||
|
||||
int pos = sfilename.Find('.', true) ;
|
||||
if ( pos != wxNOT_FOUND && extension != wxT("*") )
|
||||
{
|
||||
sfilename = sfilename.Left(pos+1)+extension ;
|
||||
cfString = wxCFStringRef( sfilename , wxFONTENCODING_DEFAULT ) ;
|
||||
NavDialogSetSaveFileName( ioParams->context , cfString ) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OpenUserDataRec::EventProcCBCustomize(NavCBRecPtr ioParams)
|
||||
{
|
||||
wxWindow* control = m_dialog->GetExtraControl();
|
||||
|
||||
if ( control )
|
||||
{
|
||||
SInt16 neededRight, neededBottom;
|
||||
|
||||
wxSize size = m_dialog->GetExtraControl()->GetSize();
|
||||
neededRight = ioParams->customRect.left + size.x;
|
||||
neededBottom = ioParams->customRect.top + size.y;
|
||||
|
||||
if (ioParams->customRect.right == 0 && ioParams->customRect.bottom == 0)
|
||||
{
|
||||
ioParams->customRect.right = neededRight;
|
||||
ioParams->customRect.bottom = neededBottom;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ioParams->customRect.right != m_lastRight )
|
||||
{
|
||||
if ( ioParams->customRect.right < neededRight )
|
||||
ioParams->customRect.right = neededRight;
|
||||
}
|
||||
if ( ioParams->customRect.bottom != m_lastBottom )
|
||||
{
|
||||
if ( ioParams->customRect.bottom < neededBottom )
|
||||
ioParams->customRect.bottom = neededBottom;
|
||||
}
|
||||
}
|
||||
m_lastRight = ioParams->customRect.right;
|
||||
m_lastBottom = ioParams->customRect.bottom;
|
||||
}
|
||||
}
|
||||
|
||||
void OpenUserDataRec::EventProcCBAdjustRect(NavCBRecPtr ioParams)
|
||||
{
|
||||
wxWindow* control = m_dialog->GetExtraControl();
|
||||
|
||||
if ( control && m_controlAdded)
|
||||
{
|
||||
control->SetSize(ioParams->customRect.left , ioParams->customRect.top,
|
||||
ioParams->customRect.right - ioParams->customRect.left,
|
||||
ioParams->customRect.bottom - ioParams->customRect.top);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenUserDataRec::MakeUserDataRec( const wxString& filter )
|
||||
{
|
||||
if ( !filter.empty() )
|
||||
{
|
||||
wxString filter2(filter) ;
|
||||
int filterIndex = 0;
|
||||
bool isName = true ;
|
||||
wxString current ;
|
||||
|
||||
for ( unsigned int i = 0; i < filter2.length() ; i++ )
|
||||
{
|
||||
if ( filter2.GetChar(i) == wxT('|') )
|
||||
{
|
||||
if ( isName )
|
||||
{
|
||||
m_name.Add( current ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_extensions.Add( current ) ;
|
||||
++filterIndex ;
|
||||
}
|
||||
|
||||
isName = !isName ;
|
||||
current = wxEmptyString ;
|
||||
}
|
||||
else
|
||||
{
|
||||
current += filter2.GetChar(i) ;
|
||||
}
|
||||
}
|
||||
// we allow for compatibility reason to have a single filter expression (like *.*) without
|
||||
// an explanatory text, in that case the first part is name and extension at the same time
|
||||
|
||||
wxASSERT_MSG( filterIndex == 0 || !isName , wxT("incorrect format of format string") ) ;
|
||||
if ( current.empty() )
|
||||
m_extensions.Add( m_name[filterIndex] ) ;
|
||||
else
|
||||
m_extensions.Add( current ) ;
|
||||
if ( filterIndex == 0 || isName )
|
||||
m_name.Add( current ) ;
|
||||
|
||||
++filterIndex ;
|
||||
|
||||
const size_t extCount = m_extensions.GetCount();
|
||||
for ( size_t i = 0 ; i < extCount; i++ )
|
||||
{
|
||||
wxUint32 fileType, creator;
|
||||
wxString extension = m_extensions[i];
|
||||
|
||||
// Remove leading '*'
|
||||
if ( !extension.empty() && (extension.GetChar(0) == '*') )
|
||||
extension = extension.Mid( 1 );
|
||||
|
||||
// Remove leading '.'
|
||||
if ( !extension.empty() && (extension.GetChar(0) == '.') )
|
||||
extension = extension.Mid( 1 );
|
||||
|
||||
if (wxFileName::MacFindDefaultTypeAndCreator( extension, &fileType, &creator ))
|
||||
m_filtermactypes.Add( (OSType)fileType );
|
||||
else
|
||||
m_filtermactypes.Add( '****' ); // We'll fail safe if it's not recognized
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool OpenUserDataRec::CheckFile( const wxString &filename , OSType type)
|
||||
{
|
||||
wxString file(filename) ;
|
||||
file.MakeUpper() ;
|
||||
|
||||
if ( m_extensions.GetCount() > 0 )
|
||||
{
|
||||
//for ( int i = 0 ; i < data->numfilters ; ++i )
|
||||
int i = m_currentfilter ;
|
||||
if ( m_extensions[i].Right(2) == wxT(".*") )
|
||||
return true ;
|
||||
|
||||
{
|
||||
if ( type == (OSType)m_filtermactypes[i] )
|
||||
return true ;
|
||||
|
||||
wxStringTokenizer tokenizer( m_extensions[i] , wxT(";") ) ;
|
||||
while ( tokenizer.HasMoreTokens() )
|
||||
{
|
||||
wxString extension = tokenizer.GetNextToken() ;
|
||||
if ( extension.GetChar(0) == '*' )
|
||||
extension = extension.Mid(1) ;
|
||||
extension.MakeUpper();
|
||||
|
||||
if ( file.length() >= extension.length() && extension == file.Right(extension.length() ) )
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
|
||||
return false ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
bool OpenUserDataRec::FilterCallback(
|
||||
AEDesc *theItem,
|
||||
void *info,
|
||||
NavFilterModes filterMode )
|
||||
{
|
||||
if (filterMode == kNavFilteringBrowserList)
|
||||
{
|
||||
// We allow navigation to all folders. For files, we check against the current
|
||||
// filter string.
|
||||
// However, packages should be dealt with like files and not like folders. So
|
||||
// check if a folder is a package before deciding what to do.
|
||||
NavFileOrFolderInfo* theInfo = (NavFileOrFolderInfo*) info ;
|
||||
FSRef fsref;
|
||||
|
||||
if ( theInfo->isFolder )
|
||||
{
|
||||
// check bundle bit (using Finder Services - used by OS9 on some bundles)
|
||||
FSCatalogInfo catalogInfo;
|
||||
if (FSGetCatalogInfo (&fsref, kFSCatInfoFinderInfo, &catalogInfo, NULL, NULL, NULL) != noErr)
|
||||
return true;
|
||||
|
||||
// Check bundle item (using Launch Services - used by OS-X through info.plist or APP)
|
||||
LSItemInfoRecord lsInfo;
|
||||
if (LSCopyItemInfoForRef(&fsref, kLSRequestBasicFlagsOnly, &lsInfo ) != noErr)
|
||||
return true;
|
||||
|
||||
// If it's not a bundle, then it's a normal folder and it passes our filter
|
||||
FileInfo *fileInfo = (FileInfo *) catalogInfo.finderInfo;
|
||||
if ( !(fileInfo->finderFlags & kHasBundle) &&
|
||||
!(lsInfo.flags & (kLSItemInfoIsApplication | kLSItemInfoIsPackage)) )
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
AECoerceDesc (theItem, typeFSRef, theItem);
|
||||
if ( AEGetDescData (theItem, &fsref, sizeof (FSRef)) == noErr)
|
||||
{
|
||||
wxString file = wxMacFSRefToPath( &fsref ) ;
|
||||
return CheckFile( file , theInfo->fileAndFolder.fileInfo.finderInfo.fdType ) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// end wxmac
|
||||
|
||||
pascal Boolean CrossPlatformFilterCallback(
|
||||
AEDesc *theItem,
|
||||
void *info,
|
||||
void *callBackUD,
|
||||
NavFilterModes filterMode );
|
||||
|
||||
pascal Boolean CrossPlatformFilterCallback(
|
||||
AEDesc *theItem,
|
||||
void *info,
|
||||
void *callBackUD,
|
||||
NavFilterModes filterMode )
|
||||
{
|
||||
OpenUserDataRec* data = (OpenUserDataRec*) callBackUD ;
|
||||
return data->FilterCallback(theItem,info,filterMode);
|
||||
}
|
||||
|
||||
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 )
|
||||
{
|
||||
OpenUserDataRec * data = ( OpenUserDataRec *) ioUserData ;
|
||||
data->EventProc(inSelector, ioParams);
|
||||
}
|
||||
|
||||
|
||||
void wxFileDialog::Init()
|
||||
{
|
||||
}
|
||||
|
||||
void wxFileDialog::Create(
|
||||
wxWindow *parent, const wxString& message,
|
||||
const wxString& defaultDir, const wxString& defaultFileName, const wxString& wildCard,
|
||||
long style, const wxPoint& pos, const wxSize& sz, const wxString& name)
|
||||
{
|
||||
wxFileDialogBase::Create(parent, message, defaultDir, defaultFileName, wildCard, style, pos, sz, name);
|
||||
|
||||
wxASSERT_MSG( NavServicesAvailable() , wxT("Navigation Services are not running") ) ;
|
||||
}
|
||||
|
||||
void wxFileDialog::SetupExtraControls(WXWindow nativeWindow)
|
||||
{
|
||||
wxTopLevelWindow::Create( GetParent(), nativeWindow );
|
||||
|
||||
if (HasExtraControlCreator())
|
||||
{
|
||||
CreateExtraControl();
|
||||
}
|
||||
}
|
||||
|
||||
int wxFileDialog::ShowModal()
|
||||
{
|
||||
WX_HOOK_MODAL_DIALOG();
|
||||
|
||||
m_paths.Empty();
|
||||
m_fileNames.Empty();
|
||||
|
||||
OSErr err;
|
||||
NavDialogCreationOptions dialogCreateOptions;
|
||||
|
||||
// set default options
|
||||
::NavGetDefaultDialogCreationOptions(&dialogCreateOptions);
|
||||
|
||||
// this was always unset in the old code
|
||||
dialogCreateOptions.optionFlags &= ~kNavSelectDefaultLocation;
|
||||
|
||||
wxCFStringRef message(m_message, GetFont().GetEncoding());
|
||||
dialogCreateOptions.windowTitle = message;
|
||||
|
||||
wxCFStringRef defaultFileName(m_fileName, GetFont().GetEncoding());
|
||||
dialogCreateOptions.saveFileName = defaultFileName;
|
||||
|
||||
NavDialogRef dialog;
|
||||
NavObjectFilterUPP navFilterUPP = NULL;
|
||||
OpenUserDataRec myData( this );
|
||||
|
||||
dialogCreateOptions.popupExtension = myData.GetMenuItems();
|
||||
|
||||
if (HasFdFlag(wxFD_SAVE))
|
||||
{
|
||||
dialogCreateOptions.optionFlags |= kNavDontAutoTranslate;
|
||||
dialogCreateOptions.optionFlags |= kNavDontAddTranslateItems;
|
||||
if (dialogCreateOptions.popupExtension == NULL)
|
||||
dialogCreateOptions.optionFlags |= kNavNoTypePopup;
|
||||
|
||||
// The extension is important
|
||||
if ( dialogCreateOptions.popupExtension == NULL || CFArrayGetCount(dialogCreateOptions.popupExtension)<2)
|
||||
dialogCreateOptions.optionFlags |= kNavPreserveSaveFileExtension;
|
||||
|
||||
if (!(m_windowStyle & wxFD_OVERWRITE_PROMPT))
|
||||
dialogCreateOptions.optionFlags |= kNavDontConfirmReplacement;
|
||||
|
||||
err = ::NavCreatePutFileDialog(
|
||||
&dialogCreateOptions,
|
||||
kNavGenericSignature, // Suppresses the 'Default' (top) menu item
|
||||
kNavGenericSignature,
|
||||
sStandardNavEventFilter,
|
||||
&myData, // for defaultLocation
|
||||
&dialog );
|
||||
}
|
||||
else
|
||||
{
|
||||
// let the user select bundles/programs in dialogs
|
||||
dialogCreateOptions.optionFlags |= kNavSupportPackages;
|
||||
|
||||
navFilterUPP = NewNavObjectFilterUPP(CrossPlatformFilterCallback);
|
||||
err = ::NavCreateGetFileDialog(
|
||||
&dialogCreateOptions,
|
||||
NULL, // NavTypeListHandle
|
||||
sStandardNavEventFilter,
|
||||
NULL, // NavPreviewUPP
|
||||
navFilterUPP,
|
||||
(void *) &myData, // inClientData
|
||||
&dialog );
|
||||
}
|
||||
|
||||
SetupExtraControls(NavDialogGetWindow(dialog));
|
||||
|
||||
if (err == noErr)
|
||||
{
|
||||
wxDialog::OSXBeginModalDialog();
|
||||
err = ::NavDialogRun(dialog);
|
||||
wxDialog::OSXEndModalDialog();
|
||||
}
|
||||
|
||||
// clean up filter related data, etc.
|
||||
if (navFilterUPP)
|
||||
::DisposeNavObjectFilterUPP(navFilterUPP);
|
||||
|
||||
if (err != noErr)
|
||||
{
|
||||
::NavDialogDispose(dialog);
|
||||
return wxID_CANCEL;
|
||||
}
|
||||
|
||||
NavReplyRecord navReply;
|
||||
err = ::NavDialogGetReply(dialog, &navReply);
|
||||
if (err == noErr && navReply.validRecord)
|
||||
{
|
||||
AEKeyword theKeyword;
|
||||
DescType actualType;
|
||||
Size actualSize;
|
||||
FSRef theFSRef;
|
||||
wxString thePath ;
|
||||
long count;
|
||||
|
||||
m_filterIndex = myData.GetCurrentFilter();
|
||||
::AECountItems( &navReply.selection, &count );
|
||||
for (long i = 1; i <= count; ++i)
|
||||
{
|
||||
err = ::AEGetNthPtr(
|
||||
&(navReply.selection), i, typeFSRef, &theKeyword, &actualType,
|
||||
&theFSRef, sizeof(theFSRef), &actualSize );
|
||||
if (err != noErr)
|
||||
break;
|
||||
|
||||
if (HasFdFlag(wxFD_SAVE))
|
||||
thePath = wxMacFSRefToPath( &theFSRef, navReply.saveFileName );
|
||||
else
|
||||
thePath = wxMacFSRefToPath( &theFSRef );
|
||||
|
||||
if (!thePath)
|
||||
{
|
||||
::NavDisposeReply(&navReply);
|
||||
::NavDialogDispose(dialog);
|
||||
return wxID_CANCEL;
|
||||
}
|
||||
|
||||
m_path = thePath;
|
||||
m_paths.Add(m_path);
|
||||
m_fileName = wxFileNameFromPath(m_path);
|
||||
m_fileNames.Add(m_fileName);
|
||||
}
|
||||
|
||||
// set these to the first hit
|
||||
m_path = m_paths[0];
|
||||
m_fileName = wxFileNameFromPath(m_path);
|
||||
m_dir = wxPathOnly(m_path);
|
||||
}
|
||||
|
||||
UnsubclassWin();
|
||||
::NavDisposeReply(&navReply);
|
||||
::NavDialogDispose(dialog);
|
||||
|
||||
return (err == noErr) ? wxID_OK : wxID_CANCEL;
|
||||
}
|
||||
|
||||
bool wxFileDialog::SupportsExtraControl() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif // wxUSE_FILEDLG
|
||||
|
@@ -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
|
||||
|
@@ -1,443 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/osx/carbon/glcanvas.cpp
|
||||
// Purpose: wxGLCanvas, for using OpenGL with wxWidgets under Macintosh
|
||||
// Author: Stefan Csomor
|
||||
// Modified by:
|
||||
// Created: 1998-01-01
|
||||
// Copyright: (c) Stefan Csomor
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#if defined(__BORLANDC__)
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#if wxUSE_GLCANVAS
|
||||
|
||||
#include "wx/glcanvas.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/frame.h"
|
||||
#include "wx/log.h"
|
||||
#include "wx/settings.h"
|
||||
#endif
|
||||
|
||||
#include "wx/osx/uma.h"
|
||||
|
||||
#include "wx/osx/private.h"
|
||||
#include <AGL/agl.h>
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// helper functions
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
static void wxLogAGLError(const char *func)
|
||||
{
|
||||
const int err = aglGetError();
|
||||
|
||||
wxLogError(_("OpenGL function \"%s\" failed: %s (error %d)"),
|
||||
func, aglErrorString(err), err);
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// low level implementation routines
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WXGLContext WXGLCreateContext( WXGLPixelFormat pixelFormat, WXGLContext shareContext )
|
||||
{
|
||||
WXGLContext context = aglCreateContext(pixelFormat, shareContext);
|
||||
if ( !context )
|
||||
wxLogAGLError("aglCreateContext");
|
||||
return context ;
|
||||
}
|
||||
|
||||
void WXGLDestroyContext( WXGLContext context )
|
||||
{
|
||||
if ( context )
|
||||
{
|
||||
if ( !aglDestroyContext(context) )
|
||||
{
|
||||
wxLogAGLError("aglDestroyContext");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WXGLContext WXGLGetCurrentContext()
|
||||
{
|
||||
return aglGetCurrentContext();
|
||||
}
|
||||
|
||||
bool WXGLSetCurrentContext(WXGLContext context)
|
||||
{
|
||||
if ( !aglSetCurrentContext(context) )
|
||||
{
|
||||
wxLogAGLError("aglSetCurrentContext");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void WXGLDestroyPixelFormat( WXGLPixelFormat pixelFormat )
|
||||
{
|
||||
if ( pixelFormat )
|
||||
{
|
||||
aglDestroyPixelFormat(pixelFormat);
|
||||
}
|
||||
}
|
||||
|
||||
WXGLPixelFormat WXGLChoosePixelFormat(const int *attribList)
|
||||
{
|
||||
GLint data[512];
|
||||
const GLint defaultAttribs[] =
|
||||
{
|
||||
AGL_RGBA,
|
||||
AGL_DOUBLEBUFFER,
|
||||
AGL_MINIMUM_POLICY, // never choose less than requested
|
||||
AGL_DEPTH_SIZE, 1, // use largest available depth buffer
|
||||
AGL_RED_SIZE, 1,
|
||||
AGL_GREEN_SIZE, 1,
|
||||
AGL_BLUE_SIZE, 1,
|
||||
AGL_ALPHA_SIZE, 0,
|
||||
AGL_NONE
|
||||
};
|
||||
|
||||
const GLint *attribs;
|
||||
if ( !attribList )
|
||||
{
|
||||
attribs = defaultAttribs;
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned p = 0;
|
||||
data[p++] = AGL_MINIMUM_POLICY; // make _SIZE tags behave more like GLX
|
||||
|
||||
for ( unsigned arg = 0; attribList[arg] !=0 && p < WXSIZEOF(data); )
|
||||
{
|
||||
switch ( attribList[arg++] )
|
||||
{
|
||||
case WX_GL_RGBA:
|
||||
data[p++] = AGL_RGBA;
|
||||
break;
|
||||
|
||||
case WX_GL_BUFFER_SIZE:
|
||||
data[p++] = AGL_BUFFER_SIZE;
|
||||
data[p++] = attribList[arg++];
|
||||
break;
|
||||
|
||||
case WX_GL_LEVEL:
|
||||
data[p++]=AGL_LEVEL;
|
||||
data[p++]=attribList[arg++];
|
||||
break;
|
||||
|
||||
case WX_GL_DOUBLEBUFFER:
|
||||
data[p++] = AGL_DOUBLEBUFFER;
|
||||
break;
|
||||
|
||||
case WX_GL_STEREO:
|
||||
data[p++] = AGL_STEREO;
|
||||
break;
|
||||
|
||||
case WX_GL_AUX_BUFFERS:
|
||||
data[p++] = AGL_AUX_BUFFERS;
|
||||
data[p++] = attribList[arg++];
|
||||
break;
|
||||
|
||||
case WX_GL_MIN_RED:
|
||||
data[p++] = AGL_RED_SIZE;
|
||||
data[p++] = attribList[arg++];
|
||||
break;
|
||||
|
||||
case WX_GL_MIN_GREEN:
|
||||
data[p++] = AGL_GREEN_SIZE;
|
||||
data[p++] = attribList[arg++];
|
||||
break;
|
||||
|
||||
case WX_GL_MIN_BLUE:
|
||||
data[p++] = AGL_BLUE_SIZE;
|
||||
data[p++] = attribList[arg++];
|
||||
break;
|
||||
|
||||
case WX_GL_MIN_ALPHA:
|
||||
data[p++] = AGL_ALPHA_SIZE;
|
||||
data[p++] = attribList[arg++];
|
||||
break;
|
||||
|
||||
case WX_GL_DEPTH_SIZE:
|
||||
data[p++] = AGL_DEPTH_SIZE;
|
||||
data[p++] = attribList[arg++];
|
||||
break;
|
||||
|
||||
case WX_GL_STENCIL_SIZE:
|
||||
data[p++] = AGL_STENCIL_SIZE;
|
||||
data[p++] = attribList[arg++];
|
||||
break;
|
||||
|
||||
case WX_GL_MIN_ACCUM_RED:
|
||||
data[p++] = AGL_ACCUM_RED_SIZE;
|
||||
data[p++] = attribList[arg++];
|
||||
break;
|
||||
|
||||
case WX_GL_MIN_ACCUM_GREEN:
|
||||
data[p++] = AGL_ACCUM_GREEN_SIZE;
|
||||
data[p++] = attribList[arg++];
|
||||
break;
|
||||
|
||||
case WX_GL_MIN_ACCUM_BLUE:
|
||||
data[p++] = AGL_ACCUM_BLUE_SIZE;
|
||||
data[p++] = attribList[arg++];
|
||||
break;
|
||||
|
||||
case WX_GL_MIN_ACCUM_ALPHA:
|
||||
data[p++] = AGL_ACCUM_ALPHA_SIZE;
|
||||
data[p++] = attribList[arg++];
|
||||
break;
|
||||
|
||||
case WX_GL_SAMPLE_BUFFERS:
|
||||
if ( !wxGLCanvas::IsAGLMultiSampleAvailable() )
|
||||
{
|
||||
if ( !attribList[arg++] )
|
||||
break;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
data[p++] = AGL_SAMPLE_BUFFERS_ARB;
|
||||
if ( (data[p++] = attribList[arg++]) == true )
|
||||
{
|
||||
// don't use software fallback
|
||||
data[p++] = AGL_NO_RECOVERY;
|
||||
}
|
||||
break;
|
||||
|
||||
case WX_GL_SAMPLES:
|
||||
if ( !wxGLCanvas::IsAGLMultiSampleAvailable() )
|
||||
{
|
||||
if ( !attribList[arg++] )
|
||||
break;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
data[p++] = AGL_SAMPLES_ARB;
|
||||
data[p++] = attribList[arg++];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
data[p] = AGL_NONE;
|
||||
|
||||
attribs = data;
|
||||
}
|
||||
|
||||
return aglChoosePixelFormat(NULL, 0, attribs);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxGLContext
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
bool wxGLContext::SetCurrent(const wxGLCanvas& win) const
|
||||
{
|
||||
if ( !m_glContext )
|
||||
return false;
|
||||
|
||||
GLint bufnummer = win.GetAglBufferName();
|
||||
aglSetInteger(m_glContext, AGL_BUFFER_NAME, &bufnummer);
|
||||
//win.SetLastContext(m_glContext);
|
||||
|
||||
const_cast<wxGLCanvas&>(win).SetViewport();
|
||||
|
||||
aglSetWindowRef(m_glContext, win.MacGetTopLevelWindowRef());
|
||||
|
||||
return WXGLSetCurrentContext(m_glContext);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxGLCanvas
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
|
||||
sharing contexts under AGL is not straightforward, to quote from
|
||||
|
||||
http://lists.apple.com/archives/mac-opengl/2003/Jan/msg00402.html :
|
||||
|
||||
In Carbon OpenGL (AGL) you would use call aglSetInteger to setup a
|
||||
buffer name and attached each context to that same name. From AGL
|
||||
you can do:
|
||||
|
||||
GLint id = 1;
|
||||
|
||||
ctx1 = aglCreateContext...
|
||||
aglSetInteger(ctx1, AGL_BUFFER_NAME, &id); // create name
|
||||
aglAttachDrawable (ctx1,...); // create surface with associated with
|
||||
name (first time)
|
||||
ctx2 = aglCreateContext...
|
||||
aglSetInteger(ctx2, AGL_BUFFER_NAME, &id); // uses previously created name
|
||||
aglAttachDrawable (ctx2, ...); // uses existing surface with existing name
|
||||
|
||||
AGL Docs say:
|
||||
AGL_BUFFER_NAME
|
||||
params contains one value: a non-negative integer name of the surface to be
|
||||
associated to be with the current context. If this value is non-zero, and a
|
||||
surface of this name is not associated to this drawable, a new surface with
|
||||
this name is created and associated with the context when
|
||||
aglSetDrawable is called subsequently. If this is a previously allocated
|
||||
buffer name within the namespace of the current window (e.g., drawable),
|
||||
that previously allocated surface is associated with the context (e.g., no
|
||||
new surface is created) and the subsequent call to aglSetDrawable will
|
||||
attach that surface. This allows multiple contexts to be attached to a single
|
||||
surface. Using the default buffer name zero, returns to one surface per
|
||||
context behaviour.
|
||||
*/
|
||||
|
||||
/*
|
||||
so what I'm doing is to have a dummy aglContext attached to a wxGLCanvas,
|
||||
assign it a buffer number
|
||||
*/
|
||||
|
||||
|
||||
bool wxGLCanvas::Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long style,
|
||||
const wxString& name,
|
||||
const int *attribList,
|
||||
const wxPalette& WXUNUSED(palette))
|
||||
{
|
||||
m_needsUpdate = false;
|
||||
m_macCanvasIsShown = false;
|
||||
|
||||
m_glFormat = WXGLChoosePixelFormat(attribList);
|
||||
if ( !m_glFormat )
|
||||
return false;
|
||||
|
||||
if ( !wxWindow::Create(parent, id, pos, size, style, name) )
|
||||
return false;
|
||||
|
||||
m_dummyContext = WXGLCreateContext(m_glFormat, NULL);
|
||||
|
||||
static GLint gCurrentBufferName = 1;
|
||||
m_bufferName = gCurrentBufferName++;
|
||||
aglSetInteger (m_dummyContext, AGL_BUFFER_NAME, &m_bufferName);
|
||||
|
||||
aglSetWindowRef(m_dummyContext, MacGetTopLevelWindowRef());
|
||||
|
||||
m_macCanvasIsShown = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
wxGLCanvas::~wxGLCanvas()
|
||||
{
|
||||
if ( m_glFormat )
|
||||
WXGLDestroyPixelFormat(m_glFormat);
|
||||
|
||||
if ( m_dummyContext )
|
||||
WXGLDestroyContext(m_dummyContext);
|
||||
}
|
||||
|
||||
bool wxGLCanvas::SwapBuffers()
|
||||
{
|
||||
WXGLContext context = WXGLGetCurrentContext();
|
||||
wxCHECK_MSG(context, false, wxT("should have current context"));
|
||||
|
||||
aglSwapBuffers(context);
|
||||
return true;
|
||||
}
|
||||
|
||||
void wxGLCanvas::SetViewport()
|
||||
{
|
||||
if ( !m_needsUpdate )
|
||||
return;
|
||||
|
||||
m_needsUpdate = false;
|
||||
|
||||
// AGLContext context = aglGetCurrentContext();
|
||||
// if ( !context )
|
||||
// return;
|
||||
|
||||
// viewport is initially set to entire port, adjust it to just this window
|
||||
int x = 0,
|
||||
y = 0;
|
||||
MacClientToRootWindow(&x , &y);
|
||||
|
||||
int width, height;
|
||||
GetClientSize(&width, &height);
|
||||
|
||||
Rect bounds;
|
||||
GetWindowPortBounds(MAC_WXHWND(MacGetTopLevelWindowRef()) , &bounds);
|
||||
|
||||
GLint parms[4];
|
||||
parms[0] = x;
|
||||
parms[1] = bounds.bottom - bounds.top - ( y + height );
|
||||
parms[2] = width;
|
||||
parms[3] = height;
|
||||
|
||||
// move the buffer rect out of sight if we're hidden
|
||||
if ( !m_macCanvasIsShown )
|
||||
parms[0] += 20000;
|
||||
|
||||
if ( !aglSetInteger(m_dummyContext, AGL_BUFFER_RECT, parms) )
|
||||
wxLogAGLError("aglSetInteger(AGL_BUFFER_RECT)");
|
||||
|
||||
if ( !aglEnable(m_dummyContext, AGL_BUFFER_RECT) )
|
||||
wxLogAGLError("aglEnable(AGL_BUFFER_RECT)");
|
||||
|
||||
if ( !aglUpdateContext(m_dummyContext) )
|
||||
wxLogAGLError("aglUpdateContext");
|
||||
}
|
||||
|
||||
void wxGLCanvas::OnSize(wxSizeEvent& event)
|
||||
{
|
||||
MacUpdateView();
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void wxGLCanvas::MacUpdateView()
|
||||
{
|
||||
m_needsUpdate = true;
|
||||
Refresh(false);
|
||||
}
|
||||
|
||||
void wxGLCanvas::MacSuperChangedPosition()
|
||||
{
|
||||
MacUpdateView();
|
||||
SetViewport();
|
||||
wxWindow::MacSuperChangedPosition();
|
||||
}
|
||||
|
||||
void wxGLCanvas::MacTopLevelWindowChangedPosition()
|
||||
{
|
||||
MacUpdateView();
|
||||
wxWindow::MacTopLevelWindowChangedPosition();
|
||||
}
|
||||
|
||||
void wxGLCanvas::MacVisibilityChanged()
|
||||
{
|
||||
if ( IsShownOnScreen() != m_macCanvasIsShown )
|
||||
{
|
||||
m_macCanvasIsShown = !m_macCanvasIsShown;
|
||||
MacUpdateView();
|
||||
}
|
||||
|
||||
wxWindowMac::MacVisibilityChanged();
|
||||
}
|
||||
|
||||
#endif // wxUSE_GLCANVAS
|
@@ -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 )
|
||||
|
@@ -1,684 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/osx/carbon/listbox.cpp
|
||||
// Purpose: wxListBox
|
||||
// Author: Stefan Csomor
|
||||
// Modified by:
|
||||
// Created: 1998-01-01
|
||||
// Copyright: (c) Stefan Csomor
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#if wxUSE_LISTBOX
|
||||
|
||||
#include "wx/listbox.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/log.h"
|
||||
#include "wx/intl.h"
|
||||
#include "wx/utils.h"
|
||||
#include "wx/settings.h"
|
||||
#include "wx/arrstr.h"
|
||||
#include "wx/dcclient.h"
|
||||
#endif
|
||||
|
||||
#include "wx/osx/private.h"
|
||||
|
||||
// ============================================================================
|
||||
// list box control implementation
|
||||
// ============================================================================
|
||||
|
||||
wxWidgetImplType* wxWidgetImpl::CreateListBox( wxWindowMac* wxpeer,
|
||||
wxWindowMac* WXUNUSED(parent),
|
||||
wxWindowID WXUNUSED(id),
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long style,
|
||||
long WXUNUSED(extraStyle))
|
||||
{
|
||||
wxMacDataBrowserListControl* control = new wxMacDataBrowserListControl( wxpeer, pos, size, style );
|
||||
// TODO CHECK control->SetClientDataType( m_clientDataItemsType );
|
||||
return control;
|
||||
}
|
||||
|
||||
int wxMacDataBrowserListControl::DoListHitTest(const wxPoint& inpoint) const
|
||||
{
|
||||
OSStatus err;
|
||||
|
||||
// There are few reasons why this is complicated:
|
||||
// 1) There is no native HitTest function for Mac
|
||||
// 2) GetDataBrowserItemPartBounds only works on visible items
|
||||
// 3) We can't do it through GetDataBrowserTableView[Item]RowHeight
|
||||
// because what it returns is basically inaccurate in the context
|
||||
// of the coordinates we want here, but we use this as a guess
|
||||
// for where the first visible item lies
|
||||
|
||||
wxPoint point = inpoint;
|
||||
|
||||
// get column property ID (req. for call to itempartbounds)
|
||||
DataBrowserTableViewColumnID colId = 0;
|
||||
err = GetDataBrowserTableViewColumnProperty(GetControlRef(), 0, &colId);
|
||||
wxCHECK_MSG(err == noErr, wxNOT_FOUND, wxT("Unexpected error from GetDataBrowserTableViewColumnProperty"));
|
||||
|
||||
// OK, first we need to find the first visible item we have -
|
||||
// this will be the "low" for our binary search. There is no real
|
||||
// easy way around this, as we will need to do a SLOW linear search
|
||||
// until we find a visible item, but we can do a cheap calculation
|
||||
// via the row height to speed things up a bit
|
||||
UInt32 scrollx, scrolly;
|
||||
err = GetDataBrowserScrollPosition(GetControlRef(), &scrollx, &scrolly);
|
||||
wxCHECK_MSG(err == noErr, wxNOT_FOUND, wxT("Unexpected error from GetDataBrowserScrollPosition"));
|
||||
|
||||
UInt16 height;
|
||||
err = GetDataBrowserTableViewRowHeight(GetControlRef(), &height);
|
||||
wxCHECK_MSG(err == noErr, wxNOT_FOUND, wxT("Unexpected error from GetDataBrowserTableViewRowHeight"));
|
||||
|
||||
wxListBox *list = wxDynamicCast( GetWXPeer() , wxListBox );
|
||||
|
||||
// these indices are 0-based, as usual, so we need to add 1 to them when
|
||||
// passing them to data browser functions which use 1-based indices
|
||||
int low = scrolly / height,
|
||||
high = list->GetCount() - 1;
|
||||
|
||||
// search for the first visible item (note that the scroll guess above
|
||||
// is the low bounds of where the item might lie so we only use that as a
|
||||
// starting point - we should reach it within 1 or 2 iterations of the loop)
|
||||
while ( low <= high )
|
||||
{
|
||||
Rect bounds;
|
||||
err = GetDataBrowserItemPartBounds(
|
||||
GetControlRef(), low + 1, colId,
|
||||
kDataBrowserPropertyEnclosingPart,
|
||||
&bounds); // note +1 to translate to Mac ID
|
||||
if ( err == noErr )
|
||||
break;
|
||||
|
||||
// errDataBrowserItemNotFound is expected as it simply means that the
|
||||
// item is not currently visible -- but other errors are not
|
||||
wxCHECK_MSG( err == errDataBrowserItemNotFound, wxNOT_FOUND,
|
||||
wxT("Unexpected error from GetDataBrowserItemPartBounds") );
|
||||
|
||||
low++;
|
||||
}
|
||||
|
||||
// NOW do a binary search for where the item lies, searching low again if
|
||||
// we hit an item that isn't visible
|
||||
while ( low <= high )
|
||||
{
|
||||
int mid = (low + high) / 2;
|
||||
|
||||
Rect bounds;
|
||||
err = GetDataBrowserItemPartBounds(
|
||||
GetControlRef(), mid + 1, colId,
|
||||
kDataBrowserPropertyEnclosingPart,
|
||||
&bounds); //note +1 to trans to mac id
|
||||
wxCHECK_MSG( err == noErr || err == errDataBrowserItemNotFound,
|
||||
wxNOT_FOUND,
|
||||
wxT("Unexpected error from GetDataBrowserItemPartBounds") );
|
||||
|
||||
if ( err == errDataBrowserItemNotFound )
|
||||
{
|
||||
// item not visible, attempt to find a visible one
|
||||
// search lower
|
||||
high = mid - 1;
|
||||
}
|
||||
else // visible item, do actual hitttest
|
||||
{
|
||||
// if point is within the bounds, return this item (since we assume
|
||||
// all x coords of items are equal we only test the x coord in
|
||||
// equality)
|
||||
if ((point.x >= bounds.left && point.x <= bounds.right) &&
|
||||
(point.y >= bounds.top && point.y <= bounds.bottom) )
|
||||
{
|
||||
// found!
|
||||
return mid;
|
||||
}
|
||||
|
||||
if ( point.y < bounds.top )
|
||||
// index(bounds) greater than key(point)
|
||||
high = mid - 1;
|
||||
else
|
||||
// index(bounds) less than key(point)
|
||||
low = mid + 1;
|
||||
}
|
||||
}
|
||||
|
||||
return wxNOT_FOUND;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// data browser based implementation
|
||||
// ============================================================================
|
||||
|
||||
wxMacListBoxItem::wxMacListBoxItem()
|
||||
:wxMacDataItem()
|
||||
{
|
||||
}
|
||||
|
||||
wxMacListBoxItem::~wxMacListBoxItem()
|
||||
{
|
||||
}
|
||||
|
||||
OSStatus wxMacListBoxItem::GetSetData(wxMacDataItemBrowserControl *owner ,
|
||||
DataBrowserPropertyID property,
|
||||
DataBrowserItemDataRef itemData,
|
||||
bool changeValue )
|
||||
{
|
||||
wxMacDataBrowserListControl *lb = wxDynamicCast(owner,wxMacDataBrowserListControl);
|
||||
OSStatus err = errDataBrowserPropertyNotSupported;
|
||||
if ( !changeValue )
|
||||
{
|
||||
if ( property >= kMinColumnId )
|
||||
{
|
||||
wxMacDataBrowserColumn* col = lb->GetColumnFromProperty( property );
|
||||
unsigned int n = owner->GetLineFromItem( this );
|
||||
wxListBox *list = wxDynamicCast( owner->GetWXPeer() , wxListBox );
|
||||
wxMacDataBrowserCellValue valueholder(itemData);
|
||||
list->GetValueCallback( n , col, valueholder );
|
||||
|
||||
err = noErr;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( property == kDataBrowserItemIsEditableProperty )
|
||||
{
|
||||
DataBrowserPropertyID propertyToEdit ;
|
||||
GetDataBrowserItemDataProperty( itemData, &propertyToEdit );
|
||||
wxMacDataBrowserColumn* col = lb->GetColumnFromProperty( propertyToEdit );
|
||||
|
||||
verify_noerr(SetDataBrowserItemDataBooleanValue( itemData, col->IsEditable() ));
|
||||
err = noErr;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( property >= kMinColumnId )
|
||||
{
|
||||
wxMacDataBrowserColumn* col = lb->GetColumnFromProperty( property );
|
||||
|
||||
unsigned int n = owner->GetLineFromItem( this );
|
||||
wxListBox *list = wxDynamicCast( owner->GetWXPeer() , wxListBox );
|
||||
wxMacDataBrowserCellValue valueholder(itemData);
|
||||
list->SetValueCallback( n , col, valueholder );
|
||||
|
||||
/*
|
||||
// we have to change this behind the back, since Check() would be triggering another update round
|
||||
bool newVal = !m_isChecked;
|
||||
verify_noerr(SetDataBrowserItemDataButtonValue( itemData, newVal ? kThemeButtonOn : kThemeButtonOff ));
|
||||
m_isChecked = newVal;
|
||||
err = noErr;
|
||||
|
||||
wxCommandEvent event( wxEVT_CHECKLISTBOX, checklist->GetId() );
|
||||
event.SetInt( owner->GetLineFromItem( this ) );
|
||||
event.SetEventObject( checklist );
|
||||
checklist->HandleWindowEvent( event );
|
||||
|
||||
*/
|
||||
err = noErr;
|
||||
}
|
||||
}
|
||||
|
||||
// call inherited if not ours
|
||||
if ( err == errDataBrowserPropertyNotSupported )
|
||||
{
|
||||
err = wxMacDataItem::GetSetData(owner, property, itemData, changeValue);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
void wxMacListBoxItem::Notification(wxMacDataItemBrowserControl *owner ,
|
||||
DataBrowserItemNotification message,
|
||||
DataBrowserItemDataRef WXUNUSED(itemData) ) const
|
||||
{
|
||||
wxMacDataBrowserListControl *lb = wxDynamicCast(owner,wxMacDataBrowserListControl);
|
||||
|
||||
// we want to depend on as little as possible to make sure tear-down of controls is safe
|
||||
|
||||
if ( message == kDataBrowserItemRemoved)
|
||||
{
|
||||
delete this;
|
||||
return;
|
||||
}
|
||||
|
||||
wxListBox *list = wxDynamicCast( lb->GetWXPeer() , wxListBox );
|
||||
wxCHECK_RET( list != NULL , wxT("Listbox expected"));
|
||||
|
||||
if (message == kDataBrowserItemDoubleClicked)
|
||||
{
|
||||
unsigned int n = owner->GetLineFromItem( this );
|
||||
list->HandleLineEvent( n, true );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
wxIMPLEMENT_DYNAMIC_CLASS(wxMacDataBrowserListControl, wxMacDataItemBrowserControl);
|
||||
|
||||
wxMacDataBrowserListControl::wxMacDataBrowserListControl( wxWindow *peer, const wxPoint& pos, const wxSize& size, long style)
|
||||
: wxMacDataItemBrowserControl( peer, pos, size, style )
|
||||
{
|
||||
m_nextColumnId = 0 ;
|
||||
|
||||
OSStatus err = noErr;
|
||||
m_clientDataItemsType = wxClientData_None;
|
||||
if ( style & wxLB_SORT )
|
||||
m_sortOrder = SortOrder_Text_Ascending;
|
||||
|
||||
DataBrowserSelectionFlags options = kDataBrowserDragSelect;
|
||||
if ( style & wxLB_MULTIPLE )
|
||||
{
|
||||
options |= kDataBrowserAlwaysExtendSelection | kDataBrowserCmdTogglesSelection;
|
||||
}
|
||||
else if ( style & wxLB_EXTENDED )
|
||||
{
|
||||
options |= kDataBrowserCmdTogglesSelection;
|
||||
}
|
||||
else
|
||||
{
|
||||
options |= kDataBrowserSelectOnlyOne;
|
||||
}
|
||||
err = SetSelectionFlags( options );
|
||||
verify_noerr( err );
|
||||
|
||||
DataBrowserListViewColumnDesc columnDesc;
|
||||
columnDesc.headerBtnDesc.titleOffset = 0;
|
||||
columnDesc.headerBtnDesc.version = kDataBrowserListViewLatestHeaderDesc;
|
||||
|
||||
columnDesc.headerBtnDesc.btnFontStyle.flags =
|
||||
kControlUseFontMask | kControlUseJustMask;
|
||||
|
||||
columnDesc.headerBtnDesc.btnContentInfo.contentType = kControlNoContent;
|
||||
columnDesc.headerBtnDesc.btnFontStyle.just = teFlushDefault;
|
||||
columnDesc.headerBtnDesc.btnFontStyle.font = kControlFontViewSystemFont;
|
||||
columnDesc.headerBtnDesc.btnFontStyle.style = normal;
|
||||
columnDesc.headerBtnDesc.titleString = NULL;
|
||||
/*
|
||||
columnDesc.headerBtnDesc.minimumWidth = 0;
|
||||
columnDesc.headerBtnDesc.maximumWidth = 10000;
|
||||
|
||||
columnDesc.propertyDesc.propertyID = kTextColumnId;
|
||||
columnDesc.propertyDesc.propertyType = kDataBrowserTextType;
|
||||
columnDesc.propertyDesc.propertyFlags = kDataBrowserTableViewSelectionColumn;
|
||||
columnDesc.propertyDesc.propertyFlags |= kDataBrowserListViewTypeSelectColumn;
|
||||
|
||||
verify_noerr( AddColumn( &columnDesc, kDataBrowserListViewAppendColumn ) );
|
||||
*/
|
||||
columnDesc.headerBtnDesc.minimumWidth = 0;
|
||||
columnDesc.headerBtnDesc.maximumWidth = 0;
|
||||
columnDesc.propertyDesc.propertyID = kNumericOrderColumnId;
|
||||
columnDesc.propertyDesc.propertyType = kDataBrowserPropertyRelevanceRankPart;
|
||||
columnDesc.propertyDesc.propertyFlags = kDataBrowserTableViewSelectionColumn;
|
||||
columnDesc.propertyDesc.propertyFlags |= kDataBrowserListViewTypeSelectColumn;
|
||||
|
||||
verify_noerr( AddColumn( &columnDesc, kDataBrowserListViewAppendColumn ) );
|
||||
|
||||
/*
|
||||
SetDataBrowserSortProperty( m_controlRef , kTextColumnId);
|
||||
if ( m_sortOrder == SortOrder_Text_Ascending )
|
||||
{
|
||||
SetDataBrowserSortProperty( m_controlRef , kTextColumnId);
|
||||
SetDataBrowserSortOrder( m_controlRef , kDataBrowserOrderIncreasing);
|
||||
}
|
||||
else
|
||||
*/
|
||||
{
|
||||
SetDataBrowserSortProperty( m_controlRef , kNumericOrderColumnId);
|
||||
SetDataBrowserSortOrder( m_controlRef , kDataBrowserOrderIncreasing);
|
||||
}
|
||||
|
||||
verify_noerr( AutoSizeColumns() );
|
||||
verify_noerr( SetHiliteStyle(kDataBrowserTableViewFillHilite ) );
|
||||
verify_noerr( SetHeaderButtonHeight( 0 ) );
|
||||
err = SetHasScrollBars( (style & wxHSCROLL) != 0 , true );
|
||||
#if 0
|
||||
// shouldn't be necessary anymore under 10.2
|
||||
GetPeer()->SetData( kControlNoPart, kControlDataBrowserIncludesFrameAndFocusTag, (Boolean)false );
|
||||
GetPeer()->SetNeedsFocusRect( true );
|
||||
#endif
|
||||
}
|
||||
|
||||
wxMacDataBrowserListControl::~wxMacDataBrowserListControl()
|
||||
{
|
||||
}
|
||||
|
||||
void wxMacDataBrowserListControl::ItemNotification(
|
||||
DataBrowserItemID itemID,
|
||||
DataBrowserItemNotification message,
|
||||
DataBrowserItemDataRef itemData)
|
||||
{
|
||||
wxListBox *list = wxDynamicCast( GetWXPeer() , wxListBox );
|
||||
wxCHECK_RET( list != NULL , wxT("Listbox expected"));
|
||||
|
||||
if (list->HasMultipleSelection() && (message == kDataBrowserSelectionSetChanged) && (!list->MacGetBlockEvents()))
|
||||
{
|
||||
list->CalcAndSendEvent();
|
||||
return;
|
||||
}
|
||||
|
||||
if ((message == kDataBrowserSelectionSetChanged) && (!list->MacGetBlockEvents()))
|
||||
{
|
||||
wxCommandEvent event( wxEVT_LISTBOX, list->GetId() );
|
||||
|
||||
int sel = list->GetSelection();
|
||||
if ((sel < 0) || (sel > (int) list->GetCount())) // OS X can select an item below the last item (why?)
|
||||
return;
|
||||
list->HandleLineEvent( sel, false );
|
||||
return;
|
||||
}
|
||||
|
||||
// call super for item level(wxMacDataItem->Notification) callback processing
|
||||
wxMacDataItemBrowserControl::ItemNotification( itemID, message, itemData);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
wxWindow * wxMacDataBrowserListControl::GetPeer() const
|
||||
{
|
||||
return wxDynamicCast( wxMacControl::GetWX() , wxWindow );
|
||||
}
|
||||
*/
|
||||
|
||||
//
|
||||
// List Methods
|
||||
//
|
||||
|
||||
wxMacDataBrowserColumn* wxMacDataBrowserListControl::DoInsertColumn( unsigned int pos, DataBrowserPropertyID property,
|
||||
const wxString& title, bool editable,
|
||||
DataBrowserPropertyType colType, SInt16 just, int width )
|
||||
{
|
||||
DataBrowserListViewColumnDesc columnDesc;
|
||||
columnDesc.headerBtnDesc.titleOffset = 0;
|
||||
columnDesc.headerBtnDesc.version = kDataBrowserListViewLatestHeaderDesc;
|
||||
|
||||
columnDesc.headerBtnDesc.btnFontStyle.flags =
|
||||
kControlUseFontMask | kControlUseJustMask;
|
||||
|
||||
columnDesc.headerBtnDesc.btnContentInfo.contentType = kControlContentTextOnly;
|
||||
columnDesc.headerBtnDesc.btnFontStyle.just = just;
|
||||
columnDesc.headerBtnDesc.btnFontStyle.font = kControlFontViewSystemFont;
|
||||
columnDesc.headerBtnDesc.btnFontStyle.style = normal;
|
||||
|
||||
// TODO: Why is m_font not defined when we enter wxLC_LIST mode, but is
|
||||
// defined for other modes?
|
||||
wxFontEncoding enc;
|
||||
if ( m_font.IsOk() )
|
||||
enc = m_font.GetEncoding();
|
||||
else
|
||||
enc = wxLocale::GetSystemEncoding();
|
||||
wxCFStringRef cfTitle( title, enc );
|
||||
columnDesc.headerBtnDesc.titleString = cfTitle;
|
||||
|
||||
columnDesc.headerBtnDesc.minimumWidth = 0;
|
||||
columnDesc.headerBtnDesc.maximumWidth = 30000;
|
||||
|
||||
columnDesc.propertyDesc.propertyID = property;
|
||||
columnDesc.propertyDesc.propertyType = colType;
|
||||
columnDesc.propertyDesc.propertyFlags = kDataBrowserListViewSortableColumn;
|
||||
columnDesc.propertyDesc.propertyFlags |= kDataBrowserListViewTypeSelectColumn;
|
||||
columnDesc.propertyDesc.propertyFlags |= kDataBrowserListViewNoGapForIconInHeaderButton;
|
||||
|
||||
if ( editable )
|
||||
columnDesc.propertyDesc.propertyFlags |= kDataBrowserPropertyIsMutable;
|
||||
|
||||
verify_noerr( AddColumn( &columnDesc, pos ) );
|
||||
|
||||
if (width > 0)
|
||||
{
|
||||
wxMacDataBrowserControl::SetColumnWidth(property, width);
|
||||
}
|
||||
|
||||
wxMacDataBrowserColumn *col = new wxMacDataBrowserColumn( property, colType, editable );
|
||||
|
||||
m_columns.Insert( col, pos );
|
||||
|
||||
return col;
|
||||
}
|
||||
|
||||
wxListWidgetColumn* wxMacDataBrowserListControl::InsertTextColumn( unsigned pos, const wxString& title, bool editable,
|
||||
wxAlignment just, int defaultWidth)
|
||||
{
|
||||
DataBrowserPropertyID property = kMinColumnId + m_nextColumnId++;
|
||||
|
||||
SInt16 j = teFlushLeft;
|
||||
if ( just & wxALIGN_RIGHT )
|
||||
j = teFlushRight;
|
||||
else if ( just & wxALIGN_CENTER_HORIZONTAL )
|
||||
j = teCenter;
|
||||
|
||||
return DoInsertColumn( pos, property, title, editable, kDataBrowserTextType, just, defaultWidth );
|
||||
}
|
||||
|
||||
wxListWidgetColumn* wxMacDataBrowserListControl::InsertCheckColumn( unsigned pos , const wxString& title, bool editable,
|
||||
wxAlignment just, int defaultWidth )
|
||||
{
|
||||
DataBrowserPropertyID property = kMinColumnId + m_nextColumnId++;
|
||||
|
||||
SInt16 j = teFlushLeft;
|
||||
if ( just & wxALIGN_RIGHT )
|
||||
j = teFlushRight;
|
||||
else if ( just & wxALIGN_CENTER_HORIZONTAL )
|
||||
j = teCenter;
|
||||
|
||||
return DoInsertColumn( pos, property, title, editable, kDataBrowserCheckboxType, just, defaultWidth );
|
||||
}
|
||||
|
||||
wxMacDataBrowserColumn* wxMacDataBrowserListControl::GetColumnFromProperty( DataBrowserPropertyID property)
|
||||
{
|
||||
for ( unsigned int i = 0; i < m_columns.size() ; ++ i )
|
||||
if ( m_columns[i]->GetProperty() == property )
|
||||
return m_columns[i];
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
wxMacDataItem* wxMacDataBrowserListControl::ListGetLineItem( unsigned int n )
|
||||
{
|
||||
return (wxMacDataItem*) GetItemFromLine(n);
|
||||
}
|
||||
*/
|
||||
|
||||
unsigned int wxMacDataBrowserListControl::ListGetCount() const
|
||||
{
|
||||
return MacGetCount();
|
||||
}
|
||||
|
||||
void wxMacDataBrowserListControl::ListDelete( unsigned int n )
|
||||
{
|
||||
MacDelete( n );
|
||||
}
|
||||
|
||||
void wxMacDataBrowserListControl::ListInsert( unsigned int n )
|
||||
{
|
||||
MacInsert( n , new wxMacListBoxItem() );
|
||||
}
|
||||
|
||||
void wxMacDataBrowserListControl::ListClear()
|
||||
{
|
||||
MacClear();
|
||||
}
|
||||
|
||||
void wxMacDataBrowserListControl::ListDeselectAll()
|
||||
{
|
||||
wxMacDataItemBrowserSelectionSuppressor suppressor(this);
|
||||
SetSelectedAllItems( kDataBrowserItemsRemove );
|
||||
}
|
||||
|
||||
void wxMacDataBrowserListControl::ListSetSelection( unsigned int n, bool select, bool multi )
|
||||
{
|
||||
wxMacDataItem* item = (wxMacDataItem*) GetItemFromLine(n);
|
||||
wxMacDataItemBrowserSelectionSuppressor suppressor(this);
|
||||
|
||||
if ( IsItemSelected( item ) != select )
|
||||
{
|
||||
if ( select )
|
||||
SetSelectedItem( item, multi ? kDataBrowserItemsAdd : kDataBrowserItemsAssign );
|
||||
else
|
||||
SetSelectedItem( item, kDataBrowserItemsRemove );
|
||||
}
|
||||
|
||||
ListScrollTo( n );
|
||||
}
|
||||
|
||||
bool wxMacDataBrowserListControl::ListIsSelected( unsigned int n ) const
|
||||
{
|
||||
wxMacDataItem* item = (wxMacDataItem*) GetItemFromLine(n);
|
||||
return IsItemSelected( item );
|
||||
}
|
||||
|
||||
int wxMacDataBrowserListControl::ListGetSelection() const
|
||||
{
|
||||
wxMacDataItemPtr first, last;
|
||||
GetSelectionAnchor( &first, &last );
|
||||
|
||||
if ( first != NULL )
|
||||
{
|
||||
return GetLineFromItem( first );
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int wxMacDataBrowserListControl::ListGetSelections( wxArrayInt& aSelections ) const
|
||||
{
|
||||
aSelections.Empty();
|
||||
wxArrayMacDataItemPtr selectedItems;
|
||||
GetItems( wxMacDataBrowserRootContainer, false , kDataBrowserItemIsSelected, selectedItems);
|
||||
|
||||
int count = selectedItems.GetCount();
|
||||
|
||||
for ( int i = 0; i < count; ++i)
|
||||
{
|
||||
aSelections.Add(GetLineFromItem(selectedItems[i]));
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
void wxMacDataBrowserListControl::ListScrollTo( unsigned int n )
|
||||
{
|
||||
UInt32 top , left ;
|
||||
GetScrollPosition( &top , &left ) ;
|
||||
wxMacDataItem * item = (wxMacDataItem*) GetItemFromLine( n );
|
||||
|
||||
// there is a bug in RevealItem that leads to situations
|
||||
// in large lists, where the item does not get scrolled
|
||||
// into sight, so we do a pre-scroll if necessary
|
||||
UInt16 height ;
|
||||
GetRowHeight( (DataBrowserItemID) item , &height ) ;
|
||||
UInt32 linetop = n * ((UInt32) height );
|
||||
UInt32 linebottom = linetop + height;
|
||||
Rect rect ;
|
||||
GetControlBounds( m_controlRef, &rect );
|
||||
|
||||
if ( linetop < top || linebottom > (top + rect.bottom - rect.top ) )
|
||||
SetScrollPosition( wxMax( n-2, 0 ) * ((UInt32)height) , left ) ;
|
||||
|
||||
RevealItem( item , kDataBrowserRevealWithoutSelecting );
|
||||
}
|
||||
|
||||
void wxMacDataBrowserListControl::UpdateLine( unsigned int n, wxListWidgetColumn* col )
|
||||
{
|
||||
wxMacDataBrowserColumn* dbcol = dynamic_cast<wxMacDataBrowserColumn*> (col);
|
||||
wxMacDataItem * item = (wxMacDataItem*) GetItemFromLine( n );
|
||||
UpdateItem(wxMacDataBrowserRootContainer, item, dbcol ? dbcol->GetProperty() : kDataBrowserNoItem );
|
||||
}
|
||||
|
||||
void wxMacDataBrowserListControl::UpdateLineToEnd( unsigned int n)
|
||||
{
|
||||
// with databrowser inserting does not need updating the entire model, it's done by databrowser itself
|
||||
wxMacDataItem * item = (wxMacDataItem*) GetItemFromLine( n );
|
||||
UpdateItem(wxMacDataBrowserRootContainer, item, kDataBrowserNoItem );
|
||||
}
|
||||
|
||||
// value setters
|
||||
|
||||
void wxMacDataBrowserCellValue::Set( CFStringRef value )
|
||||
{
|
||||
SetDataBrowserItemDataText( m_data, value );
|
||||
}
|
||||
|
||||
void wxMacDataBrowserCellValue::Set( const wxString& value )
|
||||
{
|
||||
wxCFStringRef cf(value);
|
||||
SetDataBrowserItemDataText( m_data, (CFStringRef) cf);
|
||||
}
|
||||
|
||||
void wxMacDataBrowserCellValue::Set( int value )
|
||||
{
|
||||
SetDataBrowserItemDataValue( m_data, value );
|
||||
}
|
||||
|
||||
void wxMacDataBrowserCellValue::Check( bool check )
|
||||
{
|
||||
SetDataBrowserItemDataButtonValue( m_data, check ? kThemeButtonOn : kThemeButtonOff);
|
||||
}
|
||||
|
||||
int wxMacDataBrowserCellValue::GetIntValue() const
|
||||
{
|
||||
SInt32 value;
|
||||
GetDataBrowserItemDataValue( m_data, &value );
|
||||
return value;
|
||||
}
|
||||
|
||||
wxString wxMacDataBrowserCellValue::GetStringValue() const
|
||||
{
|
||||
CFStringRef value;
|
||||
GetDataBrowserItemDataText ( m_data, &value );
|
||||
wxCFStringRef cf(value);
|
||||
return cf.AsString();
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
// in case we need that one day
|
||||
|
||||
// ============================================================================
|
||||
// HIView owner-draw-based implementation
|
||||
// ============================================================================
|
||||
|
||||
static pascal void ListBoxDrawProc(
|
||||
ControlRef browser, DataBrowserItemID item, DataBrowserPropertyID property,
|
||||
DataBrowserItemState itemState, const Rect *itemRect, SInt16 depth, Boolean isColorDevice )
|
||||
{
|
||||
CFStringRef cfString;
|
||||
ThemeDrawingState themeState;
|
||||
long systemVersion;
|
||||
|
||||
GetThemeDrawingState( &themeState );
|
||||
cfString = CFStringCreateWithFormat( NULL, NULL, CFSTR("Row %d"), item );
|
||||
|
||||
// In this sample we handle the "selected" state; all others fall through to our "active" state
|
||||
if ( itemState == kDataBrowserItemIsSelected )
|
||||
{
|
||||
ThemeBrush colorBrushID;
|
||||
|
||||
// TODO: switch over to wxSystemSettingsNative::GetColour() when kThemeBrushSecondaryHighlightColor
|
||||
// is incorporated Panther DB starts using kThemeBrushSecondaryHighlightColor
|
||||
// for inactive browser highlighting
|
||||
if ( !IsControlActive( browser ) )
|
||||
colorBrushID = kThemeBrushSecondaryHighlightColor;
|
||||
else
|
||||
colorBrushID = kThemeBrushPrimaryHighlightColor;
|
||||
|
||||
// First paint the hilite rect, then the text on top
|
||||
SetThemePen( colorBrushID, 32, true );
|
||||
PaintRect( itemRect );
|
||||
SetThemeDrawingState( themeState, false );
|
||||
}
|
||||
|
||||
DrawThemeTextBox( cfString, kThemeApplicationFont, kThemeStateActive, true, itemRect, teFlushDefault, NULL );
|
||||
SetThemeDrawingState( themeState, true );
|
||||
|
||||
if ( cfString != NULL )
|
||||
CFRelease( cfString );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif // wxUSE_LISTBOX
|
File diff suppressed because it is too large
Load Diff
@@ -45,31 +45,7 @@ static const int IDM_WINDOWTILEVERT = 4005;
|
||||
|
||||
void UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate )
|
||||
{
|
||||
#if wxOSX_USE_CARBON // TODO REMOVE
|
||||
if ( inWindowRef )
|
||||
{
|
||||
// bool isHighlighted = IsWindowHighlited( inWindowRef ) ;
|
||||
// if ( inActivate != isHighlighted )
|
||||
#ifndef __LP64__
|
||||
GrafPtr port ;
|
||||
GetPort( &port ) ;
|
||||
SetPortWindowPort( inWindowRef ) ;
|
||||
#endif
|
||||
HiliteWindow( inWindowRef , inActivate ) ;
|
||||
ControlRef control = NULL ;
|
||||
::GetRootControl( inWindowRef , &control ) ;
|
||||
if ( control )
|
||||
{
|
||||
if ( inActivate )
|
||||
::ActivateControl( control ) ;
|
||||
else
|
||||
::DeactivateControl( control ) ;
|
||||
}
|
||||
#ifndef __LP64__
|
||||
SetPort( port ) ;
|
||||
#endif
|
||||
}
|
||||
#elif defined(wxOSX_USE_COCOA)
|
||||
#if defined(wxOSX_USE_COCOA)
|
||||
wxUnusedVar(inActivate);
|
||||
wxUnusedVar(inWindowRef);
|
||||
// TODO: implement me!
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,436 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/osx/carbon/menu.cpp
|
||||
// Purpose: wxMenu, wxMenuBar, wxMenuItem
|
||||
// Author: Stefan Csomor
|
||||
// Modified by:
|
||||
// Created: 1998-01-01
|
||||
// Copyright: (c) Stefan Csomor
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// headers & declarations
|
||||
// ============================================================================
|
||||
|
||||
// wxWidgets headers
|
||||
// -----------------
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#include "wx/menu.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/log.h"
|
||||
#include "wx/app.h"
|
||||
#include "wx/utils.h"
|
||||
#include "wx/frame.h"
|
||||
#include "wx/menuitem.h"
|
||||
#endif
|
||||
|
||||
#include "wx/osx/private.h"
|
||||
#include "wx/stockitem.h"
|
||||
|
||||
// other standard headers
|
||||
// ----------------------
|
||||
#include <string.h>
|
||||
|
||||
// under carbon there's no such thing as a MenuItemRef, everything is done
|
||||
// on the 'parent' menu via index APIs (first line having index 1 !)
|
||||
// so to make things still work, we store the wxMenuItemImpl instance as a
|
||||
// RefCon at the respective menu line
|
||||
|
||||
class wxMenuItemCarbonImpl : public wxMenuItemImpl
|
||||
{
|
||||
public :
|
||||
wxMenuItemCarbonImpl( wxMenuItem* peer ) : wxMenuItemImpl(peer)
|
||||
{
|
||||
// the parent menu ref is only set, once the item has been attached
|
||||
m_parentMenuRef = NULL;
|
||||
}
|
||||
|
||||
~wxMenuItemCarbonImpl();
|
||||
|
||||
void SetBitmap( const wxBitmap& bitmap )
|
||||
{
|
||||
MenuItemIndex i = FindMenuItemIndex() ;
|
||||
if ( i > 0 )
|
||||
{
|
||||
if ( bitmap.IsOk() )
|
||||
{
|
||||
#if wxUSE_BMPBUTTON
|
||||
ControlButtonContentInfo info ;
|
||||
wxMacCreateBitmapButton( &info , bitmap ) ;
|
||||
if ( info.contentType != kControlNoContent )
|
||||
{
|
||||
if ( info.contentType == kControlContentIconRef )
|
||||
SetMenuItemIconHandle( m_parentMenuRef, i ,
|
||||
kMenuIconRefType , (Handle) info.u.iconRef ) ;
|
||||
else if ( info.contentType == kControlContentCGImageRef )
|
||||
SetMenuItemIconHandle( m_parentMenuRef, i ,
|
||||
kMenuCGImageRefType , (Handle) info.u.imageRef ) ;
|
||||
}
|
||||
wxMacReleaseBitmapButton( &info ) ;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Enable( bool enable )
|
||||
{
|
||||
MenuItemIndex i = FindMenuItemIndex() ;
|
||||
if ( i > 0 )
|
||||
{
|
||||
|
||||
if ( GetWXPeer()->GetId() == wxApp::s_macPreferencesMenuItemId)
|
||||
{
|
||||
if ( enable )
|
||||
EnableMenuCommand( NULL , kHICommandPreferences ) ;
|
||||
else
|
||||
DisableMenuCommand( NULL , kHICommandPreferences ) ;
|
||||
}
|
||||
else if ( GetWXPeer()->GetId() == wxApp::s_macExitMenuItemId)
|
||||
{
|
||||
if ( enable )
|
||||
EnableMenuCommand( NULL , kHICommandQuit ) ;
|
||||
else
|
||||
DisableMenuCommand( NULL , kHICommandQuit ) ;
|
||||
}
|
||||
|
||||
if ( enable )
|
||||
EnableMenuItem(m_parentMenuRef , i);
|
||||
else
|
||||
DisableMenuItem(m_parentMenuRef , i);
|
||||
|
||||
if ( GetWXPeer()->IsSubMenu() )
|
||||
{
|
||||
UMAEnableMenuItem( GetWXPeer()->GetSubMenu()->GetHMenu() , 0 , enable ) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Check( bool check )
|
||||
{
|
||||
MenuItemIndex i = FindMenuItemIndex() ;
|
||||
if ( i > 0 )
|
||||
{
|
||||
if ( check )
|
||||
::SetItemMark( m_parentMenuRef, i, 0x12 ) ; // checkmark
|
||||
else
|
||||
::SetItemMark( m_parentMenuRef, i, 0 ) ; // no mark
|
||||
}
|
||||
}
|
||||
|
||||
void Hide( bool hide )
|
||||
{
|
||||
MenuItemIndex i = FindMenuItemIndex() ;
|
||||
if ( i > 0 )
|
||||
{
|
||||
if ( hide )
|
||||
ChangeMenuItemAttributes( m_parentMenuRef, i, kMenuItemAttrHidden, 0 );
|
||||
else
|
||||
ChangeMenuItemAttributes( m_parentMenuRef, i, 0 , kMenuItemAttrHidden );
|
||||
}
|
||||
}
|
||||
|
||||
void SetLabel( const wxString& text, wxAcceleratorEntry *entry )
|
||||
{
|
||||
MenuItemIndex i = FindMenuItemIndex() ;
|
||||
if ( i > 0 )
|
||||
{
|
||||
SetMenuItemTextWithCFString( m_parentMenuRef, i, wxCFStringRef(text));
|
||||
UMASetMenuItemShortcut( m_parentMenuRef, i , entry ) ;
|
||||
}
|
||||
}
|
||||
|
||||
void * GetHMenuItem() { return NULL; }
|
||||
|
||||
// Carbon Only
|
||||
|
||||
void AttachToParent( MenuRef parentMenuRef, MenuItemIndex index )
|
||||
{
|
||||
m_parentMenuRef = parentMenuRef;
|
||||
if ( m_parentMenuRef && index > 0 )
|
||||
SetMenuItemRefCon( m_parentMenuRef, index, (URefCon) m_peer );
|
||||
}
|
||||
|
||||
MenuItemIndex FindMenuItemIndex()
|
||||
{
|
||||
MenuItemIndex hit = 0 ;
|
||||
if ( m_parentMenuRef )
|
||||
{
|
||||
for ( MenuItemIndex i = 1 ; i <= CountMenuItems(m_parentMenuRef) ; ++i )
|
||||
{
|
||||
URefCon storedRef = 0;
|
||||
GetMenuItemRefCon(m_parentMenuRef, i, &storedRef );
|
||||
if ( storedRef == (URefCon) m_peer )
|
||||
{
|
||||
hit = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return hit;
|
||||
}
|
||||
protected :
|
||||
MenuRef m_parentMenuRef;
|
||||
} ;
|
||||
|
||||
//
|
||||
// wxMenuImpl
|
||||
//
|
||||
|
||||
class wxMenuCarbonImpl : public wxMenuImpl
|
||||
{
|
||||
public :
|
||||
wxMenuCarbonImpl( wxMenu* peer , MenuRef menu , MenuRef oldMenu , SInt16 menuId)
|
||||
: wxMenuImpl(peer), m_osxMenu(menu), m_oldMenuRef(oldMenu), m_menuId(menuId)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~wxMenuCarbonImpl();
|
||||
|
||||
virtual void InsertOrAppend(wxMenuItem *pItem, size_t pos)
|
||||
{
|
||||
// MacOS counts menu items from 1 and inserts after, therefore having the
|
||||
// same effect as wx 0 based and inserting before, we must correct pos
|
||||
// after however for updates to be correct
|
||||
|
||||
MenuItemIndex index = pos;
|
||||
if ( pos == (size_t) -1 )
|
||||
index = CountMenuItems(m_osxMenu);
|
||||
|
||||
if ( pItem->IsSeparator() )
|
||||
{
|
||||
InsertMenuItemTextWithCFString( m_osxMenu, CFSTR(""), index, kMenuItemAttrSeparator, 0);
|
||||
// now switch to the Carbon 1 based counting
|
||||
index += 1 ;
|
||||
}
|
||||
else
|
||||
{
|
||||
InsertMenuItemTextWithCFString( m_osxMenu, CFSTR("placeholder"), index, 0, 0 );
|
||||
|
||||
// now switch to the Carbon 1 based counting
|
||||
index += 1 ;
|
||||
if ( pItem->IsSubMenu() )
|
||||
{
|
||||
MenuRef submenu = pItem->GetSubMenu()->GetHMenu();
|
||||
SetMenuItemHierarchicalMenu(m_osxMenu, index, submenu);
|
||||
// carbon is using the title of the submenu, eg in the menubar
|
||||
SetMenuTitleWithCFString(submenu, wxCFStringRef(pItem->GetItemLabelText()));
|
||||
}
|
||||
else
|
||||
{
|
||||
SetMenuItemCommandID( m_osxMenu, index , wxIdToMacCommand(pItem->GetId()) ) ;
|
||||
}
|
||||
}
|
||||
|
||||
wxMenuItemCarbonImpl* impl = (wxMenuItemCarbonImpl*) pItem->GetPeer();
|
||||
impl->AttachToParent( m_osxMenu, index );
|
||||
// only now can all settings be updated correctly
|
||||
pItem->UpdateItemText();
|
||||
pItem->UpdateItemStatus();
|
||||
pItem->UpdateItemBitmap();
|
||||
}
|
||||
|
||||
virtual void Remove( wxMenuItem *pItem )
|
||||
{
|
||||
wxMenuItemCarbonImpl* impl = (wxMenuItemCarbonImpl*) pItem->GetPeer();
|
||||
if ( impl )
|
||||
{
|
||||
MenuItemIndex i = impl->FindMenuItemIndex();
|
||||
if ( i > 0 )
|
||||
{
|
||||
DeleteMenuItem(m_osxMenu , i);
|
||||
impl->AttachToParent( NULL, 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtual void MakeRoot()
|
||||
{
|
||||
SetRootMenu( m_osxMenu );
|
||||
}
|
||||
|
||||
virtual void SetTitle( const wxString& text )
|
||||
{
|
||||
SetMenuTitleWithCFString(m_osxMenu, wxCFStringRef(text));
|
||||
}
|
||||
|
||||
WXHMENU GetHMenu() { return m_osxMenu; }
|
||||
|
||||
virtual void PopUp( wxWindow *WXUNUSED(win), int x, int y )
|
||||
{
|
||||
long menuResult = ::PopUpMenuSelect(m_osxMenu, y, x, 0) ;
|
||||
if ( HiWord(menuResult) != 0 )
|
||||
{
|
||||
MenuCommand macid;
|
||||
GetMenuItemCommandID( GetMenuHandle(HiWord(menuResult)) , LoWord(menuResult) , &macid );
|
||||
int id = wxMacCommandToId( macid );
|
||||
wxMenuItem* item = NULL ;
|
||||
wxMenu* realmenu ;
|
||||
item = m_peer->FindItem( id, &realmenu ) ;
|
||||
if ( item )
|
||||
{
|
||||
m_peer->HandleCommandProcess(item, NULL );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static wxMenuImpl* Create( wxMenu* peer, const wxString& title );
|
||||
static wxMenuImpl* CreateRootMenu( wxMenu* peer );
|
||||
protected :
|
||||
wxCFRef<MenuRef> m_osxMenu;
|
||||
MenuRef m_oldMenuRef;
|
||||
SInt16 m_menuId;
|
||||
} ;
|
||||
|
||||
// static const short kwxMacAppleMenuId = 1 ;
|
||||
|
||||
// Find an item given the Macintosh Menu Reference
|
||||
|
||||
WX_DECLARE_HASH_MAP(WXHMENU, wxMenu*, wxPointerHash, wxPointerEqual, MacMenuMap);
|
||||
|
||||
static MacMenuMap wxWinMacMenuList;
|
||||
|
||||
wxMenu *wxFindMenuFromMacMenu(WXHMENU inMenuRef)
|
||||
{
|
||||
MacMenuMap::iterator node = wxWinMacMenuList.find(inMenuRef);
|
||||
|
||||
return (node == wxWinMacMenuList.end()) ? NULL : node->second;
|
||||
}
|
||||
|
||||
void wxAssociateMenuWithMacMenu(WXHMENU inMenuRef, wxMenu *menu) ;
|
||||
void wxAssociateMenuWithMacMenu(WXHMENU inMenuRef, wxMenu *menu)
|
||||
{
|
||||
// adding NULL MenuRef is (first) surely a result of an error and
|
||||
// (secondly) breaks menu command processing
|
||||
wxCHECK_RET( inMenuRef != (WXHMENU) NULL, wxT("attempt to add a NULL MenuRef to menu list") );
|
||||
|
||||
wxWinMacMenuList[inMenuRef] = menu;
|
||||
}
|
||||
|
||||
void wxRemoveMacMenuAssociation(wxMenu *menu) ;
|
||||
void wxRemoveMacMenuAssociation(wxMenu *menu)
|
||||
{
|
||||
// iterate over all the elements in the class
|
||||
MacMenuMap::iterator it;
|
||||
for ( it = wxWinMacMenuList.begin(); it != wxWinMacMenuList.end(); ++it )
|
||||
{
|
||||
if ( it->second == menu )
|
||||
{
|
||||
wxWinMacMenuList.erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wxMenuCarbonImpl::~wxMenuCarbonImpl()
|
||||
{
|
||||
wxRemoveMacMenuAssociation( GetWXPeer() );
|
||||
// restore previous menu
|
||||
m_osxMenu.reset();
|
||||
if ( m_menuId > 0 )
|
||||
MacDeleteMenu(m_menuId);
|
||||
if ( m_oldMenuRef )
|
||||
MacInsertMenu(m_oldMenuRef, -1);
|
||||
}
|
||||
|
||||
wxMenuImpl* wxMenuImpl::Create( wxMenu* peer, const wxString& title )
|
||||
{
|
||||
// create the menu
|
||||
static SInt16 s_macNextMenuId = 3;
|
||||
SInt16 menuId = s_macNextMenuId++;
|
||||
// save existing menu in case we're embedding into an application
|
||||
// or sharing outside UI elements.
|
||||
WXHMENU oldMenu = GetMenuHandle(menuId);
|
||||
if ( oldMenu )
|
||||
MacDeleteMenu(menuId);
|
||||
WXHMENU menu = NULL;
|
||||
CreateNewMenu( menuId , 0 , &menu ) ;
|
||||
if ( !menu )
|
||||
{
|
||||
wxLogLastError(wxT("CreateNewMenu failed"));
|
||||
if ( oldMenu )
|
||||
MacInsertMenu(oldMenu, -1);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
wxMenuImpl* c = new wxMenuCarbonImpl( peer, menu, oldMenu, menuId );
|
||||
c->SetTitle(title);
|
||||
wxAssociateMenuWithMacMenu( menu , peer ) ;
|
||||
return c;
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
wxMenuItemCarbonImpl::~wxMenuItemCarbonImpl()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
wxMenuItemImpl* wxMenuItemImpl::Create( wxMenuItem* peer,
|
||||
wxMenu * WXUNUSED(pParentMenu),
|
||||
int WXUNUSED(id),
|
||||
const wxString& WXUNUSED(text),
|
||||
wxAcceleratorEntry *WXUNUSED(entry),
|
||||
const wxString& WXUNUSED(strHelp),
|
||||
wxItemKind WXUNUSED(kind),
|
||||
wxMenu *WXUNUSED(pSubMenu) )
|
||||
{
|
||||
wxMenuItemImpl* c = NULL;
|
||||
|
||||
c = new wxMenuItemCarbonImpl( peer );
|
||||
return c;
|
||||
}
|
||||
|
||||
void wxInsertMenuItemsInMenu(wxMenu* menu, MenuRef wm, MenuItemIndex insertAfter)
|
||||
{
|
||||
wxMenuItemList::compatibility_iterator node;
|
||||
wxMenuItem *item;
|
||||
wxMenu *subMenu = NULL ;
|
||||
bool newItems = false;
|
||||
|
||||
for (node = menu->GetMenuItems().GetFirst(); node; node = node->GetNext())
|
||||
{
|
||||
item = (wxMenuItem *)node->GetData();
|
||||
subMenu = item->GetSubMenu() ;
|
||||
if (subMenu)
|
||||
{
|
||||
wxInsertMenuItemsInMenu(subMenu, (MenuRef)subMenu->GetHMenu(), 0);
|
||||
}
|
||||
if ( item->IsSeparator() )
|
||||
{
|
||||
if ( wm && newItems)
|
||||
InsertMenuItemTextWithCFString( wm,
|
||||
CFSTR(""), insertAfter, kMenuItemAttrSeparator, 0);
|
||||
|
||||
newItems = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
wxAcceleratorEntry*
|
||||
entry = wxAcceleratorEntry::Create( item->GetItemLabel() ) ;
|
||||
|
||||
MenuItemIndex winListPos = (MenuItemIndex)-1;
|
||||
OSStatus err = GetIndMenuItemWithCommandID(wm,
|
||||
wxIdToMacCommand ( item->GetId() ), 1, NULL, &winListPos);
|
||||
|
||||
if ( wm && err == menuItemNotFoundErr )
|
||||
{
|
||||
// NB: the only way to determine whether or not we should add
|
||||
// a separator is to know if we've added menu items to the menu
|
||||
// before the separator.
|
||||
newItems = true;
|
||||
UMAInsertMenuItem(wm, wxStripMenuCodes(item->GetItemLabel()) , wxFont::GetDefaultEncoding(), insertAfter, entry);
|
||||
SetMenuItemCommandID( wm , insertAfter+1 , wxIdToMacCommand ( item->GetId() ) ) ;
|
||||
SetMenuItemRefCon( wm , insertAfter+1 , (URefCon) item ) ;
|
||||
}
|
||||
|
||||
delete entry ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user