]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/notebook.cpp
Applied patch [ 592363 ] Owner Draw Round 2 fixes
[wxWidgets.git] / src / gtk / notebook.cpp
index 1754454371b2c04db7a3f1fb2b51e7d6b4f377b3..edd509368564080fa147240dfcf19191f973c169 100644 (file)
@@ -21,9 +21,9 @@
 #include "wx/intl.h"
 #include "wx/log.h"
 
-#include <gdk/gdk.h>
-#include <gtk/gtk.h>
+#include "wx/gtk/private.h"
 #include "wx/gtk/win_gtk.h"
+
 #include <gdk/gdkkeysyms.h>
 
 // ----------------------------------------------------------------------------
@@ -46,16 +46,6 @@ extern bool g_isIdle;
 
 extern bool g_blockEventsOnDrag;
 
-//-----------------------------------------------------------------------------
-// debug
-//-----------------------------------------------------------------------------
-
-#ifdef __WXDEBUG__
-
-extern void debug_focus_in( GtkWidget* widget, const wxChar* name, const wxChar *window );
-
-#endif
-
 //-----------------------------------------------------------------------------
 // wxGtkNotebookPage
 //-----------------------------------------------------------------------------
@@ -291,10 +281,6 @@ bool wxNotebook::Create(wxWindow *parent, wxWindowID id,
 
     m_widget = gtk_notebook_new();
 
-#ifdef __WXDEBUG__
-    debug_focus_in( m_widget, wxT("wxNotebook::m_widget"), name );
-#endif
-
     gtk_notebook_set_scrollable( GTK_NOTEBOOK(m_widget), 1 );
 
     gtk_signal_connect( GTK_OBJECT(m_widget), "switch_page",
@@ -408,7 +394,7 @@ bool wxNotebook::SetPageText( int page, const wxString &text )
 
     nb_page->m_text = text;
 
-    gtk_label_set( nb_page->m_label, nb_page->m_text.mbc_str() );
+    gtk_label_set( nb_page->m_label, wxGTK_CONV( nb_page->m_text ) );
 
     return TRUE;
 }
@@ -522,14 +508,11 @@ bool wxNotebook::DeleteAllPages()
 
     wxASSERT_MSG( GetPageCount() == 0, _T("all pages must have been deleted") );
 
-    return TRUE;
+    return wxNotebookBase::DeleteAllPages();
 }
 
 bool wxNotebook::DeletePage( int page )
 {
-    wxGtkNotebookPage* nb_page = GetNotebookPage(page);
-    wxCHECK_MSG( nb_page, FALSE, _T("invalid page in wxNotebook::DeletePage") );
-
     // GTK sets GtkNotebook.cur_page to NULL before sending the switch page
     // event so we have to store the selection internally
     if ( m_selection == -1 )
@@ -542,25 +525,23 @@ bool wxNotebook::DeletePage( int page )
         }
     }
 
-    m_pagesData.DeleteObject( nb_page );
-
+    // it will call our DoRemovePage() to do the real work
     return wxNotebookBase::DeletePage(page);
 }
 
 wxNotebookPage *wxNotebook::DoRemovePage( int page )
 {
-    wxGtkNotebookPage* nb_page = GetNotebookPage(page);
+    wxNotebookPage *client = wxNotebookBase::DoRemovePage(page);
+    if ( !client )
+        return NULL;
 
-    wxCHECK_MSG( nb_page, NULL, _T("wxNotebook::RemovePage: invalid page") );
-
-    wxNotebookPage *client = GetPage(page);
     gtk_widget_ref( client->m_widget );
     gtk_widget_unrealize( client->m_widget );
     gtk_widget_unparent( client->m_widget );
 
     gtk_notebook_remove_page( GTK_NOTEBOOK(m_widget), page );
 
-    m_pagesData.DeleteObject( nb_page );
+    m_pagesData.DeleteObject(GetNotebookPage(page));
 
     return client;
 }
@@ -636,7 +617,7 @@ bool wxNotebook::InsertPage( int position,
     page->m_text = text;
     if (page->m_text.IsEmpty()) page->m_text = wxT("");
 
-    page->m_label = GTK_LABEL( gtk_label_new(page->m_text.mbc_str()) );
+    page->m_label = GTK_LABEL( gtk_label_new( wxGTK_CONV( page->m_text ) ) );
     gtk_box_pack_end( GTK_BOX(page->m_box), GTK_WIDGET(page->m_label), FALSE, FALSE, 3 );
 
     /* show the label */
@@ -691,7 +672,7 @@ void wxNotebook::ApplyWidgetStyle()
 bool wxNotebook::IsOwnGtkWindow( GdkWindow *window )
 {
     return ((m_widget->window == window) ||
-            (GTK_NOTEBOOK(m_widget)->panel == window));
+            (NOTEBOOK_PANEL(m_widget) == window));
 }
 
 //-----------------------------------------------------------------------------