+// Not tested under WinCE
+#ifndef __WXWINCE__
+
+// this class installs a message hook which really wakes up our idle processing
+// each time a WM_NULL is received (wxWakeUpIdle does this), even if we're
+// sitting inside a local modal loop (e.g. a menu is opened or scrollbar is
+// being dragged or even inside ::MessageBox()) and so don't control message
+// dispatching otherwise
+class wxIdleWakeUpModule : public wxModule
+{
+public:
+ virtual bool OnInit()
+ {
+ ms_hMsgHookProc = ::SetWindowsHookEx
+ (
+ WH_GETMESSAGE,
+ &wxIdleWakeUpModule::MsgHookProc,
+ NULL,
+ GetCurrentThreadId()
+ );
+
+ if ( !ms_hMsgHookProc )
+ {
+ wxLogLastError(_T("SetWindowsHookEx(WH_GETMESSAGE)"));
+
+ return false;
+ }
+
+ return true;
+ }
+
+ virtual void OnExit()
+ {
+ ::UnhookWindowsHookEx(wxIdleWakeUpModule::ms_hMsgHookProc);
+ }
+
+ static LRESULT CALLBACK MsgHookProc(int nCode, WPARAM wParam, LPARAM lParam)
+ {
+ MSG *msg = (MSG*)lParam;
+ if ( msg->message == WM_NULL )
+ {
+ wxTheApp->ProcessPendingEvents();
+ }
+
+ return CallNextHookEx(ms_hMsgHookProc, nCode, wParam, lParam);
+ };
+
+private:
+ static HHOOK ms_hMsgHookProc;
+
+ DECLARE_DYNAMIC_CLASS(wxIdleWakeUpModule)
+};
+
+HHOOK wxIdleWakeUpModule::ms_hMsgHookProc = 0;
+
+IMPLEMENT_DYNAMIC_CLASS(wxIdleWakeUpModule, wxModule)
+
+#endif // __WXWINCE__
+
+#ifdef __WXWINCE__
+
+#if wxUSE_STATBOX
+static void wxAdjustZOrder(wxWindow* parent)
+{
+ if (parent->IsKindOf(CLASSINFO(wxStaticBox)))
+ {
+ // Set the z-order correctly
+ SetWindowPos((HWND) parent->GetHWND(), HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
+ }
+
+ wxWindowList::compatibility_iterator current = parent->GetChildren().GetFirst();
+ while (current)
+ {
+ wxWindow *childWin = current->GetData();
+ wxAdjustZOrder(childWin);
+ current = current->GetNext();
+ }
+}
+#endif
+
+// We need to adjust the z-order of static boxes in WinCE, to
+// make 'contained' controls visible
+void wxWindowMSW::OnInitDialog( wxInitDialogEvent& event )
+{
+#if wxUSE_STATBOX
+ wxAdjustZOrder(this);
+#endif
+
+ event.Skip();
+}
+#endif
+