]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/notebook.cpp
fix wxGTK1 compilation after wxTextEntry DoGetValue() change
[wxWidgets.git] / src / gtk1 / notebook.cpp
index 7c51c6d91bbeeaa655bb08b9baa8d64a8c5665b7..ac4155516dd93ba337a76eb89d7622f2012b86e5 100644 (file)
 
 #include <gdk/gdkkeysyms.h>
 
 
 #include <gdk/gdkkeysyms.h>
 
-// ----------------------------------------------------------------------------
-// events
-// ----------------------------------------------------------------------------
-
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED)
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING)
-
 //-----------------------------------------------------------------------------
 // idle system
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 // idle system
 //-----------------------------------------------------------------------------
@@ -68,8 +61,8 @@ public:
     wxGtkNotebookPage()
     {
         m_image = -1;
     wxGtkNotebookPage()
     {
         m_image = -1;
-        m_page = (GtkNotebookPage *) NULL;
-        m_box = (GtkWidget *) NULL;
+        m_page = NULL;
+        m_box = NULL;
     }
 
     wxString           m_text;
     }
 
     wxString           m_text;
@@ -112,34 +105,25 @@ static void gtk_notebook_page_change_callback(GtkNotebook *WXUNUSED(widget),
         notebook->m_skipNextPageChangeEvent = false;
 
         // make wxNotebook::GetSelection() return the correct (i.e. consistent
         notebook->m_skipNextPageChangeEvent = false;
 
         // make wxNotebook::GetSelection() return the correct (i.e. consistent
-        // with wxNotebookEvent::GetSelection()) value even though the page is
+        // with wxBookCtrlEvent::GetSelection()) value even though the page is
         // not really changed in GTK+
         notebook->m_selection = page;
     }
     else
     {
         // not really changed in GTK+
         notebook->m_selection = page;
     }
     else
     {
-        wxNotebookEvent eventChanging( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING,
-                                       notebook->GetId(), page, old );
-        eventChanging.SetEventObject( notebook );
-
-        if ( (notebook->GetEventHandler()->ProcessEvent(eventChanging)) &&
-              !eventChanging.IsAllowed() )
+        if ( !notebook->SendPageChangingEvent(page) )
         {
         {
-            /* program doesn't allow the page change */
-            g_signal_stop_emission_by_name (notebook->m_widget,
-                                            "switch_page");
+            // program doesn't allow the page change
+            gtk_signal_emit_stop_by_name(GTK_OBJECT(notebook->m_widget), "switch_page");
         }
         else // change allowed
         {
             // make wxNotebook::GetSelection() return the correct (i.e. consistent
         }
         else // change allowed
         {
             // make wxNotebook::GetSelection() return the correct (i.e. consistent
-            // with wxNotebookEvent::GetSelection()) value even though the page is
+            // with wxBookCtrlEvent::GetSelection()) value even though the page is
             // not really changed in GTK+
             notebook->m_selection = page;
 
             // not really changed in GTK+
             notebook->m_selection = page;
 
-            wxNotebookEvent eventChanged( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
-                                          notebook->GetId(), page, old );
-            eventChanged.SetEventObject( notebook );
-            notebook->GetEventHandler()->ProcessEvent( eventChanged );
+            notebook->SendPageChangedEvent(old);
         }
     }
 
         }
     }
 
@@ -258,7 +242,7 @@ static gint gtk_notebook_key_press_callback( GtkWidget *widget, GdkEventKey *gdk
         event.SetCurrentFocus( notebook );
 
         wxNotebookPage *client = notebook->GetPage(sel);
         event.SetCurrentFocus( notebook );
 
         wxNotebookPage *client = notebook->GetPage(sel);
-        if ( !client->GetEventHandler()->ProcessEvent( event ) )
+        if ( !client->HandleWindowEvent( event ) )
         {
              client->SetFocus();
         }
         {
              client->SetFocus();
         }
@@ -296,9 +280,9 @@ static void wxInsertChildInNotebook( wxNotebook* parent, wxWindow* child )
 // wxNotebook
 //-----------------------------------------------------------------------------
 
 // wxNotebook
 //-----------------------------------------------------------------------------
 
-IMPLEMENT_DYNAMIC_CLASS(wxNotebook,wxControl)
+IMPLEMENT_DYNAMIC_CLASS(wxNotebook,wxBookCtrlBase)
 
 
-BEGIN_EVENT_TABLE(wxNotebook, wxControl)
+BEGIN_EVENT_TABLE(wxNotebook, wxBookCtrlBase)
     EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey)
 END_EVENT_TABLE()
 
     EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey)
 END_EVENT_TABLE()
 
@@ -307,7 +291,7 @@ void wxNotebook::Init()
     m_padding = 0;
     m_inSwitchPage = false;
 
     m_padding = 0;
     m_inSwitchPage = false;
 
-    m_imageList = (wxImageList *) NULL;
+    m_imageList = NULL;
     m_selection = -1;
     m_themeEnabled = true;
 }
     m_selection = -1;
     m_themeEnabled = true;
 }
@@ -424,9 +408,9 @@ int wxNotebook::GetPageImage( size_t page ) const
 
 wxGtkNotebookPage* wxNotebook::GetNotebookPage( int page ) const
 {
 
 wxGtkNotebookPage* wxNotebook::GetNotebookPage( int page ) const
 {
-    wxCHECK_MSG( m_widget != NULL, (wxGtkNotebookPage*) NULL, wxT("invalid notebook") );
+    wxCHECK_MSG( m_widget != NULL, NULL, wxT("invalid notebook") );
 
 
-    wxCHECK_MSG( page < (int)m_pagesData.GetCount(), (wxGtkNotebookPage*) NULL, wxT("invalid notebook index") );
+    wxCHECK_MSG( page < (int)m_pagesData.GetCount(), NULL, wxT("invalid notebook index") );
 
     return m_pagesData.Item(page)->GetData();
 }
 
     return m_pagesData.Item(page)->GetData();
 }
@@ -501,7 +485,7 @@ bool wxNotebook::SetPageImage( size_t page, int image )
     if (image == -1 && nb_page->m_image == -1)
         return true; /* Case 1): Nothing to do. */
 
     if (image == -1 && nb_page->m_image == -1)
         return true; /* Case 1): Nothing to do. */
 
-    GtkWidget *pixmapwid = (GtkWidget*) NULL;
+    GtkWidget *pixmapwid = NULL;
 
     if (nb_page->m_image != -1)
     {
 
     if (nb_page->m_image != -1)
     {
@@ -537,7 +521,7 @@ bool wxNotebook::SetPageImage( size_t page, int image )
     /* Construct the new pixmap */
     const wxBitmap *bmp = m_imageList->GetBitmapPtr(image);
     GdkPixmap *pixmap = bmp->GetPixmap();
     /* Construct the new pixmap */
     const wxBitmap *bmp = m_imageList->GetBitmapPtr(image);
     GdkPixmap *pixmap = bmp->GetPixmap();
-    GdkBitmap *mask = (GdkBitmap*) NULL;
+    GdkBitmap *mask = NULL;
     if ( bmp->GetMask() )
     {
         mask = bmp->GetMask()->GetBitmap();
     if ( bmp->GetMask() )
     {
         mask = bmp->GetMask()->GetBitmap();
@@ -705,7 +689,7 @@ bool wxNotebook::InsertPage( size_t position,
 
         const wxBitmap *bmp = m_imageList->GetBitmapPtr(imageId);
         GdkPixmap *pixmap = bmp->GetPixmap();
 
         const wxBitmap *bmp = m_imageList->GetBitmapPtr(imageId);
         GdkPixmap *pixmap = bmp->GetPixmap();
-        GdkBitmap *mask = (GdkBitmap*) NULL;
+        GdkBitmap *mask = NULL;
         if ( bmp->GetMask() )
         {
             mask = bmp->GetMask()->GetBitmap();
         if ( bmp->GetMask() )
         {
             mask = bmp->GetMask()->GetBitmap();
@@ -874,10 +858,4 @@ wxNotebook::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
     return GetDefaultAttributesFromGTKWidget(gtk_notebook_new);
 }
 
     return GetDefaultAttributesFromGTKWidget(gtk_notebook_new);
 }
 
-//-----------------------------------------------------------------------------
-// wxNotebookEvent
-//-----------------------------------------------------------------------------
-
-IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent)
-
 #endif
 #endif