iup_text.e 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760
  1. class IUP_TEXT
  2. -- Creates an editable text field.
  3. -- When using UTF-8 strings in GTK be aware that all attributes are indexed by
  4. -- characters, NOT by byte index, because some characters in UTF-8 can use more
  5. -- than one byte. This also applies to Windows if FORMATTING=True depending on
  6. -- the Windows codepage (for example East Asian codepage where some characters
  7. -- take two bytes).
  8. inherit
  9. IUP_WIDGET
  10. undefine
  11. execute_spin,
  12. execute_dragbegin,
  13. execute_dragdatasize,
  14. execute_dragdata,
  15. execute_dragend,
  16. execute_dropdata,
  17. execute_dropmotion
  18. redefine
  19. execute_map,
  20. execute_unmap,
  21. execute_destroy,
  22. execute_getfocus,
  23. execute_killfocus,
  24. execute_enterwindow,
  25. execute_leavewindow,
  26. execute_k_any,
  27. execute_help,
  28. execute_action_fnis,
  29. execute_button,
  30. execute_caret,
  31. execute_dropfiles,
  32. execute_motion,
  33. execute_valuechanged,
  34. execute_maskfail
  35. end
  36. IUP_WIDGET_BGCOLOR
  37. IUP_WIDGET_FGCOLOR
  38. IUP_WIDGET_SIZE
  39. IUP_WIDGET_ACTIVE
  40. IUP_WIDGET_FONT
  41. IUP_WIDGET_EXPAND
  42. IUP_WIDGET_SCREENPOSITION
  43. IUP_WIDGET_POSITION
  44. IUP_WIDGET_MAXMIN_SIZE
  45. IUP_WIDGET_TIP
  46. IUP_WIDGET_RASTERSIZE
  47. IUP_WIDGET_USERSIZE
  48. IUP_WIDGET_ZORDER
  49. IUP_WIDGET_VISIBLE
  50. IUP_WIDGET_CHILD
  51. IUP_WIDGET_NAME
  52. IUP_WIDGET_FOCUS
  53. IUP_WIDGET_PROPAGATEFOCUS
  54. IUP_WIDGET_CUSTOM_ATTRIBUTES
  55. IUP_DRAG_AND_DROP
  56. IUP_WIDGET_TEXT_COMMON
  57. IUP_WIDGET_TEXT_SPIN
  58. insert
  59. IUP_WIDGET_TEXT_CARET
  60. IUP_WIDGET_TEXT_SELECTION
  61. IUP_WIDGET_TEXT_SPIN
  62. create {ANY}
  63. text
  64. feature {ANY}
  65. text
  66. -- A new text field.
  67. local
  68. a_text, p: POINTER
  69. do
  70. a_text := int_text(p)
  71. set_widget(a_text)
  72. create_mask_dictionary
  73. end
  74. -- Attributes
  75. set_alignment (value: STRING)
  76. -- [Windows and GTK Only] (non inheritable): text alignment. Possible
  77. -- values: "ALEFT", "ARIGHT", "ACENTER". Default: "ALEFT". In Motif, text
  78. -- is always left aligned.
  79. require
  80. is_valid: is_valid_alignment(value)
  81. do
  82. iup_open.set_attribute(Current, "ALIGNMENT", value)
  83. end
  84. set_border (state: BOOLEAN)
  85. -- (creation only): Shows a border around the text. Default: "True".
  86. do
  87. iup_open.set_attribute(Current, "BORDER", boolean_to_yesno(state))
  88. end
  89. set_can_focus (state: BOOLEAN)
  90. -- (creation only) (non inheritable): enables the focus traversal of the
  91. -- control. In Windows the control will still get the focus when clicked.
  92. -- Default: True.
  93. do
  94. iup_open.set_attribute(Current, "CANFOCUS", boolean_to_yesno(state))
  95. end
  96. get_count: INTEGER
  97. -- (read-only): returns the number of characters in the text, including
  98. -- the line breaks.
  99. local
  100. str: STRING
  101. do
  102. str := iup_open.get_attribute(Current, "COUNT")
  103. if str.is_integer then
  104. Result := str.to_integer
  105. end
  106. end
  107. set_as_drop_files_target (state: BOOLEAN)
  108. -- [Windows and GTK Only] (non inheritable): Enable or disable the drop
  109. -- of files. Default: False, but if DROPFILES_CB is defined when the
  110. -- element is mapped then it will be automatically enabled.
  111. do
  112. iup_open.set_attribute(Current, "DROPFILESTARGET", boolean_to_yesno(state))
  113. end
  114. set_formatting (state: BOOLEAN)
  115. -- [Windows and GTK Only] (non inheritable): When enabled allow the use
  116. -- of text formatting attributes. In GTK is always enabled, but only when
  117. -- MULTILINE=True. Default: False.
  118. do
  119. iup_open.set_attribute(Current, "FORMATTING", boolean_to_yesno(state))
  120. end
  121. add_format_tag (name: STRING)
  122. -- [write only] (non inheritable) Name of a format tag element to be
  123. -- added to the IUP_TEXT. The name association must be done before
  124. -- setting the attribute.
  125. do
  126. iup_open.set_attribute(Current, "ADDFORMATTAG", name)
  127. end
  128. add_format_widget (wgt: IUP_FORMATTING)
  129. -- [write only] (non inheritable) Handle of a format tag element to be
  130. -- added to the IUP_TEXT. The tag element will be automatically destroyed
  131. -- when the IUP_TEXT is mapped. If the IUP_TEXT is already mapped, the
  132. -- format tag is immediately destroyed when the attribute is set. The
  133. -- format tag can NOT be reused.
  134. local
  135. str: STRING
  136. do
  137. create str.from_external(wgt.widget)
  138. iup_open.set_attribute(Current, "ADDFORMATTAG_HANDLE", str)
  139. end
  140. remove_formatting (value: STRING)
  141. -- Removes the formatting of the current selection if YES, and from all
  142. -- text if ALL is used.
  143. require
  144. is_valid_remove(value)
  145. do
  146. iup_open.set_attribute(Current, "REMOVEFORMATTING", value)
  147. end
  148. set_no_hide_sel (state: BOOLEAN)
  149. -- [Windows Only]: do not hide the selection when the control loses its
  150. -- focus. Default: True.
  151. do
  152. iup_open.set_attribute(Current, "NOHIDESEL", boolean_to_yesno(state))
  153. end
  154. set_overwrite (state: BOOLEAN)
  155. -- [Windows and GTK Only] (non inheritable): turns the overwrite mode
  156. -- ON (True) or OFF (False). Works only when FORMATTING=True.
  157. local
  158. str: STRING
  159. do
  160. if state then
  161. str := "ON"
  162. else
  163. str := "OFF"
  164. end
  165. iup_open.set_attribute(Current, "OVERWRITE", str)
  166. end
  167. set_password (state: BOOLEAN)
  168. -- (creation only) [Windows and GTK Only] (non inheritable): Hide the
  169. -- typed character using an "*". Default: "False".
  170. do
  171. iup_open.set_attribute(Current, "PASSWORD", boolean_to_yesno(state))
  172. end
  173. set_value (value: STRING)
  174. -- (non inheritable): Text entered by the user. The '\n' character
  175. -- indicates a new line, valid only when is MULTILINE. After the element
  176. -- is mapped and if there is no text will return the empty string "".
  177. do
  178. iup_open.set_str_attribute(Current, "VALUE", value)
  179. end
  180. get_value: STRING
  181. -- The value.
  182. do
  183. Result := iup_open.get_attribute(Current, "VALUE")
  184. end
  185. set_value_masked (value: STRING)
  186. -- (non inheritable) (write-only): sets VALUE but first checks if it is
  187. -- validated by MASK. If not does nothing.
  188. do
  189. iup_open.set_attribute(Current, "VALUEMASKED", value)
  190. end
  191. set_visible_columns (value: INTEGER)
  192. -- Defines the number of visible columns for the Natural Size, this means
  193. -- that will act also as minimum number of visible columns. It uses a
  194. -- wider character size then the one used for the SIZE attribute so
  195. -- strings will fit better without the need of extra columns. As for SIZE
  196. -- you can set to Void after map to use it as an initial value. Default: 5
  197. require
  198. value >= 0
  199. do
  200. iup_open.set_attribute(Current, "VISIBLECOLUMNS", value.to_string)
  201. end
  202. -- Coordination to pos
  203. convert_xy_to_pos (x, y: INTEGER): INTEGER
  204. -- Converts a (x,y) coordinate in an string position.
  205. -- Returns: a position in the string starting at 0. If fails returns -1.
  206. -- Position is always "column - 1".
  207. do
  208. Result := iup_open.iup_convert_xy_to_pos (Current, x, y)
  209. end
  210. -- Callbacks
  211. -- Common
  212. set_cb_map (act: FUNCTION[TUPLE[IUP_TEXT], STRING])
  213. -- Called right after an element is mapped and its attributes updated.
  214. local
  215. operation: INTEGER
  216. do
  217. cb_map := act
  218. if cb_map /= Void then
  219. operation := 1
  220. else
  221. operation := 0
  222. end
  223. iup_open.set_callback (Current, "MAP_CB", "NONEEDED", operation)
  224. end
  225. set_cb_unmap (act: FUNCTION[TUPLE[IUP_TEXT], STRING])
  226. -- Called right before an element is unmapped.
  227. local
  228. operation: INTEGER
  229. do
  230. cb_unmap := act
  231. if cb_unmap /= Void then
  232. operation := 1
  233. else
  234. operation := 0
  235. end
  236. iup_open.set_callback (Current, "UNMAP_CB", "NONEEDED", operation)
  237. end
  238. set_cb_destroy (act: FUNCTION[TUPLE[IUP_TEXT], STRING])
  239. -- Called right before an element is destroyed.
  240. local
  241. operation: INTEGER
  242. do
  243. cb_destroy := act
  244. if cb_destroy /= Void then
  245. operation := 1
  246. else
  247. operation := 0
  248. end
  249. iup_open.set_callback (Current, "DESTROY_CB", "NONEEDED", operation)
  250. end
  251. set_cb_get_focus (act: FUNCTION[TUPLE[IUP_TEXT], STRING])
  252. -- Action generated when an element is given keyboard focus.
  253. -- This callback is called after the KILLFOCUS_CB of the element
  254. -- that loosed the focus. The {IUP}.get_focus function during the
  255. -- callback returns the element that loosed the focus.
  256. local
  257. operation: INTEGER
  258. do
  259. cb_getfocus := act
  260. if cb_getfocus /= Void then
  261. operation := 1
  262. else
  263. operation := 0
  264. end
  265. iup_open.set_callback (Current, "GETFOCUS_CB", "NONEEDED", operation)
  266. end
  267. set_cb_kill_focus (act: FUNCTION[TUPLE[IUP_TEXT], STRING])
  268. -- Action generated when an element loses keyboard focus. This
  269. -- callback is called before the GETFOCUS_CB of the element that
  270. -- gets the focus.
  271. local
  272. operation: INTEGER
  273. do
  274. cb_killfocus := act
  275. if cb_killfocus /= Void then
  276. operation := 1
  277. else
  278. operation := 0
  279. end
  280. iup_open.set_callback (Current, "KILLFOCUS_CB", "NONEEDED", operation)
  281. end
  282. set_cb_enter_window (act: FUNCTION[TUPLE[IUP_TEXT], STRING])
  283. -- Action generated when the mouse enters the native element.
  284. local
  285. operation: INTEGER
  286. do
  287. cb_enterwindow := act
  288. if cb_enterwindow /= Void then
  289. operation := 1
  290. else
  291. operation := 0
  292. end
  293. iup_open.set_callback (Current, "ENTERWINDOW_CB", "NONEEDED", operation)
  294. end
  295. set_cb_leave_window (act: FUNCTION[TUPLE[IUP_TEXT], STRING])
  296. -- Action generated when the mouse leaves the native element.
  297. local
  298. operation: INTEGER
  299. do
  300. cb_leavewindow := act
  301. if cb_leavewindow /= Void then
  302. operation := 1
  303. else
  304. operation := 0
  305. end
  306. iup_open.set_callback (Current, "LEAVEWINDOW_CB", "NONEEDED", operation)
  307. end
  308. set_cb_k_any (act: FUNCTION[TUPLE[IUP_TEXT, INTEGER], STRING])
  309. -- Action generated when a keyboard event occurs.
  310. -- IUP_WIDGET the element that activated the event.
  311. -- INTEGER identifier of typed key. Please refer to the Keyboard
  312. -- Codes table for a list of possible values.
  313. --
  314. -- Returns: If IUP_IGNORE is returned the key is ignored and not
  315. -- processed by the control and not propagated. If returns
  316. -- IUP_CONTINUE, the key will be processed and the event will be
  317. -- propagated to the parent of the element receiving it, this is
  318. -- the default behavior. If returns IUP_DEFAULT the key is processed
  319. -- but it is not propagated. IUP_CLOSE will be processed.
  320. local
  321. operation: INTEGER
  322. do
  323. cb_k_any := act
  324. if cb_k_any /= Void then
  325. operation := 1
  326. else
  327. operation := 0
  328. end
  329. iup_open.set_callback (Current, "K_ANY", "NONEEDED", operation)
  330. end
  331. set_cb_help (act: PROCEDURE[TUPLE[IUP_TEXT]])
  332. -- Action generated when the user press F1 at a control. In Motif
  333. -- is also activated by the Help button in some workstations
  334. -- keyboard.
  335. -- Returns: IUP_CLOSE will be processed.
  336. local
  337. operation: INTEGER
  338. do
  339. cb_help := act
  340. if cb_help /= Void then
  341. operation := 1
  342. else
  343. operation := 0
  344. end
  345. iup_open.set_callback (Current, "HELP_CB", "NONEEDED", operation)
  346. end
  347. -- Extra
  348. set_cb_text (act: FUNCTION[TUPLE[IUP_TEXT, INTEGER, STRING], STRING])
  349. -- Action generated when the text is edited, but before its value is
  350. -- actually changed. Can be generated when using the keyboard, undo
  351. -- system or from the clipboard.
  352. --
  353. -- ih: identifier of the element that activated the event.
  354. -- c: valid alpha numeric character or 0.
  355. -- new_value: Represents the new text value.
  356. --
  357. -- Returns: IUP_CLOSE will be processed, but the change will be ignored.
  358. -- If IUP_IGNORE, the system will ignore the new value. If c is valid and
  359. -- returns a valid alpha numeric-character, this new character will be
  360. -- used instead. The VALUE attribute can be changed only if IUP_IGNORE is
  361. -- returned.
  362. local
  363. operation: INTEGER
  364. do
  365. cb_action := act
  366. if cb_action /= Void then
  367. operation := 1
  368. else
  369. operation := 0
  370. end
  371. iup_open.set_callback (Current, "ACTION", "Fnis", operation)
  372. end
  373. set_cb_button (act: FUNCTION[TUPLE[IUP_TEXT, INTEGER, INTEGER, INTEGER, INTEGER, STRING], STRING])
  374. -- Action generated when any mouse button is pressed and when it is
  375. -- released. Both calls occur before the ACTION callback when button 1 is
  376. -- being used.
  377. -- Use convert_xy_to_pos to convert (x,y) coordinates in character
  378. -- positioning.
  379. --
  380. -- IUP_BUTTON: identifies the element that activated the event.
  381. -- button: identifies the activated mouse button:
  382. --
  383. -- 1 - left mouse button (button 1);
  384. -- 2 - middle mouse button (button 2);
  385. -- 3 - right mouse button (button 3).
  386. --
  387. -- pressed: indicates the state of the button:
  388. --
  389. -- 0 - mouse button was released;
  390. -- 1 - mouse button was pressed.
  391. --
  392. -- x, y: position in the canvas where the event has occurred, in pixels.
  393. --
  394. -- status: status of the mouse buttons and some keyboard keys at the
  395. -- moment the event is generated. The following IUP features must be used
  396. -- for verification:
  397. --
  398. -- is_shift(status)
  399. -- is_control(status)
  400. -- is_button_1(status)
  401. -- is_button_2(status)
  402. -- is_button_3(status)
  403. -- is_button_4(status)
  404. -- is_button_5(status)
  405. -- is_double(status)
  406. -- is_alt(status)
  407. -- is_sys(status)
  408. --
  409. -- Returns: IUP_CLOSE will be processed. On some controls if IUP_IGNORE
  410. -- is returned the action is ignored (this is system dependent).
  411. local
  412. operation: INTEGER
  413. do
  414. cb_button := act
  415. if cb_button /= Void then
  416. operation := 1
  417. else
  418. operation := 0
  419. end
  420. iup_open.set_callback (Current, "BUTTON_CB", "NONEEDED", operation)
  421. end
  422. set_cb_caret (act: FUNCTION[TUPLE[IUP_TEXT, INTEGER, INTEGER, INTEGER], STRING])
  423. -- Action generated when the caret/cursor position is changed.
  424. --
  425. -- ih: identifier of the element that activated the event.
  426. -- lin, col: line and column number (start at 1).
  427. -- pos: 0 based character position.
  428. --
  429. -- For single line controls lin is always 1, and pos is always "col-1".
  430. local
  431. operation: INTEGER
  432. do
  433. cb_caret := act
  434. if cb_caret /= Void then
  435. operation := 1
  436. else
  437. operation := 0
  438. end
  439. iup_open.set_callback (Current, "CARET_CB", "NONEEDED", operation)
  440. end
  441. set_cb_drop_files (act: FUNCTION[TUPLE[IUP_TEXT, STRING, INTEGER, INTEGER, INTEGER], STRING])
  442. -- Action called when a file is "dropped" into the control. When several
  443. -- files are dropped at once, the callback is called several times, once
  444. -- for each file.
  445. --
  446. -- If defined after the element is mapped then the attribute
  447. -- DROPFILESTARGET must be set to True. [Windows and GTK Only]
  448. --
  449. -- ih: identifier of the element that activated the event.
  450. -- filename: Name of the dropped file.
  451. -- num: Number index of the dropped file. If several files are dropped,
  452. -- num is the index of the dropped file starting from "total-1" to "0".
  453. -- x: X coordinate of the point where the user released the mouse button.
  454. -- y: Y coordinate of the point where the user released the mouse button.
  455. --
  456. -- Returns: If IUP_IGNORE is returned the callback will NOT be called for
  457. -- the next dropped files, and the processing of dropped files will be
  458. -- interrupted.
  459. local
  460. operation: INTEGER
  461. do
  462. cb_dropfiles := act
  463. if cb_dropfiles /= Void then
  464. operation := 1
  465. else
  466. operation := 0
  467. end
  468. iup_open.set_callback (Current, "DROPFILES_CB", "NONEEDED", operation)
  469. end
  470. set_cb_motion (act: FUNCTION[TUPLE[IUP_TEXT, INTEGER, INTEGER, STRING], STRING])
  471. -- Action generated when the mouse moves.
  472. -- Use convert_xy_to_pos to convert (x,y) coordinates in character
  473. -- positioning.
  474. --
  475. -- ih: identifier of the element that activated the event.
  476. -- x, y: position in the canvas where the event has occurred, in pixels.
  477. -- status: status of mouse buttons and certain keyboard keys at the
  478. -- moment the event was generated. The same macros used for BUTTON_CB can
  479. -- be used for this status.
  480. local
  481. operation: INTEGER
  482. do
  483. cb_motion := act
  484. if cb_motion /= Void then
  485. operation := 1
  486. else
  487. operation := 0
  488. end
  489. iup_open.set_callback (Current, "MOTION_CB", "NONEEDED", operation)
  490. end
  491. set_cb_value_changed (act: FUNCTION[TUPLE[IUP_TEXT], STRING])
  492. -- Called after the value was interactively changed by the user.
  493. local
  494. operation: INTEGER
  495. do
  496. cb_valuechanged := act
  497. if cb_valuechanged /= Void then
  498. operation := 1
  499. else
  500. operation := 0
  501. end
  502. iup_open.set_callback (Current, "VALUECHANGED_CB", "NONEEDED", operation)
  503. end
  504. set_cb_mask_fail (act: FUNCTION[TUPLE[IUP_TEXT, STRING], STRING])
  505. -- Action generated when the new text fails at the mask check.
  506. -- ih: identifier of the element that activated the event.
  507. -- new_value: Represents the new text value.
  508. local
  509. operation: INTEGER
  510. do
  511. cb_maskfail := act
  512. if cb_maskfail /= Void then
  513. operation := 1
  514. else
  515. operation := 0
  516. end
  517. iup_open.set_callback (Current, "MASKFAIL_CB", "NONEEDED", operation)
  518. end
  519. feature {IUP}
  520. execute_map: STRING
  521. do
  522. Result := cb_map.item([Current])
  523. end
  524. execute_unmap: STRING
  525. do
  526. Result := cb_unmap.item([Current])
  527. end
  528. execute_destroy: STRING
  529. do
  530. Result := cb_destroy.item([Current])
  531. end
  532. execute_getfocus: STRING
  533. do
  534. Result := cb_getfocus.item([Current])
  535. end
  536. execute_killfocus: STRING
  537. do
  538. Result := cb_getfocus.item([Current])
  539. end
  540. execute_enterwindow: STRING
  541. do
  542. Result := cb_enterwindow.item([Current])
  543. end
  544. execute_leavewindow: STRING
  545. do
  546. Result := cb_leavewindow.item([Current])
  547. end
  548. execute_k_any (c: INTEGER): STRING
  549. do
  550. Result := cb_k_any.item([Current, c])
  551. end
  552. execute_help
  553. do
  554. cb_help.call([Current])
  555. end
  556. execute_action_fnis (c: INTEGER; new_value: STRING): STRING
  557. do
  558. Result := cb_action.item([Current, c, new_value])
  559. end
  560. execute_button (btn, pressed, x, y: INTEGER; status: STRING): STRING
  561. do
  562. Result := cb_button.item([Current, btn, pressed, x, y, status])
  563. end
  564. execute_caret (lin, col, pos: INTEGER): STRING
  565. do
  566. Result := cb_caret.item([Current, lin, col, pos])
  567. end
  568. execute_dropfiles (filename: STRING; num: INTEGER; x: INTEGER; y: INTEGER): STRING
  569. do
  570. Result := cb_dropfiles.item([Current, filename, num, x, y])
  571. end
  572. execute_motion (x, y: INTEGER; status: STRING): STRING
  573. do
  574. Result := cb_motion.item([Current, x, y, status])
  575. end
  576. execute_valuechanged: STRING
  577. do
  578. Result := cb_valuechanged.item([Current])
  579. end
  580. execute_maskfail (new_value: STRING): STRING
  581. do
  582. Result := cb_maskfail.item([Current, new_value])
  583. end
  584. feature {}
  585. -- For callbacks
  586. cb_map: FUNCTION[TUPLE[IUP_TEXT], STRING]
  587. cb_unmap: FUNCTION[TUPLE[IUP_TEXT], STRING]
  588. cb_destroy: FUNCTION[TUPLE[IUP_TEXT], STRING]
  589. cb_getfocus: FUNCTION[TUPLE[IUP_TEXT], STRING]
  590. cb_killfocus: FUNCTION[TUPLE[IUP_TEXT], STRING]
  591. cb_enterwindow: FUNCTION[TUPLE[IUP_TEXT], STRING]
  592. cb_leavewindow: FUNCTION[TUPLE[IUP_TEXT], STRING]
  593. cb_k_any: FUNCTION[TUPLE[IUP_TEXT, INTEGER], STRING]
  594. cb_help: PROCEDURE[TUPLE[IUP_TEXT]]
  595. cb_action: FUNCTION[TUPLE[IUP_TEXT, INTEGER, STRING], STRING]
  596. cb_button: FUNCTION[TUPLE[IUP_TEXT, INTEGER, INTEGER, INTEGER, INTEGER, STRING], STRING]
  597. cb_caret: FUNCTION[TUPLE[IUP_TEXT, INTEGER, INTEGER, INTEGER], STRING]
  598. cb_dropfiles: FUNCTION[TUPLE[IUP_TEXT, STRING, INTEGER, INTEGER, INTEGER], STRING]
  599. cb_motion: FUNCTION[TUPLE[IUP_TEXT, INTEGER, INTEGER, STRING], STRING]
  600. cb_valuechanged: FUNCTION[TUPLE[IUP_TEXT], STRING]
  601. cb_maskfail: FUNCTION[TUPLE[IUP_TEXT, STRING], STRING]
  602. -- Internals
  603. int_text (action: POINTER): POINTER
  604. external "plug_in"
  605. alias "{
  606. location: "${sys}/plugins"
  607. module_name: "iup"
  608. feature_name: "IupText"
  609. }"
  610. end
  611. -- Validations
  612. is_valid_alignment (value: STRING): BOOLEAN
  613. do
  614. if value.is_equal("ALEFT") or
  615. value.is_equal("ACENTER") or
  616. value.is_equal("ARIGHT") then
  617. Result := True
  618. else
  619. Result := False
  620. end
  621. end
  622. is_valid_remove (value: STRING): BOOLEAN
  623. do
  624. if value.is_equal("YES") or
  625. value.is_equal("ALL") then
  626. Result := True
  627. else
  628. Result := False
  629. end
  630. end
  631. end
  632. -- The MIT License (MIT)
  633. -- Copyright (c) 2016, 2017, 2018, 2019 by German A. Arias
  634. -- Permission is hereby granted, free of charge, to any person obtaining a copy
  635. -- of this software and associated documentation files (the "Software"), to deal
  636. -- in the Software without restriction, including without limitation the rights
  637. -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  638. -- copies of the Software, and to permit persons to whom the Software is
  639. -- furnished to do so, subject to the following conditions:
  640. --
  641. -- The above copyright notice and this permission notice shall be included in
  642. -- all copies or substantial portions of the Software.
  643. --
  644. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  645. -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  646. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  647. -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  648. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  649. -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  650. -- SOFTWARE.