- Moved wxApp::SendIdleEvents and wxApp::ProcessIdle into common code.

- wxWindow::OnInternalIdle is now used in all ports, and ensures that
  user OnIdle events do not interfere with crucial internal processing.
- wxWindow::UpdateWindowUI is now a documented function that
  sends wxUpdateUIEvents, and can be overridden. It has a helper function
  DoUpdateWindowUI for taking appropriate wxUpdateUIEvent action.
- Added functions to wxUpdateUIEvent: Set/GetMode, Set/GetUpdateInterval,
  CanUpdate, to assist with optimising update event frequency.
- Added functions to wxIdleEvent: Set/GetMode, CanSend, to
  determine whether a window should receive idle events.
- Added wxWS_EX_PROCESS_IDLE, wxWS_EX_PROCESS_UI_UPDATES window
  styles for use with conservative idle and update event modes.
- wxMSW and wxGTK now send menu update events only when a menu is
  about to be used.
- Added WM_INITMENU processing instead of WM_ENTERMENULOOP, or
  accelerators don't always get called since menu items may still
  be disabled.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21789 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2003-07-09 10:15:21 +00:00
parent 50b27824da
commit e39af974ef
81 changed files with 733 additions and 959 deletions

View File

@@ -534,27 +534,6 @@ GdkVisual *wxApp::GetGdkVisual()
return visual;
}
bool wxApp::ProcessIdle()
{
wxWindowList::Node* node = wxTopLevelWindows.GetFirst();
node = wxTopLevelWindows.GetFirst();
while (node)
{
wxWindow* win = node->GetData();
CallInternalIdle( win );
node = node->GetNext();
}
wxIdleEvent event;
event.SetEventObject( this );
ProcessEvent( event );
wxUpdateUIEvent::ResetUpdateTime();
return event.MoreRequested();
}
void wxApp::OnIdle( wxIdleEvent &event )
{
static bool s_inOnIdle = FALSE;
@@ -581,64 +560,6 @@ void wxApp::OnIdle( wxIdleEvent &event )
s_inOnIdle = FALSE;
}
bool wxApp::SendIdleEvents()
{
bool needMore = FALSE;
wxWindowList::Node* node = wxTopLevelWindows.GetFirst();
while (node)
{
wxWindow* win = node->GetData();
if (SendIdleEvents(win))
needMore = TRUE;
node = node->GetNext();
}
return needMore;
}
bool wxApp::CallInternalIdle( wxWindow* win )
{
win->OnInternalIdle();
wxWindowList::Node *node = win->GetChildren().GetFirst();
while (node)
{
wxWindow *win = node->GetData();
CallInternalIdle( win );
node = node->GetNext();
}
return TRUE;
}
bool wxApp::SendIdleEvents( wxWindow* win )
{
bool needMore = FALSE;
wxIdleEvent event;
event.SetEventObject(win);
win->GetEventHandler()->ProcessEvent(event);
if (event.MoreRequested())
needMore = TRUE;
wxWindowList::Node *node = win->GetChildren().GetFirst();
while (node)
{
wxWindow *win = node->GetData();
if (SendIdleEvents(win))
needMore = TRUE;
node = node->GetNext();
}
return needMore;
}
int wxApp::MainLoop()
{
gtk_main();

View File

@@ -220,8 +220,8 @@ void wxCheckBox::OnInternalIdle()
}
}
if (wxUpdateUIEvent::CanUpdate())
UpdateWindowUI();
if (wxUpdateUIEvent::CanUpdate(this))
UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
}
wxSize wxCheckBox::DoGetBestSize() const

View File

@@ -508,7 +508,7 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y),
void wxFrame::OnInternalIdle()
{
wxTopLevelWindow::OnInternalIdle();
wxFrameBase::OnInternalIdle();
#if wxUSE_MENUS_NATIVE
if (m_frameMenuBar) m_frameMenuBar->OnInternalIdle();

View File

@@ -1039,8 +1039,8 @@ void wxListBox::OnInternalIdle()
}
}
if (wxUpdateUIEvent::CanUpdate())
UpdateWindowUI();
if (wxUpdateUIEvent::CanUpdate(this))
UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
}
wxSize wxListBox::DoGetBestSize() const

View File

@@ -239,8 +239,8 @@ void wxRadioButton::OnInternalIdle()
}
}
if (wxUpdateUIEvent::CanUpdate())
UpdateWindowUI();
if (wxUpdateUIEvent::CanUpdate(this))
UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
}
wxSize wxRadioButton::DoGetBestSize() const

View File

@@ -673,8 +673,8 @@ void wxToolBar::OnInternalIdle()
}
}
if (wxUpdateUIEvent::CanUpdate())
UpdateWindowUI();
if (wxUpdateUIEvent::CanUpdate(this))
UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
}
#endif // wxUSE_TOOLBAR_NATIVE

View File

@@ -1591,8 +1591,8 @@ void wxTextCtrl::OnInternalIdle()
}
}
if (wxUpdateUIEvent::CanUpdate())
UpdateWindowUI();
if (wxUpdateUIEvent::CanUpdate(this))
UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
}
wxSize wxTextCtrl::DoGetBestSize() const

View File

@@ -166,8 +166,8 @@ void wxToggleButton::OnInternalIdle()
gdk_window_set_cursor(win, cursor.GetCursor());
}
if (wxUpdateUIEvent::CanUpdate())
UpdateWindowUI();
if (wxUpdateUIEvent::CanUpdate(this))
UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
}
// wxSize DoGetBestSize() const

View File

@@ -3022,8 +3022,8 @@ void wxWindowGTK::OnInternalIdle()
}
}
if (wxUpdateUIEvent::CanUpdate())
UpdateWindowUI();
if (wxUpdateUIEvent::CanUpdate(this))
UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
}
void wxWindowGTK::DoGetSize( int *width, int *height ) const