#|
|# ;;-------------------------------------------------------------------------- ;; ;; Control Binding Example ;; (in-package :examples) (use-package :oli) (defun control-binding-example () (let ((dialog-rg "CONTROL-BINDING-EXAMPLE-RG")) (sd-create-resizable-dialog-shell "CONTROL-BINDING-EXAMPLE" :title "Control Binding Example" :width 300 :height 300 :spacing 0 :cellSize 10,11) (sd-create-pushbutton-control "LEFT-PB" dialog-rg :x 0 :y 12 :width 7 :height 2 :title ":left") (sd-set-control-binding "LEFT-PB" '(:left)) (sd-create-pushbutton-control "RIGHT-PB" dialog-rg :x 22 :y 12 :width 7 :height 2 :title ":right") (sd-set-control-binding "RIGHT-PB" '(:right)) (sd-create-pushbutton-control "TOP-PB" dialog-rg :x 11 :y 0 :width 7 :height 2 :title ":top") (sd-set-control-binding "TOP-PB" '(:top)) (sd-create-pushbutton-control "BOTTOM-PB" dialog-rg :x 11 :y 25 :width 7 :height 2 :title ":bottom") (sd-set-control-binding "BOTTOM-PB" '(:bottom)) (sd-create-pushbutton-control "RELATIVE-HORZ-PB" dialog-rg :x 9 :y 13 :width 11 :height 2 :title ":relative-horizontal") (sd-set-control-binding "RELATIVE-HORZ-PB" '(:relative-horizontal)) (sd-create-pushbutton-control "RELATIVE-VERT-PB" dialog-rg :x 9 :y 11 :width 11 :height 2 :title ":relative-vertical") (sd-set-control-binding "RELATIVE-VERT-PB" '(:relative-vertical)) (sd-create-pushbutton-control "RESIZE-BOTH-PB" dialog-rg :x 9 :y 5 :width 11 :height 2 :title ":resize-both") (sd-set-control-binding "RESIZE-BOTH-PB" '(:resize-both)) (sd-create-pushbutton-control "RESIZE-HORZ-PB" dialog-rg :x 9 :y 18 :width 11 :height 2 :title ":resize-horizontal") (sd-set-control-binding "RESIZE-HORZ-PB" '(:resize-horizontal)) (sd-create-pushbutton-control "RESIZE-VERT-PB" dialog-rg :x 9 :y 20 :width 11 :height 2 :title ":resize-vertical") (sd-set-control-binding "RESIZE-VERT-PB" '(:resize-vertical)) (sd-show-dialog-shell "CONTROL-BINDING-EXAMPLE"))) ;;-------------------------------------------------------------------------- ;; ;; Scrolled Grid Area and Control Binding Example ;; (defun scrolled-grid-area-control-binding-example () (let ((dialog-rg "SCROLLED-GRID-AREA-CONTROL-BINDING-EXAMPLE-RG")) (sd-create-resizable-dialog-shell "SCROLLED-GRID-AREA-CONTROL-BINDING-EXAMPLE" :title "Scrolled Grid Area & Ctrl Binding" :margin 5 :spacing 1 :width 300 :height 260 :cellSize 10,10) (sd-create-grid-area "TOP-AREA" dialog-rg :frame t :x 0 :y 0 :width 29 :height 5 :cellSize 1,1 :margin 0 :spacing 0) (sd-set-control-binding "TOP-AREA" '(:resize-horizontal)) (sd-create-pushbutton-control "PUSH-3" "TOP-AREA" :x 85 :y 10 :width 100 :height 20 :title "Push 3") (sd-create-scrolled-grid-area "SCROLLED-AREA" dialog-rg :x 0 :y 6 :width 29 :height 15 :gridWidth 40 :gridHeight 40 :cellSize 10,10 :margin 5 :spacing 1) (sd-set-control-binding "SCROLLED-AREA-SA" '(:resize-both)) (sd-create-pushbutton-control "PUSH-1" "SCROLLED-AREA" :x 0 :y 0 :width 10 :height 2 :title "Push 1") (sd-create-pushbutton-control "PUSH-2" "SCROLLED-AREA" :x 25 :y 25 :width 10 :height 2 :title "Push 2") (sd-create-pushbutton-control "PUSH-4" dialog-rg :x 22 :y 23 :width 7 :height 2 :title "+" :pushAction '(sd-set-scrolled-grid-area-geometry "SCROLLED-AREA" :gridWidth 80 :gridHeight 80)) (sd-set-control-binding "PUSH-4" '(:right :bottom)) (sd-create-pushbutton-control "PUSH-5" dialog-rg :x 14 :y 23 :width 7 :height 2 :title "-" :pushAction '(sd-set-scrolled-grid-area-geometry "SCROLLED-AREA" :gridWidth 40 :gridHeight 40)) (sd-set-control-binding "PUSH-5" '(:right :bottom)) (sd-show-dialog-shell "SCROLLED-GRID-AREA-CONTROL-BINDING-EXAMPLE"))) ;;-------------------------------------------------------------------------- ;; ;; Splitter Control Example ;; (defun splitter-control-example () (let ( (dialog-rg "SPLITTER-CONTROL-EXAMPLE-RG") (splitter "SPLITTER-CONTROL-SP") (push1 "PUSH1-PB") (push2 "PUSH2-PB") (geo-rg)) (sd-create-resizable-dialog-shell "SPLITTER-CONTROL-EXAMPLE" :title "Splitter Control Example" :width 400 :height 300 :spacing 2 :margin 2 :cellSize 1,1) (setq geo-rg (oli:sd-get-control-geometry dialog-rg)) (sd-create-splitter-control splitter dialog-rg :horizontal t :margin 0 :x 0 :y 0 :width (getf geo-rg :width) :height (getf geo-rg :height) :cellSize 1,1 :spacing 0) (sd-set-control-binding splitter '(:resize-both)) (sd-create-pushbutton-control push1 (format nil "~A-LEFT-PANE-RG" splitter) :x 10 :y 20 :width 70 :height 20 :title "Left Pane") (sd-set-control-binding push1 '(:resize-both)) (sd-create-pushbutton-control push2 (format nil "~A-RIGHT-PANE-RG" splitter) :x 10 :y 20 :width 70 :height 20 :title "Right Pane") (sd-set-control-binding push2 '(:relative-vertical :relative-horizontal)) (sd-show-dialog-shell "SPLITTER-CONTROL-EXAMPLE"))) ;;-------------------------------------------------------------------------- ;; ;; Viewport control example ;; (defun viewport-control-example () (let ( (dialog-rg "VIEWPORT-CONTROL-EXAMPLE-RG") (splitter "VIEWPORT-CONTROL-SP") (push1 "VIEWPORT-PUSH1-PB") (vp "VIEWPORT-CONTROL-VP") (geo-rg)) (sd-create-resizable-dialog-shell "VIEWPORT-CONTROL-EXAMPLE" :title "Viewport Control & Splitter" :width 400 :height 300 :spacing 2 :margin 2 :cellSize 1,1) (setq geo-rg (oli:sd-get-control-geometry dialog-rg)) (sd-create-splitter-control splitter dialog-rg :horizontal t :margin 0 :x 0 :y 0 :width (getf geo-rg :width) :height (getf geo-rg :height) :cellSize 1,1 :spacing 0) (sd-set-control-binding splitter '(:resize-both)) (sd-create-pushbutton-control push1 (format nil "~A-LEFT-PANE-RG" splitter) :x 10 :y 20 :width 70 :height 20 :title "Left Pane") (sd-set-control-binding push1 '(:resize-both)) (setq geo-rg (oli:sd-get-control-geometry (format nil "~A-RIGHT-PANE-RG" splitter))) (sd-create-viewport-control vp (format nil "~A-RIGHT-PANE-RG" splitter) :x 0 :y 0 :width (getf geo-rg :width) :height (getf geo-rg :height)) (sd-show-dialog-shell "VIEWPORT-CONTROL-EXAMPLE"))) ;;-------------------------------------------------------------------------- ;; ;; Create UI ;; (control-binding-example) (scrolled-grid-area-control-binding-example) (splitter-control-example) (viewport-control-example) #||#