X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/dd05139a8023fd3e30476409fafbe04221c6d627..77c8efc8c37da6d6a5e2e8022d21d1cd7d76371d:/src/common/dpycmn.cpp diff --git a/src/common/dpycmn.cpp b/src/common/dpycmn.cpp index ce5fc0ac22..0087b7d09f 100644 --- a/src/common/dpycmn.cpp +++ b/src/common/dpycmn.cpp @@ -6,7 +6,7 @@ // Created: 01.03.03 // RCS-ID: $Id$ // Copyright: (c) 2003-2006 Vadim Zeitlin -// License: wxWindows licence +// Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// // ============================================================================ @@ -27,11 +27,11 @@ #ifndef WX_PRECOMP #include "wx/gdicmn.h" #include "wx/window.h" + #include "wx/module.h" #endif //WX_PRECOMP #include "wx/display.h" #include "wx/display_impl.h" -#include "wx/module.h" #if wxUSE_DISPLAY @@ -85,7 +85,7 @@ public: #endif // wxUSE_DISPLAY - DECLARE_NO_COPY_CLASS(wxDisplayImplSingle) + wxDECLARE_NO_COPY_CLASS(wxDisplayImplSingle); }; // ---------------------------------------------------------------------------- @@ -98,11 +98,7 @@ public: virtual bool OnInit() { return true; } virtual void OnExit() { - if ( gs_factory ) - { - delete gs_factory; - gs_factory = NULL; - } + wxDELETE(gs_factory); } DECLARE_DYNAMIC_CLASS(wxDisplayModule) @@ -118,7 +114,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxDisplayModule, wxModule) // ctor/dtor // ---------------------------------------------------------------------------- -wxDisplay::wxDisplay(size_t n) +wxDisplay::wxDisplay(unsigned n) { wxASSERT_MSG( n < GetCount(), wxT("An invalid index was passed to wxDisplay") ); @@ -135,7 +131,7 @@ wxDisplay::~wxDisplay() // static functions forwarded to wxDisplayFactory // ---------------------------------------------------------------------------- -/* static */ size_t wxDisplay::GetCount() +/* static */ unsigned wxDisplay::GetCount() { return Factory().GetCount(); } @@ -145,9 +141,9 @@ wxDisplay::~wxDisplay() return Factory().GetFromPoint(pt); } -/* static */ int wxDisplay::GetFromWindow(wxWindow *window) +/* static */ int wxDisplay::GetFromWindow(const wxWindow *window) { - wxCHECK_MSG( window, wxNOT_FOUND, _T("invalid window") ); + wxCHECK_MSG( window, wxNOT_FOUND, wxT("invalid window") ); return Factory().GetFromWindow(window); } @@ -158,21 +154,21 @@ wxDisplay::~wxDisplay() wxRect wxDisplay::GetGeometry() const { - wxCHECK_MSG( IsOk(), wxRect(), _T("invalid wxDisplay object") ); + wxCHECK_MSG( IsOk(), wxRect(), wxT("invalid wxDisplay object") ); return m_impl->GetGeometry(); } wxRect wxDisplay::GetClientArea() const { - wxCHECK_MSG( IsOk(), wxRect(), _T("invalid wxDisplay object") ); + wxCHECK_MSG( IsOk(), wxRect(), wxT("invalid wxDisplay object") ); return m_impl->GetClientArea(); } wxString wxDisplay::GetName() const { - wxCHECK_MSG( IsOk(), wxString(), _T("invalid wxDisplay object") ); + wxCHECK_MSG( IsOk(), wxString(), wxT("invalid wxDisplay object") ); return m_impl->GetName(); } @@ -186,26 +182,26 @@ bool wxDisplay::IsPrimary() const wxArrayVideoModes wxDisplay::GetModes(const wxVideoMode& mode) const { - wxCHECK_MSG( IsOk(), wxArrayVideoModes(), _T("invalid wxDisplay object") ); + wxCHECK_MSG( IsOk(), wxArrayVideoModes(), wxT("invalid wxDisplay object") ); return m_impl->GetModes(mode); } wxVideoMode wxDisplay::GetCurrentMode() const { - wxCHECK_MSG( IsOk(), wxVideoMode(), _T("invalid wxDisplay object") ); + wxCHECK_MSG( IsOk(), wxVideoMode(), wxT("invalid wxDisplay object") ); return m_impl->GetCurrentMode(); } bool wxDisplay::ChangeMode(const wxVideoMode& mode) { - wxCHECK_MSG( IsOk(), false, _T("invalid wxDisplay object") ); + wxCHECK_MSG( IsOk(), false, wxT("invalid wxDisplay object") ); return m_impl->ChangeMode(mode); } -#endif // wxUSE_DIRECTDRAW +#endif // wxUSE_DISPLAY // ---------------------------------------------------------------------------- // static functions implementation @@ -235,10 +231,10 @@ bool wxDisplay::ChangeMode(const wxVideoMode& mode) // wxDisplayFactory implementation // ============================================================================ -int wxDisplayFactory::GetFromWindow(wxWindow *window) +int wxDisplayFactory::GetFromWindow(const wxWindow *window) { // consider that the window belongs to the display containing its centre - const wxRect r(window->GetRect()); + const wxRect r(window->GetScreenRect()); return GetFromPoint(wxPoint(r.x + r.width/2, r.y + r.height/2)); } @@ -247,7 +243,7 @@ int wxDisplayFactory::GetFromWindow(wxWindow *window) // ============================================================================ /* static */ -wxDisplayImpl *wxDisplayFactorySingle::CreateDisplay(size_t n) +wxDisplayImpl *wxDisplayFactorySingle::CreateDisplay(unsigned n) { // we recognize the main display only return n != 0 ? NULL : new wxDisplayImplSingle;