]> git.saurik.com Git - wxWidgets.git/commitdiff
Resize all top level windows when SIP changes visibility.
authorWłodzimierz Skiba <abx@abx.art.pl>
Sun, 13 Nov 2005 11:46:24 +0000 (11:46 +0000)
committerWłodzimierz Skiba <abx@abx.art.pl>
Sun, 13 Nov 2005 11:46:24 +0000 (11:46 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36162 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
docs/latex/wx/tlw.tex
docs/latex/wx/wxmsw.tex
include/wx/msw/frame.h
include/wx/msw/toplevel.h
src/msw/frame.cpp
src/msw/toplevel.cpp

index dd3f96241233f49e0582629396530d7e95289104..2eb8dec21323838fea768ef09db786bbf0b9f80e 100644 (file)
@@ -42,6 +42,7 @@ wxWinCE:
 
 - Pressing build-in joystick on WinCE phones fires wxEVT_JOY_BUTTON_DOWN event.
 - Native wxCheckListBox implementation.
+- All wxTopLevelWindows resizes accordingly to SIP visibility.
 
 Unix:
 
index c4e0534a30a51c627749d15e478a391cb4caa890..6224124362343b68844cdb6b423b154a0839c736 100644 (file)
@@ -69,6 +69,15 @@ Gets a string containing the window title.
 \helpref{wxTopLevelWindow::SetTitle}{wxtoplevelwindowsettitle}
 
 
+\membersection{wxTopLevelWindow::HandleSettingChange}\label{wxtoplevelwindowhandlesettingchange}
+
+\func{virtual bool}{HandleSettingChange}{\param{WXWPARAM}{ wParam}, \param{WXLPARAM}{ lParam}}
+
+Unique to the wxWinCE port. Responds to showing/hiding SIP (soft input panel) area and resize
+accordingly window accordingly. Override this if you want to avoid resinzing or do additional
+operations.
+
+
 \membersection{wxTopLevelWindow::IsActive}\label{wxtoplevelwindowisactive}
 
 \constfunc{bool}{IsActive}{\void}
index a8689ef7e48c2d7cc3c4ba39d5ccec67bde24bf6..933b94bf43b9def075cc1cef25de926f0f00dc25 100644 (file)
@@ -117,8 +117,8 @@ that will do the right thing on each platform.)
 If the screen orientation changes, the windows will automatically be resized
 so no further action needs to be taken (unless you want to change the layout
 according to the orientation, which you could detect in idle time, for example).
-However, if the input panel (SIP) is shown, windows do not yet resize accordingly. This will
-be implemented soon.
+When input panel (SIP) is shown, top level windows (frames and dialogs) resize
+accordingly (see \helpref{wxTopLevelWindow::HandleSettingChange}{wxtoplevelwindowhandlesettingchange}).
 
 \subsubsection{Closing top-level windows in wxWinCE}
 
index c90c105978f9e7688e2fd574791f8423fb31a42a..10c17972d5124f01e261be4dc529bdae29c9c105 100644 (file)
@@ -18,12 +18,12 @@ public:
     // construction
     wxFrame() { Init(); }
     wxFrame(wxWindow *parent,
-               wxWindowID id,
-               const wxString& title,
-               const wxPoint& pos = wxDefaultPosition,
-               const wxSize& size = wxDefaultSize,
-               long style = wxDEFAULT_FRAME_STYLE,
-               const wxString& name = wxFrameNameStr)
+            wxWindowID id,
+            const wxString& title,
+            const wxPoint& pos = wxDefaultPosition,
+            const wxSize& size = wxDefaultSize,
+            long style = wxDEFAULT_FRAME_STYLE,
+            const wxString& name = wxFrameNameStr)
     {
         Init();
 
@@ -149,9 +149,6 @@ private:
 #if wxUSE_TOOLTIPS
     WXHWND                m_hwndToolTip;
 #endif // tooltips
-#if defined(__SMARTPHONE__) || defined(__POCKETPC__)
-    void* m_activateInfo;
-#endif
 
     // used by IconizeChildFrames(), see comments there
     bool m_wasMinimized;
index 8e28a4bbabb2f0c933ae1846a8031c309b0dfe56..56c99693b46476458b460320183f811c97923a92 100644 (file)
@@ -86,6 +86,11 @@ public:
     bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
 #endif // __SMARTPHONE__ && __WXWINCE__
 
+#if defined(__SMARTPHONE__) || defined(__POCKETPC__)
+    // Soft Input Panel (SIP) change notification
+    virtual bool HandleSettingChange(WXWPARAM wParam, WXLPARAM lParam);
+#endif
+
 protected:
     // common part of all ctors
     void Init();
@@ -111,6 +116,9 @@ protected:
     // choose the right parent to use with CreateWindow()
     virtual WXHWND MSWGetParent() const;
 
+    // window proc for the frames
+    WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
+
     // is the window currently iconized?
     bool m_iconized;
 
@@ -163,6 +171,12 @@ protected:
     void ReloadAllButtons();
 #endif // __SMARTPHONE__ && __WXWINCE__
 
+private:
+
+#if defined(__SMARTPHONE__) || defined(__POCKETPC__)
+    void* m_activateInfo;
+#endif
+
     DECLARE_EVENT_TABLE()
     DECLARE_NO_COPY_CLASS(wxTopLevelWindowMSW)
 };
index 69248ea9d65533de07eec3788de80e9979f30c4c..1f6b31bce7f025a8d3f79e4531e9e67c04c9166b 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        msw/frame.cpp
+// Name:        src/msw/frame.cpp
 // Purpose:     wxFrame
 // Author:      Julian Smart
 // Modified by:
@@ -179,14 +179,6 @@ void wxFrame::Init()
     m_hwndToolTip = 0;
 #endif
 
-#if defined(__SMARTPHONE__) || defined(__POCKETPC__)
-    SHACTIVATEINFO* info = new SHACTIVATEINFO;
-    memset(info, 0, sizeof(SHACTIVATEINFO));
-    info->cbSize = sizeof(SHACTIVATEINFO);
-
-    m_activateInfo = (void*) info;
-#endif
-
     m_wasMinimized = false;
 }
 
@@ -223,12 +215,6 @@ wxFrame::~wxFrame()
 {
     m_isBeingDeleted = true;
     DeleteAllBars();
-
-#if defined(__SMARTPHONE__) || defined(__POCKETPC__)
-    SHACTIVATEINFO* info = (SHACTIVATEINFO*) m_activateInfo;
-    delete info;
-    m_activateInfo = NULL;
-#endif
 }
 
 // ----------------------------------------------------------------------------
@@ -967,39 +953,6 @@ WXLRESULT wxFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lPara
 
     switch ( message )
     {
-#if defined(__SMARTPHONE__) || defined(__POCKETPC__)
-        case WM_ACTIVATE:
-        {
-            SHACTIVATEINFO* info = (SHACTIVATEINFO*) m_activateInfo;
-            if (info)
-                SHHandleWMActivate(GetHwnd(), wParam, lParam, info, FALSE);
-
-            // This implicitly sends a wxEVT_ACTIVATE_APP event
-            if (wxTheApp)
-                wxTheApp->SetActive(wParam != 0, FindFocus());
-            break;
-        }
-        case WM_SETTINGCHANGE:
-        {
-            SHACTIVATEINFO* info = (SHACTIVATEINFO*) m_activateInfo;
-            if (info)
-                SHHandleWMSettingChange(GetHwnd(), wParam, lParam, info);
-            processed = true;
-            break;
-        }
-        case WM_HIBERNATE:
-        {
-            wxActivateEvent event(wxEVT_HIBERNATE, true, wxID_ANY);
-            event.SetEventObject(wxTheApp);
-
-            if (wxTheApp)
-            {
-                processed = wxTheApp->ProcessEvent(event);
-            }
-            break;
-        }
-#endif
-
         case WM_CLOSE:
             // if we can't close, tell the system that we processed the
             // message - otherwise it would close us
index f1dfb54d5ca490772df3a9877a2b5b5d877fe38b..e5e40c269c39f916bcccc518a3f48df8deeaf94f 100644 (file)
@@ -144,6 +144,14 @@ void wxTopLevelWindowMSW::Init()
 #if defined(__SMARTPHONE__) && defined(__WXWINCE__)
     m_MenuBarHWND = 0;
 #endif
+
+#if defined(__SMARTPHONE__) || defined(__POCKETPC__)
+    SHACTIVATEINFO* info = new SHACTIVATEINFO;
+    wxZeroMemory(*info);
+    info->cbSize = sizeof(SHACTIVATEINFO);
+
+    m_activateInfo = (void*) info;
+#endif
 }
 
 WXDWORD wxTopLevelWindowMSW::MSWGetStyle(long style, WXDWORD *exflags) const
@@ -304,6 +312,61 @@ WXHWND wxTopLevelWindowMSW::MSWGetParent() const
     return (WXHWND)hwndParent;
 }
 
+bool wxTopLevelWindowMSW::HandleSettingChange(WXWPARAM wParam, WXLPARAM lParam)
+{
+    SHACTIVATEINFO* info = (SHACTIVATEINFO*) m_activateInfo;
+    if (!info) return false;
+    return SHHandleWMSettingChange(GetHwnd(), wParam, lParam, info) == TRUE;
+}
+
+WXLRESULT wxTopLevelWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
+{
+    WXLRESULT rc = 0;
+    bool processed = false;
+
+    switch ( message )
+    {
+#if defined(__SMARTPHONE__) || defined(__POCKETPC__)
+        case WM_ACTIVATE:
+        {
+            SHACTIVATEINFO* info = (SHACTIVATEINFO*) m_activateInfo;
+            if (info)
+            {
+                DWORD flags = 0;
+                if (GetExtraStyle() & wxTOPLEVEL_EX_DIALOG) flags = SHA_INPUTDIALOG;
+                SHHandleWMActivate(GetHwnd(), wParam, lParam, info, flags);
+            }
+
+            // This implicitly sends a wxEVT_ACTIVATE_APP event
+            if (wxTheApp)
+                wxTheApp->SetActive(wParam != 0, FindFocus());
+
+            break;
+        }
+        case WM_SETTINGCHANGE:
+        {
+            processed = HandleSettingChange(wParam,lParam);
+            break;
+        }
+        case WM_HIBERNATE:
+        {
+            if (wxTheApp)
+            {
+                wxActivateEvent event(wxEVT_HIBERNATE, true, wxID_ANY);
+                event.SetEventObject(wxTheApp);
+                processed = wxTheApp->ProcessEvent(event);
+            }
+            break;
+        }
+#endif
+    }
+
+    if ( !processed )
+        rc = wxTopLevelWindowBase::MSWWindowProc(message, wParam, lParam);
+
+    return rc;
+}
+
 bool wxTopLevelWindowMSW::CreateDialog(const void *dlgTemplate,
                                        const wxString& title,
                                        const wxPoint& pos,
@@ -550,6 +613,12 @@ bool wxTopLevelWindowMSW::Create(wxWindow *parent,
 
 wxTopLevelWindowMSW::~wxTopLevelWindowMSW()
 {
+#if defined(__SMARTPHONE__) || defined(__POCKETPC__)
+    SHACTIVATEINFO* info = (SHACTIVATEINFO*) m_activateInfo;
+    delete info;
+    m_activateInfo = NULL;
+#endif
+
     // after destroying an owned window, Windows activates the next top level
     // window in Z order but it may be different from our owner (to reproduce
     // this simply Alt-TAB to another application and back before closing the
@@ -1019,40 +1088,51 @@ void wxTopLevelWindowMSW::OnActivate(wxActivateEvent& event)
 LONG APIENTRY _EXPORT
 wxDlgProc(HWND hDlg,
           UINT message,
-          WPARAM WXUNUSED(wParam),
-          LPARAM WXUNUSED(lParam))
+          WPARAM wParam,
+          LPARAM lParam)
 {
-    if ( message == WM_INITDIALOG )
+    switch ( message )
     {
-        // under CE, add a "Ok" button in the dialog title bar and make it full
-        // screen
-        //
-        // TODO: find the window for this HWND, and take into account
-        // wxMAXIMIZE and wxCLOSE_BOX. For now, assume both are present.
-        //
-        // Standard SDK doesn't have aygshell.dll: see
-        // include/wx/msw/wince/libraries.h
+        case WM_INITDIALOG:
+        {
+            // under CE, add a "Ok" button in the dialog title bar and make it full
+            // screen
+            //
+            // TODO: find the window for this HWND, and take into account
+            // wxMAXIMIZE and wxCLOSE_BOX. For now, assume both are present.
+            //
+            // Standard SDK doesn't have aygshell.dll: see
+            // include/wx/msw/wince/libraries.h
 #if defined(__WXWINCE__) && !defined(__WINCE_STANDARDSDK__) && !defined(__HANDHELDPC__)
-        SHINITDLGINFO shidi;
-        shidi.dwMask = SHIDIM_FLAGS;
-        shidi.dwFlags = SHIDIF_SIZEDLG // take account of the SIP or menubar
+            SHINITDLGINFO shidi;
+            shidi.dwMask = SHIDIM_FLAGS;
+            shidi.dwFlags = SHIDIF_SIZEDLG // take account of the SIP or menubar
 #ifndef __SMARTPHONE__
-                        | SHIDIF_DONEBUTTON
+                            | SHIDIF_DONEBUTTON
 #endif
                         ;
-        shidi.hDlg = hDlg;
-        SHInitDialog( &shidi );
+            shidi.hDlg = hDlg;
+            SHInitDialog( &shidi );
 #else // no SHInitDialog()
-        wxUnusedVar(hDlg);
+            wxUnusedVar(hDlg);
+#endif
+            // for WM_INITDIALOG, returning TRUE tells system to set focus to
+            // the first control in the dialog box, but as we set the focus
+            // ourselves, we return FALSE for it as well
+            return FALSE;
+        }
+
+#if defined(__SMARTPHONE__) || defined(__POCKETPC__)
+        case WM_SETTINGCHANGE:
+        {
+            wxTopLevelWindow *tlw = wxDynamicCast(wxGetWindowFromHWND(hDlg), wxTopLevelWindow);
+            if(tlw) return tlw->HandleSettingChange(wParam,lParam) ? TRUE : FALSE;
+        }
 #endif
     }
 
     // for almost all messages, returning FALSE means that we didn't process
     // the message
-    //
-    // for WM_INITDIALOG, returning TRUE tells system to set focus to
-    // the first control in the dialog box, but as we set the focus
-    // ourselves, we return FALSE for it as well
     return FALSE;
 }