summaryrefslogtreecommitdiff
path: root/fpcsrc/packages/gtk2/src/gtk+/gtk/gtk2.pas
blob: 000d329eab9e162fd020b64665de8c8406539fca (plain)
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
{ GTK - The GIMP Toolkit
   Copyright (C) 2005 Mattias Gaertner, Olaf Leidinger

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with this library; if not, write to the
   Free Software Foundation, Inc., 59 Temple Place - Suite 330,
   Boston, MA 02111-1307, USA.
  }
unit gtk2; // keep unit name lowercase for kylix

// default GTK2_8
{$define GTK2_8}

{ Smartlinking has problems on powerpc-linux because of commandline length, disable
  it for now }
{$ifdef powerpc}
  {$ifdef linux}
    {$smartlink off}
  {$endif}
{$endif}

{$H+}
{$IFDEF FPC}
  {$mode objfpc}
{$ENDIF}
{$IFDEF VER140}
  {$DEFINE KYLIX}
{$ENDIF}

{$IFDEF GTK2_2}
{$DEFINE HasGTK2_0}
{$DEFINE HasGTK2_2}
{$ENDIF}

{$IFDEF GTK2_4}
{$DEFINE HasGTK2_0}
{$DEFINE HasGTK2_2}
{$DEFINE HasGTK2_4}
{$ENDIF}

{$IFDEF GTK2_6}
{$DEFINE HasGTK2_0}
{$DEFINE HasGTK2_2}
{$DEFINE HasGTK2_4}
{$DEFINE HasGTK2_6}
{$ENDIF}

{$IFDEF GTK2_8}
{$DEFINE HasGTK2_0}
{$DEFINE HasGTK2_2}
{$DEFINE HasGTK2_4}
{$DEFINE HasGTK2_6}
{$DEFINE HasGTK2_8}
{$ENDIF}

// {$define HasGTK_FileSystem}

interface

uses
  glib2, atk, pango, gdk2pixbuf, gdk2;

const
// OS dependent defines
{$ifdef windows}
  {$DEFINE GTK_WINDOWING_WIN32}
  gtklib = 'libgtk-win32-2.0-0.dll';
  {$IFDEF FPC}
    {$ifndef NO_SMART_LINK}
      {$smartlink on}
    {$endif}
  {$ENDIF}
{$else}
  {$IFDEF KYLIX}
    gtklib = 'libgtk-x11-2.0.so';
  {$ELSE}
    {$ifdef darwin}
      gtklib = 'gtk-x11-2.0';
      {$linklib gtk-x11-2.0}
      {$linklib gdk-x11-2.0}
      {$linklib pango-1.0.0}
      {$linklib glib-2.0.0}
      {$linklib gobject-2.0.0}
      {$linklib gdk_pixbuf-2.0.0}
      {$linklib atk-1.0.0}
      {$linklib gthread-2.0}
    {$else}
      {$ifdef UseCustomLibs}
      gtklib = '';
      {$else}
      gtklib = 'libgtk-x11-2.0.so';
      {$endif}
    {$endif}
  {$ENDIF}
{$endif}


{$IFDEF KYLIX}
Type
  PPPchar   = PPPgchar;
{$ENDIF}


{$IFNDEF KYLIX}
  {$PACKRECORDS C}
{$ELSE}
  {$ALIGN 4}
  {$WEAKPACKAGEUNIT}
  {$WARNINGS OFF}
{$ENDIF}

const
   GTK_MAX_COMPOSE_LEN = 7;

type
{$DEFINE read_forward_definitions}
{$include gtkincludes.inc}
{$UNDEF read_forward_definitions}

{$DEFINE read_interface_types}
{$include gtkincludes.inc}
{$UNDEF read_interface_types}

{$DEFINE read_interface_rest}
{$include gtkincludes.inc}
{$UNDEF read_interface_rest}

implementation

uses
  SysUtils;

{$IFDEF FPC}
{ There is a bug in the compiler. If an external variable is not used, it will
  create code, that can be relocated by the linker.
  So, use them in this hidden dummy procedure.
}
procedure CheckUnusedVariable; [Public];
begin
  if (gtk_major_version<>0) then ;
  if (gtk_minor_version<>0) then ;
  if (gtk_micro_version<>0) then ;
  if (gtk_binary_age<>0) then ;
  if (gtk_interface_age<>0) then ;
  if (ord(gtk_text_attr_appearance_type)<>0) then ;
end;
{$ENDIF}


// call implementation parts of header files
{$DEFINE read_implementation}
{$include gtkincludes.inc}
{$UNDEF read_implementation}

end.