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

FXFileDialog.h

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,2002 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.18 2002/01/18 22:42:53 jeroen Exp $                   *
00023 ********************************************************************************/
00024 #ifndef FXFILEDIALOG_H
00025 #define FXFILEDIALOG_H
00026 
00027 #ifndef FXDIALOGBOX_H
00028 #include "FXDialogBox.h"
00029 #endif
00030 
00031 
00032 
00033 class FXFileSelector;
00034 
00035 
00036 /// File selection dialog
00037 class FXAPI FXFileDialog : public FXDialogBox {
00038   FXDECLARE(FXFileDialog)
00039 protected:
00040   FXFileSelector *filebox;
00041 protected:
00042   FXFileDialog(){}
00043 private:
00044   FXFileDialog(const FXFileDialog&);
00045   FXFileDialog &operator=(const FXFileDialog&);
00046 public:
00047 
00048   /// Construct File Dialog Box
00049   FXFileDialog(FXWindow* owner,const FXString& name,FXuint opts=0,FXint x=0,FXint y=0,FXint w=500,FXint h=300);
00050 
00051   /// Change file name
00052   void setFilename(const FXString& path);
00053 
00054   /// Return file name, if any
00055   FXString getFilename() const;
00056 
00057   /// Return empty-string terminated list of selected file names, or NULL if none selected
00058   FXString* getFilenames() const;
00059 
00060   /// Change file pattern
00061   void setPattern(const FXString& ptrn);
00062 
00063   /// Return file pattern
00064   FXString getPattern() const;
00065 
00066   /**
00067   * Change the list of file patterns shown in the file dialog.
00068   * Each pattern comprises an optional name, followed by a pattern in
00069   * parentheses.  The patterns are separated by newlines.
00070   * For example,
00071   *
00072   *  "*\n*.cpp,*.cc\n*.hpp,*.hh,*.h"
00073   *
00074   * and
00075   *
00076   *  "All Files (*)\nC++ Sources (*.cpp,*.cc)\nC++ Headers (*.hpp,*.hh,*.h)"
00077   *
00078   * will set the same three patterns, but the former shows no pattern names.
00079   */
00080   void setPatternList(const FXString& patterns);
00081 
00082   /**
00083   * Set list of patterns as name,pattern pairs.
00084   * The list should be terminated with a final NULL string.
00085   * (DEPRECATED)
00086   */
00087   void setPatternList(const FXchar **ptrns);
00088 
00089   /// Return list of patterns
00090   FXString getPatternList() const;
00091 
00092   /**
00093   * After setting the list of patterns, this call will
00094   * initially select pattern n as the active one.
00095   */
00096   void setCurrentPattern(FXint n);
00097 
00098   /// Return current pattern number
00099   FXint getCurrentPattern() const;
00100 
00101   /// Get pattern text for given pattern number
00102   FXString getPatternText(FXint patno) const;
00103 
00104   /// Change pattern text for pattern number
00105   void setPatternText(FXint patno,const FXString& text);
00106 
00107   /// Change directory
00108   void setDirectory(const FXString& path);
00109 
00110   /// Return directory
00111   FXString getDirectory() const;
00112 
00113   /// Set the inter-item spacing (in pixels)
00114   void setItemSpace(FXint s);
00115 
00116   /// Return the inter-item spacing (in pixels)
00117   FXint getItemSpace() const;
00118 
00119   /// Change File List style
00120   void setFileBoxStyle(FXuint style);
00121 
00122   /// Return File List style
00123   FXuint getFileBoxStyle() const;
00124 
00125   /// Change file selection mode
00126   void setSelectMode(FXuint mode);
00127 
00128   /// Return file selection mode
00129   FXuint getSelectMode() const;
00130 
00131   /// Show readonly button
00132   void showReadOnly(FXbool show);
00133 
00134   /// Return TRUE if readonly is shown
00135   FXbool shownReadOnly() const;
00136 
00137   /// Set initial state of readonly button
00138   void setReadOnly(FXbool state);
00139 
00140   /// Get readonly state
00141   FXbool getReadOnly() const;
00142 
00143   /// Open existing filename
00144   static FXString getOpenFilename(FXWindow* owner,const FXString& caption,const FXString& path,const FXString& patterns="*",FXint initial=0);
00145 
00146   /// Open multiple existing files
00147   static FXString* getOpenFilenames(FXWindow* owner,const FXString& caption,const FXString& path,const FXString& patterns="*",FXint initial=0);
00148 
00149   /// Save to filename
00150   static FXString getSaveFilename(FXWindow* owner,const FXString& caption,const FXString& path,const FXString& patterns="*",FXint initial=0);
00151 
00152   /// Open directory name
00153   static FXString getOpenDirectory(FXWindow* owner,const FXString& caption,const FXString& path);
00154 
00155   /// Save to stream
00156   virtual void save(FXStream& store) const;
00157 
00158   /// Load from stream
00159   virtual void load(FXStream& store);
00160 
00161   /// Destructor
00162   virtual ~FXFileDialog();
00163   };
00164 
00165 
00166 #endif