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_MODAL 0x0020
|
||||||
#define wxDIALOG_MODELESS 0x0000
|
#define wxDIALOG_MODELESS 0x0000
|
||||||
|
|
||||||
// Add for normal Windows frame behaviour
|
// deprecated flag, don't use any more, defined for compatibility only
|
||||||
#define wxFRAME_FLOAT_ON_PARENT 0x0020
|
#define wxFRAME_FLOAT_ON_PARENT 0
|
||||||
|
|
||||||
// Context-sensitive help
|
// Context-sensitive help
|
||||||
#define wxFRAME_EX_CONTEXTHELP 0x00000004
|
#define wxFRAME_EX_CONTEXTHELP 0x00000004
|
||||||
|
@@ -23,10 +23,8 @@ WXDLLEXPORT_DATA(extern const wxChar*) wxDialogNameStr;
|
|||||||
// Dialog boxes
|
// Dialog boxes
|
||||||
class WXDLLEXPORT wxDialog : public wxDialogBase
|
class WXDLLEXPORT wxDialog : public wxDialogBase
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxDialog)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxDialog();
|
wxDialog() { Init(); }
|
||||||
|
|
||||||
// Constructor with a modal flag, but no window id - the old convention
|
// Constructor with a modal flag, but no window id - the old convention
|
||||||
wxDialog(wxWindow *parent,
|
wxDialog(wxWindow *parent,
|
||||||
@@ -116,9 +114,17 @@ protected:
|
|||||||
// show modal dialog and enter modal loop
|
// show modal dialog and enter modal loop
|
||||||
void DoShowModal();
|
void DoShowModal();
|
||||||
|
|
||||||
|
// common part of all ctors
|
||||||
|
void Init();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxWindow *m_oldFocus;
|
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()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -305,10 +305,6 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
wxWindowList *m_winDisabled;
|
wxWindowList *m_winDisabled;
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
|
||||||
wxWindow *m_winTop;
|
|
||||||
#endif // MSW
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -87,6 +87,8 @@ WXDLLEXPORT_DATA(wxMBConv *) wxConvCurrent = &wxConvLibc;
|
|||||||
|
|
||||||
#if wxUSE_WCHAR_T
|
#if wxUSE_WCHAR_T
|
||||||
|
|
||||||
|
#ifdef WC_UTF16
|
||||||
|
|
||||||
static size_t encode_utf16(wxUint32 input,wxUint16*output)
|
static size_t encode_utf16(wxUint32 input,wxUint16*output)
|
||||||
{
|
{
|
||||||
if (input<=0xffff) {
|
if (input<=0xffff) {
|
||||||
@@ -119,6 +121,8 @@ static size_t decode_utf16(wxUint16*input,wxUint32&output)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // WC_UTF16
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxMBConv
|
// wxMBConv
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -1071,17 +1071,6 @@ void wxEnableTopLevelWindows(bool enable)
|
|||||||
|
|
||||||
wxWindowDisabler::wxWindowDisabler(wxWindow *winToSkip)
|
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
|
// remember the top level windows which were already disabled, so that we
|
||||||
// don't reenable them later
|
// don't reenable them later
|
||||||
m_winDisabled = NULL;
|
m_winDisabled = NULL;
|
||||||
@@ -1123,29 +1112,6 @@ wxWindowDisabler::~wxWindowDisabler()
|
|||||||
}
|
}
|
||||||
|
|
||||||
delete m_winDisabled;
|
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
|
// Yield to other apps/messages and disable user input to all windows except
|
||||||
|
@@ -96,11 +96,14 @@ END_EVENT_TABLE()
|
|||||||
// wxDialog construction
|
// wxDialog construction
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
wxDialog::wxDialog()
|
void wxDialog::Init()
|
||||||
{
|
{
|
||||||
m_oldFocus = (wxWindow *)NULL;
|
m_oldFocus = (wxWindow *)NULL;
|
||||||
|
|
||||||
m_isShown = FALSE;
|
m_isShown = FALSE;
|
||||||
|
|
||||||
|
m_windowDisabler = (wxWindowDisabler *)NULL;
|
||||||
|
|
||||||
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
|
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,9 +114,10 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id,
|
|||||||
long style,
|
long style,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
|
Init();
|
||||||
|
|
||||||
m_oldFocus = FindFocus();
|
m_oldFocus = FindFocus();
|
||||||
|
|
||||||
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
|
|
||||||
SetName(name);
|
SetName(name);
|
||||||
|
|
||||||
wxTopLevelWindows.Append(this);
|
wxTopLevelWindows.Append(this);
|
||||||
@@ -139,8 +143,6 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
m_windowStyle = style;
|
m_windowStyle = style;
|
||||||
|
|
||||||
m_isShown = FALSE;
|
|
||||||
|
|
||||||
if (width < 0)
|
if (width < 0)
|
||||||
width = wxDIALOG_DEFAULT_WIDTH;
|
width = wxDIALOG_DEFAULT_WIDTH;
|
||||||
if (height < 0)
|
if (height < 0)
|
||||||
@@ -212,8 +214,7 @@ wxDialog::~wxDialog()
|
|||||||
|
|
||||||
wxTopLevelWindows.DeleteObject(this);
|
wxTopLevelWindows.DeleteObject(this);
|
||||||
|
|
||||||
// this will call BringWindowToTop() if necessary to bring back our parent
|
// this will also reenable all the other windows for a modal dialog
|
||||||
// window to top
|
|
||||||
Show(FALSE);
|
Show(FALSE);
|
||||||
|
|
||||||
if ( !IsModal() )
|
if ( !IsModal() )
|
||||||
@@ -342,34 +343,34 @@ void wxDialog::DoShowModal()
|
|||||||
if (oldFocus)
|
if (oldFocus)
|
||||||
hwndOldFocus = (HWND) oldFocus->GetHWND();
|
hwndOldFocus = (HWND) oldFocus->GetHWND();
|
||||||
|
|
||||||
// inside this block, all app windows are disabled
|
// remember where the focus was
|
||||||
|
if ( !oldFocus )
|
||||||
{
|
{
|
||||||
wxWindowDisabler wd(this);
|
oldFocus = parent;
|
||||||
|
if ( parent )
|
||||||
// remember where the focus was
|
hwndOldFocus = GetHwndOf(parent);
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#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 )
|
if ( parent )
|
||||||
::SetActiveWindow(GetHwndOf(parent));
|
::SetActiveWindow(GetHwndOf(parent));
|
||||||
#endif // __WIN32__
|
#endif // __WIN32__
|
||||||
@@ -388,16 +389,15 @@ void wxDialog::DoShowModal()
|
|||||||
|
|
||||||
bool wxDialog::Show(bool show)
|
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 )
|
if ( !show )
|
||||||
{
|
{
|
||||||
wxWindow *parent = GetParent();
|
// if we had disabled other app windows, reenable them back now because
|
||||||
if ( parent )
|
// 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 )
|
switch ( message )
|
||||||
{
|
{
|
||||||
|
#if 0 // now that we got owner window right it doesn't seem to be needed
|
||||||
case WM_ACTIVATE:
|
case WM_ACTIVATE:
|
||||||
switch ( LOWORD(wParam) )
|
switch ( LOWORD(wParam) )
|
||||||
{
|
{
|
||||||
@@ -578,6 +579,7 @@ long wxDialog::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
|||||||
// fall through to process it normally as well
|
// fall through to process it normally as well
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#endif // 0
|
||||||
|
|
||||||
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
|
||||||
|
@@ -147,13 +147,6 @@ bool wxFrame::Create(wxWindow *parent,
|
|||||||
|
|
||||||
m_iconized = FALSE;
|
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);
|
wxTopLevelWindows.Append(this);
|
||||||
|
|
||||||
MSWCreate(m_windowId, parent, wxFrameClassName, this, title,
|
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);
|
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 !defined(__WIN16__) && !defined(__SC__)
|
||||||
if (style & wxFRAME_TOOL_WINDOW)
|
if (style & wxFRAME_TOOL_WINDOW)
|
||||||
extendedStyle |= WS_EX_TOOLWINDOW;
|
extendedStyle |= WS_EX_TOOLWINDOW;
|
||||||
|
else
|
||||||
|
extendedStyle |= WS_EX_APPWINDOW;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (style & wxSTAY_ON_TOP)
|
if (style & wxSTAY_ON_TOP)
|
||||||
|
@@ -1737,7 +1737,6 @@ void wxListCtrl::OnPaint(wxPaintEvent& event)
|
|||||||
wxRect itemRect;
|
wxRect itemRect;
|
||||||
int cy=0;
|
int cy=0;
|
||||||
|
|
||||||
int lastH = 0;
|
|
||||||
int itemCount = GetItemCount();
|
int itemCount = GetItemCount();
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < itemCount; i++)
|
for (i = 0; i < itemCount; i++)
|
||||||
|
Reference in New Issue
Block a user