FXFileSelector.h

Go to the documentation of this file.
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,2006 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or                 *
00009 * modify it under the terms of the GNU Lesser General Public                    *
00010 * License as published by the Free Software Foundation; either                  *
00011 * version 2.1 of the License, or (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 GNU             *
00016 * Lesser General Public License for more details.                               *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public              *
00019 * License along with this library; if not, write to the Free Software           *
00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.    *
00021 *********************************************************************************
00022 * $Id: FXFileSelector.h,v 1.61 2006/01/23 15:51:05 fox Exp $                    *
00023 ********************************************************************************/
00024 #ifndef FX_DISABLEFILEDIRDIALOGS
00025 
00026 #ifndef FXFILESELECTOR_H
00027 #define FXFILESELECTOR_H
00028 
00029 #ifndef FXPACKER_H
00030 #include "FXPacker.h"
00031 #endif
00032 
00033 namespace FX {
00034 
00035 class FXFileList;
00036 class FXTextField;
00037 class FXComboBox;
00038 class FXDirBox;
00039 class FXButton;
00040 class FXMenuButton;
00041 class FXIcon;
00042 class FXMenuPane;
00043 class FXCheckButton;
00044 class FXMatrix;
00045 class FXHorizontalFrame;
00046 
00047 
00049 enum {
00050   SELECTFILE_ANY,             
00051   SELECTFILE_EXISTING,        
00052   SELECTFILE_MULTIPLE,        
00053   SELECTFILE_MULTIPLE_ALL,    
00054   SELECTFILE_DIRECTORY        
00055   };
00056 
00057 
00059 class FXAPI FXFileSelector : public FXPacker {
00060   FXDECLARE(FXFileSelector)
00061 protected:
00062   FXFileList        *filebox;           // File list widget
00063   FXTextField       *filename;          // File name entry field
00064   FXComboBox        *filefilter;        // Combobox for pattern list
00065   FXMenuPane        *bookmarkmenu;      // Menu for bookmarks
00066   FXHorizontalFrame *navbuttons;        // Navigation buttons
00067   FXHorizontalFrame *fileboxframe;      // Frame around file list
00068   FXMatrix          *entryblock;        // Entry block
00069   FXCheckButton     *readonly;          // Open file as read only
00070   FXDirBox          *dirbox;            // Directory hierarchy list
00071   FXButton          *accept;            // Accept button
00072   FXButton          *cancel;            // Cancel button
00073   FXIcon            *updiricon;         // Up directory icon
00074   FXIcon            *listicon;          // List mode icon
00075   FXIcon            *detailicon;        // Detail mode icon
00076   FXIcon            *iconsicon;         // Icon mode icon
00077   FXIcon            *homeicon;          // Go home icon
00078   FXIcon            *workicon;          // Go home icon
00079   FXIcon            *shownicon;         // Files shown icon
00080   FXIcon            *hiddenicon;        // Files hidden icon
00081   FXIcon            *markicon;          // Book mark icon
00082   FXIcon            *clearicon;         // Book clear icon
00083   FXIcon            *newicon;           // New directory icon
00084   FXIcon            *deleteicon;        // Delete file icon
00085   FXIcon            *moveicon;          // Rename file icon
00086   FXIcon            *copyicon;          // Copy file icon
00087   FXIcon            *linkicon;          // Link file icon
00088   FXRecentFiles      bookmarks;         // Bookmarked places
00089   FXuint             selectmode;        // Select mode
00090   FXbool             navigable;         // May navigate
00091 protected:
00092   FXFileSelector(){}
00093   FXString *getSelectedFiles() const;
00094   FXString *getSelectedFilesOnly() const;
00095 private:
00096   FXFileSelector(const FXFileSelector&);
00097   FXFileSelector &operator=(const FXFileSelector&);
00098 public:
00099   long onCmdAccept(FXObject*,FXSelector,void*);
00100   long onCmdFilter(FXObject*,FXSelector,void*);
00101   long onCmdItemDblClicked(FXObject*,FXSelector,void*);
00102   long onCmdItemSelected(FXObject*,FXSelector,void*);
00103   long onCmdItemDeselected(FXObject*,FXSelector,void*);
00104   long onCmdDirectoryUp(FXObject*,FXSelector,void*);
00105   long onUpdDirectoryUp(FXObject*,FXSelector,void*);
00106   long onCmdDirTree(FXObject*,FXSelector,void*);
00107   long onCmdHome(FXObject*,FXSelector,void*);
00108   long onCmdWork(FXObject*,FXSelector,void*);
00109   long onCmdBookmark(FXObject*,FXSelector,void*);
00110   long onCmdVisit(FXObject*,FXSelector,void*);
00111   long onCmdNew(FXObject*,FXSelector,void*);
00112   long onUpdNew(FXObject*,FXSelector,void*);
00113   long onCmdMove(FXObject*,FXSelector,void*);
00114   long onCmdCopy(FXObject*,FXSelector,void*);
00115   long onCmdLink(FXObject*,FXSelector,void*);
00116   long onCmdDelete(FXObject*,FXSelector,void*);
00117   long onUpdSelected(FXObject*,FXSelector,void*);
00118   long onPopupMenu(FXObject*,FXSelector,void*);
00119   long onCmdImageSize(FXObject*,FXSelector,void*);
00120   long onUpdImageSize(FXObject*,FXSelector,void*);
00121   long onUpdNavigable(FXObject*,FXSelector,void*);
00122 public:
00123   enum {
00124     ID_FILEFILTER=FXPacker::ID_LAST,
00125     ID_ACCEPT,
00126     ID_FILELIST,
00127     ID_DIRECTORY_UP,
00128     ID_DIRTREE,
00129     ID_NORMAL_SIZE,
00130     ID_MEDIUM_SIZE,
00131     ID_GIANT_SIZE,
00132     ID_HOME,
00133     ID_WORK,
00134     ID_BOOKMARK,
00135     ID_BOOKMENU,
00136     ID_VISIT,
00137     ID_NEW,
00138     ID_DELETE,
00139     ID_MOVE,
00140     ID_COPY,
00141     ID_LINK,
00142     ID_LAST
00143     };
00144 public:
00145 
00147   FXFileSelector(FXComposite *p,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
00148 
00150   FXButton *acceptButton() const { return accept; }
00151 
00153   FXButton *cancelButton() const { return cancel; }
00154 
00156   void setFilename(const FXString& path);
00157 
00159   FXString getFilename() const;
00160 
00166   FXString* getFilenames() const;
00167 
00169   void setPattern(const FXString& ptrn);
00170 
00172   FXString getPattern() const;
00173 
00188   void setPatternList(const FXString& patterns);
00189 
00191   FXString getPatternList() const;
00192 
00197   void setCurrentPattern(FXint n);
00198 
00200   FXint getCurrentPattern() const;
00201 
00203   FXString getPatternText(FXint patno) const;
00204 
00206   void setPatternText(FXint patno,const FXString& text);
00207 
00209   FXint getNumPatterns() const;
00210 
00212   void allowPatternEntry(FXbool allow);
00213 
00215   FXbool allowPatternEntry() const;
00216 
00223   static FXString patternFromText(const FXString& pattern);
00224 
00230   static FXString extensionFromPattern(const FXString& pattern);
00231 
00233   void setDirectory(const FXString& path);
00234 
00236   FXString getDirectory() const;
00237 
00239   void setItemSpace(FXint s);
00240 
00242   FXint getItemSpace() const;
00243 
00245   void setFileBoxStyle(FXuint style);
00246 
00248   FXuint getFileBoxStyle() const;
00249 
00251   void setSelectMode(FXuint mode);
00252 
00254   FXuint getSelectMode() const { return selectmode; }
00255 
00257   void setMatchMode(FXuint mode);
00258 
00260   FXuint getMatchMode() const;
00261 
00263   FXbool showHiddenFiles() const;
00264 
00266   void showHiddenFiles(FXbool showing);
00267 
00269   FXbool showImages() const;
00270 
00272   void showImages(FXbool showing);
00273 
00275   FXint getImageSize() const;
00276 
00278   void setImageSize(FXint size);
00279 
00281   void showReadOnly(FXbool show);
00282 
00284   FXbool shownReadOnly() const;
00285 
00287   void setReadOnly(FXbool state);
00288 
00290   FXbool getReadOnly() const;
00291 
00293   void allowNavigation(FXbool flag){ navigable=flag; }
00294 
00296   FXbool allowNavigation() const { return navigable; }
00297 
00299   virtual void save(FXStream& store) const;
00300 
00302   virtual void load(FXStream& store);
00303 
00305   virtual ~FXFileSelector();
00306   };
00307 
00308 }
00309 
00310 #endif
00311 #endif

(C) 2002-2009 Niall Douglas. Some parts (C) to assorted authors.
Generated on Fri Nov 20 18:31:21 2009 for TnFOX by doxygen v1.4.7