From: Francesco Montorsi Date: Tue, 1 Apr 2008 13:55:38 +0000 (+0000) Subject: first raw revision X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/0ce6d6c89a540e707c4a91238e6460c0e4bae2a6 first raw revision git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52959 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/interface/fdrepdlg.h b/interface/fdrepdlg.h index 84fd6047a5..7696f782dc 100644 --- a/interface/fdrepdlg.h +++ b/interface/fdrepdlg.h @@ -1,17 +1,66 @@ ///////////////////////////////////////////////////////////////////////////// // Name: fdrepdlg.h -// Purpose: interface of wxFindDialogEvent +// Purpose: interface of wxFindDialogEvent, wxFindReplaceDialog // Author: wxWidgets team // RCS-ID: $Id$ // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// + +/** + See wxFindDialogEvent::GetFlags(). +*/ +enum wxFindReplaceFlags +{ + /** downward search/replace selected (otherwise - upwards) */ + wxFR_DOWN = 1, + + /** whole word search/replace selected */ + wxFR_WHOLEWORD = 2, + + /** case sensitive search/replace selected (otherwise - case insensitive) */ + wxFR_MATCHCASE = 4 +} + + +/** + These flags can be specified in wxFindReplaceDialog ctor or Create(): +*/ +enum wxFindReplaceDialogStyles +{ + /** replace dialog (otherwise find dialog) */ + wxFR_REPLACEDIALOG = 1, + + /** don't allow changing the search direction */ + wxFR_NOUPDOWN = 2, + + /** don't allow case sensitive searching */ + wxFR_NOMATCHCASE = 4, + + /** don't allow whole word searching */ + wxFR_NOWHOLEWORD = 8 +} + + /** @class wxFindDialogEvent @wxheader{fdrepdlg.h} wxFindReplaceDialog events + @beginEventTable{wxFindDialogEvent} + @event{EVT_FIND(id, func)}: + Find button was pressed in the dialog. + @event{EVT_FIND_NEXT(id, func)}: + Find next button was pressed in the dialog. + @event{EVT_FIND_REPLACE(id, func)}: + Replace button was pressed in the dialog. + @event{EVT_FIND_REPLACE_ALL(id, func)}: + Replace all button was pressed in the dialog. + @event{EVT_FIND_CLOSE(id, func)}: + The dialog is being destroyed, any pointers to it cannot be used any longer. + @endEventTable + @library{wxcore} @category{events} */ @@ -35,8 +84,8 @@ public: wxString GetFindString() const; /** - Get the currently selected flags: this is the combination of @c wxFR_DOWN, - @c wxFR_WHOLEWORD and @c wxFR_MATCHCASE flags. + Get the currently selected flags: this is the combination of + the ::wxFindReplaceFlags enumeration values. */ int GetFlags() const; @@ -44,7 +93,7 @@ public: Return the string to replace the search string with (only for replace and replace all events). */ - const wxString GetReplaceString() const; + const wxString& GetReplaceString() const; }; @@ -53,18 +102,18 @@ public: @class wxFindReplaceData @wxheader{fdrepdlg.h} - wxFindReplaceData holds the data for - wxFindReplaceDialog. It is used to initialize - the dialog with the default values and will keep the last values from the - dialog when it is closed. It is also updated each time a - wxFindDialogEvent is generated so instead of - using the wxFindDialogEvent methods you can also directly query this object. + wxFindReplaceData holds the data for wxFindReplaceDialog. + + It is used to initialize the dialog with the default values and will keep the + last values from the dialog when it is closed. It is also updated each time a + wxFindDialogEvent is generated so instead of using the wxFindDialogEvent + methods you can also directly query this object. Note that all @c SetXXX() methods may only be called before showing the dialog and calling them has no effect later. @library{wxcore} - @category{FIXME} + @category{data} */ class wxFindReplaceData : public wxObject { @@ -113,13 +162,14 @@ public: wxFindReplaceDialog is a standard modeless dialog which is used to allow the user to search for some text (and possibly replace it with something else). + The actual searching is supposed to be done in the owner window which is the parent of this dialog. Note that it means that unlike for the other standard dialogs this one @b must have a parent window. Also note that there is no way to use this dialog in a modal way; it is always, by design and implementation, modeless. - Please see the dialogs sample for an example of using it. + Please see the @ref page_samples_dialogs sample for an example of using it. @library{wxcore} @category{cmndlg} @@ -127,18 +177,17 @@ public: class wxFindReplaceDialog : public wxDialog { public: - //@{ + wxFindReplaceDialog(); + /** - After using default constructor Create() - must be called. + After using default constructor Create() must be called. + The @a parent and @a data parameters must be non-@NULL. */ - wxFindReplaceDialog(); wxFindReplaceDialog(wxWindow* parent, wxFindReplaceData* data, const wxString& title, int style = 0); - //@} /** Destructor. @@ -147,14 +196,14 @@ public: /** Creates the dialog; use wxWindow::Show to show it on screen. + The @a parent and @a data parameters must be non-@NULL. */ bool Create(wxWindow* parent, wxFindReplaceData* data, const wxString& title, int style = 0); /** - Get the wxFindReplaceData object used by this - dialog. + Get the wxFindReplaceData object used by this dialog. */ const wxFindReplaceData* GetData() const; }; diff --git a/interface/fileconf.h b/interface/fileconf.h index cd51b24376..589e83df42 100644 --- a/interface/fileconf.h +++ b/interface/fileconf.h @@ -21,7 +21,7 @@ Windows. @library{wxbase} - @category{FIXME} + @category{misc} @see wxFileConfig::Save */ @@ -29,40 +29,41 @@ class wxFileConfig : public wxConfigBase { public: /** - ) Read the config data from the specified stream instead of the associated file, as usual. @see Save() */ - wxFileConfig(wxInputStream& is); + wxFileConfig(wxInputStream& is, const wxMBConv& conv = wxConvAuto()); /** Return the full path to the file which would be used by wxFileConfig as global, - system-wide, file if it were constructed with @a basename as "global - filename'' parameter in the constructor. Notice that this function cannot be - used if @a basename is already a full path name. + system-wide, file if it were constructed with @a basename as "global filename" + parameter in the constructor. + + Notice that this function cannot be used if @a basename is already a full path name. */ static wxFileName GetGlobalFile(const wxString& basename); /** Return the full path to the file which would be used by wxFileConfig as local, - user-specific, file if it were constructed with @a basename as "local - filename'' parameter in the constructor. + user-specific, file if it were constructed with @a basename as "local filename" + parameter in the constructor. + @a style has the same meaning as in @ref wxConfigBase::ctor constructor and can contain any combination of styles but only wxCONFIG_USE_SUBDIR bit is examined by this function. - Notice that this function cannot be used if @a basename is already a full - path name. + + Notice that this function cannot be used if @a basename is already a full path name. */ static wxFileName GetLocalFile(const wxString& basename, int style = 0); /** - ) Saves all config data to the given stream, returns @true if data was saved successfully or @false on error. - Note the interaction of this function with the internal "dirty flag'': the + + Note the interaction of this function with the internal "dirty flag": the data is saved unconditionally, i.e. even if the object is not dirty. However after saving it successfully, the dirty flag is reset so no changes will be written back to the file this object is associated with until you change its @@ -70,13 +71,13 @@ public: @see wxConfigBase::Flush */ - bool Save(wxOutputStream& os); + bool Save(wxOutputStream& os, const wxMBConv& conv = wxConvAuto()); /** Allows to set the mode to be used for the config file creation. For example, to create a config file which is not readable by other users (useful if it stores - some sensitive information, such as passwords), you could use - @c SetUmask(0077). + some sensitive information, such as passwords), you could use @c SetUmask(0077). + This function doesn't do anything on non-Unix platforms. @see wxCHANGE_UMASK() diff --git a/interface/filectrl.h b/interface/filectrl.h index fbad3f4a9a..3c8d2a3a5b 100644 --- a/interface/filectrl.h +++ b/interface/filectrl.h @@ -10,9 +10,10 @@ @class wxFileCtrl @wxheader{filectrl.h} - This control allows the user to select a file. two implemetations exist, one - for Gtk and another generic one for anything other than Gtk. - It is only available if @c wxUSE_FILECTRL is set to 1. + This control allows the user to select a file. + + Two implemetations exist, one for Gtk and another generic one for anything + other than Gtk. It is only available if @c wxUSE_FILECTRL is set to 1. @beginStyleTable @style{wxFC_DEFAULT_STYLE}: @@ -30,16 +31,31 @@ Hides the "Show Hidden Files" checkbox (Generic only) @endStyleTable + + @beginEventTable{wxFileCtrlEvent} + @event{EVT_FILECTRL_FILEACTIVATED(id, func)}: + The user activated a file(by double-clicking or pressing Enter) + @event{EVT_FILECTRL_SELECTIONCHANGED(id, func)}: + The user changed the current selection(by selecting or deselecting a file) + @event{EVT_FILECTRL_FOLDERCHANGED(id, func)}: + The current folder of the file control has been changed + @endEventTable + + @nativeimpl{gtk} + @library{wxbase} - @category{FIXME} + @category{miscwnd} @see wxGenericDirCtrl */ class wxFileCtrl : public wxWindow { public: - //@{ + wxFileCtrl(); + /** + Constructs the window. + @param parent Parent window, must not be non-@NULL. @param id @@ -65,7 +81,7 @@ public: @returns @true if the control was successfully created or @false if creation failed. */ - wxFileCtrl(); + wxFileCtrl(wxWindow* parent, wxWindowID id, const wxString& defaultDirectory = wxEmptyString, const wxString& defaultFilename = wxEmptyString, @@ -74,7 +90,6 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, const wxString& name = "filectrl"); - //@} /** Create function for two-step construction. See wxFileCtrl() for details. @@ -89,23 +104,22 @@ public: const wxString& name = "filectrl"); /** - Returns the current directory of the file control (i.e. the directory shown by - it). + Returns the current directory of the file control (i.e. the directory shown by it). */ wxString GetDirectory() const; /** Returns the currently selected filename. - For the controls having the @c wxFC_MULTIPLE style, use GetFilenames() - instead + + For the controls having the @c wxFC_MULTIPLE style, use GetFilenames() instead. */ wxString GetFilename() const; /** - Fills the array @a filenames with the filenames only of selected items. This - function should only be used with the controls having the @c wxFC_MULTIPLE - style, - use GetFilename() for the others. + Fills the array @a filenames with the filenames only of selected items. + + This function should only be used with the controls having the @c wxFC_MULTIPLE + style, use GetFilename() for the others. @remarks filenames is emptied first. */ @@ -118,14 +132,14 @@ public: /** Returns the full path (directory and filename) of the currently selected file. - For the controls having the @c wxFC_MULTIPLE style, use GetPaths() - instead + For the controls having the @c wxFC_MULTIPLE style, use GetPaths() instead. */ wxString GetPath() const; /** - Fills the array @a paths with the full paths of the files chosen. This - function should be used with the controls having the @c wxFC_MULTIPLE style, + Fills the array @a paths with the full paths of the files chosen. + + This function should be used with the controls having the @c wxFC_MULTIPLE style, use GetPath() otherwise. @remarks paths is emptied first. @@ -177,8 +191,17 @@ public: A file control event holds information about events associated with wxFileCtrl objects. + @beginEventTable{wxFileCtrlEvent} + @event{EVT_FILECTRL_FILEACTIVATED(id, func)}: + The user activated a file(by double-clicking or pressing Enter) + @event{EVT_FILECTRL_SELECTIONCHANGED(id, func)}: + The user changed the current selection(by selecting or deselecting a file) + @event{EVT_FILECTRL_FOLDERCHANGED(id, func)}: + The current folder of the file control has been changed + @endEventTable + @library{wxbase} - @category{FIXME} + @category{events} */ class wxFileCtrlEvent : public wxCommandEvent { @@ -190,18 +213,20 @@ public: /** Returns the current directory. + In case of a @b EVT_FILECTRL_FOLDERCHANGED, this method returns the new directory. */ wxString GetDirectory() const; /** - Returns the file selected(assuming it is only one file). + Returns the file selected (assuming it is only one file). */ wxString GetFile() const; /** Returns the files selected. + In case of a @b EVT_FILECTRL_SELECTIONCHANGED, this method returns the files selected after the event. */ @@ -210,6 +235,12 @@ public: /** Sets the files changed by this event. */ - wxFileCtrlEvent::SetFiles(const wxArrayString files); + void SetFiles(const wxArrayString files); + + + /** + Sets the directory of this event. + */ + void SetDirectory( const wxString &directory ); }; diff --git a/interface/filedlg.h b/interface/filedlg.h index 5af07bd365..e4e64c3724 100644 --- a/interface/filedlg.h +++ b/interface/filedlg.h @@ -12,13 +12,32 @@ This class represents the file chooser dialog. + It pops up a file selector box (native for Windows and GTK2.4+). + + The path and filename are distinct elements of a full file pathname. + If path is "", the current directory will be used. If filename is "", no default + filename will be supplied. The wildcard determines what files are displayed in the + file selector, and file extension supplies a type extension for the required filename. + + @remarks + All implementations of the wxFileDialog provide a wildcard filter. Typing a filename + containing wildcards (*, ?) in the filename text item, and clicking on Ok, will + result in only those files matching the pattern being displayed. + The wildcard may be a specification for multiple types of file with a description + for each, such as: + "BMP and GIF files (*.bmp;*.gif)|*.bmp;*.gif|PNG files (*.png)|*.png" + It must be noted that wildcard support in the native Motif file dialog is quite + limited: only one alternative is supported, and it is displayed without the + descriptive test; "BMP files (*.bmp)|*.bmp" is displayed as "*.bmp", and both + "BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif" and "Image files|*.bmp;*.gif" + are errors. + @beginStyleTable @style{wxFD_DEFAULT_STYLE}: Equivalent to wxFD_OPEN. @style{wxFD_OPEN}: This is an open dialog; usually this means that the default - button's label of the dialog is "Open". Cannot be combined with - wxFD_SAVE. + button's label of the dialog is "Open". Cannot be combined with wxFD_SAVE. @style{wxFD_SAVE}: This is a save dialog; usually this means that the default button's label of the dialog is "Save". Cannot be combined with wxFD_OPEN. @@ -26,8 +45,7 @@ For save dialog only: prompt for a confirmation if a file will be overwritten. @style{wxFD_FILE_MUST_EXIST}: - For open dialog only: the user may only select files that actually - exist. + For open dialog only: the user may only select files that actually exist. @style{wxFD_MULTIPLE}: For open dialog only: allows selecting multiple files. @style{wxFD_CHANGE_DIR}: @@ -41,8 +59,7 @@ @library{wxcore} @category{cmndlg} - @see @ref overview_wxfiledialogoverview "wxFileDialog overview", - wxFileSelector() + @see @ref overview_wxfiledialog, ::wxFileSelector() */ class wxFileDialog : public wxDialog { @@ -59,8 +76,7 @@ public: @param defaultFile The default filename, or the empty string. @param wildcard - A wildcard, such as "*.*" or "BMP files (*.bmp)|*.bmp|GIF files - (*.gif)|*.gif". + A wildcard, such as "*.*" or "BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif". Note that the native Motif dialog has some limitations with respect to wildcards; see the Remarks section above. @param style @@ -93,9 +109,7 @@ public: wxString GetDirectory() const; /** - If functions - SetExtraControlCreator() - and ShowModal() were called, + If functions SetExtraControlCreator() and ShowModal() were called, returns the extra window. Otherwise returns @NULL. */ wxWindow* GetExtraControl() const; @@ -106,9 +120,11 @@ public: wxString GetFilename() const; /** - Fills the array @a filenames with the names of the files chosen. This - function should only be used with the dialogs which have @c wxFD_MULTIPLE style, + Fills the array @a filenames with the names of the files chosen. + + This function should only be used with the dialogs which have @c wxFD_MULTIPLE style, use GetFilename() for the others. + Note that under Windows, if the user selects shortcuts, the filenames include paths, since the application cannot determine the full path of each referenced file by appending the directory containing the shortcuts @@ -119,8 +135,10 @@ public: /** Returns the index into the list of filters supplied, optionally, in the wildcard parameter. + Before the dialog is shown, this is the index which will be used when the dialog is first displayed. + After the dialog is shown, this is the index selected by the user. */ int GetFilterIndex() const; @@ -136,8 +154,9 @@ public: wxString GetPath() const; /** - Fills the array @a paths with the full paths of the files chosen. This - function should only be used with the dialogs which have @c wxFD_MULTIPLE style, + Fills the array @a paths with the full paths of the files chosen. + + This function should only be used with the dialogs which have @c wxFD_MULTIPLE style, use GetPath() for the others. */ void GetPaths(wxArrayString& paths) const; @@ -155,10 +174,12 @@ public: /** Customize file dialog by adding extra window, which is typically placed below the list of files and above the buttons. - SetExtraControlCreator can be called only once, before calling - ShowModal(). + + SetExtraControlCreator() can be called only once, before calling ShowModal(). + The @c creator function should take pointer to parent window (file dialog) and should return a window allocated with operator new. + Supported platforms: wxGTK, wxUniv. */ bool SetExtraControlCreator(t_extraControlCreator creator); @@ -186,7 +207,8 @@ public: /** Sets the wildcard, which can contain multiple file types, for example: - "BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif" + "BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif". + Note that the native Motif dialog has some limitations with respect to wildcards; see the Remarks section above. */ diff --git a/interface/filefn.h b/interface/filefn.h index ee4cd58bca..834b037ecb 100644 --- a/interface/filefn.h +++ b/interface/filefn.h @@ -25,70 +25,70 @@ class wxPathList : public wxArrayString { public: - //@{ + wxPathList(); + /** Constructs the object calling the Add() function. */ - wxPathList(); wxPathList(const wxArrayString& arr); - //@} - //@{ /** - The first form adds the given directory to the path list, if the path is not - already in the list. + Adds the given directory to the path list, if the @a path is not already in the list. If the path cannot be normalized for some reason, it returns @false. - The second form just calls the first form on all elements of the given array. - The @a path is always considered a directory but no existence checks will be - done on it - (because if it doesn't exist, it could be created later and thus result a valid - path when - FindValidPath() is called). - @b Note: if the given path is relative, it won't be made absolute before adding - it - (this is why FindValidPath() may return relative paths). + + The @a path is always considered to be a directory but no existence checks will be + done on it (because if it doesn't exist, it could be created later and thus result a + valid path when FindValidPath() is called). + + @note if the given path is relative, it won't be made absolute before adding it + (this is why FindValidPath() may return relative paths). */ bool Add(const wxString& path); + + /** + Adds all elements of the given array as paths. + */ void Add(const wxArrayString& arr); - //@} /** Finds the value of the given environment variable, and adds all paths - to the path list. Useful for finding files in the @c PATH variable, for - example. + to the path list. + + Useful for finding files in the @c PATH variable, for example. */ void AddEnvList(const wxString& env_variable); /** - Given a full filename (with path), calls Add() with the path - of the file. + Given a full filename (with path), calls Add() with the path of the file. */ bool EnsureFileAccessible(const wxString& filename); /** - Like FindValidPath() but this function always - returns an absolute path (eventually prepending the current working directory - to the value returned wxPathList::FindValidPath) or an - empty string. + Like FindValidPath() but this function always returns an absolute path + (eventually prepending the current working directory to the value returned + wxPathList::FindValidPath()) or an empty string. */ wxString FindAbsoluteValidPath(const wxString& file) const; /** Searches the given file in all paths stored in this class. + The first path which concatenated to the given string points to an existing file (see wxFileExists()) is returned. - If the file wasn't found in any of the stored paths, an empty string is - returned. + + If the file wasn't found in any of the stored paths, an empty string is returned. + The given string must be a file name, eventually with a path prefix (if the path prefix is absolute, only its name will be searched); i.e. it must not end with - a directory separator (see wxFileName::GetPathSeparator) - otherwise an assertion will fail. + a directory separator (see wxFileName::GetPathSeparator) otherwise an assertion + will fail. + The returned path may be relative to the current working directory. + Note in fact that wxPathList can be used to store both relative and absolute - paths so that - if you Added() relative paths, then the current working directory - (see wxGetCwd() and wxSetWorkingDirectory()) - may affect the value returned by this function! + paths so that if you added relative paths, then the current working directory + (see wxGetCwd() and wxSetWorkingDirectory()) may affect the value returned + by this function! */ wxString FindValidPath(const wxString& file) const; };