* generator/Parameters.cs (IsHidden): method to check if a

parameter should be hidden in the managed sig (eg, because it's
	user_data, or it's the length of the preceding array/string, etc).
	(VisibleCount): the number of parameters that will actually be
	exposed in the managed signature.
	(IsAccessor): test VisibleCount, not Count
	(AccessorReturnType, AccessorName): deal with the fact that the
	accessor parameter might not be the first one.

	* generator/CallbackGen.cs:
	* generator/Signature.cs: use Parameters.IsHidden.

	* generator/Method.cs (Initialize): set is_set based on
	VisibleCount, not Count.
	(Validate): call base.Validate() before Initialize() so that
	VisibleCount will be correct in Initialize.

	* generator/MethodBody.cs (GetCallString, CallArrayLength,
	Initialize): update to deal with accessors with multiple args.

	* gtk/Clipboard.custom (SetText): implement as an Obsolete variant
	of the Text property

	* gtk/IconTheme.custom (SearchPath, SetSearchPath): obsolete
	SetSearchPath, implement a setter on SearchPath instead.

	* gtk/ListStore.custom (SetColumnTypes):
	* gtk/TreeStore.custom (SetColumnTypes): implement as an Obsolete
	variant of the ColumnTypes property.

	* glade/XML.custom (CustomHandler): implement as a property
	(SetCustomHandler): Mark this obsolete

	* glade/Global.custom (SetCustomHandler): deprecate in favor of
	XML.CustomHandler.

	* gnomedb/Editor.custom (SetText): implement as an Obsolete
	variant of the Text property

svn path=/trunk/gtk-sharp/; revision=43898
This commit is contained in:
Dan Winship 2005-05-02 20:10:03 +00:00
parent 5825f7f4fe
commit b7e4cc507e
24 changed files with 360 additions and 125 deletions

View file

@ -1,3 +1,44 @@
2005-05-02 Dan Winship <danw@novell.com>
* generator/Parameters.cs (IsHidden): method to check if a
parameter should be hidden in the managed sig (eg, because it's
user_data, or it's the length of the preceding array/string, etc).
(VisibleCount): the number of parameters that will actually be
exposed in the managed signature.
(IsAccessor): test VisibleCount, not Count
(AccessorReturnType, AccessorName): deal with the fact that the
accessor parameter might not be the first one.
* generator/CallbackGen.cs:
* generator/Signature.cs: use Parameters.IsHidden.
* generator/Method.cs (Initialize): set is_set based on
VisibleCount, not Count.
(Validate): call base.Validate() before Initialize() so that
VisibleCount will be correct in Initialize.
* generator/MethodBody.cs (GetCallString, CallArrayLength,
Initialize): update to deal with accessors with multiple args.
* gtk/Clipboard.custom (SetText): implement as an Obsolete variant
of the Text property
* gtk/IconTheme.custom (SearchPath, SetSearchPath): obsolete
SetSearchPath, implement a setter on SearchPath instead.
* gtk/ListStore.custom (SetColumnTypes):
* gtk/TreeStore.custom (SetColumnTypes): implement as an Obsolete
variant of the ColumnTypes property.
* glade/XML.custom (CustomHandler): implement as a property
(SetCustomHandler): Mark this obsolete
* glade/Global.custom (SetCustomHandler): deprecate in favor of
XML.CustomHandler.
* gnomedb/Editor.custom (SetText): implement as an Obsolete
variant of the Text property
2005-05-02 Dan Winship <danw@novell.com>
Apply the parts of the generator reorganization from #69514 that

View file

@ -115,6 +115,26 @@ public class GladeApp
</remarks>
</Docs>
</Member>
<Member MemberName="CustomHandler">
<MemberSignature Language="C#" Value="public static Glade.XMLCustomWidgetHandler CustomHandler { set; };" />
<MemberType>Property</MemberType>
<ReturnValue>
<ReturnType>Glade.XMLCustomWidgetHandler</ReturnType>
</ReturnValue>
<Docs>
<summary>Allows you to override the default behaviour when a Custom widget is found in an interface.</summary>
<returns>a <see cref="T:Glade.XMLCustomWidgetHandler" /></returns>
<remarks>
<para>
Setting this property allows you to override the default
behaviour when a Custom widget is found in an
interface. This could be used by a language binding to
call some other function, or to limit what functions can
be called to create custom widgets
</para>
</remarks>
</Docs>
</Member>
<Member MemberName="SetCustomHandler">
<MemberSignature Language="C#" Value="public static void SetCustomHandler (Glade.XMLCustomWidgetHandler handler);" />
<MemberType>Method</MemberType>
@ -125,20 +145,9 @@ public class GladeApp
<Parameter Name="handler" Type="Glade.XMLCustomWidgetHandler" />
</Parameters>
<Docs>
<summary>
This function allows you to override the default behaviour
when a Custom widget is found in an interface.
</summary>
<summary>Deprecated: Replaced by the <see cref="M:Glade.XML.CustomHandler" /> property.</summary>
<param name="handler">the custom widget handler</param>
<remarks>
<para>
Calling this function allows you to override the default
behaviour when a Custom widget is found in an
interface. This could be used by a language binding to
call some other function, or to limit what functions can
be called to create custom widgets
</para>
</remarks>
<remarks>Deprecated: Replaced by the <see cref="M:Glade.XML.CustomHandler" /> property.</remarks>
</Docs>
</Member>
<Member MemberName="BindFields">

View file

@ -84,7 +84,7 @@
<remarks>To be added</remarks>
</Docs>
</Member>
<Member MemberName="SetText">
<Member MemberName="SetText" Deprecated="true">
<MemberSignature Language="C#" Value="public void SetText (string text);" />
<MemberType>Method</MemberType>
<ReturnValue>
@ -218,5 +218,17 @@
<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="Text">
<MemberSignature Language="C#" Value="public string Text { set; };" />
<MemberType>Property</MemberType>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Docs>
<summary>To be added</summary>
<returns>a <see cref="T:System.String" /></returns>
<remarks>To be added</remarks>
</Docs>
</Member>
</Members>
</Type>

View file

@ -13,7 +13,7 @@
<summary>An object that stores clipboard data.</summary>
<remarks>
<para> The <see cref="T:Gtk.Clipboard" /> object represents a clipboard of data shared between different processes or between different widgets in the same process. Each clipboard is identified by a name encoded as a <see cref="T:Gdk.Atom" />. (Conversion to and from strings can be done with <see cref="M:Gdk.Atom.Intern(System.String,System.Boolean)" /> and <see cref="M:Gdk.Atom.Name()" />.) The default clipboard corresponds to the "CLIPBOARD" atom; another commonly used clipboard is the "PRIMARY" clipboard, which, in X, traditionally contains the currently selected text.</para>
<para>To support having a number of different formats on the clipboard at the same time, the clipboard mechanism allows providing callbacks instead of the actual data. When you set the contents of the clipboard, you can either supply the data directly (via methods like <see cref="M:Gtk.Clipboard.SetText()" />), or you can supply a callback to be called at a later time when the data is needed (via <see cref="M:Gtk.Clipboard.SetWithData()" /> or <see cref="M:Gtk.Clipboard.SetWithOwner()" />.) Providing a callback also avoids having to make copies of the data when it is not needed.</para>
<para>To support having a number of different formats on the clipboard at the same time, the clipboard mechanism allows providing callbacks instead of the actual data. When you set the contents of the clipboard, you can either supply the data directly (eg, via the <see cref="M:Gtk.Clipboard.Text" /> property), or you can supply a callback to be called at a later time when the data is needed (via <see cref="M:Gtk.Clipboard.SetWithData()" /> or <see cref="M:Gtk.Clipboard.SetWithOwner()" />.) Providing a callback also avoids having to make copies of the data when it is not needed.</para>
<para>
<see cref="M:Gtk.Clipboard.SetWithData()" /> and <see cref="M:Gtk.Clipboard.SetWithOwner()" /> are quite similar; the choice between the two depends mostly on which is more convenient in a particular situation. The former is most useful when you want to have a blob of data with callbacks to convert it into the various data types that you advertise. When the clear_func you provided is called, you simply free the data blob. The latter is more useful when the contents of clipboard reflect the internal state of a <see cref="T:GLib.Object" /> (As an example, for the PRIMARY clipboard, when an entry widget provides the contents for the clipboar the contents are simply the text within the selected region.) If the contents change, the entry widget can call <see cref="M:Gtk.Clipboard.SetWithOwner()" /> to update the timestamp for clipboard ownership, without having to worry about clear_func being called.</para>
<para>Requesting the data from the clipboard is essentially asynchronous. If the contents of the clipboard are provided within the same process, then a direct function call will be made to retrieve the data, but if they are provided by another process, then the data needs to be retrieved from the other process, which may take some time. To avoid blocking the user interface, the call to request the selection, <see cref="M:Gtk.Clipboard.RequestContents()" /> takes a callback that will be called when the contents are received (or when the request fails.) If you do not want to deal with providing a separate callback, you can also use <see cref="M:Gtk.Clipboard.WaitForContents()" />. What this does is run the GLib main loop recursively waiting for the contents. This can simplify the code flow, but you still have to be aware that other callbacks in your program can be called while this recursive mainloop is running.</para>
@ -131,7 +131,19 @@
<remarks>If the clipboard contents callbacks were set with <see cref="M:Gtk.Clipboard.SetWithOwner()" />, and the <see cref="M:Gtk.Clipboard.SetWithData()" /> or <see cref="M:Gtk.Clipboard.Clear()" /> has not been subsequently called, it will return the owner set by <see cref="M:Gtk.Clipboard.SetWithOwner()" />.</remarks>
</Docs>
</Member>
<Member MemberName="SetText">
<Member MemberName="Text">
<MemberSignature Language="C#" Value="public string Text { set; };" />
<MemberType>Property</MemberType>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Docs>
<summary>Sets the contents of the clipboard to the given UTF-8 string.</summary>
<returns>a <see cref="T:System.String" /></returns>
<remarks>Gtk# will make a copy of the text and take responsibility for responding for requests for the text, and for converting the text into the requested format.</remarks>
</Docs>
</Member>
<Member MemberName="SetText" Deprecated="true">
<MemberSignature Language="C#" Value="public void SetText (string text);" />
<MemberType>Method</MemberType>
<ReturnValue>
@ -141,9 +153,9 @@
<Parameter Name="text" Type="System.String" />
</Parameters>
<Docs>
<summary>Sets the contents of the clipboard to the given UTF-8 string.</summary>
<summary>Deprecated method to set the contents of the clipboard.</summary>
<param name="text">an object of type <see cref="T:System.String" /></param>
<remarks>Gtk# will make a copy of the text and take responsibility for responding for requests for the text, and for converting the text into the requested format.</remarks>
<remarks>Replaced by the <see cref="M:Gtk.Clipboard.Text" /> property.</remarks>
</Docs>
</Member>
<Member MemberName="Display">

View file

@ -186,6 +186,38 @@ In general, if you use <see cref="M:Gtk.IconTheme.AddBuiltinIcon()" /> you shoul
<remarks>See <see cref="P:Gtk.IconTheme.SearchPath" />.</remarks>
</Docs>
</Member>
<Member MemberName="SearchPath">
<MemberSignature Language="C#" Value="public string [] SearchPath { set; get; };" />
<MemberType>Property</MemberType>
<ReturnValue>
<ReturnType>System.String[]</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>The current search path</summary>
<returns>a <see cref="T:System.String" />, array of directories that are searched for icon themes</returns>
<remarks>
<para>
When looking for an icon theme, Gtk will search for a
subdirectory of one or more of the directories in this
path with the same name as the icon theme. (Themes from
multiple of the path elements are combined to allow
themes to be extended by adding icons in the user's home
directory.)
</para>
<para>
In addition if an icon found is not found either in the
current icon theme or the default icon theme, and an
image file with the right name is found directly in one
of the elements of path, then that image will be used
for the icon name. (This is a legacy feature, and new
icons should be put into the default icon theme, which
is called DEFAULT_THEME_NAME, rather than directly on
the icon path.)
</para>
</remarks>
</Docs>
</Member>
<Member MemberName="SetSearchPath">
<MemberSignature Language="C#" Value="public void SetSearchPath (string [] path);" />
<MemberType>Method</MemberType>
@ -196,16 +228,9 @@ In general, if you use <see cref="M:Gtk.IconTheme.AddBuiltinIcon()" /> you shoul
<Parameter Name="path" Type="System.String[]" />
</Parameters>
<Docs>
<summary>Sets the current search path.</summary>
<summary>Deprecated method to set the current search path.</summary>
<param name="path">a <see cref="T:System.String[]" />, array of directories that are searched for icon themes</param>
<remarks>
<para>
Sets the search path for the icon theme object. When looking for an icon theme, Gtk will search for a subdirectory of one or more of the directories in path with the same name as the icon theme. (Themes from multiple of the path elements are combined to allow themes to be extended by adding icons in the user's home directory.)
</para>
<para>
In addition if an icon found is not found either in the current icon theme or the default icon theme, and an image file with the right name is found directly in one of the elements of path, then that image will be used for the icon name. (This is a legacy feature, and new icons should be put into the default icon theme, which is called DEFAULT_THEME_NAME, rather than directly on the icon path.)
</para>
</remarks>
<remarks>Replaced by the <see cref="M:Gtk.IconTheme:SearchPath" /> property.</remarks>
</Docs>
</Member>
<Member MemberName="LookupIcon">
@ -366,19 +391,6 @@ In addition if an icon found is not found either in the current icon theme or th
<remarks />
</Docs>
</Member>
<Member MemberName="SearchPath">
<MemberSignature Language="C#" Value="public string [] SearchPath { get; };" />
<MemberType>Property</MemberType>
<ReturnValue>
<ReturnType>System.String[]</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>The current search path</summary>
<returns>a <see cref="T:System.String" />, array of directories that are searched for icon themes</returns>
<remarks />
</Docs>
</Member>
<Member MemberName="Changed">
<MemberSignature Language="C#" Value="public event EventHandler Changed;" />
<MemberType>Event</MemberType>

View file

@ -1078,7 +1078,26 @@ The above example creates a new three columns list store. The types of the colum
<remarks>Returns the native <see cref="T:GLib.GType" /> value for <see cref="T:Gtk.ListStore" />.</remarks>
</Docs>
</Member>
<Member MemberName="SetColumnTypes">
<Member MemberName="ColumnTypes">
<MemberSignature Language="C#" Value="public GLib.GType [] ColumnTypes { set; };" />
<MemberType>Property</MemberType>
<ReturnValue>
<ReturnType>GLib.GType[]</ReturnType>
</ReturnValue>
<Docs>
<summary>The types in each column of a ListStore.</summary>
<returns>a <see cref="T:GLib.GType[]" /></returns>
<remarks>
This property is meant primarily for classes that
inherit from <see cref="T:Gtk.ListStore" />, and should
only be used when constructing a new <see
cref="T:Gtk.ListStore" />. It will not function after a
row has been added or after a method on the <see
cref="T:Gtk.TreeModel" /> interface has been called.
</remarks>
</Docs>
</Member>
<Member MemberName="SetColumnTypes" Deprecated="true">
<MemberSignature Language="C#" Value="public void SetColumnTypes (GLib.GType[] types);" />
<MemberType>Method</MemberType>
<ReturnValue>
@ -1088,14 +1107,9 @@ The above example creates a new three columns list store. The types of the colum
<Parameter Name="types" Type="GLib.GType[]" />
</Parameters>
<Docs>
<summary>Sets what types go in each column of a ListStore.</summary>
<summary>Deprecated method to set what types go in each column of a ListStore.</summary>
<param name="types">a <see cref="T:GLib.GType[]" /></param>
<remarks> This function is meant primarily for #GObjects that inherit
from <see cref="T:Gtk.ListStore" /> and should only be used when
constructing a new <see cref="T:Gtk.ListStore" />. It will not
function after a row has been added or after a method on the
<see cref="T:Gtk.TreeModel" /> interface has been called.
</remarks>
<remarks>See <see cref="M:Gtk.ListStore.ColumnTypes" /></remarks>
</Docs>
</Member>
<Member MemberName="GetColumnType">

View file

@ -1221,7 +1221,38 @@ store = new TreeStore (typeof (int), typeof (string));
<remarks>Returns the native <see cref="T:GLib.GType" /> value for <see cref="T:Gtk.TreeStore" />.</remarks>
</Docs>
</Member>
<Member MemberName="SetColumnTypes">
<Member MemberName="ColumnTypes">
<MemberSignature Language="C#" Value="public GLib.GType [] ColumnTypes { set; };" />
<MemberType>Property</MemberType>
<ReturnValue>
<ReturnType>GLib.GType[]</ReturnType>
</ReturnValue>
<Docs>
<summary>To be added</summary>
<returns>a <see cref="T:GLib.GType[]" /></returns>
<remarks>To be added</remarks>
</Docs>
</Member>
<Member MemberName="ColumnTypes">
<MemberSignature Language="C#" Value="public GLib.GType [] ColumnTypes { set; };" />
<MemberType>Property</MemberType>
<ReturnValue>
<ReturnType>GLib.GType[]</ReturnType>
</ReturnValue>
<Docs>
<summary>The types in each column of a TreeStore.</summary>
<returns>a <see cref="T:GLib.GType[]" /></returns>
<remarks>
This property is meant primarily for classes that
inherit from <see cref="T:Gtk.TreeStore" />, and should
only be used when constructing a new <see
cref="T:Gtk.TreeStore" />. It will not function after a
row has been added or after a method on the <see
cref="T:Gtk.TreeModel" /> interface has been called.
</remarks>
</Docs>
</Member>
<Member MemberName="SetColumnTypes" Deprecated="true">
<MemberSignature Language="C#" Value="public void SetColumnTypes (GLib.GType[] types);" />
<MemberType>Method</MemberType>
<ReturnValue>
@ -1231,30 +1262,9 @@ store = new TreeStore (typeof (int), typeof (string));
<Parameter Name="types" Type="GLib.GType[]" />
</Parameters>
<Docs>
<summary>Sets what types go in each column of a ListStore.</summary>
<summary>Deprecated method to set what types go in each column of a TreeStore.</summary>
<param name="types">a <see cref="T:GLib.GType[]" /></param>
<remarks> This function is meant primarily for #GObjects that inherit
from <see cref="T:Gtk.ListStore" /> and should only be used when
constructing a new <see cref="T:Gtk.ListStore" />. It will not
function after a row has been added or after a method on the
<see cref="T:Gtk.TreeModel" /> interface has been called.
</remarks>
</Docs>
</Member>
<Member MemberName="GetColumnType">
<MemberSignature Language="C#" Value="public virtual GLib.GType GetColumnType (int index_);" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>GLib.GType</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="index_" Type="System.Int32" />
</Parameters>
<Docs>
<summary>Gets the type of data stored in column number <paramref name="index_" />.</summary>
<param name="index_">a <see cref="T:System.Int32" />, the column to check</param>
<returns>a <see cref="T:GLib.GType" /></returns>
<remarks />
<remarks>See <see cref="M:Gtk.TreeStore.ColumnTypes" /></remarks>
</Docs>
</Member>
<Member MemberName="OnRowsReordered">
@ -1378,7 +1388,7 @@ store = new TreeStore (typeof (int), typeof (string));
<Docs>
<summary>Protected Constructor.</summary>
<param name="gtype">a <see cref="T:GLib.GType" /></param>
<returns>a <see cref="T:Gtk.ListStore" /></returns>
<returns>a <see cref="T:Gtk.TreeStore" /></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>
@ -1408,7 +1418,7 @@ store = new TreeStore (typeof (int), typeof (string));
<Parameter Name="parent" Type="Gtk.TreeIter" />
</Parameters>
<Docs>
<summary>Reorders the ListStore.</summary>
<summary>Reorders the TreeStore.</summary>
<returns>a <see cref="T:System.Int32" />.</returns>
<remarks>(FIXME: Does this binding work?)</remarks>
</Docs>

View file

@ -84,16 +84,11 @@ namespace GtkSharp.Generation {
{
Parameter p = parms [i];
if (i > 0 && p.IsLength && parms[i-1].IsString)
continue;
if ((i == parms.Count - 1) && p.IsUserData)
continue;
if (p.CType == "GError**") {
sw.WriteLine ("\t\t\t" + p.Name + " = IntPtr.Zero;");
continue;
}
} else if (parms.IsHidden (p))
continue;
IGeneratable gen = p.Generatable;

View file

@ -121,7 +121,7 @@ namespace GtkSharp.Generation {
Parameters parms = Parameters;
is_get = ((((parms.IsAccessor && retval.IsVoid) || (parms.Count == 0 && !retval.IsVoid)) || (parms.Count == 0 && !retval.IsVoid)) && Name.Length > 3 && (Name.StartsWith ("Get") || Name.StartsWith ("Is") || Name.StartsWith ("Has")));
is_set = ((parms.IsAccessor || (parms.Count == 1 && retval.IsVoid)) && (Name.Length > 3 && Name.Substring(0, 3) == "Set"));
is_set = ((parms.IsAccessor || (parms.VisibleCount == 1 && retval.IsVoid)) && (Name.Length > 3 && Name.Substring(0, 3) == "Set"));
call = "(" + (IsStatic ? "" : container_type.CallByName () + (parms.Count > 0 ? ", " : "")) + Body.GetCallString (is_set) + ")";
@ -131,7 +131,7 @@ namespace GtkSharp.Generation {
public override bool Validate ()
{
if (!Initialize () || !base.Validate ())
if (!base.Validate () || !Initialize ())
return false;
if (!retval.Validate ()) {

View file

@ -42,10 +42,10 @@ namespace GtkSharp.Generation {
return type != "int" ? "(" + type + ") " : "";
}
private string CallArrayLength (Parameter array, Parameter length)
private string CallArrayLength (string array_name, Parameter length)
{
string result = array.Name + " != null ? ";
result += CastFromInt (length.CSType) + array.Name + ".Length";
string result = array_name + " != null ? ";
result += CastFromInt (length.CSType) + array_name + ".Length";
result += ": 0";
return length.Generatable.CallByName (result);
}
@ -59,24 +59,28 @@ namespace GtkSharp.Generation {
for (int i = 0; i < parameters.Count; i++) {
Parameter p = parameters [i];
IGeneratable igen = p.Generatable;
string name = (i == 0 && is_set) ? "value" : p.Name;
if (p.IsCount) {
if (i > 0 && parameters [i - 1].IsArray) {
result[i] = CallArrayLength (parameters[i - 1], p);
string array_name = (i == 1 && is_set) ? "value" : parameters [i - 1].Name;
result[i] = CallArrayLength (array_name, p);
continue;
} else if (i < parameters.Count - 1 && parameters [i + 1].IsArray) {
result[i] = CallArrayLength (parameters[i + 1], p);
string array_name = (i == 0 && is_set) ? "value" : parameters [i + 1].Name;
result[i] = CallArrayLength (array_name, p);
continue;
}
} else if (i > 0 && parameters [i - 1].IsString && p.IsLength) {
result[i] = igen.CallByName (CastFromInt (p.CSType) + parameters [i - 1].Name + ".Length");
string string_name = (i == 1 && is_set) ? "value" : parameters [i - 1].Name;
result[i] = igen.CallByName (CastFromInt (p.CSType) + string_name + ".Length");
continue;
} else if (p.IsArray && p.MarshalType != p.CSType) {
result[i] = "native_" + p.Name;
continue;
}
string call_parm = p.CallByName (is_set && i == 0 ? "value" : p.Name);
string call_parm = p.CallByName (name);
if (p.CType == "GError**") {
result [i] += "out ";
@ -122,8 +126,8 @@ namespace GtkSharp.Generation {
sw.WriteLine(indent + "\t\t\t" + gen.MarshalType + " " + name + "_as_native;");
else if (p.IsArray && p.MarshalType != p.CSType) {
sw.WriteLine(indent + "\t\t\tint cnt_" + p.Name + " = {0} == null ? 0 : {0}.Length;", name);
sw.WriteLine(indent + "\t\t\t{0}[] native_" + p.Name + " = new {0} [cnt_{1}];", p.MarshalType.TrimEnd('[', ']'), name);
sw.WriteLine(indent + "\t\t\tfor (int i = 0; i < cnt_{0}; i++)", name);
sw.WriteLine(indent + "\t\t\t{0}[] native_" + p.Name + " = new {0} [cnt_{1}];", p.MarshalType.TrimEnd('[', ']'), p.Name);
sw.WriteLine(indent + "\t\t\tfor (int i = 0; i < cnt_{0}; i++)", p.Name);
if (gen is IManualMarshaler)
sw.WriteLine(indent + "\t\t\t\tnative_{0} [i] = {1};", p.Name, (gen as IManualMarshaler).AllocNative (name + "[i]"));
else
@ -140,7 +144,7 @@ namespace GtkSharp.Generation {
default:
if (p.Scope == String.Empty)
Console.WriteLine ("Defaulting " + gen.Name + " param to 'call' scope in method " + gen_info.CurrentMember);
sw.WriteLine (indent + "\t\t\t{0} {1}_wrapper = new {0} ({2});", wrapper, name, p.Name);
sw.WriteLine (indent + "\t\t\t{0} {1}_wrapper = new {0} ({1});", wrapper, name);
break;
}

View file

@ -235,12 +235,51 @@ namespace GtkSharp.Generation {
}
}
public int VisibleCount {
get {
int visible = 0;
foreach (Parameter p in this) {
if (!IsHidden (p))
visible++;
}
return visible;
}
}
public Parameter this [int idx] {
get {
return param_list [idx] as Parameter;
}
}
public bool IsHidden (Parameter p)
{
int idx = param_list.IndexOf (p);
if (idx > 0 && p.IsLength && this [idx - 1].IsString)
return true;
if (p.IsCount && ((idx > 0 && this [idx - 1].IsArray) ||
(idx < Count - 1 && this [idx + 1].IsArray)))
return true;
if (p.CType == "GError**")
return true;
if (HasCB || HideData) {
if (p.IsUserData && (idx == Count - 1))
return true;
}
return false;
}
bool has_cb;
public bool HasCB {
get { return has_cb; }
set { has_cb = value; }
}
bool hide_data;
public bool HideData {
get { return hide_data; }
@ -285,6 +324,9 @@ namespace GtkSharp.Generation {
Clear ();
return false;
}
if (p.Generatable is CallbackGen)
has_cb = true;
}
return true;
@ -292,14 +334,25 @@ namespace GtkSharp.Generation {
public bool IsAccessor {
get {
return Count == 1 && this [0].PassAs == "out";
return VisibleCount == 1 && AccessorParam.PassAs == "out";
}
}
public Parameter AccessorParam {
get {
foreach (Parameter p in this) {
if (!IsHidden (p))
return p;
}
return null;
}
}
public string AccessorReturnType {
get {
if (Count > 0)
return this [0].CSType;
Parameter p = AccessorParam;
if (p != null)
return p.CSType;
else
return null;
}
@ -307,8 +360,9 @@ namespace GtkSharp.Generation {
public string AccessorName {
get {
if (Count > 0)
return this [0].Name;
Parameter p = AccessorParam;
if (p != null)
return p.Name;
else
return null;
}

View file

@ -31,23 +31,8 @@ namespace GtkSharp.Generation {
public Signature (Parameters parms)
{
bool has_cb = parms.HideData;
for (int i = 0; i < parms.Count; i++) {
Parameter p = parms [i];
if (i > 0 && p.IsLength && parms [i - 1].IsString)
continue;
if (p.IsCount && ((i > 0 && parms [i - 1].IsArray) || (i < parms.Count - 1 && parms [i + 1].IsArray)))
continue;
has_cb = has_cb || p.Generatable is CallbackGen;
if (p.IsUserData && has_cb && (i == parms.Count - 1))
continue;
if (p.CType == "GError**")
continue;
foreach (Parameter p in parms) {
if (!parms.IsHidden (p))
this.parms.Add (p);
}
}

View file

@ -3,4 +3,5 @@
<attr path="/api/namespace/callback[@cname='GladeXMLCustomWidgetHandler']/*/*[@type='gchar*']" name="type">const-gchar*</attr>
<attr path="/api/namespace/object[@cname='GladeXML']/method[@name='GetWidgetPrefix']" name="hidden">1</attr>
<attr path="/api/namespace/class[@name='Global']/method[@name='ModuleCheckVersion']/return-type" name="type">const-gchar*</attr>
<attr path="/api/namespace/class[@name='Global']/method[@name='SetCustomHandler']" name="hidden">1</attr>
</metadata>

21
glade/Global.custom Normal file
View file

@ -0,0 +1,21 @@
// Copyright (c) 2005 Novell, Inc.
//
// 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.
[Obsolete ("Replaced by Glade.XML.CustomHandler static property.")]
public static void SetCustomHandler (Glade.XMLCustomWidgetHandler handler)
{
XML.CustomHandler = handler;
}

View file

@ -18,6 +18,7 @@ sources = \
WidgetAttribute.cs
customs = \
Global.custom \
XML.custom
add_dist = makefile.win32 glade-sharp-2.0.pc.in

View file

@ -30,10 +30,17 @@
[DllImport("libglade-2.0-0.dll")]
static extern void glade_set_custom_handler (GladeSharp.XMLCustomWidgetHandlerNative handler, IntPtr user_data);
public static Glade.XMLCustomWidgetHandler CustomHandler {
set {
GladeSharp.XMLCustomWidgetHandlerWrapper value_wrapper = new GladeSharp.XMLCustomWidgetHandlerWrapper (value);
glade_set_custom_handler(value_wrapper.NativeDelegate, IntPtr.Zero);
}
}
[Obsolete ("Replaced by CustomHandler property.")]
static public void SetCustomHandler (Glade.XMLCustomWidgetHandler handler)
{
callback_wrapper = new GladeSharp.XMLCustomWidgetHandlerWrapper (handler);
glade_set_custom_handler (callback_wrapper.NativeDelegate, IntPtr.Zero);
CustomHandler = handler;
}
[DllImport("gladesharpglue-2")]

21
gnomedb/Editor.custom Normal file
View file

@ -0,0 +1,21 @@
// Copyright (c) 2005 Novell, Inc.
//
// 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.
[Obsolete ("Replaced by Test property.")]
public void SetText (string text)
{
Text = text;
}

View file

@ -14,7 +14,8 @@ references = ../glib/glib-sharp.dll ../pango/pango-sharp.dll ../atk/atk-sharp.dl
sources = \
Application.cs
customs =
customs = \
Editor.custom
add_dist = gnomedb-sharp-2.0.pc.in

View file

@ -61,3 +61,8 @@
return ret;
}
[Obsolete ("Replaced by Text property.")]
public void SetText (string text)
{
Text = text;
}

View file

@ -220,6 +220,7 @@
<attr path="/api/namespace/object[@cname='GtkHScale']/constructor[@cname='gtk_hscale_new_with_range']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkIconTheme']/method[@name='GetSearchPath']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkIconTheme']/method[@name='ListIcons']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkIconTheme']/method[@name='SetSearchPath']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkIconView']/method[@name='ItemActivated']" name="name">ActivateItem</attr>
<attr path="/api/namespace/object[@cname='GtkIconView']/signal[@name='SelectAll']" name="name">AllSelected</attr>
<attr path="/api/namespace/object[@cname='GtkIconView']/signal[@name='SetScrollAdjustments']" name="hidden">1</attr>

View file

@ -43,6 +43,9 @@
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_icon_theme_get_search_path(IntPtr raw, out IntPtr path, out int n_elements);
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_icon_theme_set_search_path(IntPtr raw, IntPtr[] path, int n_elements);
[DllImport("libglib-2.0-0.dll")]
static extern void g_strfreev (IntPtr mem);
@ -66,5 +69,19 @@
return retval;
}
set {
int cnt_path = value == null ? 0 : value.Length;
IntPtr[] native_path = new IntPtr [cnt_path];
for (int i = 0; i < cnt_path; i++)
native_path [i] = GLib.Marshaller.StringToPtrGStrdup (value[i]);
gtk_icon_theme_set_search_path (Handle, native_path, native_path.Length);
for (int i = 0; i < native_path.Length; i++)
GLib.Marshaller.Free (native_path[i]);
}
}
[Obsolete ("Replaced by SearchPath property.")]
public void SetSearchPath (string[] path)
{
SearchPath = path;
}

View file

@ -122,7 +122,7 @@
public ListStore (params GLib.GType[] types) : base (IntPtr.Zero)
{
CreateNativeObject (new string [0], new GLib.Value [0]);
SetColumnTypes (types);
ColumnTypes = types;
}
public ListStore (params Type[] types) : base (IntPtr.Zero)
@ -138,7 +138,13 @@
}
CreateNativeObject (new string [0], new GLib.Value [0]);
SetColumnTypes (gtypes);
ColumnTypes = gtypes;
}
[Obsolete ("Replaced by ColumnTypes property.")]
public void SetColumnTypes (GLib.GType[] types)
{
ColumnTypes = types;
}
public object GetValue(Gtk.TreeIter iter, int column)

View file

@ -298,7 +298,7 @@
public TreeStore (params GLib.GType[] types) : base (IntPtr.Zero)
{
CreateNativeObject (new string [0], new GLib.Value [0]);
SetColumnTypes (types);
ColumnTypes = types;
}
public TreeStore (params Type[] types) : base (IntPtr.Zero)
@ -314,7 +314,13 @@
}
CreateNativeObject (new string [0], new GLib.Value [0]);
SetColumnTypes (gtypes);
ColumnTypes = gtypes;
}
[Obsolete ("Replaced by ColumnTypes property.")]
public void SetColumnTypes (GLib.GType[] types)
{
ColumnTypes = types;
}
public object GetValue (Gtk.TreeIter iter, int column) {

View file

@ -59,7 +59,7 @@ namespace GtkDemo
void CopyClicked (object obj, EventArgs args)
{
Clipboard clipboard = copyEntry.GetClipboard (Gdk.Selection.Clipboard);
clipboard.SetText (copyEntry.Text);
clipboard.Text = copyEntry.Text;
}
void PasteClicked (object obj, EventArgs args)