gtk2.pas 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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. {$define GTK2_2}
  18. { Smartlinking has problems on powerpc-linux because of commandline length, disable
  19. it for now }
  20. {$ifdef powerpc}
  21. {$ifdef linux}
  22. {$smartlink off}
  23. {$endif}
  24. {$endif}
  25. {$H+}
  26. {$IFDEF FPC}
  27. {$mode objfpc}
  28. {$ENDIF}
  29. {$IFDEF VER140}
  30. {$DEFINE KYLIX}
  31. {$ENDIF}
  32. {$IFDEF GTK2_2}
  33. {$DEFINE HasGTK2_0}
  34. {$DEFINE HasGTK2_2}
  35. {$ENDIF}
  36. {$IFDEF GTK2_4}
  37. {$DEFINE HasGTK2_0}
  38. {$DEFINE HasGTK2_2}
  39. {$DEFINE HasGTK2_4}
  40. {$ENDIF}
  41. {$IFDEF GTK2_6}
  42. {$DEFINE HasGTK2_0}
  43. {$DEFINE HasGTK2_2}
  44. {$DEFINE HasGTK2_4}
  45. {$DEFINE HasGTK2_6}
  46. {$ENDIF}
  47. interface
  48. uses
  49. glib2, atk, pango, gdk2pixbuf, gdk2;
  50. const
  51. // OS dependent defines
  52. {$ifdef win32}
  53. {$DEFINE GTK_WINDOWING_WIN32}
  54. gtklib = 'libgtk-win32-2.0-0.dll';
  55. {$IFDEF FPC}
  56. {$smartlink on}
  57. {$ENDIF}
  58. {$else}
  59. {$IFDEF KYLIX}
  60. gtklib = 'libgtk-x11-2.0.so';
  61. {$ELSE}
  62. {$ifdef darwin}
  63. gtklib = 'gtk-x11-2.0';
  64. {$linklib gtk-x11-2.0}
  65. {$linklib gdk-x11-2.0}
  66. {$linklib pango-1.0.0}
  67. {$linklib glib-2.0.0}
  68. {$linklib gobject-2.0.0}
  69. {$linklib gdk_pixbuf-2.0.0}
  70. {$linklib atk-1.0.0}
  71. {$else}
  72. {$ifdef UseCustomLibs}
  73. gtklib = '';
  74. {$else}
  75. gtklib = 'libgtk-x11-2.0.so';
  76. {$endif}
  77. {$endif}
  78. {$ENDIF}
  79. {$endif}
  80. {$IFDEF KYLIX}
  81. Type
  82. PPPchar = PPPgchar;
  83. {$ENDIF}
  84. {$IFNDEF KYLIX}
  85. {$PACKRECORDS C}
  86. {$ELSE}
  87. {$ALIGN 4}
  88. {$WEAKPACKAGEUNIT}
  89. {$WARNINGS OFF}
  90. {$ENDIF}
  91. const
  92. GTK_MAX_COMPOSE_LEN = 7;
  93. type
  94. {$DEFINE read_forward_definitions}
  95. {$include gtkincludes.inc}
  96. {$UNDEF read_forward_definitions}
  97. {$DEFINE read_interface_types}
  98. {$include gtkincludes.inc}
  99. {$UNDEF read_interface_types}
  100. {$DEFINE read_interface_rest}
  101. {$include gtkincludes.inc}
  102. {$UNDEF read_interface_rest}
  103. implementation
  104. {$IFDEF FPC}
  105. { There is a bug in the compiler. If an external variable is not used, it will
  106. create code, that can be relocated by the linker.
  107. So, use them in this hidden dummy procedure.
  108. }
  109. procedure CheckUnusedVariable; [Public];
  110. begin
  111. if (gtk_major_version<>0) then ;
  112. if (gtk_minor_version<>0) then ;
  113. if (gtk_micro_version<>0) then ;
  114. if (gtk_binary_age<>0) then ;
  115. if (gtk_interface_age<>0) then ;
  116. if (ord(gtk_text_attr_appearance_type)<>0) then ;
  117. end;
  118. {$ENDIF}
  119. // call implementation parts of header files
  120. {$DEFINE read_implementation}
  121. {$include gtkincludes.inc}
  122. {$UNDEF read_implementation}
  123. end.