560af5c5 |
1 | ;; Common Lisp bindings for GTK+ v2.0 |
bbaeff4b |
2 | ;; Copyright (C) 1999-2001 Espen S. Johnsen <esj@stud.cs.uit.no> |
560af5c5 |
3 | ;; |
4 | ;; This library is free software; you can redistribute it and/or |
5 | ;; modify it under the terms of the GNU Lesser General Public |
6 | ;; License as published by the Free Software Foundation; either |
7 | ;; version 2 of the License, or (at your option) any later version. |
8 | ;; |
9 | ;; This library is distributed in the hope that it will be useful, |
10 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | ;; Lesser General Public License for more details. |
13 | ;; |
14 | ;; You should have received a copy of the GNU Lesser General Public |
15 | ;; License along with this library; if not, write to the Free Software |
16 | ;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
17 | |
1047e159 |
18 | ;; $Id: gtk.lisp,v 1.13 2004-10-31 12:05:52 espen Exp $ |
560af5c5 |
19 | |
20 | |
21 | (in-package "GTK") |
22 | |
23 | ;;; Gtk version |
24 | |
bbaeff4b |
25 | (defbinding check-version () string |
560af5c5 |
26 | (required-major unsigned-int) |
27 | (required-minor unsigned-int) |
28 | (required-micro unsigned-int)) |
29 | |
bbaeff4b |
30 | (defbinding query-version () nil |
560af5c5 |
31 | (major unsigned-int :out) |
32 | (minor unsigned-int :out) |
33 | (micro unsigned-int :out)) |
34 | |
35 | (defun gtk-version () |
36 | (multiple-value-bind (major minor micro) |
37 | (query-version) |
38 | (if (zerop micro) |
39 | (format nil "Gtk+ v~A.~A" major minor) |
40 | (format nil "Gtk+ v~A.~A.~A" major minor micro)))) |
41 | |
0f476ab5 |
42 | (defbinding get-default-language () string) |
560af5c5 |
43 | |
44 | |
0f476ab5 |
45 | ;;; Acccel group |
560af5c5 |
46 | |
47 | |
1047e159 |
48 | |
560af5c5 |
49 | ;;; Acccel label |
50 | |
bbaeff4b |
51 | (defbinding accel-label-refetch () boolean |
560af5c5 |
52 | (accel-label accel-label)) |
53 | |
54 | |
0f476ab5 |
55 | ;;; Adjustment |
560af5c5 |
56 | |
1047e159 |
57 | (defmethod shared-initialize ((adjustment adjustment) names &key value) |
58 | (prog1 |
59 | (call-next-method) |
60 | ;; we need to make sure that the value is set last, otherwise it |
61 | ;; may be outside current limits |
62 | (when value |
63 | (setf (slot-value adjustment 'value) value)))) |
64 | |
65 | |
0f476ab5 |
66 | (defbinding adjustment-changed () nil |
67 | (adjustment adjustment)) |
68 | |
69 | (defbinding adjustment-value-changed () nil |
70 | (adjustment adjustment)) |
71 | |
72 | (defbinding adjustment-clamp-page () nil |
73 | (adjustment adjustment) |
74 | (lower single-float) |
75 | (upper single-float)) |
560af5c5 |
76 | |
0f476ab5 |
77 | |
0f476ab5 |
78 | ;;; Arrow -- no functions |
79 | |
80 | |
81 | |
82 | ;;; Aspect frame |
83 | |
84 | |
85 | ;;; Bin |
560af5c5 |
86 | |
87 | (defun (setf bin-child) (child bin) |
0f476ab5 |
88 | (when-bind (current-child (bin-child bin)) |
89 | (container-remove bin current-child)) |
560af5c5 |
90 | (container-add bin child) |
91 | child) |
92 | |
f36ca6af |
93 | |
0f476ab5 |
94 | ;;; Binding |
95 | |
96 | |
97 | |
98 | ;;; Box |
99 | |
100 | (defbinding box-pack-start () nil |
101 | (box box) |
102 | (child widget) |
103 | (expand boolean) |
104 | (fill boolean) |
105 | (padding unsigned-int)) |
106 | |
107 | (defbinding box-pack-end () nil |
108 | (box box) |
109 | (child widget) |
110 | (expand boolean) |
111 | (fill boolean) |
112 | (padding unsigned-int)) |
113 | |
1047e159 |
114 | (defun box-pack (box child &key from-end expand fill (padding 0)) |
f5b67f2b |
115 | (if from-end |
116 | (box-pack-end box child expand fill padding) |
117 | (box-pack-start box child expand fill padding))) |
0f476ab5 |
118 | |
119 | (defbinding box-reorder-child () nil |
120 | (box box) |
121 | (child widget) |
122 | (position int)) |
123 | |
124 | (defbinding box-query-child-packing () nil |
125 | (box box) |
126 | (child widget) |
127 | (expand boolean :out) |
128 | (fill boolean :out) |
129 | (padding unsigned-int :out) |
130 | (pack-type pack-type :out)) |
131 | |
132 | (defbinding box-set-child-packing () nil |
133 | (box box) |
134 | (child widget) |
135 | (expand boolean) |
136 | (fill boolean) |
137 | (padding unsigned-int) |
138 | (pack-type pack-type)) |
139 | |
140 | |
141 | |
560af5c5 |
142 | ;;; Button |
143 | |
bbaeff4b |
144 | (defbinding button-pressed () nil |
560af5c5 |
145 | (button button)) |
146 | |
0f476ab5 |
147 | (defbinding button-released () nil |
148 | (button button)) |
149 | |
150 | (defbinding button-clicked () nil |
151 | (button button)) |
152 | |
153 | (defbinding button-enter () nil |
154 | (button button)) |
155 | |
156 | (defbinding button-leave () nil |
157 | (button button)) |
158 | |
159 | |
160 | |
161 | ;;; Calendar |
162 | |
163 | (defbinding calendar-select-month () int |
164 | (calendar calendar) |
165 | (month unsigned-int) |
166 | (year unsigned-int)) |
167 | |
168 | (defbinding calendar-select-day () nil |
169 | (calendar calendar) |
170 | (day unsigned-int)) |
171 | |
172 | (defbinding calendar-mark-day () int |
173 | (calendar calendar) |
174 | (day unsigned-int)) |
175 | |
176 | (defbinding calendar-unmark-day () int |
177 | (calendar calendar) |
178 | (day unsigned-int)) |
179 | |
180 | (defbinding calendar-clear-marks () nil |
181 | (calendar calendar)) |
182 | |
183 | (defbinding calendar-display-options () nil |
184 | (calendar calendar) |
185 | (options calendar-display-options)) |
186 | |
187 | (defbinding (calendar-date "gtk_calendar_get_date") () nil |
188 | (calendar calendar) |
189 | (year unsigned-int :out) |
190 | (month unsigned-int :out) |
191 | (day unsigned-int :out)) |
192 | |
193 | (defbinding calendar-freeze () nil |
194 | (calendar calendar)) |
195 | |
196 | (defbinding calendar-thaw () nil |
197 | (calendar calendar)) |
198 | |
199 | |
200 | |
201 | ;;; Cell editable |
202 | |
203 | |
204 | |
205 | ;;; Cell renderer |
206 | |
207 | |
208 | |
209 | ;;; Cell renderer pixbuf -- no functions |
210 | |
211 | |
212 | |
213 | ;;; Cell renderer text |
214 | |
215 | |
216 | |
217 | ;;; Cell renderer toggle -- no functions |
218 | |
219 | |
220 | |
221 | ;;; Check button -- no functions |
222 | |
223 | |
224 | |
225 | ;;; Check menu item |
226 | |
227 | (defbinding check-menu-item-toggled () nil |
228 | (check-menu-item check-menu-item)) |
229 | |
230 | |
231 | |
232 | ;;; Clipboard |
233 | |
234 | |
235 | ;;; Color selection |
236 | |
237 | (defbinding (color-selection-is-adjusting-p |
238 | "gtk_color_selection_is_adjusting") () boolean |
239 | (colorsel color-selection)) |
240 | |
241 | |
242 | |
243 | ;;; Color selection dialog -- no functions |
244 | |
245 | |
246 | |
247 | ;;; Combo |
248 | |
f5b67f2b |
249 | (defmethod shared-initialize ((combo combo) names &rest initargs |
250 | &key popdown-strings) |
251 | (call-next-method) |
252 | (when popdown-strings |
253 | (combo-set-popdown-strings combo popdown-strings))) |
254 | |
0f476ab5 |
255 | (defbinding combo-set-popdown-strings () nil |
256 | (combo combo) |
257 | (strings (glist string))) |
258 | |
259 | (defbinding combo-disable-activate () nil |
260 | (combo combo)) |
261 | |
262 | |
263 | |
48da76bf |
264 | ;;;; Dialog |
0f476ab5 |
265 | |
1047e159 |
266 | (defmethod shared-initialize ((dialog dialog) names &rest initargs &key button) |
48da76bf |
267 | (call-next-method) |
0f476ab5 |
268 | (dolist (button-definition (get-all initargs :button)) |
1047e159 |
269 | (apply #'dialog-add-button dialog (mklist button-definition)))) |
48da76bf |
270 | |
0f476ab5 |
271 | |
272 | (defvar %*response-id-key* (gensym)) |
273 | |
1047e159 |
274 | (defun %dialog-find-response-id-num (dialog id &optional create-p error-p) |
0f476ab5 |
275 | (or |
1047e159 |
276 | (cadr (assoc id (rest (type-expand-1 'response-type)))) |
277 | (let ((response-ids (object-data dialog %*response-id-key*))) |
0f476ab5 |
278 | (cond |
1047e159 |
279 | ((and response-ids (position id response-ids :test #'equal))) |
280 | (create-p |
281 | (cond |
282 | (response-ids |
283 | (vector-push-extend id response-ids) |
284 | (1- (length response-ids))) |
285 | (t |
286 | (setf |
287 | (object-data dialog %*response-id-key*) |
288 | (make-array 1 :adjustable t :fill-pointer t :initial-element id)) |
289 | 0))) |
290 | (error-p |
291 | (error "Invalid response: ~A" id)))))) |
0f476ab5 |
292 | |
293 | (defun %dialog-find-response-id (dialog response-id-num) |
294 | (if (< response-id-num 0) |
295 | (car |
296 | (rassoc |
297 | (list response-id-num) |
1047e159 |
298 | (rest (type-expand-1 'response-type)) :test #'equal)) |
299 | (aref (object-data dialog %*response-id-key*) response-id-num ))) |
0f476ab5 |
300 | |
301 | |
48da76bf |
302 | (defmethod signal-connect ((dialog dialog) signal function &key object after) |
303 | (let ((response-id-num (%dialog-find-response-id-num dialog signal))) |
304 | (cond |
305 | (response-id-num |
306 | (call-next-method |
307 | dialog 'response |
308 | #'(lambda (dialog id) |
309 | (when (= id response-id-num) |
310 | (cond |
311 | ((eq object t) (funcall function dialog)) |
312 | (object (funcall function object)) |
313 | (t (funcall function))))) |
314 | :object t :after after)) |
1047e159 |
315 | ((call-next-method))))) |
0f476ab5 |
316 | |
317 | |
48da76bf |
318 | (defbinding dialog-run () nil |
319 | (dialog dialog)) |
0f476ab5 |
320 | |
48da76bf |
321 | (defbinding dialog-response (dialog response-id) nil |
0f476ab5 |
322 | (dialog dialog) |
48da76bf |
323 | ((%dialog-find-response-id-num dialog response-id nil t) int)) |
0f476ab5 |
324 | |
325 | |
326 | (defbinding %dialog-add-button () button |
327 | (dialog dialog) |
328 | (text string) |
329 | (response-id-num int)) |
330 | |
1047e159 |
331 | (defun dialog-add-button (dialog label &optional (response label) |
332 | &key default object after) |
333 | "Adds a button to the dialog. If no response is given, then label |
334 | will be used." |
335 | (let* ((id (if (functionp response) |
336 | label |
337 | response)) |
338 | (id-num (%dialog-find-response-id-num dialog id t)) |
339 | (button (%dialog-add-button dialog label id-num))) |
340 | (when (functionp response) |
341 | (signal-connect dialog id response :object object :after after)) |
342 | (when default |
343 | (%dialog-set-default-response dialog id-num)) |
0f476ab5 |
344 | button)) |
345 | |
346 | |
347 | (defbinding %dialog-add-action-widget () button |
348 | (dialog dialog) |
349 | (action-widget widget) |
350 | (response-id-num int)) |
351 | |
1047e159 |
352 | (defun dialog-add-action-widget (dialog widget &optional (response widget) |
353 | &key default object after) |
354 | (let* ((id (if (functionp response) |
355 | widget |
356 | response)) |
357 | (id-num (%dialog-find-response-id-num dialog id t))) |
358 | (%dialog-add-action-widget dialog widget id-num) |
359 | (when (functionp response) |
360 | (signal-connect dialog id response :object object :after after)) |
361 | (when default |
362 | (%dialog-set-default-response dialog id-num)) |
0f476ab5 |
363 | widget)) |
0f476ab5 |
364 | |
0f476ab5 |
365 | |
48da76bf |
366 | (defbinding %dialog-set-default-response () nil |
367 | (dialog dialog) |
368 | (response-id-num int)) |
0f476ab5 |
369 | |
48da76bf |
370 | (defun dialog-set-default-response (dialog response-id) |
371 | (%dialog-set-default-response |
372 | dialog (%dialog-find-response-id-num dialog response-id nil t))) |
0f476ab5 |
373 | |
48da76bf |
374 | (defbinding dialog-set-response-sensitive (dialog response-id sensitive) nil |
375 | (dialog dialog) |
376 | ((%dialog-find-response-id-num dialog response-id nil t) int) |
377 | (sensitive boolean)) |
0f476ab5 |
378 | |
379 | |
48da76bf |
380 | ;; Addition dialog functions |
381 | |
382 | (defmethod container-add ((dialog dialog) (child widget) &rest args) |
1047e159 |
383 | (apply #'container-add (dialog-vbox dialog) child args)) |
48da76bf |
384 | |
385 | (defmethod container-remove ((dialog dialog) (child widget)) |
1047e159 |
386 | (container-remove (dialog-vbox dialog) child)) |
0f476ab5 |
387 | |
48da76bf |
388 | (defmethod container-children ((dialog dialog)) |
1047e159 |
389 | (container-children (dialog-vbox dialog))) |
48da76bf |
390 | |
391 | (defmethod (setf container-children) (children (dialog dialog)) |
1047e159 |
392 | (setf (container-children (dialog-vbox dialog)) children)) |
560af5c5 |
393 | |
560af5c5 |
394 | |
560af5c5 |
395 | |
48da76bf |
396 | ;;; Drawing area -- no functions |
560af5c5 |
397 | |
398 | |
aaa6e6cb |
399 | ;;; Entry |
560af5c5 |
400 | |
aaa6e6cb |
401 | (defbinding entry-get-layout () pango:layout |
402 | (entry entry)) |
403 | |
404 | (defbinding entry-get-layout-offsets () nil |
405 | (entry entry) |
406 | (x int :out) |
407 | (y int :out)) |
560af5c5 |
408 | |
560af5c5 |
409 | |
1047e159 |
410 | ;;; Image |
411 | |
412 | (defbinding image-set-from-file () nil |
413 | (image image) |
414 | (filename pathname)) |
415 | |
416 | (defbinding image-set-from-pixmap () nil |
417 | (image image) |
418 | (pixmap gdk:pixmap) |
419 | (mask gdk:bitmap)) |
420 | |
421 | (defbinding image-set-from-stock () nil |
422 | (image image) |
423 | (stock-id string) |
424 | (icon-size icon-size)) |
425 | |
426 | (defun image-set-from-pixmap-data (image pixmap-data) |
427 | (multiple-value-bind (pixmap mask) (gdk:pixmap-create pixmap-data) |
428 | (image-set-from-pixmap image pixmap mask))) |
429 | |
430 | (defun image-set-from-source (image source) |
431 | (etypecase source |
432 | (pathname (image-set-from-file image source)) |
433 | (string (if (stock-lookup source) |
434 | (setf (image-stock image) source) |
435 | (image-set-from-file image source))) |
436 | (vector (image-set-from-pixmap-data image source)))) |
437 | |
438 | |
439 | (defmethod shared-initialize ((image image) names &rest initargs |
440 | &key file pixmap source) |
441 | (prog1 |
442 | (if (vectorp pixmap) |
443 | (progn |
444 | (remf initargs :pixmap) |
445 | (apply #'call-next-method image names initargs)) |
446 | (call-next-method)) |
447 | (cond |
448 | (file (image-set-from-file image file)) |
449 | ((vectorp pixmap) (image-set-from-pixmap-data image pixmap)) |
450 | (source (image-set-from-source image source))))) |
451 | |
560af5c5 |
452 | |
0f476ab5 |
453 | ;;; Label |
560af5c5 |
454 | |
aaa6e6cb |
455 | (defbinding label-get-layout-offsets () nil |
1047e159 |
456 | (label label) |
aaa6e6cb |
457 | (x int :out) |
458 | (y int :out)) |
459 | |
0f476ab5 |
460 | (defbinding label-select-region () nil |
461 | (label label) |
462 | (start int) |
463 | (end int)) |
560af5c5 |
464 | |
1047e159 |
465 | (defbinding label-get-text () string |
aaa6e6cb |
466 | (label label)) |
467 | |
468 | (defbinding label-get-layout () pango:layout |
469 | (label label)) |
470 | |
1047e159 |
471 | (defbinding label-get-selection-bounds () boolean |
aaa6e6cb |
472 | (label label) |
473 | (start int :out) |
474 | (end int :out)) |
f36ca6af |
475 | |
560af5c5 |
476 | |
477 | |
478 | ;;; Radio button |
479 | |
e5b416f0 |
480 | (defbinding %radio-button-get-group () pointer |
d520140e |
481 | (radio-button radio-button)) |
482 | |
bbaeff4b |
483 | (defbinding %radio-button-set-group () nil |
d520140e |
484 | (radio-button radio-button) |
485 | (group pointer)) |
560af5c5 |
486 | |
d520140e |
487 | (defun radio-button-add-to-group (button1 button2) |
488 | "Add BUTTON1 to the group which BUTTON2 belongs to." |
489 | (%radio-button-set-group button1 (%radio-button-get-group button2))) |
490 | |
e5b416f0 |
491 | |
d520140e |
492 | (defmethod initialize-instance ((button radio-button) |
e5b416f0 |
493 | &rest initargs &key group-with) |
494 | (declare (ignore initargs)) |
d520140e |
495 | (call-next-method) |
e5b416f0 |
496 | (when group-with |
f5b67f2b |
497 | (radio-button-add-to-group button group-with))) |
560af5c5 |
498 | |
499 | |
500 | ;;; Option menu |
501 | |
bbaeff4b |
502 | (defbinding %option-menu-set-menu () nil |
f36ca6af |
503 | (option-menu option-menu) |
504 | (menu widget)) |
560af5c5 |
505 | |
bbaeff4b |
506 | (defbinding %option-menu-remove-menu () nil |
f36ca6af |
507 | (option-menu option-menu)) |
560af5c5 |
508 | |
f36ca6af |
509 | (defun (setf option-menu-menu) (menu option-menu) |
510 | (if (not menu) |
511 | (%option-menu-remove-menu option-menu) |
512 | (%option-menu-set-menu option-menu menu)) |
513 | menu) |
560af5c5 |
514 | |
515 | |
516 | |
517 | ;;; Item |
518 | |
bbaeff4b |
519 | (defbinding item-select () nil |
560af5c5 |
520 | (item item)) |
521 | |
bbaeff4b |
522 | (defbinding item-deselect () nil |
560af5c5 |
523 | (item item)) |
524 | |
bbaeff4b |
525 | (defbinding item-toggle () nil |
560af5c5 |
526 | (item item)) |
527 | |
528 | |
529 | |
530 | ;;; Menu item |
531 | |
f36ca6af |
532 | (defun (setf menu-item-label) (label menu-item) |
533 | (make-instance 'accel-label |
534 | :label label :xalign 0.0 :yalign 0.5 :accel-widget menu-item |
535 | :visible t :parent menu-item) |
536 | label) |
560af5c5 |
537 | |
f5b67f2b |
538 | (defun menu-item-label (menu-item) |
539 | (with-slots (child) menu-item |
540 | (when (typep child 'label) |
541 | (label-label child)))) |
542 | |
bbaeff4b |
543 | (defbinding %menu-item-set-submenu () nil |
f36ca6af |
544 | (menu-item menu-item) |
545 | (submenu menu)) |
560af5c5 |
546 | |
bbaeff4b |
547 | (defbinding %menu-item-remove-submenu () nil |
f36ca6af |
548 | (menu-item menu-item)) |
560af5c5 |
549 | |
f36ca6af |
550 | (defun (setf menu-item-submenu) (submenu menu-item) |
551 | (if (not submenu) |
552 | (%menu-item-remove-submenu menu-item) |
553 | (%menu-item-set-submenu menu-item submenu)) |
554 | submenu) |
560af5c5 |
555 | |
f5b67f2b |
556 | (defbinding menu-item-set-accel-path () nil |
557 | (menu-item menu-item) |
558 | (accel-path string)) |
559 | |
bbaeff4b |
560 | (defbinding menu-item-select () nil |
f36ca6af |
561 | (menu-item menu-item)) |
560af5c5 |
562 | |
bbaeff4b |
563 | (defbinding menu-item-deselect () nil |
f36ca6af |
564 | (menu-item menu-item)) |
560af5c5 |
565 | |
bbaeff4b |
566 | (defbinding menu-item-activate () nil |
f36ca6af |
567 | (menu-item menu-item)) |
560af5c5 |
568 | |
f5b67f2b |
569 | (defbinding menu-item-toggle-size-request () nil |
570 | (menu-item menu-item) |
571 | (requisition int :out)) |
572 | |
573 | (defbinding menu-item-toggle-size-allocate () nil |
574 | (menu-item menu-item) |
575 | (allocation int)) |
576 | |
560af5c5 |
577 | |
578 | |
f36ca6af |
579 | ;;; Radio menu item |
560af5c5 |
580 | |
e5b416f0 |
581 | (defbinding %radio-menu-item-get-group () pointer |
d520140e |
582 | (radio-menu-item radio-menu-item)) |
583 | |
bbaeff4b |
584 | (defbinding %radio-menu-item-set-group () nil |
d520140e |
585 | (radio-menu-item radio-menu-item) |
586 | (group pointer)) |
587 | |
d520140e |
588 | (defun radio-menu-item-add-to-group (item1 item2) |
589 | "Add ITEM1 to the group which ITEM2 belongs to." |
590 | (%radio-menu-item-set-group item1 (%radio-menu-item-get-group item2))) |
591 | |
592 | (defmethod initialize-instance ((item radio-menu-item) |
e5b416f0 |
593 | &rest initargs &key group-with) |
594 | (declare (ignore initargs)) |
f5b67f2b |
595 | (prog1 |
596 | (call-next-method) |
597 | (when group-with |
598 | (radio-menu-item-add-to-group item group-with)))) |
d520140e |
599 | |
560af5c5 |
600 | |
601 | |
aaa6e6cb |
602 | ;;; Toggle button |
603 | |
604 | (defbinding toggle-button-toggled () nil |
605 | (toggle-button toggle-button)) |
606 | |
607 | |
608 | |
560af5c5 |
609 | ;;; Window |
610 | |
7625ebd8 |
611 | (defbinding window-set-wmclass () nil |
560af5c5 |
612 | (window window) |
613 | (wmclass-name string) |
614 | (wmclass-class string)) |
615 | |
bbaeff4b |
616 | (defbinding window-add-accel-group () nil |
560af5c5 |
617 | (window window) |
618 | (accel-group accel-group)) |
619 | |
bbaeff4b |
620 | (defbinding window-remove-accel-group () nil |
560af5c5 |
621 | (window window) |
622 | (accel-group accel-group)) |
623 | |
bbaeff4b |
624 | (defbinding window-activate-focus () int |
560af5c5 |
625 | (window window)) |
626 | |
bbaeff4b |
627 | (defbinding window-activate-default () int |
560af5c5 |
628 | (window window)) |
629 | |
7625ebd8 |
630 | (defbinding window-set-default-size (window width height) int |
560af5c5 |
631 | (window window) |
7625ebd8 |
632 | ((or width -1) int) |
633 | ((or height -1) int)) |
560af5c5 |
634 | |
bbaeff4b |
635 | ;(defbinding window-set-geometry-hints) |
560af5c5 |
636 | |
7625ebd8 |
637 | (defbinding window-list-toplevels () (glist window)) |
638 | |
639 | (defbinding window-add-mnemonic (window key target) nil |
640 | (window window) |
641 | ((gdk:keyval-from-name key) unsigned-int) |
642 | (target widget)) |
643 | |
644 | (defbinding window-remove-mnemonic (window key target) nil |
645 | (window window) |
646 | ((gdk:keyval-from-name key) unsigned-int) |
647 | (target widget)) |
648 | |
649 | (defbinding window-mnemonic-activate (window key modifier) nil |
650 | (window window) |
651 | ((gdk:keyval-from-name key) unsigned-int) |
652 | (modifier gdk:modifier-type)) |
653 | |
654 | (defbinding window-present () nil |
655 | (window window)) |
656 | |
657 | (defbinding window-iconify () nil |
658 | (window window)) |
659 | |
660 | (defbinding window-deiconify () nil |
661 | (window window)) |
662 | |
663 | (defbinding window-stick () nil |
664 | (window window)) |
665 | |
666 | (defbinding window-unstick () nil |
667 | (window window)) |
668 | |
669 | (defbinding window-maximize () nil |
670 | (window window)) |
671 | |
672 | (defbinding window-unmaximize () nil |
673 | (window window)) |
674 | |
675 | (defbinding window-begin-resize-drag () nil |
676 | (window window) |
677 | (edge gdk:window-edge) |
678 | (button int) |
679 | (root-x int) (root-y int) |
680 | (timestamp (unsigned-int 32))) |
681 | |
682 | (defbinding window-begin-move-drag () nil |
683 | (window window) |
684 | (edge gdk:window-edge) |
685 | (button int) |
686 | (root-x int) (root-y int) |
687 | (timestamp (unsigned-int 32))) |
688 | |
689 | (defbinding window-set-frame-dimensions () nil |
690 | (window window) |
691 | (left int) (top int) (rigth int) (bottom int)) |
692 | |
693 | (defbinding (window-default-icons "gtk_window_get_default_icon_list") |
694 | () (glist gdk:pixbuf)) |
695 | |
696 | (defbinding %window-get-default-size () nil |
697 | (window window) |
698 | (width int :out) |
699 | (height int :out)) |
700 | |
701 | (defun window-get-default-size (window) |
702 | (multiple-value-bind (width height) (%window-get-default-size window) |
703 | (values (unless (= width -1) width) (unless (= height -1) height)))) |
704 | |
705 | (defbinding window-get-frame-dimensions () nil |
706 | (window window) |
707 | (left int :out) (top int :out) (rigth int :out) (bottom int :out)) |
708 | |
709 | (defbinding %window-get-icon-list () (glist gdk:pixbuf) |
710 | (window window)) |
711 | |
712 | (defmethod window-icon ((window window)) |
713 | (let ((icon-list (%window-get-icon-list window))) |
714 | (if (endp (rest icon-list)) |
715 | (first icon-list) |
716 | icon-list))) |
717 | |
718 | (defbinding window-get-position () nil |
719 | (window window) |
720 | (root-x int :out) |
721 | (root-y int :out)) |
722 | |
723 | (defbinding window-get-size () nil |
724 | (window window) |
725 | (width int :out) |
726 | (height int :out)) |
727 | |
728 | (defbinding window-move () nil |
729 | (window window) |
730 | (x int) |
731 | (y int)) |
732 | |
733 | (defbinding window-parse-geometry () boolean |
734 | (window window) |
735 | (geometry string)) |
736 | |
737 | (defbinding window-reshow-with-initial-size () nil |
738 | (window window)) |
739 | |
740 | (defbinding window-resize () nil |
741 | (window window) |
742 | (width int) |
743 | (heigth int)) |
744 | |
745 | (defbinding %window-set-icon-list () nil |
746 | (window window) |
747 | (icon-list (glist gdk:pixbuf))) |
748 | |
749 | (defmethod (setf window-icon) (icon (window window)) |
750 | (%window-set-icon-list window (mklist icon))) |
751 | |
752 | |
560af5c5 |
753 | |
754 | |
1047e159 |
755 | ;;; File chooser |
560af5c5 |
756 | |
560af5c5 |
757 | |
560af5c5 |
758 | |
759 | |
f36ca6af |
760 | ;;; Scrolled window |
560af5c5 |
761 | |
560af5c5 |
762 | (defun (setf scrolled-window-scrollbar-policy) (policy window) |
763 | (setf (scrolled-window-hscrollbar-policy window) policy) |
764 | (setf (scrolled-window-vscrollbar-policy window) policy)) |
765 | |
bbaeff4b |
766 | (defbinding scrolled-window-add-with-viewport () nil |
560af5c5 |
767 | (scrolled-window scrolled-window) |
768 | (child widget)) |
769 | |
770 | |
771 | |
d520140e |
772 | |
773 | |
774 | |
560af5c5 |
775 | |
f36ca6af |
776 | ;;; Statusbar |
560af5c5 |
777 | |
bbaeff4b |
778 | (defbinding (statusbar-context-id "gtk_statusbar_get_context_id") |
779 | () unsigned-int |
f36ca6af |
780 | (statusbar statusbar) |
781 | (context-description string)) |
560af5c5 |
782 | |
bbaeff4b |
783 | (defbinding statusbar-push () unsigned-int |
f36ca6af |
784 | (statusbar statusbar) |
785 | (context-id unsigned-int) |
786 | (text string)) |
560af5c5 |
787 | |
bbaeff4b |
788 | (defbinding statusbar-pop () nil |
f36ca6af |
789 | (statusbar statusbar) |
790 | (context-id unsigned-int)) |
560af5c5 |
791 | |
bbaeff4b |
792 | (defbinding statusbar-remove () nil |
f36ca6af |
793 | (statusbar statusbar) |
794 | (context-id unsigned-int) |
795 | (message-id unsigned-int)) |
560af5c5 |
796 | |
560af5c5 |
797 | |
798 | |
799 | ;;; Fixed |
800 | |
bbaeff4b |
801 | (defbinding fixed-put () nil |
f36ca6af |
802 | (fixed fixed) |
803 | (widget widget) |
f5b67f2b |
804 | (x int) (y int)) |
560af5c5 |
805 | |
bbaeff4b |
806 | (defbinding fixed-move () nil |
f36ca6af |
807 | (fixed fixed) |
808 | (widget widget) |
f5b67f2b |
809 | (x int) (y int)) |
560af5c5 |
810 | |
811 | |
812 | |
d520140e |
813 | ;;; Notebook |
560af5c5 |
814 | |
f5b67f2b |
815 | (defun %notebook-position (notebook page) |
816 | (etypecase page |
817 | (int page) |
818 | (keyword (case page |
819 | (:first 0) |
820 | (:last -1) |
1047e159 |
821 | (t (error "Invalid position keyword: ~A" page)))) |
f5b67f2b |
822 | (widget (notebook-page-num notebook page t)))) |
823 | |
824 | (defun %notebook-child (notebook position) |
825 | (typecase position |
826 | (widget position) |
827 | (t (notebook-nth-page-child notebook position)))) |
828 | |
829 | |
830 | (defbinding (notebook-insert "gtk_notebook_insert_page_menu") |
f36ca6af |
831 | (notebook position child tab-label &optional menu-label) nil |
832 | (notebook notebook) |
833 | (child widget) |
834 | ((if (stringp tab-label) |
f5b67f2b |
835 | (make-instance 'label :label tab-label) |
f36ca6af |
836 | tab-label) widget) |
837 | ((if (stringp menu-label) |
f5b67f2b |
838 | (make-instance 'label :label menu-label) |
f36ca6af |
839 | menu-label) (or null widget)) |
f5b67f2b |
840 | ((%notebook-position notebook position) int)) |
560af5c5 |
841 | |
f5b67f2b |
842 | (defun notebook-append (notebook child tab-label &optional menu-label) |
843 | (notebook-insert notebook :last child tab-label menu-label)) |
560af5c5 |
844 | |
f5b67f2b |
845 | (defun notebook-prepend (notebook child tab-label &optional menu-label) |
846 | (notebook-insert notebook :first child tab-label menu-label)) |
560af5c5 |
847 | |
f5b67f2b |
848 | (defbinding notebook-remove-page (notebook page) nil |
f36ca6af |
849 | (notebook notebook) |
1047e159 |
850 | ((%notebook-position notebook page) int)) |
560af5c5 |
851 | |
bbaeff4b |
852 | (defbinding %notebook-page-num () int |
f36ca6af |
853 | (notebook notebook) |
854 | (child widget)) |
855 | |
f5b67f2b |
856 | (defun notebook-page-num (notebook child &optional error-p) |
f36ca6af |
857 | (let ((page-num (%notebook-page-num notebook child))) |
858 | (if (= page-num -1) |
f5b67f2b |
859 | (when error-p |
860 | (error "~A is not a child of ~A" child notebook)) |
f36ca6af |
861 | page-num))) |
862 | |
bbaeff4b |
863 | (defbinding notebook-next-page () nil |
f36ca6af |
864 | (notebook notebook)) |
560af5c5 |
865 | |
bbaeff4b |
866 | (defbinding notebook-prev-page () nil |
f36ca6af |
867 | (notebook notebook)) |
868 | |
f5b67f2b |
869 | (defbinding notebook-reorder-child (notebook child position) nil |
870 | (notebook notebook) |
871 | (child widget) |
872 | ((%notebook-position notebook position) int)) |
873 | |
bbaeff4b |
874 | (defbinding notebook-popup-enable () nil |
f36ca6af |
875 | (notebook notebook)) |
876 | |
bbaeff4b |
877 | (defbinding notebook-popup-disable () nil |
f36ca6af |
878 | (notebook notebook)) |
879 | |
f5b67f2b |
880 | (defbinding (notebook-nth-page-child "gtk_notebook_get_nth_page") |
881 | (notebook page) widget |
882 | (notebook notebook) |
883 | ((case page |
884 | (:first 0) |
885 | (:last -1) |
886 | (t page)) int)) |
887 | |
1047e159 |
888 | |
889 | (defbinding %notebook-get-current-page () int |
f5b67f2b |
890 | (notebook notebook)) |
891 | |
1047e159 |
892 | (defun notebook-current-page-num (notebook) |
893 | (let ((num (%notebook-get-current-page notebook))) |
894 | (when (>= num 0) |
895 | num))) |
896 | |
f5b67f2b |
897 | (defun notebook-current-page (notebook) |
1047e159 |
898 | (let ((page-num (notebook-current-page-num notebook))) |
899 | (when page-num |
900 | (notebook-nth-page-child notebook page-num)))) |
f5b67f2b |
901 | |
902 | (defbinding %notebook-set-current-page () nil |
903 | (notebook notebook) |
904 | (page-num int)) |
905 | |
906 | (defun (setf notebook-current-page) (page notebook) |
907 | (%notebook-set-current-page notebook (%notebook-position notebook page)) |
908 | page) |
909 | |
910 | |
1047e159 |
911 | (defbinding (notebook-tab-label "gtk_notebook_get_tab_label") |
912 | (notebook page) widget |
913 | (notebook notebook) |
914 | ((%notebook-child notebook page) widget)) |
f5b67f2b |
915 | |
1047e159 |
916 | (defbinding (notebook-tab-label-text "gtk_notebook_get_tab_label_text") |
917 | (notebook page) string |
918 | (notebook notebook) |
919 | ((%notebook-child notebook page) widget)) |
f5b67f2b |
920 | |
1047e159 |
921 | (defbinding %notebook-set-tab-label () nil |
922 | (notebook notebook) |
923 | (page widget) |
924 | (tab-label widget)) |
925 | |
926 | (defun (setf notebook-tab-label) (tab-label notebook page) |
927 | (let ((widget (if (stringp tab-label) |
928 | (make-instance 'label :label tab-label) |
929 | tab-label))) |
930 | (%notebook-set-tab-label notebook (%notebook-child notebook page) widget) |
931 | widget)) |
f5b67f2b |
932 | |
f5b67f2b |
933 | |
1047e159 |
934 | (defbinding (notebook-menu-label "gtk_notebook_get_menu_label") |
935 | (notebook page) widget |
936 | (notebook notebook) |
937 | ((%notebook-child notebook page) widget)) |
f5b67f2b |
938 | |
1047e159 |
939 | (defbinding (notebook-menu-label-text "gtk_notebook_get_menu_label_text") |
940 | (notebook page) string |
941 | (notebook notebook) |
942 | ((%notebook-child notebook page) widget)) |
f5b67f2b |
943 | |
1047e159 |
944 | (defbinding %notebook-set-menu-label () nil |
945 | (notebook notebook) |
946 | (page widget) |
947 | (menu-label widget)) |
948 | |
949 | (defun (setf notebook-menu-label) (menu-label notebook page) |
950 | (let ((widget (if (stringp menu-label) |
951 | (make-instance 'label :label menu-label) |
952 | menu-label))) |
953 | (%notebook-set-menu-label notebook (%notebook-child notebook page) widget) |
954 | widget)) |
f5b67f2b |
955 | |
956 | |
957 | (defbinding notebook-query-tab-label-packing (notebook page) nil |
f36ca6af |
958 | (notebook notebook) |
f5b67f2b |
959 | ((%notebook-child notebook page) widget) |
f36ca6af |
960 | (expand boolean :out) |
961 | (fill boolean :out) |
962 | (pack-type pack-type :out)) |
963 | |
f5b67f2b |
964 | (defbinding notebook-set-tab-label-packing |
965 | (notebook page expand fill pack-type) nil |
f36ca6af |
966 | (notebook notebook) |
f5b67f2b |
967 | ((%notebook-child notebook page) widget) |
f36ca6af |
968 | (expand boolean) |
969 | (fill boolean) |
970 | (pack-type pack-type)) |
971 | |
560af5c5 |
972 | |
973 | |
d520140e |
974 | ;;; Paned |
560af5c5 |
975 | |
bbaeff4b |
976 | (defbinding paned-pack1 () nil |
d520140e |
977 | (paned paned) |
978 | (child widget) |
979 | (resize boolean) |
980 | (shrink boolean)) |
560af5c5 |
981 | |
bbaeff4b |
982 | (defbinding paned-pack2 () nil |
d520140e |
983 | (paned paned) |
984 | (child widget) |
985 | (resize boolean) |
986 | (shrink boolean)) |
560af5c5 |
987 | |
f5b67f2b |
988 | (defun (setf paned-child1) (child paned) |
989 | (paned-pack1 paned child nil t) |
990 | child) |
991 | |
992 | (defun (setf paned-child2) (child paned) |
993 | (paned-pack2 paned child t t) |
994 | child) |
995 | |
996 | ;; Defined in gtkglue.c |
bbaeff4b |
997 | (defbinding paned-child1 () widget |
d520140e |
998 | (paned paned) |
999 | (resize boolean :out) |
1000 | (shrink boolean :out)) |
560af5c5 |
1001 | |
f5b67f2b |
1002 | ;; Defined in gtkglue.c |
bbaeff4b |
1003 | (defbinding paned-child2 () widget |
d520140e |
1004 | (paned paned) |
1005 | (resize boolean :out) |
1006 | (shrink boolean :out)) |
560af5c5 |
1007 | |
560af5c5 |
1008 | |
560af5c5 |
1009 | |
d520140e |
1010 | ;;; Layout |
560af5c5 |
1011 | |
bbaeff4b |
1012 | (defbinding layout-put () nil |
d520140e |
1013 | (layout layout) |
1014 | (widget widget) |
1015 | (x int) |
1016 | (y int)) |
560af5c5 |
1017 | |
bbaeff4b |
1018 | (defbinding layout-move () nil |
d520140e |
1019 | (layout layout) |
1020 | (widget widget) |
1021 | (x int) |
1022 | (y int)) |
560af5c5 |
1023 | |
560af5c5 |
1024 | |
1025 | |
560af5c5 |
1026 | ;;; Menu shell |
1027 | |
f5b67f2b |
1028 | (defbinding menu-shell-insert (menu-shell menu-item position) nil |
f36ca6af |
1029 | (menu-shell menu-shell) |
1030 | (menu-item menu-item) |
f5b67f2b |
1031 | ((case position |
1032 | (:first 0) |
1033 | (:last -1) |
1034 | (t position)) int)) |
560af5c5 |
1035 | |
f36ca6af |
1036 | (defun menu-shell-append (menu-shell menu-item) |
f5b67f2b |
1037 | (menu-shell-insert menu-shell menu-item :last)) |
560af5c5 |
1038 | |
f36ca6af |
1039 | (defun menu-shell-prepend (menu-shell menu-item) |
f5b67f2b |
1040 | (menu-shell-insert menu-shell menu-item :fisrt)) |
560af5c5 |
1041 | |
bbaeff4b |
1042 | (defbinding menu-shell-deactivate () nil |
f36ca6af |
1043 | (menu-shell menu-shell)) |
560af5c5 |
1044 | |
bbaeff4b |
1045 | (defbinding menu-shell-select-item () nil |
f36ca6af |
1046 | (menu-shell menu-shell) |
1047 | (menu-item menu-item)) |
560af5c5 |
1048 | |
bbaeff4b |
1049 | (defbinding menu-shell-deselect () nil |
f36ca6af |
1050 | (menu-shell menu-shell)) |
560af5c5 |
1051 | |
bbaeff4b |
1052 | (defbinding menu-shell-activate-item () nil |
f36ca6af |
1053 | (menu-shell menu-shell) |
1054 | (menu-item menu-item) |
1055 | (fore-deactivate boolean)) |
560af5c5 |
1056 | |
1057 | |
1058 | |
f5b67f2b |
1059 | ;;; Menu |
560af5c5 |
1060 | |
f5b67f2b |
1061 | (defun %menu-position (menu child) |
1062 | (etypecase child |
1063 | (int child) |
1064 | (keyword (case child |
1065 | (:first 0) |
1066 | (:last -1) |
1047e159 |
1067 | (t (error "Invalid position keyword: ~A" child)))) |
f5b67f2b |
1068 | (widget (menu-child-position menu child)))) |
560af5c5 |
1069 | |
1070 | |
f5b67f2b |
1071 | (defbinding menu-reorder-child (menu menu-item position) nil |
1072 | (menu menu) |
1073 | (menu-item menu-item) |
1074 | ((%menu-position menu position) int)) |
560af5c5 |
1075 | |
f5b67f2b |
1076 | (defvar *menu-position-callback-marshal* |
1077 | (system:foreign-symbol-address "gtk_menu_position_callback_marshal")) |
560af5c5 |
1078 | |
f5b67f2b |
1079 | (defbinding %menu-popup () nil |
1080 | (menu menu) |
1081 | (parent-menu-shell (or null menu-shell)) |
1082 | (parent-menu-item (or null menu-item)) |
1083 | (callback-func (or null pointer)) |
1084 | (callback-id unsigned-int) |
1085 | (button unsigned-int) |
1086 | (activate-time (unsigned 32))) |
1087 | |
1088 | (defun menu-popup (menu button activate-time &key callback parent-menu-shell |
1089 | parent-menu-item) |
1090 | (if callback |
1091 | (let ((callback-id (register-callback-function callback))) |
1092 | (unwind-protect |
1093 | (%menu-popup |
1094 | menu parent-menu-shell parent-menu-item |
1095 | *menu-position-callback-marshal* callback-id button activate-time) |
1096 | (destroy-user-data callback-id))) |
1097 | (%menu-popup |
1098 | menu parent-menu-shell parent-menu-item nil 0 button activate-time))) |
1099 | |
1100 | (defbinding menu-set-accel-path () nil |
1101 | (menu menu) |
1102 | (accel-path string)) |
560af5c5 |
1103 | |
bbaeff4b |
1104 | (defbinding menu-reposition () nil |
f36ca6af |
1105 | (menu menu)) |
560af5c5 |
1106 | |
bbaeff4b |
1107 | (defbinding menu-popdown () nil |
f36ca6af |
1108 | (menu menu)) |
560af5c5 |
1109 | |
f5b67f2b |
1110 | (defun menu-child-position (menu child) |
1111 | (position child (container-children menu))) |
1112 | |
1113 | (defun menu-active-num (menu) |
1114 | (menu-child-position menu (menu-active menu))) |
1115 | |
bbaeff4b |
1116 | (defbinding %menu-set-active () nil |
f36ca6af |
1117 | (menu menu) |
1118 | (index unsigned-int)) |
560af5c5 |
1119 | |
f5b67f2b |
1120 | (defun (setf menu-active) (menu child) |
1121 | (%menu-set-active menu (%menu-position menu child)) |
1122 | child) |
d520140e |
1123 | |
560af5c5 |
1124 | |
1125 | |
f36ca6af |
1126 | ;;; Table |
560af5c5 |
1127 | |
bbaeff4b |
1128 | (defbinding table-resize () nil |
f36ca6af |
1129 | (table table) |
1130 | (rows unsigned-int) |
1131 | (columns unsigned-int)) |
560af5c5 |
1132 | |
bbaeff4b |
1133 | (defbinding table-attach (table child left right top bottom |
f5b67f2b |
1134 | &key (x-options '(:expand :fill)) |
1135 | (y-options '(:expand :fill)) |
1136 | (x-padding 0) (y-padding 0)) nil |
f36ca6af |
1137 | (table table) |
1138 | (child widget) |
1139 | (left unsigned-int) |
1140 | (right unsigned-int) |
1141 | (top unsigned-int) |
1142 | (bottom unsigned-int) |
1143 | (x-options attach-options) |
1144 | (y-options attach-options) |
1145 | (x-padding unsigned-int) |
1146 | (y-padding unsigned-int)) |
1147 | |
e5b416f0 |
1148 | |
bbaeff4b |
1149 | (defbinding %table-set-row-spacing () nil |
f36ca6af |
1150 | (table table) |
1151 | (row unsigned-int) |
1152 | (spacing unsigned-int)) |
1153 | |
e5b416f0 |
1154 | (defbinding %table-set-row-spacings () nil |
1155 | (table table) |
1156 | (spacing unsigned-int)) |
1157 | |
1158 | (defun (setf table-row-spacing) (spacing table &optional row) |
1159 | (if row |
1160 | (%table-set-row-spacing table row spacing) |
1161 | (%table-set-row-spacings table spacing)) |
f36ca6af |
1162 | spacing) |
1163 | |
e5b416f0 |
1164 | (defbinding %table-get-row-spacing () unsigned-int |
f36ca6af |
1165 | (table table) |
e5b416f0 |
1166 | (row unsigned-int)) |
1167 | |
1168 | (defbinding %table-get-default-row-spacing () unsigned-int |
1169 | (table table)) |
1170 | |
1171 | (defun table-row-spacing (table &optional row) |
1172 | (if row |
1173 | (%table-get-row-spacing table row) |
1174 | (%table-get-default-row-spacing table))) |
1175 | |
f36ca6af |
1176 | |
bbaeff4b |
1177 | (defbinding %table-set-col-spacing () nil |
f36ca6af |
1178 | (table table) |
1179 | (col unsigned-int) |
1180 | (spacing unsigned-int)) |
1181 | |
e5b416f0 |
1182 | (defbinding %table-set-col-spacings () nil |
1183 | (table table) |
1184 | (spacing unsigned-int)) |
1185 | |
1186 | (defun (setf table-col-spacing) (spacing table &optional col) |
1187 | (if col |
1188 | (%table-set-col-spacing table col spacing) |
1189 | (%table-set-col-spacings table spacing)) |
f36ca6af |
1190 | spacing) |
1191 | |
e5b416f0 |
1192 | (defbinding %table-get-col-spacing () unsigned-int |
f36ca6af |
1193 | (table table) |
e5b416f0 |
1194 | (col unsigned-int)) |
1195 | |
1196 | (defbinding %table-get-default-col-spacing () unsigned-int |
1197 | (table table)) |
1198 | |
1199 | (defun table-col-spacing (table &optional col) |
1200 | (if col |
1201 | (%table-get-col-spacing table col) |
1202 | (%table-get-default-col-spacing table))) |
1203 | |
1204 | |
f36ca6af |
1205 | |
1206 | ;;; Toolbar |
1207 | |
bbaeff4b |
1208 | (defbinding %toolbar-insert-element () widget |
f36ca6af |
1209 | (toolbar toolbar) |
1210 | (type toolbar-child-type) |
1211 | (widget (or null widget)) |
1212 | (text string) |
1213 | (tooltip-text string) |
1214 | (tooltip-private-text string) |
1215 | (icon (or null widget)) |
1216 | (nil null) |
1217 | (nil null) |
1218 | (position int)) |
560af5c5 |
1219 | |
f5b67f2b |
1220 | (defbinding %toolbar-insert-stock () widget |
1221 | (toolbar toolbar) |
1222 | (stock-id string) |
1223 | (tooltip-text string) |
1224 | (tooltip-private-text string) |
1225 | (nil null) |
1226 | (nil null) |
1227 | (position int)) |
1228 | |
1229 | (defun toolbar-insert (toolbar position element |
1230 | &key tooltip-text tooltip-private-text |
1231 | type icon group callback object) |
1232 | (let* ((numpos (case position |
1047e159 |
1233 | (:first -1) |
1234 | (:last 0) |
f5b67f2b |
1235 | (t position))) |
1236 | (widget |
1237 | (cond |
1238 | ((or |
1239 | (eq type :space) |
1240 | (and (not type) (eq element :space))) |
1241 | (%toolbar-insert-element |
1242 | toolbar :space nil nil |
1243 | tooltip-text tooltip-private-text nil numpos)) |
1244 | ((or |
1245 | (eq type :widget) |
1246 | (and (not type) (typep element 'widget))) |
1247 | (%toolbar-insert-element |
1248 | toolbar :widget element nil |
1249 | tooltip-text tooltip-private-text nil numpos)) |
1250 | ((or |
1251 | (eq type :stock) |
1252 | (and |
1253 | (not type) |
1254 | (typep element 'string) |
1255 | (stock-lookup element))) |
1256 | (%toolbar-insert-stock |
1257 | toolbar element tooltip-text tooltip-private-text numpos)) |
1258 | ((typep element 'string) |
1259 | (%toolbar-insert-element |
1260 | toolbar (or type :button) (when (eq type :radio-button) group) |
1047e159 |
1261 | element tooltip-text tooltip-private-text |
1262 | (etypecase icon |
1263 | (null nil) |
1264 | (widget icon) |
1265 | ((or pathname string vector) |
1266 | (make-instance 'image |
1267 | :source icon ; :icon-size (toolbar-icon-size toolbar) |
1268 | ))) |
1269 | numpos)) |
f5b67f2b |
1270 | ((error "Invalid element type: ~A" element))))) |
f36ca6af |
1271 | (when callback |
f5b67f2b |
1272 | (signal-connect widget 'clicked callback :object object)) |
1273 | widget)) |
f36ca6af |
1274 | |
f5b67f2b |
1275 | (defun toolbar-append (toolbar element &key tooltip-text tooltip-private-text |
1276 | type icon group callback object) |
1277 | (toolbar-insert |
1278 | toolbar :first element :type type :icon icon :group group |
f36ca6af |
1279 | :tooltip-text tooltip-text :tooltip-private-text tooltip-private-text |
f5b67f2b |
1280 | :callback callback :object object)) |
f36ca6af |
1281 | |
f5b67f2b |
1282 | (defun toolbar-prepend (toolbar element &key tooltip-text tooltip-private-text |
1283 | type icon group callback object) |
1284 | (toolbar-insert |
1285 | toolbar :last element :type type :icon icon :group group |
f36ca6af |
1286 | :tooltip-text tooltip-text :tooltip-private-text tooltip-private-text |
f5b67f2b |
1287 | :callback callback :object object)) |
1288 | |
f36ca6af |
1289 | |
1290 | (defun toolbar-insert-space (toolbar position) |
f5b67f2b |
1291 | (toolbar-insert toolbar position :space)) |
f36ca6af |
1292 | |
1293 | (defun toolbar-append-space (toolbar) |
f5b67f2b |
1294 | (toolbar-append toolbar :space)) |
f36ca6af |
1295 | |
1296 | (defun toolbar-prepend-space (toolbar) |
f5b67f2b |
1297 | (toolbar-prepend toolbar :space)) |
f36ca6af |
1298 | |
560af5c5 |
1299 | |
f36ca6af |
1300 | (defun toolbar-enable-tooltips (toolbar) |
1301 | (setf (toolbar-tooltips-p toolbar) t)) |
560af5c5 |
1302 | |
f36ca6af |
1303 | (defun toolbar-disable-tooltips (toolbar) |
1304 | (setf (toolbar-tooltips-p toolbar) nil)) |
560af5c5 |
1305 | |
1306 | |
f5b67f2b |
1307 | (defbinding toolbar-remove-space () nil |
1308 | (toolbar toolbar) |
1309 | (position int)) |
560af5c5 |
1310 | |
f5b67f2b |
1311 | (defbinding toolbar-unset-icon-size () nil |
1312 | (toolbar toolbar)) |
560af5c5 |
1313 | |
f5b67f2b |
1314 | (defbinding toolbar-unset-style () nil |
1315 | (toolbar toolbar)) |
560af5c5 |
1316 | |
1317 | |
bbaeff4b |
1318 | ;;; Editable |
1047e159 |
1319 | |
bbaeff4b |
1320 | (defbinding editable-select-region (editable &optional (start 0) end) nil |
f36ca6af |
1321 | (editable editable) |
1322 | (start int) |
1323 | ((or end -1) int)) |
560af5c5 |
1324 | |
1047e159 |
1325 | (defbinding editable-get-selection-bounds (editable) nil |
1326 | (editable editable) |
1327 | (start int :out) |
1328 | (end int :out)) |
1329 | |
bbaeff4b |
1330 | (defbinding editable-insert-text |
f36ca6af |
1331 | (editable text &optional (position 0)) nil |
1332 | (editable editable) |
1333 | (text string) |
1334 | ((length text) int) |
1335 | ((or position -1) int :in-out)) |
560af5c5 |
1336 | |
f36ca6af |
1337 | (defun editable-append-text (editable text) |
1338 | (editable-insert-text editable text nil)) |
560af5c5 |
1339 | |
f36ca6af |
1340 | (defun editable-prepend-text (editable text) |
1341 | (editable-insert-text editable text 0)) |
560af5c5 |
1342 | |
bbaeff4b |
1343 | (defbinding editable-delete-text (editable &optional (start 0) end) nil |
f36ca6af |
1344 | (editable editable) |
1345 | (start int) |
1346 | ((or end -1) int)) |
560af5c5 |
1347 | |
bbaeff4b |
1348 | (defbinding (editable-text "gtk_editable_get_chars") |
f36ca6af |
1349 | (editable &optional (start 0) end) string |
1350 | (editable editable) |
1351 | (start int) |
1352 | ((or end -1) int)) |
560af5c5 |
1353 | |
f36ca6af |
1354 | (defun (setf editable-text) (text editable) |
1355 | (if text |
1356 | (editable-delete-text |
1357 | editable |
1358 | (editable-insert-text editable text)) |
1359 | (editable-delete-text editable)) |
1360 | text) |
560af5c5 |
1361 | |
bbaeff4b |
1362 | (defbinding editable-cut-clipboard () nil |
f36ca6af |
1363 | (editable editable)) |
560af5c5 |
1364 | |
bbaeff4b |
1365 | (defbinding editable-copy-clipboard () nil |
f36ca6af |
1366 | (editable editable)) |
560af5c5 |
1367 | |
bbaeff4b |
1368 | (defbinding editable-paste-clipboard () nil |
f36ca6af |
1369 | (editable editable)) |
560af5c5 |
1370 | |
bbaeff4b |
1371 | (defbinding editable-delete-selection () nil |
f36ca6af |
1372 | (editable editable)) |
560af5c5 |
1373 | |
560af5c5 |
1374 | |
560af5c5 |
1375 | |
f36ca6af |
1376 | ;;; Spin button |
560af5c5 |
1377 | |
f36ca6af |
1378 | (defun spin-button-value-as-int (spin-button) |
1379 | (round (spin-button-value spin-button))) |
560af5c5 |
1380 | |
bbaeff4b |
1381 | (defbinding spin-button-spin () nil |
f36ca6af |
1382 | (spin-button spin-button) |
1383 | (direction spin-type) |
1384 | (increment single-float)) |
560af5c5 |
1385 | |
bbaeff4b |
1386 | (defbinding spin-button-update () nil |
f36ca6af |
1387 | (spin-button spin-button)) |
560af5c5 |
1388 | |
1389 | |
1390 | |
1391 | ; ;;; Ruler |
1392 | |
bbaeff4b |
1393 | (defbinding ruler-set-range () nil |
f36ca6af |
1394 | (ruler ruler) |
1395 | (lower single-float) |
1396 | (upper single-float) |
1397 | (position single-float) |
1398 | (max-size single-float)) |
560af5c5 |
1399 | |
bbaeff4b |
1400 | (defbinding ruler-draw-ticks () nil |
f36ca6af |
1401 | (ruler ruler)) |
560af5c5 |
1402 | |
bbaeff4b |
1403 | (defbinding ruler-draw-pos () nil |
f36ca6af |
1404 | (ruler ruler)) |
560af5c5 |
1405 | |
560af5c5 |
1406 | |
560af5c5 |
1407 | |
d520140e |
1408 | ;;; Range |
560af5c5 |
1409 | |
1047e159 |
1410 | (defun range-lower (range) |
1411 | (adjustment-lower (range-adjustment range))) |
560af5c5 |
1412 | |
1047e159 |
1413 | (defun range-upper (range) |
1414 | (adjustment-upper (range-adjustment range))) |
560af5c5 |
1415 | |
1047e159 |
1416 | (defun (setf range-lower) (value range) |
1417 | (setf (adjustment-lower (range-adjustment range)) value)) |
560af5c5 |
1418 | |
1047e159 |
1419 | (defun (setf range-upper) (value range) |
1420 | (setf (adjustment-upper (range-adjustment range)) value)) |
560af5c5 |
1421 | |
1047e159 |
1422 | (defun range-page-increment (range) |
1423 | (adjustment-page-increment (range-adjustment range))) |
560af5c5 |
1424 | |
1047e159 |
1425 | (defun range-step-increment (range) |
1426 | (adjustment-step-increment (range-adjustment range))) |
560af5c5 |
1427 | |
1047e159 |
1428 | (defun (setf range-page-increment) (value range) |
1429 | (setf (adjustment-page-increment (range-adjustment range)) value)) |
560af5c5 |
1430 | |
1047e159 |
1431 | (defun (setf range-step-increment) (value range) |
1432 | (setf (adjustment-step-increment (range-adjustment range)) value)) |
560af5c5 |
1433 | |
1047e159 |
1434 | (defbinding range-set-range () nil |
d520140e |
1435 | (range range) |
1047e159 |
1436 | (lower double-float) |
1437 | (upper double-float)) |
560af5c5 |
1438 | |
1047e159 |
1439 | (defbinding range-set-increments () nil |
d520140e |
1440 | (range range) |
1047e159 |
1441 | (step double-float) |
1442 | (page double-float)) |
560af5c5 |
1443 | |
560af5c5 |
1444 | |
d520140e |
1445 | ;;; Scale |
560af5c5 |
1446 | |
e5b416f0 |
1447 | ; (defbinding scale-draw-value () nil |
1448 | ; (scale scale)) |
560af5c5 |
1449 | |
560af5c5 |
1450 | |
560af5c5 |
1451 | |
d520140e |
1452 | ;;; Progress bar |
560af5c5 |
1453 | |
bbaeff4b |
1454 | (defbinding progress-bar-pulse () nil |
d520140e |
1455 | (progress-bar progress-bar)) |
560af5c5 |
1456 | |
1457 | |
1458 | |
f5b67f2b |
1459 | ;;; Stock items |
1460 | |
1461 | (defbinding stock-lookup () boolean |
1462 | (stock-id string) |
1463 | (stock-item stock-item :out)) |
1464 | |
1465 | |
560af5c5 |
1466 | |
1467 | |
1468 | ;;; Tooltips |
1469 | |
bbaeff4b |
1470 | (defbinding tooltips-enable () nil |
d520140e |
1471 | (tooltips tooltips)) |
560af5c5 |
1472 | |
bbaeff4b |
1473 | (defbinding tooltips-disable () nil |
d520140e |
1474 | (tooltips tooltips)) |
560af5c5 |
1475 | |
e5b416f0 |
1476 | (defun (setf tooltips-enabled-p) (enable tooltips) |
1477 | (if enable |
1478 | (tooltips-enable tooltips) |
1479 | (tooltips-disable tooltips))) |
1480 | |
bbaeff4b |
1481 | (defbinding tooltips-set-tip () nil |
d520140e |
1482 | (tooltips tooltips) |
1483 | (widget widget) |
1484 | (tip-text string) |
1485 | (tip-private string)) |
560af5c5 |
1486 | |
bbaeff4b |
1487 | (defbinding tooltips-force-window () nil |
d520140e |
1488 | (tooltips tooltips)) |
560af5c5 |
1489 | |
1490 | |
1491 | |
d520140e |
1492 | ;;; Rc |
560af5c5 |
1493 | |
bbaeff4b |
1494 | (defbinding rc-add-default-file (filename) nil |
d520140e |
1495 | ((namestring (truename filename)) string)) |
560af5c5 |
1496 | |
bbaeff4b |
1497 | (defbinding rc-parse (filename) nil |
d520140e |
1498 | ((namestring (truename filename)) string)) |
560af5c5 |
1499 | |
bbaeff4b |
1500 | (defbinding rc-parse-string () nil |
d520140e |
1501 | (rc-string string)) |
560af5c5 |
1502 | |
bbaeff4b |
1503 | (defbinding rc-reparse-all () nil) |
560af5c5 |
1504 | |
bbaeff4b |
1505 | (defbinding rc-get-style () style |
d520140e |
1506 | (widget widget)) |
560af5c5 |
1507 | |
1508 | |
1509 | |
1510 | ;;; Accelerator Groups |
bbaeff4b |
1511 | #| |
1512 | (defbinding accel-group-get-default () accel-group) |
560af5c5 |
1513 | |
f36ca6af |
1514 | (deftype-method alien-ref accel-group (type-spec) |
1515 | (declare (ignore type-spec)) |
1516 | '%accel-group-ref) |
560af5c5 |
1517 | |
f36ca6af |
1518 | (deftype-method alien-unref accel-group (type-spec) |
1519 | (declare (ignore type-spec)) |
1520 | '%accel-group-unref) |
1521 | |
bbaeff4b |
1522 | (defbinding %accel-group-ref () accel-group |
f36ca6af |
1523 | (accel-group (or accel-group pointer))) |
1524 | |
bbaeff4b |
1525 | (defbinding %accel-group-unref () nil |
f36ca6af |
1526 | (accel-group (or accel-group pointer))) |
560af5c5 |
1527 | |
bbaeff4b |
1528 | (defbinding accel-group-activate (accel-group key modifiers) boolean |
560af5c5 |
1529 | (accel-group accel-group) |
1530 | ((gdk:keyval-from-name key) unsigned-int) |
1531 | (modifiers gdk:modifier-type)) |
1532 | |
bbaeff4b |
1533 | (defbinding accel-groups-activate (object key modifiers) boolean |
560af5c5 |
1534 | (object object) |
1535 | ((gdk:keyval-from-name key) unsigned-int) |
1536 | (modifiers gdk:modifier-type)) |
1537 | |
bbaeff4b |
1538 | (defbinding accel-group-attach () nil |
560af5c5 |
1539 | (accel-group accel-group) |
1540 | (object object)) |
1541 | |
bbaeff4b |
1542 | (defbinding accel-group-detach () nil |
560af5c5 |
1543 | (accel-group accel-group) |
1544 | (object object)) |
1545 | |
bbaeff4b |
1546 | (defbinding accel-group-lock () nil |
560af5c5 |
1547 | (accel-group accel-group)) |
1548 | |
bbaeff4b |
1549 | (defbinding accel-group-unlock () nil |
560af5c5 |
1550 | (accel-group accel-group)) |
1551 | |
1552 | |
1553 | ;;; Accelerator Groups Entries |
1554 | |
bbaeff4b |
1555 | (defbinding accel-group-get-entry (accel-group key modifiers) accel-entry |
560af5c5 |
1556 | (accel-group accel-group) |
1557 | ((gdk:keyval-from-name key) unsigned-int) |
1558 | (modifiers gdk:modifier-type)) |
1559 | |
bbaeff4b |
1560 | (defbinding accel-group-lock-entry (accel-group key modifiers) nil |
560af5c5 |
1561 | (accel-group accel-group) |
1562 | ((gdk:keyval-from-name key) unsigned-int) |
1563 | (modifiers gdk:modifier-type)) |
1564 | |
bbaeff4b |
1565 | (defbinding accel-group-unlock-entry (accel-group key modifiers) nil |
560af5c5 |
1566 | (accel-group accel-group) |
1567 | ((gdk:keyval-from-name key) unsigned-int) |
1568 | (modifiers gdk:modifier-type)) |
1569 | |
bbaeff4b |
1570 | (defbinding accel-group-add |
560af5c5 |
1571 | (accel-group key modifiers flags object signal) nil |
1572 | (accel-group accel-group) |
1573 | ((gdk:keyval-from-name key) unsigned-int) |
1574 | (modifiers gdk:modifier-type) |
1575 | (flags accel-flags) |
1576 | (object object) |
1577 | ((name-to-string signal) string)) |
1578 | |
bbaeff4b |
1579 | (defbinding accel-group-add (accel-group key modifiers object) nil |
560af5c5 |
1580 | (accel-group accel-group) |
1581 | ((gdk:keyval-from-name key) unsigned-int) |
1582 | (modifiers gdk:modifier-type) |
1583 | (object object)) |
1584 | |
1585 | |
1586 | ;;; Accelerator Signals |
1587 | |
bbaeff4b |
1588 | (defbinding accel-group-handle-add |
560af5c5 |
1589 | (object signal-id accel-group key modifiers flags) nil |
1590 | (object object) |
1591 | (signal-id unsigned-int) |
1592 | (accel-group accel-group) |
1593 | ((gdk:keyval-from-name key) unsigned-int) |
1594 | (modifiers gdk:modifier-type) |
1595 | (flags accel-flags)) |
1596 | |
bbaeff4b |
1597 | (defbinding accel-group-handle-remove |
560af5c5 |
1598 | (object accel-group key modifiers) nil |
1599 | (object object) |
1600 | (accel-group accel-group) |
1601 | ((gdk:keyval-from-name key) unsigned-int) |
1602 | (modifiers gdk:modifier-type)) |
bbaeff4b |
1603 | |# |