2004-11-26 Jeroen Zwartepoorte <jeroen@xs4all.nl>

* gtk/ActionEntry.cs:
	* gtk/ActionGroup.custom:
	* gtk/Gtk.metadata:
	* gtk/Makefile.am:
	* gtk/RadioActionEntry.cs:
	* gtk/ToggleActionEntry.cs:
	* gtk/UIManager.custom:
	* sample/Actions.cs: Updated to use the new *ActionEntry code. Reflects
	testactions.c from gtk+ now.
	
	Added C# syntactic sugar for easily defining Action's for the UIManager.
	Derived from the same ActionEntry structs in gtk+.


svn path=/trunk/gtk-sharp/; revision=36638
This commit is contained in:
Jeroen Zwartepoorte 2004-11-26 14:59:38 +00:00
parent 30cc0b8109
commit 0c81f9142c
15 changed files with 1097 additions and 35 deletions

View file

@ -1,3 +1,18 @@
2004-11-26 Jeroen Zwartepoorte <jeroen@xs4all.nl>
* gtk/ActionEntry.cs:
* gtk/ActionGroup.custom:
* gtk/Gtk.metadata:
* gtk/Makefile.am:
* gtk/RadioActionEntry.cs:
* gtk/ToggleActionEntry.cs:
* gtk/UIManager.custom:
* sample/Actions.cs: Updated to use the new *ActionEntry code. Reflects
testactions.c from gtk+ now.
Added C# syntactic sugar for easily defining Action's for the UIManager.
Derived from the same ActionEntry structs in gtk+.
2004-11-22 Dan Winship <danw@novell.com>
* generator/ClassBase.cs:

View file

@ -1,3 +1,13 @@
2004-11-26 Jeroen Zwartepoorte <jeroen@xs4all.nl>
* doc/en/Gtk/ActionEntry.xml:
* doc/en/Gtk/ActionGroup.xml:
* doc/en/Gtk/RadioActionEntry.xml:
* doc/en/Gtk/ToggleActionEntry.xml:
* doc/en/Gtk/UIManager.xml:
New ActionEntry related structs & methods.
2004-11-18 Dan Winship <danw@novell.com>
* en/Gtk/: update for container child property change

161
doc/en/Gtk/ActionEntry.xml Normal file
View file

@ -0,0 +1,161 @@
<Type Name="ActionEntry" FullName="Gtk.ActionEntry">
<TypeSignature Language="C#" Value="public sealed struct ActionEntry" Maintainer="auto" />
<AssemblyInfo>
<AssemblyName>gtk-sharp</AssemblyName>
<AssemblyPublicKey>[00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00 00 24 00 00 52 53 41 31 00 04 00 00 01 00 01 00 71 EB 6C 55 75 52 9C BF 72 44 F7 A6 EA 05 62 84 F9 EA E0 3B CF F2 CC 13 2C 9C 49 0A B3 09 EA B0 B5 6B CE 44 9D F5 03 D9 C0 A8 1E 52 05 85 CD BE 70 E2 FB 90 43 4B AC 04 FA 62 22 A8 00 98 B7 A1 A7 B3 AF 99 1A 41 23 24 BB 43 25 F6 B8 65 BB 64 EB F6 D1 C2 06 D5 73 2D DF BC 70 A7 38 9E E5 3E 0C 24 6E 32 79 74 1A D0 05 03 E4 98 42 E1 9B F3 7B 19 8B 40 21 26 CB 36 89 C2 EA 64 96 A4 7C B4]</AssemblyPublicKey>
<AssemblyVersion>2.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 struct containing all the info necessary for creating an <see cref="T:Gtk.Action" /></summary>
<remarks>
<para>The ActionEntry struct is C# "syntactic sugar", designed to make it easier for developers to add <see cref="T:Gtk.Action" />s to their code.</para>
<para>Instead of creating a new <see cref="T:Gtk.Action" /> object for each action, a developer can create an array of ActionEntry's and add them to an <see cref="T:Gtk.ActionGroup" /> all at once using the <see cref="M:Gtk.ActionGroup.Add" /> method.</para>
</remarks>
</Docs>
<Base>
<BaseTypeName>System.ValueType</BaseTypeName>
</Base>
<Interfaces />
<Attributes />
<Members>
<Member MemberName="name">
<MemberSignature Language="C#" Value="public string name;" />
<MemberType>Field</MemberType>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters>
</Parameters>
<Docs>
<summary>A unique name for the action.</summary>
<remarks />
</Docs>
</Member>
<Member MemberName="stock_id">
<MemberSignature Language="C#" Value="public string stock_id;" />
<MemberType>Field</MemberType>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters>
</Parameters>
<Docs>
<summary>The stock icon displayed in widgets representing this action.</summary>
<remarks />
</Docs>
</Member>
<Member MemberName="label">
<MemberSignature Language="C#" Value="public string label;" />
<MemberType>Field</MemberType>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters>
</Parameters>
<Docs>
<summary>The label used for menu items and buttons that activate this action.</summary>
<remarks />
</Docs>
</Member>
<Member MemberName="tooltip">
<MemberSignature Language="C#" Value="public string tooltip;" />
<MemberType>Field</MemberType>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters>
</Parameters>
<Docs>
<summary>A tooltip for this action.</summary>
<remarks />
</Docs>
</Member>
<Member MemberName="accelerator">
<MemberSignature Language="C#" Value="public string accelerator;" />
<MemberType>Field</MemberType>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters>
</Parameters>
<Docs>
<summary>The accelerator for the action, in the format understood by <see cref="M:Gtk.Accelerator.Parse()" />, or "" for no accelerator, or <see langword="null" /> to use the stock accelerator.</summary>
<remarks />
</Docs>
</Member>
<Member MemberName="activated">
<MemberSignature Language="C#" Value="public EventHandler activated;" />
<MemberType>Field</MemberType>
<ReturnValue>
<ReturnType>System.EventHandler</ReturnType>
</ReturnValue>
<Parameters>
</Parameters>
<Docs>
<summary>EventHandler to be called when the action is triggered.</summary>
<remarks />
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public ActionEntry (string name, string stock_id);" />
<MemberType>Constructor</MemberType>
<ReturnValue />
<Parameters>
<Parameter Name="name" Type="System.String" />
<Parameter Name="stock_id" Type="System.String" />
</Parameters>
<Docs>
<summary>To be added</summary>
<param name="name">a <see cref="T:System.String" /></param>
<param name="stock_id">a <see cref="T:System.String" /></param>
<returns>a <see cref="T:Gtk.ActionEntry" /></returns>
<remarks>To be added</remarks>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public ActionEntry (string name, string stock_id, EventHandler activated);" />
<MemberType>Constructor</MemberType>
<ReturnValue />
<Parameters>
<Parameter Name="name" Type="System.String" />
<Parameter Name="stock_id" Type="System.String" />
<Parameter Name="activated" Type="System.EventHandler" />
</Parameters>
<Docs>
<summary>To be added</summary>
<param name="name">a <see cref="T:System.String" /></param>
<param name="stock_id">a <see cref="T:System.String" /></param>
<param name="activated">a <see cref="T:System.EventHandler" /></param>
<returns>a <see cref="T:Gtk.ActionEntry" /></returns>
<remarks>To be added</remarks>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public ActionEntry (string name, string stock_id, string label, string accelerator, string tooltip, EventHandler activated);" />
<MemberType>Constructor</MemberType>
<ReturnValue />
<Parameters>
<Parameter Name="name" Type="System.String" />
<Parameter Name="stock_id" Type="System.String" />
<Parameter Name="label" Type="System.String" />
<Parameter Name="accelerator" Type="System.String" />
<Parameter Name="tooltip" Type="System.String" />
<Parameter Name="activated" Type="System.EventHandler" />
</Parameters>
<Docs>
<summary>To be added</summary>
<param name="name">a <see cref="T:System.String" /></param>
<param name="stock_id">a <see cref="T:System.String" /></param>
<param name="label">a <see cref="T:System.String" /></param>
<param name="accelerator">a <see cref="T:System.String" /></param>
<param name="tooltip">a <see cref="T:System.String" /></param>
<param name="activated">a <see cref="T:System.EventHandler" /></param>
<returns>a <see cref="T:Gtk.ActionEntry" /></returns>
<remarks>To be added</remarks>
</Docs>
</Member>
</Members>
</Type>

View file

@ -260,5 +260,54 @@ Therefore you must either set the accel path yourself with <see cref="P:Gtk.Acti
<remarks>To be added</remarks>
</Docs>
</Member>
<Member MemberName="Add">
<MemberSignature Language="C#" Value="public void Add (Gtk.ActionEntry[] entries);" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="entries" Type="Gtk.ActionEntry[]" />
</Parameters>
<Docs>
<summary>Ease of use function for adding multiple <see cref="T:Gtk.Action" />s in a single call using the <see cref="T:Gtk.ActionEntry" /> struct.</summary>
<param name="entries">a <see cref="T:Gtk.ActionEntry" /></param>
<remarks />
</Docs>
</Member>
<Member MemberName="Add">
<MemberSignature Language="C#" Value="public void Add (Gtk.ToggleActionEntry[] entries);" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="entries" Type="Gtk.ToggleActionEntry[]" />
</Parameters>
<Docs>
<summary>Ease of use function for adding multiple <see cref="T:Gtk.ToggleAction" />s in a single call using the <see cref="T:Gtk.ToggleActionEntry" /> struct.</summary>
<param name="entries">a <see cref="T:Gtk.ToggleActionEntry" /></param>
<remarks />
</Docs>
</Member>
<Member MemberName="Add">
<MemberSignature Language="C#" Value="public void Add (Gtk.RadioActionEntry[] entries, int value, Gtk.ChangedHandler changed);" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="entries" Type="Gtk.RadioActionEntry[]" />
<Parameter Name="value" Type="System.Int32" />
<Parameter Name="changed" Type="Gtk.ChangedHandler" />
</Parameters>
<Docs>
<summary>Ease of use function for adding multiple <see cref="T:Gtk.RadioAction" />s in a single call using the <see cref="T:Gtk.RadioActionEntry" /> struct.</summary>
<param name="entries">a <see cref="T:Gtk.RadioActionEntry" /></param>
<param name="value">a <see cref="T:System.Int32" /></param>
<param name="changed">a <see cref="T:Gtk.ChangedHandler" /></param>
<remarks />
</Docs>
</Member>
</Members>
</Type>
</Type>

View file

@ -0,0 +1,165 @@
<Type Name="RadioActionEntry" FullName="Gtk.RadioActionEntry">
<TypeSignature Language="C#" Value="public sealed struct RadioActionEntry" Maintainer="auto" />
<AssemblyInfo>
<AssemblyName>gtk-sharp</AssemblyName>
<AssemblyPublicKey>[00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00 00 24 00 00 52 53 41 31 00 04 00 00 01 00 01 00 71 EB 6C 55 75 52 9C BF 72 44 F7 A6 EA 05 62 84 F9 EA E0 3B CF F2 CC 13 2C 9C 49 0A B3 09 EA B0 B5 6B CE 44 9D F5 03 D9 C0 A8 1E 52 05 85 CD BE 70 E2 FB 90 43 4B AC 04 FA 62 22 A8 00 98 B7 A1 A7 B3 AF 99 1A 41 23 24 BB 43 25 F6 B8 65 BB 64 EB F6 D1 C2 06 D5 73 2D DF BC 70 A7 38 9E E5 3E 0C 24 6E 32 79 74 1A D0 05 03 E4 98 42 E1 9B F3 7B 19 8B 40 21 26 CB 36 89 C2 EA 64 96 A4 7C B4]</AssemblyPublicKey>
<AssemblyVersion>2.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 struct containing all the info necessary for creating an <see cref="T:Gtk.RadioAction" /></summary>
<remarks>
<para>The ActionEntry struct is C# "syntactic sugar", designed to make it easier for developers to add <see cref="T:Gtk.RadioAction" />s to their code.</para>
<para>Instead of creating a new <see cref="T:Gtk.RadioAction" /> object for each action, a developer can create an array of RadioActionEntry's and add them to an <see cref="T:Gtk.ActionGroup" /> all at once using the <see cref="M:Gtk.ActionGroup.Add" /> method.</para>
</remarks>
</Docs>
<Base>
<BaseTypeName>System.ValueType</BaseTypeName>
</Base>
<Interfaces />
<Attributes />
<Members>
<Member MemberName="name">
<MemberSignature Language="C#" Value="public string name;" />
<MemberType>Field</MemberType>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters>
</Parameters>
<Docs>
<summary>A unique name for the action.</summary>
<remarks />
</Docs>
</Member>
<Member MemberName="stock_id">
<MemberSignature Language="C#" Value="public string stock_id;" />
<MemberType>Field</MemberType>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters>
</Parameters>
<Docs>
<summary>The stock icon displayed in widgets representing this action.</summary>
<remarks />
</Docs>
</Member>
<Member MemberName="label">
<MemberSignature Language="C#" Value="public string label;" />
<MemberType>Field</MemberType>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters>
</Parameters>
<Docs>
<summary>The label used for menu items and buttons that activate this action.</summary>
<remarks />
</Docs>
</Member>
<Member MemberName="tooltip">
<MemberSignature Language="C#" Value="public string tooltip;" />
<MemberType>Field</MemberType>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters>
</Parameters>
<Docs>
<summary>A tooltip for this action.</summary>
<remarks />
</Docs>
</Member>
<Member MemberName="accelerator">
<MemberSignature Language="C#" Value="public string accelerator;" />
<MemberType>Field</MemberType>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters>
</Parameters>
<Docs>
<summary>The accelerator for the action, in the format understood by <see cref="M:Gtk.Accelerator.Parse()" />, or "" for no accelerator, or <see langword="null" /> to use the stock accelerator.</summary>
<remarks />
</Docs>
</Member>
<Member MemberName="value">
<MemberSignature Language="C#" Value="public int value;" />
<MemberType>Field</MemberType>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Parameters>
</Parameters>
<Docs>
<summary>Integer representing the value of the <see cref="T:Gtk.RadioAction" />.</summary>
<remarks />
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public RadioActionEntry (string name, string stock_id);" />
<MemberType>Constructor</MemberType>
<ReturnValue />
<Parameters>
<Parameter Name="name" Type="System.String" />
<Parameter Name="stock_id" Type="System.String" />
</Parameters>
<Docs>
<summary>To be added</summary>
<param name="name">a <see cref="T:System.String" /></param>
<param name="stock_id">a <see cref="T:System.String" /></param>
<returns>a <see cref="T:Gtk.RadioActionEntry" /></returns>
<remarks>To be added</remarks>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public RadioActionEntry (string name, string stock_id, string label, string accelerator, string tooltip);" />
<MemberType>Constructor</MemberType>
<ReturnValue />
<Parameters>
<Parameter Name="name" Type="System.String" />
<Parameter Name="stock_id" Type="System.String" />
<Parameter Name="label" Type="System.String" />
<Parameter Name="accelerator" Type="System.String" />
<Parameter Name="tooltip" Type="System.String" />
</Parameters>
<Docs>
<summary>To be added</summary>
<param name="name">a <see cref="T:System.String" /></param>
<param name="stock_id">a <see cref="T:System.String" /></param>
<param name="label">a <see cref="T:System.String" /></param>
<param name="accelerator">a <see cref="T:System.String" /></param>
<param name="tooltip">a <see cref="T:System.String" /></param>
<returns>a <see cref="T:Gtk.RadioActionEntry" /></returns>
<remarks>To be added</remarks>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public RadioActionEntry (string name, string stock_id, string label, string accelerator, string tooltip, int value);" />
<MemberType>Constructor</MemberType>
<ReturnValue />
<Parameters>
<Parameter Name="name" Type="System.String" />
<Parameter Name="stock_id" Type="System.String" />
<Parameter Name="label" Type="System.String" />
<Parameter Name="accelerator" Type="System.String" />
<Parameter Name="tooltip" Type="System.String" />
<Parameter Name="value" Type="System.Int32" />
</Parameters>
<Docs>
<summary>To be added</summary>
<param name="name">a <see cref="T:System.String" /></param>
<param name="stock_id">a <see cref="T:System.String" /></param>
<param name="label">a <see cref="T:System.String" /></param>
<param name="accelerator">a <see cref="T:System.String" /></param>
<param name="tooltip">a <see cref="T:System.String" /></param>
<param name="value">a <see cref="T:System.Int32" /></param>
<returns>a <see cref="T:Gtk.RadioActionEntry" /></returns>
<remarks>To be added</remarks>
</Docs>
</Member>
</Members>
</Type>

View file

@ -0,0 +1,196 @@
<Type Name="ToggleActionEntry" FullName="Gtk.ToggleActionEntry">
<TypeSignature Language="C#" Value="public sealed struct ToggleActionEntry" Maintainer="auto" />
<AssemblyInfo>
<AssemblyName>gtk-sharp</AssemblyName>
<AssemblyPublicKey>[00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00 00 24 00 00 52 53 41 31 00 04 00 00 01 00 01 00 71 EB 6C 55 75 52 9C BF 72 44 F7 A6 EA 05 62 84 F9 EA E0 3B CF F2 CC 13 2C 9C 49 0A B3 09 EA B0 B5 6B CE 44 9D F5 03 D9 C0 A8 1E 52 05 85 CD BE 70 E2 FB 90 43 4B AC 04 FA 62 22 A8 00 98 B7 A1 A7 B3 AF 99 1A 41 23 24 BB 43 25 F6 B8 65 BB 64 EB F6 D1 C2 06 D5 73 2D DF BC 70 A7 38 9E E5 3E 0C 24 6E 32 79 74 1A D0 05 03 E4 98 42 E1 9B F3 7B 19 8B 40 21 26 CB 36 89 C2 EA 64 96 A4 7C B4]</AssemblyPublicKey>
<AssemblyVersion>2.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 struct containing all the info necessary for creating an <see cref="T:Gtk.ToggleAction" /></summary>
<remarks>
<para>The ActionEntry struct is C# "syntactic sugar", designed to make it easier for developers to add <see cref="T:Gtk.ToggleAction" />s to their code.</para>
<para>Instead of creating a new <see cref="T:Gtk.ToggleAction" /> object for each action, a developer can create an array of ToggleActionEntry's and add them to an <see cref="T:Gtk.ActionGroup" /> all at once using the <see cref="M:Gtk.ActionGroup.Add" /> method.</para>
</remarks>
</Docs>
<Base>
<BaseTypeName>System.ValueType</BaseTypeName>
</Base>
<Interfaces />
<Attributes />
<Members>
<Member MemberName="name">
<MemberSignature Language="C#" Value="public string name;" />
<MemberType>Field</MemberType>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters>
</Parameters>
<Docs>
<summary>A unique name for the action.</summary>
<remarks />
</Docs>
</Member>
<Member MemberName="stock_id">
<MemberSignature Language="C#" Value="public string stock_id;" />
<MemberType>Field</MemberType>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters>
</Parameters>
<Docs>
<summary>The stock icon displayed in widgets representing this action.</summary>
<remarks />
</Docs>
</Member>
<Member MemberName="label">
<MemberSignature Language="C#" Value="public string label;" />
<MemberType>Field</MemberType>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters>
</Parameters>
<Docs>
<summary>The label used for menu items and buttons that activate this action.</summary>
<remarks />
</Docs>
</Member>
<Member MemberName="tooltip">
<MemberSignature Language="C#" Value="public string tooltip;" />
<MemberType>Field</MemberType>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters>
</Parameters>
<Docs>
<summary>A tooltip for this action.</summary>
<remarks />
</Docs>
</Member>
<Member MemberName="accelerator">
<MemberSignature Language="C#" Value="public string accelerator;" />
<MemberType>Field</MemberType>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters>
</Parameters>
<Docs>
<summary>The accelerator for the action, in the format understood by <see cref="M:Gtk.Accelerator.Parse()" />, or "" for no accelerator, or <see langword="null" /> to use the stock accelerator.</summary>
<remarks />
</Docs>
</Member>
<Member MemberName="activated">
<MemberSignature Language="C#" Value="public EventHandler activated;" />
<MemberType>Field</MemberType>
<ReturnValue>
<ReturnType>System.EventHandler</ReturnType>
</ReturnValue>
<Parameters>
</Parameters>
<Docs>
<summary>EventHandler to be called when the action is triggered.</summary>
<remarks />
</Docs>
</Member>
<Member MemberName="active">
<MemberSignature Language="C#" Value="public bool active;" />
<MemberType>Field</MemberType>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
</Parameters>
<Docs>
<summary>Boolean value indicating whether the initial state of the ToggleAction is "on" or "off".</summary>
<remarks />
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public ToggleActionEntry (string name, string stock_id);" />
<MemberType>Constructor</MemberType>
<ReturnValue />
<Parameters>
<Parameter Name="name" Type="System.String" />
<Parameter Name="stock_id" Type="System.String" />
</Parameters>
<Docs>
<summary>To be added</summary>
<param name="name">a <see cref="T:System.String" /></param>
<param name="stock_id">a <see cref="T:System.String" /></param>
<returns>a <see cref="T:Gtk.ToggleActionEntry" /></returns>
<remarks>To be added</remarks>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public ToggleActionEntry (string name, string stock_id, EventHandler activated);" />
<MemberType>Constructor</MemberType>
<ReturnValue />
<Parameters>
<Parameter Name="name" Type="System.String" />
<Parameter Name="stock_id" Type="System.String" />
<Parameter Name="activated" Type="System.EventHandler" />
</Parameters>
<Docs>
<summary>To be added</summary>
<param name="name">a <see cref="T:System.String" /></param>
<param name="stock_id">a <see cref="T:System.String" /></param>
<param name="activated">a <see cref="T:System.EventHandler" /></param>
<returns>a <see cref="T:Gtk.ToggleActionEntry" /></returns>
<remarks>To be added</remarks>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public ToggleActionEntry (string name, string stock_id, EventHandler activated, bool active);" />
<MemberType>Constructor</MemberType>
<ReturnValue />
<Parameters>
<Parameter Name="name" Type="System.String" />
<Parameter Name="stock_id" Type="System.String" />
<Parameter Name="activated" Type="System.EventHandler" />
<Parameter Name="active" Type="System.Boolean" />
</Parameters>
<Docs>
<summary>To be added</summary>
<param name="name">a <see cref="T:System.String" /></param>
<param name="stock_id">a <see cref="T:System.String" /></param>
<param name="activated">a <see cref="T:System.EventHandler" /></param>
<param name="active">a <see cref="T:System.Boolean" /></param>
<returns>a <see cref="T:Gtk.ToggleActionEntry" /></returns>
<remarks>To be added</remarks>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public ToggleActionEntry (string name, string stock_id, string label, string accelerator, string tooltip, EventHandler activated, bool active);" />
<MemberType>Constructor</MemberType>
<ReturnValue />
<Parameters>
<Parameter Name="name" Type="System.String" />
<Parameter Name="stock_id" Type="System.String" />
<Parameter Name="label" Type="System.String" />
<Parameter Name="accelerator" Type="System.String" />
<Parameter Name="tooltip" Type="System.String" />
<Parameter Name="activated" Type="System.EventHandler" />
<Parameter Name="active" Type="System.Boolean" />
</Parameters>
<Docs>
<summary>To be added</summary>
<param name="name">a <see cref="T:System.String" /></param>
<param name="stock_id">a <see cref="T:System.String" /></param>
<param name="label">a <see cref="T:System.String" /></param>
<param name="accelerator">a <see cref="T:System.String" /></param>
<param name="tooltip">a <see cref="T:System.String" /></param>
<param name="activated">a <see cref="T:System.EventHandler" /></param>
<param name="active">a <see cref="T:System.Boolean" /></param>
<returns>a <see cref="T:Gtk.ToggleActionEntry" /></returns>
<remarks>To be added</remarks>
</Docs>
</Member>
</Members>
</Type>

View file

@ -387,7 +387,7 @@ The behaviour is chosen based on the "is_important" property of the action to wh
<remarks />
</Docs>
</Member>
<Member MemberName=".ctor">
<Member MemberName=".ctor" Deprecated="true">
<MemberSignature Language="C#" Value="public UIManager (Gtk.UIManager self);" />
<MemberType>Constructor</MemberType>
<ReturnValue />
@ -538,5 +538,18 @@ The behaviour is chosen based on the "is_important" property of the action to wh
<remarks>This is intended for applications to get notification just after any action is activated.</remarks>
</Docs>
</Member>
<Member MemberName="NewMergeId">
<MemberSignature Language="C#" Value="public uint NewMergeId ();" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>System.UInt32</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>To be added</summary>
<returns>a <see cref="T:System.UInt32" /></returns>
<remarks>To be added</remarks>
</Docs>
</Member>
</Members>
</Type>

48
gtk/ActionEntry.cs Normal file
View file

@ -0,0 +1,48 @@
// ActionEntry.cs - Syntactic C# sugar for easily defining Actions.
//
// Authors: Jeroen Zwartepoorte <jeroen@xs4all.nl>
//
// Copyright (c) 2004 Jeroen Zwartepoorte
//
// 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.
using System;
namespace Gtk {
public struct ActionEntry {
public string name;
public string stock_id;
public string label;
public string tooltip;
public string accelerator;
public EventHandler activated;
public ActionEntry (string name, string stock_id)
: this (name, stock_id, null, null, null, null) {}
public ActionEntry (string name, string stock_id, EventHandler activated)
: this (name, stock_id, null, null, null, activated) {}
public ActionEntry (string name, string stock_id, string label, string accelerator, string tooltip, EventHandler activated)
{
this.name = name;
this.stock_id = stock_id;
this.label = label;
this.accelerator = accelerator;
this.tooltip = tooltip;
this.activated = activated;
}
}
}

68
gtk/ActionGroup.custom Normal file
View file

@ -0,0 +1,68 @@
// ActionGroup.custom - Syntactic C# sugar for easily defining Actions.
//
// Authors: Jeroen Zwartepoorte <jeroen@xs4all.nl>
//
// Copyright (c) 2004 Jeroen Zwartepoorte
//
// 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.
public void Add (ActionEntry[] entries)
{
foreach (ActionEntry entry in entries) {
Action action = new Action (entry.name, entry.label, entry.tooltip, entry.stock_id);
if (entry.activated != null)
action.Activated += entry.activated;
if (entry.accelerator == null)
Add (action);
else
Add (action, entry.accelerator);
}
}
public void Add (ToggleActionEntry[] entries)
{
foreach (ToggleActionEntry entry in entries) {
ToggleAction action = new ToggleAction (entry.name, entry.label, entry.tooltip, entry.stock_id);
action.Active = entry.active;
if (entry.activated != null)
action.Activated += entry.activated;
if (entry.accelerator == null)
Add (action);
else
Add (action, entry.accelerator);
}
}
public void Add (RadioActionEntry[] entries, int value, ChangedHandler changed)
{
GLib.SList group = new GLib.SList (typeof (RadioAction));
RadioAction[] actions = new RadioAction[entries.Length];
for (int i = 0; i < entries.Length; i++) {
actions[i] = new RadioAction (entries[i].name, entries[i].label,
entries[i].tooltip, entries[i].stock_id, entries[i].value);
actions[i].Group = group;
group = actions[i].Group;
actions[i].Active = value == entries[i].value;
if (entries[i].accelerator == null)
Add (actions[i]);
else
Add (actions[i], entries[i].accelerator);
}
// Add the ChangedHandler when we're done adding all the actions.
// Otherwise, setting the Active property will trigger a premature event.
if (changed != null)
actions[0].Changed += changed;
}

View file

@ -332,6 +332,7 @@
<attr path="/api/namespace/object[@cname='GtkTreeView']/method[@name='ScrollToCell']/*/*[@type='GtkTreeViewColumn*']" name="null_ok">1</attr>
<attr path="/api/namespace/object[@cname='GtkTreeView']/method[@name='SetModel']/*/*[@type='GtkTreeModel*']" name="null_ok">1</attr>
<attr path="/api/namespace/object[@cname='GtkTreeView']/signal[@name='SetScrollAdjustments']" name="name">ScrollAdjustmentsSet</attr>
<attr path="/api/namespace/object[@cname='GtkUIManager']/constructor[@cname='gtk_ui_manager_new_merge_id']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkViewport']/constructor[@cname='gtk_viewport_new']/*/*[@type='GtkAdjustment*']" name="null_ok">1</attr>
<attr path="/api/namespace/object[@cname='GtkViewport']/method[@name='SetHadjustment']/*/*[@type='GtkAdjustment*']" name="null_ok">1</attr>
<attr path="/api/namespace/object[@cname='GtkViewport']/method[@name='SetVadjustment']/*/*[@type='GtkAdjustment*']" name="null_ok">1</attr>

View file

@ -17,11 +17,14 @@ CLEANFILES = $(ASSEMBLY) generated-stamp generated/*.cs $(API) glue/generated.c
DISTCLEANFILES = $(ASSEMBLY).config AssemblyInfo.cs
sources = \
ActionEntry.cs \
Application.cs \
ChildPropertyAttribute.cs \
ITreeNode.cs \
NodeStore.cs \
RadioActionEntry.cs \
ThreadNotify.cs \
ToggleActionEntry.cs \
TreeNodeAttribute.cs \
TreeNode.cs \
TreeNodeValueAttribute.cs
@ -32,6 +35,7 @@ customs = \
Accel.custom \
AccelKey.custom \
Action.custom \
ActionGroup.custom \
Adjustment.custom \
Bin.custom \
Button.custom \

50
gtk/RadioActionEntry.cs Normal file
View file

@ -0,0 +1,50 @@
// RadioActionEntry.cs - Syntactic C# sugar for easily defining RadioActions.
//
// Authors: Jeroen Zwartepoorte <jeroen@xs4all.nl>
//
// Copyright (c) 2004 Jeroen Zwartepoorte
//
// 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.
using System;
namespace Gtk {
public struct RadioActionEntry {
public string name;
public string stock_id;
public string label;
public string tooltip;
public string accelerator;
public int value;
public RadioActionEntry (string name, string stock_id)
: this (name, stock_id, null, null, null, 0) {}
public RadioActionEntry (string name, string stock_id, string label,
string accelerator, string tooltip)
: this (name, stock_id, label, accelerator, tooltip, 0) {}
public RadioActionEntry (string name, string stock_id, string label,
string accelerator, string tooltip, int value)
{
this.name = name;
this.stock_id = stock_id;
this.label = label;
this.accelerator = accelerator;
this.tooltip = tooltip;
this.value = value;
}
}
}

55
gtk/ToggleActionEntry.cs Normal file
View file

@ -0,0 +1,55 @@
// ToggleActionEntry.cs - Syntactic C# sugar for easily defining ToggleActions.
//
// Authors: Jeroen Zwartepoorte <jeroen@xs4all.nl>
//
// Copyright (c) 2004 Jeroen Zwartepoorte
//
// 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.
using System;
namespace Gtk {
public struct ToggleActionEntry {
public string name;
public string stock_id;
public string label;
public string tooltip;
public string accelerator;
public EventHandler activated;
public bool active;
public ToggleActionEntry (string name, string stock_id)
: this (name, stock_id, null, null, null, null, false) {}
public ToggleActionEntry (string name, string stock_id, EventHandler activated)
: this (name, stock_id, null, null, null, activated, false) {}
public ToggleActionEntry (string name, string stock_id, EventHandler activated, bool active)
: this (name, stock_id, null, null, null, activated, active) {}
public ToggleActionEntry (string name, string stock_id, string label,
string accelerator, string tooltip,
EventHandler activated, bool active)
{
this.name = name;
this.stock_id = stock_id;
this.label = label;
this.accelerator = accelerator;
this.tooltip = tooltip;
this.activated = activated;
this.active = active;
}
}
}

View file

@ -20,15 +20,22 @@
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
public uint AddUiFromResource (string resource)
{
if (resource == null)
throw new ArgumentNullException ("resource");
System.IO.Stream s = System.Reflection.Assembly.GetCallingAssembly ().GetManifestResourceStream (resource);
if (s == null)
throw new ArgumentException ("resource must be a valid resource name of 'assembly'.");
public uint AddUiFromResource (string resource)
{
if (resource == null)
throw new ArgumentNullException ("resource");
System.IO.Stream s = System.Reflection.Assembly.GetCallingAssembly ().GetManifestResourceStream (resource);
if (s == null)
throw new ArgumentException ("resource must be a valid resource name of 'assembly'.");
return AddUiFromString (new System.IO.StreamReader (s).ReadToEnd ());
}
return AddUiFromString (new System.IO.StreamReader (s).ReadToEnd ());
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern uint gtk_ui_manager_new_merge_id (IntPtr raw);
public uint NewMergeId ()
{
return gtk_ui_manager_new_merge_id (Handle);
}

View file

@ -1,8 +1,8 @@
// Actions.cs - Gtk.Action class Test implementation
// Actions.cs - Gtk.Action class Test implementation (port of testactions.c)
//
// Author: Jeroen Zwartepoorte <jeroen@xs4all.nl
// Author: Jeroen Zwartepoorte <jeroen@xs4all.nl>
//
// (c) 2003 Jeroen Zwartepoorte
// (c) 2004 Jeroen Zwartepoorte
namespace GtkSamples {
@ -12,18 +12,133 @@ namespace GtkSamples {
public class Actions {
static VBox box = null;
static Statusbar statusbar = null;
static ActionGroup group = null;
static Toolbar toolbar = null;
static SpinButton spin = null;
static ActionGroup dynGroup = null;
static uint mergeId = 0;
static UIManager uim = null;
/* XML description of the menus for the test app. The parser understands
* a subset of the Bonobo UI XML format, and uses GMarkup for parsing */
const string ui_info =
"<menubar>" +
" <menu name=\"Menu _1\" action=\"Menu1Action\">" +
" <menuitem name=\"quit\" action=\"quit\" />" +
" </menu>" +
"</menubar>" +
"<toolbar name=\"toolbar\">" +
" <toolitem name=\"quit\" action=\"quit\" />" +
"</toolbar>";
" <menubar>\n" +
" <menu name=\"Menu _1\" action=\"Menu1Action\">\n" +
" <menuitem name=\"cut\" action=\"cut\" />\n" +
" <menuitem name=\"copy\" action=\"copy\" />\n" +
" <menuitem name=\"paste\" action=\"paste\" />\n" +
" <separator name=\"sep1\" />\n" +
" <menuitem name=\"bold1\" action=\"bold\" />\n" +
" <menuitem name=\"bold2\" action=\"bold\" />\n" +
" <separator name=\"sep2\" />\n" +
" <menuitem name=\"toggle-cnp\" action=\"toggle-cnp\" />\n" +
" <separator name=\"sep3\" />\n" +
" <menuitem name=\"quit\" action=\"quit\" />\n" +
" </menu>\n" +
" <menu name=\"Menu _2\" action=\"Menu2Action\">\n" +
" <menuitem name=\"cut\" action=\"cut\" />\n" +
" <menuitem name=\"copy\" action=\"copy\" />\n" +
" <menuitem name=\"paste\" action=\"paste\" />\n" +
" <separator name=\"sep4\"/>\n" +
" <menuitem name=\"bold\" action=\"bold\" />\n" +
" <separator name=\"sep5\"/>\n" +
" <menuitem name=\"justify-left\" action=\"justify-left\" />\n" +
" <menuitem name=\"justify-center\" action=\"justify-center\" />\n" +
" <menuitem name=\"justify-right\" action=\"justify-right\" />\n" +
" <menuitem name=\"justify-fill\" action=\"justify-fill\" />\n" +
" <separator name=\"sep6\"/>\n" +
" <menuitem name=\"customise-accels\" action=\"customise-accels\" />\n" +
" <separator name=\"sep7\"/>\n" +
" <menuitem action=\"toolbar-icons\" />\n" +
" <menuitem action=\"toolbar-text\" />\n" +
" <menuitem action=\"toolbar-both\" />\n" +
" <menuitem action=\"toolbar-both-horiz\" />\n" +
" <separator name=\"sep8\"/>\n" +
" <menuitem action=\"toolbar-small-icons\" />\n" +
" <menuitem action=\"toolbar-large-icons\" />\n" +
" </menu>\n" +
" <menu name=\"DynamicMenu\" action=\"Menu3Action\" />\n" +
" </menubar>\n" +
" <toolbar name=\"toolbar\">\n" +
" <toolitem name=\"cut\" action=\"cut\" />\n" +
" <toolitem name=\"copy\" action=\"copy\" />\n" +
" <toolitem name=\"paste\" action=\"paste\" />\n" +
" <separator name=\"sep9\" />\n" +
" <toolitem name=\"bold\" action=\"bold\" />\n" +
" <separator name=\"sep10\" />\n" +
" <toolitem name=\"justify-left\" action=\"justify-left\" />\n" +
" <toolitem name=\"justify-center\" action=\"justify-center\" />\n" +
" <toolitem name=\"justify-right\" action=\"justify-right\" />\n" +
" <toolitem name=\"justify-fill\" action=\"justify-fill\" />\n" +
" <separator name=\"sep11\"/>\n" +
" <toolitem name=\"quit\" action=\"quit\" />\n" +
" </toolbar>\n";
static ActionEntry[] entries = new ActionEntry[] {
new ActionEntry ("Menu1Action", null, "Menu _1", null, null, null),
new ActionEntry ("Menu2Action", null, "Menu _2", null, null, null),
new ActionEntry ("Menu3Action", null, "_Dynamic Menu", null, null, null),
new ActionEntry ("cut", Stock.Cut, "C_ut", "<control>X",
"Cut the selected text to the clipboard",
new EventHandler (OnActivate)),
new ActionEntry ("copy", Stock.Copy, "_Copy", "<control>C",
"Copy the selected text to the clipboard",
new EventHandler (OnActivate)),
new ActionEntry ("paste", Stock.Paste, "_Paste", "<control>V",
"Paste the text from the clipboard",
new EventHandler (OnActivate)),
new ActionEntry ("quit", Stock.Quit, null, "<control>Q",
"Quit the application", new EventHandler (OnQuit)),
new ActionEntry ("customise-accels", null, "Customise _Accels", null,
"Customize keyboard shortcuts",
new EventHandler (OnCustomizeAccels)),
new ActionEntry ("toolbar-small-icons", null, "Small Icons", null,
null, new EventHandler (OnToolbarSizeSmall)),
new ActionEntry ("toolbar-large-icons", null, "Large Icons", null,
null, new EventHandler (OnToolbarSizeLarge))
};
static ToggleActionEntry[] toggleEntries = new ToggleActionEntry[] {
new ToggleActionEntry ("bold", Stock.Bold, "_Bold", "<control>B",
"Change to bold face",
new EventHandler (OnToggle), false),
new ToggleActionEntry ("toggle-cnp", null, "Enable Cut/Copy/Paste",
null, "Change the sensitivity of the cut, copy and paste actions",
new EventHandler (OnToggleCnp), true)
};
enum Justify {
Left,
Center,
Right,
Fill
};
static RadioActionEntry[] radioEntries = new RadioActionEntry[] {
new RadioActionEntry ("justify-left", Stock.JustifyLeft, "_Left",
"<control>L", "Left justify the text",
(int)Justify.Left),
new RadioActionEntry ("justify-center", Stock.JustifyCenter, "C_enter",
"<control>E", "Center justify the text",
(int)Justify.Center),
new RadioActionEntry ("justify-right", Stock.JustifyRight, "_Right",
"<control>R", "Right justify the text",
(int)Justify.Right),
new RadioActionEntry ("justify-fill", Stock.JustifyFill, "_Fill",
"<control>J", "Fill justify the text",
(int)Justify.Fill)
};
static RadioActionEntry[] toolbarEntries = new RadioActionEntry[] {
new RadioActionEntry ("toolbar-icons", null, "Icons", null,
null, (int)ToolbarStyle.Icons),
new RadioActionEntry ("toolbar-text", null, "Text", null,
null, (int)ToolbarStyle.Text),
new RadioActionEntry ("toolbar-both", null, "Both", null,
null, (int)ToolbarStyle.Both),
new RadioActionEntry ("toolbar-both-horiz", null, "Both Horizontal",
null, null, (int)ToolbarStyle.BothHoriz)
};
public static int Main (string[] args)
{
@ -35,15 +150,13 @@ namespace GtkSamples {
box = new VBox (false, 0);
win.Add (box);
ActionGroup group = new ActionGroup ("TestGroup");
Action action = new Action ("quit", null, "Quit the program", Stock.Quit);
action.Activated += new EventHandler (OnQuit);
group.Add (action, "<control>Q");
group = new ActionGroup ("TestActions");
group.Add (entries);
group.Add (toggleEntries);
group.Add (radioEntries, (int)Justify.Left, new ChangedHandler (OnRadio));
group.Add (toolbarEntries, (int)ToolbarStyle.BothHoriz, new ChangedHandler (OnToolbarStyle));
action = new Action ("Menu1Action", "_File", null, null);
group.Add (action);
UIManager uim = new UIManager ();
uim = new UIManager ();
uim.AddWidget += new AddWidgetHandler (OnWidgetAdd);
uim.ConnectProxy += new ConnectProxyHandler (OnProxyConnect);
uim.InsertActionGroup (group, 0);
@ -52,14 +165,122 @@ namespace GtkSamples {
statusbar = new Statusbar ();
box.PackEnd (statusbar, false, true, 0);
VBox vbox = new VBox (false, 5);
Button button = new Button ("Blah");
box.PackEnd (button, true, true, 0);
vbox.PackEnd (button, true, true, 0);
HBox hbox = new HBox (false, 5);
spin = new SpinButton (new Adjustment (100, 100, 10000, 1, 100, 100), 100, 0);
hbox.PackStart (spin, true, true, 0);
button = new Button ("Remove");
button.Clicked += new EventHandler (OnDynamicRemove);
hbox.PackEnd (button, false, false, 0);
button = new Button ("Add");
button.Clicked += new EventHandler (OnDynamicAdd);
hbox.PackEnd (button, false, false, 0);
vbox.PackEnd (hbox, false, false, 0);
box.PackEnd (vbox, true, true, 0);
win.ShowAll ();
Application.Run ();
return 0;
}
static void OnActivate (object obj, EventArgs args)
{
Action action = (Action)obj;
Console.WriteLine ("Action {0} (type={1}) activated",
action.Name, action.GetType ().FullName);
}
static void OnCustomizeAccels (object obj, EventArgs args)
{
Console.WriteLine ("Sorry, accel dialog not available");
}
static void OnToolbarSizeSmall (object obj, EventArgs args)
{
toolbar.IconSize = IconSize.SmallToolbar;
}
static void OnToolbarSizeLarge (object obj, EventArgs args)
{
toolbar.IconSize = IconSize.LargeToolbar;
}
static void OnToggle (object obj, EventArgs args)
{
ToggleAction action = (ToggleAction)obj;
Console.WriteLine ("Action {0} (type={1}) activated (active={2})",
action.Name, action.GetType ().FullName, action.Active);
}
static void OnToggleCnp (object obj, EventArgs args)
{
Action action = (ToggleAction)obj;
bool sensitive = ((ToggleAction)action).Active;
action = group.GetAction ("cut");
action.Sensitive = sensitive;
action = group.GetAction ("copy");
action.Sensitive = sensitive;
action = group.GetAction ("paste");
action.Sensitive = sensitive;
action = group.GetAction ("toggle-cnp");
if (sensitive)
action.Label = "Disable Cut and past ops";
else
action.Label = "Enable Cut and paste ops";
}
static void OnRadio (object obj, ChangedArgs args)
{
RadioAction action = (RadioAction)obj;
Console.WriteLine ("Action {0} (type={1}) activated (active={2}) (value {3})",
action.Name, action.GetType ().FullName,
action.Active, action.CurrentValue);
}
static void OnToolbarStyle (object obj, ChangedArgs args)
{
RadioAction action = (RadioAction)obj;
ToolbarStyle style = (ToolbarStyle)action.CurrentValue;
toolbar.ToolbarStyle = style;
}
static void OnDynamicAdd (object obj, EventArgs args)
{
if (mergeId != 0 || dynGroup != null)
return;
int num = spin.ValueAsInt;
dynGroup = new ActionGroup ("DynamicActions");
uim.InsertActionGroup (dynGroup, 0);
mergeId = uim.NewMergeId ();
for (int i = 0; i < num; i++) {
string name = "DynAction" + i;
string label = "Dynamic Action " + i;
Action action = new Action (name, label);
dynGroup.Add (action);
uim.AddUi (mergeId, "/menubar/DynamicMenu", name,
name, UIManagerItemType.Menuitem, false);
}
uim.EnsureUpdate ();
}
static void OnDynamicRemove (object obj, EventArgs args)
{
if (mergeId == 0 || dynGroup == null)
return;
uim.RemoveUi (mergeId);
uim.EnsureUpdate ();
mergeId = 0;
uim.RemoveActionGroup (dynGroup);
dynGroup = null;
}
static void OnWindowDelete (object obj, DeleteEventArgs args)
{
Application.Quit ();
@ -68,7 +289,8 @@ namespace GtkSamples {
static void OnWidgetAdd (object obj, AddWidgetArgs args)
{
Console.WriteLine ("OnWidgetAdd {0}", args.Widget.Name);
if (args.Widget is Toolbar)
toolbar = (Toolbar)args.Widget;
args.Widget.Show ();
box.PackStart (args.Widget, false, true, 0);
}
@ -87,7 +309,6 @@ namespace GtkSamples {
static void OnProxyConnect (object obj, ConnectProxyArgs args)
{
Console.WriteLine ("ProxyConnect {0}, {1}", args.Action, args.Proxy.Name);
if (args.Proxy is MenuItem) {
((GLib.Object)args.Proxy).Data ["action"] = args.Action;
((Item)args.Proxy).Selected += new EventHandler (OnSelect);
@ -97,7 +318,6 @@ namespace GtkSamples {
static void OnQuit (object obj, EventArgs args)
{
Console.WriteLine ("quit");
Application.Quit ();
}
}