gtk2.pas 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. { GTK - The GIMP Toolkit
  2. Copyright (C) 2005 Mattias Gaertner, Olaf Leidinger
  3. This library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public
  5. License as published by the Free Software Foundation; either
  6. version 2 of the License, or (at your option) any later version.
  7. This library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public
  12. License along with this library; if not, write to the
  13. Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  14. Boston, MA 02111-1307, USA.
  15. }
  16. unit gtk2; // keep unit name lowercase for kylix
  17. // default GTK2_8
  18. {$define GTK2_8}
  19. { Smartlinking has problems on powerpc-linux because of commandline length, disable
  20. it for now }
  21. {$ifdef powerpc}
  22. {$ifdef linux}
  23. {$smartlink off}
  24. {$endif}
  25. {$endif}
  26. {$H+}
  27. {$IFDEF FPC}
  28. {$mode objfpc}
  29. {$ENDIF}
  30. {$IFDEF VER140}
  31. {$DEFINE KYLIX}
  32. {$ENDIF}
  33. {$IFDEF GTK2_2}
  34. {$DEFINE HasGTK2_0}
  35. {$DEFINE HasGTK2_2}
  36. {$ENDIF}
  37. {$IFDEF GTK2_4}
  38. {$DEFINE HasGTK2_0}
  39. {$DEFINE HasGTK2_2}
  40. {$DEFINE HasGTK2_4}
  41. {$ENDIF}
  42. {$IFDEF GTK2_6}
  43. {$DEFINE HasGTK2_0}
  44. {$DEFINE HasGTK2_2}
  45. {$DEFINE HasGTK2_4}
  46. {$DEFINE HasGTK2_6}
  47. {$ENDIF}
  48. {$IFDEF GTK2_8}
  49. {$DEFINE HasGTK2_0}
  50. {$DEFINE HasGTK2_2}
  51. {$DEFINE HasGTK2_4}
  52. {$DEFINE HasGTK2_6}
  53. {$DEFINE HasGTK2_8}
  54. {$ENDIF}
  55. interface
  56. uses
  57. glib2, atk, pango, gdk2pixbuf, gdk2;
  58. const
  59. // OS dependent defines
  60. {$ifdef win32}
  61. {$DEFINE GTK_WINDOWING_WIN32}
  62. gtklib = 'libgtk-win32-2.0-0.dll';
  63. {$IFDEF FPC}
  64. {$ifndef NO_SMART_LINK}
  65. {$smartlink on}
  66. {$endif}
  67. {$ENDIF}
  68. {$else}
  69. {$IFDEF KYLIX}
  70. gtklib = 'libgtk-x11-2.0.so';
  71. {$ELSE}
  72. {$ifdef darwin}
  73. gtklib = 'gtk-x11-2.0';
  74. {$linklib gtk-x11-2.0}
  75. {$linklib gdk-x11-2.0}
  76. {$linklib pango-1.0.0}
  77. {$linklib glib-2.0.0}
  78. {$linklib gobject-2.0.0}
  79. {$linklib gdk_pixbuf-2.0.0}
  80. {$linklib atk-1.0.0}
  81. {$else}
  82. {$ifdef UseCustomLibs}
  83. gtklib = '';
  84. {$else}
  85. gtklib = 'libgtk-x11-2.0.so';
  86. {$endif}
  87. {$endif}
  88. {$ENDIF}
  89. {$endif}
  90. {$IFDEF KYLIX}
  91. Type
  92. PPPchar = PPPgchar;
  93. {$ENDIF}
  94. {$IFNDEF KYLIX}
  95. {$PACKRECORDS C}
  96. {$ELSE}
  97. {$ALIGN 4}
  98. {$WEAKPACKAGEUNIT}
  99. {$WARNINGS OFF}
  100. {$ENDIF}
  101. const
  102. GTK_MAX_COMPOSE_LEN = 7;
  103. type
  104. {$DEFINE read_forward_definitions}
  105. {$include gtkincludes.inc}
  106. {$UNDEF read_forward_definitions}
  107. {$DEFINE read_interface_types}
  108. {$include gtkincludes.inc}
  109. {$UNDEF read_interface_types}
  110. {$DEFINE read_interface_rest}
  111. {$include gtkincludes.inc}
  112. {$UNDEF read_interface_rest}
  113. implementation
  114. uses
  115. SysUtils;
  116. {$IFDEF FPC}
  117. { There is a bug in the compiler. If an external variable is not used, it will
  118. create code, that can be relocated by the linker.
  119. So, use them in this hidden dummy procedure.
  120. }
  121. procedure CheckUnusedVariable; [Public];
  122. begin
  123. if (gtk_major_version<>0) then ;
  124. if (gtk_minor_version<>0) then ;
  125. if (gtk_micro_version<>0) then ;
  126. if (gtk_binary_age<>0) then ;
  127. if (gtk_interface_age<>0) then ;
  128. if (ord(gtk_text_attr_appearance_type)<>0) then ;
  129. end;
  130. {$ENDIF}
  131. // call implementation parts of header files
  132. {$DEFINE read_implementation}
  133. {$include gtkincludes.inc}
  134. {$UNDEF read_implementation}
  135. end.