- 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

@@ -46,9 +46,6 @@
// ----------------------------------------------------------------------------
BEGIN_EVENT_TABLE(wxFrameBase, wxTopLevelWindow)
#if wxUSE_MENUS && wxUSE_IDLEMENUUPDATES
EVT_IDLE(wxFrameBase::OnIdle)
#endif
#if wxUSE_MENUS && !wxUSE_IDLEMENUUPDATES
EVT_MENU_OPEN(wxFrameBase::OnMenuOpen)
#endif
@@ -211,6 +208,34 @@ bool wxFrameBase::ProcessCommand(int id)
#endif // wxUSE_MENUS/!wxUSE_MENUS
}
// Do the UI update processing for this window. This is
// provided for the application to call if it wants to
// force a UI update, particularly for the menus and toolbar.
void wxFrameBase::UpdateWindowUI(long flags)
{
wxWindowBase::UpdateWindowUI(flags);
#if wxUSE_TOOLBAR
if (GetToolBar())
GetToolBar()->UpdateWindowUI(flags);
#endif
#if wxUSE_MENUS
if (GetMenuBar())
{
if ((flags & wxUPDATE_UI_FROMIDLE) && !wxUSE_IDLEMENUUPDATES)
{
// If coming from an idle event, we only
// want to update the menus if we're
// in the wxUSE_IDLEMENUUPDATES configuration:
// so if we're not, do nothing
}
else
DoMenuUpdates();
}
#endif
}
// ----------------------------------------------------------------------------
// event handlers
// ----------------------------------------------------------------------------
@@ -222,10 +247,11 @@ void wxFrameBase::OnMenuHighlight(wxMenuEvent& event)
#endif // wxUSE_STATUSBAR
}
void wxFrameBase::OnIdle(wxIdleEvent& WXUNUSED(event) )
// Implement internal behaviour (menu updating on some platforms)
void wxFrameBase::OnInternalIdle()
{
#if wxUSE_MENUS && wxUSE_IDLEMENUUPDATES
if (wxUpdateUIEvent::CanUpdate())
if (wxUpdateUIEvent::CanUpdate(this))
DoMenuUpdates();
#endif
}