Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

/home/jeroen/FOX/fox/fox-1.7.33/include/FXFileSelector.h
00001 /********************************************************************************
00002 *                                                                               *
00003 *                  F i l e   S e l e c t i o n   W i d g e t                    *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 1998,2012 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or modify          *
00009 * it under the terms of the GNU Lesser General Public License as published by   *
00010 * the Free Software Foundation; either version 3 of the License, or             *
00011 * (at your option) any later version.                                           *
00012 *                                                                               *
00013 * This library is distributed in the hope that it will be useful,               *
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                 *
00016 * GNU Lesser General Public License for more details.                           *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public License      *
00019 * along with this program.  If not, see <http://www.gnu.org/licenses/>          *
00020 ********************************************************************************/
00021 #ifndef FXFILESELECTOR_H
00022 #define FXFILESELECTOR_H
00023 
00024 #ifndef FXPACKER_H
00025 #include "FXPacker.h"
00026 #endif
00027 
00028 namespace FX {
00029 
00030 class FXFileDict;
00031 class FXFileList;
00032 class FXTextField;
00033 class FXComboBox;
00034 class FXDirBox;
00035 class FXButton;
00036 class FXMenuButton;
00037 class FXIcon;
00038 class FXMenuPane;
00039 class FXCheckButton;
00040 class FXMatrix;
00041 class FXHorizontalFrame;
00042 
00043 
00045 enum {
00046   SELECTFILE_ANY,             
00047   SELECTFILE_EXISTING,        
00048   SELECTFILE_MULTIPLE,        
00049   SELECTFILE_MULTIPLE_ALL,    
00050   SELECTFILE_DIRECTORY        
00051   };
00052 
00053 
00055 class FXAPI FXFileSelector : public FXPacker {
00056   FXDECLARE(FXFileSelector)
00057 protected:
00058   FXFileList        *filebox;           // File list widget
00059   FXTextField       *filename;          // File name entry field
00060   FXComboBox        *filefilter;        // Combobox for pattern list
00061   FXMenuPane        *bookmarkmenu;      // Menu for bookmarks
00062   FXHorizontalFrame *navbuttons;        // Navigation buttons
00063   FXHorizontalFrame *fileboxframe;      // Frame around file list
00064   FXMatrix          *entryblock;        // Entry block
00065   FXCheckButton     *readonly;          // Open file as read only
00066   FXDirBox          *dirbox;            // Directory hierarchy list
00067   FXButton          *accept;            // Accept button
00068   FXButton          *cancel;            // Cancel button
00069   FXIcon            *updiricon;         // Up directory icon
00070   FXIcon            *listicon;          // List mode icon
00071   FXIcon            *detailicon;        // Detail mode icon
00072   FXIcon            *iconsicon;         // Icon mode icon
00073   FXIcon            *homeicon;          // Go home icon
00074   FXIcon            *workicon;          // Go home icon
00075   FXIcon            *shownicon;         // Files shown icon
00076   FXIcon            *hiddenicon;        // Files hidden icon
00077   FXIcon            *markicon;          // Book mark icon
00078   FXIcon            *clearicon;         // Book clear icon
00079   FXIcon            *newicon;           // New directory icon
00080   FXIcon            *renameicon;        // Rename file icon
00081   FXIcon            *copyicon;          // Copy file icon
00082   FXIcon            *moveicon;          // Rename file icon
00083   FXIcon            *linkicon;          // Link file icon
00084   FXIcon            *deleteicon;        // Delete file icon
00085   FXRecentFiles      bookmarks;         // Bookmarked places
00086   FXuint             selectmode;        // Select mode
00087   FXbool             navigable;         // May navigate
00088 protected:
00089   FXFileSelector(){}
00090   FXString *getSelectedFiles() const;
00091   FXString *getSelectedFilesOnly() const;
00092 private:
00093   FXFileSelector(const FXFileSelector&);
00094   FXFileSelector &operator=(const FXFileSelector&);
00095 public:
00096   long onCmdAccept(FXObject*,FXSelector,void*);
00097   long onCmdFilter(FXObject*,FXSelector,void*);
00098   long onCmdItemDblClicked(FXObject*,FXSelector,void*);
00099   long onCmdItemSelected(FXObject*,FXSelector,void*);
00100   long onCmdItemDeselected(FXObject*,FXSelector,void*);
00101   long onCmdDirectoryUp(FXObject*,FXSelector,void*);
00102   long onUpdDirectoryUp(FXObject*,FXSelector,void*);
00103   long onCmdDirTree(FXObject*,FXSelector,void*);
00104   long onCmdHome(FXObject*,FXSelector,void*);
00105   long onCmdWork(FXObject*,FXSelector,void*);
00106   long onCmdBookmark(FXObject*,FXSelector,void*);
00107   long onCmdVisit(FXObject*,FXSelector,void*);
00108   long onCmdNew(FXObject*,FXSelector,void*);
00109   long onUpdNew(FXObject*,FXSelector,void*);
00110   long onCmdRename(FXObject*,FXSelector,void*);
00111   long onCmdCopy(FXObject*,FXSelector,void*);
00112   long onCmdMove(FXObject*,FXSelector,void*);
00113   long onCmdLink(FXObject*,FXSelector,void*);
00114   long onCmdRemove(FXObject*,FXSelector,void*);
00115   long onUpdSelected(FXObject*,FXSelector,void*);
00116   long onPopupMenu(FXObject*,FXSelector,void*);
00117   long onCmdImageSize(FXObject*,FXSelector,void*);
00118   long onUpdImageSize(FXObject*,FXSelector,void*);
00119   long onUpdNavigable(FXObject*,FXSelector,void*);
00120 public:
00121   enum {
00122     ID_FILEFILTER=FXPacker::ID_LAST,
00123     ID_ACCEPT,
00124     ID_FILELIST,
00125     ID_DIRECTORY_UP,
00126     ID_DIRTREE,
00127     ID_NORMAL_SIZE,
00128     ID_MEDIUM_SIZE,
00129     ID_GIANT_SIZE,
00130     ID_HOME,
00131     ID_WORK,
00132     ID_BOOKMARK,
00133     ID_BOOKMENU,
00134     ID_VISIT,
00135     ID_NEW,
00136     ID_RENAME,
00137     ID_COPY,
00138     ID_MOVE,
00139     ID_LINK,
00140     ID_REMOVE,
00141     ID_LAST
00142     };
00143 public:
00144 
00146   FXFileSelector(FXComposite *p,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
00147 
00149   FXButton *acceptButton() const { return accept; }
00150 
00152   FXButton *cancelButton() const { return cancel; }
00153 
00155   void setFilename(const FXString& path);
00156 
00158   FXString getFilename() const;
00159 
00165   FXString* getFilenames() const;
00166 
00168   void setPattern(const FXString& ptrn);
00169 
00171   FXString getPattern() const;
00172 
00187   void setPatternList(const FXString& patterns);
00188 
00190   FXString getPatternList() const;
00191 
00196   void setCurrentPattern(FXint patno);
00197 
00199   FXint getCurrentPattern() const;
00200 
00202   void setPatternText(FXint patno,const FXString& text);
00203 
00205   FXString getPatternText(FXint patno) const;
00206 
00208   FXint getNumPatterns() const;
00209 
00211   void allowPatternEntry(FXbool flag);
00212 
00214   FXbool allowPatternEntry() const;
00215 
00222   static FXString patternFromText(const FXString& pattern);
00223 
00229   static FXString extensionFromPattern(const FXString& pattern);
00230 
00232   void setDirectory(const FXString& path);
00233 
00235   FXString getDirectory() const;
00236 
00238   void setItemSpace(FXint s);
00239 
00241   FXint getItemSpace() const;
00242 
00244   void setFileBoxStyle(FXuint style);
00245 
00247   FXuint getFileBoxStyle() const;
00248 
00250   void setSelectMode(FXuint mode);
00251 
00253   FXuint getSelectMode() const { return selectmode; }
00254 
00256   void setMatchMode(FXuint mode);
00257 
00259   FXuint getMatchMode() const;
00260 
00262   FXbool showHiddenFiles() const;
00263 
00265   void showHiddenFiles(FXbool flag);
00266 
00268   FXbool showImages() const;
00269 
00271   void showImages(FXbool flag);
00272 
00274   FXint getImageSize() const;
00275 
00277   void setImageSize(FXint size);
00278 
00280   void showReadOnly(FXbool flag);
00281 
00283   FXbool shownReadOnly() const;
00284 
00286   void setReadOnly(FXbool flag);
00287 
00289   FXbool getReadOnly() const;
00290 
00292   void allowNavigation(FXbool flag){ navigable=flag; }
00293 
00295   FXbool allowNavigation() const { return navigable; }
00296 
00298   void setAssociations(FXFileDict* assoc,FXbool owned=false);
00299 
00301   FXFileDict* getAssociations() const;
00302 
00304   void setDraggableFiles(FXbool flag);
00305 
00307   FXbool getDraggableFiles() const;
00308 
00310   virtual void save(FXStream& store) const;
00311 
00313   virtual void load(FXStream& store);
00314 
00316   virtual ~FXFileSelector();
00317   };
00318 
00319 }
00320 
00321 #endif

Copyright © 1997-2011 Jeroen van der Zijp