2002-01-11 Mike Kestner <mkestner@speakeasy.net>

* generator/ObjectGen.cs : Add property generation.
	* generator/SymbolTable.cs : More fixage to simple_types. Add
	  GetMarshalType and IsObject methods.
	* glib/Object.cs : Rename Events prop to EventList to avoid name
	  collision. Add float, double, uint, and IntPtr GetProp and SetProp
	  methods.
	* parser/TODO : Add a couple prop related bugs to come back for.
	* parser/gapi2xml.pl (addPropElems): Restructure.  It was thoroughly
	  broken.  It's better now.

svn path=/trunk/gtk-sharp/; revision=1960
This commit is contained in:
Mike Kestner 2002-01-12 02:08:16 +00:00
parent d828b8ce59
commit 9fcf82d28e
11 changed files with 299 additions and 873 deletions

View file

@ -1,4 +1,16 @@
2002-01-08 Mike Kestner <mkestner@speakeasy.net>
2002-01-11 Mike Kestner <mkestner@speakeasy.net>
* generator/ObjectGen.cs : Add property generation.
* generator/SymbolTable.cs : More fixage to simple_types. Add
GetMarshalType and IsObject methods.
* glib/Object.cs : Rename Events prop to EventList to avoid name
collision. Add float, double, uint, and IntPtr GetProp and SetProp
methods.
* parser/TODO : Add a couple prop related bugs to come back for.
* parser/gapi2xml.pl (addPropElems): Restructure. It was thoroughly
broken. It's better now.
2002-01-10 Mike Kestner <mkestner@speakeasy.net>
* generator/StructBase.cs (GenField): Return a bool success indicator.
* generator/ObjectGen.cs : Check the return of GenField.

View file

@ -101,6 +101,9 @@ namespace GtkSharp.Generation {
break;
case "property":
if (!GenProperty(member, table, sw)) {
Console.WriteLine("in object " + CName);
}
break;
case "signal":
@ -119,7 +122,63 @@ namespace GtkSharp.Generation {
sw.Flush();
sw.Close();
}
}
public bool GenProperty (XmlElement prop, SymbolTable table, StreamWriter sw)
{
String c_type = prop.GetAttribute("type");
char[] ast = {'*'};
c_type = c_type.TrimEnd(ast);
String cs_type = table.GetCSType(c_type);
String m_type;
if (table.IsObject(c_type)) {
m_type = "GLib.Object";
} else {
m_type = table.GetMarshalType(c_type);
}
if ((cs_type == "") || (m_type == "")) {
Console.Write("Property has unknown Type {0} ", c_type);
return false;
}
if (prop.HasAttribute("construct-only") && !prop.HasAttribute("readable")) {
return true;
}
XmlElement parent = (XmlElement) prop.ParentNode;
String name = prop.GetAttribute("name");
if (name == parent.GetAttribute("name")) {
name += "Prop";
}
sw.WriteLine("\t\tpublic " + cs_type + " " + name + " {");
if (prop.HasAttribute("readable")) {
sw.WriteLine("\t\t\tget {");
sw.WriteLine("\t\t\t\t" + m_type + " val;");
sw.WriteLine("\t\t\t\tGetProperty(\"" + prop.GetAttribute("cname") + "\", out val);");
sw.Write("\t\t\t\treturn ");
if (cs_type != m_type) {
sw.Write("(" + cs_type + ") ");
}
sw.WriteLine("val;");
sw.WriteLine("\t\t\t}");
}
if (prop.HasAttribute("writeable") && !prop.HasAttribute("construct-only")) {
sw.WriteLine("\t\t\tset {");
sw.WriteLine("\t\t\t\tSetProperty(\"" + prop.GetAttribute("cname") + "\", (" + m_type + ") value);");
sw.WriteLine("\t\t\t}");
}
sw.WriteLine("\t\t}");
sw.WriteLine();
return true;
}
}
}

View file

@ -44,6 +44,7 @@ namespace GtkSharp.Generation {
simple_types.Add ("int", "int");
simple_types.Add ("char", "char");
simple_types.Add ("double", "double");
simple_types.Add ("float", "float");
simple_types.Add ("gunichar", "String");
simple_types.Add ("uint1", "bool");
simple_types.Add ("GPtrArray", "IntPtr[]");
@ -75,15 +76,15 @@ namespace GtkSharp.Generation {
}
}
public IDictionaryEnumerator GetEnumerator ()
public IDictionaryEnumerator GetEnumerator()
{
return complex_types.GetEnumerator();
}
public String GetCSType (String c_type)
public String GetCSType(String c_type)
{
if (simple_types.ContainsKey(c_type)) {
return (String) simple_types [c_type];
return (String) simple_types[c_type];
} else if (complex_types.ContainsKey(c_type)) {
IGeneratable gen = (IGeneratable) complex_types[c_type];
return gen.QualifiedName;
@ -92,6 +93,29 @@ namespace GtkSharp.Generation {
}
}
public String GetMarshalType(String c_type)
{
if (simple_types.ContainsKey(c_type)) {
return (String) simple_types[c_type];
} else if (complex_types.ContainsKey(c_type)) {
IGeneratable gen = (IGeneratable) complex_types[c_type];
return gen.MarshalType;
} else {
return "";
}
}
public bool IsObject(String c_type)
{
if (complex_types.ContainsKey(c_type)) {
IGeneratable gen = (IGeneratable) complex_types[c_type];
if (gen is ObjectGen) {
return true;
}
}
return false;
}
}
}

File diff suppressed because one or more lines are too long

View file

@ -90,7 +90,7 @@ namespace GLib {
}
/// <summary>
/// Events Property
/// EventList Property
/// </summary>
///
/// <remarks>
@ -98,7 +98,7 @@ namespace GLib {
/// object indexed by the Gtk+ signal name.
/// </remarks>
protected EventHandlerList Events {
protected EventHandlerList EventList {
get {
if (_events == null)
_events = new EventHandlerList ();
@ -209,6 +209,46 @@ namespace GLib {
out val, new IntPtr (0));
}
/// <summary>
/// GetProperty Method
/// </summary>
///
/// <remarks>
/// Accesses a double Property.
/// </remarks>
[DllImport("gobject-1.3.dll", CharSet=CharSet.Ansi,
CallingConvention=CallingConvention.Cdecl)]
static extern void g_object_get (IntPtr obj, IntPtr name,
out double val, IntPtr term);
public void GetProperty (String name, out double val)
{
g_object_get (RawObject,
Marshal.StringToHGlobalAnsi (name),
out val, new IntPtr (0));
}
/// <summary>
/// GetProperty Method
/// </summary>
///
/// <remarks>
/// Accesses a float Property.
/// </remarks>
[DllImport("gobject-1.3.dll", CharSet=CharSet.Ansi,
CallingConvention=CallingConvention.Cdecl)]
static extern void g_object_get (IntPtr obj, IntPtr name,
out float val, IntPtr term);
public void GetProperty (String name, out float val)
{
g_object_get (RawObject,
Marshal.StringToHGlobalAnsi (name),
out val, new IntPtr (0));
}
/// <summary>
/// GetProperty Method
/// </summary>
@ -229,6 +269,26 @@ namespace GLib {
out val, new IntPtr (0));
}
/// <summary>
/// GetProperty Method
/// </summary>
///
/// <remarks>
/// Accesses an unsigned integer Property.
/// </remarks>
[DllImport("gobject-1.3.dll", CharSet=CharSet.Ansi,
CallingConvention=CallingConvention.Cdecl)]
static extern void g_object_get (IntPtr obj, IntPtr name,
out uint val, IntPtr term);
public void GetProperty (String name, out uint val)
{
g_object_get (RawObject,
Marshal.StringToHGlobalAnsi (name),
out val, new IntPtr (0));
}
/// <summary>
/// GetProperty Method
/// </summary>
@ -246,6 +306,24 @@ namespace GLib {
val = GLib.Object.GetObject (obj);
}
/// <summary>
/// GetProperty Method
/// </summary>
///
/// <remarks>
/// Accesses an IntPtr Property.
/// </remarks>
public void GetProperty (String name, out IntPtr val)
{
g_object_get (RawObject,
Marshal.StringToHGlobalAnsi (name),
out val, new IntPtr (0));
}
/// <summary>
/// SetProperty Method
/// </summary>
/// <summary>
/// SetProperty Method
/// </summary>
@ -287,6 +365,26 @@ namespace GLib {
val, new IntPtr (0));
}
/// <summary>
/// SetProperty Method
/// </summary>
///
/// <remarks>
/// Changes the value of an unsigned integer Property.
/// </remarks>
[DllImport("gobject-1.3.dll", CharSet=CharSet.Ansi,
CallingConvention=CallingConvention.Cdecl)]
static extern void g_object_set (IntPtr obj, IntPtr name,
uint val, IntPtr term);
public void SetProperty (String name, uint val)
{
g_object_set (RawObject,
Marshal.StringToHGlobalAnsi (name),
val, new IntPtr (0));
}
/// <summary>
/// SetProperty Method
/// </summary>
@ -307,6 +405,61 @@ namespace GLib {
val, new IntPtr (0));
}
/// <summary>
/// SetProperty Method
/// </summary>
///
/// <remarks>
/// Changes the value of a double Property.
/// </remarks>
[DllImport("gobject-1.3.dll", CharSet=CharSet.Ansi,
CallingConvention=CallingConvention.Cdecl)]
static extern void g_object_set (IntPtr obj, IntPtr name,
double val, IntPtr term);
public void SetProperty (String name, double val)
{
g_object_set (RawObject,
Marshal.StringToHGlobalAnsi (name),
val, new IntPtr (0));
}
/// <summary>
/// SetProperty Method
/// </summary>
///
/// <remarks>
/// Changes the value of a float Property.
/// </remarks>
[DllImport("gobject-1.3.dll", CharSet=CharSet.Ansi,
CallingConvention=CallingConvention.Cdecl)]
static extern void g_object_set (IntPtr obj, IntPtr name,
float val, IntPtr term);
public void SetProperty (String name, float val)
{
g_object_set (RawObject,
Marshal.StringToHGlobalAnsi (name),
val, new IntPtr (0));
}
/// <summary>
/// SetProperty Method
/// </summary>
///
/// <remarks>
/// Changes the value of an IntPtr Property.
/// </remarks>
public void SetProperty (String name, IntPtr val)
{
g_object_set (RawObject,
Marshal.StringToHGlobalAnsi (name),
val, new IntPtr (0));
}
/// <summary>
/// SetProperty Method
/// </summary>

View file

@ -1,464 +0,0 @@
// GTK.Button.cs - GTK Button class implementation
//
// Authors: Bob Smith <bob@thestuff.net>
// Mike Kestner <mkestner@speakeasy.net>
//
// (c) 2001 Bob Smith and Mike Kestner
namespace Gtk {
using System;
using System.Collections;
using System.Runtime.InteropServices;
using GLib;
/// <summary>
/// Button Class
/// </summary>
///
/// <remarks>
/// A Button user interface element.
/// </remarks>
public class Button : Widget {
private Hashtable Signals = new Hashtable ();
/// <summary>
/// Button Constructor
/// </summary>
///
/// <remarks>
/// Constructs a Button with no label.
/// </remarks>
[DllImport("gtk-1.3.dll", CharSet=CharSet.Ansi,
CallingConvention=CallingConvention.Cdecl)]
static extern IntPtr gtk_button_new ();
public Button ()
{
RawObject = gtk_button_new ();
}
/// <summary>
/// Button Object Constructor
/// </summary>
///
/// <remarks>
/// Constructs a Button Wrapper from a raw object. This
/// constructor is primarily used internally by gtk-sharp,
/// but could conceivably be called by an application if
/// the need to wrap a raw button object presents itself.
/// </remarks>
///
/// <param name="obj">
/// Raw object reference from the native library.
/// </param>
public Button (IntPtr obj)
{
RawObject = obj;
}
/// <summary>
/// Button Constructor
/// </summary>
///
/// <remarks>
/// Constructs a new Button with the specified label.
/// Note, that underlines in the label provided will
/// be converted into mnemonics and the label will be
/// interpreted as a stock system identifier if possible.
/// If this behavior is not desired, more control can be
/// obtained with an overloaded constructor.
/// </remarks>
///
/// <param name="label">
/// Text label or stock system id to display on the button.
/// </param>
[DllImport("gtk-1.3.dll", CharSet=CharSet.Ansi,
CallingConvention=CallingConvention.Cdecl)]
static extern IntPtr gtk_button_new_from_stock (IntPtr str);
public Button (String label)
{
RawObject = gtk_button_new_from_stock (
Marshal.StringToHGlobalAnsi (label));
}
/// <summary>
/// Button Constructor
/// </summary>
///
/// <remarks>
/// Constructs a new Button with the specified label.
/// Underlines in the label can be converted to mnemonics
/// based on the specified flag. The label can identify
/// a stock button if desired as well.
/// </remarks>
///
/// <param name="label">
/// Text label to display on the button face.
/// </param>
///
/// <param name="stock">
/// Indicates if the stock system should be used. If the
/// label does not represent a known stock button, it will
/// instead be used verbatim with mnemonic if an underline
/// is included.
/// </param>
///
/// <param name="mnemonic">
/// Convert underscore to a mnemonic which can be used
/// to activate the button with the keyboard.
/// </param>
[DllImport("gtk-1.3.dll", CharSet=CharSet.Ansi,
CallingConvention=CallingConvention.Cdecl)]
static extern IntPtr gtk_button_new_with_mnemonic (IntPtr str);
[DllImport("gtk-1.3.dll", CharSet=CharSet.Ansi,
CallingConvention=CallingConvention.Cdecl)]
static extern IntPtr gtk_button_new_with_label (IntPtr str);
public Button (String label, bool stock, bool mnemonic)
{
if (stock)
RawObject = gtk_button_new_from_stock (
Marshal.StringToHGlobalAnsi (label));
else if (mnemonic)
RawObject = gtk_button_new_with_mnemonic (
Marshal.StringToHGlobalAnsi (label));
else
RawObject = gtk_button_new_with_label (
Marshal.StringToHGlobalAnsi (label));
}
/// <summary>
/// Label Property
/// </summary>
///
/// <remarks>
/// Text label to display on the button face.
/// </remarks>
public String Label {
get {
String val;
GetProperty ("label", out val);
return val;
}
set {
SetProperty ("label", value);
}
}
/// <summary>
/// Relief Property
/// </summary>
///
/// <remarks>
/// Relief style used to draw the button.
/// </remarks>
public ReliefStyle Relief {
get {
int val;
GetProperty ("relief", out val);
return (ReliefStyle) val;
}
set {
SetProperty ("relief", (int) value);
}
}
/// <summary>
/// UseStock Property
/// </summary>
///
/// <remarks>
/// Indicates if stock button images should be used.
/// </remarks>
public bool UseStock {
get {
bool val;
GetProperty ("use-stock", out val);
return val;
}
set {
SetProperty ("use-stock", value);
}
}
/// <summary>
/// UseUnderline Property
/// </summary>
///
/// <remarks>
/// Indicates if underlines in the label text should be
/// treated as a mnemonic.
/// </remarks>
public bool UseUnderline {
get {
bool val;
GetProperty ("use-underline", out val);
return val;
}
set {
SetProperty ("use-underline", value);
}
}
/// <summary>
/// Activated Event
/// </summary>
///
/// <remarks>
/// Signal indicating that the button has been activated.
/// </remarks>
private static readonly string ActName = "activate";
public event EventHandler Activated
{
add {
if (Events [ActName] == null)
Signals [ActName] = new SimpleSignal (
this, RawObject,
ActName, value);
Events.AddHandler (ActName, value);
}
remove {
Events.RemoveHandler (ActName, value);
if (Events [ActName] == null)
Signals.Remove (ActName);
}
}
/// <summary>
/// Clicked Event
/// </summary>
///
/// <remarks>
/// Signal indicating that the button has been clicked.
/// </remarks>
private static readonly string ClkName = "clicked";
public event EventHandler Clicked
{
add {
if (Events [ClkName] == null)
Signals [ClkName] = new SimpleSignal (
this, RawObject,
ClkName, value);
Events.AddHandler (ClkName, value);
}
remove {
Events.RemoveHandler (ClkName, value);
if (Events [ClkName] == null)
Signals.Remove (ClkName);
}
}
/// <summary>
/// Entered Event
/// </summary>
///
/// <remarks>
/// Signal indicating that the focus has entered the button.
/// </remarks>
private static readonly string EnterName = "enter";
public event EventHandler Entered
{
add {
if (Events [EnterName] == null)
Signals [EnterName] = new SimpleSignal (
this, RawObject,
EnterName, value);
Events.AddHandler (EnterName, value);
}
remove {
Events.RemoveHandler (EnterName, value);
if (Events [EnterName] == null)
Signals.Remove (EnterName);
}
}
/// <summary>
/// Left Event
/// </summary>
///
/// <remarks>
/// Signal indicating that the focus has left the button.
/// </remarks>
private static readonly string LeaveName = "leave";
public event EventHandler Left
{
add {
if (Events [LeaveName] == null)
Signals [LeaveName] = new SimpleSignal (
this, RawObject,
LeaveName, value);
Events.AddHandler (LeaveName, value);
}
remove {
Events.RemoveHandler (LeaveName, value);
if (Events [LeaveName] == null)
Signals.Remove (LeaveName);
}
}
/// <summary>
/// Pressed Event
/// </summary>
///
/// <remarks>
/// Signal indicating that the button has been pressed.
/// </remarks>
private static readonly string PressName = "pressed";
public event EventHandler Pressed
{
add {
if (Events [PressName] == null)
Signals [PressName] = new SimpleSignal (
this, RawObject,
PressName, value);
Events.AddHandler (PressName, value);
}
remove {
Events.RemoveHandler (PressName, value);
if (Events [PressName] == null)
Signals.Remove (PressName);
}
}
/// <summary>
/// Released Event
/// </summary>
///
/// <remarks>
/// Signal indicating that the button has been released.
/// </remarks>
private static readonly string RelName = "released";
public event EventHandler Released
{
add {
if (Events [RelName] == null)
Signals [RelName] = new SimpleSignal (
this, RawObject,
RelName, value);
Events.AddHandler (RelName, value);
}
remove {
Events.RemoveHandler (RelName, value);
if (Events [RelName] == null)
Signals.Remove (RelName);
}
}
/// <summary>
/// Click Method
/// </summary>
///
/// <remarks>
/// Emit a Signal indicating that the button has been
/// clicked.
/// </remarks>
[DllImport("gtk-1.3.dll")]
static extern void gtk_button_clicked (IntPtr obj);
public void Click ()
{
gtk_button_clicked (RawObject);
}
/// <summary>
/// Enter Method
/// </summary>
///
/// <remarks>
/// Emit a Signal indicating that the focus has entered
/// the button.
/// </remarks>
[DllImport("gtk-1.3.dll")]
static extern void gtk_button_enter (IntPtr obj);
public void Enter ()
{
gtk_button_enter (RawObject);
}
/// <summary>
/// Leave Method
/// </summary>
///
/// <remarks>
/// Emit a Signal indicating that the focus has left the
/// button.
/// </remarks>
[DllImport("gtk-1.3.dll")]
static extern void gtk_button_leave (IntPtr obj);
public void Leave ()
{
gtk_button_leave (RawObject);
}
/// <summary>
/// Pressed Method
/// </summary>
///
/// <remarks>
/// Emit a Signal indicating that the button has been
/// pressed.
/// </remarks>
[DllImport("gtk-1.3.dll")]
static extern void gtk_button_pressed (IntPtr obj);
public void Press ()
{
gtk_button_pressed (RawObject);
}
/// <summary>
/// Release Method
/// </summary>
///
/// <remarks>
/// Emit a Signal indicating that the button has been
/// released.
/// </remarks>
[DllImport("gtk-1.3.dll")]
static extern void gtk_button_released (IntPtr obj);
public void Release ()
{
gtk_button_released (RawObject);
}
}
}

View file

@ -1,100 +0,0 @@
// Gtk.Container.cs - GtkContainer class wrapper implementation
//
// Author: Mike Kestner <mkestner@speakeasy.net>
//
// (c) 2001 Mike Kestner
namespace Gtk {
using System;
using System.Runtime.InteropServices;
/// <summary>
/// Container Class
/// </summary>
///
/// <remarks>
/// Abstract class which provides the capability to embed a
/// widget within its boundaries.
/// </remarks>
public abstract class Container : Widget {
/// <summary>
/// BorderWidth Property
/// </summary>
///
/// <remarks>
/// The Width, in pixels, of the border around the
/// Container.
/// </remarks>
public int BorderWidth {
get {
int val;
GetProperty ("border-width", out val);
return val;
}
set {
SetProperty ("border-width", value);
}
}
// FIXME: Implement Child property.
/// <summary>
/// ResizeMode Property
/// </summary>
///
/// <remarks>
/// Indicates the resizing policy for the Container.
/// </remarks>
public ResizeMode ResizeMode {
get {
int val;
GetProperty ("border-width", out val);
return (ResizeMode) val;
}
set {
SetProperty ("border-width", (int) value);
}
}
/// <summary>
/// Add Method
/// </summary>
///
/// <remarks>
/// Adds a child Widget to the Container.
/// </remarks>
[DllImport("gtk-1.3.dll", CharSet=CharSet.Ansi,
CallingConvention=CallingConvention.Cdecl)]
static extern void gtk_container_add (IntPtr obj, IntPtr child);
public void Add (Widget child)
{
gtk_container_add (Handle, child.Handle);
}
/// <summary>
/// Remove Method
/// </summary>
///
/// <remarks>
/// Remove a child Widget from the Container.
/// </remarks>
[DllImport("gtk-1.3.dll", CharSet=CharSet.Ansi,
CallingConvention=CallingConvention.Cdecl)]
static extern void gtk_container_remove (IntPtr obj,
IntPtr child);
public void Remove (Widget child)
{
gtk_container_remove (Handle, child.Handle);
}
}
}

View file

@ -1,240 +0,0 @@
// GTK.Label.cs - GTK Label class implementation
//
// Author: Bob Smith <bob@thestuff.net>
//
// (c) 2001 Bob Smith
namespace Gtk {
using System;
using System.Runtime.InteropServices;
public class Label : Widget {
/// <summary>
/// Label Object Constructor
/// </summary>
///
/// <remarks>
/// Constructs a Label Wrapper.
/// </remarks>
public Label (IntPtr o)
{
RawObject = o;
}
/// <summary>
/// Label Constructor
/// </summary>
///
/// <remarks>
/// Constructs a new Label with the specified content.
/// </remarks>
[DllImport("gtk-1.3")]
static extern IntPtr gtk_label_new (String str);
public Label (String str)
{
RawObject = gtk_label_new (str);
}
/// <summary>
/// Text Property
/// </summary>
///
/// <remarks>
/// The raw text of the label.
/// </remarks>
[DllImport("gtk-1.3")]
static extern void gtk_label_set_text (IntPtr hnd, String str);
[DllImport("gtk-1.3")]
static extern String gtk_label_get_text (IntPtr hnd);
public String Text {
get
{
return gtk_label_get_text (RawObject);
}
set
{
gtk_label_set_text (RawObject, value);
}
}
/// <summary>
/// Markup Property
/// </summary>
///
/// <remarks>
/// Text to parse.
/// </remarks>
[DllImport("gtk-1.3")]
static extern void gtk_label_set_markup (IntPtr hnd, String str);
public String Markup {
set
{
gtk_label_set_markup (RawObject, value);
}
}
/// <summary>
/// Label Property
/// </summary>
///
/// <remarks>
/// Parsed content.
/// </remarks>
/*
[DllImport("gtk-1.3")]
static extern void gtk_label_set_label (IntPtr hnd, String str);
[DllImport("gtk-1.3")]
static extern String gtk_label_get_label (IntPtr hnd);
public String Label {
get
{
return gtk_label_get_label (RawObject);
}
set
{
gtk_label_set_label (RawObject, value);
}
}
*/
/// <summary>
/// Selectable Property
/// </summary>
///
/// <remarks>
/// Is the user able to select text from the label.
/// </remarks>
[DllImport("gtk-1.3")]
static extern void gtk_label_set_selectable (IntPtr hnd, bool setting);
[DllImport("gtk-1.3")]
static extern bool gtk_label_get_selectable (IntPtr hnd);
public bool Selectable {
get
{
return gtk_label_get_selectable (RawObject);
}
set
{
gtk_label_set_selectable (RawObject, value);
}
}
/// <summary>
/// UseUnderline Property
/// </summary>
///
/// <remarks>
/// Indicates that the next character after an underline should be the accelerator key.
/// </remarks>
[DllImport("gtk-1.3")]
static extern void gtk_label_set_use_underline (IntPtr hnd, bool setting);
[DllImport("gtk-1.3")]
static extern bool gtk_label_get_use_underline (IntPtr hnd);
public bool UseUnderline {
get
{
return gtk_label_get_use_underline (RawObject);
}
set
{
gtk_label_set_use_underline (RawObject, value);
}
}
/// <summary>
/// UseMarkup Property
/// </summary>
///
/// <remarks>
/// Indicates that the text contains markup.
/// </remarks>
[DllImport("gtk-1.3")]
static extern void gtk_label_set_use_markup (IntPtr hnd, bool setting);
[DllImport("gtk-1.3")]
static extern bool gtk_label_get_use_markup (IntPtr hnd);
public bool UseMarkup {
get
{
return gtk_label_get_use_markup (RawObject);
}
set
{
gtk_label_set_use_markup (RawObject, value);
}
}
/// <summary>
/// LineWrap Property
/// </summary>
///
/// <remarks>
/// Indicates that the text is automatically wrapped if to long.
/// </remarks>
[DllImport("gtk-1.3")]
static extern void gtk_label_set_line_wrap (IntPtr hnd, bool setting);
[DllImport("gtk-1.3")]
static extern bool gtk_label_get_line_wrap (IntPtr hnd);
public bool LineWrap {
get
{
return gtk_label_get_line_wrap (RawObject);
}
set
{
gtk_label_set_line_wrap (RawObject, value);
}
}
/*
TODO:
void gtk_label_set_attributes(GtkLabel *label, PangoAttrList *attrs);
void gtk_label_set_markup_with_mnemonic(GtkLabel *label, const gchar *str);
void gtk_label_set_pattern(GtkLabel *label, const gchar *pattern);
void gtk_label_set_justify(GtkLabel *label, GtkJustification jtype);
guint gtk_label_parse_uline(GtkLabel *label, const gchar *string);
void gtk_label_get_layout_offsets (GtkLabel *label,
gint *x,
gint *y);
guint gtk_label_get_mnemonic_keyval (GtkLabel *label);
GtkWidget* gtk_label_new_with_mnemonic (const char *str);
void gtk_label_select_region (GtkLabel *label,
gint start_offset,
gint end_offset);
void gtk_label_set_mnemonic_widget (GtkLabel *label,
GtkWidget *widget);
void gtk_label_set_text_with_mnemonic
(GtkLabel *label,
const gchar *str);
PangoAttrList* gtk_label_get_attributes (GtkLabel *label);
GtkJustification gtk_label_get_justify (GtkLabel *label);
PangoLayout* gtk_label_get_layout (GtkLabel *label);
GtkWidget* gtk_label_get_mnemonic_widget (GtkLabel *label);
gboolean gtk_label_get_selection_bounds (GtkLabel *label,
gint *start,
gint *end);
*/
}
}

View file

@ -1,16 +0,0 @@
// Object.cs - GtkObject class wrapper implementation
//
// Author: Mike Kestner <mkestner@speakeasy.net>
//
// (c) 2001 Mike Kestner
namespace Gtk {
using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
public abstract class Object : GLib.Object {
}
}

View file

@ -1 +1,3 @@
Fix enum bug where symbolic values are used (eg Gdk.ModifierType.ModifierMask).
Fix property names where a variable is used instead of a string literal.
Fix the bool property macro definitions in GtkTextTag and CellRendererText.

View file

@ -425,46 +425,45 @@ sub addPropElem
{
my ($spec, $node) = @_;
my ($name, $mode, $docs);
$spec =~ /g_param_spec_(\w+)\s*\((.*)/;
$spec =~ /g_param_spec_(\w+)\s*\((.*)\s*\)\s*\)/;
my $type = $1;
my $params = $2;
my @params = split(/,/, $2);
if ($type =~ /boolean|^u*int|pointer/) {
$params =~ /\"(.+)\",.+\".+\".+\"(.+)\".*(,\s*G_PARAM_\w+.*)\)\s*\)/;
$name = $1; $docs = $2; $mode = $3;
# FIXME: Handle non-literals. Needs work in the pp too.
$name = $params[0];
$name =~ s/\"//g;
while ($params[2] !~ /\"\s*\)?$/) {
die "Unable to reconstruct doc string.\n" if (!$params[3]);
$params[2] .= ",$params[3]";
@params = (@params[0..2],@params[4..$#params]);
}
$docs = $params[2];
$docs =~ s/\"//g;
$docs =~ s/\s+/ /g;
$mode = $params[$#params];
if ($type =~ /boolean|float|double|^u?int|pointer/) {
$type = "g$type";
} elsif ($type =~ /string/) {
$params =~ /\"(.+)\",.+\".+\".+\"(.+)\".*(,\s*G_PARAM_\w+.*)\)\s*\)/;
$name = $1; $docs = $2; $mode = $3;
$type = "gchar*";
} elsif ($type =~ /enum|flags/) {
$params =~ /\"(.+)\",.+,.+\"(.+)\".*,\s+(\w+),.*,(\s*G_PARAM_\w+.*)\)\s*\)/;
$name = $1; $docs = $2; $type = $3; $mode = $4;
$type =~ s/TYPE_//;
$type = StudlyCaps(lc($type));
} elsif ($type =~ /object/) {
$params =~ /\"(.+)\",.+,.+\"(.+)\".*,\s+(\w+),(\s*G_PARAM_\w+.*)\)\s*\)/;
$name = $1; $docs = $2; $type = $3; $mode = $4;
} elsif ($type =~ /enum|flags|object/) {
$type = $params[3];
$type =~ s/TYPE_//;
$type =~ s/\s+//g;
$type = StudlyCaps(lc($type));
}
$prop_elem = $doc->createElement('property');
$node->appendChild($prop_elem);
$prop_elem->setAttribute('name', $name);
$prop_elem->setAttribute('name', StudlyCaps($name));
$prop_elem->setAttribute('cname', $name);
$prop_elem->setAttribute('type', $type);
$prop_elem->setAttribute('doc-string', $docs);
if ($mode =~ /READ/) {
$prop_elem->setAttribute('readable', "true");
}
if ($mode =~ /WRIT/) {
$prop_elem->setAttribute('writeable', "true");
}
if ($mode =~ /CONS/) {
$prop_elem->setAttribute('construct-only', "true");
}
$prop_elem->setAttribute('readable', "true") if ($mode =~ /READ/);
$prop_elem->setAttribute('writeable', "true") if ($mode =~ /WRIT/);
$prop_elem->setAttribute('construct-only', "true") if ($mode =~ /CONS/);
}
sub addSignalElem
@ -526,26 +525,23 @@ sub parseInitFunc
my $line = $init_lines[$linenum];
while ($linenum < @init_lines) {
$line = $init_lines[$linenum];
if ($line =~ /g_object_class_install_prop/) {
my $prop = $line;
do {
$prop .= $init_lines[++$linenum];
} until ($init_lines[$linenum] =~ /;/);
addPropElem ($prop, $obj_el);
$propcnt++;
} elsif ($line =~ /g(tk)?_signal_new/) {
my $sig = $line;
do {
$sig .= $init_lines[++$linenum];
} until ($init_lines[$linenum] =~ /;/);
addSignalElem ($sig, $classdef, $obj_el);
$sigcnt++;
}
$linenum++;
if ($line =~ /#define/) {
# FIXME: This ignores the bool helper macro thingie.
} elsif ($line =~ /g_object_class_install_prop/) {
my $prop = $line;
do {
$prop .= $init_lines[++$linenum];
} until ($init_lines[$linenum] =~ /;/);
addPropElem ($prop, $obj_el);
$propcnt++;
} elsif ($line =~ /g(tk)?_signal_new/) {
my $sig = $line;
do {
$sig .= $init_lines[++$linenum];
} until ($init_lines[$linenum] =~ /;/);
addSignalElem ($sig, $classdef, $obj_el);
$sigcnt++;
}
$linenum++;
}
}