1999-08-17 11:55:25 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2006-04-25 13:31:27 -04:00
|
|
|
// Name: wx/generic/filedlgg.h
|
2003-04-03 08:10:08 -05:00
|
|
|
// Purpose: wxGenericFileDialog
|
1999-08-17 11:55:25 -04:00
|
|
|
// Author: Robert Roebling
|
|
|
|
// Modified by:
|
|
|
|
// Created: 8/17/99
|
|
|
|
// Copyright: (c) Robert Roebling
|
|
|
|
// RCS-ID: $Id$
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
1999-08-17 11:55:25 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_FILEDLGG_H_
|
|
|
|
#define _WX_FILEDLGG_H_
|
|
|
|
|
2003-04-03 08:10:08 -05:00
|
|
|
#include "wx/listctrl.h"
|
2003-04-06 15:57:51 -04:00
|
|
|
#include "wx/datetime.h"
|
2005-09-25 20:21:03 -04:00
|
|
|
#include "wx/filefn.h"
|
2008-03-05 07:27:21 -05:00
|
|
|
#include "wx/artprov.h"
|
2006-04-25 13:31:27 -04:00
|
|
|
#include "wx/filedlg.h"
|
2007-09-16 20:14:34 -04:00
|
|
|
#include "wx/generic/filectrlg.h"
|
1999-08-17 11:55:25 -04:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// classes
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2007-07-09 06:09:52 -04:00
|
|
|
class WXDLLIMPEXP_FWD_CORE wxBitmapButton;
|
2007-09-16 20:14:34 -04:00
|
|
|
class WXDLLIMPEXP_FWD_CORE wxGenericFileCtrl;
|
2007-07-09 06:09:52 -04:00
|
|
|
class WXDLLIMPEXP_FWD_CORE wxGenericFileDialog;
|
2007-09-16 20:14:34 -04:00
|
|
|
class WXDLLIMPEXP_FWD_CORE wxFileCtrlEvent;
|
1999-08-17 11:55:25 -04:00
|
|
|
|
|
|
|
//-------------------------------------------------------------------------
|
2003-06-14 09:31:49 -04:00
|
|
|
// wxGenericFileDialog
|
1999-08-17 11:55:25 -04:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
2008-03-26 11:06:00 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxGenericFileDialog: public wxFileDialogBase
|
1999-08-17 11:55:25 -04:00
|
|
|
{
|
|
|
|
public:
|
2005-03-07 19:29:56 -05:00
|
|
|
wxGenericFileDialog() : wxFileDialogBase() { Init(); }
|
1999-08-17 11:55:25 -04:00
|
|
|
|
2003-04-03 08:10:08 -05:00
|
|
|
wxGenericFileDialog(wxWindow *parent,
|
2005-03-07 19:29:56 -05:00
|
|
|
const wxString& message = wxFileSelectorPromptStr,
|
2003-07-19 13:22:05 -04:00
|
|
|
const wxString& defaultDir = wxEmptyString,
|
|
|
|
const wxString& defaultFile = wxEmptyString,
|
2005-03-07 19:29:56 -05:00
|
|
|
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
|
2006-05-28 19:32:12 -04:00
|
|
|
long style = wxFD_DEFAULT_STYLE,
|
2005-03-07 19:29:56 -05:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
2006-05-28 19:32:12 -04:00
|
|
|
const wxSize& sz = wxDefaultSize,
|
|
|
|
const wxString& name = wxFileDialogNameStr,
|
2005-03-07 19:29:56 -05:00
|
|
|
bool bypassGenericImpl = false );
|
|
|
|
|
2004-12-05 15:30:18 -05:00
|
|
|
bool Create( wxWindow *parent,
|
|
|
|
const wxString& message = wxFileSelectorPromptStr,
|
2005-03-07 19:29:56 -05:00
|
|
|
const wxString& defaultDir = wxEmptyString,
|
|
|
|
const wxString& defaultFile = wxEmptyString,
|
2004-12-05 15:30:18 -05:00
|
|
|
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
|
2006-05-28 19:32:12 -04:00
|
|
|
long style = wxFD_DEFAULT_STYLE,
|
2005-03-07 19:29:56 -05:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
2006-05-28 19:32:12 -04:00
|
|
|
const wxSize& sz = wxDefaultSize,
|
|
|
|
const wxString& name = wxFileDialogNameStr,
|
2005-03-07 19:29:56 -05:00
|
|
|
bool bypassGenericImpl = false );
|
|
|
|
|
2003-04-03 08:10:08 -05:00
|
|
|
virtual ~wxGenericFileDialog();
|
1999-08-17 11:55:25 -04:00
|
|
|
|
2003-07-19 13:22:05 -04:00
|
|
|
virtual void SetMessage(const wxString& message) { SetTitle(message); }
|
2007-10-05 19:54:40 -04:00
|
|
|
virtual void SetPath(const wxString& path)
|
|
|
|
{ m_filectrl->SetPath(path); }
|
|
|
|
virtual void SetFilterIndex(int filterIndex)
|
|
|
|
{ m_filectrl->SetFilterIndex(filterIndex); }
|
|
|
|
virtual void SetWildcard(const wxString& wildCard)
|
|
|
|
{ m_filectrl->SetWildcard(wildCard); }
|
|
|
|
|
|
|
|
virtual wxString GetPath() const
|
|
|
|
{ return m_filectrl->GetPath(); }
|
|
|
|
virtual void GetPaths(wxArrayString& paths) const
|
2007-12-27 12:00:29 -05:00
|
|
|
{ m_filectrl->GetPaths(paths); }
|
2007-10-05 19:54:40 -04:00
|
|
|
virtual wxString GetDirectory() const
|
|
|
|
{ return m_filectrl->GetDirectory(); }
|
|
|
|
virtual wxString GetFilename() const
|
|
|
|
{ return m_filectrl->GetFilename(); }
|
|
|
|
virtual void GetFilenames(wxArrayString& files) const
|
2007-12-27 12:00:29 -05:00
|
|
|
{ m_filectrl->GetFilenames(files); }
|
2007-10-05 19:54:40 -04:00
|
|
|
virtual wxString GetWildcard() const
|
|
|
|
{ return m_filectrl->GetWildcard(); }
|
|
|
|
virtual int GetFilterIndex() const
|
|
|
|
{ return m_filectrl->GetFilterIndex(); }
|
2008-03-02 09:33:47 -05:00
|
|
|
virtual bool SupportsExtraControl() const { return true; }
|
1999-09-18 12:39:08 -04:00
|
|
|
|
2002-09-07 15:24:45 -04:00
|
|
|
// implementation only from now on
|
|
|
|
// -------------------------------
|
|
|
|
|
|
|
|
virtual int ShowModal();
|
2004-03-01 17:54:20 -05:00
|
|
|
virtual bool Show( bool show = true );
|
2002-09-07 15:24:45 -04:00
|
|
|
|
1999-08-17 11:55:25 -04:00
|
|
|
void OnList( wxCommandEvent &event );
|
|
|
|
void OnReport( wxCommandEvent &event );
|
|
|
|
void OnUp( wxCommandEvent &event );
|
|
|
|
void OnHome( wxCommandEvent &event );
|
2007-09-16 20:14:34 -04:00
|
|
|
void OnOk( wxCommandEvent &event );
|
1999-08-18 07:40:40 -04:00
|
|
|
void OnNew( wxCommandEvent &event );
|
2007-09-16 20:14:34 -04:00
|
|
|
void OnFileActivated( wxFileCtrlEvent &event);
|
2003-04-06 15:57:51 -04:00
|
|
|
|
2004-12-05 15:30:18 -05:00
|
|
|
private:
|
2007-09-19 08:24:05 -04:00
|
|
|
// if true, don't use this implementation at all
|
2004-12-05 15:30:18 -05:00
|
|
|
bool m_bypassGenericImpl;
|
1999-09-18 12:39:08 -04:00
|
|
|
|
|
|
|
protected:
|
2007-09-19 08:24:05 -04:00
|
|
|
// update the state of m_upDirButton and m_newDirButton depending on the
|
|
|
|
// currently selected directory
|
|
|
|
void OnUpdateButtonsUI(wxUpdateUIEvent& event);
|
2002-12-04 09:11:26 -05:00
|
|
|
|
2007-09-16 20:14:34 -04:00
|
|
|
wxString m_filterExtension;
|
|
|
|
wxGenericFileCtrl *m_filectrl;
|
|
|
|
wxBitmapButton *m_upDirButton;
|
|
|
|
wxBitmapButton *m_newDirButton;
|
1999-09-18 12:39:08 -04:00
|
|
|
|
1999-08-17 11:55:25 -04:00
|
|
|
private:
|
2005-03-07 19:29:56 -05:00
|
|
|
void Init();
|
2008-03-02 09:33:47 -05:00
|
|
|
wxBitmapButton* AddBitmapButton( wxWindowID winId, const wxArtID& artId,
|
|
|
|
const wxString& tip, wxSizer *sizer );
|
2007-09-19 08:24:05 -04:00
|
|
|
|
2003-04-03 08:10:08 -05:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxGenericFileDialog)
|
1999-08-17 11:55:25 -04:00
|
|
|
DECLARE_EVENT_TABLE()
|
2000-01-15 19:31:41 -05:00
|
|
|
|
2003-04-03 08:10:08 -05:00
|
|
|
// these variables are preserved between wxGenericFileDialog calls
|
2002-09-07 15:24:45 -04:00
|
|
|
static long ms_lastViewStyle; // list or report?
|
|
|
|
static bool ms_lastShowHidden; // did we show hidden files?
|
1999-08-17 11:55:25 -04:00
|
|
|
};
|
|
|
|
|
2007-07-27 20:08:01 -04:00
|
|
|
#ifdef wxHAS_GENERIC_FILEDIALOG
|
2003-04-03 08:10:08 -05:00
|
|
|
|
2008-03-26 11:06:00 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxFileDialog: public wxGenericFileDialog
|
2003-04-03 08:10:08 -05:00
|
|
|
{
|
|
|
|
public:
|
2008-12-04 18:14:00 -05:00
|
|
|
wxFileDialog() {}
|
2003-04-03 08:10:08 -05:00
|
|
|
|
|
|
|
wxFileDialog(wxWindow *parent,
|
|
|
|
const wxString& message = wxFileSelectorPromptStr,
|
2004-06-17 12:22:36 -04:00
|
|
|
const wxString& defaultDir = wxEmptyString,
|
|
|
|
const wxString& defaultFile = wxEmptyString,
|
2003-04-03 08:10:08 -05:00
|
|
|
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
|
|
|
|
long style = 0,
|
2008-12-04 18:14:00 -05:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize)
|
|
|
|
:wxGenericFileDialog(parent, message,
|
|
|
|
defaultDir, defaultFile, wildCard,
|
|
|
|
style,
|
|
|
|
pos, size)
|
2004-01-15 08:49:22 -05:00
|
|
|
{
|
|
|
|
}
|
2005-02-08 07:37:49 -05:00
|
|
|
|
2004-12-05 15:30:18 -05:00
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxFileDialog)
|
2003-04-03 08:10:08 -05:00
|
|
|
};
|
|
|
|
|
2007-07-27 20:08:01 -04:00
|
|
|
#endif // wxHAS_GENERIC_FILEDIALOG
|
1999-08-17 11:55:25 -04:00
|
|
|
|
2003-06-14 09:31:49 -04:00
|
|
|
#endif // _WX_FILEDLGG_H_
|