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

FXFileDialog.h
Go to the documentation of this file.
1 /********************************************************************************
2 * *
3 * F i l e S e l e c t i o n D i a l o g *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1998,2006 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or *
9 * modify it under the terms of the GNU Lesser General Public *
10 * License as published by the Free Software Foundation; either *
11 * version 2.1 of the License, or (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
16 * Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public *
19 * License along with this library; if not, write to the Free Software *
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
21 *********************************************************************************
22 * $Id: FXFileDialog.h,v 1.34 2006/01/23 06:03:15 fox Exp $ *
23 ********************************************************************************/
24 #ifndef FXFILEDIALOG_H
25 #define FXFILEDIALOG_H
26 
27 #ifndef FXDIALOGBOX_H
28 #include "FXDialogBox.h"
29 #endif
30 
31 namespace FX {
32 
33 
34 class FXFileSelector;
35 
36 
37 /// File selection dialog
38 class FXAPI FXFileDialog : public FXDialogBox {
40 protected:
41  FXFileSelector *filebox;
42 protected:
43  FXFileDialog(){}
44  void initdialog();
45 private:
46  FXFileDialog(const FXFileDialog&);
47  FXFileDialog &operator=(const FXFileDialog&);
48 public:
49 
50  /// Construct file dialog box
51  FXFileDialog(FXWindow* owner,const FXString& name,FXuint opts=0,FXint x=0,FXint y=0,FXint w=500,FXint h=300);
52 
53  /// Construct free-floating file dialog box
54  FXFileDialog(FXApp* a,const FXString& name,FXuint opts=0,FXint x=0,FXint y=0,FXint w=500,FXint h=300);
55 
56  /// Hide this window
57  virtual void hide();
58 
59  /// Change file name
60  void setFilename(const FXString& path);
61 
62  /// Return file name, if any
63  FXString getFilename() const;
64 
65  /// Return empty-string terminated list of selected file names, or NULL if none selected
66  FXString* getFilenames() const;
67 
68  /// Change file pattern
69  void setPattern(const FXString& ptrn);
70 
71  /// Return file pattern
72  FXString getPattern() const;
73 
74  /**
75  * Change the list of file patterns shown in the file dialog.
76  * Each pattern comprises an optional name, followed by a pattern in
77  * parentheses. The patterns are separated by newlines.
78  * For example,
79  *
80  * "*\n*.cpp,*.cc\n*.hpp,*.hh,*.h"
81  *
82  * and
83  *
84  * "All Files (*)\nC++ Sources (*.cpp,*.cc)\nC++ Headers (*.hpp,*.hh,*.h)"
85  *
86  * will set the same three patterns, but the former shows no pattern names.
87  */
88  void setPatternList(const FXString& patterns);
89 
90  /// Return list of patterns
91  FXString getPatternList() const;
92 
93  /**
94  * After setting the list of patterns, this call will
95  * initially select pattern n as the active one.
96  */
97  void setCurrentPattern(FXint n);
98 
99  /// Return current pattern number
100  FXint getCurrentPattern() const;
101 
102  /// Get pattern text for given pattern number
103  FXString getPatternText(FXint patno) const;
104 
105  /// Change pattern text for pattern number
106  void setPatternText(FXint patno,const FXString& text);
107 
108  /// Return number of patterns
109  FXint getNumPatterns() const;
110 
111  /// Allow pattern entry
112  void allowPatternEntry(FXbool allow);
113 
114  /// Return TRUE if pattern entry is allowed
115  FXbool allowPatternEntry() const;
116 
117  /// Change directory
118  void setDirectory(const FXString& path);
119 
120  /// Return directory
121  FXString getDirectory() const;
122 
123  /// Set the inter-item spacing (in pixels)
124  void setItemSpace(FXint s);
125 
126  /// Return the inter-item spacing (in pixels)
127  FXint getItemSpace() const;
128 
129  /// Change file selection mode
130  void setSelectMode(FXuint mode);
131 
132  /// Return file selection mode
133  FXuint getSelectMode() const;
134 
135  /// Change wildcard matching mode
136  void setMatchMode(FXuint mode);
137 
138  /// Return wildcard matching mode
139  FXuint getMatchMode() const;
140 
141  /// Return TRUE if showing hidden files
142  FXbool showHiddenFiles() const;
143 
144  /// Show or hide hidden files
145  void showHiddenFiles(FXbool showing);
146 
147  /// Return TRUE if image preview on
148  FXbool showImages() const;
149 
150  /// Show or hide preview images
151  void showImages(FXbool showing);
152 
153  /// Return images preview size
154  FXint getImageSize() const;
155 
156  /// Change images preview size
157  void setImageSize(FXint size);
158 
159  /// Show readonly button
160  void showReadOnly(FXbool show);
161 
162  /// Return TRUE if readonly is shown
163  FXbool shownReadOnly() const;
164 
165  /// Set initial state of readonly button
166  void setReadOnly(FXbool state);
167 
168  /// Get readonly state
169  FXbool getReadOnly() const;
170 
171  /// Change File List style
172  void setFileBoxStyle(FXuint style);
173 
174  /// Return File List style
175  FXuint getFileBoxStyle() const;
176 
177  /// Allow or disallow navigation
178  void allowNavigation(FXbool navigable);
179 
180  /// Is navigation allowed?
181  FXbool allowNavigation() const;
182 
183  /// Open existing filename
184  static FXString getOpenFilename(FXWindow* owner,const FXString& caption,const FXString& path,const FXString& patterns="*",FXint initial=0);
185 
186  /// Open multiple existing files
187  static FXString* getOpenFilenames(FXWindow* owner,const FXString& caption,const FXString& path,const FXString& patterns="*",FXint initial=0);
188 
189  /// Save to filename
190  static FXString getSaveFilename(FXWindow* owner,const FXString& caption,const FXString& path,const FXString& patterns="*",FXint initial=0);
191 
192  /// Open directory name
193  static FXString getOpenDirectory(FXWindow* owner,const FXString& caption,const FXString& path);
194 
195  /// Save to stream
196  virtual void save(FXStream& store) const;
197 
198  /// Load from stream
199  virtual void load(FXStream& store);
200 
201  /// Destructor
202  virtual ~FXFileDialog();
203  };
204 
205 }
206 
207 #endif
DialogBox window.
Definition: FXDialogBox.h:40
Base class for all windows.
Definition: FXWindow.h:115
unsigned int FXuint
Definition: fxdefs.h:389
#define FXAPI
Definition: fxdefs.h:122
File selection dialog.
Definition: FXFileDialog.h:38
FXuchar FXbool
Definition: fxdefs.h:386
Application Object.
Definition: FXApp.h:158
FXString name(const FXString &file)
Return name and extension part of the path name.
A stream is a way to serialize data and objects into a byte stream.
Definition: FXStream.h:99
Definition: FX4Splitter.h:31
int FXint
Definition: fxdefs.h:390
#define FXDECLARE(classname)
Macro to set up class declaration.
Definition: FXObject.h:92
File selection widget.
Definition: FXFileSelector.h:65
FXString provides essential string manipulation capabilities.
Definition: FXString.h:33

Copyright © 1997-2005 Jeroen van der Zijp