splitter: make rebface [ tip: { USAGE: area splitter area DESCRIPTION: Placed between two widgets on the same row or column. Allows both to be resized by dragging the splitter left/right or up/down respectively. Its size determines whether it is vertical or horizontal. } size: 1x25 color: colors/outline-light feel: make default-feel [ redraw: make function! [face act pos /local f p n] [ unless face/data [ f: find face/parent-face/pane face p: back f n: next f if face/size/y <= face/size/x [ while [face/offset/x <> p/1/offset/x] [ if head? p [gui-error "Splitter failed to find previous widget"] p: back p ] while [face/offset/x <> n/1/offset/x] [ if tail? p [gui-error "Splitter failed to find next widget"] n: next n ] ] face/data: reduce [first p first n] ] ] over: make function! [face act pos] [ face/color: either act [colors/state-dark] [colors/outline-light] show face ] engage: make function! [face act event /local p n delta] [ if event/type = 'move [ p: first face/data n: second face/data either face/size/y > face/size/x [ delta: face/offset/x - face/offset/x: min n/offset/x + n/size/x - face/size/x - 1 max p/offset/x + 1 face/offset/x + event/offset/x p/size/x: p/size/x - delta n/size/x: n/size/x + delta n/offset/x: n/offset/x - delta ][ delta: face/offset/y - face/offset/y: min n/offset/y + n/size/y - face/size/y - 1 max p/offset/y + 1 face/offset/y + event/offset/y p/size/y: p/size/y - delta n/size/y: n/size/y + delta n/offset/y: n/offset/y - delta ] show [p face n] ] ; reset color if splitter is dragged out of bounds all [act = 'away face/feel/over face false 0x0] ] ] rebind: make function! [] [color: colors/outline-light] ]