From ea451729db1696e7993d472e46661622fa06a7f7 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Sat, 22 Jan 2000 11:14:22 +0000 Subject: [PATCH] Fixed wxListCtrl::GetNextItem() Fixed bug in handling wxLC_NO_HEADER, Moved logmessage stuff out of idle_recursion protection so that log dialogs get idle events git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5584 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/listctrl.cpp | 8 +++++++- src/generic/logg.cpp | 5 +++-- src/generic/panelg.cpp | 1 + src/gtk/app.cpp | 24 ++++++++++++------------ src/gtk1/app.cpp | 24 ++++++++++++------------ 5 files changed, 35 insertions(+), 27 deletions(-) diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 95bad0445e..77f0ebe6d7 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -2334,7 +2334,7 @@ long wxListMainWindow::GetNextItem( long item, int WXUNUSED(geometry), int state long ret = 0; if (item > 0) ret = item; if(ret >= GetItemCount()) return -1; - wxNode *node = m_lines.Nth( (size_t)ret ); + wxNode *node = m_lines.Nth( (size_t)++ret ); while (node) { wxListLineData *line = (wxListLineData*)node->Data(); @@ -2715,9 +2715,15 @@ bool wxListCtrl::Create(wxWindow *parent, m_mainWin = new wxListMainWindow( this, -1, wxPoint(0,0), size, style ); if (HasFlag(wxLC_REPORT)) + { m_headerWin = new wxListHeaderWindow( this, -1, m_mainWin, wxPoint(0,0), wxSize(size.x,23), wxTAB_TRAVERSAL ); + if (HasFlag(wxLC_NO_HEADER)) + m_headerWin->Show( FALSE ); + } else + { m_headerWin = (wxListHeaderWindow *) NULL; + } SetBackgroundColour( *wxWHITE ); diff --git a/src/generic/logg.cpp b/src/generic/logg.cpp index 82cc02d40c..bd25cec3b1 100644 --- a/src/generic/logg.cpp +++ b/src/generic/logg.cpp @@ -636,7 +636,7 @@ wxLogDialog::wxLogDialog(wxWindow *parent, const wxArrayLong& times, const wxString& caption, long style) - : wxDialog(parent, -1, caption), + : wxDialog(parent, -1, caption ), m_messages(messages), m_severity(severity), m_times(times) { m_showingDetails = FALSE; // not initially @@ -697,7 +697,7 @@ void wxLogDialog::OnDetails(wxCommandEvent& WXUNUSED(event)) // create it now m_listctrl = new wxListCtrl(this, -1, wxDefaultPosition, wxDefaultSize, - wxLC_REPORT | wxLC_NO_HEADER); + wxLC_REPORT | wxLC_NO_HEADER ); m_listctrl->InsertColumn(0, _("Message")); m_listctrl->InsertColumn(1, _("Time")); @@ -775,6 +775,7 @@ void wxLogDialog::OnDetails(wxCommandEvent& WXUNUSED(event)) m_showingDetails = !m_showingDetails; // in any case, our size changed - update + sizer->SetSizeHints(this); sizer->Fit(this); } diff --git a/src/generic/panelg.cpp b/src/generic/panelg.cpp index 3ff8c2dbc0..0218693d28 100644 --- a/src/generic/panelg.cpp +++ b/src/generic/panelg.cpp @@ -25,6 +25,7 @@ #include "wx/font.h" #include "wx/colour.h" #include "wx/settings.h" +#include "wx/log.h" #endif #include "wx/generic/panelg.h" diff --git a/src/gtk/app.cpp b/src/gtk/app.cpp index 115d743eae..3196c1a79c 100644 --- a/src/gtk/app.cpp +++ b/src/gtk/app.cpp @@ -138,9 +138,6 @@ gint wxapp_idle_callback( gpointer WXUNUSED(data) ) // thread so we must lock it here ourselves gdk_threads_enter(); - /* sent idle event to all who request them */ - while (wxTheApp->ProcessIdle()) { } - /* we don't want any more idle events until the next event is sent to wxGTK */ gtk_idle_remove( wxTheApp->m_idleTag ); @@ -153,6 +150,9 @@ gint wxapp_idle_callback( gpointer WXUNUSED(data) ) emptied */ g_isIdle = TRUE; + /* sent idle event to all who request them */ + while (wxTheApp->ProcessIdle()) { } + // release lock again gdk_threads_leave(); @@ -352,11 +352,11 @@ bool wxApp::ProcessIdle() void wxApp::OnIdle( wxIdleEvent &event ) { static bool s_inOnIdle = FALSE; - + /* Avoid recursion (via ProcessEvent default case) */ if (s_inOnIdle) return; - + s_inOnIdle = TRUE; /* Resend in the main thread events which have been prepared in other @@ -366,13 +366,6 @@ void wxApp::OnIdle( wxIdleEvent &event ) /* 'Garbage' collection of windows deleted with Close(). */ DeletePendingObjects(); - /* flush the logged messages if any */ -#if wxUSE_LOG - wxLog *log = wxLog::GetActiveTarget(); - if (log != NULL && log->HasPendingMessages()) - log->Flush(); -#endif // wxUSE_LOG - /* Send OnIdle events to all windows */ bool needMore = SendIdleEvents(); @@ -380,6 +373,13 @@ void wxApp::OnIdle( wxIdleEvent &event ) event.RequestMore(TRUE); s_inOnIdle = FALSE; + + /* flush the logged messages if any */ +#if wxUSE_LOG + wxLog *log = wxLog::GetActiveTarget(); + if (log != NULL && log->HasPendingMessages()) + log->Flush(); +#endif // wxUSE_LOG } bool wxApp::SendIdleEvents() diff --git a/src/gtk1/app.cpp b/src/gtk1/app.cpp index 115d743eae..3196c1a79c 100644 --- a/src/gtk1/app.cpp +++ b/src/gtk1/app.cpp @@ -138,9 +138,6 @@ gint wxapp_idle_callback( gpointer WXUNUSED(data) ) // thread so we must lock it here ourselves gdk_threads_enter(); - /* sent idle event to all who request them */ - while (wxTheApp->ProcessIdle()) { } - /* we don't want any more idle events until the next event is sent to wxGTK */ gtk_idle_remove( wxTheApp->m_idleTag ); @@ -153,6 +150,9 @@ gint wxapp_idle_callback( gpointer WXUNUSED(data) ) emptied */ g_isIdle = TRUE; + /* sent idle event to all who request them */ + while (wxTheApp->ProcessIdle()) { } + // release lock again gdk_threads_leave(); @@ -352,11 +352,11 @@ bool wxApp::ProcessIdle() void wxApp::OnIdle( wxIdleEvent &event ) { static bool s_inOnIdle = FALSE; - + /* Avoid recursion (via ProcessEvent default case) */ if (s_inOnIdle) return; - + s_inOnIdle = TRUE; /* Resend in the main thread events which have been prepared in other @@ -366,13 +366,6 @@ void wxApp::OnIdle( wxIdleEvent &event ) /* 'Garbage' collection of windows deleted with Close(). */ DeletePendingObjects(); - /* flush the logged messages if any */ -#if wxUSE_LOG - wxLog *log = wxLog::GetActiveTarget(); - if (log != NULL && log->HasPendingMessages()) - log->Flush(); -#endif // wxUSE_LOG - /* Send OnIdle events to all windows */ bool needMore = SendIdleEvents(); @@ -380,6 +373,13 @@ void wxApp::OnIdle( wxIdleEvent &event ) event.RequestMore(TRUE); s_inOnIdle = FALSE; + + /* flush the logged messages if any */ +#if wxUSE_LOG + wxLog *log = wxLog::GetActiveTarget(); + if (log != NULL && log->HasPendingMessages()) + log->Flush(); +#endif // wxUSE_LOG } bool wxApp::SendIdleEvents()