]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/notebook.cpp
(very) small changes for Windows compilation
[wxWidgets.git] / src / gtk1 / notebook.cpp
index 0a3b30089d1cdf6f8ed11a5b29dcbc5bda5c23b0..f318ba6d2ca771f5943815ab790e2b0903f11741 100644 (file)
@@ -2,9 +2,8 @@
 // Name:        notebook.cpp
 // Purpose:
 // Author:      Robert Roebling
-// Created:     01/02/97
-// Id:
-// Copyright:   (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
+// Id:          $Id$
+// Copyright:   (c) 1998 Robert Roebling, Vadim Zeitlin
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
@@ -151,6 +150,8 @@ bool wxNotebook::Create(wxWindow *parent, wxWindowID id,
 
 int wxNotebook::GetSelection() const
 {
+  wxCHECK_MSG( m_widget != NULL, -1, "invalid notebook" );
+  
   if (m_pages.Number() == 0) return -1;
 
   GtkNotebookPage *g_page = GTK_NOTEBOOK(m_widget)->cur_page;
@@ -183,6 +184,8 @@ int wxNotebook::GetRowCount() const
 
 wxString wxNotebook::GetPageText( int page ) const
 {
+  wxCHECK_MSG( m_widget != NULL, "", "invalid notebook" );
+  
   wxNotebookPage* nb_page = GetNotebookPage(page);
   if (nb_page)
     return nb_page->m_text;
@@ -192,6 +195,8 @@ wxString wxNotebook::GetPageText( int page ) const
 
 int wxNotebook::GetPageImage( int page ) const
 {
+  wxCHECK_MSG( m_widget != NULL, 0, "invalid notebook" );
+
   wxNotebookPage* nb_page = GetNotebookPage(page);
   if (nb_page)
     return nb_page->m_image;
@@ -201,6 +206,8 @@ int wxNotebook::GetPageImage( int page ) const
 
 wxNotebookPage* wxNotebook::GetNotebookPage(int page) const
 {
+  wxCHECK_MSG( m_widget != NULL, (wxNotebookPage*)NULL, "invalid notebook" );
+
   wxNotebookPage *nb_page = (wxNotebookPage *) NULL;
 
   wxNode *node = m_pages.First();
@@ -219,6 +226,8 @@ wxNotebookPage* wxNotebook::GetNotebookPage(int page) const
 
 int wxNotebook::SetSelection( int page )
 {
+  wxCHECK_MSG( m_widget != NULL, -1, "invalid notebook" );
+
   int selOld = GetSelection();
   wxNotebookPage* nb_page = GetNotebookPage(page);
   
@@ -242,6 +251,8 @@ int wxNotebook::SetSelection( int page )
 
 void wxNotebook::AdvanceSelection( bool bForward )
 {
+  wxCHECK_RET( m_widget != NULL, "invalid notebook" );
+
   int sel = GetSelection();
   int max = GetPageCount();
 
@@ -258,6 +269,8 @@ void wxNotebook::SetImageList( wxImageList* imageList )
 
 bool wxNotebook::SetPageText( int page, const wxString &text )
 {
+  wxCHECK_MSG( m_widget != NULL, FALSE, "invalid notebook" );
+
   wxNotebookPage* nb_page = GetNotebookPage(page);
   
   if (!nb_page) return FALSE;
@@ -290,6 +303,8 @@ void wxNotebook::SetPadding( const wxSize &WXUNUSED(padding) )
 
 bool wxNotebook::DeleteAllPages()
 {
+  wxCHECK_MSG( m_widget != NULL, FALSE, "invalid notebook" );
+
   wxNode *page_node = m_pages.First();
   while (page_node)
   {
@@ -332,6 +347,8 @@ bool wxNotebook::DeletePage( int page )
 bool wxNotebook::AddPage(wxWindow* win, const wxString& text,
                          bool bSelect, int imageId)
 {
+  wxCHECK_MSG( m_widget != NULL, FALSE, "invalid notebook" );
+
   // we've created the notebook page in AddChild(). Now we just have to set
   // the caption for the page and set the others parameters.
 
@@ -385,6 +402,8 @@ bool wxNotebook::AddPage(wxWindow* win, const wxString& text,
 
 wxWindow *wxNotebook::GetPage( int page ) const
 {
+  wxCHECK_MSG( m_widget != NULL, (wxWindow*) NULL, "invalid notebook" );
+
   wxNotebookPage* nb_page = GetNotebookPage(page);
   if (!nb_page)
     return (wxWindow *) NULL;
@@ -394,6 +413,8 @@ wxWindow *wxNotebook::GetPage( int page ) const
 
 void wxNotebook::AddChild( wxWindow *win )
 {
+  wxCHECK_RET( m_widget != NULL, "invalid notebook" );
+
   m_children.Append(win);
 
   wxNotebookPage *page = new wxNotebookPage();
@@ -435,6 +456,26 @@ bool wxNotebook::DoPhase( int WXUNUSED(nPhase) )
   return TRUE;
 }
 
+void wxNotebook::SetFont( const wxFont &font )
+{
+  wxCHECK_RET( m_widget != NULL, "invalid notebook" );
+
+  wxControl::SetFont( font );
+   
+  gtk_widget_set_style( m_widget, m_widgetStyle );
+}
+
+void wxNotebook::SetBackgroundColour( const wxColour &colour )
+{
+  wxCHECK_RET( m_widget != NULL, "invalid notebook" );
+
+  wxControl::SetBackgroundColour( colour );
+  
+  if (!m_backgroundColour.Ok()) return;
+  
+  gtk_widget_set_style( m_widget, m_widgetStyle );
+}
+
 //-----------------------------------------------------------------------------
 // wxNotebookEvent
 //-----------------------------------------------------------------------------