2002-08-13 Joe Shaw <joe@assbarn.com>

* configure.in: Check for libgnomecanvas.

	* gtk/ColorSelectionDialog.custom: Create a button subclass which
	contains a reference to the parent ColorSelectionDialog.  Modify
	properties to return this subclass instead of a regular
	Gtk.Button.

	* gtk/FileSelection.custom: Ditto.

	* sample/test/TestFileSelection.cs (file_selection_ok):
	Demonstrate the button subclass by destroying the parent dialog
	when the ok button is clicked.

svn path=/trunk/gtk-sharp/; revision=6610
This commit is contained in:
Joe Shaw 2002-08-13 14:01:14 +00:00
parent e6ea0015b5
commit e14ce485dc
5 changed files with 56 additions and 13 deletions

View file

@ -1,3 +1,18 @@
2002-08-13 Joe Shaw <joe@assbarn.com>
* configure.in: Check for libgnomecanvas.
* gtk/ColorSelectionDialog.custom: Create a button subclass which
contains a reference to the parent ColorSelectionDialog. Modify
properties to return this subclass instead of a regular
Gtk.Button.
* gtk/FileSelection.custom: Ditto.
* sample/test/TestFileSelection.cs (file_selection_ok):
Demonstrate the button subclass by destroying the parent dialog
when the ok button is clicked.
2002-08-12 Rachel Hestilow <hestilow@ximian.com>
[ Patch from Ricardo Fernandez Pascual <rfp1@ono.com> for

View file

@ -61,7 +61,7 @@ AC_ARG_WITH(crosspkgdir, [ --with-crosspkgdir=/path/to/pkg-config/dir],
## Versions of dependencies
GNOME_REQUIRED_VERSION=2.0.0
GTK_REQUIRED_VERSION=2.0.0
PKG_CHECK_MODULES(BASE_DEPENDENCIES, libgnomeui-2.0 >= $GNOME_REQUIRED_VERSION gtk+-2.0 >= $GTK_REQUIRED_VERSION gmodule-2.0 >= $GTK_REQUIRED_VERSION, enable_gnome=yes, enable_gnome=no)
PKG_CHECK_MODULES(BASE_DEPENDENCIES, libgnomecanvas-2.0 >= $GNOME_REQUIRED_VERSION libgnomeui-2.0 >= $GNOME_REQUIRED_VERSION gtk+-2.0 >= $GTK_REQUIRED_VERSION gmodule-2.0 >= $GTK_REQUIRED_VERSION, enable_gnome=yes, enable_gnome=no)
if test "x$enable_gnome" = "xno"; then
PKG_CHECK_MODULES(BASE_DEPENDENCIES, gtk+-2.0 >= $GTK_REQUIRED_VERSION gmodule-2.0 >= $GTK_REQUIRED_VERSION)

View file

@ -8,6 +8,18 @@
// This code is inserted after the automatically generated code.
//
public class Button : Gtk.Button {
private ColorSelectionDialog color_sel;
public ColorSelectionDialog ColorSelectionDialog {
get { return color_sel; }
}
public Button (ColorSelectionDialog cs, IntPtr raw) : base (raw) {
color_sel = cs;
}
}
[DllImport("gtksharpglue")]
static extern IntPtr gtksharp_color_selection_dialog_get_colorsel (IntPtr i);
public Gtk.ColorSelection ColorSelection {
@ -17,17 +29,17 @@ public Gtk.ColorSelection ColorSelection {
[DllImport("gtksharpglue")]
static extern IntPtr gtksharp_color_selection_dialog_get_ok_button (IntPtr i);
public Gtk.Button OkButton {
get { return new Gtk.Button (gtksharp_color_selection_dialog_get_ok_button (this.Handle)); }
get { return new Button (this, gtksharp_color_selection_dialog_get_ok_button (this.Handle)); }
}
[DllImport("gtksharpglue")]
static extern IntPtr gtksharp_color_selection_dialog_get_cancel_button (IntPtr i);
public Gtk.Button CancelButton {
get { return new Gtk.Button (gtksharp_color_selection_dialog_get_cancel_button (this.Handle)); }
get { return new Button (this, gtksharp_color_selection_dialog_get_cancel_button (this.Handle)); }
}
[DllImport("gtksharpglue")]
static extern IntPtr gtksharp_color_selection_dialog_get_help_button (IntPtr i);
public Gtk.Button HelpButton {
get { return new Gtk.Button (gtksharp_color_selection_dialog_get_help_button (this.Handle)); }
get { return new Button (this, gtksharp_color_selection_dialog_get_help_button (this.Handle)); }
}

View file

@ -2,12 +2,25 @@
// Gtk.FileSelection.custom - Gtk FileSelection class customizations
//
// Author: Duncan Mak (duncan@ximian.com)
// Joe Shaw (joe@ximian.com)
//
// Copyright (C) 2002 Ximian, Inc.
//
// This code is inserted after the automatically generated code.
//
public class Button : Gtk.Button {
private FileSelection file_sel;
public FileSelection FileSelection {
get { return file_sel; }
}
public Button (FileSelection fs, IntPtr raw) : base (raw) {
file_sel = fs;
}
}
[DllImport("gtksharpglue")]
static extern IntPtr gtksharp_file_selection_get_dir_list (IntPtr i);
public Gtk.TreeView DirList {
@ -35,19 +48,19 @@ public Gtk.Label SelectionText {
[DllImport("gtksharpglue")]
static extern IntPtr gtksharp_file_selection_get_ok_button (IntPtr i);
public Gtk.Button OkButton {
get { return new Gtk.Button (gtksharp_file_selection_get_ok_button (this.Handle)); }
get { return new Button (this, gtksharp_file_selection_get_ok_button (this.Handle)); }
}
[DllImport("gtksharpglue")]
static extern IntPtr gtksharp_file_selection_get_cancel_button (IntPtr i);
public Gtk.Button CancelButton {
get { return new Gtk.Button (gtksharp_file_selection_get_cancel_button (this.Handle)); }
get { return new Button (this, gtksharp_file_selection_get_cancel_button (this.Handle)); }
}
[DllImport("gtksharpglue")]
static extern IntPtr gtksharp_file_selection_get_help_button (IntPtr i);
public Gtk.Button HelpButton {
get { return new Gtk.Button (gtksharp_file_selection_get_help_button (this.Handle)); }
get { return new Button (this, gtksharp_file_selection_get_help_button (this.Handle)); }
}
[DllImport("gtksharpglue")]
@ -85,19 +98,19 @@ public string FileopFile {
[DllImport("gtksharpglue")]
static extern IntPtr gtksharp_file_selection_get_fileop_c_dir (IntPtr i);
public Gtk.Button FileopCDir {
get { return new Gtk.Button (gtksharp_file_selection_get_fileop_c_dir(this.Handle)); }
get { return new Button (this, gtksharp_file_selection_get_fileop_c_dir(this.Handle)); }
}
[DllImport("gtksharpglue")]
static extern IntPtr gtksharp_file_selection_get_fileop_del_file (IntPtr i);
public Gtk.Button FileopDelFile {
get { return new Gtk.Button (gtksharp_file_selection_get_fileop_del_file (this.Handle)); }
get { return new Button (this, gtksharp_file_selection_get_fileop_del_file (this.Handle)); }
}
[DllImport("gtksharpglue")]
static extern IntPtr gtksharp_file_selection_get_fileop_ren_file (IntPtr i);
public Gtk.Button FileopRenFile {
get { return new Gtk.Button (gtksharp_file_selection_get_fileop_ren_file (this.Handle)); }
get { return new Button (this, gtksharp_file_selection_get_fileop_ren_file (this.Handle)); }
}
[DllImport("gtksharpglue")]
@ -111,6 +124,3 @@ static extern IntPtr gtksharp_file_selection_get_action_area (IntPtr i);
public new Gtk.HButtonBox ActionArea {
get { return new Gtk.HButtonBox (gtksharp_file_selection_get_action_area (this.Handle)); }
}

View file

@ -39,6 +39,12 @@ namespace WidgetViewer {
static void file_selection_ok (object o, EventArgs args)
{
Gtk.FileSelection.Button fsbutton = (Gtk.FileSelection.Button) o;
Console.WriteLine ("ok button clicked!");
fsbutton.FileSelection.Destroy ();
}
static void show_fileops (object o, EventArgs args)