- 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:
@@ -370,23 +370,32 @@ wxCommandEvent::wxCommandEvent(wxEventType commandType, int theId)
|
||||
*/
|
||||
|
||||
#if wxUSE_LONGLONG
|
||||
wxLongLong wxUpdateUIEvent::m_lastUpdate = 0;
|
||||
wxLongLong wxUpdateUIEvent::sm_lastUpdate = 0;
|
||||
#endif
|
||||
|
||||
long wxUpdateUIEvent::m_updateInterval = 0;
|
||||
long wxUpdateUIEvent::sm_updateInterval = 0;
|
||||
|
||||
wxUpdateUIMode wxUpdateUIEvent::sm_updateMode = wxUPDATE_UI_PROCESS_ALL;
|
||||
|
||||
// Can we update?
|
||||
bool wxUpdateUIEvent::CanUpdate()
|
||||
bool wxUpdateUIEvent::CanUpdate(wxWindow* win)
|
||||
{
|
||||
if (m_updateInterval == -1)
|
||||
// Don't update if we've switched global updating off
|
||||
// and this window doesn't support updates.
|
||||
if (win &&
|
||||
(GetMode() == wxUPDATE_UI_PROCESS_SPECIFIED &&
|
||||
((win->GetExtraStyle() & wxWS_EX_PROCESS_UI_UPDATES) == 0)))
|
||||
return FALSE;
|
||||
else if (m_updateInterval == 0)
|
||||
|
||||
if (sm_updateInterval == -1)
|
||||
return FALSE;
|
||||
else if (sm_updateInterval == 0)
|
||||
return TRUE;
|
||||
else
|
||||
{
|
||||
#if wxUSE_STOPWATCH && wxUSE_LONGLONG
|
||||
wxLongLong now = wxGetLocalTimeMillis();
|
||||
if (now > (m_lastUpdate + m_updateInterval))
|
||||
if (now > (sm_lastUpdate + sm_updateInterval))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
@@ -404,17 +413,35 @@ bool wxUpdateUIEvent::CanUpdate()
|
||||
void wxUpdateUIEvent::ResetUpdateTime()
|
||||
{
|
||||
#if wxUSE_STOPWATCH && wxUSE_LONGLONG
|
||||
if (m_updateInterval > 0)
|
||||
if (sm_updateInterval > 0)
|
||||
{
|
||||
wxLongLong now = wxGetLocalTimeMillis();
|
||||
if (now > (m_lastUpdate + m_updateInterval))
|
||||
if (now > (sm_lastUpdate + sm_updateInterval))
|
||||
{
|
||||
m_lastUpdate = now;
|
||||
sm_lastUpdate = now;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Idle events
|
||||
*/
|
||||
|
||||
wxIdleMode wxIdleEvent::sm_idleMode = wxIDLE_PROCESS_ALL;
|
||||
|
||||
// Can we send an idle event?
|
||||
bool wxIdleEvent::CanSend(wxWindow* win)
|
||||
{
|
||||
// Don't update if we've switched global updating off
|
||||
// and this window doesn't support updates.
|
||||
if (win &&
|
||||
(GetMode() == wxIDLE_PROCESS_SPECIFIED &&
|
||||
((win->GetExtraStyle() & wxWS_EX_PROCESS_IDLE) == 0)))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Scroll events
|
||||
|
||||
Reference in New Issue
Block a user