mimecmn.cpp C 32,B
module.cpp C B
mstream.cpp C B
+nbkbase.cpp C
object.cpp C B
objstrm.cpp C B
odbc.cpp C R,X,P
class wxGtkNotebookPage;
+#include "wx/list.h"
+WX_DECLARE_LIST(wxGtkNotebookPage, wxGtkNotebookPagesList);
+
//-----------------------------------------------------------------------------
// wxNotebook
//-----------------------------------------------------------------------------
long style = 0,
const wxString& name = "notebook");
// dtor
- ~wxNotebook();
+ virtual ~wxNotebook();
// accessors
// ---------
bool SetPageText(int nPage, const wxString& strText);
wxString GetPageText(int nPage) const;
- // image list stuff: each page may have an image associated with it. All
- // the images belong to an image list, so you have to
- // 1) create an image list
- // 2) associate it with the notebook
- // 3) set for each page it's image
- // associate image list with a control
- void SetImageList(wxImageList* imageList);
- void AssignImageList(wxImageList* imageList);
-
// sets/returns item's image index in the current image list
int GetPageImage(int nPage) const;
bool SetPageImage(int nPage, int nImage);
// adds a new page to the notebook (it will be deleted ny the notebook,
// don't delete it yourself). If bSelect, this page becomes active.
- bool AddPage( wxNotebookPage *win,
- const wxString& strText,
- bool select = FALSE,
- int imageId = -1 );
// the same as AddPage(), but adds it at the specified position
bool InsertPage( int position,
wxNotebookPage *win,
// helper function
wxGtkNotebookPage* GetNotebookPage(int page) const;
- bool m_ownsImageList;
- wxList m_pages;
+ // the additional page data (the pages themselves are in m_pages array)
+ wxGtkNotebookPagesList m_pagesData;
// for reasons explained in gtk/notebook.cpp we store the current
// selection internally instead of querying the notebook for it
- int m_selection;
+ int m_selection;
protected:
// remove one page from the notebook but do not destroy it
class wxGtkNotebookPage;
+#include "wx/list.h"
+WX_DECLARE_LIST(wxGtkNotebookPage, wxGtkNotebookPagesList);
+
//-----------------------------------------------------------------------------
// wxNotebook
//-----------------------------------------------------------------------------
long style = 0,
const wxString& name = "notebook");
// dtor
- ~wxNotebook();
+ virtual ~wxNotebook();
// accessors
// ---------
bool SetPageText(int nPage, const wxString& strText);
wxString GetPageText(int nPage) const;
- // image list stuff: each page may have an image associated with it. All
- // the images belong to an image list, so you have to
- // 1) create an image list
- // 2) associate it with the notebook
- // 3) set for each page it's image
- // associate image list with a control
- void SetImageList(wxImageList* imageList);
- void AssignImageList(wxImageList* imageList);
-
// sets/returns item's image index in the current image list
int GetPageImage(int nPage) const;
bool SetPageImage(int nPage, int nImage);
// adds a new page to the notebook (it will be deleted ny the notebook,
// don't delete it yourself). If bSelect, this page becomes active.
- bool AddPage( wxNotebookPage *win,
- const wxString& strText,
- bool select = FALSE,
- int imageId = -1 );
// the same as AddPage(), but adds it at the specified position
bool InsertPage( int position,
wxNotebookPage *win,
// helper function
wxGtkNotebookPage* GetNotebookPage(int page) const;
- bool m_ownsImageList;
- wxList m_pages;
+ // the additional page data (the pages themselves are in m_pages array)
+ wxGtkNotebookPagesList m_pagesData;
// for reasons explained in gtk/notebook.cpp we store the current
// selection internally instead of querying the notebook for it
- int m_selection;
+ int m_selection;
protected:
// remove one page from the notebook but do not destroy it
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = "notebook");
- // dtor
- ~wxNotebook();
// accessors
// ---------
// 3) set for each page it's image
// associate image list with a control
void SetImageList(wxImageList* imageList);
- void AssignImageList(wxImageList* imageList);
// sets/returns item's image index in the current image list
int GetPageImage(int nPage) const;
// helper functions
void ChangePage(int nOldSel, int nSel); // change pages
- bool m_bOwnsImageList;
-
int m_nSelection; // the current selection (-1 if none)
DECLARE_DYNAMIC_CLASS(wxNotebook)
#ifndef _WX_NOTEBOOK_H_BASE_
#define _WX_NOTEBOOK_H_BASE_
+#ifdef __GNUG__
+ #pragma interface "notebookbase.h"
+#endif
+
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
// ctor
wxNotebookBase()
{
- m_imageList = NULL;
+ Init();
}
// quasi ctor
long style = 0,
const wxString& name = wxNOTEBOOK_NAME);
+ // dtor
+ virtual ~wxNotebookBase();
+
// accessors
// ---------
// image list stuff: each page may have an image associated with it (all
// images belong to the same image list)
- virtual void SetImageList(wxImageList* imageList)
- {
- m_imageList = imageList;
- }
+ virtual void SetImageList(wxImageList* imageList);
+
+ // as SetImageList() but we will delete the image list ourselves
+ void AssignImageList(wxImageList* imageList);
// get pointer (may be NULL) to the associated image list
wxImageList* GetImageList() const { return m_imageList; }
virtual void SetTabSize(const wxSize& sz) = 0;
// calculate the size of the notebook from the size of its page
- virtual wxSize CalcSizeFromPage(const wxSize& sizePage)
- {
- // this was just taken from wxNotebookSizer::CalcMin() and is, of
- // course, totally bogus - just like the original code was
- wxSize sizeTotal = sizePage;
- if ( HasFlag(wxNB_LEFT) || HasFlag(wxNB_RIGHT) )
- sizeTotal.x += 90;
- else
- sizeTotal.y += 40;
-
- return sizeTotal;
- }
+ virtual wxSize CalcSizeFromPage(const wxSize& sizePage);
// operations
// ----------
// remove one page from the notebook and delete it
- virtual bool DeletePage(int nPage)
- {
- wxNotebookPage *page = DoRemovePage(nPage);
- if ( !page )
- return FALSE;
-
- delete page;
-
- return TRUE;
- }
+ virtual bool DeletePage(int nPage);
// remove one page from the notebook, without deleting it
virtual bool RemovePage(int nPage) { return DoRemovePage(nPage) != NULL; }
// remove the page and return a pointer to it
virtual wxNotebookPage *DoRemovePage(int page) = 0;
- // get the next page wrapping if we reached the end
- int GetNextPage(bool forward) const
- {
- int nPage;
-
- int nMax = GetPageCount();
- if ( nMax-- ) // decrement it to get the last valid index
- {
- int nSel = GetSelection();
+ // common part of all ctors
+ void Init();
- // change selection wrapping if it becomes invalid
- nPage = forward ? nSel == nMax ? 0
- : nSel + 1
- : nSel == 0 ? nMax
- : nSel - 1;
- }
- else // notebook is empty, no next page
- {
- nPage = -1;
- }
-
- return nPage;
- }
+ // get the next page wrapping if we reached the end
+ int GetNextPage(bool forward) const;
- wxImageList *m_imageList; // we can have an associated image list
- wxArrayPages m_pages; // array of pages
+ wxArrayPages m_pages; // array of pages
+ wxImageList *m_imageList; // we can have an associated image list
+ bool m_ownsImageList; // true if we must delete m_imageList
};
// ----------------------------------------------------------------------------
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: src/common/nbkbase.cpp
+// Purpose: common wxNotebook methods
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 02.07.01
+// RCS-ID: $Id$
+// Copyright: (c) 2001 Vadim Zeitlin
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#ifdef __GNUG__
+ #pragma implementation "notebookbase.h"
+#endif
+
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#if wxUSE_NOTEBOOK
+
+#ifndef WX_PRECOMP
+ #include "wx/notebook.h"
+ #include "wx/imaglist.h"
+#endif //WX_PRECOMP
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// constructors and destructors
+// ----------------------------------------------------------------------------
+
+void wxNotebookBase::Init()
+{
+ m_imageList = NULL;
+ m_ownsImageList = FALSE;
+}
+
+wxNotebookBase::~wxNotebookBase()
+{
+ if ( m_ownsImageList )
+ {
+ // may be NULL, ok
+ delete m_imageList;
+ }
+}
+
+// ----------------------------------------------------------------------------
+// image list
+// ----------------------------------------------------------------------------
+
+void wxNotebookBase::SetImageList(wxImageList* imageList)
+{
+ if ( m_ownsImageList )
+ {
+ // may be NULL, ok
+ delete m_imageList;
+
+ m_ownsImageList = FALSE;
+ }
+
+ m_imageList = imageList;
+}
+
+void wxNotebookBase::AssignImageList(wxImageList* imageList)
+{
+ SetImageList(imageList);
+ m_ownsImageList = TRUE;
+}
+
+// ----------------------------------------------------------------------------
+// geometry
+// ----------------------------------------------------------------------------
+
+wxSize wxNotebookBase::CalcSizeFromPage(const wxSize& sizePage)
+{
+ // this was just taken from wxNotebookSizer::CalcMin() and is, of
+ // course, totally bogus - just like the original code was
+ wxSize sizeTotal = sizePage;
+ if ( HasFlag(wxNB_LEFT) || HasFlag(wxNB_RIGHT) )
+ sizeTotal.x += 90;
+ else
+ sizeTotal.y += 40;
+
+ return sizeTotal;
+}
+
+// ----------------------------------------------------------------------------
+// pages management
+// ----------------------------------------------------------------------------
+
+bool wxNotebookBase::DeletePage(int nPage)
+{
+ wxNotebookPage *page = DoRemovePage(nPage);
+ if ( !page )
+ return FALSE;
+
+ delete page;
+
+ return TRUE;
+}
+
+int wxNotebookBase::GetNextPage(bool forward) const
+{
+ int nPage;
+
+ int nMax = GetPageCount();
+ if ( nMax-- ) // decrement it to get the last valid index
+ {
+ int nSel = GetSelection();
+
+ // change selection wrapping if it becomes invalid
+ nPage = forward ? nSel == nMax ? 0
+ : nSel + 1
+ : nSel == 0 ? nMax
+ : nSel - 1;
+ }
+ else // notebook is empty, no next page
+ {
+ nPage = -1;
+ }
+
+ return nPage;
+}
+
+#endif // wxUSE_NOTEBOOK
+
-# This file was automatically generated by tmake at 14:52, 2001/07/02
+# This file was automatically generated by tmake at 20:23, 2001/07/02
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE BASE.T!
ALL_SOURCES = \
common/init.cpp \
-# This file was automatically generated by tmake at 14:52, 2001/07/02
+# This file was automatically generated by tmake at 20:23, 2001/07/02
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE GTK.T!
ALL_SOURCES = \
generic/accel.cpp \
common/mimecmn.cpp \
common/module.cpp \
common/mstream.cpp \
+ common/nbkbase.cpp \
common/object.cpp \
common/objstrm.cpp \
common/paper.cpp \
mimecmn.o \
module.o \
mstream.o \
+ nbkbase.o \
object.o \
objstrm.o \
paper.o \
mimecmn.d \
module.d \
mstream.d \
+ nbkbase.d \
object.d \
objstrm.d \
paper.d \
// data
//-----------------------------------------------------------------------------
-extern bool g_blockEventsOnDrag;
+extern bool g_blockEventsOnDrag;
//-----------------------------------------------------------------------------
// debug
// wxGtkNotebookPage
//-----------------------------------------------------------------------------
+// VZ: this is rather ugly as we keep the pages themselves in an array (it
+// allows us to have quite a few functions implemented in the base class)
+// but the page data is kept in a separate list, so we must maintain them
+// in sync manually... of course, the list had been there before the base
+// class which explains it but it still would be nice to do something
+// about this one day
+
class wxGtkNotebookPage: public wxObject
{
public:
wxGtkNotebookPage()
{
- m_text = "";
m_image = -1;
m_page = (GtkNotebookPage *) NULL;
- m_client = (wxNotebookPage *) NULL;
m_box = (GtkWidget *) NULL;
}
int m_image;
GtkNotebookPage *m_page;
GtkLabel *m_label;
- wxNotebookPage *m_client;
GtkWidget *m_box; // in which the label and image are packed
};
+#include "wx/listimpl.cpp"
+WX_DEFINE_LIST(wxGtkNotebookPagesList);
+
//-----------------------------------------------------------------------------
// "switch_page"
//-----------------------------------------------------------------------------
/* win is a control: tab can be propagated up */
if ((gdk_event->keyval == GDK_Tab) || (gdk_event->keyval == GDK_ISO_Left_Tab))
{
- wxNode *node = win->m_pages.Nth( win->GetSelection() );
- if (!node) return FALSE;
-
- wxGtkNotebookPage *page = (wxGtkNotebookPage*) node->Data();
+ int sel = win->GetSelection();
+ wxGtkNotebookPage *page = win->GetNotebookPage(sel);
+ wxCHECK_MSG( page, FALSE, _T("invalid selection in wxNotebook") );
wxNavigationKeyEvent event;
event.SetEventObject( win );
/* CTRL-TAB changes the (parent) window, i.e. switch notebook page */
event.SetWindowChange( (gdk_event->state & GDK_CONTROL_MASK) );
event.SetCurrentFocus( win );
- if (!page->m_client->GetEventHandler()->ProcessEvent( event ))
+
+ wxNotebookPage *client = win->GetPage(sel);
+ if ( !client->GetEventHandler()->ProcessEvent( event ) )
{
- page->m_client->SetFocus();
+ client->SetFocus();
}
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "key_press_event" );
void wxNotebook::Init()
{
m_imageList = (wxImageList *) NULL;
- m_ownsImageList = FALSE;
- m_pages.DeleteContents( TRUE );
+ m_pagesData.DeleteContents( TRUE );
m_selection = -1;
m_themeEnabled = TRUE;
}
GTK_SIGNAL_FUNC(gtk_notebook_page_change_callback), (gpointer) this );
DeleteAllPages();
- if (m_ownsImageList) delete m_imageList;
}
bool wxNotebook::Create(wxWindow *parent, wxWindowID id,
- const wxPoint& pos, const wxSize& size,
- long style, const wxString& name )
+ const wxPoint& pos, const wxSize& size,
+ long style, const wxString& name )
{
m_needParent = TRUE;
m_acceptsFocus = TRUE;
{
wxCHECK_MSG( m_widget != NULL, (wxGtkNotebookPage*) NULL, wxT("invalid notebook") );
- wxCHECK_MSG( page < (int)m_pages.GetCount(), (wxGtkNotebookPage*) NULL, wxT("invalid notebook index") );
+ wxCHECK_MSG( page < (int)m_pagesData.GetCount(), (wxGtkNotebookPage*) NULL, wxT("invalid notebook index") );
- wxNode *node = m_pages.Nth( page );
-
- return (wxGtkNotebookPage *) node->Data();
+ return m_pagesData.Item(page)->GetData();
}
int wxNotebook::SetSelection( int page )
{
wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid notebook") );
- wxCHECK_MSG( page < (int)m_pages.GetCount(), -1, wxT("invalid notebook index") );
+ wxCHECK_MSG( page < (int)m_pagesData.GetCount(), -1, wxT("invalid notebook index") );
int selOld = GetSelection();
// cache the selection
m_selection = page;
gtk_notebook_set_page( GTK_NOTEBOOK(m_widget), page );
-
- wxGtkNotebookPage* g_page = GetNotebookPage( page );
- if (g_page->m_client)
- g_page->m_client->SetFocus();
- return selOld;
-}
-
-void wxNotebook::SetImageList( wxImageList* imageList )
-{
- if (m_ownsImageList) delete m_imageList;
- m_imageList = imageList;
- m_ownsImageList = FALSE;
-}
+ wxNotebookPage *client = GetPage(page);
+ if ( client )
+ client->SetFocus();
-void wxNotebook::AssignImageList( wxImageList* imageList )
-{
- SetImageList(imageList);
- m_ownsImageList = TRUE;
+ return selOld;
}
bool wxNotebook::SetPageText( int page, const wxString &text )
{
wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid notebook") );
- while (m_pages.GetCount() > 0)
- DeletePage( m_pages.GetCount()-1 );
+ while (m_pagesData.GetCount() > 0)
+ DeletePage( m_pagesData.GetCount()-1 );
+
+ wxASSERT_MSG( GetPageCount() == 0, _T("all pages must have been deleted") );
return TRUE;
}
if ( m_selection == -1 )
{
m_selection = GetSelection();
- if ( m_selection == (int)m_pages.GetCount() - 1 )
+ if ( m_selection == (int)m_pagesData.GetCount() - 1 )
{
// the index will become invalid after the page is deleted
m_selection = -1;
}
}
- nb_page->m_client->Destroy();
- m_pages.DeleteObject( nb_page );
+ m_pagesData.DeleteObject( nb_page );
- return TRUE;
+ return wxNotebookBase::DeletePage(page);
}
wxNotebookPage *wxNotebook::DoRemovePage( int page )
wxCHECK_MSG( nb_page, NULL, _T("wxNotebook::RemovePage: invalid page") );
- gtk_widget_ref( nb_page->m_client->m_widget );
- gtk_widget_unrealize( nb_page->m_client->m_widget );
- gtk_widget_unparent( nb_page->m_client->m_widget );
-
+ wxNotebookPage *client = GetPage(page);
+ gtk_widget_ref( client->m_widget );
+ gtk_widget_unrealize( client->m_widget );
+ gtk_widget_unparent( client->m_widget );
+
gtk_notebook_remove_page( GTK_NOTEBOOK(m_widget), page );
- wxNotebookPage *pageRemoved = (wxNotebookPage *)m_pages[page];
- m_pages.DeleteObject( nb_page );
+ m_pagesData.DeleteObject( nb_page );
- return pageRemoved;
+ return client;
}
-bool wxNotebook::InsertPage( int position, wxNotebookPage* win, const wxString& text,
- bool select, int imageId )
+bool wxNotebook::InsertPage( int position,
+ wxNotebookPage* win,
+ const wxString& text,
+ bool select,
+ int imageId )
{
wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid notebook") );
wxCHECK_MSG( win->GetParent() == this, FALSE,
wxT("Can't add a page whose parent is not the notebook!") );
+ wxCHECK_MSG( position >= 0 && position <= GetPageCount(), FALSE,
+ _T("invalid page index in wxNotebookPage::InsertPage()") );
+
/* don't receive switch page during addition */
gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget),
GTK_SIGNAL_FUNC(gtk_notebook_page_change_callback), (gpointer) this );
wxGtkNotebookPage *page = new wxGtkNotebookPage();
- if (position < 0)
- m_pages.Append( page );
+ if ( position == GetPageCount() )
+ m_pagesData.Append( page );
else
- m_pages.Insert( m_pages.Nth( position ), page );
+ m_pagesData.Insert( m_pagesData.Item( position ), page );
- page->m_client = win;
+ m_pages.Insert(win, position);
page->m_box = gtk_hbox_new( FALSE, 0 );
gtk_container_border_width( GTK_CONTAINER(page->m_box), 2 );
/* show the label */
gtk_widget_show( GTK_WIDGET(page->m_label) );
- if (select && (m_pages.GetCount() > 1))
+ if (select && (m_pagesData.GetCount() > 1))
{
if (position < 0)
SetSelection( GetPageCount()-1 );
return TRUE;
}
-bool wxNotebook::AddPage(wxNotebookPage* win, const wxString& text,
- bool select, int imageId)
-{
- return InsertPage( -1, win, text, select, imageId );
-}
-
void wxNotebook::OnNavigationKey(wxNavigationKeyEvent& event)
{
if (event.IsWindowChange())
-# This file was automatically generated by tmake at 14:52, 2001/07/02
+# This file was automatically generated by tmake at 20:23, 2001/07/02
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE GTK.T!
ALL_SOURCES = \
generic/accel.cpp \
common/mimecmn.cpp \
common/module.cpp \
common/mstream.cpp \
+ common/nbkbase.cpp \
common/object.cpp \
common/objstrm.cpp \
common/paper.cpp \
mimecmn.o \
module.o \
mstream.o \
+ nbkbase.o \
object.o \
objstrm.o \
paper.o \
mimecmn.d \
module.d \
mstream.d \
+ nbkbase.d \
object.d \
objstrm.d \
paper.d \
// data
//-----------------------------------------------------------------------------
-extern bool g_blockEventsOnDrag;
+extern bool g_blockEventsOnDrag;
//-----------------------------------------------------------------------------
// debug
// wxGtkNotebookPage
//-----------------------------------------------------------------------------
+// VZ: this is rather ugly as we keep the pages themselves in an array (it
+// allows us to have quite a few functions implemented in the base class)
+// but the page data is kept in a separate list, so we must maintain them
+// in sync manually... of course, the list had been there before the base
+// class which explains it but it still would be nice to do something
+// about this one day
+
class wxGtkNotebookPage: public wxObject
{
public:
wxGtkNotebookPage()
{
- m_text = "";
m_image = -1;
m_page = (GtkNotebookPage *) NULL;
- m_client = (wxNotebookPage *) NULL;
m_box = (GtkWidget *) NULL;
}
int m_image;
GtkNotebookPage *m_page;
GtkLabel *m_label;
- wxNotebookPage *m_client;
GtkWidget *m_box; // in which the label and image are packed
};
+#include "wx/listimpl.cpp"
+WX_DEFINE_LIST(wxGtkNotebookPagesList);
+
//-----------------------------------------------------------------------------
// "switch_page"
//-----------------------------------------------------------------------------
/* win is a control: tab can be propagated up */
if ((gdk_event->keyval == GDK_Tab) || (gdk_event->keyval == GDK_ISO_Left_Tab))
{
- wxNode *node = win->m_pages.Nth( win->GetSelection() );
- if (!node) return FALSE;
-
- wxGtkNotebookPage *page = (wxGtkNotebookPage*) node->Data();
+ int sel = win->GetSelection();
+ wxGtkNotebookPage *page = win->GetNotebookPage(sel);
+ wxCHECK_MSG( page, FALSE, _T("invalid selection in wxNotebook") );
wxNavigationKeyEvent event;
event.SetEventObject( win );
/* CTRL-TAB changes the (parent) window, i.e. switch notebook page */
event.SetWindowChange( (gdk_event->state & GDK_CONTROL_MASK) );
event.SetCurrentFocus( win );
- if (!page->m_client->GetEventHandler()->ProcessEvent( event ))
+
+ wxNotebookPage *client = win->GetPage(sel);
+ if ( !client->GetEventHandler()->ProcessEvent( event ) )
{
- page->m_client->SetFocus();
+ client->SetFocus();
}
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "key_press_event" );
void wxNotebook::Init()
{
m_imageList = (wxImageList *) NULL;
- m_ownsImageList = FALSE;
- m_pages.DeleteContents( TRUE );
+ m_pagesData.DeleteContents( TRUE );
m_selection = -1;
m_themeEnabled = TRUE;
}
GTK_SIGNAL_FUNC(gtk_notebook_page_change_callback), (gpointer) this );
DeleteAllPages();
- if (m_ownsImageList) delete m_imageList;
}
bool wxNotebook::Create(wxWindow *parent, wxWindowID id,
- const wxPoint& pos, const wxSize& size,
- long style, const wxString& name )
+ const wxPoint& pos, const wxSize& size,
+ long style, const wxString& name )
{
m_needParent = TRUE;
m_acceptsFocus = TRUE;
{
wxCHECK_MSG( m_widget != NULL, (wxGtkNotebookPage*) NULL, wxT("invalid notebook") );
- wxCHECK_MSG( page < (int)m_pages.GetCount(), (wxGtkNotebookPage*) NULL, wxT("invalid notebook index") );
+ wxCHECK_MSG( page < (int)m_pagesData.GetCount(), (wxGtkNotebookPage*) NULL, wxT("invalid notebook index") );
- wxNode *node = m_pages.Nth( page );
-
- return (wxGtkNotebookPage *) node->Data();
+ return m_pagesData.Item(page)->GetData();
}
int wxNotebook::SetSelection( int page )
{
wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid notebook") );
- wxCHECK_MSG( page < (int)m_pages.GetCount(), -1, wxT("invalid notebook index") );
+ wxCHECK_MSG( page < (int)m_pagesData.GetCount(), -1, wxT("invalid notebook index") );
int selOld = GetSelection();
// cache the selection
m_selection = page;
gtk_notebook_set_page( GTK_NOTEBOOK(m_widget), page );
-
- wxGtkNotebookPage* g_page = GetNotebookPage( page );
- if (g_page->m_client)
- g_page->m_client->SetFocus();
- return selOld;
-}
-
-void wxNotebook::SetImageList( wxImageList* imageList )
-{
- if (m_ownsImageList) delete m_imageList;
- m_imageList = imageList;
- m_ownsImageList = FALSE;
-}
+ wxNotebookPage *client = GetPage(page);
+ if ( client )
+ client->SetFocus();
-void wxNotebook::AssignImageList( wxImageList* imageList )
-{
- SetImageList(imageList);
- m_ownsImageList = TRUE;
+ return selOld;
}
bool wxNotebook::SetPageText( int page, const wxString &text )
{
wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid notebook") );
- while (m_pages.GetCount() > 0)
- DeletePage( m_pages.GetCount()-1 );
+ while (m_pagesData.GetCount() > 0)
+ DeletePage( m_pagesData.GetCount()-1 );
+
+ wxASSERT_MSG( GetPageCount() == 0, _T("all pages must have been deleted") );
return TRUE;
}
if ( m_selection == -1 )
{
m_selection = GetSelection();
- if ( m_selection == (int)m_pages.GetCount() - 1 )
+ if ( m_selection == (int)m_pagesData.GetCount() - 1 )
{
// the index will become invalid after the page is deleted
m_selection = -1;
}
}
- nb_page->m_client->Destroy();
- m_pages.DeleteObject( nb_page );
+ m_pagesData.DeleteObject( nb_page );
- return TRUE;
+ return wxNotebookBase::DeletePage(page);
}
wxNotebookPage *wxNotebook::DoRemovePage( int page )
wxCHECK_MSG( nb_page, NULL, _T("wxNotebook::RemovePage: invalid page") );
- gtk_widget_ref( nb_page->m_client->m_widget );
- gtk_widget_unrealize( nb_page->m_client->m_widget );
- gtk_widget_unparent( nb_page->m_client->m_widget );
-
+ wxNotebookPage *client = GetPage(page);
+ gtk_widget_ref( client->m_widget );
+ gtk_widget_unrealize( client->m_widget );
+ gtk_widget_unparent( client->m_widget );
+
gtk_notebook_remove_page( GTK_NOTEBOOK(m_widget), page );
- wxNotebookPage *pageRemoved = (wxNotebookPage *)m_pages[page];
- m_pages.DeleteObject( nb_page );
+ m_pagesData.DeleteObject( nb_page );
- return pageRemoved;
+ return client;
}
-bool wxNotebook::InsertPage( int position, wxNotebookPage* win, const wxString& text,
- bool select, int imageId )
+bool wxNotebook::InsertPage( int position,
+ wxNotebookPage* win,
+ const wxString& text,
+ bool select,
+ int imageId )
{
wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid notebook") );
wxCHECK_MSG( win->GetParent() == this, FALSE,
wxT("Can't add a page whose parent is not the notebook!") );
+ wxCHECK_MSG( position >= 0 && position <= GetPageCount(), FALSE,
+ _T("invalid page index in wxNotebookPage::InsertPage()") );
+
/* don't receive switch page during addition */
gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget),
GTK_SIGNAL_FUNC(gtk_notebook_page_change_callback), (gpointer) this );
wxGtkNotebookPage *page = new wxGtkNotebookPage();
- if (position < 0)
- m_pages.Append( page );
+ if ( position == GetPageCount() )
+ m_pagesData.Append( page );
else
- m_pages.Insert( m_pages.Nth( position ), page );
+ m_pagesData.Insert( m_pagesData.Item( position ), page );
- page->m_client = win;
+ m_pages.Insert(win, position);
page->m_box = gtk_hbox_new( FALSE, 0 );
gtk_container_border_width( GTK_CONTAINER(page->m_box), 2 );
/* show the label */
gtk_widget_show( GTK_WIDGET(page->m_label) );
- if (select && (m_pages.GetCount() > 1))
+ if (select && (m_pagesData.GetCount() > 1))
{
if (position < 0)
SetSelection( GetPageCount()-1 );
return TRUE;
}
-bool wxNotebook::AddPage(wxNotebookPage* win, const wxString& text,
- bool select, int imageId)
-{
- return InsertPage( -1, win, text, select, imageId );
-}
-
void wxNotebook::OnNavigationKey(wxNavigationKeyEvent& event)
{
if (event.IsWindowChange())
#pragma hdrstop
#endif
-#include "wx/defs.h"
-
#if wxUSE_HTML && wxUSE_STREAMS
+#ifndef WX_PRECOMP
+ #include "wx/app.h"
+ #include "wx/intl.h"
+#endif // WX_PRECOMP
+
#include "wx/html/helpctrl.h"
-#include "wx/wx.h"
#include "wx/busyinfo.h"
#if wxUSE_HELP
#pragma hdrstop
#endif
-#include "wx/defs.h"
-
#if wxUSE_HTML && wxUSE_STREAMS
+
#ifndef WXPRECOMP
-#include "wx/wx.h"
-#endif
+ #include "wx/intl.h"
+ #include "wx/log.h"
+
+ #include "wx/object.h"
+ #include "wx/layout.h"
+ #include "wx/sizer.h"
+
+ #include "wx/bmpbuttn.h"
+ #include "wx/statbox.h"
+ #include "wx/radiobox.h"
+#endif // WXPRECOMP
#include "wx/html/helpfrm.h"
#include "wx/html/helpctrl.h"
-# This file was automatically generated by tmake at 14:52, 2001/07/02
+# This file was automatically generated by tmake at 20:23, 2001/07/02
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE MOTIF.T!
ALL_SOURCES = \
generic/busyinfo.cpp \
common/mimecmn.cpp \
common/module.cpp \
common/mstream.cpp \
+ common/nbkbase.cpp \
common/object.cpp \
common/objstrm.cpp \
common/paper.cpp \
mimecmn.o \
module.o \
mstream.o \
+ nbkbase.o \
object.o \
objstrm.o \
paper.o \
mimecmn.d \
module.d \
mstream.d \
+ nbkbase.d \
object.d \
objstrm.d \
paper.d \
-# This file was automatically generated by tmake at 14:52, 2001/07/02
+# This file was automatically generated by tmake at 20:23, 2001/07/02
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE MSW.T!
ALL_SOURCES = \
generic/busyinfo.cpp \
common/mimecmn.cpp \
common/module.cpp \
common/mstream.cpp \
+ common/nbkbase.cpp \
common/object.cpp \
common/objstrm.cpp \
common/paper.cpp \
mimecmn.o \
module.o \
mstream.o \
+ nbkbase.o \
object.o \
objstrm.o \
paper.o \
mimecmn.d \
module.d \
mstream.d \
+ nbkbase.d \
object.d \
objstrm.d \
paper.d \
-# This file was automatically generated by tmake at 14:52, 2001/07/02
+# This file was automatically generated by tmake at 20:23, 2001/07/02
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE B32.T!
#
$(MSWDIR)\mimecmn.obj \
$(MSWDIR)\module.obj \
$(MSWDIR)\mstream.obj \
+ $(MSWDIR)\nbkbase.obj \
$(MSWDIR)\object.obj \
$(MSWDIR)\objstrm.obj \
$(MSWDIR)\odbc.obj \
$(MSWDIR)\mstream.obj: $(COMMDIR)\mstream.$(SRCSUFF)
+$(MSWDIR)\nbkbase.obj: $(COMMDIR)\nbkbase.$(SRCSUFF)
+
$(MSWDIR)\object.obj: $(COMMDIR)\object.$(SRCSUFF)
$(MSWDIR)\objstrm.obj: $(COMMDIR)\objstrm.$(SRCSUFF)
-# This file was automatically generated by tmake at 14:52, 2001/07/02
+# This file was automatically generated by tmake at 20:23, 2001/07/02
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE BCC.T!
#
$(MSWDIR)\menucmn.obj \
$(MSWDIR)\module.obj \
$(MSWDIR)\mstream.obj \
+ $(MSWDIR)\nbkbase.obj \
$(MSWDIR)\object.obj \
$(MSWDIR)\objstrm.obj \
$(MSWDIR)\paper.obj \
$(MSWDIR)\mstream.obj: $(COMMDIR)\mstream.$(SRCSUFF)
+$(MSWDIR)\nbkbase.obj: $(COMMDIR)\nbkbase.$(SRCSUFF)
+
$(MSWDIR)\object.obj: $(COMMDIR)\object.$(SRCSUFF)
$(MSWDIR)\objstrm.obj: $(COMMDIR)\objstrm.$(SRCSUFF)
-# This file was automatically generated by tmake at 14:52, 2001/07/02
+# This file was automatically generated by tmake at 20:23, 2001/07/02
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE DOS.T!
#
$(COMMDIR)\menucmn.obj \
$(COMMDIR)\module.obj \
$(COMMDIR)\mstream.obj \
+ $(COMMDIR)\nbkbase.obj \
$(COMMDIR)\object.obj \
$(COMMDIR)\objstrm.obj \
$(COMMDIR)\odbc.obj
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
<<
+$(COMMDIR)/nbkbase.obj: $*.$(SRCSUFF)
+ cl @<<
+$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
+<<
+
$(COMMDIR)/object.obj: $*.$(SRCSUFF)
cl @<<
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
-# This file was automatically generated by tmake at 14:52, 2001/07/02
+# This file was automatically generated by tmake at 20:23, 2001/07/02
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE G95.T!
#
$(COMMDIR)/mimecmn.$(OBJSUFF) \
$(COMMDIR)/module.$(OBJSUFF) \
$(COMMDIR)/mstream.$(OBJSUFF) \
+ $(COMMDIR)/nbkbase.$(OBJSUFF) \
$(COMMDIR)/object.$(OBJSUFF) \
$(COMMDIR)/objstrm.$(OBJSUFF) \
$(COMMDIR)/paper.$(OBJSUFF) \
-# This file was automatically generated by tmake at 14:52, 2001/07/02
+# This file was automatically generated by tmake at 20:23, 2001/07/02
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE SC.T!
# Symantec C++ makefile for the msw objects
$(COMMDIR)\mimecmn.obj \
$(COMMDIR)\module.obj \
$(COMMDIR)\mstream.obj \
+ $(COMMDIR)\nbkbase.obj \
$(COMMDIR)\object.obj \
$(COMMDIR)\objstrm.obj \
$(COMMDIR)\odbc.obj \
-# This file was automatically generated by tmake at 14:52, 2001/07/02
+# This file was automatically generated by tmake at 20:23, 2001/07/02
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE VC.T!
# File: makefile.vc
..\common\$D\mimecmn.obj \
..\common\$D\module.obj \
..\common\$D\mstream.obj \
+ ..\common\$D\nbkbase.obj \
..\common\$D\object.obj \
..\common\$D\objstrm.obj \
..\common\$D\odbc.obj \
#!/binb/wmake.exe
-# This file was automatically generated by tmake at 14:52, 2001/07/02
+# This file was automatically generated by tmake at 20:23, 2001/07/02
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE WAT.T!
#
mimecmn.obj &
module.obj &
mstream.obj &
+ nbkbase.obj &
object.obj &
objstrm.obj &
odbc.obj &
mstream.obj: $(COMMDIR)\mstream.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
+nbkbase.obj: $(COMMDIR)\nbkbase.cpp
+ *$(CCC) $(CPPFLAGS) $(IFLAGS) $<
+
object.obj: $(COMMDIR)\object.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
// common part of all ctors
void wxNotebook::Init()
{
- m_bOwnsImageList = FALSE;
m_imageList = NULL;
m_nSelection = -1;
}
return TRUE;
}
-// dtor
-wxNotebook::~wxNotebook()
-{
- if (m_bOwnsImageList)
- delete m_imageList;
-}
-
// ----------------------------------------------------------------------------
// wxNotebook accessors
// ----------------------------------------------------------------------------
+
int wxNotebook::GetPageCount() const
{
// consistency check
void wxNotebook::SetImageList(wxImageList* imageList)
{
- if ( m_bOwnsImageList )
+ wxNotebookBase::SetImageList(imageList);
+
+ if ( imageList )
{
- delete m_imageList;
+ TabCtrl_SetImageList(m_hwnd, (HIMAGELIST)imageList->GetHIMAGELIST());
}
-
- m_bOwnsImageList = FALSE;
- m_imageList = imageList;
-
- TabCtrl_SetImageList(m_hwnd, (HIMAGELIST)imageList->GetHIMAGELIST());
-}
-
-void wxNotebook::AssignImageList(wxImageList* imageList)
-{
- SetImageList(imageList);
- m_bOwnsImageList = TRUE;
}
// ----------------------------------------------------------------------------
-# This file was automatically generated by tmake at 14:52, 2001/07/02
+# This file was automatically generated by tmake at 20:23, 2001/07/02
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE GTK.T!
UNIVOBJS = \
bmpbuttn.o \