]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/utilscmn.cpp
no event upon changing value only anymore
[wxWidgets.git] / src / common / utilscmn.cpp
index 9d0d3b771cfd085d9ac4bd5237915583d2ba2d9b..92dabe4d64811f59f925758ed7a8ac76c6810ac1 100644 (file)
 
 #if wxUSE_GUI
     #include "wx/colordlg.h"
+    #include "wx/fontdlg.h"
     #include "wx/notebook.h"
     #include "wx/frame.h"
     #include "wx/statusbr.h"
-    #include "wx/toolbar.h"
 #endif // wxUSE_GUI
 
 #include <time.h>
     #include "wx/msw/private.h"
 #endif
 
+// ----------------------------------------------------------------------------
+// common data
+// ----------------------------------------------------------------------------
+
+#if WXWIN_COMPATIBILITY_2_2
+    const wxChar *wxInternalErrorStr = wxT("wxWindows Internal Error");
+    const wxChar *wxFatalErrorStr = wxT("wxWindows Fatal Error");
+#endif // WXWIN_COMPATIBILITY_2_2
+
 // ----------------------------------------------------------------------------
 // function protoypes
 // ----------------------------------------------------------------------------
@@ -217,6 +226,11 @@ extern "C"
 #define strncasecmp strnicmp
 #endif
 
+#ifdef __WATCOMC__
+#define strcasecmp stricmp
+#define strncasecmp strnicmp
+#endif
+
 wxChar *
 copystring (const wxChar *s)
 {
@@ -606,6 +620,7 @@ wxWindow* wxFindWindowAtPoint(wxWindow* win, const wxPoint& pt)
 
     // Hack for wxNotebook case: at least in wxGTK, all pages
     // claim to be shown, so we must only deal with the selected one.
+#if wxUSE_NOTEBOOK
     if (win->IsKindOf(CLASSINFO(wxNotebook)))
     {
       wxNotebook* nb = (wxNotebook*) win;
@@ -618,6 +633,8 @@ wxWindow* wxFindWindowAtPoint(wxWindow* win, const wxPoint& pt)
            return foundWin;
       }
     }
+#endif
+
     /* Doesn't work
     // Frame case
     else if (win->IsKindOf(CLASSINFO(wxFrame)))
@@ -739,7 +756,7 @@ whereami(name)
 
         t = imagedir;
         if (!absolute_pathname(name)) {
-#if defined(DOS) || defined(__WIN32__)
+#if defined(__DOS__) || defined(__WIN32__)
             int   drive;
             char *newrbuf;
 
@@ -954,36 +971,59 @@ wxString wxGetPasswordFromUser(const wxString& message,
 
 wxColour wxGetColourFromUser(wxWindow *parent, const wxColour& colInit)
 {
-      wxColourData data;
-      data.SetChooseFull(TRUE);
-      if ( colInit.Ok() )
-      {
-          data.SetColour((wxColour &)colInit); // const_cast
-      }
+    wxColourData data;
+    data.SetChooseFull(TRUE);
+    if ( colInit.Ok() )
+    {
+        data.SetColour((wxColour &)colInit); // const_cast
+    }
 
-      wxColour colRet;
-      wxColourDialog dialog(parent, &data);
-      if ( dialog.ShowModal() == wxID_OK )
-      {
-          colRet = dialog.GetColourData().GetColour();
-      }
-      //else: leave it invalid
+    wxColour colRet;
+    wxColourDialog dialog(parent, &data);
+    if ( dialog.ShowModal() == wxID_OK )
+    {
+        colRet = dialog.GetColourData().GetColour();
+    }
+    //else: leave it invalid
 
-      return colRet;
+    return colRet;
 }
 
 #endif // wxUSE_COLOURDLG
 
+#if wxUSE_FONTDLG
+
+wxFont wxGetFontFromUser(wxWindow *parent, const wxFont& fontInit)
+{
+    wxFontData data;
+    if ( fontInit.Ok() )
+    {
+        data.SetInitialFont(fontInit);
+    }
+
+    wxFont fontRet;
+    wxFontDialog dialog(parent, &data);
+    if ( dialog.ShowModal() == wxID_OK )
+    {
+        fontRet = dialog.GetFontData().GetChosenFont();
+    }
+    //else: leave it invalid
+
+    return fontRet;
+}
+
+#endif // wxUSE_FONTDLG
 // ----------------------------------------------------------------------------
 // missing C RTL functions (FIXME shouldn't be here at all)
 // ----------------------------------------------------------------------------
 
 #ifdef __MWERKS__
+#if __MSL__ < 0x7000
 char *strdup(const char *s)
 {
         return strcpy( (char*) malloc( strlen( s ) + 1 ) , s ) ;
 }
-
+#endif
 int isascii( int c )
 {
         return ( c >= 0 && c < 128 ) ;
@@ -1077,7 +1117,7 @@ const wxChar *wxGetInstallPrefix()
 {
     wxString prefix;
     
-    if ( wxGetEnv(wxT("WX_PREFIX"), &prefix) )
+    if ( wxGetEnv(wxT("WXPREFIX"), &prefix) )
         return prefix.c_str();
     
 #ifdef wxINSTALL_PREFIX
@@ -1087,6 +1127,18 @@ const wxChar *wxGetInstallPrefix()
 #endif
 }
 
+wxString wxGetDataDir()
+{
+    wxString format = wxGetInstallPrefix();
+    format <<  wxFILE_SEP_PATH
+           << wxT("share") << wxFILE_SEP_PATH
+           << wxT("wx") << wxFILE_SEP_PATH
+           << wxT("%i.%i");
+    wxString dir;
+    dir.Printf(format.c_str(), wxMAJOR_VERSION, wxMINOR_VERSION);
+    return dir;
+}
+
 
 // ----------------------------------------------------------------------------
 // network and user id functions
@@ -1242,7 +1294,7 @@ static long wxDoExecuteWithCapture(const wxString& command,
     wxProcess *process = new wxProcess;
     process->Redirect();
 
-    long rc = wxExecute(command, TRUE /* sync */, process);
+    long rc = wxExecute(command, wxEXEC_SYNC, process);
 
 #if wxUSE_STREAMS
     if ( rc != -1 )