00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef FILESELECTOR_H
00022 #define FILESELECTOR_H
00023
00024 #include "selectionwindow.h"
00025 #include "../paradialog.h"
00026
00027 class FileInfo;
00028 class FileSelectionItemFactory;
00029
00030 class FileSelectionWindow : public ASC_PG_Dialog {
00031 ASCString filename;
00032 ASCString wildcard;
00033 bool saveFile;
00034 bool overwriteMessage;
00035 FileSelectionItemFactory* factory;
00036
00037 protected:
00038 void fileNameSelected( const ASCString& filename );
00039 void fileNameEntered( ASCString filename );
00040 public:
00041 FileSelectionWindow( PG_Widget *parent, const PG_Rect &r, const ASCString& fileWildcard, bool save, bool overwriteMessage );
00042 ASCString getFilename() { return filename; };
00043 };
00044
00045
00046 class FileSelectionItemFactory: public SelectionItemFactory {
00047 protected:
00048 typedef deallocating_vector<FileInfo*> Items;
00049 Items::iterator it;
00050
00051 private:
00052 Items items;
00053
00054 public:
00055 FileSelectionItemFactory( const ASCString& wildcard );
00056
00057 static bool comp ( const FileInfo* i1, const FileInfo* i2 );
00058
00059 void restart();
00060
00061 int getLevel( const ASCString& name );
00062
00063 SelectionWidget* spawnNextItem( PG_Widget* parent, const PG_Point& pos );
00064
00065 SigC::Signal1<void,const ASCString& > filenameSelectedMouse;
00066 SigC::Signal1<void,const ASCString& > filenameSelectedKeyb;
00067 SigC::Signal1<void,const ASCString& > filenameMarked;
00068
00069 void itemMarked( const SelectionWidget* widget );
00070
00071 void itemSelected( const SelectionWidget* widget, bool mouse );
00072 };
00073
00074 extern ASCString selectFile( const ASCString& ext, bool load, bool overwriteMessage = true );
00075
00076 #endif
00077