moved 2.1-staging to trunk @ rev 1765
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / fileselection.h
1 // -*- c++ -*-
2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _GTKMM_FILESELECTION_H
4 #define _GTKMM_FILESELECTION_H
5
6 #ifndef GTKMM_DISABLE_DEPRECATED
7
8
9 #include <glibmm.h>
10
11 /* $Id$ */
12
13
14 /* fileselection.h
15  * 
16  * Copyright (C) 1998-2002 The gtkmm Development Team
17  *
18  * This library is free software; you can redistribute it and/or
19  * modify it under the terms of the GNU Library General Public
20  * License as published by the Free Software Foundation; either
21  * version 2 of the License, or (at your option) any later version.
22  *
23  * This library is distributed in the hope that it will be useful,
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
26  * Library General Public License for more details.
27  *
28  * You should have received a copy of the GNU Library General Public
29  * License along with this library; if not, write to the Free
30  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
31  */
32
33 #include <gtkmm/dialog.h>
34 #include <gtkmm/button.h>
35 #include <gtkmm/entry.h>
36 #include <gtkmm/label.h>
37 #include <gtkmm/box.h>
38 #include <gtkmm/treeview.h>
39 #include <gtkmm/buttonbox.h>
40 #include <gtkmm/optionmenu.h>
41
42
43 #ifndef DOXYGEN_SHOULD_SKIP_THIS
44 typedef struct _GtkFileSelection GtkFileSelection;
45 typedef struct _GtkFileSelectionClass GtkFileSelectionClass;
46 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
47
48
49 namespace Gtk
50 { class FileSelection_Class; } // namespace Gtk
51 namespace Gtk
52 {
53
54 /** Prompt the user for a file or directory name.
55  *
56  * Gtk::FileSelection should be used to retrieve file or directory names from
57  * the user. It will create a new dialog window containing a directory list,
58  * and a file list corresponding to the current working directory. The
59  * filesystem can be navigated using the directory list or the drop-down
60  * history menu. Alternatively, the TAB key can be used to navigate using
61  * filename completion - common in text based editors such as emacs and jed.
62  *
63  * @deprecated Use the FileChooserDialog instead.
64  */
65
66 class FileSelection : public Dialog
67 {
68   public:
69 #ifndef DOXYGEN_SHOULD_SKIP_THIS
70   typedef FileSelection CppObjectType;
71   typedef FileSelection_Class CppClassType;
72   typedef GtkFileSelection BaseObjectType;
73   typedef GtkFileSelectionClass BaseClassType;
74 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
75
76   virtual ~FileSelection();
77
78 #ifndef DOXYGEN_SHOULD_SKIP_THIS
79
80 private:
81   friend class FileSelection_Class;
82   static CppClassType fileselection_class_;
83
84   // noncopyable
85   FileSelection(const FileSelection&);
86   FileSelection& operator=(const FileSelection&);
87
88 protected:
89   explicit FileSelection(const Glib::ConstructParams& construct_params);
90   explicit FileSelection(GtkFileSelection* castitem);
91
92 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
93
94 public:
95 #ifndef DOXYGEN_SHOULD_SKIP_THIS
96   static GType get_type()      G_GNUC_CONST;
97   static GType get_base_type() G_GNUC_CONST;
98 #endif
99
100   ///Provides access to the underlying C GtkObject.
101   GtkFileSelection*       gobj()       { return reinterpret_cast<GtkFileSelection*>(gobject_); }
102
103   ///Provides access to the underlying C GtkObject.
104   const GtkFileSelection* gobj() const { return reinterpret_cast<GtkFileSelection*>(gobject_); }
105
106
107 public:
108   //C++ methods used to invoke GTK+ virtual functions:
109 #ifdef GLIBMM_VFUNCS_ENABLED
110 #endif //GLIBMM_VFUNCS_ENABLED
111
112 protected:
113   //GTK+ Virtual Functions (override these to change behaviour):
114 #ifdef GLIBMM_VFUNCS_ENABLED
115 #endif //GLIBMM_VFUNCS_ENABLED
116
117   //Default Signal Handlers::
118 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
119 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
120
121
122 private:
123
124   
125 public:
126
127   FileSelection();
128   explicit FileSelection(const Glib::ustring& title);
129
130   
131   /** Sets a default path for the file requestor. If @a filename  includes a
132    * directory path, then the requestor will open with that path as its
133    * current working directory.
134    * 
135    * This has the consequence that in order to open the requestor with a 
136    * working directory and an empty filename, @a filename  must have a trailing
137    * directory separator.
138    * 
139    * The encoding of @a filename  is preferred GLib file name encoding, which
140    * may not be UTF-8. See Glib::filename_from_utf8().
141    * @param filename A string to set as the default file name.
142    */
143   void set_filename(const std::string& filename);
144
145   
146   /** This function returns the selected filename in the GLib file name
147    * encoding. To convert to UTF-8, call Glib::filename_to_utf8(). The
148    * returned string points to a statically allocated buffer and should
149    * be copied if you plan to keep it around.
150    * 
151    * If no file is selected then the selected directory path is returned.
152    * @return Currently-selected filename in the on-disk encoding.
153    */
154   std::string get_filename() const;
155
156   
157   void complete(const Glib::ustring& pattern);
158   
159   void show_fileop_buttons();
160   
161   void hide_fileop_buttons();
162
163   
164   /** Retrieves the list of file selections the user has made in the dialog box.
165    * This function is intended for use when the user can select multiple files
166    * in the file list. 
167    * 
168    * The filenames are in the GLib file name encoding. To convert to
169    * UTF-8, call Glib::filename_to_utf8() on each string.
170    * @return A newly-allocated <tt>0</tt>-terminated array of strings. Use
171    * Glib::strfreev() to free it.
172    */
173   Glib::ArrayHandle<std::string> get_selections() const;
174
175   
176   /** Sets whether the user is allowed to select multiple files in the file list.
177    * Use get_selections() to get the list of selected files.
178    * @param select_multiple Whether or not the user is allowed to select multiple
179    * files in the file list.
180    */
181   void set_select_multiple(bool select_multiple = true);
182   
183   /** Determines whether or not the user is allowed to select multiple files in
184    * the file list. See set_select_multiple().
185    * @return <tt>true</tt> if the user is allowed to select multiple files in the
186    * file list.
187    */
188   bool get_select_multiple() const;
189
190   //: Accessors
191    TreeView* get_dir_list();
192   const TreeView* get_dir_list() const;
193     TreeView* get_file_list();
194   const TreeView* get_file_list() const;
195     OptionMenu* get_history_pulldown();
196   const OptionMenu* get_history_pulldown() const;
197     Entry* get_selection_entry();
198   const Entry* get_selection_entry() const;
199     Label* get_selection_text();
200   const Label* get_selection_text() const;
201     VBox* get_main_vbox();
202   const VBox* get_main_vbox() const;
203     Button* get_ok_button();
204   const Button* get_ok_button() const;
205     Button* get_cancel_button();
206   const Button* get_cancel_button() const;
207     Button* get_help_button();
208   const Button* get_help_button() const;
209     HButtonBox* get_button_area();
210   const HButtonBox* get_button_area() const;
211     HBox* get_action_area();
212   const HBox* get_action_area() const;
213  
214   #ifdef GLIBMM_PROPERTIES_ENABLED
215 /** Whether buttons for creating/manipulating files should be displayed.
216    *
217    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
218    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
219    * the value of the property changes.
220    */
221   Glib::PropertyProxy<bool> property_show_fileops() ;
222 #endif //#GLIBMM_PROPERTIES_ENABLED
223
224 #ifdef GLIBMM_PROPERTIES_ENABLED
225 /** Whether buttons for creating/manipulating files should be displayed.
226    *
227    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
228    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
229    * the value of the property changes.
230    */
231   Glib::PropertyProxy_ReadOnly<bool> property_show_fileops() const;
232 #endif //#GLIBMM_PROPERTIES_ENABLED
233
234   #ifdef GLIBMM_PROPERTIES_ENABLED
235 /** The currently selected filename.
236    *
237    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
238    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
239    * the value of the property changes.
240    */
241   Glib::PropertyProxy<std::string> property_filename() ;
242 #endif //#GLIBMM_PROPERTIES_ENABLED
243
244 #ifdef GLIBMM_PROPERTIES_ENABLED
245 /** The currently selected filename.
246    *
247    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
248    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
249    * the value of the property changes.
250    */
251   Glib::PropertyProxy_ReadOnly<std::string> property_filename() const;
252 #endif //#GLIBMM_PROPERTIES_ENABLED
253
254   #ifdef GLIBMM_PROPERTIES_ENABLED
255 /** Whether to allow multiple files to be selected.
256    *
257    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
258    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
259    * the value of the property changes.
260    */
261   Glib::PropertyProxy<bool> property_select_multiple() ;
262 #endif //#GLIBMM_PROPERTIES_ENABLED
263
264 #ifdef GLIBMM_PROPERTIES_ENABLED
265 /** Whether to allow multiple files to be selected.
266    *
267    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
268    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
269    * the value of the property changes.
270    */
271   Glib::PropertyProxy_ReadOnly<bool> property_select_multiple() const;
272 #endif //#GLIBMM_PROPERTIES_ENABLED
273
274
275 };
276
277 } // namespace Gtk
278
279
280 namespace Glib
281 {
282   /** @relates Gtk::FileSelection
283    * @param object The C instance
284    * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
285    * @result A C++ instance that wraps this C instance.
286    */
287   Gtk::FileSelection* wrap(GtkFileSelection* object, bool take_copy = false);
288 } //namespace Glib
289
290
291 #endif // GTKMM_DISABLE_DEPRECATED
292
293
294 #endif /* _GTKMM_FILESELECTION_H */
295