Use __WINDOWS__ for OS checks and __WXMSW__ for GUI checks (round 2).

This is continuation of r70796 and serves the same purpose.

Closes #14065, #14066.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70808 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2012-03-04 20:31:42 +00:00
parent 3a1ec1d5dc
commit bb5a951418
33 changed files with 69 additions and 63 deletions

View File

@@ -43,7 +43,7 @@ inline wxUint32 wxAtomicDec (wxUint32 &value)
}
#elif defined(__WXMSW__)
#elif defined(__WINDOWS__)
// include standard Windows headers
#include "wx/msw/wrapwin.h"

View File

@@ -22,7 +22,7 @@
// under Windows we prefer to use the native implementation but can be forced
// to use the file-based one
#if defined(__WXMSW__) && wxUSE_CONFIG_NATIVE
#if defined(__WINDOWS__) && wxUSE_CONFIG_NATIVE
#include "wx/msw/regconf.h"
#define wxConfig wxRegConfig
#elif defined(__WXOS2__) && wxUSE_CONFIG_NATIVE

View File

@@ -22,10 +22,10 @@ WX_DECLARE_USER_EXPORTED_LIST(wxDDEClient, wxDDEClientList, WXDLLIMPEXP_BASE);
WX_DECLARE_USER_EXPORTED_LIST(wxDDEServer, wxDDEServerList, WXDLLIMPEXP_BASE);
WX_DECLARE_USER_EXPORTED_LIST(wxDDEConnection, wxDDEConnectionList, WXDLLIMPEXP_BASE);
#if defined(__WXMSW__)
#if defined(__WINDOWS__)
#include "wx/msw/dde.h"
#else
#error DDE is only supported on MSW
#error DDE is only supported under Windows
#endif
#endif

View File

@@ -39,9 +39,9 @@ private:
wxString m_filename;
};
// under MSW the same file may contain several icons so we also store the
// under Windows the same file may contain several icons so we also store the
// index of the icon
#if defined(__WXMSW__)
#if defined(__WINDOWS__)
class WXDLLIMPEXP_BASE wxIconLocation : public wxIconLocationBase
{
@@ -65,7 +65,7 @@ wxIconLocation::wxIconLocation(const wxString& file, int num)
SetIndex(num);
}
#else // !MSW
#else // !__WINDOWS__
// must be a class because we forward declare it as class
class WXDLLIMPEXP_BASE wxIconLocation : public wxIconLocationBase

View File

@@ -16,7 +16,7 @@
#if wxUSE_JOYSTICK
#if defined(__WXMSW__)
#if defined(__WINDOWS__)
#include "wx/msw/joystick.h"
#elif defined(__WXMOTIF__)
#include "wx/unix/joystick.h"

View File

@@ -28,7 +28,7 @@ extern WXDLLIMPEXP_DATA_CORE(const char) wxListCtrlNameStr[];
// include the wxListCtrl class declaration
// ----------------------------------------------------------------------------
#if defined(__WIN32__) && !defined(__WXUNIVERSAL__)
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
#include "wx/msw/listctrl.h"
#elif defined(__WXMAC__) && !defined(__WXUNIVERSAL__) && wxOSX_USE_CARBON
#include "wx/osx/listctrl.h"

View File

@@ -234,7 +234,7 @@ protected:
#if defined(__WXUNIVERSAL__)
#define wxStatusBarUniv wxStatusBar
#include "wx/univ/statusbr.h"
#elif defined(__WIN32__) && wxUSE_NATIVE_STATUSBAR
#elif defined(__WXMSW__) && wxUSE_NATIVE_STATUSBAR
#include "wx/msw/statusbar.h"
#elif defined(__WXMAC__)
#define wxStatusBarMac wxStatusBar

View File

@@ -22,8 +22,8 @@
#pragma hdrstop
#endif
#ifndef __WXMSW__
#error "This sample is MSW-only"
#ifndef __WINDOWS__
#error "This sample is Windows-only"
#endif
#include "wx/app.h"

View File

@@ -31,8 +31,8 @@
#include "wx/stattext.h"
#include "wx/button.h"
#ifndef __WXMSW__
#error "This sample is MSW-only"
#ifndef __WINDOWS__
#error "This sample is Windows-only"
#endif
#ifdef WXUSINGDLL

View File

@@ -32,7 +32,7 @@
#include "wx/msw/ole/automtn.h"
#ifndef __WXMSW__
#ifndef __WINDOWS__
#error "Sorry, this sample works under Windows only."
#endif

View File

@@ -31,7 +31,7 @@
#include "wx/imaglist.h"
#include "wx/tokenzr.h"
#if wxUSE_CONFIG_NATIVE && defined( __WXMSW__ )
#if wxUSE_CONFIG_NATIVE && defined( __WINDOWS__ )
# define DO_REGTEST 1
#else
# define DO_REGTEST 0

View File

@@ -37,7 +37,7 @@
// define this to use XPMs everywhere (by default, BMPs are used under Win)
// BMPs use less space, but aren't compiled into the executable on other platforms
#ifdef __WXMSW__
#ifdef __WINDOWS__
#define USE_XPM_BITMAPS 0
#else
#define USE_XPM_BITMAPS 1

View File

@@ -163,7 +163,7 @@ void wxMessageOutputStderr::Output(const wxString& str)
void wxMessageOutputDebug::Output(const wxString& str)
{
#if defined(__WXMSW__) && !defined(__WXMICROWIN__)
#if defined(__WINDOWS__) && !defined(__WXMICROWIN__)
wxString out(AppendLineFeedIfNeeded(str));
out.Replace(wxT("\t"), wxT(" "));
out.Replace(wxT("\n"), wxT("\r\n"));
@@ -202,7 +202,7 @@ void wxMessageOutputMessageBox::Output(const wxString& str)
wxString out(str);
// the native MSW msg box understands the TABs, others don't
#ifndef __WXMSW__
#ifndef __WINDOWS__
out.Replace(wxT("\t"), wxT(" "));
#endif

View File

@@ -2111,7 +2111,7 @@ wxFORCE_LINK_MODULE( socketiohandler )
#endif
// same for ManagerSetter in the MSW file
#ifdef __WXMSW__
#ifdef __WINDOWS__
wxFORCE_LINK_MODULE( mswsocket )
#endif

View File

@@ -75,7 +75,7 @@
#include "wx/platinfo.h"
#include "wx/private/window.h"
#ifdef __WXMSW__
#ifdef __WINDOWS__
#include "wx/msw/wrapwin.h"
#endif

View File

@@ -55,7 +55,7 @@
#include "wx/osx/private.h" // includes mac headers
#endif
#ifdef __WXMSW__
#ifdef __WINDOWS__
#include <windows.h>
#include "wx/msw/winundef.h"
#include "wx/volume.h"
@@ -71,7 +71,7 @@
#include <ctype.h>
#endif
#endif
#endif // __WINDOWS__
#if defined(__OS2__) || defined(__DOS__)
#ifdef __OS2__
@@ -310,7 +310,7 @@ int setdrive(int WXUNUSED_IN_WINCE(drive))
#else
newdrive[2] = wxT('\0');
#endif
#if defined(__WXMSW__)
#if defined(__WINDOWS__)
if (::SetCurrentDirectory(newdrive))
#else
// VA doesn't know what LPSTR is and has its own set
@@ -1170,7 +1170,7 @@ void wxGenericDirCtrl::FindChildFiles(wxTreeItemId treeid, int dirFlags, wxArray
wxString dirName(data->m_path);
#if defined(__WXMSW__) || defined(__OS2__)
#if defined(__WINDOWS__) || defined(__OS2__)
if (dirName.Last() == ':')
dirName += wxString(wxFILE_SEP_PATH);
#endif
@@ -1572,7 +1572,7 @@ wxImageList *wxFileIconsTable::GetSmallImageList()
return m_smallImageList;
}
#if wxUSE_MIMETYPE && wxUSE_IMAGE && (!defined(__WXMSW__) || wxUSE_WXDIB)
#if wxUSE_MIMETYPE && wxUSE_IMAGE && (!defined(__WINDOWS__) || wxUSE_WXDIB)
// VS: we don't need this function w/o wxMimeTypesManager because we'll only have
// one icon and we won't resize it
@@ -1732,7 +1732,7 @@ int wxFileIconsTable::GetIconID(const wxString& extension, const wxString& mime)
{
m_smallImageList->Add(bmp);
}
#if wxUSE_IMAGE && (!defined(__WXMSW__) || wxUSE_WXDIB)
#if wxUSE_IMAGE && (!defined(__WINDOWS__) || wxUSE_WXDIB)
else
{
wxImage img = bmp.ConvertToImage();

View File

@@ -35,7 +35,7 @@
#include "wx/tokenzr.h"
#include "wx/imaglist.h"
#ifdef __WXMSW__
#ifdef __WINDOWS__
#include "wx/msw/wrapwin.h"
#endif

View File

@@ -641,9 +641,15 @@ bool wxJoystick::HasPOVCTS() const
bool wxJoystick::SetCapture(wxWindow* win, int pollingFreq)
{
#ifdef __WXMSW__
BOOL changed = (pollingFreq == 0);
MMRESULT res = joySetCapture((HWND) win->GetHWND(), m_joystick, pollingFreq, changed);
return (res == JOYERR_NOERROR);
#else
wxUnusedVar(win);
wxUnusedVar(pollingFreq);
return false;
#endif
}
bool wxJoystick::ReleaseCapture()

View File

@@ -409,7 +409,7 @@ void TempDir::RemoveDir(wxString& path)
# define WXARC_pclose(fp)
#endif
#ifdef __WXMSW__
#ifdef __WINDOWS__
# define WXARC_b "b"
#else
# define WXARC_b
@@ -661,7 +661,7 @@ void ArchiveTestCase<ClassFactoryT>::CreateArchive(wxOutputStream& out,
wxFileName fn(i->first, wxPATH_UNIX);
TestEntry& entry = *i->second;
wxDateTime dt = entry.GetDateTime();
#ifdef __WXMSW__
#ifdef __WINDOWS__
if (fn.IsDir())
entry.SetDateTime(wxDateTime());
else
@@ -806,7 +806,7 @@ void ArchiveTestCase<ClassFactoryT>::ExtractArchive(wxInputStream& in)
const TestEntry& testEntry = *it->second;
#ifndef __WXMSW__
#ifndef __WINDOWS__
// On Windows some archivers compensate for Windows DST handling, but
// other don't, so disable the test for now.
wxDateTime dt = testEntry.GetDateTime();
@@ -950,7 +950,7 @@ void ArchiveTestCase<ClassFactoryT>::VerifyDir(wxString& path,
const TestEntry& testEntry = *it->second;
#if 0 //ndef __WXMSW__
#if 0 //ndef __WINDOWS__
CPPUNIT_ASSERT_MESSAGE("timestamp check" + error_context,
testEntry.GetDateTime() ==
wxFileName(path).GetModificationTime());
@@ -1300,7 +1300,7 @@ void ArchiveTestSuite::AddCmd(wxArrayString& cmdlist, const wxString& cmd)
bool ArchiveTestSuite::IsInPath(const wxString& cmd)
{
wxString c = cmd.BeforeFirst(wxT(' '));
#ifdef __WXMSW__
#ifdef __WINDOWS__
c += wxT(".exe");
#endif
return !m_path.FindValidPath(c).empty();

View File

@@ -356,7 +356,7 @@ BENCHMARK_FUNC(StringCmpNoCase)
// Also benchmark various native functions under MSW. Surprisingly/annoyingly
// they sometimes have vastly better performance than alternatives, especially
// for case-sensitive comparison (see #10375).
#ifdef __WXMSW__
#ifdef __WINDOWS__
#include "wx/msw/wrapwin.h"
@@ -400,7 +400,7 @@ BENCHMARK_FUNC(MSWCompareStringIgnoreCase)
) == CSTR_EQUAL;
}
#endif // __WXMSW__
#endif // __WINDOWS__
// ----------------------------------------------------------------------------
// string buffers: wx[W]CharBuffer

View File

@@ -27,7 +27,7 @@
#define ASYNC_COMMAND "xclock"
#define SHELL_COMMAND "echo hi from shell>/dev/null"
#define COMMAND_NO_OUTPUT "echo -n"
#elif defined(__WXMSW__)
#elif defined(__WINDOWS__)
#define COMMAND "cmd.exe /c \"echo hi\""
#define ASYNC_COMMAND "notepad"
#define SHELL_COMMAND "echo hi > nul:"

View File

@@ -178,7 +178,7 @@ void DirTestCase::DirExists()
{ ".", true },
{ "..", true },
{ "$USER_DOCS_DIR", true },
#if defined(__WXMSW__)
#if defined(__WINDOWS__)
{ "$USER_DOCS_DIR\\", true },
{ "$USER_DOCS_DIR\\\\", true },
{ "..\\..", true },
@@ -202,20 +202,20 @@ void DirTestCase::DirExists()
#endif
};
#ifdef __WXMSW__
#ifdef __WINDOWS__
wxString homedrive = wxGetenv("HOMEDRIVE");
if ( homedrive.empty() )
homedrive = "c:";
#endif // __WXMSW__
#endif // __WINDOWS__
for ( size_t n = 0; n < WXSIZEOF(testData); n++ )
{
wxString dirname = testData[n].dirname;
dirname.Replace("$USER_DOCS_DIR", wxStandardPaths::Get().GetDocumentsDir());
#ifdef __WXMSW__
#ifdef __WINDOWS__
dirname.Replace("$MSW_DRIVE", homedrive);
#endif // __WXMSW__
#endif // __WINDOWS__
std::string errDesc = wxString::Format("failed on directory '%s'", dirname).ToStdString();
CPPUNIT_ASSERT_EQUAL_MESSAGE(errDesc, testData[n].shouldExist, wxDir::Exists(dirname));

View File

@@ -26,9 +26,9 @@
#include "wx/stdpaths.h"
#include "wx/scopeguard.h"
#ifdef __WXMSW__
#ifdef __WINDOWS__
#include "wx/msw/registry.h"
#endif // __WXMSW__
#endif // __WINDOWS__
#ifdef __UNIX__
#include <unistd.h>
@@ -323,7 +323,7 @@ void FileNameTestCase::TestNormalize()
} tests[] =
{
// test wxPATH_NORM_ENV_VARS
#ifdef __WXMSW__
#ifdef __WINDOWS__
{ "%ABCDEF%/g/h/i", wxPATH_NORM_ENV_VARS, "abcdef/g/h/i", wxPATH_UNIX },
#else
{ "$(ABCDEF)/g/h/i", wxPATH_NORM_ENV_VARS, "abcdef/g/h/i", wxPATH_UNIX },
@@ -407,7 +407,7 @@ void FileNameTestCase::TestNormalize()
// and also that the registry key was changed recently and didn't take
// effect yet but these are marginal cases which we consciously choose to
// ignore for now)
#ifdef __WXMSW__
#ifdef __WINDOWS__
long shortNamesDisabled;
if ( wxRegKey
(
@@ -421,7 +421,7 @@ void FileNameTestCase::TestNormalize()
CPPUNIT_ASSERT_EQUAL( "..\\mkinstalldirs", fn.GetFullPath() );
}
//else: when in doubt, don't run the test
#endif // __WXMSW__
#endif // __WINDOWS__
}
void FileNameTestCase::TestReplace()
@@ -605,7 +605,7 @@ void FileNameTestCase::TestCreateTempFileName()
{ "foo", "$SYSTEM_TEMP", true },
{ "..", "$SYSTEM_TEMP", true },
{ "../bar", "..", true },
#ifdef __WXMSW__
#ifdef __WINDOWS__
{ "$USER_DOCS_DIR\\", "$USER_DOCS_DIR", true },
{ "c:\\a\\directory\\which\\does\\not\\exist", "", false },
#elif defined( __UNIX__ )

View File

@@ -428,9 +428,9 @@ private:
CPPUNIT_TEST( TestEventModify );
// MSW implementation doesn't detect file access events currently
#ifndef __WXMSW__
#ifndef __WINDOWS__
CPPUNIT_TEST( TestEventAccess );
#endif // __WXMSW__
#endif // __WINDOWS__
#endif // !wxHAS_KQUEUE
CPPUNIT_TEST( TestNoEventsAfterRemove );

View File

@@ -90,7 +90,7 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( InteractiveOutputTestCase, "InteractiveOu
// wxDllLoader
// ----------------------------------------------------------------------------
#if !defined(__WXMSW__) && !defined(__UNIX__)
#if !defined(__WINDOWS__) && !defined(__UNIX__)
#undef TEST_DYNLIB
#endif

View File

@@ -46,7 +46,7 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( DynamicLibraryTestCase, "DynamicLibraryTe
void DynamicLibraryTestCase::Load()
{
#if defined(__WXMSW__)
#if defined(__WINDOWS__)
static const wxChar *LIB_NAME = wxT("kernel32.dll");
static const wxChar *FUNC_NAME = wxT("lstrlenA");
#elif defined(__UNIX__)
@@ -74,7 +74,7 @@ void DynamicLibraryTestCase::Load()
// Call the function dynamically loaded
CPPUNIT_ASSERT( pfnStrlen("foo") == 3 );
#ifdef __WXMSW__
#ifdef __WINDOWS__
static const wxChar *FUNC_NAME_AW = wxT("lstrlen");
typedef int (wxSTDCALL *wxStrlenTypeAorW)(const wxChar *);
@@ -86,5 +86,5 @@ void DynamicLibraryTestCase::Load()
CPPUNIT_ASSERT_MESSAGE( errMsg2.ToStdString(), pfnStrlenAorW );
CPPUNIT_ASSERT( pfnStrlenAorW(wxT("foobar")) == 6 );
#endif // __WXMSW__
#endif // __WINDOWS__
}

View File

@@ -262,4 +262,4 @@ void IPCTestCase::Disconnect()
#endif // wxUSE_THREADS
#endif // !__WXMSW__
#endif // !__WINDOWS__

View File

@@ -35,7 +35,7 @@
#include "wx/filename.h"
#include "wx/wfstream.h"
#ifdef __WXMSW__
#ifdef __WINDOWS__
#include "wx/msw/wrapwin.h"
#ifdef __VISUALC__
// 'nonstandard extension used : nameless struct/union' occurs inside
@@ -305,7 +305,7 @@ CppUnit::Test *largeFile::suite()
// are picked up. However this is only possible when sparse files are
// supported otherwise the tests require too much disk space.
#ifdef __WXMSW__
#ifdef __WINDOWS__
#ifndef FILE_SUPPORTS_SPARSE_FILES
#define FILE_SUPPORTS_SPARSE_FILES 0x00000040
@@ -400,7 +400,7 @@ CppUnit::Test* GetlargeFileSuite()
return NULL;
}
#else // __WXMSW__
#else // __WINDOWS__
bool IsFAT(const wxString& WXUNUSED(path)) { return false; }
void MakeSparse(const wxString& WXUNUSED(path), int WXUNUSED(fd)) { }
@@ -436,7 +436,7 @@ CppUnit::Test* GetlargeFileSuite()
return NULL;
}
#endif // __WXMSW__
#endif // __WINDOWS__
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(largeFile, "largeFile");
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(largeFile, "Streams.largeFile");

View File

@@ -93,7 +93,7 @@ TextStreamTestCase::TextStreamTestCase()
{
}
#if defined(__WXMSW__) || defined(__WXPM__)
#if defined(__WINDOWS__) || defined(__WXPM__)
# define NEWLINE "\r\n"
# define NEWLINELEN 2
#elif defined(__WXMAC__) && !defined(__DARWIN__)

View File

@@ -272,7 +272,7 @@ void VarArgTestCase::ArgsValidation()
// check size_t handling
size_t len = sizeof(*this);
#ifdef __WXMSW__
#ifdef __WINDOWS__
wxString::Format("%Iu", len);
#else
wxString::Format("%zu", len);

View File

@@ -425,7 +425,7 @@ void VsnprintfTestCase::LongLong()
CMP3("123456789", "%llu", (wxULongLong_t)123456789);
#ifdef __WXMSW__
#ifdef __WINDOWS__
CMP3("123456789", "%I64d", (wxLongLong_t)123456789);
CMP3("123456789abcdef", "%I64x", wxLL(0x123456789abcdef));
#endif

View File

@@ -45,7 +45,7 @@
#include <exception>
#include <iostream>
#ifdef __WXMSW__
#ifdef __WINDOWS__
#include "wx/msw/msvcrt.h"
#endif

View File

@@ -75,7 +75,7 @@ void XLocaleTestCase::TestCtor()
#ifdef wxHAS_XLOCALE_SUPPORT
CPPUNIT_ASSERT( wxXLocale(wxLANGUAGE_FRENCH).IsOk() );
#ifdef __WXMSW__
#ifdef __WINDOWS__
CPPUNIT_ASSERT( wxXLocale("french").IsOk() );
#else
CPPUNIT_ASSERT( wxXLocale("fr_FR").IsOk() );