#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
//----------------------------------------------------------------------
};
#ifdef USE_XPM
- // image ids and names
+ // image ids
enum
{
Image_List, Image_Choice, Image_Combo, Image_Text, Image_Radio, Image_Gauge, Image_Max
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
"\n"
"This is also supposed to demonstrate how\n"
"to use static controls.\n",
- wxPoint(208,25), wxSize(200, 100) );
+ wxPoint(208,25)
+#ifdef __WXMSW__
+ ,wxSize(210, 110)
+#endif
+ );
m_spintext = new wxTextCtrl( panel, -1, "0", wxPoint(20,160), wxSize(80,-1) );
m_spintext->SetBackgroundColour("wheat");
m_spinbutton = new wxSpinButton( panel, ID_SPIN, wxPoint(103,159), wxSize(-1,-1) );
{
#ifdef __WXGTK__
- if (!wxTheClipboard->IsSupportedFormat( wxDF_TEXT ))
- {
- *m_text << "The clipboard doesn't contain any data in the requested format." << "\n";
-
- return;
- }
-
if (!wxTheClipboard->Open())
{
*m_text << "Error opening the clipboard." << "\n";
if (text.IsEmpty()) return;
- wxTextDataObject *data = new wxTextDataObject( text );
-
if (!wxTheClipboard->Open())
{
*m_text << "Error opening the clipboard." << "\n";
*m_text << "Successfully opened the clipboard." << "\n";
}
- if (!wxTheClipboard->SetData( data ))
+ wxTextDataObject *data = new wxTextDataObject( text );
+ wxDataBroker *broker = new wxDataBroker();
+ broker->Add( data );
+
+ if (!wxTheClipboard->SetData( broker ))
{
*m_text << "Error while copying to the clipboard." << "\n";
}