]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/filedlg.cpp
another segfault fix
[wxWidgets.git] / src / os2 / filedlg.cpp
index 8832598af41c29001acd781e577cf51a17f859e7..aee711ce99540c7ed13cc71d2e0c165173f733d0 100644 (file)
@@ -1,32 +1,53 @@
 /////////////////////////////////////////////////////////////////////////////
 // Name:        filedlg.cpp
 // Purpose:     wxFileDialog
 /////////////////////////////////////////////////////////////////////////////
 // Name:        filedlg.cpp
 // Purpose:     wxFileDialog
-// Author:      AUTHOR
+// Author:      David Webster
 // Modified by:
 // Modified by:
-// Created:     ??/??/98
+// Created:     10/05/99
 // RCS-ID:      $Id$
 // RCS-ID:      $Id$
-// Copyright:   (c) AUTHOR
+// Copyright:   (c) David Webster
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#ifdef __GNUG__
-#pragma implementation "filedlg.h"
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+    #pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+    #include <stdio.h>
+    #include "wx/defs.h"
+    #include "wx/utils.h"
+    #include "wx/msgdlg.h"
+    #include "wx/dialog.h"
+    #include "wx/filedlg.h"
+    #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #endif
 
-#include "wx/defs.h"
-#include "wx/utils.h"
-#include "wx/dialog.h"
-#include "wx/filedlg.h"
-#include "wx/intl.h"
+#define INCL_PM
+#include <os2.h>
+
+#include "wx/os2/private.h"
+
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
 
 
-#if !USE_SHARED_LIBRARY
 IMPLEMENT_CLASS(wxFileDialog, wxDialog)
 IMPLEMENT_CLASS(wxFileDialog, wxDialog)
-#endif
 
 
-wxString wxFileSelector(const char *title,
-                     const char *defaultDir, const char *defaultFileName,
-                     const char *defaultExtension, const char *filter, int flags,
-                     wxWindow *parent, int x, int y)
+wxString wxFileSelector( const char* title
+                        ,const char* defaultDir
+                        ,const char* defaultFileName
+                        ,const char* defaultExtension
+                        ,const char* filter
+                        ,int         flags
+                        ,wxWindow*   parent
+                        ,int         x
+                        ,int         y
+                       )
 {
     // If there's a default extension specified but no filter, we create a suitable
     // filter.
 {
     // If there's a default extension specified but no filter, we create a suitable
     // filter.
@@ -59,16 +80,32 @@ wxString wxFileSelector(const char *title,
         return wxEmptyString;
 }
 
         return wxEmptyString;
 }
 
-wxString wxFileSelectorEx(const char *title,
-                       const char *defaultDir,
-                       const char *defaultFileName,
-                       int* defaultFilterIndex,
-                       const char *filter,
-                       int       flags,
-                       wxWindow* parent,
-                       int       x,
-                       int       y)
-
+# ifndef MAXPATH
+# define MAXPATH   400
+# endif
+
+# ifndef MAXDRIVE
+# define MAXDRIVE  3
+# endif
+
+# ifndef MAXFILE
+# define MAXFILE   9
+# endif
+
+# ifndef MAXEXT
+# define MAXEXT    5
+# endif
+
+wxString wxFileSelectorEx( const char* title
+                          ,const char* defaultDir
+                          ,const char* defaultFileName
+                          ,int*        defaultFilterIndex
+                          ,const char* filter
+                          ,int         flags
+                          ,wxWindow*   parent
+                          ,int         x
+                          ,int         y
+                         )
 {
     wxFileDialog fileDialog(parent, title ? title : "", defaultDir ? defaultDir : "",
         defaultFileName ? defaultFileName : "", filter ? filter : "", flags, wxPoint(x, y));
 {
     wxFileDialog fileDialog(parent, title ? title : "", defaultDir ? defaultDir : "",
         defaultFileName ? defaultFileName : "", filter ? filter : "", flags, wxPoint(x, y));
@@ -82,9 +119,14 @@ wxString wxFileSelectorEx(const char *title,
         return wxEmptyString;
 }
 
         return wxEmptyString;
 }
 
-wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
-        const wxString& defaultDir, const wxString& defaultFileName, const wxString& wildCard,
-        long style, const wxPoint& pos)
+wxFileDialog::wxFileDialog( wxWindow*       parent
+                           ,const wxString& message
+                           ,const wxString& defaultDir
+                           ,const wxString& defaultFileName
+                           ,const wxString& wildCard
+                           ,long            style
+                           ,const wxPoint&  pos
+                          )
 {
     m_message = message;
     m_dialogStyle = style;
 {
     m_message = message;
     m_dialogStyle = style;
@@ -103,10 +145,15 @@ int wxFileDialog::ShowModal()
 }
 
 // Generic file load/save dialog
 }
 
 // Generic file load/save dialog
-static wxString wxDefaultFileSelector(bool load, const char *what, const char *extension, const char *default_name, wxWindow *parent)
+static wxString wxDefaultFileSelector( bool        load
+                                      ,const char* what
+                                      ,const char* extension
+                                      ,const char* default_name
+                                      ,wxWindow*   parent
+                                     )
 {
   char *ext = (char *)extension;
 {
   char *ext = (char *)extension;
-  
+
   char prompt[50];
   wxString str;
   if (load)
   char prompt[50];
   wxString str;
   if (load)
@@ -123,14 +170,22 @@ static wxString wxDefaultFileSelector(bool load, const char *what, const char *e
 }
 
 // Generic file load dialog
 }
 
 // Generic file load dialog
-wxString wxLoadFileSelector(const char *what, const char *extension, const char *default_name, wxWindow *parent)
+wxString wxLoadFileSelector( const char* what
+                            ,const char* extension
+                            ,const char* default_name
+                            ,wxWindow*   parent
+                           )
 {
   return wxDefaultFileSelector(TRUE, what, extension, default_name, parent);
 }
 
 
 // Generic file save dialog
 {
   return wxDefaultFileSelector(TRUE, what, extension, default_name, parent);
 }
 
 
 // Generic file save dialog
-wxString wxSaveFileSelector(const char *what, const char *extension, const char *default_name, wxWindow *parent)
+wxString wxSaveFileSelector( const char* what
+                            ,const char* extension
+                            ,const char* default_name
+                            ,wxWindow*   parent
+                           )
 {
   return wxDefaultFileSelector(FALSE, what, extension, default_name, parent);
 }
 {
   return wxDefaultFileSelector(FALSE, what, extension, default_name, parent);
 }