Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

dlgFilesSelector Class Reference

Dialog for choosing multiple files to process. More...

#include <dlgFilesSelector.hpp>

Inheritance diagram for dlgFilesSelector:

Inheritance graph
[legend]
Collaboration diagram for dlgFilesSelector:

Collaboration graph
[legend]
List of all members.

Public Member Functions

void createControls ()
 Creates and initializes the controls of the dialog.

 dlgFilesSelector (wxWindow *parent, const bool extendDialog=false)
 Creates a new dialog.

 dlgFilesSelector ()
 Creates a new dialog.

void getFileNames (wxArrayString &names) const
 Gets the names of the files.

int getHistoryMaxSize ()
 Get the maximum size of the history of the last files' names and directories for searching files.

wxString getLookInConfigKey (const int n)
 Gets the configuration key for the last directories for searching files.

wxString getNamedConfigKey (const int n)
 Gets the configuration key for the last files' names for searching files.

virtual wxString getRootConfigKey ()=0
 Gets the root configuration key for parameters of this dialog.

virtual void initialize ()
 Initializes the dialog.

virtual ~dlgFilesSelector ()
 The class descructor.


Protected Types

enum  {
  LVW_FILES = wxID_HIGHEST + 1, BTN_ADD, BTN_REMOVE, BTN_ADDLIST,
  BTN_LOADLIST, BTN_SAVELIST, CBO_NAMED, CBO_LOOKIN,
  BTN_BROWSE, BTN_SEARCH_AND_ADD, SPN_DEPTH, RBX_SORT_BY,
  RBX_SORT_ORDER, BTN_OK, DLG_FILESSELECTOR_ID_HIGHEST
}
 Controls IDs. More...

enum  PreferencesKey {
  prGUI_SORT_BY = 0, prGUI_SORT_ORDER, prGUI_FILENAME_WIDTH, prGUI_DIRECTORY_WIDTH,
  prGUI_WINDOW_SIZE
}
 Preferences keys. More...

enum  UIStrings {
  uiDialogTitle = 0, uiBtnOK, uiFraFilesList, uiFraSearchFiles,
  uiOpenDlgAddFiles, uiOpenDlgAddList, uiOpenDlgLoadList, uiSaveDlgAddList
}
 Custumised UI strings. More...


Protected Member Functions

void addFileNamesToListView (const wxArrayString &fileNames)
 Adds the given array of file names to the listview of file names.

void btnAddClick (wxCommandEvent &event)
 Processes button Add.

void btnAddListClick (wxCommandEvent &event)
 Processes button Add List.

void btnBrowseClick (wxCommandEvent &event)
 Processes button Browse.

void btnLoadListClick (wxCommandEvent &event)
 Processes button Load List.

void btnOKClick (wxCommandEvent &event)
 Processes button OK.

void btnRemoveClick (wxCommandEvent &event)
 Processes button Remove.

void btnSaveListClick (wxCommandEvent &event)
 Processes button Save List.

void btnSearchAndAddClick (wxCommandEvent &event)
 Processes button Search and Add.

void cboSearchTextEnter (wxCommandEvent &event)
 Event handler for the enter key pressed on a search combo box.

wxString getConfigKey (const PreferencesKey pk)
 Gets the configuration key corresponding to the given preference key.

virtual wxFileDialogFilterMaker getFiltersForAddFilesDialog ()=0
 Returns a set of filters for the "Add files" dialog.

virtual wxString getUIString (UIStrings id)=0
 Gets the string for the specified UI element.

void lvwFilesColumnClick (wxListEvent &event)
 Processes a click on a header of a column of the list of files.

void lvwFilesDeselectItem (wxListEvent &event)
 Event handler for the deselection of an item.

void lvwFilesKeyDown (wxListEvent &event)
 Event handler for the key down event.

void lvwFilesSelectItem (wxListEvent &event)
 Event handler for the selection of an item.

void rbxSortBySelect (wxCommandEvent &event)
 Processes a selection of the column to sort.

void rbxSortOrderSelect (wxCommandEvent &event)
 Processes a selection of the sort order.


Static Protected Member Functions

long getID ()
 Gets a new unique identifier.


Protected Attributes

wxButton * btnAdd
 Button for adding files.

wxButton * btnRemove
 Button for removing files.

wxButton * btnSearchAndAdd
 Search and add files to the list of files.

wxComboBox * cboLookIn
 Directory to begin the search.

wxComboBox * cboNamed
 Name of the file to search.

bool extend
 Is the dialog will be extended ?

wxBoxSizer * extendSizer
 Sizer where controls should be added (it is positionned before the validation buttons).

wxArrayString fileNames
 Names of the files given by the validator.

wxSortableListViewlvwFiles
 List of selected files.

wxRadioBox * rbxSortBy
 Sort by radio box buttons.

wxRadioBox * rbxSortOrder
 Sort order radio box buttons.

wxSpinCtrl * spnDepth
 Search depth.


Private Member Functions

void getLastDirectoryAndFilter (const wxString &configKey, wxString &lastDirKey, wxString &lastDir, wxFileDialogFilterMaker &fltMaker)
 Gets the last directory used and the filter for the open or save dialog.


Static Private Member Functions

void addLineToComboBox (wxComboBox *cboBox, const int maxLines)
 Adds a file or a directory or a match pattern to a combo box.


Detailed Description

Dialog for choosing multiple files to process.

Important: you must call the initialize() method just after the constructor the create the widgets of the window (this can't be done in the constructor because createControls() calls pure virtual methods.

Definition at line 56 of file dlgFilesSelector.hpp.


Member Enumeration Documentation

anonymous enum [protected]
 

Controls IDs.

Definition at line 128 of file dlgFilesSelector.hpp.

enum dlgFilesSelector::PreferencesKey [protected]
 

Preferences keys.

Definition at line 185 of file dlgFilesSelector.hpp.

enum dlgFilesSelector::UIStrings [protected]
 

Custumised UI strings.

Definition at line 199 of file dlgFilesSelector.hpp.


Constructor & Destructor Documentation

dlgFilesSelector::dlgFilesSelector  ) 
 

Creates a new dialog.

Definition at line 400 of file dlgFilesSelector.cpp.

References extend.

dlgFilesSelector::dlgFilesSelector wxWindow *  parent,
const bool  extendDialog = false
 

Creates a new dialog.

Parameters:
parent Parent of the dialog.
extendDialog true if the dialog will be extended with other controls that the ones created by dlgFilesSelector. If this parameter is true then the extendSizer attribute is initialised otherwise it equals to NULL.

Definition at line 418 of file dlgFilesSelector.cpp.

References extend.

dlgFilesSelector::~dlgFilesSelector  )  [virtual]
 

The class descructor.

Definition at line 599 of file dlgFilesSelector.cpp.


Member Function Documentation

void dlgFilesSelector::addFileNamesToListView const wxArrayString &  fileNames  )  [protected]
 

Adds the given array of file names to the listview of file names.

The names that already are in the list are not added.

Parameters:
fileNames Names of the files to be added to the listview.

Definition at line 1130 of file dlgFilesSelector.cpp.

References addFileNamesToListView(), compareFileName(), filesListCmpFnct(), getID(), and lvwFiles.

Referenced by addFileNamesToListView(), btnAddClick(), btnAddListClick(), btnLoadListClick(), and btnSearchAndAddClick().

void dlgFilesSelector::addLineToComboBox wxComboBox *  cboBox,
const int  maxLines
[static, private]
 

Adds a file or a directory or a match pattern to a combo box.

Parameters:
cboBox The combobox.
maxLines The number of maximum lines in the combobox.

Definition at line 878 of file dlgFilesSelector.cpp.

References addLineToComboBox(), and compareFileName().

Referenced by addLineToComboBox(), and btnSearchAndAddClick().

void dlgFilesSelector::btnAddClick wxCommandEvent &  event  )  [protected]
 

Processes button Add.

Parameters:
event The event's parameters

Definition at line 610 of file dlgFilesSelector.cpp.

References addFileNamesToListView(), btnAddClick(), wxFileDialogFilterMaker::GetFilters(), getFiltersForAddFilesDialog(), getRootConfigKey(), getUIString(), and AppPrefs::getUserDocumentsDirName().

Referenced by btnAddClick().

void dlgFilesSelector::btnAddListClick wxCommandEvent &  event  )  [protected]
 

Processes button Add List.

Parameters:
event The event's parameters

Definition at line 697 of file dlgFilesSelector.cpp.

References addFileNamesToListView(), btnAddListClick(), wxFileDialogFilterMaker::GetFilters(), getLastDirectoryAndFilter(), and getUIString().

Referenced by btnAddListClick().

void dlgFilesSelector::btnBrowseClick wxCommandEvent &  event  )  [protected]
 

Processes button Browse.

Parameters:
event The event's parameters

Definition at line 844 of file dlgFilesSelector.cpp.

References btnBrowseClick(), cboLookIn, getRootConfigKey(), and AppPrefs::getUserDocumentsDirName().

Referenced by btnBrowseClick().

void dlgFilesSelector::btnLoadListClick wxCommandEvent &  event  )  [protected]
 

Processes button Load List.

Parameters:
event The event's parameters

Definition at line 743 of file dlgFilesSelector.cpp.

References addFileNamesToListView(), btnLoadListClick(), wxFileDialogFilterMaker::GetFilters(), getLastDirectoryAndFilter(), getUIString(), and lvwFiles.

Referenced by btnLoadListClick().

void dlgFilesSelector::btnOKClick wxCommandEvent &  event  )  [protected]
 

Processes button OK.

Parameters:
event The event's parameters

Reimplemented in dlgBatchCreationConf.

Definition at line 1098 of file dlgFilesSelector.cpp.

References btnOKClick(), wxSortableListView::GetColumnToSort(), getConfigKey(), wxSortableListView::GetSortOrder(), and lvwFiles.

Referenced by btnOKClick().

void dlgFilesSelector::btnRemoveClick wxCommandEvent &  event  )  [protected]
 

Processes button Remove.

Parameters:
event The event's parameters

Definition at line 649 of file dlgFilesSelector.cpp.

References btnRemoveClick(), and lvwFiles.

Referenced by btnRemoveClick().

void dlgFilesSelector::btnSaveListClick wxCommandEvent &  event  )  [protected]
 

Processes button Save List.

Parameters:
event The event's parameters

Definition at line 792 of file dlgFilesSelector.cpp.

References btnSaveListClick(), wxFileDialogFilterMaker::GetFilters(), getLastDirectoryAndFilter(), getUIString(), and lvwFiles.

Referenced by btnSaveListClick().

void dlgFilesSelector::btnSearchAndAddClick wxCommandEvent &  event  )  [protected]
 

Processes button Search and Add.

Parameters:
event The event's parameters

Definition at line 918 of file dlgFilesSelector.cpp.

References addFileNamesToListView(), addLineToComboBox(), btnSearchAndAddClick(), cboLookIn, cboNamed, getHistoryMaxSize(), getLookInConfigKey(), getNamedConfigKey(), and spnDepth.

Referenced by btnSearchAndAddClick().

void dlgFilesSelector::cboSearchTextEnter wxCommandEvent &  event  )  [protected]
 

Event handler for the enter key pressed on a search combo box.

Parameters:
event Event parameters.

Definition at line 1028 of file dlgFilesSelector.cpp.

References btnSearchAndAdd, and cboSearchTextEnter().

Referenced by cboSearchTextEnter().

void dlgFilesSelector::createControls  ) 
 

Creates and initializes the controls of the dialog.

Reimplemented in dlgBatchCreationConf.

Definition at line 453 of file dlgFilesSelector.cpp.

References btnAdd, btnRemove, btnSearchAndAdd, cboLookIn, cboNamed, CONTROL_SPACE, extend, extendSizer, wxSortableListView::GetColumnToSort(), getConfigKey(), getHistoryMaxSize(), getLookInConfigKey(), getNamedConfigKey(), wxSortableListView::GetSortOrder(), getUIString(), lvwFiles, rbxSortBy, rbxSortOrder, wxSortableListView::SetColumnToSort(), wxSortableListView::SetSortOrder(), and spnDepth.

Referenced by initialize().

wxString dlgFilesSelector::getConfigKey const PreferencesKey  pk  )  [protected]
 

Gets the configuration key corresponding to the given preference key.

Parameters:
pk The preference key to get.
Returns:
The configuration key corresponding to the given preference key or an empty string if the preference key is invalid.

Definition at line 1246 of file dlgFilesSelector.cpp.

References getConfigKey(), and getRootConfigKey().

Referenced by btnOKClick(), createControls(), getConfigKey(), and initialize().

void dlgFilesSelector::getFileNames wxArrayString &  names  )  const
 

Gets the names of the files.

Parameters:
names The array which will contain the names of the files.

Definition at line 1186 of file dlgFilesSelector.cpp.

References fileNames, and getFileNames().

Referenced by getFileNames(), frmSums::itmToolsBatchCreationClick(), and frmSums::itmToolsCheckMultipleClick().

virtual wxFileDialogFilterMaker dlgFilesSelector::getFiltersForAddFilesDialog  )  [protected, pure virtual]
 

Returns a set of filters for the "Add files" dialog.

Returns:
A set of filters for the "Add files" dialog.

Implemented in dlgBatchCreationConf, and dlgMultiCheckConf.

Referenced by btnAddClick().

int dlgFilesSelector::getHistoryMaxSize  )  [inline]
 

Get the maximum size of the history of the last files' names and directories for searching files.

Returns:
The maximum size of the history of the last files' names and directories for searching files.

Definition at line 1232 of file dlgFilesSelector.cpp.

Referenced by btnSearchAndAddClick(), createControls(), getLookInConfigKey(), and getNamedConfigKey().

long dlgFilesSelector::getID  )  [static, protected]
 

Gets a new unique identifier.

Returns:
A new unique identifier.

Definition at line 1281 of file dlgFilesSelector.cpp.

References getUniqueId().

Referenced by addFileNamesToListView(), and dlgFilesSelector::FilesListValidator::TransferToWindow().

void dlgFilesSelector::getLastDirectoryAndFilter const wxString &  configKey,
wxString &  lastDirKey,
wxString &  lastDir,
wxFileDialogFilterMaker fltMaker
[private]
 

Gets the last directory used and the filter for the open or save dialog.

Parameters:
configKey Configuration key for the last directory.
lastDirKey String that will contains the full configuration key for the last directory.
lastDir String that will contains the last directory.
fltMaker Filter that will contains the filters for the open or save dialog.

Definition at line 671 of file dlgFilesSelector.cpp.

References wxFileDialogFilterMaker::AddFilter(), getLastDirectoryAndFilter(), getRootConfigKey(), and AppPrefs::getUserDocumentsDirName().

Referenced by btnAddListClick(), btnLoadListClick(), btnSaveListClick(), and getLastDirectoryAndFilter().

wxString dlgFilesSelector::getLookInConfigKey const int  n  ) 
 

Gets the configuration key for the last directories for searching files.

Parameters:
n The nth history configuration key to get.
Returns:
The configuration key for the last directories for searching files.

Definition at line 1215 of file dlgFilesSelector.cpp.

References getHistoryMaxSize(), getLookInConfigKey(), and getRootConfigKey().

Referenced by btnSearchAndAddClick(), createControls(), and getLookInConfigKey().

wxString dlgFilesSelector::getNamedConfigKey const int  n  ) 
 

Gets the configuration key for the last files' names for searching files.

Parameters:
n The nth history configuration key to get.
Returns:
The configuration key for the last files' names for searching files.

Definition at line 1199 of file dlgFilesSelector.cpp.

References getHistoryMaxSize(), getNamedConfigKey(), and getRootConfigKey().

Referenced by btnSearchAndAddClick(), createControls(), and getNamedConfigKey().

virtual wxString dlgFilesSelector::getRootConfigKey  )  [pure virtual]
 

Gets the root configuration key for parameters of this dialog.

The returned string must be ended the a '/' character.

Returns:
The root configuration key for parameters of this dialog.

Implemented in dlgBatchCreationConf, and dlgMultiCheckConf.

Referenced by btnAddClick(), btnBrowseClick(), getConfigKey(), getLastDirectoryAndFilter(), getLookInConfigKey(), and getNamedConfigKey().

virtual wxString dlgFilesSelector::getUIString UIStrings  id  )  [protected, pure virtual]
 

Gets the string for the specified UI element.

Parameters:
id Identifier of the wanted UI element.
Returns:
The string for the specified UI element and an empty string if the given UI element is invalid.

Implemented in dlgBatchCreationConf, and dlgMultiCheckConf.

Referenced by btnAddClick(), btnAddListClick(), btnLoadListClick(), btnSaveListClick(), and createControls().

void dlgFilesSelector::initialize  )  [virtual]
 

Initializes the dialog.

If you derivate this method, please call the one of the parent class before doing anything.

Reimplemented in dlgBatchCreationConf.

Definition at line 433 of file dlgFilesSelector.cpp.

References createControls(), and getConfigKey().

Referenced by dlgBatchCreationConf::initialize(), and frmSums::itmToolsCheckMultipleClick().

void dlgFilesSelector::lvwFilesColumnClick wxListEvent &  event  )  [protected]
 

Processes a click on a header of a column of the list of files.

Parameters:
event Event parameters.

Definition at line 1065 of file dlgFilesSelector.cpp.

References filesListCmpFnct(), wxSortableListView::GetColumnToSort(), wxSortableListView::GetSortOrder(), lvwFiles, lvwFilesColumnClick(), rbxSortBy, rbxSortOrder, wxSortableListView::SetColumnToSort(), and wxSortableListView::SetSortOrder().

Referenced by lvwFilesColumnClick().

void dlgFilesSelector::lvwFilesDeselectItem wxListEvent &  event  )  [protected]
 

Event handler for the deselection of an item.

Parameters:
event Event parameters.

Definition at line 978 of file dlgFilesSelector.cpp.

References btnRemove, lvwFiles, and lvwFilesDeselectItem().

Referenced by lvwFilesDeselectItem().

void dlgFilesSelector::lvwFilesKeyDown wxListEvent &  event  )  [protected]
 

Event handler for the key down event.

Parameters:
event Event parameters.

Definition at line 1041 of file dlgFilesSelector.cpp.

References btnAdd, btnRemove, and lvwFilesKeyDown().

Referenced by lvwFilesKeyDown().

void dlgFilesSelector::lvwFilesSelectItem wxListEvent &  event  )  [protected]
 

Event handler for the selection of an item.

Parameters:
event Event parameters.

Definition at line 966 of file dlgFilesSelector.cpp.

References btnRemove, and lvwFilesSelectItem().

Referenced by lvwFilesSelectItem().

void dlgFilesSelector::rbxSortBySelect wxCommandEvent &  event  )  [protected]
 

Processes a selection of the column to sort.

Parameters:
event Event parameters.

Definition at line 991 of file dlgFilesSelector.cpp.

References filesListCmpFnct(), lvwFiles, rbxSortBySelect(), and wxSortableListView::SetColumnToSort().

Referenced by rbxSortBySelect().

void dlgFilesSelector::rbxSortOrderSelect wxCommandEvent &  event  )  [protected]
 

Processes a selection of the sort order.

Parameters:
event Event parameters.

Definition at line 1004 of file dlgFilesSelector.cpp.

References filesListCmpFnct(), lvwFiles, rbxSortOrderSelect(), and wxSortableListView::SetSortOrder().

Referenced by rbxSortOrderSelect().


Member Data Documentation

wxButton* dlgFilesSelector::btnAdd [protected]
 

Button for adding files.

Definition at line 79 of file dlgFilesSelector.hpp.

Referenced by createControls(), and lvwFilesKeyDown().

wxButton* dlgFilesSelector::btnRemove [protected]
 

Button for removing files.

Definition at line 80 of file dlgFilesSelector.hpp.

Referenced by createControls(), lvwFilesDeselectItem(), lvwFilesKeyDown(), and lvwFilesSelectItem().

wxButton* dlgFilesSelector::btnSearchAndAdd [protected]
 

Search and add files to the list of files.

Definition at line 83 of file dlgFilesSelector.hpp.

Referenced by cboSearchTextEnter(), and createControls().

wxComboBox* dlgFilesSelector::cboLookIn [protected]
 

Directory to begin the search.

Definition at line 85 of file dlgFilesSelector.hpp.

Referenced by btnBrowseClick(), btnSearchAndAddClick(), and createControls().

wxComboBox* dlgFilesSelector::cboNamed [protected]
 

Name of the file to search.

Definition at line 84 of file dlgFilesSelector.hpp.

Referenced by btnSearchAndAddClick(), and createControls().

bool dlgFilesSelector::extend [protected]
 

Is the dialog will be extended ?

Definition at line 76 of file dlgFilesSelector.hpp.

Referenced by createControls(), and dlgFilesSelector().

wxBoxSizer* dlgFilesSelector::extendSizer [protected]
 

Sizer where controls should be added (it is positionned before the validation buttons).

Definition at line 87 of file dlgFilesSelector.hpp.

Referenced by createControls().

wxArrayString dlgFilesSelector::fileNames [protected]
 

Names of the files given by the validator.

Definition at line 78 of file dlgFilesSelector.hpp.

Referenced by getFileNames().

wxSortableListView* dlgFilesSelector::lvwFiles [protected]
 

List of selected files.

Definition at line 77 of file dlgFilesSelector.hpp.

Referenced by addFileNamesToListView(), btnLoadListClick(), btnOKClick(), btnRemoveClick(), btnSaveListClick(), createControls(), lvwFilesColumnClick(), lvwFilesDeselectItem(), rbxSortBySelect(), and rbxSortOrderSelect().

wxRadioBox* dlgFilesSelector::rbxSortBy [protected]
 

Sort by radio box buttons.

Definition at line 81 of file dlgFilesSelector.hpp.

Referenced by createControls(), and lvwFilesColumnClick().

wxRadioBox* dlgFilesSelector::rbxSortOrder [protected]
 

Sort order radio box buttons.

Definition at line 82 of file dlgFilesSelector.hpp.

Referenced by createControls(), and lvwFilesColumnClick().

wxSpinCtrl* dlgFilesSelector::spnDepth [protected]
 

Search depth.

Definition at line 86 of file dlgFilesSelector.hpp.

Referenced by btnSearchAndAddClick(), and createControls().


The documentation for this class was generated from the following files:
Generated on Sun May 30 13:38:04 2004 for wxChecksums by doxygen 1.3.7