X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b2aef89b7a675805b601e757492c982031f38d21..fb1585ae85bc09432ae4c1afd805fb4aebf6e0c8:/include/wx/utils.h diff --git a/include/wx/utils.h b/include/wx/utils.h index e2ef6fd635..cebdd6c3dc 100644 --- a/include/wx/utils.h +++ b/include/wx/utils.h @@ -9,8 +9,8 @@ // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// -#ifndef __UTILSH__ -#define __UTILSH__ +#ifndef _WX_UTILSH__ +#define _WX_UTILSH__ #ifdef __GNUG__ #pragma interface "utils.h" @@ -23,10 +23,13 @@ #include "wx/filefn.h" #include "wx/process.h" -#if USE_IOSTREAMH +#if wxUSE_IOSTREAMH #include #else #include +# ifdef _MSC_VER + using namespace std; +# endif #endif #ifdef __X__ @@ -91,16 +94,17 @@ bool WXDLLEXPORT StringMatch(char *one, char *two, bool subString = TRUE, bool e #define wxStringEq(s1, s2) (s1 && s2 && (strcmp(s1, s2) == 0)) // Convert 2-digit hex number to decimal -int WXDLLEXPORT wxHexToDec(char *buf); +int WXDLLEXPORT wxHexToDec(const wxString& buf); // Convert decimal integer to 2-character hex string void WXDLLEXPORT wxDecToHex(int dec, char *buf); +wxString WXDLLEXPORT wxDecToHex(int dec); // Execute another program. Returns 0 if there was an error, a PID otherwise. -long WXDLLEXPORT wxExecute(char **argv, bool Async = FALSE, - wxProcess *process = NULL); -long WXDLLEXPORT wxExecute(const wxString& command, bool Async = FALSE, - wxProcess *process = NULL); +long WXDLLEXPORT wxExecute(char **argv, bool sync = FALSE, + wxProcess *process = (wxProcess *) NULL); +long WXDLLEXPORT wxExecute(const wxString& command, bool sync = FALSE, + wxProcess *process = (wxProcess *) NULL); #define wxSIGTERM 1 @@ -139,15 +143,16 @@ bool WXDLLEXPORT wxGetUserName(char *buf, int maxSize); /* * Strip out any menu codes */ -char* WXDLLEXPORT wxStripMenuCodes(char *in, char *out = NULL); +char* WXDLLEXPORT wxStripMenuCodes(char *in, char *out = (char *) NULL); +wxString WXDLLEXPORT wxStripMenuCodes(const wxString& str); // Find the window/widget with the given title or label. // Pass a parent to begin the search from, or NULL to look through // all windows. -wxWindow* WXDLLEXPORT wxFindWindowByLabel(const wxString& title, wxWindow *parent = NULL); +wxWindow* WXDLLEXPORT wxFindWindowByLabel(const wxString& title, wxWindow *parent = (wxWindow *) NULL); // Find window by name, and if that fails, by label. -wxWindow* WXDLLEXPORT wxFindWindowByName(const wxString& name, wxWindow *parent = NULL); +wxWindow* WXDLLEXPORT wxFindWindowByName(const wxString& name, wxWindow *parent = (wxWindow *) NULL); // Returns menu item id or -1 if none. int WXDLLEXPORT wxFindMenuItemId(wxFrame *frame, const wxString& menuString, const wxString& itemString); @@ -167,9 +172,9 @@ int WXDLLEXPORT wxFindMenuItemId(wxFrame *frame, const wxString& menuString, con // Can't export a class derived from a non-export class #if !defined(_WINDLL) && !defined(WXUSINGDLL) -#ifdef new -#undef new -#endif +// #ifdef new +// #undef new +// #endif class WXDLLEXPORT wxDebugStreamBuf: public streambuf { @@ -182,9 +187,9 @@ class WXDLLEXPORT wxDebugStreamBuf: public streambuf int sync(void); }; -#if WXDEBUG && USE_GLOBAL_MEMORY_OPERATORS -#define new WXDEBUG_NEW -#endif +// #if defined(__WXDEBUG__) && wxUSE_GLOBAL_MEMORY_OPERATORS +// #define new WXDEBUG_NEW +// #endif #endif @@ -213,7 +218,7 @@ void WXDLLEXPORT wxDebugMsg(const char *fmt ...) ; void WXDLLEXPORT wxBell(void) ; // Get OS version -int WXDLLEXPORT wxGetOsVersion(int *majorVsn=NULL,int *minorVsn=NULL) ; +int WXDLLEXPORT wxGetOsVersion(int *majorVsn= (int *) NULL,int *minorVsn= (int *) NULL) ; // Set the cursor to the busy cursor for all windows class WXDLLEXPORT wxCursor; @@ -237,7 +242,7 @@ WXDLLEXPORT_DATA(extern const char*) wxFatalErrorStr; void WXDLLEXPORT wxFatalError(const wxString& msg, const wxString& title = wxFatalErrorStr); // Reading and writing resources (eg WIN.INI, .Xdefaults) -#if USE_RESOURCES +#if wxUSE_RESOURCES bool WXDLLEXPORT wxWriteResource(const wxString& section, const wxString& entry, const wxString& value, const wxString& file = ""); bool WXDLLEXPORT wxWriteResource(const wxString& section, const wxString& entry, float value, const wxString& file = ""); bool WXDLLEXPORT wxWriteResource(const wxString& section, const wxString& entry, long value, const wxString& file = ""); @@ -247,13 +252,11 @@ bool WXDLLEXPORT wxGetResource(const wxString& section, const wxString& entry, c bool WXDLLEXPORT wxGetResource(const wxString& section, const wxString& entry, float *value, const wxString& file = ""); bool WXDLLEXPORT wxGetResource(const wxString& section, const wxString& entry, long *value, const wxString& file = ""); bool WXDLLEXPORT wxGetResource(const wxString& section, const wxString& entry, int *value, const wxString& file = ""); -#endif // USE_RESOURCES +#endif // wxUSE_RESOURCES + +// Get current Home dir and copy to dest (returns pstr->c_str()) +const char* WXDLLEXPORT wxGetHomeDir(wxString *pstr); -#ifdef __UNIX__ -// 'X' Only, will soon vanish.... -// Get current Home dir and copy to dest -char* WXDLLEXPORT wxGetHomeDir( char *dest ); -#endif // Get the user's home dir (caller must copy--- volatile) // returns NULL is no HOME dir is known char* WXDLLEXPORT wxGetUserHome(const wxString& user = ""); @@ -266,18 +269,16 @@ void WXDLLEXPORT wxGetMousePosition( int* x, int* y ); // MSW only: get user-defined resource from the .res file. // Returns NULL or newly-allocated memory, so use delete[] to clean up. -#ifdef __WINDOWS__ +#ifdef __WXMSW__ extern const char* WXDLLEXPORT wxUserResourceStr; char* WXDLLEXPORT wxLoadUserResource(const wxString& resourceName, const wxString& resourceType = wxUserResourceStr); #endif // X only #ifdef __X__ -// Get X display: often needed in the wxWindows implementation. -Display *wxGetDisplay(void); -/* Matthew Flatt: Added wxSetDisplay and wxGetDisplayName */ +WXDisplay *wxGetDisplay(); bool wxSetDisplay(const wxString& display_name); -wxString wxGetDisplayName(void); +wxString wxGetDisplayName(); #endif #ifdef __X__ @@ -309,4 +310,4 @@ void wxAllocColor(Display *display,Colormap colormap,XColor *xcolor); #endif //__X__ #endif - // __UTILSH__ + // _WX_UTILSH__