From 133a5c8715e7db7b18aa7785b2b3a85b50127b6c Mon Sep 17 00:00:00 2001 From: Mike Kestner Date: Fri, 7 May 2004 17:32:32 +0000 Subject: [PATCH] 2004-05-07 Mike Kestner * gtk/Gtk.metadata : hide some *MenuItem ctors. * gtk/CheckMenuItem.custom : implement string ctor. * gtk/ImageMenuItem.custom : implement string ctor. * gtk/MenuItem.custom : use AccelLabel. * gtk/RadioMenuItem.custom : fix string ctor for subclassing. * gtk/Makefile.am : add new customs. svn path=/trunk/gtk-sharp/; revision=26935 --- ChangeLog | 9 +++++++++ gtk/CheckMenuItem.custom | 24 ++++++++++++++++++++++++ gtk/Gtk.metadata | 6 ++++-- gtk/ImageMenuItem.custom | 25 +++++++++++++++++++++++++ gtk/Makefile.am | 2 ++ gtk/MenuItem.custom | 6 +++++- gtk/RadioMenuItem.custom | 25 +++++++++++++++++-------- 7 files changed, 86 insertions(+), 11 deletions(-) create mode 100644 gtk/CheckMenuItem.custom create mode 100644 gtk/ImageMenuItem.custom diff --git a/ChangeLog b/ChangeLog index d4e4955e7..ba4c5f2b1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2004-05-07 Mike Kestner + + * gtk/Gtk.metadata : hide some *MenuItem ctors. + * gtk/CheckMenuItem.custom : implement string ctor. + * gtk/ImageMenuItem.custom : implement string ctor. + * gtk/MenuItem.custom : use AccelLabel. + * gtk/RadioMenuItem.custom : fix string ctor for subclassing. + * gtk/Makefile.am : add new customs. + 2004-05-07 Mike Kestner * gtk/Gtk.metadata : hide some MenuItem ctors. diff --git a/gtk/CheckMenuItem.custom b/gtk/CheckMenuItem.custom new file mode 100644 index 000000000..a79b53492 --- /dev/null +++ b/gtk/CheckMenuItem.custom @@ -0,0 +1,24 @@ +// Gtk.CheckMenuItem.custom - Gtk CheckMenuItem class customizations +// +// Author: Mike Kestner +// +// Copyright (C) 2004 Novell, Inc. +// +// This code is inserted after the automatically generated code. + + [DllImport ("libgtk-win32-2.0-0.dll")] + static extern IntPtr gtk_check_menu_item_new_with_mnemonic (string label); + + public CheckMenuItem (string label) : base (IntPtr.Zero) + { + if (GetType() != typeof (CheckMenuItem)) { + CreateNativeObject (new string [0], new GLib.Value [0]); + AccelLabel al = new AccelLabel (""); + al.TextWithMnemonic = label; + al.SetAlignment (0.0f, 0.5f); + Add (al); + al.AccelWidget = this; + } + + Raw = gtk_check_menu_item_new_with_mnemonic (label); + } diff --git a/gtk/Gtk.metadata b/gtk/Gtk.metadata index a7f1d3fac..b02026d83 100644 --- a/gtk/Gtk.metadata +++ b/gtk/Gtk.metadata @@ -76,7 +76,8 @@ Left SetDisplayOptions 1 - 1 + 1 + 1 Toggle 1 1 @@ -106,7 +107,8 @@ 1 1 1 - 1 + 1 + 1 1 SurroundingDeleted 1 diff --git a/gtk/ImageMenuItem.custom b/gtk/ImageMenuItem.custom new file mode 100644 index 000000000..333c11ff9 --- /dev/null +++ b/gtk/ImageMenuItem.custom @@ -0,0 +1,25 @@ +// Gtk.ImageMenuItem.custom - Gtk ImageMenuItem class customizations +// +// Author: Mike Kestner +// +// Copyright (C) 2004 Novell, Inc. +// +// This code is inserted after the automatically generated code. + + [DllImport ("libgtk-win32-2.0-0.dll")] + static extern IntPtr gtk_image_menu_item_new_with_mnemonic (string label); + + public ImageMenuItem (string label) : base (IntPtr.Zero) + { + if (GetType() != typeof (ImageMenuItem)) { + CreateNativeObject (new string [0], new GLib.Value [0]); + AccelLabel al = new AccelLabel (""); + al.TextWithMnemonic = label; + al.SetAlignment (0.0f, 0.5f); + Add (al); + al.AccelWidget = this; + } + + Raw = gtk_image_menu_item_new_with_mnemonic (label); + } + diff --git a/gtk/Makefile.am b/gtk/Makefile.am index 78b263582..610d88006 100644 --- a/gtk/Makefile.am +++ b/gtk/Makefile.am @@ -33,6 +33,7 @@ customs = \ Adjustment.custom \ Button.custom \ Calendar.custom \ + CheckMenuItem.custom \ Clipboard.custom \ ColorSelection.custom \ ColorSelectionDialog.custom \ @@ -45,6 +46,7 @@ customs = \ HBox.custom \ IconFactory.custom \ IconSet.custom \ + ImageMenuItem.custom \ Label.custom \ Layout.custom \ ListStore.custom \ diff --git a/gtk/MenuItem.custom b/gtk/MenuItem.custom index 042dde2df..4a9febfe3 100644 --- a/gtk/MenuItem.custom +++ b/gtk/MenuItem.custom @@ -13,7 +13,11 @@ { if (GetType() != typeof (MenuItem)) { CreateNativeObject (new string [0], new GLib.Value [0]); - Add (new Label (label)); + AccelLabel al = new AccelLabel (""); + al.TextWithMnemonic = label; + al.SetAlignment (0.0f, 0.5f); + Add (al); + al.AccelWidget = this; } Raw = gtk_menu_item_new_with_mnemonic (label); diff --git a/gtk/RadioMenuItem.custom b/gtk/RadioMenuItem.custom index d0c57e49d..80bf2aa95 100644 --- a/gtk/RadioMenuItem.custom +++ b/gtk/RadioMenuItem.custom @@ -1,11 +1,20 @@ +// Gtk.RadioMenuItem.custom - Gtk RadioMenuItem customizations // -// RadioMenuItem.custom -// -// Author: John Luke +// Authors: John Luke +// Mike Kestner // +// Copyright (c) 2004 Novell, Inc. - // creates a new group for this RadioMenuItem - public RadioMenuItem (string label) - { - Raw = gtk_radio_menu_item_new_with_mnemonic (IntPtr.Zero, label); - } + public RadioMenuItem (string label) : base (IntPtr.Zero) + { + if (GetType() != typeof (RadioMenuItem)) { + CreateNativeObject (new string [0], new GLib.Value [0]); + AccelLabel al = new AccelLabel (""); + al.TextWithMnemonic = label; + al.SetAlignment (0.0f, 0.5f); + Add (al); + al.AccelWidget = this; + } + + Raw = gtk_radio_menu_item_new_with_mnemonic (IntPtr.Zero, label); + }