From 979a0320b0410ff0f8439a17ae362d6d5c7a1031 Mon Sep 17 00:00:00 2001 From: =?utf8?q?W=C5=82odzimierz=20Skiba?= Date: Thu, 27 Apr 2006 17:18:46 +0000 Subject: [PATCH] wxTLW::IsAlwaysMaximized() introduction. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38942 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/latex/wx/tlw.tex | 8 ++++++++ include/wx/toplevel.h | 4 ++++ src/common/toplvcmn.cpp | 13 +++++++++++++ src/msw/toplevel.cpp | 8 ++++---- 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/docs/latex/wx/tlw.tex b/docs/latex/wx/tlw.tex index dfdf848b7a..770b9e34cd 100644 --- a/docs/latex/wx/tlw.tex +++ b/docs/latex/wx/tlw.tex @@ -86,6 +86,14 @@ Returns \true if this window is currently active, i.e. if the user is currently working with it. +\membersection{wxTopLevelWindow::IsAlwaysMaximized}\label{wxtoplevelwindowisalwaysmaximized} + +\constfunc{virtual bool}{IsAlwaysMaximized}{\void} + +Returns \true if this window is expected to be always maximized, either due to platform policy +or due to local policy regarding particular class. + + \membersection{wxTopLevelWindow::Iconize}\label{wxtoplevelwindowiconize} \func{void}{Iconize}{\param{bool}{ iconize}} diff --git a/include/wx/toplevel.h b/include/wx/toplevel.h index 8824066fe8..69c5a76ac1 100644 --- a/include/wx/toplevel.h +++ b/include/wx/toplevel.h @@ -137,6 +137,10 @@ public: // return true if the frame is maximized virtual bool IsMaximized() const = 0; + // return true if the frame is always maximized + // due to native guidelines or current policy + virtual bool IsAlwaysMaximized() const; + // return true if the frame is iconized virtual bool IsIconized() const = 0; diff --git a/src/common/toplvcmn.cpp b/src/common/toplvcmn.cpp index 8441f436eb..c9eed594e9 100644 --- a/src/common/toplvcmn.cpp +++ b/src/common/toplvcmn.cpp @@ -185,6 +185,11 @@ wxSize wxTopLevelWindowBase::GetDefaultSize() void wxTopLevelWindowBase::DoCentre(int dir) { + // on some platforms centering top level windows is impossible + // because they are always maximized by guidelines or limitations + if(IsAlwaysMaximized()) + return; + // we need the display rect anyhow so store it first int nDisplay = wxDisplay::GetFromWindow(this); wxDisplay dpy(nDisplay == wxNOT_FOUND ? 0 : nDisplay); @@ -286,6 +291,14 @@ void wxTopLevelWindowBase::DoClientToScreen(int *x, int *y) const wxWindow::DoClientToScreen(x, y); } +bool wxTopLevelWindowBase::IsAlwaysMaximized() const +{ +#if defined(__SMARTPHONE__) || defined(__POCKETPC__) + return true; +#else + return false; +#endif +} // ---------------------------------------------------------------------------- // event handlers diff --git a/src/msw/toplevel.cpp b/src/msw/toplevel.cpp index 82b65ed06b..d7e9649243 100644 --- a/src/msw/toplevel.cpp +++ b/src/msw/toplevel.cpp @@ -724,11 +724,11 @@ void wxTopLevelWindowMSW::Maximize(bool maximize) bool wxTopLevelWindowMSW::IsMaximized() const { -#if defined(__SMARTPHONE__) || defined(__POCKETPC__) - return true; -#else - return m_maximizeOnShow || ::IsZoomed(GetHwnd()) != 0; + return IsAlwaysMaximized() || +#if !defined(__SMARTPHONE__) && !defined(__POCKETPC__) + (::IsZoomed(GetHwnd()) != 0) || #endif + m_maximizeOnShow; } void wxTopLevelWindowMSW::Iconize(bool iconize) -- 2.45.2