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

FXFileDialog.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                   F i l e   S e l e c t i o n   D i a l o g                   *
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: FXFileDialog.h,v 1.34 2006/01/23 06:03:15 fox Exp $                      *
00023 ********************************************************************************/
00024 #ifndef FXFILEDIALOG_H
00025 #define FXFILEDIALOG_H
00026 
00027 #ifndef FXDIALOGBOX_H
00028 #include "FXDialogBox.h"
00029 #endif
00030 
00031 namespace FX {
00032 
00033 
00034 class FXFileSelector;
00035 
00036 
00037 /// File selection dialog
00038 class FXAPI FXFileDialog : public FXDialogBox {
00039   FXDECLARE(FXFileDialog)
00040 protected:
00041   FXFileSelector *filebox;
00042 protected:
00043   FXFileDialog(){}
00044   void initdialog();
00045 private:
00046   FXFileDialog(const FXFileDialog&);
00047   FXFileDialog &operator=(const FXFileDialog&);
00048 public:
00049 
00050   /// Construct file dialog box
00051   FXFileDialog(FXWindow* owner,const FXString& name,FXuint opts=0,FXint x=0,FXint y=0,FXint w=500,FXint h=300);
00052 
00053   /// Construct free-floating file dialog box
00054   FXFileDialog(FXApp* a,const FXString& name,FXuint opts=0,FXint x=0,FXint y=0,FXint w=500,FXint h=300);
00055 
00056   /// Hide this window
00057   virtual void hide();
00058 
00059   /// Change file name
00060   void setFilename(const FXString& path);
00061 
00062   /// Return file name, if any
00063   FXString getFilename() const;
00064 
00065   /// Return empty-string terminated list of selected file names, or NULL if none selected
00066   FXString* getFilenames() const;
00067 
00068   /// Change file pattern
00069   void setPattern(const FXString& ptrn);
00070 
00071   /// Return file pattern
00072   FXString getPattern() const;
00073 
00074   /**
00075   * Change the list of file patterns shown in the file dialog.
00076   * Each pattern comprises an optional name, followed by a pattern in
00077   * parentheses.  The patterns are separated by newlines.
00078   * For example,
00079   *
00080   *  "*\n*.cpp,*.cc\n*.hpp,*.hh,*.h"
00081   *
00082   * and
00083   *
00084   *  "All Files (*)\nC++ Sources (*.cpp,*.cc)\nC++ Headers (*.hpp,*.hh,*.h)"
00085   *
00086   * will set the same three patterns, but the former shows no pattern names.
00087   */
00088   void setPatternList(const FXString& patterns);
00089 
00090   /// Return list of patterns
00091   FXString getPatternList() const;
00092 
00093   /**
00094   * After setting the list of patterns, this call will
00095   * initially select pattern n as the active one.
00096   */
00097   void setCurrentPattern(FXint n);
00098 
00099   /// Return current pattern number
00100   FXint getCurrentPattern() const;
00101 
00102   /// Get pattern text for given pattern number
00103   FXString getPatternText(FXint patno) const;
00104 
00105   /// Change pattern text for pattern number
00106   void setPatternText(FXint patno,const FXString& text);
00107 
00108   /// Return number of patterns
00109   FXint getNumPatterns() const;
00110 
00111   /// Allow pattern entry
00112   void allowPatternEntry(FXbool allow);
00113 
00114   /// Return TRUE if pattern entry is allowed
00115   FXbool allowPatternEntry() const;
00116 
00117   /// Change directory
00118   void setDirectory(const FXString& path);
00119 
00120   /// Return directory
00121   FXString getDirectory() const;
00122 
00123   /// Set the inter-item spacing (in pixels)
00124   void setItemSpace(FXint s);
00125 
00126   /// Return the inter-item spacing (in pixels)
00127   FXint getItemSpace() const;
00128 
00129   /// Change file selection mode
00130   void setSelectMode(FXuint mode);
00131 
00132   /// Return file selection mode
00133   FXuint getSelectMode() const;
00134 
00135   /// Change wildcard matching mode
00136   void setMatchMode(FXuint mode);
00137 
00138   /// Return wildcard matching mode
00139   FXuint getMatchMode() const;
00140 
00141   /// Return TRUE if showing hidden files
00142   FXbool showHiddenFiles() const;
00143 
00144   /// Show or hide hidden files
00145   void showHiddenFiles(FXbool showing);
00146 
00147   /// Return TRUE if image preview on
00148   FXbool showImages() const;
00149 
00150   /// Show or hide preview images
00151   void showImages(FXbool showing);
00152 
00153   /// Return images preview size
00154   FXint getImageSize() const;
00155 
00156   /// Change images preview size
00157   void setImageSize(FXint size);
00158 
00159   /// Show readonly button
00160   void showReadOnly(FXbool show);
00161 
00162   /// Return TRUE if readonly is shown
00163   FXbool shownReadOnly() const;
00164 
00165   /// Set initial state of readonly button
00166   void setReadOnly(FXbool state);
00167 
00168   /// Get readonly state
00169   FXbool getReadOnly() const;
00170 
00171   /// Change File List style
00172   void setFileBoxStyle(FXuint style);
00173 
00174   /// Return File List style
00175   FXuint getFileBoxStyle() const;
00176 
00177   /// Allow or disallow navigation
00178   void allowNavigation(FXbool navigable);
00179   
00180   /// Is navigation allowed?
00181   FXbool allowNavigation() const;
00182 
00183   /// Open existing filename
00184   static FXString getOpenFilename(FXWindow* owner,const FXString& caption,const FXString& path,const FXString& patterns="*",FXint initial=0);
00185 
00186   /// Open multiple existing files
00187   static FXString* getOpenFilenames(FXWindow* owner,const FXString& caption,const FXString& path,const FXString& patterns="*",FXint initial=0);
00188 
00189   /// Save to filename
00190   static FXString getSaveFilename(FXWindow* owner,const FXString& caption,const FXString& path,const FXString& patterns="*",FXint initial=0);
00191 
00192   /// Open directory name
00193   static FXString getOpenDirectory(FXWindow* owner,const FXString& caption,const FXString& path);
00194 
00195   /// Save to stream
00196   virtual void save(FXStream& store) const;
00197 
00198   /// Load from stream
00199   virtual void load(FXStream& store);
00200 
00201   /// Destructor
00202   virtual ~FXFileDialog();
00203   };
00204 
00205 }
00206 
00207 #endif

Copyright © 1997-2005 Jeroen van der Zijp