load ImageList_Copy() dynamically to allow wx apps to start up under Win95 (state image display in wxTreeCtrl still won't work though)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58572 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -37,6 +37,7 @@
|
||||
#include "wx/settings.h"
|
||||
#endif
|
||||
|
||||
#include "wx/dynlib.h"
|
||||
#include "wx/msw/private.h"
|
||||
|
||||
// Set this to 1 to be _absolutely_ sure that repainting will work for all
|
||||
@@ -2705,7 +2706,30 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
|
||||
// delete it (in POSTPAINT notify)
|
||||
if (m_imageListState && m_imageListState->GetImageCount() > 0)
|
||||
{
|
||||
#define hImageList (HIMAGELIST)m_imageListState->GetHIMAGELIST()
|
||||
typedef BOOL (*ImageList_Copy_t)
|
||||
(HIMAGELIST, int, HIMAGELIST, int, UINT);
|
||||
static ImageList_Copy_t s_pfnImageList_Copy = NULL;
|
||||
static bool loaded = false;
|
||||
|
||||
if ( !loaded )
|
||||
{
|
||||
wxLoadedDLL dllComCtl32(_T("comctl32.dll"));
|
||||
if ( dllComCtl32.IsLoaded() )
|
||||
wxDL_INIT_FUNC(s_pfn, ImageList_Copy, dllComCtl32);
|
||||
}
|
||||
|
||||
if ( !s_pfnImageList_Copy )
|
||||
{
|
||||
// this code is broken with ImageList_Copy()
|
||||
// but I don't care enough about Win95 support
|
||||
// to write it now -- if anybody does, please
|
||||
// do it
|
||||
wxFAIL_MSG("TODO: implement this for Win95");
|
||||
break;
|
||||
}
|
||||
|
||||
const HIMAGELIST
|
||||
hImageList = GetHimagelistOf(m_imageListState);
|
||||
|
||||
// add temporary image
|
||||
int width, height;
|
||||
@@ -2719,13 +2743,15 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
|
||||
{
|
||||
// move images to right
|
||||
for ( int i = index; i > 0; i-- )
|
||||
::ImageList_Copy(hImageList, i, hImageList, i-1, 0);
|
||||
{
|
||||
(*s_pfnImageList_Copy)(hImageList, i,
|
||||
hImageList, i-1,
|
||||
ILCF_MOVE);
|
||||
}
|
||||
|
||||
// we must remove the image in POSTPAINT notify
|
||||
*result |= CDRF_NOTIFYPOSTPAINT;
|
||||
}
|
||||
|
||||
#undef hImageList
|
||||
}
|
||||
break;
|
||||
|
||||
|
Reference in New Issue
Block a user