From: Mart Raudsepp Date: Tue, 29 Nov 2005 12:50:13 +0000 (+0000) Subject: Make wxJoystick::GetNumberJoystick a static method, as the number of X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/da9e956384a0619a0ecaa0bd1e4ba26b133b60a9 Make wxJoystick::GetNumberJoystick a static method, as the number of joysticks attached to the computer is a global property, not one of the specific instance. Patch from Lauri Nurmi. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36284 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/docs/latex/wx/joystick.tex b/docs/latex/wx/joystick.tex index 4f92e49a41..155b2f05fb 100644 --- a/docs/latex/wx/joystick.tex +++ b/docs/latex/wx/joystick.tex @@ -66,7 +66,7 @@ Returns the number of buttons for this joystick. \membersection{wxJoystick::GetNumberJoysticks}\label{wxjoystickgetnumberjoysticks} -\constfunc{int}{GetNumberJoysticks}{\void} +\func{static int}{GetNumberJoysticks}{\void} Returns the number of joysticks currently attached to the computer. diff --git a/include/wx/mac/carbon/joystick.h b/include/wx/mac/carbon/joystick.h index 271db26b0a..dce79f8a37 100644 --- a/include/wx/mac/carbon/joystick.h +++ b/include/wx/mac/carbon/joystick.h @@ -42,7 +42,7 @@ class WXDLLEXPORT wxJoystick: public wxObject //////////////////////////////////////////////////////////////////////////// bool IsOk() const; // Checks that the joystick is functioning - int GetNumberJoysticks() const ; + static int GetNumberJoysticks() ; int GetManufacturerId() const ; int GetProductId() const ; wxString GetProductName() const ; diff --git a/include/wx/mac/classic/joystick.h b/include/wx/mac/classic/joystick.h index 271db26b0a..dce79f8a37 100644 --- a/include/wx/mac/classic/joystick.h +++ b/include/wx/mac/classic/joystick.h @@ -42,7 +42,7 @@ class WXDLLEXPORT wxJoystick: public wxObject //////////////////////////////////////////////////////////////////////////// bool IsOk() const; // Checks that the joystick is functioning - int GetNumberJoysticks() const ; + static int GetNumberJoysticks() ; int GetManufacturerId() const ; int GetProductId() const ; wxString GetProductName() const ; diff --git a/include/wx/mac/corefoundation/joystick.h b/include/wx/mac/corefoundation/joystick.h index a8f589a031..13024b2731 100644 --- a/include/wx/mac/corefoundation/joystick.h +++ b/include/wx/mac/corefoundation/joystick.h @@ -42,7 +42,7 @@ class WXDLLEXPORT wxJoystick: public wxObject //////////////////////////////////////////////////////////////////////////// bool IsOk() const; // Checks that the joystick is functioning - int GetNumberJoysticks() const ; + static int GetNumberJoysticks() ; int GetManufacturerId() const ; int GetProductId() const ; wxString GetProductName() const ; diff --git a/include/wx/os2/joystick.h b/include/wx/os2/joystick.h index 6e5a4c9236..0d1e113d01 100644 --- a/include/wx/os2/joystick.h +++ b/include/wx/os2/joystick.h @@ -42,7 +42,7 @@ class WXDLLEXPORT wxJoystick: public wxObject //////////////////////////////////////////////////////////////////////////// bool IsOk() const; // Checks that the joystick is functioning - int GetNumberJoysticks() const ; + static int GetNumberJoysticks() ; int GetManufacturerId() const ; int GetProductId() const ; wxString GetProductName() const ; diff --git a/include/wx/unix/joystick.h b/include/wx/unix/joystick.h index 7359bfa05e..c52edff09a 100644 --- a/include/wx/unix/joystick.h +++ b/include/wx/unix/joystick.h @@ -46,7 +46,7 @@ class WXDLLEXPORT wxJoystick: public wxObject //////////////////////////////////////////////////////////////////////////// bool IsOk() const; // Checks that the joystick is functioning - int GetNumberJoysticks() const ; + static int GetNumberJoysticks() ; int GetManufacturerId() const ; int GetProductId() const ; wxString GetProductName() const ; diff --git a/include/wx/x11/joystick.h b/include/wx/x11/joystick.h index 52c3c7f56d..81d3c553b5 100644 --- a/include/wx/x11/joystick.h +++ b/include/wx/x11/joystick.h @@ -42,7 +42,7 @@ public: //////////////////////////////////////////////////////////////////////////// bool IsOk() const; // Checks that the joystick is functioning - int GetNumberJoysticks() const ; + static int GetNumberJoysticks() ; int GetManufacturerId() const ; int GetProductId() const ; wxString GetProductName() const ; diff --git a/samples/joytest/joytest.cpp b/samples/joytest/joytest.cpp index 0366659659..65ca2e196c 100644 --- a/samples/joytest/joytest.cpp +++ b/samples/joytest/joytest.cpp @@ -86,7 +86,7 @@ bool MyApp::OnInit() #if wxUSE_STATUSBAR frame->CreateStatusBar(); - frame->SetStatusText(wxString::Format(wxT("Device [%s] (PID:[%i] MID:[%i]) Ready... # of joysticks:[%i]"), stick.GetProductName().c_str(), stick.GetProductId(), stick.GetManufacturerId(), stick.GetNumberJoysticks())); + frame->SetStatusText(wxString::Format(wxT("Device [%s] (PID:[%i] MID:[%i]) Ready... # of joysticks:[%i]"), stick.GetProductName().c_str(), stick.GetProductId(), stick.GetManufacturerId(), wxJoystick::GetNumberJoysticks())); #endif // wxUSE_STATUSBAR frame->CenterOnScreen(); diff --git a/src/mac/carbon/joystick.cpp b/src/mac/carbon/joystick.cpp index facb42c957..c56cf2001a 100644 --- a/src/mac/carbon/joystick.cpp +++ b/src/mac/carbon/joystick.cpp @@ -90,7 +90,7 @@ bool wxJoystick::IsOk() const return FALSE; } -int wxJoystick::GetNumberJoysticks() const +int wxJoystick::GetNumberJoysticks() { // TODO return 0; diff --git a/src/mac/classic/joystick.cpp b/src/mac/classic/joystick.cpp index 0d50a65359..6dd6aefd1b 100644 --- a/src/mac/classic/joystick.cpp +++ b/src/mac/classic/joystick.cpp @@ -88,7 +88,7 @@ bool wxJoystick::IsOk() const return FALSE; } -int wxJoystick::GetNumberJoysticks() const +int wxJoystick::GetNumberJoysticks() { // TODO return 0; diff --git a/src/mac/corefoundation/hidjoystick.cpp b/src/mac/corefoundation/hidjoystick.cpp index 4d104a44f4..bb24ddc33d 100644 --- a/src/mac/corefoundation/hidjoystick.cpp +++ b/src/mac/corefoundation/hidjoystick.cpp @@ -276,7 +276,7 @@ int wxJoystick::GetNumberAxes() const // is all devices with the kHIDUsage_GD_Joystick or kHIDUsage_GD_GamePad // identifiers. //--------------------------------------------------------------------------- -int wxJoystick::GetNumberJoysticks() const +int wxJoystick::GetNumberJoysticks() { return wxHIDDevice::GetCount(kHIDPage_GenericDesktop, kHIDUsage_GD_Joystick) + diff --git a/src/os2/joystick.cpp b/src/os2/joystick.cpp index 0b19280bc7..7d9ec64512 100644 --- a/src/os2/joystick.cpp +++ b/src/os2/joystick.cpp @@ -101,7 +101,7 @@ bool wxJoystick::IsOk() const return false; } -int wxJoystick::GetNumberJoysticks() const +int wxJoystick::GetNumberJoysticks() { // TODO return 0; diff --git a/src/unix/joystick.cpp b/src/unix/joystick.cpp index fcb266cc1d..92e36ad5d7 100644 --- a/src/unix/joystick.cpp +++ b/src/unix/joystick.cpp @@ -283,7 +283,7 @@ bool wxJoystick::IsOk() const return (m_device != -1); } -int wxJoystick::GetNumberJoysticks() const +int wxJoystick::GetNumberJoysticks() { wxString dev_name; int fd, j; diff --git a/src/x11/joystick.cpp b/src/x11/joystick.cpp index 8840ec82e3..dde21cc580 100644 --- a/src/x11/joystick.cpp +++ b/src/x11/joystick.cpp @@ -87,7 +87,7 @@ bool wxJoystick::IsOk() const return FALSE; } -int wxJoystick::GetNumberJoysticks() const +int wxJoystick::GetNumberJoysticks() { // TODO return 0;