<Type Name="ItemFactory" FullName="Gtk.ItemFactory"> <TypeSignature Language="C#" Value="public class ItemFactory : Gtk.Object, IWrapper, IDisposable" Maintainer="Hector Gomez M" /> <AssemblyInfo> <AssemblyName>gtk-sharp</AssemblyName> <AssemblyPublicKey> </AssemblyPublicKey> <AssemblyVersion>0.0.0.0</AssemblyVersion> <AssemblyCulture>neutral</AssemblyCulture> <Attributes /> </AssemblyInfo> <ThreadSafetyStatement>Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details.</ThreadSafetyStatement> <Docs> <summary>A factory for menus.</summary> <remarks> To use this class, make an array of <see cref="T:Gtk.MenuEntry"/> objects which describe a menu, then invoke <see cref="M:Gtk.ItemFactory.CreateMenuEntries"/> to generate the menu. </remarks> </Docs> <Base> <BaseTypeName>Gtk.Object</BaseTypeName> </Base> <Interfaces> <Interface> <InterfaceName>GLib.IWrapper</InterfaceName> </Interface> <Interface> <InterfaceName>System.IDisposable</InterfaceName> </Interface> </Interfaces> <Attributes /> <Members> <Member MemberName="PathFromWidget"> <MemberSignature Language="C#" Value="public static string PathFromWidget (Gtk.Widget widget);" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.String</ReturnType> </ReturnValue> <Parameters> <Parameter Name="widget" Type="Gtk.Widget" /> </Parameters> <Docs> <summary>If <paramref name="widget" /> has been created by an item factory, returns the full path to it.</summary> <param name="widget">A <see cref="T:Gtk.Widget" />.</param> <returns>The full path to <paramref name="widget" /> if it has been created by an item factory, <see langword="null" /> otherwise. This value is owned by GTK+ and must not be modified or freed.</returns> <remarks> <para> The full path of a <paramref name="widget" /> is the concatenation of the factory path specified in <see cref="M:Gtk.ItemFactory.Construct" /> with the path specified in the <see cref="T:Gtk.ItemFactoryEntry" /> from which the <paramref name="widget" /> was created. </para> </remarks> </Docs> </Member> <Member MemberName="FromWidget"> <MemberSignature Language="C#" Value="public static Gtk.ItemFactory FromWidget (Gtk.Widget widget);" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>Gtk.ItemFactory</ReturnType> </ReturnValue> <Parameters> <Parameter Name="widget" Type="Gtk.Widget" /> </Parameters> <Docs> <summary>Obtains the item factory from which a <paramref name="widget" /> was created.</summary> <param name="widget">A <see cref="T:Gtk.Widget" />.</param> <returns>The item factory from which <paramref name="widget" /> was created, or <see langword="null" />.</returns> <remarks /> </Docs> </Member> <Member MemberName="PopupDataFromWidget"> <MemberSignature Language="C#" Value="public static IntPtr PopupDataFromWidget (Gtk.Widget widget);" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.IntPtr</ReturnType> </ReturnValue> <Parameters> <Parameter Name="widget" Type="Gtk.Widget" /> </Parameters> <Docs> <summary>Obtains the <paramref name="popup_data" /> which was passed to <see cref="M:Gtk.ItemFactory.PopupWithData" />.</summary> <param name="widget">A <see cref="T:Gtk.Widget" />.</param> <returns> <paramref name="popup_data" /> associated with the item factory from which <paramref name="widget" /> was created, or <see langword="null" /> if <paramref name="widget" /> wasn't created by an item factory.</returns> <remarks> <para> This data is available until the menu is popped down again. </para> </remarks> </Docs> </Member> <Member MemberName="AddForeign"> <MemberSignature Language="C#" Value="public static void AddForeign (Gtk.Widget accel_widget, string full_path, Gtk.AccelGroup accel_group, uint keyval, Gdk.ModifierType modifiers);" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.Void</ReturnType> </ReturnValue> <Parameters> <Parameter Name="accel_widget" Type="Gtk.Widget" /> <Parameter Name="full_path" Type="System.String" /> <Parameter Name="accel_group" Type="Gtk.AccelGroup" /> <Parameter Name="keyval" Type="System.UInt32" /> <Parameter Name="modifiers" Type="Gdk.ModifierType" /> </Parameters> <Docs> <summary>Installs an accelerator for <paramref name="accel_widget" /> in <paramref name="accel_group" />, that causes the activate event to be emitted it the accelerator is activated.</summary> <param name="accel_widget">Widget to install an accelerator on.</param> <param name="full_path">The full path for the <paramref name="accel_widget" />.</param> <param name="accel_group">The accelerator group to install the accelerator in.</param> <param name="keyval">Key value of the accelerator.</param> <param name="modifiers">Modifier combination of the acelerator.</param> <remarks> <para> This method can be used to make widgets participate in the accel saving/restoring functionality provided by <see cref="M:Gtk.Accel.MapSave" /> and <see cref="M:Gtk.Accel.MapLoad" />, even if they haven't been created by an item factory. The recommended API for this purpose are the <see cref="P:Gtk.Menu.AccelPath" /> and <see cref="P:Gtk.Widget.SetAccelPath" />; don't use <see cref="M:Gtk.ItemFactory.AddForeign" /> in new code, since it is likely to be removed in the future. </para> </remarks> </Docs> </Member> <Member MemberName="DeleteEntries"> <MemberSignature Language="C#" Value="public void DeleteEntries (uint n_entries, Gtk.ItemFactoryEntry entries);" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.Void</ReturnType> </ReturnValue> <Parameters> <Parameter Name="n_entries" Type="System.UInt32" /> <Parameter Name="entries" Type="Gtk.ItemFactoryEntry" /> </Parameters> <Docs> <summary>Deletes the menu items which were created from the entries by the given item factory.</summary> <param name="n_entries">The length of <paramref name="entries" />.</param> <param name="entries">An array of <see cref="T:Gtk.ItemFactoryEntry" />s.</param> <remarks /> </Docs> </Member> <Member MemberName="GetItem"> <MemberSignature Language="C#" Value="public Gtk.Widget GetItem (uint action);" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>Gtk.Widget</ReturnType> </ReturnValue> <Parameters> <Parameter Name="action" Type="System.UInt32" /> </Parameters> <Docs> <summary>Obtains the menu item which correponds to <paramref name="action" />.</summary> <param name="action">A <see cref="T:System.UInt32" /> (TODO: where is this enumerated?)</param> <returns>A <see cref="T:Gtk.Widget" /></returns> <remarks /> </Docs> </Member> <Member MemberName="DeleteEntry"> <MemberSignature Language="C#" Value="public void DeleteEntry (Gtk.ItemFactoryEntry entry);" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.Void</ReturnType> </ReturnValue> <Parameters> <Parameter Name="entry" Type="Gtk.ItemFactoryEntry" /> </Parameters> <Docs> <summary>Deletes the menu item which was created from <paramref name="entry" /> by the given item factory.</summary> <param name="entry">A <see cref="T:Gtk.ItemFactoryEntry" />.</param> <remarks /> </Docs> </Member> <Member MemberName="CreateItem"> <MemberSignature Language="C#" Value="public void CreateItem (Gtk.ItemFactoryEntry entry, IntPtr callback_data, uint callback_type);" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.Void</ReturnType> </ReturnValue> <Parameters> <Parameter Name="entry" Type="Gtk.ItemFactoryEntry" /> <Parameter Name="callback_data" Type="System.IntPtr" /> <Parameter Name="callback_type" Type="System.UInt32" /> </Parameters> <Docs> <summary>Creates an item for <paramref name="entry" />.</summary> <param name="entry">The <see cref="T:Gtk.ItemFactoryEntry" /> to create an item for.</param> <param name="callback_data">Data passed to the callback method of <paramref name="entry" />.</param> <param name="callback_type">1 if the callback method of <paramref name="entry" /> is of type <see cref="T:Gtk.ItemFactoryCallback" />, 2 if it is of type <see cref="T:Gtk.ItemFactoryCallback1" />.</param> <remarks /> </Docs> </Member> <Member MemberName="GetWidget"> <MemberSignature Language="C#" Value="public Gtk.Widget GetWidget (uint action);" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>Gtk.Widget</ReturnType> </ReturnValue> <Parameters> <Parameter Name="action" Type="System.UInt32" /> </Parameters> <Docs> <summary>Obtains the <paramref name="widget" /> which corresponds to <paramref name="action" />.</summary> <param name="action">A <see cref="T:System.UInt32" /> (TODO: where is this enumerated?)</param> <returns>A <see cref="T:Gtk.Widget" /></returns> <remarks> </remarks> </Docs> </Member> <Member MemberName="GetItem"> <MemberSignature Language="C#" Value="public Gtk.Widget GetItem (string path);" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>Gtk.Widget</ReturnType> </ReturnValue> <Parameters> <Parameter Name="path" Type="System.String" /> </Parameters> <Docs> <summary>Obtains the menu item which corresponds to <paramref name="path" />.</summary> <param name="path">The path to the menu item.</param> <returns>The menu item for the given path, or <see langword="null" /> if <paramref name="path" /> doesn't lead to a menu item.</returns> <remarks> <para> If the <paramref name="widget" /> corresponding to <paramref name="path" /> is a menu item which opens a submenum, then the item is returned. If you are interested in the submenum, use <see cref="M:Gtk.ItemFactory.GetWidget" /> instead. </para> </remarks> </Docs> </Member> <Member MemberName="DeleteItem"> <MemberSignature Language="C#" Value="public void DeleteItem (string path);" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.Void</ReturnType> </ReturnValue> <Parameters> <Parameter Name="path" Type="System.String" /> </Parameters> <Docs> <summary>Deletes the menu item which was created for <paramref name="path" /> by the given item factory.</summary> <param name="path">A path.</param> <remarks /> </Docs> </Member> <Member MemberName="PopupData"> <MemberSignature Language="C#" Value="public IntPtr PopupData ();" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.IntPtr</ReturnType> </ReturnValue> <Parameters /> <Docs> <summary>Obtains the <paramref name="popup_data" /> which was passed to <see cref="M:Gtk.ItemFactory.PopupWithData" />.</summary> <returns> <paramref name="popup_data" /> associated.</returns> <remarks> <para> This data is available until the menu is popped down again. </para> </remarks> </Docs> </Member> <Member MemberName="CreateItems"> <MemberSignature Language="C#" Value="public void CreateItems (uint n_entries, Gtk.ItemFactoryEntry entries, IntPtr callback_data);" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.Void</ReturnType> </ReturnValue> <Parameters> <Parameter Name="n_entries" Type="System.UInt32" /> <Parameter Name="entries" Type="Gtk.ItemFactoryEntry" /> <Parameter Name="callback_data" Type="System.IntPtr" /> </Parameters> <Docs> <summary>Creates the menu items from the <paramref name="entries" />.</summary> <param name="n_entries">The length of <paramref name="entries" />.</param> <param name="entries">An array of <see cref="T:Gtk.ItemFactoryEntry" />s whose <paramref name="callback" /> members must be of type <see cref="T:Gtk.ItemFactoryCallback1" />.</param> <param name="callback_data">Data passed to the callback methods of all entries.</param> <remarks /> </Docs> </Member> <Member MemberName="GetWidget"> <MemberSignature Language="C#" Value="public Gtk.Widget GetWidget (string path);" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>Gtk.Widget</ReturnType> </ReturnValue> <Parameters> <Parameter Name="path" Type="System.String" /> </Parameters> <Docs> <summary>Obtains the <paramref name="widget" /> which corresponds to <paramref name="path" />.</summary> <param name="path">The path to the <paramref name="widget" />.</param> <returns>The <paramref name="widget" /> for the given path, or <see langword="null" /> if <paramref name="path" /> doesn't lead to a <paramref name="widget" />.</returns> <remarks> <para> If the <paramref name="widget" /> corresponding to <paramref name="path" /> is a menu item which opens a submenu, then the submenu is returned. If you are interested in the menu item, use <see cref="M:Gtk:ItemFactory.GetItem" /> instead. </para> </remarks> </Docs> </Member> <Member MemberName="SetTranslateFunc"> <MemberSignature Language="C#" Value="public void SetTranslateFunc (Gtk.TranslateFunc func, IntPtr data, Gtk.DestroyNotify notify);" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.Void</ReturnType> </ReturnValue> <Parameters> <Parameter Name="func" Type="Gtk.TranslateFunc" /> <Parameter Name="data" Type="System.IntPtr" /> <Parameter Name="notify" Type="Gtk.DestroyNotify" /> </Parameters> <Docs> <summary>Sets a method to be used for translating the path elements before they are displayed.</summary> <param name="func">The <see cref="T:Gtk.TraslateFunc" /> delegate to be used to traslate path elements.</param> <param name="data">Data to pass to <paramref name="func" /> and <paramref name="notify" />.</param> <param name="notify">A <see cref="T:Gtk.DestroyNotify" /> delegate to be called when the <see cref="T:Gtk.ItemFactory" /> object is destroyed and when the translation is changed again.</param> <remarks /> </Docs> </Member> <Member MemberName="Finalize"> <MemberSignature Language="C#" Value="protected override void Finalize ();" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.Void</ReturnType> </ReturnValue> <Parameters /> <Docs> <summary>Disposes the resources associated with the object.</summary> <remarks /> </Docs> </Member> <Member MemberName=".ctor"> <MemberSignature Language="C#" Value="public ItemFactory (IntPtr raw);" /> <MemberType>Constructor</MemberType> <ReturnValue /> <Parameters> <Parameter Name="raw" Type="System.IntPtr" /> </Parameters> <Docs> <summary>Internal constructor</summary> <param name="raw">Pointer to the C object.</param> <returns>An instance of ItemFactory, wrapping the C object.</returns> <remarks> <para>This is an internal constructor, and should not be used by user code.</para> </remarks> </Docs> </Member> <Member MemberName="PopupWithData"> <MemberSignature Language="C#" Value="public void PopupWithData (IntPtr popup_data, Gtk.DestroyNotify destroy, uint x, uint y, uint mouse_button, uint time_);" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.Void</ReturnType> </ReturnValue> <Parameters> <Parameter Name="popup_data" Type="System.IntPtr" /> <Parameter Name="destroy" Type="Gtk.DestroyNotify" /> <Parameter Name="x" Type="System.UInt32" /> <Parameter Name="y" Type="System.UInt32" /> <Parameter Name="mouse_button" Type="System.UInt32" /> <Parameter Name="time_" Type="System.UInt32" /> </Parameters> <Docs> <summary>Pops up the menu constructed form the item factory at (<paramref name="x" />, <paramref name="y" />).</summary> <param name="popup_data">Data available for callbacks while the menu is posted.</param> <param name="destroy">A <see cref="T:Gtk.DestroyNotify" /> to be called on <paramref name="popup_data" /> when the menu is unposted.</param> <param name="x">The x position.</param> <param name="y">The y position.</param> <param name="mouse_button">The mouse button which was pressed to initiate the popup.</param> <param name="time_">The time at which the activation event ocurred.</param> <remarks> <para> Callbacks can access the <paramref name="popup_data" /> while the menu is posted via <see cref="M:Gtk.ItemFactory.PopupData" /> and <see cref="M:Gtk.ItemFactory.PopupDataFromWidget" />. </para> <para> The <paramref name="mouse_button" /> should be the mouse button pressed to initiate the menu popup. If the menu popup was initiated by something other than a mouse button press, such as a mouse button release or a keypress, <paramref name="mouse_button" /> should be 0. </para> <para> The <paramref name="time_" /> should be the time stamp of the event that initiated the popup. If such a event is not available, use <see cref="P:Gtk.Global.CurrentEventTime" /> instead. </para> <para> The operation of the <paramref name="mouse_button" /> and the <paramref name="time_" /> is the same as the <paramref name="button" /> and <paramref name="activation_time" /> for <see cref="M:Gtk.Menu.Popup" />. </para> </remarks> </Docs> </Member> <Member MemberName="Popup"> <MemberSignature Language="C#" Value="public void Popup (uint x, uint y, uint mouse_button, uint time_);" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.Void</ReturnType> </ReturnValue> <Parameters> <Parameter Name="x" Type="System.UInt32" /> <Parameter Name="y" Type="System.UInt32" /> <Parameter Name="mouse_button" Type="System.UInt32" /> <Parameter Name="time_" Type="System.UInt32" /> </Parameters> <Docs> <summary>Pops up the menu constructed form the item factory at (<paramref name="x" />, <paramref name="y" />).</summary> <param name="x">The x position.</param> <param name="y">The y position.</param> <param name="mouse_button">The mouse button which was pressed to initiate the popup.</param> <param name="time_">The time at which the activation event ocurred.</param> <remarks> <para> The <paramref name="mouse_button" /> should be the mouse button pressed to initiate the menu popup. If the menu popup was initiated by something other than a mouse button press, such as a mouse button release or a keypress, <paramref name="mouse_button" /> should be 0. </para> <para> The <paramref name="time_" /> should be the time stamp of the event that initiated the popup. If such a event is not available, use <see cref="P:Gtk.Global.CurrentEventTime" /> instead. </para> <para> The operation of the <paramref name="mouse_button" /> and the <paramref name="time_" /> is the same as the <paramref name="button" /> and <paramref name="activation_time" /> for <see cref="M:Gtk.Menu.Popup" />. </para> </remarks> </Docs> </Member> <Member MemberName="GType"> <MemberSignature Language="C#" Value="public static GLib.GType GType { get; };" /> <MemberType>Property</MemberType> <ReturnValue> <ReturnType>GLib.GType</ReturnType> </ReturnValue> <Parameters /> <Docs> <summary>GType Property.</summary> <returns>a <see cref="T:GLib.GType" /></returns> <remarks>Returns the native <see cref="T:GLib.GType" /> value for <see cref="T:Gtk.ItemFactory" />.</remarks> </Docs> </Member> <Member MemberName="Construct"> <MemberSignature Language="C#" Value="public void Construct (GLib.GType container_type, string path, Gtk.AccelGroup accel_group);" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.Void</ReturnType> </ReturnValue> <Parameters> <Parameter Name="container_type" Type="GLib.GType" /> <Parameter Name="path" Type="System.String" /> <Parameter Name="accel_group" Type="Gtk.AccelGroup" /> </Parameters> <Docs> <summary>Initializes a <see cref="T:Gtk.ItemFactory" /></summary> <param name="container_type">The kind of menu to create; can be <see cref="T:Gtk.MenuBar" />, <see cref="T:Gtk.Menu" />, or <see cref="T:Gtk.OptionMenu" /></param> <param name="path">the factory path of the new item factory, a string of the form "<name>"</param> <param name="accel_group">a <see cref="T:Gtk.AccelGroup" /> to which the accelerators for the menu items will be added, or null to create a new one</param> <remarks /> </Docs> </Member> <Member MemberName=".ctor"> <MemberSignature Language="C#" Value="protected ItemFactory (GLib.GType gtype);" /> <MemberType>Constructor</MemberType> <ReturnValue /> <Parameters> <Parameter Name="gtype" Type="GLib.GType" /> </Parameters> <Docs> <summary>Protected Constructor.</summary> <param name="gtype">a <see cref="T:GLib.GType" /></param> <returns>a <see cref="T:Gtk.ItemFactory" /></returns> <remarks>Chain to this constructor if you have manually registered a native <see cref="T:GLib.GType" /> value for your subclass.</remarks> </Docs> </Member> <Member MemberName=".ctor"> <MemberSignature Language="C#" Value="public ItemFactory (GLib.GType container_type, string path, Gtk.AccelGroup accel_group);" /> <MemberType>Constructor</MemberType> <ReturnValue /> <Parameters> <Parameter Name="container_type" Type="GLib.GType" /> <Parameter Name="path" Type="System.String" /> <Parameter Name="accel_group" Type="Gtk.AccelGroup" /> </Parameters> <Docs> <summary>Basic constructor.</summary> <param name="container_type">The kind of menu to create; can be <see cref="T:Gtk.MenuBar" />, <see cref="T:Gtk.Menu" />, or <see cref="T:Gtk.OptionMenu" /></param> <param name="path">the factory path of the new item factory, a string of the form "<name>"</param> <param name="accel_group">a <see cref="T:Gtk.AccelGroup" /> to which the accelerators for the menu items will be added, or null to create a new one</param> <returns>a <see cref="T:Gtk.ItemFactory" /></returns> <remarks /> </Docs> </Member> <Member MemberName=".ctor"> <MemberSignature Language="C#" Value="protected ItemFactory ();" /> <MemberType>Constructor</MemberType> <ReturnValue /> <Parameters /> <Docs> <summary>Protected constructor.</summary> <returns>a <see cref="T:Gtk.ItemFactory" /></returns> <remarks /> </Docs> </Member> <Member MemberName="FromPath"> <MemberSignature Language="C#" Value="public static Gtk.ItemFactory FromPath (string path);" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>Gtk.ItemFactory</ReturnType> </ReturnValue> <Parameters> <Parameter Name="path" Type="System.String" /> </Parameters> <Docs> <summary>Finds an item factory which has been constructed using the "<name>" prefix of <paramref name="path"/> as the path argument building a new item factory. </summary> <param name="path">a <see cref="T:System.String" /></param> <returns>a <see cref="T:Gtk.ItemFactory" />, or <see langword="null"/></returns> <remarks></remarks> </Docs> </Member> <Member MemberName="CreateMenuEntries"> <MemberSignature Language="C#" Value="public static void CreateMenuEntries (uint n_entries, Gtk.MenuEntry entries);" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.Void</ReturnType> </ReturnValue> <Parameters> <Parameter Name="n_entries" Type="System.UInt32" /> <Parameter Name="entries" Type="Gtk.MenuEntry" /> </Parameters> <Docs> <summary>Creates menu items from a set of entries.</summary> <param name="n_entries">a <see cref="T:System.UInt32" />, the number of entries</param> <param name="entries">an array of <see cref="T:Gtk.MenuEntry" /> objects</param> <remarks></remarks> </Docs> </Member> <Member MemberName="CreateItemsAc"> <MemberSignature Language="C#" Value="public void CreateItemsAc (uint n_entries, Gtk.ItemFactoryEntry entries, IntPtr callback_data, uint callback_type);" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.Void</ReturnType> </ReturnValue> <Parameters> <Parameter Name="n_entries" Type="System.UInt32" /> <Parameter Name="entries" Type="Gtk.ItemFactoryEntry" /> <Parameter Name="callback_data" Type="System.IntPtr" /> <Parameter Name="callback_type" Type="System.UInt32" /> </Parameters> <Docs> <summary>Creates menu items from entries.</summary> <param name="n_entries">a <see cref="T:System.UInt32" />, the number of menu items</param> <param name="entries">a <see cref="T:Gtk.ItemFactoryEntry" />, a list of information about menu items</param> <param name="callback_data">a <see cref="T:System.IntPtr" />, pointer to data that should be passed to the callback functions of all entries</param> <param name="callback_type">a <see cref="T:System.UInt32" /></param> <remarks>FIXME: See bugzilla 70887.</remarks> </Docs> </Member> </Members> </Type>