iup_flat_tabs.e 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363
  1. class IUP_FLAT_TABS
  2. -- Creates a native container for composing elements in hidden layers with only
  3. -- one layer visible (just like IupZbox), but its visibility can be
  4. -- interactively controlled. The interaction is done in a line of tabs with
  5. -- titles and arranged according to the tab type. Also known as Notebook in
  6. -- native systems. Identical to the IUP_TABS control but the decorations and
  7. -- buttons are manually drawn. It inherits from IUP_CANVAS.
  8. inherit
  9. IUP_CANVAS
  10. redefine
  11. execute_flat_button,
  12. execute_flat_motion,
  13. execute_flat_leavewindow,
  14. execute_tabchange,
  15. execute_tabchangepos,
  16. execute_tabclose,
  17. execute_rightclick,
  18. execute_extrabutton
  19. end
  20. IUP_WIDGET_CLIENTSIZE
  21. IUP_WIDGET_CLIENTOFFSET
  22. IUP_WIDGET_NAME
  23. IUP_WIDGET_FLAT_TEXT
  24. IUP_WIDGET_FLOATING
  25. IUP_WIDGET_CHILDSIZEALL
  26. create {ANY}
  27. flat_tabs_empty,
  28. flat_tabs
  29. feature {ANY}
  30. flat_tabs_empty
  31. -- Create an empty flat tabs
  32. local
  33. p, a_flat_tabs: POINTER
  34. do
  35. a_flat_tabs := int_flat_tabs_empty (p)
  36. set_widget(a_flat_tabs)
  37. end
  38. flat_tabs (col: ARRAY[IUP_WIDGET])
  39. -- Create a new flat tabs containing the list of widgets
  40. local
  41. i: INTEGER; arg: ARRAY[POINTER]; s: IUP_WIDGET; a_flat_tabs: POINTER
  42. do
  43. i := col.count
  44. create arg.make_filled(default_pointer, 1, i + 1)
  45. i := 0
  46. across
  47. col as ic
  48. loop
  49. i := i + 1
  50. s := ic.item
  51. arg.put(s.widget, i)
  52. end
  53. a_flat_tabs := int_flat_tabs (get_pointer(arg.to_c))
  54. set_widget(a_flat_tabs)
  55. end
  56. -- Attributes
  57. set_rgb_fore_color (red: INTEGER; green: INTEGER; blue: INTEGER)
  58. -- Text color for the current Tab. Default: "50 150 255".
  59. do
  60. iup_open.set_attribute(Current, "FORECOLOR", rgb_to_string(red, green, blue))
  61. end
  62. get_rgb_fore_color: TUPLE[INTEGER, INTEGER, INTEGER]
  63. do
  64. Result := iup_open.get_rgb(Current, "FORECOLOR")
  65. end
  66. set_rgb_highlight_color (red: INTEGER; green: INTEGER; blue: INTEGER)
  67. -- Text color for the highlighted Tab. The current Tab is never
  68. -- highlighted, so it affects only the other tabs. If not defined
  69. -- FORECOLOR will be used.
  70. do
  71. iup_open.set_attribute(Current, "HIGHCOLOR", rgb_to_string(red, green, blue))
  72. end
  73. get_rgb_highlight_color: TUPLE[INTEGER, INTEGER, INTEGER]
  74. do
  75. Result := iup_open.get_rgb(Current, "HIGHCOLOR")
  76. end
  77. set_child_offset (horizontal, vertical: INTEGER)
  78. -- Allow to specify a position offset for the child. Available for native
  79. -- containers only. It will not affect the natural size, and allows to
  80. -- position controls outside the client area. Format "dxxdy", where dx
  81. -- and dy are integer values corresponding to the horizontal and vertical
  82. -- offsets, respectively, in pixels. Default: 0x0.
  83. require
  84. horizontal >= 0
  85. vertical >= 0
  86. local
  87. offset: STRING
  88. do
  89. offset := horizontal.out
  90. offset.append_string("x")
  91. offset.append_string(vertical.out)
  92. iup_open.set_attribute(Current, "CHILDOFFSET", offset)
  93. end
  94. get_child_offset: TUPLE[INTEGER, INTEGER]
  95. -- Return the offset of the child.
  96. local
  97. offset: STRING
  98. do
  99. offset := iup_open.get_attribute(Current, "CHILDOFFSET")
  100. Result := components_of_size(offset)
  101. end
  102. get_count: INTEGER
  103. -- (read-only) (non inheritable): returns the number of tabs.
  104. do
  105. Result := get_child_count
  106. end
  107. set_fixed_width (state: BOOLEAN)
  108. -- Forces all tabs to use the same width. Default: False.
  109. do
  110. iup_open.set_attribute(Current, "FIXEDWIDTH", boolean_to_yesno(state))
  111. end
  112. is_fixed_width: BOOLEAN
  113. local
  114. str: STRING
  115. do
  116. str := iup_open.get_attribute(Current, "FIXEDWIDTH")
  117. Result := yesno_to_boolean(str)
  118. end
  119. set_show_close (state: BOOLEAN)
  120. -- Enables the close button on each tab. Default value: "False". By
  121. -- default when closed the tab is hidden. To change that behavior use the
  122. -- TABCLOSE_CB callback.
  123. do
  124. iup_open.set_attribute(Current, "SHOWCLOSE", boolean_to_yesno(state))
  125. end
  126. is_show_close: BOOLEAN
  127. local
  128. str: STRING
  129. do
  130. str := iup_open.get_attribute(Current, "SHOWCLOSE")
  131. Result := yesno_to_boolean(str)
  132. end
  133. set_show_lines (state: BOOLEAN)
  134. -- When enabled the current tab will be separated of the other tabs by a
  135. -- line. Default: True.
  136. do
  137. iup_open.set_attribute(Current, "SHOWLINES", boolean_to_yesno(state))
  138. end
  139. is_show_lines: BOOLEAN
  140. local
  141. str: STRING
  142. do
  143. str := iup_open.get_attribute(Current, "SHOWLINES")
  144. Result := yesno_to_boolean(str)
  145. end
  146. set_tab_change_on_check (state: BOOLEAN)
  147. -- Call the TABCHANGE* callbacks when current tab is removed or hidden.
  148. -- Default: False.
  149. do
  150. iup_open.set_attribute(Current, "TABCHANGEONCHECK", boolean_to_yesno(state))
  151. end
  152. is_tab_change_on_check: BOOLEAN
  153. local
  154. str: STRING
  155. do
  156. str := iup_open.get_attribute(Current, "TABCHANGEONCHECK")
  157. Result := yesno_to_boolean(str)
  158. end
  159. set_tabs_padding (horizontal, vertical: INTEGER)
  160. -- (non inheritable): internal margin of the tab title. Works just like
  161. -- the MARGIN attribute of the IUP_HBOX and IUP_VBOX containers.
  162. -- Default value: "6x4".
  163. require
  164. horizontal >= 0
  165. vertical >= 0
  166. local
  167. padding: STRING
  168. do
  169. padding := horizontal.out
  170. padding.append_string("x")
  171. padding.append_string(vertical.out)
  172. iup_open.set_attribute(Current, "TABSPADDING", padding)
  173. end
  174. get_tabs_padding: TUPLE[INTEGER, INTEGER]
  175. -- Return the margin of the tab title.
  176. local
  177. padding: STRING
  178. do
  179. padding := iup_open.get_attribute(Current, "TABSPADDING")
  180. Result := components_of_size(padding)
  181. end
  182. set_tabs_rgb_fore_color (red: INTEGER; green: INTEGER; blue: INTEGER)
  183. -- Text color of the tabs that are not the current tab. Default: the
  184. -- global attribute DLGFGCOLOR.
  185. do
  186. iup_open.set_attribute(Current, "TABSFORECOLOR", rgb_to_string(red, green, blue))
  187. end
  188. get_tabs_rgb_fore_color: TUPLE[INTEGER, INTEGER, INTEGER]
  189. do
  190. Result := iup_open.get_rgb(Current, "TABSFORECOLOR")
  191. end
  192. set_tabs_rgb_background_color (red: INTEGER; green: INTEGER; blue: INTEGER)
  193. -- Background color of the tabs that are not the current tab. If not
  194. -- defined it will use the background color of the parent.
  195. do
  196. iup_open.set_attribute(Current, "TABSBACKCOLOR", rgb_to_string(red, green, blue))
  197. end
  198. get_tabs_rgb_background_color: TUPLE[INTEGER, INTEGER, INTEGER]
  199. do
  200. Result := iup_open.get_rgb(Current, "TABSBACKCOLOR")
  201. end
  202. set_tabs_rgb_highlight_color (red: INTEGER; green: INTEGER; blue: INTEGER)
  203. -- Background highlight color of the tabs that are not the current tab.
  204. -- When not defined the background is not highlighted.
  205. do
  206. iup_open.set_attribute(Current, "TABSHIGHCOLOR", rgb_to_string(red, green, blue))
  207. end
  208. get_tabs_rgb_highlight_color: TUPLE[INTEGER, INTEGER, INTEGER]
  209. do
  210. Result := iup_open.get_rgb(Current, "TABSHIGHCOLOR")
  211. end
  212. set_tabs_font (font: STRING)
  213. -- Text font of the tabs. When not defined FONT is used. It is a non
  214. -- inheritable option for setting the font.
  215. do
  216. iup_open.set_attribute(Current, "TABSFONT", font)
  217. end
  218. get_tabs_font: STRING
  219. -- Return the string with the description of the used font.
  220. do
  221. Result := iup_open.get_attribute(Current, "TABSFONT")
  222. end
  223. set_tabs_font_style (fontstyle: STRING)
  224. -- Text font style. When change will actually set TABSFONT.
  225. do
  226. iup_open.set_attribute(Current, "TABSFONTSTYLE", fontstyle)
  227. end
  228. get_tabs_font_style: STRING
  229. -- Return the style of the current TABSFONTSTYLE attribute.
  230. do
  231. Result := iup_open.get_attribute(Current, "TABSFONTSTYLE")
  232. end
  233. set_tabs_font_size (fontsize: INTEGER)
  234. -- Text font size. When change will actually set TABSFONT.
  235. do
  236. iup_open.set_attribute(Current, "TABSFONTSIZE", fontsize.out)
  237. end
  238. get_tabs_font_size: INTEGER
  239. -- Return the style of the current TABSFONTSIZE attribute.
  240. local
  241. size: STRING
  242. do
  243. size := iup_open.get_attribute(Current, "TABSFONTSIZE")
  244. Result := size.to_integer
  245. end
  246. set_tabs_text_alignment (value: STRING)
  247. -- Horizontal text alignment for multiple lines. Can be: ALEFT, ARIGHT or
  248. -- ACENTER. Default: ALEFT.
  249. require
  250. is_valid: is_valid_horizontal_alignment(value)
  251. do
  252. iup_open.set_attribute(Current, "TABSTEXTALIGNMENT", value)
  253. end
  254. get_tabs_text_alignment: STRING
  255. do
  256. Result := iup_open.get_attribute(Current, "TABSTEXTALIGNMENT")
  257. end
  258. set_tabs_text_wrap (state: BOOLEAN)
  259. -- (non inheritable): For single line texts if the text is larger than
  260. -- its box the line will be automatically broken in multiple lines.
  261. -- Notice that this is done internally by the system, the element natural
  262. -- size will still use only a single line. For the remaining lines to be
  263. -- visible the element should use EXPAND=VERTICAL or set a
  264. -- SIZE/RASTERSIZE with enough height for the wrapped lines.
  265. do
  266. iup_open.set_attribute(Current, "TABSTEXTWRAP", boolean_to_yesno(state))
  267. end
  268. set_tabs_text_ellipsis (state: BOOLEAN)
  269. -- (non inheritable): If the text is larger that its box, an ellipsis
  270. -- ("...") will be placed near the last visible part of the text and
  271. -- replace the invisible part. It will be ignored when TEXTWRAP=True.
  272. do
  273. iup_open.set_attribute(Current, "TABSTEXTELLIPSIS", boolean_to_yesno(state))
  274. end
  275. set_tabs_text_orientation (value: REAL_64)
  276. -- (non inheritable): text angle in degrees and counterclockwise. The
  277. -- text size will adapt to include the rotated space.
  278. do
  279. iup_open.set_attribute(Current, "TABSTEXTORIENTATION", value.out)
  280. end
  281. set_tab_type_top
  282. -- The default value. It will not automatically change the TABORIENTATION.
  283. -- When changed with the dialog visible the application should call
  284. -- "refresh" or "refresh_children" to updated the layout when ready.
  285. do
  286. iup_open.set_attribute(Current, "TABTYPE", "TOP")
  287. end
  288. set_tab_type_bottom
  289. -- It will not automatically change the TABORIENTATION. When changed with
  290. -- the dialog visible the application should call "refresh" or
  291. -- "refresh_children" to updated the layout when ready.
  292. do
  293. iup_open.set_attribute(Current, "TABTYPE", "BOTTOM")
  294. end
  295. set_tab_type_left
  296. -- It will not automatically change the TABORIENTATION. When changed with
  297. -- the dialog visible the application should call "refresh" or
  298. -- "refresh_children" to updated the layout when ready.
  299. do
  300. iup_open.set_attribute(Current, "TABTYPE", "LEFT")
  301. end
  302. set_tab_type_right
  303. -- It will not automatically change the TABORIENTATION. When changed with
  304. -- the dialog visible the application should call "refresh" or
  305. -- "refresh_children" to updated the layout when ready.
  306. do
  307. iup_open.set_attribute(Current, "TABTYPE", "RIGHT")
  308. end
  309. set_tab_orientation_horizontal
  310. -- Horizontal orientation of tab text. Thi is the default value.
  311. do
  312. iup_open.set_attribute(Current, "TABORIENTATION", "HORIZONTAL")
  313. end
  314. set_tab_orientation_vertical
  315. -- When set to vertical it will simply set_tabs_text_orientation=90.
  316. do
  317. iup_open.set_attribute(Current, "TABORIENTATION", "VERTICAL")
  318. end
  319. set_tabs_rgb_line_color (red: INTEGER; green: INTEGER; blue: INTEGER)
  320. -- Color of the separator line. Default: "180 180 180".
  321. do
  322. iup_open.set_attribute(Current, "TABSLINECOLOR", rgb_to_string(red, green, blue))
  323. end
  324. get_tabs_rgb_line_color: TUPLE[INTEGER, INTEGER, INTEGER]
  325. do
  326. Result := iup_open.get_rgb(Current, "TABSLINECOLOR")
  327. end
  328. set_tabs_image_position (value: STRING)
  329. -- Position of the image relative to the text when both are displayed.
  330. -- Can be: LEFT, RIGHT, TOP, BOTTOM. Default: LEFT.
  331. require
  332. is_valid: is_valid_position(value)
  333. do
  334. iup_open.set_attribute(Current, "TABSIMAGEPOSITION", value)
  335. end
  336. get_tabs_image_position: STRING
  337. do
  338. Result := iup_open.get_attribute(Current, "TABSIMAGEPOSITION")
  339. end
  340. set_tabs_image_spacing (value: INTEGER)
  341. -- Spacing between the image and the text. Default: "2".
  342. require
  343. positive: value >= 0
  344. do
  345. iup_open.set_attribute(Current, "TABSIMAGESPACING", value.out)
  346. end
  347. get_tabs_image_spacing: STRING
  348. do
  349. Result := iup_open.get_attribute(Current, "TABSIMAGESPACING")
  350. end
  351. set_tabs_alignment (horizontal, vertical: STRING)
  352. -- Horizontal and vertical alignment of the set image+text. Possible
  353. -- values: "ALEFT", "ACENTER" and "ARIGHT", combined to "ATOP", "ACENTER"
  354. -- and "ABOTTOM". Default: "ACENTER:ACENTER".
  355. require
  356. is_valid_tabs_alignment(horizontal, vertical)
  357. local
  358. str: STRING
  359. do
  360. create str.make_from_string(horizontal)
  361. str.append_string(":")
  362. str.append_string(vertical)
  363. iup_open.set_attribute(Current, "TABSALIGNMENT", str)
  364. end
  365. get_tabs_alignment: TUPLE[INTEGER, INTEGER]
  366. -- Return the horizontal and vertical alignment.
  367. local
  368. str: STRING
  369. do
  370. str := iup_open.get_attribute(Current, "TABSALIGNMENT")
  371. Result := components_of(str, ':')
  372. end
  373. -- Tab Attributes (non inheritable)
  374. set_tab_n_image (imagename: STRING; n: INTEGER)
  375. -- Image name to be used in the respective tab. Use
  376. -- set_widget_name to associate an image to a name. n starts at 0.
  377. -- See also IUP_IMAGE.
  378. require
  379. n >= 0
  380. do
  381. iup_open.set_attribute_id(Current, "TABIMAGE", n, imagename)
  382. end
  383. get_tab_n_image (n: INTEGER): STRING
  384. -- Return the image name at tab n.
  385. require
  386. n >= 0
  387. do
  388. Result := iup_open.get_attribute_id(Current, "TABIMAGE", n)
  389. end
  390. set_tab_n_image_highlight (imagename: STRING; n: INTEGER)
  391. -- Same as set_tab_n_image when in highlight state. If not defined
  392. -- tab n image is used.
  393. require
  394. n >= 0
  395. do
  396. iup_open.set_attribute_id(Current, "TABIMAGEHIGHTLIGHT", n, imagename)
  397. end
  398. get_tab_n_image_highlight (n: INTEGER): STRING
  399. -- Return the image highlight name at tab n.
  400. require
  401. n >= 0
  402. do
  403. Result := iup_open.get_attribute_id(Current, "TABIMAGEHIGHTLIGHT", n)
  404. end
  405. set_tab_n_image_inactive (imagename: STRING; n: INTEGER)
  406. -- Same as set_tab_n_image when in inactive state. If not defined
  407. -- tab n image is used and its colors will be replaced by a modified
  408. -- version creating the disabled effect.
  409. require
  410. n >= 0
  411. do
  412. iup_open.set_attribute_id(Current, "TABIMAGEINACTIVE", n, imagename)
  413. end
  414. get_tab_n_image_inactive (n: INTEGER): STRING
  415. -- Return the image inactive name at tab n.
  416. require
  417. n >= 0
  418. do
  419. Result := iup_open.get_attribute_id(Current, "TABIMAGEINACTIVE", n)
  420. end
  421. set_tab_n_visible (state: BOOLEAN; n: INTEGER)
  422. -- Allows to hide a tab. n starts at 0. When a tab is hidden the tabs
  423. -- indices are not changed.
  424. require
  425. n >= 0
  426. do
  427. iup_open.set_attribute_id (Current, "TABVISIBLE", n, boolean_to_yesno(state))
  428. end
  429. is_tab_n_visible (n: INTEGER): BOOLEAN
  430. -- Return the visible status of tab n.
  431. require
  432. n >= 0
  433. local
  434. str: STRING
  435. do
  436. str := iup_open.get_attribute_id(Current, "TABVISIBLE", n)
  437. Result := yesno_to_boolean(str)
  438. end
  439. set_tab_n_title (title: STRING; n: INTEGER)
  440. -- Contains the text to be shown in the respective tab title. n starts
  441. -- at 0.
  442. require
  443. n >= 0
  444. do
  445. iup_open.set_attribute_id (Current, "TABTITLE", n, title)
  446. end
  447. get_tab_n_title (n: INTEGER): STRING
  448. -- Return the title of tab n.
  449. require
  450. n >= 0
  451. do
  452. Result := iup_open.get_attribute_id(Current, "TABTITLE", n)
  453. end
  454. set_tab_n_active (state: BOOLEAN; n: INTEGER)
  455. -- Active state of the tab. Default: True.
  456. require
  457. n >= 0
  458. do
  459. iup_open.set_attribute_id(Current, "TABACTIVE", n, boolean_to_yesno(state))
  460. end
  461. is_tab_n_active (n: INTEGER): BOOLEAN
  462. -- Return the tab n active state.
  463. require
  464. n >= 0
  465. local
  466. str: STRING
  467. do
  468. str := iup_open.get_attribute_id(Current, "TABACTIVE", n)
  469. Result := yesno_to_boolean(str)
  470. end
  471. set_tab_n_rgb_fore_color (red, green, blue, n: INTEGER)
  472. -- Text color of the tab title. When not defined TABSFORECOLOR is used.
  473. require
  474. n >= 0
  475. do
  476. iup_open.set_attribute_id(Current, "TABFORECOLOR", n, rgb_to_string(red, green, blue))
  477. end
  478. get_tab_n_rgb_fore_color (n: INTEGER): TUPLE[INTEGER, INTEGER, INTEGER]
  479. require
  480. n >= 0
  481. do
  482. Result := iup_open.get_rgb_id(Current, "TABFORECOLOR", n)
  483. end
  484. set_tab_n_rgb_background_color (red, green, blue, n: INTEGER)
  485. -- Background color of the tab. When not defined TABSBACKCOLOR is used.
  486. require
  487. n >= 0
  488. do
  489. iup_open.set_attribute_id(Current, "TABBACKCOLOR", n, rgb_to_string(red, green, blue))
  490. end
  491. get_tab_n_rgb_background_color (n: INTEGER): TUPLE[INTEGER, INTEGER, INTEGER]
  492. require
  493. n >= 0
  494. do
  495. Result := iup_open.get_rgb_id(Current, "TABBACKCOLOR", n)
  496. end
  497. set_tab_n_rgb_highlight_color (red, green, blue, n: INTEGER)
  498. -- Highlight color of the tab title. When not defined TABSHIGHCOLOR is
  499. -- used.
  500. require
  501. n >= 0
  502. do
  503. iup_open.set_attribute_id(Current, "TABHIGHCOLOR", n, rgb_to_string(red, green, blue))
  504. end
  505. get_tab_n_rgb_highlight_color (n: INTEGER): TUPLE[INTEGER, INTEGER, INTEGER]
  506. require
  507. n >= 0
  508. do
  509. Result := iup_open.get_rgb_id(Current, "TABHIGHCOLOR", n)
  510. end
  511. set_tab_n_font (font: STRING; n: INTEGER)
  512. -- Text font of the tab. When not defined TABSFONT is used.
  513. require
  514. n >= 0
  515. do
  516. iup_open.set_attribute_id(Current, "TABFONT", n, font)
  517. end
  518. get_tab_n_font (n: INTEGER): STRING
  519. require
  520. n >= 0
  521. do
  522. Result := iup_open.get_attribute_id(Current, "TABFONT", n)
  523. end
  524. set_tab_n_font_style (fontstyle: STRING; n: INTEGER)
  525. -- Text font style. When change will actually set TABFONTn.
  526. require
  527. n >= 0
  528. do
  529. iup_open.set_attribute_id(Current, "TABFONTSTYLE", n, fontstyle)
  530. end
  531. get_tab_n_font_style (n: INTEGER): STRING
  532. require
  533. n >= 0
  534. do
  535. Result := iup_open.get_attribute_id(Current, "TABSFONTSTYLE", n)
  536. end
  537. set_tab_n_font_size (fontsize, n: INTEGER)
  538. -- Text font size. When change will actually set TABFONTn.
  539. require
  540. n >= 0
  541. do
  542. iup_open.set_attribute_id(Current, "TABFONTSIZE", n, fontsize.out)
  543. end
  544. get_tab_n_font_size (n: INTEGER): INTEGER
  545. require
  546. n >= 0
  547. local
  548. size: STRING
  549. do
  550. size := iup_open.get_attribute_id(Current, "TABFONTSIZE", n)
  551. Result := size.to_integer
  552. end
  553. set_tab_n_tip (tip: STRING; n: INTEGER)
  554. -- TIP of the tab.
  555. require
  556. n >= 0
  557. do
  558. iup_open.set_attribute_id(Current, "TABTIP", n, tip)
  559. end
  560. get_tab_n_tip (n: INTEGER): STRING
  561. require
  562. n >= 0
  563. do
  564. Result := iup_open.get_attribute_id(Current, "TABTIP", n)
  565. end
  566. -- Tab Close Button Attributes
  567. set_tab_close_image (imagename: STRING)
  568. -- Image name to be used in the close button. Use
  569. -- set_widget_name to associate an image to a name. n starts at 0.
  570. -- See also IUP_IMAGE. Default: "IMGFLATCLOSE".
  571. do
  572. iup_open.set_attribute(Current, "CLOSEIMAGE", imagename)
  573. end
  574. get_tab_close_image: STRING
  575. do
  576. Result := iup_open.get_attribute(Current, "TABIMAGE")
  577. end
  578. set_tab_close_image_press (imagename: STRING)
  579. -- Image name to be used in the close button in pressed state.
  580. -- Default: "IMGFLATCLOSEPRESS".
  581. do
  582. iup_open.set_attribute(Current, "CLOSEIMAGEPRESS", imagename)
  583. end
  584. get_tab_close_image_press: STRING
  585. do
  586. Result := iup_open.get_attribute(Current, "CLOSEIMAGEPRESS")
  587. end
  588. set_tab_close_image_highlight (imagename: STRING)
  589. -- Image name to be used in the close button in highlight state.
  590. do
  591. iup_open.set_attribute(Current, "CLOSEIMAGEHIGHLIGHT", imagename)
  592. end
  593. get_tab_close_image_highlight: STRING
  594. do
  595. Result := iup_open.get_attribute(Current, "CLOSEIMAGEHIGHLIGHT")
  596. end
  597. set_tab_close_image_inactive (imagename: STRING)
  598. -- Image name to be used in the close button in inactive state. If it is
  599. -- not defined then the CLOSEIMAGE is used and its colors will be
  600. -- replaced by a modified version creating the disabled effect.
  601. do
  602. iup_open.set_attribute(Current, "CLOSEIMAGEINACTIVE", imagename)
  603. end
  604. get_tab_close_image_inactive: STRING
  605. do
  606. Result := iup_open.get_attribute(Current, "CLOSEIMAGEINACTIVE")
  607. end
  608. set_tab_rgb_close_press_color (red, green, blue: INTEGER)
  609. -- Background color of the close button in pressed state.
  610. -- Default: "80 180 245".
  611. do
  612. iup_open.set_attribute(Current, "CLOSEPRESSCOLOR", rgb_to_string(red, green, blue))
  613. end
  614. get_tabs_rgb_close_press_color: TUPLE[INTEGER, INTEGER, INTEGER]
  615. do
  616. Result := iup_open.get_rgb(Current, "CLOSEPRESSCOLOR")
  617. end
  618. set_tab_rgb_close_highlight_color (red, green, blue: INTEGER)
  619. -- Background color of the close button in highlight state.
  620. -- Default: "200 220 245".
  621. do
  622. iup_open.set_attribute(Current, "CLOSEHIGHCOLOR", rgb_to_string(red, green, blue))
  623. end
  624. get_tabs_rgb_close_highlight_color: TUPLE[INTEGER, INTEGER, INTEGER]
  625. do
  626. Result := iup_open.get_rgb(Current, "CLOSEHIGHCOLOR")
  627. end
  628. -- Extra Buttons Attributes (non inheritable)
  629. set_extra_buttons (buttons: INTEGER)
  630. -- Sets the number of extra image buttons at right in the free space
  631. -- area. There can be any number of buttons. See the EXTRABUTTON_CB
  632. -- callback. Default: 0.
  633. --
  634. -- Button id starts at 1, and are positioned from right to left. Just
  635. -- like the tabs they do not affect natural width. But they also don't
  636. -- affect the tabs title height, if button title or image are larger than
  637. -- the tabs title height they will be cropped.
  638. require
  639. buttons >= 0
  640. do
  641. iup_open.set_attribute(Current, "EXTRABUTTONS", buttons.out)
  642. end
  643. get_extra_buttons: INTEGER
  644. do
  645. Result := iup_open.get_attribute(Current, "EXTRABUTTONS").to_integer
  646. end
  647. set_title_at_extra_button (title: STRING; button: INTEGER)
  648. -- Text of the respective button.
  649. require
  650. button >= 0
  651. do
  652. iup_open.set_attribute_id(Current, "EXTRATITLE", button, title)
  653. end
  654. get_title_at_extra_button (button: INTEGER): STRING
  655. require
  656. button >= 0
  657. do
  658. Result := iup_open.get_attribute_id(Current, "EXTRATITLE", button)
  659. end
  660. set_extra_button_active (button: INTEGER; state: BOOLEAN)
  661. require
  662. button >= 0
  663. do
  664. iup_open.set_attribute_id(Current, "EXTRAACTIVE", button, boolean_to_yesno(state))
  665. end
  666. is_extra_button_active (button: INTEGER): BOOLEAN
  667. require
  668. button >= 0
  669. local
  670. str: STRING
  671. do
  672. str := iup_open.get_attribute_id(Current, "EXTRAACTIVE", button)
  673. Result := yesno_to_boolean(str)
  674. end
  675. set_extra_button_rgb_fore_color (red, green, blue, button: INTEGER)
  676. -- Text color of the button title. When not defined TABSFORECOLOR is used.
  677. require
  678. button >= 0
  679. do
  680. iup_open.set_attribute_id(Current, "EXTRAFORECOLOR", button, rgb_to_string(red, green, blue))
  681. end
  682. get_extra_button_rgb_fore_color (button: INTEGER): TUPLE[INTEGER, INTEGER, INTEGER]
  683. require
  684. button >= 0
  685. do
  686. Result := iup_open.get_rgb_id(Current, "EXTRAFORECOLOR", button)
  687. end
  688. set_extra_button_rgb_press_color (red, green, blue, button: INTEGER)
  689. -- Background color of the button in pressed state.
  690. -- Default: "150 200 235".
  691. require
  692. button >= 0
  693. do
  694. iup_open.set_attribute_id(Current, "EXTRAPRESSCOLOR", button, rgb_to_string(red, green, blue))
  695. end
  696. get_extra_button_rgb_press_color (button: INTEGER): TUPLE[INTEGER, INTEGER, INTEGER]
  697. require
  698. button >= 0
  699. do
  700. Result := iup_open.get_rgb_id(Current, "EXTRAPRESSCOLOR", button)
  701. end
  702. set_extra_button_rgb_highlight_color (red, green, blue, button: INTEGER)
  703. -- Background color of the button in highlight state.
  704. -- Default: "200 225 245".
  705. require
  706. button >= 0
  707. do
  708. iup_open.set_attribute_id(Current, "EXTRAHIGHCOLOR", button, rgb_to_string(red, green, blue))
  709. end
  710. get_extra_button_rgb_highlight_color (button: INTEGER): TUPLE[INTEGER, INTEGER, INTEGER]
  711. require
  712. button >= 0
  713. do
  714. Result := iup_open.get_rgb_id(Current, "EXTRAHIGHCOLOR", button)
  715. end
  716. set_extra_button_font (font: STRING; button: INTEGER)
  717. -- Text font of the tab. When not defined TABSFONT is used.
  718. require
  719. button >= 0
  720. do
  721. iup_open.set_attribute_id(Current, "EXTRAFONT", button, font)
  722. end
  723. get_extra_button_font (button: INTEGER): STRING
  724. require
  725. button >= 0
  726. do
  727. Result := iup_open.get_attribute_id(Current, "EXTRAFONT", button)
  728. end
  729. set_extra_button_n_image (imagename: STRING; n: INTEGER)
  730. -- Image name to be used in the respective button.
  731. require
  732. n >= 0
  733. do
  734. iup_open.set_attribute_id (Current, "TABIMAGE", n, imagename)
  735. end
  736. get_extra_button_n_image (n: INTEGER): STRING
  737. require
  738. n >= 0
  739. do
  740. Result := iup_open.get_attribute_id(Current, "TABIMAGE", n)
  741. end
  742. set_extra_button_n_image_press (imagename: STRING; n: INTEGER)
  743. -- Image name to be used in the respective button when pressed. If not
  744. -- defined the IMAGE will be used.
  745. require
  746. n >= 0
  747. do
  748. iup_open.set_attribute_id (Current, "TABIMAGEPRESS", n, imagename)
  749. end
  750. get_extra_button_n_image_press (n: INTEGER): STRING
  751. require
  752. n >= 0
  753. do
  754. Result := iup_open.get_attribute_id(Current, "TABIMAGEPRESS", n)
  755. end
  756. set_extra_button_n_image_highlight (imagename: STRING; n: INTEGER)
  757. -- Image name to be used in the respective button when highlighted. If
  758. -- not defined IMAGE will be used.
  759. require
  760. n >= 0
  761. do
  762. iup_open.set_attribute_id (Current, "EXTRAIMAGEHIGHLIGHT", n, imagename)
  763. end
  764. get_extra_button_n_image_highlight (n: INTEGER): STRING
  765. require
  766. n >= 0
  767. do
  768. Result := iup_open.get_attribute_id(Current, "EXTRAIMAGEHIGHLIGHT", n)
  769. end
  770. set_extra_button_n_image_inactive (imagename: STRING; n: INTEGER)
  771. -- Image name to be used in the respective button when highlighted. If
  772. -- not defined IMAGE will be used and its colors will be replaced by a
  773. -- modified version creating the disabled effect.
  774. require
  775. n >= 0
  776. do
  777. iup_open.set_attribute_id (Current, "EXTRAIMAGEINACTIVE", n, imagename)
  778. end
  779. get_extra_button_n_image_inactive (n: INTEGER): STRING
  780. require
  781. n >= 0
  782. do
  783. Result := iup_open.get_attribute_id(Current, "EXTRAIMAGEINACTIVE", n)
  784. end
  785. set_extra_button_n_tip (tip: STRING; n: INTEGER)
  786. -- Tip of the button.
  787. require
  788. n >= 0
  789. do
  790. iup_open.set_attribute_id (Current, "EXTRATIP", n, tip)
  791. end
  792. get_extra_button_n_tip (n: INTEGER): STRING
  793. require
  794. n >= 0
  795. do
  796. Result := iup_open.get_attribute_id(Current, "EXTRATIP", n)
  797. end
  798. -- Expand Button Attributes (non inheritable)
  799. set_extra_expand_button (state: BOOLEAN)
  800. -- Uses the next free extra button to configure an expand button. The
  801. -- button allows to dynamically expand and collapse the tabs contents.
  802. -- When collapsed a click on a tab causes that tab to be temporarily
  803. -- expanded until it looses the focus.
  804. do
  805. iup_open.set_attribute(Current, "EXPANDBUTTON", boolean_to_yesno(state))
  806. end
  807. has_extra_expand_button: BOOLEAN
  808. local
  809. str: STRING
  810. do
  811. str := iup_open.get_attribute(Current, "EXPANDBUTTON")
  812. Result := yesno_to_boolean(str)
  813. end
  814. get_expand_button_position: INTEGER
  815. -- (read-only): position of the expand button in the extra buttons.
  816. do
  817. Result := iup_open.get_attribute(Current, "EXPANDBUTTONPOS").to_integer
  818. end
  819. set_expand_button_state (state: BOOLEAN)
  820. -- Set the expand button state. True: Expanded. False: Collapsed.
  821. -- Default: True.
  822. do
  823. iup_open.set_attribute(Current, "EXPANDBUTTONSTATE", boolean_to_yesno(state))
  824. end
  825. get_expand_button_state: BOOLEAN
  826. local
  827. str: STRING
  828. do
  829. str := iup_open.get_attribute(Current, "EXPANDBUTTONSTATE")
  830. Result := yesno_to_boolean(str)
  831. end
  832. -- Current Tab (non inheritable)
  833. set_value (name: STRING)
  834. -- Changes the current tab by its name. The value passed must be the name
  835. -- of one of the elements contained in the tabs. Use set_widget_name
  836. -- to associate a child to a name.
  837. do
  838. iup_open.set_attribute(Current, "VALUE", name)
  839. end
  840. get_value: STRING
  841. -- Return the name of the visible child.
  842. do
  843. Result := iup_open.get_attribute(Current, "VALUE")
  844. end
  845. set_value_widget (wgt: IUP_WIDGET)
  846. -- Changes the current tab by its widget. The value passed must be the
  847. -- widget of a child contained in the tabs. When the tabs is created, the
  848. -- first element inserted is set as the visible child.
  849. do
  850. iup_open.set_attribute_widget(Current, "VALUE_HANDLE", wgt)
  851. end
  852. get_value_widget: IUP_WIDGET
  853. -- Return the IUP_WIDGET that is visible.
  854. do
  855. Result := iup_open.get_attribute_widget(Current, "VALUE_HANDLE")
  856. end
  857. set_value_position (value: INTEGER)
  858. -- Changes the current tab by its position, starting at 0. When the tabs
  859. -- is created, the first element inserted is set as the visible child. In
  860. -- GTK, inside the callback the returned value is still the previous one.
  861. require
  862. value >= 0
  863. do
  864. iup_open.set_attribute(Current, "VALUEPOS", value.out)
  865. end
  866. get_value_position: INTEGER
  867. -- Return the position of the visible tab.
  868. do
  869. Result := iup_open.get_attribute(Current, "VALUEPOS").to_integer
  870. end
  871. -- Coordination to pos
  872. convert_xy_to_pos (x, y: INTEGER): INTEGER
  873. -- To convert (x,y) coordinates in tab position (same as VALUEPOS).
  874. do
  875. Result := iup_open.iup_convert_xy_to_pos (Current, x, y)
  876. end
  877. -- Callbacks
  878. set_cb_flat_button (act: detachable FUNCTION[TUPLE[IUP_FLAT_TABS, INTEGER, INTEGER, INTEGER, INTEGER, STRING], STRING])
  879. -- Action generated when any mouse button is pressed and when it is
  880. -- released. Both calls occur before the ACTION callback when button 1 is
  881. -- being used.
  882. -- IUP_CANVAS: identifies the element that activated the event.
  883. -- button: identifies the activated mouse button:
  884. --
  885. -- 1 - left mouse button (button 1);
  886. -- 2 - middle mouse button (button 2);
  887. -- 3 - right mouse button (button 3).
  888. --
  889. -- pressed: indicates the state of the button:
  890. --
  891. -- 0 - mouse button was released;
  892. -- 1 - mouse button was pressed.
  893. --
  894. -- x, y: position in the canvas where the event has occurred, in pixels.
  895. --
  896. -- status: status of the mouse buttons and some keyboard keys at the
  897. -- moment the event is generated. The following macros must be used for
  898. -- verification:
  899. --
  900. -- Returns: IUP_CLOSE will be processed. On some controls if IUP_IGNORE
  901. -- is returned the action is ignored (this is system dependent).
  902. local
  903. operation: INTEGER
  904. do
  905. cb_flat_button := act
  906. if cb_flat_button /= Void then
  907. operation := 1
  908. else
  909. operation := 0
  910. end
  911. iup_open.set_callback (Current, "FLAT_BUTTON_CB", "NONEEDED", operation)
  912. end
  913. set_cb_flat_motion (act: detachable FUNCTION[TUPLE[IUP_FLAT_TABS, INTEGER, INTEGER, STRING], STRING])
  914. -- Action generated when the mouse moves.
  915. -- ih: identifier of the element that activated the event.
  916. -- x, y: position in the canvas where the event has occurred, in pixels.
  917. -- status: status of mouse buttons and certain keyboard keys at the
  918. -- moment the event was generated. The same macros used for BUTTON_CB can
  919. -- be used for this status.
  920. local
  921. operation: INTEGER
  922. do
  923. cb_flat_motion := act
  924. if cb_flat_motion /= Void then
  925. operation := 1
  926. else
  927. operation := 0
  928. end
  929. iup_open.set_callback (Current, "FALT_MOTION_CB", "NONEEDED", operation)
  930. end
  931. set_cb_flat_leave_window (act: detachable FUNCTION[TUPLE[IUP_FLAT_TABS], STRING])
  932. -- Action generated when the mouse leaves the native element.
  933. local
  934. operation: INTEGER
  935. do
  936. cb_flat_leavewindow := act
  937. if cb_leavewindow /= Void then
  938. operation := 1
  939. else
  940. operation := 0
  941. end
  942. iup_open.set_callback (Current, "FLAT_LEAVEWINDOW_CB", "NONEEDED", operation)
  943. end
  944. -- Extra
  945. set_cb_tab_change (act: detachable FUNCTION[TUPLE[IUP_FLAT_TABS, IUP_WIDGET, IUP_WIDGET], STRING])
  946. -- Callback called when the user shifts the active tab.
  947. local
  948. operation: INTEGER
  949. do
  950. cb_tabchange := act
  951. if cb_tabchange /= Void then
  952. operation := 1
  953. else
  954. operation := 0
  955. end
  956. iup_open.set_callback (Current, "TABCHANGE_CB", "NONEEDED", operation)
  957. end
  958. set_cb_tab_change_position (act: detachable FUNCTION[TUPLE[IUP_FLAT_TABS, INTEGER, INTEGER], STRING])
  959. -- Callback called when the user shifts the active tab. Called only when
  960. -- TABCHANGE_CB is not defined.
  961. local
  962. operation: INTEGER
  963. do
  964. cb_tabchangepos := act
  965. if cb_tabchangepos /= Void then
  966. operation := 1
  967. else
  968. operation := 0
  969. end
  970. iup_open.set_callback (Current, "TABCHANGEPOS_CB", "NONEEDED", operation)
  971. end
  972. set_cb_tab_close (act: detachable FUNCTION[TUPLE[IUP_FLAT_TABS, INTEGER], STRING])
  973. -- [Windows and GTK Only]: Callback called when the user clicks on the
  974. -- close button. Called only when SHOWCLOSE=Yes.
  975. local
  976. operation: INTEGER
  977. do
  978. cb_tabclose := act
  979. if cb_tabclose /= Void then
  980. operation := 1
  981. else
  982. operation := 0
  983. end
  984. iup_open.set_callback (Current, "TABCLOSE_CB", "NONEEDED", operation)
  985. end
  986. set_cb_right_click (act: detachable FUNCTION[TUPLE[IUP_FLAT_TABS, INTEGER], STRING])
  987. -- Callback called when the user clicks on some tab using the right mouse
  988. -- button.
  989. local
  990. operation: INTEGER
  991. do
  992. cb_rightclick := act
  993. if cb_rightclick /= Void then
  994. operation := 1
  995. else
  996. operation := 0
  997. end
  998. iup_open.set_callback (Current, "RIGHTCLICK_CB", "NONEEDED", operation)
  999. end
  1000. set_cb_extra_button (act: detachable FUNCTION[TUPLE[IUP_FLAT_TABS, INTEGER, INTEGER], STRING])
  1001. -- Action generated when any mouse button is pressed or
  1002. -- released.
  1003. -- ih: identifies the element that activated the event.
  1004. -- button: identifies the extra button. can be 1, 2 or 3. (this is not
  1005. -- the same as BUTTON_CB)
  1006. -- pressed: indicates the state of the button:
  1007. -- 0 - mouse button was released;
  1008. -- 1 - mouse button was pressed.
  1009. local
  1010. operation: INTEGER
  1011. do
  1012. cb_extrabutton := act
  1013. if cb_extrabutton /= Void then
  1014. operation := 1
  1015. else
  1016. operation := 0
  1017. end
  1018. iup_open.set_callback (Current, "EXTRABUTTON_CB", "NONEEDED", operation)
  1019. end
  1020. -- Validations
  1021. is_valid_position (type: STRING): BOOLEAN
  1022. do
  1023. if type.is_equal("TOP") or
  1024. type.is_equal("BOTTOM") or
  1025. type.is_equal("LEFT") or
  1026. type.is_equal("RIGHT") then
  1027. Result := True
  1028. else
  1029. Result := False
  1030. end
  1031. end
  1032. is_valid_tabs_alignment (horizontal, vertical: STRING): BOOLEAN
  1033. local
  1034. h, v: BOOLEAN
  1035. do
  1036. if horizontal.is_equal("ALEFT") or
  1037. horizontal.is_equal("ACENTER") or
  1038. horizontal.is_equal("ARIGHT") then
  1039. h := True
  1040. else
  1041. h := False
  1042. end
  1043. if vertical.is_equal("ATOP") or
  1044. vertical.is_equal("ACENTER") or
  1045. vertical.is_equal("ABOTTOM") then
  1046. v := True
  1047. else
  1048. v := False
  1049. end
  1050. if h and v then
  1051. Result := True
  1052. else
  1053. Result := False
  1054. end
  1055. end
  1056. feature {IUP}
  1057. -- Callbacks
  1058. execute_flat_button (btn, pressed, x, y: INTEGER; status: STRING): STRING
  1059. do
  1060. if attached cb_flat_button as int_cb then
  1061. Result := int_cb.item([Current, btn, pressed, x, y, status])
  1062. else
  1063. Result := "IUP_DEFAULT"
  1064. end
  1065. end
  1066. execute_flat_motion (x, y: INTEGER; status: STRING): STRING
  1067. do
  1068. if attached cb_flat_motion as int_cb then
  1069. Result := int_cb.item([Current, x, y, status])
  1070. else
  1071. Result := "IUP_DEFAULT"
  1072. end
  1073. end
  1074. execute_flat_leavewindow: STRING
  1075. do
  1076. if attached cb_flat_leavewindow as int_cb then
  1077. Result := int_cb.item([Current])
  1078. else
  1079. Result := "IUP_DEFAULT"
  1080. end
  1081. end
  1082. execute_tabchange (new_tab, old_tab: IUP_WIDGET): STRING
  1083. do
  1084. if attached cb_tabchange as int_cb then
  1085. Result := int_cb.item([Current, new_tab, old_tab])
  1086. else
  1087. Result := "IUP_DEFAULT"
  1088. end
  1089. end
  1090. execute_tabchangepos (new_pos, old_pos: INTEGER): STRING
  1091. do
  1092. if attached cb_tabchangepos as int_cb then
  1093. Result := int_cb.item([Current, new_pos, old_pos])
  1094. else
  1095. Result := "IUP_DEFAULT"
  1096. end
  1097. end
  1098. execute_tabclose (pos: INTEGER): STRING
  1099. do
  1100. if attached cb_tabclose as int_cb then
  1101. Result := int_cb.item([Current, pos])
  1102. else
  1103. Result := "IUP_DEFAULT"
  1104. end
  1105. end
  1106. execute_rightclick (pos: INTEGER): STRING
  1107. do
  1108. if attached cb_rightclick as int_cb then
  1109. Result := int_cb.item([Current, pos])
  1110. else
  1111. Result := "IUP_DEFAULT"
  1112. end
  1113. end
  1114. execute_extrabutton (button, pressed: INTEGER): STRING
  1115. do
  1116. if attached cb_extrabutton as int_cb then
  1117. Result := int_cb.item([Current, button, pressed])
  1118. else
  1119. Result := "IUP_DEFAULT"
  1120. end
  1121. end
  1122. feature {NONE}
  1123. -- For Tabs callbacks
  1124. cb_flat_button: detachable FUNCTION[TUPLE[IUP_FLAT_TABS, INTEGER, INTEGER, INTEGER, INTEGER, STRING], STRING]
  1125. cb_flat_motion: detachable FUNCTION[TUPLE[IUP_FLAT_TABS, INTEGER, INTEGER, STRING], STRING]
  1126. cb_flat_leavewindow: detachable FUNCTION[TUPLE[IUP_FLAT_TABS], STRING]
  1127. cb_tabchange: detachable FUNCTION[TUPLE[IUP_FLAT_TABS, IUP_WIDGET, IUP_WIDGET], STRING]
  1128. cb_tabchangepos: detachable FUNCTION[TUPLE[IUP_FLAT_TABS, INTEGER, INTEGER], STRING]
  1129. cb_tabclose: detachable FUNCTION[TUPLE[IUP_FLAT_TABS, INTEGER], STRING]
  1130. cb_rightclick: detachable FUNCTION[TUPLE[IUP_FLAT_TABS, INTEGER], STRING]
  1131. cb_extrabutton: detachable FUNCTION[TUPLE[IUP_FLAT_TABS, INTEGER, INTEGER], STRING]
  1132. -- Internals
  1133. int_flat_tabs_empty (arguments: POINTER): POINTER
  1134. external
  1135. "C inline use %"eiffel-iup.h%""
  1136. alias
  1137. "return IupFlatTabs ($arguments);"
  1138. end
  1139. int_flat_tabs (arguments: POINTER): POINTER
  1140. external
  1141. "C inline use %"eiffel-iup.h%""
  1142. alias
  1143. "return IupFlatTabsv ($arguments);"
  1144. end
  1145. end
  1146. -- The MIT License (MIT)
  1147. -- Copyright (c) 2017, 2019, 2020, 2021, 2022 by German A. Arias
  1148. -- Permission is hereby granted, free of charge, to any person obtaining a copy
  1149. -- of this software and associated documentation files (the "Software"), to deal
  1150. -- in the Software without restriction, including without limitation the rights
  1151. -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  1152. -- copies of the Software, and to permit persons to whom the Software is
  1153. -- furnished to do so, subject to the following conditions:
  1154. --
  1155. -- The above copyright notice and this permission notice shall be included in
  1156. -- all copies or substantial portions of the Software.
  1157. --
  1158. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  1159. -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  1160. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  1161. -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  1162. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  1163. -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  1164. -- SOFTWARE.