wxWidgets 3.1.3 图标在 mac 下加载 - ICNS 文件不可读?
wxWidgets 3.1.3 icon loading under mac - ICNS files unreadable?
现在似乎不可能在mac下加载.icns文件。过去可以使用wxIcon和wxIconLocation,例如。
wxMimeTypesManager manager;
wxFileType *type = manager.GetFileTypeFromExtension("zip");
wxIconLocation location;
if(type->GetIcon(&location))
{
// location m_filename is something like "/System/Library/CoreServices/Applications/Archive Utility.app/Contents/Resources/bah-zip.icns"
wxIcon icon;
// This will FAIL now as there is no handler for wxBITMAP_TYPE_ICON...
icon.LoadFile(location.GetFileName(), wxBITMAP_TYPE_ICON, 32, 32);
}
wxMimeTypesManager::GetFileTypeFromExtension 返回一个 wxFileType。 然后,您可以使用 wxFileType::GetIcon 返回 wxIconLocation。
wxIconLocation::GetFileName(( 返回 OSX 下的.icns文件。如果您将wxBITMAP_TYPE_ICON传递给wxIcon::LoadFile,则这曾经可以在wxWidgets 2.9.1下作为wxIcon加载,因为这会强制wxIcon::LoadIconFromFile (src/osx/carbon/icon.cpp(使用ReadIconFromFSRef从icns加载。
但是由于所有的碳代码都消失了,现在我无法从.icns文件中加载任何内容。
我现在该怎么做?
编辑:我使用了以下配置:configure --disable-shared --enable-unicode --prefix="$(pwd)" --enable-stc --enable-ipc --enable-base64 --enable-exceptions --enable-fontenum --enable-fs_archive --enable-stdpaths --enable-sysoptions --enable-threads --enable-url --enable-aui --enable-graphics_ctx --enable-printarch --enable-timer --enable-ribbon --enable-webview --enable-display --enable-splash --enable-snglinst --enable-printfposparam --with-opengl --with-osx_cocoa --with-expat=builtin --with-cxx=11 --enable-cxx11 --enable-stl --enable-std_iostreams --enable-std_string --enable-ftp --enable-http --enable-fileproto --enable-sockets --enable-ipv6 --enable-dataobj --enable-ipc --enable-any --enable-arcstream --enable-backtrace --enable-cmdline --enable-datetime --enable-debugreport --enable-dynamicloader --enable-exceptions --enable-ffile --enable-file --enable-filehistory --enable-filesystem --enable-fontmap --enable-fs_inet --enable-fs_zip --enable-fsvolume --enable-fswatcher --enable-geometry --enable-sound --enable-stopwatch --enable-streams --enable-tarstream --enable-textbuf --enable-textfile --enable-variant --enable-zipstream --enable-protocol --enable-protocol-http --enable-protocol-ftp --enable-protocol-file --enable-html --enable-htmlhelp --enable-propgrid --enable-svg --enable-clipboard --enable-dnd --enable-accel --with-osx_cocoa --enable-debug --with-libpng=builtin --with-libjpeg=builtin --with-zlib=builtin --with-libtiff=builtin
不幸的是,这对我来说是一个错误。目前wxIcon::LoadIconFromFile()
只是在wxOSX_ICON_USE_NSIMAGE==1
时总是返回 false,这是默认值。您可以尝试在setup.h
中将wxOSX_BITMAP_NATIVE_ACCESS
设置为 0 并重建作为非常短期的修复,但真正需要做的是使用 NSImage 实现此功能,可能使用[NSImage initWithContentsOfFile:]
。
- .cpp和.h文件中的模板专用化声明
- 为什么两个不同的未命名名称空间可以共存于一个cpp文件中
- 文本文件中的单词链表
- CMake-按正确顺序将项目与C运行时对象文件链接
- 使用新行和不使用新行读取文件
- 在C++程序中输入的文本文件将不起作用,除非文本被复制和粘贴
- 挂起和取消挂起一个文件DLL
- 如何确定我已使用非编码文件到达 EOF?
- 命名空间中具有.h和.cpp文件的类
- 如何使用ndk-build.cmd构建Android.so文件
- 从包含m行的文件中提取n行,必要时(惰性地)重复该文件
- 读取文件并输入到矢量中
- 在C++中查找文件
- c++库的公共头文件中应该包含什么
- 用c++从输入文件中读取另一行
- Cppcheck生成xml转储文件
- 读取文件的最后一行并输入到链接列表时出错
- 无法编译 rtmidi 测试 cmidiin.cpp 文件, 非法指令
- 如何将内容数组写入文本文件?
- wxWidgets 3.1.3 图标在 mac 下加载 - ICNS 文件不可读?