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

Copyright © 1997-2004 Jeroen van der Zijp