1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401
|
// This file was generated by the Gtk# code generator.
// Any changes made will be lost if regenerated.
namespace Gtk {
using System;
using System.Runtime.InteropServices;
#region Autogenerated code
public partial class EditableAdapter : GLib.GInterfaceAdapter, Gtk.IEditable {
[StructLayout (LayoutKind.Sequential)]
struct GtkEditableInterface {
IntPtr TextInserted;
IntPtr TextDeleted;
IntPtr Changed;
public InsertTextNativeDelegate InsertText;
public DeleteTextNativeDelegate DeleteText;
public GetCharsNativeDelegate GetChars;
public SelectRegionNativeDelegate SelectRegion;
public GetSelectionBoundsNativeDelegate GetSelectionBounds;
public SetPositionNativeDelegate SetPosition;
public GetPositionNativeDelegate GetPosition;
}
static GtkEditableInterface iface;
static EditableAdapter ()
{
GLib.GType.Register (_gtype, typeof (EditableAdapter));
iface.InsertText = new InsertTextNativeDelegate (InsertText_cb);
iface.DeleteText = new DeleteTextNativeDelegate (DeleteText_cb);
iface.GetChars = new GetCharsNativeDelegate (GetChars_cb);
iface.SelectRegion = new SelectRegionNativeDelegate (SelectRegion_cb);
iface.GetSelectionBounds = new GetSelectionBoundsNativeDelegate (GetSelectionBounds_cb);
iface.SetPosition = new SetPositionNativeDelegate (SetPosition_cb);
iface.GetPosition = new GetPositionNativeDelegate (GetPosition_cb);
}
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
delegate void InsertTextNativeDelegate (IntPtr inst, IntPtr new_text, int new_text_length, ref int position);
static void InsertText_cb (IntPtr inst, IntPtr new_text, int new_text_length, ref int position)
{
try {
IEditableImplementor __obj = GLib.Object.GetObject (inst, false) as IEditableImplementor;
__obj.InsertText (GLib.Marshaller.Utf8PtrToString (new_text), ref position);
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
delegate void DeleteTextNativeDelegate (IntPtr inst, int start_pos, int end_pos);
static void DeleteText_cb (IntPtr inst, int start_pos, int end_pos)
{
try {
IEditableImplementor __obj = GLib.Object.GetObject (inst, false) as IEditableImplementor;
__obj.DeleteText (start_pos, end_pos);
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
delegate IntPtr GetCharsNativeDelegate (IntPtr inst, int start_pos, int end_pos);
static IntPtr GetChars_cb (IntPtr inst, int start_pos, int end_pos)
{
try {
IEditableImplementor __obj = GLib.Object.GetObject (inst, false) as IEditableImplementor;
string __result;
__result = __obj.GetChars (start_pos, end_pos);
return GLib.Marshaller.StringToPtrGStrdup(__result);
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, true);
// NOTREACHED: above call does not return.
throw e;
}
}
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
delegate void SelectRegionNativeDelegate (IntPtr inst, int start_pos, int end_pos);
static void SelectRegion_cb (IntPtr inst, int start_pos, int end_pos)
{
try {
IEditableImplementor __obj = GLib.Object.GetObject (inst, false) as IEditableImplementor;
__obj.SelectRegion (start_pos, end_pos);
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
delegate bool GetSelectionBoundsNativeDelegate (IntPtr inst, out int start_pos, out int end_pos);
static bool GetSelectionBounds_cb (IntPtr inst, out int start_pos, out int end_pos)
{
try {
IEditableImplementor __obj = GLib.Object.GetObject (inst, false) as IEditableImplementor;
bool __result;
__result = __obj.GetSelectionBounds (out start_pos, out end_pos);
return __result;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, true);
// NOTREACHED: above call does not return.
throw e;
}
}
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
delegate void SetPositionNativeDelegate (IntPtr inst, int position);
static void SetPosition_cb (IntPtr inst, int position)
{
try {
IEditableImplementor __obj = GLib.Object.GetObject (inst, false) as IEditableImplementor;
__obj.Position = position;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
delegate int GetPositionNativeDelegate (IntPtr inst);
static int GetPosition_cb (IntPtr inst)
{
try {
IEditableImplementor __obj = GLib.Object.GetObject (inst, false) as IEditableImplementor;
int __result;
__result = __obj.Position;
return __result;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, true);
// NOTREACHED: above call does not return.
throw e;
}
}
static int class_offset = 2 * IntPtr.Size;
static void Initialize (IntPtr ptr, IntPtr data)
{
IntPtr ifaceptr = new IntPtr (ptr.ToInt64 () + class_offset);
GtkEditableInterface native_iface = (GtkEditableInterface) Marshal.PtrToStructure (ifaceptr, typeof (GtkEditableInterface));
native_iface.InsertText = iface.InsertText;
native_iface.DeleteText = iface.DeleteText;
native_iface.GetChars = iface.GetChars;
native_iface.SelectRegion = iface.SelectRegion;
native_iface.GetSelectionBounds = iface.GetSelectionBounds;
native_iface.SetPosition = iface.SetPosition;
native_iface.GetPosition = iface.GetPosition;
Marshal.StructureToPtr (native_iface, ifaceptr, false);
}
GLib.Object implementor;
public EditableAdapter ()
{
InitHandler = new GLib.GInterfaceInitHandler (Initialize);
}
public EditableAdapter (IEditableImplementor implementor)
{
if (implementor == null)
throw new ArgumentNullException ("implementor");
else if (!(implementor is GLib.Object))
throw new ArgumentException ("implementor must be a subclass of GLib.Object");
this.implementor = implementor as GLib.Object;
}
public EditableAdapter (IntPtr handle)
{
if (!_gtype.IsInstance (handle))
throw new ArgumentException ("The gobject doesn't implement the GInterface of this adapter", "handle");
implementor = GLib.Object.GetObject (handle);
}
[DllImport("gtk-3-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gtk_editable_get_type();
private static GLib.GType _gtype = new GLib.GType (gtk_editable_get_type ());
public static GLib.GType GType {
get {
return _gtype;
}
}
public override GLib.GType GInterfaceGType {
get {
return _gtype;
}
}
public override IntPtr Handle {
get {
return implementor.Handle;
}
}
public IntPtr OwnedHandle {
get {
return implementor.OwnedHandle;
}
}
public static IEditable GetObject (IntPtr handle, bool owned)
{
GLib.Object obj = GLib.Object.GetObject (handle, owned);
return GetObject (obj);
}
public static IEditable GetObject (GLib.Object obj)
{
if (obj == null)
return null;
else if (obj is IEditableImplementor)
return new EditableAdapter (obj as IEditableImplementor);
else if (obj as IEditable == null)
return new EditableAdapter (obj.Handle);
else
return obj as IEditable;
}
public IEditableImplementor Implementor {
get {
return implementor as IEditableImplementor;
}
}
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
delegate void TextInsertedSignalDelegate (IntPtr inst, IntPtr arg0, int arg1, ref int arg2, IntPtr gch);
static void TextInsertedSignalCallback (IntPtr inst, IntPtr arg0, int arg1, ref int arg2, IntPtr gch)
{
Gtk.TextInsertedArgs args = new Gtk.TextInsertedArgs ();
try {
GLib.Signal sig = ((GCHandle) gch).Target as GLib.Signal;
if (sig == null)
throw new Exception("Unknown signal GC handle received " + gch);
args.Args = new object[3];
args.Args[0] = GLib.Marshaller.Utf8PtrToString (arg0);
args.Args[1] = arg1;
args.Args[2] = arg2;
Gtk.TextInsertedHandler handler = (Gtk.TextInsertedHandler) sig.Handler;
handler (GLib.Object.GetObject (inst), args);
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
try {
arg2 = ((int)args.Args[2]);
} catch (Exception) {
Exception ex = new Exception ("args.RetVal or 'out' property unset or set to incorrect type in Gtk.TextInsertedHandler callback");
GLib.ExceptionManager.RaiseUnhandledException (ex, true);
// NOTREACHED: above call doesn't return.
throw ex;
}
}
[GLib.Signal("insert-text")]
public event Gtk.TextInsertedHandler TextInserted {
add {
GLib.Object.GetObject (Handle).AddSignalHandler ("insert-text", value, new TextInsertedSignalDelegate(TextInsertedSignalCallback));
}
remove {
GLib.Object.GetObject (Handle).RemoveSignalHandler ("insert-text", value);
}
}
[GLib.Signal("delete-text")]
public event Gtk.TextDeletedHandler TextDeleted {
add {
GLib.Object.GetObject (Handle).AddSignalHandler ("delete-text", value, typeof (Gtk.TextDeletedArgs));
}
remove {
GLib.Object.GetObject (Handle).RemoveSignalHandler ("delete-text", value);
}
}
[GLib.Signal("changed")]
public event System.EventHandler Changed {
add {
GLib.Object.GetObject (Handle).AddSignalHandler ("changed", value);
}
remove {
GLib.Object.GetObject (Handle).RemoveSignalHandler ("changed", value);
}
}
[DllImport("gtk-3-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void gtk_editable_copy_clipboard(IntPtr raw);
public void CopyClipboard() {
gtk_editable_copy_clipboard(Handle);
}
[DllImport("gtk-3-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void gtk_editable_cut_clipboard(IntPtr raw);
public void CutClipboard() {
gtk_editable_cut_clipboard(Handle);
}
[DllImport("gtk-3-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void gtk_editable_delete_selection(IntPtr raw);
public void DeleteSelection() {
gtk_editable_delete_selection(Handle);
}
[DllImport("gtk-3-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void gtk_editable_delete_text(IntPtr raw, int start_pos, int end_pos);
public void DeleteText(int start_pos, int end_pos) {
gtk_editable_delete_text(Handle, start_pos, end_pos);
}
[DllImport("gtk-3-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gtk_editable_get_chars(IntPtr raw, int start_pos, int end_pos);
public string GetChars(int start_pos, int end_pos) {
IntPtr raw_ret = gtk_editable_get_chars(Handle, start_pos, end_pos);
string ret = GLib.Marshaller.PtrToStringGFree(raw_ret);
return ret;
}
[DllImport("gtk-3-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern bool gtk_editable_get_editable(IntPtr raw);
[DllImport("gtk-3-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void gtk_editable_set_editable(IntPtr raw, bool is_editable);
public bool IsEditable {
get {
bool raw_ret = gtk_editable_get_editable(Handle);
bool ret = raw_ret;
return ret;
}
set {
gtk_editable_set_editable(Handle, value);
}
}
[DllImport("gtk-3-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern int gtk_editable_get_position(IntPtr raw);
[DllImport("gtk-3-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void gtk_editable_set_position(IntPtr raw, int position);
public int Position {
get {
int raw_ret = gtk_editable_get_position(Handle);
int ret = raw_ret;
return ret;
}
set {
gtk_editable_set_position(Handle, value);
}
}
[DllImport("gtk-3-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern bool gtk_editable_get_selection_bounds(IntPtr raw, out int start_pos, out int end_pos);
public bool GetSelectionBounds(out int start_pos, out int end_pos) {
bool raw_ret = gtk_editable_get_selection_bounds(Handle, out start_pos, out end_pos);
bool ret = raw_ret;
return ret;
}
[DllImport("gtk-3-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void gtk_editable_insert_text(IntPtr raw, IntPtr new_text, int new_text_length, ref int position);
public void InsertText(string new_text, ref int position) {
IntPtr native_new_text = GLib.Marshaller.StringToPtrGStrdup (new_text);
gtk_editable_insert_text(Handle, native_new_text, System.Text.Encoding.UTF8.GetByteCount (new_text), ref position);
GLib.Marshaller.Free (native_new_text);
}
[DllImport("gtk-3-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void gtk_editable_paste_clipboard(IntPtr raw);
public void PasteClipboard() {
gtk_editable_paste_clipboard(Handle);
}
[DllImport("gtk-3-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void gtk_editable_select_region(IntPtr raw, int start_pos, int end_pos);
public void SelectRegion(int start_pos, int end_pos) {
gtk_editable_select_region(Handle, start_pos, end_pos);
}
#endregion
}
}
|