From 73c700fdeef6f2acfb86a0b9c8c7789505feee38 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 12 Jan 1999 23:49:59 +0000 Subject: [PATCH] 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 --- samples/controls/controls.cpp | 46 +++++++++++++++++++++--------- samples/controls/controls.rc | 13 ++++----- samples/controls/icons/choice.bmp | Bin 0 -> 2102 bytes samples/controls/icons/combo.bmp | Bin 0 -> 2102 bytes samples/controls/icons/gauge.bmp | Bin 0 -> 2102 bytes samples/controls/icons/list.bmp | Bin 0 -> 2102 bytes samples/controls/icons/radio.bmp | Bin 0 -> 2102 bytes samples/controls/icons/text.bmp | Bin 0 -> 2102 bytes 8 files changed, 39 insertions(+), 20 deletions(-) create mode 100644 samples/controls/icons/choice.bmp create mode 100644 samples/controls/icons/combo.bmp create mode 100644 samples/controls/icons/gauge.bmp create mode 100644 samples/controls/icons/list.bmp create mode 100644 samples/controls/icons/radio.bmp create mode 100644 samples/controls/icons/text.bmp diff --git a/samples/controls/controls.cpp b/samples/controls/controls.cpp index a8f5b70ac9..41860f5bb5 100644 --- a/samples/controls/controls.cpp +++ b/samples/controls/controls.cpp @@ -29,22 +29,18 @@ #include "wx/spinbutt.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__) -#define USE_XPM + #define USE_XPM #endif #ifdef USE_XPM -#include "mondrian.xpm" -#include "icons/choice.xpm" -#include "icons/combo.xpm" -#include "icons/list.xpm" -#include "icons/radio.xpm" -#include "icons/text.xpm" -#include "icons/gauge.xpm" + #include "mondrian.xpm" + #include "icons/choice.xpm" + #include "icons/combo.xpm" + #include "icons/list.xpm" + #include "icons/radio.xpm" + #include "icons/text.xpm" + #include "icons/gauge.xpm" #endif //---------------------------------------------------------------------- @@ -268,7 +264,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) : }; #ifdef USE_XPM - // image ids and names + // image ids enum { 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( radio_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); #else diff --git a/samples/controls/controls.rc b/samples/controls/controls.rc index 1016ec86f5..746abb4618 100644 --- a/samples/controls/controls.rc +++ b/samples/controls/controls.rc @@ -1,11 +1,10 @@ mondrian ICON "mondrian.ico" -/* -list ICON "icons/list.ico" -choice ICON "icons/choice.ico" -combo ICON "icons/combo.ico" -text ICON "icons/text.ico" -radio ICON "icons/radio.ico" -*/ +choice BITMAP "icons/choice.bmp" +combo BITMAP "icons/combo.bmp" +gauge BITMAP "icons/gauge.bmp" +list BITMAP "icons/list.bmp" +radio BITMAP "icons/radio.bmp" +text BITMAP "icons/text.bmp" #include "wx/msw/wx.rc" diff --git a/samples/controls/icons/choice.bmp b/samples/controls/icons/choice.bmp new file mode 100644 index 0000000000000000000000000000000000000000..4ee793ebaec4922a44c228bb415c92a00b8e6fdd GIT binary patch literal 2102 zcmeH{K@Nl<3`I+w#U$=Lfy+682blfbinDPoq*l^M!N#y0eo`zvenlXDf7=@lZ7+aN z%GNU+oFI)aGY7Z?DU!VR5JG?$cno@8S9urWW%`?KC?)4CA7 ziuc^j(GJS^;|?QNAX`z4ky1*ObDlQOV7`GrdIR_ajJ83^dm=VS;b8F^*^9Th-&ALv zt@PZI1m)ZJZ5Jh_`qM?H=pBdXM<4 e9P4p=9{ zG!2Z9GypCDhA_cIF#r~WXn+|GK!%UXqXiEmJb0J~NBH1Qz7Y4}mj|gKAK*57XvhEn D{8;-* literal 0 HcmV?d00001 diff --git a/samples/controls/icons/list.bmp b/samples/controls/icons/list.bmp new file mode 100644 index 0000000000000000000000000000000000000000..07277af7e6a8aff6d6656dcab74848ffb9d1f6f6 GIT binary patch literal 2102 zcmeH{!3}^Q3`IZS!Ni*rcys~>@a|U3##%@%i5^O7>`{JFV|aesLc@M+BQ9+Nu$H%_ zhC>BqeV#br3Zy8CF(RdeoO6%92Ym*9Gy~2oz&Axd*Le`+J^9!#;Gl87+1h@Mb4zXi zlQ-M1^=n-2k6iEaTm4#n8n@=R`lb4w=c{o!zis|F=ezUcTBRrZC35#i-+b2z)m8y5 literal 0 HcmV?d00001 diff --git a/samples/controls/icons/radio.bmp b/samples/controls/icons/radio.bmp new file mode 100644 index 0000000000000000000000000000000000000000..ca0a837dc02f64f80faa363ccbc787b5390ebd65 GIT binary patch literal 2102 zcmeH{!41P83`IXQhf2M5f*vzL2I#$8F&k@9|2PN{2@_S3awuPNFg$D^SiC>W9jlfJ zn8kZ-=CA=7e?HXU1kywy1jHDTQW`e?!Ki^hssVige*b#!3;{>DZ^+5}#P|jlaxT|{ zl-2h6Z4TU4mHpQ7M>ywL@jcEBSn(G3UaO#e{vI!p>ec7pQ{L=3_s1+0+g!=)=lp%n dnG|n0x9V#ai~@7d%80nsX2RB>I>V){&oNW literal 0 HcmV?d00001 diff --git a/samples/controls/icons/text.bmp b/samples/controls/icons/text.bmp new file mode 100644 index 0000000000000000000000000000000000000000..aedf05e5ca9052b4cc359422f9a21a1a047226c6 GIT binary patch literal 2102 zcmZ?rHRE6a12Yx|1`Qxf0g4$Jpb|iFA#Mm}U<68nFc7q~v@jeyc8uZw|No=5 zzz9kMkP=|%l8h7s1_maa0Ax5}d1f4di3y?~hcq)n9uofO>WG(TW@cbO*UgM%KCR^` dcR!}