merged 2.2 branch
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@7748 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -9,9 +9,12 @@
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// important: the #pragma argument must be different from treectrl.cpp,
|
||||
// otherwise gcc gets confused (as there is also treectrl.cpp in the library
|
||||
// which has identical #pragma) and the sample crashes on startup!
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#pragma interface
|
||||
#pragma interface "treetest.cpp"
|
||||
#pragma implementation "treetest.cpp"
|
||||
#endif
|
||||
|
||||
// For compilers that support precompilation, includes "wx/wx.h".
|
||||
@@ -428,7 +431,18 @@ void MyFrame::OnSetImageSize(wxCommandEvent& event)
|
||||
|
||||
void MyFrame::OnToggleImages(wxCommandEvent& event)
|
||||
{
|
||||
wxGetApp().SetShowImages(!wxGetApp().ShowImages());
|
||||
if ( wxGetApp().ShowImages() )
|
||||
{
|
||||
m_treeCtrl->CreateImageList(-1);
|
||||
|
||||
wxGetApp().SetShowImages(FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_treeCtrl->CreateImageList();
|
||||
|
||||
wxGetApp().SetShowImages(TRUE);
|
||||
}
|
||||
|
||||
OnRecreate(event);
|
||||
}
|
||||
@@ -522,42 +536,42 @@ void MyTreeCtrl::CreateImageList(int size)
|
||||
if ( size == -1 )
|
||||
{
|
||||
m_imageListNormal = NULL;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Make an image list containing small icons
|
||||
m_imageListNormal = new wxImageList(size, size, TRUE);
|
||||
|
||||
// should correspond to TreeCtrlIcon_xxx enum
|
||||
#if defined(__WXMSW__) && defined(__WIN16__)
|
||||
m_imageListNormal->Add(wxBitmap("bitmap1", wxBITMAP_TYPE_BMP_RESOURCE));
|
||||
m_imageListNormal->Add(wxBitmap("bitmap2", wxBITMAP_TYPE_BMP_RESOURCE));
|
||||
m_imageListNormal->Add(wxBitmap("bitmap3", wxBITMAP_TYPE_BMP_RESOURCE));
|
||||
m_imageListNormal->Add(wxBitmap("bitmap4", wxBITMAP_TYPE_BMP_RESOURCE));
|
||||
m_imageListNormal->Add(wxBitmap("bitmap5", wxBITMAP_TYPE_BMP_RESOURCE));
|
||||
#else
|
||||
wxIcon icons[5];
|
||||
icons[0] = wxICON(icon1);
|
||||
icons[1] = wxICON(icon2);
|
||||
icons[2] = wxICON(icon3);
|
||||
icons[3] = wxICON(icon4);
|
||||
icons[4] = wxICON(icon5);
|
||||
|
||||
int sizeOrig = icons[0].GetWidth();
|
||||
for ( size_t i = 0; i < WXSIZEOF(icons); i++ )
|
||||
else
|
||||
{
|
||||
if ( size == sizeOrig )
|
||||
// Make an image list containing small icons
|
||||
m_imageListNormal = new wxImageList(size, size, TRUE);
|
||||
|
||||
// should correspond to TreeCtrlIcon_xxx enum
|
||||
#if defined(__WXMSW__) && defined(__WIN16__)
|
||||
m_imageListNormal->Add(wxBitmap("bitmap1", wxBITMAP_TYPE_BMP_RESOURCE));
|
||||
m_imageListNormal->Add(wxBitmap("bitmap2", wxBITMAP_TYPE_BMP_RESOURCE));
|
||||
m_imageListNormal->Add(wxBitmap("bitmap3", wxBITMAP_TYPE_BMP_RESOURCE));
|
||||
m_imageListNormal->Add(wxBitmap("bitmap4", wxBITMAP_TYPE_BMP_RESOURCE));
|
||||
m_imageListNormal->Add(wxBitmap("bitmap5", wxBITMAP_TYPE_BMP_RESOURCE));
|
||||
#else // !MSW
|
||||
wxIcon icons[5];
|
||||
icons[0] = wxICON(icon1);
|
||||
icons[1] = wxICON(icon2);
|
||||
icons[2] = wxICON(icon3);
|
||||
icons[3] = wxICON(icon4);
|
||||
icons[4] = wxICON(icon5);
|
||||
|
||||
int sizeOrig = icons[0].GetWidth();
|
||||
for ( size_t i = 0; i < WXSIZEOF(icons); i++ )
|
||||
{
|
||||
m_imageListNormal->Add(icons[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_imageListNormal->Add(wxImage(icons[i]).Rescale(size, size).
|
||||
ConvertToBitmap());
|
||||
if ( size == sizeOrig )
|
||||
{
|
||||
m_imageListNormal->Add(icons[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_imageListNormal->Add(wxImage(icons[i]).Rescale(size, size).
|
||||
ConvertToBitmap());
|
||||
}
|
||||
}
|
||||
#endif // MSW/!MSW
|
||||
}
|
||||
#endif
|
||||
|
||||
SetImageList(m_imageListNormal);
|
||||
}
|
||||
|
Reference in New Issue
Block a user