1 // Gtk.CheckMenuItem.cs - Gtk CheckMenuItem class customizations 2 // 3 // Author: Mike Kestner <mkestner@ximian.com> 4 // 5 // Copyright (C) 2004 Novell, Inc. 6 // 7 // This program is free software; you can redistribute it and/or 8 // modify it under the terms of version 2 of the Lesser GNU General 9 // Public License as published by the Free Software Foundation. 10 // 11 // This program is distributed in the hope that it will be useful, 12 // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 // Lesser General Public License for more details. 15 // 16 // You should have received a copy of the GNU Lesser General Public 17 // License along with this program; if not, write to the 18 // Free Software Foundation, Inc., 59 Temple Place - Suite 330, 19 // Boston, MA 02111-1307, USA. 20 21 namespace Gtk { 22 23 using System; 24 using System.Runtime.InteropServices; 25 26 public partial class CheckMenuItem { 27 28 [DllImport (Global.GtkNativeDll, CallingConvention = CallingConvention.Cdecl)] gtk_check_menu_item_new_with_mnemonic(IntPtr label)29 static extern IntPtr gtk_check_menu_item_new_with_mnemonic (IntPtr label); 30 CheckMenuItem(string label)31 public CheckMenuItem (string label) : base (IntPtr.Zero) 32 { 33 if (GetType() != typeof (CheckMenuItem)) { 34 CreateNativeObject (new string [0], new GLib.Value [0]); 35 AccelLabel al = new AccelLabel (""); 36 al.TextWithMnemonic = label; 37 al.SetAlignment (0.0f, 0.5f); 38 Add (al); 39 al.AccelWidget = this; 40 return; 41 } 42 43 IntPtr native = GLib.Marshaller.StringToPtrGStrdup (label); 44 Raw = gtk_check_menu_item_new_with_mnemonic (native); 45 GLib.Marshaller.Free (native); 46 } 47 Toggle()48 public void Toggle() { 49 Active = !Active; 50 } 51 } 52 } 53