gtk: Re-indent code that was moved inside partial classes

No real code change in this commit, just whitespace changes.
This commit is contained in:
Bertrand Lorentz 2012-08-05 17:24:05 +02:00
parent a410d42975
commit a8e1e8fd7d
29 changed files with 1460 additions and 1459 deletions

View file

@ -19,12 +19,12 @@ namespace Gtk {
public partial struct AccelKey { public partial struct AccelKey {
public AccelKey (Gdk.Key key, Gdk.ModifierType mods, Gtk.AccelFlags flags) public AccelKey (Gdk.Key key, Gdk.ModifierType mods, Gtk.AccelFlags flags)
{ {
this.Key = key; this.Key = key;
this.AccelMods = mods; this.AccelMods = mods;
this._bitfield0 = 0; this._bitfield0 = 0;
this.AccelFlags = flags; this.AccelFlags = flags;
} }
} }
} }

View file

@ -26,8 +26,7 @@ namespace Gtk {
public partial class Action { public partial class Action {
public Action (string name, string label) : this (name, label, null, null) public Action (string name, string label) : this (name, label, null, null)
{ {}
}
[DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gtk_action_get_proxies (IntPtr raw); static extern IntPtr gtk_action_get_proxies (IntPtr raw);

View file

@ -23,11 +23,11 @@ namespace Gtk {
public partial class Adjustment { public partial class Adjustment {
[DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gtk_adjustment_new(double value, double lower, double upper, double step_increment, double page_increment, double page_size); static extern IntPtr gtk_adjustment_new(double value, double lower, double upper, double step_increment, double page_increment, double page_size);
public Adjustment (double value, double lower, double upper, double step_increment, double page_increment, double page_size) : base (IntPtr.Zero) public Adjustment (double value, double lower, double upper, double step_increment, double page_increment, double page_size) : base (IntPtr.Zero)
{ {
if (GetType () != typeof (Adjustment)) { if (GetType () != typeof (Adjustment)) {
CreateNativeObject (new string [0], new GLib.Value [0]); CreateNativeObject (new string [0], new GLib.Value [0]);
Value = value; Value = value;
@ -40,16 +40,16 @@ public Adjustment (double value, double lower, double upper, double step_increme
} }
Raw = gtk_adjustment_new(value, lower, upper, step_increment, page_increment, page_size); Raw = gtk_adjustment_new(value, lower, upper, step_increment, page_increment, page_size);
} }
[DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void g_object_freeze_notify (IntPtr inst); static extern void g_object_freeze_notify (IntPtr inst);
[DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void g_object_thaw_notify (IntPtr inst); static extern void g_object_thaw_notify (IntPtr inst);
public void SetBounds (double lower, double upper, double step_increment, double page_increment, double page_size) public void SetBounds (double lower, double upper, double step_increment, double page_increment, double page_size)
{ {
// g_object_freeze_notify/g_object_thaw_notify calls are necessary to to avoid multiple emissions of the "changed" signal // g_object_freeze_notify/g_object_thaw_notify calls are necessary to to avoid multiple emissions of the "changed" signal
g_object_freeze_notify (this.Handle); g_object_freeze_notify (this.Handle);
@ -60,6 +60,6 @@ public void SetBounds (double lower, double upper, double step_increment, double
PageSize = page_size; PageSize = page_size;
g_object_thaw_notify (this.Handle); g_object_thaw_notify (this.Handle);
} }
} }
} }

View file

@ -30,9 +30,9 @@ namespace Gtk {
public partial class Builder { public partial class Builder {
[System.Serializable] [System.Serializable]
public class HandlerNotFoundException : SystemException public class HandlerNotFoundException : SystemException
{ {
string handler_name; string handler_name;
string signal_name; string signal_name;
System.Reflection.EventInfo evnt; System.Reflection.EventInfo evnt;
@ -111,12 +111,12 @@ public class HandlerNotFoundException : SystemException
info.AddValue ("Event", evnt); info.AddValue ("Event", evnt);
info.AddValue ("DelegateType", delegate_type); info.AddValue ("DelegateType", delegate_type);
} }
} }
[AttributeUsage (AttributeTargets.Field)] [AttributeUsage (AttributeTargets.Field)]
public class ObjectAttribute : Attribute public class ObjectAttribute : Attribute
{ {
private string name; private string name;
private bool specified; private bool specified;
@ -140,21 +140,21 @@ public class ObjectAttribute : Attribute
{ {
get { return specified; } get { return specified; }
} }
} }
public IntPtr GetRawObject(string name) { public IntPtr GetRawObject(string name) {
IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name); IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name);
IntPtr raw_ret = gtk_builder_get_object(Handle, native_name); IntPtr raw_ret = gtk_builder_get_object(Handle, native_name);
GLib.Marshaller.Free (native_name); GLib.Marshaller.Free (native_name);
return raw_ret; return raw_ret;
} }
public Builder (System.IO.Stream s) : this (s, null) public Builder (System.IO.Stream s) : this (s, null)
{ {
} }
public Builder (System.IO.Stream s, string translation_domain) public Builder (System.IO.Stream s, string translation_domain)
{ {
if (s == null) if (s == null)
throw new ArgumentNullException ("s"); throw new ArgumentNullException ("s");
@ -166,18 +166,18 @@ public Builder (System.IO.Stream s, string translation_domain)
AddFromString(System.Text.Encoding.UTF8.GetString (buffer)); AddFromString(System.Text.Encoding.UTF8.GetString (buffer));
TranslationDomain = translation_domain; TranslationDomain = translation_domain;
} }
public Builder (string resource_name) : this (resource_name, null) public Builder (string resource_name) : this (resource_name, null)
{ {
} }
public Builder (string resource_name, string translation_domain) : this (System.Reflection.Assembly.GetEntryAssembly (), resource_name, translation_domain) public Builder (string resource_name, string translation_domain) : this (System.Reflection.Assembly.GetEntryAssembly (), resource_name, translation_domain)
{ {
} }
public Builder (System.Reflection.Assembly assembly, string resource_name, string translation_domain) : this () public Builder (System.Reflection.Assembly assembly, string resource_name, string translation_domain) : this ()
{ {
if (GetType() != typeof (Builder)) if (GetType() != typeof (Builder))
throw new InvalidOperationException ("Cannot chain to this constructor from subclasses."); throw new InvalidOperationException ("Cannot chain to this constructor from subclasses.");
@ -197,22 +197,22 @@ public Builder (System.Reflection.Assembly assembly, string resource_name, strin
AddFromString(System.Text.Encoding.UTF8.GetString (buffer)); AddFromString(System.Text.Encoding.UTF8.GetString (buffer));
TranslationDomain = translation_domain; TranslationDomain = translation_domain;
} }
public void Autoconnect (object handler) public void Autoconnect (object handler)
{ {
BindFields (handler); BindFields (handler);
(new SignalConnector (this, handler)).ConnectSignals (); (new SignalConnector (this, handler)).ConnectSignals ();
} }
public void Autoconnect (Type handler_class) public void Autoconnect (Type handler_class)
{ {
BindFields (handler_class); BindFields (handler_class);
(new SignalConnector (this, handler_class)).ConnectSignals (); (new SignalConnector (this, handler_class)).ConnectSignals ();
} }
class SignalConnector class SignalConnector
{ {
Builder builder; Builder builder;
Type handler_type; Type handler_type;
object handler; object handler;
@ -364,21 +364,21 @@ class SignalConnector
return sb.ToString (); return sb.ToString ();
} }
} }
void BindFields (object target) void BindFields (object target)
{ {
BindFields (target, target.GetType ()); BindFields (target, target.GetType ());
} }
void BindFields (Type type) void BindFields (Type type)
{ {
BindFields (null, type); BindFields (null, type);
} }
void BindFields (object target, Type type) void BindFields (object target, Type type)
{ {
System.Reflection.BindingFlags flags = System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.DeclaredOnly; System.Reflection.BindingFlags flags = System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.DeclaredOnly;
if (target != null) if (target != null)
flags |= System.Reflection.BindingFlags.Instance; flags |= System.Reflection.BindingFlags.Instance;
@ -415,6 +415,6 @@ void BindFields (object target, Type type)
type = type.BaseType; type = type.BaseType;
} }
while (type != typeof(object) && type != null); while (type != typeof(object) && type != null);
} }
} }
} }

View file

@ -25,11 +25,11 @@ namespace Gtk {
public partial class Button { public partial class Button {
[DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gtk_button_new_from_stock(IntPtr stock_id); static extern IntPtr gtk_button_new_from_stock(IntPtr stock_id);
public Button (string stock_id) : base (IntPtr.Zero) public Button (string stock_id) : base (IntPtr.Zero)
{ {
if (GetType () != typeof (Button)) { if (GetType () != typeof (Button)) {
GLib.Value[] vals = new GLib.Value [2]; GLib.Value[] vals = new GLib.Value [2];
string[] names = new string [2]; string[] names = new string [2];
@ -43,11 +43,11 @@ public Button (string stock_id) : base (IntPtr.Zero)
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (stock_id); IntPtr native = GLib.Marshaller.StringToPtrGStrdup (stock_id);
Raw = gtk_button_new_from_stock (native); Raw = gtk_button_new_from_stock (native);
GLib.Marshaller.Free (native); GLib.Marshaller.Free (native);
} }
public Button (Widget widget) : this () public Button (Widget widget) : this ()
{ {
Add (widget); Add (widget);
} }
} }
} }

View file

@ -25,8 +25,8 @@ namespace Gtk {
public partial class Calendar { public partial class Calendar {
public DateTime GetDate () public DateTime GetDate ()
{ {
uint year, month, day; uint year, month, day;
GetDate (out year, out month, out day); GetDate (out year, out month, out day);
DateTime result; DateTime result;
@ -38,14 +38,13 @@ public DateTime GetDate ()
result = new DateTime ((int) year, (int) month + 1, DateTime.DaysInMonth ((int) year, (int) month + 1)); result = new DateTime ((int) year, (int) month + 1, DateTime.DaysInMonth ((int) year, (int) month + 1));
} }
return result; return result;
} }
// This defines a Date property for Calendar // This defines a Date property for Calendar
// Note that the setter causes CalendarChange events to be fired // Note that the setter causes CalendarChange events to be fired
public DateTime Date public DateTime Date
{
{
get { get {
return this.GetDate(); return this.GetDate();
} }
@ -57,6 +56,6 @@ public DateTime Date
SelectMonth(month,year); SelectMonth(month,year);
SelectDay(day); SelectDay(day);
} }
} }
} }
} }

View file

@ -23,8 +23,9 @@ namespace Gtk {
using System; using System;
public partial class ColorSelectionDialog { public partial class ColorSelectionDialog {
[Obsolete ("Do not use this class. It will cause your app to crash in mysterious ways.")]
public class ColorSelectionButton : Gtk.Button { [Obsolete ("Do not use this class. It will cause your app to crash in mysterious ways.")]
public class ColorSelectionButton : Gtk.Button {
private ColorSelectionDialog color_sel; private ColorSelectionDialog color_sel;
public ColorSelectionDialog ColorSelectionDialog { public ColorSelectionDialog ColorSelectionDialog {
@ -34,6 +35,6 @@ public class ColorSelectionButton : Gtk.Button {
public ColorSelectionButton (ColorSelectionDialog cs, IntPtr raw) : base (raw) { public ColorSelectionButton (ColorSelectionDialog cs, IntPtr raw) : base (raw) {
color_sel = cs; color_sel = cs;
} }
} }
} }
} }

View file

@ -26,47 +26,47 @@ namespace Gtk {
public partial class Container { public partial class Container {
[DllImport("gtksharpglue-3")] [DllImport("gtksharpglue-3")]
static extern void gtksharp_container_child_get_property (IntPtr container, IntPtr child, IntPtr property, ref GLib.Value value); static extern void gtksharp_container_child_get_property (IntPtr container, IntPtr child, IntPtr property, ref GLib.Value value);
public GLib.Value ChildGetProperty (Gtk.Widget child, string property_name) { public GLib.Value ChildGetProperty (Gtk.Widget child, string property_name) {
GLib.Value value = new GLib.Value (); GLib.Value value = new GLib.Value ();
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (property_name); IntPtr native = GLib.Marshaller.StringToPtrGStrdup (property_name);
gtksharp_container_child_get_property (Handle, child.Handle, native, ref value); gtksharp_container_child_get_property (Handle, child.Handle, native, ref value);
GLib.Marshaller.Free (native); GLib.Marshaller.Free (native);
return value; return value;
} }
public IEnumerator GetEnumerator () public IEnumerator GetEnumerator ()
{ {
return Children.GetEnumerator (); return Children.GetEnumerator ();
} }
class ChildAccumulator { class ChildAccumulator {
public ArrayList Children = new ArrayList (); public ArrayList Children = new ArrayList ();
public void Add (Gtk.Widget widget) public void Add (Gtk.Widget widget)
{ {
Children.Add (widget); Children.Add (widget);
} }
} }
public IEnumerable AllChildren { public IEnumerable AllChildren {
get { get {
ChildAccumulator acc = new ChildAccumulator (); ChildAccumulator acc = new ChildAccumulator ();
Forall (new Gtk.Callback (acc.Add)); Forall (new Gtk.Callback (acc.Add));
return acc.Children; return acc.Children;
} }
} }
[DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern bool gtk_container_get_focus_chain (IntPtr raw, out IntPtr list_ptr); static extern bool gtk_container_get_focus_chain (IntPtr raw, out IntPtr list_ptr);
[DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void gtk_container_set_focus_chain (IntPtr raw, IntPtr list_ptr); static extern void gtk_container_set_focus_chain (IntPtr raw, IntPtr list_ptr);
public Widget[] FocusChain { public Widget[] FocusChain {
get { get {
IntPtr list_ptr; IntPtr list_ptr;
bool success = gtk_container_get_focus_chain (Handle, out list_ptr); bool success = gtk_container_get_focus_chain (Handle, out list_ptr);
@ -86,24 +86,24 @@ public Widget[] FocusChain {
gtk_container_set_focus_chain (Handle, list.Handle); gtk_container_set_focus_chain (Handle, list.Handle);
} }
} }
[DllImport("gtksharpglue-3")] [DllImport("gtksharpglue-3")]
static extern void gtksharp_container_base_forall (IntPtr handle, bool include_internals, IntPtr cb, IntPtr data); static extern void gtksharp_container_base_forall (IntPtr handle, bool include_internals, IntPtr cb, IntPtr data);
[DllImport("gtksharpglue-3")] [DllImport("gtksharpglue-3")]
static extern void gtksharp_container_override_forall (IntPtr gtype, ForallDelegate cb); static extern void gtksharp_container_override_forall (IntPtr gtype, ForallDelegate cb);
[DllImport("gtksharpglue-3")] [DllImport("gtksharpglue-3")]
static extern void gtksharp_container_invoke_gtk_callback (IntPtr cb, IntPtr handle, IntPtr data); static extern void gtksharp_container_invoke_gtk_callback (IntPtr cb, IntPtr handle, IntPtr data);
[UnmanagedFunctionPointer (CallingConvention.Cdecl)] [UnmanagedFunctionPointer (CallingConvention.Cdecl)]
delegate void ForallDelegate (IntPtr container, bool include_internals, IntPtr cb, IntPtr data); delegate void ForallDelegate (IntPtr container, bool include_internals, IntPtr cb, IntPtr data);
static ForallDelegate ForallOldCallback; static ForallDelegate ForallOldCallback;
static ForallDelegate ForallCallback; static ForallDelegate ForallCallback;
public struct CallbackInvoker { public struct CallbackInvoker {
IntPtr cb; IntPtr cb;
IntPtr data; IntPtr data;
@ -129,10 +129,10 @@ public struct CallbackInvoker {
{ {
gtksharp_container_invoke_gtk_callback (cb, w.Handle, data); gtksharp_container_invoke_gtk_callback (cb, w.Handle, data);
} }
} }
static void ForallOld_cb (IntPtr container, bool include_internals, IntPtr cb, IntPtr data) static void ForallOld_cb (IntPtr container, bool include_internals, IntPtr cb, IntPtr data)
{ {
try { try {
Container obj = GLib.Object.GetObject (container, false) as Container; Container obj = GLib.Object.GetObject (container, false) as Container;
CallbackInvoker invoker = new CallbackInvoker (cb, data); CallbackInvoker invoker = new CallbackInvoker (cb, data);
@ -140,24 +140,24 @@ static void ForallOld_cb (IntPtr container, bool include_internals, IntPtr cb, I
} catch (Exception e) { } catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false); GLib.ExceptionManager.RaiseUnhandledException (e, false);
} }
} }
static void OverrideForallOld (GLib.GType gtype) static void OverrideForallOld (GLib.GType gtype)
{ {
if (ForallOldCallback == null) if (ForallOldCallback == null)
ForallOldCallback = new ForallDelegate (ForallOld_cb); ForallOldCallback = new ForallDelegate (ForallOld_cb);
gtksharp_container_override_forall (gtype.Val, ForallOldCallback); gtksharp_container_override_forall (gtype.Val, ForallOldCallback);
} }
[Obsolete ("Override the ForAll(bool,Gtk.Callback) method instead")] [Obsolete ("Override the ForAll(bool,Gtk.Callback) method instead")]
[GLib.DefaultSignalHandler (Type=typeof(Gtk.Container), ConnectionMethod="OverrideForallOld")] [GLib.DefaultSignalHandler (Type=typeof(Gtk.Container), ConnectionMethod="OverrideForallOld")]
protected virtual void ForAll (bool include_internals, CallbackInvoker invoker) protected virtual void ForAll (bool include_internals, CallbackInvoker invoker)
{ {
gtksharp_container_base_forall (Handle, include_internals, invoker.Callback, invoker.Data); gtksharp_container_base_forall (Handle, include_internals, invoker.Callback, invoker.Data);
} }
static void Forall_cb (IntPtr container, bool include_internals, IntPtr cb, IntPtr data) static void Forall_cb (IntPtr container, bool include_internals, IntPtr cb, IntPtr data)
{ {
try { try {
Container obj = GLib.Object.GetObject (container, false) as Container; Container obj = GLib.Object.GetObject (container, false) as Container;
CallbackInvoker invoker = new CallbackInvoker (cb, data); CallbackInvoker invoker = new CallbackInvoker (cb, data);
@ -165,18 +165,18 @@ static void Forall_cb (IntPtr container, bool include_internals, IntPtr cb, IntP
} catch (Exception e) { } catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false); GLib.ExceptionManager.RaiseUnhandledException (e, false);
} }
} }
static void OverrideForall (GLib.GType gtype) static void OverrideForall (GLib.GType gtype)
{ {
if (ForallCallback == null) if (ForallCallback == null)
ForallCallback = new ForallDelegate (Forall_cb); ForallCallback = new ForallDelegate (Forall_cb);
gtksharp_container_override_forall (gtype.Val, ForallCallback); gtksharp_container_override_forall (gtype.Val, ForallCallback);
} }
[GLib.DefaultSignalHandler (Type=typeof(Gtk.Container), ConnectionMethod="OverrideForall")] [GLib.DefaultSignalHandler (Type=typeof(Gtk.Container), ConnectionMethod="OverrideForall")]
protected virtual void ForAll (bool include_internals, Gtk.Callback callback) protected virtual void ForAll (bool include_internals, Gtk.Callback callback)
{ {
CallbackInvoker invoker; CallbackInvoker invoker;
try { try {
invoker = (CallbackInvoker)callback.Target; invoker = (CallbackInvoker)callback.Target;
@ -184,11 +184,11 @@ protected virtual void ForAll (bool include_internals, Gtk.Callback callback)
throw new ApplicationException ("ForAll can only be called as \"base.ForAll()\". Use Forall() or Foreach()."); throw new ApplicationException ("ForAll can only be called as \"base.ForAll()\". Use Forall() or Foreach().");
} }
gtksharp_container_base_forall (Handle, include_internals, invoker.Callback, invoker.Data); gtksharp_container_base_forall (Handle, include_internals, invoker.Callback, invoker.Data);
} }
// Compatibility code for old ChildType() virtual method // Compatibility code for old ChildType() virtual method
static IntPtr ObsoleteChildType_cb (IntPtr raw) static IntPtr ObsoleteChildType_cb (IntPtr raw)
{ {
try { try {
Container obj = GLib.Object.GetObject (raw, false) as Container; Container obj = GLib.Object.GetObject (raw, false) as Container;
GLib.GType gtype = obj.ChildType (); GLib.GType gtype = obj.ChildType ();
@ -198,24 +198,24 @@ static IntPtr ObsoleteChildType_cb (IntPtr raw)
} }
return GLib.GType.Invalid.Val; return GLib.GType.Invalid.Val;
} }
static ChildTypeNativeDelegate ObsoleteChildTypeVMCallback; static ChildTypeNativeDelegate ObsoleteChildTypeVMCallback;
static void OverrideObsoleteChildType (GLib.GType gtype) static void OverrideObsoleteChildType (GLib.GType gtype)
{ {
if (ObsoleteChildTypeVMCallback == null) if (ObsoleteChildTypeVMCallback == null)
ObsoleteChildTypeVMCallback = new ChildTypeNativeDelegate (ObsoleteChildType_cb); ObsoleteChildTypeVMCallback = new ChildTypeNativeDelegate (ObsoleteChildType_cb);
OverrideChildType (gtype, ObsoleteChildTypeVMCallback); // -> autogenerated method OverrideChildType (gtype, ObsoleteChildTypeVMCallback); // -> autogenerated method
} }
[Obsolete ("Replaced by OnChildType for implementations and SupportedChildType for callers.")] [Obsolete ("Replaced by OnChildType for implementations and SupportedChildType for callers.")]
[GLib.DefaultSignalHandler (Type=typeof(Gtk.Container), ConnectionMethod="OverrideObsoleteChildType")] [GLib.DefaultSignalHandler (Type=typeof(Gtk.Container), ConnectionMethod="OverrideObsoleteChildType")]
public virtual GLib.GType ChildType() { public virtual GLib.GType ChildType() {
return InternalChildType (); // -> autogenerated method return InternalChildType (); // -> autogenerated method
} }
public class ContainerChild { public class ContainerChild {
protected Container parent; protected Container parent;
protected Widget child; protected Widget child;
@ -236,12 +236,12 @@ public class ContainerChild {
return child; return child;
} }
} }
} }
public virtual ContainerChild this [Widget w] { public virtual ContainerChild this [Widget w] {
get { get {
return new ContainerChild (this, w); return new ContainerChild (this, w);
} }
} }
} }
} }

View file

@ -26,10 +26,10 @@ namespace Gtk {
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
public partial class Dialog { public partial class Dialog {
[DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gtk_dialog_new_with_buttons (IntPtr title, IntPtr i, int flags, IntPtr dummy); static extern IntPtr gtk_dialog_new_with_buttons (IntPtr title, IntPtr i, int flags, IntPtr dummy);
public Dialog (string title, Gtk.Window parent, Gtk.DialogFlags flags, params object[] button_data) : base(IntPtr.Zero) public Dialog (string title, Gtk.Window parent, Gtk.DialogFlags flags, params object[] button_data) : base(IntPtr.Zero)
{ {
if (GetType() != typeof (Dialog)) { if (GetType() != typeof (Dialog)) {
GLib.Value[] vals = new GLib.Value [1]; GLib.Value[] vals = new GLib.Value [1];
string[] names = new string [1]; string[] names = new string [1];
@ -49,27 +49,27 @@ public Dialog (string title, Gtk.Window parent, Gtk.DialogFlags flags, params ob
for (int i = 0; i < button_data.Length - 1; i += 2) for (int i = 0; i < button_data.Length - 1; i += 2)
AddButton ((string) button_data [i], (int) button_data [i + 1]); AddButton ((string) button_data [i], (int) button_data [i + 1]);
} }
public void AddActionWidget (Widget child, ResponseType response) public void AddActionWidget (Widget child, ResponseType response)
{ {
this.AddActionWidget (child, (int) response); this.AddActionWidget (child, (int) response);
} }
public Gtk.Widget AddButton (string button_text, ResponseType response) public Gtk.Widget AddButton (string button_text, ResponseType response)
{ {
return this.AddButton (button_text, (int) response); return this.AddButton (button_text, (int) response);
} }
public void Respond (ResponseType response) public void Respond (ResponseType response)
{ {
this.Respond ((int) response); this.Respond ((int) response);
} }
[Obsolete ("Replaced by AlternativeButtonOrder property")] [Obsolete ("Replaced by AlternativeButtonOrder property")]
public int SetAlternativeButtonOrderFromArray (int n_params) public int SetAlternativeButtonOrderFromArray (int n_params)
{ {
return -1; return -1;
} }
} }
} }

View file

@ -20,24 +20,25 @@ namespace Gtk {
using System; using System;
public partial class Entry { public partial class Entry {
public int InsertText (string new_text)
{ public int InsertText (string new_text)
{
int position = 0; int position = 0;
InsertText (new_text, ref position); InsertText (new_text, ref position);
return position; return position;
} }
public Entry(string initialText): this() public Entry(string initialText): this()
{ {
Text = initialText; Text = initialText;
} }
[Obsolete("Replaced by IsEditable property")] [Obsolete("Replaced by IsEditable property")]
public bool Editable { public bool Editable {
get { return IsEditable; } get { return IsEditable; }
set { IsEditable = value; } set { IsEditable = value; }
} }
} }
} }

View file

@ -19,7 +19,7 @@ namespace Gtk {
public partial class HBox { public partial class HBox {
public HBox () : this (false, 0) {} public HBox () : this (false, 0) {}
} }
} }

View file

@ -20,14 +20,14 @@ namespace Gtk {
public partial class MessageDialog { public partial class MessageDialog {
[DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gtk_message_dialog_new (IntPtr parent_window, DialogFlags flags, MessageType type, ButtonsType bt, IntPtr msg, IntPtr args); static extern IntPtr gtk_message_dialog_new (IntPtr parent_window, DialogFlags flags, MessageType type, ButtonsType bt, IntPtr msg, IntPtr args);
[DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gtk_message_dialog_new_with_markup (IntPtr parent_window, DialogFlags flags, MessageType type, ButtonsType bt, IntPtr msg, IntPtr args); static extern IntPtr gtk_message_dialog_new_with_markup (IntPtr parent_window, DialogFlags flags, MessageType type, ButtonsType bt, IntPtr msg, IntPtr args);
public MessageDialog (Gtk.Window parent_window, DialogFlags flags, MessageType type, ButtonsType bt, bool use_markup, string format, params object[] args) public MessageDialog (Gtk.Window parent_window, DialogFlags flags, MessageType type, ButtonsType bt, bool use_markup, string format, params object[] args)
{ {
IntPtr p = (parent_window != null) ? parent_window.Handle : IntPtr.Zero; IntPtr p = (parent_window != null) ? parent_window.Handle : IntPtr.Zero;
if (format == null) { if (format == null) {
@ -41,9 +41,9 @@ public MessageDialog (Gtk.Window parent_window, DialogFlags flags, MessageType t
else else
Raw = gtk_message_dialog_new (p, flags, type, bt, nmsg, IntPtr.Zero); Raw = gtk_message_dialog_new (p, flags, type, bt, nmsg, IntPtr.Zero);
GLib.Marshaller.Free (nmsg); GLib.Marshaller.Free (nmsg);
} }
public MessageDialog (Gtk.Window parent_window, DialogFlags flags, MessageType type, ButtonsType bt, string format, params object[] args) : this (parent_window, flags, type, bt, true, format, args) {} public MessageDialog (Gtk.Window parent_window, DialogFlags flags, MessageType type, ButtonsType bt, string format, params object[] args) : this (parent_window, flags, type, bt, true, format, args) {}
} }
} }

View file

@ -129,8 +129,7 @@ namespace Gtk {
throw new Exception (String.Format ("You have two TreeNodeValueAttributes with the Column={0}", col)); throw new Exception (String.Format ("You have two TreeNodeValueAttributes with the Column={0}", col));
getters [col] = mi; getters [col] = mi;
Type t = mi is PropertyInfo ? ((PropertyInfo) mi).PropertyType Type t = mi is PropertyInfo ? ((PropertyInfo) mi).PropertyType : ((FieldInfo) mi).FieldType;
: ((FieldInfo) mi).FieldType;
ctypes [col] = (GLib.GType) t; ctypes [col] = (GLib.GType) t;
} }
} }

View file

@ -26,18 +26,18 @@ namespace Gtk {
public partial class Notebook { public partial class Notebook {
public Widget CurrentPageWidget { public Widget CurrentPageWidget {
get { get {
return GetNthPage (CurrentPage); return GetNthPage (CurrentPage);
} }
} }
[DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern int gtk_notebook_page_num (IntPtr handle, IntPtr child); static extern int gtk_notebook_page_num (IntPtr handle, IntPtr child);
public int PageNum (Widget child) public int PageNum (Widget child)
{ {
return gtk_notebook_page_num (Handle, child.Handle); return gtk_notebook_page_num (Handle, child.Handle);
} }
} }
} }

View file

@ -208,138 +208,138 @@ public void SetMidGC (StateType state, Gdk.GC gc)
} }
#endif #endif
[DllImport("gtksharpglue-3")] [DllImport("gtksharpglue-3")]
static extern IntPtr gtksharp_gtk_style_get_bg (IntPtr style, int i); static extern IntPtr gtksharp_gtk_style_get_bg (IntPtr style, int i);
public Gdk.Color Background (StateType state) public Gdk.Color Background (StateType state)
{ {
IntPtr raw = gtksharp_gtk_style_get_bg (Handle, (int) state); IntPtr raw = gtksharp_gtk_style_get_bg (Handle, (int) state);
return Gdk.Color.New (raw); return Gdk.Color.New (raw);
} }
public Gdk.Color[] Backgrounds { public Gdk.Color[] Backgrounds {
get { get {
Gdk.Color[] ret = new Gdk.Color[5]; Gdk.Color[] ret = new Gdk.Color[5];
for (int i = 0; i < 5; i++) for (int i = 0; i < 5; i++)
ret[i] = Gdk.Color.New (gtksharp_gtk_style_get_bg (Handle, i)); ret[i] = Gdk.Color.New (gtksharp_gtk_style_get_bg (Handle, i));
return ret; return ret;
} }
} }
[DllImport("gtksharpglue-3")] [DllImport("gtksharpglue-3")]
static extern IntPtr gtksharp_gtk_style_get_fg (IntPtr style, int i); static extern IntPtr gtksharp_gtk_style_get_fg (IntPtr style, int i);
public Gdk.Color Foreground (StateType state) public Gdk.Color Foreground (StateType state)
{ {
IntPtr raw = gtksharp_gtk_style_get_fg (Handle, (int) state); IntPtr raw = gtksharp_gtk_style_get_fg (Handle, (int) state);
return Gdk.Color.New (raw); return Gdk.Color.New (raw);
} }
public Gdk.Color[] Foregrounds { public Gdk.Color[] Foregrounds {
get { get {
Gdk.Color[] ret = new Gdk.Color[5]; Gdk.Color[] ret = new Gdk.Color[5];
for (int i = 0; i < 5; i++) for (int i = 0; i < 5; i++)
ret[i] = Gdk.Color.New (gtksharp_gtk_style_get_fg (Handle, i)); ret[i] = Gdk.Color.New (gtksharp_gtk_style_get_fg (Handle, i));
return ret; return ret;
} }
} }
[DllImport("gtksharpglue-3")] [DllImport("gtksharpglue-3")]
static extern IntPtr gtksharp_gtk_style_get_text (IntPtr style, int i); static extern IntPtr gtksharp_gtk_style_get_text (IntPtr style, int i);
public Gdk.Color Text (StateType state) public Gdk.Color Text (StateType state)
{ {
IntPtr raw = gtksharp_gtk_style_get_text (Handle, (int) state); IntPtr raw = gtksharp_gtk_style_get_text (Handle, (int) state);
return Gdk.Color.New (raw); return Gdk.Color.New (raw);
} }
public Gdk.Color[] TextColors { public Gdk.Color[] TextColors {
get { get {
Gdk.Color[] ret = new Gdk.Color[5]; Gdk.Color[] ret = new Gdk.Color[5];
for (int i = 0; i < 5; i++) for (int i = 0; i < 5; i++)
ret[i] = Gdk.Color.New (gtksharp_gtk_style_get_text (Handle, i)); ret[i] = Gdk.Color.New (gtksharp_gtk_style_get_text (Handle, i));
return ret; return ret;
} }
} }
[DllImport("gtksharpglue-3")] [DllImport("gtksharpglue-3")]
static extern IntPtr gtksharp_gtk_style_get_base (IntPtr style, int i); static extern IntPtr gtksharp_gtk_style_get_base (IntPtr style, int i);
public Gdk.Color Base (StateType state) public Gdk.Color Base (StateType state)
{ {
IntPtr raw = gtksharp_gtk_style_get_base (Handle, (int) state); IntPtr raw = gtksharp_gtk_style_get_base (Handle, (int) state);
return Gdk.Color.New (raw); return Gdk.Color.New (raw);
} }
public Gdk.Color[] BaseColors { public Gdk.Color[] BaseColors {
get { get {
Gdk.Color[] ret = new Gdk.Color[5]; Gdk.Color[] ret = new Gdk.Color[5];
for (int i = 0; i < 5; i++) for (int i = 0; i < 5; i++)
ret[i] = Gdk.Color.New (gtksharp_gtk_style_get_base (Handle, i)); ret[i] = Gdk.Color.New (gtksharp_gtk_style_get_base (Handle, i));
return ret; return ret;
} }
} }
[DllImport("gtksharpglue-3")] [DllImport("gtksharpglue-3")]
static extern IntPtr gtksharp_gtk_style_get_light (IntPtr style, int i); static extern IntPtr gtksharp_gtk_style_get_light (IntPtr style, int i);
public Gdk.Color Light (StateType state) public Gdk.Color Light (StateType state)
{ {
IntPtr raw = gtksharp_gtk_style_get_light (Handle, (int) state); IntPtr raw = gtksharp_gtk_style_get_light (Handle, (int) state);
return Gdk.Color.New (raw); return Gdk.Color.New (raw);
} }
public Gdk.Color[] LightColors { public Gdk.Color[] LightColors {
get { get {
Gdk.Color[] ret = new Gdk.Color[5]; Gdk.Color[] ret = new Gdk.Color[5];
for (int i = 0; i < 5; i++) for (int i = 0; i < 5; i++)
ret[i] = Gdk.Color.New (gtksharp_gtk_style_get_light (Handle, i)); ret[i] = Gdk.Color.New (gtksharp_gtk_style_get_light (Handle, i));
return ret; return ret;
} }
} }
[DllImport("gtksharpglue-3")] [DllImport("gtksharpglue-3")]
static extern IntPtr gtksharp_gtk_style_get_mid (IntPtr style, int i); static extern IntPtr gtksharp_gtk_style_get_mid (IntPtr style, int i);
public Gdk.Color Mid (StateType state) public Gdk.Color Mid (StateType state)
{ {
IntPtr raw = gtksharp_gtk_style_get_mid (Handle, (int) state); IntPtr raw = gtksharp_gtk_style_get_mid (Handle, (int) state);
return Gdk.Color.New (raw); return Gdk.Color.New (raw);
} }
public Gdk.Color[] MidColors { public Gdk.Color[] MidColors {
get { get {
Gdk.Color[] ret = new Gdk.Color[5]; Gdk.Color[] ret = new Gdk.Color[5];
for (int i = 0; i < 5; i++) for (int i = 0; i < 5; i++)
ret[i] = Gdk.Color.New (gtksharp_gtk_style_get_mid (Handle, i)); ret[i] = Gdk.Color.New (gtksharp_gtk_style_get_mid (Handle, i));
return ret; return ret;
} }
} }
[DllImport("gtksharpglue-3")] [DllImport("gtksharpglue-3")]
static extern IntPtr gtksharp_gtk_style_get_dark (IntPtr style, int i); static extern IntPtr gtksharp_gtk_style_get_dark (IntPtr style, int i);
public Gdk.Color Dark (StateType state) public Gdk.Color Dark (StateType state)
{ {
IntPtr raw = gtksharp_gtk_style_get_dark (Handle, (int) state); IntPtr raw = gtksharp_gtk_style_get_dark (Handle, (int) state);
return Gdk.Color.New (raw); return Gdk.Color.New (raw);
} }
public Gdk.Color[] DarkColors { public Gdk.Color[] DarkColors {
get { get {
Gdk.Color[] ret = new Gdk.Color[5]; Gdk.Color[] ret = new Gdk.Color[5];
for (int i = 0; i < 5; i++) for (int i = 0; i < 5; i++)
ret[i] = Gdk.Color.New (gtksharp_gtk_style_get_dark (Handle, i)); ret[i] = Gdk.Color.New (gtksharp_gtk_style_get_dark (Handle, i));
return ret; return ret;
} }
} }
[DllImport ("gtksharpglue-3")] [DllImport ("gtksharpglue-3")]
static extern int gtksharp_gtk_style_get_thickness (IntPtr style, int x_axis); static extern int gtksharp_gtk_style_get_thickness (IntPtr style, int x_axis);
[DllImport ("gtksharpglue-3")] [DllImport ("gtksharpglue-3")]
static extern void gtksharp_gtk_style_set_thickness (IntPtr style, int value); static extern void gtksharp_gtk_style_set_thickness (IntPtr style, int value);
public int XThickness { public int XThickness {
get { get {
return gtksharp_gtk_style_get_thickness (Handle, 0); return gtksharp_gtk_style_get_thickness (Handle, 0);
} }
@ -347,9 +347,9 @@ public int XThickness {
set { set {
gtksharp_gtk_style_set_thickness (Handle, value); gtksharp_gtk_style_set_thickness (Handle, value);
} }
} }
public int YThickness { public int YThickness {
get { get {
return gtksharp_gtk_style_get_thickness (Handle, 1); return gtksharp_gtk_style_get_thickness (Handle, 1);
} }
@ -357,12 +357,12 @@ public int YThickness {
set { set {
gtksharp_gtk_style_set_thickness (Handle, -value); gtksharp_gtk_style_set_thickness (Handle, -value);
} }
} }
[DllImport ("gtksharpglue-3")] [DllImport ("gtksharpglue-3")]
static extern IntPtr gtksharp_gtk_style_get_font_description (IntPtr style); static extern IntPtr gtksharp_gtk_style_get_font_description (IntPtr style);
public Pango.FontDescription FontDescription { public Pango.FontDescription FontDescription {
get { get {
IntPtr Raw = gtksharp_gtk_style_get_font_description (Handle); IntPtr Raw = gtksharp_gtk_style_get_font_description (Handle);
@ -373,6 +373,6 @@ public Pango.FontDescription FontDescription {
ret = new Pango.FontDescription (Raw); ret = new Pango.FontDescription (Raw);
return ret; return ret;
} }
} }
} }
} }

View file

@ -25,57 +25,57 @@ namespace Gtk {
public partial class TextBuffer { public partial class TextBuffer {
[DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void gtk_text_buffer_set_text (IntPtr raw, IntPtr text, int len); static extern void gtk_text_buffer_set_text (IntPtr raw, IntPtr text, int len);
public void Clear () public void Clear ()
{ {
Gtk.TextIter start = StartIter, end = EndIter; Gtk.TextIter start = StartIter, end = EndIter;
Delete (ref start, ref end); Delete (ref start, ref end);
} }
[Obsolete ("Replaced by 'ref TextIter, ref TextIter' overload")] [Obsolete ("Replaced by 'ref TextIter, ref TextIter' overload")]
public void Delete (TextIter start, TextIter end ) public void Delete (TextIter start, TextIter end )
{ {
Delete (ref start, ref end); Delete (ref start, ref end);
} }
// overload to paste clipboard contents at cursor editable by default. // overload to paste clipboard contents at cursor editable by default.
public void PasteClipboard (Gtk.Clipboard clipboard) public void PasteClipboard (Gtk.Clipboard clipboard)
{ {
gtk_text_buffer_paste_clipboard(Handle, clipboard.Handle, IntPtr.Zero, true); gtk_text_buffer_paste_clipboard(Handle, clipboard.Handle, IntPtr.Zero, true);
} }
[DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void gtk_text_buffer_insert (IntPtr raw, ref Gtk.TextIter iter, IntPtr text, int len); static extern void gtk_text_buffer_insert (IntPtr raw, ref Gtk.TextIter iter, IntPtr text, int len);
[Obsolete ("Replaced by 'ref TextIter iter' overload")] [Obsolete ("Replaced by 'ref TextIter iter' overload")]
public void Insert (TextIter iter, string text) public void Insert (TextIter iter, string text)
{ {
Insert (ref iter, text); Insert (ref iter, text);
} }
public void Insert (ref Gtk.TextIter iter, string text) public void Insert (ref Gtk.TextIter iter, string text)
{ {
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (text); IntPtr native = GLib.Marshaller.StringToPtrGStrdup (text);
gtk_text_buffer_insert (Handle, ref iter, native, -1); gtk_text_buffer_insert (Handle, ref iter, native, -1);
GLib.Marshaller.Free (native); GLib.Marshaller.Free (native);
} }
[Obsolete ("Replaced by 'ref TextIter iter' overload")] [Obsolete ("Replaced by 'ref TextIter iter' overload")]
public void InsertRange (TextIter iter, TextIter start, TextIter end ) public void InsertRange (TextIter iter, TextIter start, TextIter end )
{ {
InsertRange (ref iter, start, end); InsertRange (ref iter, start, end);
} }
[Obsolete ("Replaced by 'ref TextIter iter' overload")] [Obsolete ("Replaced by 'ref TextIter iter' overload")]
public void InsertWithTags (TextIter iter, string text, params TextTag[] tags) public void InsertWithTags (TextIter iter, string text, params TextTag[] tags)
{ {
InsertWithTags (ref iter, text, tags); InsertWithTags (ref iter, text, tags);
} }
public void InsertWithTags (ref TextIter iter, string text, params TextTag[] tags) public void InsertWithTags (ref TextIter iter, string text, params TextTag[] tags)
{ {
TextIter start; TextIter start;
int offset = iter.Offset; int offset = iter.Offset;
Insert (ref iter, text); Insert (ref iter, text);
@ -85,10 +85,10 @@ public void InsertWithTags (ref TextIter iter, string text, params TextTag[] tag
foreach (TextTag t in tags) foreach (TextTag t in tags)
this.ApplyTag (t, start, iter); this.ApplyTag (t, start, iter);
} }
public void InsertWithTagsByName (ref TextIter iter, string text, params string[] tagnames) public void InsertWithTagsByName (ref TextIter iter, string text, params string[] tagnames)
{ {
TextIter start; TextIter start;
int offset = iter.Offset; int offset = iter.Offset;
Insert (ref iter, text); Insert (ref iter, text);
@ -101,51 +101,51 @@ public void InsertWithTagsByName (ref TextIter iter, string text, params string[
if (tag != null) if (tag != null)
this.ApplyTag (tag, start, iter); this.ApplyTag (tag, start, iter);
} }
} }
[Obsolete("Use the TextBuffer.Text property's setter")] [Obsolete("Use the TextBuffer.Text property's setter")]
public void SetText (string text) public void SetText (string text)
{ {
Text = text; Text = text;
} }
[DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern bool gtk_text_buffer_insert_interactive(IntPtr raw, ref Gtk.TextIter iter, IntPtr text, int len, bool default_editable); static extern bool gtk_text_buffer_insert_interactive(IntPtr raw, ref Gtk.TextIter iter, IntPtr text, int len, bool default_editable);
public bool InsertInteractive(ref Gtk.TextIter iter, string text, bool default_editable) public bool InsertInteractive(ref Gtk.TextIter iter, string text, bool default_editable)
{ {
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (text); IntPtr native = GLib.Marshaller.StringToPtrGStrdup (text);
bool result = gtk_text_buffer_insert_interactive(Handle, ref iter, native, -1, default_editable); bool result = gtk_text_buffer_insert_interactive(Handle, ref iter, native, -1, default_editable);
GLib.Marshaller.Free (native); GLib.Marshaller.Free (native);
return result; return result;
} }
[DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern bool gtk_text_buffer_insert_interactive_at_cursor(IntPtr raw, IntPtr text, int len, bool default_editable); static extern bool gtk_text_buffer_insert_interactive_at_cursor(IntPtr raw, IntPtr text, int len, bool default_editable);
public bool InsertInteractiveAtCursor(string text, bool default_editable) public bool InsertInteractiveAtCursor(string text, bool default_editable)
{ {
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (text); IntPtr native = GLib.Marshaller.StringToPtrGStrdup (text);
bool result = gtk_text_buffer_insert_interactive_at_cursor(Handle, native, -1, default_editable); bool result = gtk_text_buffer_insert_interactive_at_cursor(Handle, native, -1, default_editable);
GLib.Marshaller.Free (native); GLib.Marshaller.Free (native);
return result; return result;
} }
[DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void gtk_text_buffer_insert_at_cursor(IntPtr raw, IntPtr text, int len); static extern void gtk_text_buffer_insert_at_cursor(IntPtr raw, IntPtr text, int len);
public void InsertAtCursor(string text) public void InsertAtCursor(string text)
{ {
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (text); IntPtr native = GLib.Marshaller.StringToPtrGStrdup (text);
gtk_text_buffer_insert_at_cursor(Handle, native, -1); gtk_text_buffer_insert_at_cursor(Handle, native, -1);
GLib.Marshaller.Free (native); GLib.Marshaller.Free (native);
} }
[DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gtk_text_buffer_serialize (IntPtr raw, IntPtr content_buffer, IntPtr format, ref Gtk.TextIter start, ref Gtk.TextIter end, out UIntPtr length); static extern IntPtr gtk_text_buffer_serialize (IntPtr raw, IntPtr content_buffer, IntPtr format, ref Gtk.TextIter start, ref Gtk.TextIter end, out UIntPtr length);
public byte[] Serialize(Gtk.TextBuffer content_buffer, Gdk.Atom format, Gtk.TextIter start, Gtk.TextIter end) public byte[] Serialize(Gtk.TextBuffer content_buffer, Gdk.Atom format, Gtk.TextIter start, Gtk.TextIter end)
{ {
UIntPtr length; UIntPtr length;
IntPtr raw_ret = gtk_text_buffer_serialize (Handle, content_buffer == null ? IntPtr.Zero : content_buffer.Handle, format == null ? IntPtr.Zero : format.Handle, ref start, ref end, out length); IntPtr raw_ret = gtk_text_buffer_serialize (Handle, content_buffer == null ? IntPtr.Zero : content_buffer.Handle, format == null ? IntPtr.Zero : format.Handle, ref start, ref end, out length);
if (raw_ret == IntPtr.Zero) if (raw_ret == IntPtr.Zero)
@ -154,15 +154,15 @@ public byte[] Serialize(Gtk.TextBuffer content_buffer, Gdk.Atom format, Gtk.Text
byte[] ret = new byte [sz]; byte[] ret = new byte [sz];
Marshal.Copy (raw_ret, ret, 0, sz); Marshal.Copy (raw_ret, ret, 0, sz);
return ret; return ret;
} }
[DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gtk_text_buffer_get_serialize_formats(IntPtr raw, out int n_formats); static extern IntPtr gtk_text_buffer_get_serialize_formats(IntPtr raw, out int n_formats);
[DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gtk_text_buffer_get_deserialize_formats(IntPtr raw, out int n_formats); static extern IntPtr gtk_text_buffer_get_deserialize_formats(IntPtr raw, out int n_formats);
public Gdk.Atom[] DeserializeFormats { public Gdk.Atom[] DeserializeFormats {
get { get {
int n_formats; int n_formats;
IntPtr raw_ret = gtk_text_buffer_get_deserialize_formats(Handle, out n_formats); IntPtr raw_ret = gtk_text_buffer_get_deserialize_formats(Handle, out n_formats);
@ -173,9 +173,9 @@ public Gdk.Atom[] DeserializeFormats {
} }
return result; return result;
} }
} }
public Gdk.Atom[] SerializeFormats { public Gdk.Atom[] SerializeFormats {
get { get {
int n_formats; int n_formats;
IntPtr raw_ret = gtk_text_buffer_get_serialize_formats(Handle, out n_formats); IntPtr raw_ret = gtk_text_buffer_get_serialize_formats(Handle, out n_formats);
@ -186,6 +186,6 @@ public Gdk.Atom[] SerializeFormats {
} }
return result; return result;
} }
} }
} }
} }

View file

@ -54,6 +54,7 @@ namespace Gtk {
Widget[] result = new Widget [list.Count]; Widget[] result = new Widget [list.Count];
for (int i = 0; i < list.Count; i++) for (int i = 0; i < list.Count; i++)
result [i] = list [i] as Widget; result [i] = list [i] as Widget;
return result; return result;
} }
@ -67,6 +68,7 @@ namespace Gtk {
ActionGroup[] result = new ActionGroup [list.Count]; ActionGroup[] result = new ActionGroup [list.Count];
for (int i = 0; i < list.Count; i++) for (int i = 0; i < list.Count; i++)
result [i] = list [i] as ActionGroup; result [i] = list [i] as ActionGroup;
return result; return result;
} }
} }

View file

@ -19,7 +19,7 @@ namespace Gtk {
public partial class VBox { public partial class VBox {
public VBox () : this (false, 0) {} public VBox () : this (false, 0) {}
} }
} }

View file

@ -28,51 +28,51 @@ namespace Gtk {
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
public partial class Widget { public partial class Widget {
[Obsolete ("Replaced by Window property.")]
public Gdk.Window GdkWindow { [Obsolete ("Replaced by Window property.")]
public Gdk.Window GdkWindow {
get { return Window; } get { return Window; }
set { Window = value; } set { Window = value; }
} }
public void AddAccelerator (string accel_signal, AccelGroup accel_group, AccelKey accel_key) public void AddAccelerator (string accel_signal, AccelGroup accel_group, AccelKey accel_key)
{ {
this.AddAccelerator (accel_signal, accel_group, (uint) accel_key.Key, accel_key.AccelMods, accel_key.AccelFlags); this.AddAccelerator (accel_signal, accel_group, (uint) accel_key.Key, accel_key.AccelMods, accel_key.AccelFlags);
}
} public int FocusLineWidth {
public int FocusLineWidth {
get { get {
return (int) StyleGetProperty ("focus-line-width"); return (int) StyleGetProperty ("focus-line-width");
} }
} }
struct GClosure { struct GClosure {
long fields; long fields;
IntPtr marshaler; IntPtr marshaler;
IntPtr data; IntPtr data;
IntPtr notifiers; IntPtr notifiers;
} }
[UnmanagedFunctionPointer (CallingConvention.Cdecl)] [UnmanagedFunctionPointer (CallingConvention.Cdecl)]
delegate void ClosureMarshal (IntPtr closure, IntPtr return_val, uint n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data); delegate void ClosureMarshal (IntPtr closure, IntPtr return_val, uint n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data);
[DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr g_closure_new_simple (int closure_size, IntPtr dummy); static extern IntPtr g_closure_new_simple (int closure_size, IntPtr dummy);
[DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void g_closure_set_marshal (IntPtr closure, ClosureMarshal marshaler); static extern void g_closure_set_marshal (IntPtr closure, ClosureMarshal marshaler);
static IntPtr CreateClosure (ClosureMarshal marshaler) { static IntPtr CreateClosure (ClosureMarshal marshaler) {
IntPtr raw_closure = g_closure_new_simple (Marshal.SizeOf (typeof (GClosure)), IntPtr.Zero); IntPtr raw_closure = g_closure_new_simple (Marshal.SizeOf (typeof (GClosure)), IntPtr.Zero);
g_closure_set_marshal (raw_closure, marshaler); g_closure_set_marshal (raw_closure, marshaler);
return raw_closure; return raw_closure;
} }
[DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern uint g_signal_newv (IntPtr signal_name, IntPtr gtype, GLib.Signal.Flags signal_flags, IntPtr closure, IntPtr accumulator, IntPtr accu_data, IntPtr c_marshaller, IntPtr return_type, uint n_params, [MarshalAs (UnmanagedType.LPArray)] IntPtr[] param_types); static extern uint g_signal_newv (IntPtr signal_name, IntPtr gtype, GLib.Signal.Flags signal_flags, IntPtr closure, IntPtr accumulator, IntPtr accu_data, IntPtr c_marshaller, IntPtr return_type, uint n_params, [MarshalAs (UnmanagedType.LPArray)] IntPtr[] param_types);
static uint RegisterSignal (string signal_name, GLib.GType gtype, GLib.Signal.Flags signal_flags, GLib.GType return_type, GLib.GType[] param_types, ClosureMarshal marshaler) static uint RegisterSignal (string signal_name, GLib.GType gtype, GLib.Signal.Flags signal_flags, GLib.GType return_type, GLib.GType[] param_types, ClosureMarshal marshaler)
{ {
IntPtr[] native_param_types = new IntPtr [param_types.Length]; IntPtr[] native_param_types = new IntPtr [param_types.Length];
for (int parm_idx = 0; parm_idx < param_types.Length; parm_idx++) for (int parm_idx = 0; parm_idx < param_types.Length; parm_idx++)
native_param_types [parm_idx] = param_types [parm_idx].Val; native_param_types [parm_idx] = param_types [parm_idx].Val;
@ -83,10 +83,10 @@ static uint RegisterSignal (string signal_name, GLib.GType gtype, GLib.Signal.Fl
} finally { } finally {
GLib.Marshaller.Free (native_signal_name); GLib.Marshaller.Free (native_signal_name);
} }
} }
static void ActivateMarshal_cb (IntPtr raw_closure, IntPtr return_val, uint n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data) static void ActivateMarshal_cb (IntPtr raw_closure, IntPtr return_val, uint n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data)
{ {
try { try {
GLib.Value inst_val = (GLib.Value) Marshal.PtrToStructure (param_values, typeof (GLib.Value)); GLib.Value inst_val = (GLib.Value) Marshal.PtrToStructure (param_values, typeof (GLib.Value));
Widget inst; Widget inst;
@ -99,26 +99,26 @@ static void ActivateMarshal_cb (IntPtr raw_closure, IntPtr return_val, uint n_pa
} catch (Exception e) { } catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false); GLib.ExceptionManager.RaiseUnhandledException (e, false);
} }
} }
static ClosureMarshal ActivateMarshalCallback; static ClosureMarshal ActivateMarshalCallback;
static void ConnectActivate (GLib.GType gtype) static void ConnectActivate (GLib.GType gtype)
{ {
if (ActivateMarshalCallback == null) if (ActivateMarshalCallback == null)
ActivateMarshalCallback = new ClosureMarshal (ActivateMarshal_cb); ActivateMarshalCallback = new ClosureMarshal (ActivateMarshal_cb);
GtkWidgetClass klass = GetClassStruct (gtype, false); GtkWidgetClass klass = GetClassStruct (gtype, false);
klass.ActivateSignal = RegisterSignal ("activate_signal", gtype, GLib.Signal.Flags.RunLast, GLib.GType.None, new GLib.GType [0], ActivateMarshalCallback); klass.ActivateSignal = RegisterSignal ("activate_signal", gtype, GLib.Signal.Flags.RunLast, GLib.GType.None, new GLib.GType [0], ActivateMarshalCallback);
OverrideClassStruct (gtype, klass); OverrideClassStruct (gtype, klass);
} }
[GLib.DefaultSignalHandler (Type=typeof (Gtk.Widget), ConnectionMethod="ConnectActivate")] [GLib.DefaultSignalHandler (Type=typeof (Gtk.Widget), ConnectionMethod="ConnectActivate")]
protected virtual void OnActivate () protected virtual void OnActivate ()
{ {
} }
private class BindingInvoker { private class BindingInvoker {
System.Reflection.MethodInfo mi; System.Reflection.MethodInfo mi;
object[] parms; object[] parms;
@ -132,15 +132,15 @@ private class BindingInvoker {
{ {
mi.Invoke (w, parms); mi.Invoke (w, parms);
} }
} }
/* As gtk_binding_entry_add_signall only allows passing long, double and string parameters to the specified signal, we cannot pass a pointer to the BindingInvoker directly /* As gtk_binding_entry_add_signall only allows passing long, double and string parameters to the specified signal, we cannot pass a pointer to the BindingInvoker directly
* to the signal. Instead, the signal takes the index of the BindingInvoker in binding_invokers. * to the signal. Instead, the signal takes the index of the BindingInvoker in binding_invokers.
*/ */
static ArrayList binding_invokers; static ArrayList binding_invokers;
static void BindingMarshal_cb (IntPtr raw_closure, IntPtr return_val, uint n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data) static void BindingMarshal_cb (IntPtr raw_closure, IntPtr return_val, uint n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data)
{ {
try { try {
GLib.Value[] inst_and_params = new GLib.Value [n_param_vals]; GLib.Value[] inst_and_params = new GLib.Value [n_param_vals];
int gvalue_size = Marshal.SizeOf (typeof (GLib.Value)); int gvalue_size = Marshal.SizeOf (typeof (GLib.Value));
@ -153,42 +153,42 @@ static void BindingMarshal_cb (IntPtr raw_closure, IntPtr return_val, uint n_par
} catch (Exception e) { } catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false); GLib.ExceptionManager.RaiseUnhandledException (e, false);
} }
} }
static ClosureMarshal binding_delegate; static ClosureMarshal binding_delegate;
static ClosureMarshal BindingDelegate { static ClosureMarshal BindingDelegate {
get { get {
if (binding_delegate == null) if (binding_delegate == null)
binding_delegate = new ClosureMarshal (BindingMarshal_cb); binding_delegate = new ClosureMarshal (BindingMarshal_cb);
return binding_delegate; return binding_delegate;
} }
} }
[DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gtk_binding_set_by_class (IntPtr class_ptr); static extern IntPtr gtk_binding_set_by_class (IntPtr class_ptr);
[DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void gtk_binding_entry_add_signall (IntPtr binding_set, uint keyval, Gdk.ModifierType modifiers, IntPtr signal_name, IntPtr binding_args); static extern void gtk_binding_entry_add_signall (IntPtr binding_set, uint keyval, Gdk.ModifierType modifiers, IntPtr signal_name, IntPtr binding_args);
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
struct GtkBindingArg { struct GtkBindingArg {
public IntPtr arg_type; public IntPtr arg_type;
public GtkBindingArgData data; public GtkBindingArgData data;
} }
[StructLayout(LayoutKind.Explicit)] [StructLayout(LayoutKind.Explicit)]
struct GtkBindingArgData { struct GtkBindingArgData {
#if WIN64LONGS #if WIN64LONGS
[FieldOffset (0)] public int long_data; [FieldOffset (0)] public int long_data;
#else #else
[FieldOffset (0)] public IntPtr long_data; [FieldOffset (0)] public IntPtr long_data;
#endif #endif
[FieldOffset (0)] public double double_data; [FieldOffset (0)] public double double_data;
[FieldOffset (0)] public IntPtr string_data; [FieldOffset (0)] public IntPtr string_data;
} }
static void ClassInit (GLib.GType gtype, Type t) static void ClassInit (GLib.GType gtype, Type t)
{ {
object[] attrs = t.GetCustomAttributes (typeof (BindingAttribute), true); object[] attrs = t.GetCustomAttributes (typeof (BindingAttribute), true);
if (attrs.Length == 0) return; if (attrs.Length == 0) return;
@ -218,10 +218,10 @@ static void ClassInit (GLib.GType gtype, Type t)
binding_args.Dispose (); binding_args.Dispose ();
} }
GLib.Marshaller.Free (native_signame); GLib.Marshaller.Free (native_signame);
} }
public object StyleGetProperty (string property_name) public object StyleGetProperty (string property_name)
{ {
GLib.Value value; GLib.Value value;
try { try {
value = StyleGetPropertyValue (property_name); value = StyleGetPropertyValue (property_name);
@ -231,16 +231,16 @@ public object StyleGetProperty (string property_name)
object ret = value.Val; object ret = value.Val;
value.Dispose (); value.Dispose ();
return ret; return ret;
} }
[DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gtk_widget_class_find_style_property (IntPtr class_ptr, IntPtr property_name); static extern IntPtr gtk_widget_class_find_style_property (IntPtr class_ptr, IntPtr property_name);
[DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gtk_widget_style_get_property (IntPtr inst, IntPtr property_name, ref GLib.Value value); static extern IntPtr gtk_widget_style_get_property (IntPtr inst, IntPtr property_name, ref GLib.Value value);
internal GLib.Value StyleGetPropertyValue (string property_name) internal GLib.Value StyleGetPropertyValue (string property_name)
{ {
IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (property_name); IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (property_name);
try { try {
IntPtr pspec_ptr = gtk_widget_class_find_style_property (this.LookupGType ().GetClassPtr (), native_name); IntPtr pspec_ptr = gtk_widget_class_find_style_property (this.LookupGType ().GetClassPtr (), native_name);
@ -253,13 +253,13 @@ internal GLib.Value StyleGetPropertyValue (string property_name)
} finally { } finally {
GLib.Marshaller.Free (native_name); GLib.Marshaller.Free (native_name);
} }
} }
[DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gtk_widget_list_mnemonic_labels (IntPtr raw); static extern IntPtr gtk_widget_list_mnemonic_labels (IntPtr raw);
public Widget[] ListMnemonicLabels () public Widget[] ListMnemonicLabels ()
{ {
IntPtr raw_ret = gtk_widget_list_mnemonic_labels (Handle); IntPtr raw_ret = gtk_widget_list_mnemonic_labels (Handle);
if (raw_ret == IntPtr.Zero) if (raw_ret == IntPtr.Zero)
return new Widget [0]; return new Widget [0];
@ -268,33 +268,33 @@ public Widget[] ListMnemonicLabels ()
for (int i = 0; i < list.Count; i++) for (int i = 0; i < list.Count; i++)
result [i] = list [i] as Widget; result [i] = list [i] as Widget;
return result; return result;
} }
public void ModifyBase (Gtk.StateType state) public void ModifyBase (Gtk.StateType state)
{ {
gtk_widget_modify_base (Handle, (int) state, IntPtr.Zero); gtk_widget_modify_base (Handle, (int) state, IntPtr.Zero);
} }
public void ModifyBg (Gtk.StateType state) public void ModifyBg (Gtk.StateType state)
{ {
gtk_widget_modify_bg (Handle, (int) state, IntPtr.Zero); gtk_widget_modify_bg (Handle, (int) state, IntPtr.Zero);
} }
public void ModifyFg (Gtk.StateType state) public void ModifyFg (Gtk.StateType state)
{ {
gtk_widget_modify_fg (Handle, (int) state, IntPtr.Zero); gtk_widget_modify_fg (Handle, (int) state, IntPtr.Zero);
} }
public void ModifyText (Gtk.StateType state) public void ModifyText (Gtk.StateType state)
{ {
gtk_widget_modify_text (Handle, (int) state, IntPtr.Zero); gtk_widget_modify_text (Handle, (int) state, IntPtr.Zero);
} }
public void Path (out string path, out string path_reversed) public void Path (out string path, out string path_reversed)
{ {
uint len; uint len;
Path (out len, out path, out path_reversed); Path (out len, out path, out path_reversed);
} }
// Code from custom code for Gtk.Object in 2.x // Code from custom code for Gtk.Object in 2.x