diff options
author | miniak <milan.burda@gmail.com> | 2009-09-22 08:33:30 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2009-09-22 08:33:30 (GMT) |
commit | e689e41ad1baad65d90866eefe88a96f5e16fa04 (patch) | |
tree | 1914948c3416a725ff243b2ee5b09a4d04d8321d /src/gui/styles/qwindowsstyle.cpp | |
parent | ac7fca3606d1a7dd5985b6fc284c40c0f2682fe5 (diff) | |
download | Qt-e689e41ad1baad65d90866eefe88a96f5e16fa04.zip Qt-e689e41ad1baad65d90866eefe88a96f5e16fa04.tar.gz Qt-e689e41ad1baad65d90866eefe88a96f5e16fa04.tar.bz2 |
Cleanup convertHIconToPixmap() & loadIconFromShell32()
Replace convertHIconToPixmap() by QPixmap::fromWinHICON()
Move loadIconFromShell32() to qwindowsstyle.cpp
Merge-request: 1570
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
Diffstat (limited to 'src/gui/styles/qwindowsstyle.cpp')
-rw-r--r-- | src/gui/styles/qwindowsstyle.cpp | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/src/gui/styles/qwindowsstyle.cpp b/src/gui/styles/qwindowsstyle.cpp index 742b5b0..f5aadb8 100644 --- a/src/gui/styles/qwindowsstyle.cpp +++ b/src/gui/styles/qwindowsstyle.cpp @@ -41,7 +41,6 @@ #include "qwindowsstyle.h" #include "qwindowsstyle_p.h" -#include <private/qpixmapdata_p.h> #include <private/qstylehelper_p.h> #if !defined(QT_NO_STYLE_WINDOWS) || defined(QT_PLUGIN) @@ -927,6 +926,24 @@ static const char *const question_xpm[] = { #endif //QT_NO_IMAGEFORMAT_XPM +static QPixmap loadIconFromShell32( int resourceId, int size ) +{ +#ifdef Q_OS_WINCE + HMODULE hmod = LoadLibrary(L"ceshell.dll"); +#else + HMODULE hmod = LoadLibrary(L"shell32.dll"); +#endif + if( hmod ) { + HICON iconHandle = (HICON)LoadImage(hmod, MAKEINTRESOURCE(resourceId), IMAGE_ICON, size, size, 0); + if( iconHandle ) { + QPixmap iconpixmap = QPixmap::fromWinHICON( iconHandle ); + DestroyIcon(iconHandle); + return iconpixmap; + } + } + return QPixmap(); +} + /*! \reimp */ @@ -1016,28 +1033,28 @@ QPixmap QWindowsStyle::standardPixmap(StandardPixmap standardPixmap, const QStyl case SP_MessageBoxInformation: { HICON iconHandle = LoadIcon(NULL, IDI_INFORMATION); - desktopIcon = convertHIconToPixmap( iconHandle ); + desktopIcon = QPixmap::fromWinHICON( iconHandle ); DestroyIcon(iconHandle); break; } case SP_MessageBoxWarning: { HICON iconHandle = LoadIcon(NULL, IDI_WARNING); - desktopIcon = convertHIconToPixmap( iconHandle ); + desktopIcon = QPixmap::fromWinHICON( iconHandle ); DestroyIcon(iconHandle); break; } case SP_MessageBoxCritical: { HICON iconHandle = LoadIcon(NULL, IDI_ERROR); - desktopIcon = convertHIconToPixmap( iconHandle ); + desktopIcon = QPixmap::fromWinHICON( iconHandle ); DestroyIcon(iconHandle); break; } case SP_MessageBoxQuestion: { HICON iconHandle = LoadIcon(NULL, IDI_QUESTION); - desktopIcon = convertHIconToPixmap( iconHandle ); + desktopIcon = QPixmap::fromWinHICON( iconHandle ); DestroyIcon(iconHandle); break; } @@ -1052,7 +1069,7 @@ QPixmap QWindowsStyle::standardPixmap(StandardPixmap standardPixmap, const QStyl memset(&iconInfo, 0, sizeof(iconInfo)); iconInfo.cbSize = sizeof(iconInfo); if (pSHGetStockIconInfo(_SIID_SHIELD, _SHGFI_ICON | _SHGFI_SMALLICON, &iconInfo) == S_OK) { - pixmap = convertHIconToPixmap(iconInfo.hIcon); + pixmap = QPixmap::fromWinHICON(iconInfo.hIcon); DestroyIcon(iconInfo.hIcon); return pixmap; } @@ -3346,7 +3363,7 @@ QIcon QWindowsStyle::standardIconImplementation(StandardPixmap standardIcon, con memset(&iconInfo, 0, sizeof(iconInfo)); iconInfo.cbSize = sizeof(iconInfo); if (pSHGetStockIconInfo(_SIID_SHIELD, _SHGFI_ICON | _SHGFI_LARGEICON, &iconInfo) == S_OK) { - icon.addPixmap(convertHIconToPixmap(iconInfo.hIcon)); + icon.addPixmap(QPixmap::fromWinHICON(iconInfo.hIcon)); DestroyIcon(iconInfo.hIcon); } } |