2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: dirdlg.h
|
2008-03-10 11:24:38 -04:00
|
|
|
// Purpose: interface of wxDirDialog
|
2008-03-08 08:52:38 -05:00
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
2010-07-13 09:29:13 -04:00
|
|
|
// Licence: wxWindows licence
|
2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2012-07-14 17:36:25 -04:00
|
|
|
#define wxDD_CHANGE_DIR 0x0100
|
|
|
|
#define wxDD_DIR_MUST_EXIST 0x0200
|
|
|
|
#define wxDD_NEW_DIR_BUTTON 0 // deprecated, on by default now,
|
|
|
|
|
2011-12-30 01:14:17 -05:00
|
|
|
#define wxDD_DEFAULT_STYLE (wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
|
|
|
|
|
2012-03-03 19:29:07 -05:00
|
|
|
/**
|
|
|
|
Initial folder for generic directory dialog.
|
|
|
|
*/
|
|
|
|
const char wxDirDialogDefaultFolderStr[] = "/";
|
|
|
|
|
|
|
|
/**
|
|
|
|
Default message for directory selector dialog.
|
|
|
|
*/
|
|
|
|
const char wxDirSelectorPromptStr[] = "Select a directory";
|
|
|
|
|
|
|
|
/**
|
|
|
|
Default name for directory selector dialog.
|
|
|
|
*/
|
|
|
|
const char wxDirDialogNameStr[] = "wxDirCtrl";
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
@class wxDirDialog
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
This class represents the directory chooser dialog.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@beginStyleTable
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxDD_DEFAULT_STYLE}
|
2008-03-08 08:52:38 -05:00
|
|
|
Equivalent to a combination of wxDEFAULT_DIALOG_STYLE and
|
|
|
|
wxRESIZE_BORDER (the last one is not used under wxWinCE).
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxDD_DIR_MUST_EXIST}
|
2008-03-08 08:52:38 -05:00
|
|
|
The dialog will allow the user to choose only an existing folder.
|
|
|
|
When this style is not given, a "Create new directory" button is
|
|
|
|
added to the dialog (on Windows) or some other way is provided to
|
|
|
|
the user to type the name of a new folder.
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxDD_CHANGE_DIR}
|
2008-03-08 08:52:38 -05:00
|
|
|
Change the current working directory to the directory chosen by the
|
|
|
|
user.
|
|
|
|
@endStyleTable
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-11-05 10:27:34 -05:00
|
|
|
Notice that @c wxRESIZE_BORDER has special side effect under recent (i.e.
|
|
|
|
later than Win9x) Windows where two different directory selection dialogs
|
|
|
|
are available and this style also implicitly selects the new version as the
|
|
|
|
old one always has fixed size. As the new version is almost always
|
|
|
|
preferable, it is recommended that @c wxRESIZE_BORDER style be always used.
|
|
|
|
This is the case if the dialog is created with the default style value but
|
|
|
|
if you need to use any additional styles you should still specify @c
|
|
|
|
wxDD_DEFAULT_STYLE unless you explicitly need to use the old dialog version
|
|
|
|
under Windows. E.g. do
|
|
|
|
@code
|
|
|
|
wxDirDialog dlg(NULL, "Choose input directory", "",
|
|
|
|
wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST);
|
|
|
|
@endcode
|
|
|
|
instead of just using @c wxDD_DIR_MUST_EXIST style alone.
|
2008-04-20 21:40:12 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxcore}
|
|
|
|
@category{cmndlg}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-04-20 21:40:12 -04:00
|
|
|
@see @ref overview_cmndlg_dir, wxFileDialog
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
class wxDirDialog : public wxDialog
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
2008-04-20 21:40:12 -04:00
|
|
|
Constructor. Use ShowModal() to show the dialog.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param parent
|
2008-03-09 08:33:59 -04:00
|
|
|
Parent window.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param message
|
2008-03-09 08:33:59 -04:00
|
|
|
Message to show on the dialog.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param defaultPath
|
2008-03-09 08:33:59 -04:00
|
|
|
The default path, or the empty string.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param style
|
2008-03-09 08:33:59 -04:00
|
|
|
The dialog style. See wxDirDialog
|
2008-03-08 09:43:31 -05:00
|
|
|
@param pos
|
2008-03-09 08:33:59 -04:00
|
|
|
Dialog position. Ignored under Windows.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param size
|
2008-03-09 08:33:59 -04:00
|
|
|
Dialog size. Ignored under Windows.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param name
|
2008-03-09 08:33:59 -04:00
|
|
|
The dialog name, not used.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
wxDirDialog(wxWindow* parent,
|
2008-11-08 10:17:16 -05:00
|
|
|
const wxString& message = wxDirSelectorPromptStr,
|
|
|
|
const wxString& defaultPath = wxEmptyString,
|
2008-03-08 08:52:38 -05:00
|
|
|
long style = wxDD_DEFAULT_STYLE,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
2008-11-08 10:17:16 -05:00
|
|
|
const wxString& name = wxDirDialogNameStr);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Destructor.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual ~wxDirDialog();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the message that will be displayed on the dialog.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual wxString GetMessage() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the default or user-selected path.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual wxString GetPath() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the message that will be displayed on the dialog.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void SetMessage(const wxString& message);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the default path.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void SetPath(const wxString& path);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-04-20 21:40:12 -04:00
|
|
|
Shows the dialog, returning wxID_OK if the user pressed OK, and
|
|
|
|
wxID_CANCEL otherwise.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
int ShowModal();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
// ============================================================================
|
|
|
|
// Global functions/macros
|
|
|
|
// ============================================================================
|
|
|
|
|
2009-01-05 15:48:06 -05:00
|
|
|
/** @addtogroup group_funcmacro_dialog */
|
2008-03-18 15:30:01 -04:00
|
|
|
//@{
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
2008-03-18 15:30:01 -04:00
|
|
|
Pops up a directory selector dialog. The arguments have the same meaning
|
|
|
|
as those of wxDirDialog::wxDirDialog(). The message is displayed at the
|
|
|
|
top, and the default_path, if specified, is set as the initial selection.
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
The application must check for an empty return value (if the user pressed
|
|
|
|
Cancel). For example:
|
2008-03-09 08:33:59 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@code
|
|
|
|
const wxString& dir = wxDirSelector("Choose a folder");
|
|
|
|
if ( !dir.empty() )
|
|
|
|
{
|
2008-03-18 15:30:01 -04:00
|
|
|
...
|
2008-03-08 08:52:38 -05:00
|
|
|
}
|
|
|
|
@endcode
|
2008-03-18 15:30:01 -04:00
|
|
|
|
|
|
|
@header{wx/dirdlg.h}
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
wxString wxDirSelector(const wxString& message = wxDirSelectorPromptStr,
|
2009-01-10 13:31:45 -05:00
|
|
|
const wxString& default_path = wxEmptyString,
|
2008-03-08 08:52:38 -05:00
|
|
|
long style = 0,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
2008-03-09 08:33:59 -04:00
|
|
|
wxWindow* parent = NULL);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2008-03-18 15:30:01 -04:00
|
|
|
//@}
|
|
|
|
|