]> git.saurik.com Git - wxWidgets.git/commitdiff
Added bitmaps and icons to samples
authorRobert Roebling <robert@roebling.de>
Fri, 31 Jul 1998 20:04:04 +0000 (20:04 +0000)
committerRobert Roebling <robert@roebling.de>
Fri, 31 Jul 1998 20:04:04 +0000 (20:04 +0000)
  Fixed event handling in all controls
  Add some missing functions to wxRadioBox
  Fixed clientData stuff to Choice (Combo?)
  No more gtk warning in Combo
  Fixed toolbar sample and mdi sample
  Fixed bug in AddChild resulting from mdi changes
  Fixed wxFrame::GetPosition()
  Changed order of notification calls in wxListCtrl
  to prevent what I think is a reentry bug
  The usual compile fixes here and there

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@408 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

62 files changed:
include/wx/gtk/combobox.h
include/wx/gtk/radiobox.h
include/wx/gtk1/combobox.h
include/wx/gtk1/radiobox.h
samples/controls/controls.cpp
samples/controls/mondrian.xpm [new file with mode: 0644]
samples/dialogs/dialogs.cpp
samples/dnd/dnd.cpp
samples/dnd/mondrian.xpm [new file with mode: 0644]
samples/dynamic/minimal.cpp
samples/dynamic/mondrian.xpm [new file with mode: 0644]
samples/internat/internat.cpp
samples/internat/mondrian.xpm [new file with mode: 0644]
samples/mdi/bitmaps/copy.xpm [new file with mode: 0644]
samples/mdi/bitmaps/cut.xpm [new file with mode: 0644]
samples/mdi/bitmaps/help.xpm [new file with mode: 0644]
samples/mdi/bitmaps/new.xpm [new file with mode: 0644]
samples/mdi/bitmaps/open.xpm [new file with mode: 0644]
samples/mdi/bitmaps/print.xpm [new file with mode: 0644]
samples/mdi/bitmaps/save.xpm [new file with mode: 0644]
samples/mdi/mdi.cpp
samples/mdi/mondrian.xpm [new file with mode: 0644]
samples/memcheck/memcheck.cpp
samples/memcheck/mondrian.xpm [new file with mode: 0644]
samples/toolbar/bitmaps/copy.xpm [new file with mode: 0644]
samples/toolbar/bitmaps/cut.xpm [new file with mode: 0644]
samples/toolbar/bitmaps/help.xpm [new file with mode: 0644]
samples/toolbar/bitmaps/new.xpm [new file with mode: 0644]
samples/toolbar/bitmaps/open.xpm [new file with mode: 0644]
samples/toolbar/bitmaps/preview.xpm [new file with mode: 0644]
samples/toolbar/bitmaps/print.xpm [new file with mode: 0644]
samples/toolbar/bitmaps/save.xpm [new file with mode: 0644]
samples/toolbar/mondrian.xpm [new file with mode: 0644]
samples/toolbar/test.cpp
samples/treectrl/mondrian.xpm [new file with mode: 0644]
samples/treectrl/treetest.cpp
src/generic/listctrl.cpp
src/gtk/bmpbuttn.cpp
src/gtk/button.cpp
src/gtk/checkbox.cpp
src/gtk/choice.cpp
src/gtk/combobox.cpp
src/gtk/frame.cpp
src/gtk/listbox.cpp
src/gtk/radiobox.cpp
src/gtk/scrolbar.cpp
src/gtk/textctrl.cpp
src/gtk/window.cpp
src/gtk1/bmpbuttn.cpp
src/gtk1/button.cpp
src/gtk1/checkbox.cpp
src/gtk1/choice.cpp
src/gtk1/combobox.cpp
src/gtk1/frame.cpp
src/gtk1/listbox.cpp
src/gtk1/radiobox.cpp
src/gtk1/scrolbar.cpp
src/gtk1/textctrl.cpp
src/gtk1/window.cpp
user/wxFile/wxFile.cpp
user/wxLayout/wxllist.h
user/wxLayout/wxlwindow.h

index 28a906f941f81cbe8720ccb486ed56faff0ca5fd..1215f6a85db33de395e66e65a768de39399b4f2e 100644 (file)
@@ -76,6 +76,7 @@ class wxComboBox: public wxControl
   wxString GetStringSelection(void) const;
   int Number(void) const;
   void SetSelection( int n );
+  void SetStringSelection( const wxString &string );
 
   // Text field functions
   wxString GetValue(void) const ;
@@ -96,8 +97,11 @@ class wxComboBox: public wxControl
 
   private:
   
-  wxList m_clientData;
-   
+    wxList   m_clientData;
+  
+  public:
+  
+    bool     m_alreadySent;
 };
 
 #endif // __GTKCOMBOBOXH__
index f648659e65b7855d9ee71822576277514d4473ff..c1218fc449dbd900c3cad34733410013921b7b39 100644 (file)
@@ -79,6 +79,9 @@ class wxRadioBox: public wxControl
   
     GtkRadioButton *m_radio;
     
+  public:
+  
+    bool            m_alreadySent;
 };
 
 #endif // __GTKRADIOBOXH__
index 28a906f941f81cbe8720ccb486ed56faff0ca5fd..1215f6a85db33de395e66e65a768de39399b4f2e 100644 (file)
@@ -76,6 +76,7 @@ class wxComboBox: public wxControl
   wxString GetStringSelection(void) const;
   int Number(void) const;
   void SetSelection( int n );
+  void SetStringSelection( const wxString &string );
 
   // Text field functions
   wxString GetValue(void) const ;
@@ -96,8 +97,11 @@ class wxComboBox: public wxControl
 
   private:
   
-  wxList m_clientData;
-   
+    wxList   m_clientData;
+  
+  public:
+  
+    bool     m_alreadySent;
 };
 
 #endif // __GTKCOMBOBOXH__
index f648659e65b7855d9ee71822576277514d4473ff..c1218fc449dbd900c3cad34733410013921b7b39 100644 (file)
@@ -79,6 +79,9 @@ class wxRadioBox: public wxControl
   
     GtkRadioButton *m_radio;
     
+  public:
+  
+    bool            m_alreadySent;
 };
 
 #endif // __GTKRADIOBOXH__
index 7ecbdf18d92f6d1335d2331459b3317f2a1d267d..3f805cc9fe6121854d20f35c1a7f98461f0fd957 100644 (file)
 
 #include "wx/notebook.h"
 
+#ifdef __WXGTK__
+#include "mondrian.xpm"
+#endif
+
 //----------------------------------------------------------------------
 // class definitions
 //----------------------------------------------------------------------
@@ -45,10 +49,17 @@ class MyPanel: public wxPanel
     void OnSize( wxSizeEvent& event );
     void OnListBox( wxCommandEvent &event );
     void OnListBoxButtons( wxCommandEvent &event );
+    void OnChoice( wxCommandEvent &event );
+    void OnChoiceButtons( wxCommandEvent &event );
+    void OnCombo( wxCommandEvent &event );
+    void OnComboButtons( wxCommandEvent &event );
+    void OnRadio( wxCommandEvent &event );
+    void OnRadioButtons( wxCommandEvent &event );
     
     wxListBox   *m_listbox;
     wxChoice    *m_choice;
     wxComboBox  *m_combo;
+    wxRadioBox  *m_radio;
     
     wxTextCtrl  *m_text;
     wxNotebook  *m_notebook;    
@@ -93,9 +104,8 @@ bool MyApp::OnInit(void)
   // Give it an icon
 #ifdef __WXMSW__
   frame->SetIcon(wxIcon("mondrian"));
-#endif
-#ifdef __X__
-  frame->SetIcon(wxIcon("aiai.xbm"));
+#else
+  frame->SetIcon(wxIcon( mondrian_xpm ));
 #endif
 
   wxMenu *file_menu = new wxMenu;
@@ -132,9 +142,17 @@ const  ID_CHOICE_CLEAR      = 123;
 const  ID_CHOICE_APPEND     = 124;
 
 const  ID_COMBO             = 140;
+const  ID_COMBO_SEL_NUM     = 141;
+const  ID_COMBO_SEL_STR     = 142;
+const  ID_COMBO_CLEAR       = 143;
+const  ID_COMBO_APPEND      = 144;
 
 const  ID_TEXT              = 150;
 
+const  ID_RADIOBOX          = 160;
+const  ID_RADIOBOX_SEL_NUM  = 161;
+const  ID_RADIOBOX_SEL_STR  = 162;
+
 BEGIN_EVENT_TABLE(MyPanel, wxPanel)
   EVT_SIZE      (                       MyPanel::OnSize)
   EVT_LISTBOX   (ID_LISTBOX,            MyPanel::OnListBox)
@@ -142,6 +160,19 @@ BEGIN_EVENT_TABLE(MyPanel, wxPanel)
   EVT_BUTTON    (ID_LISTBOX_SEL_STR,    MyPanel::OnListBoxButtons)
   EVT_BUTTON    (ID_LISTBOX_CLEAR,      MyPanel::OnListBoxButtons)
   EVT_BUTTON    (ID_LISTBOX_APPEND,     MyPanel::OnListBoxButtons)
+  EVT_CHOICE    (ID_CHOICE,             MyPanel::OnChoice)
+  EVT_BUTTON    (ID_CHOICE_SEL_NUM,     MyPanel::OnChoiceButtons)
+  EVT_BUTTON    (ID_CHOICE_SEL_STR,     MyPanel::OnChoiceButtons)
+  EVT_BUTTON    (ID_CHOICE_CLEAR,       MyPanel::OnChoiceButtons)
+  EVT_BUTTON    (ID_CHOICE_APPEND,      MyPanel::OnChoiceButtons)
+  EVT_CHOICE    (ID_COMBO,              MyPanel::OnCombo)
+  EVT_BUTTON    (ID_COMBO_SEL_NUM,      MyPanel::OnComboButtons)
+  EVT_BUTTON    (ID_COMBO_SEL_STR,      MyPanel::OnComboButtons)
+  EVT_BUTTON    (ID_COMBO_CLEAR,        MyPanel::OnComboButtons)
+  EVT_BUTTON    (ID_COMBO_APPEND,       MyPanel::OnComboButtons)
+  EVT_RADIOBOX  (ID_RADIOBOX,           MyPanel::OnRadio)
+  EVT_BUTTON    (ID_RADIOBOX_SEL_NUM,   MyPanel::OnRadioButtons)
+  EVT_BUTTON    (ID_RADIOBOX_SEL_STR,   MyPanel::OnRadioButtons)
 END_EVENT_TABLE()
 
 MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) :
@@ -154,18 +185,13 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) :
   wxString choices[] =
   {
     "This",
-    "is",
-    "a",
-    "wonderfull example.",
-    "Or",
-    "what",
-    "do",
-    "you",
-    "think?"
+    "is a",
+    "wonderfull",
+    "example.",
   };
   
   wxPanel *panel = new wxPanel(m_notebook);
-  m_listbox = new wxListBox( panel, ID_LISTBOX, wxPoint(10,10), wxSize(120,70), 9, choices );
+  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) );
   (void)new wxButton( panel, ID_LISTBOX_SEL_STR, "Select 'This'", wxPoint(300,30), wxSize(100,30) );
   (void)new wxButton( panel, ID_LISTBOX_CLEAR, "Clear", wxPoint(180,80), wxSize(100,30) );
@@ -173,15 +199,29 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) :
   m_notebook->AddPage(panel, "wxList");
   
   panel = new wxPanel(m_notebook);
-  m_choice = new wxChoice( panel, ID_CHOICE, wxPoint(10,10), wxSize(120,-1), 9, choices );
+  m_choice = new wxChoice( panel, ID_CHOICE, wxPoint(10,10), wxSize(120,-1), 4, choices );
+  (void)new wxButton( panel, ID_CHOICE_SEL_NUM, "Select #2", wxPoint(180,30), wxSize(100,30) );
+  (void)new wxButton( panel, ID_CHOICE_SEL_STR, "Select 'This'", wxPoint(300,30), wxSize(100,30) );
+  (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) );
   m_notebook->AddPage(panel, "wxChoice");
   
   panel = new wxPanel(m_notebook);
-  m_combo = new wxComboBox( panel, ID_COMBO, "This", wxPoint(10,10), wxSize(120,-1), 9, choices );
+  m_combo = new wxComboBox( panel, ID_COMBO, "This", wxPoint(10,10), wxSize(170,-1), 4, choices );
+  (void)new wxButton( panel, ID_COMBO_SEL_NUM, "Select #2", wxPoint(180,30), wxSize(100,30) );
+  (void)new wxButton( panel, ID_COMBO_SEL_STR, "Select 'This'", wxPoint(300,30), wxSize(100,30) );
+  (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) );
   m_notebook->AddPage(panel, "wxComboBox");
   
   wxTextCtrl *text = new wxTextCtrl( m_notebook, ID_TEXT, "Write text here.", wxPoint(10,10), wxSize(120,100), wxTE_MULTILINE );
   m_notebook->AddPage( text, "wxTextCtrl" );
+  
+  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");
 }
 
 void MyPanel::OnSize( wxSizeEvent& WXUNUSED(event) )
@@ -196,16 +236,128 @@ void MyPanel::OnSize( wxSizeEvent& WXUNUSED(event) )
 
 void MyPanel::OnListBox( wxCommandEvent &event )
 {
-  m_text->WriteText( "ListBox Event:\n");
   m_text->WriteText( "ListBox selection string is: " );
   m_text->WriteText( event.GetString() );
   m_text->WriteText( "\n" );
 }
 
-void MyPanel::OnListBoxButtons( wxCommandEvent &WXUNUSED(event) )
+void MyPanel::OnListBoxButtons( wxCommandEvent &event )
+{
+  switch (event.GetId())
+  {
+    case ID_LISTBOX_SEL_NUM:
+    {
+      m_listbox->SetSelection( 2 );
+      break;
+    }
+    case ID_LISTBOX_SEL_STR:
+    {
+      m_listbox->SetStringSelection( "This" );
+      break;
+    }
+    case ID_LISTBOX_CLEAR:
+    {
+      m_listbox->Clear();
+      break;
+    }
+    case ID_LISTBOX_APPEND:
+    {
+      m_listbox->Append( "Hi!" );
+      break;
+    }
+  }
+}
+
+void MyPanel::OnChoice( wxCommandEvent &event )
+{
+  m_text->WriteText( "Choice selection string is: " );
+  m_text->WriteText( event.GetString() );
+  m_text->WriteText( "\n" );
+}
+
+void MyPanel::OnChoiceButtons( wxCommandEvent &event )
+{
+  switch (event.GetId())
+  {
+    case ID_CHOICE_SEL_NUM:
+    {
+      m_choice->SetSelection( 2 );
+      break;
+    }
+    case ID_CHOICE_SEL_STR:
+    {
+      m_choice->SetStringSelection( "This" );
+      break;
+    }
+    case ID_CHOICE_CLEAR:
+    {
+      m_choice->Clear();
+      break;
+    }
+    case ID_CHOICE_APPEND:
+    {
+      m_choice->Append( "Hi!" );
+      break;
+    }
+  }
+}
+
+void MyPanel::OnCombo( wxCommandEvent &event )
+{
+  m_text->WriteText( "ComboBox selection string is: " );
+  m_text->WriteText( event.GetString() );
+  m_text->WriteText( "\n" );
+}
+
+void MyPanel::OnComboButtons( wxCommandEvent &event )
 {
-       if (m_notebook->GetPageCount() > 1)
-               m_notebook->DeletePage( 1 );
+  switch (event.GetId())
+  {
+    case ID_COMBO_SEL_NUM:
+    {
+      m_combo->SetSelection( 2 );
+      break;
+    }
+    case ID_COMBO_SEL_STR:
+    {
+      m_combo->SetStringSelection( "This" );
+      break;
+    }
+    case ID_COMBO_CLEAR:
+    {
+      m_combo->Clear();
+      break;
+    }
+    case ID_COMBO_APPEND:
+    {
+      m_combo->Append( "Hi!" );
+      break;
+    }
+  }
+}
+
+void MyPanel::OnRadio( wxCommandEvent &event )
+{
+  m_text->WriteText( "RadioBox selection string is: " );
+  m_text->WriteText( event.GetString() );
+  m_text->WriteText( "\n" );
+}
+
+void MyPanel::OnRadioButtons( wxCommandEvent &event )
+{
+  switch (event.GetId())
+  {
+    case ID_RADIOBOX_SEL_NUM:
+    {
+      m_radio->SetSelection( 2 );
+      break;
+    }
+    case ID_RADIOBOX_SEL_STR:
+    {
+      m_radio->SetStringSelection( "This" );
+      break;
+    }
+  }
 }
 
 //----------------------------------------------------------------------
diff --git a/samples/controls/mondrian.xpm b/samples/controls/mondrian.xpm
new file mode 100644 (file)
index 0000000..409f27a
--- /dev/null
@@ -0,0 +1,44 @@
+/* XPM */
+static char *mondrian_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"32 32 6 1",
+"  c Black",
+". c Blue",
+"X c #00bf00",
+"o c Red",
+"O c Yellow",
+"+ c Gray100",
+/* pixels */
+"                                ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+"                                ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++      ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++                    ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+"                                "
+};
index 7a501ba5efe60d0c488a7f8201328c75d3e67fba..0d8fd9a3633991485722abb3f34cfd0cf32a7ded 100644 (file)
@@ -50,7 +50,7 @@ IMPLEMENT_WXWIN_MAIN
 bool MyApp::OnInit(void)
 {
   m_canvasTextColour = wxColour("BLACK");
-  m_canvasFont = *wxNORMAL_FONT;
+  m_canvasFont = *wxSWISS_FONT;
 
   // Create the main frame window
   MyFrame *frame = new MyFrame(NULL, "wxWindows dialogs example", wxPoint(50, 50), wxSize(400, 300));
index 9c6155983807e217b1bd14eec69119c936494e2e..53f2c43f12aa98973a571690257183c742c6b031 100644 (file)
 
 #include  "wx/dnd.h"
 
+#ifdef __WXGTK__
+#include "mondrian.xpm"
+#endif
+
 // ----------------------------------------------------------------------------
 // Derive 2 simple classes which just put in the listbox the strings (text or
 // file names) we drop on them
@@ -142,6 +146,8 @@ DnDFrame::DnDFrame(wxFrame *frame, char *title, int x, int y, int w, int h)
 #ifdef __WXMSW__
   // frame icon and status bar
   SetIcon(wxIcon("mondrian"));
+#else
+  SetIcon(wxIcon(mondrian_xpm));
 #endif  
   
   const int widths[] = { -1 };
diff --git a/samples/dnd/mondrian.xpm b/samples/dnd/mondrian.xpm
new file mode 100644 (file)
index 0000000..409f27a
--- /dev/null
@@ -0,0 +1,44 @@
+/* XPM */
+static char *mondrian_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"32 32 6 1",
+"  c Black",
+". c Blue",
+"X c #00bf00",
+"o c Red",
+"O c Yellow",
+"+ c Gray100",
+/* pixels */
+"                                ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+"                                ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++      ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++                    ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+"                                "
+};
index 50b45ca0bd7a6275b93338356c747b692ae2a172..393cc3795700fdda517077f70d114b29e5d6d01f 100644 (file)
 #include "wx/wx.h"
 #endif
 
+#ifdef __WXGTK__
+#include "mondrian.xpm"
+#endif
+
 // Define a new application type
 class MyApp: public wxApp
 { public:
@@ -62,9 +66,8 @@ bool MyApp::OnInit(void)
   // Give it an icon
 #ifdef __WXMSW__
   frame->SetIcon(wxIcon("mondrian"));
-#endif
-#ifdef __X__
-  frame->SetIcon(wxIcon("aiai.xbm"));
+#else
+  frame->SetIcon(wxIcon(mondrian_xpm));
 #endif
 
   // Make a menubar
diff --git a/samples/dynamic/mondrian.xpm b/samples/dynamic/mondrian.xpm
new file mode 100644 (file)
index 0000000..409f27a
--- /dev/null
@@ -0,0 +1,44 @@
+/* XPM */
+static char *mondrian_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"32 32 6 1",
+"  c Black",
+". c Blue",
+"X c #00bf00",
+"o c Red",
+"O c Yellow",
+"+ c Gray100",
+/* pixels */
+"                                ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+"                                ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++      ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++                    ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+"                                "
+};
index 265dd57e678767a068a317f4ec1327b1dead2e97..6e669da1a8ca7b2824a2b6b06ae454197c1033ba 100644 (file)
 #include "wx/file.h"
 #include "wx/log.h"
 
+#ifdef __WXGTK__
+#include "mondrian.xpm"
+#endif
+
 // Define a new application type
 class MyApp: public wxApp
 {
@@ -100,9 +104,8 @@ bool MyApp::OnInit(void)
   // Give it an icon
 #ifdef __WXMSW__
   frame->SetIcon(wxIcon("mondrian"));
-#endif
-#ifdef __X__
-  frame->SetIcon(wxIcon("aiai.xbm"));
+#else
+  frame->SetIcon(wxIcon(mondrian_xpm));
 #endif
 
   // Make a menubar
diff --git a/samples/internat/mondrian.xpm b/samples/internat/mondrian.xpm
new file mode 100644 (file)
index 0000000..409f27a
--- /dev/null
@@ -0,0 +1,44 @@
+/* XPM */
+static char *mondrian_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"32 32 6 1",
+"  c Black",
+". c Blue",
+"X c #00bf00",
+"o c Red",
+"O c Yellow",
+"+ c Gray100",
+/* pixels */
+"                                ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+"                                ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++      ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++                    ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+"                                "
+};
diff --git a/samples/mdi/bitmaps/copy.xpm b/samples/mdi/bitmaps/copy.xpm
new file mode 100644 (file)
index 0000000..47565c1
--- /dev/null
@@ -0,0 +1,25 @@
+/* XPM */
+static char *copy_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"16 15 4 1",
+"  c None",
+". c Black",
+"X c Gray100",
+"o c #000080",
+/* pixels */
+"                ",
+" ......         ",
+" .XXXX..        ",
+" .XXXX.X.       ",
+" .X..X.oooooo   ",
+" .XXXXXoXXXXoo  ",
+" .X....oXXXXoXo ",
+" .XXXXXoX..Xoooo",
+" .X....oXXXXXXXo",
+" .XXXXXoX.....Xo",
+" ......oXXXXXXXo",
+"       oX.....Xo",
+"       oXXXXXXXo",
+"       ooooooooo",
+"                "
+};
diff --git a/samples/mdi/bitmaps/cut.xpm b/samples/mdi/bitmaps/cut.xpm
new file mode 100644 (file)
index 0000000..bfe7e95
--- /dev/null
@@ -0,0 +1,24 @@
+/* XPM */
+static char *cut_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"16 15 3 1",
+"  c None",
+". c Black",
+"X c #000080",
+/* pixels */
+"                ",
+"     .   .      ",
+"     .   .      ",
+"     .   .      ",
+"     .. ..      ",
+"      . .       ",
+"      ...       ",
+"       .        ",
+"      X.X       ",
+"      X XXX     ",
+"    XXX X  X    ",
+"   X  X X  X    ",
+"   X  X X  X    ",
+"   X  X  XX     ",
+"    XX          "
+};
diff --git a/samples/mdi/bitmaps/help.xpm b/samples/mdi/bitmaps/help.xpm
new file mode 100644 (file)
index 0000000..50fdb41
--- /dev/null
@@ -0,0 +1,25 @@
+/* XPM */
+static char *help_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"16 15 4 1",
+"  c None",
+". c Black",
+"X c Blue",
+"o c #000080",
+/* pixels */
+"                ",
+"     ......     ",
+"    .XXXXX..    ",
+"   .XX...oX..   ",
+"   .X..  .X..   ",
+"   .X.. .XX..   ",
+"    .. .XX..    ",
+"      .XX..     ",
+"      .X..      ",
+"      .X..      ",
+"      .o..      ",
+"       ..       ",
+"      .XX..     ",
+"      .XX..     ",
+"       ...      "
+};
diff --git a/samples/mdi/bitmaps/new.xpm b/samples/mdi/bitmaps/new.xpm
new file mode 100644 (file)
index 0000000..754d2d2
--- /dev/null
@@ -0,0 +1,24 @@
+/* XPM */
+static char *new_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"16 15 3 1",
+"  c None",
+". c Black",
+"X c Gray100",
+/* pixels */
+"                ",
+"   ........     ",
+"   .XXXXXX..    ",
+"   .XXXXXX.X.   ",
+"   .XXXXXX....  ",
+"   .XXXXXXXXX.  ",
+"   .XXXXXXXXX.  ",
+"   .XXXXXXXXX.  ",
+"   .XXXXXXXXX.  ",
+"   .XXXXXXXXX.  ",
+"   .XXXXXXXXX.  ",
+"   .XXXXXXXXX.  ",
+"   .XXXXXXXXX.  ",
+"   ...........  ",
+"                "
+};
diff --git a/samples/mdi/bitmaps/open.xpm b/samples/mdi/bitmaps/open.xpm
new file mode 100644 (file)
index 0000000..54748e9
--- /dev/null
@@ -0,0 +1,26 @@
+/* XPM */
+static char *open_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"16 15 5 1",
+"  c None",
+". c Black",
+"X c Yellow",
+"o c Gray100",
+"O c #bfbf00",
+/* pixels */
+"                ",
+"          ...   ",
+"         .   . .",
+"              ..",
+"  ...        ...",
+" .XoX.......    ",
+" .oXoXoXoXo.    ",
+" .XoXoXoXoX.    ",
+" .oXoX..........",
+" .XoX.OOOOOOOOO.",
+" .oo.OOOOOOOOO. ",
+" .X.OOOOOOOOO.  ",
+" ..OOOOOOOOO.   ",
+" ...........    ",
+"                "
+};
diff --git a/samples/mdi/bitmaps/print.xpm b/samples/mdi/bitmaps/print.xpm
new file mode 100644 (file)
index 0000000..3c2e2be
--- /dev/null
@@ -0,0 +1,26 @@
+/* XPM */
+static char *print_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"16 15 5 1",
+"  c None",
+". c Black",
+"X c Gray100",
+"o c #808000",
+"O c Yellow",
+/* pixels */
+"                ",
+"     .........  ",
+"    .XXXXXXXX.  ",
+"    .X.....X.   ",
+"   .XXXXXXXX.   ",
+"   .X.....X.... ",
+"  .XXXXXXXX. . .",
+" .......... . ..",
+".          . . .",
+".............  .",
+".      ooo  . . ",
+".      OOO  ... ",
+"............. . ",
+" .         . .  ",
+"  ...........   "
+};
diff --git a/samples/mdi/bitmaps/save.xpm b/samples/mdi/bitmaps/save.xpm
new file mode 100644 (file)
index 0000000..01b18f9
--- /dev/null
@@ -0,0 +1,25 @@
+/* XPM */
+static char *save_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"16 15 4 1",
+"  c None",
+". c Black",
+"X c #808000",
+"o c #808080",
+/* pixels */
+"                ",
+" .............. ",
+" .X.        . . ",
+" .X.        ... ",
+" .X.        .X. ",
+" .X.        .X. ",
+" .X.        .X. ",
+" .X.        .X. ",
+" .XX........oX. ",
+" .XXXXXXXXXXXX. ",
+" .XX.........X. ",
+" .XX......  .X. ",
+" .XX......  .X. ",
+" .XX......  .X. ",
+"  ............. "
+};
index dfcfa0bb4b5e27aade694a991547ee45350fe5ec..342f52299d310a855fe97e085864bc1c6338a682 100644 (file)
 #include <wx/toolbar.h>
 
 #ifdef __WXGTK__
-#include "folder.xpm"
+#include "mondrian.xpm"
+#include "bitmaps/new.xpm"
+#include "bitmaps/open.xpm"
+#include "bitmaps/save.xpm"
+#include "bitmaps/copy.xpm"
+#include "bitmaps/cut.xpm"
+// #include "bitmaps/paste.xpm"
+#include "bitmaps/print.xpm"
+#include "bitmaps/preview.xpm"
+#include "bitmaps/help.xpm"
 #endif
 
+
 #include "mdi.h"
 
 MyFrame *frame = NULL;
@@ -52,9 +62,6 @@ bool MyApp::OnInit(void)
 #ifdef __WXMSW__
   frame->SetIcon(wxIcon("mdi_icn"));
 #endif
-#ifdef __X__
-  frame->SetIcon(wxIcon("aiai.xbm"));
-#endif
 
   // Make a menubar
   wxMenu *file_menu = new wxMenu;
@@ -136,9 +143,8 @@ void MyFrame::OnNewWindow(wxCommandEvent& WXUNUSED(event) )
       // Give it an icon (this is ignored in MDI mode: uses resources)
 #ifdef __WXMSW__
       subframe->SetIcon(wxIcon("chrt_icn"));
-#endif
-#ifdef __X__
-      subframe->SetIcon(wxIcon("aiai.xbm"));
+#else
+      subframe->SetIcon(wxIcon(mondrian_xpm));
 #endif
 
       // Give it a status line
@@ -311,14 +317,15 @@ void MyFrame::InitToolBar(wxToolBar* toolBar)
     bitmaps[6] = new wxBitmap("icon7", wxBITMAP_TYPE_RESOURCE);
     bitmaps[7] = new wxBitmap("icon8", wxBITMAP_TYPE_RESOURCE);
 #else
-    bitmaps[0] = new wxBitmap( folder_xpm );
-    bitmaps[1] = new wxBitmap( folder_xpm );
-    bitmaps[2] = new wxBitmap( folder_xpm );
-    bitmaps[3] = new wxBitmap( folder_xpm );
-    bitmaps[4] = new wxBitmap( folder_xpm );
-    bitmaps[5] = new wxBitmap( folder_xpm );
-    bitmaps[6] = new wxBitmap( folder_xpm );
-    bitmaps[7] = new wxBitmap( folder_xpm );
+  bitmaps[0] = new wxBitmap( new_xpm );
+  bitmaps[1] = new wxBitmap( open_xpm );
+  bitmaps[2] = new wxBitmap( save_xpm );
+  bitmaps[3] = new wxBitmap( copy_xpm );
+  bitmaps[4] = new wxBitmap( cut_xpm );
+//  bitmaps[5] = new wxBitmap( paste_xpm );
+  bitmaps[5] = new wxBitmap( preview_xpm );
+  bitmaps[6] = new wxBitmap( print_xpm );
+  bitmaps[7] = new wxBitmap( help_xpm );
 #endif
 
 #ifdef __WXMSW__
diff --git a/samples/mdi/mondrian.xpm b/samples/mdi/mondrian.xpm
new file mode 100644 (file)
index 0000000..409f27a
--- /dev/null
@@ -0,0 +1,44 @@
+/* XPM */
+static char *mondrian_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"32 32 6 1",
+"  c Black",
+". c Blue",
+"X c #00bf00",
+"o c Red",
+"O c Yellow",
+"+ c Gray100",
+/* pixels */
+"                                ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+"                                ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++      ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++                    ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+"                                "
+};
index 805b3159457bd26fd4d273da622c1ea743307fa6..026f8d053210dc160732084750b33d1f8f95eee4 100644 (file)
 
 #include "wx/date.h"
 
+#ifdef __WXGTK__
+#include "mondrian.xpm"
+#endif
+
 #if !WXDEBUG
 #error You must set WXDEBUG to 1 on the 'make' command line (MSW) or with configure (GTK)
 #endif
@@ -59,9 +63,7 @@ bool MyApp::OnInit(void)
   // Give it an icon
 #ifdef wx_msw
   frame->SetIcon(wxIcon("mondrian"));
-#endif
-#ifdef wx_x
-  frame->SetIcon(wxIcon("mondrian.xbm"));
+  frame->SetIcon(wxIcon(mondrian_xpm));
 #endif
 
   // Make a menubar
diff --git a/samples/memcheck/mondrian.xpm b/samples/memcheck/mondrian.xpm
new file mode 100644 (file)
index 0000000..409f27a
--- /dev/null
@@ -0,0 +1,44 @@
+/* XPM */
+static char *mondrian_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"32 32 6 1",
+"  c Black",
+". c Blue",
+"X c #00bf00",
+"o c Red",
+"O c Yellow",
+"+ c Gray100",
+/* pixels */
+"                                ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+"                                ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++      ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++                    ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+"                                "
+};
diff --git a/samples/toolbar/bitmaps/copy.xpm b/samples/toolbar/bitmaps/copy.xpm
new file mode 100644 (file)
index 0000000..47565c1
--- /dev/null
@@ -0,0 +1,25 @@
+/* XPM */
+static char *copy_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"16 15 4 1",
+"  c None",
+". c Black",
+"X c Gray100",
+"o c #000080",
+/* pixels */
+"                ",
+" ......         ",
+" .XXXX..        ",
+" .XXXX.X.       ",
+" .X..X.oooooo   ",
+" .XXXXXoXXXXoo  ",
+" .X....oXXXXoXo ",
+" .XXXXXoX..Xoooo",
+" .X....oXXXXXXXo",
+" .XXXXXoX.....Xo",
+" ......oXXXXXXXo",
+"       oX.....Xo",
+"       oXXXXXXXo",
+"       ooooooooo",
+"                "
+};
diff --git a/samples/toolbar/bitmaps/cut.xpm b/samples/toolbar/bitmaps/cut.xpm
new file mode 100644 (file)
index 0000000..bfe7e95
--- /dev/null
@@ -0,0 +1,24 @@
+/* XPM */
+static char *cut_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"16 15 3 1",
+"  c None",
+". c Black",
+"X c #000080",
+/* pixels */
+"                ",
+"     .   .      ",
+"     .   .      ",
+"     .   .      ",
+"     .. ..      ",
+"      . .       ",
+"      ...       ",
+"       .        ",
+"      X.X       ",
+"      X XXX     ",
+"    XXX X  X    ",
+"   X  X X  X    ",
+"   X  X X  X    ",
+"   X  X  XX     ",
+"    XX          "
+};
diff --git a/samples/toolbar/bitmaps/help.xpm b/samples/toolbar/bitmaps/help.xpm
new file mode 100644 (file)
index 0000000..50fdb41
--- /dev/null
@@ -0,0 +1,25 @@
+/* XPM */
+static char *help_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"16 15 4 1",
+"  c None",
+". c Black",
+"X c Blue",
+"o c #000080",
+/* pixels */
+"                ",
+"     ......     ",
+"    .XXXXX..    ",
+"   .XX...oX..   ",
+"   .X..  .X..   ",
+"   .X.. .XX..   ",
+"    .. .XX..    ",
+"      .XX..     ",
+"      .X..      ",
+"      .X..      ",
+"      .o..      ",
+"       ..       ",
+"      .XX..     ",
+"      .XX..     ",
+"       ...      "
+};
diff --git a/samples/toolbar/bitmaps/new.xpm b/samples/toolbar/bitmaps/new.xpm
new file mode 100644 (file)
index 0000000..754d2d2
--- /dev/null
@@ -0,0 +1,24 @@
+/* XPM */
+static char *new_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"16 15 3 1",
+"  c None",
+". c Black",
+"X c Gray100",
+/* pixels */
+"                ",
+"   ........     ",
+"   .XXXXXX..    ",
+"   .XXXXXX.X.   ",
+"   .XXXXXX....  ",
+"   .XXXXXXXXX.  ",
+"   .XXXXXXXXX.  ",
+"   .XXXXXXXXX.  ",
+"   .XXXXXXXXX.  ",
+"   .XXXXXXXXX.  ",
+"   .XXXXXXXXX.  ",
+"   .XXXXXXXXX.  ",
+"   .XXXXXXXXX.  ",
+"   ...........  ",
+"                "
+};
diff --git a/samples/toolbar/bitmaps/open.xpm b/samples/toolbar/bitmaps/open.xpm
new file mode 100644 (file)
index 0000000..54748e9
--- /dev/null
@@ -0,0 +1,26 @@
+/* XPM */
+static char *open_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"16 15 5 1",
+"  c None",
+". c Black",
+"X c Yellow",
+"o c Gray100",
+"O c #bfbf00",
+/* pixels */
+"                ",
+"          ...   ",
+"         .   . .",
+"              ..",
+"  ...        ...",
+" .XoX.......    ",
+" .oXoXoXoXo.    ",
+" .XoXoXoXoX.    ",
+" .oXoX..........",
+" .XoX.OOOOOOOOO.",
+" .oo.OOOOOOOOO. ",
+" .X.OOOOOOOOO.  ",
+" ..OOOOOOOOO.   ",
+" ...........    ",
+"                "
+};
diff --git a/samples/toolbar/bitmaps/preview.xpm b/samples/toolbar/bitmaps/preview.xpm
new file mode 100644 (file)
index 0000000..0dfdca4
--- /dev/null
@@ -0,0 +1,26 @@
+/* XPM */
+static char *preview_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"16 15 5 1",
+"  c Black",
+". c None",
+"X c Gray100",
+"o c #808080",
+"O c Cyan",
+/* pixels */
+"         .......",
+" XXXXXXX  ......",
+" XXXXXXX . .....",
+" XXXXXXX    ....",
+" XXXXXXXXXX ....",
+" XXXXXXX    ....",
+" XXXXXX o..o ...",
+" XXXXX oOO.oo ..",
+" XXXXX .O..o. ..",
+" XXXXX ....o. ..",
+" XXXXX o..Ooo ..",
+" XXXXXX o..o o..",
+" XXXXXXX    o  .",
+" XXXXXXXXXX .   ",
+"            ..  "
+};
diff --git a/samples/toolbar/bitmaps/print.xpm b/samples/toolbar/bitmaps/print.xpm
new file mode 100644 (file)
index 0000000..3c2e2be
--- /dev/null
@@ -0,0 +1,26 @@
+/* XPM */
+static char *print_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"16 15 5 1",
+"  c None",
+". c Black",
+"X c Gray100",
+"o c #808000",
+"O c Yellow",
+/* pixels */
+"                ",
+"     .........  ",
+"    .XXXXXXXX.  ",
+"    .X.....X.   ",
+"   .XXXXXXXX.   ",
+"   .X.....X.... ",
+"  .XXXXXXXX. . .",
+" .......... . ..",
+".          . . .",
+".............  .",
+".      ooo  . . ",
+".      OOO  ... ",
+"............. . ",
+" .         . .  ",
+"  ...........   "
+};
diff --git a/samples/toolbar/bitmaps/save.xpm b/samples/toolbar/bitmaps/save.xpm
new file mode 100644 (file)
index 0000000..01b18f9
--- /dev/null
@@ -0,0 +1,25 @@
+/* XPM */
+static char *save_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"16 15 4 1",
+"  c None",
+". c Black",
+"X c #808000",
+"o c #808080",
+/* pixels */
+"                ",
+" .............. ",
+" .X.        . . ",
+" .X.        ... ",
+" .X.        .X. ",
+" .X.        .X. ",
+" .X.        .X. ",
+" .X.        .X. ",
+" .XX........oX. ",
+" .XXXXXXXXXXXX. ",
+" .XX.........X. ",
+" .XX......  .X. ",
+" .XX......  .X. ",
+" .XX......  .X. ",
+"  ............. "
+};
diff --git a/samples/toolbar/mondrian.xpm b/samples/toolbar/mondrian.xpm
new file mode 100644 (file)
index 0000000..409f27a
--- /dev/null
@@ -0,0 +1,44 @@
+/* XPM */
+static char *mondrian_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"32 32 6 1",
+"  c Black",
+". c Blue",
+"X c #00bf00",
+"o c Red",
+"O c Yellow",
+"+ c Gray100",
+/* pixels */
+"                                ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+"                                ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++      ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++                    ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+"                                "
+};
index c4b1ea21e23467b3ae18b17a473f9b2d479ae6fd..842dbea3da08340a2b81bdc54ff5417b3e88c63d 100644 (file)
 #include "wx/toolbar.h"
 #include "test.h"
 
+#ifdef __WXGTK__
+#include "mondrian.xpm"
+#include "bitmaps/new.xpm"
+#include "bitmaps/open.xpm"
+#include "bitmaps/save.xpm"
+#include "bitmaps/copy.xpm"
+#include "bitmaps/cut.xpm"
+// #include "bitmaps/paste.xpm"
+#include "bitmaps/print.xpm"
+#include "bitmaps/preview.xpm"
+#include "bitmaps/help.xpm"
+#endif
+
 IMPLEMENT_APP(MyApp)
 
-#ifdef __X__
-// TODO: include XBM or XPM icons for X apps
-#endif
 
 // The `main program' equivalent, creating the windows and returning the
 // main frame
@@ -43,9 +53,8 @@ bool MyApp::OnInit(void)
   // Give it an icon
 #ifdef __WXMSW__
   frame->SetIcon(wxIcon("mondrian"));
-#endif
-#ifdef __X__
-  frame->SetIcon(wxIcon("mondrian.xbm"));
+#else
+  frame->SetIcon( wxIcon(mondrian_xpm) );
 #endif
 
   // Make a menubar
@@ -96,17 +105,16 @@ bool MyApp::InitToolbar(wxToolBar* toolBar)
   toolBarBitmaps[5] = new wxBitmap("icon6");
   toolBarBitmaps[6] = new wxBitmap("icon7");
   toolBarBitmaps[7] = new wxBitmap("icon8");
-#endif
-#ifdef __X__
-  // TODO
-  toolBarBitmaps[0] = new wxBitmap(...);
-  toolBarBitmaps[1] = new wxBitmap(...);
-  toolBarBitmaps[2] = new wxBitmap(...);
-  toolBarBitmaps[3] = new wxBitmap(...);
-  toolBarBitmaps[4] = new wxBitmap(...);
-  toolBarBitmaps[5] = new wxBitmap(...);
-  toolBarBitmaps[6] = new wxBitmap(...);
-  toolBarBitmaps[7] = new wxBitmap(...);
+#else
+  toolBarBitmaps[0] = new wxBitmap( new_xpm );
+  toolBarBitmaps[1] = new wxBitmap( open_xpm );
+  toolBarBitmaps[2] = new wxBitmap( save_xpm );
+  toolBarBitmaps[3] = new wxBitmap( copy_xpm );
+  toolBarBitmaps[4] = new wxBitmap( cut_xpm );
+//  toolBarBitmaps[5] = new wxBitmap( paste_xpm );
+  toolBarBitmaps[5] = new wxBitmap( preview_xpm );
+  toolBarBitmaps[6] = new wxBitmap( print_xpm );
+  toolBarBitmaps[7] = new wxBitmap( help_xpm );
 #endif
 
 #ifdef __WXMSW__
@@ -114,7 +122,6 @@ bool MyApp::InitToolbar(wxToolBar* toolBar)
 #else
   int width = 16;
 #endif
-  int offX = 5;
   int currentX = 5;
 
   toolBar->AddTool(wxID_NEW, *(toolBarBitmaps[0]), wxNullBitmap, FALSE, (float)currentX, -1, NULL, "New file");
@@ -164,19 +171,19 @@ MyFrame::MyFrame(wxFrame* parent, wxWindowID id, const wxString& title, const wx
   m_textWindow = new wxTextCtrl(this, -1, "", wxPoint(0, 0), wxSize(-1, -1), wxTE_MULTILINE);
 }
 
-void MyFrame::OnQuit(wxCommandEvent& event)
+void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
 {
     Close(TRUE);
 }
 
-void MyFrame::OnAbout(wxCommandEvent& event)
+void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
 {
     (void)wxMessageBox("wxWindows wxToolBar demo\n", "About wxToolBar");
 }
 
 // Define the behaviour for the frame closing
 // - must delete all frames except for the main one.
-void MyFrame::OnCloseWindow(wxCloseEvent& event)
+void MyFrame::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
 {
   Destroy();
 }
diff --git a/samples/treectrl/mondrian.xpm b/samples/treectrl/mondrian.xpm
new file mode 100644 (file)
index 0000000..409f27a
--- /dev/null
@@ -0,0 +1,44 @@
+/* XPM */
+static char *mondrian_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"32 32 6 1",
+"  c Black",
+". c Blue",
+"X c #00bf00",
+"o c Red",
+"O c Yellow",
+"+ c Gray100",
+/* pixels */
+"                                ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+"                                ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++      ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++                    ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+"                                "
+};
index eb946008a7e1762f0a396e5474701c3acc9ebaaa..0eb7d8894645c4cb1be4641f105cfd8026953c03 100644 (file)
 #include "wx/wx.h"
 #endif
 
+#ifdef __WXGTK__
+#include "mondrian.xpm"
+#endif
+
 #include "wx/treectrl.h"
 
 #include "treetest.h"
@@ -65,9 +69,8 @@ bool MyApp::OnInit(void)
   // Give it an icon
 #ifdef __WXMSW__
   frame->SetIcon(wxIcon("mondrian"));
-#endif
-#ifdef __X__
-  frame->SetIcon(wxIcon("aiai.xbm"));
+#else
+  frame->SetIcon(wxIcon(mondrian_xpm));
 #endif
 
   // Make an image list containing small icons
index 6c6eba0be62fd2caa61a8ee0053d00522d0d1bb1..67d086dc724220d187be56c59f71ef23c9e23e69 100644 (file)
@@ -1103,6 +1103,7 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event )
       m_current = line;
       HilightAll( FALSE );
       m_current->ReverseHilight();
+      RefreshLine( m_current );
     }
     else
     {
@@ -1110,6 +1111,7 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event )
       {
         m_current = line;
         m_current->ReverseHilight();
+        RefreshLine( m_current );
       }
       else if (event.ControlDown())
       {
@@ -1143,21 +1145,20 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event )
          RefreshLine( test_line );
          node = node->Next();
        }
-       return;
       }
       else 
       {
         m_current = line;
         HilightAll( FALSE );
         m_current->ReverseHilight();
+        RefreshLine( m_current );
       }
     }
-    RefreshLine( m_current );
     if (m_current != oldCurrent)
     {
+      RefreshLine( oldCurrent );
       UnfocusLine( oldCurrent );
       FocusLine( m_current );
-      RefreshLine( oldCurrent );
     };
     m_lastOnSame = (m_current == oldCurrent);
     return;
@@ -1198,15 +1199,15 @@ void wxListMainWindow::MoveToFocus( void )
 
 void wxListMainWindow::OnArrowChar( wxListLineData *newCurrent, bool shiftDown )
 {
-  UnfocusLine( m_current );
   if ((m_mode & wxLC_SINGLE_SEL) || (m_usedKeys == FALSE)) m_current->Hilight( FALSE );
   wxListLineData *oldCurrent = m_current;
   m_current = newCurrent;
   MoveToFocus();
   if (shiftDown || (m_mode & wxLC_SINGLE_SEL)) m_current->Hilight( TRUE );
-  FocusLine( m_current );
   RefreshLine( m_current );
   RefreshLine( oldCurrent );
+  FocusLine( m_current );
+  UnfocusLine( oldCurrent );
 };
 
 void wxListMainWindow::OnChar( wxKeyEvent &event )
@@ -1310,14 +1311,14 @@ void wxListMainWindow::OnChar( wxKeyEvent &event )
       if (!(m_mode & wxLC_SINGLE_SEL))
       {
         wxListLineData *oldCurrent = m_current;
-        UnfocusLine( m_current );
         m_current->ReverseHilight();
         wxNode *node = m_lines.Member( m_current )->Next();       
         if (node) m_current = (wxListLineData*)node->Data();
         MoveToFocus();
-        FocusLine( m_current );
-       RefreshLine( m_current );
        RefreshLine( oldCurrent );
+       RefreshLine( m_current );
+        UnfocusLine( oldCurrent );
+        FocusLine( m_current );
       };
     };
     break;
@@ -1828,6 +1829,7 @@ void wxListMainWindow::DeleteColumn( int col )
 void wxListMainWindow::DeleteAllItems( void )
 {
   m_dirty = TRUE;
+  m_current = NULL;
   wxNode *node = m_lines.First();
   while (node)
   {
@@ -1836,12 +1838,12 @@ void wxListMainWindow::DeleteAllItems( void )
     node = node->Next();
   };
   m_lines.Clear();
-  m_current = NULL;
 };
 
 void wxListMainWindow::DeleteEverything( void )
 {
   m_dirty = TRUE;
+  m_current = NULL;
   wxNode *node = m_lines.First();
   while (node)
   {
index fe0b6ebe1ef9c7a8355e5712131712d01eed90a1..f1a0aa1a465684cff5b39f9da1bbd6769ee54cac 100644 (file)
@@ -26,12 +26,11 @@ class wxBitmapButton;
 
 IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton,wxControl)
 
-void gtk_bmpbutton_clicked_callback( GtkWidget *WXUNUSED(widget), gpointer data )
+void gtk_bmpbutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button )
 {
-  wxBitmapButton *button = (wxBitmapButton*)data;
   wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
   event.SetEventObject(button);
-  button->ProcessEvent(event);
+  button->GetEventHandler()->ProcessEvent(event);
 };
 
 //-----------------------------------------------------------------------------
index 2201232c15fe35fc7801b18f8b180c4d062281f7..52c4e2d4b9787992f2a2db0868616a03c13af88c 100644 (file)
@@ -26,12 +26,11 @@ class wxButton;
 
 IMPLEMENT_DYNAMIC_CLASS(wxButton,wxControl)
 
-void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), gpointer data )
+void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxButton *button )
 {
-  wxButton *button = (wxButton*)data;
   wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
   event.SetEventObject(button);
-  button->ProcessEvent(event);
+  button->GetEventHandler()->ProcessEvent(event);
 };
 
 //-----------------------------------------------------------------------------
index ee3830f361e7a015f5d53043190bf44fb1630942..b4c8a447ffd8b2dc8299388d24d686bfbedcf304 100644 (file)
 // wxCheckBox
 //-----------------------------------------------------------------------------
 
-void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), gpointer data )
+void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), wxCheckBox *cb )
 {
-  wxCheckBox *cb = (wxCheckBox*)data;
   wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, cb->GetId());
   event.SetInt( cb->GetValue() );
   event.SetEventObject(cb);
-  cb->ProcessEvent(event);
+  cb->GetEventHandler()->ProcessEvent(event);
 };
 
 //-----------------------------------------------------------------------------
index 57922091b9ca4b2afa7122de3d25d6e5d9406bfe..180bbb17d3d93115e708e8dbbd54251d0d50aaf4 100644 (file)
 // wxChoice
 //-----------------------------------------------------------------------------
 
-void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), gpointer data )
+void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), wxChoice *choice )
 {
-  wxChoice *choice = (wxChoice*)data;
-  wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, choice->GetId());
+  wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, choice->GetId() );
   event.SetInt( choice->GetSelection() );
   wxString tmp( choice->GetStringSelection() );
   event.SetString( WXSTRINGCAST(tmp) );
   event.SetEventObject(choice);
-  choice->ProcessEvent(event);
+  choice->GetEventHandler()->ProcessEvent(event);
 };
 
 //-----------------------------------------------------------------------------
@@ -103,8 +102,8 @@ void wxChoice::Clear(void)
 
 int wxChoice::FindString( const wxString &string ) const
 {
-  // If you read this code once and you think you undestand
-  // it, then you are very wrong. RR
+  // If you read this code once and you think you understand
+  // it, then you are very wrong. Robert Roebling.
   
   GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
   int count = 0;
@@ -112,7 +111,8 @@ int wxChoice::FindString( const wxString &string ) const
   while (child)
   {
     GtkBin *bin = GTK_BIN( child->data );
-    GtkLabel *label = GTK_LABEL(bin->child);
+    GtkLabel *label = NULL;
+    if (bin->child) label = GTK_LABEL(bin->child);
     if (!label) label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
     if (string == label->label) return count;
     child = child->next;
@@ -151,7 +151,8 @@ wxString wxChoice::GetString( int n ) const
     GtkBin *bin = GTK_BIN( child->data );
     if (count == n)
     {
-      GtkLabel *label = GTK_LABEL(bin->child);
+      GtkLabel *label = NULL;
+      if (bin->child) label = GTK_LABEL(bin->child);
       if (!label) label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
       return label->label;
     };
@@ -188,6 +189,8 @@ void wxChoice::SetSelection( int n )
 {
   int tmp = n;
   gtk_option_menu_set_history( GTK_OPTION_MENU(m_widget), (gint)tmp );
+  
+  gtk_choice_clicked_callback( NULL, this );
 };
 
 void wxChoice::SetStringSelection( const wxString &string )
index 5d080a400a1eb531dc879495ddb020b5c42ff83c..2e892f7e3ab0c2bf7d854d018619add2f8a5f652 100644 (file)
 
 #include "wx/combobox.h"
 
+//-----------------------------------------------------------------------------
+// data
+//-----------------------------------------------------------------------------
+
+extern bool   g_blockEventsOnDrag;
+
 //-----------------------------------------------------------------------------
 // wxComboBox
 //-----------------------------------------------------------------------------
 
-void gtk_combo_clicked_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
+//-----------------------------------------------------------------------------
+// clicked
+
+static void gtk_combo_clicked_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
 {
+  if (combo->m_alreadySent)
+  {
+    combo->m_alreadySent = FALSE;
+    return;
+  }
+
+  combo->m_alreadySent = TRUE;
+  
   wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, combo->GetId());
   event.SetInt( combo->GetSelection() );
   wxString tmp( combo->GetStringSelection() );
   event.SetString( WXSTRINGCAST(tmp) );
   event.SetEventObject(combo);
-  combo->ProcessEvent(event);
+  combo->GetEventHandler()->ProcessEvent(event);
 };
 
+//-----------------------------------------------------------------------------
+// size 
+
+/*
+static gint gtk_combo_size_callback( GtkCombo *widget, GtkAllocation* alloc, wxComboBox *win )
+{ 
+  if (!win->HasVMT()) return FALSE;
+  if (g_blockEventsOnDrag) return FALSE;
+  if (!widget->button) return FALSE;
+  
+  widget->button->allocation.x = 
+    alloc->width - widget->button->allocation.width;
+  
+  return FALSE;
+};
+*/
+
 //-----------------------------------------------------------------------------
 
 IMPLEMENT_DYNAMIC_CLASS(wxComboBox,wxControl)
@@ -37,6 +71,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxString& value,
   int n, const wxString choices[],
   long style, const wxString& name )
 {
+  m_alreadySent = FALSE;
   m_needParent = TRUE;
   
   PreCreation( parent, id, pos, size, style, name );
@@ -60,11 +95,18 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxString& value,
   
     gtk_container_add( GTK_CONTAINER(list), list_item );
     
+    m_clientData.Append( (wxObject*)NULL );
+    
     gtk_widget_show( list_item );
   };
   
   PostCreation();
 
+/*
+  gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate", 
+    GTK_SIGNAL_FUNC(gtk_combo_size_callback), (gpointer)this );
+*/
+
   if (!value.IsNull()) SetValue( value );
     
   Show( TRUE );
@@ -76,31 +118,44 @@ void wxComboBox::Clear(void)
 {
   GtkWidget *list = GTK_COMBO(m_widget)->list;
   gtk_list_clear_items( GTK_LIST(list), 0, Number() );
+  
+  m_clientData.Clear();
 };
 
 void wxComboBox::Append( const wxString &item )
+{
+  Append( item, (char*)NULL );
+};
+
+void wxComboBox::Append( const wxString &item, char *clientData )
 {
   GtkWidget *list = GTK_COMBO(m_widget)->list;
   
   GtkWidget *list_item;
   list_item = gtk_list_item_new_with_label( item ); 
   
- gtk_signal_connect( GTK_OBJECT(list_item), "select", 
 gtk_signal_connect( GTK_OBJECT(list_item), "select", 
     GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
   
   gtk_container_add( GTK_CONTAINER(list), list_item );
     
   gtk_widget_show( list_item );
-};
-
-void wxComboBox::Append( const wxString &WXUNUSED(item), char* WXUNUSED(clientData) )
-{
+  
+  m_clientData.Append( (wxObject*)clientData );
 };
 
 void wxComboBox::Delete( int n )
 {
   GtkWidget *list = GTK_COMBO(m_widget)->list;
   gtk_list_clear_items( GTK_LIST(list), n, n );
+  
+  wxNode *node = m_clientData.Nth( n );
+  if (!node)
+  {
+    wxFAIL_MSG("wxComboBox::Delete wrong index");
+  }
+  else
+    m_clientData.DeleteNode( node );
 };
 
 int wxComboBox::FindString( const wxString &item )
@@ -196,6 +251,13 @@ void wxComboBox::SetSelection( int n )
   gtk_list_select_item( GTK_LIST(list), n );
 };
 
+void wxComboBox::SetStringSelection( const wxString &string )
+{
+  int res = FindString( string );
+  if (res == -1) return;
+  SetSelection( res );
+};
+
 wxString wxComboBox::GetValue(void) const
 {
   GtkWidget *entry = GTK_COMBO(m_widget)->entry;
index 0abf2c82dffb405679cd3bdf6680cf3a16e59998..99d98fcdb888fb61f061191589f2e226576d71ec 100644 (file)
@@ -33,7 +33,7 @@ extern wxList wxPendingDelete;
 //-----------------------------------------------------------------------------
 
 //-----------------------------------------------------------------------------
-// size
+// set size
 
 void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxFrame *win )
 {
@@ -66,6 +66,19 @@ bool gtk_frame_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(
   return TRUE;
 };
 
+//-----------------------------------------------------------------------------
+// configure
+
+gint gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *event, wxFrame *win )
+{
+  if (!win->HasVMT()) return FALSE;
+  
+  win->m_x = event->x;
+  win->m_y = event->y;
+  
+  return FALSE;
+};
+
 //-----------------------------------------------------------------------------
 
 BEGIN_EVENT_TABLE(wxFrame, wxWindow)
@@ -143,6 +156,9 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
   gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
     GTK_SIGNAL_FUNC(gtk_frame_size_callback), (gpointer)this );
 
+  gtk_signal_connect( GTK_OBJECT(m_widget), "configure_event",
+    GTK_SIGNAL_FUNC(gtk_frame_configure_callback), (gpointer)this );
+    
   PostCreation();
 
   gtk_widget_realize( m_mainWindow );
@@ -210,10 +226,11 @@ void wxFrame::GetClientSize( int *width, int *height ) const
   };
 };
 
-void wxFrame::GtkOnSize( int x, int y, int width, int height )
+void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height )
 {
-  m_x = x;
-  m_y = y;
+  // due to a bug in gtk, x,y are always 0
+  // m_x = x;
+  // m_y = y;
 
   if ((m_height == height) && (m_width == width) &&
       (m_sizeSet)) return;
@@ -240,7 +257,7 @@ void wxFrame::GtkOnSize( int x, int y, int width, int height )
   // m_wxwindow just like any other window.
 
 //  not really needed
-  gtk_widget_set_usize( m_mainWindow, width, height );
+//  gtk_widget_set_usize( m_mainWindow, width, height );
 
   if (m_frameMenuBar)
   {
index f880a3291ef6f17e1fcfdfa9ec91f079e476f6a2..359adda8d089d0c98a2803685adfc5e9e77d3991 100644 (file)
 // wxListBox
 //-----------------------------------------------------------------------------
 
-void gtk_listitem_select_callback( GtkWidget *widget, gpointer data )
+void gtk_listitem_select_callback( GtkWidget *widget, wxListBox *listbox )
 {
-  wxListBox *listbox = (wxListBox*)data;
-
   wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, listbox->GetId() );
   
   event.SetInt( listbox->GetIndex( widget ) );
@@ -32,10 +30,9 @@ void gtk_listitem_select_callback( GtkWidget *widget, gpointer data )
   GtkLabel *label = GTK_LABEL( bin->child );
   wxString tmp( label->label );
   event.SetString( WXSTRINGCAST(tmp) );
-  
   event.SetEventObject( listbox );
   
-  listbox->ProcessEvent( event );
+  listbox->GetEventHandler()->ProcessEvent( event );
 };
 
 //-----------------------------------------------------------------------------
index c449676506ef95ed066b29b9345007b272262e11..f4efa3d603df13af9d8e5b04ab71a9144f4a8a65 100644 (file)
 // wxRadioBox
 //-----------------------------------------------------------------------------
 
-void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), gpointer data )
+void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxRadioBox *rb )
 {
-  wxRadioBox *rb = (wxRadioBox*)data;
+  if (rb->m_alreadySent)
+  {
+    rb->m_alreadySent = FALSE;
+    return;
+  }
+
+  rb->m_alreadySent = TRUE;
+  
   wxCommandEvent event( wxEVT_COMMAND_RADIOBOX_SELECTED, rb->GetId() );
   event.SetInt( rb->GetSelection() );
   wxString tmp( rb->GetStringSelection() );
   event.SetString( WXSTRINGCAST(tmp) );
   event.SetEventObject( rb );
-  rb->ProcessEvent(event);
+  rb->GetEventHandler()->ProcessEvent(event);
 };
 
 //-----------------------------------------------------------------------------
@@ -56,6 +63,7 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
       int WXUNUSED(majorDim), long style,
       const wxString &name )
 {
+  m_alreadySent = FALSE;
   m_needParent = TRUE;
   
   PreCreation( parent, id, pos, size, style, name );
@@ -74,6 +82,7 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
     for (int i = 0; i < n; i++)
     {
       if (i) radio_button_group = gtk_radio_button_group( GTK_RADIO_BUTTON(m_radio) );
+      
       m_radio = GTK_RADIO_BUTTON( gtk_radio_button_new_with_label( radio_button_group, choices[i] ) );
       
       if (!i) gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_radio), TRUE );
@@ -123,13 +132,33 @@ bool wxRadioBox::Show( bool show )
   return TRUE;
 };
 
-int wxRadioBox::FindString( const wxString& WXUNUSED(s) ) const
+int wxRadioBox::FindString( const wxString &s ) const
 {
-  return 0;
+  GSList *item = gtk_radio_button_group( m_radio );
+  
+  int count = g_slist_length(item)-1;
+  
+  while (item)
+  {
+    GtkButton *b = GTK_BUTTON( item->data );
+    GtkLabel *l = GTK_LABEL( b->child );
+    if (s == l->label) return count;
+    count--;
+    item = item->next;
+  };
+
+  return -1;
 };
 
-void wxRadioBox::SetSelection( int WXUNUSED(n) )
+void wxRadioBox::SetSelection( int n )
 {
+  GSList *item = gtk_radio_button_group( m_radio );
+  item = g_slist_nth( item, g_slist_length(item)-n-1 );
+  if (!item) return;
+  
+  GtkToggleButton *button = GTK_TOGGLE_BUTTON( item->data );
+  
+  gtk_toggle_button_set_state( button, 1 );
 };
 
 int wxRadioBox::GetSelection(void) const
@@ -146,9 +175,18 @@ int wxRadioBox::GetSelection(void) const
   return -1;
 };
 
-wxString wxRadioBox::GetString( int WXUNUSED(n) ) const
+wxString wxRadioBox::GetString( int n ) const
 {
-  return "";
+  GSList *item = gtk_radio_button_group( m_radio );
+  
+  item = g_slist_nth( item, g_slist_length(item)-n-1 );
+  if (!item) return "";
+  
+  GtkToggleButton *button = GTK_TOGGLE_BUTTON( item->data );
+  
+  GtkLabel *label = GTK_LABEL( GTK_BUTTON(button)->child );
+  
+  return wxString( label->label );
 };
 
 wxString wxRadioBox::GetLabel(void) const
@@ -201,8 +239,11 @@ wxString wxRadioBox::GetStringSelection(void) const
   return "";
 };
 
-bool wxRadioBox::SetStringSelection( const wxString& WXUNUSED(s) )
+bool wxRadioBox::SetStringSelection( const wxString&s )
 {
+  int res = FindString( s );
+  if (res == -1) return FALSE;
+  SetSelection( res );
   return TRUE;
 };
 
index bcfece5c2771351b1e0ea1b5eef8f9b7ddd34b5d..ac11b17d44384355f0dd333f0bc23533a0883df8 100644 (file)
@@ -52,7 +52,7 @@ void gtk_scrollbar_callback( GtkWidget *WXUNUSED(widget), wxScrollBar *win )
   
   wxScrollEvent event( command, win->GetId(), value, orient );
   event.SetEventObject( win );
-  win->ProcessEvent( event );
+  win->GetEventHandler()->ProcessEvent( event );
   
 /*
   wxCommandEvent cevent( wxEVT_COMMAND_SCROLLBAR_UPDATED, win->GetId() );
index afd11f78a75d93177591923e3910710590d5487e..deb1db70fb7f148d0e73729b7074a8794284c7d6 100644 (file)
@@ -59,7 +59,8 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
   PreCreation( parent, id, pos, size, style, name );
 
   bool bMultiLine = (style & wxTE_MULTILINE) != 0;
-  if ( bMultiLine ) {
+  if ( bMultiLine ) 
+  {
     // a multi-line edit control: create a vertical scrollbar by default and
     // horizontal if requested
     bool bHasHScrollbar = (style & wxHSCROLL) != 0;
index 8f8ccf94466acdefef9a78f24820da0bfd1210ec..c064c71faa2fbada70b0d7ad1f46b543c21f4ab0 100644 (file)
@@ -27,7 +27,7 @@
 #include "wx/mdi.h"
 #include "wx/notebook.h"
 #include "wx/statusbr.h"
-#include "wx/treectrl.h"
+//#include "wx/treectrl.h"
 #include "gdk/gdkkeysyms.h"
 #include <math.h>
 #include "wx/gtk/win_gtk.h"
@@ -1064,7 +1064,8 @@ void wxWindow::ImplementSetPosition(void)
     if (IsKindOf(CLASSINFO(wxFrame)) ||
         IsKindOf(CLASSINFO(wxDialog)))
     {
-      gtk_widget_set_uposition( m_widget, m_x, m_y );
+      if ((m_x != -1) || (m_y != -1))
+        gtk_widget_set_uposition( m_widget, m_x, m_y );
     }
     else
     {
@@ -1362,7 +1363,7 @@ void wxWindow::Fit(void)
 
     node = node->Next();
   }
-  SetClientSize(maxX + 5, maxY + 5);
+  SetClientSize(maxX + 5, maxY + 10);
 };
 
 void wxWindow::OnSize( wxSizeEvent &WXUNUSED(event) )
@@ -1473,7 +1474,7 @@ void wxWindow::AddChild( wxWindow *child )
   
   // wxFrame has a private AddChild
   
-  if (IS_KIND_OF(this,wxFrame))
+  if (IS_KIND_OF(this,wxFrame) && !IS_KIND_OF(this,wxMDIChildFrame))
   {
     wxFrame *frame = (wxFrame*)this;
     frame->AddChild( child );
@@ -1604,12 +1605,6 @@ void wxWindow::Refresh( bool eraseBackground, const wxRect *rect )
     gdk_rect.width = rect->width;
     gdk_rect.height = rect->height;
     
-    if (IS_KIND_OF(this,wxTreeCtrl))
-    {
-      printf( "x: %d y: %d w: %d h: %d .\n",
-        gdk_rect.x, gdk_rect.y, gdk_rect.width, gdk_rect.height );
-    }
-    
     if (m_wxwindow)
       gtk_widget_draw( m_wxwindow, &gdk_rect );
     else
index fe0b6ebe1ef9c7a8355e5712131712d01eed90a1..f1a0aa1a465684cff5b39f9da1bbd6769ee54cac 100644 (file)
@@ -26,12 +26,11 @@ class wxBitmapButton;
 
 IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton,wxControl)
 
-void gtk_bmpbutton_clicked_callback( GtkWidget *WXUNUSED(widget), gpointer data )
+void gtk_bmpbutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button )
 {
-  wxBitmapButton *button = (wxBitmapButton*)data;
   wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
   event.SetEventObject(button);
-  button->ProcessEvent(event);
+  button->GetEventHandler()->ProcessEvent(event);
 };
 
 //-----------------------------------------------------------------------------
index 2201232c15fe35fc7801b18f8b180c4d062281f7..52c4e2d4b9787992f2a2db0868616a03c13af88c 100644 (file)
@@ -26,12 +26,11 @@ class wxButton;
 
 IMPLEMENT_DYNAMIC_CLASS(wxButton,wxControl)
 
-void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), gpointer data )
+void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxButton *button )
 {
-  wxButton *button = (wxButton*)data;
   wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
   event.SetEventObject(button);
-  button->ProcessEvent(event);
+  button->GetEventHandler()->ProcessEvent(event);
 };
 
 //-----------------------------------------------------------------------------
index ee3830f361e7a015f5d53043190bf44fb1630942..b4c8a447ffd8b2dc8299388d24d686bfbedcf304 100644 (file)
 // wxCheckBox
 //-----------------------------------------------------------------------------
 
-void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), gpointer data )
+void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), wxCheckBox *cb )
 {
-  wxCheckBox *cb = (wxCheckBox*)data;
   wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, cb->GetId());
   event.SetInt( cb->GetValue() );
   event.SetEventObject(cb);
-  cb->ProcessEvent(event);
+  cb->GetEventHandler()->ProcessEvent(event);
 };
 
 //-----------------------------------------------------------------------------
index 57922091b9ca4b2afa7122de3d25d6e5d9406bfe..180bbb17d3d93115e708e8dbbd54251d0d50aaf4 100644 (file)
 // wxChoice
 //-----------------------------------------------------------------------------
 
-void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), gpointer data )
+void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), wxChoice *choice )
 {
-  wxChoice *choice = (wxChoice*)data;
-  wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, choice->GetId());
+  wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, choice->GetId() );
   event.SetInt( choice->GetSelection() );
   wxString tmp( choice->GetStringSelection() );
   event.SetString( WXSTRINGCAST(tmp) );
   event.SetEventObject(choice);
-  choice->ProcessEvent(event);
+  choice->GetEventHandler()->ProcessEvent(event);
 };
 
 //-----------------------------------------------------------------------------
@@ -103,8 +102,8 @@ void wxChoice::Clear(void)
 
 int wxChoice::FindString( const wxString &string ) const
 {
-  // If you read this code once and you think you undestand
-  // it, then you are very wrong. RR
+  // If you read this code once and you think you understand
+  // it, then you are very wrong. Robert Roebling.
   
   GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
   int count = 0;
@@ -112,7 +111,8 @@ int wxChoice::FindString( const wxString &string ) const
   while (child)
   {
     GtkBin *bin = GTK_BIN( child->data );
-    GtkLabel *label = GTK_LABEL(bin->child);
+    GtkLabel *label = NULL;
+    if (bin->child) label = GTK_LABEL(bin->child);
     if (!label) label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
     if (string == label->label) return count;
     child = child->next;
@@ -151,7 +151,8 @@ wxString wxChoice::GetString( int n ) const
     GtkBin *bin = GTK_BIN( child->data );
     if (count == n)
     {
-      GtkLabel *label = GTK_LABEL(bin->child);
+      GtkLabel *label = NULL;
+      if (bin->child) label = GTK_LABEL(bin->child);
       if (!label) label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
       return label->label;
     };
@@ -188,6 +189,8 @@ void wxChoice::SetSelection( int n )
 {
   int tmp = n;
   gtk_option_menu_set_history( GTK_OPTION_MENU(m_widget), (gint)tmp );
+  
+  gtk_choice_clicked_callback( NULL, this );
 };
 
 void wxChoice::SetStringSelection( const wxString &string )
index 5d080a400a1eb531dc879495ddb020b5c42ff83c..2e892f7e3ab0c2bf7d854d018619add2f8a5f652 100644 (file)
 
 #include "wx/combobox.h"
 
+//-----------------------------------------------------------------------------
+// data
+//-----------------------------------------------------------------------------
+
+extern bool   g_blockEventsOnDrag;
+
 //-----------------------------------------------------------------------------
 // wxComboBox
 //-----------------------------------------------------------------------------
 
-void gtk_combo_clicked_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
+//-----------------------------------------------------------------------------
+// clicked
+
+static void gtk_combo_clicked_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
 {
+  if (combo->m_alreadySent)
+  {
+    combo->m_alreadySent = FALSE;
+    return;
+  }
+
+  combo->m_alreadySent = TRUE;
+  
   wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, combo->GetId());
   event.SetInt( combo->GetSelection() );
   wxString tmp( combo->GetStringSelection() );
   event.SetString( WXSTRINGCAST(tmp) );
   event.SetEventObject(combo);
-  combo->ProcessEvent(event);
+  combo->GetEventHandler()->ProcessEvent(event);
 };
 
+//-----------------------------------------------------------------------------
+// size 
+
+/*
+static gint gtk_combo_size_callback( GtkCombo *widget, GtkAllocation* alloc, wxComboBox *win )
+{ 
+  if (!win->HasVMT()) return FALSE;
+  if (g_blockEventsOnDrag) return FALSE;
+  if (!widget->button) return FALSE;
+  
+  widget->button->allocation.x = 
+    alloc->width - widget->button->allocation.width;
+  
+  return FALSE;
+};
+*/
+
 //-----------------------------------------------------------------------------
 
 IMPLEMENT_DYNAMIC_CLASS(wxComboBox,wxControl)
@@ -37,6 +71,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxString& value,
   int n, const wxString choices[],
   long style, const wxString& name )
 {
+  m_alreadySent = FALSE;
   m_needParent = TRUE;
   
   PreCreation( parent, id, pos, size, style, name );
@@ -60,11 +95,18 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxString& value,
   
     gtk_container_add( GTK_CONTAINER(list), list_item );
     
+    m_clientData.Append( (wxObject*)NULL );
+    
     gtk_widget_show( list_item );
   };
   
   PostCreation();
 
+/*
+  gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate", 
+    GTK_SIGNAL_FUNC(gtk_combo_size_callback), (gpointer)this );
+*/
+
   if (!value.IsNull()) SetValue( value );
     
   Show( TRUE );
@@ -76,31 +118,44 @@ void wxComboBox::Clear(void)
 {
   GtkWidget *list = GTK_COMBO(m_widget)->list;
   gtk_list_clear_items( GTK_LIST(list), 0, Number() );
+  
+  m_clientData.Clear();
 };
 
 void wxComboBox::Append( const wxString &item )
+{
+  Append( item, (char*)NULL );
+};
+
+void wxComboBox::Append( const wxString &item, char *clientData )
 {
   GtkWidget *list = GTK_COMBO(m_widget)->list;
   
   GtkWidget *list_item;
   list_item = gtk_list_item_new_with_label( item ); 
   
- gtk_signal_connect( GTK_OBJECT(list_item), "select", 
 gtk_signal_connect( GTK_OBJECT(list_item), "select", 
     GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
   
   gtk_container_add( GTK_CONTAINER(list), list_item );
     
   gtk_widget_show( list_item );
-};
-
-void wxComboBox::Append( const wxString &WXUNUSED(item), char* WXUNUSED(clientData) )
-{
+  
+  m_clientData.Append( (wxObject*)clientData );
 };
 
 void wxComboBox::Delete( int n )
 {
   GtkWidget *list = GTK_COMBO(m_widget)->list;
   gtk_list_clear_items( GTK_LIST(list), n, n );
+  
+  wxNode *node = m_clientData.Nth( n );
+  if (!node)
+  {
+    wxFAIL_MSG("wxComboBox::Delete wrong index");
+  }
+  else
+    m_clientData.DeleteNode( node );
 };
 
 int wxComboBox::FindString( const wxString &item )
@@ -196,6 +251,13 @@ void wxComboBox::SetSelection( int n )
   gtk_list_select_item( GTK_LIST(list), n );
 };
 
+void wxComboBox::SetStringSelection( const wxString &string )
+{
+  int res = FindString( string );
+  if (res == -1) return;
+  SetSelection( res );
+};
+
 wxString wxComboBox::GetValue(void) const
 {
   GtkWidget *entry = GTK_COMBO(m_widget)->entry;
index 0abf2c82dffb405679cd3bdf6680cf3a16e59998..99d98fcdb888fb61f061191589f2e226576d71ec 100644 (file)
@@ -33,7 +33,7 @@ extern wxList wxPendingDelete;
 //-----------------------------------------------------------------------------
 
 //-----------------------------------------------------------------------------
-// size
+// set size
 
 void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxFrame *win )
 {
@@ -66,6 +66,19 @@ bool gtk_frame_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(
   return TRUE;
 };
 
+//-----------------------------------------------------------------------------
+// configure
+
+gint gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *event, wxFrame *win )
+{
+  if (!win->HasVMT()) return FALSE;
+  
+  win->m_x = event->x;
+  win->m_y = event->y;
+  
+  return FALSE;
+};
+
 //-----------------------------------------------------------------------------
 
 BEGIN_EVENT_TABLE(wxFrame, wxWindow)
@@ -143,6 +156,9 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
   gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
     GTK_SIGNAL_FUNC(gtk_frame_size_callback), (gpointer)this );
 
+  gtk_signal_connect( GTK_OBJECT(m_widget), "configure_event",
+    GTK_SIGNAL_FUNC(gtk_frame_configure_callback), (gpointer)this );
+    
   PostCreation();
 
   gtk_widget_realize( m_mainWindow );
@@ -210,10 +226,11 @@ void wxFrame::GetClientSize( int *width, int *height ) const
   };
 };
 
-void wxFrame::GtkOnSize( int x, int y, int width, int height )
+void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height )
 {
-  m_x = x;
-  m_y = y;
+  // due to a bug in gtk, x,y are always 0
+  // m_x = x;
+  // m_y = y;
 
   if ((m_height == height) && (m_width == width) &&
       (m_sizeSet)) return;
@@ -240,7 +257,7 @@ void wxFrame::GtkOnSize( int x, int y, int width, int height )
   // m_wxwindow just like any other window.
 
 //  not really needed
-  gtk_widget_set_usize( m_mainWindow, width, height );
+//  gtk_widget_set_usize( m_mainWindow, width, height );
 
   if (m_frameMenuBar)
   {
index f880a3291ef6f17e1fcfdfa9ec91f079e476f6a2..359adda8d089d0c98a2803685adfc5e9e77d3991 100644 (file)
 // wxListBox
 //-----------------------------------------------------------------------------
 
-void gtk_listitem_select_callback( GtkWidget *widget, gpointer data )
+void gtk_listitem_select_callback( GtkWidget *widget, wxListBox *listbox )
 {
-  wxListBox *listbox = (wxListBox*)data;
-
   wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, listbox->GetId() );
   
   event.SetInt( listbox->GetIndex( widget ) );
@@ -32,10 +30,9 @@ void gtk_listitem_select_callback( GtkWidget *widget, gpointer data )
   GtkLabel *label = GTK_LABEL( bin->child );
   wxString tmp( label->label );
   event.SetString( WXSTRINGCAST(tmp) );
-  
   event.SetEventObject( listbox );
   
-  listbox->ProcessEvent( event );
+  listbox->GetEventHandler()->ProcessEvent( event );
 };
 
 //-----------------------------------------------------------------------------
index c449676506ef95ed066b29b9345007b272262e11..f4efa3d603df13af9d8e5b04ab71a9144f4a8a65 100644 (file)
 // wxRadioBox
 //-----------------------------------------------------------------------------
 
-void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), gpointer data )
+void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxRadioBox *rb )
 {
-  wxRadioBox *rb = (wxRadioBox*)data;
+  if (rb->m_alreadySent)
+  {
+    rb->m_alreadySent = FALSE;
+    return;
+  }
+
+  rb->m_alreadySent = TRUE;
+  
   wxCommandEvent event( wxEVT_COMMAND_RADIOBOX_SELECTED, rb->GetId() );
   event.SetInt( rb->GetSelection() );
   wxString tmp( rb->GetStringSelection() );
   event.SetString( WXSTRINGCAST(tmp) );
   event.SetEventObject( rb );
-  rb->ProcessEvent(event);
+  rb->GetEventHandler()->ProcessEvent(event);
 };
 
 //-----------------------------------------------------------------------------
@@ -56,6 +63,7 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
       int WXUNUSED(majorDim), long style,
       const wxString &name )
 {
+  m_alreadySent = FALSE;
   m_needParent = TRUE;
   
   PreCreation( parent, id, pos, size, style, name );
@@ -74,6 +82,7 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
     for (int i = 0; i < n; i++)
     {
       if (i) radio_button_group = gtk_radio_button_group( GTK_RADIO_BUTTON(m_radio) );
+      
       m_radio = GTK_RADIO_BUTTON( gtk_radio_button_new_with_label( radio_button_group, choices[i] ) );
       
       if (!i) gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_radio), TRUE );
@@ -123,13 +132,33 @@ bool wxRadioBox::Show( bool show )
   return TRUE;
 };
 
-int wxRadioBox::FindString( const wxString& WXUNUSED(s) ) const
+int wxRadioBox::FindString( const wxString &s ) const
 {
-  return 0;
+  GSList *item = gtk_radio_button_group( m_radio );
+  
+  int count = g_slist_length(item)-1;
+  
+  while (item)
+  {
+    GtkButton *b = GTK_BUTTON( item->data );
+    GtkLabel *l = GTK_LABEL( b->child );
+    if (s == l->label) return count;
+    count--;
+    item = item->next;
+  };
+
+  return -1;
 };
 
-void wxRadioBox::SetSelection( int WXUNUSED(n) )
+void wxRadioBox::SetSelection( int n )
 {
+  GSList *item = gtk_radio_button_group( m_radio );
+  item = g_slist_nth( item, g_slist_length(item)-n-1 );
+  if (!item) return;
+  
+  GtkToggleButton *button = GTK_TOGGLE_BUTTON( item->data );
+  
+  gtk_toggle_button_set_state( button, 1 );
 };
 
 int wxRadioBox::GetSelection(void) const
@@ -146,9 +175,18 @@ int wxRadioBox::GetSelection(void) const
   return -1;
 };
 
-wxString wxRadioBox::GetString( int WXUNUSED(n) ) const
+wxString wxRadioBox::GetString( int n ) const
 {
-  return "";
+  GSList *item = gtk_radio_button_group( m_radio );
+  
+  item = g_slist_nth( item, g_slist_length(item)-n-1 );
+  if (!item) return "";
+  
+  GtkToggleButton *button = GTK_TOGGLE_BUTTON( item->data );
+  
+  GtkLabel *label = GTK_LABEL( GTK_BUTTON(button)->child );
+  
+  return wxString( label->label );
 };
 
 wxString wxRadioBox::GetLabel(void) const
@@ -201,8 +239,11 @@ wxString wxRadioBox::GetStringSelection(void) const
   return "";
 };
 
-bool wxRadioBox::SetStringSelection( const wxString& WXUNUSED(s) )
+bool wxRadioBox::SetStringSelection( const wxString&s )
 {
+  int res = FindString( s );
+  if (res == -1) return FALSE;
+  SetSelection( res );
   return TRUE;
 };
 
index bcfece5c2771351b1e0ea1b5eef8f9b7ddd34b5d..ac11b17d44384355f0dd333f0bc23533a0883df8 100644 (file)
@@ -52,7 +52,7 @@ void gtk_scrollbar_callback( GtkWidget *WXUNUSED(widget), wxScrollBar *win )
   
   wxScrollEvent event( command, win->GetId(), value, orient );
   event.SetEventObject( win );
-  win->ProcessEvent( event );
+  win->GetEventHandler()->ProcessEvent( event );
   
 /*
   wxCommandEvent cevent( wxEVT_COMMAND_SCROLLBAR_UPDATED, win->GetId() );
index afd11f78a75d93177591923e3910710590d5487e..deb1db70fb7f148d0e73729b7074a8794284c7d6 100644 (file)
@@ -59,7 +59,8 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
   PreCreation( parent, id, pos, size, style, name );
 
   bool bMultiLine = (style & wxTE_MULTILINE) != 0;
-  if ( bMultiLine ) {
+  if ( bMultiLine ) 
+  {
     // a multi-line edit control: create a vertical scrollbar by default and
     // horizontal if requested
     bool bHasHScrollbar = (style & wxHSCROLL) != 0;
index 8f8ccf94466acdefef9a78f24820da0bfd1210ec..c064c71faa2fbada70b0d7ad1f46b543c21f4ab0 100644 (file)
@@ -27,7 +27,7 @@
 #include "wx/mdi.h"
 #include "wx/notebook.h"
 #include "wx/statusbr.h"
-#include "wx/treectrl.h"
+//#include "wx/treectrl.h"
 #include "gdk/gdkkeysyms.h"
 #include <math.h>
 #include "wx/gtk/win_gtk.h"
@@ -1064,7 +1064,8 @@ void wxWindow::ImplementSetPosition(void)
     if (IsKindOf(CLASSINFO(wxFrame)) ||
         IsKindOf(CLASSINFO(wxDialog)))
     {
-      gtk_widget_set_uposition( m_widget, m_x, m_y );
+      if ((m_x != -1) || (m_y != -1))
+        gtk_widget_set_uposition( m_widget, m_x, m_y );
     }
     else
     {
@@ -1362,7 +1363,7 @@ void wxWindow::Fit(void)
 
     node = node->Next();
   }
-  SetClientSize(maxX + 5, maxY + 5);
+  SetClientSize(maxX + 5, maxY + 10);
 };
 
 void wxWindow::OnSize( wxSizeEvent &WXUNUSED(event) )
@@ -1473,7 +1474,7 @@ void wxWindow::AddChild( wxWindow *child )
   
   // wxFrame has a private AddChild
   
-  if (IS_KIND_OF(this,wxFrame))
+  if (IS_KIND_OF(this,wxFrame) && !IS_KIND_OF(this,wxMDIChildFrame))
   {
     wxFrame *frame = (wxFrame*)this;
     frame->AddChild( child );
@@ -1604,12 +1605,6 @@ void wxWindow::Refresh( bool eraseBackground, const wxRect *rect )
     gdk_rect.width = rect->width;
     gdk_rect.height = rect->height;
     
-    if (IS_KIND_OF(this,wxTreeCtrl))
-    {
-      printf( "x: %d y: %d w: %d h: %d .\n",
-        gdk_rect.x, gdk_rect.y, gdk_rect.width, gdk_rect.height );
-    }
-    
     if (m_wxwindow)
       gtk_widget_draw( m_wxwindow, &gdk_rect );
     else
index 5057a46d8e17af415c4709f47d7a77655a8ec9c2..aab90635b4a3779a487d70e57ca2416fb89d78d1 100644 (file)
@@ -292,6 +292,8 @@ void MyFrame::OnAbout( wxCommandEvent &WXUNUSED(event) )
   
   (void) new wxButton( &dialog, wxID_OK, "Return", wxPoint(w/2-40,h-50), wxSize(80,30) );
   
+  dialog.Fit();
+  
   dialog.ShowModal();
 };
 
index d4744a77ba58f479582cc6a6026d70f61c4f2d7e..fc5f5a619cf33d81e9e6e35841ab07abfc570127 100644 (file)
@@ -60,8 +60,8 @@ public:
        @param baseLine the baseline for alignment, from top of box
        @draw if set to false, do not draw but just calculate sizes
    */
-   virtual void Draw(wxDC &dc, wxPoint position, CoordType baseLine,
-                     bool draw = true) {};
+   virtual void Draw( wxDC &WXUNUSED(dc), wxPoint WXUNUSED(position), 
+                     CoordType WXUNUSED(baseLine), bool draw = true) {};
 
    /** Calculates and returns the size of the object. May need to be
        called twice to work.
@@ -70,8 +70,9 @@ public:
        baseline)
        @return the size of the object's box in pixels
    */
-   virtual wxPoint GetSize(CoordType *baseLine) const { return
-                                                           wxPoint(0,0); };
+   virtual wxPoint GetSize( CoordType *WXUNUSED(baseLine) ) const 
+     { return wxPoint(0,0); };
+     
    /// returns the number of cursor positions occupied by this object
    virtual CoordType CountPositions(void) const { return 1; }
 
index cf656ce45c3e5a983e27bfd2e589f71aeb6dc4cd..61304396e329235a39bde988ea2aa16a16436ae3 100644 (file)
@@ -16,6 +16,8 @@
 
 #include   "wxllist.h"
 
+#define BROKEN_COMPILER
+
 #ifdef   BROKEN_COMPILER
 #   define   virtual
 #endif