/////////////////////////////////////////////////////////////////////////////
-// Name: filedlg.h
+// Name: wx/filedlg.h
// Purpose: wxFileDialog base header
// Author: Robert Roebling
// Modified by:
// wxFileDialog data
//----------------------------------------------------------------------------
-#if WXWIN_COMPATIBILITY_2_6
-enum
-{
- wxOPEN = 0x0001,
- wxSAVE = 0x0002,
- wxOVERWRITE_PROMPT = 0x0004,
-#if WXWIN_COMPATIBILITY_2_4
- wxHIDE_READONLY = 0x0008,
-#endif
- wxFILE_MUST_EXIST = 0x0010,
- wxMULTIPLE = 0x0020,
- wxCHANGE_DIR = 0x0040
-};
-#endif
-
enum
{
wxFD_OPEN = 0x0001,
wxFD_CHANGE_DIR = 0x0040
};
+#if WXWIN_COMPATIBILITY_2_6
+enum
+{
+ wxOPEN = wxFD_OPEN,
+ wxSAVE = wxFD_SAVE,
+ wxOVERWRITE_PROMPT = wxFD_OVERWRITE_PROMPT,
+#if WXWIN_COMPATIBILITY_2_4
+ wxHIDE_READONLY = 0x0008,
+#endif
+ wxFILE_MUST_EXIST = wxFD_FILE_MUST_EXIST,
+ wxMULTIPLE = wxFD_MULTIPLE,
+ wxCHANGE_DIR = wxFD_CHANGE_DIR
+};
+#endif
+
#define wxFD_DEFAULT_STYLE wxFD_OPEN
extern WXDLLEXPORT_DATA(const wxChar) wxFileDialogNameStr[];
wxMenu *sheet_menu = new wxMenu;
sheet_menu->Append(DIALOGS_PROPERTY_SHEET, _T("&Standard property sheet\tShift-Ctrl-P"));
sheet_menu->Append(DIALOGS_PROPERTY_SHEET_TOOLBOOK, _T("&Toolbook sheet\tShift-Ctrl-T"));
-
+
if (wxPlatformIs(wxMac))
sheet_menu->Append(DIALOGS_PROPERTY_SHEET_BUTTONTOOLBOOK, _T("Button &Toolbook sheet\tShift-Ctrl-U"));
/*
wxString wildcards = _T("All files (*.*)|*.*|C++ files (*.cpp;*.h)|*.cpp;*.h");
wxGenericFileDialog dialog(this, _T("Testing open multiple file dialog"),
wxEmptyString, wxEmptyString, wildcards,
- wxMULTIPLE);
+ wxFD_MULTIPLE);
if (dialog.ShowModal() == wxID_OK)
{
wxEmptyString,
_T("myletter.doc"),
_T("Text files (*.txt)|*.txt|Document files (*.doc)|*.doc"),
- wxSAVE|wxOVERWRITE_PROMPT);
+ wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
dialog.SetFilterIndex(1);
int tabImage1 = -1;
int tabImage2 = -1;
-
+
bool useToolBook = (dialogType == DIALOGS_PROPERTY_SHEET_TOOLBOOK || dialogType == DIALOGS_PROPERTY_SHEET_BUTTONTOOLBOOK);
int resizeBorder = wxRESIZE_BORDER;
resizeBorder = 0;
tabImage1 = 0;
tabImage2 = 1;
-
+
int sheetStyle = wxPROPSHEET_SHRINKTOFIT;
if (dialogType == DIALOGS_PROPERTY_SHEET_BUTTONTOOLBOOK)
sheetStyle |= wxPROPSHEET_BUTTONTOOLBOOK;
else
sheetStyle |= wxPROPSHEET_TOOLBOOK;
-
+
SetSheetStyle(sheetStyle);
SetSheetInnerBorder(0);
SetSheetOuterBorder(0);
#include "wx/dirdlg.h"
#include "wx/app.h"
#endif
+
#include "wx/filename.h"
#include "wx/cocoa/autorelease.h"
const wxSize& size, const wxString& name)
{
wxTopLevelWindows.Append(this);
-
- m_message = message;
+
+ m_message = message;
m_dialogStyle = style;
m_parent = parent;
m_path = defaultPath;
//If the user requests to save - use a NSSavePanel
//else use a NSOpenPanel
- if (m_dialogStyle & wxSAVE)
+ if (m_dialogStyle & wxFD_SAVE)
{
SetNSPanel([NSSavePanel savePanel]);
[GetNSSavePanel() setTreatsFilePackagesAsDirectories:YES];
[GetNSSavePanel() setCanSelectHiddenExtension:YES];
}
- else //m_dialogStyle & wxOPEN
+ else //m_dialogStyle & wxFD_OPEN
{
SetNSPanel([NSOpenPanel openPanel]);
[m_cocoaNSWindow setTitle:wxNSStringWithWxString(message)];
[GetNSSavePanel() setPrompt:@"Open"];
}
- if (m_dialogStyle & wxDD_NEW_DIR_BUTTON) //m_dialogStyle & wxDD_NEW_DIR_BUTTON
- {
+ if (m_dialogStyle & wxDD_NEW_DIR_BUTTON) //m_dialogStyle & wxDD_NEW_DIR_BUTTON
+ {
[(NSOpenPanel*)m_cocoaNSWindow setCanCreateDirectories:YES];
- }
+ }
}
wxDirDialog::~wxDirDialog()
int nResult;
- if (m_dialogStyle & wxSAVE)
+ if (m_dialogStyle & wxFD_SAVE)
{
nResult = [GetNSSavePanel()
runModalForDirectory:wxNSStringWithWxString(m_dir)
m_path = m_fileNames[0];
}
}
- else //m_dialogStyle & wxOPEN
+ else //m_dialogStyle & wxFD_OPEN
{
nResult = [(NSOpenPanel*)m_cocoaNSWindow
runModalForDirectory:wxNSStringWithWxString(m_dir)
}
#endif // wxUSE_DIRDLG
-
#include "wx/filedlg.h"
#include "wx/app.h"
#endif
+
#include "wx/filename.h"
#include "wx/cocoa/autorelease.h"
//If the user requests to save - use a NSSavePanel
//else use a NSOpenPanel
- if (m_dialogStyle & wxSAVE)
+ if (m_dialogStyle & wxFD_SAVE)
{
SetNSPanel([NSSavePanel savePanel]);
// dialogs are all that useful, anyway :)
//
}
- else //m_dialogStyle & wxOPEN
+ else //m_dialogStyle & wxFD_OPEN
{
SetNSPanel([NSOpenPanel openPanel]);
[m_cocoaNSWindow setTitle:wxNSStringWithWxString(message)];
- [(NSOpenPanel*)m_cocoaNSWindow setAllowsMultipleSelection:(m_dialogStyle & wxMULTIPLE)];
+ [(NSOpenPanel*)m_cocoaNSWindow setAllowsMultipleSelection:(m_dialogStyle & wxFD_MULTIPLE)];
[(NSOpenPanel*)m_cocoaNSWindow setResolvesAliases:YES];
[(NSOpenPanel*)m_cocoaNSWindow setCanChooseFiles:YES];
[(NSOpenPanel*)m_cocoaNSWindow setCanChooseDirectories:NO];
int nResult;
- if (m_dialogStyle & wxSAVE)
+ if (m_dialogStyle & wxFD_SAVE)
{
nResult = [GetNSSavePanel()
runModalForDirectory:wxNSStringWithWxString(m_dir)
m_path = m_fileNames[0];
}
}
- else //m_dialogStyle & wxOPEN
+ else //m_dialogStyle & wxFD_OPEN
{
nResult = [(NSOpenPanel*)m_cocoaNSWindow
runModalForDirectory:wxNSStringWithWxString(m_dir)
}
#endif // wxUSE_FILEDLG
-
wxConvFileName->cWX2MB(defaultFileName));
#if GTK_CHECK_VERSION(2,7,3)
- if ((style & wxOVERWRITE_PROMPT) && !gtk_check_version(2,7,3))
+ if ((style & wxFD_OVERWRITE_PROMPT) && !gtk_check_version(2,7,3))
gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(m_widget), TRUE);
#endif
}
bool isName = true ;
wxString current ;
- for ( unsigned int i = 0; i < filter2.Len() ; i++ )
+ for ( unsigned int i = 0; i < filter2.length() ; i++ )
{
if ( filter2.GetChar(i) == wxT('|') )
{
if ( extension.GetChar(0) == '*' )
extension = extension.Mid(1) ;
- if ( file.Len() >= extension.Len() && extension == file.Right(extension.Len() ) )
+ if ( file.length() >= extension.length() && extension == file.Right(extension.length() ) )
return true ;
}
}
dialogCreateOptions.optionFlags |= kNavPreserveSaveFileExtension;
#if TARGET_API_MAC_OSX
- if (!(m_windowStyle & wxOVERWRITE_PROMPT))
+ if (!(m_windowStyle & wxFD_OVERWRITE_PROMPT))
dialogCreateOptions.optionFlags |= kNavDontConfirmReplacement;
#endif
int filterIndex = 0;
bool isName = true ;
wxString current ;
- for( unsigned int i = 0; i < filter2.Len() ; i++ )
+ for( unsigned int i = 0; i < filter2.length() ; i++ )
{
if( filter2.GetChar(i) == wxT('|') )
{
if ( extension.GetChar(0) == '*' )
extension = extension.Mid(1) ;
- if ( file.Len() >= extension.Len() && extension == file.Right(extension.Len() ) )
+ if ( file.length() >= extension.length() && extension == file.Right(extension.length() ) )
return true ;
}
}
myData.saveMode = false ;
mNavFilterUPP = NewNavObjectFilterUPP( CrossPlatformFilterCallback ) ;
- if ( m_windowStyle & wxMULTIPLE )
+ if ( m_windowStyle & wxFD_MULTIPLE )
mNavOptions.dialogOptionFlags |= kNavAllowMultipleFiles ;
else
mNavOptions.dialogOptionFlags &= ~kNavAllowMultipleFiles ;
wildCard, style, pos, sz, name)
{
- if ( ( m_windowStyle & wxMULTIPLE ) && ( m_windowStyle & wxSAVE ) )
- m_windowStyle &= ~wxMULTIPLE;
+ if ( ( m_windowStyle & wxFD_MULTIPLE ) && ( m_windowStyle & wxFD_SAVE ) )
+ m_windowStyle &= ~wxFD_MULTIPLE;
m_bMovedWindow = false;
}
// helper used below in ShowModal(): style is used to determine whether to show
-// the "Save file" dialog (if it contains wxSAVE bit) or "Open file" one;
+// the "Save file" dialog (if it contains wxFD_SAVE bit) or "Open file" one;
// returns true on success or false on failure in which case err is filled with
// the CDERR_XXX constant
static bool DoShowCommFileDialog(OPENFILENAME *of, long style, DWORD *err)
{
- if ( style & wxSAVE ? GetSaveFileName(of) : GetOpenFileName(of) )
+ if ( style & wxFD_SAVE ? GetSaveFileName(of) : GetOpenFileName(of) )
return true;
if ( err )
#if WXWIN_COMPATIBILITY_2_4
long msw_flags = 0;
- if ( (m_windowStyle & wxHIDE_READONLY) || (m_windowStyle & wxSAVE) )
+ if ( (m_windowStyle & wxHIDE_READONLY) || (m_windowStyle & wxFD_SAVE) )
msw_flags |= OFN_HIDEREADONLY;
#else
long msw_flags = OFN_HIDEREADONLY;
#endif
- if ( m_windowStyle & wxFILE_MUST_EXIST )
+ if ( m_windowStyle & wxFD_FILE_MUST_EXIST )
msw_flags |= OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
/*
If the window has been moved the programmer is probably
#endif
}
- if (m_windowStyle & wxMULTIPLE )
+ if (m_windowStyle & wxFD_MULTIPLE )
{
// OFN_EXPLORER must always be specified with OFN_ALLOWMULTISELECT
msw_flags |= OFN_EXPLORER | OFN_ALLOWMULTISELECT;
}
- // if wxCHANGE_DIR flag is not given we shouldn't change the CWD which the
+ // if wxFD_CHANGE_DIR flag is not given we shouldn't change the CWD which the
// standard dialog does by default (notice that under NT it does it anyhow,
// OFN_NOCHANGEDIR or not, see below)
- if ( !(m_windowStyle & wxCHANGE_DIR) )
+ if ( !(m_windowStyle & wxFD_CHANGE_DIR) )
{
msw_flags |= OFN_NOCHANGEDIR;
}
- if ( m_windowStyle & wxOVERWRITE_PROMPT )
+ if ( m_windowStyle & wxFD_OVERWRITE_PROMPT )
{
msw_flags |= OFN_OVERWRITEPROMPT;
}
}
// Replace | with \0
- for (i = 0; i < filterBuffer.Len(); i++ ) {
+ for (i = 0; i < filterBuffer.length(); i++ ) {
if ( filterBuffer.GetChar(i) == wxT('|') ) {
filterBuffer[i] = wxT('\0');
}
of.nMaxFile = wxMAXPATH;
// we must set the default extension because otherwise Windows would check
- // for the existing of a wrong file with wxOVERWRITE_PROMPT (i.e. if the
+ // for the existing of a wrong file with wxFD_OVERWRITE_PROMPT (i.e. if the
// user types "foo" and the default extension is ".bar" we should force it
// to check for "foo.bar" existence and not "foo")
wxString defextBuffer; // we need it to be alive until GetSaveFileName()!
- if (m_windowStyle & wxSAVE)
+ if (m_windowStyle & wxFD_SAVE)
{
const wxChar* extension = filterBuffer;
int maxFilter = (int)(of.nFilterIndex*2L) - 1;
// GetOpenFileName will always change the current working directory on
// (according to MSDN) "Windows NT 4.0/2000/XP" because the flag
// OFN_NOCHANGEDIR has no effect. If the user did not specify
- // wxCHANGE_DIR let's restore the current working directory to what it
+ // wxFD_CHANGE_DIR let's restore the current working directory to what it
// was before the dialog was shown.
if ( msw_flags & OFN_NOCHANGEDIR )
{
m_fileNames.Empty();
- if ( ( m_windowStyle & wxMULTIPLE ) &&
+ if ( ( m_windowStyle & wxFD_MULTIPLE ) &&
#if defined(OFN_EXPLORER)
( fileNameBuffer[of.nFileOffset-1] == wxT('\0') )
#else
i = of.nFileOffset;
m_fileName = &fileNameBuffer[i];
m_fileNames.Add(m_fileName);
- i += m_fileName.Len() + 1;
+ i += m_fileName.length() + 1;
while (fileNameBuffer[i] != wxT('\0'))
{
extension = extension + wxStrlen( extension ) + 1;
m_fileName = AppendExtension(fileNameBuffer, extension);
- wxStrncpy(fileNameBuffer, m_fileName.c_str(), wxMin(m_fileName.Len(), wxMAXPATH-1));
- fileNameBuffer[wxMin(m_fileName.Len(), wxMAXPATH-1)] = wxT('\0');
+ wxStrncpy(fileNameBuffer, m_fileName.c_str(), wxMin(m_fileName.length(), wxMAXPATH-1));
+ fileNameBuffer[wxMin(m_fileName.length(), wxMAXPATH-1)] = wxT('\0');
}
m_path = fileNameBuffer;
}
#endif // wxUSE_FILEDLG && !(__SMARTPHONE__ && __WXWINCE__)
-
{
m_message = message;
m_windowStyle = style;
- if ( ( m_windowStyle & wxMULTIPLE ) && ( m_windowStyle & wxSAVE ) )
- m_windowStyle &= ~wxMULTIPLE;
+ if ( ( m_windowStyle & wxFD_MULTIPLE ) && ( m_windowStyle & wxFD_SAVE ) )
+ m_windowStyle &= ~wxFD_MULTIPLE;
m_parent = parent;
m_path = wxEmptyString;
m_fileName = defaultFileName;
/////////////////////////////////////////////////////////////////////////////
-// Name: filedlg.cpp
+// Name: src/os2/filedlg.cpp
// Purpose: wxFileDialog
// Author: David Webster
// Modified by:
:wxFileDialogBase(pParent, rsMessage, rsDefaultDir, rsDefaultFileName, rsWildCard, lStyle, rPos, sz, name)
{
- if ((m_windowStyle & wxMULTIPLE) && (m_windowStyle & wxSAVE))
- m_windowStyle &= ~wxMULTIPLE;
+ if ((m_windowStyle & wxFD_MULTIPLE) && (m_windowStyle & wxFD_SAVE))
+ m_windowStyle &= ~wxFD_MULTIPLE;
m_filterIndex = 1;
} // end of wxFileDialog::wxFileDialog
*zFileNameBuffer = wxT('\0');
*zTitleBuffer = wxT('\0');
- if (m_windowStyle & wxSAVE)
+ if (m_windowStyle & wxFD_SAVE)
lFlags = FDS_SAVEAS_DIALOG;
else
lFlags = FDS_OPEN_DIALOG;
lFlags |= FDS_SAVEAS_DIALOG;
#endif
- if (m_windowStyle & wxSAVE)
+ if (m_windowStyle & wxFD_SAVE)
lFlags |= FDS_SAVEAS_DIALOG;
- if (m_windowStyle & wxMULTIPLE )
+ if (m_windowStyle & wxFD_MULTIPLE)
lFlags |= FDS_OPEN_DIALOG | FDS_MULTIPLESEL;
vFileDlg.cbSize = sizeof(FILEDLG);
if (hWnd && vFileDlg.lReturn == DID_OK)
{
m_fileNames.Empty();
- if ((m_windowStyle & wxMULTIPLE ) && vFileDlg.ulFQFCount > 1)
+ if ((m_windowStyle & wxFD_MULTIPLE ) && vFileDlg.ulFQFCount > 1)
{
for (int i = 0; i < (int)vFileDlg.ulFQFCount; i++)
{
}
::WinFreeFileDlgList(vFileDlg.papszFQFilename);
}
- else if (!(m_windowStyle & wxSAVE))
+ else if (!(m_windowStyle & wxFD_SAVE))
{
m_path = (wxChar*)vFileDlg.szFullFile;
m_fileName = wxFileNameFromPath(wxString((const wxChar*)vFileDlg.szFullFile));
m_dir = wxPathOnly((const wxChar*)vFileDlg.szFullFile);
//
- // === Simulating the wxOVERWRITE_PROMPT >>============================
+ // === Simulating the wxFD_OVERWRITE_PROMPT >>============================
//
- if ((m_windowStyle & wxOVERWRITE_PROMPT) &&
- (m_windowStyle & wxSAVE) &&
+ if ((m_windowStyle & wxFD_OVERWRITE_PROMPT) &&
+ (m_windowStyle & wxFD_SAVE) &&
(wxFileExists(m_path.c_str())))
{
wxString sMessageText;