Back to index

plt-scheme  4.2.1
Utilities.h
Go to the documentation of this file.
00001 /*                                                      -*- C++ -*-
00002  *
00003  * Purpose: common utilities
00004  *
00005  * Authors: Markus Holzem and Julian Smart
00006  *
00007  * Copyright: (C) 2004-2009 PLT Scheme Inc.
00008  * Copyright: (C) 1995, AIAI, University of Edinburgh (Julian)
00009  * Copyright: (C) 1995, GNU (Markus)
00010  *
00011  * This program is free software; you can redistribute it and/or modify
00012  * it under the terms of the GNU General Public License as published by
00013  * the Free Software Foundation; either version 2 of the License, or
00014  * (at your option) any later version.
00015  *
00016  * This program is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU General Public License
00022  * along with this program; if not, write to the Free Software
00023  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00024  * 02110-1301 USA.
00025  */
00026 
00027 #ifndef wxUtilities_h
00028 #define wxUtilities_h
00029 
00030 #ifdef __GNUG__
00031 #pragma interface
00032 #endif
00033 
00034 #undef  min
00035 #define min(a,b) ((a)<(b)?(a):(b))
00036 #undef  max
00037 #define max(a,b) ((a)>(b)?(a):(b))
00038 #undef  wxNumberOf
00039 #define wxNumberOf(arr) ((int)(sizeof(arr)/sizeof(arr[0])))
00040 
00041 // application utilities
00042 void wxExit(void);
00043 void wxFlushEvents(void);
00044 Bool wxYield(void);
00045 
00046 // File functions
00047 Bool wxDirExists(char *dirname);
00048 Bool wxFileExists(char *filename);
00049 Bool wxRemoveFile(char *filename);
00050 
00051 char *wxFileNameFromPath(char *path);
00052 char *wxPathOnly(char *path);
00053 char *wxGetUserHome(const char *user);
00054 char *wxGetTempFileName(char *prefix, char *dest);
00055 
00056 #define DirExists wxDirExists
00057 #define FileExists wxFileExists
00058 #define FileNameFromPath wxFileNameFromPath
00059 #define PathOnly wxPathOnly
00060 
00061 // Network functions
00062 extern "C" {
00063 #include "Net.h"
00064 }
00065 
00066 // String functions
00067 char *copystring(const char *s);
00068 #ifdef MZ_PRECISE_GC
00069 char *copystring_to_aligned(const char *s, int d);
00070 #endif
00071 void wxGetLabelAndKey(char *label, char **clean_label, char **clean_key);
00072 char *wxStripMenuCodes(char *in, char *out);
00073 
00074 // GDI functions
00075 class wxCursor;
00076 Bool wxColourDisplay(void);
00077 int  wxDisplayDepth(void);
00078 void wxDisplaySize(int *width, int *height, int flags = 0);
00079 void wxDisplayOrigin(int *x, int *y);
00080 
00081 // busy cursor
00082 class wxCursor;
00083 void wxBeginBusyCursor(wxCursor *cursor = wxHOURGLASS_CURSOR);
00084 void wxEndBusyCursor(void);
00085 Bool wxIsBusy(void);
00086 
00087 void wxHideCursor(void);
00088 void wxUnhideCursor(void);
00089 int wxCheckHiddenCursors();
00090 int wxUnhideCursorInFrame(wxObject *o, int busy);
00091 
00092 // Miscellaneous
00093 void wxDebugMsg(const char *fmt, ...);
00094 void wxError(const char *msg, const char *title="wxWindows Error");
00095 Bool wxExecute(char **argv, Bool Async = FALSE);
00096 Bool wxExecute(const char *command, Bool Async = FALSE);
00097 void wxFatalError(const char *msg, const char *title="wxWindows Fatal Error");
00098 char *wxNow(void);
00099 
00100 // read/write resources
00101 Bool wxGetResource(const char *section, const char *entry, char **value,
00102                  const char *file = NULL);
00103 Bool wxGetResource(const char *section, const char *entry, float *value,
00104                  const char *file = NULL);
00105 Bool wxGetResource(const char *section, const char *entry, long *value,
00106                  const char *file = NULL);
00107 Bool wxGetResource(const char *section, const char *entry, int *value,
00108                  const char *file = NULL);
00109 Bool wxWriteResource(const char *section, const char *entry, char *value,
00110                    const char *file = NULL);
00111 Bool wxWriteResource(const char *section, const char *entry, float value,
00112                    const char *file = NULL);
00113 Bool wxWriteResource(const char *section, const char *entry, long value,
00114                    const char *file = NULL);
00115 Bool wxWriteResource(const char *section, const char *entry, int value,
00116                    const char *file = NULL);
00117 
00118 #endif // wxUtilities_h