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;
void SetFormat (int format);
#include "wx/stubs/filedlg.h"
#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
// _WX_FILEDLG_H_BASE_
DECLARE_EVENT_TABLE()
};
-char* WXDLLEXPORT wxFontFamilyIntToString(int family);
-char* WXDLLEXPORT wxFontWeightIntToString(int weight);
-char* WXDLLEXPORT wxFontStyleIntToString(int style);
+char WXDLLEXPORT *wxFontFamilyIntToString(int family);
+char WXDLLEXPORT *wxFontWeightIntToString(int weight);
+char WXDLLEXPORT *wxFontStyleIntToString(int style);
int WXDLLEXPORT wxFontFamilyStringToInt(char *family);
int WXDLLEXPORT wxFontWeightStringToInt(char *weight);
int WXDLLEXPORT wxFontStyleStringToInt(char *style);
#define wxHIDE_READONLY 8
#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
// __GTKFILEDLGH__
#define wxHIDE_READONLY 8
#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
// __GTKFILEDLGH__
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_FILEDLG_H_
class WXDLLEXPORT wxFileDialog: public wxDialog
{
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:
wxFileDialog(wxWindow *parent, const wxString& message = wxFileSelectorPromptStr,
const wxString& defaultDir = wxEmptyString, const wxString& defaultFile = wxEmptyString, const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
inline int GetFilterIndex(void) const { return m_filterIndex ; }
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 wxHIDE_READONLY 0x0008
#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
// _WX_FILEDLG_H_
#define wxHIDE_READONLY 0x0008
#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
// _WX_FILEDLG_H_
#define wxHIDE_READONLY 0x0008
#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
// _WX_FILEDLG_H_
// Ostream operations
////////////////////////////////////////////////////////////////
-ostream& WXDLLEXPORT operator << (ostream &os, const wxDate &dt)
+ostream WXDLLEXPORT & operator << (ostream &os, const wxDate &dt)
{
return os << (const char *) dt.FormatDate();
}
bool wxDocument::SaveAs(void)
{
- wxDocTemplate *docTemplate = GetDocumentTemplate();
- if (!docTemplate)
- return FALSE;
-
- char *tmp = wxFileSelector(_("Save as"), docTemplate->GetDirectory(), GetFilename(),
- docTemplate->GetDefaultExtension(), docTemplate->GetFileFilter(),
- wxSAVE|wxOVERWRITE_PROMPT, GetDocumentWindow());
+ wxDocTemplate *docTemplate = GetDocumentTemplate();
+ if (!docTemplate)
+ return FALSE;
- if (!tmp)
- return FALSE;
- else
- {
+ wxString tmp = wxFileSelector(_("Save as"),
+ docTemplate->GetDirectory(),
+ GetFilename(),
+ docTemplate->GetDefaultExtension(),
+ docTemplate->GetFileFilter(),
+ wxSAVE | wxOVERWRITE_PROMPT,
+ GetDocumentWindow());
+
+ if (tmp.IsEmpty())
+ return FALSE;
+
wxString fileName(tmp);
wxString path("");
wxString name("");
view->OnChangeFilename();
node = node->Next();
}
- }
- return OnSaveDocument(m_documentFile);
+
+ return OnSaveDocument(m_documentFile);
}
bool wxDocument::OnSaveDocument(const wxString& file)
{
// We can only have multiple filters in Windows
#ifdef __WXMSW__
- char *descrBuf = new char[1000]; // FIXME static buffer
- descrBuf[0] = 0;
- int i;
- for (i = 0; i < noTemplates; i++)
- {
- if (templates[i]->IsVisible())
+ wxString descrBuf;
+
+ int i;
+ for (i = 0; i < noTemplates; i++)
{
- strcat(descrBuf, templates[i]->GetDescription());
- strcat(descrBuf, " (");
- strcat(descrBuf, templates[i]->GetFileFilter());
- strcat(descrBuf, ") ");
- strcat(descrBuf, "|");
- strcat(descrBuf, templates[i]->GetFileFilter());
- strcat(descrBuf, "|");
+ if (templates[i]->IsVisible())
+ {
+ // add a '|' to separate this filter from the previous one
+ if ( !descrBuf.IsEmpty() )
+ 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
- char* descrBuf = copystring("*.*");
+ wxString descrBuf = "*.*";
#endif
- char *pathTmp = wxFileSelector(_("Select a file"), "", "", "", descrBuf, 0, wxTheApp->GetTopWindow());
- delete[] descrBuf;
- if (pathTmp)
+ wxString pathTmp = wxFileSelector(_("Select a file"), "", "", "",
+ descrBuf, 0, wxTheApp->GetTopWindow());
+
+ if (!pathTmp.IsEmpty())
{
path = pathTmp;
char *theExt = FindExtension((char *)(const char *)path);
{
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[1] = (char) 0xde;
msg.sig[2] = (char) 0xed;
Write((char *)&msg, sizeof(msg));
return *this;
+
+#ifdef _MSC_VER
+ #pragma warning(default: 4310)
+#endif // _MSC_VER
}
wxSocketBase& wxSocketBase::Unread(const char *buffer, size_t nbytes)
case FD_CONNECT:
sk_req = wxSocketBase::EVT_CONNECT;
break;
+
+ default:
+ wxFAIL_MSG("invalid socket event");
+ return (LRESULT)0;
}
+
sock->OnRequest(sk_req);
return (LRESULT)0;
} g_strEmpty = { {-1, 0, 0}, '\0' };
// 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
}
else if ((m_filename == "") && (wxThePrintSetupData->GetPrinterMode() == PS_FILE))
{
- char *file = wxSaveFileSelector (_("PostScript"), "ps");
- if (!file)
+ wxString file = wxSaveFileSelector (_("PostScript"), "ps");
+ if ( file.IsEmpty() )
{
m_ok = FALSE;
return FALSE;
}
+
wxThePrintSetupData->SetPrinterFile(file);
m_filename = file;
m_ok = TRUE;
{
wxThePrintSetupData->SetPrinterMode(PS_FILE);
- char *f = wxFileSelector(_("PostScript file"),
- wxPathOnly(wxThePrintSetupData->GetPrinterFile()),
- wxFileNameFromPath(wxThePrintSetupData->GetPrinterFile()),
- "ps", "*.ps", 0, this);
- if (f)
- wxThePrintSetupData->SetPrinterFile(f);
- else
- return;
+ wxString f = wxFileSelector(_("PostScript file"),
+ wxPathOnly(wxThePrintSetupData->GetPrinterFile()),
+ wxFileNameFromPath(wxThePrintSetupData->GetPrinterFile()),
+ "ps", "*.ps", 0, this);
+ if ( f.IsEmpty() )
+ return;
+
+ wxThePrintSetupData->SetPrinterFile(f);
}
else
wxThePrintSetupData->SetPrinterMode(PS_PRINTER);
wxPrintData data;
data.SetSetupDialog(TRUE);
wxPrintDialog *printDialog = new wxPrintDialog(this, & data);
- int ret = printDialog->ShowModal();
+ printDialog->ShowModal();
printDialog->Destroy();
// This is to foil optimizations in Visual C++ that
// throw out dummy.obj.
-#if defined(_MSC_VER) && !defined(WXMAKINGDLL)
+#if 0 && defined(_MSC_VER) && !defined(WXMAKINGDLL)
extern char wxDummyChar;
if (wxDummyChar) wxDummyChar++;
#endif
bool wxBitmapButton::MSWOnDraw(WXDRAWITEMSTRUCT *item)
{
- long style = GetWindowLong((HWND) GetHWND(), GWL_STYLE);
#if defined(__WIN95__)
+ long style = GetWindowLong((HWND) GetHWND(), GWL_STYLE);
if (style & BS_BITMAP)
{
// Should we call Default() here?
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
-#pragma implementation "filedlg.h"
+ #pragma implementation "filedlg.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
-#pragma hdrstop
+ #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 <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"
#endif
#include <windows.h>
#if !defined(__WIN32__) || defined(__SALFORDC__)
-#include <commdlg.h>
+ #include <commdlg.h>
#endif
#include "wx/msw/private.h"
#include <string.h>
#if !USE_SHARED_LIBRARY
-IMPLEMENT_CLASS(wxFileDialog, wxDialog)
+ IMPLEMENT_CLASS(wxFileDialog, wxDialog)
#endif
-char *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)
{
// In the original implementation, defaultExtension is passed to the
// lpstrDefExt member of OPENFILENAME. This extension, if non-NULL, is
return wxBuffer;
}
else
- return NULL;
+ return wxGetEmptyString();
}
# if __BORLANDC__
# endif
-char *wxFileSelectorEx(const char *title,
+wxString wxFileSelectorEx(const char *title,
const char *defaultDir,
const char *defaultFileName,
int* defaultFilterIndex,
return wxBuffer;
}
else
- return NULL;
+ return wxGetEmptyString();
}
wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
}
-// Generic file load/save dialog
-static char *
-wxDefaultFileSelector(bool load, const char *what, const char *extension, const char *default_name, wxWindow *parent)
+// Generic file load/save dialog (for internal use only)
+static
+wxString wxDefaultFileSelector(bool load,
+ const char *what,
+ const char *extension,
+ const char *default_name,
+ wxWindow *parent)
{
-
wxString prompt;
- wxString str;
- if (load)
- str = _("Load %s file");
- else
- str = _("Save %s file");
+ wxString str = load ? _("Load %s file") : _("Save %s file");
prompt.Printf(str, what);
const char *ext = extension;
}
// Generic file load dialog
-char *
-wxLoadFileSelector(const char *what, const char *extension, const char *default_name, wxWindow *parent)
+WXDLLEXPORT wxString wxLoadFileSelector(const char *what,
+ 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
-char *
-wxSaveFileSelector(const char *what, const char *extension, const char *default_name, wxWindow *parent)
+WXDLLEXPORT 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);
}
-
#undef GetClassName
#endif
-#if wxUSE_NATIVE_STATUSBAR
+#if wxUSE_NATIVE_STATUSBAR
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxStatusBar95, wxStatusBar);
SetFieldsWidth();
}
-#endif
- // __WIN95__
-#endif
- // wxUSE_NATIVE_STATUSBAR
+#endif // wxUSE_NATIVE_STATUSBAR
+
+#else
+ #error "wxStatusBar95 is only available under Windows 95 and later."
+#endif // __WIN95__
+