# Generic panel support Wpanel: module { PATH: con "/dis/o/wpanel.dis"; Qatom, Qrow, Qcol: con iota; # for Panel.rowcol Phide, # panel not shown Playout, # layout container. reclaims space Pedit, # kbd/mouse editing allowed Ptag, # show the tag, accept mouse commands for tag Pmore, # has hidden children (containers only) Pdirties, # has dirty children (containers only) Pdirty, # unsaved changes (for text panels, or atoms) Pline, # at most one line (for text panels) Ptbl, # tabulate content (for text panels) Psync, # saves to fs pending, must sync. Predraw, # must redraw Pdead, # it's gone Pbusy, # panel being update or doing another op. Pshown, # panel shown in screen (used for redrawing tags) Pmax: con int (1<Qid; dqid: Sys->Qid; cqid: Sys->Qid; space: int; rect: Draw->Rect; orect: Draw->Rect; size: Draw->Point; wants: Draw->Point; minsz: Draw->Point; maxsz: Draw->Point; font: ref Draw->Font; # only used by text panels # but kept here for the future impl: Pimpl; implid: int; ctls: string; # to keep ctl contents while doing i/o with fs. new: fn(n: string, fp: ref Panel): ref Panel; fsctl: fn(p: self ref Panel, s: string, async: int); text: fn(p: self ref Panel): string; # functions delegated to the panel implementor # Called from the tree coordinator: init: fn(p: self ref Panel); term: fn(p: self ref Panel); ctl: fn(p: self ref Panel, s: string); update: fn(p: self ref Panel, d: array of byte); draw: fn(p: self ref Panel); sync: fn(p: self ref Panel); # Called from other procs: event: fn(p: self ref Panel, s: string); # ins, del mouse: fn(p: self ref Panel, m: ref Gui->Cpointer, cm: chan of ref Gui->Cpointer); kbd: fn(p: self ref Panel, r: int); }; intag: fn(p: ref Panel, xy: Draw->Point): int; escape: fn(s: string): string; unescape: fn(s: string): string; nth: fn(l: list of string, n: int): string; init: fn(d: Livedat, dir: string); }; Pimpl: module { prefixes: list of string; pinit: fn(p: ref Wpanel->Panel); pterm: fn(p: ref Wpanel->Panel); pctl: fn(p: ref Wpanel->Panel, s: string); pupdate: fn(p: ref Wpanel->Panel, d: array of byte); pevent: fn(p: ref Wpanel->Panel, s: string); # ins, del pdraw: fn(p: ref Wpanel->Panel); pmouse: fn(p: ref Wpanel->Panel, m: ref Gui->Cpointer, cm: chan of ref Gui->Cpointer); pkbd: fn(p: ref Wpanel->Panel, r: int); psync: fn(p: ref Wpanel->Panel); init: fn(d: Livedat) : string; };