Copyright (C) 2003 Hotsprings Inc.
Distributed under the GPL
Location: www.Opensprings.org
Requirements:
- Must show current
folder
Must be able to
jump to any of the parent folders + up button
Must have most
recent used folders + back,forward buttons
Must have favorite
folders + add to favorites
Must show content
of current folder + view as selection
Must be able to
type the filename
Must be able to
type the full pathname
Must be able to
type the search pattern
Must show the deep
search result with full path
Must be able to
execute (ask the system to open) file
Description:
class FileDialogStorage is the persistent storage for the data dialog.
To instantiate a FileFindDialog you need an instance of this class as a parameter. The dialog will use this storage space for its public member data. When a dialog closes the instance of this class can be held alive if you hold another reference to it. Next time you open the dialog you can use this same (Saved) instance of the storage and therefore make the dialog resume from the place it last closed. This way you can easily keep track of all the visited folders (history), the typed in filters, search patterns and so on. Additionally you can initialize this object before the first use of the dialog to make it act as if it already knows some "favorite places".
class FileFindDialog is the main functional object in this file. It is derived of a dialog window. It uses the FileDialogStorage described above to store it's persistent data. Also it uses 2 lists (the back and forward history) which we decided not to make persistent. This class is a good example for how to use a couple of controls together to implement a more complex state machine with various components having direct user control. The "DoLayout" method overrides the virtual in dialog window and allows the dialog to reposition/resize it's component views when resized.The "PopulateDialog" method is used to create and initialize the views associated with this dialog.The "PopulateFields" adds to each view the appropriate data to render.The "RepopulateContent" has the same purpose as "PopulateFields" but only deals with those views that may change their content during the operation of the dialog. For example the "folderContent" list is repopulated every time the user enters a new folder."DialogEventBack" is called when the user pushes the "back" button. If the back history list is not empty the function goes to the previous folder in the history list."DialogEventForward" called when the user pushed the "forward button", otherwise identical to the "back" function.DialogEventUpFolder is called when the user wants to go to the parent directory.If there is such a parent folder the function will go there and remember the current folder in the back history list.DialogEventSelection is a callback function called every time the user clicks on one of the files/folders listed in the content. If it is a folder we use that event to dive into it. If it is a file we simply launch that file using the OS.DialogEventFolder is a callback function called every time the user selects a new folder from the folders combo box. DialogEventFilter is called every time the user makes a new choice for the search pattern. As a result the current folder and all its children are searched for that specific pattern and the matching filenames are loaded into the content browser.
class FilePickButtonListener is a helper object used to listen to the buttons we added to the dialog. The Apply/Ok/Cancel buttons are handled separately by the dialog window base class, we don't need to do anything on those. However for the buttons that we did add, inside the listener we do redirect the notifications to member functions inside the dialog.
class FilePickSelectionListener is a helper object used to listen to the selection of an entry in the list of files. It has proxy semantics, all it does is to redirect the notifications to member functions inside the dialog.
class MySimpleApp is similar to "DemoApplication" in "DemoHello.cpp", see the description in that file.