many changes; major ones:

1. start of !wxUSE_GUI support
2. _T() macro renamed to T()
3. wxConvertWX2MB and MB2WX macro added


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3828 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1999-10-04 20:15:38 +00:00
parent 9841339c74
commit e90c1d2a19
298 changed files with 5153 additions and 4672 deletions

View File

@@ -37,7 +37,9 @@
#include "wx/event.h" // for the base class
#include "wx/window.h" // for wxTopLevelWindows
#if wxUSE_GUI
#include "wx/window.h" // for wxTopLevelWindows
#endif // wxUSE_GUI
#if wxUSE_LOG
#include "wx/log.h"
@@ -64,22 +66,33 @@ public:
// prevents the program from continuing - it's a good place to create
// the top level program window and return TRUE.
//
// Override: always.
// Override: always in GUI application, rarely in console ones.
#if wxUSE_GUI
virtual bool OnInit() { return FALSE; };
#else // !GUI
virtual bool OnInit() { return TRUE; };
#endif // wxUSE_GUI
#if wxUSE_GUI
// a platform-dependent version of OnInit(): the code here is likely to
// depend on the toolkit. default version does nothing.
//
// Override: rarely.
virtual bool OnInitGui() { return TRUE; }
#endif // wxUSE_GUI
// called to start program execution - the default version just enters
// the main GUI loop in which events are received and processed until
// the last window is not deleted (if GetExitOnFrameDelete) or
// ExitMainLoop() is called.
// ExitMainLoop() is called. In console mode programs, the execution
// of the program really starts here
//
// Override: rarely.
// Override: rarely in GUI applications, always in console ones.
#if wxUSE_GUI
virtual int OnRun() { return MainLoop(); };
#else // !GUI
virtual int OnRun() = 0;
#endif // wxUSE_GUI
// called after the main loop termination. This is a good place for
// cleaning up (it may be too late in dtor) and is also useful if you
@@ -102,6 +115,7 @@ public:
// the worker functions - usually not used directly by the user code
// -----------------------------------------------------------------
#if wxUSE_GUI
// execute the main GUI loop, the function returns when the loop ends
virtual int MainLoop() = 0;
@@ -118,6 +132,7 @@ public:
// process the first event in the event queue (blocks until an event
// apperas if there are none currently)
virtual void Dispatch() = 0;
#endif // wxUSE_GUI
// application info: name, description, vendor
// -------------------------------------------
@@ -144,6 +159,7 @@ public:
const wxString& GetVendorName() const { return m_vendorName; }
void SetVendorName(const wxString& name) { m_vendorName = name; }
#if wxUSE_GUI
// top level window functions
// --------------------------
@@ -171,6 +187,8 @@ public:
void SetExitOnFrameDelete(bool flag) { m_exitOnFrameDelete = flag; }
bool GetExitOnFrameDelete() const { return m_exitOnFrameDelete; }
#endif // wxUSE_GUI
// miscellaneous customization functions
// -------------------------------------
@@ -179,10 +197,15 @@ public:
// user-defined class (default implementation creates a wxLogGui
// object) - this log object is used by default by all wxLogXXX()
// functions.
virtual wxLog *CreateLogTarget() { return new wxLogGui; }
virtual wxLog *CreateLogTarget()
#if wxUSE_GUI
{ return new wxLogGui; }
#else // !GUI
{ return new wxLogStderr; }
#endif // wxUSE_GUI
#endif // wxUSE_LOG
#if wxUSE_GUI
// get the standard icon used by wxWin dialogs - this allows the user
// to customize the standard dialogs. The 'which' parameter is one of
// wxICON_XXX values
@@ -198,6 +221,7 @@ public:
// printing.
virtual void SetPrintMode(int WXUNUSED(mode)) { }
int GetPrintMode() const { return wxPRINT_POSTSCRIPT; }
#endif // wxUSE_GUI
// implementation only from now on
// -------------------------------
@@ -228,29 +252,35 @@ protected:
// TRUE if the application wants to get debug output
bool m_wantDebugOutput;
#if wxUSE_GUI
// the main top level window - may be NULL
wxWindow *m_topWindow;
#endif // wxUSE_GUI
};
// ----------------------------------------------------------------------------
// now include the declaration of the real class
// ----------------------------------------------------------------------------
#if defined(__WXMSW__)
#include "wx/msw/app.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/app.h"
#elif defined(__WXQT__)
#include "wx/qt/app.h"
#elif defined(__WXGTK__)
#include "wx/gtk/app.h"
#elif defined(__WXMAC__)
#include "wx/mac/app.h"
#elif defined(__WXPM__)
#include "wx/os2/app.h"
#elif defined(__WXSTUBS__)
#include "wx/stubs/app.h"
#endif
#if wxUSE_GUI
#if defined(__WXMSW__)
#include "wx/msw/app.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/app.h"
#elif defined(__WXQT__)
#include "wx/qt/app.h"
#elif defined(__WXGTK__)
#include "wx/gtk/app.h"
#elif defined(__WXMAC__)
#include "wx/mac/app.h"
#elif defined(__WXPM__)
#include "wx/os2/app.h"
#elif defined(__WXSTUBS__)
#include "wx/stubs/app.h"
#endif
#else // !GUI
typedef wxAppBase wxApp;
#endif // GUI/!GUI
// ----------------------------------------------------------------------------
// the global data
@@ -266,11 +296,34 @@ WXDLLEXPORT_DATA(extern wxApp*) wxTheApp;
// global functions
// ----------------------------------------------------------------------------
// event loop related functions only work in GUI programs
// ------------------------------------------------------
#if wxUSE_GUI
// Force an exit from main loop
void WXDLLEXPORT wxExit();
extern void WXDLLEXPORT wxExit();
// Yield to other apps/messages
bool WXDLLEXPORT wxYield();
extern bool WXDLLEXPORT wxYield();
#endif // wxUSE_GUI
// console applications may avoid using DECLARE_APP and IMPLEMENT_APP macros
// and call these functions instead at the program startup and termination
// -------------------------------------------------------------------------
#if wxUSE_NOGUI
// initialize the library (may be called as many times as needed, but each
// call to wxInitialize() must be matched by wxUninitialize())
extern bool WXDLLEXPORT wxInitialize();
// clean up - the library can't be used any more after the last call to
// wxUninitialize()
extern void WXDLLEXPORT wxUninitialize();
#endif // wxUSE_NOGUI
// ----------------------------------------------------------------------------
// macros for dynamic creation of the application object

View File

@@ -2,7 +2,7 @@
// Name: listimpl.cpp
// Purpose: helper file for implementation of dynamic lists
// Author: Vadim Zeitlin
// Modified by:
// Modified by:
// Created: 16.10.97
// RCS-ID: $Id$
// Copyright: (c) 1997 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
@@ -20,6 +20,9 @@
* 4) WX_DEFINE_OBJARRAY *
*****************************************************************************/
// needed to resolve the conflict between global T and macro parameter T
#define _WX_ERROR_REMOVE2(x) T("bad index in " #x "::Remove()")
// macro implements remaining (not inline) methods of template list
// (it's private to this file)
#undef _DEFINE_OBJARRAY
@@ -58,7 +61,7 @@ void name::Empty() \
\
void name::Remove(size_t uiIndex) \
{ \
wxCHECK_RET( uiIndex < Count(), _T("bad index in " #name "::Remove()") ); \
wxCHECK_RET( uiIndex < Count(), _WX_ERROR_REMOVE2(name) ); \
\
delete (T*)wxBaseArray::Item(uiIndex); \
\
@@ -99,8 +102,8 @@ int name::Index(const T& Item, bool bFromEnd) const \
} \
} \
\
return wxNOT_FOUND; \
}
return wxNOT_FOUND; \
}
// redefine the macro so that now it will generate the class implementation
// old value would provoke a compile-time error if this file is not included

View File

@@ -15,6 +15,7 @@
#define _WX_BUFFER_H
#include "wx/wxchar.h"
#include <string.h> // strdup
// ----------------------------------------------------------------------------
@@ -27,14 +28,14 @@ class wxCharBuffer
public:
wxCharBuffer(const char *str)
{
wxASSERT_MSG( str, _T("NULL string in wxCharBuffer") );
wxASSERT_MSG( str, T("NULL string in wxCharBuffer") );
m_str = str ? strdup(str) : (char *)NULL;
}
wxCharBuffer(size_t len)
{
m_str = (char *)malloc(len+1);
m_str[len] = '\0';
m_str[len] = '\0';
}
// no need to check for NULL, free() does it
~wxCharBuffer() { free(m_str); }
@@ -66,7 +67,7 @@ class wxWCharBuffer
public:
wxWCharBuffer(const wchar_t *wcs)
{
wxASSERT_MSG( wcs, _T("NULL string in wxWCharBuffer") );
wxASSERT_MSG( wcs, T("NULL string in wxWCharBuffer") );
if (wcs) {
size_t siz = (wcslen(wcs)+1)*sizeof(wchar_t);
@@ -78,7 +79,7 @@ public:
wxWCharBuffer(size_t len)
{
m_wcs = (wchar_t *)malloc((len+1)*sizeof(wchar_t));
m_wcs[len] = L'\0';
m_wcs[len] = L'\0';
}
// no need to check for NULL, free() does it
@@ -100,23 +101,23 @@ public:
operator const wchar_t *() const { return m_wcs; }
wchar_t operator[](size_t n) const { return m_wcs[n]; }
private:
wchar_t *m_wcs;
};
#endif
#if wxUSE_UNICODE
#define wxMB2WXbuf wxWCharBuffer
#define wxWX2MBbuf wxCharBuffer
#define wxWC2WXbuf wxChar*
#define wxWX2WCbuf wxChar*
#else
#define wxMB2WXbuf wxChar*
#define wxWX2MBbuf wxChar*
#define wxWC2WXbuf wxCharBuffer
#define wxWX2WCbuf wxWCharBuffer
#endif
#define wxMB2WXbuf wxWCharBuffer
#define wxWX2MBbuf wxCharBuffer
#define wxWC2WXbuf wxChar*
#define wxWX2WCbuf wxChar*
#else // ANSI
#define wxMB2WXbuf wxChar*
#define wxWX2MBbuf wxChar*
#define wxWC2WXbuf wxCharBuffer
#define wxWX2WCbuf wxWCharBuffer
#endif // Unicode/ANSI
// ----------------------------------------------------------------------------
// template class for any kind of data

View File

@@ -1,12 +1,12 @@
/////////////////////////////////////////////////////////////////////////////
// Name: debug.h
// Name: wx/debug.h
// Purpose: Misc debug functions and macros
// Author: Vadim Zeitlin
// Modified by:
// Created: 29/01/98
// RCS-ID: $Id$
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
// Licence: wxWindows license
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DEBUG_H_
@@ -16,24 +16,19 @@
#include "wx/wxchar.h"
#ifndef __TFILE__
#define __XFILE__(x) _T(x)
#define __TFILE__ __XFILE__(__FILE__)
#endif
// ----------------------------------------------------------------------------
/**
@name Debugging macros
/**
@name Debugging macros
All debugging macros rely on ASSERT() which in turn calls user-defined
OnAssert() function. To keep things simple, it's called even when the
expression is TRUE (i.e. everything is ok) and by default does nothing: just
returns the same value back. But if you redefine it to do something more sexy
(popping up a message box in your favourite GUI, sending you e-mail or
(popping up a message box in your favourite GUI, sending you e-mail or
whatever) it will affect all ASSERTs, FAILs and CHECKs in your code.
<BR>
<BR>
<b>Warning</b>: if you don't like advices on programming style, don't read
<b>Warning</b>: if you don't like advices on programming style, don't read
further! ;-)
<BR>
<BR>
@@ -94,13 +89,13 @@
// NB: these macros work also in release mode!
/**
/**
These macros must be used only in invalid situation: for example, an
invalid parameter (NULL pointer) is passed to a function. Instead of
dereferencing it and causing core dump the function might try using
CHECK( p != NULL ) or CHECK( p != NULL, return LogError("p is NULL!!") )
@name Macros which remain even in 'release' mode
@name Macros which remain even in 'release' mode
*/
//@{
/// check that expression is true, "return" if not (also FAILs in debug mode)

View File

@@ -115,13 +115,11 @@
# pragma suppress 571 // Virtual function hiding
#endif // __SALFORDC__
#ifdef __VISUALC__
#ifndef WIN32
// VC1.5 does not have LPTSTR type
#define LPTSTR LPSTR
#define LPCTSTR LPCSTR
#endif
#endif
#if defined(__VISUALC__) && !defined(WIN32)
// VC1.5 does not have LPTSTR type
#define LPTSTR LPSTR
#define LPCTSTR LPCSTR
#endif // VC++ 1.5
// Digital Unix C++ compiler only defines this symbol for .cxx and .hxx files,
// so define it ourselves
@@ -190,8 +188,9 @@
// Make sure the environment is set correctly
#if defined(__WXMSW__) && defined(__X__)
#error "Target can't be both X and Windows"
#elif !defined(__WXMOTIF__) && !defined(__WXMSW__) && !defined(__WXGTK__) && !defined(__WXPM__) && \
!defined(__WXMAC__) && !defined(__X__) && !defined(__WXQT__) && !defined(__WXSTUBS__)
#elif !defined(__WXMOTIF__) && !defined(__WXMSW__) && !defined(__WXGTK__) && \
!defined(__WXPM__) && !defined(__WXMAC__) && !defined(__X__) && \
!defined(__WXQT__) && !defined(__WXSTUBS__) && wxUSE_GUI
#error "No Target! Use -D[__WXMOTIF__|__WXGTK__|__WXMSW__|__WXMAC__|__WXQT__|__WXPM__|__WXSTUBS__]"
#endif
@@ -215,6 +214,17 @@
#include "wx/version.h"
// ----------------------------------------------------------------------------
// compatibility defines
// ----------------------------------------------------------------------------
// possibility to build non GUI apps is new, so don't burden ourselves with
// compatibility code
#if !wxUSE_GUI
#undef WXWIN_COMPATIBILITY_2
#define WXWIN_COMPATIBILITY_2 0
#endif // !GUI
// ============================================================================
// non portable C++ features
// ============================================================================
@@ -223,21 +233,14 @@
// check for native bool type and TRUE/FALSE constants
// ----------------------------------------------------------------------------
#if defined(__WXMOTIF__) || defined(__WXGTK__) || defined(__WXQT__) || defined(__WXPM__) || defined(__WXSTUBS__)
// Bool is now obsolete, use bool instead
// typedef int Bool;
// define boolean constants if not done yet
#ifndef TRUE
#define TRUE 1
#endif
#ifndef TRUE
#define TRUE 1
#define FALSE 0
#define Bool_DEFINED
#endif
#elif defined(__WXMSW__)
#ifndef TRUE
#define TRUE 1
#define FALSE 0
#endif
#endif // TRUE/FALSE
#ifndef FALSE
#define FALSE 0
#endif
// Add more tests here for Windows compilers that already define bool
// (under Unix, configure tests for this)

View File

@@ -24,7 +24,7 @@
extern const wxChar *wxEmptyString;
#define WXDIALUP_MANAGER_DEFAULT_BEACONHOST _T("www.yahoo.com")
#define WXDIALUP_MANAGER_DEFAULT_BEACONHOST T("www.yahoo.com")
// ----------------------------------------------------------------------------
// A class which groups functions dealing with connecting to the network from a
@@ -78,7 +78,7 @@ public:
bool async = TRUE) = 0;
// returns TRUE if (async) dialing is in progress
virtual bool IsDialling() const = 0;
virtual bool IsDialing() const = 0;
// cancel dialing the number initiated with Dial(async = TRUE)
// NB: this won't result in DISCONNECTED event being sent
@@ -129,8 +129,8 @@ public:
// Sets the commands to start up the network and to hang up again. Used by
// the Unix implementations only.
virtual void
SetConnectCommand(const wxString& commandDial = _T("/usr/bin/pon"),
const wxString& commandHangup = _T("/usr/bin/poff")) = 0;
SetConnectCommand(const wxString& commandDial = T("/usr/bin/pon"),
const wxString& commandHangup = T("/usr/bin/poff")) = 0;
};
// ----------------------------------------------------------------------------

View File

@@ -151,6 +151,11 @@ private:
// template classes
// ============================================================================
// resolves the name conflict between the T() macor and T typedef: we can't
// use T() inside WX_DEFINE_ARRAY!
#define _WX_ERROR_SIZEOF T("illegal use of DEFINE_ARRAY")
#define _WX_ERROR_REMOVE T("removing inexisting element in wxArray::Remove")
// ----------------------------------------------------------------------------
// This macro generates a new array class. It is intended for storage of simple
// types of sizeof()<=sizeof(long) or pointers if sizeof(pointer)<=sizeof(long)
@@ -170,7 +175,7 @@ public: \
size_t type = sizeof(T); \
size_t sizelong = sizeof(long); \
if ( type > sizelong ) \
{ wxFAIL_MSG( _T("illegal use of DEFINE_ARRAY") ); } \
{ wxFAIL_MSG( _WX_ERROR_SIZEOF ); } \
} \
\
name& operator=(const name& src) \
@@ -197,7 +202,7 @@ public: \
void Remove(T Item) \
{ int iIndex = Index(Item); \
wxCHECK2_MSG( iIndex != wxNOT_FOUND, return, \
_T("removing inexisting element in wxArray::Remove") ); \
_WX_ERROR_REMOVE); \
wxBaseArray::Remove((size_t)iIndex); } \
\
void Sort(CMPFUNC##T fCmp) { wxBaseArray::Sort((CMPFUNC)fCmp); } \
@@ -232,7 +237,7 @@ public: \
{ size_t type = sizeof(T); \
size_t sizelong = sizeof(long); \
if ( type > sizelong ) \
{ wxFAIL_MSG( _T("illegal use of DEFINE_ARRAY") ); } \
{ wxFAIL_MSG( _WX_ERROR_SIZEOF ); } \
m_fnCompare = fn; \
} \
\
@@ -259,7 +264,7 @@ public: \
void Remove(T Item) \
{ int iIndex = Index(Item); \
wxCHECK2_MSG( iIndex != wxNOT_FOUND, return, \
_T("removing inexisting element in wxArray::Remove") ); \
_WX_ERROR_REMOVE ); \
wxBaseArray::Remove((size_t)iIndex); } \
\
private: \

View File

@@ -18,16 +18,30 @@
#include "wx/defs.h"
#include "wx/object.h"
#include "wx/gdicmn.h"
#if wxUSE_GUI
#include "wx/gdicmn.h"
#endif
#if wxUSE_THREADS
#include "wx/thread.h"
#endif
/*
* Event types
*
*/
// ----------------------------------------------------------------------------
// forward declarations
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxList;
#if wxUSE_GUI
class WXDLLEXPORT wxClientData;
class WXDLLEXPORT wxDC;
class WXDLLEXPORT wxMenu;
#endif // wxUSE_GUI
// ----------------------------------------------------------------------------
// Event types
// ----------------------------------------------------------------------------
typedef int wxEventType;
@@ -336,6 +350,8 @@ public:
bool m_isCommandEvent;
};
#if wxUSE_GUI
// Item or menu event class
/*
wxEVT_COMMAND_BUTTON_CLICKED
@@ -354,8 +370,6 @@ public:
wxEVT_COMMAND_COMBOBOX_SELECTED
*/
class WXDLLEXPORT wxClientData;
class WXDLLEXPORT wxCommandEvent : public wxEvent
{
DECLARE_DYNAMIC_CLASS(wxCommandEvent)
@@ -523,7 +537,6 @@ public:
wxEVT_NC_RIGHT_DCLICK,
*/
class WXDLLEXPORT wxDC;
class WXDLLEXPORT wxMouseEvent : public wxEvent
{
DECLARE_DYNAMIC_CLASS(wxMouseEvent)
@@ -764,7 +777,6 @@ public:
wxEVT_ERASE_BACKGROUND
*/
class WXDLLEXPORT wxDC;
class WXDLLEXPORT wxEraseEvent : public wxEvent
{
DECLARE_DYNAMIC_CLASS(wxEraseEvent)
@@ -884,7 +896,7 @@ public:
{
// GetVeto() will return FALSE anyhow...
wxCHECK_RET( m_canVeto,
_T("call to Veto() ignored (can't veto this event)") );
T("call to Veto() ignored (can't veto this event)") );
m_veto = veto;
}
@@ -1069,36 +1081,11 @@ public:
void CopyObject(wxObject& obj) const;
};
// Idle event
/*
wxEVT_IDLE
*/
class WXDLLEXPORT wxIdleEvent : public wxEvent
{
DECLARE_DYNAMIC_CLASS(wxIdleEvent)
public:
wxIdleEvent()
{ m_eventType = wxEVT_IDLE; m_requestMore = FALSE; }
void RequestMore(bool needMore = TRUE) { m_requestMore = needMore; }
bool MoreRequested() const { return m_requestMore; }
void CopyObject(wxObject& obj) const;
protected:
bool m_requestMore;
};
// Update UI event
/*
wxEVT_UPDATE_UI
*/
class WXDLLEXPORT wxMenu;
class WXDLLEXPORT wxWindow;
class WXDLLEXPORT wxUpdateUIEvent : public wxCommandEvent
{
DECLARE_DYNAMIC_CLASS(wxUpdateUIEvent)
@@ -1256,6 +1243,30 @@ public:
wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); }
};
#endif // wxUSE_GUI
// Idle event
/*
wxEVT_IDLE
*/
class WXDLLEXPORT wxIdleEvent : public wxEvent
{
DECLARE_DYNAMIC_CLASS(wxIdleEvent)
public:
wxIdleEvent()
{ m_eventType = wxEVT_IDLE; m_requestMore = FALSE; }
void RequestMore(bool needMore = TRUE) { m_requestMore = needMore; }
bool MoreRequested() const { return m_requestMore; }
void CopyObject(wxObject& obj) const;
protected:
bool m_requestMore;
};
/* TODO
wxEVT_POWER,
wxEVT_MOUSE_CAPTURE_CHANGED,
@@ -1267,11 +1278,6 @@ public:
wxEVT_COMPARE_ITEM
*/
class WXDLLEXPORT wxWindow;
class WXDLLEXPORT wxControl;
// struct WXDLLEXPORT wxEventTableEntry;
typedef void (wxObject::*wxObjectEventFunction)(wxEvent&);
struct WXDLLEXPORT wxEventTableEntry
@@ -1312,7 +1318,7 @@ public:
virtual void OnCommand(wxWindow& WXUNUSED(win),
wxCommandEvent& WXUNUSED(event))
{
wxFAIL_MSG(_T("shouldn't be called any more"));
wxFAIL_MSG(T("shouldn't be called any more"));
}
// Called if child control has no callback function
@@ -1373,6 +1379,7 @@ protected:
};
typedef void (wxEvtHandler::*wxEventFunction)(wxEvent&);
#if wxUSE_GUI
typedef void (wxEvtHandler::*wxCommandEventFunction)(wxCommandEvent&);
typedef void (wxEvtHandler::*wxScrollEventFunction)(wxScrollEvent&);
typedef void (wxEvtHandler::*wxScrollWinEventFunction)(wxScrollWinEvent&);
@@ -1398,6 +1405,7 @@ typedef void (wxEvtHandler::*wxMaximizeEventFunction)(wxShowEvent&);
typedef void (wxEvtHandler::*wxNavigationKeyEventFunction)(wxNavigationKeyEvent&);
typedef void (wxEvtHandler::*wxPaletteChangedEventFunction)(wxPaletteChangedEvent&);
typedef void (wxEvtHandler::*wxQueryNewPaletteEventFunction)(wxQueryNewPaletteEvent&);
#endif // wxUSE_GUI
// N.B. In GNU-WIN32, you *have* to take the address of a member function
// (use &) or the compiler crashes...
@@ -1603,13 +1611,17 @@ const wxEventTableEntry theClass::sm_eventTableEntries[] = { \
#define EVT_UPDATE_UI(id, func) \
{ wxEVT_UPDATE_UI, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxUpdateUIEventFunction) & func, (wxObject *) NULL },\
/*
* Helper functions
*/
// ----------------------------------------------------------------------------
// Helper functions
// ----------------------------------------------------------------------------
#if wxUSE_GUI
// Find a window with the focus, that is also a descendant of the given window.
// This is used to determine the window to initially send commands to.
wxWindow* wxFindFocusDescendant(wxWindow* ancestor);
#endif // wxUSE_GUI
#endif
// _WX_EVENTH__

View File

@@ -51,7 +51,7 @@ public:
bool Close();
// assign an existing file descriptor and get it back from wxFFile object
void Attach(FILE *fp, const wxString& name = _T(""))
void Attach(FILE *fp, const wxString& name = T(""))
{ Close(); m_fp = fp; m_name = name; }
void Detach() { m_fp = NULL; }
FILE *fp() const { return m_fp; }

View File

@@ -141,9 +141,9 @@ public:
// New constructor: one size fits all. Specify wxCONFIG_USE_LOCAL_FILE or
// wxCONFIG_USE_GLOBAL_FILE to say which files should be used.
wxFileConfig(const wxString& appName,
const wxString& vendorName = _T(""),
const wxString& localFilename = _T(""),
const wxString& globalFilename = _T(""),
const wxString& vendorName = T(""),
const wxString& localFilename = T(""),
const wxString& globalFilename = T(""),
long style = wxCONFIG_USE_LOCAL_FILE);
// dtor will save unsaved data

View File

@@ -159,15 +159,15 @@ WXDLLEXPORT bool wxMkdir(const wxString& dir, int perm = 0777);
WXDLLEXPORT bool wxRmdir(const wxString& dir, int flags = 0);
// separators in file names
#define wxFILE_SEP_EXT _T('.')
#define wxFILE_SEP_DSK _T(':')
#define wxFILE_SEP_PATH_DOS _T('\\')
#define wxFILE_SEP_PATH_UNIX _T('/')
#define wxFILE_SEP_EXT T('.')
#define wxFILE_SEP_DSK T(':')
#define wxFILE_SEP_PATH_DOS T('\\')
#define wxFILE_SEP_PATH_UNIX T('/')
// separator in the path list (as in PATH environment variable)
// NB: these are strings and not characters on purpose!
#define wxPATH_SEP_DOS _T(";")
#define wxPATH_SEP_UNIX _T(":")
#define wxPATH_SEP_DOS T(";")
#define wxPATH_SEP_UNIX T(":")
// platform independent versions
#ifdef __UNIX__

View File

@@ -32,7 +32,7 @@ public:
// enumerate the different encodings either for given font family or for
// all font families - will result in OnFontEncoding() being called for
// each available (family, encoding) couple
virtual bool EnumerateEncodings(const wxString& family = _T(""));
virtual bool EnumerateEncodings(const wxString& family = T(""));
// callbacks which are called after one of EnumerateXXX() functions from
// above is invoked - all of them may return FALSE to stop enumeration or

View File

@@ -100,7 +100,7 @@ public:
const wxSize &size = wxDefaultSize,
long style = wxLC_LIST,
const wxValidator &validator = wxDefaultValidator,
const wxString &name = _T("filelist") );
const wxString &name = T("filelist") );
void ChangeToListMode();
void ChangeToReportMode();
void ChangeToIconMode();

View File

@@ -54,7 +54,7 @@ public:
@param newmsg if used, new message to display
@returns true if ABORT button has not been pressed
*/
bool Update(int value = -1, const wxString& newmsg = _T(""));
bool Update(int value = -1, const wxString& newmsg = T(""));
/* Can be called to continue after the cancel button has been pressed, but
the program decided to continue the operation (e.g., user didn't

View File

@@ -64,7 +64,7 @@ public:
#if wxUSE_STATUSBAR
virtual wxStatusBar* CreateStatusBar(int number=1, long style = wxST_SIZEGRIP, wxWindowID id = 0,
const wxString& name = _T("statusBar"));
const wxString& name = T("statusBar"));
virtual wxStatusBar *OnCreateStatusBar( int number, long style, wxWindowID id,
const wxString& name );
virtual wxStatusBar *GetStatusBar() const;

View File

@@ -121,8 +121,12 @@ class wxMDIChildFrame: public wxFrame
#if wxUSE_STATUSBAR
// no status bars
virtual wxStatusBar* CreateStatusBar( int WXUNUSED(number)=1, long WXUNUSED(style)=1,
wxWindowID WXUNUSED(id)=1, const wxString& WXUNUSED(name)=WXSTRINGCAST NULL ) {return (wxStatusBar*)NULL; }
virtual wxStatusBar* CreateStatusBar( int WXUNUSED(number) = 1,
long WXUNUSED(style) = 1,
wxWindowID WXUNUSED(id) = 1,
const wxString& WXUNUSED(name) = wxEmptyString)
{ return (wxStatusBar*)NULL; }
virtual wxStatusBar *GetStatusBar() const { return (wxStatusBar*)NULL; }
virtual void SetStatusText( const wxString &WXUNUSED(text), int WXUNUSED(number)=0 ) {}
virtual void SetStatusWidths( int WXUNUSED(n), const int WXUNUSED(widths_field)[] ) {}

View File

@@ -64,7 +64,7 @@ public:
#if wxUSE_STATUSBAR
virtual wxStatusBar* CreateStatusBar(int number=1, long style = wxST_SIZEGRIP, wxWindowID id = 0,
const wxString& name = _T("statusBar"));
const wxString& name = T("statusBar"));
virtual wxStatusBar *OnCreateStatusBar( int number, long style, wxWindowID id,
const wxString& name );
virtual wxStatusBar *GetStatusBar() const;

View File

@@ -121,8 +121,12 @@ class wxMDIChildFrame: public wxFrame
#if wxUSE_STATUSBAR
// no status bars
virtual wxStatusBar* CreateStatusBar( int WXUNUSED(number)=1, long WXUNUSED(style)=1,
wxWindowID WXUNUSED(id)=1, const wxString& WXUNUSED(name)=WXSTRINGCAST NULL ) {return (wxStatusBar*)NULL; }
virtual wxStatusBar* CreateStatusBar( int WXUNUSED(number) = 1,
long WXUNUSED(style) = 1,
wxWindowID WXUNUSED(id) = 1,
const wxString& WXUNUSED(name) = wxEmptyString)
{ return (wxStatusBar*)NULL; }
virtual wxStatusBar *GetStatusBar() const { return (wxStatusBar*)NULL; }
virtual void SetStatusText( const wxString &WXUNUSED(text), int WXUNUSED(number)=0 ) {}
virtual void SetStatusWidths( int WXUNUSED(n), const int WXUNUSED(widths_field)[] ) {}

View File

@@ -32,7 +32,7 @@
// gettext() style macro (notice that xgettext should be invoked with "-k_"
// option to extract the strings inside _() from the sources)
#ifndef WXINTL_NO_GETTEXT_MACRO
#define _(str) wxGetTranslation(_T(str))
#define _(str) wxGetTranslation(T(str))
#endif
// ----------------------------------------------------------------------------

View File

@@ -53,8 +53,8 @@ class WXDLLEXPORT wxConnectionBase: public wxObject
inline ~wxConnectionBase(void) {}
// Calls that CLIENT can make
virtual bool Execute(wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT ) = 0;
virtual bool Execute(const wxString& str) { return Execute(WXSTRINGCAST str, -1, wxIPC_TEXT); }
virtual bool Execute(const wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT ) = 0;
virtual bool Execute(const wxString& str) { return Execute(str, -1, wxIPC_TEXT); }
virtual char *Request(const wxString& item, int *size = (int *) NULL, wxIPCFormat format = wxIPC_TEXT) = 0;
virtual bool Poke(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT) = 0;
virtual bool StartAdvise(const wxString& item) = 0;

View File

@@ -245,7 +245,7 @@ protected:
// GUI part (andnot just the base one) of the library, they're implemented in
// src/generic/logg.cpp *and not src/common/log.cpp unlike all the rest)
#ifndef wxUSE_NOGUI
#if wxUSE_GUI
// log everything to a text window (GUI only of course)
class WXDLLEXPORT wxLogTextCtrl : public wxLog
@@ -338,7 +338,7 @@ private:
wxLogFrame *m_pLogFrame; // the log frame
};
#endif // wxUSE_NOGUI
#endif // wxUSE_GUI
// ----------------------------------------------------------------------------
// /dev/null log target: suppress logging until this object goes out of scope
@@ -464,7 +464,7 @@ DECLARE_LOG_FUNCTION2(SysError, long lErrCode);
// ----------------------------------------------------------------------------
#ifndef __TFILE__
#define __XFILE__(x) _T(x)
#define __XFILE__(x) Tx)
#define __TFILE__ __XFILE__(__FILE__)
#endif
@@ -473,12 +473,12 @@ DECLARE_LOG_FUNCTION2(SysError, long lErrCode);
// will take us immediately to the place of the failed API
#ifdef __VISUALC__
#define wxLogApiError(api, rc) \
wxLogDebug(_T("%s(%d): '%s' failed with error 0x%08lx (%s)."), \
wxLogDebug(T("%s(%d): '%s' failed with error 0x%08lx (%s)."), \
__TFILE__, __LINE__, api, \
rc, wxSysErrorMsg(rc))
#else // !VC++
#define wxLogApiError(api, rc) \
wxLogDebug(_T("In file %s at line %d: '%s' failed with " \
wxLogDebug(T("In file %s at line %d: '%s' failed with " \
"error 0x%08lx (%s)."), \
__TFILE__, __LINE__, api, \
rc, wxSysErrorMsg(rc))

View File

@@ -110,7 +110,7 @@ class WXDLLEXPORT wxClipboardClient : public wxObject
public:
/* This list should be filled in with strings indicating the formats
this client can provide. Almost all clients will provide "TEXT".
this client can provide. Almost all clients will provide "TEXT(".
Format names should be 4 characters long, so things will work
out on the Macintosh */
wxStringList formats;
@@ -147,7 +147,7 @@ class WXDLLEXPORT wxClipboard : public wxObject
/* Set the clipboard string; does not require a client. */
void SetClipboardString(char *, long time);
/* Get data from the clipboard in the format "TEXT". */
/* Get data from the clipboard in the format "TEXT(". */
char *GetClipboardString(long time);
/* Get data from the clipboard */

View File

@@ -92,7 +92,7 @@ public:
// the string ID identifies the format of clipboard or DnD data. a word
// processor would e.g. add a wxTextDataObject and a wxPrivateDataObject
// to the clipboard - the latter with the Id "WXWORD_FORMAT".
// to the clipboard - the latter with the Id "WXWORD_FORMAT(".
void SetId( const wxString& id )
{ m_id = id; }

View File

@@ -3,7 +3,7 @@
// Header signatures for various resources
#define BFT_ICON 0x4349 /* 'IC' */
#define BFT_BITMAP 0x4d42 /* 'BM' */
#define BFT_CURSOR 0x5450 /* 'PT' */
#define BFT_CURSOR 0x5450 /* 'PT(' */
// This WIDTHBYTES macro determines the number of BYTES per scan line.
#define WIDTHBYTES( i) ((i + 31) / 32 * 4)

View File

@@ -54,8 +54,8 @@ public:
~wxDDEConnection(void);
// Calls that CLIENT can make
virtual bool Execute(wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT);
virtual bool Execute(const wxString& str) { return Execute(WXSTRINGCAST str, -1, wxIPC_TEXT); }
virtual bool Execute(const wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT);
virtual bool Execute(const wxString& str) { return Execute(str, -1, wxIPC_TEXT); }
virtual char *Request(const wxString& item, int *size = NULL, wxIPCFormat format = wxIPC_TEXT);
virtual bool Poke(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT);
virtual bool StartAdvise(const wxString& item);

View File

@@ -139,17 +139,17 @@ WXDLLEXPORT_DATA(extern HFONT) wxSTATUS_LINE_FONT;
* for this combination of CTl3D/FAFA settings
*/
#define STATIC_CLASS _T("STATIC")
#define STATIC_CLASS T("STATIC")
#define STATIC_FLAGS (SS_LEFT|WS_CHILD|WS_VISIBLE)
#define CHECK_CLASS _T("BUTTON")
#define CHECK_CLASS T("BUTTON")
#define CHECK_FLAGS (BS_AUTOCHECKBOX|WS_TABSTOP|WS_CHILD)
#define CHECK_IS_FAFA FALSE
#define RADIO_CLASS _T("BUTTON")
#define RADIO_CLASS T("BUTTON")
#define RADIO_FLAGS (BS_AUTORADIOBUTTON|WS_CHILD|WS_VISIBLE)
#define RADIO_SIZE 20
#define RADIO_IS_FAFA FALSE
#define PURE_WINDOWS
#define GROUP_CLASS _T("BUTTON")
#define GROUP_CLASS T("BUTTON")
#define GROUP_FLAGS (BS_GROUPBOX|WS_CHILD|WS_VISIBLE)
/*

View File

@@ -117,13 +117,13 @@ WXDLLEXPORT wxObject* wxCreateStoredObject( wxInputStream& stream );
#define IMPLEMENT_DYNAMIC_CLASS(name, basename) \
wxObject* WXDLLEXPORT_CTORFN wxConstructorFor##name(void) \
{ return new name; }\
wxClassInfo name::sm_class##name((wxChar *) _T(#name), (wxChar *) _T(#basename), (wxChar *) NULL, (int) sizeof(name), (wxObjectConstructorFn) wxConstructorFor##name);
wxClassInfo name::sm_class##name((wxChar *) T(#name), (wxChar *) T(#basename), (wxChar *) NULL, (int) sizeof(name), (wxObjectConstructorFn) wxConstructorFor##name);
// Multiple inheritance with two base classes
#define IMPLEMENT_DYNAMIC_CLASS2(name, basename1, basename2) \
wxObject* WXDLLEXPORT_CTORFN wxConstructorFor##name(void) \
{ return new name; }\
wxClassInfo name::sm_class##name((wxChar *) _T(#name), (wxChar *) _T(#basename1), (wxChar *) _T(#basename2), (int) sizeof(name), (wxObjectConstructorFn) wxConstructorFor##name);
wxClassInfo name::sm_class##name((wxChar *) T(#name), (wxChar *) T(#basename1), (wxChar *) T(#basename2), (int) sizeof(name), (wxObjectConstructorFn) wxConstructorFor##name);
//////
////// for abstract classes
@@ -131,13 +131,13 @@ wxObject* WXDLLEXPORT_CTORFN wxConstructorFor##name(void) \
// Single inheritance with one base class
#define IMPLEMENT_ABSTRACT_CLASS(name, basename) \
wxClassInfo name::sm_class##name((wxChar *) _T(#name), (wxChar *) _T(#basename), \
wxClassInfo name::sm_class##name((wxChar *) T(#name), (wxChar *) T(#basename), \
(wxChar *) NULL, (int) sizeof(name), (wxObjectConstructorFn) NULL);
// Multiple inheritance with two base classes
#define IMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2) \
wxClassInfo name::sm_class##name((wxChar *) _T(#name), (wxChar *) _T(#basename1), \
(wxChar *) _T(#basename2), (int) sizeof(name), (wxObjectConstructorFn) NULL);
wxClassInfo name::sm_class##name((wxChar *) T(#name), (wxChar *) T(#basename1), \
(wxChar *) T(#basename2), (int) sizeof(name), (wxObjectConstructorFn) NULL);
#define IMPLEMENT_CLASS IMPLEMENT_ABSTRACT_CLASS
#define IMPLEMENT_CLASS2 IMPLEMENT_ABSTRACT_CLASS2

View File

@@ -552,7 +552,7 @@ class WXDLLEXPORT wxListOfStringsListValidator: public wxPropertyListValidator
// Called when the property is double clicked.
bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
bool EditStringList(wxWindow *parent, wxStringList *stringList, const wxChar *title = _T("String List Editor"));
bool EditStringList(wxWindow *parent, wxStringList *stringList, const wxChar *title = T("String List Editor"));
// Called when the edit (...) button is pressed.
void OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);

View File

@@ -63,9 +63,9 @@ protected:
friend class wxTCPServer;
friend class wxTCPClient;
friend void Client_OnRequest(wxSocketBase&,
wxSocketNotify, char *);
wxSocketNotify, char *);
friend void Server_OnRequest(wxSocketServer&,
wxSocketNotify, char *);
wxSocketNotify, char *);
public:
wxTCPConnection(char *buffer, int size);
@@ -73,7 +73,7 @@ public:
virtual ~wxTCPConnection();
// Calls that CLIENT can make
bool Execute(wxChar *data, int size = -1,
bool Execute(const wxChar *data, int size = -1,
wxIPCFormat format = wxIPC_TEXT);
char *Request(const wxString& item, int *size = NULL,
wxIPCFormat format = wxIPC_TEXT);

View File

@@ -24,159 +24,175 @@
#if wxUSE_WCHAR_T
//---------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// wxMBConv (base class for conversions, using libc conversion itself)
//---------------------------------------------------------------------------
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxMBConv
{
public:
// the actual conversion takes place here
virtual size_t MB2WC(wchar_t *buf, const char *psz, size_t n) const;
virtual size_t WC2MB(char *buf, const wchar_t *psz, size_t n) const;
// No longer inline since BC++ complains.
const wxWCharBuffer cMB2WC(const char *psz) const;
const wxCharBuffer cWC2MB(const wchar_t *psz) const;
// the actual conversion takes place here
virtual size_t MB2WC(wchar_t *buf, const char *psz, size_t n) const;
virtual size_t WC2MB(char *buf, const wchar_t *psz, size_t n) const;
// No longer inline since BC++ complains.
const wxWCharBuffer cMB2WC(const char *psz) const;
const wxCharBuffer cWC2MB(const wchar_t *psz) const;
#if wxUSE_UNICODE
const wxWCharBuffer cMB2WX(const char *psz) const { return cMB2WC(psz); }
const wxCharBuffer cWX2MB(const wchar_t *psz) const { return cWC2MB(psz); }
const wchar_t* cWC2WX(const wchar_t *psz) const { return psz; }
const wchar_t* cMB2WC(const wchar_t *psz) const { return psz; }
#else
const char* cMB2WX(const char *psz) const { return psz; }
const char* cWX2MB(const char *psz) const { return psz; }
const wxCharBuffer cWC2WX(const wchar_t *psz) const { return cWC2MB(psz); }
const wxWCharBuffer cWX2WC(const char *psz) const { return cMB2WC(psz); }
#endif
const wxWCharBuffer cMB2WX(const char *psz) const { return cMB2WC(psz); }
const wxCharBuffer cWX2MB(const wchar_t *psz) const { return cWC2MB(psz); }
const wchar_t* cWC2WX(const wchar_t *psz) const { return psz; }
const wchar_t* cMB2WC(const wchar_t *psz) const { return psz; }
#else // ANSI
const char* cMB2WX(const char *psz) const { return psz; }
const char* cWX2MB(const char *psz) const { return psz; }
const wxCharBuffer cWC2WX(const wchar_t *psz) const { return cWC2MB(psz); }
const wxWCharBuffer cWX2WC(const char *psz) const { return cMB2WC(psz); }
#endif // Unicode/ANSI
};
WXDLLEXPORT_DATA(extern wxMBConv) wxConvLibc;
//---------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// wxMBConvFile (for conversion to filenames)
//---------------------------------------------------------------------------
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxMBConvFile: public wxMBConv
class WXDLLEXPORT wxMBConvFile : public wxMBConv
{
public:
virtual size_t MB2WC(wchar_t *buf, const char *psz, size_t n) const;
virtual size_t WC2MB(char *buf, const wchar_t *psz, size_t n) const;
virtual size_t MB2WC(wchar_t *buf, const char *psz, size_t n) const;
virtual size_t WC2MB(char *buf, const wchar_t *psz, size_t n) const;
};
WXDLLEXPORT_DATA(extern wxMBConvFile) wxConvFile;
//---------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// wxMBConvUTF7 (for conversion using UTF7 encoding)
//---------------------------------------------------------------------------
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxMBConvUTF7: public wxMBConv
class WXDLLEXPORT wxMBConvUTF7 : public wxMBConv
{
public:
virtual size_t MB2WC(wchar_t *buf, const char *psz, size_t n) const;
virtual size_t WC2MB(char *buf, const wchar_t *psz, size_t n) const;
virtual size_t MB2WC(wchar_t *buf, const char *psz, size_t n) const;
virtual size_t WC2MB(char *buf, const wchar_t *psz, size_t n) const;
};
WXDLLEXPORT_DATA(extern wxMBConvUTF7) wxConvUTF7;
//---------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// wxMBConvUTF8 (for conversion using UTF8 encoding)
//---------------------------------------------------------------------------
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxMBConvUTF8: public wxMBConv
class WXDLLEXPORT wxMBConvUTF8 : public wxMBConv
{
public:
virtual size_t MB2WC(wchar_t *buf, const char *psz, size_t n) const;
virtual size_t WC2MB(char *buf, const wchar_t *psz, size_t n) const;
virtual size_t MB2WC(wchar_t *buf, const char *psz, size_t n) const;
virtual size_t WC2MB(char *buf, const wchar_t *psz, size_t n) const;
};
WXDLLEXPORT_DATA(extern wxMBConvUTF8) wxConvUTF8;
#ifdef __WXGTK12__
//---------------------------------------------------------------------------
// wxMBConvUTF8 (for conversion using GDK's internal converions)
//---------------------------------------------------------------------------
class WXDLLEXPORT wxMBConvGdk: public wxMBConv
// ----------------------------------------------------------------------------
// wxMBConvUTF8 (for conversion using GDK's internal converions)
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxMBConvGdk : public wxMBConv
{
public:
virtual size_t MB2WC(wchar_t *buf, const char *psz, size_t n) const;
virtual size_t WC2MB(char *buf, const wchar_t *psz, size_t n) const;
virtual size_t MB2WC(wchar_t *buf, const char *psz, size_t n) const;
virtual size_t WC2MB(char *buf, const wchar_t *psz, size_t n) const;
};
WXDLLEXPORT_DATA(extern wxMBConvGdk) wxConvGdk;
#endif
//---------------------------------------------------------------------------
// wxCSConv (for conversion based on laodable char sets)
//---------------------------------------------------------------------------
#endif // wxGTK 1.2
class wxCharacterSet;
// ----------------------------------------------------------------------------
// wxCSConv (for conversion based on loadable char sets)
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxCSConv: public wxMBConv
class WXDLLEXPORT wxCharacterSet;
class WXDLLEXPORT wxCSConv : public wxMBConv
{
private:
wxChar *m_name;
wxCharacterSet *m_cset;
bool m_deferred;
void SetName(const wxChar *charset);
public:
wxCSConv(const wxChar *charset);
virtual ~wxCSConv();
void LoadNow();
virtual size_t MB2WC(wchar_t *buf, const char *psz, size_t n) const;
virtual size_t WC2MB(char *buf, const wchar_t *psz, size_t n) const;
wxCSConv(const wxChar *charset);
virtual ~wxCSConv();
void LoadNow();
virtual size_t MB2WC(wchar_t *buf, const char *psz, size_t n) const;
virtual size_t WC2MB(char *buf, const wchar_t *psz, size_t n) const;
private:
void SetName(const wxChar *charset);
wxChar *m_name;
wxCharacterSet *m_cset;
bool m_deferred;
};
WXDLLEXPORT_DATA(extern wxCSConv) wxConvLocal;
#define wxConv_local wxConvLocal
WXDLLEXPORT_DATA(extern wxMBConv *) wxConvCurrent;
#define wxConv_current wxConvCurrent
//---------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// filename conversion macros
//---------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// filenames are multibyte on Unix and probably widechar on Windows?
#if defined(__UNIX__) || defined(__BORLANDC__)
#define wxMBFILES 1
#define wxMBFILES 1
#else
#define wxMBFILES 0
#define wxMBFILES 0
#endif
#if wxMBFILES
#define wxFNCONV(name) wxConvFile.cWX2MB(name)
#define FNSTRINGCAST MBSTRINGCAST
#define wxFNCONV(name) wxConvFile.cWX2MB(name)
#define wxFNSTRINGCAST wxMBSTRINGCAST
#else
#define wxFNCONV(name) name
#define FNSTRINGCAST WXSTRINGCAST
#define wxFNCONV(name) name
#define wxFNSTRINGCAST WXSTRINGCAST
#endif
#else
// !wxUSE_WCHAR_T
//---------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// stand-ins in absence of wchar_t
//---------------------------------------------------------------------------
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxMBConv
class WXDLLEXPORT wxMBConv
{
public:
const char* cMB2WX(const char *psz) const { return psz; }
const char* cWX2MB(const char *psz) const { return psz; }
const char* cMB2WX(const char *psz) const { return psz; }
const char* cWX2MB(const char *psz) const { return psz; }
};
WXDLLEXPORT_DATA(extern wxMBConv) wxConvLibc, wxConvFile;
WXDLLEXPORT_DATA(extern wxMBConv *) wxConvCurrent;
#define wxFNCONV(name) name
#define FNSTRINGCAST WXSTRINGCAST
#define wxFNSTRINGCAST WXSTRINGCAST
#endif
// wxUSE_WCHAR_T
#endif
// ----------------------------------------------------------------------------
// macros for the most common conversions
// ----------------------------------------------------------------------------
#if wxUSE_UNICODE
#define wxConvertWX2MB(s) wxConvCurrent->cWX2MB(s)
#define wxConvertMB2WX(s) wxConvCurrent->cMB2WX(s)
#else // ANSI
// no conversions to do
#define wxConvertWX2MB(s) (s)
#define wxConvertMB2WX(s) (s)
#endif // Unicode/ANSI
#endif
// _WX_WXSTRCONVH__

View File

@@ -9,13 +9,35 @@
// Licence: wxWindows license
///////////////////////////////////////////////////////////////////////////////
/*
Efficient string class [more or less] compatible with MFC CString,
wxWindows version 1 wxString and std::string and some handy functions
missing from string.h.
*/
#ifndef _WX_WXSTRINGH__
#define _WX_WXSTRINGH__
#ifdef __GNUG__
#pragma interface "string.h"
#pragma interface "string.h"
#endif
// ----------------------------------------------------------------------------
// conditinal compilation
// ----------------------------------------------------------------------------
// compile the std::string compatibility functions if defined
#define wxSTD_STRING_COMPATIBILITY
// define to derive wxString from wxObject (deprecated!)
#ifdef WXSTRING_IS_WXOBJECT
#undef WXSTRING_IS_WXOBJECT
#endif
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#ifdef __WXMAC__
#include <ctype.h>
#endif
@@ -34,57 +56,53 @@
#include <strings.h> // for strcasecmp()
#endif // AIX
#ifndef WX_PRECOMP
#include "wx/defs.h"
#include "wx/defs.h" // everybody should include this
#include "wx/debug.h" // for wxASSERT()
#include "wx/wxchar.h" // for wxChar
#include "wx/buffer.h" // for wxCharBuffer
#include "wx/strconv.h" // for wxConvertXXX() macros and wxMBConv classes
#ifndef WX_PRECOMP
#ifdef WXSTRING_IS_WXOBJECT
#include "wx/object.h"
#include "wx/object.h" // base class
#endif
#endif // !PCH
#include "wx/debug.h"
#include "wx/wxchar.h"
#include "wx/buffer.h"
/*
Efficient string class [more or less] compatible with MFC CString,
wxWindows version 1 wxString and std::string and some handy functions
missing from string.h.
*/
// ---------------------------------------------------------------------------
// macros
// ---------------------------------------------------------------------------
// compile the std::string compatibility functions if defined
#define wxSTD_STRING_COMPATIBILITY
// define to derive wxString from wxObject
#ifdef WXSTRING_IS_WXOBJECT
#undef WXSTRING_IS_WXOBJECT
#endif
// maximum possible length for a string means "take all string" everywhere
// (as sizeof(StringData) is unknown here we substract 100)
const unsigned int wxSTRING_MAXLEN = UINT_MAX - 100;
// 'naughty' cast
#define WXSTRINGCAST (wxChar *)(const wxChar *)
#define WXCSTRINGCAST (wxChar *)(const wxChar *)
#define MBSTRINGCAST (char *)(const char *)
#define WCSTRINGCAST (wchar_t *)(const wchar_t *)
#define wxCSTRINGCAST (wxChar *)(const wxChar *)
#define wxMBSTRINGCAST (char *)(const char *)
#define wxWCSTRINGCAST (wchar_t *)(const wchar_t *)
// implementation only
#define ASSERT_VALID_INDEX(i) wxASSERT( (unsigned)(i) <= Len() )
// include conversion classes
#include "wx/strconv.h"
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
// maximum possible length for a string means "take all string" everywhere
// (as sizeof(StringData) is unknown here, we substract 100)
const unsigned int wxSTRING_MAXLEN = UINT_MAX - 100;
// ----------------------------------------------------------------------------
// global data
// ----------------------------------------------------------------------------
// global pointer to empty string
WXDLLEXPORT_DATA(extern const wxChar*) wxEmptyString;
// ---------------------------------------------------------------------------
// Global functions complementing standard C string library replacements for
// global functions complementing standard C string library replacements for
// strlen() and portable strcasecmp()
//---------------------------------------------------------------------------
// USE wx* FUNCTIONS IN wx/wxchar.h INSTEAD - THIS IS ONLY FOR BINARY COMPATIBILITY
// Use wxXXX() functions from wxchar.h instead! These functions are for
// backwards compatibility only.
// checks whether the passed in pointer is NULL and if the string is empty
inline bool WXDLLEXPORT IsEmpty(const char *p) { return (!p || !*p); }
@@ -138,23 +156,15 @@ inline int WXDLLEXPORT Stricmp(const char *psz1, const char *psz2)
#endif // OS/compiler
}
// ----------------------------------------------------------------------------
// global data
// ----------------------------------------------------------------------------
WXDLLEXPORT_DATA(extern const wxChar*) wxEmptyString;
// global pointer to empty string
WXDLLEXPORT_DATA(extern const wxChar*) g_szNul;
// return an empty wxString
class WXDLLEXPORT wxString; // not yet defined
inline const wxString& wxGetEmptyString() { return *(wxString *)&g_szNul; }
inline const wxString& wxGetEmptyString() { return *(wxString *)&wxEmptyString; }
// ---------------------------------------------------------------------------
// string data prepended with some housekeeping info (used by wxString class),
// is never used directly (but had to be put here to allow inlining)
// ---------------------------------------------------------------------------
struct WXDLLEXPORT wxStringData
{
int nRefs; // reference count
@@ -225,7 +235,7 @@ private:
// string (re)initialization functions
// initializes the string to the empty value (must be called only from
// ctors, use Reinit() otherwise)
void Init() { m_pchData = (wxChar *)g_szNul; }
void Init() { m_pchData = (wxChar *)wxEmptyString; }
// initializaes the string with (a part of) C-string
void InitWith(const wxChar *psz, size_t nPos = 0, size_t nLen = wxSTRING_MAXLEN);
// as Init, but also frees old data
@@ -278,6 +288,7 @@ public:
// (default value of wxSTRING_MAXLEN means take all the string)
wxString(const wxChar *psz, size_t nLength = wxSTRING_MAXLEN)
{ InitWith(psz, 0, nLength); }
#if wxUSE_UNICODE
// from multibyte string
// (NB: nLength is right now number of Unicode characters, not
@@ -286,21 +297,24 @@ public:
// from wxWCharBuffer (i.e. return from wxGetString)
wxString(const wxWCharBuffer& psz)
{ InitWith(psz, 0, wxSTRING_MAXLEN); }
#else
#else // ANSI
// from C string (for compilers using unsigned char)
wxString(const unsigned char* psz, size_t nLength = wxSTRING_MAXLEN)
{ InitWith((const char*)psz, 0, nLength); }
// from multibyte string
wxString(const char *psz, wxMBConv& WXUNUSED(conv), size_t nLength = wxSTRING_MAXLEN)
{ InitWith(psz, 0, nLength); }
#if wxUSE_WCHAR_T
// from wide (Unicode) string
wxString(const wchar_t *pwz);
#endif
#endif // !wxUSE_WCHAR_T
// from wxCharBuffer
wxString(const wxCharBuffer& psz)
{ InitWith(psz, 0, wxSTRING_MAXLEN); }
#endif
#endif // Unicode/ANSI
// dtor is not virtual, this class must not be inherited from!
~wxString() { GetStringData()->Unlock(); }
@@ -378,25 +392,36 @@ public:
const wxChar* c_str() const { return m_pchData; }
// (and this with [wx]Printf()!)
const wxChar* wx_str() const { return m_pchData; }
//
// identical to c_str()
const wxChar* GetData() const { return m_pchData; }
// conversions with (possible) format convertions: have to return a
// buffer with temporary data
#if wxUSE_UNICODE
const wxCharBuffer mb_str(wxMBConv& conv = wxConvLibc) const { return conv.cWC2MB(m_pchData); }
const wxWX2MBbuf mbc_str() const { return mb_str(*wxConvCurrent); }
const wxChar* wc_str(wxMBConv& WXUNUSED(conv) = wxConvLibc) const { return m_pchData; }
#if wxMBFILES
const wxCharBuffer fn_str() const { return mb_str(wxConvFile); }
#else
#else // !wxMBFILES
const wxChar* fn_str() const { return m_pchData; }
#endif
#else
const wxChar* mb_str(wxMBConv& WXUNUSED(conv) = wxConvLibc ) const { return m_pchData; }
#endif // wxMBFILES/!wxMBFILES
#else // ANSI
#if wxUSE_MULTIBYTE
const wxChar* mb_str(wxMBConv& WXUNUSED(conv) = wxConvLibc) const
{ return m_pchData; }
const wxWX2MBbuf mbc_str() const { return mb_str(*wxConvCurrent); }
#else // !mmultibyte
const wxChar* mb_str() const { return m_pchData; }
const wxWX2MBbuf mbc_str() const { return mb_str(); }
#endif // multibyte/!multibyte
#if wxUSE_WCHAR_T
const wxWCharBuffer wc_str(wxMBConv& conv) const { return conv.cMB2WC(m_pchData); }
#endif
#endif // wxUSE_WCHAR_T
const wxChar* fn_str() const { return m_pchData; }
#endif
// for convenience
const wxWX2MBbuf mbc_str() const { return mb_str(*wxConvCurrent); }
#endif // Unicode/ANSI
// overloaded assignment
// from another wxString
@@ -408,7 +433,7 @@ public:
#if wxUSE_UNICODE
// from wxWCharBuffer
wxString& operator=(const wxWCharBuffer& psz) { return operator=((const wchar_t *)psz); }
#else
#else // ANSI
// from another kind of C string
wxString& operator=(const unsigned char* psz);
#if wxUSE_WCHAR_T
@@ -417,7 +442,7 @@ public:
#endif
// from wxCharBuffer
wxString& operator=(const wxCharBuffer& psz) { return operator=((const char *)psz); }
#endif
#endif // Unicode/ANSI
// string concatenation
// in place concatenation
@@ -548,7 +573,7 @@ public:
// remove spaces from left or from right (default) side
wxString& Trim(bool bFromRight = TRUE);
// add nCount copies chPad in the beginning or at the end (default)
wxString& Pad(size_t nCount, wxChar chPad = _T(' '), bool bFromRight = TRUE);
wxString& Pad(size_t nCount, wxChar chPad = T(' '), bool bFromRight = TRUE);
// truncate string to given length
wxString& Truncate(size_t uiLen);
@@ -660,7 +685,7 @@ public:
// return the maximum size of the string
size_t max_size() const { return wxSTRING_MAXLEN; }
// resize the string, filling the space with c if c != 0
void resize(size_t nSize, wxChar ch = _T('\0'));
void resize(size_t nSize, wxChar ch = T('\0'));
// delete the contents of the string
void clear() { Empty(); }
// returns true if the string is empty
@@ -835,6 +860,7 @@ public:
// so the original string may be safely deleted. When a string is retrieved
// from the array (operator[] or Item() method), a reference is returned.
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxArrayString
{
public:
@@ -979,20 +1005,23 @@ wxString WXDLLEXPORT operator+(const wxString& string, const wxChar *psz);
wxString WXDLLEXPORT operator+(const wxChar *psz, const wxString& string);
#if wxUSE_UNICODE
inline wxString WXDLLEXPORT operator+(const wxString& string, const wxWCharBuffer& buf)
{ return string + (const wchar_t *)buf; }
{ return string + (const wchar_t *)buf; }
inline wxString WXDLLEXPORT operator+(const wxWCharBuffer& buf, const wxString& string)
{ return (const wchar_t *)buf + string; }
{ return (const wchar_t *)buf + string; }
#else
inline wxString WXDLLEXPORT operator+(const wxString& string, const wxCharBuffer& buf)
{ return string + (const char *)buf; }
{ return string + (const char *)buf; }
inline wxString WXDLLEXPORT operator+(const wxCharBuffer& buf, const wxString& string)
{ return (const char *)buf + string; }
{ return (const char *)buf + string; }
#endif
// ---------------------------------------------------------------------------
// Implementation only from here until the end of file
// ---------------------------------------------------------------------------
// don't pollute the library user's name space
#undef ASSERT_VALID_INDEX
#if defined(wxSTD_STRING_COMPATIBILITY) && wxUSE_STD_IOSTREAM
#include "wx/ioswrap.h"

View File

@@ -74,7 +74,7 @@ WXDLLEXPORT bool StringMatch(wxChar *one, wxChar *two, bool subString = TRUE, bo
// ----------------------------------------------------------------------------
// Sound the bell
WXDLLEXPORT void wxBell(void) ;
WXDLLEXPORT void wxBell();
// Get OS version
WXDLLEXPORT int wxGetOsVersion(int *majorVsn= (int *) NULL,int *minorVsn= (int *) NULL) ;
@@ -82,6 +82,7 @@ WXDLLEXPORT int wxGetOsVersion(int *majorVsn= (int *) NULL,int *minorVsn= (int *
// Return a string with the current date/time
WXDLLEXPORT wxString wxNow();
#if wxUSE_GUI
// Don't synthesize KeyUp events holding down a key and producing
// KeyDown events with autorepeat. On by default and always on
// in wxMSW.
@@ -106,6 +107,8 @@ WXDLLEXPORT void wxRegisterId(long id);
// Return the current ID
WXDLLEXPORT long wxGetCurrentId();
#endif // wxUSE_GUI
// ----------------------------------------------------------------------------
// Various conversions
// ----------------------------------------------------------------------------
@@ -215,6 +218,8 @@ WXDLLEXPORT const wxMB2WXbuf wxGetUserHome(const wxString& user = wxEmptyString)
WXDLLEXPORT wxChar* wxGetUserHome(const wxString& user = wxEmptyString);
#endif
#if wxUSE_GUI // GUI only things from now on
// ----------------------------------------------------------------------------
// Strip out any menu codes
// ----------------------------------------------------------------------------
@@ -388,5 +393,7 @@ extern wxNativeFont wxLoadQueryNearestFont(int pointSize,
#endif // X || GTK
#endif // wxUSE_GUI
#endif
// _WX_UTILSH__

View File

@@ -81,22 +81,22 @@ public:
// Construction & destruction
wxVariant();
wxVariant(double val, const wxString& name = g_szNul);
wxVariant(long val, const wxString& name = g_szNul);
wxVariant(double val, const wxString& name = wxEmptyString);
wxVariant(long val, const wxString& name = wxEmptyString);
#ifdef HAVE_BOOL
wxVariant(bool val, const wxString& name = g_szNul);
wxVariant(bool val, const wxString& name = wxEmptyString);
#endif
wxVariant(char val, const wxString& name = g_szNul);
wxVariant(const wxString& val, const wxString& name = g_szNul);
wxVariant(const wxChar* val, const wxString& name = g_szNul); // Necessary or VC++ assumes bool!
wxVariant(const wxStringList& val, const wxString& name = g_szNul);
wxVariant(const wxList& val, const wxString& name = g_szNul); // List of variants
wxVariant(char val, const wxString& name = wxEmptyString);
wxVariant(const wxString& val, const wxString& name = wxEmptyString);
wxVariant(const wxChar* val, const wxString& name = wxEmptyString); // Necessary or VC++ assumes bool!
wxVariant(const wxStringList& val, const wxString& name = wxEmptyString);
wxVariant(const wxList& val, const wxString& name = wxEmptyString); // List of variants
#if wxUSE_TIMEDATE
wxVariant(const wxTime& val, const wxString& name = g_szNul); // Time
wxVariant(const wxDate& val, const wxString& name = g_szNul); // Date
wxVariant(const wxTime& val, const wxString& name = wxEmptyString); // Time
wxVariant(const wxDate& val, const wxString& name = wxEmptyString); // Date
#endif
wxVariant(void* ptr, const wxString& name = g_szNul); // void* (general purpose)
wxVariant(wxVariantData* data, const wxString& name = g_szNul); // User-defined data
wxVariant(void* ptr, const wxString& name = wxEmptyString); // void* (general purpose)
wxVariant(wxVariantData* data, const wxString& name = wxEmptyString); // User-defined data
wxVariant(const wxVariant& variant);
~wxVariant();

View File

@@ -81,7 +81,7 @@ public:
static void Chain(wxWizardPageSimple *first, wxWizardPageSimple *second)
{
wxCHECK_RET( first && second,
_T("NULL passed to wxWizardPageSimple::Chain") );
T("NULL passed to wxWizardPageSimple::Chain") );
first->SetNext(second);
second->SetPrev(first);

View File

@@ -6,16 +6,26 @@
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c)
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_WXH__
#define _WX_WXH__
#include "wx/setup.h" // Which features to include - user editable
#include "wx/defs.h"
#include "wx/object.h"
#include "wx/dynarray.h"
#include "wx/list.h"
#include "wx/hash.h"
#include "wx/string.h"
#include "wx/intl.h"
#include "wx/log.h"
#include "wx/event.h"
#include "wx/app.h"
#include "wx/utils.h"
#if wxUSE_GUI
#include "wx/window.h"
#include "wx/panel.h"
#include "wx/frame.h"
@@ -26,8 +36,6 @@
#include "wx/dcscreen.h"
#include "wx/button.h"
#include "wx/menu.h"
#include "wx/app.h"
#include "wx/event.h"
#include "wx/list.h"
#include "wx/pen.h"
#include "wx/brush.h"
@@ -36,7 +44,6 @@
#include "wx/cursor.h"
#include "wx/dialog.h"
#include "wx/timer.h"
#include "wx/utils.h"
#include "wx/settings.h"
#include "wx/msgdlg.h"
#include "wx/cmndata.h"
@@ -67,10 +74,6 @@
#include "wx/filedlg.h"
#include "wx/dirdlg.h"
#if wxUSE_INTL
#include "wx/intl.h"
#endif // wxUSE_INTL
#if wxUSE_VALIDATORS
#include "wx/valtext.h"
#endif // wxUSE_VALIDATORS
@@ -80,5 +83,7 @@
#include "wx/serbase.h"
#endif // wxUSE_SERIAL
#endif // wxUSE_GUI
#endif
// _WX_WXH__

View File

@@ -230,7 +230,7 @@ typedef __WCHAR_TYPE__ wxChar;
typedef signed __WCHAR_TYPE__ wxSChar;
typedef unsigned __WCHAR_TYPE__ wxUChar;
# define _T(x) L##x
# define T(x) L##x
// ctype.h functions (wctype.h)
# define wxIsalnum iswalnum
@@ -289,50 +289,54 @@ typedef unsigned __WCHAR_TYPE__ wxUChar;
# include <ctype.h>
# include <string.h>
# if 0 // temporary - preserve binary compatibilty
typedef char wxChar;
typedef signed char wxSChar;
typedef unsigned char wxUChar;
# else
# define wxChar char
# define wxSChar signed char
# define wxUChar unsigned char
# endif
# if 0 // temporary - preserve binary compatibilty
typedef char wxChar;
typedef signed char wxSChar;
typedef unsigned char wxUChar;
# else
# define wxChar char
# define wxSChar signed char
# define wxUChar unsigned char
# endif
# ifdef __FreeBSD__
# undef _T
# endif
# define _T(x) x
# ifdef __FreeBSD__
# undef T
# endif
# define T(x) x
// ctype.h functions
# define wxIsalnum isalnum
# define wxIsalpha isalpha
# define wxIsctrl isctrl
# define wxIsdigit isdigit
# define wxIsgraph isgraph
# define wxIslower islower
# define wxIsprint isprint
# define wxIspunct ispunct
# define wxIsspace isspace
# define wxIsupper isupper
# define wxIsxdigit isxdigit
# define wxTolower tolower
# define wxToupper toupper
# define wxIsalnum isalnum
# define wxIsalpha isalpha
# define wxIsctrl isctrl
# define wxIsdigit isdigit
# define wxIsgraph isgraph
# define wxIslower islower
# define wxIsprint isprint
# define wxIspunct ispunct
# define wxIsspace isspace
# define wxIsupper isupper
# define wxIsxdigit isxdigit
# define wxTolower tolower
# define wxToupper toupper
// locale.h functons
# define wxSetlocale setlocale
// locale.h functons
# define wxSetlocale setlocale
// string.h functions
// #define wxStricmp strcasecmp
// wxStricmp is defined below!!
// string.h functions
// #define wxStricmp strcasecmp
// wxStricmp is defined below!!
// #define wxStrtok strtok_r // this needs a configure check
#ifdef HAVE_STRTOK_R
#define wxStrtok(str, sep, last) strtok_r(str, sep, last)
#else
#define wxStrtok(str, sep, last) strtok(str, sep)
#endif
// leave the rest to defaults below
# define wxNEED_WX_STRING_H
# define wxNEED_WX_STDIO_H
# define wxNEED_WX_STDLIB_H
# define wxNEED_WX_TIME_H
# define wxNEED_WX_STRING_H
# define wxNEED_WX_STDIO_H
# define wxNEED_WX_STDLIB_H
# define wxNEED_WX_TIME_H
# endif//Unicode
#endif//TCHAR-aware compilers
@@ -557,6 +561,12 @@ WXDLLEXPORT int wxSystem(const wxChar *psz);
WXDLLEXPORT size_t wxStrftime(wxChar *s, size_t max, const wxChar *fmt, const struct tm *tm);
#endif
// a Unicode-friendly __FILE__ analog
#ifndef __TFILE__
#define __XFILE__(x) T(x)
#define __TFILE__ __XFILE__(__FILE__)
#endif
#endif
//_WX_WXCHAR_H_

View File

@@ -112,7 +112,7 @@ class WXDLLEXPORT wxExpr
return value.word;
else if (type == wxExprString)
return wxString(value.string);
else return wxString(_T(""));
else return wxString(T(""));
}
inline wxString StringValue(void) const {
@@ -120,7 +120,7 @@ class WXDLLEXPORT wxExpr
return wxString(value.string);
else if (type == wxExprWord)
return wxString(value.word);
else return wxString(_T(""));
else return wxString(T(""));
}
// Get nth arg of clause (starting from 1)