2012-08-05 14:32:41 +00:00
|
|
|
// Gtk.FileChooserDialog.cs - Gtk FileChooserDialog customizations
|
2004-10-30 03:31:43 +00:00
|
|
|
//
|
|
|
|
// Authors: Todd Berman <tberman@off.net>
|
|
|
|
// Jeroen Zwartepoorte <jeroen@xs4all.nl>
|
2005-06-23 22:28:06 +00:00
|
|
|
// Mike Kestner <mkestner@novell.com>
|
2004-10-30 03:31:43 +00:00
|
|
|
//
|
|
|
|
// Copyright (c) 2004 Todd Berman, Jeroen Zwartepoorte
|
2005-06-23 22:28:06 +00:00
|
|
|
// Copyright (c) 2005 Novell, Inc.
|
2004-10-30 03:31:43 +00:00
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of version 2 of the Lesser GNU General
|
|
|
|
// Public License as published by the Free Software Foundation.
|
|
|
|
//
|
|
|
|
// This program 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
|
|
|
|
// Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
// License along with this program; if not, write to the
|
|
|
|
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
// Boston, MA 02111-1307, USA.
|
|
|
|
|
2012-08-05 14:32:41 +00:00
|
|
|
namespace Gtk {
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
|
|
|
public partial class FileChooserDialog {
|
2004-10-30 03:31:43 +00:00
|
|
|
|
2011-02-09 22:54:12 +00:00
|
|
|
[DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
2005-03-09 20:32:24 +00:00
|
|
|
static extern IntPtr gtk_file_chooser_dialog_new(IntPtr title, IntPtr parent, int action, IntPtr nil);
|
2004-10-29 20:33:07 +00:00
|
|
|
|
2005-01-28 16:03:27 +00:00
|
|
|
public FileChooserDialog (string title, Window parent, FileChooserAction action, params object[] button_data) : base (IntPtr.Zero)
|
2004-10-29 20:33:07 +00:00
|
|
|
{
|
2004-10-30 03:31:43 +00:00
|
|
|
if (GetType () != typeof (FileChooserDialog)) {
|
|
|
|
CreateNativeObject (new string[0], new GLib.Value[0]);
|
|
|
|
Title = title;
|
|
|
|
if (parent != null)
|
2004-11-17 19:38:32 +00:00
|
|
|
TransientFor = parent;
|
2004-10-30 03:31:43 +00:00
|
|
|
Action = action;
|
2005-03-09 20:32:24 +00:00
|
|
|
} else {
|
|
|
|
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (title);
|
|
|
|
Raw = gtk_file_chooser_dialog_new (native, parent == null ? IntPtr.Zero : parent.Handle, (int)action, IntPtr.Zero);
|
|
|
|
GLib.Marshaller.Free (native);
|
|
|
|
}
|
2005-01-28 16:03:27 +00:00
|
|
|
|
|
|
|
for (int i = 0; i < button_data.Length - 1; i += 2)
|
|
|
|
AddButton ((string) button_data [i], (int) button_data [i + 1]);
|
2004-10-29 20:33:07 +00:00
|
|
|
}
|
|
|
|
|
2011-02-09 22:54:12 +00:00
|
|
|
[DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
2005-03-09 20:32:24 +00:00
|
|
|
static extern IntPtr gtk_file_chooser_dialog_new_with_backend(IntPtr title, IntPtr parent, int action, IntPtr backend, IntPtr nil);
|
2004-10-29 20:33:07 +00:00
|
|
|
|
2005-01-31 15:49:56 +00:00
|
|
|
public FileChooserDialog (string backend, string title, Window parent, FileChooserAction action, params object[] button_data) : base (IntPtr.Zero)
|
2004-10-29 20:33:07 +00:00
|
|
|
{
|
2004-10-30 03:31:43 +00:00
|
|
|
if (GetType () != typeof (FileChooserDialog)) {
|
|
|
|
CreateNativeObject (new string[] { "file-system-backend" }, new GLib.Value[] { new GLib.Value (backend) } );
|
|
|
|
Title = title;
|
|
|
|
if (parent != null)
|
2004-11-17 19:38:32 +00:00
|
|
|
TransientFor = parent;
|
2004-10-30 03:31:43 +00:00
|
|
|
Action = action;
|
2005-03-09 20:32:24 +00:00
|
|
|
} else {
|
|
|
|
IntPtr ntitle = GLib.Marshaller.StringToPtrGStrdup (title);
|
|
|
|
IntPtr nbackend = GLib.Marshaller.StringToPtrGStrdup (backend);
|
|
|
|
Raw = gtk_file_chooser_dialog_new_with_backend (ntitle, parent == null ? IntPtr.Zero : parent.Handle, (int)action, nbackend, IntPtr.Zero);
|
|
|
|
GLib.Marshaller.Free (ntitle);
|
|
|
|
GLib.Marshaller.Free (nbackend);
|
|
|
|
}
|
2005-01-28 16:03:27 +00:00
|
|
|
|
|
|
|
for (int i = 0; i < button_data.Length - 1; i += 2)
|
|
|
|
AddButton ((string) button_data [i], (int) button_data [i + 1]);
|
2004-10-29 20:33:07 +00:00
|
|
|
}
|
2012-08-05 14:32:41 +00:00
|
|
|
}
|
|
|
|
}
|