2002-05-24 01:43:25 +02:00
|
|
|
// GtkSharp.Generation.Parameters.cs - The Parameters Generation Class.
|
|
|
|
//
|
|
|
|
// Author: Mike Kestner <mkestner@speakeasy.net>
|
|
|
|
//
|
2004-06-25 18:35:15 +02:00
|
|
|
// Copyright (c) 2001-2003 Mike Kestner
|
|
|
|
// Copyright (c) 2004 Novell, Inc.
|
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of version 2 of the 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
|
|
|
|
// General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU 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.
|
|
|
|
|
2002-05-24 01:43:25 +02:00
|
|
|
|
|
|
|
namespace GtkSharp.Generation {
|
|
|
|
|
|
|
|
using System;
|
2003-09-11 08:10:03 +02:00
|
|
|
using System.Collections;
|
2002-06-10 14:34:09 +02:00
|
|
|
using System.IO;
|
2002-05-24 01:43:25 +02:00
|
|
|
using System.Xml;
|
|
|
|
|
2002-07-17 01:14:35 +02:00
|
|
|
public class Parameter {
|
|
|
|
|
|
|
|
private XmlElement elem;
|
|
|
|
|
|
|
|
public Parameter (XmlElement e)
|
|
|
|
{
|
|
|
|
elem = e;
|
|
|
|
}
|
|
|
|
|
2002-08-28 22:58:01 +02:00
|
|
|
public string CType {
|
|
|
|
get {
|
2002-10-11 02:27:46 +02:00
|
|
|
string type = elem.GetAttribute("type");
|
|
|
|
if (type == "void*")
|
|
|
|
type = "gpointer";
|
|
|
|
return type;
|
2002-08-28 22:58:01 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-07-17 01:14:35 +02:00
|
|
|
public string CSType {
|
|
|
|
get {
|
2003-05-19 04:45:17 +02:00
|
|
|
string cstype = SymbolTable.Table.GetCSType( elem.GetAttribute("type"));
|
2002-10-11 02:27:46 +02:00
|
|
|
if (cstype == "void")
|
|
|
|
cstype = "System.IntPtr";
|
2003-09-12 08:38:29 +02:00
|
|
|
if (IsArray) {
|
2003-12-04 00:08:14 +01:00
|
|
|
if (IsParams)
|
|
|
|
cstype = "params " + cstype;
|
2002-08-28 22:58:01 +02:00
|
|
|
cstype += "[]";
|
2003-02-24 04:13:08 +01:00
|
|
|
cstype = cstype.Replace ("ref ", "");
|
|
|
|
}
|
2002-08-28 22:58:01 +02:00
|
|
|
return cstype;
|
2002-07-17 01:14:35 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-06-14 19:30:32 +02:00
|
|
|
public IGeneratable Generatable {
|
|
|
|
get {
|
|
|
|
return SymbolTable.Table[CType];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-09-12 08:38:29 +02:00
|
|
|
public bool IsArray {
|
|
|
|
get {
|
|
|
|
return elem.HasAttribute("array");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-09-11 08:10:03 +02:00
|
|
|
public bool IsEllipsis {
|
|
|
|
get {
|
|
|
|
return elem.HasAttribute("ellipsis");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-11-17 04:44:32 +01:00
|
|
|
public bool IsCount {
|
|
|
|
get {
|
|
|
|
|
|
|
|
if (Name.StartsWith("n_"))
|
|
|
|
switch (CSType) {
|
|
|
|
case "int":
|
|
|
|
case "uint":
|
|
|
|
case "long":
|
|
|
|
case "ulong":
|
|
|
|
case "short":
|
|
|
|
case "ushort":
|
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-05-04 13:47:25 +02:00
|
|
|
public bool IsDestroyNotify {
|
|
|
|
get {
|
|
|
|
return CType == "GDestroyNotify";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-02-24 04:13:08 +01:00
|
|
|
public bool IsLength {
|
|
|
|
get {
|
2003-09-11 07:11:18 +02:00
|
|
|
|
|
|
|
if (Name.EndsWith("len") || Name.EndsWith("length"))
|
|
|
|
switch (CSType) {
|
|
|
|
case "int":
|
|
|
|
case "uint":
|
|
|
|
case "long":
|
|
|
|
case "ulong":
|
|
|
|
case "short":
|
|
|
|
case "ushort":
|
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return false;
|
2003-02-24 04:13:08 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-12-04 00:08:14 +01:00
|
|
|
public bool IsParams {
|
|
|
|
get {
|
|
|
|
return elem.HasAttribute("params");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-02-24 04:13:08 +01:00
|
|
|
public bool IsString {
|
|
|
|
get {
|
|
|
|
return (CSType == "string");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-09-12 08:38:29 +02:00
|
|
|
public bool IsUserData {
|
|
|
|
get {
|
2003-12-04 00:08:14 +01:00
|
|
|
return CSType == "IntPtr" && (Name.EndsWith ("data") || Name.EndsWith ("data_or_owner"));
|
2003-09-12 08:38:29 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-08-04 06:23:13 +02:00
|
|
|
public string MarshalType {
|
|
|
|
get {
|
2003-05-19 04:45:17 +02:00
|
|
|
string type = SymbolTable.Table.GetMarshalType( elem.GetAttribute("type"));
|
2002-10-11 02:27:46 +02:00
|
|
|
if (type == "void")
|
|
|
|
type = "System.IntPtr";
|
2003-09-12 08:38:29 +02:00
|
|
|
if (IsArray) {
|
2003-02-24 04:13:08 +01:00
|
|
|
type += "[]";
|
|
|
|
type = type.Replace ("ref ", "");
|
|
|
|
}
|
2002-10-11 02:27:46 +02:00
|
|
|
return type;
|
2002-08-04 06:23:13 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-07-17 01:14:35 +02:00
|
|
|
public string Name {
|
|
|
|
get {
|
2003-08-28 18:49:29 +02:00
|
|
|
return SymbolTable.Table.MangleName (elem.GetAttribute("name"));
|
2002-07-17 01:14:35 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-05-07 15:42:59 +02:00
|
|
|
public string PropertyName {
|
|
|
|
get {
|
|
|
|
return elem.GetAttribute("property_name");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-06-14 19:30:32 +02:00
|
|
|
public string PassAs {
|
|
|
|
get {
|
2003-10-13 23:53:40 +02:00
|
|
|
if (elem.HasAttribute ("pass_as"))
|
|
|
|
return elem.GetAttribute ("pass_as");
|
|
|
|
|
2004-12-27 21:00:55 +01:00
|
|
|
if (IsArray || CSType.EndsWith ("IntPtr"))
|
2003-10-13 23:53:40 +02:00
|
|
|
return "";
|
|
|
|
|
2004-12-27 21:00:55 +01:00
|
|
|
if (CType.EndsWith ("*") && (Generatable is SimpleGen || Generatable is EnumGen))
|
2003-10-18 01:06:37 +02:00
|
|
|
return "out";
|
|
|
|
|
2003-10-13 23:53:40 +02:00
|
|
|
return "";
|
2003-06-14 19:30:32 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-05-04 13:47:25 +02:00
|
|
|
string scope;
|
2005-04-04 18:27:08 +02:00
|
|
|
public string Scope {
|
|
|
|
get {
|
2005-05-04 13:47:25 +02:00
|
|
|
if (scope == null)
|
|
|
|
scope = elem.GetAttribute ("scope");
|
|
|
|
return scope;
|
|
|
|
}
|
|
|
|
set {
|
|
|
|
scope = value;
|
2005-04-04 18:27:08 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-12-04 00:08:14 +01:00
|
|
|
public string CallByName (string call_parm_name)
|
|
|
|
{
|
|
|
|
string call_parm;
|
|
|
|
if (Generatable is CallbackGen)
|
|
|
|
call_parm = SymbolTable.Table.CallByName (CType, call_parm_name + "_wrapper");
|
|
|
|
else
|
|
|
|
call_parm = SymbolTable.Table.CallByName(CType, call_parm_name);
|
|
|
|
|
|
|
|
if (IsArray)
|
|
|
|
call_parm = call_parm.Replace ("ref ", "");
|
|
|
|
|
|
|
|
return call_parm;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2002-07-17 01:14:35 +02:00
|
|
|
public string StudlyName {
|
|
|
|
get {
|
|
|
|
string name = elem.GetAttribute("name");
|
|
|
|
string[] segs = name.Split('_');
|
|
|
|
string studly = "";
|
|
|
|
foreach (string s in segs) {
|
2003-07-15 07:52:09 +02:00
|
|
|
if (s.Trim () == "")
|
|
|
|
continue;
|
2002-07-17 01:14:35 +02:00
|
|
|
studly += (s.Substring(0,1).ToUpper() + s.Substring(1));
|
|
|
|
}
|
|
|
|
return studly;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-01-26 20:17:07 +01:00
|
|
|
public class Parameters : IEnumerable {
|
2002-05-24 01:43:25 +02:00
|
|
|
|
2005-01-26 20:17:07 +01:00
|
|
|
ArrayList param_list = new ArrayList ();
|
2002-05-24 01:43:25 +02:00
|
|
|
|
2005-01-26 20:17:07 +01:00
|
|
|
public Parameters (XmlElement elem) {
|
2002-05-24 01:43:25 +02:00
|
|
|
|
2005-01-26 20:17:07 +01:00
|
|
|
if (elem == null)
|
|
|
|
return;
|
|
|
|
|
2003-09-11 08:10:03 +02:00
|
|
|
foreach (XmlNode node in elem.ChildNodes) {
|
|
|
|
XmlElement parm = node as XmlElement;
|
|
|
|
if (parm != null && parm.Name == "parameter")
|
|
|
|
param_list.Add (new Parameter (parm));
|
|
|
|
}
|
2002-05-24 01:43:25 +02:00
|
|
|
}
|
|
|
|
|
2003-09-11 08:10:03 +02:00
|
|
|
public int Count {
|
|
|
|
get {
|
|
|
|
return param_list.Count;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
* 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
2005-05-02 22:10:03 +02:00
|
|
|
public int VisibleCount {
|
|
|
|
get {
|
|
|
|
int visible = 0;
|
|
|
|
foreach (Parameter p in this) {
|
|
|
|
if (!IsHidden (p))
|
|
|
|
visible++;
|
|
|
|
}
|
|
|
|
return visible;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-07-17 01:14:35 +02:00
|
|
|
public Parameter this [int idx] {
|
|
|
|
get {
|
2003-09-11 08:10:03 +02:00
|
|
|
return param_list [idx] as Parameter;
|
2002-07-17 01:14:35 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
* 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
2005-05-02 22:10:03 +02:00
|
|
|
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;
|
2005-05-04 13:47:25 +02:00
|
|
|
if (p.IsUserData && (idx == Count - 2) &&
|
|
|
|
this [idx + 1].IsDestroyNotify)
|
|
|
|
return true;
|
|
|
|
if (p.IsDestroyNotify && (idx == Count - 1) &&
|
|
|
|
this [idx - 1].IsUserData)
|
|
|
|
return true;
|
* 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
2005-05-02 22:10:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool has_cb;
|
|
|
|
public bool HasCB {
|
|
|
|
get { return has_cb; }
|
|
|
|
set { has_cb = value; }
|
|
|
|
}
|
|
|
|
|
2005-01-26 20:17:07 +01:00
|
|
|
bool hide_data;
|
2002-08-28 22:58:01 +02:00
|
|
|
public bool HideData {
|
|
|
|
get { return hide_data; }
|
|
|
|
set { hide_data = value; }
|
|
|
|
}
|
|
|
|
|
2005-01-26 20:17:07 +01:00
|
|
|
bool is_static;
|
2003-04-06 11:21:15 +02:00
|
|
|
public bool Static {
|
2003-12-04 00:08:14 +01:00
|
|
|
get { return is_static; }
|
2003-04-06 11:21:15 +02:00
|
|
|
set { is_static = value; }
|
|
|
|
}
|
|
|
|
|
2005-01-26 20:17:07 +01:00
|
|
|
bool cleared = false;
|
|
|
|
void Clear ()
|
|
|
|
{
|
|
|
|
cleared = true;
|
|
|
|
param_list.Clear ();
|
|
|
|
}
|
|
|
|
|
|
|
|
public IEnumerator GetEnumerator ()
|
|
|
|
{
|
|
|
|
return param_list.GetEnumerator ();
|
|
|
|
}
|
|
|
|
|
2002-05-24 01:43:25 +02:00
|
|
|
public bool Validate ()
|
|
|
|
{
|
2005-01-26 20:17:07 +01:00
|
|
|
if (cleared)
|
|
|
|
return false;
|
|
|
|
|
2005-05-04 13:47:25 +02:00
|
|
|
for (int i = 0; i < param_list.Count; i++) {
|
|
|
|
Parameter p = this [i];
|
2003-09-11 08:10:03 +02:00
|
|
|
|
|
|
|
if (p.IsEllipsis) {
|
2002-07-20 16:43:48 +02:00
|
|
|
Console.Write("Ellipsis parameter ");
|
2005-01-26 20:17:07 +01:00
|
|
|
Clear ();
|
|
|
|
|
2002-07-20 16:43:48 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2003-02-24 04:13:08 +01:00
|
|
|
if ((p.CSType == "") || (p.Name == "") ||
|
2003-05-19 04:45:17 +02:00
|
|
|
(p.MarshalType == "") || (SymbolTable.Table.CallByName(p.CType, p.Name) == "")) {
|
2003-02-24 04:13:08 +01:00
|
|
|
Console.Write("Name: " + p.Name + " Type: " + p.CType + " ");
|
2005-01-26 20:17:07 +01:00
|
|
|
Clear ();
|
2002-05-24 01:43:25 +02:00
|
|
|
return false;
|
|
|
|
}
|
* 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
2005-05-02 22:10:03 +02:00
|
|
|
|
2005-05-04 13:47:25 +02:00
|
|
|
if (p.Generatable is CallbackGen) {
|
* 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
2005-05-02 22:10:03 +02:00
|
|
|
has_cb = true;
|
2005-05-04 13:47:25 +02:00
|
|
|
if (i == Count - 3 &&
|
|
|
|
this [i + 1].IsUserData &&
|
|
|
|
this [i + 2].IsDestroyNotify)
|
|
|
|
p.Scope = "notified";
|
|
|
|
}
|
2002-06-21 Rachel Hestilow <hestilow@ximian.com>
* generator/ClassBase.cs: New base class for classes and interfaces.
* generator/InterfaceGen.cs: Inherit from ClassBase, generate declarations.
* generator/ObjectGen.cs: Move half of this into ClassBase.
* generator/Method.cs: Turn all applicable Get/Set functions into .NET
accessors. Remove redundant == overload and move into Equals, as
it was confusing "!= null".
* generator/Parameters.cs: Alter signature creation to accept "is_set"
option, add support for variable arguments. Add properties "Count",
"IsVarArgs", "VAType".
* generator/Ctor.cs: Fixup for changes in Parameters (indenting,
signature creation).
* generator/Signal.cs: Support generating declarations.
* generator/SymbolTable: Change GetObjectGen to GetClassGen.
* glib/IWrapper.cs: Move "Handle" declaration to here, so
both classes and interfaces can benefit from it.
* glib/Object.cs: Inherit from IWrapper.cs
* parser/Metadata.pm: Support attribute changes on constructors,
methods, signals, and paramater lists.
* parser/gapi2xml.pl: Parse init funcs for interfaces. Ignore "_"
functions here.
* parser/gapi_pp.pl: Remove boxed_type_register check, as it will
be caught in the init funcs.
* parser/Atk.metadata: Added.
* parser/Gtk.metadata: Add all needed signal/method collision
renames. Rename GtkEditable.Editable accessors to IsEditable,
as .NET does not like accessors with the same name as their
declaring type. Tag TreeStore constructor as varargs.
* samples/ButtonApp.cs: s/EmitAdd/Add.
* samples/Menu.cs: s/EmitAdd/Add, s/Activate/Activated.
svn path=/trunk/gtk-sharp/; revision=5394
2002-06-21 19:15:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2002-06-10 14:34:09 +02:00
|
|
|
public bool IsAccessor {
|
|
|
|
get {
|
* 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
2005-05-02 22:10:03 +02:00
|
|
|
return VisibleCount == 1 && AccessorParam.PassAs == "out";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public Parameter AccessorParam {
|
|
|
|
get {
|
|
|
|
foreach (Parameter p in this) {
|
|
|
|
if (!IsHidden (p))
|
|
|
|
return p;
|
|
|
|
}
|
|
|
|
return null;
|
2002-06-10 14:34:09 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public string AccessorReturnType {
|
|
|
|
get {
|
* 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
2005-05-02 22:10:03 +02:00
|
|
|
Parameter p = AccessorParam;
|
|
|
|
if (p != null)
|
|
|
|
return p.CSType;
|
2003-09-11 08:10:03 +02:00
|
|
|
else
|
|
|
|
return null;
|
2002-06-10 14:34:09 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public string AccessorName {
|
|
|
|
get {
|
* 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
2005-05-02 22:10:03 +02:00
|
|
|
Parameter p = AccessorParam;
|
|
|
|
if (p != null)
|
|
|
|
return p.Name;
|
2003-09-11 08:10:03 +02:00
|
|
|
else
|
|
|
|
return null;
|
2002-06-10 14:34:09 +02:00
|
|
|
}
|
|
|
|
}
|
2002-05-24 01:43:25 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|