From 5c5428f9132822d5d39b02c46dd89464adff9f1f Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Sun, 1 Jun 2003 13:57:23 +0000 Subject: [PATCH] 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 --- docs/latex/wx/filetype.tex | 9 ++++++--- docs/toback24.txt | 8 ++++++++ docs/todo30.txt | 1 + include/wx/mimetype.h | 6 +++++- include/wx/msw/mimetype.h | 3 ++- src/common/mimecmn.cpp | 7 +++++-- src/msw/mimetype.cpp | 9 +++++++-- 7 files changed, 34 insertions(+), 9 deletions(-) diff --git a/docs/latex/wx/filetype.tex b/docs/latex/wx/filetype.tex index 22673a5a2f..30d87dd941 100644 --- a/docs/latex/wx/filetype.tex +++ b/docs/latex/wx/filetype.tex @@ -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 diff --git a/docs/toback24.txt b/docs/toback24.txt index 0bddb9270e..3b76ea27e2 100644 --- a/docs/toback24.txt +++ b/docs/toback24.txt @@ -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 + diff --git a/docs/todo30.txt b/docs/todo30.txt index 12e9ad0675..031831d549 100644 --- a/docs/todo30.txt +++ b/docs/todo30.txt @@ -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$ diff --git a/include/wx/mimetype.h b/include/wx/mimetype.h index b8aefeb5ec..ee204f6de5 100644 --- a/include/wx/mimetype.h +++ b/include/wx/mimetype.h @@ -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; diff --git a/include/wx/msw/mimetype.h b/include/wx/msw/mimetype.h index 299b4462bf..5170b63618 100644 --- a/include/wx/msw/mimetype.h +++ b/include/wx/msw/mimetype.h @@ -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; diff --git a/src/common/mimecmn.cpp b/src/common/mimecmn.cpp index 6523cce382..9b4f0ff3fa 100644 --- a/src/common/mimecmn.cpp +++ b/src/common/mimecmn.cpp @@ -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); diff --git a/src/msw/mimetype.cpp b/src/msw/mimetype.cpp index 6ce8557e4e..6f488946c5 100644 --- a/src/msw/mimetype.cpp +++ b/src/msw/mimetype.cpp @@ -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 -- 2.45.2