Applied patch [ 619539 ] patch to get small icon via geticon

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20815 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart 2003-06-01 13:57:23 +00:00
parent ef094fa075
commit 5c5428f913
7 changed files with 34 additions and 9 deletions

View File

@ -152,10 +152,13 @@ function in the first place.
\membersection{wxFileType::GetIcon}\label{wxfiletypegeticon}
\func{bool}{GetIcon}{\param{wxIcon*}{ icon}}
\func{bool}{GetIcon}{\param{wxIcon*}{ icon}, \param{wxString*}{ iconFile = NULL}, \param{int*}{ iconIndex = NULL}, \param{int}{ iconSize = wxICON\_LARGE}}
If the function returns {\tt true}, the icon associated with this file type will be
created and assigned to the {\it icon} parameter.
If the function returns {\tt TRUE}, the icon associated with this file type will be
created and assigned to the {\it icon} parameter. {\it iconFile} is assigned the file name
that contains the icon and {\it iconIndex} is assigned the index of the icon
(windows and unix only). A 32x32 icon is assigned if {\it iconSize} is wxICON\_LARGE
and a 16x16 icon is assigned if {\it iconSize} is wxICON\_SMALL (windows only).
{\bf Unix:} MIME manager gathers information about icons from GNOME
and KDE settings and thus GetIcon's success depends on availability

View File

@ -183,3 +183,11 @@ Checking in dcclient.cpp;
new revision: 1.170; previous revision: 1.169
done
22. patch [ 619705 ] Fixes wxApp::GetComCtl32Version
Checking in wxWindows/src/msw/app.cpp;
/pack/cvsroots/wxwindows/wxWindows/src/msw/app.cpp,v <-- app.cpp
new revision: 1.186; previous revision: 1.185
done

View File

@ -210,5 +210,6 @@ wxMiscellaneous
(extend editor API) to work around bad checkbox
behaviour (click, click, click, click away...) and
reduce checkbox size on non-Windows platforms.
- Add wxNotebook::HitTest for non-Windows platforms.
Version: $Id$

View File

@ -46,6 +46,9 @@ enum wxMailcapStyle
wxMAILCAP_ALL = 15
};
#define wxICON_LARGE 0
#define wxICON_SMALL 1
/*
TODO: would it be more convenient to have this class?
@ -214,7 +217,8 @@ public:
// in this file (Win-only) is in iconIndex
bool GetIcon(wxIcon *icon,
wxString *iconFile = NULL,
int *iconIndex = NULL) const;
int *iconIndex = NULL,
int iconSize = wxICON_LARGE) const;
// get a brief file type description ("*.txt" => "text document")
bool GetDescription(wxString *desc) const;

View File

@ -44,7 +44,8 @@ public:
bool GetExtensions(wxArrayString& extensions);
bool GetMimeType(wxString *mimeType) const;
bool GetMimeTypes(wxArrayString& mimeTypes) const;
bool GetIcon(wxIcon *icon, wxString *sCommand = NULL, int *iIndex = NULL) const;
bool GetIcon(wxIcon *icon, wxString *sCommand = NULL, int *iIndex = NULL,
int iconSize = wxICON_LARGE) const;
bool GetDescription(wxString *desc) const;
bool GetOpenCommand(wxString *openCmd,
const wxFileType::MessageParameters& params) const;

View File

@ -271,7 +271,8 @@ bool wxFileType::GetMimeTypes(wxArrayString& mimeTypes) const
bool wxFileType::GetIcon(wxIcon *icon,
wxString *iconFile,
int *iconIndex) const
int *iconIndex,
int iconSize) const
{
if ( m_info )
{
@ -291,7 +292,9 @@ bool wxFileType::GetIcon(wxIcon *icon,
return TRUE;
}
#if defined(__WXMSW__) || defined(__UNIX__)
#if defined(__WXMSW__)
return m_impl->GetIcon(icon, iconFile, iconIndex, iconSize);
#elif defined(__UNIX__)
return m_impl->GetIcon(icon, iconFile, iconIndex);
#else
return m_impl->GetIcon(icon);

View File

@ -336,7 +336,8 @@ bool wxFileTypeImpl::GetMimeTypes(wxArrayString& mimeTypes) const
bool wxFileTypeImpl::GetIcon(wxIcon *icon,
wxString *iconFile,
int *iconIndex) const
int *iconIndex,
int iconSize) const
{
#if wxUSE_GUI
wxString strIconKey;
@ -367,7 +368,11 @@ bool wxFileTypeImpl::GetIcon(wxIcon *icon,
// here we need C based counting!
int nIndex = wxAtoi(strIndex);
HICON hIcon = ExtractIcon(GetModuleHandle(NULL), strExpPath, nIndex);
HICON hIcon, hIconLarge, hIconSmall;
ExtractIconEx(strExpPath, nIndex, &hIconLarge, &hIconSmall, 1);
hIcon = (iconSize == wxICON_LARGE) ? hIconLarge : hIconSmall;
switch ( (int)hIcon ) {
case 0: // means no icons were found