Debian Codegraph @

contrib/xview/demo/itemexample.l

raw
1 (defun a nil
2 (setq *a* (instance button-example :init)))
3 (defun b nil
4 (setq *b* (instance choice-example :init)))
5 (defun c nil
6 (setq *c* (instance slider-example :init)))
7 (defun d nil
8 (setq *d* (instance toggle-example :init)))
9 (defun e nil
10 (setq *e* (instance item-example :init)))
11 (defun f nil
12 (setq *f* (instance menu-example :init)))
13 (defun test nil
14 (setq a (instance sunview-frame :init nil
15 :title "abc"
16 ))
17 )
18 (defun test nil
19 (setq a (instance sunview-frame :init nil
20 :title "abc"
21 ))
22 (setq b (send a :create-subwindow sunview-panel
23 :title "abc"
24 ))
25 )
26 (defun test1 nil
27 (setq B1 (send b :create-button :print-event :title "print args"))
28 )
29 (defclass button-example
30 :super sunview-frame
31 :slots (P B1 B2 B3))
32 (defmethod button-example
33 (:print-event
34 (item event)
35 (format t "item=~s,event=~s~%" item event))
36 (:init
37 ()
38 #+sunview
39 (send-super :init nil :title "Button example" :x 800 :y 400
40 :icon "/usr/include/images/hello_world.icon")
41 #+xview
42 (send-super :init nil :title "Button example" :x 800 :y 400
43 :icon "/usr/local/include/X11/images/hello_world.icon")
44 #+sunview
45 (setq P (send self :create-subwindow sunview-panel
46 :font "/usr/lib/fonts/fixedwidthfonts/screen.b.12"))
47 #+xview
48 (setq P (send self :create-subwindow sunview-panel
49 ;;; :font "lucidasans-bold-12"
50 ))
51 (setq B1 (send self :create-button :print-event :title "print args"))
52 (setq B2 (instance panel-button-item :init P
53 :nproc :print-event :title "print args"))
54 (setq B3 (instance panel-button-item :init P :title "print args"
55 :nproc
56 '(lambda (item event)
57 (format t "item=~s,event=~s~%" item event))))
58 (send self :show t)
59 self)
60 )
61
62 (defclass choice-example
63 :super sunview-frame
64 :slots (P C1 C2 C3))
65 (defmethod choice-example
66 (:print-event
67 (value item event)
68 (format t "value=~s,item=~s,event=~s~%" value item event))
69 (:init
70 ()
71 #+sunview
72 (send-super :init nil :title "Choice example" :x 800 :y 400
73 :icon "/usr/include/images/hello_world.icon")
74 #+xview
75 (send-super :init nil :title "Choice example" :x 800 :y 400
76 :icon "/usr/local/include/X11/images/hello_world.icon")
77 #+sunview
78 (setq P (send self :create-subwindow sunview-panel
79 :font "/usr/lib/fonts/fixedwidthfonts/screen.b.12"))
80 #+xview
81 (setq P (send self :create-subwindow sunview-panel
82 ))
83 (setq C1 (send self :create-choice :print-event
84 :choices '(a b c) :title "print args"))
85 (setq C2 (instance panel-choice-item :init P
86 :choices '(a b c)
87 :nproc :print-event :title "print args"))
88 (setq C3 (instance panel-choice-item :init P :title "print args"
89 :choices '(a b c)
90 :nproc
91 '(lambda (value item event)
92 (format t "value=~s,item=~s,event=~s~%"
93 value item event))))
94 (send self :show)
95 self)
96 )
97
98 (defclass slider-example
99 :super sunview-frame
100 :slots (P S1 S2 S3))
101 (defmethod slider-example
102 (:print-event
103 (value item event)
104 (format t "value=~s,item=~s,event=~s~%" value item event))
105 (:init
106 ()
107 #+sunview
108 (send-super :init nil :title "Slider example" :x 800 :y 400
109 :icon "/usr/include/images/hello_world.icon")
110 #+xview
111 (send-super :init nil :title "Slider example" :x 800 :y 400
112 :icon "/usr/local/include/X11/images/hello_world.icon")
113 #+sunview
114 (setq P (send self :create-subwindow sunview-panel
115 :font "/usr/lib/fonts/fixedwidthfonts/screen.b.12"))
116 #+xview
117 (setq P (send self :create-subwindow sunview-panel
118 :font "lucidasans-bold-12"
119 ))
120 (setq S1 (send self :create-slider :print-event
121 :min -10 :max 20 :title "print args"
122 :value 7 :length 80))
123 (setq S2 (instance panel-slider-item :init P
124 :nproc :print-event :title "print args"))
125 (setq S3 (instance panel-slider-item :init P :title "print args"
126 :min -10.6 :max 20.6 :value 7 :length 80
127 :vertical t
128 :nproc
129 '(lambda (value item event)
130 (format t "value=~s,item=~s,event=~s~%"
131 value item event))))
132 (send self :show)
133 self)
134 )
135
136 (defclass toggle-example
137 :super sunview-frame
138 :slots (P T1 T2 T3))
139 (defmethod toggle-example
140 (:print-event
141 (value item event)
142 (format t "value=~s,item=~s,event=~s~%" value item event))
143 (:init
144 ()
145 #+sunview
146 (send-super :init nil :title "Toggle example" :x 800 :y 400
147 :icon "/usr/include/images/hello_world.icon")
148 #+xview
149 (send-super :init nil :title "Toggle example" :x 800 :y 400
150 :icon "/usr/local/include/X11/images/hello_world.icon")
151 #+sunview
152 (setq P (send self :create-subwindow sunview-panel
153 :font "/usr/lib/fonts/fixedwidthfonts/screen.b.12"))
154 #+xview
155 (setq P (send self :create-subwindow sunview-panel
156 :font "lucidasans-bold-12"))
157 (setq T1 (send self :create-toggle :print-event
158 :choices '(a b c) :value '(c)
159 :title "print args"))
160 (setq T2 (instance panel-toggle-item :init P
161 :choices '(a b c) :value '(a c)
162 :nproc :print-event :title "print args"))
163 (setq T3 (instance panel-toggle-item :init P :title "print args"
164 :choices '(a b c) :value t
165 :nproc
166 '(lambda (value item event)
167 (format t "value=~s,item=~s,event=~s~%"
168 value item event))))
169 (send self :show)
170 self)
171 )
172
173
174 (defclass menu-example
175 :super sunview-frame
176 :slots (I))
177 (defmethod menu-example
178 (:print-event
179 (item event)
180 (format t "item=~s,event=~s~%" item event))
181 (:init
182 ()
183 (send-super :init nil :title "Button example" :x 800 :y 400
184 :icon
185 #+sunview
186 "/usr/include/images/hello_world.icon"
187 #+xview
188 "/usr/local/include/X11/images/hello_world.icon")
189 (setq P (send self :create-subwindow sunview-panel
190 :font
191 #+sunview "/usr/lib/fonts/fixedwidthfonts/screen.b.12"
192 #+xview "lucidasans-bold-12"
193 ))
194 (setq I (instance panel-text-item :init P
195 :value "Initial text"
196 :menu
197 (instance sunview-menu :init
198 :strings '(0 1 2 3))
199 :title "Text:" :length 30
200 :nproc
201 '(lambda (value item event)
202 (format t "value=~s,item=~s,event=~s~%"
203 value item event))
204 :eproc
205 '(lambda (item event)
206 (cond
207 ((and (equal (event_id event) ms_right)
208 (event_is_down event))
209 (menu_show item (P . system-cadr) event)
210 (format t "item=~s,event=~s~%"
211 item event))
212 (t
213 (panel_default_handle_event item event)))
214 )))
215 (send self :show)
216 self))
217
218
219 (defclass item-example
220 :super sunview-frame
221 :slots (I))
222 (defmethod item-example
223 (:print-event
224 (item movement button pos time)
225 (format t "item=~s,movement=~s,button=~s,pos=~s,time=~s~%"
226 item movement button pos time))
227 (:notify-text-proc (value item event)
228 (format t "value=~s,item=~s,event=~s~%"
229 value item event))
230 (:notify-button-proc (item event)
231 (format t "item=~s,event=~s~%" item event))
232 (:menu-handler (value)
233 (format t "value=~s~%" value))
234 (:init
235 ()
236 (send-super :init nil :title "Button example" :x 800 :y 400
237 :icon
238 #+sunview
239 "/usr/include/images/hello_world.icon"
240 #+xview
241 "/usr/local/include/X11/images/hello_world.icon")
242 (setq P (send self :create-subwindow sunview-panel
243 :font
244 #+sunview
245 "/usr/lib/fonts/fixedwidthfonts/screen.b.12"
246 #+xview
247 "lucidasans-bold-12"))
248 (setq I (instance panel-text-item :init P :value "Initial text"
249 :menu
250 (instance sunview-menu :init
251 :choices '(10 11 12)
252 :strings '(aa bb cc)
253 :ncols 4
254 )
255 :title "Text:" :length 30
256 :nproc :notify-text-proc
257 :clicked-proc :print-event
258 ))
259 (send I :enter-handler 'menu :menu-handler)
260 (setq B (instance panel-button-item :init P
261 :menu
262 (instance sunview-menu :init
263 :choices '(12 13 14 15)
264 :strings '(a b c d)
265 :ncols 2)
266 :title "Text:"
267 :nproc :notify-button-proc
268 ; :clicked-proc :print-event
269 ))
270 (send B :enter-handler 'menu :menu-handler)
271 (send self :show)
272 self))