From 4e675101a7fabdeaed5520257bf3dda457f54178 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Mon, 2 Oct 2006 05:38:05 +0000 Subject: [PATCH] use unsigned for display count git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41548 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/latex/wx/display.tex | 4 ++-- include/wx/display.h | 4 ++-- include/wx/display_impl.h | 14 +++++++------- src/cocoa/display.mm | 10 +++++----- src/common/dpycmn.cpp | 6 +++--- src/mac/carbon/display.cpp | 26 +++++++++++++------------- src/msw/display.cpp | 16 ++++++++-------- src/unix/displayx11.cpp | 16 ++++++++-------- 8 files changed, 48 insertions(+), 48 deletions(-) diff --git a/docs/latex/wx/display.tex b/docs/latex/wx/display.tex index fd78c8f15e..87723079c6 100644 --- a/docs/latex/wx/display.tex +++ b/docs/latex/wx/display.tex @@ -19,7 +19,7 @@ None \membersection{wxDisplay::wxDisplay}\label{wxdisplayctor} -\func{}{wxDisplay}{\param{size\_t }{index = 0}} +\func{}{wxDisplay}{\param{unsigned }{index = 0}} Constructor, setting up a wxDisplay instance with the specified display. @@ -73,7 +73,7 @@ there is a taskbar (or equivalent) on this display. \membersection{wxDisplay::GetCount}\label{wxdisplaygetcount} -\func{static size\_t}{GetCount}{\void} +\func{static unsigned }{GetCount}{\void} Returns the number of connected displays. diff --git a/include/wx/display.h b/include/wx/display.h index d209557a66..e31ee3286a 100644 --- a/include/wx/display.h +++ b/include/wx/display.h @@ -45,7 +45,7 @@ public: // // the displays are numbered from 0 to GetCount() - 1, 0 is always the // primary display and the only one which is always supported - wxDisplay(size_t n = 0); + wxDisplay(unsigned n = 0); // dtor is not virtual as this is a concrete class not meant to be derived // from @@ -54,7 +54,7 @@ public: // return the number of available displays, valid parameters to // wxDisplay ctor are from 0 up to this number - static size_t GetCount(); + static unsigned GetCount(); // find the display where the given point lies, return wxNOT_FOUND if // it doesn't belong to any display diff --git a/include/wx/display_impl.h b/include/wx/display_impl.h index cfd40a3d67..07eae9a753 100644 --- a/include/wx/display_impl.h +++ b/include/wx/display_impl.h @@ -26,10 +26,10 @@ public: // create a new display object // // it can return a NULL pointer if the display creation failed - virtual wxDisplayImpl *CreateDisplay(size_t n) = 0; + virtual wxDisplayImpl *CreateDisplay(unsigned n) = 0; // get the total number of displays - virtual size_t GetCount() = 0; + virtual unsigned GetCount() = 0; // return the display for the given point or wxNOT_FOUND virtual int GetFromPoint(const wxPoint& pt) = 0; @@ -61,7 +61,7 @@ public: virtual wxString GetName() const = 0; // return the index of this display - size_t GetIndex() const { return m_index; } + unsigned GetIndex() const { return m_index; } // return true if this is the primary monitor (usually one with index 0) virtual bool IsPrimary() const { return GetIndex() == 0; } @@ -80,11 +80,11 @@ public: protected: // create the object providing access to the display with the given index - wxDisplayImpl(size_t n) : m_index(n) { } + wxDisplayImpl(unsigned n) : m_index(n) { } // the index of this display (0 is always the primary one) - const size_t m_index; + const unsigned m_index; friend class wxDisplayFactory; @@ -101,8 +101,8 @@ protected: class WXDLLEXPORT wxDisplayFactorySingle : public wxDisplayFactory { public: - virtual wxDisplayImpl *CreateDisplay(size_t n); - virtual size_t GetCount() { return 1; } + virtual wxDisplayImpl *CreateDisplay(unsigned n); + virtual unsigned GetCount() { return 1; } virtual int GetFromPoint(const wxPoint& pt); }; diff --git a/src/cocoa/display.mm b/src/cocoa/display.mm index 8fea9718c8..3e375d45c9 100644 --- a/src/cocoa/display.mm +++ b/src/cocoa/display.mm @@ -37,7 +37,7 @@ class wxDisplayImplMacOSX : public wxDisplayImpl { public: - wxDisplayImplMacOSX(size_t n, CGDirectDisplayID id_) + wxDisplayImplMacOSX(unsigned n, CGDirectDisplayID id_) : wxDisplayImpl(n), m_id(id_) { @@ -61,8 +61,8 @@ class wxDisplayFactoryMacOSX : public wxDisplayFactory public: wxDisplayFactoryMacOSX() { } - virtual wxDisplayImpl *CreateDisplay(size_t n); - virtual size_t GetCount(); + virtual wxDisplayImpl *CreateDisplay(unsigned n); + virtual unsigned GetCount(); virtual int GetFromPoint(const wxPoint& pt); protected: @@ -73,7 +73,7 @@ protected: // wxDisplayFactoryMacOSX implementation // ============================================================================ -size_t wxDisplayFactoryMacOSX::GetCount() +unsigned wxDisplayFactoryMacOSX::GetCount() { CGDisplayCount count; #ifdef __WXDEBUG__ @@ -121,7 +121,7 @@ int wxDisplayFactoryMacOSX::GetFromPoint(const wxPoint& p) return nWhich; } -wxDisplayImpl *wxDisplayFactoryMacOSX::CreateDisplay(size_t n) +wxDisplayImpl *wxDisplayFactoryMacOSX::CreateDisplay(unsigned n) { CGDisplayCount theCount = GetCount(); CGDirectDisplayID* theIDs = new CGDirectDisplayID[theCount]; diff --git a/src/common/dpycmn.cpp b/src/common/dpycmn.cpp index 13b4685281..fe867c595d 100644 --- a/src/common/dpycmn.cpp +++ b/src/common/dpycmn.cpp @@ -118,7 +118,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 +135,7 @@ wxDisplay::~wxDisplay() // static functions forwarded to wxDisplayFactory // ---------------------------------------------------------------------------- -/* static */ size_t wxDisplay::GetCount() +/* static */ unsigned wxDisplay::GetCount() { return Factory().GetCount(); } @@ -247,7 +247,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; diff --git a/src/mac/carbon/display.cpp b/src/mac/carbon/display.cpp index feb556a200..a69b111ae8 100644 --- a/src/mac/carbon/display.cpp +++ b/src/mac/carbon/display.cpp @@ -56,7 +56,7 @@ class wxDisplayImplMacOSX : public wxDisplayImpl { public: - wxDisplayImplMacOSX(size_t n, CGDirectDisplayID id) + wxDisplayImplMacOSX(unsigned n, CGDirectDisplayID id) : wxDisplayImpl(n), m_id(id) { @@ -80,8 +80,8 @@ class wxDisplayFactoryMacOSX : public wxDisplayFactory public: wxDisplayFactoryMacOSX() {} - virtual wxDisplayImpl *CreateDisplay(size_t n); - virtual size_t GetCount(); + virtual wxDisplayImpl *CreateDisplay(unsigned n); + virtual unsigned GetCount(); virtual int GetFromPoint(const wxPoint& pt); protected: @@ -92,7 +92,7 @@ protected: // wxDisplayFactoryMacOSX implementation // ============================================================================ -size_t wxDisplayFactoryMacOSX::GetCount() +unsigned wxDisplayFactoryMacOSX::GetCount() { CGDisplayCount count; #ifdef __WXDEBUG__ @@ -140,7 +140,7 @@ int wxDisplayFactoryMacOSX::GetFromPoint(const wxPoint& p) return nWhich; } -wxDisplayImpl *wxDisplayFactoryMacOSX::CreateDisplay(size_t n) +wxDisplayImpl *wxDisplayFactoryMacOSX::CreateDisplay(unsigned n) { CGDisplayCount theCount = GetCount(); CGDirectDisplayID* theIDs = new CGDirectDisplayID[theCount]; @@ -256,7 +256,7 @@ bool wxDisplayImplMacOSX::ChangeMode( const wxVideoMode& mode ) class wxDisplayImplMac : public wxDisplayImpl { public: - wxDisplayImplMac(size_t n, GDHandle hndl) + wxDisplayImplMac(unsigned n, GDHandle hndl) : wxDisplayImpl(n), m_hndl(hndl) { @@ -280,8 +280,8 @@ class wxDisplayFactoryMac : public wxDisplayFactory public: wxDisplayFactoryMac(); - virtual wxDisplayImpl *CreateDisplay(size_t n); - virtual size_t GetCount(); + virtual wxDisplayImpl *CreateDisplay(unsigned n); + virtual unsigned GetCount(); virtual int GetFromPoint(const wxPoint& pt); protected: @@ -292,9 +292,9 @@ protected: // wxDisplayFactoryMac implementation // ============================================================================ -size_t wxDisplayFactoryMac::GetCount() +unsigned wxDisplayFactoryMac::GetCount() { - size_t num = 0; + unsigned num = 0; GDHandle hndl = DMGetFirstScreenDevice(true); while(hndl) { @@ -306,7 +306,7 @@ size_t wxDisplayFactoryMac::GetCount() int wxDisplayFactoryMac::GetFromPoint(const wxPoint &p) { - size_t num = 0; + unsigned num = 0; GDHandle hndl = DMGetFirstScreenDevice(true); while(hndl) { @@ -325,9 +325,9 @@ int wxDisplayFactoryMac::GetFromPoint(const wxPoint &p) return wxNOT_FOUND; } -wxDisplayImpl *wxDisplayFactoryMac::CreateDisplay(size_t n) +wxDisplayImpl *wxDisplayFactoryMac::CreateDisplay(unsigned n) { - size_t nOrig = n; + unsigned nOrig = n; GDHandle hndl = DMGetFirstScreenDevice(true); while(hndl) diff --git a/src/msw/display.cpp b/src/msw/display.cpp index 0195c675ff..6f7181bfa2 100644 --- a/src/msw/display.cpp +++ b/src/msw/display.cpp @@ -174,7 +174,7 @@ WX_DEFINE_ARRAY_PTR(wxDisplayInfo *, wxDisplayInfoArray); class wxDisplayImplWin32Base : public wxDisplayImpl { public: - wxDisplayImplWin32Base(size_t n, wxDisplayInfo& info) + wxDisplayImplWin32Base(unsigned n, wxDisplayInfo& info) : wxDisplayImpl(n), m_info(info) { @@ -219,7 +219,7 @@ public: bool IsOk() const { return !m_displays.empty(); } - virtual size_t GetCount() { return m_displays.size(); } + virtual unsigned GetCount() { return unsigned(m_displays.size()); } virtual int GetFromPoint(const wxPoint& pt); virtual int GetFromWindow(wxWindow *window); @@ -257,7 +257,7 @@ protected: class wxDisplayImplMultimon : public wxDisplayImplWin32Base { public: - wxDisplayImplMultimon(size_t n, wxDisplayInfo& info) + wxDisplayImplMultimon(unsigned n, wxDisplayInfo& info) : wxDisplayImplWin32Base(n, info) { } @@ -274,7 +274,7 @@ class wxDisplayFactoryMultimon : public wxDisplayFactoryWin32Base public: wxDisplayFactoryMultimon(); - virtual wxDisplayImpl *CreateDisplay(size_t n); + virtual wxDisplayImpl *CreateDisplay(unsigned n); private: // EnumDisplayMonitors() callback @@ -324,7 +324,7 @@ struct wxDisplayInfoDirectDraw : wxDisplayInfo class wxDisplayImplDirectDraw : public wxDisplayImplWin32Base { public: - wxDisplayImplDirectDraw(size_t n, wxDisplayInfo& info, IDirectDraw2 *pDD2) + wxDisplayImplDirectDraw(unsigned n, wxDisplayInfo& info, IDirectDraw2 *pDD2) : wxDisplayImplWin32Base(n, info), m_pDD2(pDD2) { @@ -351,7 +351,7 @@ public: wxDisplayFactoryDirectDraw(); virtual ~wxDisplayFactoryDirectDraw(); - virtual wxDisplayImpl *CreateDisplay(size_t n); + virtual wxDisplayImpl *CreateDisplay(unsigned n); private: // callback used with DirectDrawEnumerateEx() @@ -647,7 +647,7 @@ void wxDisplayFactoryMultimon::AddDisplay(HMONITOR hMonitor, LPRECT lprcMonitor) // wxDisplayFactoryMultimon inherited pure virtuals implementation // ---------------------------------------------------------------------------- -wxDisplayImpl *wxDisplayFactoryMultimon::CreateDisplay(size_t n) +wxDisplayImpl *wxDisplayFactoryMultimon::CreateDisplay(unsigned n) { wxCHECK_MSG( n < m_displays.size(), NULL, _T("invalid display index") ); @@ -888,7 +888,7 @@ void wxDisplayFactoryDirectDraw::AddDisplay(const GUID& guid, // wxDisplayFactoryDirectDraw inherited pure virtuals implementation // ---------------------------------------------------------------------------- -wxDisplayImpl *wxDisplayFactoryDirectDraw::CreateDisplay(size_t n) +wxDisplayImpl *wxDisplayFactoryDirectDraw::CreateDisplay(unsigned n) { wxCHECK_MSG( n < m_displays.size(), NULL, _T("invalid display index") ); diff --git a/src/unix/displayx11.cpp b/src/unix/displayx11.cpp index 3f04ced7e5..f08b0bdcae 100644 --- a/src/unix/displayx11.cpp +++ b/src/unix/displayx11.cpp @@ -71,7 +71,7 @@ public: operator const XineramaScreenInfo *() const { return m_screens; } - size_t GetCount() const { return wx_static_cast(size_t, m_num); } + unsigned GetCount() const { return wx_static_cast(unsigned, m_num); } private: XineramaScreenInfo *m_screens; @@ -85,7 +85,7 @@ private: class WXDLLEXPORT wxDisplayImplX11 : public wxDisplayImpl { public: - wxDisplayImplX11(size_t n, const XineramaScreenInfo& info) + wxDisplayImplX11(unsigned n, const XineramaScreenInfo& info) : wxDisplayImpl(n), m_rect(info.x_org, info.y_org, info.width, info.height) { @@ -110,8 +110,8 @@ class wxDisplayFactoryX11 : public wxDisplayFactory public: wxDisplayFactoryX11() { } - virtual wxDisplayImpl *CreateDisplay(size_t n); - virtual size_t GetCount(); + virtual wxDisplayImpl *CreateDisplay(unsigned n); + virtual unsigned GetCount(); virtual int GetFromPoint(const wxPoint& pt); protected: @@ -122,7 +122,7 @@ protected: // wxDisplayFactoryX11 implementation // ============================================================================ -size_t wxDisplayFactoryX11::GetCount() +unsigned wxDisplayFactoryX11::GetCount() { return ScreensInfo().GetCount(); } @@ -131,8 +131,8 @@ int wxDisplayFactoryX11::GetFromPoint(const wxPoint& p) { ScreensInfo screens; - const size_t numscreens(screens.GetCount()); - for ( size_t i = 0; i < numscreens; ++i ) + const unsigned numscreens(screens.GetCount()); + for ( unsigned i = 0; i < numscreens; ++i ) { const XineramaScreenInfo& s = screens[i]; if ( p.x >= s.x_org && p.x < s.x_org + s.width && @@ -145,7 +145,7 @@ int wxDisplayFactoryX11::GetFromPoint(const wxPoint& p) return wxNOT_FOUND; } -wxDisplayImpl *wxDisplayFactoryX11::CreateDisplay(size_t n) +wxDisplayImpl *wxDisplayFactoryX11::CreateDisplay(unsigned n) { ScreensInfo screens; -- 2.45.2