REBOL [ Title: "TOOLBAR Demo" Author: ["Henrik Mikael Kristensen"] Copyright: "2006 - HMK Design" Filename: %toolbar-demo.r Version: 0.0.3 Created: 02-May-2006 Date: 12-Jul-2006 License: { BSD (www.opensource.org/licenses/bsd-license.php) Use at your own risk. } Purpose: { Demonstration of the TOOLBAR widget for VID } History: [] ] ;path: %./ path: http://www.hmkdesign.dk/rebol/toolbar/ open.png: load join path %Open.png network.png: load join path %Network.png info.png: load join path %Info.png remove.png: load join path %Remove.png do join path %toolbar.r view/options/new center-face main: layout [ origin 0 tb: toolbar 700 with [ data: [ network divider open disabled open spacer remove remove disabled divider face divider info spacer more ] data-store: [ network [image network.png "Network Information" []] open [image open.png "Open" []] remove [image remove.png "Remove" [print now]] face [face "Search" [field 100]] info [image help.gif "Information" []] more [image info.png "More" []] ] ] gui: panel [ space 2 across b: box 500x40 font [color: black style: none size: 12 shadow: none] "Toolbar VID face. Try resizing the window. Edit the BUTTONS dialect for the toolbar and press 'Refresh Toolbar'." return h3 "Data Store (Possible toolbar elements)" 400 h3 "Data (Shown elements)" 200 h3 "Appearance" 200 return ed-rep: area 400x300 ed: area 200x300 panel 200x300 [ across space 2 txt 100 right "Padding" f-padding: field 50 [ tb/padding: to-integer get-face face do-face b-tb-refresh none ] return txt 100 right "Frame Padding" f-frame-padding: field 50 [ tb/frame-padding: to-integer get-face face do-face b-tb-refresh none ] return txt 100 right "Spacing" f-spacing: field 50 [ tb/spacing: to-integer get-face face do-face b-tb-refresh none ] return ; txt 75 right "Edge Size" f-edge-size: field 50 [ ; tb/icon-frame-edge/size: get-face face ; do-face b-tb-refresh none ; ] btn 150 "Disable Network Information" [ tb/disable 'network ] return btn 150 "Enable Network Information" [ tb/enable 'network ] return tog 150 "Enable SWITCH?" [ tb/switch?: get-face face tb/update ] ] return b-tb-refresh: btn "Refresh Toolbar" [ tb/data: load ed/text tb/data-store: load ed-rep/text tb/update main-resize ] tog "Toolbar Text" true [tb/text?: value tb/update main-resize] tog "Toolbar Icons" true [tb/icons?: value tb/update main-resize] ] ] 'resize main-resize: does [ b/size/x: gui/size/x: tb/size/x: main/size/x gui/offset/y: tb/size/y tb/update show main ] main-event-func: func [face event] [ if event/type = 'resize [main-resize] if event/type = 'close [remove-event-func :main-event-func] event ] ed/text: mold tb/data ed-rep/text: mold tb/data-store set-face f-padding tb/padding set-face f-frame-padding tb/frame-padding set-face f-spacing tb/spacing insert-event-func :main-event-func main-resize do-events