Skip to content

Instantly share code, notes, and snippets.

@sapier
Last active December 19, 2015 22:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sapier/6030971 to your computer and use it in GitHub Desktop.
Save sapier/6030971 to your computer and use it in GitHub Desktop.
Formspec Treeview proposal
treeview[<X>,<Y>;<W>,<H>;<name>;<transparent>;<selected>;<treedepth 1>:<iconimage 1>:<text 1>:<expanded 1>,<treedepth 2>:<iconimage 2>:<text 2>:<expanded 2> ... <treedepth n>:<iconimage n>:<text n>:<expanded n>]
^ x and y position the treeview relative to the top left of the menu
^ w and h are the size of the treeview
^ name fieldname sent to server on click value is element causing the event
: (or some other char) needs to be introduced as new separator and has to be escaped at least within treeview
For <treedepth>:<iconimage>:<text> following rules apply:
1) treedepth has to start with 1 for first element
2) treedepth may not be negative
3) treedepth may not increase more than 1 from x to x+1
4) treedepth may be reduced by any number for consecutive entry as long as it's >= 0
^ iconimage full path /texture name to show as icon
^ text to show for treeview element
-------------------------------------------------------------------------------------------------------
following new events (same style as for textlist) shall be added
EXP:<index> -->expand
COL:<index> -->collapse
SEL:<index> -->select
DSE:<index> -->deselect
index is plain number as elements are defined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment