1. wxLoad/SaveFileSelector return "wxString" instead of "char *"

2. WXDLLEXPORT was misplaced in a couple of places (hopefully my chanegs won't
   break compilation for other compilers)
3. Some VC++ warnings suppressed in socket code


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1464 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1999-01-24 23:31:39 +00:00
parent 08853b68b7
commit ba681060f3
18 changed files with 164 additions and 188 deletions

View File

@@ -82,7 +82,7 @@ class WXDLLEXPORT wxDate: public wxObject
friend bool WXDLLEXPORT operator == (const wxDate &dt1, const wxDate &dt2); friend bool WXDLLEXPORT operator == (const wxDate &dt1, const wxDate &dt2);
friend bool WXDLLEXPORT operator != (const wxDate &dt1, const wxDate &dt2); friend bool WXDLLEXPORT operator != (const wxDate &dt1, const wxDate &dt2);
friend ostream& WXDLLEXPORT operator << (ostream &os, const wxDate &dt); friend ostream WXDLLEXPORT & operator << (ostream &os, const wxDate &dt);
wxString FormatDate (int type=-1) const; wxString FormatDate (int type=-1) const;
void SetFormat (int format); void SetFormat (int format);

View File

@@ -15,5 +15,41 @@
#include "wx/stubs/filedlg.h" #include "wx/stubs/filedlg.h"
#endif #endif
// File selector - backward compatibility
WXDLLEXPORT wxString
wxFileSelector(const char *message = wxFileSelectorPromptStr,
const char *default_path = NULL,
const char *default_filename = NULL,
const char *default_extension = NULL,
const char *wildcard = wxFileSelectorDefaultWildcardStr,
int flags = 0,
wxWindow *parent = NULL,
int x = -1, int y = -1);
// An extended version of wxFileSelector
WXDLLEXPORT wxString
wxFileSelectorEx(const char *message = wxFileSelectorPromptStr,
const char *default_path = NULL,
const char *default_filename = NULL,
int *indexDefaultExtension = NULL,
const char *wildcard = wxFileSelectorDefaultWildcardStr,
int flags = 0,
wxWindow *parent = NULL,
int x = -1, int y = -1);
// Ask for filename to load
WXDLLEXPORT wxString
wxLoadFileSelector(const char *what,
const char *extension,
const char *default_name = (const char *)NULL,
wxWindow *parent = (wxWindow *) NULL);
// Ask for filename to save
WXDLLEXPORT wxString
wxSaveFileSelector(const char *what,
const char *extension,
const char *default_name = (const char *) NULL,
wxWindow *parent = (wxWindow *) NULL);
#endif #endif
// _WX_FILEDLG_H_BASE_ // _WX_FILEDLG_H_BASE_

View File

@@ -85,9 +85,9 @@ class WXDLLEXPORT wxGenericFontDialog: public wxDialog
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
char* WXDLLEXPORT wxFontFamilyIntToString(int family); char WXDLLEXPORT *wxFontFamilyIntToString(int family);
char* WXDLLEXPORT wxFontWeightIntToString(int weight); char WXDLLEXPORT *wxFontWeightIntToString(int weight);
char* WXDLLEXPORT wxFontStyleIntToString(int style); char WXDLLEXPORT *wxFontStyleIntToString(int style);
int WXDLLEXPORT wxFontFamilyStringToInt(char *family); int WXDLLEXPORT wxFontFamilyStringToInt(char *family);
int WXDLLEXPORT wxFontWeightStringToInt(char *weight); int WXDLLEXPORT wxFontWeightStringToInt(char *weight);
int WXDLLEXPORT wxFontStyleStringToInt(char *style); int WXDLLEXPORT wxFontStyleStringToInt(char *style);

View File

@@ -76,20 +76,5 @@ class wxFileDialog: public wxDialog
#define wxHIDE_READONLY 8 #define wxHIDE_READONLY 8
#define wxFILE_MUST_EXIST 16 #define wxFILE_MUST_EXIST 16
// File selector - backward compatibility
char* wxFileSelector(const char *message = wxFileSelectorPromptStr, const char *default_path = (const char *) NULL,
const char *default_filename = (const char *) NULL, const char *default_extension = (const char *) NULL,
const char *wildcard = wxFileSelectorDefaultWildcardStr, int flags = 0,
wxWindow *parent = (wxWindow *) NULL, int x = -1, int y = -1);
char* wxLoadFileSelector(const char *what, const char *extension, const char *default_name = (const char *) NULL,
wxWindow *parent = (wxWindow *) NULL);
char* wxSaveFileSelector(const char *what, const char *extension, const char *default_name = (const char *) NULL,
wxWindow *parent = (wxWindow *) NULL);
#endif #endif
// __GTKFILEDLGH__ // __GTKFILEDLGH__

View File

@@ -76,20 +76,5 @@ class wxFileDialog: public wxDialog
#define wxHIDE_READONLY 8 #define wxHIDE_READONLY 8
#define wxFILE_MUST_EXIST 16 #define wxFILE_MUST_EXIST 16
// File selector - backward compatibility
char* wxFileSelector(const char *message = wxFileSelectorPromptStr, const char *default_path = (const char *) NULL,
const char *default_filename = (const char *) NULL, const char *default_extension = (const char *) NULL,
const char *wildcard = wxFileSelectorDefaultWildcardStr, int flags = 0,
wxWindow *parent = (wxWindow *) NULL, int x = -1, int y = -1);
char* wxLoadFileSelector(const char *what, const char *extension, const char *default_name = (const char *) NULL,
wxWindow *parent = (wxWindow *) NULL);
char* wxSaveFileSelector(const char *what, const char *extension, const char *default_name = (const char *) NULL,
wxWindow *parent = (wxWindow *) NULL);
#endif #endif
// __GTKFILEDLGH__ // __GTKFILEDLGH__

View File

@@ -6,7 +6,7 @@
// Created: 01/02/97 // Created: 01/02/97
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) Julian Smart // Copyright: (c) Julian Smart
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifndef _WX_FILEDLG_H_ #ifndef _WX_FILEDLG_H_
@@ -28,15 +28,7 @@ WXDLLEXPORT_DATA(extern const char*) wxFileSelectorDefaultWildcardStr;
class WXDLLEXPORT wxFileDialog: public wxDialog class WXDLLEXPORT wxFileDialog: public wxDialog
{ {
DECLARE_DYNAMIC_CLASS(wxFileDialog) DECLARE_DYNAMIC_CLASS(wxFileDialog)
protected:
wxString m_message;
long m_dialogStyle;
wxWindow * m_parent;
wxString m_dir;
wxString m_path; // Full path
wxString m_fileName;
wxString m_wildCard;
int m_filterIndex;
public: public:
wxFileDialog(wxWindow *parent, const wxString& message = wxFileSelectorPromptStr, wxFileDialog(wxWindow *parent, const wxString& message = wxFileSelectorPromptStr,
const wxString& defaultDir = wxEmptyString, const wxString& defaultFile = wxEmptyString, const wxString& wildCard = wxFileSelectorDefaultWildcardStr, const wxString& defaultDir = wxEmptyString, const wxString& defaultFile = wxEmptyString, const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
@@ -59,6 +51,16 @@ public:
inline int GetFilterIndex(void) const { return m_filterIndex ; } inline int GetFilterIndex(void) const { return m_filterIndex ; }
int ShowModal(void); int ShowModal(void);
protected:
wxString m_message;
long m_dialogStyle;
wxWindow * m_parent;
wxString m_dir;
wxString m_path; // Full path
wxString m_fileName;
wxString m_wildCard;
int m_filterIndex;
}; };
#define wxOPEN 0x0001 #define wxOPEN 0x0001
@@ -67,23 +69,5 @@ public:
#define wxHIDE_READONLY 0x0008 #define wxHIDE_READONLY 0x0008
#define wxFILE_MUST_EXIST 0x0010 #define wxFILE_MUST_EXIST 0x0010
// File selector - backward compatibility
WXDLLEXPORT char* wxFileSelector(const char *message = wxFileSelectorPromptStr, const char *default_path = NULL,
const char *default_filename = NULL, const char *default_extension = NULL,
const char *wildcard = wxFileSelectorDefaultWildcardStr, int flags = 0,
wxWindow *parent = NULL, int x = -1, int y = -1);
// An extended version of wxFileSelector
WXDLLEXPORT char* wxFileSelectorEx(const char *message = wxFileSelectorPromptStr, const char *default_path = NULL,
const char *default_filename = NULL, int *indexDefaultExtension = NULL,
const char *wildcard = wxFileSelectorDefaultWildcardStr, int flags = 0,
wxWindow *parent = NULL, int x = -1, int y = -1);
// Generic file load dialog
WXDLLEXPORT char* wxLoadFileSelector(const char *what, const char *extension, const char *default_name = NULL, wxWindow *parent = NULL);
// Generic file save dialog
WXDLLEXPORT char* wxSaveFileSelector(const char *what, const char *extension, const char *default_name = NULL, wxWindow *parent = NULL);
#endif #endif
// _WX_FILEDLG_H_ // _WX_FILEDLG_H_

View File

@@ -67,23 +67,5 @@ public:
#define wxHIDE_READONLY 0x0008 #define wxHIDE_READONLY 0x0008
#define wxFILE_MUST_EXIST 0x0010 #define wxFILE_MUST_EXIST 0x0010
// File selector - backward compatibility
char* WXDLLEXPORT wxFileSelector(const char *message = wxFileSelectorPromptStr, const char *default_path = NULL,
const char *default_filename = NULL, const char *default_extension = NULL,
const char *wildcard = wxFileSelectorDefaultWildcardStr, int flags = 0,
wxWindow *parent = NULL, int x = -1, int y = -1);
// An extended version of wxFileSelector
char* WXDLLEXPORT wxFileSelectorEx(const char *message = wxFileSelectorPromptStr, const char *default_path = NULL,
const char *default_filename = NULL, int *indexDefaultExtension = NULL,
const char *wildcard = wxFileSelectorDefaultWildcardStr, int flags = 0,
wxWindow *parent = NULL, int x = -1, int y = -1);
// Generic file load dialog
char* WXDLLEXPORT wxLoadFileSelector(const char *what, const char *extension, const char *default_name = NULL, wxWindow *parent = NULL);
// Generic file save dialog
char* WXDLLEXPORT wxSaveFileSelector(const char *what, const char *extension, const char *default_name = NULL, wxWindow *parent = NULL);
#endif #endif
// _WX_FILEDLG_H_ // _WX_FILEDLG_H_

View File

@@ -67,23 +67,5 @@ public:
#define wxHIDE_READONLY 0x0008 #define wxHIDE_READONLY 0x0008
#define wxFILE_MUST_EXIST 0x0010 #define wxFILE_MUST_EXIST 0x0010
// File selector - backward compatibility
char* WXDLLEXPORT wxFileSelector(const char *message = wxFileSelectorPromptStr, const char *default_path = NULL,
const char *default_filename = NULL, const char *default_extension = NULL,
const char *wildcard = wxFileSelectorDefaultWildcardStr, int flags = 0,
wxWindow *parent = NULL, int x = -1, int y = -1);
// An extended version of wxFileSelector
char* WXDLLEXPORT wxFileSelectorEx(const char *message = wxFileSelectorPromptStr, const char *default_path = NULL,
const char *default_filename = NULL, int *indexDefaultExtension = NULL,
const char *wildcard = wxFileSelectorDefaultWildcardStr, int flags = 0,
wxWindow *parent = NULL, int x = -1, int y = -1);
// Generic file load dialog
char* WXDLLEXPORT wxLoadFileSelector(const char *what, const char *extension, const char *default_name = NULL, wxWindow *parent = NULL);
// Generic file save dialog
char* WXDLLEXPORT wxSaveFileSelector(const char *what, const char *extension, const char *default_name = NULL, wxWindow *parent = NULL);
#endif #endif
// _WX_FILEDLG_H_ // _WX_FILEDLG_H_

View File

@@ -279,7 +279,7 @@ bool WXDLLEXPORT operator != (const wxDate &dt1, const wxDate &dt2)
// Ostream operations // Ostream operations
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
ostream& WXDLLEXPORT operator << (ostream &os, const wxDate &dt) ostream WXDLLEXPORT & operator << (ostream &os, const wxDate &dt)
{ {
return os << (const char *) dt.FormatDate(); return os << (const char *) dt.FormatDate();
} }

View File

@@ -194,18 +194,21 @@ bool wxDocument::Save(void)
bool wxDocument::SaveAs(void) bool wxDocument::SaveAs(void)
{ {
wxDocTemplate *docTemplate = GetDocumentTemplate(); wxDocTemplate *docTemplate = GetDocumentTemplate();
if (!docTemplate) if (!docTemplate)
return FALSE; return FALSE;
char *tmp = wxFileSelector(_("Save as"), docTemplate->GetDirectory(), GetFilename(),
docTemplate->GetDefaultExtension(), docTemplate->GetFileFilter(),
wxSAVE|wxOVERWRITE_PROMPT, GetDocumentWindow());
if (!tmp) wxString tmp = wxFileSelector(_("Save as"),
return FALSE; docTemplate->GetDirectory(),
else GetFilename(),
{ docTemplate->GetDefaultExtension(),
docTemplate->GetFileFilter(),
wxSAVE | wxOVERWRITE_PROMPT,
GetDocumentWindow());
if (tmp.IsEmpty())
return FALSE;
wxString fileName(tmp); wxString fileName(tmp);
wxString path(""); wxString path("");
wxString name(""); wxString name("");
@@ -231,8 +234,8 @@ bool wxDocument::SaveAs(void)
view->OnChangeFilename(); view->OnChangeFilename();
node = node->Next(); node = node->Next();
} }
}
return OnSaveDocument(m_documentFile); return OnSaveDocument(m_documentFile);
} }
bool wxDocument::OnSaveDocument(const wxString& file) bool wxDocument::OnSaveDocument(const wxString& file)
@@ -1144,33 +1147,30 @@ wxDocTemplate *wxDocManager::SelectDocumentPath(wxDocTemplate **WXUNUSED(templat
{ {
// We can only have multiple filters in Windows // We can only have multiple filters in Windows
#ifdef __WXMSW__ #ifdef __WXMSW__
char *descrBuf = new char[1000]; // FIXME static buffer wxString descrBuf;
descrBuf[0] = 0;
int i; int i;
for (i = 0; i < noTemplates; i++) for (i = 0; i < noTemplates; i++)
{
if (templates[i]->IsVisible())
{ {
strcat(descrBuf, templates[i]->GetDescription()); if (templates[i]->IsVisible())
strcat(descrBuf, " ("); {
strcat(descrBuf, templates[i]->GetFileFilter()); // add a '|' to separate this filter from the previous one
strcat(descrBuf, ") "); if ( !descrBuf.IsEmpty() )
strcat(descrBuf, "|"); descrBuf << '|';
strcat(descrBuf, templates[i]->GetFileFilter());
strcat(descrBuf, "|"); descrBuf << templates[i]->GetDescription()
<< " (" << templates[i]->GetFileFilter() << ") |"
<< templates[i]->GetFileFilter();
}
} }
}
int len = strlen(descrBuf);
if (len > 0)
// Omit final "|"
descrBuf[len-1] = 0;
#else #else
char* descrBuf = copystring("*.*"); wxString descrBuf = "*.*";
#endif #endif
char *pathTmp = wxFileSelector(_("Select a file"), "", "", "", descrBuf, 0, wxTheApp->GetTopWindow()); wxString pathTmp = wxFileSelector(_("Select a file"), "", "", "",
delete[] descrBuf; descrBuf, 0, wxTheApp->GetTopWindow());
if (pathTmp)
if (!pathTmp.IsEmpty())
{ {
path = pathTmp; path = pathTmp;
char *theExt = FindExtension((char *)(const char *)path); char *theExt = FindExtension((char *)(const char *)path);

View File

@@ -439,6 +439,11 @@ wxSocketBase& wxSocketBase::WriteMsg(const char *buffer, size_t nbytes)
{ {
SockMsg msg; SockMsg msg;
// warning about 'cast truncates constant value'
#ifdef _MSC_VER
#pragma warning(disable: 4310)
#endif // _MSC_VER
msg.sig[0] = (char) 0xad; msg.sig[0] = (char) 0xad;
msg.sig[1] = (char) 0xde; msg.sig[1] = (char) 0xde;
msg.sig[2] = (char) 0xed; msg.sig[2] = (char) 0xed;
@@ -462,6 +467,10 @@ wxSocketBase& wxSocketBase::WriteMsg(const char *buffer, size_t nbytes)
Write((char *)&msg, sizeof(msg)); Write((char *)&msg, sizeof(msg));
return *this; return *this;
#ifdef _MSC_VER
#pragma warning(default: 4310)
#endif // _MSC_VER
} }
wxSocketBase& wxSocketBase::Unread(const char *buffer, size_t nbytes) wxSocketBase& wxSocketBase::Unread(const char *buffer, size_t nbytes)
@@ -1602,7 +1611,12 @@ LRESULT APIENTRY _EXPORT wxSocketHandlerWndProc(HWND hWnd, UINT message,
case FD_CONNECT: case FD_CONNECT:
sk_req = wxSocketBase::EVT_CONNECT; sk_req = wxSocketBase::EVT_CONNECT;
break; break;
default:
wxFAIL_MSG("invalid socket event");
return (LRESULT)0;
} }
sock->OnRequest(sk_req); sock->OnRequest(sk_req);
return (LRESULT)0; return (LRESULT)0;

View File

@@ -80,7 +80,7 @@ static const struct
} g_strEmpty = { {-1, 0, 0}, '\0' }; } g_strEmpty = { {-1, 0, 0}, '\0' };
// empty C style string: points to 'string data' byte of g_strEmpty // empty C style string: points to 'string data' byte of g_strEmpty
extern const char *g_szNul = &g_strEmpty.dummy; extern const char WXDLLEXPORT *g_szNul = &g_strEmpty.dummy;
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// conditional compilation // conditional compilation

View File

@@ -335,12 +335,13 @@ bool wxPostScriptDC::PrinterDialog(wxWindow *parent)
} }
else if ((m_filename == "") && (wxThePrintSetupData->GetPrinterMode() == PS_FILE)) else if ((m_filename == "") && (wxThePrintSetupData->GetPrinterMode() == PS_FILE))
{ {
char *file = wxSaveFileSelector (_("PostScript"), "ps"); wxString file = wxSaveFileSelector (_("PostScript"), "ps");
if (!file) if ( file.IsEmpty() )
{ {
m_ok = FALSE; m_ok = FALSE;
return FALSE; return FALSE;
} }
wxThePrintSetupData->SetPrinterFile(file); wxThePrintSetupData->SetPrinterFile(file);
m_filename = file; m_filename = file;
m_ok = TRUE; m_ok = TRUE;

View File

@@ -156,14 +156,14 @@ void wxGenericPrintDialog::OnOK(wxCommandEvent& WXUNUSED(event))
{ {
wxThePrintSetupData->SetPrinterMode(PS_FILE); wxThePrintSetupData->SetPrinterMode(PS_FILE);
char *f = wxFileSelector(_("PostScript file"), wxString f = wxFileSelector(_("PostScript file"),
wxPathOnly(wxThePrintSetupData->GetPrinterFile()), wxPathOnly(wxThePrintSetupData->GetPrinterFile()),
wxFileNameFromPath(wxThePrintSetupData->GetPrinterFile()), wxFileNameFromPath(wxThePrintSetupData->GetPrinterFile()),
"ps", "*.ps", 0, this); "ps", "*.ps", 0, this);
if (f) if ( f.IsEmpty() )
wxThePrintSetupData->SetPrinterFile(f); return;
else
return; wxThePrintSetupData->SetPrinterFile(f);
} }
else else
wxThePrintSetupData->SetPrinterMode(PS_PRINTER); wxThePrintSetupData->SetPrinterMode(PS_PRINTER);
@@ -425,7 +425,7 @@ void wxGenericPageSetupDialog::OnPrinter(wxCommandEvent& WXUNUSED(event))
wxPrintData data; wxPrintData data;
data.SetSetupDialog(TRUE); data.SetSetupDialog(TRUE);
wxPrintDialog *printDialog = new wxPrintDialog(this, & data); wxPrintDialog *printDialog = new wxPrintDialog(this, & data);
int ret = printDialog->ShowModal(); printDialog->ShowModal();
printDialog->Destroy(); printDialog->Destroy();

View File

@@ -260,7 +260,7 @@ bool wxApp::Initialize()
// This is to foil optimizations in Visual C++ that // This is to foil optimizations in Visual C++ that
// throw out dummy.obj. // throw out dummy.obj.
#if defined(_MSC_VER) && !defined(WXMAKINGDLL) #if 0 && defined(_MSC_VER) && !defined(WXMAKINGDLL)
extern char wxDummyChar; extern char wxDummyChar;
if (wxDummyChar) wxDummyChar++; if (wxDummyChar) wxDummyChar++;
#endif #endif

View File

@@ -97,8 +97,8 @@ void wxBitmapButton::SetBitmapLabel(const wxBitmap& bitmap)
bool wxBitmapButton::MSWOnDraw(WXDRAWITEMSTRUCT *item) bool wxBitmapButton::MSWOnDraw(WXDRAWITEMSTRUCT *item)
{ {
long style = GetWindowLong((HWND) GetHWND(), GWL_STYLE);
#if defined(__WIN95__) #if defined(__WIN95__)
long style = GetWindowLong((HWND) GetHWND(), GWL_STYLE);
if (style & BS_BITMAP) if (style & BS_BITMAP)
{ {
// Should we call Default() here? // Should we call Default() here?

View File

@@ -10,30 +10,30 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation "filedlg.h" #pragma implementation "filedlg.h"
#endif #endif
// For compilers that support precompilation, includes "wx.h". // For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h" #include "wx/wxprec.h"
#ifdef __BORLANDC__ #ifdef __BORLANDC__
#pragma hdrstop #pragma hdrstop
#endif #endif
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include <stdio.h> #include <stdio.h>
#include "wx/defs.h" #include "wx/defs.h"
#include "wx/utils.h" #include "wx/utils.h"
#include "wx/msgdlg.h" #include "wx/msgdlg.h"
#include "wx/dialog.h" #include "wx/dialog.h"
#include "wx/filedlg.h" #include "wx/filedlg.h"
#include "wx/intl.h" #include "wx/intl.h"
#endif #endif
#include <windows.h> #include <windows.h>
#if !defined(__WIN32__) || defined(__SALFORDC__) #if !defined(__WIN32__) || defined(__SALFORDC__)
#include <commdlg.h> #include <commdlg.h>
#endif #endif
#include "wx/msw/private.h" #include "wx/msw/private.h"
@@ -43,13 +43,17 @@
#include <string.h> #include <string.h>
#if !USE_SHARED_LIBRARY #if !USE_SHARED_LIBRARY
IMPLEMENT_CLASS(wxFileDialog, wxDialog) IMPLEMENT_CLASS(wxFileDialog, wxDialog)
#endif #endif
char *wxFileSelector(const char *title, wxString wxFileSelector(const char *title,
const char *defaultDir, const char *defaultFileName, const char *defaultDir,
const char *defaultExtension, const char *filter, int flags, const char *defaultFileName,
wxWindow *parent, int x, int y) const char *defaultExtension,
const char *filter,
int flags,
wxWindow *parent,
int x, int y)
{ {
// In the original implementation, defaultExtension is passed to the // In the original implementation, defaultExtension is passed to the
// lpstrDefExt member of OPENFILENAME. This extension, if non-NULL, is // lpstrDefExt member of OPENFILENAME. This extension, if non-NULL, is
@@ -120,7 +124,7 @@ char *wxFileSelector(const char *title,
return wxBuffer; return wxBuffer;
} }
else else
return NULL; return wxGetEmptyString();
} }
# if __BORLANDC__ # if __BORLANDC__
@@ -144,7 +148,7 @@ char *wxFileSelector(const char *title,
# endif # endif
char *wxFileSelectorEx(const char *title, wxString wxFileSelectorEx(const char *title,
const char *defaultDir, const char *defaultDir,
const char *defaultFileName, const char *defaultFileName,
int* defaultFilterIndex, int* defaultFilterIndex,
@@ -165,7 +169,7 @@ char *wxFileSelectorEx(const char *title,
return wxBuffer; return wxBuffer;
} }
else else
return NULL; return wxGetEmptyString();
} }
wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message, wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
@@ -328,17 +332,16 @@ int wxFileDialog::ShowModal(void)
} }
// Generic file load/save dialog // Generic file load/save dialog (for internal use only)
static char * static
wxDefaultFileSelector(bool load, const char *what, const char *extension, const char *default_name, wxWindow *parent) wxString wxDefaultFileSelector(bool load,
const char *what,
const char *extension,
const char *default_name,
wxWindow *parent)
{ {
wxString prompt; wxString prompt;
wxString str; wxString str = load ? _("Load %s file") : _("Save %s file");
if (load)
str = _("Load %s file");
else
str = _("Save %s file");
prompt.Printf(str, what); prompt.Printf(str, what);
const char *ext = extension; const char *ext = extension;
@@ -352,18 +355,20 @@ wxDefaultFileSelector(bool load, const char *what, const char *extension, const
} }
// Generic file load dialog // Generic file load dialog
char * WXDLLEXPORT wxString wxLoadFileSelector(const char *what,
wxLoadFileSelector(const char *what, const char *extension, const char *default_name, wxWindow *parent) const char *extension,
const char *default_name,
wxWindow *parent)
{ {
return wxDefaultFileSelector(TRUE, what, extension, default_name, parent); return wxDefaultFileSelector(TRUE, what, extension, default_name, parent);
} }
// Generic file save dialog // Generic file save dialog
char * WXDLLEXPORT wxString wxSaveFileSelector(const char *what,
wxSaveFileSelector(const char *what, const char *extension, const char *default_name, wxWindow *parent) 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);
} }

View File

@@ -48,7 +48,7 @@
#undef GetClassName #undef GetClassName
#endif #endif
#if wxUSE_NATIVE_STATUSBAR #if wxUSE_NATIVE_STATUSBAR
#if !USE_SHARED_LIBRARY #if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxStatusBar95, wxStatusBar); IMPLEMENT_DYNAMIC_CLASS(wxStatusBar95, wxStatusBar);
@@ -236,7 +236,9 @@ void wxStatusBar95::OnSize(wxSizeEvent& event)
SetFieldsWidth(); SetFieldsWidth();
} }
#endif #endif // wxUSE_NATIVE_STATUSBAR
// __WIN95__
#endif #else
// wxUSE_NATIVE_STATUSBAR #error "wxStatusBar95 is only available under Windows 95 and later."
#endif // __WIN95__