1. fixed wxGTK notebook which was completely broken by the merge

2. added a new file for commno notebook code (nbkbase.cpp)
3. removed 'include "wx/wx.h"' from html files as I got tired of
   recompiling them


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10793 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2001-07-02 18:34:13 +00:00
parent d1a8d972ea
commit 07b8d7ecc3
24 changed files with 352 additions and 257 deletions

View File

@ -184,6 +184,7 @@ menucmn.cpp C
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

View File

@ -21,6 +21,9 @@
class wxGtkNotebookPage;
#include "wx/list.h"
WX_DECLARE_LIST(wxGtkNotebookPage, wxGtkNotebookPagesList);
//-----------------------------------------------------------------------------
// wxNotebook
//-----------------------------------------------------------------------------
@ -45,7 +48,7 @@ public:
long style = 0,
const wxString& name = "notebook");
// dtor
~wxNotebook();
virtual ~wxNotebook();
// accessors
// ---------
@ -61,15 +64,6 @@ public:
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);
@ -91,10 +85,6 @@ public:
// 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,
@ -125,12 +115,12 @@ public:
// 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

View File

@ -21,6 +21,9 @@
class wxGtkNotebookPage;
#include "wx/list.h"
WX_DECLARE_LIST(wxGtkNotebookPage, wxGtkNotebookPagesList);
//-----------------------------------------------------------------------------
// wxNotebook
//-----------------------------------------------------------------------------
@ -45,7 +48,7 @@ public:
long style = 0,
const wxString& name = "notebook");
// dtor
~wxNotebook();
virtual ~wxNotebook();
// accessors
// ---------
@ -61,15 +64,6 @@ public:
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);
@ -91,10 +85,6 @@ public:
// 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,
@ -125,12 +115,12 @@ public:
// 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

View File

@ -48,8 +48,6 @@ public:
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = "notebook");
// dtor
~wxNotebook();
// accessors
// ---------
@ -74,7 +72,6 @@ public:
// 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;
@ -136,8 +133,6 @@ protected:
// 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)

View File

@ -12,6 +12,10 @@
#ifndef _WX_NOTEBOOK_H_BASE_
#define _WX_NOTEBOOK_H_BASE_
#ifdef __GNUG__
#pragma interface "notebookbase.h"
#endif
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
@ -46,7 +50,7 @@ public:
// ctor
wxNotebookBase()
{
m_imageList = NULL;
Init();
}
// quasi ctor
@ -57,6 +61,9 @@ public:
long style = 0,
const wxString& name = wxNOTEBOOK_NAME);
// dtor
virtual ~wxNotebookBase();
// accessors
// ---------
@ -75,10 +82,10 @@ public:
// 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; }
@ -101,33 +108,13 @@ public:
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; }
@ -170,32 +157,15 @@ protected:
// remove the page and return a pointer to it
virtual wxNotebookPage *DoRemovePage(int page) = 0;
// common part of all ctors
void Init();
// get the next page wrapping if we reached the end
int GetNextPage(bool forward) const
{
int nPage;
int GetNextPage(bool forward) const;
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;
}
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
};
// ----------------------------------------------------------------------------

140
src/common/nbkbase.cpp Normal file
View File

@ -0,0 +1,140 @@
///////////////////////////////////////////////////////////////////////////////
// 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

View File

@ -1,4 +1,4 @@
# 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 \

View File

@ -1,4 +1,4 @@
# 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 \
@ -114,6 +114,7 @@ ALL_SOURCES = \
common/mimecmn.cpp \
common/module.cpp \
common/mstream.cpp \
common/nbkbase.cpp \
common/object.cpp \
common/objstrm.cpp \
common/paper.cpp \
@ -656,6 +657,7 @@ COMMONOBJS = \
mimecmn.o \
module.o \
mstream.o \
nbkbase.o \
object.o \
objstrm.o \
paper.o \
@ -770,6 +772,7 @@ COMMONDEPS = \
mimecmn.d \
module.d \
mstream.d \
nbkbase.d \
object.d \
objstrm.d \
paper.d \

View File

@ -44,7 +44,7 @@ extern bool g_isIdle;
// data
//-----------------------------------------------------------------------------
extern bool g_blockEventsOnDrag;
extern bool g_blockEventsOnDrag;
//-----------------------------------------------------------------------------
// debug
@ -60,15 +60,20 @@ extern void debug_focus_in( GtkWidget* widget, const wxChar* name, const wxChar
// 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;
}
@ -76,10 +81,12 @@ public:
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"
//-----------------------------------------------------------------------------
@ -192,10 +199,9 @@ static gint gtk_notebook_key_press_callback( GtkWidget *widget, GdkEventKey *gdk
/* 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 );
@ -204,9 +210,11 @@ static gint gtk_notebook_key_press_callback( GtkWidget *widget, GdkEventKey *gdk
/* 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" );
@ -238,8 +246,7 @@ END_EVENT_TABLE()
void wxNotebook::Init()
{
m_imageList = (wxImageList *) NULL;
m_ownsImageList = FALSE;
m_pages.DeleteContents( TRUE );
m_pagesData.DeleteContents( TRUE );
m_selection = -1;
m_themeEnabled = TRUE;
}
@ -264,12 +271,11 @@ wxNotebook::~wxNotebook()
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;
@ -368,45 +374,30 @@ wxGtkNotebookPage* wxNotebook::GetNotebookPage( int page ) const
{
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();
wxNotebookPage *client = GetPage(page);
if ( client )
client->SetFocus();
return selOld;
}
void wxNotebook::SetImageList( wxImageList* imageList )
{
if (m_ownsImageList) delete m_imageList;
m_imageList = imageList;
m_ownsImageList = FALSE;
}
void wxNotebook::AssignImageList( wxImageList* imageList )
{
SetImageList(imageList);
m_ownsImageList = TRUE;
}
bool wxNotebook::SetPageText( int page, const wxString &text )
{
wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid notebook") );
@ -526,8 +517,10 @@ bool wxNotebook::DeleteAllPages()
{
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;
}
@ -542,17 +535,16 @@ bool wxNotebook::DeletePage( int page )
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 )
@ -561,26 +553,32 @@ 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 );
@ -592,12 +590,12 @@ bool wxNotebook::InsertPage( int position, wxNotebookPage* win, const wxString&
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 );
@ -644,7 +642,7 @@ bool wxNotebook::InsertPage( int position, wxNotebookPage* win, const wxString&
/* 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 );
@ -658,12 +656,6 @@ bool wxNotebook::InsertPage( int position, wxNotebookPage* win, const wxString&
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())

View File

@ -1,4 +1,4 @@
# 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 \
@ -114,6 +114,7 @@ ALL_SOURCES = \
common/mimecmn.cpp \
common/module.cpp \
common/mstream.cpp \
common/nbkbase.cpp \
common/object.cpp \
common/objstrm.cpp \
common/paper.cpp \
@ -656,6 +657,7 @@ COMMONOBJS = \
mimecmn.o \
module.o \
mstream.o \
nbkbase.o \
object.o \
objstrm.o \
paper.o \
@ -770,6 +772,7 @@ COMMONDEPS = \
mimecmn.d \
module.d \
mstream.d \
nbkbase.d \
object.d \
objstrm.d \
paper.d \

View File

@ -44,7 +44,7 @@ extern bool g_isIdle;
// data
//-----------------------------------------------------------------------------
extern bool g_blockEventsOnDrag;
extern bool g_blockEventsOnDrag;
//-----------------------------------------------------------------------------
// debug
@ -60,15 +60,20 @@ extern void debug_focus_in( GtkWidget* widget, const wxChar* name, const wxChar
// 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;
}
@ -76,10 +81,12 @@ public:
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"
//-----------------------------------------------------------------------------
@ -192,10 +199,9 @@ static gint gtk_notebook_key_press_callback( GtkWidget *widget, GdkEventKey *gdk
/* 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 );
@ -204,9 +210,11 @@ static gint gtk_notebook_key_press_callback( GtkWidget *widget, GdkEventKey *gdk
/* 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" );
@ -238,8 +246,7 @@ END_EVENT_TABLE()
void wxNotebook::Init()
{
m_imageList = (wxImageList *) NULL;
m_ownsImageList = FALSE;
m_pages.DeleteContents( TRUE );
m_pagesData.DeleteContents( TRUE );
m_selection = -1;
m_themeEnabled = TRUE;
}
@ -264,12 +271,11 @@ wxNotebook::~wxNotebook()
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;
@ -368,45 +374,30 @@ wxGtkNotebookPage* wxNotebook::GetNotebookPage( int page ) const
{
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();
wxNotebookPage *client = GetPage(page);
if ( client )
client->SetFocus();
return selOld;
}
void wxNotebook::SetImageList( wxImageList* imageList )
{
if (m_ownsImageList) delete m_imageList;
m_imageList = imageList;
m_ownsImageList = FALSE;
}
void wxNotebook::AssignImageList( wxImageList* imageList )
{
SetImageList(imageList);
m_ownsImageList = TRUE;
}
bool wxNotebook::SetPageText( int page, const wxString &text )
{
wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid notebook") );
@ -526,8 +517,10 @@ bool wxNotebook::DeleteAllPages()
{
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;
}
@ -542,17 +535,16 @@ bool wxNotebook::DeletePage( int page )
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 )
@ -561,26 +553,32 @@ 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 );
@ -592,12 +590,12 @@ bool wxNotebook::InsertPage( int position, wxNotebookPage* win, const wxString&
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 );
@ -644,7 +642,7 @@ bool wxNotebook::InsertPage( int position, wxNotebookPage* win, const wxString&
/* 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 );
@ -658,12 +656,6 @@ bool wxNotebook::InsertPage( int position, wxNotebookPage* win, const wxString&
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())

View File

@ -20,12 +20,14 @@
#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

View File

@ -21,12 +21,20 @@
#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"

View File

@ -1,4 +1,4 @@
# 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 \
@ -116,6 +116,7 @@ ALL_SOURCES = \
common/mimecmn.cpp \
common/module.cpp \
common/mstream.cpp \
common/nbkbase.cpp \
common/object.cpp \
common/objstrm.cpp \
common/paper.cpp \
@ -651,6 +652,7 @@ COMMONOBJS = \
mimecmn.o \
module.o \
mstream.o \
nbkbase.o \
object.o \
objstrm.o \
paper.o \
@ -765,6 +767,7 @@ COMMONDEPS = \
mimecmn.d \
module.d \
mstream.d \
nbkbase.d \
object.d \
objstrm.d \
paper.d \

View File

@ -1,4 +1,4 @@
# 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 \
@ -99,6 +99,7 @@ ALL_SOURCES = \
common/mimecmn.cpp \
common/module.cpp \
common/mstream.cpp \
common/nbkbase.cpp \
common/object.cpp \
common/objstrm.cpp \
common/paper.cpp \
@ -705,6 +706,7 @@ COMMONOBJS = \
mimecmn.o \
module.o \
mstream.o \
nbkbase.o \
object.o \
objstrm.o \
paper.o \
@ -819,6 +821,7 @@ COMMONDEPS = \
mimecmn.d \
module.d \
mstream.d \
nbkbase.d \
object.d \
objstrm.d \
paper.d \

View File

@ -1,6 +1,6 @@
# 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!
#
@ -183,6 +183,7 @@ COMMONOBJS = \
$(MSWDIR)\mimecmn.obj \
$(MSWDIR)\module.obj \
$(MSWDIR)\mstream.obj \
$(MSWDIR)\nbkbase.obj \
$(MSWDIR)\object.obj \
$(MSWDIR)\objstrm.obj \
$(MSWDIR)\odbc.obj \
@ -750,6 +751,8 @@ $(MSWDIR)\module.obj: $(COMMDIR)\module.$(SRCSUFF)
$(MSWDIR)\mstream.obj: $(COMMDIR)\mstream.$(SRCSUFF)
$(MSWDIR)\nbkbase.obj: $(COMMDIR)\nbkbase.$(SRCSUFF)
$(MSWDIR)\object.obj: $(COMMDIR)\object.$(SRCSUFF)
$(MSWDIR)\objstrm.obj: $(COMMDIR)\objstrm.$(SRCSUFF)

View File

@ -1,6 +1,6 @@
# 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!
#
@ -162,6 +162,7 @@ COMMONOBJS = \
$(MSWDIR)\menucmn.obj \
$(MSWDIR)\module.obj \
$(MSWDIR)\mstream.obj \
$(MSWDIR)\nbkbase.obj \
$(MSWDIR)\object.obj \
$(MSWDIR)\objstrm.obj \
$(MSWDIR)\paper.obj \
@ -602,6 +603,8 @@ $(MSWDIR)\module.obj: $(COMMDIR)\module.$(SRCSUFF)
$(MSWDIR)\mstream.obj: $(COMMDIR)\mstream.$(SRCSUFF)
$(MSWDIR)\nbkbase.obj: $(COMMDIR)\nbkbase.$(SRCSUFF)
$(MSWDIR)\object.obj: $(COMMDIR)\object.$(SRCSUFF)
$(MSWDIR)\objstrm.obj: $(COMMDIR)\objstrm.$(SRCSUFF)

View File

@ -1,4 +1,4 @@
# 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!
#
@ -146,6 +146,7 @@ COMMONOBJS1 = \
$(COMMDIR)\menucmn.obj \
$(COMMDIR)\module.obj \
$(COMMDIR)\mstream.obj \
$(COMMDIR)\nbkbase.obj \
$(COMMDIR)\object.obj \
$(COMMDIR)\objstrm.obj \
$(COMMDIR)\odbc.obj
@ -1050,6 +1051,11 @@ $(COMMDIR)/mstream.obj: $*.$(SRCSUFF)
$(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)

View File

@ -1,4 +1,4 @@
# 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!
#
@ -168,6 +168,7 @@ COMMONOBJS = \
$(COMMDIR)/mimecmn.$(OBJSUFF) \
$(COMMDIR)/module.$(OBJSUFF) \
$(COMMDIR)/mstream.$(OBJSUFF) \
$(COMMDIR)/nbkbase.$(OBJSUFF) \
$(COMMDIR)/object.$(OBJSUFF) \
$(COMMDIR)/objstrm.$(OBJSUFF) \
$(COMMDIR)/paper.$(OBJSUFF) \

View File

@ -1,6 +1,6 @@
# 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
@ -126,6 +126,7 @@ COMMONOBJS = \
$(COMMDIR)\mimecmn.obj \
$(COMMDIR)\module.obj \
$(COMMDIR)\mstream.obj \
$(COMMDIR)\nbkbase.obj \
$(COMMDIR)\object.obj \
$(COMMDIR)\objstrm.obj \
$(COMMDIR)\odbc.obj \

View File

@ -1,4 +1,4 @@
# 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
@ -209,6 +209,7 @@ COMMONOBJS = \
..\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 \

View File

@ -1,6 +1,6 @@
#!/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!
#
@ -165,6 +165,7 @@ COMMONOBJS = &
mimecmn.obj &
module.obj &
mstream.obj &
nbkbase.obj &
object.obj &
objstrm.obj &
odbc.obj &
@ -894,6 +895,9 @@ module.obj: $(COMMDIR)\module.cpp
mstream.obj: $(COMMDIR)\mstream.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
nbkbase.obj: $(COMMDIR)\nbkbase.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
object.obj: $(COMMDIR)\object.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<

View File

@ -110,7 +110,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent)
// common part of all ctors
void wxNotebook::Init()
{
m_bOwnsImageList = FALSE;
m_imageList = NULL;
m_nSelection = -1;
}
@ -193,16 +192,10 @@ bool wxNotebook::Create(wxWindow *parent,
return TRUE;
}
// dtor
wxNotebook::~wxNotebook()
{
if (m_bOwnsImageList)
delete m_imageList;
}
// ----------------------------------------------------------------------------
// wxNotebook accessors
// ----------------------------------------------------------------------------
int wxNotebook::GetPageCount() const
{
// consistency check
@ -276,21 +269,12 @@ bool wxNotebook::SetPageImage(int nPage, int nImage)
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;
}
// ----------------------------------------------------------------------------

View File

@ -1,4 +1,4 @@
# 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 \