-
Notifications
You must be signed in to change notification settings - Fork 6
/
layout.lisp
131 lines (102 loc) · 3.64 KB
/
layout.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
;; -*- mode: Lisp; Syntax: Common-Lisp; Package: qooxlisp; -*-
#|
layout -- qooxdoo layout
(See package.lisp for license and copyright notigification)
|#
(in-package :qxl)
(defmd qx-layout-item (qx-object) ;; better name: qx-laid-out-item
(visibility "visible")
add
height min-height max-height
width min-width max-width
margin margin-left margin-top margin-right margin-bottom
padding padding-left padding-top padding-right padding-bottom
align-x align-y
allow-grow-x
allow-grow-y
allow-shrink-x allow-shrink-y
allow-stretch-x allow-stretch-y)
(export! height ^height ^min-height min-height ^max-height max-height visibility ^visibility
^min-height min-height ^max-height max-height)
(export! width ^width ^min-width min-width ^max-width max-width
^min-width min-width ^max-width max-width)
(defobserver min-height ()
(when old-value-boundp
(with-integrity (:client `(:post-make-qx ,self))
(qxfmt "clDict[~a].setMinHeight(~a);" (oid self) new-value))))
(defobserver max-height ()
(when old-value-boundp
(with-integrity (:client `(:post-make-qx ,self))
(qxfmt "clDict[~a].setMaxHeight(~a);" (oid self) new-value))))
(defun visible (self)
(assert self () "visi self")
(equal (visibility self) "visible"))
(defmacro ^visible ()
`(visible self))
(defun hidden (self)
(assert self () "hid self")
(equal (visibility self) "hidden"))
(defun collapsed (self)
(assert self () "collaps self")
(equal (visibility self) "excluded"))
(defun vis/not (b)
(if b "visible" "hidden"))
(defmacro vis/collapsed (b)
`(if ,b "visible" "excluded"))
(export! visible ^visible collapsed hidden vis/not vis/collapsed)
(defmethod qx-configurations append ((self qx-layout-item))
(nconc
(cfg visibility)
(cfg height)(cfg min-height)(cfg max-height)
(cfg width)(cfg min-width)(cfg max-width)
(cfg margin)(cfg margin-left)(cfg margin-top)(cfg margin-right)(cfg margin-bottom)
(cfg padding)(cfg padding-left)(cfg padding-top)(cfg padding-right)(cfg padding-bottom)
(cfg align-x)
(cfg align-y)
(cfg allow-grow-y)
(cfg allow-grow-x)
(cfg allow-shrink-y)
(cfg allow-shrink-y)))
(defmd qx-layout (qx-object))
(defmd qx-layout-abstract (qx-layout))
(defmd qx-grid (qx-layout-abstract)
(qx-class "qx.ui.layout.Grid" :allocation :class :cell nil)
spacing-x spacing-y)
(defmethod qx-configurations append ((self qx-grid))
(nconc
(cfg spacing-x)(cfg spacing-y)))
(defmd qx-hv-box (qx-layout-abstract)
; anstract class on lisp side only
align-x align-y reversed separator spacing)
(defmethod qx-configurations append ((self qx-hv-box))
(nconc
(cfg align-x)(cfg align-y)(cfg reversed)(cfg separator)(cfg spacing)))
(defmd qx-hbox (qx-hv-box)
(qx-class "qx.ui.layout.HBox" :allocation :class :cell nil))
(defmd qx-vbox (qx-hv-box)
(qx-class "qx.ui.layout.VBox" :allocation :class :cell nil))
(export! qx-flow)
(defmd qx-flow (qx-layout-abstract)
(qx-class "qx.ui.layout.Flow" :allocation :class :cell nil)
spacing-x spacing-y align-x align-y reversed)
(defmethod qx-configurations append ((self qx-flow))
(nconc
(cfg align-x)(cfg align-y)
(cfg reversed)
(cfg spacing-x)(cfg spacing-y)))
;;; var scroller = new qx.ui.container.Scroll();
;;; win.add(scroller);
;;;
;;; var container = new qx.ui.container.Composite(new qx.ui.layout.Flow()).set({
;;; allowShrinkY: false
;;; });
;;; scroller.add(container);
;;;
;;; for (var i=0; i<30; i++)
;;; {
;;; container.add(new qx.ui.basic.Atom("item #" + (i+1), "icon/48/devices/computer.png").set({
;;; iconPosition: "top",
;;; width: 60,
;;; padding: 5
;;; }));
;;; }