- Added m_ prefix to wxColourData and wxFontData members
- Added wxHtmlPrintout::AddFilter so HTML printing can be subject to
custom filters as well as HTML viewing.
+- 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.
Unix:
This class is used for idle events, which are generated when the system is idle.
+By default, idle events are sent to all windows. If this is causing a significant
+overhead in your application, you can call \helpref{wxIdleEvent::SetMode}{wxidleeventsetmode} with
+the value wxIDLE\_PROCESS\_SPECIFIED, and set the wxWS\_EX\_PROCESS\_IDLE extra
+window style for every window which should receive idle events.
+
+The function \helpref{wxWindow::OnInternalIdle}{wxwindowoninternalidle} is
+also provided for internal purposes, and cannot be disabled. wxUpdateUIEvents
+are sent from OnInternalIdle.
+
\wxheading{Derived from}
\helpref{wxEvent}{wxevent}\\
\wxheading{See also}
-\helpref{Event handling overview}{eventhandlingoverview}
+\helpref{Event handling overview}{eventhandlingoverview}, \helpref{wxUpdateUIEvent}{wxupdateuievent},
+\helpref{wxWindow::OnInternalIdle}{wxwindowoninternalidle}
\latexignore{\rtfignore{\wxheading{Members}}}
Constructor.
+\membersection{wxIdleEvent::CanSend}\label{wxidleeventcansend}
+
+\func{static bool}{CanSend}{\param{wxWindow*}{ window}}
+
+Returns {\tt true} if it is appropriate to send idle events to
+this window.
+
+This function looks at the mode used (see \helpref{wxIdleEvent::SetMode}{wxidleeventsetmode}),
+and the wxWS\_EX\_PROCESS\_IDLE style in {\it window} to determine whether idle events should be sent to
+this window now. By default this will always return {\tt true} because
+the update mode is initially wxIDLE\_PROCESS\_ALL. You can change the mode
+to only send idle events to windows with the wxWS\_EX\_PROCESS\_IDLE extra window style set.
+
+\wxheading{See also}
+
+\helpref{wxIdleEvent::SetMode}{wxidlesetmode}
+
+\membersection{wxIdleEvent::GetMode}\label{wxidleeventgetmode}
+
+\func{static wxIdleMode}{GetMode}{\void}
+
+Static function returning a value specifying how wxWindows
+will send idle events: to all windows, or only to those which specify that they
+will process the events.
+
+See \helpref{wxIdleEvent::SetMode}{wxidleeventsetmode}.
+
\membersection{wxIdleEvent::RequestMore}\label{wxidleeventrequestmore}
\func{void}{RequestMore}{\param{bool}{ needMore = true}}
\helpref{wxIdleEvent::RequestMore}{wxidleeventrequestmore}
+\membersection{wxIdleEvent::SetMode}\label{wxidleeventsetmode}
+
+\func{static void}{SetMode}{\param{wxIdleMode }{mode}}
+
+Static function for specifying how wxWindows will send idle events: to
+all windows, or only to those which specify that they
+will process the events.
+
+{\it mode} can be one of the following values.
+The default is wxIDLE\_PROCESS\_ALL.
+
+\begin{verbatim}
+enum wxIdleMode
+{
+ // Send idle events to all windows
+ wxIDLE_PROCESS_ALL,
+
+ // Send idle events to windows that have
+ // the wxWS_EX_PROCESS_IDLE flag specified
+ wxIDLE_PROCESS_SPECIFIED
+};
+\end{verbatim}
+
up, \helpref{wxMenu::UpdateUI}{wxmenuupdateui} is called to process any UI events for
the window that owns the menu.
+If you find that the overhead of UI update processing is affecting
+your application, you can do one or both of the following:
+
+\begin{enumerate}
+\item Call \helpref{wxUpdateUIEvent::SetMode}{wxupdateuieventsetmode} with
+a value of wxUPDATE\_UI\_PROCESS\_SPECIFIED, and set the extra style
+wxWS\_EX\_PROCESS\_UPDATE\_EVENTS for every window that should receive update events.
+No other windows will receive update events.
+\item Call \helpref{wxUpdateUIEvent::SetUpdateInterval}{wxupdateuieventsetupdateinterval} with
+a millisecond value to set the delay between updates. You may need
+to call \helpref{wxWindow::UpdateWindowUI}{wxwindowupdatewindowui} at critical
+points, for example when a dialog is about to be shown, in case the user
+sees a slight delay before windows are updated.
+\end{enumerate}
+
+Note that although events are sent in idle time, defining a wxIdleEvent
+handler for a window does not affect this because the events are sent from \helpref{wxWindow::OnInternalIdle}{wxwindowoninternalidle}
+which is {\bf always} called in idle time.
+
+wxWindows tries to optimize update events on some platforms. On Windows
+and GTK+, events for menubar items are only sent when the menu is about
+to be shown, and not in idle time.
+
\wxheading{See also}
\helpref{Event handling overview}{eventhandlingoverview}
Holds the text with which the the application wishes to
update the UI element.
+\membersection{wxUpdateUIEvent::CanUpdate}\label{wxupdateuieventcanupdate}
+
+\func{static bool}{CanUpdate}{\param{wxWindow*}{ window}}
+
+Returns {\tt true} if it is appropriate to update (send UI update events to)
+this window.
+
+This function looks at the mode used (see \helpref{wxUpdateUIEvent::SetMode}{wxupdateuieventsetmode}),
+the wxWS\_EX\_PROCESS\_UPDATE\_EVENTS flag in {\it window},
+the time update events were last sent in idle time, and
+the update interval, to determine whether events should be sent to
+this window now. By default this will always return {\tt true} because
+the update mode is initially wxUPDATE\_UI\_PROCESS\_ALL and
+the interval is set to 0; so update events will be sent as
+often as possible. You can reduce the frequency that events
+are sent by changing the mode and/or setting an update interval.
+
+\wxheading{See also}
+
+\helpref{wxUpdateUIEvent::ResetUpdateTime}{wxupdateuieventresetupdatetime},
+\helpref{wxUpdateUIEvent::SetUpdateInterval}{wxupdateuieventsetupdateinterval},
+\helpref{wxUpdateUIEvent::SetMode}{wxupdateuieventsetmode}
+
\membersection{wxUpdateUIEvent::Check}\label{wxupdateuieventcheck}
\func{void}{Check}{\param{bool}{ check}}
Returns the text that should be set for the UI element.
+\membersection{wxUpdateUIEvent::GetMode}\label{wxupdateuieventgetmode}
+
+\func{static wxUpdateUIMode}{GetMode}{\void}
+
+Static function returning a value specifying how wxWindows
+will send update events: to all windows, or only to those which specify that they
+will process the events.
+
+See \helpref{wxUpdateUIEvent::SetMode}{wxupdateuieventsetmode}.
+
+\membersection{wxUpdateUIEvent::GetUpdateInterval}\label{wxupdateuieventgetupdateinterval}
+
+\func{static long}{GetUpdateInterval}{\void}
+
+Returns the current interval between updates in milliseconds.
+-1 disables updates, 0 updates as frequently as possible.
+
+See \helpref{wxUpdateUIEvent::SetUpdateInterval}{wxupdateuieventsetupdateinterval}.
+
+\membersection{wxUpdateUIEvent::ResetUpdateTime}\label{wxupdateuieventresetupdatetime}
+
+\func{static void}{ResetUpdateTime}{\void}
+
+Used internally to reset the last-updated time to the
+current time. It is assumed that update events are
+normally sent in idle time, so this is called at the end of
+idle processing.
+
+\wxheading{See also}
+
+\helpref{wxUpdateUIEvent::CanUpdate}{wxupdateuieventcanupdate},
+\helpref{wxUpdateUIEvent::SetUpdateInterval}{wxupdateuieventsetupdateinterval},
+\helpref{wxUpdateUIEvent::SetMode}{wxupdateuieventsetmode}
+
+\membersection{wxUpdateUIEvent::SetMode}\label{wxupdateuieventsetmode}
+
+\func{static void}{SetMode}{\param{wxIdleMode }{mode}}
+
+Specify how wxWindows will send update events: to
+all windows, or only to those which specify that they
+will process the events.
+
+{\it mode} may be one of the following values.
+The default is wxUPDATE\_UI\_PROCESS\_ALL.
+
+\begin{verbatim}
+enum wxUpdateUIMode
+{
+ // Send UI update events to all windows
+ wxUPDATE_UI_PROCESS_ALL,
+
+ // Send UI update events to windows that have
+ // the wxWS_EX_PROCESS_UI_UPDATES flag specified
+ wxUPDATE_UI_PROCESS_SPECIFIED
+};
+\end{verbatim}
+
\membersection{wxUpdateUIEvent::SetText}\label{wxupdateuieventsettext}
\func{void}{SetText}{\param{const wxString\&}{ text}}
Sets the text for this UI element.
+\membersection{wxUpdateUIEvent::SetUpdateInterval}\label{wxupdateuieventsetupdateinterval}
+
+\func{static void}{SetUpdateInterval}{\param{long }{updateInterval}}
+
+Sets the interval between updates in milliseconds.
+Set to -1 to disable updates, or to 0 to update as frequently as possible.
+The default is 0.
+
+Use this to reduce the overhead of UI update events if your application
+has a lot of windows. If you set the value to -1 or greater than 0,
+you may also need to call \helpref{wxWindow::UpdateWindowUI}{wxwindowupdatewindowui}
+at appropriate points in your application, such as when a dialog
+is about to be shown.
+
See also \helpref{window styles overview}{windowstyles}.
+\wxheading{Extra window styles}
+
+The following are extra styles, set using \helpref{wxWindow::SetExtraStyle}{wxwindowsetextrastyle}.
+
+\twocolwidtha{5cm}%
+\begin{twocollist}\itemsep=0pt
+\twocolitem{\windowstyle{wxWS\_EX\_VALIDATE\_RECURSIVELY}}{By default, Validate/TransferDataTo/FromWindow()
+only work on direct children of the window (compatible behaviour). Set this flag to make them recursively
+descend into all subwindows.}
+\twocolitem{\windowstyle{wxWS\_EX\_BLOCK\_EVENTS}}{wxCommandEvents and the objects of the derived classes are forwarded to the
+parent window and so on recursively by default. Using this flag for the
+given window allows to block this propagation at this window, i.e. prevent
+the events from being propagated further upwards. Dialogs have this
+flag on by default.}
+\twocolitem{\windowstyle{wxWS\_EX\_TRANSIENT}}{Don't use this window as an implicit parent for the other windows: this must
+be used with transient windows as otherwise there is the risk of creating a
+dialog/frame with this window as a parent which would lead to a crash if the
+parent is destroyed before the child.}
+\twocolitem{\windowstyle{wxWS\_EX\_PROCESS\_IDLE}}{This window should always process idle events, even
+if the mode set by \helpref{wxIdleEvent::SetMode}{wxidleeventsetmode} is wxIDLE\_PROCESS\_SPECIFIED.}
+\twocolitem{\windowstyle{wxWS\_EX\_PROCESS\_UI\_UPDATES}}{This window should always process UI update events,
+even if the mode set by \helpref{wxUpdateUIEvent::SetMode}{wxupdateuieventsetmode} is wxUPDATE\_UI\_PROCESS\_SPECIFIED.}
+\end{twocollist}
+
\wxheading{See also}
\helpref{Event handling overview}{eventhandlingoverview}
Returns {\tt true} if the window has been disabled, {\tt false} if it had been
already disabled before the call to this function.
+\membersection{wxWindow::DoUpdateWindowUI}\label{wxwindowdoupdatewindowui}
+
+\func{virtual void}{DoUpdateWindowUI}{\param{wxUpdateUIEvent\&}{ event}}
+
+Does the window-specific updating after processing the update event.
+This function is called by \helpref{wxWindow::UpdateWindowUI}{wxwindowupdatewindowui}
+in order to check return values in the \helpref{wxUpdateUIEvent}{wxupdateuievent} and
+act appropriately. For example, to allow frame and dialog title updating, wxWindows
+implements this function as follows:
+
+\begin{verbatim}
+// do the window-specific processing after processing the update event
+void wxTopLevelWindowBase::DoUpdateWindowUI(wxUpdateUIEvent& event)
+{
+ if ( event.GetSetEnabled() )
+ Enable(event.GetEnabled());
+
+ if ( event.GetSetText() )
+ {
+ if ( event.GetText() != GetTitle() )
+ SetTitle(event.GetText());
+ }
+}
+\end{verbatim}
+
\membersection{wxWindow::DragAcceptFiles}\label{wxwindowdragacceptfiles}
\func{virtual void}{DragAcceptFiles}{\param{bool}{ accept}}
%% \helpref{wxSysColourChangedEvent}{wxsyscolourchangedevent},\rtfsp
%% \helpref{Event handling overview}{eventhandlingoverview}
+\membersection{wxWindow::OnInternalIdle}\label{wxwindowoninternalidle}
+
+\func{virtual void}{OnInternalIdle}{\void}
+
+This virtual function is normally only used internally, but
+sometimes an application may need it to implement functionality
+that should not be disabled by an application defining an OnIdle
+handler in a derived class.
+
+This function may be used to do delayed painting, for example,
+and most implementations call \helpref{wxWindow::UpdateWindowUI}{wxwindowupdatewindowui}
+in order to send update events to the window in idle time.
+
\membersection{wxWindow::PageDown}\label{wxwindowpagedown}
This is just a wrapper for \helpref{ScrollPages()}{wxwindowscrollpages}$(1)$.
\helpref{Refresh}{wxwindowrefresh} first if you want to immediately redraw the
window unconditionally.
+\membersection{wxWindow::UpdateWindowUI}\label{wxwindowupdatewindowui}
+
+\func{virtual void}{UpdateWindowUI}{\param{long}{ flags = wxUPDATE_UI_NONE}}
+
+This function sends \helpref{wxUpdateUIEvents}{wxupdateuievent} to
+the window. The particular implementation depends on the window; for
+example a wxToolBar will send an update UI event for each toolbar button,
+and a wxFrame will send an update UI event for each menubar menu item.
+You can call this function from your application to ensure that your
+UI is up-to-date at this point (as far as your wxUpdateUIEvent handlers
+are concerned). This may be necessary if you have called
+\helpref{wxUpdateUIEvent::SetMode}{wxupdateuieventsetmode} or
+\helpref{wxUpdateUIEvent::SetUpdateInterval}{wxupdateuieventsetupdateinterval} to
+limit the overhead that wxWindows incurs by sending update UI events in idle time.
+
+{\it flags} should be a bitlist of one or more of the following values.
+
+\begin{verbatim}
+enum wxUpdateUI
+{
+ wxUPDATE_UI_NONE = 0x0000, // No particular value
+ wxUPDATE_UI_RECURSE = 0x0001, // Call the function for descendants
+ wxUPDATE_UI_FROMIDLE = 0x0002 // Invoked from On(Internal)Idle
+};
+\end{verbatim}
+
+If you are calling this function from an OnInternalIdle or OnIdle
+function, make sure you pass the wxUPDATE\_UI\_FROMIDLE flag, since
+this tells the window to only update the UI elements that need
+to be updated in idle time. Some windows update their elements
+only when necessary, for example when a menu is about to be shown.
+The following is an example of how to call UpdateWindowUI from
+an idle function.
+
+\begin{verbatim}
+void MyWindow::OnInternalIdle()
+{
+ if (wxUpdateUIEvent::CanUpdate(this))
+ UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
+}
+\end{verbatim}
+
+\wxheading{See also}
+
+\helpref{wxUpdateUIEvent}{wxupdateuievent},
+\helpref{wxWindow::DoUpdateWindowUI}{wxwindowdoupdatewindowui},
+\helpref{wxWindow::OnInternalIdle}{wxwindowoninternalidle}
+
\membersection{wxWindow::Validate}\label{wxwindowvalidate}
\func{virtual bool}{Validate}{\void}
// parties
//
// it should return TRUE if more idle events are needed, FALSE if not
- virtual bool ProcessIdle() = 0;
+ virtual bool ProcessIdle() ;
+
+ // Send idle event to all top-level windows.
+ // Returns TRUE if more idle time is requested.
+ virtual bool SendIdleEvents();
+
+ // Send idle event to window and all subwindows
+ // Returns TRUE if more idle time is requested.
+ virtual bool SendIdleEvents(wxWindow* win);
// top level window functions
virtual void Exit();
virtual bool Yield(bool onlyIfNeeded = FALSE);
- virtual bool ProcessIdle();
virtual void WakeUpIdle() { CocoaRequestIdle(); }
/* Idle Processing */
void OnIdle(wxIdleEvent& event);
- // Send idle event to all top-level windows.
- // Returns TRUE if more idle time is requested.
- bool SendIdleEvents();
- // Send idle event to window and all subwindows
- // Returns TRUE if more idle time is requested.
- bool SendIdleEvents(wxWindowCocoa* win);
-
+
virtual bool Initialize(int& argc, wxChar **argv);
virtual void CleanUp();
virtual bool CallOnInit();
// possibly be made to work in the future, at least on Windows
#define wxWS_EX_THEMED_BACKGROUND 0x00000008
+// this window should always process idle events
+#define wxWS_EX_PROCESS_IDLE 0x00000010
+
+// this window should always process UI update events
+#define wxWS_EX_PROCESS_UI_UPDATES 0x00000020
+
// Use this style to add a context-sensitive help to the window (currently for
// Win32 only and it doesn't work if wxMINIMIZE_BOX or wxMAXIMIZE_BOX are used)
#define wxFRAME_EX_CONTEXTHELP 0x00000004
wxPRINT_MODE_PRINTER = 3 // Send to printer
};
+// ----------------------------------------------------------------------------
+// UpdateWindowUI flags
+// ----------------------------------------------------------------------------
+
+enum wxUpdateUI
+{
+ wxUPDATE_UI_NONE = 0x0000,
+ wxUPDATE_UI_RECURSE = 0x0001,
+ wxUPDATE_UI_FROMIDLE = 0x0002 // Invoked from On(Internal)Idle
+};
+
// ----------------------------------------------------------------------------
// miscellaneous
// ----------------------------------------------------------------------------
wxEVT_UPDATE_UI
*/
+// Whether to always send update events to windows, or
+// to only send update events to those with the
+// wxWS_EX_PROCESS_UI_UPDATES style.
+
+enum wxUpdateUIMode
+{
+ // Send UI update events to all windows
+ wxUPDATE_UI_PROCESS_ALL,
+
+ // Send UI update events to windows that have
+ // the wxWS_EX_PROCESS_UI_UPDATES flag specified
+ wxUPDATE_UI_PROCESS_SPECIFIED
+};
+
class WXDLLIMPEXP_CORE wxUpdateUIEvent : public wxCommandEvent
{
public:
// Sets the interval between updates in milliseconds.
// Set to -1 to disable updates, or to 0 to update as frequently as possible.
- static void SetUpdateInterval(long updateInterval) { m_updateInterval = updateInterval; }
+ static void SetUpdateInterval(long updateInterval) { sm_updateInterval = updateInterval; }
// Returns the current interval between updates in milliseconds
- static long GetUpdateInterval() { return m_updateInterval ; }
+ static long GetUpdateInterval() { return sm_updateInterval ; }
- // Can we update?
- static bool CanUpdate() ;
+ // Can we update this window?
+ static bool CanUpdate(wxWindow* win) ;
// Reset the update time to provide a delay until the next
// time we should update
static void ResetUpdateTime() ;
+ // Specify how wxWindows will send update events: to
+ // all windows, or only to those which specify that they
+ // will process the events.
+ static void SetMode(wxUpdateUIMode mode) { sm_updateMode = mode; }
+
+ // Returns the UI update mode
+ static wxUpdateUIMode GetMode() { return sm_updateMode ; }
+
virtual wxEvent *Clone() const { return new wxUpdateUIEvent(*this); }
protected:
bool m_setChecked;
wxString m_text;
#if wxUSE_LONGLONG
- static wxLongLong m_lastUpdate;
+ static wxLongLong sm_lastUpdate;
#endif
- static long m_updateInterval;
+ static long sm_updateInterval;
+ static wxUpdateUIMode sm_updateMode;
private:
DECLARE_DYNAMIC_CLASS(wxUpdateUIEvent)
wxEVT_IDLE
*/
+// Whether to always send idle events to windows, or
+// to only send update events to those with the
+// wxWS_EX_PROCESS_IDLE style.
+
+enum wxIdleMode
+{
+ // Send idle events to all windows
+ wxIDLE_PROCESS_ALL,
+
+ // Send idle events to windows that have
+ // the wxWS_EX_PROCESS_IDLE flag specified
+ wxIDLE_PROCESS_SPECIFIED
+};
+
class WXDLLIMPEXP_CORE wxIdleEvent : public wxEvent
{
public:
virtual wxEvent *Clone() const { return new wxIdleEvent(*this); }
+ // Specify how wxWindows will send idle events: to
+ // all windows, or only to those which specify that they
+ // will process the events.
+ static void SetMode(wxIdleMode mode) { sm_idleMode = mode; }
+
+ // Returns the idle event mode
+ static wxIdleMode GetMode() { return sm_idleMode ; }
+
+ // Can we send an idle event?
+ static bool CanSend(wxWindow* win) ;
+
protected:
bool m_requestMore;
+ static wxIdleMode sm_idleMode;
private:
DECLARE_DYNAMIC_CLASS(wxIdleEvent)
// -------------------------------
// event handlers
- void OnIdle(wxIdleEvent& event);
void OnMenuOpen(wxMenuEvent& event);
void OnMenuHighlight(wxMenuEvent& event);
void DoMenuUpdates(wxMenu* menu, wxWindow* focusWin);
#endif // wxUSE_MENUS
+ // do the UI update processing for this window
+ virtual void UpdateWindowUI(long flags = wxUPDATE_UI_NONE);
+
+ // Implement internal behaviour (menu updating on some platforms)
+ virtual void OnInternalIdle();
+
// if there is no real wxTopLevelWindow on this platform we have to define
// some wxTopLevelWindowBase pure virtual functions here to avoid breaking
// old ports (wxMotif) which don't define them in wxFrame
virtual void Exit();
virtual bool Yield(bool onlyIfNeeded = FALSE);
- virtual bool ProcessIdle();
virtual void WakeUpIdle();
// implementation only from now on
void OnIdle( wxIdleEvent &event );
- bool SendIdleEvents();
- bool SendIdleEvents( wxWindow* win );
virtual bool Initialize(int& argc, wxChar **argv);
virtual void CleanUp();
bool m_isInAssert;
#endif // __WXDEBUG__
- bool CallInternalIdle( wxWindow* win );
-
DECLARE_DYNAMIC_CLASS(wxApp)
DECLARE_EVENT_TABLE()
};
virtual void Exit();
virtual bool Yield(bool onlyIfNeeded = FALSE);
- virtual bool ProcessIdle();
virtual void WakeUpIdle();
// implementation only from now on
void OnIdle( wxIdleEvent &event );
- bool SendIdleEvents();
- bool SendIdleEvents( wxWindow* win );
virtual bool Initialize(int& argc, wxChar **argv);
virtual void CleanUp();
bool m_isInAssert;
#endif // __WXDEBUG__
- bool CallInternalIdle( wxWindow* win );
-
DECLARE_DYNAMIC_CLASS(wxApp)
DECLARE_EVENT_TABLE()
};
virtual void Exit();
virtual bool Yield(bool onlyIfNeeded = FALSE);
- virtual bool ProcessIdle();
virtual void WakeUpIdle();
virtual void SetPrintMode(int mode) { m_printMode = mode; }
void OnEndSession(wxCloseEvent& event);
void OnQueryEndSession(wxCloseEvent& event);
- // Send idle event to all top-level windows.
- // Returns TRUE if more idle time is requested.
- bool SendIdleEvents();
-
- // Send idle event to window and all subwindows
- // Returns TRUE if more idle time is requested.
- bool SendIdleEvents(wxWindowMac* win);
-
// Windows only, but for compatibility...
inline void SetAuto3D(bool flag) { m_auto3D = flag; }
inline bool GetAuto3D() const { return m_auto3D; }
void OnSetFocus(wxFocusEvent& event) ;
void OnNcPaint(wxNcPaintEvent& event);
void OnEraseBackground(wxEraseEvent& event);
- void OnIdle(wxIdleEvent& event);
void OnMouseEvent( wxMouseEvent &event ) ;
void MacOnScroll(wxScrollEvent&event ) ;
bool AcceptsFocus() const ;
public:
+ void OnInternalIdle();
+
// For implementation purposes - sometimes decorations make the client area
// smaller
virtual wxPoint GetClientAreaOrigin() const;
virtual bool Initialized();
virtual bool Pending();
virtual void Dispatch();
- virtual bool ProcessIdle();
// implementation only from now on
void OnIdle(wxIdleEvent &event);
- bool SendIdleEvents();
- bool SendIdleEvents(wxWindow* win);
virtual bool Initialize(int& argc, wxChar **argv);
virtual void CleanUp();
// themselves inside the given rectangle
virtual void DoMoveWindow(int x, int y, int width, int height);
- void OnIdle(wxIdleEvent& event);
+ void OnInternalIdle();
private:
// common part of all ctors
virtual void Exit();
virtual bool Yield(bool onlyIfNeeded = FALSE);
- virtual bool ProcessIdle();
virtual void WakeUpIdle(); // implemented in motif/evtloop.cpp
virtual bool OnInitGui();
void OnIdle(wxIdleEvent& event);
- // Send idle event to all top-level windows.
- // Returns TRUE if more idle time is requested.
- bool SendIdleEvents();
-
- // Send idle event to window and all subwindows
- // Returns TRUE if more idle time is requested.
- bool SendIdleEvents(wxWindow* win);
-
protected:
bool m_showOnInit;
// For implementation purposes - sometimes decorations make the client area
// smaller
virtual wxPoint GetClientAreaOrigin() const;
+
+ // Process idle (send update events)
+ void OnInternalIdle();
protected:
- // event handlers (not virtual by design)
- void OnIdle(wxIdleEvent& event);
-
// Responds to colour changes: passes event on to children.
void OnSysColourChanged(wxSysColourChangedEvent& event);
virtual void Dispatch();
virtual bool Yield(bool onlyIfNeeded = FALSE);
- virtual bool ProcessIdle();
virtual void WakeUpIdle();
virtual void SetPrintMode(int mode) { m_printMode = mode; }
void OnEndSession(wxCloseEvent& event);
void OnQueryEndSession(wxCloseEvent& event);
- // Send idle event to all top-level windows.
- // Returns TRUE if more idle time is requested.
- bool SendIdleEvents();
-
- // Send idle event to window and all subwindows
- // Returns TRUE if more idle time is requested.
- bool SendIdleEvents(wxWindow* win);
-
protected:
int m_printMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT
// window proc for the frames
long MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
+ // handle WM_INITMENU message
+ bool HandleInitMenu();
+
virtual bool IsMDIChild() const { return FALSE; }
// get default (wxWindows) icon for the frame
// --------------
void OnEraseBackground(wxEraseEvent& event);
- void OnIdle(wxIdleEvent& event);
void OnPaint(wxPaintEvent& event);
public:
// check if mouse is in the window
bool IsMouseInWindow() const;
+ // virtual function for implementing internal idle
+ // behaviour
+ virtual void OnInternalIdle() ;
+
protected:
// the window handle
WXHWND m_hWnd;
virtual void Exit();
virtual bool Yield(bool onlyIfNeeded = FALSE);
- virtual bool ProcessIdle(void);
virtual void WakeUpIdle(void);
virtual void SetPrintMode(int mode) { m_nPrintMode = mode; }
void OnEndSession(wxCloseEvent& rEvent);
void OnQueryEndSession(wxCloseEvent& rEvent);
- // Send idle event to all top-level windows.
- // Returns TRUE if more idle time is requested.
- bool SendIdleEvents(void);
-
- // Send idle event to window and all subwindows
- // Returns TRUE if more idle time is requested.
- bool SendIdleEvents(wxWindow* pWin);
-
void SetAuto3D(bool bFlag) { m_bAuto3D = bFlag; }
bool GetAuto3D(void) const { return m_bAuto3D; }
size_t GetToolsCount() const { return m_tools.GetCount(); }
- void OnIdle(wxIdleEvent& event);
-
// Do the toolbar button updates (check for EVT_UPDATE_UI handlers)
- virtual void DoToolbarUpdates();
+ virtual void UpdateWindowUI(long flags = wxUPDATE_UI_NONE) ;
// don't want toolbars to accept the focus
virtual bool AcceptsFocus() const { return FALSE; }
wxTextCtrl& operator<<(double d);
wxTextCtrl& operator<<(const wxChar c);
+ // do the window-specific processing after processing the update event
+ virtual void DoUpdateWindowUI(wxUpdateUIEvent& event) ;
+
// obsolete functions
#if WXWIN_COMPATIBILITY
bool Modified() const { return IsModified(); }
// so should be there for all platforms
void OnActivate(wxActivateEvent &WXUNUSED(event)) { }
+ // do the window-specific processing after processing the update event
+ virtual void DoUpdateWindowUI(wxUpdateUIEvent& event) ;
+
protected:
// the frame client to screen translation should take account of the
// toolbar which may shift the origin of the client area
// let wxColourScheme choose the right colours for us
virtual bool IsContainerWindow() const { return TRUE; }
+ // idle processing
+ virtual void OnInternalIdle();
protected:
// geometry
virtual wxSize DoGetBestClientSize() const;
void Init();
// event handlers
- void OnIdle(wxIdleEvent& event);
void OnSize(wxSizeEvent& event);
// common part of Clear() and DoSetItems(): clears everything
// for wxControlRenderer::DrawScrollbar() only
const wxScrollArrows& GetArrows() const { return m_arrows; }
+ // idle processing
+ virtual void OnInternalIdle();
+
protected:
virtual wxSize DoGetBestClientSize() const;
virtual void DoDraw(wxControlRenderer *renderer);
virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
- // event handlers
- void OnIdle(wxIdleEvent& event);
-
// forces update of thumb's visual appearence (does nothing if m_dirty=FALSE)
void UpdateThumb();
// event handlers
// --------------
- void OnIdle(wxIdleEvent& event);
void OnChar(wxKeyEvent& event);
void OnSize(wxSizeEvent& event);
bool DoCut();
bool DoPaste();
+ // idle processing
+ virtual void OnInternalIdle();
private:
// all these methods are for multiline text controls only
// get border for the flags of this window
wxBorder GetBorder() const { return GetBorder(GetWindowStyleFlag()); }
- void UpdateWindowUI();
+ // send wxUpdateUIEvents to this window, and children if recurse is TRUE
+ virtual void UpdateWindowUI(long flags = wxUPDATE_UI_NONE);
+
+ // do the window-specific processing after processing the update event
+ virtual void DoUpdateWindowUI(wxUpdateUIEvent& event) ;
#if wxUSE_MENUS
bool PopupMenu( wxMenu *menu, const wxPoint& pos )
void OnHelp(wxHelpEvent& event);
#endif // wxUSE_HELP
- // get the haqndle of the window for the underlying window system: this
+ // virtual function for implementing internal idle
+ // behaviour
+ virtual void OnInternalIdle() {}
+
+ // call internal idle recursively
+ void ProcessInternalIdle() ;
+
+ // get the handle of the window for the underlying window system: this
// is only used for wxWin itself or for user code which wants to call
// platform-specific APIs
virtual WXWidget GetHandle() const = 0;
virtual void Exit();
virtual bool Yield(bool onlyIfNeeded = FALSE);
- virtual bool ProcessIdle();
virtual void WakeUpIdle();
virtual bool OnInitGui();
void OnIdle(wxIdleEvent& event);
- // Send idle event to all top-level windows.
- // Returns TRUE if more idle time is requested.
- bool SendIdleEvents();
-
- // Send idle event to window and all subwindows
- // Returns TRUE if more idle time is requested.
- bool SendIdleEvents(wxWindow* win);
-
// Processes an X event.
virtual bool ProcessXEvent(WXEvent* event);
void OnEraseBackground( wxEraseEvent &event );
void OnMouse( wxMouseEvent &event );
void OnChar( wxKeyEvent &event );
- void OnIdle( wxIdleEvent &event );
void OnSetFocus( wxFocusEvent& event );
void OnKillFocus( wxFocusEvent& event );
+ void OnInternalIdle();
void RefreshLine( int n );
void RefreshDown( int n );
void MoveCursor( int new_x, int new_y, bool shift = FALSE, bool centre = FALSE );
// OnInternalIdle
virtual void OnInternalIdle();
- // For compatibility across platforms (not in event table)
- void OnIdle(wxIdleEvent& WXUNUSED(event)) {}
-
protected:
// Responds to colour changes: passes event on to children.
void OnSysColourChanged(wxSysColourChangedEvent& event);
return 0;
}
-// Returns TRUE if more time is needed.
-bool wxApp::ProcessIdle()
-{
- wxIdleEvent event;
- event.SetEventObject(this);
- ProcessEvent(event);
-
- wxUpdateUIEvent::ResetUpdateTime();
-
- return event.MoreRequested();
-}
-
void wxApp::ExitMainLoop()
{
wxLogDebug("wxApp::ExitMailLoop m_isIdle=%d, isRunning=%d",(int)m_isIdle,(int)[m_cocoaApp isRunning]);
s_inOnIdle = FALSE;
}
-// Send idle event to all top-level windows
-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;
-}
-
-// Send idle event to window and all subwindows
-bool wxApp::SendIdleEvents(wxWindow* win)
-{
-// wxLogDebug("SendIdleEvents win=%p",win);
- bool needMore = FALSE;
-
- wxIdleEvent event;
- event.SetEventObject(win);
- win->ProcessEvent(event);
-
- if (event.MoreRequested())
- needMore = TRUE;
-
- wxWindowList::Node* node = win->GetChildren().GetFirst();
- while (node)
- {
-// wxLogDebug("child=%p",node->Data());
- wxWindow* win = node->GetData();
- if (SendIdleEvents(win))
- needMore = TRUE;
-
- node = node->GetNext();
- }
- return needMore;
-}
-
// Yield to other processes
bool wxApp::Yield(bool onlyIfNeeded)
}
}
+// Returns TRUE if more time is needed.
+bool wxAppBase::ProcessIdle()
+{
+ wxWindowList::Node* node = wxTopLevelWindows.GetFirst();
+ node = wxTopLevelWindows.GetFirst();
+ while (node)
+ {
+ wxWindow* win = node->GetData();
+ win->ProcessInternalIdle();
+ node = node->GetNext();
+ }
+
+ wxIdleEvent event;
+ event.SetEventObject(this);
+ bool processed = ProcessEvent(event);
+
+ wxUpdateUIEvent::ResetUpdateTime();
+
+ return processed && event.MoreRequested();
+}
+
+// Send idle event to all top-level windows
+bool wxAppBase::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;
+}
+
+// Send idle event to window and all subwindows
+bool wxAppBase::SendIdleEvents(wxWindow* win)
+{
+ bool needMore = FALSE;
+
+ if (wxIdleEvent::CanSend(win))
+ {
+ wxIdleEvent event;
+ event.SetEventObject(win);
+ win->GetEventHandler()->ProcessEvent(event);
+
+ needMore = event.MoreRequested();
+ }
+
+ wxWindowList::Node *node = win->GetChildren().GetFirst();
+ while ( node )
+ {
+ wxWindow *win = node->GetData();
+ if (SendIdleEvents(win))
+ needMore = TRUE;
+
+ node = node->GetNext();
+ }
+
+ return needMore;
+}
+
+
// ----------------------------------------------------------------------------
// wxGUIAppTraitsBase
// ----------------------------------------------------------------------------
*/
#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;
+
+ if (sm_updateInterval == -1)
return FALSE;
- else if (m_updateInterval == 0)
+ 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;
}
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
// ----------------------------------------------------------------------------
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
#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
// ----------------------------------------------------------------------------
#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
}
IMPLEMENT_CLASS(wxToolBarBase, wxControl)
BEGIN_EVENT_TABLE(wxToolBarBase, wxControl)
- EVT_IDLE(wxToolBarBase::OnIdle)
END_EVENT_TABLE()
#include "wx/listimpl.cpp"
// UI updates
// ----------------------------------------------------------------------------
-void wxToolBarBase::OnIdle(wxIdleEvent& event)
-{
- if (wxUpdateUIEvent::CanUpdate())
- DoToolbarUpdates();
-
- event.Skip();
-}
-
// Do the toolbar button updates (check for EVT_UPDATE_UI handlers)
-void wxToolBarBase::DoToolbarUpdates()
+void wxToolBarBase::UpdateWindowUI(long flags)
{
+ wxWindowBase::UpdateWindowUI(flags);
+
wxEvtHandler* evtHandler = GetEventHandler() ;
for ( wxToolBarToolsList::Node* node = m_tools.GetFirst();
return sel;
}
+// do the window-specific processing after processing the update event
+void wxTextCtrlBase::DoUpdateWindowUI(wxUpdateUIEvent& event)
+{
+ if ( event.GetSetEnabled() )
+ Enable(event.GetEnabled());
+
+ if ( event.GetSetText() )
+ {
+ if ( event.GetText() != GetValue() )
+ SetValue(event.GetText());
+ }
+}
+
+
#else // !wxUSE_TEXTCTRL
// define this one even if !wxUSE_TEXTCTRL because it is also used by other
return GetEventHandler()->ProcessEvent(event);
}
+// do the window-specific processing after processing the update event
+void wxTopLevelWindowBase::DoUpdateWindowUI(wxUpdateUIEvent& event)
+{
+ if ( event.GetSetEnabled() )
+ Enable(event.GetEnabled());
+
+ if ( event.GetSetText() )
+ {
+ if ( event.GetText() != GetTitle() )
+ SetTitle(event.GetText());
+ }
+}
+
// vi:sts=4:sw=4:et
// do Update UI processing for child controls
// ----------------------------------------------------------------------------
-// TODO: should this be implemented for the child window rather
-// than the parent? Then you can override it e.g. for wxCheckBox
-// to do the Right Thing rather than having to assume a fixed number
-// of control classes.
-void wxWindowBase::UpdateWindowUI()
+void wxWindowBase::UpdateWindowUI(long flags)
{
-#if wxUSE_CONTROLS
wxUpdateUIEvent event(GetId());
event.m_eventObject = this;
if ( GetEventHandler()->ProcessEvent(event) )
{
- if ( event.GetSetEnabled() )
- Enable(event.GetEnabled());
+ DoUpdateWindowUI(event);
+ }
- if ( event.GetSetText() )
+ if (flags & wxUPDATE_UI_RECURSE)
+ {
+ wxWindowList::Node* node = GetChildren().GetFirst();
+ while (node)
{
- wxControl *control = wxDynamicCastThis(wxControl);
- if ( control )
- {
-#if wxUSE_TEXTCTRL
- wxTextCtrl *text = wxDynamicCast(control, wxTextCtrl);
- if ( text )
- {
- if ( event.GetText() != text->GetValue() )
- text->SetValue(event.GetText());
- }
- else
-#endif // wxUSE_TEXTCTRL
- {
- if ( event.GetText() != control->GetLabel() )
- control->SetLabel(event.GetText());
- }
- }
+ wxWindow* child = (wxWindow*) node->GetData();
+ child->UpdateWindowUI(flags);
+ node = node->GetNext();
}
+ }
+}
+// do the window-specific processing after processing the update event
+// TODO: take specific knowledge out of this function and
+// put in each control's base class. Unfortunately we don't
+// yet have base implementation files for wxCheckBox and wxRadioButton.
+void wxWindowBase::DoUpdateWindowUI(wxUpdateUIEvent& event)
+{
+ if ( event.GetSetEnabled() )
+ Enable(event.GetEnabled());
+
+#if wxUSE_CONTROLS
+ if ( event.GetSetText() )
+ {
+ wxControl *control = wxDynamicCastThis(wxControl);
+ if ( control )
+ {
+ if ( event.GetText() != control->GetLabel() )
+ control->SetLabel(event.GetText());
+ }
#if wxUSE_CHECKBOX
wxCheckBox *checkbox = wxDynamicCastThis(wxCheckBox);
if ( checkbox )
radiobtn->SetValue(event.GetChecked());
}
#endif // wxUSE_RADIOBTN
+ }
+#endif
+}
+
+// call internal idle recursively
+void wxWindowBase::ProcessInternalIdle()
+{
+ OnInternalIdle();
+
+ wxWindowList::Node *node = GetChildren().GetFirst();
+ while (node)
+ {
+ wxWindow *child = node->GetData();
+ child->ProcessInternalIdle();
+ node = node->GetNext();
}
-#endif // wxUSE_CONTROLS
}
// ----------------------------------------------------------------------------
}
}
-// the default action is to populate dialog with data when it's created
+// the default action is to populate dialog with data when it's created,
+// and nudge the UI into displaying itself correctly in case
+// we've turned the wxUpdateUIEvents frequency down low.
void wxWindowBase::OnInitDialog( wxInitDialogEvent &WXUNUSED(event) )
{
TransferDataToWindow();
+
+ // Update the UI at this point
+ UpdateWindowUI(wxUPDATE_UI_RECURSE);
}
// process Ctrl-Alt-mclick
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;
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();
}
}
- if (wxUpdateUIEvent::CanUpdate())
- UpdateWindowUI();
+ if (wxUpdateUIEvent::CanUpdate(this))
+ UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
}
wxSize wxCheckBox::DoGetBestSize() const
void wxFrame::OnInternalIdle()
{
- wxTopLevelWindow::OnInternalIdle();
+ wxFrameBase::OnInternalIdle();
#if wxUSE_MENUS_NATIVE
if (m_frameMenuBar) m_frameMenuBar->OnInternalIdle();
}
}
- if (wxUpdateUIEvent::CanUpdate())
- UpdateWindowUI();
+ if (wxUpdateUIEvent::CanUpdate(this))
+ UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
}
wxSize wxListBox::DoGetBestSize() const
}
}
- if (wxUpdateUIEvent::CanUpdate())
- UpdateWindowUI();
+ if (wxUpdateUIEvent::CanUpdate(this))
+ UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
}
wxSize wxRadioButton::DoGetBestSize() const
}
}
- if (wxUpdateUIEvent::CanUpdate())
- UpdateWindowUI();
+ if (wxUpdateUIEvent::CanUpdate(this))
+ UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
}
#endif // wxUSE_TOOLBAR_NATIVE
}
}
- if (wxUpdateUIEvent::CanUpdate())
- UpdateWindowUI();
+ if (wxUpdateUIEvent::CanUpdate(this))
+ UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
}
wxSize wxTextCtrl::DoGetBestSize() const
gdk_window_set_cursor(win, cursor.GetCursor());
}
- if (wxUpdateUIEvent::CanUpdate())
- UpdateWindowUI();
+ if (wxUpdateUIEvent::CanUpdate(this))
+ UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
}
// wxSize DoGetBestSize() const
}
}
- if (wxUpdateUIEvent::CanUpdate())
- UpdateWindowUI();
+ if (wxUpdateUIEvent::CanUpdate(this))
+ UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
}
void wxWindowGTK::DoGetSize( int *width, int *height ) const
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;
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();
}
}
- if (wxUpdateUIEvent::CanUpdate())
- UpdateWindowUI();
+ if (wxUpdateUIEvent::CanUpdate(this))
+ UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
}
wxSize wxCheckBox::DoGetBestSize() const
void wxFrame::OnInternalIdle()
{
- wxTopLevelWindow::OnInternalIdle();
+ wxFrameBase::OnInternalIdle();
#if wxUSE_MENUS_NATIVE
if (m_frameMenuBar) m_frameMenuBar->OnInternalIdle();
}
}
- if (wxUpdateUIEvent::CanUpdate())
- UpdateWindowUI();
+ if (wxUpdateUIEvent::CanUpdate(this))
+ UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
}
wxSize wxListBox::DoGetBestSize() const
}
}
- if (wxUpdateUIEvent::CanUpdate())
- UpdateWindowUI();
+ if (wxUpdateUIEvent::CanUpdate(this))
+ UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
}
wxSize wxRadioButton::DoGetBestSize() const
}
}
- if (wxUpdateUIEvent::CanUpdate())
- UpdateWindowUI();
+ if (wxUpdateUIEvent::CanUpdate(this))
+ UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
}
#endif // wxUSE_TOOLBAR_NATIVE
}
}
- if (wxUpdateUIEvent::CanUpdate())
- UpdateWindowUI();
+ if (wxUpdateUIEvent::CanUpdate(this))
+ UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
}
wxSize wxTextCtrl::DoGetBestSize() const
gdk_window_set_cursor(win, cursor.GetCursor());
}
- if (wxUpdateUIEvent::CanUpdate())
- UpdateWindowUI();
+ if (wxUpdateUIEvent::CanUpdate(this))
+ UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
}
// wxSize DoGetBestSize() const
}
}
- if (wxUpdateUIEvent::CanUpdate())
- UpdateWindowUI();
+ if (wxUpdateUIEvent::CanUpdate(this))
+ UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
}
void wxWindowGTK::DoGetSize( int *width, int *height ) const
return 0;
}
-// Returns TRUE if more time is needed.
-bool wxApp::ProcessIdle()
-{
- wxIdleEvent event;
- event.SetEventObject(this);
- ProcessEvent(event);
-
- wxUpdateUIEvent::ResetUpdateTime();
-
- return event.MoreRequested();
-}
-
void wxApp::ExitMainLoop()
{
m_keepGoing = FALSE;
#else
EventRecord event ;
- return EventAvail( everyEvent , &event ) ;
+ return EventAvail( everyEvent , &event ) ;
#endif
}
wxMacWakeUp() ;
}
-// Send idle event to all top-level windows
-bool wxApp::SendIdleEvents()
-{
- bool needMore = FALSE;
- wxWindowListNode* node = wxTopLevelWindows.GetFirst();
- while (node)
- {
- wxWindow* win = node->GetData();
- if (SendIdleEvents(win))
- needMore = TRUE;
-
- node = node->GetNext();
- }
- return needMore;
-}
-
-// Send idle event to window and all subwindows
-bool wxApp::SendIdleEvents(wxWindow* win)
-{
- bool needMore = FALSE;
-
- wxIdleEvent event;
- event.SetEventObject(win);
- win->ProcessEvent(event);
-
- if (event.MoreRequested())
- needMore = TRUE;
-
- wxWindowListNode* node = win->GetChildren().GetFirst();
- while (node)
- {
- wxWindow* win = node->GetData();
- if (SendIdleEvents(win))
- needMore = TRUE;
-
- node = node->GetNext();
- }
- return needMore ;
-}
-
void wxApp::Exit()
{
wxApp::CleanUp();
return 0;
}
-// Returns TRUE if more time is needed.
-bool wxApp::ProcessIdle()
-{
- wxIdleEvent event;
- event.SetEventObject(this);
- ProcessEvent(event);
-
- wxUpdateUIEvent::ResetUpdateTime();
-
- return event.MoreRequested();
-}
-
void wxApp::ExitMainLoop()
{
m_keepGoing = FALSE;
#else
EventRecord event ;
- return EventAvail( everyEvent , &event ) ;
+ return EventAvail( everyEvent , &event ) ;
#endif
}
wxMacWakeUp() ;
}
-// Send idle event to all top-level windows
-bool wxApp::SendIdleEvents()
-{
- bool needMore = FALSE;
- wxWindowListNode* node = wxTopLevelWindows.GetFirst();
- while (node)
- {
- wxWindow* win = node->GetData();
- if (SendIdleEvents(win))
- needMore = TRUE;
-
- node = node->GetNext();
- }
- return needMore;
-}
-
-// Send idle event to window and all subwindows
-bool wxApp::SendIdleEvents(wxWindow* win)
-{
- bool needMore = FALSE;
-
- wxIdleEvent event;
- event.SetEventObject(win);
- win->ProcessEvent(event);
-
- if (event.MoreRequested())
- needMore = TRUE;
-
- wxWindowListNode* node = win->GetChildren().GetFirst();
- while (node)
- {
- wxWindow* win = node->GetData();
- if (SendIdleEvents(win))
- needMore = TRUE;
-
- node = node->GetNext();
- }
- return needMore ;
-}
-
void wxApp::Exit()
{
wxApp::CleanUp();
EVT_ERASE_BACKGROUND(wxWindowMac::OnEraseBackground)
EVT_SYS_COLOUR_CHANGED(wxWindowMac::OnSysColourChanged)
EVT_INIT_DIALOG(wxWindowMac::OnInitDialog)
- EVT_IDLE(wxWindowMac::OnIdle)
EVT_SET_FOCUS(wxWindowMac::OnSetFocus)
EVT_MOUSE_EVENTS(wxWindowMac::OnMouseEvent)
END_EVENT_TABLE()
SetBackgroundColour(GetParent()->GetBackgroundColour());
}
-void wxWindowMac::OnIdle(wxIdleEvent& event)
+void wxWindowMac::OnInternalIdle()
{
// This calls the UI-update mechanism (querying windows for
// menu/toolbar/control state information)
- if (wxUpdateUIEvent::CanUpdate())
- UpdateWindowUI();
+ if (wxUpdateUIEvent::CanUpdate(this))
+ UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
}
// Raise the window to the top of the Z order
EVT_ERASE_BACKGROUND(wxWindowMac::OnEraseBackground)
EVT_SYS_COLOUR_CHANGED(wxWindowMac::OnSysColourChanged)
EVT_INIT_DIALOG(wxWindowMac::OnInitDialog)
- EVT_IDLE(wxWindowMac::OnIdle)
EVT_SET_FOCUS(wxWindowMac::OnSetFocus)
EVT_MOUSE_EVENTS(wxWindowMac::OnMouseEvent)
END_EVENT_TABLE()
SetBackgroundColour(GetParent()->GetBackgroundColour());
}
-void wxWindowMac::OnIdle(wxIdleEvent& event)
+void wxWindowMac::OnInternalIdle()
{
// This calls the UI-update mechanism (querying windows for
// menu/toolbar/control state information)
- if (wxUpdateUIEvent::CanUpdate())
- UpdateWindowUI();
+ if (wxUpdateUIEvent::CanUpdate(this))
+ UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
}
// Raise the window to the top of the Z order
return TRUE;
}
-bool wxApp::ProcessIdle()
-{
- wxIdleEvent event;
- event.SetEventObject(this);
- ProcessEvent(event);
-
- wxUpdateUIEvent::ResetUpdateTime();
-
- return event.MoreRequested();
-}
-
void wxApp::OnIdle(wxIdleEvent &event)
{
static bool s_inOnIdle = FALSE;
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::SendIdleEvents(wxWindow* win)
-{
- bool needMore = FALSE;
-
- wxIdleEvent event;
- event.SetEventObject(win);
-
- win->GetEventHandler()->ProcessEvent(event);
-
- if ( event.MoreRequested() )
- needMore = TRUE;
-
- wxNode* node = win->GetChildren().First();
- while (node)
- {
- wxWindow* win = (wxWindow*) node->Data();
- if ( SendIdleEvents(win) )
- needMore = TRUE;
-
- node = node->Next();
- }
- return needMore;
-}
-
int wxApp::MainLoop()
{
int rt;
bool wxEventLoopImpl::SendIdleEvent()
{
- wxIdleEvent event;
-
- bool processed = wxTheApp->ProcessEvent(event);
-
- wxUpdateUIEvent::ResetUpdateTime();
-
- return processed && event.MoreRequested();
+ return wxTheApp->ProcessIdle();
}
// ============================================================================
IMPLEMENT_ABSTRACT_CLASS(wxWindowMGL, wxWindowBase)
BEGIN_EVENT_TABLE(wxWindowMGL, wxWindowBase)
- EVT_IDLE(wxWindowMGL::OnIdle)
END_EVENT_TABLE()
// ===========================================================================
// idle events processing
// ---------------------------------------------------------------------------
-void wxWindowMGL::OnIdle(wxIdleEvent& WXUNUSED(event))
+void wxWindowMGL::OnInternalIdle()
{
- if (wxUpdateUIEvent::CanUpdate())
- UpdateWindowUI();
+ if (wxUpdateUIEvent::CanUpdate(this))
+ UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
}
return 0;
}
-// Processes an idle event.
-// Returns TRUE if more time is needed.
-bool wxApp::ProcessIdle()
-{
- wxIdleEvent event;
-
- bool processed = ProcessEvent(event);
-
- wxUpdateUIEvent::ResetUpdateTime();
-
- return processed && event.MoreRequested();
-}
-
void wxApp::ExitMainLoop()
{
if( m_eventLoop->IsRunning() )
inOnIdle = FALSE;
}
-// Send idle event to all top-level windows
-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;
-}
-
-// Send idle event to window and all subwindows
-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 ;
-}
-
static char *fallbackResources[] = {
"*menuBar.marginHeight: 0",
"*menuBar.shadowThickness: 1",
BEGIN_EVENT_TABLE(wxWindow, wxWindowBase)
EVT_SYS_COLOUR_CHANGED(wxWindow::OnSysColourChanged)
- EVT_IDLE(wxWindow::OnIdle)
END_EVENT_TABLE()
// ============================================================================
}
}
-void wxWindow::OnIdle(wxIdleEvent& WXUNUSED(event))
+void wxWindow::OnInternalIdle()
{
// This calls the UI-update mechanism (querying windows for
// menu/toolbar/control state information)
- if (wxUpdateUIEvent::CanUpdate())
- UpdateWindowUI();
+ if (wxUpdateUIEvent::CanUpdate(this))
+ UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
}
// ----------------------------------------------------------------------------
return s_currentMsg.wParam;
}
-// Returns TRUE if more time is needed.
-bool wxApp::ProcessIdle()
-{
- wxIdleEvent event;
- event.SetEventObject(this);
- ProcessEvent(event);
-
- wxUpdateUIEvent::ResetUpdateTime();
-
- return event.MoreRequested();
-}
-
void wxApp::ExitMainLoop()
{
// this will set m_keepGoing to FALSE a bit later
wxIsInOnIdleFlag = FALSE;
}
-// Send idle event to all top-level windows
-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;
-}
-
-// Send idle event to window and all subwindows
-bool wxApp::SendIdleEvents(wxWindow* win)
-{
- wxIdleEvent event;
- event.SetEventObject(win);
- win->GetEventHandler()->ProcessEvent(event);
-
- bool needMore = event.MoreRequested();
-
- wxWindowList::Node *node = win->GetChildren().GetFirst();
- while ( node )
- {
- wxWindow *win = node->GetData();
- if (SendIdleEvents(win))
- needMore = TRUE;
-
- node = node->GetNext();
- }
-
- return needMore;
-}
-
void wxApp::WakeUpIdle()
{
// Send the top window a dummy message so idle handler processing will
bool wxEventLoopImpl::SendIdleMessage()
{
- wxIdleEvent event;
-
- bool processed = wxTheApp->ProcessEvent(event) ;
-
- wxUpdateUIEvent::ResetUpdateTime();
-
- return processed && event.MoreRequested();
+ return wxTheApp->ProcessIdle();
}
// ============================================================================
void wxFrame::Raise()
{
-#ifdef __WIN16__
- // no SetForegroundWindow() in Win16
- wxFrameBase::Raise();
-#else // Win32
::SetForegroundWindow(GetHwnd());
-#endif // Win16/32
}
// generate an artificial resize event
}
break;
+ case WM_INITMENU:
+ processed = HandleInitMenu();
+ break;
+
case WM_PAINT:
processed = HandlePaint();
break;
processed = HandleMenuSelect(item, flags, hmenu);
}
break;
-
-#ifndef __WIN16__
+
+ // We don't need to send the wxEVT_MENU_OPEN
+ // when we get WM_ENTERMENULOOP now, because we send
+ // it when we get WM_INITMENU.
+#if 0
case WM_ENTERMENULOOP:
processed = HandleMenuLoop(wxEVT_MENU_OPEN, wParam);
break;
-
+#endif
case WM_EXITMENULOOP:
processed = HandleMenuLoop(wxEVT_MENU_CLOSE, wParam);
break;
-#endif // __WIN16__
case WM_QUERYDRAGICON:
{
return rc;
}
+// handle WM_INITMENU message
+bool wxFrame::HandleInitMenu()
+{
+ wxMenuEvent event(wxEVT_MENU_OPEN, 0);
+ event.SetEventObject(this);
+
+ return GetEventHandler()->ProcessEvent(event);
+
+ return TRUE;
+}
+
+
EVT_ERASE_BACKGROUND(wxWindowMSW::OnEraseBackground)
EVT_SYS_COLOUR_CHANGED(wxWindowMSW::OnSysColourChanged)
EVT_INIT_DIALOG(wxWindowMSW::OnInitDialog)
- EVT_IDLE(wxWindowMSW::OnIdle)
END_EVENT_TABLE()
// ===========================================================================
return hwnd != NULL;
}
-void wxWindowMSW::OnIdle(wxIdleEvent& WXUNUSED(event))
+void wxWindowMSW::OnInternalIdle()
{
// Check if we need to send a LEAVE event
if ( m_mouseInWindow )
m_mouseInWindow = FALSE;
// Unfortunately the mouse button and keyboard state may have
- // changed by the time the OnIdle function is called, so 'state'
+ // changed by the time the OnInternalIdle function is called, so 'state'
// may be meaningless.
int state = 0;
if ( wxIsShiftDown() )
}
}
- if (wxUpdateUIEvent::CanUpdate())
- UpdateWindowUI();
+ if (wxUpdateUIEvent::CanUpdate(this))
+ UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
}
// Set this window to be the child of 'parent'.
wxLogLastError(_T("UpdateWindow"));
}
-#if defined(__WIN32__) && !defined(__WXMICROWIN__)
+#if !defined(__WXMICROWIN__)
// just calling UpdateWindow() is not enough, what we did in our WM_PAINT
// handler needs to be really drawn right now
(void)::GdiFlush();
}
// ---------------------------------------------------------------------------
-// message params unpackers (different for Win16 and Win32)
+// message params unpackers
// ---------------------------------------------------------------------------
-#ifdef __WIN32__
-
void wxWindowMSW::UnpackCommand(WXWPARAM wParam, WXLPARAM lParam,
WORD *id, WXHWND *hwnd, WORD *cmd)
{
*hmenu = (WXHMENU)lParam;
}
-#else // Win16
-
-void wxWindowMSW::UnpackCommand(WXWPARAM wParam, WXLPARAM lParam,
- WXWORD *id, WXHWND *hwnd, WXWORD *cmd)
-{
- *id = (WXWORD)wParam;
- *hwnd = (WXHWND)LOWORD(lParam);
- *cmd = HIWORD(lParam);
-}
-
-void wxWindowMSW::UnpackActivate(WXWPARAM wParam, WXLPARAM lParam,
- WXWORD *state, WXWORD *minimized, WXHWND *hwnd)
-{
- *state = (WXWORD)wParam;
- *minimized = LOWORD(lParam);
- *hwnd = (WXHWND)HIWORD(lParam);
-}
-
-void wxWindowMSW::UnpackScroll(WXWPARAM wParam, WXLPARAM lParam,
- WXWORD *code, WXWORD *pos, WXHWND *hwnd)
-{
- *code = (WXWORD)wParam;
- *pos = LOWORD(lParam);
- *hwnd = (WXHWND)HIWORD(lParam);
-}
-
-void wxWindowMSW::UnpackCtlColor(WXWPARAM wParam, WXLPARAM lParam,
- WXWORD *nCtlColor, WXHDC *hdc, WXHWND *hwnd)
-{
- *hwnd = (WXHWND)LOWORD(lParam);
- *nCtlColor = (int)HIWORD(lParam);
- *hdc = (WXHDC)wParam;
-}
-
-void wxWindowMSW::UnpackMenuSelect(WXWPARAM wParam, WXLPARAM lParam,
- WXWORD *item, WXWORD *flags, WXHMENU *hmenu)
-{
- *item = (WXWORD)wParam;
- *flags = LOWORD(lParam);
- *hmenu = (WXHMENU)HIWORD(lParam);
-}
-
-#endif // Win32/16
-
// ---------------------------------------------------------------------------
// Main wxWindows window proc and the window proc for wxWindow
// ---------------------------------------------------------------------------
// CTLCOLOR messages are sent by children to query the parent for their
// colors#ifndef __WXMICROWIN__
#ifndef __WXMICROWIN__
-#ifdef __WIN32__
case WM_CTLCOLORMSGBOX:
case WM_CTLCOLOREDIT:
case WM_CTLCOLORLISTBOX:
case WM_CTLCOLORDLG:
case WM_CTLCOLORSCROLLBAR:
case WM_CTLCOLORSTATIC:
-#else // Win16
- case WM_CTLCOLOR:
-#endif // Win32/16
{
WXWORD nCtlColor;
WXHDC hdc;
}
#endif
-#if defined(__WIN32__) && defined(WM_HELP)
+#if defined(WM_HELP)
case WM_HELP:
{
HELPINFO* info = (HELPINFO*) lParam;
}
}
break;
-#endif // __WIN32__
+#endif
}
if ( !processed )
// first ask the user code - it may wish to set the cursor in some very
// specific way (for example, depending on the current position)
POINT pt;
-#ifdef __WIN32__
if ( !::GetCursorPos(&pt) )
{
wxLogLastError(wxT("GetCursorPos"));
}
-#else
- // In WIN16 it doesn't return a value.
- ::GetCursorPos(&pt);
-#endif
int x = pt.x,
y = pt.y;
// if (GetExtraStyle() & wxWS_EX_THEMED_BACKGROUND)
// return FALSE;
-#ifdef __WIN32__
HRGN hRegion = ::CreateRectRgn(0, 0, 0, 0); // Dummy call to get a handle
if ( !hRegion )
wxLogLastError(wxT("CreateRectRgn"));
wxLogLastError(wxT("GetUpdateRgn"));
m_updateRegion = wxRegion((WXHRGN) hRegion);
-#else // Win16
- RECT updateRect;
- ::GetUpdateRect(GetHwnd(), &updateRect, FALSE);
-
- m_updateRegion = wxRegion(updateRect.left, updateRect.top,
- updateRect.right - updateRect.left,
- updateRect.bottom - updateRect.top);
-#endif // Win32/16
wxPaintEvent event(m_windowId);
event.SetEventObject(this);
HWND hwnd = GetHwndOf(win),
hwndUnderMouse;
-#ifdef __WIN32__
hwndUnderMouse = ::ChildWindowFromPointEx
(
hwnd,
);
if ( !hwndUnderMouse || hwndUnderMouse == hwnd )
-#endif // __WIN32__
{
// now try any child window at all
hwndUnderMouse = ::ChildWindowFromPoint(hwnd, pt);
event.m_wheelRotation = (short)HIWORD(wParam);
event.m_wheelDelta = WHEEL_DELTA;
-#ifdef __WIN32__
static int s_linesPerRotation = -1;
if ( s_linesPerRotation == -1 )
{
s_linesPerRotation = 3;
}
}
-#else // Win16
- // no SystemParametersInfo() under Win16
- static const int s_linesPerRotation = 3;
-#endif
event.m_linesPerAction = s_linesPerRotation;
return GetEventHandler()->ProcessEvent(event);
return FALSE;
}
-#ifdef __WIN32__
-
int wxWindowMSW::HandleMenuChar(int chAccel, WXLPARAM lParam)
{
const HMENU hmenu = (HMENU)lParam;
}
}
}
- else // failed ot get the menu text?
+ else // failed to get the menu text?
{
// it's not fatal, so don't show error, but still log
// it
return wxNOT_FOUND;
}
-#endif // __WIN32__
-
// ---------------------------------------------------------------------------
// joystick
// ---------------------------------------------------------------------------
case SB_THUMBPOSITION:
case SB_THUMBTRACK:
-#ifdef __WIN32__
// under Win32, the scrollbar range and position are 32 bit integers,
// but WM_[HV]SCROLL only carry the low 16 bits of them, so we must
// explicitly query the scrollbar for the correct position (this must
event.SetPosition(scrollInfo.nTrackPos);
}
-#endif // Win32
event.m_eventType = wParam == SB_THUMBPOSITION
? wxEVT_SCROLLWIN_THUMBRELEASE
win = wxFindWinFromHandle((WXHWND)hwnd);
if ( !win )
{
- // all these hacks only work under Win32 anyhow
-#ifdef __WIN32__
-
#if wxUSE_RADIOBOX
// native radiobuttons return DLGC_RADIOBUTTON here and for any
// wxWindow class which overrides WM_GETDLGCODE processing to
win = wxSpinCtrl::GetSpinForTextCtrl((WXHWND)hwnd);
}
#endif // wxUSE_SPINCTRL
-
-#endif // Win32
}
}
wxTheKeyboardHookProc = MakeProcInstance((FARPROC) wxKeyboardHook, wxGetInstance());
wxTheKeyboardHook = SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC) wxTheKeyboardHookProc, wxGetInstance(),
-#if defined(__WIN32__)
GetCurrentThreadId()
// (DWORD)GetCurrentProcess()); // This is another possibility. Which is right?
-#else
- GetCurrentTask()
-#endif
);
}
else
{
UnhookWindowsHookEx(wxTheKeyboardHook);
-
- // avoids warning about statement with no effect (FreeProcInstance
- // doesn't do anything under Win32)
-#if !defined(__WIN32__) && !defined(__NT__)
- FreeProcInstance(wxTheKeyboardHookProc);
-#endif
}
}
case 0x0047: return "WM_WINDOWPOSCHANGED";
case 0x0048: return "WM_POWER";
-#ifdef __WIN32__
case 0x004A: return "WM_COPYDATA";
case 0x004B: return "WM_CANCELJOURNAL";
case 0x004E: return "WM_NOTIFY";
case 0x007E: return "WM_DISPLAYCHANGE";
case 0x007F: return "WM_GETICON";
case 0x0080: return "WM_SETICON";
-#endif //WIN32
case 0x0081: return "WM_NCCREATE";
case 0x0082: return "WM_NCDESTROY";
case 0x0107: return "WM_SYSDEADCHAR";
case 0x0108: return "WM_KEYLAST";
-#ifdef __WIN32__
case 0x010D: return "WM_IME_STARTCOMPOSITION";
case 0x010E: return "WM_IME_ENDCOMPOSITION";
case 0x010F: return "WM_IME_COMPOSITION";
-#endif //WIN32
case 0x0110: return "WM_INITDIALOG";
case 0x0111: return "WM_COMMAND";
case 0x0211: return "WM_ENTERMENULOOP";
case 0x0212: return "WM_EXITMENULOOP";
-#ifdef __WIN32__
case 0x0213: return "WM_NEXTMENU";
case 0x0214: return "WM_SIZING";
case 0x0215: return "WM_CAPTURECHANGED";
case 0x0216: return "WM_MOVING";
case 0x0218: return "WM_POWERBROADCAST";
case 0x0219: return "WM_DEVICECHANGE";
-#endif //WIN32
case 0x0220: return "WM_MDICREATE";
case 0x0221: return "WM_MDIDESTROY";
case 0x0230: return "WM_MDISETMENU";
case 0x0233: return "WM_DROPFILES";
-#ifdef __WIN32__
case 0x0281: return "WM_IME_SETCONTEXT";
case 0x0282: return "WM_IME_NOTIFY";
case 0x0283: return "WM_IME_CONTROL";
case 0x0286: return "WM_IME_CHAR";
case 0x0290: return "WM_IME_KEYDOWN";
case 0x0291: return "WM_IME_KEYUP";
-#endif //WIN32
case 0x0300: return "WM_CUT";
case 0x0301: return "WM_COPY";
case 0x0310: return "WM_PALETTEISCHANGING";
case 0x0311: return "WM_PALETTECHANGED";
-#ifdef __WIN32__
// common controls messages - although they're not strictly speaking
// standard, it's nice to decode them nevertheless
case WM_USER+61: return "TB_GETTEXTROWS";
case WM_USER+41: return "TB_GETBITMAPFLAGS";
-#endif //WIN32
-
default:
static char s_szBuf[128];
sprintf(s_szBuf, "<unknown message = %d>", message);
return (int)svCurrentMsg.mp1;
} // end of wxApp::MainLoop
-//
-// Returns TRUE if more time is needed.
-//
-bool wxApp::ProcessIdle()
-{
- wxIdleEvent vEvent;
-
- vEvent.SetEventObject(this);
- ProcessEvent(vEvent);
- wxUpdateUIEvent::ResetUpdateTime();
- return vEvent.MoreRequested();
-} // end of wxApp::ProcessIdle
-
void wxApp::ExitMainLoop()
{
::WinPostMsg(NULL, WM_QUIT, 0, 0);
gbInOnIdle = FALSE;
} // end of wxApp::OnIdle
-// Send idle event to all top-level windows
-bool wxApp::SendIdleEvents()
-{
- bool bNeedMore = FALSE;
- wxWindowList::Node* pNode = wxTopLevelWindows.GetFirst();
-
- while (pNode)
- {
- wxWindow* pWin = pNode->GetData();
-
- if (SendIdleEvents(pWin))
- bNeedMore = TRUE;
- pNode = pNode->GetNext();
- }
- return bNeedMore;
-} // end of wxApp::SendIdleEvents
-
-//
-// Send idle event to window and all subwindows
-//
-bool wxApp::SendIdleEvents(
- wxWindow* pWin
-)
-{
- bool bNeedMore = FALSE;
- wxIdleEvent vEvent;
-
- vEvent.SetEventObject(pWin);
- pWin->GetEventHandler()->ProcessEvent(vEvent);
-
- if (vEvent.MoreRequested())
- bNeedMore = TRUE;
-
- wxNode* pNode = pWin->GetChildren().First();
-
- while (pNode)
- {
- wxWindow* pWin = (wxWindow*) pNode->Data();
-
- if (SendIdleEvents(pWin))
- bNeedMore = TRUE;
- pNode = pNode->Next();
- }
- return bNeedMore;
-} // end of wxApp::SendIdleEvents
-
void wxApp::OnEndSession(
wxCloseEvent& WXUNUSED(rEvent))
{
bool wxEventLoopImpl::SendIdleMessage()
{
- wxIdleEvent event;
-
- bool processed = wxTheApp->ProcessEvent(event) ;
-
- wxUpdateUIEvent::ResetUpdateTime();
-
- return processed && event.MoreRequested();
+ return wxTheApp->ProcessIdle() ;
}
// ============================================================================
(void)GetEventHandler()->ProcessEvent(rEvent);
}
}
- if (wxUpdateUIEvent::CanUpdate())
- UpdateWindowUI();
+ if (wxUpdateUIEvent::CanUpdate(this))
+ UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
} // end of wxWindowOS2::OnIdle
//
BEGIN_EVENT_TABLE(wxListBox, wxListBoxBase)
EVT_SIZE(wxListBox::OnSize)
-
- EVT_IDLE(wxListBox::OnIdle)
END_EVENT_TABLE()
// ----------------------------------------------------------------------------
}
}
-void wxListBox::OnIdle(wxIdleEvent& event)
+void wxListBox::OnInternalIdle()
{
if ( m_updateScrollbarY || m_updateScrollbarX )
{
m_updateCount = 0;
}
-
- event.Skip();
}
// ----------------------------------------------------------------------------
wxLog::FlushActive();
// some controls update themselves from OnIdle() call - let them do it
- wxIdleEvent event;
- wxTheApp->ProcessEvent(event);
+ wxTheApp->ProcessIdle();
// if the window hadn't been refreshed yet, the menu can adversely affect
// its next OnPaint() handler execution - i.e. scrolled window refresh
IMPLEMENT_DYNAMIC_CLASS(wxScrollBar, wxControl)
BEGIN_EVENT_TABLE(wxScrollBar, wxScrollBarBase)
- EVT_IDLE(wxScrollBar::OnIdle)
END_EVENT_TABLE()
// ----------------------------------------------------------------------------
// drawing
// ----------------------------------------------------------------------------
-void wxScrollBar::OnIdle(wxIdleEvent& event)
+void wxScrollBar::OnInternalIdle()
{
UpdateThumb();
- event.Skip();
}
void wxScrollBar::UpdateThumb()
EVT_CHAR(wxTextCtrl::OnChar)
EVT_SIZE(wxTextCtrl::OnSize)
-
- EVT_IDLE(wxTextCtrl::OnIdle)
END_EVENT_TABLE()
IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl, wxControl)
MData().m_updateScrollbarY = FALSE;
}
-void wxTextCtrl::OnIdle(wxIdleEvent& event)
+void wxTextCtrl::OnInternalIdle()
{
// notice that single line text control never has scrollbars
if ( !IsSingleLine() &&
{
UpdateScrollbars();
}
-
- event.Skip();
}
bool wxTextCtrl::SendAutoScrollEvents(wxScrollWinEvent& event) const
return FALSE;
}
-// Returns TRUE if more time is needed.
-// Note that this duplicates wxEventLoopImpl::SendIdleEvent
-// but ProcessIdle may be needed by apps, so is kept.
-bool wxApp::ProcessIdle()
-{
- wxIdleEvent event;
- event.SetEventObject(this);
- ProcessEvent(event);
-
- wxUpdateUIEvent::ResetUpdateTime();
-
- return event.MoreRequested();
-}
-
void wxApp::ExitMainLoop()
{
if (m_mainLoop)
}
-// Send idle event to all top-level windows
-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;
-}
-
-// Send idle event to window and all subwindows
-bool wxApp::SendIdleEvents(wxWindow* win)
-{
- bool needMore = FALSE;
-
- wxIdleEvent event;
- event.SetEventObject(win);
-
- win->GetEventHandler()->ProcessEvent(event);
-
- if (event.MoreRequested())
- needMore = TRUE;
-
- wxWindowListNode* node = win->GetChildren().GetFirst();
- while (node)
- {
- wxWindow* win = (wxWindow*) node->GetData();
- if (SendIdleEvents(win))
- needMore = TRUE;
-
- node = node->GetNext();
- }
-
- win->OnInternalIdle();
-
- return needMore;
-}
-
// Create display, and other initialization
bool wxApp::OnInitGui()
{
bool wxEventLoopImpl::SendIdleEvent()
{
- wxIdleEvent event;
- event.SetEventObject(wxTheApp);
-
- bool processed = wxTheApp->ProcessEvent(event) ;
-
- wxUpdateUIEvent::ResetUpdateTime();
-
- return processed && event.MoreRequested();
+ return wxTheApp->ProcessIdle();
}
// ============================================================================
EVT_ERASE_BACKGROUND(wxTextCtrl::OnEraseBackground)
EVT_CHAR(wxTextCtrl::OnChar)
EVT_MOUSE_EVENTS(wxTextCtrl::OnMouse)
- EVT_IDLE(wxTextCtrl::OnIdle)
EVT_KILL_FOCUS(wxTextCtrl::OnKillFocus)
EVT_SET_FOCUS(wxTextCtrl::OnSetFocus)
event.Skip();
}
-void wxTextCtrl::OnIdle( wxIdleEvent &event )
+void wxTextCtrl::OnInternalIdle()
{
m_ignoreInput = FALSE;
if (m_lang != wxSOURCE_LANG_NONE)
SearchForBrackets();
-
- event.Skip( TRUE );
}
void wxTextCtrl::Indent()
// This calls the UI-update mechanism (querying windows for
// menu/toolbar/control state information)
- if (wxUpdateUIEvent::CanUpdate())
- UpdateWindowUI();
+ if (wxUpdateUIEvent::CanUpdate(this))
+ UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
// Set the input focus if couldn't do it before
if (m_needsInputFocus)