gdk2.pas 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. {
  2. GDK - The GIMP Drawing Kit
  3. Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
  4. This library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2 of the License, or (at your option) any later version.
  8. This library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with this library; if not, write to the
  14. Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  15. Boston, MA 02111-1307, USA.
  16. }
  17. unit gdk2; // keep unit name lowercase for kylix
  18. {$IFDEF FPC}
  19. {$mode objfpc}
  20. {$ENDIF}
  21. {$IFDEF VER140}
  22. {$DEFINE KYLIX}
  23. {$ENDIF}
  24. interface
  25. uses glib2, gdk2pixbuf, pango;
  26. const
  27. // OS dependent defines
  28. {$ifdef win32}
  29. {$DEFINE GDK_WINDOWING_WIN32}
  30. gdklib = 'libgdk-win32-2.0-0.dll';
  31. {$IFDEF FPC}
  32. {$smartlink on}
  33. {$ENDIF}
  34. GDK_HAVE_WCHAR_H=1;
  35. GDK_HAVE_WCTYPE_H=1;
  36. {$else}
  37. {$ifdef darwin}
  38. gdklib = 'gdk-x11-2.0';
  39. {$linklib gtk-x11-2.0}
  40. {$linklib gdk-x11-2.0}
  41. {$linklib pango-1.0.0}
  42. {$linklib glib-2.0.0}
  43. {$linklib gobject-2.0.0}
  44. {$linklib gdk_pixbuf-2.0.0}
  45. {$linklib atk-1.0.0}
  46. {$else}
  47. {$ifdef UseCustomLibs}
  48. gdklib = '';
  49. {$else}
  50. gdklib = 'libgdk-x11-2.0.so';
  51. {$endif}
  52. {$endif}
  53. {$endif}
  54. {$IFNDEF KYLIX}
  55. {$PACKRECORDS C}
  56. {$ELSE}
  57. {$ALIGN 4}
  58. {$WEAKPACKAGEUNIT}
  59. {$WARNINGS OFF}
  60. {$ENDIF}
  61. // the included header files:
  62. {
  63. number of points to buffer before sending them off
  64. to scanlines() : Must be an even number
  65. }
  66. const
  67. NUMPTSTOBUFFER = 200;
  68. GDK_MAX_TIMECOORD_AXES = 128;
  69. type
  70. PGdkDeviceClass = ^TGdkDeviceClass;
  71. TGdkDeviceClass = record
  72. parent_class: TGObjectClass;
  73. end;
  74. PGdkVisualClass = ^TGdkVisualClass;
  75. TGdkVisualClass = record
  76. parent_class: TGObjectClass;
  77. end;
  78. {$DEFINE read_forward_definitions}
  79. {$include gdkincludes.inc}
  80. {$UNDEF read_forward_definitions}
  81. {$DEFINE read_interface_types}
  82. {$include gdkincludes.inc}
  83. {$UNDEF read_interface_types}
  84. {$DEFINE read_interface_rest}
  85. {$include gdkincludes.inc}
  86. {$UNDEF read_interface_rest}
  87. procedure gdk_parse_args(argc:Pgint; var argv:PPgchar); cdecl; external gdklib;
  88. procedure gdk_init(argc:Pgint; var argv:PPgchar); cdecl; external gdklib;
  89. function gdk_init_check(argc:Pgint; var argv:PPgchar):gboolean; cdecl; external gdklib;
  90. {$ifndef GDK_DISABLE_DEPRECATED}
  91. procedure gdk_exit(error_code:gint); cdecl; external gdklib;
  92. {$endif}
  93. { GDK_DISABLE_DEPRECATED }
  94. function gdk_set_locale:Pgchar; cdecl; external gdklib;
  95. function gdk_get_program_class:Pchar; cdecl; external gdklib;
  96. procedure gdk_set_program_class(program_class:Pchar); cdecl; external gdklib;
  97. { Push and pop error handlers for X errors }
  98. procedure gdk_error_trap_push; cdecl; external gdklib;
  99. function gdk_error_trap_pop:gint; cdecl; external gdklib;
  100. {$ifndef GDK_DISABLE_DEPRECATED}
  101. procedure gdk_set_use_xshm(use_xshm:gboolean); cdecl; external gdklib;
  102. function gdk_get_use_xshm:gboolean; cdecl; external gdklib;
  103. {$endif}
  104. { GDK_DISABLE_DEPRECATED }
  105. function gdk_get_display:Pgchar; cdecl; external gdklib;
  106. function gdk_get_display_arg_name:Pgchar; cdecl; external gdklib;
  107. {$ifndef GDK_DISABLE_DEPRECATED}
  108. function gdk_input_add_full(source:gint; condition:TGdkInputCondition; _function:TGdkInputFunction; data:gpointer; destroy:TGdkDestroyNotify):gint; cdecl; external gdklib;
  109. function gdk_input_add(source:gint; condition:TGdkInputCondition; _function:TGdkInputFunction; data:gpointer):gint; cdecl; external gdklib;
  110. procedure gdk_input_remove(tag:gint); cdecl; external gdklib;
  111. {$endif}
  112. { GDK_DISABLE_DEPRECATED }
  113. function gdk_pointer_grab(window:PGdkWindow; owner_events:gboolean; event_mask:TGdkEventMask; confine_to:PGdkWindow; cursor:PGdkCursor;
  114. time:guint32):TGdkGrabStatus; cdecl; external gdklib;
  115. function gdk_keyboard_grab(window:PGdkWindow; owner_events:gboolean; time:guint32):TGdkGrabStatus; cdecl; external gdklib;
  116. {$ifndef GDK_MULTIHEAD_SAFE}
  117. procedure gdk_pointer_ungrab(time:guint32); cdecl; external gdklib;
  118. procedure gdk_keyboard_ungrab(time:guint32); cdecl; external gdklib;
  119. function gdk_pointer_is_grabbed:gboolean; cdecl; external gdklib;
  120. function gdk_screen_width:gint; cdecl; external gdklib;
  121. function gdk_screen_height:gint; cdecl; external gdklib;
  122. function gdk_screen_width_mm:gint; cdecl; external gdklib;
  123. function gdk_screen_height_mm:gint; cdecl; external gdklib;
  124. procedure gdk_beep; cdecl; external gdklib;
  125. {$endif}
  126. { GDK_MULTIHEAD_SAFE }
  127. procedure gdk_flush; cdecl; external gdklib;
  128. {$ifndef GDK_MULTIHEAD_SAFE}
  129. procedure gdk_set_double_click_time(msec:guint); cdecl; external gdklib;
  130. {$endif}
  131. { Rectangle utilities }
  132. function gdk_rectangle_intersect(src1:PGdkRectangle; src2:PGdkRectangle; dest:PGdkRectangle):gboolean; cdecl; external gdklib;
  133. procedure gdk_rectangle_union(src1:PGdkRectangle; src2:PGdkRectangle; dest:PGdkRectangle); cdecl; external gdklib;
  134. function gdk_rectangle_get_type:GType; cdecl; external gdklib;
  135. function GDK_TYPE_RECTANGLE : GType;
  136. { Conversion functions between wide char and multibyte strings. }
  137. function gdk_wcstombs(src:PGdkWChar):Pgchar; cdecl; external gdklib;
  138. function gdk_mbstowcs(dest:PGdkWChar; src:Pgchar; dest_max:gint):gint; cdecl; external gdklib;
  139. { Miscellaneous }
  140. {$ifndef GDK_MULTIHEAD_SAFE}
  141. function gdk_event_send_client_message(event:PGdkEvent; xid:guint32):gboolean; cdecl; external gdklib;
  142. procedure gdk_event_send_clientmessage_toall(event:PGdkEvent); cdecl; external gdklib;
  143. {$endif}
  144. function gdk_event_send_client_message_for_display(display:PGdkDisplay; event:PGdkEvent; xid:guint32):gboolean; cdecl; external gdklib;
  145. {$IFNDEF KYLIX}
  146. { Threading }
  147. var
  148. gdk_threads_mutex : PGMutex; cvar; external;
  149. {$ENDIF}
  150. procedure gdk_threads_enter; cdecl; external gdklib;
  151. procedure gdk_threads_leave; cdecl; external gdklib;
  152. procedure gdk_threads_init; cdecl; external gdklib;
  153. procedure _GDK_THREADS_ENTER;
  154. procedure _GDK_THREADS_LEAVE;
  155. implementation
  156. {$IFNDEF KYLIX}
  157. { There is a bug in the compiler. If an external variable is not used, it will
  158. create code, that can be relocated by the linker.
  159. So, use them in this hidden procedure.
  160. }
  161. procedure CheckUnusedVariable; [Public];
  162. begin
  163. if (gdk_threads_mutex<>nil) then ;
  164. end;
  165. {$ENDIF}
  166. //------------------------------------------------------------------------------
  167. function GDK_TYPE_RECTANGLE : GType;
  168. begin
  169. GDK_TYPE_RECTANGLE:=gdk_rectangle_get_type;
  170. end;
  171. procedure _GDK_THREADS_ENTER;
  172. begin
  173. {$ifdef G_THREADS_ENABLED}
  174. if (gdk_threads_mutex) then
  175. g_mutex_lock (gdk_threads_mutex);
  176. {$endif}
  177. end;
  178. procedure _GDK_THREADS_LEAVE;
  179. begin
  180. {$ifdef G_THREADS_ENABLED}
  181. if (gdk_threads_mutex) then
  182. g_mutex_unlock (gdk_threads_mutex);
  183. {$endif}
  184. end;
  185. // call implementation parts of header files
  186. {$DEFINE read_implementation}
  187. {$include gdkincludes.inc}
  188. {$UNDEF read_implementation}
  189. end.