/* $Id: fileselection.hg,v 1.4 2005/11/29 16:38:10 murrayc Exp $ */


/* fileselection.h
 * 
 * Copyright (C) 1998-2002 The gtkmm Development Team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include <gtkmm/dialog.h>
#include <gtkmm/button.h>
#include <gtkmm/entry.h>
#include <gtkmm/label.h>
#include <gtkmm/box.h>
#include <gtkmm/treeview.h>
#include <gtkmm/buttonbox.h>
#include <gtkmm/optionmenu.h>
_DEFS(gtkmm,gtk)
_PINCLUDE(gtkmm/private/dialog_p.h)

namespace Gtk
{

/** Prompt the user for a file or directory name.
 *
 * Gtk::FileSelection should be used to retrieve file or directory names from
 * the user. It will create a new dialog window containing a directory list,
 * and a file list corresponding to the current working directory. The
 * filesystem can be navigated using the directory list or the drop-down
 * history menu. Alternatively, the TAB key can be used to navigate using
 * filename completion - common in text based editors such as emacs and jed.
 *
 * @deprecated Use the FileChooserDialog instead.
 */
class FileSelection : public Dialog
{
  _CLASS_GTKOBJECT(FileSelection,GtkFileSelection,GTK_FILE_SELECTION,Gtk::Dialog,GtkDialog)
  _UNMANAGEABLE
  _IS_DEPRECATED
public:

  FileSelection();
  _WRAP_CTOR(FileSelection(const Glib::ustring& title), gtk_file_selection_new)

#m4 dnl // Rarely needed -- could be used by accident if it were in convert_gtk.m4.
#m4 _CONVERSION(`const std::string&', `const gchar*', `($3).c_str()')

  _WRAP_METHOD(void set_filename(const std::string& filename), gtk_file_selection_set_filename)

#m4 dnl // This isn't in convert_gtk.m4, because usually we need to check for NULL.
#m4 _CONVERSION(`const gchar*', `std::string', `$2($3)')

  _WRAP_METHOD(std::string get_filename() const, gtk_file_selection_get_filename)

  _WRAP_METHOD(void complete(const Glib::ustring& pattern), gtk_file_selection_complete)
  _WRAP_METHOD(void show_fileop_buttons(), gtk_file_selection_show_fileop_buttons)
  _WRAP_METHOD(void hide_fileop_buttons(), gtk_file_selection_hide_fileop_buttons)

#m4 dnl // This isn't in convert_gtk.m4, since the gchar** ownership policy often differs.
#m4 _CONVERSION(`gchar**', `Glib::ArrayHandle<std::string>', `$2($3, Glib::OWNERSHIP_DEEP)')

  _WRAP_METHOD(Glib::ArrayHandle<std::string> get_selections() const, gtk_file_selection_get_selections)

  _WRAP_METHOD(void set_select_multiple(bool select_multiple = true), gtk_file_selection_set_select_multiple)
  _WRAP_METHOD(bool get_select_multiple() const, gtk_file_selection_get_select_multiple)

  //: Accessors
  _MEMBER_GET_PTR(dir_list, dir_list, TreeView*, GtkWidget*)
  _MEMBER_GET_PTR(file_list, file_list, TreeView*, GtkWidget*)
  _MEMBER_GET_PTR(history_pulldown, history_pulldown, OptionMenu*, GtkWidget*)
  _MEMBER_GET_PTR(selection_entry, selection_entry, Entry*, GtkWidget*)
  _MEMBER_GET_PTR(selection_text, selection_text, Label*, GtkWidget*)
  _MEMBER_GET_PTR(main_vbox, main_vbox, VBox*, GtkWidget*)
  _MEMBER_GET_PTR(ok_button, ok_button, Button*, GtkWidget*)
  _MEMBER_GET_PTR(cancel_button, cancel_button, Button*, GtkWidget*)
  _MEMBER_GET_PTR(help_button, help_button, Button*, GtkWidget*)
  _MEMBER_GET_PTR(button_area, button_area, HButtonBox*, GtkWidget*)
  _MEMBER_GET_PTR(action_area, action_area, HBox*, GtkWidget*)

  _WRAP_PROPERTY("show-fileops", bool)
  _WRAP_PROPERTY("filename", std::string)
  _WRAP_PROPERTY("select_multiple", bool)
};

} // namespace Gtk

