Browse code
feat(capi-utils): init
Ed Langley authored on 01/09/2020 21:19:24
Showing 1 changed files
Showing 1 changed files
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,35 @@ |
1 |
+(defpackage :fwoar.capi-utils |
|
2 |
+ (:use :cl)) |
|
3 |
+(in-package :fwoar.capi-utils) |
|
4 |
+ |
|
5 |
+(defun history-pane (navigate) |
|
6 |
+ (make-instance 'capi:list-panel |
|
7 |
+ :items '() |
|
8 |
+ :selection-callback navigate |
|
9 |
+ :callback-type :data |
|
10 |
+ :external-max-width '(:character 30))) |
|
11 |
+ |
|
12 |
+(defun open-url (url) |
|
13 |
+ (let* ((history (history-pane (lambda (it) (format *xxx* "~&>> ~s" it)))) |
|
14 |
+ (browser (make-instance 'capi:browser-pane |
|
15 |
+ :url url |
|
16 |
+ :document-complete-callback (lambda (pane url title) |
|
17 |
+ (declare (ignore pane)) |
|
18 |
+ (let ((new-item (make-instance 'capi:item |
|
19 |
+ :collection history |
|
20 |
+ :text title |
|
21 |
+ :data url))) |
|
22 |
+ (capi:apply-in-pane-process-if-alive history |
|
23 |
+ 'capi:append-items |
|
24 |
+ history (list new-item)) |
|
25 |
+ (capi:apply-in-pane-process-if-alive history |
|
26 |
+ #'(setf capi:choice-selected-item) |
|
27 |
+ new-item history)) |
|
28 |
+ |
|
29 |
+ (values))))) |
|
30 |
+ (capi:contain (make-instance 'capi:row-layout |
|
31 |
+ :description (list history |
|
32 |
+ browser)) |
|
33 |
+ :title "Management Console" |
|
34 |
+ :best-width 1280 |
|
35 |
+ :best-height 800))) |