images in the notebook work under MSW too (with or without XPM)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1388 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1999-01-12 23:49:59 +00:00
parent 4698648ff8
commit 73c700fdee
8 changed files with 39 additions and 20 deletions

View File

@@ -29,22 +29,18 @@
#include "wx/spinbutt.h" #include "wx/spinbutt.h"
#include "wx/clipbrd.h" #include "wx/clipbrd.h"
// XPM doesn't seem to work under Windows at present. Or, wxNotebook images
// aren't working.
// Uncomment this line and comment out the next to try it.
//#if defined(__WXGTK__) || defined(__WXMOTIF__) || (defined(__WXMSW__) && wxUSE_XPM_IN_MSW)
#if defined(__WXGTK__) || defined(__WXMOTIF__) #if defined(__WXGTK__) || defined(__WXMOTIF__)
#define USE_XPM #define USE_XPM
#endif #endif
#ifdef USE_XPM #ifdef USE_XPM
#include "mondrian.xpm" #include "mondrian.xpm"
#include "icons/choice.xpm" #include "icons/choice.xpm"
#include "icons/combo.xpm" #include "icons/combo.xpm"
#include "icons/list.xpm" #include "icons/list.xpm"
#include "icons/radio.xpm" #include "icons/radio.xpm"
#include "icons/text.xpm" #include "icons/text.xpm"
#include "icons/gauge.xpm" #include "icons/gauge.xpm"
#endif #endif
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@@ -268,7 +264,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) :
}; };
#ifdef USE_XPM #ifdef USE_XPM
// image ids and names // image ids
enum enum
{ {
Image_List, Image_Choice, Image_Combo, Image_Text, Image_Radio, Image_Gauge, Image_Max Image_List, Image_Choice, Image_Combo, Image_Text, Image_Radio, Image_Gauge, Image_Max
@@ -283,6 +279,30 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) :
imagelist-> Add( wxBitmap( text_xpm )); imagelist-> Add( wxBitmap( text_xpm ));
imagelist-> Add( wxBitmap( radio_xpm )); imagelist-> Add( wxBitmap( radio_xpm ));
imagelist-> Add( wxBitmap( gauge_xpm )); imagelist-> Add( wxBitmap( gauge_xpm ));
m_notebook->SetImageList(imagelist);
#elif defined(__WXMSW__)
// load images from resources
enum
{
Image_List, Image_Choice, Image_Combo, Image_Text, Image_Radio, Image_Gauge, Image_Max
};
wxImageList *imagelist = new wxImageList(32, 32, FALSE, Image_Max);
static const char *s_iconNames[Image_Max] =
{
"list", "choice", "combo", "text", "radio", "gauge"
};
for ( size_t n = 0; n < Image_Max; n++ )
{
wxBitmap bmp(s_iconNames[n]);
if ( !bmp.Ok() || (imagelist->Add(bmp) == -1) )
{
wxLogWarning("Couldn't load the image '%s' for the notebook page %d.",
s_iconNames[n], n);
}
}
m_notebook->SetImageList(imagelist); m_notebook->SetImageList(imagelist);
#else #else

View File

@@ -1,11 +1,10 @@
mondrian ICON "mondrian.ico" mondrian ICON "mondrian.ico"
/* choice BITMAP "icons/choice.bmp"
list ICON "icons/list.ico" combo BITMAP "icons/combo.bmp"
choice ICON "icons/choice.ico" gauge BITMAP "icons/gauge.bmp"
combo ICON "icons/combo.ico" list BITMAP "icons/list.bmp"
text ICON "icons/text.ico" radio BITMAP "icons/radio.bmp"
radio ICON "icons/radio.ico" text BITMAP "icons/text.bmp"
*/
#include "wx/msw/wx.rc" #include "wx/msw/wx.rc"

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB