ORIGIN '~beta/guienv/guienv'; INCLUDE '~beta/guienv/fields'; BODY 'private/treeviewbody'; --- windowlib: attributes --- treeview: canvas (# <<SLOT treeviewLib: attributes>>; selection: ^item; item: (* abstract superpattern for elements in the tree *) (# <<SLOT treeviewItemLib: attributes>>; isFolder:< booleanValue; father: ^folder (* the folder in which this(item) is * located - this attribute is only valid, * if this(item) is added to the folder * using addItem *); icon:< (* the icon to show for this type of item *) (# i: ^guienv.pixmap enter i[] ... #); label: ^text (* the text of this item *); popupmenu:< (* popup menu on this item *) (# m: ^guienv.menu enter m[] ... exit m[] #); scrollIntoView: (# sc: ^scroller enter sc[] ... #); select: (# ... #); deselect: (# ... #); onIconSelected:< (* invoked when item icon is selected *) (# ev: ^eventhandler.mouseevent enter ev[] ... #); onSelected:< (* invoked when item is selected *) (# ev: ^eventhandler.mouseevent enter ev[] ... #); onLabelChanged:< (* invoked the label have been edited. newLabel will * contain the edited label value. *) (# newLabel: ^text enter newLabel[] ... #); allowLabelEdit:< booleanValue; itemPrivate: @...; #); folder: item (# <<SLOT treeviewFolderLib: attributes>>; isFolder:: trueObject; items: @list(# element:: item #); addItem: (# i: ^item enter i[] do this(folder)[]->i.father[]; i[]->items.append; INNER #); prependItem: (# i: ^item enter i[] do this(folder)[]->i.father[]; i[]->items.prepend; INNER #); Icon::<(* the icon to show for this folder when open *) (# openicon: ^guienv.pixmap enter openicon[] ... #); onToggleSelected:< (* invoked when toggle icon is selected *) (# ... #); onIconSelected::<(# ... #); onSelected::< (# ... #); onExpand:< (* invoked when folder is opened *) (# ... #); onCollapse:< (* invoked when folder is closed again *) (# ... #); isExpanded:< (# open:@boolean ... exit open #); folderPrivate: @...; #); root: (# f: ^folder enter (# enter f[] ... #) exit (# ... exit f[] #) #); hideRoot:< (* if trueObject then root is not shown *) booleanValue; minSize:< (* Specifies the minimum size of this(treeView) *) (# width, height: @integer; do INNER; exit (width, height) #); changed: (# ... #); eventHandler::< (# onRefresh::< (# ... #); onMouseDown::< (# ... #); onMouseUp::< (# ... #); onUpdate:< (* further bind onUpdate and change etc. newheight, * to change the size of this treeview *) (# width,height:@integer; newwidth,newheight:@integer; updateDoneInInner:@boolean; enter (width,height) do width->newwidth; height->newheight; INNER; (if not updateDoneInInner then (if (newwidth<>width) or (newheight<>height) then (newwidth,newheight)->size else true->update; if); if) #) #); open::< (# ... #); treeviewPrivate: @...; #)
21.32 Treeview Interface | © 1994-2004 Mjølner Informatics |
[Modified: Monday January 8th 2001 at 12:43]
|