iup.nim 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958
  1. #
  2. #
  3. # Nim's Runtime Library
  4. # (c) Copyright 2012 Andreas Rumpf
  5. #
  6. # See the file "copying.txt", included in this
  7. # distribution, for details about the copyright.
  8. #
  9. # C header files translated by hand
  10. # Licence of IUP follows:
  11. # ****************************************************************************
  12. # Copyright (C) 1994-2009 Tecgraf, PUC-Rio.
  13. #
  14. # Permission is hereby granted, free of charge, to any person obtaining
  15. # a copy of this software and associated documentation files (the
  16. # "Software"), to deal in the Software without restriction, including
  17. # without limitation the rights to use, copy, modify, merge, publish,
  18. # distribute, sublicense, and/or sell copies of the Software, and to
  19. # permit persons to whom the Software is furnished to do so, subject to
  20. # the following conditions:
  21. #
  22. # The above copyright notice and this permission notice shall be
  23. # included in all copies or substantial portions of the Software.
  24. #
  25. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  26. # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  27. # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  28. # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  29. # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  30. # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  31. # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  32. # ****************************************************************************
  33. {.deadCodeElim: on.} # dce option deprecated
  34. when defined(windows):
  35. const dllname = "iup(|30|27|26|25|24).dll"
  36. elif defined(macosx):
  37. const dllname = "libiup(|3.0|2.7|2.6|2.5|2.4).dylib"
  38. else:
  39. const dllname = "libiup(|3.0|2.7|2.6|2.5|2.4).so(|.1)"
  40. const
  41. IUP_NAME* = "IUP - Portable User Interface"
  42. IUP_COPYRIGHT* = "Copyright (C) 1994-2009 Tecgraf, PUC-Rio."
  43. IUP_DESCRIPTION* = "Portable toolkit for building graphical user interfaces."
  44. constIUP_VERSION* = "3.0"
  45. constIUP_VERSION_NUMBER* = 300000
  46. constIUP_VERSION_DATE* = "2009/07/18"
  47. type
  48. Ihandle = object
  49. PIhandle* = ptr Ihandle
  50. Icallback* = proc (arg: PIhandle): cint {.cdecl.}
  51. # pre-defineded dialogs
  52. proc fileDlg*: PIhandle {.importc: "IupFileDlg", dynlib: dllname, cdecl.}
  53. proc messageDlg*: PIhandle {.importc: "IupMessageDlg", dynlib: dllname, cdecl.}
  54. proc colorDlg*: PIhandle {.importc: "IupColorDlg", dynlib: dllname, cdecl.}
  55. proc fontDlg*: PIhandle {.importc: "IupFontDlg", dynlib: dllname, cdecl.}
  56. proc getFile*(arq: cstring): cint {.
  57. importc: "IupGetFile", dynlib: dllname, cdecl.}
  58. proc message*(title, msg: cstring) {.
  59. importc: "IupMessage", dynlib: dllname, cdecl.}
  60. proc messagef*(title, format: cstring) {.
  61. importc: "IupMessagef", dynlib: dllname, cdecl, varargs.}
  62. proc alarm*(title, msg, b1, b2, b3: cstring): cint {.
  63. importc: "IupAlarm", dynlib: dllname, cdecl.}
  64. proc scanf*(format: cstring): cint {.
  65. importc: "IupScanf", dynlib: dllname, cdecl, varargs.}
  66. proc listDialog*(theType: cint, title: cstring, size: cint,
  67. list: cstringArray, op, maxCol, maxLin: cint,
  68. marks: ptr cint): cint {.
  69. importc: "IupListDialog", dynlib: dllname, cdecl.}
  70. proc getText*(title, text: cstring): cint {.
  71. importc: "IupGetText", dynlib: dllname, cdecl.}
  72. proc getColor*(x, y: cint, r, g, b: var byte): cint {.
  73. importc: "IupGetColor", dynlib: dllname, cdecl.}
  74. type
  75. Iparamcb* = proc (dialog: PIhandle, paramIndex: cint,
  76. userData: pointer): cint {.cdecl.}
  77. proc getParam*(title: cstring, action: Iparamcb, userData: pointer,
  78. format: cstring): cint {.
  79. importc: "IupGetParam", cdecl, varargs, dynlib: dllname.}
  80. proc getParamv*(title: cstring, action: Iparamcb, userData: pointer,
  81. format: cstring, paramCount, paramExtra: cint,
  82. paramData: pointer): cint {.
  83. importc: "IupGetParamv", cdecl, dynlib: dllname.}
  84. # Functions
  85. proc open*(argc: ptr cint, argv: ptr cstringArray): cint {.
  86. importc: "IupOpen", cdecl, dynlib: dllname.}
  87. proc close*() {.importc: "IupClose", cdecl, dynlib: dllname.}
  88. proc imageLibOpen*() {.importc: "IupImageLibOpen", cdecl, dynlib: dllname.}
  89. proc mainLoop*(): cint {.importc: "IupMainLoop", cdecl, dynlib: dllname,
  90. discardable.}
  91. proc loopStep*(): cint {.importc: "IupLoopStep", cdecl, dynlib: dllname,
  92. discardable.}
  93. proc mainLoopLevel*(): cint {.importc: "IupMainLoopLevel", cdecl,
  94. dynlib: dllname, discardable.}
  95. proc flush*() {.importc: "IupFlush", cdecl, dynlib: dllname.}
  96. proc exitLoop*() {.importc: "IupExitLoop", cdecl, dynlib: dllname.}
  97. proc update*(ih: PIhandle) {.importc: "IupUpdate", cdecl, dynlib: dllname.}
  98. proc updateChildren*(ih: PIhandle) {.importc: "IupUpdateChildren", cdecl, dynlib: dllname.}
  99. proc redraw*(ih: PIhandle, children: cint) {.importc: "IupRedraw", cdecl, dynlib: dllname.}
  100. proc refresh*(ih: PIhandle) {.importc: "IupRefresh", cdecl, dynlib: dllname.}
  101. proc mapFont*(iupfont: cstring): cstring {.importc: "IupMapFont", cdecl, dynlib: dllname.}
  102. proc unMapFont*(driverfont: cstring): cstring {.importc: "IupUnMapFont", cdecl, dynlib: dllname.}
  103. proc help*(url: cstring): cint {.importc: "IupHelp", cdecl, dynlib: dllname.}
  104. proc load*(filename: cstring): cstring {.importc: "IupLoad", cdecl, dynlib: dllname.}
  105. proc iupVersion*(): cstring {.importc: "IupVersion", cdecl, dynlib: dllname.}
  106. proc iupVersionDate*(): cstring {.importc: "IupVersionDate", cdecl, dynlib: dllname.}
  107. proc iupVersionNumber*(): cint {.importc: "IupVersionNumber", cdecl, dynlib: dllname.}
  108. proc setLanguage*(lng: cstring) {.importc: "IupSetLanguage", cdecl, dynlib: dllname.}
  109. proc getLanguage*(): cstring {.importc: "IupGetLanguage", cdecl, dynlib: dllname.}
  110. proc destroy*(ih: PIhandle) {.importc: "IupDestroy", cdecl, dynlib: dllname.}
  111. proc detach*(child: PIhandle) {.importc: "IupDetach", cdecl, dynlib: dllname.}
  112. proc append*(ih, child: PIhandle): PIhandle {.
  113. importc: "IupAppend", cdecl, dynlib: dllname, discardable.}
  114. proc insert*(ih, refChild, child: PIhandle): PIhandle {.
  115. importc: "IupInsert", cdecl, dynlib: dllname, discardable.}
  116. proc getChild*(ih: PIhandle, pos: cint): PIhandle {.
  117. importc: "IupGetChild", cdecl, dynlib: dllname.}
  118. proc getChildPos*(ih, child: PIhandle): cint {.
  119. importc: "IupGetChildPos", cdecl, dynlib: dllname.}
  120. proc getChildCount*(ih: PIhandle): cint {.
  121. importc: "IupGetChildCount", cdecl, dynlib: dllname.}
  122. proc getNextChild*(ih, child: PIhandle): PIhandle {.
  123. importc: "IupGetNextChild", cdecl, dynlib: dllname.}
  124. proc getBrother*(ih: PIhandle): PIhandle {.
  125. importc: "IupGetBrother", cdecl, dynlib: dllname.}
  126. proc getParent*(ih: PIhandle): PIhandle {.
  127. importc: "IupGetParent", cdecl, dynlib: dllname.}
  128. proc getDialog*(ih: PIhandle): PIhandle {.
  129. importc: "IupGetDialog", cdecl, dynlib: dllname.}
  130. proc getDialogChild*(ih: PIhandle, name: cstring): PIhandle {.
  131. importc: "IupGetDialogChild", cdecl, dynlib: dllname.}
  132. proc reparent*(ih, newParent: PIhandle): cint {.
  133. importc: "IupReparent", cdecl, dynlib: dllname.}
  134. proc popup*(ih: PIhandle, x, y: cint): cint {.
  135. importc: "IupPopup", cdecl, dynlib: dllname, discardable.}
  136. proc show*(ih: PIhandle): cint {.
  137. importc: "IupShow", cdecl, dynlib: dllname, discardable.}
  138. proc showXY*(ih: PIhandle, x, y: cint): cint {.
  139. importc: "IupShowXY", cdecl, dynlib: dllname, discardable.}
  140. proc hide*(ih: PIhandle): cint {.
  141. importc: "IupHide", cdecl, dynlib: dllname, discardable.}
  142. proc map*(ih: PIhandle): cint {.
  143. importc: "IupMap", cdecl, dynlib: dllname, discardable.}
  144. proc unmap*(ih: PIhandle) {.
  145. importc: "IupUnmap", cdecl, dynlib: dllname, discardable.}
  146. proc setAttribute*(ih: PIhandle, name, value: cstring) {.
  147. importc: "IupSetAttribute", cdecl, dynlib: dllname.}
  148. proc storeAttribute*(ih: PIhandle, name, value: cstring) {.
  149. importc: "IupStoreAttribute", cdecl, dynlib: dllname.}
  150. proc setAttributes*(ih: PIhandle, str: cstring): PIhandle {.
  151. importc: "IupSetAttributes", cdecl, dynlib: dllname.}
  152. proc getAttribute*(ih: PIhandle, name: cstring): cstring {.
  153. importc: "IupGetAttribute", cdecl, dynlib: dllname.}
  154. proc getAttributes*(ih: PIhandle): cstring {.
  155. importc: "IupGetAttributes", cdecl, dynlib: dllname.}
  156. proc getInt*(ih: PIhandle, name: cstring): cint {.
  157. importc: "IupGetInt", cdecl, dynlib: dllname.}
  158. proc getInt2*(ih: PIhandle, name: cstring): cint {.
  159. importc: "IupGetInt2", cdecl, dynlib: dllname.}
  160. proc getIntInt*(ih: PIhandle, name: cstring, i1, i2: var cint): cint {.
  161. importc: "IupGetIntInt", cdecl, dynlib: dllname.}
  162. proc getFloat*(ih: PIhandle, name: cstring): cfloat {.
  163. importc: "IupGetFloat", cdecl, dynlib: dllname.}
  164. proc setfAttribute*(ih: PIhandle, name, format: cstring) {.
  165. importc: "IupSetfAttribute", cdecl, dynlib: dllname, varargs.}
  166. proc getAllAttributes*(ih: PIhandle, names: cstringArray, n: cint): cint {.
  167. importc: "IupGetAllAttributes", cdecl, dynlib: dllname.}
  168. proc setAtt*(handleName: cstring, ih: PIhandle, name: cstring): PIhandle {.
  169. importc: "IupSetAtt", cdecl, dynlib: dllname, varargs, discardable.}
  170. proc setGlobal*(name, value: cstring) {.
  171. importc: "IupSetGlobal", cdecl, dynlib: dllname.}
  172. proc storeGlobal*(name, value: cstring) {.
  173. importc: "IupStoreGlobal", cdecl, dynlib: dllname.}
  174. proc getGlobal*(name: cstring): cstring {.
  175. importc: "IupGetGlobal", cdecl, dynlib: dllname.}
  176. proc setFocus*(ih: PIhandle): PIhandle {.
  177. importc: "IupSetFocus", cdecl, dynlib: dllname.}
  178. proc getFocus*(): PIhandle {.
  179. importc: "IupGetFocus", cdecl, dynlib: dllname.}
  180. proc previousField*(ih: PIhandle): PIhandle {.
  181. importc: "IupPreviousField", cdecl, dynlib: dllname.}
  182. proc nextField*(ih: PIhandle): PIhandle {.
  183. importc: "IupNextField", cdecl, dynlib: dllname.}
  184. proc getCallback*(ih: PIhandle, name: cstring): Icallback {.
  185. importc: "IupGetCallback", cdecl, dynlib: dllname.}
  186. proc setCallback*(ih: PIhandle, name: cstring, fn: Icallback): Icallback {.
  187. importc: "IupSetCallback", cdecl, dynlib: dllname, discardable.}
  188. proc setCallbacks*(ih: PIhandle, name: cstring, fn: Icallback): PIhandle {.
  189. importc: "IupSetCallbacks", cdecl, dynlib: dllname, varargs, discardable.}
  190. proc getFunction*(name: cstring): Icallback {.
  191. importc: "IupGetFunction", cdecl, dynlib: dllname.}
  192. proc setFunction*(name: cstring, fn: Icallback): Icallback {.
  193. importc: "IupSetFunction", cdecl, dynlib: dllname, discardable.}
  194. proc getActionName*(): cstring {.
  195. importc: "IupGetActionName", cdecl, dynlib: dllname.}
  196. proc getHandle*(name: cstring): PIhandle {.
  197. importc: "IupGetHandle", cdecl, dynlib: dllname.}
  198. proc setHandle*(name: cstring, ih: PIhandle): PIhandle {.
  199. importc: "IupSetHandle", cdecl, dynlib: dllname.}
  200. proc getAllNames*(names: cstringArray, n: cint): cint {.
  201. importc: "IupGetAllNames", cdecl, dynlib: dllname.}
  202. proc getAllDialogs*(names: cstringArray, n: cint): cint {.
  203. importc: "IupGetAllDialogs", cdecl, dynlib: dllname.}
  204. proc getName*(ih: PIhandle): cstring {.
  205. importc: "IupGetName", cdecl, dynlib: dllname.}
  206. proc setAttributeHandle*(ih: PIhandle, name: cstring, ihNamed: PIhandle) {.
  207. importc: "IupSetAttributeHandle", cdecl, dynlib: dllname.}
  208. proc getAttributeHandle*(ih: PIhandle, name: cstring): PIhandle {.
  209. importc: "IupGetAttributeHandle", cdecl, dynlib: dllname.}
  210. proc getClassName*(ih: PIhandle): cstring {.
  211. importc: "IupGetClassName", cdecl, dynlib: dllname.}
  212. proc getClassType*(ih: PIhandle): cstring {.
  213. importc: "IupGetClassType", cdecl, dynlib: dllname.}
  214. proc getClassAttributes*(classname: cstring, names: cstringArray,
  215. n: cint): cint {.
  216. importc: "IupGetClassAttributes", cdecl, dynlib: dllname.}
  217. proc saveClassAttributes*(ih: PIhandle) {.
  218. importc: "IupSaveClassAttributes", cdecl, dynlib: dllname.}
  219. proc setClassDefaultAttribute*(classname, name, value: cstring) {.
  220. importc: "IupSetClassDefaultAttribute", cdecl, dynlib: dllname.}
  221. proc create*(classname: cstring): PIhandle {.
  222. importc: "IupCreate", cdecl, dynlib: dllname.}
  223. proc createv*(classname: cstring, params: pointer): PIhandle {.
  224. importc: "IupCreatev", cdecl, dynlib: dllname.}
  225. proc createp*(classname: cstring, first: pointer): PIhandle {.
  226. importc: "IupCreatep", cdecl, dynlib: dllname, varargs.}
  227. proc fill*(): PIhandle {.importc: "IupFill", cdecl, dynlib: dllname.}
  228. proc radio*(child: PIhandle): PIhandle {.
  229. importc: "IupRadio", cdecl, dynlib: dllname.}
  230. proc vbox*(child: PIhandle): PIhandle {.
  231. importc: "IupVbox", cdecl, dynlib: dllname, varargs.}
  232. proc vboxv*(children: ptr PIhandle): PIhandle {.
  233. importc: "IupVboxv", cdecl, dynlib: dllname.}
  234. proc zbox*(child: PIhandle): PIhandle {.
  235. importc: "IupZbox", cdecl, dynlib: dllname, varargs.}
  236. proc zboxv*(children: ptr PIhandle): PIhandle {.
  237. importc: "IupZboxv", cdecl, dynlib: dllname.}
  238. proc hbox*(child: PIhandle): PIhandle {.
  239. importc: "IupHbox", cdecl, dynlib: dllname, varargs.}
  240. proc hboxv*(children: ptr PIhandle): PIhandle {.
  241. importc: "IupHboxv", cdecl, dynlib: dllname.}
  242. proc normalizer*(ihFirst: PIhandle): PIhandle {.
  243. importc: "IupNormalizer", cdecl, dynlib: dllname, varargs.}
  244. proc normalizerv*(ihList: ptr PIhandle): PIhandle {.
  245. importc: "IupNormalizerv", cdecl, dynlib: dllname.}
  246. proc cbox*(child: PIhandle): PIhandle {.
  247. importc: "IupCbox", cdecl, dynlib: dllname, varargs.}
  248. proc cboxv*(children: ptr PIhandle): PIhandle {.
  249. importc: "IupCboxv", cdecl, dynlib: dllname.}
  250. proc sbox*(child: PIhandle): PIhandle {.
  251. importc: "IupSbox", cdecl, dynlib: dllname.}
  252. proc frame*(child: PIhandle): PIhandle {.
  253. importc: "IupFrame", cdecl, dynlib: dllname.}
  254. proc image*(width, height: cint, pixmap: pointer): PIhandle {.
  255. importc: "IupImage", cdecl, dynlib: dllname.}
  256. proc imageRGB*(width, height: cint, pixmap: pointer): PIhandle {.
  257. importc: "IupImageRGB", cdecl, dynlib: dllname.}
  258. proc imageRGBA*(width, height: cint, pixmap: pointer): PIhandle {.
  259. importc: "IupImageRGBA", cdecl, dynlib: dllname.}
  260. proc item*(title, action: cstring): PIhandle {.
  261. importc: "IupItem", cdecl, dynlib: dllname.}
  262. proc submenu*(title: cstring, child: PIhandle): PIhandle {.
  263. importc: "IupSubmenu", cdecl, dynlib: dllname.}
  264. proc separator*(): PIhandle {.
  265. importc: "IupSeparator", cdecl, dynlib: dllname.}
  266. proc menu*(child: PIhandle): PIhandle {.
  267. importc: "IupMenu", cdecl, dynlib: dllname, varargs.}
  268. proc menuv*(children: ptr PIhandle): PIhandle {.
  269. importc: "IupMenuv", cdecl, dynlib: dllname.}
  270. proc button*(title, action: cstring): PIhandle {.
  271. importc: "IupButton", cdecl, dynlib: dllname.}
  272. proc link*(url, title: cstring): PIhandle {.
  273. importc: "IupLink", cdecl, dynlib: dllname.}
  274. proc canvas*(action: cstring): PIhandle {.
  275. importc: "IupCanvas", cdecl, dynlib: dllname.}
  276. proc dialog*(child: PIhandle): PIhandle {.
  277. importc: "IupDialog", cdecl, dynlib: dllname.}
  278. proc user*(): PIhandle {.
  279. importc: "IupUser", cdecl, dynlib: dllname.}
  280. proc label*(title: cstring): PIhandle {.
  281. importc: "IupLabel", cdecl, dynlib: dllname.}
  282. proc list*(action: cstring): PIhandle {.
  283. importc: "IupList", cdecl, dynlib: dllname.}
  284. proc text*(action: cstring): PIhandle {.
  285. importc: "IupText", cdecl, dynlib: dllname.}
  286. proc multiLine*(action: cstring): PIhandle {.
  287. importc: "IupMultiLine", cdecl, dynlib: dllname.}
  288. proc toggle*(title, action: cstring): PIhandle {.
  289. importc: "IupToggle", cdecl, dynlib: dllname.}
  290. proc timer*(): PIhandle {.
  291. importc: "IupTimer", cdecl, dynlib: dllname.}
  292. proc progressBar*(): PIhandle {.
  293. importc: "IupProgressBar", cdecl, dynlib: dllname.}
  294. proc val*(theType: cstring): PIhandle {.
  295. importc: "IupVal", cdecl, dynlib: dllname.}
  296. proc tabs*(child: PIhandle): PIhandle {.
  297. importc: "IupTabs", cdecl, dynlib: dllname, varargs.}
  298. proc tabsv*(children: ptr PIhandle): PIhandle {.
  299. importc: "IupTabsv", cdecl, dynlib: dllname.}
  300. proc tree*(): PIhandle {.importc: "IupTree", cdecl, dynlib: dllname.}
  301. proc spin*(): PIhandle {.importc: "IupSpin", cdecl, dynlib: dllname.}
  302. proc spinbox*(child: PIhandle): PIhandle {.
  303. importc: "IupSpinbox", cdecl, dynlib: dllname.}
  304. # IupText utilities
  305. proc textConvertLinColToPos*(ih: PIhandle, lin, col: cint, pos: var cint) {.
  306. importc: "IupTextConvertLinColToPos", cdecl, dynlib: dllname.}
  307. proc textConvertPosToLinCol*(ih: PIhandle, pos: cint, lin, col: var cint) {.
  308. importc: "IupTextConvertPosToLinCol", cdecl, dynlib: dllname.}
  309. proc convertXYToPos*(ih: PIhandle, x, y: cint): cint {.
  310. importc: "IupConvertXYToPos", cdecl, dynlib: dllname.}
  311. # IupTree utilities
  312. proc treeSetUserId*(ih: PIhandle, id: cint, userid: pointer): cint {.
  313. importc: "IupTreeSetUserId", cdecl, dynlib: dllname, discardable.}
  314. proc treeGetUserId*(ih: PIhandle, id: cint): pointer {.
  315. importc: "IupTreeGetUserId", cdecl, dynlib: dllname.}
  316. proc treeGetId*(ih: PIhandle, userid: pointer): cint {.
  317. importc: "IupTreeGetId", cdecl, dynlib: dllname.}
  318. proc treeSetAttribute*(ih: PIhandle, name: cstring, id: cint, value: cstring) {.
  319. importc: "IupTreeSetAttribute", cdecl, dynlib: dllname.}
  320. proc treeStoreAttribute*(ih: PIhandle, name: cstring, id: cint, value: cstring) {.
  321. importc: "IupTreeStoreAttribute", cdecl, dynlib: dllname.}
  322. proc treeGetAttribute*(ih: PIhandle, name: cstring, id: cint): cstring {.
  323. importc: "IupTreeGetAttribute", cdecl, dynlib: dllname.}
  324. proc treeGetInt*(ih: PIhandle, name: cstring, id: cint): cint {.
  325. importc: "IupTreeGetInt", cdecl, dynlib: dllname.}
  326. proc treeGetFloat*(ih: PIhandle, name: cstring, id: cint): cfloat {.
  327. importc: "IupTreeGetFloat", cdecl, dynlib: dllname.}
  328. proc treeSetfAttribute*(ih: PIhandle, name: cstring, id: cint, format: cstring) {.
  329. importc: "IupTreeSetfAttribute", cdecl, dynlib: dllname, varargs.}
  330. # Common Return Values
  331. const
  332. IUP_ERROR* = cint(1)
  333. IUP_NOERROR* = cint(0)
  334. IUP_OPENED* = cint(-1)
  335. IUP_INVALID* = cint(-1)
  336. # Callback Return Values
  337. IUP_IGNORE* = cint(-1)
  338. IUP_DEFAULT* = cint(-2)
  339. IUP_CLOSE* = cint(-3)
  340. IUP_CONTINUE* = cint(-4)
  341. # IupPopup and IupShowXY Parameter Values
  342. IUP_CENTER* = cint(0xFFFF)
  343. IUP_LEFT* = cint(0xFFFE)
  344. IUP_RIGHT* = cint(0xFFFD)
  345. IUP_MOUSEPOS* = cint(0xFFFC)
  346. IUP_CURRENT* = cint(0xFFFB)
  347. IUP_CENTERPARENT* = cint(0xFFFA)
  348. IUP_TOP* = IUP_LEFT
  349. IUP_BOTTOM* = IUP_RIGHT
  350. # SHOW_CB Callback Values
  351. IUP_SHOW* = cint(0)
  352. IUP_RESTORE* = cint(1)
  353. IUP_MINIMIZE* = cint(2)
  354. IUP_MAXIMIZE* = cint(3)
  355. IUP_HIDE* = cint(4)
  356. # SCROLL_CB Callback Values
  357. IUP_SBUP* = cint(0)
  358. IUP_SBDN* = cint(1)
  359. IUP_SBPGUP* = cint(2)
  360. IUP_SBPGDN* = cint(3)
  361. IUP_SBPOSV* = cint(4)
  362. IUP_SBDRAGV* = cint(5)
  363. IUP_SBLEFT* = cint(6)
  364. IUP_SBRIGHT* = cint(7)
  365. IUP_SBPGLEFT* = cint(8)
  366. IUP_SBPGRIGHT* = cint(9)
  367. IUP_SBPOSH* = cint(10)
  368. IUP_SBDRAGH* = cint(11)
  369. # Mouse Button Values and Macros
  370. IUP_BUTTON1* = cint(ord('1'))
  371. IUP_BUTTON2* = cint(ord('2'))
  372. IUP_BUTTON3* = cint(ord('3'))
  373. IUP_BUTTON4* = cint(ord('4'))
  374. IUP_BUTTON5* = cint(ord('5'))
  375. proc isShift*(s: cstring): bool = return s[0] == 'S'
  376. proc isControl*(s: cstring): bool = return s[1] == 'C'
  377. proc isButton1*(s: cstring): bool = return s[2] == '1'
  378. proc isButton2*(s: cstring): bool = return s[3] == '2'
  379. proc isbutton3*(s: cstring): bool = return s[4] == '3'
  380. proc isDouble*(s: cstring): bool = return s[5] == 'D'
  381. proc isAlt*(s: cstring): bool = return s[6] == 'A'
  382. proc isSys*(s: cstring): bool = return s[7] == 'Y'
  383. proc isButton4*(s: cstring): bool = return s[8] == '4'
  384. proc isButton5*(s: cstring): bool = return s[9] == '5'
  385. # Pre-Defined Masks
  386. const
  387. IUP_MASK_FLOAT* = "[+/-]?(/d+/.?/d*|/./d+)"
  388. IUP_MASK_UFLOAT* = "(/d+/.?/d*|/./d+)"
  389. IUP_MASK_EFLOAT* = "[+/-]?(/d+/.?/d*|/./d+)([eE][+/-]?/d+)?"
  390. IUP_MASK_INT* = "[+/-]?/d+"
  391. IUP_MASK_UINT* = "/d+"
  392. # from 32 to 126, all character sets are equal,
  393. # the key code i the same as the character code.
  394. const
  395. K_SP* = cint(ord(' '))
  396. K_exclam* = cint(ord('!'))
  397. K_quotedbl* = cint(ord('\"'))
  398. K_numbersign* = cint(ord('#'))
  399. K_dollar* = cint(ord('$'))
  400. K_percent* = cint(ord('%'))
  401. K_ampersand* = cint(ord('&'))
  402. K_apostrophe* = cint(ord('\''))
  403. K_parentleft* = cint(ord('('))
  404. K_parentright* = cint(ord(')'))
  405. K_asterisk* = cint(ord('*'))
  406. K_plus* = cint(ord('+'))
  407. K_comma* = cint(ord(','))
  408. K_minus* = cint(ord('-'))
  409. K_period* = cint(ord('.'))
  410. K_slash* = cint(ord('/'))
  411. K_0* = cint(ord('0'))
  412. K_1* = cint(ord('1'))
  413. K_2* = cint(ord('2'))
  414. K_3* = cint(ord('3'))
  415. K_4* = cint(ord('4'))
  416. K_5* = cint(ord('5'))
  417. K_6* = cint(ord('6'))
  418. K_7* = cint(ord('7'))
  419. K_8* = cint(ord('8'))
  420. K_9* = cint(ord('9'))
  421. K_colon* = cint(ord(':'))
  422. K_semicolon* = cint(ord(';'))
  423. K_less* = cint(ord('<'))
  424. K_equal* = cint(ord('='))
  425. K_greater* = cint(ord('>'))
  426. K_question* = cint(ord('?'))
  427. K_at* = cint(ord('@'))
  428. K_upperA* = cint(ord('A'))
  429. K_upperB* = cint(ord('B'))
  430. K_upperC* = cint(ord('C'))
  431. K_upperD* = cint(ord('D'))
  432. K_upperE* = cint(ord('E'))
  433. K_upperF* = cint(ord('F'))
  434. K_upperG* = cint(ord('G'))
  435. K_upperH* = cint(ord('H'))
  436. K_upperI* = cint(ord('I'))
  437. K_upperJ* = cint(ord('J'))
  438. K_upperK* = cint(ord('K'))
  439. K_upperL* = cint(ord('L'))
  440. K_upperM* = cint(ord('M'))
  441. K_upperN* = cint(ord('N'))
  442. K_upperO* = cint(ord('O'))
  443. K_upperP* = cint(ord('P'))
  444. K_upperQ* = cint(ord('Q'))
  445. K_upperR* = cint(ord('R'))
  446. K_upperS* = cint(ord('S'))
  447. K_upperT* = cint(ord('T'))
  448. K_upperU* = cint(ord('U'))
  449. K_upperV* = cint(ord('V'))
  450. K_upperW* = cint(ord('W'))
  451. K_upperX* = cint(ord('X'))
  452. K_upperY* = cint(ord('Y'))
  453. K_upperZ* = cint(ord('Z'))
  454. K_bracketleft* = cint(ord('['))
  455. K_backslash* = cint(ord('\\'))
  456. K_bracketright* = cint(ord(']'))
  457. K_circum* = cint(ord('^'))
  458. K_underscore* = cint(ord('_'))
  459. K_grave* = cint(ord('`'))
  460. K_lowera* = cint(ord('a'))
  461. K_lowerb* = cint(ord('b'))
  462. K_lowerc* = cint(ord('c'))
  463. K_lowerd* = cint(ord('d'))
  464. K_lowere* = cint(ord('e'))
  465. K_lowerf* = cint(ord('f'))
  466. K_lowerg* = cint(ord('g'))
  467. K_lowerh* = cint(ord('h'))
  468. K_loweri* = cint(ord('i'))
  469. K_lowerj* = cint(ord('j'))
  470. K_lowerk* = cint(ord('k'))
  471. K_lowerl* = cint(ord('l'))
  472. K_lowerm* = cint(ord('m'))
  473. K_lowern* = cint(ord('n'))
  474. K_lowero* = cint(ord('o'))
  475. K_lowerp* = cint(ord('p'))
  476. K_lowerq* = cint(ord('q'))
  477. K_lowerr* = cint(ord('r'))
  478. K_lowers* = cint(ord('s'))
  479. K_lowert* = cint(ord('t'))
  480. K_loweru* = cint(ord('u'))
  481. K_lowerv* = cint(ord('v'))
  482. K_lowerw* = cint(ord('w'))
  483. K_lowerx* = cint(ord('x'))
  484. K_lowery* = cint(ord('y'))
  485. K_lowerz* = cint(ord('z'))
  486. K_braceleft* = cint(ord('{'))
  487. K_bar* = cint(ord('|'))
  488. K_braceright* = cint(ord('}'))
  489. K_tilde* = cint(ord('~'))
  490. proc isPrint*(c: cint): bool = return c > 31 and c < 127
  491. # also define the escape sequences that have keys associated
  492. const
  493. K_BS* = cint(ord('\b'))
  494. K_TAB* = cint(ord('\t'))
  495. K_LF* = cint(10)
  496. K_CR* = cint(13)
  497. # IUP Extended Key Codes, range start at 128
  498. # Modifiers use 256 interval
  499. # These key code definitions are specific to IUP
  500. proc isXkey*(c: cint): bool = return c > 128
  501. proc isShiftXkey*(c: cint): bool = return c > 256 and c < 512
  502. proc isCtrlXkey*(c: cint): bool = return c > 512 and c < 768
  503. proc isAltXkey*(c: cint): bool = return c > 768 and c < 1024
  504. proc isSysXkey*(c: cint): bool = return c > 1024 and c < 1280
  505. proc iUPxCODE*(c: cint): cint = return c + cint(128) # Normal (must be above 128)
  506. proc iUPsxCODE*(c: cint): cint =
  507. return c + cint(256)
  508. # Shift (must have range to include the standard keys and the normal
  509. # extended keys, so must be above 256
  510. proc iUPcxCODE*(c: cint): cint = return c + cint(512) # Ctrl
  511. proc iUPmxCODE*(c: cint): cint = return c + cint(768) # Alt
  512. proc iUPyxCODE*(c: cint): cint = return c + cint(1024) # Sys (Win or Apple)
  513. const
  514. IUP_NUMMAXCODES* = 1280 ## 5*256=1280 Normal+Shift+Ctrl+Alt+Sys
  515. K_HOME* = iUPxCODE(1)
  516. K_UP* = iUPxCODE(2)
  517. K_PGUP* = iUPxCODE(3)
  518. K_LEFT* = iUPxCODE(4)
  519. K_MIDDLE* = iUPxCODE(5)
  520. K_RIGHT* = iUPxCODE(6)
  521. K_END* = iUPxCODE(7)
  522. K_DOWN* = iUPxCODE(8)
  523. K_PGDN* = iUPxCODE(9)
  524. K_INS* = iUPxCODE(10)
  525. K_DEL* = iUPxCODE(11)
  526. K_PAUSE* = iUPxCODE(12)
  527. K_ESC* = iUPxCODE(13)
  528. K_ccedilla* = iUPxCODE(14)
  529. K_F1* = iUPxCODE(15)
  530. K_F2* = iUPxCODE(16)
  531. K_F3* = iUPxCODE(17)
  532. K_F4* = iUPxCODE(18)
  533. K_F5* = iUPxCODE(19)
  534. K_F6* = iUPxCODE(20)
  535. K_F7* = iUPxCODE(21)
  536. K_F8* = iUPxCODE(22)
  537. K_F9* = iUPxCODE(23)
  538. K_F10* = iUPxCODE(24)
  539. K_F11* = iUPxCODE(25)
  540. K_F12* = iUPxCODE(26)
  541. K_Print* = iUPxCODE(27)
  542. K_Menu* = iUPxCODE(28)
  543. K_acute* = iUPxCODE(29) # no Shift/Ctrl/Alt
  544. K_sHOME* = iUPsxCODE(K_HOME)
  545. K_sUP* = iUPsxCODE(K_UP)
  546. K_sPGUP* = iUPsxCODE(K_PGUP)
  547. K_sLEFT* = iUPsxCODE(K_LEFT)
  548. K_sMIDDLE* = iUPsxCODE(K_MIDDLE)
  549. K_sRIGHT* = iUPsxCODE(K_RIGHT)
  550. K_sEND* = iUPsxCODE(K_END)
  551. K_sDOWN* = iUPsxCODE(K_DOWN)
  552. K_sPGDN* = iUPsxCODE(K_PGDN)
  553. K_sINS* = iUPsxCODE(K_INS)
  554. K_sDEL* = iUPsxCODE(K_DEL)
  555. K_sSP* = iUPsxCODE(K_SP)
  556. K_sTAB* = iUPsxCODE(K_TAB)
  557. K_sCR* = iUPsxCODE(K_CR)
  558. K_sBS* = iUPsxCODE(K_BS)
  559. K_sPAUSE* = iUPsxCODE(K_PAUSE)
  560. K_sESC* = iUPsxCODE(K_ESC)
  561. K_sCcedilla* = iUPsxCODE(K_ccedilla)
  562. K_sF1* = iUPsxCODE(K_F1)
  563. K_sF2* = iUPsxCODE(K_F2)
  564. K_sF3* = iUPsxCODE(K_F3)
  565. K_sF4* = iUPsxCODE(K_F4)
  566. K_sF5* = iUPsxCODE(K_F5)
  567. K_sF6* = iUPsxCODE(K_F6)
  568. K_sF7* = iUPsxCODE(K_F7)
  569. K_sF8* = iUPsxCODE(K_F8)
  570. K_sF9* = iUPsxCODE(K_F9)
  571. K_sF10* = iUPsxCODE(K_F10)
  572. K_sF11* = iUPsxCODE(K_F11)
  573. K_sF12* = iUPsxCODE(K_F12)
  574. K_sPrint* = iUPsxCODE(K_Print)
  575. K_sMenu* = iUPsxCODE(K_Menu)
  576. K_cHOME* = iUPcxCODE(K_HOME)
  577. K_cUP* = iUPcxCODE(K_UP)
  578. K_cPGUP* = iUPcxCODE(K_PGUP)
  579. K_cLEFT* = iUPcxCODE(K_LEFT)
  580. K_cMIDDLE* = iUPcxCODE(K_MIDDLE)
  581. K_cRIGHT* = iUPcxCODE(K_RIGHT)
  582. K_cEND* = iUPcxCODE(K_END)
  583. K_cDOWN* = iUPcxCODE(K_DOWN)
  584. K_cPGDN* = iUPcxCODE(K_PGDN)
  585. K_cINS* = iUPcxCODE(K_INS)
  586. K_cDEL* = iUPcxCODE(K_DEL)
  587. K_cSP* = iUPcxCODE(K_SP)
  588. K_cTAB* = iUPcxCODE(K_TAB)
  589. K_cCR* = iUPcxCODE(K_CR)
  590. K_cBS* = iUPcxCODE(K_BS)
  591. K_cPAUSE* = iUPcxCODE(K_PAUSE)
  592. K_cESC* = iUPcxCODE(K_ESC)
  593. K_cCcedilla* = iUPcxCODE(K_ccedilla)
  594. K_cF1* = iUPcxCODE(K_F1)
  595. K_cF2* = iUPcxCODE(K_F2)
  596. K_cF3* = iUPcxCODE(K_F3)
  597. K_cF4* = iUPcxCODE(K_F4)
  598. K_cF5* = iUPcxCODE(K_F5)
  599. K_cF6* = iUPcxCODE(K_F6)
  600. K_cF7* = iUPcxCODE(K_F7)
  601. K_cF8* = iUPcxCODE(K_F8)
  602. K_cF9* = iUPcxCODE(K_F9)
  603. K_cF10* = iUPcxCODE(K_F10)
  604. K_cF11* = iUPcxCODE(K_F11)
  605. K_cF12* = iUPcxCODE(K_F12)
  606. K_cPrint* = iUPcxCODE(K_Print)
  607. K_cMenu* = iUPcxCODE(K_Menu)
  608. K_mHOME* = iUPmxCODE(K_HOME)
  609. K_mUP* = iUPmxCODE(K_UP)
  610. K_mPGUP* = iUPmxCODE(K_PGUP)
  611. K_mLEFT* = iUPmxCODE(K_LEFT)
  612. K_mMIDDLE* = iUPmxCODE(K_MIDDLE)
  613. K_mRIGHT* = iUPmxCODE(K_RIGHT)
  614. K_mEND* = iUPmxCODE(K_END)
  615. K_mDOWN* = iUPmxCODE(K_DOWN)
  616. K_mPGDN* = iUPmxCODE(K_PGDN)
  617. K_mINS* = iUPmxCODE(K_INS)
  618. K_mDEL* = iUPmxCODE(K_DEL)
  619. K_mSP* = iUPmxCODE(K_SP)
  620. K_mTAB* = iUPmxCODE(K_TAB)
  621. K_mCR* = iUPmxCODE(K_CR)
  622. K_mBS* = iUPmxCODE(K_BS)
  623. K_mPAUSE* = iUPmxCODE(K_PAUSE)
  624. K_mESC* = iUPmxCODE(K_ESC)
  625. K_mCcedilla* = iUPmxCODE(K_ccedilla)
  626. K_mF1* = iUPmxCODE(K_F1)
  627. K_mF2* = iUPmxCODE(K_F2)
  628. K_mF3* = iUPmxCODE(K_F3)
  629. K_mF4* = iUPmxCODE(K_F4)
  630. K_mF5* = iUPmxCODE(K_F5)
  631. K_mF6* = iUPmxCODE(K_F6)
  632. K_mF7* = iUPmxCODE(K_F7)
  633. K_mF8* = iUPmxCODE(K_F8)
  634. K_mF9* = iUPmxCODE(K_F9)
  635. K_mF10* = iUPmxCODE(K_F10)
  636. K_mF11* = iUPmxCODE(K_F11)
  637. K_mF12* = iUPmxCODE(K_F12)
  638. K_mPrint* = iUPmxCODE(K_Print)
  639. K_mMenu* = iUPmxCODE(K_Menu)
  640. K_yHOME* = iUPyxCODE(K_HOME)
  641. K_yUP* = iUPyxCODE(K_UP)
  642. K_yPGUP* = iUPyxCODE(K_PGUP)
  643. K_yLEFT* = iUPyxCODE(K_LEFT)
  644. K_yMIDDLE* = iUPyxCODE(K_MIDDLE)
  645. K_yRIGHT* = iUPyxCODE(K_RIGHT)
  646. K_yEND* = iUPyxCODE(K_END)
  647. K_yDOWN* = iUPyxCODE(K_DOWN)
  648. K_yPGDN* = iUPyxCODE(K_PGDN)
  649. K_yINS* = iUPyxCODE(K_INS)
  650. K_yDEL* = iUPyxCODE(K_DEL)
  651. K_ySP* = iUPyxCODE(K_SP)
  652. K_yTAB* = iUPyxCODE(K_TAB)
  653. K_yCR* = iUPyxCODE(K_CR)
  654. K_yBS* = iUPyxCODE(K_BS)
  655. K_yPAUSE* = iUPyxCODE(K_PAUSE)
  656. K_yESC* = iUPyxCODE(K_ESC)
  657. K_yCcedilla* = iUPyxCODE(K_ccedilla)
  658. K_yF1* = iUPyxCODE(K_F1)
  659. K_yF2* = iUPyxCODE(K_F2)
  660. K_yF3* = iUPyxCODE(K_F3)
  661. K_yF4* = iUPyxCODE(K_F4)
  662. K_yF5* = iUPyxCODE(K_F5)
  663. K_yF6* = iUPyxCODE(K_F6)
  664. K_yF7* = iUPyxCODE(K_F7)
  665. K_yF8* = iUPyxCODE(K_F8)
  666. K_yF9* = iUPyxCODE(K_F9)
  667. K_yF10* = iUPyxCODE(K_F10)
  668. K_yF11* = iUPyxCODE(K_F11)
  669. K_yF12* = iUPyxCODE(K_F12)
  670. K_yPrint* = iUPyxCODE(K_Print)
  671. K_yMenu* = iUPyxCODE(K_Menu)
  672. K_sPlus* = iUPsxCODE(K_plus)
  673. K_sComma* = iUPsxCODE(K_comma)
  674. K_sMinus* = iUPsxCODE(K_minus)
  675. K_sPeriod* = iUPsxCODE(K_period)
  676. K_sSlash* = iUPsxCODE(K_slash)
  677. K_sAsterisk* = iUPsxCODE(K_asterisk)
  678. K_cupperA* = iUPcxCODE(K_upperA)
  679. K_cupperB* = iUPcxCODE(K_upperB)
  680. K_cupperC* = iUPcxCODE(K_upperC)
  681. K_cupperD* = iUPcxCODE(K_upperD)
  682. K_cupperE* = iUPcxCODE(K_upperE)
  683. K_cupperF* = iUPcxCODE(K_upperF)
  684. K_cupperG* = iUPcxCODE(K_upperG)
  685. K_cupperH* = iUPcxCODE(K_upperH)
  686. K_cupperI* = iUPcxCODE(K_upperI)
  687. K_cupperJ* = iUPcxCODE(K_upperJ)
  688. K_cupperK* = iUPcxCODE(K_upperK)
  689. K_cupperL* = iUPcxCODE(K_upperL)
  690. K_cupperM* = iUPcxCODE(K_upperM)
  691. K_cupperN* = iUPcxCODE(K_upperN)
  692. K_cupperO* = iUPcxCODE(K_upperO)
  693. K_cupperP* = iUPcxCODE(K_upperP)
  694. K_cupperQ* = iUPcxCODE(K_upperQ)
  695. K_cupperR* = iUPcxCODE(K_upperR)
  696. K_cupperS* = iUPcxCODE(K_upperS)
  697. K_cupperT* = iUPcxCODE(K_upperT)
  698. K_cupperU* = iUPcxCODE(K_upperU)
  699. K_cupperV* = iUPcxCODE(K_upperV)
  700. K_cupperW* = iUPcxCODE(K_upperW)
  701. K_cupperX* = iUPcxCODE(K_upperX)
  702. K_cupperY* = iUPcxCODE(K_upperY)
  703. K_cupperZ* = iUPcxCODE(K_upperZ)
  704. K_c1* = iUPcxCODE(K_1)
  705. K_c2* = iUPcxCODE(K_2)
  706. K_c3* = iUPcxCODE(K_3)
  707. K_c4* = iUPcxCODE(K_4)
  708. K_c5* = iUPcxCODE(K_5)
  709. K_c6* = iUPcxCODE(K_6)
  710. K_c7* = iUPcxCODE(K_7)
  711. K_c8* = iUPcxCODE(K_8)
  712. K_c9* = iUPcxCODE(K_9)
  713. K_c0* = iUPcxCODE(K_0)
  714. K_cPlus* = iUPcxCODE(K_plus)
  715. K_cComma* = iUPcxCODE(K_comma)
  716. K_cMinus* = iUPcxCODE(K_minus)
  717. K_cPeriod* = iUPcxCODE(K_period)
  718. K_cSlash* = iUPcxCODE(K_slash)
  719. K_cSemicolon* = iUPcxCODE(K_semicolon)
  720. K_cEqual* = iUPcxCODE(K_equal)
  721. K_cBracketleft* = iUPcxCODE(K_bracketleft)
  722. K_cBracketright* = iUPcxCODE(K_bracketright)
  723. K_cBackslash* = iUPcxCODE(K_backslash)
  724. K_cAsterisk* = iUPcxCODE(K_asterisk)
  725. K_mupperA* = iUPmxCODE(K_upperA)
  726. K_mupperB* = iUPmxCODE(K_upperB)
  727. K_mupperC* = iUPmxCODE(K_upperC)
  728. K_mupperD* = iUPmxCODE(K_upperD)
  729. K_mupperE* = iUPmxCODE(K_upperE)
  730. K_mupperF* = iUPmxCODE(K_upperF)
  731. K_mupperG* = iUPmxCODE(K_upperG)
  732. K_mupperH* = iUPmxCODE(K_upperH)
  733. K_mupperI* = iUPmxCODE(K_upperI)
  734. K_mupperJ* = iUPmxCODE(K_upperJ)
  735. K_mupperK* = iUPmxCODE(K_upperK)
  736. K_mupperL* = iUPmxCODE(K_upperL)
  737. K_mupperM* = iUPmxCODE(K_upperM)
  738. K_mupperN* = iUPmxCODE(K_upperN)
  739. K_mupperO* = iUPmxCODE(K_upperO)
  740. K_mupperP* = iUPmxCODE(K_upperP)
  741. K_mupperQ* = iUPmxCODE(K_upperQ)
  742. K_mupperR* = iUPmxCODE(K_upperR)
  743. K_mupperS* = iUPmxCODE(K_upperS)
  744. K_mupperT* = iUPmxCODE(K_upperT)
  745. K_mupperU* = iUPmxCODE(K_upperU)
  746. K_mupperV* = iUPmxCODE(K_upperV)
  747. K_mupperW* = iUPmxCODE(K_upperW)
  748. K_mupperX* = iUPmxCODE(K_upperX)
  749. K_mupperY* = iUPmxCODE(K_upperY)
  750. K_mupperZ* = iUPmxCODE(K_upperZ)
  751. K_m1* = iUPmxCODE(K_1)
  752. K_m2* = iUPmxCODE(K_2)
  753. K_m3* = iUPmxCODE(K_3)
  754. K_m4* = iUPmxCODE(K_4)
  755. K_m5* = iUPmxCODE(K_5)
  756. K_m6* = iUPmxCODE(K_6)
  757. K_m7* = iUPmxCODE(K_7)
  758. K_m8* = iUPmxCODE(K_8)
  759. K_m9* = iUPmxCODE(K_9)
  760. K_m0* = iUPmxCODE(K_0)
  761. K_mPlus* = iUPmxCODE(K_plus)
  762. K_mComma* = iUPmxCODE(K_comma)
  763. K_mMinus* = iUPmxCODE(K_minus)
  764. K_mPeriod* = iUPmxCODE(K_period)
  765. K_mSlash* = iUPmxCODE(K_slash)
  766. K_mSemicolon* = iUPmxCODE(K_semicolon)
  767. K_mEqual* = iUPmxCODE(K_equal)
  768. K_mBracketleft* = iUPmxCODE(K_bracketleft)
  769. K_mBracketright* = iUPmxCODE(K_bracketright)
  770. K_mBackslash* = iUPmxCODE(K_backslash)
  771. K_mAsterisk* = iUPmxCODE(K_asterisk)
  772. K_yA* = iUPyxCODE(K_upperA)
  773. K_yB* = iUPyxCODE(K_upperB)
  774. K_yC* = iUPyxCODE(K_upperC)
  775. K_yD* = iUPyxCODE(K_upperD)
  776. K_yE* = iUPyxCODE(K_upperE)
  777. K_yF* = iUPyxCODE(K_upperF)
  778. K_yG* = iUPyxCODE(K_upperG)
  779. K_yH* = iUPyxCODE(K_upperH)
  780. K_yI* = iUPyxCODE(K_upperI)
  781. K_yJ* = iUPyxCODE(K_upperJ)
  782. K_yK* = iUPyxCODE(K_upperK)
  783. K_yL* = iUPyxCODE(K_upperL)
  784. K_yM* = iUPyxCODE(K_upperM)
  785. K_yN* = iUPyxCODE(K_upperN)
  786. K_yO* = iUPyxCODE(K_upperO)
  787. K_yP* = iUPyxCODE(K_upperP)
  788. K_yQ* = iUPyxCODE(K_upperQ)
  789. K_yR* = iUPyxCODE(K_upperR)
  790. K_yS* = iUPyxCODE(K_upperS)
  791. K_yT* = iUPyxCODE(K_upperT)
  792. K_yU* = iUPyxCODE(K_upperU)
  793. K_yV* = iUPyxCODE(K_upperV)
  794. K_yW* = iUPyxCODE(K_upperW)
  795. K_yX* = iUPyxCODE(K_upperX)
  796. K_yY* = iUPyxCODE(K_upperY)
  797. K_yZ* = iUPyxCODE(K_upperZ)
  798. K_y1* = iUPyxCODE(K_1)
  799. K_y2* = iUPyxCODE(K_2)
  800. K_y3* = iUPyxCODE(K_3)
  801. K_y4* = iUPyxCODE(K_4)
  802. K_y5* = iUPyxCODE(K_5)
  803. K_y6* = iUPyxCODE(K_6)
  804. K_y7* = iUPyxCODE(K_7)
  805. K_y8* = iUPyxCODE(K_8)
  806. K_y9* = iUPyxCODE(K_9)
  807. K_y0* = iUPyxCODE(K_0)
  808. K_yPlus* = iUPyxCODE(K_plus)
  809. K_yComma* = iUPyxCODE(K_comma)
  810. K_yMinus* = iUPyxCODE(K_minus)
  811. K_yPeriod* = iUPyxCODE(K_period)
  812. K_ySlash* = iUPyxCODE(K_slash)
  813. K_ySemicolon* = iUPyxCODE(K_semicolon)
  814. K_yEqual* = iUPyxCODE(K_equal)
  815. K_yBracketleft* = iUPyxCODE(K_bracketleft)
  816. K_yBracketright* = iUPyxCODE(K_bracketright)
  817. K_yBackslash* = iUPyxCODE(K_backslash)
  818. K_yAsterisk* = iUPyxCODE(K_asterisk)
  819. proc controlsOpen*(): cint {.cdecl, importc: "IupControlsOpen", dynlib: dllname.}
  820. proc controlsClose*() {.cdecl, importc: "IupControlsClose", dynlib: dllname.}
  821. proc oldValOpen*() {.cdecl, importc: "IupOldValOpen", dynlib: dllname.}
  822. proc oldTabsOpen*() {.cdecl, importc: "IupOldTabsOpen", dynlib: dllname.}
  823. proc colorbar*(): PIhandle {.cdecl, importc: "IupColorbar", dynlib: dllname.}
  824. proc cells*(): PIhandle {.cdecl, importc: "IupCells", dynlib: dllname.}
  825. proc colorBrowser*(): PIhandle {.cdecl, importc: "IupColorBrowser", dynlib: dllname.}
  826. proc gauge*(): PIhandle {.cdecl, importc: "IupGauge", dynlib: dllname.}
  827. proc dial*(theType: cstring): PIhandle {.cdecl, importc: "IupDial", dynlib: dllname.}
  828. proc matrix*(action: cstring): PIhandle {.cdecl, importc: "IupMatrix", dynlib: dllname.}
  829. # IupMatrix utilities
  830. proc matSetAttribute*(ih: PIhandle, name: cstring, lin, col: cint,
  831. value: cstring) {.
  832. cdecl, importc: "IupMatSetAttribute", dynlib: dllname.}
  833. proc matStoreAttribute*(ih: PIhandle, name: cstring, lin, col: cint,
  834. value: cstring) {.cdecl,
  835. importc: "IupMatStoreAttribute", dynlib: dllname.}
  836. proc matGetAttribute*(ih: PIhandle, name: cstring, lin, col: cint): cstring {.
  837. cdecl, importc: "IupMatGetAttribute", dynlib: dllname.}
  838. proc matGetInt*(ih: PIhandle, name: cstring, lin, col: cint): cint {.
  839. cdecl, importc: "IupMatGetInt", dynlib: dllname.}
  840. proc matGetFloat*(ih: PIhandle, name: cstring, lin, col: cint): cfloat {.
  841. cdecl, importc: "IupMatGetFloat", dynlib: dllname.}
  842. proc matSetfAttribute*(ih: PIhandle, name: cstring, lin, col: cint,
  843. format: cstring) {.cdecl,
  844. importc: "IupMatSetfAttribute",
  845. dynlib: dllname, varargs.}
  846. # Used by IupColorbar
  847. const
  848. IUP_PRIMARY* = -1
  849. IUP_SECONDARY* = -2
  850. # Initialize PPlot widget class
  851. proc pPlotOpen*() {.cdecl, importc: "IupPPlotOpen", dynlib: dllname.}
  852. # Create an PPlot widget instance
  853. proc pPlot*: PIhandle {.cdecl, importc: "IupPPlot", dynlib: dllname.}
  854. # Add dataset to plot
  855. proc pPlotBegin*(ih: PIhandle, strXdata: cint) {.
  856. cdecl, importc: "IupPPlotBegin", dynlib: dllname.}
  857. proc pPlotAdd*(ih: PIhandle, x, y: cfloat) {.
  858. cdecl, importc: "IupPPlotAdd", dynlib: dllname.}
  859. proc pPlotAddStr*(ih: PIhandle, x: cstring, y: cfloat) {.
  860. cdecl, importc: "IupPPlotAddStr", dynlib: dllname.}
  861. proc pPlotEnd*(ih: PIhandle): cint {.
  862. cdecl, importc: "IupPPlotEnd", dynlib: dllname.}
  863. proc pPlotInsertStr*(ih: PIhandle, index, sampleIndex: cint, x: cstring,
  864. y: cfloat) {.cdecl, importc: "IupPPlotInsertStr",
  865. dynlib: dllname.}
  866. proc pPlotInsert*(ih: PIhandle, index, sampleIndex: cint,
  867. x, y: cfloat) {.
  868. cdecl, importc: "IupPPlotInsert", dynlib: dllname.}
  869. # convert from plot coordinates to pixels
  870. proc pPlotTransform*(ih: PIhandle, x, y: cfloat, ix, iy: var cint) {.
  871. cdecl, importc: "IupPPlotTransform", dynlib: dllname.}
  872. # Plot on the given device. Uses a "cdCanvas*".
  873. proc pPlotPaintTo*(ih: PIhandle, cnv: pointer) {.
  874. cdecl, importc: "IupPPlotPaintTo", dynlib: dllname.}