// headers
// ----------------------------------------------------------------------------
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
- #pragma implementation "windowbase.h"
-#endif
-
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#include "wx/dialog.h"
#include "wx/msgdlg.h"
#include "wx/statusbr.h"
+ #include "wx/toolbar.h"
#include "wx/dcclient.h"
#endif //WX_PRECOMP
#include "wx/caret.h"
#endif // wxUSE_CARET
+#if wxUSE_DISPLAY
+ #include "wx/display.h"
+#endif
+
#if wxUSE_SYSTEM_OPTIONS
#include "wx/sysopt.h"
#endif
// VZ: this one shouldn't exist...
m_isBeingDeleted = false;
+
+ // Reserved for future use
+ m_windowReserved = NULL;
}
// common part of window creation process
if ( direction & wxCENTRE_ON_SCREEN )
{
+ //RN: If we are using wxDisplay we get
+ //the dimensions of the monitor the window is on,
+ //otherwise we get the dimensions of the primary monitor
+ //FIXME: wxDisplay::GetFromWindow only implemented on MSW
+#if wxUSE_DISPLAY && defined(__WXMSW__)
+ int nDisplay = wxDisplay::GetFromWindow((wxWindow*)this);
+ if(nDisplay != wxNOT_FOUND)
+ {
+ wxDisplay windowDisplay(nDisplay);
+ wxRect displayRect = windowDisplay.GetGeometry();
+ widthParent = displayRect.width;
+ heightParent = displayRect.height;
+ }
+ else
+#endif
// centre with respect to the whole screen
wxDisplaySize(&widthParent, &heightParent);
}
xNew += posParent.x;
yNew += posParent.y;
+ // FIXME: This needs to get the client display rect of the display
+ // the window is (via wxDisplay::GetFromWindow).
+
// Base size of the visible dimensions of the display
// to take into account the taskbar. And the Mac menu bar at top.
wxRect clientrect = wxGetClientDisplayRect();
- // NB: in wxMSW, negative position may not neccessary mean "out of screen",
+ // NB: in wxMSW, negative position may not necessarily mean "out of screen",
// but it may mean that the window is placed on other than the main
// display. Therefore we only make sure centered window is on the main display
// if the parent is at least partially present here.
// fits the window around the children
void wxWindowBase::Fit()
{
- if ( GetChildren().GetCount() > 0 )
+ if ( !GetChildren().empty() )
{
- SetSize(GetBestSize());
+ SetClientSize(GetBestSize());
}
//else: do nothing if we have no children
}
if ( m_windowSizer )
{
- best = m_windowSizer->GetMinSize();
+ best = GetWindowSizeForVirtualSize(m_windowSizer->GetMinSize());
}
#if wxUSE_CONSTRAINTS
else if ( m_constraints )
}
else // ! has children
{
- // For a generic window there is no natural best size - just use
- // either the minimum size if there is one, or the current size.
- // These are returned as-is, unadjusted by the client size difference.
- if ( GetMinSize().IsFullySpecified() )
- return GetMinSize();
- else
- return GetSize();
+ // for a generic window there is no natural best size so, if the
+ // minimal size is not set, use the current size but take care to
+ // remember it as minimal size for the next time because our best size
+ // should be constant: otherwise we could get into a situation when the
+ // window is initially at some size, then expanded to a larger size and
+ // then, when the containing window is shrunk back (because our initial
+ // best size had been used for computing the parent min size), we can't
+ // be shrunk back any more because our best size is now bigger
+ wxSize size = GetMinSize();
+ if ( !size.IsFullySpecified() )
+ {
+ size.SetDefaults(GetSize());
+ wxConstCast(this, wxWindowBase)->SetMinSize(size);
+ }
+
+ // return as-is, unadjusted by the client size difference.
+ return size;
}
// Add any difference between size and client size
wxSize wxWindowBase::DoGetVirtualSize() const
{
- if (m_virtualSize == wxDefaultSize)
- return GetClientSize();
+ if ( m_virtualSize.IsFullySpecified() )
+ return m_virtualSize;
+
+ wxSize size = GetClientSize();
+ if ( m_virtualSize.x != wxDefaultCoord )
+ size.x = m_virtualSize.x;
- return m_virtualSize;
+ if ( m_virtualSize.y != wxDefaultCoord )
+ size.y = m_virtualSize.y;
+
+ return size;
}
// ----------------------------------------------------------------------------
wxVisualAttributes attrs;
attrs.font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
attrs.colFg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
- attrs.colBg = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE);
+ // On Smartphone/PocketPC, wxSYS_COLOUR_WINDOW is a better reflection of
+ // the usual background colour than wxSYS_COLOUR_BTNFACE.
+ // It's a pity that wxSYS_COLOUR_WINDOW isn't always a suitable background
+ // colour on other platforms.
+
+#if defined(__WXWINCE__) && (defined(__SMARTPHONE__) || defined(__POCKETPC__))
+ attrs.colBg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
+#else
+ attrs.colBg = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE);
+#endif
return attrs;
}
switch ( wxGetOsVersion() )
{
- case wxMOTIF_X: port += _T("Motif"); break;
+ case wxMOTIF_X: port += _T("Motif"); break;
case wxMAC:
- case wxMAC_DARWIN: port += _T("Mac"); break;
- case wxBEOS: port += _T("BeOS"); break;
+ case wxMAC_DARWIN: port += _T("Mac"); break;
+ case wxBEOS: port += _T("BeOS"); break;
case wxGTK:
case wxGTK_WIN32:
case wxGTK_OS2:
- case wxGTK_BEOS: port += _T("GTK"); break;
+ case wxGTK_BEOS: port += _T("GTK"); break;
case wxWINDOWS:
case wxPENWINDOWS:
case wxWINDOWS_NT:
case wxWIN32S:
case wxWIN95:
- case wxWIN386: port += _T("MS Windows"); break;
+ case wxWIN386: port += _T("MS Windows"); break;
case wxMGL_UNIX:
case wxMGL_X:
case wxMGL_WIN32:
- case wxMGL_OS2: port += _T("MGL"); break;
+ case wxMGL_OS2: port += _T("MGL"); break;
case wxWINDOWS_OS2:
- case wxOS2_PM: port += _T("OS/2"); break;
+ case wxOS2_PM: port += _T("OS/2"); break;
+ case wxPALMOS: port += _T("Palm OS"); break;
+ case wxWINDOWS_CE: port += _T("Windows CE (generic)"); break;
+ case wxWINDOWS_POCKETPC: port += _T("Windows CE PocketPC"); break;
+ case wxWINDOWS_SMARTPHONE: port += _T("Windows CE Smartphone"); break;
default: port += _T("unknown"); break;
}
wxMessageBox(wxString::Format(
_T(
- " wxWidgets Library (%s port)\nVersion %u.%u.%u%s%s, compiled at %s %s\n Copyright (c) 1995-2004 wxWidgets team"
+ " wxWidgets Library (%s port)\nVersion %d.%d.%d%s%s, compiled at %s %s\n Copyright (c) 1995-2005 wxWidgets team"
),
port.c_str(),
wxMAJOR_VERSION,
#endif
-#if !wxUSE_STL
// ----------------------------------------------------------------------------
// list classes implementation
// ----------------------------------------------------------------------------
+#if wxUSE_STL
+
+#include <wx/listimpl.cpp>
+WX_DEFINE_LIST(wxWindowList);
+
+#else
+
void wxWindowListNode::DeleteData()
{
delete (wxWindow *)GetData();
}
+
#endif
// ----------------------------------------------------------------------------