]> git.saurik.com Git - wxWidgets.git/commitdiff
the notebook now has the icons
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 3 Sep 1998 16:59:00 +0000 (16:59 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 3 Sep 1998 16:59:00 +0000 (16:59 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@660 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

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

index e0e3ea5cc165418d9533c04af0cb270c4f4e695a..6bb423f803dafb6fa2be35d8484180b03ba7dc2e 100644 (file)
@@ -25,6 +25,7 @@
 #endif
 
 #include "wx/notebook.h"
+#include "wx/imaglist.h"
 
 #ifdef __WXGTK__
 #include "mondrian.xpm"
@@ -45,6 +46,7 @@ class MyPanel: public wxPanel
   public:
  
     MyPanel(wxFrame *frame, int x, int y, int w, int h);
+    virtual ~MyPanel();
     
     void OnSize( wxSizeEvent& event );
     void OnListBox( wxCommandEvent &event );
@@ -196,6 +198,28 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) :
     "example.",
   };
   
+  // image ids and names
+  enum
+  {
+    Image_List, Image_Choice, Image_Combo, Image_Text, Image_Radio, Image_Max
+  };
+  
+  const char *aIconNames[] =
+  {
+    "list.xpm", "choice.xpm", "combo.xpm", "text.xpm", "radio.xpm"
+  };
+  
+  wxASSERT( WXSIZEOF(aIconNames) == Image_Max ); // keep in sync
+
+  // fill the image list
+  wxString strIconDir = "icons/";
+  wxImageList *imagelist = new wxImageList(32, 32);
+  for ( size_t n = 0; n < Image_Max; n++ ) {
+    imagelist->Add(wxBitmap(strIconDir + aIconNames[n]));
+  }
+
+  m_notebook->SetImageList(imagelist);
+
   wxPanel *panel = new wxPanel(m_notebook);
   m_listbox = new wxListBox( panel, ID_LISTBOX, wxPoint(10,10), wxSize(120,70), 4, choices );
   (void)new wxButton( panel, ID_LISTBOX_SEL_NUM, "Select #2", wxPoint(180,30), wxSize(100,30) );
@@ -203,7 +227,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) :
   (void)new wxButton( panel, ID_LISTBOX_CLEAR, "Clear", wxPoint(180,80), wxSize(100,30) );
   (void)new wxButton( panel, ID_LISTBOX_APPEND, "Append 'Hi!'", wxPoint(300,80), wxSize(100,30) );
   (void)new wxButton( panel, ID_LISTBOX_DELETE, "Delete selected item", wxPoint(180,130), wxSize(140,30) );
-  m_notebook->AddPage(panel, "wxList");
+  m_notebook->AddPage(panel, "wxList", FALSE, Image_List);
   
   panel = new wxPanel(m_notebook);
   m_choice = new wxChoice( panel, ID_CHOICE, wxPoint(10,10), wxSize(120,-1), 4, choices );
@@ -212,7 +236,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) :
   (void)new wxButton( panel, ID_CHOICE_CLEAR, "Clear", wxPoint(180,80), wxSize(100,30) );
   (void)new wxButton( panel, ID_CHOICE_APPEND, "Append 'Hi!'", wxPoint(300,80), wxSize(100,30) );
   (void)new wxButton( panel, ID_CHOICE_DELETE, "Delete selected item", wxPoint(180,130), wxSize(140,30) );
-  m_notebook->AddPage(panel, "wxChoice");
+  m_notebook->AddPage(panel, "wxChoice", FALSE, Image_Choice);
   
   panel = new wxPanel(m_notebook);
   m_combo = new wxComboBox( panel, ID_COMBO, "This", wxPoint(10,10), wxSize(170,-1), 4, choices );
@@ -221,16 +245,16 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) :
   (void)new wxButton( panel, ID_COMBO_CLEAR, "Clear", wxPoint(180,80), wxSize(100,30) );
   (void)new wxButton( panel, ID_COMBO_APPEND, "Append 'Hi!'", wxPoint(300,80), wxSize(100,30) );
   (void)new wxButton( panel, ID_COMBO_DELETE, "Delete selected item", wxPoint(180,130), wxSize(140,30) );
-  m_notebook->AddPage(panel, "wxComboBox");
+  m_notebook->AddPage(panel, "wxComboBox", FALSE, Image_Combo);
   
   wxTextCtrl *text = new wxTextCtrl( m_notebook, ID_TEXT, "Write text here.", wxPoint(10,10), wxSize(120,100), wxTE_MULTILINE );
-  m_notebook->AddPage( text, "wxTextCtrl" );
+  m_notebook->AddPage(text, "wxTextCtrl" , FALSE, Image_Text);
   
   panel = new wxPanel(m_notebook);
   m_radio = new wxRadioBox( panel, ID_RADIOBOX, "This", wxPoint(10,10), wxSize(-1,-1), 4, choices );
   (void)new wxButton( panel, ID_RADIOBOX_SEL_NUM, "Select #2", wxPoint(200,30), wxSize(100,30) );
   (void)new wxButton( panel, ID_RADIOBOX_SEL_STR, "Select 'This'", wxPoint(200,80), wxSize(100,30) );
-  m_notebook->AddPage(panel, "wxRadioBox");
+  m_notebook->AddPage(panel, "wxRadioBox", FALSE, Image_Radio);
 }
 
 void MyPanel::OnSize( wxSizeEvent& WXUNUSED(event) )
@@ -387,6 +411,11 @@ void MyPanel::OnRadioButtons( wxCommandEvent &event )
   }
 }
 
+MyPanel::~MyPanel()
+{
+  delete m_notebook->GetImageList();
+}
+
 //----------------------------------------------------------------------
 // MyFrame
 //----------------------------------------------------------------------
@@ -412,5 +441,3 @@ void MyFrame::OnAbout( wxCommandEvent& WXUNUSED(event) )
   wxMessageDialog dialog(this, "This is a control sample", "About Controls", wxOK );
   dialog.ShowModal();
 }
-
-
diff --git a/samples/controls/icons/choice.xpm b/samples/controls/icons/choice.xpm
new file mode 100644 (file)
index 0000000..486adf4
--- /dev/null
@@ -0,0 +1,53 @@
+/* XPM */
+static char * choice_xpm[] = {
+"64 48 2 1",
+"      c #FFFFFFFFFFFF",
+".     c #FAFA13134040",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"          ..           .              ..                        ",
+"           .                         .  .                       ",
+"           .                            .                       ",
+"      ..   ...    ..  ..   ..    ..    .                        ",
+"     .  .  .  .  .  .  .  .  .  .  .  .                         ",
+"     .     .  .  .  .  .  .     ....  .                         ",
+"     .     .  .  .  .  .  .     .     .                         ",
+"     .  .  .  .  .  .  .  .  .  ..  .                           ",
+"      ..  ... ..  ..  ...  ..    ...  .                         ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                "};
diff --git a/samples/controls/icons/combo.xpm b/samples/controls/icons/combo.xpm
new file mode 100644 (file)
index 0000000..6a72bcb
--- /dev/null
@@ -0,0 +1,53 @@
+/* XPM */
+static char * combo_xpm[] = {
+"64 48 2 1",
+"      c #FFFFFFFFFFFF",
+".     c #3B3BFAFA3434",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                             ..                                 ",
+"                              .                                 ",
+"                              .            .                    ",
+"          ..    ..  . .. ..   ...    ..    .                    ",
+"         .  .  .  .  .  .  .  .  .  .  .   .                    ",
+"         .     .  .  .  .  .  .  .  .  .   .                    ",
+"         .     .  .  .  .  .  .  .  .  .   .                    ",
+"         .  .  .  .  .  .  .  .  .  .  .   .                    ",
+"          ..    ..  ... .. .. ...    ..    .                    ",
+"                                                                ",
+"                                           .                    ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"         .....  .....  .....  .....  .....  .....               ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                "};
diff --git a/samples/controls/icons/list.xpm b/samples/controls/icons/list.xpm
new file mode 100644 (file)
index 0000000..57f985f
--- /dev/null
@@ -0,0 +1,53 @@
+/* XPM */
+static char * list_xpm[] = {
+"64 48 2 1",
+"      c #FFFFFFFFFFFF",
+".     c #51515151FBFB",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"       ..  .                                                    ",
+"        .                                                       ",
+"        .           .                                           ",
+"        . ..   ... ....                                         ",
+"        .  .  .  .  .                                           ",
+"        .  .  ..    .                                           ",
+"        .  .    ..  .                                           ",
+"        .  .  .  .  .                                           ",
+"       ...... ...    ..                                         ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"       ..  .                                                    ",
+"        .                                                       ",
+"        .           .                                           ",
+"        . ..   ... ....                                         ",
+"        .  .  .  .  .                                           ",
+"        .  .  ..    .                                           ",
+"        .  .    ..  .                                           ",
+"        .  .  .  .  .                                           ",
+"       ...... ...    ..                                         ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"       ..  .                                                    ",
+"        .                                                       ",
+"        .           .                                           ",
+"        . ..   ... ....                                         ",
+"        .  .  .  .  .                                           ",
+"        .  .  ..    .                                           ",
+"        .  .    ..  .                                           ",
+"        .  .  .  .  .                                           ",
+"       ...... ...    ..                                         ",
+"                                                                ",
+"                                                                ",
+"                                                                "};
diff --git a/samples/controls/icons/radio.xpm b/samples/controls/icons/radio.xpm
new file mode 100644 (file)
index 0000000..c69bf9f
--- /dev/null
@@ -0,0 +1,53 @@
+/* XPM */
+static char * radio_xpm[] = {
+"64 48 2 1",
+"      c #FFFFFFFFFFFF",
+".     c #FFFF0000FFFF",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"            ......           ..  .             .   .   .        ",
+"             .   ..           .               .  . . .  .       ",
+"             .    .           .               .   ...   .       ",
+"             .   ..   ..    ... ..   ..      .   . . .   .      ",
+"             .....   .  .  .  .  .  .  .     .     .     .      ",
+"             .  .     ...  .  .  .  .  .     .           .      ",
+"             .   .   .  .  .  .  .  .  .     .           .      ",
+"             .    .  .  .  .  .  .  .  .     .           .      ",
+"            ...   ..  .. .  .. ....  ..      .           .      ",
+"                                              .         .       ",
+"                                              .         .       ",
+"                                               .       .        ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                "};
diff --git a/samples/controls/icons/text.xpm b/samples/controls/icons/text.xpm
new file mode 100644 (file)
index 0000000..3d68886
--- /dev/null
@@ -0,0 +1,53 @@
+/* XPM */
+static char * text_xpm[] = {
+"64 48 2 1",
+"      c #FFFFFFFFFFFF",
+".     c #000000000000",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                        ..                                      ",
+"                         .                                      ",
+"                         .                                      ",
+"   ..  ..  ..  .. ..     .  . . ..    ..  ... .. ..             ",
+"    .  .  .  .  .  .     . .   .  .  .  .  .  .  .              ",
+"    . ..  .  .  .  .     ..    .  .  .  .  .. . ..              ",
+"    . .   .  .  .  .     . .   .  .  .  .   . . .               ",
+"     ..   .  .  .  .     .  .  .  .  .  .   .. .                ",
+"     .     ..    .. .    .  ..... ..  ..    .  .                ",
+"     .                                                          ",
+"    .                                                           ",
+"   ..                                                           ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"            ..               ..      .                          ",
+"             .              .  .                                ",
+"             .           .     .        .                       ",
+"   ... .. .. ...    ..  ....  .     .. ....                     ",
+"    .  .  .  .  .  .  .  .   .       .  .                       ",
+"    .. . ..  .  .   ...  .   .       .  .                       ",
+"     . . .   .  .  .  .  .   .       .  .                       ",
+"     .. .    .  .  .  .  .           .  .                       ",
+"     .  .   ... ..  .. .  .. .      ...  ..                     ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                      ..           .                            ",
+"                       .           .                            ",
+"                       .           .                            ",
+"   ... .. ..  ..  . .. .  .   ...  .                            ",
+"    .  .  .  .  .  ..  . .   .  .  .                            ",
+"    .. . ..  .  .  .   ..    ..    .                            ",
+"     . . .   .  .  .   . .     ..  .                            ",
+"     .. .    .  .  .   .  .  .  .                               ",
+"     .  .     ..  ...  .  .. ...   .                            ",
+"                                                                ",
+"                                                                ",
+"                                                                ",
+"                                                                "};