wxTopLevelWindows is now a wxWindowList, better compatibility with the old

wxList in list.h


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2005 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1999-03-30 09:43:29 +00:00
parent 8ffd43c56b
commit e146b8c8bf
22 changed files with 206 additions and 185 deletions

View File

@@ -30,7 +30,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
extern const char *wxFrameNameStr; extern const char *wxFrameNameStr;
extern wxList wxTopLevelWindows; extern wxWindowList wxTopLevelWindows;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// global function // global function

View File

@@ -30,7 +30,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
extern const char *wxFrameNameStr; extern const char *wxFrameNameStr;
extern wxList wxTopLevelWindows; extern wxWindowList wxTopLevelWindows;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// global function // global function

View File

@@ -6,7 +6,7 @@
// Created: 29/01/98 // Created: 29/01/98
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) 1998 Julian Smart // Copyright: (c) 1998 Julian Smart
// Licence: wxWindows license // Licence: wxWindows license
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
/* /*
@@ -197,17 +197,17 @@ public:
size_t GetCount() const { return m_count; } size_t GetCount() const { return m_count; }
// operations // operations
// delete all nodes // delete all nodes
void Clear(); void Clear();
// instruct it to destroy user data when deleting nodes // instruct it to destroy user data when deleting nodes
void DeleteContents(bool destroy) { m_destroy = destroy; } void DeleteContents(bool destroy) { m_destroy = destroy; }
// query if to delete // query if to delete
bool GetDeleteContents() const bool GetDeleteContents() const
{ return m_destroy; } { return m_destroy; }
// get the keytype // get the keytype
wxKeyType GetKeyType() const wxKeyType GetKeyType() const
{ return m_keyType; } { return m_keyType; }
@@ -216,6 +216,13 @@ public:
void SetKeyType(wxKeyType keyType) void SetKeyType(wxKeyType keyType)
{ wxASSERT( m_count==0 ); m_keyType = keyType; } { wxASSERT( m_count==0 ); m_keyType = keyType; }
#ifdef wxLIST_COMPATIBILITY
int Number() const { return GetCount(); }
wxNode *First() const { return (wxNode *)GetFirst(); }
wxNode *Last() const { return (wxNode *)GetLast(); }
wxNode *Nth(size_t index) const { return (wxNode *)Item(index); }
#endif // wxLIST_COMPATIBILITY
protected: protected:
// all methods here are "overloaded" in derived classes to provide compile // all methods here are "overloaded" in derived classes to provide compile
@@ -294,7 +301,7 @@ protected:
void *FirstThat(wxListIterateFunction func); void *FirstThat(wxListIterateFunction func);
void ForEach(wxListIterateFunction func); void ForEach(wxListIterateFunction func);
void *LastThat(wxListIterateFunction func); void *LastThat(wxListIterateFunction func);
private: private:
// helpers // helpers
// common part of all ctors // common part of all ctors
@@ -343,7 +350,7 @@ private:
nodetype *previous = (nodetype *)NULL, \ nodetype *previous = (nodetype *)NULL, \
nodetype *next = (nodetype *)NULL, \ nodetype *next = (nodetype *)NULL, \
T *data = (T *)NULL, \ T *data = (T *)NULL, \
const wxListKey& key = wxDefaultListKey) \ const wxListKey& key = wxDefaultListKey) \
: wxNodeBase(list, previous, next, data, key) { } \ : wxNodeBase(list, previous, next, data, key) { } \
\ \
nodetype *GetNext() const \ nodetype *GetNext() const \
@@ -359,7 +366,7 @@ private:
virtual void DeleteData(); \ virtual void DeleteData(); \
}; \ }; \
\ \
class WXDLLEXPORT name : public wxListBase \ class WXDLLEXPORT name : public wxListBase \
{ \ { \
public: \ public: \
typedef nodetype Node; \ typedef nodetype Node; \
@@ -417,7 +424,7 @@ private:
protected: \ protected: \
wxNodeBase *CreateNode(wxNodeBase *prev, wxNodeBase *next, \ wxNodeBase *CreateNode(wxNodeBase *prev, wxNodeBase *next, \
void *data, \ void *data, \
const wxListKey& key = wxDefaultListKey) \ const wxListKey& key = wxDefaultListKey) \
{ \ { \
return new nodetype(this, \ return new nodetype(this, \
(nodetype *)prev, (nodetype *)next, \ (nodetype *)prev, (nodetype *)next, \
@@ -433,11 +440,17 @@ private:
// #include <wx/listimpl.cpp> // #include <wx/listimpl.cpp>
#define WX_DEFINE_LIST(name) "don't forget to include listimpl.cpp!" #define WX_DEFINE_LIST(name) "don't forget to include listimpl.cpp!"
// ============================================================================= // =============================================================================
// now we can define classes 100% compatible with the old ones // now we can define classes 100% compatible with the old ones
// ============================================================================= // =============================================================================
// ----------------------------------------------------------------------------
// commonly used string classes
// ----------------------------------------------------------------------------
class wxWindow;
WX_DECLARE_LIST(wxWindow, wxWindowList);
#ifdef wxLIST_COMPATIBILITY #ifdef wxLIST_COMPATIBILITY
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@@ -454,10 +467,6 @@ public:
// compatibility methods // compatibility methods
void Sort(wxSortCompareFunction compfunc) { wxListBase::Sort(compfunc); } void Sort(wxSortCompareFunction compfunc) { wxListBase::Sort(compfunc); }
int Number() const { return GetCount(); }
wxNode *First() const { return (wxNode *)GetFirst(); }
wxNode *Last() const { return (wxNode *)GetLast(); }
wxNode *Nth(size_t index) const { return (wxNode *)Item(index); }
wxNode *Member(wxObject *object) const { return (wxNode *)Find(object); } wxNode *Member(wxObject *object) const { return (wxNode *)Find(object); }
}; };
@@ -494,12 +503,6 @@ public:
// alphabetic sort // alphabetic sort
void Sort(); void Sort();
// compatibility methods
int Number() const { return GetCount(); }
wxNode *First() const { return (wxNode *)GetFirst(); }
wxNode *Last() const { return (wxNode *)GetLast(); }
wxNode *Nth(size_t index) const { return (wxNode *)Item(index); }
private: private:
void DoCopy(const wxStringList&); // common part of copy ctor and operator= void DoCopy(const wxStringList&); // common part of copy ctor and operator=
}; };

View File

@@ -757,7 +757,7 @@ inline int wxWindow::GetReturnCode() { return m_returnCode; }
// Get the active window. // Get the active window.
wxWindow* WXDLLEXPORT wxGetActiveWindow(); wxWindow* WXDLLEXPORT wxGetActiveWindow();
WXDLLEXPORT_DATA(extern wxList) wxTopLevelWindows; WXDLLEXPORT_DATA(extern wxWindowList) wxTopLevelWindows;
// A little class to switch off size optimization while an instance of the object // A little class to switch off size optimization while an instance of the object
// exists // exists

View File

@@ -874,7 +874,7 @@ inline bool wxWindow::IsBeingDeleted() { return m_isBeingDeleted; }
// Window specific (so far) // Window specific (so far)
WXDLLEXPORT wxWindow* wxGetActiveWindow(); WXDLLEXPORT wxWindow* wxGetActiveWindow();
WXDLLEXPORT_DATA(extern wxList) wxTopLevelWindows; WXDLLEXPORT_DATA(extern wxWindowList) wxTopLevelWindows;
WXDLLEXPORT int wxCharCodeMSWToWX(int keySym); WXDLLEXPORT int wxCharCodeMSWToWX(int keySym);
WXDLLEXPORT int wxCharCodeWXToMSW(int id, bool *IsVirtual); WXDLLEXPORT int wxCharCodeWXToMSW(int id, bool *IsVirtual);

View File

@@ -37,6 +37,13 @@
#include "wx/utils.h" // for copystring() (beurk...) #include "wx/utils.h" // for copystring() (beurk...)
#endif #endif
// -----------------------------------------------------------------------------
// implementation of standard lists
// -----------------------------------------------------------------------------
#include "wx/listimpl.cpp"
WX_DEFINE_LIST(wxWindowList);
// ============================================================================= // =============================================================================
// implementation // implementation
// ============================================================================= // =============================================================================
@@ -634,4 +641,3 @@ void wxStringList::Sort()
delete [] array; delete [] array;
} }

View File

@@ -73,6 +73,13 @@
extern char *wxBuffer; extern char *wxBuffer;
// ----------------------------------------------------------------------------
// private functions
// ----------------------------------------------------------------------------
static wxWindow *wxFindWindowByLabel1(const wxString& title, wxWindow * parent);
static wxWindow *wxFindWindowByName1 (const wxString& title, wxWindow * parent);
#ifdef __WXMAC__ #ifdef __WXMAC__
int strcasecmp(const char *str_1, const char *str_2) int strcasecmp(const char *str_1, const char *str_2)
{ {
@@ -418,53 +425,54 @@ wxString wxStripMenuCodes(const wxString& str)
* *
*/ */
static wxWindow *wxFindWindowByLabel1 (const wxString& title, wxWindow * parent);
wxWindow * wxWindow *
wxFindWindowByLabel (const wxString& title, wxWindow * parent) wxFindWindowByLabel (const wxString& title, wxWindow * parent)
{ {
if (parent) if (parent)
{ {
return wxFindWindowByLabel1 (title, parent); return wxFindWindowByLabel1(title, parent);
} }
else else
{ {
for (wxNode * node = wxTopLevelWindows.First (); node; node = node->Next ()) for ( wxWindowList::Node * node = wxTopLevelWindows.GetFirst();
node;
node = node->GetNext() )
{ {
wxWindow *win = (wxWindow *) node->Data (); wxWindow *win = node->GetData();
wxWindow *retwin = wxFindWindowByLabel1 (title, win); wxWindow *retwin = wxFindWindowByLabel1 (title, win);
if (retwin) if (retwin)
return retwin; return retwin;
} // for() } // for()
} }
return (wxWindow *) NULL; return (wxWindow *) NULL;
} }
// Recursive // Recursive
static wxWindow * static wxWindow *
wxFindWindowByLabel1 (const wxString& title, wxWindow * parent) wxFindWindowByLabel1 (const wxString& title, wxWindow * parent)
{ {
if (parent) if (parent)
{ {
if (parent->GetLabel() == title) if (parent->GetLabel() == title)
return parent; return parent;
} }
if (parent) if (parent)
{ {
for (wxNode * node = parent->GetChildren().First (); node; node = node->Next ()) for ( wxNode * node = parent->GetChildren().GetFirst();
node;
node = node->GetNext() )
{ {
wxWindow *win = (wxWindow *) node->Data (); wxWindow *win = (wxWindow *)node->GetData();
wxWindow *retwin = wxFindWindowByLabel1 (title, win); wxWindow *retwin = wxFindWindowByLabel1 (title, win);
if (retwin) if (retwin)
return retwin; return retwin;
} // for() }
} }
return (wxWindow *) NULL; // Not found return (wxWindow *) NULL; // Not found
} }
/* /*
@@ -473,28 +481,29 @@ wxFindWindowByLabel1 (const wxString& title, wxWindow * parent)
* *
*/ */
static wxWindow *wxFindWindowByName1 (const wxString& title, wxWindow * parent);
wxWindow * wxWindow *
wxFindWindowByName (const wxString& title, wxWindow * parent) wxFindWindowByName (const wxString& title, wxWindow * parent)
{ {
if (parent) if (parent)
{ {
return wxFindWindowByName1 (title, parent); return wxFindWindowByName1 (title, parent);
} }
else else
{ {
for (wxNode * node = wxTopLevelWindows.First (); node; node = node->Next ()) for ( wxWindowList::Node * node = wxTopLevelWindows.GetFirst();
node;
node = node->GetNext() )
{ {
wxWindow *win = (wxWindow *) node->Data (); wxWindow *win = node->GetData();
wxWindow *retwin = wxFindWindowByName1 (title, win); wxWindow *retwin = wxFindWindowByName1 (title, win);
if (retwin) if (retwin)
return retwin; return retwin;
} // for() }
} }
// Failed? Try by label instead.
return wxFindWindowByLabel(title, parent); // Failed? Try by label instead.
return wxFindWindowByLabel(title, parent);
} }
// Recursive // Recursive
@@ -730,21 +739,23 @@ whereami(name)
// Yield to other apps/messages and disable user input // Yield to other apps/messages and disable user input
bool wxSafeYield(wxWindow *win) bool wxSafeYield(wxWindow *win)
{ {
wxNode *node; wxWindowList::Node *node;
for ( node = wxTopLevelWindows.GetFirst(); for ( node = wxTopLevelWindows.GetFirst(); node; node = node->GetNext() )
node; {
node = node->GetNext() ) node->GetData()->Enable(FALSE);
((wxWindow*)node->GetData())->Enable(FALSE); }
// always enable ourselves
if(win) win->Enable(true);
bool rc = wxYield();
for ( node = wxTopLevelWindows.GetFirst(); // always enable ourselves
node; if ( win )
node = node->GetNext() ) win->Enable(TRUE);
((wxWindow*)node->GetData())->Enable(TRUE); bool rc = wxYield();
return rc;
for ( node = wxTopLevelWindows.GetFirst(); node; node = node->GetNext() )
{
node->GetData()->Enable(TRUE);
}
return rc;
} }
/* /*

View File

@@ -140,11 +140,11 @@ bool wxYield()
// it's necessary to call ProcessIdle() to update the frames sizes which // it's necessary to call ProcessIdle() to update the frames sizes which
// might have been changed (it also will update other things set from // might have been changed (it also will update other things set from
// OnUpdateUI() which is a nice (and desired) side effect) // OnUpdateUI() which is a nice (and desired) side effect)
for ( wxNode *node = wxTopLevelWindows.GetFirst(); for ( wxWindowList::Node *node = wxTopLevelWindows.GetFirst();
node; node;
node = node->GetNext() ) node = node->GetNext() )
{ {
wxWindow *win = ((wxWindow*)node->GetData()); wxWindow *win = node->GetData();
win->OnInternalIdle(); win->OnInternalIdle();
} }
@@ -312,14 +312,15 @@ bool wxApp::SendIdleEvents()
{ {
bool needMore = FALSE; bool needMore = FALSE;
wxNode* node = wxTopLevelWindows.First(); wxWindowList::Node* node = wxTopLevelWindows.GetFirst();
while (node) while (node)
{ {
wxWindow* win = (wxWindow*) node->Data(); wxWindow* win = node->GetData();
if (SendIdleEvents(win)) if (SendIdleEvents(win))
needMore = TRUE; needMore = TRUE;
node = node->Next(); node = node->GetNext();
} }
return needMore; return needMore;
} }
@@ -385,7 +386,7 @@ void wxApp::ProcessPendingEvents()
wxEvtHandler *handler = (wxEvtHandler *)node->Data(); wxEvtHandler *handler = (wxEvtHandler *)node->Data();
handler->ProcessPendingEvents(); handler->ProcessPendingEvents();
delete node; delete node;
node = wxPendingEvents.First(); node = wxPendingEvents.First();
@@ -411,10 +412,12 @@ void wxApp::DeletePendingObjects()
wxWindow *wxApp::GetTopWindow() wxWindow *wxApp::GetTopWindow()
{ {
if (m_topWindow) return m_topWindow; if (m_topWindow)
wxNode *node = wxTopLevelWindows.First(); return m_topWindow;
if (!node) return (wxWindow *) NULL; else if (wxTopLevelWindows.GetCount() > 0)
return (wxWindow*)node->Data(); return wxTopLevelWindows.GetFirst()->GetData();
else
return NULL;
} }
void wxApp::SetTopWindow( wxWindow *win ) void wxApp::SetTopWindow( wxWindow *win )
@@ -565,7 +568,7 @@ int wxEntry( int argc, char *argv[] )
if (!wxTheApp->OnInit()) if (!wxTheApp->OnInit())
return 0; return 0;
wxTheApp->m_initialized = (wxTopLevelWindows.Number() > 0); wxTheApp->m_initialized = wxTopLevelWindows.GetCount() != 0;
int retValue = 0; int retValue = 0;

View File

@@ -33,7 +33,7 @@ XrmDatabase wxResourceDatabase;
char *wxBuffer = (char *) NULL; char *wxBuffer = (char *) NULL;
/* Windows List */ /* Windows List */
wxList wxTopLevelWindows; wxWindowList wxTopLevelWindows;
/* List of windows pending deletion */ /* List of windows pending deletion */
wxList wxPendingDelete; wxList wxPendingDelete;
@@ -75,7 +75,7 @@ wxPenList *wxThePenList = (wxPenList *) NULL;
wxFontList *wxTheFontList = (wxFontList *) NULL; wxFontList *wxTheFontList = (wxFontList *) NULL;
wxColourDatabase *wxTheColourDatabase = (wxColourDatabase *) NULL; wxColourDatabase *wxTheColourDatabase = (wxColourDatabase *) NULL;
wxBitmapList *wxTheBitmapList = (wxBitmapList *) NULL; wxBitmapList *wxTheBitmapList = (wxBitmapList *) NULL;
/* X only font names */ /* X only font names */
/* /*
wxFontNameDirectory *wxTheFontNameDirectory; wxFontNameDirectory *wxTheFontNameDirectory;
@@ -111,7 +111,7 @@ wxBrush *wxLIGHT_GREY_BRUSH;
wxColour *wxBLACK; wxColour *wxBLACK;
wxColour *wxWHITE; wxColour *wxWHITE;
wxColour *wxGREY; wxColour *wxGREY;
wxColour *wxRED; wxColour *wxRED;
wxColour *wxBLUE; wxColour *wxBLUE;
wxColour *wxGREEN; wxColour *wxGREEN;
@@ -125,13 +125,13 @@ wxCursor *wxCROSS_CURSOR = (wxCursor *) NULL;
/* 'Null' objects */ /* 'Null' objects */
wxAcceleratorTable wxNullAcceleratorTable; wxAcceleratorTable wxNullAcceleratorTable;
wxBitmap wxNullBitmap; wxBitmap wxNullBitmap;
wxIcon wxNullIcon; wxIcon wxNullIcon;
wxCursor wxNullCursor; wxCursor wxNullCursor;
wxPen wxNullPen; wxPen wxNullPen;
wxBrush wxNullBrush; wxBrush wxNullBrush;
wxFont wxNullFont; wxFont wxNullFont;
wxColour wxNullColour; wxColour wxNullColour;
wxPalette wxNullPalette; wxPalette wxNullPalette;
/* Default window names */ /* Default window names */
const char *wxButtonNameStr = "button"; const char *wxButtonNameStr = "button";

View File

@@ -142,7 +142,7 @@ bool wxDialog::Create( wxWindow *parent,
if (m_parent) m_parent->AddChild( this ); if (m_parent) m_parent->AddChild( this );
PostCreation(); PostCreation();
gtk_widget_realize( m_widget ); gtk_widget_realize( m_widget );
gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate", gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
@@ -337,7 +337,7 @@ void wxDialog::DoSetSize( int x, int y, int width, int height, int sizeFlags )
if ((m_x != old_x) || (m_y != old_y)) if ((m_x != old_x) || (m_y != old_y))
{ {
/* m_sizeSet = FALSE; */ /* m_sizeSet = FALSE; */
gtk_widget_set_uposition( m_widget, m_x, m_y ); gtk_widget_set_uposition( m_widget, m_x, m_y );
} }
} }
@@ -413,7 +413,7 @@ bool wxDialog::Show( bool show )
} }
wxWindow::Show( show ); wxWindow::Show( show );
if (show) InitDialog(); if (show) InitDialog();
return TRUE; return TRUE;
@@ -442,7 +442,7 @@ int wxDialog::ShowModal()
wxFAIL_MSG( "wxDialog:ShowModal called twice" ); wxFAIL_MSG( "wxDialog:ShowModal called twice" );
return GetReturnCode(); return GetReturnCode();
} }
Show( TRUE ); Show( TRUE );
m_modalShowing = TRUE; m_modalShowing = TRUE;

View File

@@ -36,7 +36,6 @@ const int wxSTATUS_HEIGHT = 25;
// data // data
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
extern wxList wxTopLevelWindows;
extern wxList wxPendingDelete; extern wxList wxPendingDelete;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@@ -171,7 +171,6 @@ void debug_focus_in( GtkWidget* widget, const char* name, const char *window )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
extern wxList wxPendingDelete; extern wxList wxPendingDelete;
extern wxList wxTopLevelWindows;
extern bool g_blockEventsOnDrag; extern bool g_blockEventsOnDrag;
extern bool g_blockEventsOnScroll; extern bool g_blockEventsOnScroll;
static bool g_capturing = FALSE; static bool g_capturing = FALSE;

View File

@@ -140,11 +140,11 @@ bool wxYield()
// it's necessary to call ProcessIdle() to update the frames sizes which // it's necessary to call ProcessIdle() to update the frames sizes which
// might have been changed (it also will update other things set from // might have been changed (it also will update other things set from
// OnUpdateUI() which is a nice (and desired) side effect) // OnUpdateUI() which is a nice (and desired) side effect)
for ( wxNode *node = wxTopLevelWindows.GetFirst(); for ( wxWindowList::Node *node = wxTopLevelWindows.GetFirst();
node; node;
node = node->GetNext() ) node = node->GetNext() )
{ {
wxWindow *win = ((wxWindow*)node->GetData()); wxWindow *win = node->GetData();
win->OnInternalIdle(); win->OnInternalIdle();
} }
@@ -312,14 +312,15 @@ bool wxApp::SendIdleEvents()
{ {
bool needMore = FALSE; bool needMore = FALSE;
wxNode* node = wxTopLevelWindows.First(); wxWindowList::Node* node = wxTopLevelWindows.GetFirst();
while (node) while (node)
{ {
wxWindow* win = (wxWindow*) node->Data(); wxWindow* win = node->GetData();
if (SendIdleEvents(win)) if (SendIdleEvents(win))
needMore = TRUE; needMore = TRUE;
node = node->Next(); node = node->GetNext();
} }
return needMore; return needMore;
} }
@@ -385,7 +386,7 @@ void wxApp::ProcessPendingEvents()
wxEvtHandler *handler = (wxEvtHandler *)node->Data(); wxEvtHandler *handler = (wxEvtHandler *)node->Data();
handler->ProcessPendingEvents(); handler->ProcessPendingEvents();
delete node; delete node;
node = wxPendingEvents.First(); node = wxPendingEvents.First();
@@ -411,10 +412,12 @@ void wxApp::DeletePendingObjects()
wxWindow *wxApp::GetTopWindow() wxWindow *wxApp::GetTopWindow()
{ {
if (m_topWindow) return m_topWindow; if (m_topWindow)
wxNode *node = wxTopLevelWindows.First(); return m_topWindow;
if (!node) return (wxWindow *) NULL; else if (wxTopLevelWindows.GetCount() > 0)
return (wxWindow*)node->Data(); return wxTopLevelWindows.GetFirst()->GetData();
else
return NULL;
} }
void wxApp::SetTopWindow( wxWindow *win ) void wxApp::SetTopWindow( wxWindow *win )
@@ -565,7 +568,7 @@ int wxEntry( int argc, char *argv[] )
if (!wxTheApp->OnInit()) if (!wxTheApp->OnInit())
return 0; return 0;
wxTheApp->m_initialized = (wxTopLevelWindows.Number() > 0); wxTheApp->m_initialized = wxTopLevelWindows.GetCount() != 0;
int retValue = 0; int retValue = 0;

View File

@@ -33,7 +33,7 @@ XrmDatabase wxResourceDatabase;
char *wxBuffer = (char *) NULL; char *wxBuffer = (char *) NULL;
/* Windows List */ /* Windows List */
wxList wxTopLevelWindows; wxWindowList wxTopLevelWindows;
/* List of windows pending deletion */ /* List of windows pending deletion */
wxList wxPendingDelete; wxList wxPendingDelete;
@@ -75,7 +75,7 @@ wxPenList *wxThePenList = (wxPenList *) NULL;
wxFontList *wxTheFontList = (wxFontList *) NULL; wxFontList *wxTheFontList = (wxFontList *) NULL;
wxColourDatabase *wxTheColourDatabase = (wxColourDatabase *) NULL; wxColourDatabase *wxTheColourDatabase = (wxColourDatabase *) NULL;
wxBitmapList *wxTheBitmapList = (wxBitmapList *) NULL; wxBitmapList *wxTheBitmapList = (wxBitmapList *) NULL;
/* X only font names */ /* X only font names */
/* /*
wxFontNameDirectory *wxTheFontNameDirectory; wxFontNameDirectory *wxTheFontNameDirectory;
@@ -111,7 +111,7 @@ wxBrush *wxLIGHT_GREY_BRUSH;
wxColour *wxBLACK; wxColour *wxBLACK;
wxColour *wxWHITE; wxColour *wxWHITE;
wxColour *wxGREY; wxColour *wxGREY;
wxColour *wxRED; wxColour *wxRED;
wxColour *wxBLUE; wxColour *wxBLUE;
wxColour *wxGREEN; wxColour *wxGREEN;
@@ -125,13 +125,13 @@ wxCursor *wxCROSS_CURSOR = (wxCursor *) NULL;
/* 'Null' objects */ /* 'Null' objects */
wxAcceleratorTable wxNullAcceleratorTable; wxAcceleratorTable wxNullAcceleratorTable;
wxBitmap wxNullBitmap; wxBitmap wxNullBitmap;
wxIcon wxNullIcon; wxIcon wxNullIcon;
wxCursor wxNullCursor; wxCursor wxNullCursor;
wxPen wxNullPen; wxPen wxNullPen;
wxBrush wxNullBrush; wxBrush wxNullBrush;
wxFont wxNullFont; wxFont wxNullFont;
wxColour wxNullColour; wxColour wxNullColour;
wxPalette wxNullPalette; wxPalette wxNullPalette;
/* Default window names */ /* Default window names */
const char *wxButtonNameStr = "button"; const char *wxButtonNameStr = "button";

View File

@@ -142,7 +142,7 @@ bool wxDialog::Create( wxWindow *parent,
if (m_parent) m_parent->AddChild( this ); if (m_parent) m_parent->AddChild( this );
PostCreation(); PostCreation();
gtk_widget_realize( m_widget ); gtk_widget_realize( m_widget );
gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate", gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
@@ -337,7 +337,7 @@ void wxDialog::DoSetSize( int x, int y, int width, int height, int sizeFlags )
if ((m_x != old_x) || (m_y != old_y)) if ((m_x != old_x) || (m_y != old_y))
{ {
/* m_sizeSet = FALSE; */ /* m_sizeSet = FALSE; */
gtk_widget_set_uposition( m_widget, m_x, m_y ); gtk_widget_set_uposition( m_widget, m_x, m_y );
} }
} }
@@ -413,7 +413,7 @@ bool wxDialog::Show( bool show )
} }
wxWindow::Show( show ); wxWindow::Show( show );
if (show) InitDialog(); if (show) InitDialog();
return TRUE; return TRUE;
@@ -442,7 +442,7 @@ int wxDialog::ShowModal()
wxFAIL_MSG( "wxDialog:ShowModal called twice" ); wxFAIL_MSG( "wxDialog:ShowModal called twice" );
return GetReturnCode(); return GetReturnCode();
} }
Show( TRUE ); Show( TRUE );
m_modalShowing = TRUE; m_modalShowing = TRUE;

View File

@@ -36,7 +36,6 @@ const int wxSTATUS_HEIGHT = 25;
// data // data
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
extern wxList wxTopLevelWindows;
extern wxList wxPendingDelete; extern wxList wxPendingDelete;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@@ -171,7 +171,6 @@ void debug_focus_in( GtkWidget* widget, const char* name, const char *window )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
extern wxList wxPendingDelete; extern wxList wxPendingDelete;
extern wxList wxTopLevelWindows;
extern bool g_blockEventsOnDrag; extern bool g_blockEventsOnDrag;
extern bool g_blockEventsOnScroll; extern bool g_blockEventsOnScroll;
static bool g_capturing = FALSE; static bool g_capturing = FALSE;

View File

@@ -211,9 +211,8 @@ int wxEntry( int argc, char *argv[] )
// GUI-specific initialization, such as creating an app context. // GUI-specific initialization, such as creating an app context.
wxTheApp->OnInitGui(); wxTheApp->OnInitGui();
// Here frames insert themselves automatically // Here frames insert themselves automatically into wxTopLevelWindows by
// into wxTopLevelWindows by getting created // getting created in OnInit().
// in OnInit().
int retValue = 0; int retValue = 0;
if (wxTheApp->OnInit()) if (wxTheApp->OnInit())
@@ -438,15 +437,16 @@ void wxApp::OnIdle(wxIdleEvent& event)
bool wxApp::SendIdleEvents() bool wxApp::SendIdleEvents()
{ {
bool needMore = FALSE; bool needMore = FALSE;
wxNode* node = wxTopLevelWindows.First();
wxWindowList::Node* node = wxTopLevelWindows.GetFirst();
while (node) while (node)
{ {
wxWindow* win = (wxWindow*) node->Data(); wxWindow* win = node->GetData();
if (SendIdleEvents(win)) if (SendIdleEvents(win))
needMore = TRUE; needMore = TRUE;
node = node->GetNext();
node = node->Next();
} }
return needMore; return needMore;
} }
@@ -519,8 +519,8 @@ wxWindow* wxApp::GetTopWindow() const
{ {
if (m_topWindow) if (m_topWindow)
return m_topWindow; return m_topWindow;
else if (wxTopLevelWindows.Number() > 0) else if (wxTopLevelWindows.GetCount() > 0)
return (wxWindow*) wxTopLevelWindows.First()->Data(); return wxTopLevelWindows.GetFirst()->GetData();
else else
return NULL; return NULL;
} }

View File

@@ -6,7 +6,7 @@
// Created: 17/09/98 // Created: 17/09/98
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) Julian Smart // Copyright: (c) Julian Smart
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__
@@ -22,7 +22,7 @@
char *wxBuffer = NULL; char *wxBuffer = NULL;
// Windows List // Windows List
wxList wxTopLevelWindows; wxWindowList wxTopLevelWindows;
// List of windows pending deletion // List of windows pending deletion
wxList wxPendingDelete; wxList wxPendingDelete;

View File

@@ -22,6 +22,7 @@
#include "wx/app.h" #include "wx/app.h"
#include "wx/msgdlg.h" #include "wx/msgdlg.h"
#include "wx/cursor.h" #include "wx/cursor.h"
#include "wx/window.h" // for wxTopLevelWindows
#include <ctype.h> #include <ctype.h>
#include <stdarg.h> #include <stdarg.h>
@@ -60,8 +61,6 @@
static char *GetIniFile (char *dest, const char *filename); static char *GetIniFile (char *dest, const char *filename);
extern wxList wxTopLevelWindows;
// ============================================================================ // ============================================================================
// implementation // implementation
// ============================================================================ // ============================================================================

View File

@@ -1016,14 +1016,14 @@ void wxApp::OnIdle(wxIdleEvent& event)
bool wxApp::SendIdleEvents() bool wxApp::SendIdleEvents()
{ {
bool needMore = FALSE; bool needMore = FALSE;
wxNode* node = wxTopLevelWindows.First();
wxWindowList::Node* node = wxTopLevelWindows.First();
while (node) while (node)
{ {
wxWindow* win = (wxWindow*) node->Data(); wxWindow* win = node->GetData();
if (SendIdleEvents(win)) if (SendIdleEvents(win))
needMore = TRUE; needMore = TRUE;
node = node->GetNext();
node = node->Next();
} }
return needMore; return needMore;
@@ -1097,8 +1097,8 @@ wxWindow* wxApp::GetTopWindow() const
{ {
if (m_topWindow) if (m_topWindow)
return m_topWindow; return m_topWindow;
else if (wxTopLevelWindows.Number() > 0) else if (wxTopLevelWindows.GetCount() > 0)
return (wxWindow*) wxTopLevelWindows.First()->Data(); return wxTopLevelWindows.GetFirst()->GetData();
else else
return NULL; return NULL;
} }

View File

@@ -6,7 +6,7 @@
// Created: 01/02/97 // Created: 01/02/97
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) Julian Smart and Markus Holzem // Copyright: (c) Julian Smart and Markus Holzem
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__
@@ -32,7 +32,7 @@
char *wxBuffer = NULL; char *wxBuffer = NULL;
// Windows List // Windows List
wxList wxTopLevelWindows; wxWindowList wxTopLevelWindows;
// List of windows pending deletion // List of windows pending deletion
wxList WXDLLEXPORT wxPendingDelete; wxList WXDLLEXPORT wxPendingDelete;
@@ -469,7 +469,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxTCPConnection, wxConnectionBase)
IMPLEMENT_DYNAMIC_CLASS(wxStatusBar, wxWindow) IMPLEMENT_DYNAMIC_CLASS(wxStatusBar, wxWindow)
BEGIN_EVENT_TABLE(wxStatusBar, wxWindow) BEGIN_EVENT_TABLE(wxStatusBar, wxWindow)
EVT_PAINT(wxStatusBar::OnPaint) EVT_PAINT(wxStatusBar::OnPaint)
EVT_SYS_COLOUR_CHANGED(wxStatusBar::OnSysColourChanged) EVT_SYS_COLOUR_CHANGED(wxStatusBar::OnSysColourChanged)
END_EVENT_TABLE() END_EVENT_TABLE()
@@ -625,14 +625,14 @@ IMPLEMENT_DYNAMIC_CLASS(wxGenericGrid, wxPanel)
const wxEventTable *wxEvtHandler::GetEventTable() const { return &wxEvtHandler::sm_eventTable; } const wxEventTable *wxEvtHandler::GetEventTable() const { return &wxEvtHandler::sm_eventTable; }
const wxEventTable wxEvtHandler::sm_eventTable = const wxEventTable wxEvtHandler::sm_eventTable =
{ NULL, &wxEvtHandler::sm_eventTableEntries[0] }; { NULL, &wxEvtHandler::sm_eventTableEntries[0] };
const wxEventTableEntry wxEvtHandler::sm_eventTableEntries[] = { { 0, 0, 0, NULL } }; const wxEventTableEntry wxEvtHandler::sm_eventTableEntries[] = { { 0, 0, 0, NULL } };
BEGIN_EVENT_TABLE(wxFrame, wxWindow) BEGIN_EVENT_TABLE(wxFrame, wxWindow)
EVT_ACTIVATE(wxFrame::OnActivate) EVT_ACTIVATE(wxFrame::OnActivate)
EVT_SIZE(wxFrame::OnSize) EVT_SIZE(wxFrame::OnSize)
EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight) EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight)
EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged) EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged)
EVT_IDLE(wxFrame::OnIdle) EVT_IDLE(wxFrame::OnIdle)
EVT_CLOSE(wxFrame::OnCloseWindow) EVT_CLOSE(wxFrame::OnCloseWindow)
@@ -667,9 +667,9 @@ BEGIN_EVENT_TABLE(wxPanel, wxWindow)
END_EVENT_TABLE() END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxTextCtrl, wxControl) BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
EVT_CHAR(wxTextCtrl::OnChar) EVT_CHAR(wxTextCtrl::OnChar)
EVT_DROP_FILES(wxTextCtrl::OnDropFiles) EVT_DROP_FILES(wxTextCtrl::OnDropFiles)
EVT_ERASE_BACKGROUND(wxTextCtrl::OnEraseBackground) EVT_ERASE_BACKGROUND(wxTextCtrl::OnEraseBackground)
END_EVENT_TABLE() END_EVENT_TABLE()
#ifdef __WXMSW__ #ifdef __WXMSW__
@@ -691,32 +691,32 @@ BEGIN_EVENT_TABLE(wxToolBarBase, wxControl)
END_EVENT_TABLE() END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxToolBarSimple, wxToolBarBase) BEGIN_EVENT_TABLE(wxToolBarSimple, wxToolBarBase)
EVT_SIZE(wxToolBarSimple::OnSize) EVT_SIZE(wxToolBarSimple::OnSize)
EVT_PAINT(wxToolBarSimple::OnPaint) EVT_PAINT(wxToolBarSimple::OnPaint)
EVT_KILL_FOCUS(wxToolBarSimple::OnKillFocus) EVT_KILL_FOCUS(wxToolBarSimple::OnKillFocus)
EVT_MOUSE_EVENTS(wxToolBarSimple::OnMouseEvent) EVT_MOUSE_EVENTS(wxToolBarSimple::OnMouseEvent)
END_EVENT_TABLE() END_EVENT_TABLE()
#ifdef __WXMSW__ #ifdef __WXMSW__
BEGIN_EVENT_TABLE(wxToolBarMSW, wxToolBarBase) BEGIN_EVENT_TABLE(wxToolBarMSW, wxToolBarBase)
EVT_SIZE(wxToolBarMSW::OnSize) EVT_SIZE(wxToolBarMSW::OnSize)
EVT_PAINT(wxToolBarMSW::OnPaint) EVT_PAINT(wxToolBarMSW::OnPaint)
EVT_MOUSE_EVENTS(wxToolBarMSW::OnMouseEvent) EVT_MOUSE_EVENTS(wxToolBarMSW::OnMouseEvent)
END_EVENT_TABLE() END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxToolBar95, wxToolBarBase) BEGIN_EVENT_TABLE(wxToolBar95, wxToolBarBase)
EVT_SIZE(wxToolBar95::OnSize) EVT_SIZE(wxToolBar95::OnSize)
EVT_PAINT(wxToolBar95::OnPaint) EVT_PAINT(wxToolBar95::OnPaint)
EVT_KILL_FOCUS(wxToolBar95::OnKillFocus) EVT_KILL_FOCUS(wxToolBar95::OnKillFocus)
EVT_MOUSE_EVENTS(wxToolBar95::OnMouseEvent) EVT_MOUSE_EVENTS(wxToolBar95::OnMouseEvent)
EVT_SYS_COLOUR_CHANGED(wxToolBar95::OnSysColourChanged) EVT_SYS_COLOUR_CHANGED(wxToolBar95::OnSysColourChanged)
END_EVENT_TABLE() END_EVENT_TABLE()
#endif #endif
BEGIN_EVENT_TABLE(wxGenericGrid, wxPanel) BEGIN_EVENT_TABLE(wxGenericGrid, wxPanel)
EVT_SIZE(wxGenericGrid::OnSize) EVT_SIZE(wxGenericGrid::OnSize)
EVT_PAINT(wxGenericGrid::OnPaint) EVT_PAINT(wxGenericGrid::OnPaint)
EVT_MOUSE_EVENTS(wxGenericGrid::OnMouseEvent) EVT_MOUSE_EVENTS(wxGenericGrid::OnMouseEvent)
EVT_TEXT(wxGRID_TEXT_CTRL, wxGenericGrid::OnText) EVT_TEXT(wxGRID_TEXT_CTRL, wxGenericGrid::OnText)
EVT_COMMAND_SCROLL(wxGRID_HSCROLL, wxGenericGrid::OnGridScroll) EVT_COMMAND_SCROLL(wxGRID_HSCROLL, wxGenericGrid::OnGridScroll)
EVT_COMMAND_SCROLL(wxGRID_VSCROLL, wxGenericGrid::OnGridScroll) EVT_COMMAND_SCROLL(wxGRID_VSCROLL, wxGenericGrid::OnGridScroll)
@@ -728,28 +728,28 @@ END_EVENT_TABLE()
#if !defined(__WXMSW__) || wxUSE_GENERIC_DIALOGS_IN_MSW #if !defined(__WXMSW__) || wxUSE_GENERIC_DIALOGS_IN_MSW
BEGIN_EVENT_TABLE(wxGenericMessageDialog, wxDialog) BEGIN_EVENT_TABLE(wxGenericMessageDialog, wxDialog)
EVT_BUTTON(wxID_YES, wxGenericMessageDialog::OnYes) EVT_BUTTON(wxID_YES, wxGenericMessageDialog::OnYes)
EVT_BUTTON(wxID_NO, wxGenericMessageDialog::OnNo) EVT_BUTTON(wxID_NO, wxGenericMessageDialog::OnNo)
EVT_BUTTON(wxID_CANCEL, wxGenericMessageDialog::OnCancel) EVT_BUTTON(wxID_CANCEL, wxGenericMessageDialog::OnCancel)
END_EVENT_TABLE() END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxGenericColourDialog, wxDialog) BEGIN_EVENT_TABLE(wxGenericColourDialog, wxDialog)
EVT_BUTTON(wxID_ADD_CUSTOM, wxGenericColourDialog::OnAddCustom) EVT_BUTTON(wxID_ADD_CUSTOM, wxGenericColourDialog::OnAddCustom)
EVT_SLIDER(wxID_RED_SLIDER, wxGenericColourDialog::OnRedSlider) EVT_SLIDER(wxID_RED_SLIDER, wxGenericColourDialog::OnRedSlider)
EVT_SLIDER(wxID_GREEN_SLIDER, wxGenericColourDialog::OnGreenSlider) EVT_SLIDER(wxID_GREEN_SLIDER, wxGenericColourDialog::OnGreenSlider)
EVT_SLIDER(wxID_BLUE_SLIDER, wxGenericColourDialog::OnBlueSlider) EVT_SLIDER(wxID_BLUE_SLIDER, wxGenericColourDialog::OnBlueSlider)
EVT_PAINT(wxGenericColourDialog::OnPaint) EVT_PAINT(wxGenericColourDialog::OnPaint)
EVT_MOUSE_EVENTS(wxGenericColourDialog::OnMouseEvent) EVT_MOUSE_EVENTS(wxGenericColourDialog::OnMouseEvent)
END_EVENT_TABLE() END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxGenericFontDialog, wxDialog) BEGIN_EVENT_TABLE(wxGenericFontDialog, wxDialog)
EVT_CHECKBOX(wxID_FONT_UNDERLINE, wxGenericFontDialog::OnChangeFont) EVT_CHECKBOX(wxID_FONT_UNDERLINE, wxGenericFontDialog::OnChangeFont)
EVT_CHOICE(wxID_FONT_STYLE, wxGenericFontDialog::OnChangeFont) EVT_CHOICE(wxID_FONT_STYLE, wxGenericFontDialog::OnChangeFont)
EVT_CHOICE(wxID_FONT_WEIGHT, wxGenericFontDialog::OnChangeFont) EVT_CHOICE(wxID_FONT_WEIGHT, wxGenericFontDialog::OnChangeFont)
EVT_CHOICE(wxID_FONT_FAMILY, wxGenericFontDialog::OnChangeFont) EVT_CHOICE(wxID_FONT_FAMILY, wxGenericFontDialog::OnChangeFont)
EVT_CHOICE(wxID_FONT_COLOUR, wxGenericFontDialog::OnChangeFont) EVT_CHOICE(wxID_FONT_COLOUR, wxGenericFontDialog::OnChangeFont)
EVT_CHOICE(wxID_FONT_SIZE, wxGenericFontDialog::OnChangeFont) EVT_CHOICE(wxID_FONT_SIZE, wxGenericFontDialog::OnChangeFont)
EVT_PAINT(wxGenericFontDialog::OnPaint) EVT_PAINT(wxGenericFontDialog::OnPaint)
END_EVENT_TABLE() END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxGenericPrintDialog, wxDialog) BEGIN_EVENT_TABLE(wxGenericPrintDialog, wxDialog)
@@ -761,25 +761,25 @@ END_EVENT_TABLE()
#endif #endif
BEGIN_EVENT_TABLE(wxTextEntryDialog, wxDialog) BEGIN_EVENT_TABLE(wxTextEntryDialog, wxDialog)
EVT_BUTTON(wxID_OK, wxTextEntryDialog::OnOK) EVT_BUTTON(wxID_OK, wxTextEntryDialog::OnOK)
END_EVENT_TABLE() END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxSingleChoiceDialog, wxDialog) BEGIN_EVENT_TABLE(wxSingleChoiceDialog, wxDialog)
EVT_BUTTON(wxID_OK, wxSingleChoiceDialog::OnOK) EVT_BUTTON(wxID_OK, wxSingleChoiceDialog::OnOK)
END_EVENT_TABLE() END_EVENT_TABLE()
#include "wx/prntbase.h" #include "wx/prntbase.h"
BEGIN_EVENT_TABLE(wxPrintAbortDialog, wxDialog) BEGIN_EVENT_TABLE(wxPrintAbortDialog, wxDialog)
EVT_BUTTON(wxID_CANCEL, wxPrintAbortDialog::OnCancel) EVT_BUTTON(wxID_CANCEL, wxPrintAbortDialog::OnCancel)
END_EVENT_TABLE() END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxPreviewControlBar, wxWindow) BEGIN_EVENT_TABLE(wxPreviewControlBar, wxWindow)
EVT_BUTTON(wxID_PREVIEW_CLOSE, wxPreviewControlBar::OnClose) EVT_BUTTON(wxID_PREVIEW_CLOSE, wxPreviewControlBar::OnClose)
EVT_BUTTON(wxID_PREVIEW_PRINT, wxPreviewControlBar::OnPrint) EVT_BUTTON(wxID_PREVIEW_PRINT, wxPreviewControlBar::OnPrint)
EVT_BUTTON(wxID_PREVIEW_PREVIOUS, wxPreviewControlBar::OnPrevious) EVT_BUTTON(wxID_PREVIEW_PREVIOUS, wxPreviewControlBar::OnPrevious)
EVT_BUTTON(wxID_PREVIEW_NEXT, wxPreviewControlBar::OnNext) EVT_BUTTON(wxID_PREVIEW_NEXT, wxPreviewControlBar::OnNext)
EVT_CHOICE(wxID_PREVIEW_ZOOM, wxPreviewControlBar::OnZoom) EVT_CHOICE(wxID_PREVIEW_ZOOM, wxPreviewControlBar::OnZoom)
END_EVENT_TABLE() END_EVENT_TABLE()
#endif #endif