-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathPDPanel.pas
109 lines (93 loc) · 3.31 KB
/
PDPanel.pas
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
unit PDPanel;
// Public Domain Curses
{
*----------------------------------------------------------------------*
* Panels for PDCurses *
*----------------------------------------------------------------------*
}
{$I PDCurses.inc}
interface
uses
PDCurses;
const
{$IFDEF MACOS}
FROM_PANEL_LIB = True;
{$ELSE MACOS}
FROM_PANEL_LIB = False;
{$ENDIF MACOS}
type
PPANELOBS = ^PANELOBS;
PPANEL = ^PANEL;
PANELOBS = record
above: PPANELOBS;
pan: PPANEL;
end;
PANEL = record
win: PWINDOW;
wstarty,
wendy,
wstartx,
wendx: LongInt;
below,
above: PPANEL;
user: Pointer;
obscure: PPANELOBS;
end;
var
pdcBottomPanel: function(aPanel: PPanel): LongInt; cdecl;
pdcDelPanel: function(aPanel: PPanel): LongInt; cdecl;
pdcHidePanel: function(aPanel: PPanel): LongInt; cdecl;
pdcMovePanel: function(aPanel: PPanel): LongInt; cdecl;
pdcNewPanel: function(aWindow: PWindow): PPanel; cdecl;
pdcPanelAbove: function(const aPanel: PPanel): PPanel; cdecl;
pdcPanelBelow: function(const aPanel: PPanel): PPanel; cdecl;
pdcPanelHidden: function(const aPanel: PPanel): LongInt; cdecl;
pdcPanelUserptr: function(const aPanel: PPanel): Pointer; cdecl;
pdcPanelWindow: function(const aPanel: PPanel): PWindow; cdecl;
pdcReplacePanel: function(aPanel: PPanel; win: PWindow): LongInt; cdecl;
pdcSetPanelUserPtr: function(aPanel: PPanel; const aUserPointer: Pointer): LongInt; cdecl;
pdcShowPanel: function(aPanel: PPanel): LongInt; cdecl;
pdcTopPanel: function(aPanel: PPanel): LongInt; cdecl;
pdcUpdatePanels: procedure; cdecl;
{
Non-lib functions
}
procedure pdcInitPanelLib;
implementation
{
Non-lib functions
}
procedure pdcInitPanelLib;
{$IFDEF MACOS}
var
Marshaller: TMarshaller;
begin
if PDCPanelLibHandle <> nil then Exit;
PDCPanelLibHandle := dlopen(Marshaller.AsAnsi(LIBPDCPANEL, CP_UTF8).ToPointer,
RTLD_LAZY);
if PDCPanelLibHandle <> nil then
begin
{$ELSE MACOS}
begin
if PDCLibHandle <> nil then
begin
{$ENDIF MACOS}
@pdcBottomPanel := pdcGetProcAddr('bottom_panel', FROM_PANEL_LIB);
@pdcDelPanel := pdcGetProcAddr('del_panel', FROM_PANEL_LIB);
@pdcHidePanel := pdcGetProcAddr('hide_panel', FROM_PANEL_LIB);
@pdcMovePanel := pdcGetProcAddr('move_panel', FROM_PANEL_LIB);
@pdcNewPanel := pdcGetProcAddr('new_panel', FROM_PANEL_LIB);
@pdcPanelAbove := pdcGetProcAddr('panel_above', FROM_PANEL_LIB);
@pdcPanelBelow := pdcGetProcAddr('panel_below', FROM_PANEL_LIB);
@pdcPanelHidden := pdcGetProcAddr('panel_hidden', FROM_PANEL_LIB);
@pdcPanelUserptr := pdcGetProcAddr('panel_userptr', FROM_PANEL_LIB);
@pdcPanelWindow := pdcGetProcAddr('panel_window', FROM_PANEL_LIB);
@pdcReplacePanel := pdcGetProcAddr('replace_panel', FROM_PANEL_LIB);
@pdcSetPanelUserPtr := pdcGetProcAddr('set_panel_userptr', FROM_PANEL_LIB);
@pdcShowPanel := pdcGetProcAddr('show_panel', FROM_PANEL_LIB);
@pdcTopPanel := pdcGetProcAddr('top_panel', FROM_PANEL_LIB);
@pdcUpdatePanels := pdcGetProcAddr('update_panels', FROM_PANEL_LIB);
end else
raise EDLLLoadError.Create('Unable to load the panel library.');
end;
end.