]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/checklst.cpp
Fix memory leak when a spacer is added, and crash when a window is added before wxSiz...
[wxWidgets.git] / src / gtk1 / checklst.cpp
index 01e3bc7c54aaedceae4a802dc927153852f24388..45bc4adc20454d44f51cd6d5e21c1fe17ab231da 100644 (file)
@@ -7,15 +7,19 @@
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
 #pragma implementation "checklst.h"
 #endif
 
 #pragma implementation "checklst.h"
 #endif
 
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
 #include "wx/defs.h"
 
 #if wxUSE_CHECKLISTBOX
 
 #include "wx/checklst.h"
 #include "wx/defs.h"
 
 #if wxUSE_CHECKLISTBOX
 
 #include "wx/checklst.h"
+#include "wx/gtk/private.h"
 
 #include <gdk/gdk.h>
 #include <gtk/gtk.h>
 
 #include <gdk/gdk.h>
 #include <gtk/gtk.h>
@@ -44,6 +48,19 @@ wxCheckListBox::wxCheckListBox(wxWindow *parent, wxWindowID id,
     wxListBox::Create( parent, id, pos, size, nStrings, choices, style, validator, name );
 }
 
     wxListBox::Create( parent, id, pos, size, nStrings, choices, style, validator, name );
 }
 
+wxCheckListBox::wxCheckListBox(wxWindow *parent, wxWindowID id,
+                               const wxPoint& pos,
+                               const wxSize& size,
+                               const wxArrayString& choices,
+                               long style,
+                               const wxValidator& validator,
+                               const wxString& name )
+{
+    m_hasCheckBoxes = TRUE;
+    wxListBox::Create( parent, id, pos, size, choices,
+                       style, validator, name );
+}
+
 bool wxCheckListBox::IsChecked( int index ) const
 {
     wxCHECK_MSG( m_list != NULL, FALSE, wxT("invalid checklistbox") );
 bool wxCheckListBox::IsChecked( int index ) const
 {
     wxCHECK_MSG( m_list != NULL, FALSE, wxT("invalid checklistbox") );
@@ -54,7 +71,7 @@ bool wxCheckListBox::IsChecked( int index ) const
         GtkBin *bin = GTK_BIN( child->data );
         GtkLabel *label = GTK_LABEL( bin->child );
 
         GtkBin *bin = GTK_BIN( child->data );
         GtkLabel *label = GTK_LABEL( bin->child );
 
-        wxString str = wxString(label->label,*wxConvCurrent);
+        wxString str( wxGTK_CONV_BACK( label->label ) );
 
         return str.GetChar(1) == wxCHECKLBOX_CHECKED;
     }
 
         return str.GetChar(1) == wxCHECKLBOX_CHECKED;
     }
@@ -73,14 +90,14 @@ void wxCheckListBox::Check( int index, bool check )
         GtkBin *bin = GTK_BIN( child->data );
         GtkLabel *label = GTK_LABEL( bin->child );
 
         GtkBin *bin = GTK_BIN( child->data );
         GtkLabel *label = GTK_LABEL( bin->child );
 
-        wxString str = wxString(label->label,*wxConvCurrent);
+        wxString str( wxGTK_CONV_BACK( label->label ) );
 
         if (check == (str.GetChar(1) == wxCHECKLBOX_CHECKED))
             return;
 
         str.SetChar( 1, check ? wxCHECKLBOX_CHECKED : wxCHECKLBOX_UNCHECKED );
 
 
         if (check == (str.GetChar(1) == wxCHECKLBOX_CHECKED))
             return;
 
         str.SetChar( 1, check ? wxCHECKLBOX_CHECKED : wxCHECKLBOX_UNCHECKED );
 
-        gtk_label_set( label, str.mbc_str() );
+        gtk_label_set( label, wxGTK_CONV( str ) );
 
         return;
     }
 
         return;
     }