Resize all top level windows when SIP changes visibility.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36162 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2005-11-13 11:46:24 +00:00
parent 6fa30495b5
commit 08b9726806
7 changed files with 135 additions and 81 deletions

View File

@@ -42,6 +42,7 @@ wxWinCE:
- Pressing build-in joystick on WinCE phones fires wxEVT_JOY_BUTTON_DOWN event. - Pressing build-in joystick on WinCE phones fires wxEVT_JOY_BUTTON_DOWN event.
- Native wxCheckListBox implementation. - Native wxCheckListBox implementation.
- All wxTopLevelWindows resizes accordingly to SIP visibility.
Unix: Unix:

View File

@@ -69,6 +69,15 @@ Gets a string containing the window title.
\helpref{wxTopLevelWindow::SetTitle}{wxtoplevelwindowsettitle} \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} \membersection{wxTopLevelWindow::IsActive}\label{wxtoplevelwindowisactive}
\constfunc{bool}{IsActive}{\void} \constfunc{bool}{IsActive}{\void}

View 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 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 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). 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 When input panel (SIP) is shown, top level windows (frames and dialogs) resize
be implemented soon. accordingly (see \helpref{wxTopLevelWindow::HandleSettingChange}{wxtoplevelwindowhandlesettingchange}).
\subsubsection{Closing top-level windows in wxWinCE} \subsubsection{Closing top-level windows in wxWinCE}

View File

@@ -18,12 +18,12 @@ public:
// construction // construction
wxFrame() { Init(); } wxFrame() { Init(); }
wxFrame(wxWindow *parent, wxFrame(wxWindow *parent,
wxWindowID id, wxWindowID id,
const wxString& title, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE, long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxFrameNameStr) const wxString& name = wxFrameNameStr)
{ {
Init(); Init();
@@ -149,9 +149,6 @@ private:
#if wxUSE_TOOLTIPS #if wxUSE_TOOLTIPS
WXHWND m_hwndToolTip; WXHWND m_hwndToolTip;
#endif // tooltips #endif // tooltips
#if defined(__SMARTPHONE__) || defined(__POCKETPC__)
void* m_activateInfo;
#endif
// used by IconizeChildFrames(), see comments there // used by IconizeChildFrames(), see comments there
bool m_wasMinimized; bool m_wasMinimized;

View File

@@ -86,6 +86,11 @@ public:
bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control); bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
#endif // __SMARTPHONE__ && __WXWINCE__ #endif // __SMARTPHONE__ && __WXWINCE__
#if defined(__SMARTPHONE__) || defined(__POCKETPC__)
// Soft Input Panel (SIP) change notification
virtual bool HandleSettingChange(WXWPARAM wParam, WXLPARAM lParam);
#endif
protected: protected:
// common part of all ctors // common part of all ctors
void Init(); void Init();
@@ -111,6 +116,9 @@ protected:
// choose the right parent to use with CreateWindow() // choose the right parent to use with CreateWindow()
virtual WXHWND MSWGetParent() const; virtual WXHWND MSWGetParent() const;
// window proc for the frames
WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
// is the window currently iconized? // is the window currently iconized?
bool m_iconized; bool m_iconized;
@@ -163,6 +171,12 @@ protected:
void ReloadAllButtons(); void ReloadAllButtons();
#endif // __SMARTPHONE__ && __WXWINCE__ #endif // __SMARTPHONE__ && __WXWINCE__
private:
#if defined(__SMARTPHONE__) || defined(__POCKETPC__)
void* m_activateInfo;
#endif
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
DECLARE_NO_COPY_CLASS(wxTopLevelWindowMSW) DECLARE_NO_COPY_CLASS(wxTopLevelWindowMSW)
}; };

View File

@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: msw/frame.cpp // Name: src/msw/frame.cpp
// Purpose: wxFrame // Purpose: wxFrame
// Author: Julian Smart // Author: Julian Smart
// Modified by: // Modified by:
@@ -179,14 +179,6 @@ void wxFrame::Init()
m_hwndToolTip = 0; m_hwndToolTip = 0;
#endif #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; m_wasMinimized = false;
} }
@@ -223,12 +215,6 @@ wxFrame::~wxFrame()
{ {
m_isBeingDeleted = true; m_isBeingDeleted = true;
DeleteAllBars(); 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 ) 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: case WM_CLOSE:
// if we can't close, tell the system that we processed the // if we can't close, tell the system that we processed the
// message - otherwise it would close us // message - otherwise it would close us

View File

@@ -144,6 +144,14 @@ void wxTopLevelWindowMSW::Init()
#if defined(__SMARTPHONE__) && defined(__WXWINCE__) #if defined(__SMARTPHONE__) && defined(__WXWINCE__)
m_MenuBarHWND = 0; m_MenuBarHWND = 0;
#endif #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 WXDWORD wxTopLevelWindowMSW::MSWGetStyle(long style, WXDWORD *exflags) const
@@ -304,6 +312,61 @@ WXHWND wxTopLevelWindowMSW::MSWGetParent() const
return (WXHWND)hwndParent; 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, bool wxTopLevelWindowMSW::CreateDialog(const void *dlgTemplate,
const wxString& title, const wxString& title,
const wxPoint& pos, const wxPoint& pos,
@@ -550,6 +613,12 @@ bool wxTopLevelWindowMSW::Create(wxWindow *parent,
wxTopLevelWindowMSW::~wxTopLevelWindowMSW() 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 // 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 // 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 // this simply Alt-TAB to another application and back before closing the
@@ -1019,40 +1088,51 @@ void wxTopLevelWindowMSW::OnActivate(wxActivateEvent& event)
LONG APIENTRY _EXPORT LONG APIENTRY _EXPORT
wxDlgProc(HWND hDlg, wxDlgProc(HWND hDlg,
UINT message, UINT message,
WPARAM WXUNUSED(wParam), WPARAM wParam,
LPARAM WXUNUSED(lParam)) LPARAM lParam)
{ {
if ( message == WM_INITDIALOG ) switch ( message )
{ {
// under CE, add a "Ok" button in the dialog title bar and make it full case WM_INITDIALOG:
// screen {
// // under CE, add a "Ok" button in the dialog title bar and make it full
// TODO: find the window for this HWND, and take into account // screen
// wxMAXIMIZE and wxCLOSE_BOX. For now, assume both are present. //
// // TODO: find the window for this HWND, and take into account
// Standard SDK doesn't have aygshell.dll: see // wxMAXIMIZE and wxCLOSE_BOX. For now, assume both are present.
// include/wx/msw/wince/libraries.h //
// Standard SDK doesn't have aygshell.dll: see
// include/wx/msw/wince/libraries.h
#if defined(__WXWINCE__) && !defined(__WINCE_STANDARDSDK__) && !defined(__HANDHELDPC__) #if defined(__WXWINCE__) && !defined(__WINCE_STANDARDSDK__) && !defined(__HANDHELDPC__)
SHINITDLGINFO shidi; SHINITDLGINFO shidi;
shidi.dwMask = SHIDIM_FLAGS; shidi.dwMask = SHIDIM_FLAGS;
shidi.dwFlags = SHIDIF_SIZEDLG // take account of the SIP or menubar shidi.dwFlags = SHIDIF_SIZEDLG // take account of the SIP or menubar
#ifndef __SMARTPHONE__ #ifndef __SMARTPHONE__
| SHIDIF_DONEBUTTON | SHIDIF_DONEBUTTON
#endif #endif
; ;
shidi.hDlg = hDlg; shidi.hDlg = hDlg;
SHInitDialog( &shidi ); SHInitDialog( &shidi );
#else // no SHInitDialog() #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 #endif
} }
// for almost all messages, returning FALSE means that we didn't process // for almost all messages, returning FALSE means that we didn't process
// the message // 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; return FALSE;
} }