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

fileselector.h

Go to the documentation of this file.
00001 /*
00002      This file is part of Advanced Strategic Command; http://www.asc-hq.de
00003      Copyright (C) 1994-1999  Martin Bickel  and  Marc Schellenberger
00004  
00005      This program is free software; you can redistribute it and/or modify
00006      it under the terms of the GNU General Public License as published by
00007      the Free Software Foundation; either version 2 of the License, or
00008      (at your option) any later version.
00009  
00010      This program is distributed in the hope that it will be useful,
00011      but WITHOUT ANY WARRANTY; without even the implied warranty of
00012      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013      GNU General Public License for more details.
00014  
00015      You should have received a copy of the GNU General Public License
00016      along with this program; see the file COPYING. If not, write to the 
00017      Free Software Foundation, Inc., 59 Temple Place, Suite 330, 
00018      Boston, MA  02111-1307  USA
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 

Generated on Tue Jun 24 01:27:41 2008 for Advanced Strategic Command by  doxygen 1.4.2