Back to index

plt-scheme  4.2.1
FileDialog.cc
Go to the documentation of this file.
00001 /*                                                      -*- C++ -*-
00002  *
00003  * Purpose: file load and save dialogs
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 #include "wx.h"
00028 
00029 extern char *wxsFileDialog(char *message, char *default_path, 
00030                         char *default_filename, char *default_extension, 
00031                         int is_put, wxWindow *parent);
00032 
00033 //-----------------------------------------------------------------------------
00034 // wxFileSelector
00035 //-----------------------------------------------------------------------------
00036 char *wxFileSelector(char *message, char *default_path,
00037                    char *default_filename, char *default_extension,
00038                    char *WXUNUSED(wildcard), int flags, wxWindow *parent, int, int)
00039 {
00040   return wxsFileDialog(message, default_path, default_filename, default_extension, 
00041                      (flags & wxSAVE), parent);
00042 }
00043 
00044 char *wxLoadFileSelector(char *WXUNUSED(what), char *extension, char *default_name,
00045                       wxWindow *parent)
00046 {
00047     char wild[60];
00048     if (*extension == '.')  ++extension;
00049     sprintf(wild, "*.%s", extension);
00050     return wxFileSelector("Load file", NULL, default_name,
00051                        (char*)extension, wild, 0, parent, 0, 0);
00052 }
00053 
00054 char *wxSaveFileSelector(char *WXUNUSED(what), char *extension, char *default_name,
00055                       wxWindow *parent)
00056 {
00057     char wild[60];
00058     if (*extension == '.')  ++extension;
00059     sprintf(wild, "*.%s", extension);
00060     return wxFileSelector("Save file", NULL, default_name,
00061                        (char*)extension, wild, wxSAVE, parent, 0, 0);
00062 }