// 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
/////////////////////////////////////////////////////////////////////////////
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;
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;
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;
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();
int wxNotebook::SetSelection( int page )
{
+ wxCHECK_MSG( m_widget != NULL, -1, "invalid notebook" );
+
int selOld = GetSelection();
wxNotebookPage* nb_page = GetNotebookPage(page);
void wxNotebook::AdvanceSelection( bool bForward )
{
+ wxCHECK_RET( m_widget != NULL, "invalid notebook" );
+
int sel = GetSelection();
int max = GetPageCount();
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;
bool wxNotebook::DeleteAllPages()
{
+ wxCHECK_MSG( m_widget != NULL, FALSE, "invalid notebook" );
+
wxNode *page_node = m_pages.First();
while (page_node)
{
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.
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;
void wxNotebook::AddChild( wxWindow *win )
{
+ wxCHECK_RET( m_widget != NULL, "invalid notebook" );
+
m_children.Append(win);
wxNotebookPage *page = new wxNotebookPage();
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
//-----------------------------------------------------------------------------