IUP/Controls/IupNavmap

From Vendetta Lua
Jump to navigationJump to search


Controls

Dialog
Fill
Hbox
Vbox
Zbox
Cbox
Radio
Button
Canvas
Frame
Label
List
Multiline
Text
Toggle
Progress Bar
Matrix
Tree
Navmap

   navmap{size, expand, scrollbar}

navmap uses 0-based systemids. all systemid inputs/outputs for navmap methods and events will be this way. elsewhere systemids are 1-based

   navmap:loadmap(mode,mappath, page)
mode: 1 or 2; 1 = gridless; 2 = grid mode
mappath: "/lua/maps/(navmap.universemap.lua | system%02dmap.lua)"
page: systemid - 1; sets the page for sector ids. start index (upper left) == 1 + (256 * page)
   navmap:setpath(GetFullPath())
   navmap.currentid = <id>; universe map: values are systemid-1; system map: sectorid range determined by the map page
   navmap.clickedid = <id>; moves the clicked sector.  universe map: values are systemid-1;  system map; range determined by the map page
   navmap.["color"..number]   does not work in mode 1; number is the sectorid.  available sector ids are determined by the current page;  changing the page resets all colors;  changing back to a previous page does not show previous colors


if no mappoint is selected,

tab will navigate in tab order to other controls


   function navmap:k_any(c)
key presses repeat so long as the key is held down
ctrl does not repeat, but the combination does.
no character code for combinations. in a ctrl combo, ctrl only triggers once and the other key triggers repeatedly
arrows trigger mouseover_cb, not k_any.
enter triggers click_cb
space triggers click_cb

keys

ctrl triggers, but does not repeat
shift does not trigger
alt triggers; can't combine with a mouse click on linux

end

   navmap:click_cb(index, flags)
only triggers when clicking on a mappoint, on mouseup
pressing enter does not set a flag
pressing space does not set a flag
in mode 2, if the long-press timeout is met, the callback finishes, not waiting for the button release.
   flags "SC1            L "
       1: S (shift)
       2: C (ctrl)
       3: 1 (left mouse click)
       16: L (long-press 1 second(?))


use string.byte() to test for a specific flag
   function navmap:getfocus_cb()
triggers:
when opening the navmap's dialog
when pressing escape if the last action was a click
After this callback has triggered, all keyboard presses will trigger :k_any()

end

   function navmap:mouseover_cb(index, str)
triggers when
mousing over a map point. nothing happens when moving the mouse over anything else
pressing arrow keys after a mappoint has been selected; order of system traversal on the universe map is in systemid order
pressing tab when a mappoint has been clicked on; triggers the mouseover for the active mappoint

end