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:
@@ -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:
|
||||
|
||||
|
@@ -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}
|
||||
|
@@ -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}
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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)
|
||||
};
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user