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