1. a couple of compilation warnings fixed (strconv/listctrl)
2. now reenable windows disabled by wxWindowDisabler slightly earlier: this solves the problem with "wrong" window being brought to top and eliminates the need for BringWindowToTop() and SetActiveWindow() in our code 3. style wxFRAME_FLOAT_ON_PARENT is now obsolete and unused, all frames have WS_EX_APPWINDOW style and appear on the taskbar git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8487 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -919,8 +919,8 @@ enum wxStretch
|
||||
#define wxDIALOG_MODAL 0x0020
|
||||
#define wxDIALOG_MODELESS 0x0000
|
||||
|
||||
// Add for normal Windows frame behaviour
|
||||
#define wxFRAME_FLOAT_ON_PARENT 0x0020
|
||||
// deprecated flag, don't use any more, defined for compatibility only
|
||||
#define wxFRAME_FLOAT_ON_PARENT 0
|
||||
|
||||
// Context-sensitive help
|
||||
#define wxFRAME_EX_CONTEXTHELP 0x00000004
|
||||
|
@@ -23,10 +23,8 @@ WXDLLEXPORT_DATA(extern const wxChar*) wxDialogNameStr;
|
||||
// Dialog boxes
|
||||
class WXDLLEXPORT wxDialog : public wxDialogBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxDialog)
|
||||
|
||||
public:
|
||||
wxDialog();
|
||||
wxDialog() { Init(); }
|
||||
|
||||
// Constructor with a modal flag, but no window id - the old convention
|
||||
wxDialog(wxWindow *parent,
|
||||
@@ -116,9 +114,17 @@ protected:
|
||||
// show modal dialog and enter modal loop
|
||||
void DoShowModal();
|
||||
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
private:
|
||||
wxWindow *m_oldFocus;
|
||||
|
||||
// while we are showing a modal dialog we disable the other windows using
|
||||
// this object
|
||||
class wxWindowDisabler *m_windowDisabler;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxDialog)
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
@@ -305,10 +305,6 @@ public:
|
||||
|
||||
private:
|
||||
wxWindowList *m_winDisabled;
|
||||
|
||||
#ifdef __WXMSW__
|
||||
wxWindow *m_winTop;
|
||||
#endif // MSW
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@@ -87,6 +87,8 @@ WXDLLEXPORT_DATA(wxMBConv *) wxConvCurrent = &wxConvLibc;
|
||||
|
||||
#if wxUSE_WCHAR_T
|
||||
|
||||
#ifdef WC_UTF16
|
||||
|
||||
static size_t encode_utf16(wxUint32 input,wxUint16*output)
|
||||
{
|
||||
if (input<=0xffff) {
|
||||
@@ -119,6 +121,8 @@ static size_t decode_utf16(wxUint16*input,wxUint32&output)
|
||||
}
|
||||
}
|
||||
|
||||
#endif // WC_UTF16
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxMBConv
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@@ -1071,17 +1071,6 @@ void wxEnableTopLevelWindows(bool enable)
|
||||
|
||||
wxWindowDisabler::wxWindowDisabler(wxWindow *winToSkip)
|
||||
{
|
||||
#ifdef __WXMSW__
|
||||
#ifdef __WIN32__
|
||||
// and the top level window too
|
||||
HWND hwndFG = ::GetForegroundWindow();
|
||||
m_winTop = hwndFG ? wxFindWinFromHandle((WXHWND)hwndFG) : (wxWindow *)NULL;
|
||||
#else
|
||||
HWND hwndFG = ::GetTopWindow(0);
|
||||
m_winTop = hwndFG ? wxFindWinFromHandle((WXHWND)hwndFG) : (wxWindow *)NULL;
|
||||
#endif
|
||||
#endif // MSW
|
||||
|
||||
// remember the top level windows which were already disabled, so that we
|
||||
// don't reenable them later
|
||||
m_winDisabled = NULL;
|
||||
@@ -1123,29 +1112,6 @@ wxWindowDisabler::~wxWindowDisabler()
|
||||
}
|
||||
|
||||
delete m_winDisabled;
|
||||
|
||||
#ifdef __WXMSW__
|
||||
#ifdef __WIN32__
|
||||
if ( m_winTop )
|
||||
{
|
||||
if ( !::SetForegroundWindow(GetHwndOf(m_winTop)) )
|
||||
{
|
||||
wxLogLastError(wxT("SetForegroundWindow"));
|
||||
}
|
||||
}
|
||||
#else
|
||||
if ( m_winTop )
|
||||
{
|
||||
// 16-bit SetForegroundWindow() replacement
|
||||
RECT reWin;
|
||||
GetWindowRect((HWND) m_winTop, &reWin);
|
||||
SetWindowPos ((HWND) m_winTop, HWND_TOP,
|
||||
reWin.left, reWin.top,
|
||||
reWin.right - reWin.left, reWin.bottom,
|
||||
SWP_SHOWWINDOW);
|
||||
}
|
||||
#endif
|
||||
#endif // MSW
|
||||
}
|
||||
|
||||
// Yield to other apps/messages and disable user input to all windows except
|
||||
|
@@ -96,11 +96,14 @@ END_EVENT_TABLE()
|
||||
// wxDialog construction
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxDialog::wxDialog()
|
||||
void wxDialog::Init()
|
||||
{
|
||||
m_oldFocus = (wxWindow *)NULL;
|
||||
|
||||
m_isShown = FALSE;
|
||||
|
||||
m_windowDisabler = (wxWindowDisabler *)NULL;
|
||||
|
||||
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
|
||||
}
|
||||
|
||||
@@ -111,9 +114,10 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id,
|
||||
long style,
|
||||
const wxString& name)
|
||||
{
|
||||
Init();
|
||||
|
||||
m_oldFocus = FindFocus();
|
||||
|
||||
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
|
||||
SetName(name);
|
||||
|
||||
wxTopLevelWindows.Append(this);
|
||||
@@ -139,8 +143,6 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id,
|
||||
|
||||
m_windowStyle = style;
|
||||
|
||||
m_isShown = FALSE;
|
||||
|
||||
if (width < 0)
|
||||
width = wxDIALOG_DEFAULT_WIDTH;
|
||||
if (height < 0)
|
||||
@@ -212,8 +214,7 @@ wxDialog::~wxDialog()
|
||||
|
||||
wxTopLevelWindows.DeleteObject(this);
|
||||
|
||||
// this will call BringWindowToTop() if necessary to bring back our parent
|
||||
// window to top
|
||||
// this will also reenable all the other windows for a modal dialog
|
||||
Show(FALSE);
|
||||
|
||||
if ( !IsModal() )
|
||||
@@ -342,34 +343,34 @@ void wxDialog::DoShowModal()
|
||||
if (oldFocus)
|
||||
hwndOldFocus = (HWND) oldFocus->GetHWND();
|
||||
|
||||
// inside this block, all app windows are disabled
|
||||
// remember where the focus was
|
||||
if ( !oldFocus )
|
||||
{
|
||||
wxWindowDisabler wd(this);
|
||||
|
||||
// remember where the focus was
|
||||
if ( !oldFocus )
|
||||
{
|
||||
oldFocus = parent;
|
||||
if (parent)
|
||||
hwndOldFocus = (HWND) parent->GetHWND();
|
||||
}
|
||||
|
||||
// enter the modal loop
|
||||
while ( IsModalShowing() )
|
||||
{
|
||||
#if wxUSE_THREADS
|
||||
wxMutexGuiLeaveOrEnter();
|
||||
#endif // wxUSE_THREADS
|
||||
|
||||
while ( !wxTheApp->Pending() && wxTheApp->ProcessIdle() )
|
||||
;
|
||||
|
||||
// a message came or no more idle processing to do
|
||||
wxTheApp->DoMessage();
|
||||
}
|
||||
oldFocus = parent;
|
||||
if ( parent )
|
||||
hwndOldFocus = GetHwndOf(parent);
|
||||
}
|
||||
|
||||
#ifdef __WIN32__
|
||||
// disable all other app windows
|
||||
wxASSERT_MSG( !m_windowDisabler, _T("disabling windows twice?") );
|
||||
|
||||
m_windowDisabler = new wxWindowDisabler(this);
|
||||
|
||||
// enter the modal loop
|
||||
while ( IsModalShowing() )
|
||||
{
|
||||
#if wxUSE_THREADS
|
||||
wxMutexGuiLeaveOrEnter();
|
||||
#endif // wxUSE_THREADS
|
||||
|
||||
while ( !wxTheApp->Pending() && wxTheApp->ProcessIdle() )
|
||||
;
|
||||
|
||||
// a message came or no more idle processing to do
|
||||
wxTheApp->DoMessage();
|
||||
}
|
||||
|
||||
#if 0 //def __WIN32__
|
||||
if ( parent )
|
||||
::SetActiveWindow(GetHwndOf(parent));
|
||||
#endif // __WIN32__
|
||||
@@ -388,16 +389,15 @@ void wxDialog::DoShowModal()
|
||||
|
||||
bool wxDialog::Show(bool show)
|
||||
{
|
||||
// The following is required when the parent has been disabled, (modal
|
||||
// dialogs, or modeless dialogs with disabling such as wxProgressDialog).
|
||||
// Otherwise the parent disappears behind other windows when the dialog is
|
||||
// hidden.
|
||||
if ( !show )
|
||||
{
|
||||
wxWindow *parent = GetParent();
|
||||
if ( parent )
|
||||
// if we had disabled other app windows, reenable them back now because
|
||||
// if they stay disabled Windows will activate another window (one
|
||||
// which is enabled, anyhow) and we will lose activation
|
||||
if ( m_windowDisabler )
|
||||
{
|
||||
::BringWindowToTop(GetHwndOf(parent));
|
||||
delete m_windowDisabler;
|
||||
m_windowDisabler = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -552,6 +552,7 @@ long wxDialog::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
||||
|
||||
switch ( message )
|
||||
{
|
||||
#if 0 // now that we got owner window right it doesn't seem to be needed
|
||||
case WM_ACTIVATE:
|
||||
switch ( LOWORD(wParam) )
|
||||
{
|
||||
@@ -578,6 +579,7 @@ long wxDialog::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
||||
// fall through to process it normally as well
|
||||
}
|
||||
break;
|
||||
#endif // 0
|
||||
|
||||
case WM_CLOSE:
|
||||
// if we can't close, tell the system that we processed the
|
||||
|
@@ -147,13 +147,6 @@ bool wxFrame::Create(wxWindow *parent,
|
||||
|
||||
m_iconized = FALSE;
|
||||
|
||||
// we pass NULL as parent to MSWCreate because frames with parents behave
|
||||
// very strangely under Win95 shell
|
||||
// Alteration by JACS: keep normal Windows behaviour (float on top of parent)
|
||||
// with this style.
|
||||
if ((m_windowStyle & wxFRAME_FLOAT_ON_PARENT) == 0)
|
||||
parent = NULL;
|
||||
|
||||
wxTopLevelWindows.Append(this);
|
||||
|
||||
MSWCreate(m_windowId, parent, wxFrameClassName, this, title,
|
||||
@@ -672,9 +665,14 @@ bool wxFrame::MSWCreate(int id, wxWindow *parent, const wxChar *wclass, wxWindow
|
||||
|
||||
WXDWORD extendedStyle = MakeExtendedStyle(style);
|
||||
|
||||
// make all frames appear in the win9x shell taskbar unless
|
||||
// wxFRAME_TOOL_WINDOW is explicitly given - without giving them
|
||||
// WS_EX_APPWINDOW style, the child (i.e. owned) frames wouldn't appear in it
|
||||
#if !defined(__WIN16__) && !defined(__SC__)
|
||||
if (style & wxFRAME_TOOL_WINDOW)
|
||||
extendedStyle |= WS_EX_TOOLWINDOW;
|
||||
extendedStyle |= WS_EX_TOOLWINDOW;
|
||||
else
|
||||
extendedStyle |= WS_EX_APPWINDOW;
|
||||
#endif
|
||||
|
||||
if (style & wxSTAY_ON_TOP)
|
||||
|
@@ -1737,7 +1737,6 @@ void wxListCtrl::OnPaint(wxPaintEvent& event)
|
||||
wxRect itemRect;
|
||||
int cy=0;
|
||||
|
||||
int lastH = 0;
|
||||
int itemCount = GetItemCount();
|
||||
int i;
|
||||
for (i = 0; i < itemCount; i++)
|
||||
|
Reference in New Issue
Block a user