//-----------------------------------------------------------------------------
class wxImageList;
-class wxPanel;
-
class wxNotebook;
+class wxNotebookPage;
//-----------------------------------------------------------------------------
// global data
wxString GetPageText( const int page ) const;
int GetPageImage( const int page ) const;
void* GetPageData( const int page ) const;
+ wxNotebookPage* GetNotebookPage(int page) const;
int SetSelection( const int page );
void SetImageList( wxImageList* imageList );
bool SetPageText( const int page, const wxString& text );
void SetPadding( const wxSize& padding );
bool DeleteAllPages(void);
bool DeletePage( const int page );
- wxPanel *CreatePage( const int page, const wxString& text, const int imageId = -1, void* data = NULL );
- wxPanel *GetPanel( const int page );
+ bool AddPage( const int page, const wxString& text, wxWindow* win, const int imageId = -1, void* data = NULL );
+ wxWindow *GetPageWindow( const int page ) const;
// overriden to do nothing
virtual void AddChild( wxWindow *win );
//-----------------------------------------------------------------------------
class wxImageList;
-class wxPanel;
-
class wxNotebook;
+class wxNotebookPage;
//-----------------------------------------------------------------------------
// global data
wxString GetPageText( const int page ) const;
int GetPageImage( const int page ) const;
void* GetPageData( const int page ) const;
+ wxNotebookPage* GetNotebookPage(int page) const;
int SetSelection( const int page );
void SetImageList( wxImageList* imageList );
bool SetPageText( const int page, const wxString& text );
void SetPadding( const wxSize& padding );
bool DeleteAllPages(void);
bool DeletePage( const int page );
- wxPanel *CreatePage( const int page, const wxString& text, const int imageId = -1, void* data = NULL );
- wxPanel *GetPanel( const int page );
+ bool AddPage( const int page, const wxString& text, wxWindow* win, const int imageId = -1, void* data = NULL );
+ wxWindow *GetPageWindow( const int page ) const;
// overriden to do nothing
virtual void AddChild( wxWindow *win );
int m_image;
void *m_clientData;
GtkNotebookPage *m_page;
- wxPanel *m_clientPanel;
+ wxWindow *m_clientPanel;
wxNotebookPage(void)
{
wxString wxNotebook::GetPageText( const int page ) const
{
- wxNotebookPage *nb_page = NULL;
-
- wxNode *node = m_pages.First();
- while (node)
- {
- nb_page = (wxNotebookPage*)node->Data();
- if (nb_page->m_id == page) break;
- node = node->Next();
- };
- if (!node) return "";
-
- return nb_page->m_text;
+ wxNotebookPage* nb_page = GetNotebookPage(page);
+ if (nb_page)
+ return nb_page->m_text;
+ else
+ return "";
};
int wxNotebook::GetPageImage( const int page ) const
{
- wxNotebookPage *nb_page = NULL;
-
- wxNode *node = m_pages.First();
- while (node)
- {
- nb_page = (wxNotebookPage*)node->Data();
- if (nb_page->m_id == page) break;
- node = node->Next();
- };
- if (!node) return -1;
-
- return nb_page->m_image;
+ wxNotebookPage* nb_page = GetNotebookPage(page);
+ if (nb_page)
+ return nb_page->m_image;
+ else
+ return NULL;
};
void* wxNotebook::GetPageData( const int page ) const
+{
+ wxNotebookPage* nb_page = GetNotebookPage(page);
+ if (nb_page)
+ return nb_page->m_clientData;
+ else
+ return NULL;
+};
+
+wxNotebookPage* wxNotebook::GetNotebookPage(int page) const
{
wxNotebookPage *nb_page = NULL;
node = node->Next();
};
if (!node) return NULL;
-
- return nb_page->m_clientData;
+ return nb_page;
};
int wxNotebook::SetSelection( const int page )
{
- wxNotebookPage *nb_page = NULL;
-
- wxNode *node = m_pages.First();
- while (node)
- {
- nb_page = (wxNotebookPage*)node->Data();
- if (nb_page->m_id == page) break;
- node = node->Next();
- };
- if (!node) return -1;
+ wxNotebookPage* nb_page = GetNotebookPage(page);
+ if (!nb_page) return -1;
int page_num = 0;
GList *child = GTK_NOTEBOOK(m_widget)->children;
bool wxNotebook::SetPageText( const int page, const wxString &text )
{
- wxNotebookPage *nb_page = NULL;
-
- wxNode *node = m_pages.First();
- while (node)
- {
- nb_page = (wxNotebookPage*)node->Data();
- if (nb_page->m_id == page) break;
- node = node->Next();
- };
- if (!node) return FALSE;
+ wxNotebookPage* nb_page = GetNotebookPage(page);
+ if (!nb_page) return FALSE;
nb_page->m_text = text;
bool wxNotebook::SetPageImage( const int page, const int image )
{
- wxNotebookPage *nb_page = NULL;
-
- wxNode *node = m_pages.First();
- while (node)
- {
- nb_page = (wxNotebookPage*)node->Data();
- if (nb_page->m_id == page) break;
- node = node->Next();
- };
- if (!node) return FALSE;
+ wxNotebookPage* nb_page = GetNotebookPage(page);
+ if (!nb_page)
+ return FALSE;
nb_page->m_image = image;
bool wxNotebook::SetPageData( const int page, void* data )
{
- wxNotebookPage *nb_page = NULL;
+ wxNotebookPage* nb_page = GetNotebookPage(page);
+ if (!nb_page) return FALSE;
- wxNode *node = m_pages.First();
- while (node)
- {
- nb_page = (wxNotebookPage*)node->Data();
- if (nb_page->m_id == page) break;
- node = node->Next();
- };
- if (!node) return FALSE;
-
nb_page->m_clientData = data;
return TRUE;
bool wxNotebook::DeletePage( const int page )
{
- wxNotebookPage *nb_page = NULL;
-
- wxNode *node = m_pages.First();
- while (node)
- {
- nb_page = (wxNotebookPage*)node->Data();
- if (nb_page->m_id == page) break;
- node = node->Next();
- };
- if (!node) return FALSE;
+ wxNotebookPage* nb_page = GetNotebookPage(page);
+ if (!nb_page) return FALSE;
int page_num = 0;
GList *child = GTK_NOTEBOOK(m_widget)->children;
return TRUE;
};
-wxPanel *wxNotebook::CreatePage( const int item, const wxString &text, const int imageId, void* data )
+bool wxNotebook::AddPage( const int item, const wxString &text, wxWindow* win, const int imageId, void* data )
{
wxNotebookPage *page = new wxNotebookPage;
-
+
page->m_text = text;
if (page->m_text.IsNull()) page->m_text = "";
page->m_id = item;
page->m_clientData = data;
m_frame = gtk_label_new( page->m_text );
+ gtk_notebook_append_page( GTK_NOTEBOOK(m_widget), win->m_widget, m_frame );
+
gtk_misc_set_alignment( GTK_MISC(m_frame), 0.0, 0.5 );
- page->m_clientPanel = new wxPanel( this, -1, wxPoint(0,0), wxSize(100,100) );
+ page->m_clientPanel = win;
+// page->m_clientPanel = new wxPanel( this, -1, wxPoint(0,0), wxSize(100,100) );
m_frame = NULL;
page->m_page = (GtkNotebookPage*)( g_list_last( GTK_NOTEBOOK(m_widget)->children )->data );
- if (!page->m_page) wxFatalError( "Notebook page creation error" );
-
+ if (!page->m_page)
+ {
+ wxFatalError( "Notebook page creation error" );
+ return FALSE;
+ }
+
m_pages.Append( page );
- return page->m_clientPanel;
+ return TRUE;
};
-wxPanel *wxNotebook::GetPanel( const int page )
+wxWindow *wxNotebook::GetPageWindow( const int page ) const
{
- wxNotebookPage *nb_page = NULL;
-
- wxNode *node = m_pages.First();
- while (node)
- {
- nb_page = (wxNotebookPage*)node->Data();
- if (nb_page->m_id == page) break;
- node = node->Next();
- };
- if (!node) return NULL;
+ wxNotebookPage* nb_page = GetNotebookPage(page);
+ if (!nb_page) return NULL;
return nb_page->m_clientPanel;
};
{
if (!m_frame) wxFatalError( "Notebook::Addchild() must not be called directly." );
- gtk_notebook_append_page( GTK_NOTEBOOK(m_widget), win->m_widget, m_frame );
+// gtk_notebook_append_page( GTK_NOTEBOOK(m_widget), win->m_widget, m_frame );
};
//-----------------------------------------------------------------------------
int m_image;
void *m_clientData;
GtkNotebookPage *m_page;
- wxPanel *m_clientPanel;
+ wxWindow *m_clientPanel;
wxNotebookPage(void)
{
wxString wxNotebook::GetPageText( const int page ) const
{
- wxNotebookPage *nb_page = NULL;
-
- wxNode *node = m_pages.First();
- while (node)
- {
- nb_page = (wxNotebookPage*)node->Data();
- if (nb_page->m_id == page) break;
- node = node->Next();
- };
- if (!node) return "";
-
- return nb_page->m_text;
+ wxNotebookPage* nb_page = GetNotebookPage(page);
+ if (nb_page)
+ return nb_page->m_text;
+ else
+ return "";
};
int wxNotebook::GetPageImage( const int page ) const
{
- wxNotebookPage *nb_page = NULL;
-
- wxNode *node = m_pages.First();
- while (node)
- {
- nb_page = (wxNotebookPage*)node->Data();
- if (nb_page->m_id == page) break;
- node = node->Next();
- };
- if (!node) return -1;
-
- return nb_page->m_image;
+ wxNotebookPage* nb_page = GetNotebookPage(page);
+ if (nb_page)
+ return nb_page->m_image;
+ else
+ return NULL;
};
void* wxNotebook::GetPageData( const int page ) const
+{
+ wxNotebookPage* nb_page = GetNotebookPage(page);
+ if (nb_page)
+ return nb_page->m_clientData;
+ else
+ return NULL;
+};
+
+wxNotebookPage* wxNotebook::GetNotebookPage(int page) const
{
wxNotebookPage *nb_page = NULL;
node = node->Next();
};
if (!node) return NULL;
-
- return nb_page->m_clientData;
+ return nb_page;
};
int wxNotebook::SetSelection( const int page )
{
- wxNotebookPage *nb_page = NULL;
-
- wxNode *node = m_pages.First();
- while (node)
- {
- nb_page = (wxNotebookPage*)node->Data();
- if (nb_page->m_id == page) break;
- node = node->Next();
- };
- if (!node) return -1;
+ wxNotebookPage* nb_page = GetNotebookPage(page);
+ if (!nb_page) return -1;
int page_num = 0;
GList *child = GTK_NOTEBOOK(m_widget)->children;
bool wxNotebook::SetPageText( const int page, const wxString &text )
{
- wxNotebookPage *nb_page = NULL;
-
- wxNode *node = m_pages.First();
- while (node)
- {
- nb_page = (wxNotebookPage*)node->Data();
- if (nb_page->m_id == page) break;
- node = node->Next();
- };
- if (!node) return FALSE;
+ wxNotebookPage* nb_page = GetNotebookPage(page);
+ if (!nb_page) return FALSE;
nb_page->m_text = text;
bool wxNotebook::SetPageImage( const int page, const int image )
{
- wxNotebookPage *nb_page = NULL;
-
- wxNode *node = m_pages.First();
- while (node)
- {
- nb_page = (wxNotebookPage*)node->Data();
- if (nb_page->m_id == page) break;
- node = node->Next();
- };
- if (!node) return FALSE;
+ wxNotebookPage* nb_page = GetNotebookPage(page);
+ if (!nb_page)
+ return FALSE;
nb_page->m_image = image;
bool wxNotebook::SetPageData( const int page, void* data )
{
- wxNotebookPage *nb_page = NULL;
+ wxNotebookPage* nb_page = GetNotebookPage(page);
+ if (!nb_page) return FALSE;
- wxNode *node = m_pages.First();
- while (node)
- {
- nb_page = (wxNotebookPage*)node->Data();
- if (nb_page->m_id == page) break;
- node = node->Next();
- };
- if (!node) return FALSE;
-
nb_page->m_clientData = data;
return TRUE;
bool wxNotebook::DeletePage( const int page )
{
- wxNotebookPage *nb_page = NULL;
-
- wxNode *node = m_pages.First();
- while (node)
- {
- nb_page = (wxNotebookPage*)node->Data();
- if (nb_page->m_id == page) break;
- node = node->Next();
- };
- if (!node) return FALSE;
+ wxNotebookPage* nb_page = GetNotebookPage(page);
+ if (!nb_page) return FALSE;
int page_num = 0;
GList *child = GTK_NOTEBOOK(m_widget)->children;
return TRUE;
};
-wxPanel *wxNotebook::CreatePage( const int item, const wxString &text, const int imageId, void* data )
+bool wxNotebook::AddPage( const int item, const wxString &text, wxWindow* win, const int imageId, void* data )
{
wxNotebookPage *page = new wxNotebookPage;
-
+
page->m_text = text;
if (page->m_text.IsNull()) page->m_text = "";
page->m_id = item;
page->m_clientData = data;
m_frame = gtk_label_new( page->m_text );
+ gtk_notebook_append_page( GTK_NOTEBOOK(m_widget), win->m_widget, m_frame );
+
gtk_misc_set_alignment( GTK_MISC(m_frame), 0.0, 0.5 );
- page->m_clientPanel = new wxPanel( this, -1, wxPoint(0,0), wxSize(100,100) );
+ page->m_clientPanel = win;
+// page->m_clientPanel = new wxPanel( this, -1, wxPoint(0,0), wxSize(100,100) );
m_frame = NULL;
page->m_page = (GtkNotebookPage*)( g_list_last( GTK_NOTEBOOK(m_widget)->children )->data );
- if (!page->m_page) wxFatalError( "Notebook page creation error" );
-
+ if (!page->m_page)
+ {
+ wxFatalError( "Notebook page creation error" );
+ return FALSE;
+ }
+
m_pages.Append( page );
- return page->m_clientPanel;
+ return TRUE;
};
-wxPanel *wxNotebook::GetPanel( const int page )
+wxWindow *wxNotebook::GetPageWindow( const int page ) const
{
- wxNotebookPage *nb_page = NULL;
-
- wxNode *node = m_pages.First();
- while (node)
- {
- nb_page = (wxNotebookPage*)node->Data();
- if (nb_page->m_id == page) break;
- node = node->Next();
- };
- if (!node) return NULL;
+ wxNotebookPage* nb_page = GetNotebookPage(page);
+ if (!nb_page) return NULL;
return nb_page->m_clientPanel;
};
{
if (!m_frame) wxFatalError( "Notebook::Addchild() must not be called directly." );
- gtk_notebook_append_page( GTK_NOTEBOOK(m_widget), win->m_widget, m_frame );
+// gtk_notebook_append_page( GTK_NOTEBOOK(m_widget), win->m_widget, m_frame );
};
//-----------------------------------------------------------------------------