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