summaryrefslogtreecommitdiff
path: root/fpcsrc/packages/gtk2/src/gtkext/gtk2ext.pp
blob: 79064df026afd95b626997bb2c672bf74fc3072c (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
unit gtk2ext;

{$mode objfpc}{$H+}

interface

uses
  glib2, gdk2, gdk2pixbuf, gtk2;
  
const
  { This is equired when people don't have -dev/-devel packages on linux.
    I'm not sure how Darwin is handled tho }
  {$ifdef windows}
  GtkLibNames: array[1..1] of string = (gtklib);
  {$else}
    {$ifdef darwin} // Mac/Darwin
    GtkLibNames: array[1..1] of string = (gtklib); // TODO: I don't know this one!
    {$else} // BSD, Solaris, Linux
    GtkLibNames: array[1..2] of string = (gtklib, gtklib + '.0');
    {$endif}
  {$endif}
  
{$i gtkstatusiconh.inc}
{$i gtkscalebuttonh.inc}
{$i gtkvolumebuttonh.inc}
{$i gtktextmarkh.inc}
{$i gtktextiterh.inc}

implementation

uses
  SysUtils, dynlibs;

var
  gtkhandle : tlibhandle;

{$i gtkstatusicon.inc}
{$i gtkscalebutton.inc}
{$i gtkvolumebutton.inc}
{$i gtktextmark.inc}
{$i gtktextiter.inc}

var
  libIter: Integer;

initialization
  for libIter := High(GtkLibNames) downto Low(GtkLibNames) do begin
    gtkhandle := LoadLibrary(GtkLibNames[libIter]);
    if gtkhandle <> 0 then begin
      Loadgtkstatusicon;
      Loadgtkscalebutton;
      Loadgtkvolumebutton;
      Loadgtktextmark;
      Loadgtkiter;
      // add all specific component load functions here
      Break;
    end;
  end;
finalization
  Freegtkstatusicon;
  Freegtkscalebutton;
  Freegtkvolumebutton;
  Freegtktextmark;
  Freegtkiter;
  // add all specific component free functions here
  if gtkhandle <> 0 then
    FreeLibrary(gtkhandle);

end.