iup.e 97 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003
  1. class IUP
  2. -- Class to handle the interface system of an iup application
  3. inherit
  4. ANY
  5. ARGUMENTS
  6. IUP_GET_POINTER
  7. create {IUP_INTERFACE}
  8. init
  9. feature {IUP_INTERFACE}
  10. init
  11. -- Init the interface system
  12. local
  13. i, r: INTEGER
  14. argsv: ARRAY[STRING_8]
  15. do
  16. --io.put_string("Init IUP%N")
  17. create objects.make(0)
  18. -- Set some callback pointers
  19. set_iup_callbacks ($Current,
  20. $launch_help_cb_fn, $launch_idle_action_fidle, $launch_map_cb_fn,
  21. $launch_unmap_cb_fn, $launch_destroy_cb_fn, $launch_ldestroy_cb_fn,
  22. $launch_getfocus_cb_fn, $launch_killfocus_cb_fn, $launch_enterwindow_cb_fn,
  23. $launch_leavewindow_cb_fn, $launch_action_fn, $launch_k_any_fni,
  24. $launch_close_cb_fn, $launch_copydata_cb_fnsi, $launch_dropfiles_cb_fnsiii,
  25. $launch_mdiactivate_cb_fn, $launch_move_cb_fnii, $launch_resize_cb_fnii,
  26. $launch_show_cb_fni, $launch_trayclick_cb_fniii, $launch_file_cb_fnss,
  27. $launch_colorupdate_cb_fn, $launch_cancel_cb_fn, $launch_tabchange_cb_fnnn,
  28. $launch_tabchangepos_cb_fnii, $launch_tabclose_cb_fni, $launch_rightclick_cb_fni,
  29. $launch_detached_cb_fnnii, $launch_restored_cb_fnnii, $launch_openclose_cb_fni,
  30. $launch_extrabutton_cb_fnii, $launch_valuechanged_cb_fn, $launch_button_cb_fniiiis,
  31. $launch_action_fnff, $launch_focus_cb_fni, $launch_motion_cb_fniis, $launch_keypress_cb_fnii,
  32. $launch_scroll_cb_fniff, $launch_wheel_cb_fndiis, $launch_click_cb_fns,
  33. $launch_action_fnsii, $launch_caret_cb_fniii, $launch_dblclick_cb_fnis,
  34. $launch_dragdrop_cb_fniiii, $launch_dropdown_cb_fni, $launch_edit_cb_fnis,
  35. $launch_multiselect_cb_fns, $launch_spin_cb_fni, $launch_action_fnis,
  36. $launch_action_fni, $launch_selection_cb_fnii, $launch_multiselection_cb_fnpi,
  37. $launch_multiunselection_cb_fnpi, $launch_branchopen_cb_fni, $launch_branchclose_cb_fni,
  38. $launch_executeleaf_cb_fni, $launch_showrename_cb_fni, $launch_rename_cb_fnis,
  39. $launch_noderemoved_cb_fns, $launch_togglevalue_cb_fnii, $launch_highlight_cb_fn,
  40. $launch_open_cb_fn, $launch_menuclose_cb_fn, $launch_dragbegin_cb_fnii,
  41. $launch_dragdatasize_cb_fns, $launch_dragdata_cb_fnsvi, $launch_dragend_cb_fni,
  42. $launch_dropdata_cb_fnsviii, $launch_dropmotion_cb_fniis, $launch_recent_cb_fn,
  43. $launch_param_cb_fniv, $launch_flat_action_fn, $launch_flat_button_cb_fniiiis,
  44. $launch_flat_focus_cb_fni, $launch_flat_enterwindow_cb_fn, $launch_flat_leavewindow_cb_fn,
  45. $launch_draw_cb_fniiiiiic, $launch_height_cb_fni, $launch_hspan_cb_fnii,
  46. $launch_mouseclick_cb_fniiiiiis, $launch_mousemotion_cb_fniiiis, $launch_ncols_cb_fn,
  47. $launch_nlines_cb_fn, $launch_scrolling_cb_fnii, $launch_vspan_cb_fnii,
  48. $launch_width_cb_fni, $launch_cell_fni, $launch_extended_fni,
  49. $launch_select_fnii, $launch_switch_fnii, $launch_action_fniiiis,
  50. $launch_click_fniis, $launch_colresize_fni, $launch_release_fniis,
  51. $launch_resizematrix_fnii, $launch_mousemove_fnii, $launch_enteritem_fnii,
  52. $launch_leaveitem_fnii, $launch_scrolltop_fnii, $launch_bgcolor_fniivvv,
  53. $launch_fgcolor_fniivvv, $launch_font_fnii, $launch_type_fnii,
  54. $launch_dropcheck_fnii, $launch_translatevalue_fniis, $launch_togglevalue_fniii,
  55. $launch_drop_fnnii, $launch_menudrop_fnnii, $launch_dropselect_fniinsii,
  56. $launch_edition_fniiii, $launch_value_fnii, $launch_value_edit_fniis,
  57. $launch_mark_fnii, $launch_markedit_fniii, $launch_flat_motion_cb_fniis,
  58. $launch_dropshow_cb_fni, $launch_button_press_cb_fnd, $launch_button_release_cb_fnd,
  59. $launch_mousemove_cb_fnd, $launch_change_cb_fnvvv, $launch_drag_cb_fnvvv)
  60. -- Pass arguments to IUP
  61. create argsv.make_filled(" ", 0, argument_count)
  62. i := -1
  63. across
  64. Argument_array as ic
  65. loop
  66. i := i + 1
  67. argsv.put(ic.item, i)
  68. end
  69. r := int_iup_open ($i, get_pointer(argsv.to_c))
  70. -- 1 is returned by IUP if an error occurred.
  71. if r.is_equal(1) then
  72. io.put_string("An error occurred when try to open IUP interface. %N")
  73. end
  74. end
  75. int_iup_open (int, p: POINTER): INTEGER
  76. external
  77. "C inline use %"eiffel-iup.h%""
  78. alias
  79. "return IupOpen($int, $p);"
  80. end
  81. feature {IUP_GET_PARAM}
  82. set_get_param (wgt: IUP_GET_PARAM)
  83. do
  84. get_param := wgt
  85. end
  86. feature {ANY}
  87. -- Commands to init the main loop, exit the loop and close the interface
  88. -- system.
  89. main_loop
  90. -- Executes the user interaction until a callback returns IUP_CLOSE,
  91. -- "exit_loop" is called, or hiding the last visible dialog.
  92. -- If you cascade many calls to "main_loop" there must be a
  93. -- "return IUP_CLOSE" or "exit_llop" call for each cascade level, hiddinh
  94. -- all dialogs will close only one level. Call "main_loop_level" to
  95. -- obtain the current level.
  96. --
  97. -- If "main_loop" is called without any visible dialogs and no active
  98. -- timers, the application will hang and will not be possible to close the
  99. -- main loop. The process will have to be interrupted by the
  100. -- system.
  101. --
  102. -- When the last visible dialog is hidden the "exit_loop" function is
  103. -- automatically called, causing the "main_loop" to return. To avoid that
  104. -- set the global attribute LOCKLOOP=YES before hiding the last dialog.
  105. external
  106. "C inline use %"eiffel-iup.h%""
  107. alias
  108. "IupMainLoop();"
  109. end
  110. main_loop_level: INTEGER
  111. -- Returns the current cascade level of main loop. When no calls were
  112. -- done, return value is 0.
  113. -- You can use this function to check if "main_loop" was already
  114. -- called and avoid calling it again.
  115. --
  116. -- A call to "popup" will increase one level.
  117. external
  118. "C inline use %"eiffel-iup.h%""
  119. alias
  120. "return IupMainLoopLevel();"
  121. end
  122. loop_step: STRING
  123. -- Runs one iteration of the message loop. Returns immediately
  124. -- after processing any messages or if there are no messages to process.
  125. --
  126. -- Returns: IUP_CLOSE or IUP_DEFAULT.
  127. --
  128. -- This function is useful for allowing a second message loop to be
  129. -- managed by the application itself. This means that messages can be
  130. -- intercepted and callbacks can be processed inside an application loop.
  131. --
  132. -- If IUP_CLOSE is returned "main" loop will not end because the
  133. -- return code was already processed. If you want to end main loop
  134. -- when IUP_CLOSE is returned by "loop_step" then call "exit_loop"
  135. -- after "loop_step" returns.
  136. local
  137. rtn: INTEGER
  138. do
  139. rtn := int_loop_step
  140. if rtn.is_equal(-2) then
  141. Result := "IUP_DEFAULT"
  142. else
  143. Result := "IUP_CLOSE"
  144. end
  145. end
  146. loop_step_wait: STRING
  147. -- Put the system in idle until a message is processed.
  148. local
  149. rtn: INTEGER
  150. do
  151. rtn := int_loop_step_wait
  152. if rtn.is_equal(-2) then
  153. Result := "IUP_DEFAULT"
  154. else
  155. Result := "IUP_CLOSE"
  156. end
  157. end
  158. flush
  159. -- Processes all pending messages in the message queue.
  160. -- When you change an attribute of a certain element, the change may not
  161. -- take place immediately. For this update to occur faster than usual,
  162. -- call "flush" after the attribute is changed.
  163. --
  164. -- Important: A call to this function may cause other callbacks to be
  165. -- processed before it returns.
  166. --
  167. -- In Motif, if the X server sent an event which is not yet in the event
  168. --queue, after a call to "flush" the queue might not be empty.
  169. external
  170. "C inline use %"eiffel-iup.h%""
  171. alias
  172. "IupFlush();"
  173. end
  174. exit_loop
  175. -- Exit current loop.
  176. external
  177. "C inline use %"eiffel-iup.h%""
  178. alias
  179. "IupExitLoop();"
  180. end
  181. close
  182. -- Close the interface system
  183. external
  184. "C inline use %"eiffel-iup.h%""
  185. alias
  186. "IupClose();"
  187. end
  188. -- Help
  189. help (url: STRING): INTEGER
  190. -- Opens the given URL. In UNIX executes Netscape, Safari (MacOS) or
  191. -- Firefox (in Linux) passing the desired URL as a parameter. In Windows
  192. -- executes the shell "open" operation on the given URL.
  193. --
  194. -- In UNIX you can change the used browser setting the environment
  195. -- variable IUP_HELPAPP or using the global attribute "HELPAPP".
  196. --
  197. -- It is a non synchronous operation, i.e. the function will return just
  198. -- after execute the command and it will not wait for its result.
  199. --
  200. -- url: may be any kind of address accepted by the Browser, that is, it
  201. -- can include 'http://', or be just a file name, etc.
  202. --
  203. -- Returns: 1 if successful, -1 if failed. In Windows can return -2 if
  204. -- file not found.
  205. do
  206. Result := int_help(get_pointer(url.to_c))
  207. end
  208. -- Load images
  209. load_images
  210. -- Load a pre-defined stock images for buttons and labels.
  211. -- See: http://webserver2.tecgraf.puc-rio.br/iup/en/iupimglib.html
  212. external
  213. "C inline use %"eiffel-iup.h%""
  214. alias
  215. "IupImageLibOpen();"
  216. end
  217. load_iup_controls
  218. -- Allow use the additional controls, must be called after "iup_open".
  219. -- Several additional controls are included in this library. These
  220. -- controls are drawn by IUP using CD on a IUP_CANVAS control, and are
  221. -- not native controls.
  222. external
  223. "C inline use %"eiffel-iup.h%""
  224. alias
  225. "IupControlsOpen();"
  226. end
  227. -- Focus
  228. get_focus: detachable IUP_WIDGET
  229. -- Returns the interface element that has the keyboard focus, i.e. the
  230. -- element that will receive keyboard events (or Void if no element has
  231. -- the focus).
  232. local
  233. p: POINTER
  234. do
  235. p := int_get_focus
  236. if p /= default_pointer then
  237. Result := widget_for_object(p)
  238. end
  239. end
  240. -- Command to handle global attributes
  241. set_global_attribute (name: STRING; value: STRING)
  242. do
  243. int_set_global (get_pointer(name.to_c), get_pointer(value.to_c))
  244. end
  245. get_global_attribute (name: STRING): STRING
  246. local
  247. str: STRING
  248. do
  249. create str.make_from_c(int_get_global (get_pointer(name.to_c)))
  250. Result := str
  251. end
  252. -- Global attribute PARENTDIALOG and ICON
  253. set_global_parent_dialog_widget (dlg: IUP_DIALOG)
  254. -- Parent dialog to be used in some predefined dialogs.
  255. local
  256. p: POINTER
  257. str: STRING
  258. do
  259. str := once "PARENTDIALOG"
  260. int_set_attribute_handle (p, get_pointer(str.to_c), dlg.widget)
  261. end
  262. set_global_icon_widget (icon: IUP_IMAGE)
  263. -- Icon to be used in some predefined dialogs.
  264. local
  265. p: POINTER
  266. str: STRING
  267. do
  268. str := once "ICON"
  269. int_set_attribute_handle (p, get_pointer(str.to_c), icon.widget)
  270. end
  271. -- Copy attributes
  272. copy_attributes(src, dst: IUP_WIDGET)
  273. -- Copies all hash table attributes from one element to another.
  274. -- Internal attributes or handle attributes are not copied.
  275. --
  276. -- src: identifier of the source element.
  277. -- dst: identifier of the destiny element.
  278. do
  279. int_copy_attributes(src.widget, dst.widget)
  280. end
  281. -- Global attributes: General
  282. set_language_english
  283. do
  284. set_global_attribute ("LANGUAGE", "ENGLISH")
  285. end
  286. set_language_spanish
  287. do
  288. set_global_attribute ("LANGUAGE", "SPANISH")
  289. end
  290. set_language_portuguese
  291. do
  292. set_global_attribute ("LANGUAGE", "PORTUGUESE")
  293. end
  294. set_language (language: STRING)
  295. -- Sets the language name used by some pre-defined dialogs.
  296. --
  297. -- All elements that have pre-defined texts. The native dialogs like
  298. -- IUP_FILE_DIALOG will always be displayed in the system language.
  299. --
  300. -- Even if the language is not supported (meaning its pack of pre-defined
  301. -- strings are not defined) the new language name will be successfully
  302. -- stored so you can set your own strings and return a coherent value,
  303. -- and the current defined string will not be changed.
  304. --
  305. -- Here is a list of the pre-defined string names:
  306. -- IUP_ERROR, IUP_ATTENTION, IUP_YES, IUP_NO, IUP_INVALIDDIR,
  307. -- IUP_FILEISDIR, IUP_FILENOTEXIST, IUP_FILEOVERWRITE, IUP_CREATEFOLDER,
  308. -- IUP_NAMENEWFOLDER, IUP_SAVEAS, IUP_OPEN, IUP_SELECTDIR, IUP_OK,
  309. -- IUP_CANCEL, IUP_RETRY, IUP_APPLY, IUP_RESET, IUP_GETCOLOR, IUP_HELP,
  310. -- IUP_RED, IUP_GREEN, IUP_BLUE, IUP_HUE, IUP_SATURATION, IUP_INTENSITY,
  311. -- IUP_OPACITY, IUP_PALETTE, IUP_TRUE, IUP_FALSE, IUP_FAMILY, IUP_STYLE,
  312. -- IUP_SIZE, IUP_SAMPLE, IUP_ERRORFILEOPEN, IUP_ERRORFILESAVE
  313. do
  314. set_global_attribute ("LANGUAGE", language)
  315. end
  316. get_language: STRING
  317. do
  318. Result := get_global_attribute("LANGUAGE")
  319. end
  320. set_language_string (name, value: STRING)
  321. -- Associates a name with a string as an auxiliary method for
  322. -- Internationalization of applications.
  323. --
  324. -- name: name of the string.
  325. -- value: string value.
  326. --
  327. -- This will store the pointer. Elements that have pre-defined texts use
  328. -- this function when the current language is changed.
  329. --
  330. -- IUP will not store strings for several languages at the same time, it
  331. -- will store only for the current language. When "set_language" is
  332. -- called only the internal pre-defined strings are replace in the
  333. -- internal database. The application must register again all its strings
  334. -- for the new language.
  335. --
  336. -- If a dialog is created with string names associations and the
  337. -- associations are about to be changed, then the dialog must be
  338. -- destroyed before the associations are changed, then created again.
  339. --
  340. -- Associations are retrieved using the "get_language_string" feature.
  341. -- But to simplify the usage of the string names associations attributes
  342. -- set with regular IupSetStr* functions can use the prefix "_@" to
  343. -- indicate a string name and not the actual string.
  344. do
  345. int_set_language_string(get_pointer(name.to_c), get_pointer(value.to_c))
  346. end
  347. store_language_string (name, value: STRING)
  348. -- Like "set_language_string" but will duplicate the string internally.
  349. do
  350. int_store_language_string(get_pointer(name.to_c), get_pointer(value.to_c))
  351. end
  352. get_language_string(name: STRING): STRING
  353. -- Returns a language dependent string.
  354. local
  355. str: STRING
  356. do
  357. create str.make_from_c(int_get_language_string(get_pointer(name.to_c)))
  358. Result := str
  359. end
  360. --set_language_pack (pack: IUP_USER)
  361. -- Sets a pack of associations between names and string values.
  362. -- Internally will call "set_language_string" for each name in the pack.
  363. --
  364. -- After setting the pack it can be destroyed. The existent associations
  365. -- will not be removed. But if the new ones have the same names, the old
  366. -- ones will be replaced.
  367. -- do
  368. -- int_set_language_pack(pack.widget)
  369. -- end
  370. --remove_language_pack
  371. -- Remove all current associations.
  372. -- local
  373. -- p: POINTER
  374. -- do
  375. -- int_set_language_pack(p)
  376. -- end
  377. get_driver: STRING
  378. -- Informs the current driver being used. Two drivers are available now,
  379. -- one for each platform: "GTK", "Motif" and "Win32".
  380. do
  381. Result := get_global_attribute("DRIVER")
  382. end
  383. -- Global attributes: System
  384. set_lock_loop_yes
  385. -- When the last visible dialog is closed the IupExitLoop function is
  386. -- called. To avoid that call this feature before hiding the last dialog.
  387. do
  388. set_global_attribute ("LOCKLOOP", "YES")
  389. end
  390. set_lock_loop_no
  391. do
  392. set_global_attribute ("LOCKLOOP", "NO")
  393. end
  394. set_exit_loop_yes
  395. -- Disable the "exit_loop" function when "main_loop_level" return 1. Used
  396. -- when the application runs secondary dialogs that behave as full
  397. -- applications but sharing the same IUP environment,
  398. do
  399. set_global_attribute ("EXITLOOP", "YES")
  400. end
  401. set_exit_loop_no
  402. do
  403. set_global_attribute ("EXITLOOP", "NO")
  404. end
  405. set_default_precision (value: INTEGER)
  406. -- The default number of decimal places used in floating point output by
  407. -- some controls (IUP_MATRIX and IUP_GET_PARAM). Local attributes may
  408. -- overwrite the default. Default: 2.
  409. do
  410. set_global_attribute ("DEFAULTPRECISION", value.out)
  411. end
  412. get_default_precision: INTEGER
  413. local
  414. str: STRING
  415. do
  416. str := get_global_attribute("DEFAULTPRECISION")
  417. Result := str.to_integer
  418. end
  419. set_default_decimal_symbol_period
  420. do
  421. set_global_attribute ("DEFAULTDECIMALSYMBOL", ".")
  422. end
  423. set_default_decimal_symbol_comma
  424. do
  425. set_global_attribute ("DEFAULTDECIMALSYMBOL", ",")
  426. end
  427. is_default_decimal_symbol_period: BOOLEAN
  428. local
  429. str: STRING
  430. do
  431. str := get_global_attribute("DEFAULTPRECISION")
  432. if str.is_equal(".") then
  433. Result := True
  434. else
  435. Result := False
  436. end
  437. end
  438. is_default_decimal_symbol_comma: BOOLEAN
  439. local
  440. str: STRING
  441. do
  442. str := get_global_attribute("DEFAULTPRECISION")
  443. if str.is_equal(",") then
  444. Result := True
  445. else
  446. Result := False
  447. end
  448. end
  449. set_global_menu (state: BOOLEAN)
  450. -- [GTK Only] Flag indicating that GTK is using a global menu instead of
  451. -- a per window menu.
  452. do
  453. set_global_attribute ("GLOBALMENU", boolean_to_yesno(state))
  454. end
  455. -- Default attributes
  456. set_default_theme (name: STRING)
  457. do
  458. set_global_attribute ("DEFAULTTHEME", name)
  459. end
  460. -- System Mouse and Keyboard
  461. set_cursor_position (x, y: INTEGER)
  462. -- Controls the cursor position in absolute coordinates relative to the
  463. -- origin of the main screen. The origin of the main screen is at the
  464. -- upper left corner, in Windows it is affected by the position of the
  465. -- Start Menu when it is at the top or left side of the screen. In GTK
  466. -- and Motif also generates mouse motion messages.
  467. local
  468. str: STRING
  469. do
  470. create str.make_from_string(x.out)
  471. str.append_string("x")
  472. str.append_string(y.out)
  473. set_global_attribute("CURSORPOS", str)
  474. end
  475. get_cursor_position: TUPLE[INTEGER, INTEGER]
  476. local
  477. str: STRING
  478. do
  479. str := get_global_attribute("CURSORPOS")
  480. Result := components_of (str, 'x')
  481. end
  482. get_shift_key_state: BOOLEAN
  483. local
  484. str: STRING
  485. do
  486. str := get_global_attribute("SHIFTKEY")
  487. Result := yesno_to_boolean(str)
  488. end
  489. get_control_key_state: BOOLEAN
  490. local
  491. str: STRING
  492. do
  493. str := get_global_attribute("CONTROLKEY")
  494. Result := yesno_to_boolean(str)
  495. end
  496. get_modifier_keys_state: STRING
  497. -- Returns the state of the keyboard modifier keys: Shift, Ctrl, Alt and
  498. -- sYs(Win/Apple). In the format of 4 characters: "SCAY". When not
  499. -- pressed the respective letter is replaced by a space " ".
  500. do
  501. Result := get_global_attribute("MODKEYSTATE")
  502. end
  503. -- Key codes
  504. is_print_key (key: INTEGER): BOOLEAN
  505. -- Informs if a key can be directly used as a printable character.
  506. local
  507. rv: INTEGER
  508. do
  509. rv := int_is_print_key(key)
  510. if rv.is_equal(0) then
  511. Result := False
  512. else
  513. Result := True
  514. end
  515. end
  516. is_x_key (key: INTEGER): BOOLEAN
  517. -- Informs if a given key is an extended code (ASCII code >= 128).
  518. local
  519. rv: INTEGER
  520. do
  521. rv := int_is_x_key(key)
  522. if rv.is_equal(0) then
  523. Result := False
  524. else
  525. Result := True
  526. end
  527. end
  528. is_shift_x_key (key: INTEGER): BOOLEAN
  529. -- Informs if a given key is an extended code using the Shift modifier.
  530. local
  531. rv: INTEGER
  532. do
  533. rv := int_is_shift_x_key(key)
  534. if rv.is_equal(0) then
  535. Result := False
  536. else
  537. Result := True
  538. end
  539. end
  540. is_ctrl_x_key (key: CHARACTER): BOOLEAN
  541. -- Informs if a given key is an extended code using the Ctrl modifier.
  542. local
  543. rv: INTEGER
  544. do
  545. rv := int_is_ctrl_x_key(key)
  546. if rv.is_equal(0) then
  547. Result := False
  548. else
  549. Result := True
  550. end
  551. end
  552. is_alt_x_key (key: CHARACTER): BOOLEAN
  553. -- Informs if a given key is an extended code using the Alt modifier.
  554. local
  555. rv: INTEGER
  556. do
  557. rv := int_is_alt_x_key(key)
  558. if rv.is_equal(0) then
  559. Result := False
  560. else
  561. Result := True
  562. end
  563. end
  564. is_sys_x_key (key: CHARACTER): BOOLEAN
  565. -- Informs if a given key is an extended code using the Sys modifier.
  566. -- Sys in Windows is the Windows key and in Mac is the Apple key.
  567. local
  568. rv: INTEGER
  569. do
  570. rv := int_is_sys_x_key(key)
  571. if rv.is_equal(0) then
  572. Result := False
  573. else
  574. Result := True
  575. end
  576. end
  577. x_key_base (key: CHARACTER): INTEGER
  578. external
  579. "C inline use %"eiffel-iup.h%""
  580. alias
  581. "return iup_XkeyBase ($key);"
  582. end
  583. x_key_shift (key: CHARACTER): INTEGER
  584. external
  585. "C inline use %"eiffel-iup.h%""
  586. alias
  587. "return iup_XkeyShift ($key);"
  588. end
  589. x_key_ctrl (key: CHARACTER): INTEGER
  590. external
  591. "C inline use %"eiffel-iup.h%""
  592. alias
  593. "return iup_XkeyCtrl ($key);"
  594. end
  595. x_key_alt (key: CHARACTER): INTEGER
  596. external
  597. "C inline use %"eiffel-iup.h%""
  598. alias
  599. "return iup_XkeyAlt ($key);"
  600. end
  601. x_key_sys (key: CHARACTER): INTEGER
  602. external
  603. "C inline use %"eiffel-iup.h%""
  604. alias
  605. "return iup_XkeySys ($key);"
  606. end
  607. -- Mouse buttons
  608. is_shift (status: STRING): BOOLEAN
  609. local
  610. a: POINTER
  611. rv: INTEGER
  612. do
  613. a := convert_string_to_array(status)
  614. rv := int_is_shift(a)
  615. if rv.is_equal(0) then
  616. Result := False
  617. else
  618. Result := True
  619. end
  620. end
  621. is_control (status: STRING): BOOLEAN
  622. local
  623. a: POINTER
  624. rv: INTEGER
  625. do
  626. a := convert_string_to_array(status)
  627. rv := int_is_control(a)
  628. if rv.is_equal(0) then
  629. Result := False
  630. else
  631. Result := True
  632. end
  633. end
  634. is_button_1 (status: STRING): BOOLEAN
  635. local
  636. a: POINTER
  637. rv: INTEGER
  638. do
  639. a := convert_string_to_array(status)
  640. rv := int_is_button_1(a)
  641. if rv.is_equal(0) then
  642. Result := False
  643. else
  644. Result := True
  645. end
  646. end
  647. is_button_2 (status: STRING): BOOLEAN
  648. local
  649. a: POINTER
  650. rv: INTEGER
  651. do
  652. a := convert_string_to_array(status)
  653. rv := int_is_button_2(a)
  654. if rv.is_equal(0) then
  655. Result := False
  656. else
  657. Result := True
  658. end
  659. end
  660. is_button_3 (status: STRING): BOOLEAN
  661. local
  662. a: POINTER
  663. rv: INTEGER
  664. do
  665. a := convert_string_to_array(status)
  666. rv := int_is_button_3(a)
  667. if rv.is_equal(0) then
  668. Result := False
  669. else
  670. Result := True
  671. end
  672. end
  673. is_button_4 (status: STRING): BOOLEAN
  674. local
  675. a: POINTER
  676. rv: INTEGER
  677. do
  678. a := convert_string_to_array(status)
  679. rv := int_is_button_4(a)
  680. if rv.is_equal(0) then
  681. Result := False
  682. else
  683. Result := True
  684. end
  685. end
  686. is_button_5 (status: STRING): BOOLEAN
  687. local
  688. a: POINTER
  689. rv: INTEGER
  690. do
  691. a := convert_string_to_array(status)
  692. rv := int_is_button_5(a)
  693. if rv.is_equal(0) then
  694. Result := False
  695. else
  696. Result := True
  697. end
  698. end
  699. is_double (status: STRING): BOOLEAN
  700. local
  701. a: POINTER
  702. rv: INTEGER
  703. do
  704. a := convert_string_to_array(status)
  705. rv := int_is_double(a)
  706. if rv.is_equal(0) then
  707. Result := False
  708. else
  709. Result := True
  710. end
  711. end
  712. is_alt (status: STRING): BOOLEAN
  713. local
  714. a: POINTER
  715. rv: INTEGER
  716. do
  717. a := convert_string_to_array(status)
  718. rv := int_is_alt(a)
  719. if rv.is_equal(0) then
  720. Result := False
  721. else
  722. Result := True
  723. end
  724. end
  725. is_sys (status: STRING): BOOLEAN
  726. local
  727. a: POINTER
  728. rv: INTEGER
  729. do
  730. a := convert_string_to_array(status)
  731. rv := int_is_sys(a)
  732. if rv.is_equal(0) then
  733. Result := False
  734. else
  735. Result := True
  736. end
  737. end
  738. -- CD
  739. init_context_plus
  740. external
  741. "C inline use %"eiffel-iup.h%""
  742. alias
  743. "cdInitContextPlus();"
  744. end
  745. use_context_plus (status: BOOLEAN): BOOLEAN
  746. local
  747. prev: INTEGER
  748. do
  749. if status then
  750. prev := int_use_context_plus(1)
  751. else
  752. prev := int_use_context_plus(0)
  753. end
  754. if prev.is_equal (0) then
  755. Result := False
  756. else
  757. Result := True
  758. end
  759. end
  760. feature {IUP_WIDGET, IUP_CLIPBOARD}
  761. -- Converts
  762. position_to_integer (i: STRING): INTEGER
  763. do
  764. if i.is_equal("IUP_CENTER") then
  765. Result := 65535
  766. elseif i.is_equal("IUP_LEFT") or i.is_equal("IUP_TOP") then
  767. Result := 65534
  768. elseif i.is_equal("IUP_RIGHT") or i.is_equal("IUP_BOTTOM") then
  769. Result := 65533
  770. elseif i.is_equal("IUP_MOUSEPOS") then
  771. Result := 65532
  772. elseif i.is_equal("IUP_CURRENT") then
  773. Result := 65531
  774. elseif i.is_equal("IUP_CENTERPARENT") then
  775. Result := 65530
  776. else
  777. Result := i.to_integer
  778. end
  779. end
  780. -- PopUp a dialog or menu
  781. popup_predefined_xy (wgt: IUP_WIDGET; x, y: STRING): STRING
  782. -- Displays a dialog or menu in a given position on the screen using
  783. -- predefined values. However you can combine a predefined value with
  784. -- an integer (as string).If there was an error returns IUP_ERROR.
  785. --
  786. -- wgt: Identifier of a dialog or a menu.
  787. -- x: The following predefined values can be used:
  788. --
  789. -- IUP_LEFT: Positions the dialog on the left corner of the main screen
  790. -- IUP_CENTER: Horizontally centralizes the dialog on the main screen
  791. -- IUP_RIGHT: Positions the dialog on the right corner of the main screen
  792. -- IUP_MOUSEPOS: Positions the dialog on the mouse position
  793. -- IUP_CENTERPARENT: Horizontally centralizes the dialog relative to its
  794. -- parent
  795. -- IUP_CURRENT: use the current position of the dialog.
  796. --
  797. -- y: The following predefined calues can be used:
  798. --
  799. -- IUP_TOP: Positions the dialog on the top of the main screen
  800. -- IUP_CENTER: Vertically centralizes the dialog on the main screen
  801. -- IUP_BOTTOM: Positions the dialog on the base of the main screen
  802. -- IUP_MOUSEPOS: Positions the dialog on the mouse position
  803. -- IUP_CENTERPARENT: Vertically centralizes the dialog relative to its
  804. -- parent
  805. -- IUP_CURRENT: use the current position of the dialog.
  806. require
  807. is_valid_position(x, y)
  808. do
  809. Result := popup(wgt, position_to_integer(x), position_to_integer(y))
  810. end
  811. popup (wgt: IUP_WIDGET; x, y: INTEGER): STRING
  812. -- Shows a widget and restricts user interaction only to the specified
  813. -- element.
  814. --
  815. -- wgt: Identifier of a dialog or a menu.
  816. -- x: horizontal position of the top left corner of the window or menu,
  817. -- relative to the origin of the main screen.
  818. -- y: vertical position of the top left corner of the window or menu,
  819. -- relative to the origin of the main screen.
  820. local
  821. r: INTEGER
  822. do
  823. r := int_popup(wgt.widget, x, y)
  824. if r.is_equal(-1) then
  825. Result := "IUP_INVALID"
  826. elseif r.is_equal(0) then
  827. Result := "IUP_NOERROR"
  828. else
  829. Result := "IUP_ERROR"
  830. end
  831. end
  832. -- Commands to handle objects and callbacks
  833. set_widget_for_object (wgt: POINTER; eiffel_object: IUP_WIDGET)
  834. do
  835. objects.put(eiffel_object, wgt)
  836. set_callback (eiffel_object, "LDESTROY_CB", "NONEEDED", 1)
  837. end
  838. get_widget_for_object (wgt: POINTER): detachable IUP_WIDGET
  839. do
  840. Result := widget_for_object(wgt)
  841. end
  842. delete_widget_for_object (wgt: POINTER; eiffel_object: IUP_WIDGET)
  843. do
  844. if objects.has(wgt) then
  845. objects.remove(wgt)
  846. set_callback(eiffel_object, "LDESTROY_CB", "NONEEDED", 0)
  847. int_destroy(wgt)
  848. end
  849. end
  850. set_callback (wgt: IUP_WIDGET; name: STRING; type: STRING; operation: INTEGER)
  851. do
  852. int_set_callback (wgt.widget, get_pointer(name.to_c), get_pointer(type.to_c), operation)
  853. end
  854. set_idle_action (act: detachable FUNCTION[TUPLE, STRING])
  855. do
  856. if act /= Void then
  857. int_set_function (get_pointer(("IDLE_ACTION").to_c), 1)
  858. else
  859. int_set_function (get_pointer(("IDLE_ACTION").to_c), 0)
  860. end
  861. idle_action := act
  862. end
  863. -- Commands to handle the hierarchy and management
  864. iup_append (control: IUP_WIDGET; new_child: IUP_WIDGET): detachable IUP_WIDGET
  865. -- Insert a new widget at the end, return the object of the
  866. -- actual parent.
  867. local
  868. p: POINTER
  869. do
  870. p := int_append(control.widget, new_child.widget)
  871. if p /= default_pointer then
  872. Result := widget_for_object(p)
  873. end
  874. end
  875. iup_detach (control: IUP_WIDGET)
  876. -- Detaches an interface element from its parent.
  877. do
  878. int_detach(control.widget)
  879. end
  880. iup_insert (control: IUP_WIDGET; ref_child: IUP_WIDGET; new_child: IUP_WIDGET): detachable IUP_WIDGET
  881. -- Insert a new widget before the reference widget, return the
  882. -- object of the actual parent.
  883. local
  884. p: POINTER
  885. do
  886. p := int_insert(control.widget, ref_child.widget, new_child.widget)
  887. if p /= default_pointer then
  888. Result := widget_for_object(p)
  889. end
  890. end
  891. iup_reparent (child: IUP_WIDGET; new_parent: IUP_WIDGET; ref_child: IUP_WIDGET): STRING
  892. -- Moves an interface element from one position in the hierarchy
  893. -- tree to another.
  894. local
  895. r: INTEGER
  896. do
  897. r := int_reparent(child.widget, new_parent.widget, ref_child.widget)
  898. if r.is_equal(0) then
  899. Result := "IUP_NOERROR"
  900. else
  901. Result := "IUP_ERROR"
  902. end
  903. end
  904. iup_get_parent (child: IUP_WIDGET): detachable IUP_WIDGET
  905. -- Returns the parent of a control.
  906. local
  907. p: POINTER
  908. do
  909. p := int_get_parent(child.widget)
  910. if p /= default_pointer then
  911. Result := widget_for_object(p)
  912. end
  913. end
  914. iup_get_child (control: IUP_WIDGET; position: INTEGER): detachable IUP_WIDGET
  915. -- Returns the a child of the control given its position
  916. -- or NULL if there is none.
  917. local
  918. p: POINTER
  919. do
  920. p := int_get_child(control.widget, position)
  921. if p /= default_pointer then
  922. Result := widget_for_object(p)
  923. end
  924. end
  925. iup_get_child_pos (control: IUP_WIDGET; child: IUP_WIDGET): INTEGER
  926. -- Returns the position of a child of the given control.
  927. -- The position of the desire child starting at 0, or -1 if child
  928. -- not found.
  929. do
  930. Result := int_get_child_pos(control.widget, child.widget)
  931. end
  932. iup_get_child_count (control: IUP_WIDGET): INTEGER
  933. -- Returns the number of children of the given control.
  934. do
  935. Result := int_get_child_count(control.widget)
  936. end
  937. iup_get_next_child (control: IUP_WIDGET; child: IUP_WIDGET): detachable IUP_WIDGET
  938. -- Returns the a child of the given control given its brother.
  939. -- Returns the handle of the child or Void.
  940. local
  941. p: POINTER
  942. do
  943. p := int_get_next_child(control.widget, child.widget)
  944. if p /= default_pointer then
  945. Result := widget_for_object(p)
  946. end
  947. end
  948. iup_get_brother (control: IUP_WIDGET): detachable IUP_WIDGET
  949. -- Returns the brother of an element.
  950. -- Returns the brother or Void if there is none.
  951. local
  952. p: POINTER
  953. do
  954. p := int_get_brother(control.widget)
  955. if p /= default_pointer then
  956. Result := widget_for_object(p)
  957. end
  958. end
  959. iup_get_dialog (control: IUP_WIDGET): detachable IUP_DIALOG
  960. -- Returns the handle of the dialog that contains that interface
  961. -- element (or NULL if not found). Works also for children of a
  962. -- menu that is associated with a dialog.
  963. local
  964. p: POINTER
  965. do
  966. p := int_get_dialog(control.widget)
  967. if p /= default_pointer and
  968. attached {IUP_DIALOG} objects.at(p) as dlg then
  969. Result := dlg
  970. end
  971. end
  972. iup_get_dialog_child (control: IUP_WIDGET; name: STRING): detachable IUP_WIDGET
  973. -- Returns the identifier of the child element that has the NAME
  974. -- attribute equals to the given value on the same dialog
  975. -- hierarchy (or void if not found). Works also for children of a
  976. -- menu that is associated with a dialog.
  977. local
  978. p: POINTER
  979. do
  980. p := int_get_dialog_child(control.widget, get_pointer(name.to_c))
  981. if p /= default_pointer then
  982. Result := widget_for_object(p)
  983. end
  984. end
  985. iup_refresh (control: IUP_WIDGET)
  986. -- Updates the size and layout of all controls in the same dialog.
  987. do
  988. int_refresh(control.widget)
  989. end
  990. iup_refresh_children (control: IUP_WIDGET)
  991. -- Updates the size and layout of controls after changing size
  992. -- attributes, or attributes that affect the size of the control.
  993. -- Can be used for any element inside a dialog, only its children
  994. -- will be updated. It can change the layout of all the controls
  995. -- inside the given element because of the dynamic layout positioning.
  996. do
  997. int_refresh_children(control.widget)
  998. end
  999. iup_update (control: IUP_WIDGET)
  1000. -- Mark the element to be redraw when the control returns
  1001. -- to the system.
  1002. do
  1003. int_update(control.widget)
  1004. end
  1005. iup_update_children (control: IUP_WIDGET)
  1006. -- Mark element children to be redraw when the control returns
  1007. -- to the system.
  1008. do
  1009. int_update_children(control.widget)
  1010. end
  1011. iup_redraw (control: IUP_WIDGET; flag: INTEGER)
  1012. -- Force the element and its children to be redrawn immediately.
  1013. do
  1014. int_redraw(control.widget, flag)
  1015. end
  1016. iup_convert_xy_to_pos(control: IUP_WIDGET; x, y: INTEGER): INTEGER
  1017. do
  1018. Result := int_convert_xy_to_pos(control.widget, x, y)
  1019. end
  1020. -- Commands to handle attributes
  1021. set_attribute (wgt: IUP_WIDGET; name: STRING; value: STRING)
  1022. do
  1023. int_set_attribute (wgt.widget, get_pointer(name.to_c), get_pointer(value.to_c))
  1024. end
  1025. set_attribute_in_handle (handle: POINTER; name: STRING; value: STRING)
  1026. do
  1027. int_set_attribute (handle, get_pointer(name.to_c), get_pointer(value.to_c))
  1028. end
  1029. set_attribute_widget (wgt: IUP_WIDGET; name: STRING; other_wgt: IUP_WIDGET)
  1030. do
  1031. int_set_attribute_handle (wgt.widget, get_pointer(name.to_c), other_wgt.widget)
  1032. end
  1033. set_attribute_null (wgt: IUP_WIDGET; name: STRING)
  1034. local
  1035. p: POINTER
  1036. do
  1037. int_set_attribute (wgt.widget, get_pointer(name.to_c), p)
  1038. end
  1039. set_attribute_null_in_handle (wgt: POINTER; name: STRING)
  1040. local
  1041. p: POINTER
  1042. do
  1043. int_set_attribute (wgt, get_pointer(name.to_c), p)
  1044. end
  1045. set_str_attribute (wgt: IUP_WIDGET; name: STRING; value: STRING)
  1046. do
  1047. int_set_str_attribute (wgt.widget, get_pointer(name.to_c), get_pointer(value.to_c))
  1048. end
  1049. set_attribute_id (wgt: IUP_WIDGET; name: STRING; id: INTEGER; value: STRING)
  1050. do
  1051. int_set_attribute_id (wgt.widget, get_pointer(name.to_c), id, get_pointer(value.to_c))
  1052. end
  1053. set_str_attribute_id (wgt: IUP_WIDGET; name: STRING; id: INTEGER; value: STRING)
  1054. do
  1055. int_set_str_attribute_id (wgt.widget, get_pointer(name.to_c), id, get_pointer(value.to_c))
  1056. end
  1057. set_attribute_id2 (wgt: IUP_WIDGET; name: STRING; lin: INTEGER; col: INTEGER; value: STRING)
  1058. do
  1059. int_set_attribute_id2 (wgt.widget, get_pointer(name.to_c), lin, col, get_pointer(value.to_c))
  1060. end
  1061. set_attribute_id2_null (wgt: IUP_WIDGET; name: STRING; lin: INTEGER; col: INTEGER)
  1062. local
  1063. p: POINTER
  1064. do
  1065. int_set_attribute_id2 (wgt.widget, get_pointer(name.to_c), lin, col, p)
  1066. end
  1067. set_str_attribute_id2 (wgt: IUP_WIDGET; name: STRING; lin: INTEGER; col: INTEGER; value: STRING)
  1068. do
  1069. int_set_str_attribute_id2 (wgt.widget, get_pointer(name.to_c), lin, col, get_pointer(value.to_c))
  1070. end
  1071. set_int (wgt: IUP_WIDGET; name: STRING; value: INTEGER)
  1072. do
  1073. int_set_int (wgt.widget, get_pointer(name.to_c), value)
  1074. end
  1075. set_float (wgt: IUP_WIDGET; name: STRING; value: REAL_32)
  1076. do
  1077. int_set_float (wgt.widget, get_pointer(name.to_c), value)
  1078. end
  1079. set_double (wgt: IUP_WIDGET; name: STRING; value: REAL_64)
  1080. do
  1081. int_set_double (wgt.widget, get_pointer(name.to_c), value)
  1082. end
  1083. set_rgb (wgt: IUP_WIDGET; name: STRING; r: CHARACTER; g: CHARACTER; b: CHARACTER)
  1084. do
  1085. int_set_rgb (wgt.widget, get_pointer(name.to_c), r, g, b)
  1086. end
  1087. set_int_id (wgt: IUP_WIDGET; name: STRING; id: INTEGER; value: INTEGER)
  1088. do
  1089. int_set_int_id (wgt.widget, get_pointer(name.to_c), id, value)
  1090. end
  1091. set_float_id (wgt: IUP_WIDGET; name: STRING; id: INTEGER; value: REAL_32)
  1092. do
  1093. int_set_float_id (wgt.widget, get_pointer(name.to_c), id, value)
  1094. end
  1095. set_double_id (wgt: IUP_WIDGET; name: STRING; id: INTEGER; value: REAL_64)
  1096. do
  1097. int_set_double_id (wgt.widget, get_pointer(name.to_c), id, value)
  1098. end
  1099. set_rgb_id (wgt: IUP_WIDGET; name: STRING; id: INTEGER; r: CHARACTER; g: CHARACTER; b: CHARACTER)
  1100. do
  1101. int_set_rgb_id (wgt.widget, get_pointer(name.to_c), id, r, g, b)
  1102. end
  1103. set_int_id2 (wgt: IUP_WIDGET; name: STRING; lin: INTEGER; col: INTEGER; value: INTEGER)
  1104. do
  1105. int_set_int_id2 (wgt.widget, get_pointer(name.to_c), lin, col, value)
  1106. end
  1107. set_float_id2 (wgt: IUP_WIDGET; name: STRING; lin: INTEGER; col: INTEGER; value: REAL_32)
  1108. do
  1109. int_set_float_id2 (wgt.widget, get_pointer(name.to_c), lin, col, value)
  1110. end
  1111. set_double_id2 (wgt: IUP_WIDGET; name: STRING; lin: INTEGER; col: INTEGER; value: REAL_64)
  1112. do
  1113. int_set_double_id2 (wgt.widget, get_pointer(name.to_c), lin, col, value)
  1114. end
  1115. set_rgb_id2 (wgt: IUP_WIDGET; name: STRING; lin: INTEGER; col: INTEGER; r: CHARACTER; g: CHARACTER; b: CHARACTER)
  1116. do
  1117. int_set_rgb_id2 (wgt.widget, get_pointer(name.to_c), lin, col, r, g, b)
  1118. end
  1119. reset_attribute (wgt: IUP_WIDGET; name: STRING)
  1120. do
  1121. int_reset_attribute (wgt.widget, get_pointer(name.to_c))
  1122. end
  1123. set_attribute_handle (wgt: IUP_WIDGET; name: STRING; wgt_named: IUP_WIDGET)
  1124. do
  1125. int_set_attribute (wgt.widget, get_pointer(name.to_c), wgt_named.widget)
  1126. end
  1127. get_attribute (wgt: IUP_WIDGET; name: STRING): STRING
  1128. local
  1129. p: POINTER
  1130. str: STRING
  1131. do
  1132. p := int_get_attribute (wgt.widget, get_pointer(name.to_c))
  1133. if p /= default_pointer then
  1134. create str.make_from_c(p)
  1135. Result := str
  1136. else
  1137. Result := ""
  1138. end
  1139. end
  1140. get_attribute_from_handle (handle: POINTER; name: STRING): STRING
  1141. local
  1142. p: POINTER
  1143. str: STRING
  1144. do
  1145. p := int_get_attribute (handle, get_pointer(name.to_c))
  1146. if p /= default_pointer then
  1147. create str.make_from_c(p)
  1148. Result := str
  1149. else
  1150. create Result.make_empty
  1151. end
  1152. end
  1153. get_attribute_widget (wgt: IUP_WIDGET; name: STRING): IUP_WIDGET
  1154. local
  1155. p: POINTER
  1156. do
  1157. p := int_get_attribute (wgt.widget, get_pointer(name.to_c))
  1158. Result := widget_for_object(p)
  1159. end
  1160. get_attribute_ihandle (wgt: IUP_WIDGET; name: STRING): detachable POINTER
  1161. local
  1162. p: POINTER
  1163. do
  1164. p := int_get_attribute (wgt.widget, get_pointer(name.to_c))
  1165. if p /= default_pointer then
  1166. Result := p
  1167. end
  1168. end
  1169. get_attribute_ihandle_from_handle (handle: POINTER; name: STRING): POINTER
  1170. do
  1171. Result := int_get_attribute (handle, get_pointer(name.to_c))
  1172. end
  1173. get_attribute_id (wgt: IUP_WIDGET; name: STRING; id: INTEGER): STRING
  1174. local
  1175. p: POINTER
  1176. str: STRING
  1177. do
  1178. p := int_get_attribute_id (wgt.widget, get_pointer(name.to_c), id)
  1179. if p /= default_pointer then
  1180. create str.make_from_c(p)
  1181. Result := str
  1182. else
  1183. Result := ""
  1184. end
  1185. end
  1186. get_attribute_id2 (wgt: IUP_WIDGET; name: STRING; lin: INTEGER; col: INTEGER): STRING
  1187. local
  1188. p: POINTER
  1189. str: STRING
  1190. do
  1191. p := int_get_attribute_id2 (wgt.widget, get_pointer(name.to_c), lin, col)
  1192. if p /= default_pointer then
  1193. create str.make_from_c(p)
  1194. Result := str
  1195. else
  1196. Result := ""
  1197. end
  1198. end
  1199. get_int (wgt: IUP_WIDGET; name: STRING): INTEGER
  1200. do
  1201. Result := int_get_int (wgt.widget, get_pointer(name.to_c))
  1202. end
  1203. get_int_int (wgt: IUP_WIDGET; name: STRING; i1: POINTER; i2: POINTER): TUPLE[INTEGER, INTEGER]
  1204. local
  1205. a, b: STRING
  1206. count: INTEGER
  1207. tup: TUPLE[INTEGER, INTEGER]
  1208. do
  1209. count := int_get_int_int (wgt.widget, get_pointer(name.to_c), i1, i2)
  1210. create a.make_from_c(i1)
  1211. create b.make_from_c(i2)
  1212. tup := [a.to_integer, b.to_integer]
  1213. Result := tup
  1214. end
  1215. get_int2 (wgt: IUP_WIDGET; name: STRING): INTEGER
  1216. do
  1217. Result := int_get_int2 (wgt.widget, get_pointer(name.to_c))
  1218. end
  1219. get_float (wgt: IUP_WIDGET; name: STRING): REAL_32
  1220. do
  1221. Result := int_get_float (wgt.widget, get_pointer(name.to_c))
  1222. end
  1223. get_double (wgt: IUP_WIDGET; name: STRING): REAL_64
  1224. do
  1225. Result := int_get_double (wgt.widget, get_pointer(name.to_c))
  1226. end
  1227. get_rgb (wgt: IUP_WIDGET; name: STRING): TUPLE[INTEGER, INTEGER, INTEGER]
  1228. local
  1229. color: STRING
  1230. values: LIST[STRING]
  1231. tup: TUPLE[INTEGER, INTEGER, INTEGER]
  1232. do
  1233. color := get_attribute(wgt, name)
  1234. values := color.split(' ')
  1235. if values.count.is_equal(3) and
  1236. values.at(1).is_integer and
  1237. values.at(2).is_integer and
  1238. values.at(3).is_integer then
  1239. tup := [values.at(1).to_integer, values.at(2).to_integer,
  1240. values.at(3).to_integer]
  1241. Result := tup
  1242. else
  1243. io.put_string("Something goes wrong %N")
  1244. Result := [0, 0, 0]
  1245. end
  1246. end
  1247. get_rgba (wgt: IUP_WIDGET; name: STRING): TUPLE[INTEGER, INTEGER, INTEGER, INTEGER]
  1248. local
  1249. color: STRING
  1250. values: LIST[STRING]
  1251. tup: TUPLE[INTEGER, INTEGER, INTEGER, INTEGER]
  1252. do
  1253. color := get_attribute(wgt, name)
  1254. values := color.split(' ')
  1255. if values.count.is_equal(3) and
  1256. values.at(1).is_integer and
  1257. values.at(2).is_integer and
  1258. values.at(3).is_integer then
  1259. tup := [values.at(1).to_integer, values.at(2).to_integer,
  1260. values.at(3).to_integer, 0]
  1261. Result := tup
  1262. elseif values.at(1).is_integer and
  1263. values.at(2).is_integer and
  1264. values.at(3).is_integer and
  1265. values.at(4).is_integer then
  1266. tup := [values.at(1).to_integer, values.at(2).to_integer,
  1267. values.at(3).to_integer, values.at(4).to_integer]
  1268. Result := tup
  1269. else
  1270. io.put_string("Something goes wrong %N")
  1271. Result := [0, 0, 0, 0]
  1272. end
  1273. end
  1274. get_rgb_id (wgt: IUP_WIDGET; name: STRING; id: INTEGER): TUPLE[INTEGER, INTEGER, INTEGER]
  1275. local
  1276. color: STRING
  1277. values: LIST[STRING]
  1278. tup: TUPLE[INTEGER, INTEGER, INTEGER]
  1279. do
  1280. color := get_attribute_id(wgt, name, id)
  1281. values := color.split(' ')
  1282. if values.count.is_equal(3) and
  1283. values.at(1).is_integer and
  1284. values.at(2).is_integer and
  1285. values.at(3).is_integer then
  1286. tup := [values.at(1).to_integer, values.at(2).to_integer,
  1287. values.at(3).to_integer]
  1288. Result := tup
  1289. else
  1290. io.put_string("Something goes wrong %N")
  1291. Result := [0, 0, 0]
  1292. end
  1293. end
  1294. get_hsi (wgt: IUP_WIDGET; name: STRING): TUPLE[INTEGER, INTEGER, INTEGER]
  1295. do
  1296. Result := get_rgb(wgt, name)
  1297. end
  1298. get_hsi_real (wgt: IUP_WIDGET; name: STRING): TUPLE[REAL_64, REAL_64, REAL_64]
  1299. local
  1300. color: STRING
  1301. values: LIST[STRING]
  1302. tup: TUPLE[REAL_64, REAL_64, REAL_64]
  1303. do
  1304. color := get_attribute(wgt, name)
  1305. values := color.split(' ')
  1306. if values.count.is_equal(3) and
  1307. values.at(1).is_real_64 and
  1308. values.at(2).is_real_64 and
  1309. values.at(3).is_real_64 then
  1310. tup := [values.at(1).to_real_64, values.at(2).to_real_64,
  1311. values.at(3).to_real_64]
  1312. Result := tup
  1313. else
  1314. io.put_string("Something goes wrong %N")
  1315. Result := [(0).to_double, (0).to_double, (0).to_double]
  1316. end
  1317. end
  1318. get_attribute_handle (wgt: IUP_WIDGET; name: STRING): IUP_WIDGET
  1319. local
  1320. p: POINTER
  1321. do
  1322. p := int_get_attribute_handle (wgt.widget, get_pointer(name.to_c))
  1323. Result := widget_for_object(p)
  1324. end
  1325. feature {IUP}
  1326. -- Callbacks
  1327. launch_idle_action_fidle: INTEGER
  1328. local
  1329. v: STRING
  1330. do
  1331. if attached idle_action as int_cb then
  1332. v := int_cb.item([])
  1333. Result := return_value(v)
  1334. end
  1335. end
  1336. launch_help_cb_fn (obj: POINTER)
  1337. do
  1338. if objects.has(obj) and
  1339. attached objects.at(obj) as iup_widget then
  1340. iup_widget.execute_help
  1341. end
  1342. end
  1343. launch_map_cb_fn (obj: POINTER): INTEGER
  1344. local
  1345. v: STRING
  1346. do
  1347. if objects.has(obj) and
  1348. attached objects.at(obj) as iup_widget then
  1349. v := iup_widget.execute_map
  1350. Result := return_value(v)
  1351. end
  1352. end
  1353. launch_unmap_cb_fn (obj: POINTER): INTEGER
  1354. local
  1355. v: STRING
  1356. do
  1357. if objects.has(obj) and
  1358. attached objects.at(obj) as iup_widget then
  1359. v := iup_widget.execute_unmap
  1360. Result := return_value(v)
  1361. end
  1362. end
  1363. launch_destroy_cb_fn (obj: POINTER): INTEGER
  1364. local
  1365. v: STRING
  1366. do
  1367. if objects.has(obj) and
  1368. attached objects.at(obj) as iup_widget then
  1369. v := iup_widget.execute_destroy
  1370. Result := return_value(v)
  1371. end
  1372. end
  1373. launch_ldestroy_cb_fn (obj: POINTER): INTEGER
  1374. --local
  1375. -- iup_widget: IUP_WIDGET
  1376. do
  1377. ---if objects.has(obj) then
  1378. -- objects.remove(obj)
  1379. -- if objects.has(obj) then
  1380. -- delete_widget_for_object (obj, iup_widget)
  1381. -- end
  1382. Result := return_value("IUP_DEFAULT")
  1383. --end
  1384. end
  1385. launch_getfocus_cb_fn (obj: POINTER): INTEGER
  1386. local
  1387. v: STRING
  1388. do
  1389. if objects.has(obj) and
  1390. attached objects.at(obj) as iup_widget then
  1391. v := iup_widget.execute_getfocus
  1392. Result := return_value(v)
  1393. end
  1394. end
  1395. launch_killfocus_cb_fn (obj: POINTER): INTEGER
  1396. local
  1397. v: STRING
  1398. do
  1399. if objects.has(obj) and
  1400. attached objects.at(obj) as iup_widget then
  1401. v := iup_widget.execute_killfocus
  1402. Result := return_value(v)
  1403. end
  1404. end
  1405. launch_enterwindow_cb_fn (obj: POINTER): INTEGER
  1406. local
  1407. v: STRING
  1408. do
  1409. if objects.has(obj) and
  1410. attached objects.at(obj) as iup_widget then
  1411. v := iup_widget.execute_enterwindow
  1412. Result := return_value(v)
  1413. end
  1414. end
  1415. launch_leavewindow_cb_fn (obj: POINTER): INTEGER
  1416. local
  1417. v: STRING
  1418. do
  1419. if objects.has(obj) and
  1420. attached objects.at(obj) as iup_widget then
  1421. v := iup_widget.execute_leavewindow
  1422. Result := return_value(v)
  1423. end
  1424. end
  1425. launch_k_any_fni (obj: POINTER; int: INTEGER): INTEGER
  1426. local
  1427. v: STRING
  1428. do
  1429. if objects.has(obj) and
  1430. attached objects.at(obj) as iup_widget then
  1431. v := iup_widget.execute_k_any(int)
  1432. Result := return_value(v)
  1433. end
  1434. end
  1435. launch_action_fn (obj: POINTER): INTEGER
  1436. local
  1437. v: STRING
  1438. do
  1439. if objects.has(obj) and
  1440. attached objects.at(obj) as iup_widget then
  1441. v := iup_widget.execute_action
  1442. Result := return_value(v)
  1443. end
  1444. end
  1445. -- Dialogs
  1446. launch_close_cb_fn (obj: POINTER): INTEGER
  1447. local
  1448. v: STRING
  1449. do
  1450. if objects.has(obj) and
  1451. attached objects.at(obj) as iup_widget then
  1452. v := iup_widget.execute_close
  1453. Result := return_value(v)
  1454. end
  1455. end
  1456. launch_copydata_cb_fnsi (obj, cmdline: POINTER; size: INTEGER): INTEGER
  1457. local
  1458. v, cl: STRING
  1459. do
  1460. if objects.has(obj) and
  1461. attached objects.at(obj) as iup_widget then
  1462. if cmdline /= default_pointer then
  1463. create cl.make_from_c(cmdline)
  1464. else
  1465. cl := ""
  1466. end
  1467. v := iup_widget.execute_copydata(cl, size)
  1468. Result := return_value(v)
  1469. end
  1470. end
  1471. -- Also for canvas, label, list.
  1472. launch_dropfiles_cb_fnsiii (obj: POINTER; filename: POINTER; num: INTEGER; x: INTEGER; y: INTEGER): INTEGER
  1473. local
  1474. v, file: STRING
  1475. do
  1476. if objects.has(obj) and
  1477. attached objects.at(obj) as iup_widget then
  1478. if filename /= default_pointer then
  1479. create file.make_from_c(filename)
  1480. else
  1481. file := ""
  1482. end
  1483. v := iup_widget.execute_dropfiles(file, num, x, y)
  1484. Result := return_value(v)
  1485. end
  1486. end
  1487. launch_mdiactivate_cb_fn (obj: POINTER): INTEGER
  1488. local
  1489. v: STRING
  1490. do
  1491. if objects.has(obj) and
  1492. attached objects.at(obj) as iup_widget then
  1493. v := iup_widget.execute_mdiactivate
  1494. Result := return_value(v)
  1495. end
  1496. end
  1497. launch_move_cb_fnii (obj: POINTER; x: INTEGER; y: INTEGER): INTEGER
  1498. local
  1499. v: STRING
  1500. do
  1501. if objects.has(obj) and
  1502. attached objects.at(obj) as iup_widget then
  1503. v := iup_widget.execute_move(x, y)
  1504. Result := return_value(v)
  1505. end
  1506. end
  1507. -- Also for canvas
  1508. launch_resize_cb_fnii (obj: POINTER; width: INTEGER; height: INTEGER): INTEGER
  1509. local
  1510. v: STRING
  1511. do
  1512. if objects.has(obj) and
  1513. attached objects.at(obj) as iup_widget then
  1514. v := iup_widget.execute_resize(width, height)
  1515. Result := return_value(v)
  1516. end
  1517. end
  1518. launch_show_cb_fni (obj: POINTER; state: INTEGER): INTEGER
  1519. local
  1520. v, s: STRING
  1521. do
  1522. if objects.has(obj) and
  1523. attached objects.at(obj) as iup_widget then
  1524. if state.is_equal(0) then
  1525. s := "IUP_SHOW"
  1526. elseif state.is_equal(1) then
  1527. s := "IUP_RESTORE"
  1528. elseif state.is_equal(2) then
  1529. s := "IUP_MINIMIZE"
  1530. elseif state.is_equal(3) then
  1531. s := "IUP_MAXIMIZE"
  1532. else
  1533. s := "IUP_HIDE"
  1534. end
  1535. v := iup_widget.execute_show(s)
  1536. Result := return_value(v)
  1537. end
  1538. end
  1539. launch_trayclick_cb_fniii (obj: POINTER; but: INTEGER; pressed: INTEGER; dclick: INTEGER): INTEGER
  1540. local
  1541. v: STRING
  1542. do
  1543. if objects.has(obj) and
  1544. attached objects.at(obj) as iup_widget then
  1545. v := iup_widget.execute_trayclick(but, pressed, dclick)
  1546. Result := return_value(v)
  1547. end
  1548. end
  1549. -- Callback for file dialog
  1550. launch_file_cb_fnss (obj, file_name, status: POINTER): INTEGER
  1551. local
  1552. v, file, st: STRING
  1553. do
  1554. if objects.has(obj) and
  1555. attached objects.at(obj) as iup_widget then
  1556. if file_name /= default_pointer then
  1557. create file.make_from_c(file_name)
  1558. else
  1559. file := ""
  1560. end
  1561. if status /= default_pointer then
  1562. create st.make_from_c(status)
  1563. else
  1564. st := ""
  1565. end
  1566. v := iup_widget.execute_file(file, st)
  1567. Result := return_value(v)
  1568. end
  1569. end
  1570. -- Color update
  1571. launch_colorupdate_cb_fn (obj: POINTER): INTEGER
  1572. local
  1573. v: STRING
  1574. do
  1575. if objects.has(obj) and
  1576. attached objects.at(obj) as iup_widget then
  1577. v := iup_widget.execute_colorupdate
  1578. Result := return_value(v)
  1579. end
  1580. end
  1581. -- Progress bar dialog
  1582. launch_cancel_cb_fn(obj: POINTER): INTEGER
  1583. local
  1584. v: STRING
  1585. do
  1586. if objects.has(obj) and
  1587. attached objects.at(obj) as iup_widget then
  1588. v := iup_widget.execute_cancel
  1589. Result := return_value(v)
  1590. end
  1591. end
  1592. -- Callbacks for tabs
  1593. launch_tabchange_cb_fnnn (obj, new_tab, old_tab: POINTER): INTEGER
  1594. local
  1595. v: STRING
  1596. do
  1597. if objects.has(obj) and
  1598. attached objects.at(obj) as iup_widget and
  1599. new_tab /= default_pointer and old_tab /= default_pointer and
  1600. attached objects.at(new_tab) as ntab and
  1601. attached objects.at(old_tab) as otab then
  1602. v := iup_widget.execute_tabchange(ntab, otab)
  1603. Result := return_value(v)
  1604. end
  1605. end
  1606. launch_tabchangepos_cb_fnii (obj: POINTER; new_pos, old_pos: INTEGER): INTEGER
  1607. local
  1608. v: STRING
  1609. do
  1610. if objects.has(obj) and
  1611. attached objects.at(obj) as iup_widget then
  1612. v := iup_widget.execute_tabchangepos(new_pos, old_pos)
  1613. Result := return_value(v)
  1614. end
  1615. end
  1616. launch_tabclose_cb_fni (obj: POINTER; pos: INTEGER): INTEGER
  1617. local
  1618. v: STRING
  1619. do
  1620. if objects.has(obj) and
  1621. attached objects.at(obj) as iup_widget then
  1622. v := iup_widget.execute_tabclose(pos)
  1623. Result := return_value(v)
  1624. end
  1625. end
  1626. launch_rightclick_cb_fni (obj: POINTER; pos: INTEGER): INTEGER
  1627. local
  1628. v: STRING
  1629. do
  1630. if objects.has(obj) and
  1631. attached objects.at(obj) as iup_widget then
  1632. v := iup_widget.execute_rightclick(pos)
  1633. Result := return_value(v)
  1634. end
  1635. end
  1636. -- Callbacks for DetachBox
  1637. launch_detached_cb_fnnii (obj, new_parent: POINTER; x, y: INTEGER): INTEGER
  1638. local
  1639. v: STRING
  1640. nparent: IUP_DIALOG
  1641. do
  1642. if objects.has(obj) and
  1643. attached objects.at(obj) as iup_widget then
  1644. create nparent.dialog_widget(new_parent)
  1645. v := iup_widget.execute_detached(nparent, x, y)
  1646. Result := return_value(v)
  1647. end
  1648. end
  1649. launch_restored_cb_fnnii (obj, old_parent: POINTER; x, y: INTEGER): INTEGER
  1650. local
  1651. v: STRING
  1652. do
  1653. if objects.has(obj) and objects.has(old_parent) and
  1654. attached objects.at(obj) as iup_widget and
  1655. attached objects.at(old_parent) as oparent then
  1656. v := iup_widget.execute_restored(oparent, x, y)
  1657. Result := return_value(v)
  1658. end
  1659. end
  1660. -- Callbacks for Expander
  1661. launch_openclose_cb_fni (obj: POINTER; state: INTEGER): INTEGER
  1662. local
  1663. v: STRING
  1664. do
  1665. if objects.has(obj) and
  1666. attached objects.at(obj) as iup_widget then
  1667. v := iup_widget.execute_openclose(state)
  1668. Result := return_value(v)
  1669. end
  1670. end
  1671. launch_extrabutton_cb_fnii (obj: POINTER; button, pressed: INTEGER): INTEGER
  1672. local
  1673. v: STRING
  1674. do
  1675. if objects.has(obj) and
  1676. attached objects.at(obj) as iup_widget then
  1677. v := iup_widget.execute_extrabutton(button, pressed)
  1678. Result := return_value(v)
  1679. end
  1680. end
  1681. -- Callback for split, calendar, toggle, val.
  1682. launch_valuechanged_cb_fn (obj: POINTER): INTEGER
  1683. local
  1684. v: STRING
  1685. do
  1686. if objects.has(obj) and
  1687. attached objects.at(obj) as iup_widget then
  1688. v := iup_widget.execute_valuechanged
  1689. Result := return_value(v)
  1690. end
  1691. end
  1692. -- Callback for button, label, list, text.
  1693. launch_button_cb_fniiiis (obj: POINTER; button, pressed, x, y: INTEGER; status: POINTER): INTEGER
  1694. local
  1695. v, st: STRING
  1696. do
  1697. if objects.has(obj) and
  1698. attached objects.at(obj) as iup_widget then
  1699. if status /= default_pointer then
  1700. create st.make_from_c(status)
  1701. else
  1702. st := ""
  1703. end
  1704. v := iup_widget.execute_button(button.to_character_8.out.to_integer_32,
  1705. pressed, x, y, st)
  1706. Result := return_value(v)
  1707. end
  1708. end
  1709. -- Callbacks for canvas
  1710. launch_action_fnff (obj: POINTER; posx, posy: REAL_32): INTEGER
  1711. local
  1712. v: STRING
  1713. do
  1714. if objects.has(obj) and
  1715. attached objects.at(obj) as iup_widget then
  1716. v := iup_widget.execute_action_fnff(posx, posy)
  1717. Result := return_value(v)
  1718. end
  1719. end
  1720. launch_focus_cb_fni (obj: POINTER; focus: INTEGER): INTEGER
  1721. local
  1722. v: STRING
  1723. do
  1724. if objects.has(obj) and
  1725. attached objects.at(obj) as iup_widget then
  1726. v := iup_widget.execute_focus(focus)
  1727. Result := return_value(v)
  1728. end
  1729. end
  1730. -- Also for text.
  1731. launch_motion_cb_fniis (obj: POINTER; x, y: INTEGER; status: POINTER): INTEGER
  1732. local
  1733. v, st: STRING
  1734. do
  1735. if objects.has(obj) and
  1736. attached objects.at(obj) as iup_widget then
  1737. if status /= default_pointer then
  1738. create st.make_from_c(status)
  1739. else
  1740. st := ""
  1741. end
  1742. v := iup_widget.execute_motion(x, y, st)
  1743. Result := return_value(v)
  1744. end
  1745. end
  1746. launch_keypress_cb_fnii (obj: POINTER; c, press: INTEGER): INTEGER
  1747. local
  1748. v: STRING
  1749. do
  1750. if objects.has(obj) and
  1751. attached objects.at(obj) as iup_widget then
  1752. v := iup_widget.execute_keypress(c, press)
  1753. Result := return_value(v)
  1754. end
  1755. end
  1756. launch_scroll_cb_fniff (obj: POINTER; op: INTEGER; posx, posy: REAL_32): INTEGER
  1757. local
  1758. v: STRING
  1759. do
  1760. if objects.has(obj) and
  1761. attached objects.at(obj) as iup_widget then
  1762. v := iup_widget.execute_scroll(op, posx, posy)
  1763. Result := return_value(v)
  1764. end
  1765. end
  1766. launch_wheel_cb_fndiis (obj: POINTER; delta: REAL_32; x, y: INTEGER; status: POINTER): INTEGER
  1767. local
  1768. v, st: STRING
  1769. do
  1770. if objects.has(obj) and
  1771. attached objects.at(obj) as iup_widget then
  1772. if status /= default_pointer then
  1773. create st.make_from_c(status)
  1774. else
  1775. st := ""
  1776. end
  1777. v := iup_widget.execute_wheel(delta, x, y, st)
  1778. Result := return_value(v)
  1779. end
  1780. end
  1781. -- Callback for link
  1782. launch_click_cb_fns (obj, url: POINTER): INTEGER
  1783. local
  1784. v, u: STRING
  1785. do
  1786. if objects.has(obj) and
  1787. attached objects.at(obj) as iup_widget then
  1788. if url /= default_pointer then
  1789. create u.make_from_c(url)
  1790. else
  1791. u := ""
  1792. end
  1793. v := iup_widget.execute_click(u)
  1794. Result := return_value(v)
  1795. end
  1796. end
  1797. -- Callbacks for list
  1798. launch_action_fnsii (obj, text: POINTER; item, state: INTEGER): INTEGER
  1799. local
  1800. v, t: STRING
  1801. do
  1802. if objects.has(obj) and
  1803. attached objects.at(obj) as iup_widget then
  1804. if text /= default_pointer then
  1805. create t.make_from_c(text)
  1806. else
  1807. t := ""
  1808. end
  1809. v := iup_widget.execute_action_fnsii(t, item, state)
  1810. Result := return_value(v)
  1811. end
  1812. end
  1813. launch_caret_cb_fniii (obj: POINTER; lin, col, pos: INTEGER): INTEGER
  1814. local
  1815. v: STRING
  1816. do
  1817. if objects.has(obj) and
  1818. attached objects.at(obj) as iup_widget then
  1819. v := iup_widget.execute_caret(lin, col, pos)
  1820. Result := return_value(v)
  1821. end
  1822. end
  1823. launch_dblclick_cb_fnis (obj: POINTER; item: INTEGER; text: POINTER): INTEGER
  1824. local
  1825. v, t: STRING
  1826. do
  1827. if objects.has(obj) and
  1828. attached objects.at(obj) as iup_widget then
  1829. if text /= default_pointer then
  1830. create t.make_from_c(text)
  1831. else
  1832. t := ""
  1833. end
  1834. v := iup_widget.execute_dblclick(item, t)
  1835. Result := return_value(v)
  1836. end
  1837. end
  1838. launch_dragdrop_cb_fniiii (obj: POINTER; drag_id, drop_id, isshift, iscontrol: INTEGER): INTEGER
  1839. local
  1840. v: STRING
  1841. do
  1842. if objects.has(obj) and
  1843. attached objects.at(obj) as iup_widget then
  1844. v := iup_widget.execute_dragdrop(drag_id, drop_id, isshift, iscontrol)
  1845. Result := return_value(v)
  1846. end
  1847. end
  1848. launch_dropdown_cb_fni (obj: POINTER; state: INTEGER): INTEGER
  1849. local
  1850. v: STRING
  1851. do
  1852. if objects.has(obj) and
  1853. attached objects.at(obj) as iup_widget then
  1854. v := iup_widget.execute_dropdown(state)
  1855. Result := return_value(v)
  1856. end
  1857. end
  1858. launch_edit_cb_fnis (obj: POINTER; c: INTEGER; new_value: POINTER): INTEGER
  1859. local
  1860. v, nv: STRING
  1861. do
  1862. if objects.has(obj) and
  1863. attached objects.at(obj) as iup_widget then
  1864. if new_value /= default_pointer then
  1865. create nv.make_from_c(new_value)
  1866. else
  1867. nv := ""
  1868. end
  1869. v := iup_widget.execute_edit(c, nv)
  1870. Result := return_value(v)
  1871. end
  1872. end
  1873. launch_multiselect_cb_fns (obj, value: POINTER): INTEGER
  1874. local
  1875. v, tv: STRING
  1876. do
  1877. if objects.has(obj) and
  1878. attached objects.at(obj) as iup_widget then
  1879. if value /= default_pointer then
  1880. create tv.make_from_c(value)
  1881. else
  1882. tv := ""
  1883. end
  1884. v := iup_widget.execute_multiselect(tv)
  1885. Result := return_value(v)
  1886. end
  1887. end
  1888. -- Callback for spin.
  1889. launch_spin_cb_fni (obj: POINTER; inc: INTEGER): INTEGER
  1890. local
  1891. v: STRING
  1892. do
  1893. if objects.has(obj) and
  1894. attached objects.at(obj) as iup_widget then
  1895. v := iup_widget.execute_spin(inc)
  1896. Result := return_value(v)
  1897. end
  1898. end
  1899. -- Callbacks for text.
  1900. launch_action_fnis (obj: POINTER; c: INTEGER; new_value: POINTER): INTEGER
  1901. local
  1902. v, nv: STRING
  1903. do
  1904. if objects.has(obj) and
  1905. attached objects.at(obj) as iup_widget then
  1906. if new_value /= default_pointer then
  1907. create nv.make_from_c(new_value)
  1908. else
  1909. nv := ""
  1910. end
  1911. v := iup_widget.execute_action_fnis(c, nv)
  1912. Result := return_value(v)
  1913. end
  1914. end
  1915. -- Callbacks for toggle.
  1916. launch_action_fni (obj: POINTER; state: INTEGER): INTEGER
  1917. local
  1918. v: STRING
  1919. do
  1920. if objects.has(obj) and
  1921. attached objects.at(obj) as iup_widget then
  1922. v := iup_widget.execute_action_fni(state)
  1923. Result := return_value(v)
  1924. end
  1925. end
  1926. -- Callbacks for tree
  1927. launch_selection_cb_fnii (obj: POINTER; id, status: INTEGER): INTEGER
  1928. local
  1929. v: STRING
  1930. do
  1931. if objects.has(obj) and
  1932. attached objects.at(obj) as iup_widget then
  1933. v := iup_widget.execute_selection(id, status)
  1934. Result := return_value(v)
  1935. end
  1936. end
  1937. launch_multiselection_cb_fnpi (obj: POINTER; ids: POINTER; n: INTEGER): INTEGER
  1938. local
  1939. v: STRING
  1940. do
  1941. if objects.has(obj) and
  1942. attached objects.at(obj) as iup_widget then
  1943. v := iup_widget.execute_multiselection(ids, n)
  1944. Result := return_value(v)
  1945. end
  1946. end
  1947. launch_multiunselection_cb_fnpi (obj: POINTER; ids: POINTER; n: INTEGER): INTEGER
  1948. local
  1949. v: STRING
  1950. do
  1951. if objects.has(obj) and
  1952. attached objects.at(obj) as iup_widget then
  1953. v := iup_widget.execute_multiunselection(ids, n)
  1954. Result := return_value(v)
  1955. end
  1956. end
  1957. launch_branchopen_cb_fni (obj: POINTER; id: INTEGER): INTEGER
  1958. local
  1959. v: STRING
  1960. do
  1961. if objects.has(obj) and
  1962. attached objects.at(obj) as iup_widget then
  1963. v := iup_widget.execute_branchopen(id)
  1964. Result := return_value(v)
  1965. end
  1966. end
  1967. launch_branchclose_cb_fni (obj: POINTER; id: INTEGER): INTEGER
  1968. local
  1969. v: STRING
  1970. do
  1971. if objects.has(obj) and
  1972. attached objects.at(obj) as iup_widget then
  1973. v := iup_widget.execute_branchclose(id)
  1974. Result := return_value(v)
  1975. end
  1976. end
  1977. launch_executeleaf_cb_fni (obj: POINTER; id: INTEGER): INTEGER
  1978. local
  1979. v: STRING
  1980. do
  1981. if objects.has(obj) and
  1982. attached objects.at(obj) as iup_widget then
  1983. v := iup_widget.execute_executeleaf(id)
  1984. Result := return_value(v)
  1985. end
  1986. end
  1987. launch_showrename_cb_fni (obj: POINTER; id: INTEGER): INTEGER
  1988. local
  1989. v: STRING
  1990. do
  1991. if objects.has(obj) and
  1992. attached objects.at(obj) as iup_widget then
  1993. v := iup_widget.execute_showrename(id)
  1994. Result := return_value(v)
  1995. end
  1996. end
  1997. launch_rename_cb_fnis (obj: POINTER; id: INTEGER; title: POINTER): INTEGER
  1998. local
  1999. v, t: STRING
  2000. do
  2001. if objects.has(obj) and
  2002. attached objects.at(obj) as iup_widget then
  2003. if title /= default_pointer then
  2004. create t.make_from_c(title)
  2005. else
  2006. t := ""
  2007. end
  2008. v := iup_widget.execute_rename(id, t)
  2009. Result := return_value(v)
  2010. end
  2011. end
  2012. launch_noderemoved_cb_fns (obj: POINTER; userdata: POINTER): INTEGER
  2013. local
  2014. v: STRING
  2015. do
  2016. if objects.has(obj) and
  2017. attached objects.at(obj) as iup_widget then
  2018. v := iup_widget.execute_noderemoved(userdata)
  2019. Result := return_value(v)
  2020. end
  2021. end
  2022. launch_togglevalue_cb_fnii (obj: POINTER; id, state: INTEGER): INTEGER
  2023. local
  2024. v: STRING
  2025. do
  2026. if objects.has(obj) and
  2027. attached objects.at(obj) as iup_widget then
  2028. v := iup_widget.execute_togglevalue(id, state)
  2029. Result := return_value(v)
  2030. end
  2031. end
  2032. -- Callback for menu item ans submenu
  2033. launch_highlight_cb_fn (obj: POINTER): INTEGER
  2034. local
  2035. v: STRING
  2036. do
  2037. if objects.has(obj) and
  2038. attached objects.at(obj) as iup_widget then
  2039. v := iup_widget.execute_highlight
  2040. Result := return_value(v)
  2041. end
  2042. end
  2043. -- Callbacks for menus
  2044. launch_open_cb_fn (obj: POINTER): INTEGER
  2045. local
  2046. v: STRING
  2047. do
  2048. if objects.has(obj) and
  2049. attached objects.at(obj) as iup_widget then
  2050. v := iup_widget.execute_open
  2051. Result := return_value(v)
  2052. end
  2053. end
  2054. launch_menuclose_cb_fn (obj: POINTER): INTEGER
  2055. local
  2056. v: STRING
  2057. do
  2058. if objects.has(obj) and
  2059. attached objects.at(obj) as iup_widget then
  2060. v := iup_widget.execute_menuclose
  2061. Result := return_value(v)
  2062. end
  2063. end
  2064. -- Drag&Drop callbacks
  2065. launch_dragbegin_cb_fnii (obj: POINTER; x, y: INTEGER): INTEGER
  2066. local
  2067. v: STRING
  2068. do
  2069. if objects.has(obj) and
  2070. attached objects.at(obj) as iup_widget then
  2071. v := iup_widget.execute_dragbegin(x, y)
  2072. Result := return_value(v)
  2073. end
  2074. end
  2075. launch_dragdatasize_cb_fns (obj, type: POINTER): INTEGER
  2076. local
  2077. t: STRING
  2078. do
  2079. if objects.has(obj) and
  2080. attached objects.at(obj) as iup_widget then
  2081. if type /= default_pointer then
  2082. create t.make_from_c(type)
  2083. else
  2084. t := ""
  2085. end
  2086. Result := iup_widget.execute_dragdatasize(t)
  2087. end
  2088. end
  2089. launch_dragdata_cb_fnsvi (obj, type, data: POINTER; size: INTEGER): INTEGER
  2090. local
  2091. v, t: STRING
  2092. do
  2093. if objects.has(obj) and
  2094. attached objects.at(obj) as iup_widget then
  2095. if type /= default_pointer then
  2096. create t.make_from_c(type)
  2097. else
  2098. t := ""
  2099. end
  2100. v := iup_widget.execute_dragdata(t, data, size)
  2101. Result := return_value(v)
  2102. end
  2103. end
  2104. launch_dragend_cb_fni (obj: POINTER; action: INTEGER): INTEGER
  2105. local
  2106. v: STRING
  2107. do
  2108. if objects.has(obj) and
  2109. attached objects.at(obj) as iup_widget then
  2110. v := iup_widget.execute_dragend(action)
  2111. Result := return_value(v)
  2112. end
  2113. end
  2114. launch_dropdata_cb_fnsviii (obj, type, data: POINTER; size, x, y: INTEGER): INTEGER
  2115. local
  2116. v, t: STRING
  2117. do
  2118. if objects.has(obj) and
  2119. attached objects.at(obj) as iup_widget then
  2120. if type /= default_pointer then
  2121. create t.make_from_c(type)
  2122. else
  2123. t := ""
  2124. end
  2125. v := iup_widget.execute_dropdata(t, data, size, x, y)
  2126. Result := return_value(v)
  2127. end
  2128. end
  2129. launch_dropmotion_cb_fniis (obj: POINTER; x, y: INTEGER; status: POINTER): INTEGER
  2130. local
  2131. v, st: STRING
  2132. do
  2133. if objects.has(obj) and
  2134. attached objects.at(obj) as iup_widget then
  2135. if status /= default_pointer then
  2136. create st.make_from_c(status)
  2137. else
  2138. st := ""
  2139. end
  2140. v := iup_widget.execute_dropmotion(x, y, st)
  2141. Result := return_value(v)
  2142. end
  2143. end
  2144. -- Callback for recent file menu
  2145. launch_recent_cb_fn (obj: POINTER): INTEGER
  2146. local
  2147. v: STRING
  2148. do
  2149. if objects.has(obj) and
  2150. attached objects.at(obj) as iup_widget then
  2151. v := iup_widget.execute_recent
  2152. Result := return_value(v)
  2153. end
  2154. end
  2155. -- Callback for get param
  2156. launch_param_cb_fniv (obj: POINTER; param_index: INTEGER; user_data: POINTER): INTEGER
  2157. do
  2158. if attached get_param as int_cb then
  2159. Result := int_cb.execute_param(obj, param_index, user_data)
  2160. end
  2161. end
  2162. -- Callbacks for flat button
  2163. launch_flat_action_fn (obj: POINTER): INTEGER
  2164. local
  2165. v: STRING
  2166. do
  2167. if objects.has(obj) and
  2168. attached objects.at(obj) as iup_widget then
  2169. v := iup_widget.execute_flat_action
  2170. Result := return_value(v)
  2171. end
  2172. end
  2173. launch_flat_button_cb_fniiiis (obj: POINTER; button, pressed, x, y: INTEGER; status: POINTER): INTEGER
  2174. local
  2175. v, st: STRING
  2176. do
  2177. if objects.has(obj) and
  2178. attached objects.at(obj) as iup_widget then
  2179. if status /= default_pointer then
  2180. create st.make_from_c(status)
  2181. else
  2182. st := ""
  2183. end
  2184. v := iup_widget.execute_flat_button(button.to_character_8.out.to_integer_32,
  2185. pressed, x, y, st)
  2186. Result := return_value(v)
  2187. end
  2188. end
  2189. launch_flat_focus_cb_fni (obj: POINTER; focus: INTEGER): INTEGER
  2190. local
  2191. v: STRING
  2192. do
  2193. if objects.has(obj) and
  2194. attached objects.at(obj) as iup_widget then
  2195. v := iup_widget.execute_flat_focus(focus)
  2196. Result := return_value(v)
  2197. end
  2198. end
  2199. launch_flat_enterwindow_cb_fn (obj: POINTER): INTEGER
  2200. local
  2201. v: STRING
  2202. do
  2203. if objects.has(obj) and
  2204. attached objects.at(obj) as iup_widget then
  2205. v := iup_widget.execute_flat_enterwindow
  2206. Result := return_value(v)
  2207. end
  2208. end
  2209. launch_flat_leavewindow_cb_fn (obj: POINTER): INTEGER
  2210. local
  2211. v: STRING
  2212. do
  2213. if objects.has(obj) and
  2214. attached objects.at(obj) as iup_widget then
  2215. v := iup_widget.execute_flat_leavewindow
  2216. Result := return_value(v)
  2217. end
  2218. end
  2219. -- Callbacks for cells
  2220. launch_draw_cb_fniiiiiic (obj: POINTER; line, column, xmin, xmax, ymin, ymax: INTEGER; canvas: POINTER): INTEGER
  2221. local
  2222. v: STRING
  2223. do
  2224. if objects.has(obj) and
  2225. attached objects.at(obj) as iup_widget then
  2226. v := iup_widget.execute_draw(line, column, xmin, xmax, ymin, ymax, canvas)
  2227. Result := return_value(v)
  2228. end
  2229. end
  2230. launch_height_cb_fni (obj: POINTER; line: INTEGER): INTEGER
  2231. do
  2232. if objects.has(obj) and
  2233. attached objects.at(obj) as iup_widget then
  2234. Result := iup_widget.execute_height(line)
  2235. end
  2236. end
  2237. launch_hspan_cb_fnii (obj: POINTER; line, column: INTEGER): INTEGER
  2238. do
  2239. if objects.has(obj) and
  2240. attached objects.at(obj) as iup_widget then
  2241. Result := iup_widget.execute_hspan(line, column)
  2242. end
  2243. end
  2244. launch_mouseclick_cb_fniiiiiis (obj: POINTER; button, pressed, line, column, x, y: INTEGER; status: POINTER): INTEGER
  2245. local
  2246. v, st: STRING
  2247. do
  2248. if objects.has(obj) and
  2249. attached objects.at(obj) as iup_widget then
  2250. if status /= default_pointer then
  2251. create st.make_from_c(status)
  2252. else
  2253. st := ""
  2254. end
  2255. v := iup_widget.execute_mouseclick(button.to_character_8.out.to_integer_32,
  2256. pressed, line, column, x, y, st)
  2257. Result := return_value(v)
  2258. end
  2259. end
  2260. launch_mousemotion_cb_fniiiis (obj: POINTER; line, column, x, y: INTEGER; r: POINTER): INTEGER
  2261. local
  2262. v, rs: STRING
  2263. do
  2264. if objects.has(obj) and
  2265. attached objects.at(obj) as iup_widget then
  2266. if r /= default_pointer then
  2267. create rs.make_from_c(r)
  2268. else
  2269. rs := ""
  2270. end
  2271. v := iup_widget.execute_mousemotion(line, column, x, y, rs)
  2272. Result := return_value(v)
  2273. end
  2274. end
  2275. launch_ncols_cb_fn (obj: POINTER): INTEGER
  2276. do
  2277. if objects.has(obj) and
  2278. attached objects.at(obj) as iup_widget then
  2279. Result := iup_widget.execute_ncols
  2280. end
  2281. end
  2282. launch_nlines_cb_fn (obj: POINTER): INTEGER
  2283. do
  2284. if objects.has(obj) and
  2285. attached objects.at(obj) as iup_widget then
  2286. Result := iup_widget.execute_nlines
  2287. end
  2288. end
  2289. launch_scrolling_cb_fnii (obj: POINTER; line, column: INTEGER): INTEGER
  2290. local
  2291. v: STRING
  2292. do
  2293. if objects.has(obj) and
  2294. attached objects.at(obj) as iup_widget then
  2295. v := iup_widget.execute_scrolling(line, column)
  2296. Result := return_value(v)
  2297. end
  2298. end
  2299. launch_vspan_cb_fnii (obj: POINTER; line, column: INTEGER): INTEGER
  2300. do
  2301. if objects.has(obj) and
  2302. attached objects.at(obj) as iup_widget then
  2303. Result := iup_widget.execute_vspan(line, column)
  2304. end
  2305. end
  2306. launch_width_cb_fni (obj: POINTER; column: INTEGER): INTEGER
  2307. do
  2308. if objects.has(obj) and
  2309. attached objects.at(obj) as iup_widget then
  2310. Result := iup_widget.execute_width(column)
  2311. end
  2312. end
  2313. -- Callbacks for color bar
  2314. launch_cell_fni (obj: POINTER; cell: INTEGER): INTEGER
  2315. local
  2316. cl: TUPLE[INTEGER, INTEGER, INTEGER]
  2317. do
  2318. if objects.has(obj) and
  2319. attached objects.at(obj) as iup_widget then
  2320. cl := iup_widget.execute_cell(cell)
  2321. if cl /= Void then
  2322. Result := int_encode_color (cl.integer_32_item(1),
  2323. cl.integer_32_item(2),
  2324. cl.integer_32_item(3))
  2325. else
  2326. Result := -1
  2327. end
  2328. end
  2329. end
  2330. launch_extended_fni (obj: POINTER; cell: INTEGER): INTEGER
  2331. local
  2332. v: STRING
  2333. do
  2334. if objects.has(obj) and
  2335. attached objects.at(obj) as iup_widget then
  2336. v := iup_widget.execute_extended(cell)
  2337. Result := return_value(v)
  2338. end
  2339. end
  2340. launch_select_fnii (obj: POINTER; cell, type: INTEGER): INTEGER
  2341. local
  2342. v: STRING
  2343. do
  2344. if objects.has(obj) and
  2345. attached objects.at(obj) as iup_widget then
  2346. v := iup_widget.execute_select(cell, type)
  2347. Result := return_value(v)
  2348. end
  2349. end
  2350. launch_switch_fnii (obj: POINTER; prim_cell, sec_cell: INTEGER): INTEGER
  2351. local
  2352. v: STRING
  2353. do
  2354. if objects.has(obj) and
  2355. attached objects.at(obj) as iup_widget then
  2356. v := iup_widget.execute_switch(prim_cell, sec_cell)
  2357. Result := return_value(v)
  2358. end
  2359. end
  2360. -- Callbacks for Matrix
  2361. launch_action_fniiiis (obj: POINTER; key, lin, col, edition: INTEGER; value: POINTER): INTEGER
  2362. local
  2363. v, vs: STRING
  2364. do
  2365. if objects.has(obj) and
  2366. attached objects.at(obj) as iup_widget then
  2367. if value /= default_pointer then
  2368. create vs.make_from_c(value)
  2369. else
  2370. vs := ""
  2371. end
  2372. v := iup_widget.execute_action_fniiiis(key, lin, col, edition, vs)
  2373. Result := return_value(v)
  2374. end
  2375. end
  2376. launch_click_fniis (obj: POINTER; lin, col: INTEGER; status: POINTER): INTEGER
  2377. local
  2378. v, st: STRING
  2379. do
  2380. if objects.has(obj) and
  2381. attached objects.at(obj) as iup_widget then
  2382. if status /= default_pointer then
  2383. create st.make_from_c(status)
  2384. else
  2385. st := ""
  2386. end
  2387. v := iup_widget.execute_click_fniis(lin, col, st)
  2388. Result := return_value(v)
  2389. end
  2390. end
  2391. launch_colresize_fni (obj: POINTER; col: INTEGER): INTEGER
  2392. local
  2393. v: STRING
  2394. do
  2395. if objects.has(obj) and
  2396. attached objects.at(obj) as iup_widget then
  2397. v := iup_widget.execute_colresize(col)
  2398. Result := return_value(v)
  2399. end
  2400. end
  2401. launch_release_fniis (obj: POINTER; lin, col: INTEGER; status: POINTER): INTEGER
  2402. local
  2403. v, st: STRING
  2404. do
  2405. if objects.has(obj) and
  2406. attached objects.at(obj) as iup_widget then
  2407. if status /= default_pointer then
  2408. create st.make_from_c(status)
  2409. else
  2410. st := ""
  2411. end
  2412. v := iup_widget.execute_release(lin, col, st)
  2413. Result := return_value(v)
  2414. end
  2415. end
  2416. launch_resizematrix_fnii (obj: POINTER; width, height: INTEGER): INTEGER
  2417. local
  2418. v: STRING
  2419. do
  2420. if objects.has(obj) and
  2421. attached objects.at(obj) as iup_widget then
  2422. v := iup_widget.execute_resizematrix(width, height)
  2423. Result := return_value(v)
  2424. end
  2425. end
  2426. launch_mousemove_fnii (obj: POINTER; lin, col: INTEGER): INTEGER
  2427. local
  2428. v: STRING
  2429. do
  2430. if objects.has(obj) and
  2431. attached objects.at(obj) as iup_widget then
  2432. v := iup_widget.execute_mousemove(lin, col)
  2433. Result := return_value(v)
  2434. end
  2435. end
  2436. launch_enteritem_fnii (obj: POINTER; lin, col: INTEGER): INTEGER
  2437. local
  2438. v: STRING
  2439. do
  2440. if objects.has(obj) and
  2441. attached objects.at(obj) as iup_widget then
  2442. v := iup_widget.execute_enteritem(lin, col)
  2443. Result := return_value(v)
  2444. end
  2445. end
  2446. launch_leaveitem_fnii (obj: POINTER; lin, col: INTEGER): INTEGER
  2447. local
  2448. v: STRING
  2449. do
  2450. if objects.has(obj) and
  2451. attached objects.at(obj) as iup_widget then
  2452. v := iup_widget.execute_leaveitem(lin, col)
  2453. Result := return_value(v)
  2454. end
  2455. end
  2456. launch_scrolltop_fnii (obj: POINTER; lin, col: INTEGER): INTEGER
  2457. local
  2458. v: STRING
  2459. do
  2460. if objects.has(obj) and
  2461. attached objects.at(obj) as iup_widget then
  2462. v := iup_widget.execute_scrolltop(lin, col)
  2463. Result := return_value(v)
  2464. end
  2465. end
  2466. launch_bgcolor_fniivvv (obj: POINTER; lin, col: INTEGER; red, green, blue: POINTER): INTEGER
  2467. local
  2468. v: STRING
  2469. do
  2470. if objects.has(obj) and
  2471. attached objects.at(obj) as iup_widget then
  2472. v := iup_widget.execute_bgcolor(lin, col, red, green, blue)
  2473. Result := return_value(v)
  2474. end
  2475. end
  2476. launch_fgcolor_fniivvv (obj: POINTER; lin, col: INTEGER; red, green, blue: POINTER): INTEGER
  2477. local
  2478. v: STRING
  2479. do
  2480. if objects.has(obj) and
  2481. attached objects.at(obj) as iup_widget then
  2482. v := iup_widget.execute_fgcolor(lin, col, red, green, blue)
  2483. Result := return_value(v)
  2484. end
  2485. end
  2486. launch_font_fnii (obj: POINTER; lin, col: INTEGER): POINTER
  2487. do
  2488. if objects.has(obj) and
  2489. attached objects.at(obj) as iup_widget then
  2490. Result := get_pointer(iup_widget.execute_font(lin, col).to_c)
  2491. end
  2492. end
  2493. launch_type_fnii (obj: POINTER; lin, col: INTEGER): POINTER
  2494. do
  2495. if objects.has(obj) and
  2496. attached objects.at(obj) as iup_widget then
  2497. Result := get_pointer(iup_widget.execute_type(lin, col).to_c)
  2498. end
  2499. end
  2500. launch_dropcheck_fnii (obj: POINTER; lin, col: INTEGER): INTEGER
  2501. local
  2502. v: STRING
  2503. do
  2504. if objects.has(obj) and
  2505. attached objects.at(obj) as iup_widget then
  2506. v := iup_widget.execute_dropcheck(lin, col)
  2507. Result := return_value(v)
  2508. end
  2509. end
  2510. launch_translatevalue_fniis (obj: POINTER; lin, col: INTEGER; value: POINTER): POINTER
  2511. local
  2512. v: STRING
  2513. do
  2514. if objects.has(obj) and
  2515. attached objects.at(obj) as iup_widget then
  2516. if value /= default_pointer then
  2517. create v.make_from_c(value)
  2518. else
  2519. v := ""
  2520. end
  2521. Result := get_pointer(iup_widget.execute_translatevalue(lin, col, v).to_c)
  2522. end
  2523. end
  2524. launch_togglevalue_fniii (obj: POINTER; lin, col, status: INTEGER): INTEGER
  2525. local
  2526. v: STRING
  2527. do
  2528. if objects.has(obj) and
  2529. attached objects.at(obj) as iup_widget then
  2530. v := iup_widget.execute_togglevalue_fniii(lin, col, status)
  2531. Result := return_value(v)
  2532. end
  2533. end
  2534. launch_drop_fnnii (obj, drop: POINTER; lin, col: INTEGER): INTEGER
  2535. local
  2536. v: STRING
  2537. iup_drop: IUP_DROP
  2538. do
  2539. if objects.has(obj) and
  2540. attached objects.at(obj) as iup_widget then
  2541. if objects.has(drop) and
  2542. attached {IUP_DROP} objects.at(drop) as iup_d then
  2543. -- All Ok
  2544. iup_drop := iup_d
  2545. else
  2546. create iup_drop.drop_widget(drop)
  2547. end
  2548. v := iup_widget.execute_drop(iup_drop, lin, col)
  2549. Result := return_value(v)
  2550. end
  2551. end
  2552. launch_menudrop_fnnii (obj, drop: POINTER; lin, col: INTEGER): INTEGER
  2553. local
  2554. v: STRING
  2555. iup_drop: IUP_DROP
  2556. do
  2557. if objects.has(obj) and
  2558. attached objects.at(obj) as iup_widget then
  2559. if objects.has(drop) and
  2560. attached {IUP_DROP} objects.at(drop) as iup_d then
  2561. -- All Ok
  2562. iup_drop := iup_d
  2563. else
  2564. create iup_drop.drop_widget(drop)
  2565. end
  2566. v := iup_widget.execute_menudrop(iup_drop, lin, col)
  2567. Result := return_value(v)
  2568. end
  2569. end
  2570. launch_dropselect_fniinsii (obj: POINTER; lin, col: INTEGER; drop, t: POINTER; i, v: INTEGER): INTEGER
  2571. local
  2572. r, ts: STRING
  2573. iup_drop: IUP_DROP
  2574. do
  2575. if objects.has(obj) and
  2576. attached objects.at(obj) as iup_widget then
  2577. if t /= default_pointer then
  2578. create ts.make_from_c(t)
  2579. else
  2580. ts := ""
  2581. end
  2582. if objects.has(drop) and
  2583. attached {IUP_DROP} objects.at(drop) as iup_d then
  2584. -- All OK
  2585. iup_drop := iup_d
  2586. else
  2587. create iup_drop.drop_widget(drop)
  2588. end
  2589. r := iup_widget.execute_dropselect(lin, col, iup_drop, ts, i, v)
  2590. Result := return_value(r)
  2591. end
  2592. end
  2593. launch_edition_fniiii (obj: POINTER; lin, col, mode, update: INTEGER): INTEGER
  2594. local
  2595. v: STRING
  2596. do
  2597. if objects.has(obj) and
  2598. attached objects.at(obj) as iup_widget then
  2599. v := iup_widget.execute_edition(lin, col, mode, update)
  2600. Result := return_value(v)
  2601. end
  2602. end
  2603. launch_value_fnii (obj: POINTER; lin, col: INTEGER): POINTER
  2604. local
  2605. s: STRING
  2606. cs: C_STRING
  2607. do
  2608. --s := "hola"
  2609. --create cs.make_by_pointer(get_pointer(s.to_c))
  2610. if objects.has(obj) and
  2611. attached objects.at(obj) as iup_widget then
  2612. s := iup_widget.execute_value(lin, col)
  2613. --create cs.make_by_pointer(get_pointer((iup_widget.execute_value(lin,
  2614. --col)).to_c))
  2615. create cs.make_by_pointer(get_pointer(s.to_c))
  2616. Result := cs.item
  2617. end
  2618. end
  2619. launch_value_edit_fniis (obj: POINTER; lin, col: INTEGER; newval: POINTER): INTEGER
  2620. local
  2621. v, nv: STRING
  2622. do
  2623. if objects.has(obj) and
  2624. attached objects.at(obj) as iup_widget then
  2625. if newval /= default_pointer then
  2626. create nv.make_from_c(newval)
  2627. else
  2628. nv := ""
  2629. end
  2630. v := iup_widget.execute_value_edit(lin, col, nv)
  2631. Result := return_value(v)
  2632. end
  2633. end
  2634. launch_mark_fnii (obj: POINTER; lin, col: INTEGER): INTEGER
  2635. do
  2636. if objects.has(obj) and
  2637. attached objects.at(obj) as iup_widget then
  2638. Result := iup_widget.execute_mark(lin, col)
  2639. end
  2640. end
  2641. launch_markedit_fniii (obj: POINTER; lin, col, marked: INTEGER): INTEGER
  2642. local
  2643. v: STRING
  2644. do
  2645. if objects.has(obj) and
  2646. attached objects.at(obj) as iup_widget then
  2647. v := iup_widget.execute_markedit(lin, col, marked)
  2648. Result := return_value(v)
  2649. end
  2650. end
  2651. -- Flat tabs
  2652. launch_flat_motion_cb_fniis (obj: POINTER; x, y: INTEGER; status: POINTER): INTEGER
  2653. local
  2654. v, st: STRING
  2655. do
  2656. if objects.has(obj) and
  2657. attached objects.at(obj) as iup_widget then
  2658. if status /= default_pointer then
  2659. create st.make_from_c(status)
  2660. else
  2661. st := ""
  2662. end
  2663. v := iup_widget.execute_flat_motion(x, y, st)
  2664. Result := return_value(v)
  2665. end
  2666. end
  2667. -- Drop button
  2668. launch_dropshow_cb_fni (obj: POINTER; state: INTEGER): INTEGER
  2669. local
  2670. v: STRING
  2671. do
  2672. if objects.has(obj) and
  2673. attached objects.at(obj) as iup_widget then
  2674. v := iup_widget.execute_dropshow(state)
  2675. Result := return_value(v)
  2676. end
  2677. end
  2678. -- Dial
  2679. launch_button_press_cb_fnd (obj: POINTER; angle: REAL_64): INTEGER
  2680. local
  2681. v: STRING
  2682. do
  2683. if objects.has(obj) and
  2684. attached objects.at(obj) as iup_widget then
  2685. v := iup_widget.execute_button_press(angle)
  2686. Result := return_value(v)
  2687. end
  2688. end
  2689. launch_button_release_cb_fnd (obj: POINTER; angle: REAL_64): INTEGER
  2690. local
  2691. v: STRING
  2692. do
  2693. if objects.has(obj) and
  2694. attached objects.at(obj) as iup_widget then
  2695. v := iup_widget.execute_button_release(angle)
  2696. Result := return_value(v)
  2697. end
  2698. end
  2699. launch_mousemove_cb_fnd (obj: POINTER; angle: REAL_64): INTEGER
  2700. local
  2701. v: STRING
  2702. do
  2703. if objects.has(obj) and
  2704. attached objects.at(obj) as iup_widget then
  2705. v := iup_widget.execute_mousemove_fnd(angle)
  2706. Result := return_value(v)
  2707. end
  2708. end
  2709. -- Color browser
  2710. launch_change_cb_fnvvv (obj: POINTER; red, green, blue: INTEGER): INTEGER
  2711. local
  2712. v: STRING
  2713. do
  2714. if objects.has(obj) and
  2715. attached objects.at(obj) as iup_widget then
  2716. v := iup_widget.execute_change(red, green, blue)
  2717. Result := return_value(v)
  2718. end
  2719. end
  2720. launch_drag_cb_fnvvv (obj: POINTER; red, green, blue: INTEGER): INTEGER
  2721. local
  2722. v: STRING
  2723. do
  2724. if objects.has(obj) and
  2725. attached objects.at(obj) as iup_widget then
  2726. v := iup_widget.execute_drag(red, green, blue)
  2727. Result := return_value(v)
  2728. end
  2729. end
  2730. feature {IUP_DIALOG}
  2731. get_drop_button_for_dialog (dlg: IUP_DIALOG): detachable IUP_DROP_BUTTON
  2732. local
  2733. p: POINTER
  2734. do
  2735. p := get_attribute_ihandle(dlg, "DROPBUTTON")
  2736. if objects.has(p) and
  2737. attached {IUP_DROP_BUTTON} objects.at(p) as iup_drop_button then
  2738. -- All Ok
  2739. Result := iup_drop_button
  2740. end
  2741. end
  2742. feature {IUP_WIDGET, IUP_CLIPBOARD}
  2743. -- Validations
  2744. is_valid_position (x, y: STRING): BOOLEAN
  2745. local
  2746. xs, ys: BOOLEAN
  2747. do
  2748. if x.is_equal("IUP_LEFT") or
  2749. x.is_equal("IUP_CENTER") or
  2750. x.is_equal("IUP_RIGHT") or
  2751. x.is_equal("IUP_MOUSEPOS") or
  2752. x.is_equal("IUP_CENTERPARENT") or
  2753. x.is_equal("IUP_CURRENT") then
  2754. xs := True
  2755. elseif x.is_integer and x.to_integer >= 0 then
  2756. xs := True
  2757. else
  2758. xs := False
  2759. end
  2760. if y.is_equal("IUP_TOP") or
  2761. y.is_equal("IUP_CENTER") or
  2762. y.is_equal("IUP_BOTTOM") or
  2763. y.is_equal("IUP_MOUSEPOS") or
  2764. y.is_equal("IUP_CENTERPARENT") or
  2765. y.is_equal("IUP_CURRENT") then
  2766. ys := True
  2767. elseif y.is_integer and y.to_integer >= 0 then
  2768. ys := True
  2769. else
  2770. ys := False
  2771. end
  2772. if xs and ys then
  2773. Result := True
  2774. else
  2775. Result := False
  2776. end
  2777. end
  2778. is_valid_buttons (value: STRING): BOOLEAN
  2779. do
  2780. if value.is_equal("OK") or
  2781. value.is_equal("OKCANCEL") or
  2782. value.is_equal("RETRYCANCEL") or
  2783. value.is_equal("YESNO") or
  2784. value.is_equal("YESNOCANCEL") then
  2785. Result := True
  2786. else
  2787. Result := False
  2788. end
  2789. end
  2790. feature {NONE}
  2791. idle_action: detachable FUNCTION[TUPLE, STRING]
  2792. objects: HASH_TABLE[IUP_WIDGET, POINTER]
  2793. callbacks: detachable HASH_TABLE[IUP_WIDGET, POINTER]
  2794. get_param: detachable IUP_GET_PARAM
  2795. -- Conversion
  2796. yesno_to_boolean (value: STRING): BOOLEAN
  2797. do
  2798. if value.is_equal("YES") then
  2799. Result := True
  2800. else
  2801. Result := False
  2802. end
  2803. end
  2804. boolean_to_yesno (value: BOOLEAN): STRING
  2805. do
  2806. if value then
  2807. Result := "YES"
  2808. else
  2809. Result := "NO"
  2810. end
  2811. end
  2812. components_of (size: STRING; separator: CHARACTER): TUPLE[INTEGER, INTEGER]
  2813. local
  2814. i, c: INTEGER
  2815. width, height: STRING
  2816. tup: TUPLE[INTEGER, INTEGER]
  2817. do
  2818. if size.has(separator) then
  2819. i := size.index_of(separator, 1)
  2820. c := size.count
  2821. if not i.is_equal(1) then
  2822. width := size.substring(1, i - 1)
  2823. else
  2824. width := "0"
  2825. end
  2826. if not i.is_equal(c) then
  2827. height := size.substring(i + 1, c)
  2828. else
  2829. height := "0"
  2830. end
  2831. tup := [width.to_integer, height.to_integer]
  2832. Result := tup
  2833. else
  2834. io.put_string("Unable to get the components %N")
  2835. Result := [0, 0]
  2836. end
  2837. end
  2838. convert_string_to_array (data: STRING): POINTER
  2839. local
  2840. v: CHARACTER
  2841. arg: MANAGED_POINTER
  2842. x: INTEGER
  2843. do
  2844. create arg.make(data.count)
  2845. from
  2846. x := 1
  2847. until
  2848. x = data.count
  2849. loop
  2850. v := data.item(x)
  2851. arg.put_character(v.to_character_8, x - 1)
  2852. x := x + 1
  2853. end
  2854. Result := arg.item
  2855. end
  2856. -- Class name
  2857. get_class_name (wgt: POINTER): STRING
  2858. local
  2859. p: POINTER
  2860. str: STRING
  2861. do
  2862. p := int_get_class_name (wgt)
  2863. if p /= default_pointer then
  2864. create str.make_from_c(p)
  2865. Result := str
  2866. else
  2867. Result := ""
  2868. end
  2869. end
  2870. int_get_class_name (wgt: POINTER): POINTER
  2871. external
  2872. "C inline use %"eiffel-iup.h%""
  2873. alias
  2874. "return IupGetClassName ($wgt);"
  2875. end
  2876. -- Loop
  2877. int_loop_step: INTEGER
  2878. external
  2879. "C inline use %"eiffel-iup.h%""
  2880. alias
  2881. "return IupLoopStep();"
  2882. end
  2883. int_loop_step_wait: INTEGER
  2884. external
  2885. "C inline use %"eiffel-iup.h%""
  2886. alias
  2887. "return IupLoopStepWait();"
  2888. end
  2889. -- PopUp
  2890. int_popup (wgt: POINTER; x, y: INTEGER): INTEGER
  2891. external
  2892. "C inline use %"eiffel-iup.h%""
  2893. alias
  2894. "return IupPopup ($wgt, $x, $y);"
  2895. end
  2896. -- Help
  2897. int_help (u: POINTER): INTEGER
  2898. external
  2899. "C inline use %"eiffel-iup.h%""
  2900. alias
  2901. "return IupHelp ($u);"
  2902. end
  2903. -- Global attributes
  2904. int_set_global (name: POINTER; value: POINTER)
  2905. external
  2906. "C inline use %"eiffel-iup.h%""
  2907. alias
  2908. "IupSetGlobal ($name, $value)"
  2909. end
  2910. int_get_global (name: POINTER): POINTER
  2911. external
  2912. "C inline use %"eiffel-iup.h%""
  2913. alias
  2914. "return IupGetGlobal ($name)"
  2915. end
  2916. -- Focus
  2917. int_get_focus: POINTER
  2918. external
  2919. "C inline use %"eiffel-iup.h%""
  2920. alias
  2921. "return IupGetFocus();"
  2922. end
  2923. -- Destroy
  2924. int_destroy (wgt: POINTER)
  2925. external
  2926. "C inline use %"eiffel-iup.h%""
  2927. alias
  2928. "IupDestroy ($wgt);"
  2929. end
  2930. -- Callbacks
  2931. widget_for_object (wgt: POINTER): IUP_WIDGET
  2932. do
  2933. if objects.has(wgt) and
  2934. attached objects.at(wgt) as w then
  2935. Result := w
  2936. else
  2937. create Result.make
  2938. end
  2939. end
  2940. return_value (type: STRING): INTEGER
  2941. do
  2942. if type /= Void then
  2943. if (type.is_equal("IUP_IGNORE")) then
  2944. Result := -1
  2945. elseif (type.is_equal("IUP_DEFAULT")) then
  2946. Result := -2
  2947. elseif (type.is_equal("IUP_CLOSE")) then
  2948. Result := -3
  2949. elseif (type.is_equal("IUP_CONTINUE")) then
  2950. Result := -4
  2951. else
  2952. Result := -1
  2953. end
  2954. else
  2955. Result := -1
  2956. end
  2957. end
  2958. int_set_callback (object: POINTER; name: POINTER; type: POINTER; operation: INTEGER)
  2959. external
  2960. "C inline use %"eiffel-iup.h%""
  2961. alias
  2962. "connect_callback ($object, $name, $type, $operation);"
  2963. end
  2964. int_set_function (object: POINTER; operation: INTEGER)
  2965. external
  2966. "C inline use %"eiffel-iup.h%""
  2967. alias
  2968. "connect_function ($object, $operation);"
  2969. end
  2970. -- Hierarchy and management.
  2971. int_append (control: POINTER; new_child: POINTER): POINTER
  2972. external
  2973. "C inline use %"eiffel-iup.h%""
  2974. alias
  2975. "return IupAppend ($control, $new_child);"
  2976. end
  2977. int_detach (control: POINTER)
  2978. external
  2979. "C inline use %"eiffel-iup.h%""
  2980. alias
  2981. "IupDetach ($control);"
  2982. end
  2983. int_insert (control: POINTER; ref_child: POINTER; new_child: POINTER): POINTER
  2984. external
  2985. "C inline use %"eiffel-iup.h%""
  2986. alias
  2987. "return IupInsert ($control, $ref_child, $new_child);"
  2988. end
  2989. int_reparent (child: POINTER; new_parent: POINTER; ref_child: POINTER): INTEGER
  2990. external
  2991. "C inline use %"eiffel-iup.h%""
  2992. alias
  2993. "return IupReparent ($child, $new_parent, $ref_child);"
  2994. end
  2995. int_get_parent (child: POINTER): POINTER
  2996. external
  2997. "C inline use %"eiffel-iup.h%""
  2998. alias
  2999. "return IupGetParent ($child);"
  3000. end
  3001. int_get_child (control: POINTER; position: INTEGER): POINTER
  3002. external
  3003. "C inline use %"eiffel-iup.h%""
  3004. alias
  3005. "return IupGetChild ($control, $position);"
  3006. end
  3007. int_get_child_pos (control: POINTER; child: POINTER): INTEGER
  3008. external
  3009. "C inline use %"eiffel-iup.h%""
  3010. alias
  3011. "return IupGetChildPos ($control, $child);"
  3012. end
  3013. int_get_child_count (control: POINTER): INTEGER
  3014. external
  3015. "C inline use %"eiffel-iup.h%""
  3016. alias
  3017. "return IupGetChildCount ($control);"
  3018. end
  3019. int_get_next_child (control: POINTER; child: POINTER): POINTER
  3020. external
  3021. "C inline use %"eiffel-iup.h%""
  3022. alias
  3023. "return IupGetNextChild ($control, $child);"
  3024. end
  3025. int_get_brother (control: POINTER): POINTER
  3026. external
  3027. "C inline use %"eiffel-iup.h%""
  3028. alias
  3029. "return IupGetBrother ($control);"
  3030. end
  3031. int_get_dialog (control: POINTER): POINTER
  3032. external
  3033. "C inline use %"eiffel-iup.h%""
  3034. alias
  3035. "return IupGetDialog ($control);"
  3036. end
  3037. int_get_dialog_child (control: POINTER; child: POINTER): POINTER
  3038. external
  3039. "C inline use %"eiffel-iup.h%""
  3040. alias
  3041. "return IupGetDialogChild ($control, $child);"
  3042. end
  3043. int_refresh (control: POINTER)
  3044. external
  3045. "C inline use %"eiffel-iup.h%""
  3046. alias
  3047. "IupRefresh ($control);"
  3048. end
  3049. int_refresh_children (control: POINTER)
  3050. external
  3051. "C inline use %"eiffel-iup.h%""
  3052. alias
  3053. "IupRefreshChildren ($control);"
  3054. end
  3055. int_update (control: POINTER)
  3056. external
  3057. "C inline use %"eiffel-iup.h%""
  3058. alias
  3059. "IupUpdate ($control);"
  3060. end
  3061. int_update_children (control: POINTER)
  3062. external
  3063. "C inline use %"eiffel-iup.h%""
  3064. alias
  3065. "IupUpdateChildren ($control);"
  3066. end
  3067. int_redraw (control: POINTER; ch: INTEGER)
  3068. external
  3069. "C inline use %"eiffel-iup.h%""
  3070. alias
  3071. "IupRedraw ($control, $ch);"
  3072. end
  3073. int_convert_xy_to_pos (control: POINTER; x, y: INTEGER): INTEGER
  3074. external
  3075. "C inline use %"eiffel-iup.h%""
  3076. alias
  3077. "return IupConvertXYToPos ($control, $x, $y);"
  3078. end
  3079. -- Attributes
  3080. int_set_attribute (wgt: POINTER; name: POINTER; value: POINTER)
  3081. external
  3082. "C inline use %"eiffel-iup.h%""
  3083. alias
  3084. "IupSetAttribute ($wgt, $name, $value);"
  3085. end
  3086. int_set_str_attribute (wgt: POINTER; name: POINTER; value: POINTER)
  3087. external
  3088. "C inline use %"eiffel-iup.h%""
  3089. alias
  3090. "IupSetStrAttribute ($wgt, $name, $value);"
  3091. end
  3092. int_set_attribute_id (wgt: POINTER; name: POINTER; id: INTEGER; value: POINTER)
  3093. external
  3094. "C inline use %"eiffel-iup.h%""
  3095. alias
  3096. "IupSetAttributeId ($wgt, $name, $id, $value);"
  3097. end
  3098. int_set_str_attribute_id (wgt: POINTER; name: POINTER; id: INTEGER; value: POINTER)
  3099. external
  3100. "C inline use %"eiffel-iup.h%""
  3101. alias
  3102. "IupSetStrAttributeId ($wgt, $name, $id, $value);"
  3103. end
  3104. int_set_attribute_id2 (wgt: POINTER; name: POINTER; lin: INTEGER; col: INTEGER; value: POINTER)
  3105. external
  3106. "C inline use %"eiffel-iup.h%""
  3107. alias
  3108. "IupSetAttributeId2 ($wgt, $name, $lin, $col, $value);"
  3109. end
  3110. int_set_str_attribute_id2 (wgt: POINTER; name: POINTER; lin: INTEGER; col: INTEGER; value: POINTER)
  3111. external
  3112. "C inline use %"eiffel-iup.h%""
  3113. alias
  3114. "IupSetStrAttributeId2 ($wgt, $name, $lin, $col, $value);"
  3115. end
  3116. int_set_int (wgt: POINTER; name: POINTER; value: INTEGER)
  3117. external
  3118. "C inline use %"eiffel-iup.h%""
  3119. alias
  3120. "IupSetInt ($wgt, $name, $value);"
  3121. end
  3122. int_set_float (wgt: POINTER; name: POINTER; value: REAL_32)
  3123. external
  3124. "C inline use %"eiffel-iup.h%""
  3125. alias
  3126. "IupSetFloat ($wgt, $name, $value);"
  3127. end
  3128. int_set_double (wgt: POINTER; name: POINTER; value: REAL_64)
  3129. external
  3130. "C inline use %"eiffel-iup.h%""
  3131. alias
  3132. "IupSetDouble ($wgt, $name, $value);"
  3133. end
  3134. int_set_rgb (wgt: POINTER; name: POINTER; r: CHARACTER; g: CHARACTER; b: CHARACTER)
  3135. external
  3136. "C inline use %"eiffel-iup.h%""
  3137. alias
  3138. "IupSetRGB ($wgt, $name, $r, $g, $b);"
  3139. end
  3140. int_set_int_id (wgt: POINTER; name: POINTER; id: INTEGER; value: INTEGER)
  3141. external
  3142. "C inline use %"eiffel-iup.h%""
  3143. alias
  3144. "IupSetIntId ($wgt, $name, $id, $value);"
  3145. end
  3146. int_set_float_id (wgt: POINTER; name: POINTER; id: INTEGER; value: REAL_32)
  3147. external
  3148. "C inline use %"eiffel-iup.h%""
  3149. alias
  3150. "IupSetFloatId ($wgt, $name, $id, $value);"
  3151. end
  3152. int_set_double_id (wgt: POINTER; name: POINTER; id: INTEGER; value: REAL_64)
  3153. external
  3154. "C inline use %"eiffel-iup.h%""
  3155. alias
  3156. "IupSetDoubleId ($wgt, $name, $id, $value);"
  3157. end
  3158. int_set_rgb_id (wgt: POINTER; name: POINTER; id: INTEGER; r: CHARACTER; g: CHARACTER; b: CHARACTER)
  3159. external
  3160. "C inline use %"eiffel-iup.h%""
  3161. alias
  3162. "IupSetRGBId ($wgt, $name, $id, $r, $g, $b);"
  3163. end
  3164. int_set_int_id2 (wgt: POINTER; name: POINTER; lin: INTEGER; col: INTEGER; value: INTEGER)
  3165. external
  3166. "C inline use %"eiffel-iup.h%""
  3167. alias
  3168. "IupSetIntId2 ($wgt, $name, $lin, $col, $value);"
  3169. end
  3170. int_set_float_id2 (wgt: POINTER; name: POINTER; lin: INTEGER; col: INTEGER; value: REAL_32)
  3171. external
  3172. "C inline use %"eiffel-iup.h%""
  3173. alias
  3174. "IupSetFloatId2 ($wgt, $name, $lin, $col, $value);"
  3175. end
  3176. int_set_double_id2 (wgt: POINTER; name: POINTER; lin: INTEGER; col: INTEGER; value: REAL_64)
  3177. external
  3178. "C inline use %"eiffel-iup.h%""
  3179. alias
  3180. "IupSetDoubleId2 ($wgt, $name, $lin, $col, $value);"
  3181. end
  3182. int_set_rgb_id2 (wgt: POINTER; name: POINTER; lin: INTEGER; col: INTEGER; r: CHARACTER; g: CHARACTER; b: CHARACTER)
  3183. external
  3184. "C inline use %"eiffel-iup.h%""
  3185. alias
  3186. "IupSetRGBId2 ($wgt, $name, $lin, $col, $r, $g, $b);"
  3187. end
  3188. int_reset_attribute (wgt: POINTER; name: POINTER)
  3189. external
  3190. "C inline use %"eiffel-iup.h%""
  3191. alias
  3192. "IupResetAttribute ($wgt, $name);"
  3193. end
  3194. int_set_attribute_handle (wgt: POINTER; name: POINTER; wgt_named: POINTER)
  3195. external
  3196. "C inline use %"eiffel-iup.h%""
  3197. alias
  3198. "IupSetAttributeHandle ($wgt, $name, $wgt_named);"
  3199. end
  3200. int_get_attribute (wgt: POINTER; name: POINTER): POINTER
  3201. external
  3202. "C inline use %"eiffel-iup.h%""
  3203. alias
  3204. "return IupGetAttribute ($wgt, $name);"
  3205. end
  3206. int_get_attribute_id (wgt: POINTER; name: POINTER; id: INTEGER): POINTER
  3207. external
  3208. "C inline use %"eiffel-iup.h%""
  3209. alias
  3210. "return IupGetAttributeId ($wgt, $name, $id);"
  3211. end
  3212. int_get_attribute_id2 (wgt: POINTER; name: POINTER; lin: INTEGER; col: INTEGER): POINTER
  3213. external
  3214. "C inline use %"eiffel-iup.h%""
  3215. alias
  3216. "return IupGetAttributeId2 ($wgt, $name, $lin, $col);"
  3217. end
  3218. int_get_int (wgt: POINTER; name: POINTER): INTEGER
  3219. external
  3220. "C inline use %"eiffel-iup.h%""
  3221. alias
  3222. "return IupGetInt ($wgt, $name);"
  3223. end
  3224. int_get_int_int (wgt: POINTER; name: POINTER; i1: POINTER; i2: POINTER): INTEGER
  3225. external
  3226. "C inline use %"eiffel-iup.h%""
  3227. alias
  3228. "return IupGetIntInt ($wgt, $name, $i1, $i2);"
  3229. end
  3230. int_get_int2 (wgt: POINTER; name: POINTER): INTEGER
  3231. external
  3232. "C inline use %"eiffel-iup.h%""
  3233. alias
  3234. "return IupGetInt2 ($wgt, $name);"
  3235. end
  3236. int_get_float (wgt: POINTER; name: POINTER): REAL_32
  3237. external
  3238. "C inline use %"eiffel-iup.h%""
  3239. alias
  3240. "return IupGetFloat ($wgt, $name);"
  3241. end
  3242. int_get_double (wgt: POINTER; name: POINTER): REAL_64
  3243. external
  3244. "C inline use %"eiffel-iup.h%""
  3245. alias
  3246. "return IupGetDouble ($wgt, $name);"
  3247. end
  3248. int_get_rgb (wgt: POINTER; name, r, g, b: POINTER)
  3249. external
  3250. "C inline use %"eiffel-iup.h%""
  3251. alias
  3252. "IupGetRGB ($wgt, $name, $r, $g, $b);"
  3253. end
  3254. int_get_attribute_handle (wgt: POINTER; name: POINTER): POINTER
  3255. external
  3256. "C inline use %"eiffel-iup.h%""
  3257. alias
  3258. "return IupGetAttributeHandle ($wgt, $name);"
  3259. end
  3260. -- Key codes
  3261. int_is_print_key(key: INTEGER): INTEGER
  3262. external
  3263. "C inline use %"eiffel-iup.h%""
  3264. alias
  3265. "return iup_isprint ($key);"
  3266. end
  3267. int_is_x_key(key: INTEGER): INTEGER
  3268. external
  3269. "C inline use %"eiffel-iup.h%""
  3270. alias
  3271. "return iup_isXkey ($key);"
  3272. end
  3273. int_is_shift_x_key(key: INTEGER): INTEGER
  3274. external
  3275. "C inline use %"eiffel-iup.h%""
  3276. alias
  3277. "return iup_isShiftXkey ($key);"
  3278. end
  3279. int_is_ctrl_x_key(key: CHARACTER): INTEGER
  3280. external
  3281. "C inline use %"eiffel-iup.h%""
  3282. alias
  3283. "return iup_isCtrlXkey ($key);"
  3284. end
  3285. int_is_alt_x_key(key: CHARACTER): INTEGER
  3286. external
  3287. "C inline use %"eiffel-iup.h%""
  3288. alias
  3289. "return iup_isAltXkey ($key);"
  3290. end
  3291. int_is_sys_x_key(key: CHARACTER): INTEGER
  3292. external
  3293. "C inline use %"eiffel-iup.h%""
  3294. alias
  3295. "return iup_isSysXkey ($key);"
  3296. end
  3297. -- Mouse buttons
  3298. int_is_shift(status: POINTER): INTEGER
  3299. external
  3300. "C inline use %"eiffel-iup.h%""
  3301. alias
  3302. "return iup_isshift (((char *) $status));"
  3303. end
  3304. int_is_control(status: POINTER): INTEGER
  3305. external
  3306. "C inline use %"eiffel-iup.h%""
  3307. alias
  3308. "return iup_iscontrol (((char *) $status));"
  3309. end
  3310. int_is_button_1(status: POINTER): INTEGER
  3311. external
  3312. "C inline use %"eiffel-iup.h%""
  3313. alias
  3314. "return iup_isbutton1 (((char *) $status));"
  3315. end
  3316. int_is_button_2(status: POINTER): INTEGER
  3317. external
  3318. "C inline use %"eiffel-iup.h%""
  3319. alias
  3320. "return iup_isbutton2 (((char *) $status));"
  3321. end
  3322. int_is_button_3(status: POINTER): INTEGER
  3323. external
  3324. "C inline use %"eiffel-iup.h%""
  3325. alias
  3326. "return iup_isbutton3 (((char *) $status));"
  3327. end
  3328. int_is_button_4(status: POINTER): INTEGER
  3329. external
  3330. "C inline use %"eiffel-iup.h%""
  3331. alias
  3332. "return iup_isbutton4 (((char *) $status));"
  3333. end
  3334. int_is_button_5(status: POINTER): INTEGER
  3335. external
  3336. "C inline use %"eiffel-iup.h%""
  3337. alias
  3338. "return iup_isbutton5 (((char *) $status));"
  3339. end
  3340. int_is_double(status: POINTER): INTEGER
  3341. external
  3342. "C inline use %"eiffel-iup.h%""
  3343. alias
  3344. "return iup_isdouble (((char *) $status));"
  3345. end
  3346. int_is_alt(status: POINTER): INTEGER
  3347. external
  3348. "C inline use %"eiffel-iup.h%""
  3349. alias
  3350. "return iup_isalt (((char *) $status));"
  3351. end
  3352. int_is_sys(status: POINTER): INTEGER
  3353. external
  3354. "C inline use %"eiffel-iup.h%""
  3355. alias
  3356. "return iup_issys (((char *) $status));"
  3357. end
  3358. -- CD
  3359. int_use_context_plus(status: INTEGER): INTEGER
  3360. external
  3361. "C inline use %"eiffel-iup.h%""
  3362. alias
  3363. "return cdUseContextPlus ($status);"
  3364. end
  3365. int_encode_color (r, g, b: INTEGER): INTEGER
  3366. external
  3367. "C inline use %"eiffel-iup.h%""
  3368. alias
  3369. "return cdEncodeColor ($r, $g, $b);"
  3370. end
  3371. -- Languages
  3372. int_set_language_string (n, v: POINTER)
  3373. external
  3374. "C inline use %"eiffel-iup.h%""
  3375. alias
  3376. "IupSetLanguageString ($n, $v);"
  3377. end
  3378. int_store_language_string (n, v: POINTER)
  3379. external
  3380. "C inline use %"eiffel-iup.h%""
  3381. alias
  3382. "IupStoreLanguageString ($n, $v);"
  3383. end
  3384. int_get_language_string (n: POINTER): POINTER
  3385. external
  3386. "C inline use %"eiffel-iup.h%""
  3387. alias
  3388. "return IupGetLanguageString($n);"
  3389. end
  3390. int_set_language_pack (p: POINTER)
  3391. external
  3392. "C inline use %"eiffel-iup.h%""
  3393. alias
  3394. "IupSetLanguagePack ($p);"
  3395. end
  3396. -- Copy attributes
  3397. int_copy_attributes (s, d: POINTER)
  3398. external
  3399. "C inline use %"eiffel-iup.h%""
  3400. alias
  3401. "IupCopyAttributes ($s, $d);"
  3402. end
  3403. -- IUP Callbacks
  3404. set_iup_callbacks (obj,
  3405. l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13, l14, l15, l16, l17, l18, l19,
  3406. l20, l21, l22, l23, l24, l25, l26, l27, l28, l29, l30, l31, l32, l33, l34, l35, l36, l37, l38, l39,
  3407. l40, l41, l42, l43, l44, l45, l46, l47, l48, l49, l50, l51, l52, l53, l54, l55, l56, l57, l58, l59,
  3408. l60, l61, l62, l63, l64, l65, l66, l67, l68, l69, l70, l71, l72, l73, l74, l75, l76, l77, l78, l79,
  3409. l80, l81, l82, l83, l84, l85, l86, l87, l88, l89, l90, l91, l92, l93, l94, l95, l96, l97, l98, l99,
  3410. l100, l101, l102, l103, l104, l105, l106, l107, l108, l109, l110, l111, l112, l113, l114, l115, l116, l117, l118, l119,
  3411. l120, l121: POINTER)
  3412. external
  3413. "C inline use %"eiffel-iup.h%""
  3414. alias
  3415. "set_callbacks ($obj,%
  3416. %$l1, $l2, $l3, $l4, $l5, $l6, $l7, $l8, $l9, $l10, $l11, $l12, $l13, $l14, $l15, $l16, $l17, $l18, $l19,%
  3417. %$l20, $l21, $l22, $l23, $l24, $l25, $l26, $l27, $l28, $l29, $l30, $l31, $l32, $l33, $l34, $l35, $l36, $l37, $l38, $l39,%
  3418. %$l40, $l41, $l42, $l43, $l44, $l45, $l46, $l47, $l48, $l49, $l50, $l51, $l52, $l53, $l54, $l55, $l56, $l57, $l58, $l59,%
  3419. %$l60, $l61, $l62, $l63, $l64, $l65, $l66, $l67, $l68, $l69, $l70, $l71, $l72, $l73, $l74, $l75, $l76, $l77, $l78, $l79,%
  3420. %$l80, $l81, $l82, $l83, $l84, $l85, $l86, $l87, $l88, $l89, $l90, $l91, $l92, $l93, $l94, $l95, $l96, $l97, $l98, $l99,%
  3421. %$l100, $l101, $l102, $l103, $l104, $l105, $l106, $l107, $l108, $l109, $l110, $l111, $l112, $l113, $l114, $l115, $l116, $l117, $l118, $l119,%
  3422. %$l120, $l121);"
  3423. end
  3424. end -- class IUP
  3425. -- The MIT License (MIT)
  3426. -- Copyright (c) 2016, 2017, 2018, 2019, 2020 by German A. Arias
  3427. -- Permission is hereby granted, free of charge, to any person obtaining a copy
  3428. -- of this software and associated documentation files (the "Software"), to deal
  3429. -- in the Software without restriction, including without limitation the rights
  3430. -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  3431. -- copies of the Software, and to permit persons to whom the Software is
  3432. -- furnished to do so, subject to the following conditions:
  3433. --
  3434. -- The above copyright notice and this permission notice shall be included in
  3435. -- all copies or substantial portions of the Software.
  3436. --
  3437. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  3438. -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  3439. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  3440. -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  3441. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  3442. -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  3443. -- SOFTWARE.