Native.cs 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Runtime.InteropServices;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using Avalonia.Controls;
  8. using gint8 = System.Byte;
  9. using gint16 = System.Int16;
  10. using gint32 = System.Int32;
  11. using gint = System.Int32;
  12. using guint16 = System.UInt16;
  13. using guint32 = System.UInt32;
  14. using guint = System.UInt32;
  15. using gdouble = System.Double;
  16. namespace Avalonia.Gtk3.Interop
  17. {
  18. static class Native
  19. {
  20. public static class D
  21. {
  22. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)]
  23. public delegate IntPtr gtk_application_new(Utf8Buffer appId, int flags);
  24. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)]
  25. public delegate void gtk_main_iteration();
  26. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)]
  27. public delegate GtkWindow gtk_window_new(GtkWindowType windowType);
  28. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)]
  29. public delegate IntPtr gtk_init(int argc, IntPtr argv);
  30. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)]
  31. public delegate void gtk_window_present(GtkWindow gtkWindow);
  32. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)]
  33. public delegate void gtk_widget_hide(GtkWidget gtkWidget);
  34. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)]
  35. public delegate void gtk_widget_show(GtkWidget gtkWidget);
  36. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)]
  37. public delegate void gtk_window_set_icon(GtkWindow window, Pixbuf pixbuf);
  38. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)]
  39. public delegate void gtk_window_set_modal(GtkWindow window, bool modal);
  40. [UnmanagedFunctionPointer(CallingConvention.Cdecl)] //No manual import
  41. public delegate IntPtr gdk_get_native_handle(IntPtr gdkWindow);
  42. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)]
  43. public delegate IntPtr gtk_widget_get_window(GtkWidget gtkWidget);
  44. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk, optional: true)]
  45. public delegate uint gtk_widget_get_scale_factor(GtkWidget gtkWidget);
  46. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)]
  47. public delegate IntPtr gtk_widget_get_screen(GtkWidget gtkWidget);
  48. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)]
  49. public delegate IntPtr gtk_widget_set_double_buffered(GtkWidget gtkWidget, bool value);
  50. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)]
  51. public delegate IntPtr gtk_widget_set_events(GtkWidget gtkWidget, uint flags);
  52. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gdk)]
  53. public delegate int gdk_screen_get_height(IntPtr screen);
  54. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gdk)]
  55. public delegate int gdk_screen_get_width(IntPtr screen);
  56. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gdk)]
  57. public delegate IntPtr gdk_display_get_default();
  58. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gdk)]
  59. public delegate int gdk_window_get_origin(IntPtr gdkWindow, out int x, out int y);
  60. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gdk)]
  61. public delegate void gdk_window_resize(IntPtr gtkWindow, int width, int height);
  62. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)]
  63. public delegate void gtk_widget_realize(GtkWidget gtkWidget);
  64. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)]
  65. public delegate void gtk_window_set_title(GtkWindow gtkWindow, Utf8Buffer title);
  66. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)]
  67. public delegate void gtk_window_set_decorated(GtkWindow gtkWindow, bool decorated);
  68. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)]
  69. public delegate void gtk_window_set_skip_taskbar_hint(GtkWindow gtkWindow, bool setting);
  70. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)]
  71. public delegate bool gtk_window_get_skip_taskbar_hint(GtkWindow gtkWindow);
  72. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)]
  73. public delegate void gtk_window_set_skip_pager_hint(GtkWindow gtkWindow, bool setting);
  74. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)]
  75. public delegate bool gtk_window_get_skip_pager_hint(GtkWindow gtkWindow);
  76. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)]
  77. public delegate void gtk_window_get_size(GtkWindow gtkWindow, out int width, out int height);
  78. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)]
  79. public delegate void gtk_window_resize(GtkWindow gtkWindow, int width, int height);
  80. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)]
  81. public delegate void gtk_widget_set_size_request(GtkWidget widget, int width, int height);
  82. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)]
  83. public delegate void gtk_window_set_default_size(GtkWindow gtkWindow, int width, int height);
  84. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)]
  85. public delegate void gtk_window_get_position(GtkWindow gtkWindow, out int x, out int y);
  86. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)]
  87. public delegate void gtk_window_move(GtkWindow gtkWindow, int x, int y);
  88. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)]
  89. public delegate GtkFileChooser gtk_file_chooser_dialog_new(Utf8Buffer title, GtkWindow parent, GtkFileChooserAction action, IntPtr ignore);
  90. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)]
  91. public unsafe delegate GSList* gtk_file_chooser_get_filenames(GtkFileChooser chooser);
  92. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)]
  93. public delegate void gtk_file_chooser_set_select_multiple(GtkFileChooser chooser, bool allow);
  94. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)]
  95. public delegate void gtk_file_chooser_set_filename(GtkFileChooser chooser, Utf8Buffer file);
  96. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)]
  97. public delegate void gtk_dialog_add_button(GtkDialog raw, Utf8Buffer button_text, GtkResponseType response_id);
  98. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Cairo)]
  99. public delegate CairoSurface cairo_image_surface_create(int format, int width, int height);
  100. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Cairo)]
  101. public delegate IntPtr cairo_image_surface_get_data(CairoSurface surface);
  102. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Cairo)]
  103. public delegate int cairo_image_surface_get_stride(CairoSurface surface);
  104. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Cairo)]
  105. public delegate void cairo_surface_mark_dirty(CairoSurface surface);
  106. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Cairo)]
  107. public delegate void cairo_surface_flush(CairoSurface surface);
  108. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Cairo)]
  109. public delegate void cairo_surface_destroy(IntPtr surface);
  110. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Cairo)]
  111. public delegate void cairo_set_source_surface(IntPtr cr, CairoSurface surface, double x, double y);
  112. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Cairo)]
  113. public delegate void cairo_scale(IntPtr context, double sx, double sy);
  114. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Cairo)]
  115. public delegate void cairo_paint(IntPtr context);
  116. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)]
  117. public delegate void gtk_widget_queue_draw_area(GtkWidget widget, int x, int y, int width, int height);
  118. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)]
  119. public delegate GtkImContext gtk_im_multicontext_new();
  120. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)]
  121. public delegate IntPtr gtk_im_context_set_client_window(GtkImContext context, IntPtr window);
  122. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)]
  123. public delegate bool gtk_im_context_filter_keypress(GtkImContext context, IntPtr ev);
  124. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)]
  125. public delegate void gtk_widget_activate(GtkWidget widget);
  126. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gdk)]
  127. public delegate IntPtr gdk_screen_get_root_window(IntPtr screen);
  128. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gdk)]
  129. public delegate IntPtr gdk_cursor_new(GdkCursorType type);
  130. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gdk)]
  131. public delegate IntPtr gdk_window_get_pointer(IntPtr raw, out int x, out int y, out int mask);
  132. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gdk)]
  133. public delegate GdkWindowState gdk_window_get_state(IntPtr window);
  134. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gdk)]
  135. public delegate void gdk_window_iconify(IntPtr window);
  136. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gdk)]
  137. public delegate void gdk_window_deiconify(IntPtr window);
  138. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gdk)]
  139. public delegate void gdk_window_maximize(IntPtr window);
  140. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gdk)]
  141. public delegate void gdk_window_unmaximize(IntPtr window);
  142. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gdk)]
  143. public delegate void gtk_window_set_geometry_hints(GtkWindow window, IntPtr geometry_widget, ref GdkGeometry geometry, GdkWindowHints geom_mask);
  144. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gdk)]
  145. public delegate void gdk_window_invalidate_rect(IntPtr window, ref GdkRectangle rect, bool invalidate_children);
  146. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gdk)]
  147. public delegate void gdk_window_begin_move_drag(IntPtr window, gint button, gint root_x, gint root_y, guint32 timestamp);
  148. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gdk)]
  149. public delegate void gdk_window_begin_resize_drag(IntPtr window, WindowEdge edge, gint button, gint root_x, gint root_y, guint32 timestamp);
  150. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gdk)]
  151. public delegate void gdk_event_request_motions(IntPtr ev);
  152. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)]
  153. public delegate IntPtr gtk_clipboard_get_for_display(IntPtr display, IntPtr atom);
  154. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)]
  155. public delegate void gtk_clipboard_request_text(IntPtr clipboard, GtkClipboardTextReceivedFunc callback, IntPtr user_data);
  156. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)]
  157. public delegate void gtk_clipboard_set_text(IntPtr clipboard, Utf8Buffer text, int len);
  158. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)]
  159. public delegate void gtk_clipboard_clear(IntPtr clipboard);
  160. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.GdkPixBuf)]
  161. public delegate IntPtr gdk_pixbuf_new_from_file(Utf8Buffer filename, out IntPtr error);
  162. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)]
  163. public delegate IntPtr gtk_icon_theme_get_default();
  164. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)]
  165. public delegate IntPtr gtk_icon_theme_load_icon(IntPtr icon_theme, Utf8Buffer icon_name, gint size, int flags,out IntPtr error);
  166. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gdk)]
  167. public delegate IntPtr gdk_cursor_new_from_pixbuf(IntPtr disp, IntPtr pixbuf, int x, int y);
  168. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gdk)]
  169. public delegate IntPtr gdk_window_set_cursor(IntPtr window, IntPtr cursor);
  170. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.GdkPixBuf)]
  171. public delegate IntPtr gdk_pixbuf_new_from_stream(GInputStream stream, IntPtr cancel, out IntPtr error);
  172. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.GdkPixBuf)]
  173. public delegate bool gdk_pixbuf_save_to_bufferv(Pixbuf pixbuf, out IntPtr buffer, out IntPtr buffer_size,
  174. Utf8Buffer type, IntPtr option_keys, IntPtr option_values, out IntPtr error);
  175. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gobject)]
  176. public delegate void g_object_unref(IntPtr instance);
  177. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gobject)]
  178. public delegate void g_object_ref(GObject instance);
  179. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gobject)]
  180. public delegate ulong g_signal_connect_object(GObject instance, Utf8Buffer signal, IntPtr handler, IntPtr userData, int flags);
  181. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gobject)]
  182. public delegate ulong g_signal_handler_disconnect(GObject instance, ulong connectionId);
  183. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Glib)]
  184. public delegate ulong g_timeout_add(uint interval, timeout_callback callback, IntPtr data);
  185. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Glib)]
  186. public delegate ulong g_free(IntPtr data);
  187. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Glib)]
  188. public unsafe delegate void g_slist_free(GSList* data);
  189. [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gio)]
  190. public delegate GInputStream g_memory_input_stream_new_from_data(IntPtr ptr, IntPtr len, IntPtr destroyCallback);
  191. [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
  192. public delegate bool signal_widget_draw(IntPtr gtkWidget, IntPtr cairoContext, IntPtr userData);
  193. [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
  194. public delegate bool signal_generic(IntPtr gtkWidget, IntPtr userData);
  195. [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
  196. public delegate bool signal_dialog_response(IntPtr gtkWidget, GtkResponseType response, IntPtr userData);
  197. [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
  198. public delegate bool signal_onevent(IntPtr gtkWidget, IntPtr ev, IntPtr userData);
  199. [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
  200. public delegate bool signal_commit(IntPtr gtkWidget, IntPtr utf8string, IntPtr userData);
  201. [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
  202. public delegate bool timeout_callback(IntPtr data);
  203. [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
  204. public delegate void GtkClipboardTextReceivedFunc(IntPtr clipboard, IntPtr utf8string, IntPtr userdata);
  205. }
  206. public static D.gtk_window_set_decorated GtkWindowSetDecorated;
  207. public static D.gtk_window_set_skip_taskbar_hint GtkWindowSetSkipTaskbarHint;
  208. public static D.gtk_window_get_skip_taskbar_hint GtkWindowGetSkipTaskbarHint;
  209. public static D.gtk_window_set_skip_pager_hint GtkWindowSetSkipPagerHint;
  210. public static D.gtk_window_get_skip_pager_hint GtkWindowGetSkipPagerHint;
  211. public static D.gtk_window_set_title GtkWindowSetTitle;
  212. public static D.gtk_application_new GtkApplicationNew;
  213. public static D.gtk_main_iteration GtkMainIteration;
  214. public static D.gtk_window_new GtkWindowNew;
  215. public static D.gtk_window_set_icon GtkWindowSetIcon;
  216. public static D.gtk_window_set_modal GtkWindowSetModal;
  217. public static D.gtk_init GtkInit;
  218. public static D.gtk_window_present GtkWindowPresent;
  219. public static D.gtk_widget_hide GtkWidgetHide;
  220. public static D.gtk_widget_show GtkWidgetShow;
  221. public static D.gdk_get_native_handle GetNativeGdkWindowHandle;
  222. public static D.gtk_widget_get_window GtkWidgetGetWindow;
  223. public static D.gtk_widget_get_scale_factor GtkWidgetGetScaleFactor;
  224. public static D.gtk_widget_get_screen GtkWidgetGetScreen;
  225. public static D.gtk_widget_realize GtkWidgetRealize;
  226. public static D.gtk_window_get_size GtkWindowGetSize;
  227. public static D.gtk_window_resize GtkWindowResize;
  228. public static D.gdk_window_resize GdkWindowResize;
  229. public static D.gtk_widget_set_size_request GtkWindowSetSizeRequest;
  230. public static D.gtk_window_set_default_size GtkWindowSetDefaultSize;
  231. public static D.gtk_window_get_position GtkWindowGetPosition;
  232. public static D.gtk_window_move GtkWindowMove;
  233. public static D.gtk_file_chooser_dialog_new GtkFileChooserDialogNew;
  234. public static D.gtk_file_chooser_set_select_multiple GtkFileChooserSetSelectMultiple;
  235. public static D.gtk_file_chooser_set_filename GtkFileChooserSetFilename;
  236. public static D.gtk_file_chooser_get_filenames GtkFileChooserGetFilenames;
  237. public static D.gtk_dialog_add_button GtkDialogAddButton;
  238. public static D.g_object_unref GObjectUnref;
  239. public static D.g_object_ref GObjectRef;
  240. public static D.g_signal_connect_object GSignalConnectObject;
  241. public static D.g_signal_handler_disconnect GSignalHandlerDisconnect;
  242. public static D.g_timeout_add GTimeoutAdd;
  243. public static D.g_free GFree;
  244. public static D.g_slist_free GSlistFree;
  245. public static D.g_memory_input_stream_new_from_data GMemoryInputStreamNewFromData;
  246. public static D.gtk_widget_set_double_buffered GtkWidgetSetDoubleBuffered;
  247. public static D.gtk_widget_set_events GtkWidgetSetEvents;
  248. public static D.gdk_window_invalidate_rect GdkWindowInvalidateRect;
  249. public static D.gtk_widget_queue_draw_area GtkWidgetQueueDrawArea;
  250. public static D.gtk_widget_activate GtkWidgetActivate;
  251. public static D.gtk_clipboard_get_for_display GtkClipboardGetForDisplay;
  252. public static D.gtk_clipboard_request_text GtkClipboardRequestText;
  253. public static D.gtk_clipboard_set_text GtkClipboardSetText;
  254. public static D.gtk_clipboard_clear GtkClipboardRequestClear;
  255. public static D.gtk_im_multicontext_new GtkImMulticontextNew;
  256. public static D.gtk_im_context_filter_keypress GtkImContextFilterKeypress;
  257. public static D.gtk_im_context_set_client_window GtkImContextSetClientWindow;
  258. public static D.gdk_screen_get_height GdkScreenGetHeight;
  259. public static D.gdk_display_get_default GdkGetDefaultDisplay;
  260. public static D.gdk_screen_get_width GdkScreenGetWidth;
  261. public static D.gdk_screen_get_root_window GdkScreenGetRootWindow;
  262. public static D.gdk_cursor_new GdkCursorNew;
  263. public static D.gdk_window_get_origin GdkWindowGetOrigin;
  264. public static D.gdk_window_get_pointer GdkWindowGetPointer;
  265. public static D.gdk_window_get_state GdkWindowGetState;
  266. public static D.gdk_window_iconify GdkWindowIconify;
  267. public static D.gdk_window_deiconify GdkWindowDeiconify;
  268. public static D.gdk_window_maximize GdkWindowMaximize;
  269. public static D.gdk_window_unmaximize GdkWindowUnmaximize;
  270. public static D.gdk_window_begin_move_drag GdkWindowBeginMoveDrag;
  271. public static D.gdk_window_begin_resize_drag GdkWindowBeginResizeDrag;
  272. public static D.gdk_event_request_motions GdkEventRequestMotions;
  273. public static D.gdk_pixbuf_new_from_file GdkPixbufNewFromFile;
  274. public static D.gtk_icon_theme_get_default GtkIconThemeGetDefault;
  275. public static D.gtk_icon_theme_load_icon GtkIconThemeLoadIcon;
  276. public static D.gdk_cursor_new_from_pixbuf GdkCursorNewFromPixbuf;
  277. public static D.gdk_window_set_cursor GdkWindowSetCursor;
  278. public static D.gdk_pixbuf_new_from_stream GdkPixbufNewFromStream;
  279. public static D.gdk_pixbuf_save_to_bufferv GdkPixbufSaveToBufferv;
  280. public static D.cairo_image_surface_create CairoImageSurfaceCreate;
  281. public static D.cairo_image_surface_get_data CairoImageSurfaceGetData;
  282. public static D.cairo_image_surface_get_stride CairoImageSurfaceGetStride;
  283. public static D.cairo_surface_mark_dirty CairoSurfaceMarkDirty;
  284. public static D.cairo_surface_flush CairoSurfaceFlush;
  285. public static D.cairo_surface_destroy CairoSurfaceDestroy;
  286. public static D.cairo_set_source_surface CairoSetSourceSurface;
  287. public static D.cairo_scale CairoScale;
  288. public static D.cairo_paint CairoPaint;
  289. }
  290. public enum GtkWindowType
  291. {
  292. TopLevel,
  293. Popup
  294. }
  295. [StructLayout(LayoutKind.Sequential)]
  296. public struct GdkRectangle
  297. {
  298. public int X, Y, Width, Height;
  299. public static GdkRectangle FromRect(Rect rect)
  300. {
  301. return new GdkRectangle
  302. {
  303. X = (int) rect.X,
  304. Y = (int) rect.Y,
  305. Width = (int) rect.Width,
  306. Height = (int) rect.Height
  307. };
  308. }
  309. }
  310. enum GdkEventType
  311. {
  312. Nothing = -1,
  313. Delete = 0,
  314. Destroy = 1,
  315. Expose = 2,
  316. MotionNotify = 3,
  317. ButtonPress = 4,
  318. TwoButtonPress = 5,
  319. ThreeButtonPress = 6,
  320. ButtonRelease = 7,
  321. KeyPress = 8,
  322. KeyRelease = 9,
  323. EnterNotify = 10,
  324. LeaveNotify = 11,
  325. FocusChange = 12,
  326. Configure = 13,
  327. Map = 14,
  328. Unmap = 15,
  329. PropertyNotify = 16,
  330. SelectionClear = 17,
  331. SelectionRequest = 18,
  332. SelectionNotify = 19,
  333. ProximityIn = 20,
  334. ProximityOut = 21,
  335. DragEnter = 22,
  336. DragLeave = 23,
  337. DragMotion = 24,
  338. DragStatus = 25,
  339. DropStart = 26,
  340. DropFinished = 27,
  341. ClientEvent = 28,
  342. VisibilityNotify = 29,
  343. NoExpose = 30,
  344. Scroll = 31,
  345. WindowState = 32,
  346. Setting = 33,
  347. OwnerChange = 34,
  348. GrabBroken = 35,
  349. }
  350. enum GdkModifierType
  351. {
  352. ShiftMask = 1,
  353. LockMask = 2,
  354. ControlMask = 4,
  355. Mod1Mask = 8,
  356. Mod2Mask = 16,
  357. Mod3Mask = 32,
  358. Mod4Mask = 64,
  359. Mod5Mask = 128,
  360. Button1Mask = 256,
  361. Button2Mask = 512,
  362. Button3Mask = 1024,
  363. Button4Mask = 2048,
  364. Button5Mask = 4096,
  365. SuperMask = 67108864,
  366. HyperMask = 134217728,
  367. MetaMask = 268435456,
  368. ReleaseMask = 1073741824,
  369. ModifierMask = ReleaseMask | Button5Mask | Button4Mask | Button3Mask | Button2Mask | Button1Mask | Mod5Mask | Mod4Mask | Mod3Mask | Mod2Mask | Mod1Mask | ControlMask | LockMask | ShiftMask,
  370. None = 0,
  371. }
  372. enum GdkScrollDirection
  373. {
  374. Up,
  375. Down,
  376. Left,
  377. Right,
  378. Smooth
  379. }
  380. [StructLayout(LayoutKind.Sequential)]
  381. unsafe struct GdkEventButton
  382. {
  383. public GdkEventType type;
  384. public IntPtr window;
  385. public gint8 send_event;
  386. public guint32 time;
  387. public gdouble x;
  388. public gdouble y;
  389. public gdouble* axes;
  390. public GdkModifierType state;
  391. public guint button;
  392. public IntPtr device;
  393. public gdouble x_root, y_root;
  394. }
  395. [StructLayout(LayoutKind.Sequential)]
  396. unsafe struct GdkEventMotion
  397. {
  398. public GdkEventType type;
  399. public IntPtr window;
  400. public gint8 send_event;
  401. public guint32 time;
  402. public gdouble x;
  403. public gdouble y;
  404. public gdouble* axes;
  405. public GdkModifierType state;
  406. public gint16 is_hint;
  407. public IntPtr device;
  408. public gdouble x_root, y_root;
  409. }
  410. [StructLayout(LayoutKind.Sequential)]
  411. unsafe struct GdkEventScroll
  412. {
  413. public GdkEventType type;
  414. public IntPtr window;
  415. public gint8 send_event;
  416. public guint32 time;
  417. public gdouble x;
  418. public gdouble y;
  419. public GdkModifierType state;
  420. public GdkScrollDirection direction;
  421. public IntPtr device;
  422. public gdouble x_root, y_root;
  423. public gdouble delta_x;
  424. public gdouble delta_y;
  425. }
  426. [StructLayout(LayoutKind.Sequential)]
  427. unsafe struct GdkEventCrossing
  428. {
  429. public GdkEventType type;
  430. public IntPtr window;
  431. public gint8 send_event;
  432. public IntPtr subwindow;
  433. public guint32 time;
  434. public gdouble x;
  435. public gdouble y;
  436. public gdouble x_root;
  437. public gdouble y_root;
  438. public int mode;
  439. public int detail;
  440. public bool focus;
  441. public GdkModifierType state;
  442. };
  443. [StructLayout(LayoutKind.Sequential)]
  444. unsafe struct GdkEventWindowState
  445. {
  446. public GdkEventType type;
  447. public IntPtr window;
  448. gint8 send_event;
  449. public GdkWindowState changed_mask;
  450. public GdkWindowState new_window_state;
  451. }
  452. [StructLayout(LayoutKind.Sequential)]
  453. unsafe struct GdkEventKey
  454. {
  455. public GdkEventType type;
  456. public IntPtr window;
  457. public gint8 send_event;
  458. public guint32 time;
  459. public guint state;
  460. public guint keyval;
  461. public gint length;
  462. public IntPtr pstring;
  463. public guint16 hardware_keycode;
  464. public byte group;
  465. public guint is_modifier;
  466. }
  467. [StructLayout(LayoutKind.Sequential)]
  468. unsafe struct GSList
  469. {
  470. public IntPtr Data;
  471. public GSList* Next;
  472. }
  473. [Flags]
  474. public enum GdkWindowState
  475. {
  476. Withdrawn = 1,
  477. Iconified = 2,
  478. Maximized = 4,
  479. Sticky = 8,
  480. Fullscreen = 16,
  481. Above = 32,
  482. Below = 64,
  483. Focused = 128,
  484. Ttiled = 256
  485. }
  486. public enum GtkResponseType
  487. {
  488. Help = -11,
  489. Apply = -10,
  490. No = -9,
  491. Yes = -8,
  492. Close = -7,
  493. Cancel = -6,
  494. Ok = -5,
  495. DeleteEvent = -4,
  496. Accept = -3,
  497. Reject = -2,
  498. None = -1,
  499. }
  500. public enum GtkFileChooserAction
  501. {
  502. Open,
  503. Save,
  504. SelectFolder,
  505. CreateFolder,
  506. }
  507. [StructLayout(LayoutKind.Sequential)]
  508. struct GdkGeometry
  509. {
  510. gint min_width;
  511. gint min_height;
  512. gint max_width;
  513. gint max_height;
  514. gint base_width;
  515. gint base_height;
  516. gint width_inc;
  517. gint height_inc;
  518. gdouble min_aspect;
  519. gdouble max_aspect;
  520. gint win_gravity;
  521. }
  522. enum GdkWindowHints
  523. {
  524. GDK_HINT_POS = 1 << 0,
  525. GDK_HINT_MIN_SIZE = 1 << 1,
  526. GDK_HINT_MAX_SIZE = 1 << 2,
  527. GDK_HINT_BASE_SIZE = 1 << 3,
  528. GDK_HINT_ASPECT = 1 << 4,
  529. GDK_HINT_RESIZE_INC = 1 << 5,
  530. GDK_HINT_WIN_GRAVITY = 1 << 6,
  531. GDK_HINT_USER_POS = 1 << 7,
  532. GDK_HINT_USER_SIZE = 1 << 8
  533. }
  534. }