]> git.saurik.com Git - wxWidgets.git/commitdiff
images in the notebook work under MSW too (with or without XPM)
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 12 Jan 1999 23:49:59 +0000 (23:49 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 12 Jan 1999 23:49:59 +0000 (23:49 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1388 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/controls/controls.cpp
samples/controls/controls.rc
samples/controls/icons/choice.bmp [new file with mode: 0644]
samples/controls/icons/combo.bmp [new file with mode: 0644]
samples/controls/icons/gauge.bmp [new file with mode: 0644]
samples/controls/icons/list.bmp [new file with mode: 0644]
samples/controls/icons/radio.bmp [new file with mode: 0644]
samples/controls/icons/text.bmp [new file with mode: 0644]

index a8f5b70ac990e80dc1c30e015f977eaa711bff85..41860f5bb5fcda657150ef57d9df92bd547f2a4a 100644 (file)
 #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
 
index 1016ec86f5b0b6e16d3d972821f0ffbf1bb5e9c3..746abb461847da127f3b4b431dcd4f52aa85b270 100644 (file)
@@ -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 (file)
index 0000000..4ee793e
Binary files /dev/null and b/samples/controls/icons/choice.bmp differ
diff --git a/samples/controls/icons/combo.bmp b/samples/controls/icons/combo.bmp
new file mode 100644 (file)
index 0000000..bcad7cd
Binary files /dev/null and b/samples/controls/icons/combo.bmp differ
diff --git a/samples/controls/icons/gauge.bmp b/samples/controls/icons/gauge.bmp
new file mode 100644 (file)
index 0000000..ff1cdcf
Binary files /dev/null and b/samples/controls/icons/gauge.bmp differ
diff --git a/samples/controls/icons/list.bmp b/samples/controls/icons/list.bmp
new file mode 100644 (file)
index 0000000..07277af
Binary files /dev/null and b/samples/controls/icons/list.bmp differ
diff --git a/samples/controls/icons/radio.bmp b/samples/controls/icons/radio.bmp
new file mode 100644 (file)
index 0000000..ca0a837
Binary files /dev/null and b/samples/controls/icons/radio.bmp differ
diff --git a/samples/controls/icons/text.bmp b/samples/controls/icons/text.bmp
new file mode 100644 (file)
index 0000000..aedf05e
Binary files /dev/null and b/samples/controls/icons/text.bmp differ