// Created: 29/01/98
// RCS-ID: $Id$
// Copyright: (c) 1998 Julian Smart
-// Licence: wxWindows license
+// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_UTILSH__
#include "wx/list.h"
#include "wx/window.h"
#include "wx/filefn.h"
-#include "wx/process.h"
-
-#if wxUSE_IOSTREAMH
-#include <iostream.h>
-#else
-#include <iostream>
-# ifdef _MSC_VER
- using namespace std;
-# endif
-#endif
+
+#include "wx/ioswrap.h"
+
+class WXDLLEXPORT wxProcess;
#ifdef __X__
#ifndef __VMS__
// Execute a command in an interactive shell window
// If no command then just the shell
-WXDLLEXPORT bool wxShell(const wxString& command = "");
+WXDLLEXPORT bool wxShell(const wxString& command = wxEmptyString);
// Sleep for nSecs seconds under UNIX, do nothing under Windows
WXDLLEXPORT void wxSleep(int nSecs);
// Get hostname.
WXDLLEXPORT bool wxGetHostName(char *buf, int maxSize);
+WXDLLEXPORT bool wxGetHostName(wxString& buf);
// Get user ID e.g. jacs
WXDLLEXPORT bool wxGetUserId(char *buf, int maxSize);
+WXDLLEXPORT bool wxGetUserId(wxString& buf);
// Get user name e.g. Julian Smart
WXDLLEXPORT bool wxGetUserName(char *buf, int maxSize);
+WXDLLEXPORT bool wxGetUserName(wxString& buf);
/*
* Strip out any menu codes
// Returns menu item id or -1 if none.
WXDLLEXPORT int wxFindMenuItemId(wxFrame *frame, const wxString& menuString, const wxString& itemString);
-// A debugging stream buffer.
-// Under Windows, this writes to the Windows debug output.
-// Under other platforms, it writes to cerr.
-
-// ALl this horrible gubbins required for Borland, because the calling
-// convention needs to be the same as for streambuf.
-// Thanks to Gerhard.Vogt@embl-heidelberg.de for this solution.
-
-#if defined(__BORLANDC__) && defined(__BCOPT__) && !defined(_RTL_ALLOW_po) && !defined(__FLAT__)
-#pragma option -po-
-#endif
-
-// Can't export a class derived from a non-export class
-#if !defined(_WINDLL) && !defined(WXUSINGDLL)
-
-// #ifdef new
-// #undef new
-// #endif
-
-class WXDLLEXPORT wxDebugStreamBuf: public streambuf
-{
- public:
- wxDebugStreamBuf(void);
- ~wxDebugStreamBuf(void) {}
-
- int overflow(int i);
- inline int underflow(void) { return EOF; }
- int sync(void);
-};
-
-// #if defined(__WXDEBUG__) && wxUSE_GLOBAL_MEMORY_OPERATORS
-// #define new WXDEBUG_NEW
-// #endif
-
-#endif
-
-#if defined(__BORLANDC__) && defined(__BCOPT__) && !defined(_RTL_ALLOW_po) && !defined(__FLAT__)
-#pragma option -po.
-#endif
-
/*
#if (!defined(__MINMAX_DEFINED) && !defined(max))
#define max(a,b) (((a) > (b)) ? (a) : (b))
#define __MINMAX_DEFINED 1
#endif
*/
+
#define wxMax(a,b) (((a) > (b)) ? (a) : (b))
#define wxMin(a,b) (((a) < (b)) ? (a) : (b))
class WXDLLEXPORT wxCursor;
WXDLLEXPORT_DATA(extern wxCursor*) wxHOURGLASS_CURSOR;
WXDLLEXPORT void wxBeginBusyCursor(wxCursor *cursor = wxHOURGLASS_CURSOR);
-
+
// Restore cursor to normal
WXDLLEXPORT void wxEndBusyCursor(void);
// TRUE if we're between the above two calls
WXDLLEXPORT bool wxIsBusy(void);
+// Convenience class so we can just create a wxBusyCursor object on the stack
+class WXDLLEXPORT wxBusyCursor
+{
+ public:
+ inline wxBusyCursor(wxCursor* cursor = wxHOURGLASS_CURSOR) { wxBeginBusyCursor(cursor); }
+ inline ~wxBusyCursor() { wxEndBusyCursor(); }
+};
+
/* Error message functions used by wxWindows */
// Non-fatal error (continues)
// Reading and writing resources (eg WIN.INI, .Xdefaults)
#if wxUSE_RESOURCES
-WXDLLEXPORT bool wxWriteResource(const wxString& section, const wxString& entry, const wxString& value, const wxString& file = "");
-WXDLLEXPORT bool wxWriteResource(const wxString& section, const wxString& entry, float value, const wxString& file = "");
-WXDLLEXPORT bool wxWriteResource(const wxString& section, const wxString& entry, long value, const wxString& file = "");
-WXDLLEXPORT bool wxWriteResource(const wxString& section, const wxString& entry, int value, const wxString& file = "");
-
-WXDLLEXPORT bool wxGetResource(const wxString& section, const wxString& entry, char **value, const wxString& file = "");
-WXDLLEXPORT bool wxGetResource(const wxString& section, const wxString& entry, float *value, const wxString& file = "");
-WXDLLEXPORT bool wxGetResource(const wxString& section, const wxString& entry, long *value, const wxString& file = "");
-WXDLLEXPORT bool wxGetResource(const wxString& section, const wxString& entry, int *value, const wxString& file = "");
+WXDLLEXPORT bool wxWriteResource(const wxString& section, const wxString& entry, const wxString& value, const wxString& file = wxEmptyString);
+WXDLLEXPORT bool wxWriteResource(const wxString& section, const wxString& entry, float value, const wxString& file = wxEmptyString);
+WXDLLEXPORT bool wxWriteResource(const wxString& section, const wxString& entry, long value, const wxString& file = wxEmptyString);
+WXDLLEXPORT bool wxWriteResource(const wxString& section, const wxString& entry, int value, const wxString& file = wxEmptyString);
+
+WXDLLEXPORT bool wxGetResource(const wxString& section, const wxString& entry, char **value, const wxString& file = wxEmptyString);
+WXDLLEXPORT bool wxGetResource(const wxString& section, const wxString& entry, float *value, const wxString& file = wxEmptyString);
+WXDLLEXPORT bool wxGetResource(const wxString& section, const wxString& entry, long *value, const wxString& file = wxEmptyString);
+WXDLLEXPORT bool wxGetResource(const wxString& section, const wxString& entry, int *value, const wxString& file = wxEmptyString);
#endif // wxUSE_RESOURCES
// Get current Home dir and copy to dest (returns pstr->c_str())
// Get the user's home dir (caller must copy--- volatile)
// returns NULL is no HOME dir is known
-WXDLLEXPORT char* wxGetUserHome(const wxString& user = "");
+WXDLLEXPORT char* wxGetUserHome(const wxString& user = wxEmptyString);
// Check whether this window wants to process messages, e.g. Stop button
// in long calculations.
#ifdef __WXMSW__
WXDLLEXPORT extern const char* wxUserResourceStr;
WXDLLEXPORT char* wxLoadUserResource(const wxString& resourceName, const wxString& resourceType = wxUserResourceStr);
+
+// Implemented in utils.cpp: VC++, Win95 only. Sets up a console for standard
+// input/output
+WXDLLEXPORT void wxRedirectIOToConsole();
+
#endif
// X only