Debian Codegraph @

sdk/extension.pas

raw
1 unit Extension;
2
3 interface
4
5 const
6 // dialog messages
7 DM_FIRST = 0;
8 DM_CLOSE = DM_FIRST+1; // A signal that the dialog is about to close
9 DM_ENABLE = DM_FIRST+2;
10 DM_GETDLGDATA = DM_FIRST+3;
11 DM_GETDLGBOUNDS = DM_FIRST+4;
12 DM_GETITEMBOUNDS = DM_FIRST+5;
13 DM_GETTEXT = DM_FIRST+6; // Retrieve the text of an edit string or the caption of an item
14 DM_KEYDOWN = DM_FIRST+7;
15 DM_KEYUP = DM_FIRST+8;
16 DM_SETDLGDATA = DM_FIRST+9;
17 DM_SETFOCUS = DM_FIRST+10; // Set the keyboard focus to the given dialog item
18 DM_REDRAW = DM_FIRST+11; // Redraw the whole dialog
19 DM_SETTEXT = DM_FIRST+12; // Set a new string value for an edit line or a new caption for an item
20 DM_SETMAXTEXTLENGTH = DM_FIRST+13; // Set the maximum length of an edit string
21 DM_SHOWDIALOG = DM_FIRST+14; // Show/hide the dialog window
22 DM_SHOWITEM = DM_FIRST+15; // Show/hide a dialog item
23 DM_GETCHECK = DM_FIRST+16; // Retrieve the state of TCheckBox or TRadioButton items
24 DM_SETCHECK = DM_FIRST+17; // Change the state of TCheckBox and TRadioButton items
25 DM_LISTGETITEM = DM_FIRST+18; // Retrieve a list item
26 DM_LISTGETITEMINDEX = DM_FIRST+19; // Get current item index in a list
27 DM_LISTSETITEMINDEX = DM_FIRST+20; // Set current item index in a list
28 DM_LISTDELETE = DM_FIRST+21;
29 DM_LISTADD = DM_FIRST+22;
30 DM_LISTADDSTR = DM_FIRST+23;
31 DM_LISTUPDATE = DM_FIRST+24;
32 DM_LISTINSERT = DM_FIRST+25;
33 DM_LISTINDEXOF = DM_FIRST+26;
34 DM_LISTGETCOUNT = DM_FIRST+27;
35 DM_LISTGETDATA = DM_FIRST+28;
36 DM_LISTSETDATA = DM_FIRST+29;
37 DM_SETDLGBOUNDS = DM_FIRST+30;
38 DM_SETITEMBOUNDS = DM_FIRST+31;
39 DM_GETDROPPEDDOWN = DM_FIRST+32;
40 DM_SETDROPPEDDOWN = DM_FIRST+33;
41 DM_GETITEMDATA = DM_FIRST+34;
42 DM_SETITEMDATA = DM_FIRST+35;
43 DM_LISTSET = DM_FIRST+36;
44 DM_SETPROGRESSVALUE = DM_FIRST+37;
45 DM_SETPROGRESSSTYLE = DM_FIRST+38;
46 DM_SETPASSWORDCHAR = DM_FIRST+39;
47 DM_LISTCLEAR = DM_FIRST+40;
48 DM_TIMERSETINTERVAL = DM_FIRST+41;
49
50 // events messages
51 DN_FIRST = $1000;
52 DN_CLICK = DN_FIRST+1; // Sent after mouse click
53 DN_DBLCLICK = DN_FIRST+2; // Sent after mouse double click
54 DN_CHANGE = DN_FIRST+3; // Sent after the dialog item is changed
55 DN_GOTFOCUS = DN_FIRST+4; // Sent when the dialog item gets input focus
56 DN_INITDIALOG = DN_FIRST+5; // Sent before showing the dialog
57 DN_KILLFOCUS = DN_FIRST+6; // Sent before a dialog item loses the input focus
58 DN_TIMER = DN_FIRST+7; // Sent when a timer expires
59
60 DN_KEYDOWN = DM_KEYDOWN;
61 DN_KEYUP = DM_KEYUP;
62 DN_CLOSE = DM_CLOSE; // Sent before the dialog is closed
63
64 DM_USER = $4000; // Starting value for user defined messages
65
66 const
67 // MessageBox: To indicate the buttons displayed in the message box,
68 // specify one of the following values.
69 MB_OK = $00000000;
70 MB_OKCANCEL = $00000001;
71 MB_ABORTRETRYIGNORE = $00000002;
72 MB_YESNOCANCEL = $00000003;
73 MB_YESNO = $00000004;
74 MB_RETRYCANCEL = $00000005;
75 MB_ICONHAND = $00000010;
76 MB_ICONQUESTION = $00000020;
77 MB_ICONEXCLAMATION = $00000030;
78 MB_ICONASTERICK = $00000040;
79 MB_ICONWARNING = MB_ICONEXCLAMATION;
80 MB_ICONERROR = MB_ICONHAND;
81 MB_ICONSTOP = MB_ICONHAND;
82 MB_ICONINFORMATION = MB_ICONASTERICK;
83 // MessageBox: To indicate the default button, specify one of the following values.
84 MB_DEFBUTTON1 = $00000000;
85 MB_DEFBUTTON2 = $00000100;
86 MB_DEFBUTTON3 = $00000200;
87 MB_DEFBUTTON4 = $00000300;
88 // MessageBox: Return values
89 ID_OK = 1;
90 ID_CANCEL = 2;
91 ID_ABORT = 3;
92 ID_RETRY = 4;
93 ID_IGNORE = 5;
94 ID_YES = 6;
95 ID_NO = 7;
96 ID_CLOSE = 8;
97 ID_HELP = 9;
98 // DialogBoxParam: Flags
99 DB_LFM = 0; // Data contains a form in the LFM format
100 DB_LRS = 1; // Data contains a form in the LRS format
101 DB_FILENAME = 2; // Data contains a form file name (*.lfm)
102
103 const
104 EXT_MAX_PATH = 16384; // 16 Kb
105
106 { For compatibility with Delphi use $IFDEF's to set calling convention }
107
108 type
109 { Dialog window callback function }
110 TDlgProc = function(pDlg: PtrUInt; DlgItemName: PAnsiChar; Msg, wParam, lParam: PtrInt): PtrInt; {$IFDEF MSWINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
111 { Definition of callback functions called by the DLL }
112 TInputBoxProc = function(Caption, Prompt: PAnsiChar; MaskInput: LongBool; Value: PAnsiChar; ValueMaxLen: Integer): LongBool; {$IFDEF MSWINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
113 TMessageBoxProc = function(Text, Caption: PAnsiChar; Flags: Longint): Integer; {$IFDEF MSWINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
114 TMsgChoiceBoxProc = function(Text, Caption: PAnsiChar; Buttons: PPAnsiChar; BtnDef, BtnEsc: Integer): Integer; {$IFDEF MSWINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
115 TDialogBoxLFMProc = function(LFMData: Pointer; DataSize: LongWord; DlgProc: TDlgProc): LongBool; {$IFDEF MSWINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
116 TDialogBoxLRSProc = function(LRSData: Pointer; DataSize: LongWord; DlgProc: TDlgProc): LongBool; {$IFDEF MSWINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
117 TDialogBoxLFMFileProc = function(lfmFileName: PAnsiChar; DlgProc: TDlgProc): LongBool; {$IFDEF MSWINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
118 TDialogBoxParamProc = function(Data: Pointer; DataSize: LongWord; DlgProc: TDlgProc; Flags: LongWord; UserData, Reserved: Pointer): UIntPtr; {$IFDEF MSWINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
119 TTranslateStringProc = function(Translation: Pointer; Identifier, Original: PAnsiChar; Output: PAnsiChar; OutLen: Integer): Integer {$IFDEF MSWINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
120
121 type
122 PExtensionStartupInfo = ^TExtensionStartupInfo;
123 TExtensionStartupInfo = packed record
124 // The size of the structure, in bytes
125 StructSize: LongWord;
126 // Directory where plugin is located (UTF-8 encoded)
127 PluginDir: packed array [0..Pred(EXT_MAX_PATH)] of AnsiChar;
128 // Directory where plugin configuration file must be located (UTF-8 encoded)
129 PluginConfDir: packed array [0..Pred(EXT_MAX_PATH)] of AnsiChar;
130 // Dialog API
131 InputBox: TInputBoxProc;
132 MessageBox: TMessageBoxProc;
133 DialogBoxLFM: TDialogBoxLFMProc;
134 DialogBoxLRS: TDialogBoxLRSProc;
135 DialogBoxLFMFile: TDialogBoxLFMFileProc;
136 SendDlgMsg: TDlgProc;
137 Translation: Pointer;
138 TranslateString: TTranslateStringProc;
139 VersionAPI: UIntPtr;
140 MsgChoiceBox: TMsgChoiceBoxProc;
141 DialogBoxParam: TDialogBoxParamProc;
142 // Reserved for future API extension
143 Reserved: packed array [0..Pred(4091 * SizeOf(Pointer))] of Byte;
144 end;
145
146 type
147 TExtensionInitializeProc = procedure(StartupInfo: PExtensionStartupInfo); {$IFDEF MSWINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
148 TExtensionFinalizeProc = procedure(Reserved: Pointer); {$IFDEF MSWINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
149
150 implementation
151
152 (* Plugin must implement this function for working with Extension API
153
154 procedure ExtensionInitialize(StartupInfo: PExtensionStartupInfo); {$IFDEF MSWINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
155
156 procedure ExtensionFinalize(Reserved: Pointer); {$IFDEF MSWINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
157
158 *)
159
160 end.
161