extension.h 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. #include "common.h"
  2. /* dialog messages */
  3. #define DM_FIRST 0
  4. #define DM_CLOSE DM_FIRST+1 /* A signal that the dialog is about to close */
  5. #define DM_ENABLE DM_FIRST+2
  6. #define DM_GETDLGDATA DM_FIRST+3
  7. #define DM_GETDLGBOUNDS DM_FIRST+4
  8. #define DM_GETITEMBOUNDS DM_FIRST+5
  9. #define DM_GETTEXT DM_FIRST+6 /* Retrieve the text of an edit string or the caption of an item */
  10. #define DM_KEYDOWN DM_FIRST+7
  11. #define DM_KEYUP DM_FIRST+8
  12. #define DM_SETDLGDATA DM_FIRST+9
  13. #define DM_SETFOCUS DM_FIRST+10 /* Set the keyboard focus to the given dialog item */
  14. #define DM_REDRAW DM_FIRST+11 /* Redraw the whole dialog */
  15. #define DM_SETTEXT DM_FIRST+12 /* Set a new string value for an edit line or a new caption for an item */
  16. #define DM_SETMAXTEXTLENGTH DM_FIRST+13 /* Set the maximum length of an edit string */
  17. #define DM_SHOWDIALOG DM_FIRST+14 /* Show/hide the dialog window */
  18. #define DM_SHOWITEM DM_FIRST+15 /* Show/hide a dialog item */
  19. #define DM_GETCHECK DM_FIRST+16 /* Retrieve the state of TCheckBox or TRadioButton items */
  20. #define DM_SETCHECK DM_FIRST+17 /* Change the state of TCheckBox and TRadioButton items */
  21. #define DM_LISTGETITEM DM_FIRST+18 /* Retrieve a list item */
  22. #define DM_LISTGETITEMINDEX DM_FIRST+19 /* Get current item index in a list */
  23. #define DM_LISTSETITEMINDEX DM_FIRST+20 /* Set current item index in a list */
  24. #define DM_LISTDELETE DM_FIRST+21
  25. #define DM_LISTADD DM_FIRST+22
  26. #define DM_LISTADDSTR DM_FIRST+23
  27. #define DM_LISTUPDATE DM_FIRST+24
  28. #define DM_LISTINSERT DM_FIRST+25
  29. #define DM_LISTINDEXOF DM_FIRST+26
  30. #define DM_LISTGETCOUNT DM_FIRST+27
  31. #define DM_LISTGETDATA DM_FIRST+28
  32. #define DM_LISTSETDATA DM_FIRST+29
  33. #define DM_SETDLGBOUNDS DM_FIRST+30
  34. #define DM_SETITEMBOUNDS DM_FIRST+31
  35. #define DM_GETDROPPEDDOWN DM_FIRST+32
  36. #define DM_SETDROPPEDDOWN DM_FIRST+33
  37. #define DM_GETITEMDATA DM_FIRST+34
  38. #define DM_SETITEMDATA DM_FIRST+35
  39. #define DM_LISTSET DM_FIRST+36
  40. #define DM_SETPROGRESSVALUE DM_FIRST+37
  41. #define DM_SETPROGRESSSTYLE DM_FIRST+38
  42. #define DM_SETPASSWORDCHAR DM_FIRST+39
  43. #define DM_LISTCLEAR DM_FIRST+40
  44. #define DM_TIMERSETINTERVAL DM_FIRST+41
  45. /* events messages */
  46. #define DN_FIRST 0x1000
  47. #define DN_CLICK DN_FIRST+1 /* Sent after mouse click */
  48. #define DN_DBLCLICK DN_FIRST+2 /* Sent after mouse double click */
  49. #define DN_CHANGE DN_FIRST+3 /* Sent after the dialog item is changed */
  50. #define DN_GOTFOCUS DN_FIRST+4 /* Sent when the dialog item gets input focus */
  51. #define DN_INITDIALOG DN_FIRST+5 /* Sent before showing the dialog */
  52. #define DN_KILLFOCUS DN_FIRST+6 /* Sent before a dialog item loses the input focus */
  53. #define DN_TIMER DN_FIRST+7 /* Sent when a timer expires */
  54. #define DN_KEYDOWN DM_KEYDOWN
  55. #define DN_KEYUP DM_KEYUP
  56. #define DN_CLOSE DM_CLOSE /* Sent before the dialog is closed */
  57. #define DM_USER 0x4000 /* Starting value for user defined messages */
  58. /* Set/Get Property */
  59. #define TK_STRING 1
  60. #define TK_FLOAT 2
  61. #define TK_INT32 3
  62. #define TK_INT64 4
  63. #define TK_BOOL 5
  64. // MessageBox: To indicate the buttons displayed in the message box,
  65. // specify one of the following values.
  66. #define MB_OK 0x00000000
  67. #define MB_OKCANCEL 0x00000001
  68. #define MB_ABORTRETRYIGNORE 0x00000002
  69. #define MB_YESNOCANCEL 0x00000003
  70. #define MB_YESNO 0x00000004
  71. #define MB_RETRYCANCEL 0x00000005
  72. #define MB_ICONHAND 0x00000010
  73. #define MB_ICONQUESTION 0x00000020
  74. #define MB_ICONEXCLAMATION 0x00000030
  75. #define MB_ICONASTERICK 0x00000040
  76. #define MB_ICONWARNING MB_ICONEXCLAMATION
  77. #define MB_ICONERROR MB_ICONHAND
  78. #define MB_ICONSTOP MB_ICONHAND
  79. #define MB_ICONINFORMATION MB_ICONASTERICK
  80. // MessageBox: To indicate the default button, specify one of the following values.
  81. #define MB_DEFBUTTON1 0x00000000
  82. #define MB_DEFBUTTON2 0x00000100
  83. #define MB_DEFBUTTON3 0x00000200
  84. #define MB_DEFBUTTON4 0x00000300
  85. // MessageBox: Return values
  86. #define ID_OK 1
  87. #define ID_CANCEL 2
  88. #define ID_ABORT 3
  89. #define ID_RETRY 4
  90. #define ID_IGNORE 5
  91. #define ID_YES 6
  92. #define ID_NO 7
  93. #define ID_CLOSE 8
  94. #define ID_HELP 9
  95. // DialogBoxParam: Flags
  96. #define DB_LFM 0 // Data contains a form in the LFM format
  97. #define DB_LRS 1 // Data contains a form in the LRS format
  98. #define DB_FILENAME 2 // Data contains a form file name (*.lfm)
  99. /* other */
  100. #define EXT_MAX_PATH 16384 /* 16 Kb */
  101. /* Dialog window callback function */
  102. typedef intptr_t (DCPCALL *tDlgProc)(uintptr_t pDlg, char* DlgItemName, intptr_t Msg, intptr_t wParam, intptr_t lParam);
  103. /* Definition of callback functions called by the DLL */
  104. typedef BOOL (DCPCALL *tInputBoxProc)(char* Caption, char* Prompt, BOOL MaskInput, char* Value, int ValueMaxLen);
  105. typedef int (DCPCALL *tMessageBoxProc)(char* Text, char* Caption, long Flags);
  106. typedef int (DCPCALL *tMsgChoiceBoxProc)(char* Text, char* Caption, char** Buttons, int BtnDef, int BtnEsc);
  107. typedef BOOL (DCPCALL *tDialogBoxLFMProc)(intptr_t LFMData, unsigned long DataSize, tDlgProc DlgProc);
  108. typedef BOOL (DCPCALL *tDialogBoxLRSProc)(intptr_t LRSData, unsigned long DataSize, tDlgProc DlgProc);
  109. typedef BOOL (DCPCALL *tDialogBoxLFMFileProc)(char* LFMFileName, tDlgProc DlgProc);
  110. typedef uintptr_t (DCPCALL *tDialogBoxParamProc)(void* Data, uint32_t DataSize, tDlgProc DlgProc, uint32_t Flags, void *UserData, void* Reserved);
  111. typedef int (DCPCALL *tTranslateStringProc)(void *Translation, const char *Identifier, const char *Original, char *Output, int OutLen);
  112. typedef intptr_t (DCPCALL *tSetProperty)(uintptr_t pDlg, const char* DlgItemName, const char *PropName, void *PropValue, int PropType);
  113. typedef intptr_t (DCPCALL *tGetProperty)(uintptr_t pDlg, const char* DlgItemName, const char *PropName, void *PropValue, int PropType, int PropSize);
  114. typedef uintptr_t (DCPCALL *tCreateComponent)(uintptr_t pDlg, const char* Parent, const char* DlgItemName, const char* DlgItemClass, void* Reserved);
  115. #pragma pack(push)
  116. #pragma pack(1)
  117. typedef struct {
  118. uint32_t StructSize;
  119. char PluginDir[EXT_MAX_PATH];
  120. char PluginConfDir[EXT_MAX_PATH];
  121. tInputBoxProc InputBox;
  122. tMessageBoxProc MessageBox;
  123. tDialogBoxLFMProc DialogBoxLFM;
  124. tDialogBoxLRSProc DialogBoxLRS;
  125. tDialogBoxLFMFileProc DialogBoxLFMFile;
  126. tDlgProc SendDlgMsg;
  127. void *Translation;
  128. tTranslateStringProc TranslateString;
  129. uintptr_t VersionAPI;
  130. tMsgChoiceBoxProc MsgChoiceBox;
  131. tDialogBoxParamProc DialogBoxParam;
  132. tSetProperty SetProperty;
  133. tGetProperty GetProperty;
  134. tCreateComponent CreateComponent;
  135. char LanguageID[16];
  136. unsigned char Reserved[4086 * sizeof(void *)];
  137. } tExtensionStartupInfo;
  138. #pragma pack(pop)
  139. typedef void (DCPCALL tExtensionInitializeProc)(tExtensionStartupInfo* StartupInfo);
  140. typedef void (DCPCALL tExtensionFinalizeProc)(void* Reserved);
  141. /* Plugin must implement this function for working with Extension API
  142. void DCPCALL ExtensionInitialize(tExtensionStartupInfo* StartupInfo);
  143. void DCPCALL ExtensionFinalize(void* Reserved);
  144. */