// 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.
{
wxASSERT( m_imageList != NULL );
- wxBitmap *bmp = m_imageList->GetBitmap(imageId);
+ const wxBitmap *bmp = m_imageList->GetBitmap(imageId);
GdkPixmap *pixmap = bmp->GetPixmap();
GdkBitmap *mask = (GdkBitmap*) NULL;
- if (bmp->GetMask()) mask = bmp->GetMask()->GetBitmap();
+ if ( bmp->GetMask() )
+ {
+ mask = bmp->GetMask()->GetBitmap();
+ }
+
GtkWidget *pixmapwid = gtk_pixmap_new (pixmap, mask );
gtk_box_pack_start(GTK_BOX(page->m_box), pixmapwid, FALSE, FALSE, 3);
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::ApplyWidgetStyle()
+{
+ SetWidgetStyle();
+ gtk_widget_set_style( m_widget, m_widgetStyle );
+}
+
//-----------------------------------------------------------------------------
// wxNotebookEvent
//-----------------------------------------------------------------------------