treectrl sample modified to use XPMs

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15834 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Chris Elliott 2002-06-14 10:05:01 +00:00
parent 99030bdf57
commit 6f4aae6098
12 changed files with 16 additions and 45 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 B

View File

@ -41,15 +41,13 @@
#include "treetest.h"
// under Windows the icons are in the .rc file
#ifndef __WXMSW__
#include "icon1.xpm"
#include "icon2.xpm"
#include "icon3.xpm"
#include "icon4.xpm"
#include "icon5.xpm"
#include "mondrian.xpm"
#endif
#include "icon1.xpm"
#include "icon2.xpm"
#include "icon3.xpm"
#include "icon4.xpm"
#include "icon5.xpm"
#include "mondrian.xpm"
// verify that the item is ok and insult the user if it is not
#define CHECK_ITEM( item ) if ( !item.IsOk() ) { \
@ -645,20 +643,13 @@ void MyTreeCtrl::CreateImageList(int size)
wxImageList *images = new wxImageList(size, size, TRUE);
// should correspond to TreeCtrlIcon_xxx enum
#if defined(__WXMSW__) && defined(__WIN16__)
images->Add(wxBitmap("bitmap1", wxBITMAP_TYPE_BMP_RESOURCE));
images->Add(wxBitmap("bitmap2", wxBITMAP_TYPE_BMP_RESOURCE));
images->Add(wxBitmap("bitmap3", wxBITMAP_TYPE_BMP_RESOURCE));
images->Add(wxBitmap("bitmap4", wxBITMAP_TYPE_BMP_RESOURCE));
images->Add(wxBitmap("bitmap5", wxBITMAP_TYPE_BMP_RESOURCE));
#else // !MSW
wxBusyCursor wait;
wxIcon icons[5];
icons[0] = wxICON(icon1);
icons[1] = wxICON(icon2);
icons[2] = wxICON(icon3);
icons[3] = wxICON(icon4);
icons[4] = wxICON(icon5);
icons[0] = wxIcon(icon1_xpm);
icons[1] = wxIcon(icon2_xpm);
icons[2] = wxIcon(icon3_xpm);
icons[3] = wxIcon(icon4_xpm);
icons[4] = wxIcon(icon5_xpm);
int sizeOrig = icons[0].GetWidth();
for ( size_t i = 0; i < WXSIZEOF(icons); i++ )
@ -672,7 +663,6 @@ void MyTreeCtrl::CreateImageList(int size)
images->Add(wxBitmap(wxBitmap(icons[i]).ConvertToImage().Rescale(size, size)));
}
}
#endif // MSW/!MSW
AssignImageList(images);
}
@ -690,19 +680,12 @@ void MyTreeCtrl::CreateButtonsImageList(int size)
wxImageList *images = new wxImageList(size, size, TRUE);
// should correspond to TreeCtrlIcon_xxx enum
#if defined(__WXMSW__) && defined(__WIN16__)
images->Add(wxBitmap("bitmap1", wxBITMAP_TYPE_BMP_RESOURCE));
images->Add(wxBitmap("bitmap2", wxBITMAP_TYPE_BMP_RESOURCE));
images->Add(wxBitmap("bitmap3", wxBITMAP_TYPE_BMP_RESOURCE));
images->Add(wxBitmap("bitmap4", wxBITMAP_TYPE_BMP_RESOURCE));
images->Add(wxBitmap("bitmap5", wxBITMAP_TYPE_BMP_RESOURCE));
#else // !MSW
wxBusyCursor wait;
wxIcon icons[4];
icons[0] = wxICON(icon3); // closed
icons[1] = wxICON(icon3); // closed, selected
icons[2] = wxICON(icon5); // open
icons[3] = wxICON(icon5); // open, selected
icons[0] = wxIcon(icon3_xpm); // closed
icons[1] = wxIcon(icon3_xpm); // closed, selected
icons[2] = wxIcon(icon5_xpm); // open
icons[3] = wxIcon(icon5_xpm); // open, selected
for ( size_t i = 0; i < WXSIZEOF(icons); i++ )
{
@ -716,7 +699,6 @@ void MyTreeCtrl::CreateButtonsImageList(int size)
images->Add(wxBitmap(icons[i].ConvertToImage().Rescale(size, size)));
}
}
#endif // MSW/!MSW
AssignButtonsImageList(images);
#endif

View File

@ -3,15 +3,4 @@ aaaa ICON "mondrian.ico"
#include "wx/msw/wx.rc"
icon1 ICON "bitmaps/file1.ico"
icon2 ICON "bitmaps/file2.ico"
icon3 ICON "bitmaps/folder1.ico"
icon4 ICON "bitmaps/folder2.ico"
icon5 ICON "bitmaps/folder3.ico"
bitmap1 BITMAP "bitmaps/file1.bmp"
bitmap2 BITMAP "bitmaps/file2.bmp"
bitmap3 BITMAP "bitmaps/folder1.bmp"
bitmap4 BITMAP "bitmaps/folder2.bmp"
bitmap5 BITMAP "bitmaps/folder3.bmp"