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 | |
31700e82 |
18 | ;; $Id: gtk.lisp,v 1.31 2005-01-13 00:17:55 espen Exp $ |
560af5c5 |
19 | |
20 | |
21 | (in-package "GTK") |
22 | |
23 | ;;; Gtk version |
24 | |
6bb23851 |
25 | (defbinding check-version () (copy-of 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 | |
6bb23851 |
42 | (defbinding get-default-language () (copy-of pango:language)) |
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 | |
31700e82 |
68 | (defbinding %accel-group-connect () nil |
69 | (accel-group accel-group) |
70 | (key unsigned-int) |
71 | (modifiers gdk:modifier-type) |
72 | (flags accel-flags) |
73 | (gclosure gclosure)) |
74 | |
75 | (defun accel-group-connect (group accelerator function &optional flags) |
76 | (multiple-value-bind (key modifiers) (accelerator-parse accelerator) |
77 | (let ((gclosure (make-callback-closure function))) |
78 | (%accel-group-connect group key modifiers flags gclosure) |
79 | gclosure))) |
80 | |
81 | (defbinding accel-group-connect-by-path (group path function) nil |
82 | (group accel-group) |
83 | (path string) |
84 | ((make-callback-closure function) gclosure :return)) |
85 | |
86 | (defbinding %accel-group-disconnect (group gclosure) boolean |
87 | (group accel-group) |
88 | (gclosure gclosure)) |
89 | |
90 | (defbinding %accel-group-disconnect-key () boolean |
91 | (group accel-group) |
92 | (key unsigned-int) |
93 | (modifiers gdk:modifier-type)) |
94 | |
95 | (defun accel-group-disconnect (group accelerator) |
96 | (etypecase accelerator |
97 | (gclosure (%accel-group-disconnect group accelerator)) |
98 | (string |
99 | (multiple-value-bind (key modifiers) (accelerator-parse accelerator) |
100 | (%accel-group-disconnect-key group key modifiers))))) |
101 | |
102 | (defbinding accel-group-lock () nil |
103 | (accel-group accel-group)) |
104 | |
105 | (defbinding accel-group-unlock () nil |
106 | (accel-group accel-group)) |
107 | |
108 | (defbinding %accel-groups-activate () boolean |
109 | (object gobject) |
110 | (key unsigned-int) |
111 | (modifiers gdk:modifier-type)) |
112 | |
113 | (defun accel-groups-activate (object accelerator) |
114 | (multiple-value-bind (key modifiers) (accelerator-parse accelerator) |
115 | (%accel-groups-activate object key modifiers))) |
116 | |
117 | (defbinding accel-groups-from-object () (gslist accel-groups) |
118 | (object gobject)) |
119 | |
120 | (defbinding accelerator-valid-p (key &optional mask) boolean |
121 | (key unsigned-int) |
122 | (modifiers gdk:modifier-type)) |
123 | |
124 | (defbinding %accelerator-parse () nil |
125 | (accelerator string) |
126 | (key unsigned-int :out) |
127 | (modifiers gdk:modifier-type :out)) |
128 | |
129 | (defun accelerator-parse (accelerator) |
130 | (multiple-value-bind (key modifiers) (%accelerator-parse accelerator) |
131 | (if (zerop key) |
132 | (error "Invalid accelerator: ~A" accelerator) |
133 | (values key modifiers)))) |
134 | |
135 | (defbinding accelerator-name () string |
136 | (key unsigned-int) |
137 | (modifiers gdk:modifier-type)) |
138 | |
139 | #+gtk2.6 |
140 | (defbinding accelerator-get-label () string |
141 | (key unsigned-int) |
142 | (modifiers gdk:modifier-type)) |
143 | |
144 | (defbinding %accelerator-set-default-mod-mask () nil |
145 | (default-modifiers gdk:modifier-type)) |
146 | |
147 | (defun (setf accelerator-default-modifier-mask) (default-modifiers) |
148 | (%accelerator-set-default-mod-mask default-modifiers)) |
149 | |
150 | (defbinding (accelerator-default-modifier-mask "gtk_accelerator_get_default_mod_mask") () gdk:modifier-type) |
560af5c5 |
151 | |
1047e159 |
152 | |
560af5c5 |
153 | ;;; Acccel label |
154 | |
bbaeff4b |
155 | (defbinding accel-label-refetch () boolean |
560af5c5 |
156 | (accel-label accel-label)) |
157 | |
158 | |
31700e82 |
159 | |
160 | ;;; Accel map |
161 | |
162 | (defbinding %accel-map-add-entry () nil |
163 | (path string) |
164 | (key unsigned-int) |
165 | (modifiers gdk:modifier-type)) |
166 | |
167 | (defun accel-map-add-entry (path accelerator) |
168 | (multiple-value-bind (key modifiers) (accelerator-parse accelerator) |
169 | (%accel-map-add-entry path key modifiers))) |
170 | |
171 | (defbinding accel-map-lookup-entry () boolean |
172 | (path string) |
173 | (key pointer)) ;accel-key)) |
174 | |
175 | (defbinding %accel-map-change-entry () boolean |
176 | (path string) |
177 | (key unsigned-int) |
178 | (modifiers gdk:modifier-type) |
179 | (replace boolean)) |
180 | |
181 | (defun accel-map-change-entry (path accelerator &optional replace) |
182 | (multiple-value-bind (key modifiers) (accelerator-parse accelerator) |
183 | (%accel-map-change-entry path key modifiers replace))) |
184 | |
185 | (defbinding accel-map-load () nil |
186 | (filename pathname)) |
187 | |
188 | (defbinding accel-map-save () nil |
189 | (filename pathname)) |
190 | |
191 | (defbinding accel-map-get () accel-map) |
192 | |
193 | (defbinding accel-map-lock-path () nil |
194 | (path string)) |
195 | |
196 | (defbinding accel-map-unlock-path () nil |
197 | (path string)) |
198 | |
199 | |
200 | |
d76e9fca |
201 | ;;; Accessible |
202 | |
203 | (defbinding accessible-connect-widget-destroyed () nil |
204 | (accessible accessible)) |
205 | |
206 | |
0f476ab5 |
207 | ;;; Adjustment |
560af5c5 |
208 | |
d76e9fca |
209 | (defmethod initialize-instance ((adjustment adjustment) &key value) |
1047e159 |
210 | (prog1 |
211 | (call-next-method) |
212 | ;; we need to make sure that the value is set last, otherwise it |
d76e9fca |
213 | ;; may be outside current limits and ignored |
1047e159 |
214 | (when value |
215 | (setf (slot-value adjustment 'value) value)))) |
216 | |
217 | |
0f476ab5 |
218 | (defbinding adjustment-changed () nil |
219 | (adjustment adjustment)) |
220 | |
221 | (defbinding adjustment-value-changed () nil |
222 | (adjustment adjustment)) |
223 | |
224 | (defbinding adjustment-clamp-page () nil |
225 | (adjustment adjustment) |
226 | (lower single-float) |
227 | (upper single-float)) |
560af5c5 |
228 | |
0f476ab5 |
229 | |
68f519e0 |
230 | ;;; Alignment |
231 | |
232 | (defbinding alignment-set () nil |
233 | (alognment alignment) |
234 | (x-align single-float) |
235 | (y-align single-float) |
236 | (x-scale single-float) |
237 | (y-scale single-float)) |
238 | |
239 | (defbinding alignment-get-padding () nil |
240 | (alognment alignment) |
241 | (top unsigned-int :out) |
242 | (bottom unsigned-int :out) |
243 | (left unsigned-int :out) |
244 | (right unsigned-int :out)) |
245 | |
246 | (defbinding alignment-set-padding () nil |
247 | (alognment alignment) |
248 | (top unsigned-int) |
249 | (bottom unsigned-int) |
250 | (left unsigned-int) |
251 | (right unsigned-int)) |
252 | |
253 | |
0f476ab5 |
254 | ;;; Aspect frame |
255 | |
256 | |
257 | ;;; Bin |
560af5c5 |
258 | |
259 | (defun (setf bin-child) (child bin) |
0f476ab5 |
260 | (when-bind (current-child (bin-child bin)) |
261 | (container-remove bin current-child)) |
560af5c5 |
262 | (container-add bin child) |
263 | child) |
264 | |
cb4bf772 |
265 | (defmethod create-callback-function ((bin bin) function arg1) |
266 | (if (eq arg1 :child) |
267 | #'(lambda (&rest args) |
268 | (apply function (bin-child bin) (rest args))) |
269 | (call-next-method))) |
0f476ab5 |
270 | |
271 | |
272 | ;;; Box |
273 | |
274 | (defbinding box-pack-start () nil |
275 | (box box) |
276 | (child widget) |
277 | (expand boolean) |
278 | (fill boolean) |
279 | (padding unsigned-int)) |
280 | |
281 | (defbinding box-pack-end () nil |
282 | (box box) |
283 | (child widget) |
284 | (expand boolean) |
285 | (fill boolean) |
286 | (padding unsigned-int)) |
287 | |
d76e9fca |
288 | (defun box-pack (box child &key end (expand t) (fill t) (padding 0)) |
1a1949c7 |
289 | (if end |
f5b67f2b |
290 | (box-pack-end box child expand fill padding) |
291 | (box-pack-start box child expand fill padding))) |
0f476ab5 |
292 | |
293 | (defbinding box-reorder-child () nil |
294 | (box box) |
295 | (child widget) |
296 | (position int)) |
297 | |
298 | (defbinding box-query-child-packing () nil |
299 | (box box) |
300 | (child widget) |
301 | (expand boolean :out) |
302 | (fill boolean :out) |
303 | (padding unsigned-int :out) |
304 | (pack-type pack-type :out)) |
305 | |
306 | (defbinding box-set-child-packing () nil |
307 | (box box) |
308 | (child widget) |
309 | (expand boolean) |
310 | (fill boolean) |
311 | (padding unsigned-int) |
312 | (pack-type pack-type)) |
313 | |
314 | |
315 | |
560af5c5 |
316 | ;;; Button |
317 | |
d76e9fca |
318 | (defmethod initialize-instance ((button button) &rest initargs &key stock) |
319 | (if stock |
320 | (apply #'call-next-method button :label stock :use-stock t initargs) |
321 | (call-next-method))) |
322 | |
323 | |
bbaeff4b |
324 | (defbinding button-pressed () nil |
560af5c5 |
325 | (button button)) |
326 | |
0f476ab5 |
327 | (defbinding button-released () nil |
328 | (button button)) |
329 | |
330 | (defbinding button-clicked () nil |
331 | (button button)) |
332 | |
333 | (defbinding button-enter () nil |
334 | (button button)) |
335 | |
336 | (defbinding button-leave () nil |
337 | (button button)) |
338 | |
339 | |
340 | |
341 | ;;; Calendar |
342 | |
343 | (defbinding calendar-select-month () int |
344 | (calendar calendar) |
345 | (month unsigned-int) |
346 | (year unsigned-int)) |
347 | |
348 | (defbinding calendar-select-day () nil |
349 | (calendar calendar) |
350 | (day unsigned-int)) |
351 | |
352 | (defbinding calendar-mark-day () int |
353 | (calendar calendar) |
354 | (day unsigned-int)) |
355 | |
356 | (defbinding calendar-unmark-day () int |
357 | (calendar calendar) |
358 | (day unsigned-int)) |
359 | |
360 | (defbinding calendar-clear-marks () nil |
361 | (calendar calendar)) |
362 | |
d76e9fca |
363 | (defbinding calendar-get-date () nil |
0f476ab5 |
364 | (calendar calendar) |
365 | (year unsigned-int :out) |
366 | (month unsigned-int :out) |
367 | (day unsigned-int :out)) |
368 | |
369 | (defbinding calendar-freeze () nil |
370 | (calendar calendar)) |
371 | |
372 | (defbinding calendar-thaw () nil |
373 | (calendar calendar)) |
374 | |
375 | |
0f476ab5 |
376 | ;;; Check menu item |
377 | |
378 | (defbinding check-menu-item-toggled () nil |
379 | (check-menu-item check-menu-item)) |
380 | |
381 | |
382 | |
383 | ;;; Clipboard |
384 | |
385 | |
386 | ;;; Color selection |
387 | |
388 | (defbinding (color-selection-is-adjusting-p |
389 | "gtk_color_selection_is_adjusting") () boolean |
390 | (colorsel color-selection)) |
391 | |
392 | |
393 | |
394 | ;;; Color selection dialog -- no functions |
395 | |
396 | |
397 | |
1a1949c7 |
398 | ;;;; Combo Box |
0f476ab5 |
399 | |
d76e9fca |
400 | (defmethod initialize-instance ((combo-box combo-box) &rest initargs |
401 | &key model content active) |
402 | (remf initargs :active) |
403 | (if model |
404 | (apply #'call-next-method combo-box initargs) |
405 | (progn |
406 | (apply #'call-next-method combo-box |
407 | :model (make-instance 'list-store :column-types '(string)) |
408 | initargs) |
409 | (unless (typep combo-box 'combo-box-entry) |
410 | (let ((cell (make-instance 'cell-renderer-text))) |
411 | (cell-layout-pack combo-box cell :expand t) |
412 | (cell-layout-add-attribute combo-box cell :text 0))))) |
413 | (when content |
414 | (mapc #'(lambda (text) |
415 | (combo-box-append-text combo-box text)) |
416 | content)) |
417 | (when active |
418 | (setf (combo-box-active combo-box) active))) |
419 | |
1a1949c7 |
420 | |
421 | ;; (defmethod shared-initialize :after ((combo-box combo-box) names &key active) |
422 | ;; (when active |
423 | ;; (signal-emit combo-box 'changed))) |
424 | |
425 | (defbinding combo-box-append-text () nil |
426 | (combo-box combo-box) |
427 | (text string)) |
428 | |
429 | (defbinding combo-box-insert-text () nil |
430 | (combo-box combo-box) |
431 | (position int) |
432 | (text string)) |
433 | |
434 | (defbinding combo-box-prepend-text () nil |
435 | (combo-box combo-box) |
436 | (text string)) |
437 | |
438 | #+gtk2.6 |
439 | (defbinding combo-box-get-active-text () string |
440 | (combo-box combo-box)) |
0f476ab5 |
441 | |
1a1949c7 |
442 | (defbinding combo-box-popup () nil |
443 | (combo-box combo-box)) |
0f476ab5 |
444 | |
1a1949c7 |
445 | (defbinding combo-box-popdown () nil |
446 | (combo-box combo-box)) |
447 | |
448 | |
449 | |
450 | ;;;; Combo Box Entry |
451 | |
d76e9fca |
452 | (defmethod initialize-instance ((combo-box-entry combo-box-entry) &key model) |
1a1949c7 |
453 | (call-next-method) |
454 | (unless model |
455 | (setf (combo-box-entry-text-column combo-box-entry) 0))) |
0f476ab5 |
456 | |
457 | |
48da76bf |
458 | ;;;; Dialog |
0f476ab5 |
459 | |
c49be931 |
460 | (defmethod shared-initialize ((dialog dialog) names &rest initargs |
461 | &key button buttons) |
462 | (declare (ignore button buttons)) |
463 | (prog1 |
464 | (call-next-method) |
465 | (initial-apply-add dialog #'dialog-add-button initargs :button :buttons))) |
48da76bf |
466 | |
0f476ab5 |
467 | |
1047e159 |
468 | (defun %dialog-find-response-id-num (dialog id &optional create-p error-p) |
0f476ab5 |
469 | (or |
1047e159 |
470 | (cadr (assoc id (rest (type-expand-1 'response-type)))) |
40b2615c |
471 | (let ((response-ids (object-data dialog 'response-id-key))) |
0f476ab5 |
472 | (cond |
1047e159 |
473 | ((and response-ids (position id response-ids :test #'equal))) |
474 | (create-p |
475 | (cond |
476 | (response-ids |
477 | (vector-push-extend id response-ids) |
478 | (1- (length response-ids))) |
479 | (t |
480 | (setf |
40b2615c |
481 | (object-data dialog 'response-id-key) |
1047e159 |
482 | (make-array 1 :adjustable t :fill-pointer t :initial-element id)) |
483 | 0))) |
484 | (error-p |
485 | (error "Invalid response: ~A" id)))))) |
0f476ab5 |
486 | |
487 | (defun %dialog-find-response-id (dialog response-id-num) |
488 | (if (< response-id-num 0) |
489 | (car |
490 | (rassoc |
491 | (list response-id-num) |
1047e159 |
492 | (rest (type-expand-1 'response-type)) :test #'equal)) |
40b2615c |
493 | (aref (object-data dialog 'response-id-key) response-id-num ))) |
0f476ab5 |
494 | |
495 | |
48da76bf |
496 | (defmethod signal-connect ((dialog dialog) signal function &key object after) |
497 | (let ((response-id-num (%dialog-find-response-id-num dialog signal))) |
498 | (cond |
499 | (response-id-num |
500 | (call-next-method |
501 | dialog 'response |
502 | #'(lambda (dialog id) |
503 | (when (= id response-id-num) |
504 | (cond |
505 | ((eq object t) (funcall function dialog)) |
506 | (object (funcall function object)) |
507 | (t (funcall function))))) |
508 | :object t :after after)) |
1047e159 |
509 | ((call-next-method))))) |
0f476ab5 |
510 | |
511 | |
48da76bf |
512 | (defbinding dialog-run () nil |
513 | (dialog dialog)) |
0f476ab5 |
514 | |
48da76bf |
515 | (defbinding dialog-response (dialog response-id) nil |
0f476ab5 |
516 | (dialog dialog) |
48da76bf |
517 | ((%dialog-find-response-id-num dialog response-id nil t) int)) |
0f476ab5 |
518 | |
519 | |
520 | (defbinding %dialog-add-button () button |
521 | (dialog dialog) |
522 | (text string) |
523 | (response-id-num int)) |
524 | |
1047e159 |
525 | (defun dialog-add-button (dialog label &optional (response label) |
526 | &key default object after) |
40b2615c |
527 | "Adds a button to the dialog." |
1047e159 |
528 | (let* ((id (if (functionp response) |
529 | label |
530 | response)) |
531 | (id-num (%dialog-find-response-id-num dialog id t)) |
532 | (button (%dialog-add-button dialog label id-num))) |
533 | (when (functionp response) |
534 | (signal-connect dialog id response :object object :after after)) |
535 | (when default |
536 | (%dialog-set-default-response dialog id-num)) |
0f476ab5 |
537 | button)) |
538 | |
539 | |
540 | (defbinding %dialog-add-action-widget () button |
541 | (dialog dialog) |
542 | (action-widget widget) |
543 | (response-id-num int)) |
544 | |
1047e159 |
545 | (defun dialog-add-action-widget (dialog widget &optional (response widget) |
546 | &key default object after) |
547 | (let* ((id (if (functionp response) |
548 | widget |
549 | response)) |
550 | (id-num (%dialog-find-response-id-num dialog id t))) |
551 | (%dialog-add-action-widget dialog widget id-num) |
552 | (when (functionp response) |
553 | (signal-connect dialog id response :object object :after after)) |
554 | (when default |
555 | (%dialog-set-default-response dialog id-num)) |
0f476ab5 |
556 | widget)) |
0f476ab5 |
557 | |
0f476ab5 |
558 | |
48da76bf |
559 | (defbinding %dialog-set-default-response () nil |
560 | (dialog dialog) |
561 | (response-id-num int)) |
0f476ab5 |
562 | |
48da76bf |
563 | (defun dialog-set-default-response (dialog response-id) |
564 | (%dialog-set-default-response |
565 | dialog (%dialog-find-response-id-num dialog response-id nil t))) |
0f476ab5 |
566 | |
48da76bf |
567 | (defbinding dialog-set-response-sensitive (dialog response-id sensitive) nil |
568 | (dialog dialog) |
569 | ((%dialog-find-response-id-num dialog response-id nil t) int) |
570 | (sensitive boolean)) |
0f476ab5 |
571 | |
40b2615c |
572 | #+gtk2.6 |
573 | (defbinding alternative-dialog-button-order-p(&optional screen) |
574 | (screen (or null screen))) |
575 | |
576 | #+gtk2.6 |
577 | (defbinding (dialog-set-alternative-button-order |
578 | "gtk_dialog_set_alternative_button_order_from_array") |
579 | (dialog new-order) |
580 | (dialog dialog) |
581 | ((length new-order) int) |
582 | ((map 'vector #'(lambda (id) |
583 | (%dialog-find-response-id-num dialog id nil t)) |
584 | new-order) (vector int))) |
0f476ab5 |
585 | |
48da76bf |
586 | |
587 | (defmethod container-add ((dialog dialog) (child widget) &rest args) |
1047e159 |
588 | (apply #'container-add (dialog-vbox dialog) child args)) |
48da76bf |
589 | |
590 | (defmethod container-remove ((dialog dialog) (child widget)) |
1047e159 |
591 | (container-remove (dialog-vbox dialog) child)) |
0f476ab5 |
592 | |
48da76bf |
593 | (defmethod container-children ((dialog dialog)) |
1047e159 |
594 | (container-children (dialog-vbox dialog))) |
48da76bf |
595 | |
596 | (defmethod (setf container-children) (children (dialog dialog)) |
1047e159 |
597 | (setf (container-children (dialog-vbox dialog)) children)) |
560af5c5 |
598 | |
560af5c5 |
599 | |
aaa6e6cb |
600 | ;;; Entry |
560af5c5 |
601 | |
aaa6e6cb |
602 | (defbinding entry-get-layout-offsets () nil |
603 | (entry entry) |
604 | (x int :out) |
605 | (y int :out)) |
560af5c5 |
606 | |
d76e9fca |
607 | (defbinding entry-layout-index-to-text-index () int |
608 | (entry entry) |
609 | (layout-index int)) |
610 | |
611 | (defbinding entry-text-index-to-layout-index () int |
612 | (entry entry) |
613 | (text-index int)) |
614 | |
560af5c5 |
615 | |
f45fd227 |
616 | ;;; Entry Completion |
617 | |
618 | (def-callback-marshal %entry-completion-match-func |
619 | (boolean entry-completion string (copy-of tree-iter))) |
620 | |
621 | (defbinding entry-completion-set-match-func (completion function) nil |
622 | (completion entry-completion) |
623 | ((callback %entry-completion-match-func) pointer) |
624 | ((register-callback-function function) unsigned-int) |
625 | ((callback %destroy-user-data) pointer)) |
626 | |
627 | (defbinding entry-completion-complete () nil |
628 | (completion entry-completion)) |
629 | |
630 | #+gtk2.6 |
631 | (defbinding entry-completion-insert-prefix () nil |
632 | (completion entry-completion)) |
633 | |
634 | (defbinding entry-completion-insert-action-text () nil |
635 | (completion entry-completion) |
636 | (index int) |
637 | (text string)) |
638 | |
639 | (defbinding entry-completion-insert-action-markup () nil |
640 | (completion entry-completion) |
641 | (index int) |
642 | (markup string)) |
643 | |
644 | (defbinding entry-completion-delete-action () nil |
645 | (completion entry-completion) |
646 | (index int)) |
647 | |
648 | |
68f519e0 |
649 | ;;; File Chooser |
650 | |
651 | (defmethod initialize-instance ((file-chooser file-chooser) &rest initargs |
652 | &key filter filters shortcut-folder |
653 | shortcut-folders shortcut-folder-uti |
654 | shortcut-folder-uris) |
655 | (declare (ignore filter filters shortcut-folder shortcut-folders |
656 | shortcut-folder-uti shortcut-folder-uris)) |
657 | (prog1 |
658 | (call-next-method) |
659 | (initial-add file-chooser #'file-chooser-add-filter |
660 | initargs :filer :filters) |
661 | (initial-add file-chooser #'file-chooser-add-shortcut-folder |
662 | initargs :shortcut-folder :shortcut-folders) |
663 | (initial-add file-chooser #'file-chooser-add-shortcut-folder-uri |
664 | initargs :shortcut-folder-uri :shortcut-folders-uris))) |
665 | |
666 | |
667 | (defbinding file-chooser-select-filename () boolean |
668 | (file-chooser file-chooser) |
669 | (filename string)) |
670 | |
671 | (defbinding file-chooser-unselect-filename () nil |
672 | (file-chooser file-chooser) |
673 | (filename string)) |
674 | |
675 | (defbinding file-chooser-select-all () boolean |
676 | (file-chooser file-chooser)) |
677 | |
678 | (defbinding file-chooser-unselect-all () boolean |
679 | (file-chooser file-chooser)) |
680 | |
681 | (defbinding file-chooser-get-filenames () (gslist string) |
682 | (file-chooser file-chooser)) |
683 | |
684 | (defbinding file-chooser-select-uri () boolean |
685 | (file-chooser file-chooser) |
686 | (uri string)) |
687 | |
688 | (defbinding file-chooser-unselect-uri () nil |
689 | (file-chooser file-chooser) |
690 | (uri string)) |
691 | |
692 | (defbinding file-chooser-get-uris () (gslist string) |
693 | (file-chooser file-chooser)) |
694 | |
695 | (defbinding file-chooser-add-filter () nil |
696 | (file-chooser file-chooser) |
697 | (filter file-filter)) |
698 | |
699 | (defbinding file-chooser-remove-filter () nil |
700 | (file-chooser file-chooser) |
701 | (filter file-filter)) |
702 | |
703 | (defbinding file-chooser-list-filters () (gslist file-filter) |
704 | (file-chooser file-chooser)) |
705 | |
706 | (defbinding file-chooser-add-shortcut-folder () boolean |
707 | (file-chooser file-chooser) |
708 | (folder string) |
709 | (nil null)) |
710 | |
711 | (defbinding file-chooser-remove-shortcut-folder () nil |
712 | (file-chooser file-chooser) |
713 | (folder string) |
714 | (nil null)) |
715 | |
716 | (defbinding file-chooser-list-shortcut-folders () (gslist string) |
717 | (file-chooser file-chooser)) |
718 | |
719 | (defbinding file-chooser-add-shortcut-folder-uri () boolean |
720 | (file-chooser file-chooser) |
721 | (uri string) |
722 | (nil null)) |
723 | |
724 | (defbinding file-chooser-remove-shortcut-folder-uri () nil |
725 | (file-chooser file-chooser) |
726 | (uri string) |
727 | (nil null)) |
728 | |
729 | (defbinding file-chooser-list-shortcut-folder-uris () (gslist string) |
730 | (file-chooser file-chooser)) |
731 | |
732 | |
733 | ;;; File Filter |
734 | |
735 | (defmethod initialize-instance ((file-filter file-filter) &rest initargs |
736 | &key mime-type mime-types pattern patterns |
737 | pixbuf-formats) |
738 | (declare (ignore mime-type mime-types pattern patterns)) |
739 | (prog1 |
740 | (call-next-method) |
741 | (when pixbuf-formats |
742 | #-gtk2.6(warn "Initarg :PIXBUF-FORMATS not supportet in this version of Gtk") |
743 | #+gtk2.6(file-filter-add-pixbuf-formats file-filter)) |
744 | (initial-add file-filter #'file-filter-add-mime-type |
745 | initargs :mime-type :mime-types) |
746 | (initial-add file-filter #'file-filter-add-pattern |
747 | initargs :pattern :patterns))) |
748 | |
749 | |
750 | (defbinding file-filter-add-mime-type () nil |
751 | (filter file-filter) |
752 | (mime-type string)) |
753 | |
754 | (defbinding file-filter-add-pattern () nil |
755 | (filter file-filter) |
756 | (pattern string)) |
757 | |
758 | #+gtk2.6 |
759 | (defbinding file-filter-add-pixbuf-formats () nil |
760 | (filter file-filter) |
761 | (pattern string)) |
762 | |
763 | (def-callback-marshal %file-filter-func (boolean file-filter-info)) |
764 | |
765 | (defbinding file-filter-add-custom () nil |
766 | (filter file-filter) |
767 | (needed file-filter-flags) |
768 | ((callback %file-filter-func) pointer) |
769 | ((register-callback-function function) unsigned-int) |
770 | ((callback %destroy-user-data) pointer)) |
771 | |
772 | (defbinding file-filter-get-needed () file-filter-flags |
773 | (filter file-filter)) |
774 | |
775 | (defbinding file-filter-filter () boolean |
776 | (filter file-filter) |
777 | (filter-info file-filter-info)) |
778 | |
779 | |
780 | |
1047e159 |
781 | ;;; Image |
782 | |
783 | (defbinding image-set-from-file () nil |
784 | (image image) |
785 | (filename pathname)) |
786 | |
d76e9fca |
787 | (defmethod (setf image-pixmap) ((data vector) (image image)) |
788 | (multiple-value-bind (pixmap mask) (gdk:pixmap-create data) |
789 | (setf (image-pixmap image) pixmap) |
790 | (setf (image-mask image) mask))) |
791 | |
792 | (defmethod initialize-instance ((image image) &rest initargs &key pixmap file) |
793 | (cond |
794 | ((typep pixmap 'vector) |
795 | (multiple-value-bind (pixmap mask) (gdk:pixmap-create pixmap) |
796 | (apply #'call-next-method image :pixmap pixmap :mask mask initargs))) |
797 | (file |
798 | (prog1 |
799 | (call-next-method) |
800 | (image-set-from-file image file))) |
801 | ((call-next-method)))) |
1047e159 |
802 | |
cb4bf772 |
803 | (defun create-image-widget (source &optional mask) |
d76e9fca |
804 | (etypecase source |
805 | (gdk:pixbuf (make-instance 'image :pixbuf source)) |
806 | (string (make-instance 'image :stock source)) |
807 | (pathname (make-instance 'image :file source)) |
808 | ((or list vector) (make-instance 'image :pixmap source)) |
809 | (gdk:pixmap (make-instance 'image :pixmap source :mask mask)))) |
1047e159 |
810 | |
1047e159 |
811 | |
d76e9fca |
812 | ;;; Image menu item |
1047e159 |
813 | |
d76e9fca |
814 | (defmethod initialize-instance ((item image-menu-item) &rest initargs &key image) |
815 | (if (and image (not (typep image 'widget))) |
cb4bf772 |
816 | (apply #'call-next-method item :image (create-image-widget image) initargs) |
d76e9fca |
817 | (call-next-method))) |
1047e159 |
818 | |
d76e9fca |
819 | |
820 | (defmethod (setf image-menu-item-image) ((widget widget) (item image-menu-item)) |
821 | (setf (slot-value item 'image) widget)) |
822 | |
823 | (defmethod (setf image-menu-item-image) (image (item image-menu-item)) |
cb4bf772 |
824 | (setf (image-menu-item-image item) (create-image-widget image))) |
1047e159 |
825 | |
560af5c5 |
826 | |
0f476ab5 |
827 | ;;; Label |
560af5c5 |
828 | |
aaa6e6cb |
829 | (defbinding label-get-layout-offsets () nil |
1047e159 |
830 | (label label) |
aaa6e6cb |
831 | (x int :out) |
832 | (y int :out)) |
833 | |
0f476ab5 |
834 | (defbinding label-select-region () nil |
835 | (label label) |
836 | (start int) |
837 | (end int)) |
560af5c5 |
838 | |
1047e159 |
839 | (defbinding label-get-selection-bounds () boolean |
aaa6e6cb |
840 | (label label) |
841 | (start int :out) |
842 | (end int :out)) |
f36ca6af |
843 | |
560af5c5 |
844 | |
845 | |
846 | ;;; Radio button |
847 | |
e5b416f0 |
848 | (defbinding %radio-button-get-group () pointer |
d520140e |
849 | (radio-button radio-button)) |
850 | |
bbaeff4b |
851 | (defbinding %radio-button-set-group () nil |
d520140e |
852 | (radio-button radio-button) |
853 | (group pointer)) |
560af5c5 |
854 | |
cb4bf772 |
855 | (defmethod add-to-radio-group ((button1 radio-button) (button2 radio-button)) |
d520140e |
856 | "Add BUTTON1 to the group which BUTTON2 belongs to." |
857 | (%radio-button-set-group button1 (%radio-button-get-group button2))) |
858 | |
d76e9fca |
859 | (defmethod initialize-instance ((button radio-button) &key group) |
860 | (prog1 |
861 | (call-next-method) |
862 | (when group |
cb4bf772 |
863 | (add-to-radio-group button group)))) |
560af5c5 |
864 | |
865 | |
560af5c5 |
866 | ;;; Item |
867 | |
bbaeff4b |
868 | (defbinding item-select () nil |
560af5c5 |
869 | (item item)) |
870 | |
bbaeff4b |
871 | (defbinding item-deselect () nil |
560af5c5 |
872 | (item item)) |
873 | |
bbaeff4b |
874 | (defbinding item-toggle () nil |
560af5c5 |
875 | (item item)) |
876 | |
877 | |
878 | |
879 | ;;; Menu item |
880 | |
d76e9fca |
881 | (defmethod initialize-instance ((item menu-item) &key label) |
882 | (prog1 |
883 | (call-next-method) |
884 | (when label |
885 | (setf (menu-item-label item) label)))) |
886 | |
887 | |
f36ca6af |
888 | (defun (setf menu-item-label) (label menu-item) |
889 | (make-instance 'accel-label |
890 | :label label :xalign 0.0 :yalign 0.5 :accel-widget menu-item |
d76e9fca |
891 | :use-underline (menu-item-use-underline-p menu-item) |
892 | :visible t :parent menu-item) |
f36ca6af |
893 | label) |
560af5c5 |
894 | |
f5b67f2b |
895 | (defun menu-item-label (menu-item) |
d76e9fca |
896 | (when (and (slot-boundp menu-item 'child) |
897 | (typep (bin-child menu-item) 'label)) |
898 | (label-label (bin-child menu-item)))) |
f5b67f2b |
899 | |
d76e9fca |
900 | (defbinding menu-item-remove-submenu () nil |
f36ca6af |
901 | (menu-item menu-item)) |
560af5c5 |
902 | |
f5b67f2b |
903 | (defbinding menu-item-set-accel-path () nil |
904 | (menu-item menu-item) |
905 | (accel-path string)) |
906 | |
bbaeff4b |
907 | (defbinding menu-item-select () nil |
f36ca6af |
908 | (menu-item menu-item)) |
560af5c5 |
909 | |
bbaeff4b |
910 | (defbinding menu-item-deselect () nil |
f36ca6af |
911 | (menu-item menu-item)) |
560af5c5 |
912 | |
bbaeff4b |
913 | (defbinding menu-item-activate () nil |
f36ca6af |
914 | (menu-item menu-item)) |
560af5c5 |
915 | |
f5b67f2b |
916 | (defbinding menu-item-toggle-size-request () nil |
917 | (menu-item menu-item) |
918 | (requisition int :out)) |
919 | |
920 | (defbinding menu-item-toggle-size-allocate () nil |
921 | (menu-item menu-item) |
922 | (allocation int)) |
923 | |
560af5c5 |
924 | |
d76e9fca |
925 | ;;; Menu tool button |
926 | |
927 | #+gtk2.6 |
928 | (defbinding menu-tool-button-set-arrow-tip () nil |
929 | (menu-tool-button menu-tool-button) |
930 | (tooltips tooltips) |
931 | (tip-text string) |
932 | (tip-private string)) |
933 | |
934 | |
f4267180 |
935 | ;;; Message dialog |
936 | |
937 | (defmethod initialize-instance ((dialog message-dialog) &rest initargs |
938 | &key (type :info) (buttons :close) ; or :ok? |
939 | flags message parent) |
940 | (remf initargs :parent) |
941 | (setf |
942 | (slot-value dialog 'location) |
943 | (%message-dialog-new parent flags type buttons nil)) |
944 | (message-dialog-set-markup dialog message) |
945 | (apply #'call-next-method dialog initargs)) |
946 | |
947 | |
948 | (defbinding %message-dialog-new () pointer |
949 | (parent (or null window)) |
950 | (flags dialog-flags) |
951 | (type message-type) |
952 | (buttons buttons-type) |
953 | (message (or null string))) |
954 | |
955 | (defbinding %message-dialog-new-with-markup () pointer |
956 | (parent (or null window)) |
957 | (flags dialog-flags) |
958 | (type message-type) |
959 | (buttons buttons-type) |
960 | (message string)) |
961 | |
962 | (defbinding message-dialog-set-markup () nil |
963 | (message-dialog message-dialog) |
964 | (markup string)) |
965 | |
966 | #+gtk2.6 |
967 | (defbinding message-dialog-format-secondary-text () nil |
968 | (message-dialog message-dialog) |
969 | (text string)) |
970 | |
971 | #+gtk2.6 |
972 | (defbinding message-dialog-format-secondary-markup () nil |
973 | (message-dialog message-dialog) |
974 | (markup string)) |
975 | |
976 | |
560af5c5 |
977 | |
f36ca6af |
978 | ;;; Radio menu item |
560af5c5 |
979 | |
e5b416f0 |
980 | (defbinding %radio-menu-item-get-group () pointer |
d520140e |
981 | (radio-menu-item radio-menu-item)) |
982 | |
bbaeff4b |
983 | (defbinding %radio-menu-item-set-group () nil |
d520140e |
984 | (radio-menu-item radio-menu-item) |
985 | (group pointer)) |
986 | |
cb4bf772 |
987 | (defmethod add-to-radio-group ((item1 radio-menu-item) (item2 radio-menu-item)) |
d520140e |
988 | "Add ITEM1 to the group which ITEM2 belongs to." |
989 | (%radio-menu-item-set-group item1 (%radio-menu-item-get-group item2))) |
990 | |
d76e9fca |
991 | (defmethod initialize-instance ((item radio-menu-item) &key group) |
f5b67f2b |
992 | (prog1 |
993 | (call-next-method) |
d76e9fca |
994 | (when group |
cb4bf772 |
995 | (add-to-radio-group item group)))) |
996 | |
d520140e |
997 | |
560af5c5 |
998 | |
d76e9fca |
999 | ;;; Radio tool button |
1000 | |
1001 | (defbinding %radio-tool-button-get-group () pointer |
1002 | (radio-tool-button radio-tool-button)) |
1003 | |
1004 | (defbinding %radio-tool-button-set-group () nil |
1005 | (radio-tool-button radio-tool-button) |
1006 | (group pointer)) |
1007 | |
cb4bf772 |
1008 | (defmethod add-to-radio-group ((button1 radio-tool-button) (button2 radio-tool-button)) |
d76e9fca |
1009 | "Add BUTTON1 to the group which BUTTON2 belongs to." |
1010 | (%radio-tool-button-set-group button1 (%radio-tool-button-get-group button2))) |
1011 | |
cb4bf772 |
1012 | (defmethod add-activate-callback ((widget widget) function &key object after) |
1013 | (if object |
1014 | (signal-connect widget 'clicked |
1015 | #'(lambda (object) |
1016 | (when (slot-value widget 'active) |
1017 | (funcall function object (slot-value widget 'value)))) |
1018 | :object object :after after) |
1019 | (signal-connect widget 'clicked |
1020 | #'(lambda () |
1021 | (when (slot-value widget 'active) |
1022 | (funcall function (slot-value widget 'value)))) |
1023 | :after after))) |
d76e9fca |
1024 | |
1025 | (defmethod initialize-instance ((button radio-tool-button) &key group) |
1026 | (prog1 |
1027 | (call-next-method) |
1028 | (when group |
cb4bf772 |
1029 | (add-to-radio-group button group)))) |
1030 | |
d76e9fca |
1031 | |
560af5c5 |
1032 | |
aaa6e6cb |
1033 | ;;; Toggle button |
1034 | |
1035 | (defbinding toggle-button-toggled () nil |
1036 | (toggle-button toggle-button)) |
1037 | |
1038 | |
560af5c5 |
1039 | ;;; Window |
1040 | |
c49be931 |
1041 | (defmethod initialize-instance ((window window) &rest initargs |
1042 | &key accel-group accel-groups) |
1043 | (declare (ignore accel-group accel-groups)) |
1044 | (prog1 |
1045 | (call-next-method) |
1046 | (initial-add window #'window-add-accel-group |
1047 | initargs :accel-group :accel-groups))) |
73d58e01 |
1048 | |
1049 | |
7625ebd8 |
1050 | (defbinding window-set-wmclass () nil |
560af5c5 |
1051 | (window window) |
1052 | (wmclass-name string) |
1053 | (wmclass-class string)) |
1054 | |
bbaeff4b |
1055 | (defbinding window-add-accel-group () nil |
560af5c5 |
1056 | (window window) |
1057 | (accel-group accel-group)) |
1058 | |
bbaeff4b |
1059 | (defbinding window-remove-accel-group () nil |
560af5c5 |
1060 | (window window) |
1061 | (accel-group accel-group)) |
1062 | |
bbaeff4b |
1063 | (defbinding window-activate-focus () int |
560af5c5 |
1064 | (window window)) |
1065 | |
bbaeff4b |
1066 | (defbinding window-activate-default () int |
560af5c5 |
1067 | (window window)) |
1068 | |
7625ebd8 |
1069 | (defbinding window-set-default-size (window width height) int |
560af5c5 |
1070 | (window window) |
7625ebd8 |
1071 | ((or width -1) int) |
1072 | ((or height -1) int)) |
560af5c5 |
1073 | |
4d16221f |
1074 | (defbinding %window-set-geometry-hints () nil |
1075 | (window window) |
1076 | (geometry gdk:geometry) |
1077 | (geometry-mask gdk:window-hints)) |
1078 | |
1079 | (defun window-set-geometry-hints (window &key min-width min-height |
1080 | max-width max-height base-width base-height |
1081 | width-inc height-inc min-aspect max-aspect |
1082 | (gravity nil gravity-p) min-size max-size) |
1083 | (let ((geometry (make-instance 'gdk:geometry |
1084 | :min-width (or min-width -1) |
1085 | :min-height (or min-height -1) |
1086 | :max-width (or max-width -1) |
1087 | :max-height (or max-height -1) |
1088 | :base-width (or base-width 0) |
1089 | :base-height (or base-height 0) |
1090 | :width-inc (or width-inc 0) |
1091 | :height-inc (or height-inc 0) |
1092 | :min-aspect (or min-aspect 0) |
1093 | :max-aspect (or max-aspect 0) |
1094 | :gravity gravity)) |
1095 | (mask ())) |
1096 | (when (or min-size min-width min-height) |
1097 | (push :min-size mask)) |
1098 | (when (or max-size max-width max-height) |
1099 | (push :max-size mask)) |
1100 | (when (or base-width base-height) |
1101 | (push :base-size mask)) |
1102 | (when (or width-inc height-inc) |
1103 | (push :resize-inc mask)) |
1104 | (when (or min-aspect max-aspect) |
1105 | (push :aspect mask)) |
1106 | (when gravity-p |
1107 | (push :win-gravity mask)) |
1108 | (%window-set-geometry-hints window geometry mask))) |
560af5c5 |
1109 | |
73d58e01 |
1110 | (defbinding window-list-toplevels () (glist (copy-of window)) |
1111 | "Returns a list of all existing toplevel windows.") |
7625ebd8 |
1112 | |
1113 | (defbinding window-add-mnemonic (window key target) nil |
1114 | (window window) |
1115 | ((gdk:keyval-from-name key) unsigned-int) |
1116 | (target widget)) |
1117 | |
1118 | (defbinding window-remove-mnemonic (window key target) nil |
1119 | (window window) |
1120 | ((gdk:keyval-from-name key) unsigned-int) |
1121 | (target widget)) |
1122 | |
1123 | (defbinding window-mnemonic-activate (window key modifier) nil |
1124 | (window window) |
1125 | ((gdk:keyval-from-name key) unsigned-int) |
1126 | (modifier gdk:modifier-type)) |
1127 | |
4d16221f |
1128 | (defbinding window-activate-key () boolean |
1129 | (window window) |
1130 | (event gdk:key-event)) |
1131 | |
1132 | (defbinding window-propagate-key-event () boolean |
1133 | (window window) |
1134 | (event gdk:key-event)) |
1135 | |
7625ebd8 |
1136 | (defbinding window-present () nil |
1137 | (window window)) |
1138 | |
1139 | (defbinding window-iconify () nil |
1140 | (window window)) |
1141 | |
1142 | (defbinding window-deiconify () nil |
1143 | (window window)) |
1144 | |
1145 | (defbinding window-stick () nil |
1146 | (window window)) |
1147 | |
1148 | (defbinding window-unstick () nil |
1149 | (window window)) |
1150 | |
1151 | (defbinding window-maximize () nil |
1152 | (window window)) |
1153 | |
1154 | (defbinding window-unmaximize () nil |
1155 | (window window)) |
1156 | |
4d16221f |
1157 | (defbinding window-fullscreen () nil |
1158 | (window window)) |
1159 | |
1160 | (defbinding window-unfullscreen () nil |
1161 | (window window)) |
1162 | |
1163 | (defbinding window-set-keep-above () nil |
1164 | (window window) |
1165 | (setting boolean)) |
1166 | |
1167 | (defbinding window-set-keep-below () nil |
1168 | (window window) |
1169 | (setting boolean)) |
1170 | |
7625ebd8 |
1171 | (defbinding window-begin-resize-drag () nil |
1172 | (window window) |
1173 | (edge gdk:window-edge) |
1174 | (button int) |
1175 | (root-x int) (root-y int) |
9adccb27 |
1176 | (timestamp unsigned-int)) |
7625ebd8 |
1177 | |
1178 | (defbinding window-begin-move-drag () nil |
1179 | (window window) |
1180 | (edge gdk:window-edge) |
1181 | (button int) |
1182 | (root-x int) (root-y int) |
9adccb27 |
1183 | (timestamp unsigned-int)) |
7625ebd8 |
1184 | |
1185 | (defbinding window-set-frame-dimensions () nil |
1186 | (window window) |
1187 | (left int) (top int) (rigth int) (bottom int)) |
1188 | |
7625ebd8 |
1189 | (defbinding %window-get-default-size () nil |
1190 | (window window) |
1191 | (width int :out) |
1192 | (height int :out)) |
1193 | |
1194 | (defun window-get-default-size (window) |
1195 | (multiple-value-bind (width height) (%window-get-default-size window) |
1196 | (values (unless (= width -1) width) (unless (= height -1) height)))) |
1197 | |
1198 | (defbinding window-get-frame-dimensions () nil |
1199 | (window window) |
1200 | (left int :out) (top int :out) (rigth int :out) (bottom int :out)) |
1201 | |
1202 | (defbinding %window-get-icon-list () (glist gdk:pixbuf) |
1203 | (window window)) |
1204 | |
7625ebd8 |
1205 | (defbinding window-get-position () nil |
1206 | (window window) |
1207 | (root-x int :out) |
1208 | (root-y int :out)) |
1209 | |
1210 | (defbinding window-get-size () nil |
1211 | (window window) |
1212 | (width int :out) |
1213 | (height int :out)) |
1214 | |
1215 | (defbinding window-move () nil |
1216 | (window window) |
1217 | (x int) |
1218 | (y int)) |
1219 | |
1220 | (defbinding window-parse-geometry () boolean |
1221 | (window window) |
1222 | (geometry string)) |
1223 | |
1224 | (defbinding window-reshow-with-initial-size () nil |
1225 | (window window)) |
1226 | |
1227 | (defbinding window-resize () nil |
1228 | (window window) |
1229 | (width int) |
1230 | (heigth int)) |
1231 | |
4d16221f |
1232 | (defbinding (window-default-icon-list "gtk_window_get_default_icon_list") |
1233 | () (glist gdk:pixbuf)) |
1234 | |
1235 | (defun window-default-icon () |
1236 | (first (window-default-icon-list))) |
1237 | |
1238 | (defbinding %window-set-default-icon-list () nil |
1239 | (icons (glist gdk:pixbuf))) |
1240 | |
1241 | (defun (setf window-default-icon-list) (icons) |
1242 | (%window-set-default-icon-list icons) |
1243 | icons) |
1244 | |
1245 | (defbinding %window-set-default-icon () nil |
1246 | (icons (glist gdk:pixbuf))) |
1247 | |
1248 | (defmethod (setf window-default-icon) ((icon gdk:pixbuf)) |
1249 | (%window-set-default-icon icon) |
1250 | icon) |
1251 | |
1252 | (defmethod (setf window-group) ((group window-group) (window window)) |
1253 | (window-group-add-window group window) |
1254 | group) |
1255 | |
1256 | (defbinding %window-set-default-icon-from-file () boolean |
1257 | (filename pathname) |
1258 | (nil null)) |
1259 | |
1260 | (defmethod (setf window-default-icon) ((icon-file pathname)) |
1261 | (%window-set-default-icon-from-file icon-file) |
1262 | icon-file) |
1263 | |
1264 | (defbinding %window-set-icon-from-file () boolean |
1265 | (window window) |
1266 | (filename pathname) |
1267 | (nil null)) |
1268 | |
1269 | (defmethod (setf window-icon) ((icon-file pathname) (window window)) |
1270 | (%window-set-icon-from-file window icon-file) |
1271 | icon-file) |
1272 | |
1273 | (defbinding window-set-auto-startup-notification () nil |
1274 | (setting boolean)) |
1275 | |
1276 | (defbinding decorated-window-init () nil |
1277 | (window window)) |
1278 | |
1279 | (defbinding decorated-window-calculate-frame-size () nil |
1280 | (window window)) |
1281 | |
1282 | (defbinding decorated-window-set-title () nil |
7625ebd8 |
1283 | (window window) |
4d16221f |
1284 | (title string)) |
7625ebd8 |
1285 | |
4d16221f |
1286 | (defbinding decorated-window-move-resize-window () nil |
1287 | (window window) |
1288 | (x int) |
1289 | (y int) |
1290 | (width int) |
1291 | (heigth int)) |
7625ebd8 |
1292 | |
1293 | |
4d16221f |
1294 | ;;; Window group |
560af5c5 |
1295 | |
4d16221f |
1296 | (defmethod initialize-instance ((window-group window-group) &rest initargs |
1297 | &key window windows) |
1298 | (declare (ignore window windows)) |
1299 | (prog1 |
1300 | (call-next-method) |
1301 | (initial-add window-group #'window-group-add-window |
1302 | initargs :window :windows))) |
560af5c5 |
1303 | |
560af5c5 |
1304 | |
4d16221f |
1305 | (defbinding window-group-add-window () nil |
1306 | (window-group window-group) |
1307 | (window window)) |
560af5c5 |
1308 | |
4d16221f |
1309 | (defbinding window-group-remove-window () nil |
1310 | (window-group window-group) |
1311 | (window window)) |
560af5c5 |
1312 | |
1313 | |
f36ca6af |
1314 | ;;; Scrolled window |
560af5c5 |
1315 | |
560af5c5 |
1316 | (defun (setf scrolled-window-scrollbar-policy) (policy window) |
1317 | (setf (scrolled-window-hscrollbar-policy window) policy) |
1318 | (setf (scrolled-window-vscrollbar-policy window) policy)) |
1319 | |
bbaeff4b |
1320 | (defbinding scrolled-window-add-with-viewport () nil |
560af5c5 |
1321 | (scrolled-window scrolled-window) |
1322 | (child widget)) |
1323 | |
d76e9fca |
1324 | (defmethod initialize-instance ((window scrolled-window) &rest initargs |
1325 | &key policy) |
1326 | (if policy |
1327 | (apply #'call-next-method window |
1328 | :vscrollbar-policy policy :hscrollbar-policy policy initargs) |
1329 | (call-next-method))) |
d520140e |
1330 | |
560af5c5 |
1331 | |
f36ca6af |
1332 | ;;; Statusbar |
560af5c5 |
1333 | |
d76e9fca |
1334 | (defbinding statusbar-get-context-id () unsigned-int |
f36ca6af |
1335 | (statusbar statusbar) |
1336 | (context-description string)) |
560af5c5 |
1337 | |
bbaeff4b |
1338 | (defbinding statusbar-push () unsigned-int |
f36ca6af |
1339 | (statusbar statusbar) |
1340 | (context-id unsigned-int) |
1341 | (text string)) |
560af5c5 |
1342 | |
bbaeff4b |
1343 | (defbinding statusbar-pop () nil |
f36ca6af |
1344 | (statusbar statusbar) |
1345 | (context-id unsigned-int)) |
560af5c5 |
1346 | |
bbaeff4b |
1347 | (defbinding statusbar-remove () nil |
f36ca6af |
1348 | (statusbar statusbar) |
1349 | (context-id unsigned-int) |
1350 | (message-id unsigned-int)) |
560af5c5 |
1351 | |
560af5c5 |
1352 | |
1353 | |
1354 | ;;; Fixed |
1355 | |
bbaeff4b |
1356 | (defbinding fixed-put () nil |
f36ca6af |
1357 | (fixed fixed) |
1358 | (widget widget) |
f5b67f2b |
1359 | (x int) (y int)) |
560af5c5 |
1360 | |
bbaeff4b |
1361 | (defbinding fixed-move () nil |
f36ca6af |
1362 | (fixed fixed) |
1363 | (widget widget) |
f5b67f2b |
1364 | (x int) (y int)) |
560af5c5 |
1365 | |
1366 | |
1367 | |
d520140e |
1368 | ;;; Notebook |
560af5c5 |
1369 | |
68f519e0 |
1370 | (defun %ensure-notebook-position (notebook page) |
f5b67f2b |
1371 | (etypecase page |
68f519e0 |
1372 | (position page) |
f5b67f2b |
1373 | (widget (notebook-page-num notebook page t)))) |
1374 | |
68f519e0 |
1375 | (defun %ensure-notebook-child (notebook position) |
f5b67f2b |
1376 | (typecase position |
1377 | (widget position) |
68f519e0 |
1378 | (t (notebook-get-nth-page notebook position)))) |
f5b67f2b |
1379 | |
1380 | (defbinding (notebook-insert "gtk_notebook_insert_page_menu") |
f36ca6af |
1381 | (notebook position child tab-label &optional menu-label) nil |
1382 | (notebook notebook) |
1383 | (child widget) |
1384 | ((if (stringp tab-label) |
f5b67f2b |
1385 | (make-instance 'label :label tab-label) |
f36ca6af |
1386 | tab-label) widget) |
1387 | ((if (stringp menu-label) |
f5b67f2b |
1388 | (make-instance 'label :label menu-label) |
f36ca6af |
1389 | menu-label) (or null widget)) |
68f519e0 |
1390 | ((%ensure-notebook-position notebook position) position)) |
560af5c5 |
1391 | |
f5b67f2b |
1392 | (defun notebook-append (notebook child tab-label &optional menu-label) |
1393 | (notebook-insert notebook :last child tab-label menu-label)) |
560af5c5 |
1394 | |
f5b67f2b |
1395 | (defun notebook-prepend (notebook child tab-label &optional menu-label) |
1396 | (notebook-insert notebook :first child tab-label menu-label)) |
560af5c5 |
1397 | |
f5b67f2b |
1398 | (defbinding notebook-remove-page (notebook page) nil |
f36ca6af |
1399 | (notebook notebook) |
68f519e0 |
1400 | ((%ensure-notebook-position notebook page) position)) |
560af5c5 |
1401 | |
bbaeff4b |
1402 | (defbinding %notebook-page-num () int |
f36ca6af |
1403 | (notebook notebook) |
1404 | (child widget)) |
1405 | |
f5b67f2b |
1406 | (defun notebook-page-num (notebook child &optional error-p) |
f36ca6af |
1407 | (let ((page-num (%notebook-page-num notebook child))) |
1408 | (if (= page-num -1) |
f5b67f2b |
1409 | (when error-p |
68f519e0 |
1410 | (error "~A is not a page in ~A" child notebook)) |
f36ca6af |
1411 | page-num))) |
1412 | |
bbaeff4b |
1413 | (defbinding notebook-next-page () nil |
f36ca6af |
1414 | (notebook notebook)) |
560af5c5 |
1415 | |
bbaeff4b |
1416 | (defbinding notebook-prev-page () nil |
f36ca6af |
1417 | (notebook notebook)) |
1418 | |
f5b67f2b |
1419 | (defbinding notebook-reorder-child (notebook child position) nil |
1420 | (notebook notebook) |
1421 | (child widget) |
1422 | ((%notebook-position notebook position) int)) |
1423 | |
bbaeff4b |
1424 | (defbinding notebook-popup-enable () nil |
f36ca6af |
1425 | (notebook notebook)) |
1426 | |
bbaeff4b |
1427 | (defbinding notebook-popup-disable () nil |
f36ca6af |
1428 | (notebook notebook)) |
1429 | |
68f519e0 |
1430 | (defbinding notebook-get-nth-page () widget |
f5b67f2b |
1431 | (notebook notebook) |
68f519e0 |
1432 | (page position)) |
f5b67f2b |
1433 | |
68f519e0 |
1434 | (defun %notebook-current-page (notebook) |
1435 | (when (slot-boundp notebook 'current-page-num) |
1436 | (notebook-get-nth-page notebook (notebook-current-page-num notebook)))) |
f5b67f2b |
1437 | |
1438 | (defun (setf notebook-current-page) (page notebook) |
68f519e0 |
1439 | (setf (notebook-current-page notebook) (notebook-page-num notebook page))) |
f5b67f2b |
1440 | |
1047e159 |
1441 | (defbinding (notebook-tab-label "gtk_notebook_get_tab_label") |
1442 | (notebook page) widget |
1443 | (notebook notebook) |
68f519e0 |
1444 | ((%ensure-notebook-child notebook page) widget)) |
f5b67f2b |
1445 | |
1047e159 |
1446 | (defbinding (notebook-tab-label-text "gtk_notebook_get_tab_label_text") |
6bb23851 |
1447 | (notebook page) (copy-of string) |
1047e159 |
1448 | (notebook notebook) |
68f519e0 |
1449 | ((%ensure-notebook-child notebook page) widget)) |
f5b67f2b |
1450 | |
1047e159 |
1451 | (defbinding %notebook-set-tab-label () nil |
1452 | (notebook notebook) |
1453 | (page widget) |
1454 | (tab-label widget)) |
1455 | |
1456 | (defun (setf notebook-tab-label) (tab-label notebook page) |
1457 | (let ((widget (if (stringp tab-label) |
1458 | (make-instance 'label :label tab-label) |
1459 | tab-label))) |
68f519e0 |
1460 | (%notebook-set-tab-label notebook (%ensure-notebook-child notebook page) widget) |
1047e159 |
1461 | widget)) |
f5b67f2b |
1462 | |
f5b67f2b |
1463 | |
1047e159 |
1464 | (defbinding (notebook-menu-label "gtk_notebook_get_menu_label") |
1465 | (notebook page) widget |
1466 | (notebook notebook) |
68f519e0 |
1467 | ((%ensure-notebook-child notebook page) widget)) |
f5b67f2b |
1468 | |
1047e159 |
1469 | (defbinding (notebook-menu-label-text "gtk_notebook_get_menu_label_text") |
6bb23851 |
1470 | (notebook page) (copy-of string) |
1047e159 |
1471 | (notebook notebook) |
68f519e0 |
1472 | ((%ensure-notebook-child notebook page) widget)) |
f5b67f2b |
1473 | |
1047e159 |
1474 | (defbinding %notebook-set-menu-label () nil |
1475 | (notebook notebook) |
1476 | (page widget) |
1477 | (menu-label widget)) |
1478 | |
1479 | (defun (setf notebook-menu-label) (menu-label notebook page) |
1480 | (let ((widget (if (stringp menu-label) |
1481 | (make-instance 'label :label menu-label) |
1482 | menu-label))) |
68f519e0 |
1483 | (%notebook-set-menu-label notebook (%ensure-notebook-child notebook page) widget) |
1047e159 |
1484 | widget)) |
f5b67f2b |
1485 | |
1486 | |
1487 | (defbinding notebook-query-tab-label-packing (notebook page) nil |
f36ca6af |
1488 | (notebook notebook) |
f5b67f2b |
1489 | ((%notebook-child notebook page) widget) |
f36ca6af |
1490 | (expand boolean :out) |
1491 | (fill boolean :out) |
1492 | (pack-type pack-type :out)) |
1493 | |
f5b67f2b |
1494 | (defbinding notebook-set-tab-label-packing |
1495 | (notebook page expand fill pack-type) nil |
f36ca6af |
1496 | (notebook notebook) |
f5b67f2b |
1497 | ((%notebook-child notebook page) widget) |
f36ca6af |
1498 | (expand boolean) |
1499 | (fill boolean) |
1500 | (pack-type pack-type)) |
1501 | |
560af5c5 |
1502 | |
1503 | |
d520140e |
1504 | ;;; Paned |
560af5c5 |
1505 | |
bbaeff4b |
1506 | (defbinding paned-pack1 () nil |
d520140e |
1507 | (paned paned) |
1508 | (child widget) |
1509 | (resize boolean) |
1510 | (shrink boolean)) |
560af5c5 |
1511 | |
bbaeff4b |
1512 | (defbinding paned-pack2 () nil |
d520140e |
1513 | (paned paned) |
1514 | (child widget) |
1515 | (resize boolean) |
1516 | (shrink boolean)) |
560af5c5 |
1517 | |
560af5c5 |
1518 | |
d520140e |
1519 | ;;; Layout |
560af5c5 |
1520 | |
bbaeff4b |
1521 | (defbinding layout-put () nil |
d520140e |
1522 | (layout layout) |
68f519e0 |
1523 | (child widget) |
d520140e |
1524 | (x int) |
1525 | (y int)) |
560af5c5 |
1526 | |
bbaeff4b |
1527 | (defbinding layout-move () nil |
d520140e |
1528 | (layout layout) |
68f519e0 |
1529 | (child widget) |
d520140e |
1530 | (x int) |
1531 | (y int)) |
560af5c5 |
1532 | |
68f519e0 |
1533 | (defbinding layout-set-size () nil |
1534 | (layout layout) |
1535 | (width unsigned-int) |
1536 | (height unsigned-int)) |
1537 | |
1538 | (defbinding layout-get-size () nil |
1539 | (layout layout) |
1540 | (width unsigned-int :out) |
1541 | (height unsigned-int :out)) |
560af5c5 |
1542 | |
1543 | |
560af5c5 |
1544 | ;;; Menu shell |
1545 | |
f5b67f2b |
1546 | (defbinding menu-shell-insert (menu-shell menu-item position) nil |
f36ca6af |
1547 | (menu-shell menu-shell) |
1548 | (menu-item menu-item) |
f5b67f2b |
1549 | ((case position |
1550 | (:first 0) |
1551 | (:last -1) |
1552 | (t position)) int)) |
560af5c5 |
1553 | |
f36ca6af |
1554 | (defun menu-shell-append (menu-shell menu-item) |
f5b67f2b |
1555 | (menu-shell-insert menu-shell menu-item :last)) |
560af5c5 |
1556 | |
f36ca6af |
1557 | (defun menu-shell-prepend (menu-shell menu-item) |
f5b67f2b |
1558 | (menu-shell-insert menu-shell menu-item :fisrt)) |
560af5c5 |
1559 | |
bbaeff4b |
1560 | (defbinding menu-shell-deactivate () nil |
f36ca6af |
1561 | (menu-shell menu-shell)) |
560af5c5 |
1562 | |
bbaeff4b |
1563 | (defbinding menu-shell-select-item () nil |
f36ca6af |
1564 | (menu-shell menu-shell) |
1565 | (menu-item menu-item)) |
560af5c5 |
1566 | |
d76e9fca |
1567 | (defbinding menu-shell-select-first () nil |
1568 | (menu-shell menu-shell) |
1569 | (search-sensitive boolean)) |
1570 | |
bbaeff4b |
1571 | (defbinding menu-shell-deselect () nil |
f36ca6af |
1572 | (menu-shell menu-shell)) |
560af5c5 |
1573 | |
bbaeff4b |
1574 | (defbinding menu-shell-activate-item () nil |
f36ca6af |
1575 | (menu-shell menu-shell) |
1576 | (menu-item menu-item) |
1577 | (fore-deactivate boolean)) |
560af5c5 |
1578 | |
d76e9fca |
1579 | (defbinding menu-shell-cancel () nil |
1580 | (menu-shell menu-shell)) |
560af5c5 |
1581 | |
1582 | |
f5b67f2b |
1583 | ;;; Menu |
560af5c5 |
1584 | |
f5b67f2b |
1585 | (defun %menu-position (menu child) |
1586 | (etypecase child |
1587 | (int child) |
1588 | (keyword (case child |
1589 | (:first 0) |
1590 | (:last -1) |
1047e159 |
1591 | (t (error "Invalid position keyword: ~A" child)))) |
f5b67f2b |
1592 | (widget (menu-child-position menu child)))) |
560af5c5 |
1593 | |
1594 | |
f5b67f2b |
1595 | (defbinding menu-reorder-child (menu menu-item position) nil |
1596 | (menu menu) |
1597 | (menu-item menu-item) |
1598 | ((%menu-position menu position) int)) |
560af5c5 |
1599 | |
d76e9fca |
1600 | (defbinding menu-attach () nil |
1601 | (menu menu) |
1602 | (menu-item menu-item) |
1603 | (left-attach unsigned-int) |
1604 | (right-attach unsigned-int) |
1605 | (top-attach unsigned-int) |
1606 | (bottom-attach unsigned-int)) |
1607 | |
1608 | (def-callback-marshal %menu-position-func (nil (menu menu) (x int) (y int) (push-in boolean))) |
560af5c5 |
1609 | |
f5b67f2b |
1610 | (defbinding %menu-popup () nil |
1611 | (menu menu) |
1612 | (parent-menu-shell (or null menu-shell)) |
1613 | (parent-menu-item (or null menu-item)) |
1614 | (callback-func (or null pointer)) |
1615 | (callback-id unsigned-int) |
1616 | (button unsigned-int) |
1617 | (activate-time (unsigned 32))) |
1618 | |
1619 | (defun menu-popup (menu button activate-time &key callback parent-menu-shell |
1620 | parent-menu-item) |
1621 | (if callback |
1a1949c7 |
1622 | (with-callback-function (id callback) |
1623 | (%menu-popup |
1624 | menu parent-menu-shell parent-menu-item |
d76e9fca |
1625 | (callback %menu-position-func) id button activate-time)) |
f5b67f2b |
1626 | (%menu-popup |
1627 | menu parent-menu-shell parent-menu-item nil 0 button activate-time))) |
1628 | |
1629 | (defbinding menu-set-accel-path () nil |
1630 | (menu menu) |
1631 | (accel-path string)) |
560af5c5 |
1632 | |
bbaeff4b |
1633 | (defbinding menu-reposition () nil |
f36ca6af |
1634 | (menu menu)) |
560af5c5 |
1635 | |
bbaeff4b |
1636 | (defbinding menu-popdown () nil |
f36ca6af |
1637 | (menu menu)) |
560af5c5 |
1638 | |
f5b67f2b |
1639 | (defun menu-child-position (menu child) |
1640 | (position child (container-children menu))) |
1641 | |
1642 | (defun menu-active-num (menu) |
1643 | (menu-child-position menu (menu-active menu))) |
1644 | |
bbaeff4b |
1645 | (defbinding %menu-set-active () nil |
f36ca6af |
1646 | (menu menu) |
1647 | (index unsigned-int)) |
560af5c5 |
1648 | |
f5b67f2b |
1649 | (defun (setf menu-active) (menu child) |
1650 | (%menu-set-active menu (%menu-position menu child)) |
1651 | child) |
d520140e |
1652 | |
d76e9fca |
1653 | (defcallback %menu-detach-func (nil (widget widget) (menu menu)) |
1654 | (funcall (object-data menu 'detach-func) widget menu)) |
1655 | |
1656 | (defbinding %menu-attach-to-widget () nil |
1657 | (menu menu) |
1658 | (widget widget) |
1659 | ((callback %menu-detach-func) pointer)) |
1660 | |
1661 | (defun menu-attach-to-widget (menu widget function) |
1662 | (setf (object-data menu 'detach-func) function) |
1663 | (%menu-attach-to-widget menu widget)) |
1664 | |
1665 | (defbinding menu-detach () nil |
1666 | (menu menu)) |
1667 | |
1668 | #+gtk2.6 |
1669 | (defbinding menu-get-for-attach-widget () (copy-of (glist widget)) |
1670 | (widget widget)) |
1671 | |
1672 | (defbinding menu-set-monitor () nil |
1673 | (menu menu) |
1674 | (monitor-num int)) |
560af5c5 |
1675 | |
1676 | |
f36ca6af |
1677 | ;;; Table |
560af5c5 |
1678 | |
bbaeff4b |
1679 | (defbinding table-resize () nil |
f36ca6af |
1680 | (table table) |
1681 | (rows unsigned-int) |
1682 | (columns unsigned-int)) |
560af5c5 |
1683 | |
bbaeff4b |
1684 | (defbinding table-attach (table child left right top bottom |
c49be931 |
1685 | &key options x-options y-options |
1686 | (x-padding 0) (y-padding 0)) nil |
f36ca6af |
1687 | (table table) |
1688 | (child widget) |
1689 | (left unsigned-int) |
1690 | (right unsigned-int) |
1691 | (top unsigned-int) |
1692 | (bottom unsigned-int) |
c49be931 |
1693 | ((append (mklist options) (mklist x-options)) attach-options) |
1694 | ((append (mklist options) (mklist y-options)) attach-options) |
f36ca6af |
1695 | (x-padding unsigned-int) |
1696 | (y-padding unsigned-int)) |
1697 | |
e5b416f0 |
1698 | |
bbaeff4b |
1699 | (defbinding %table-set-row-spacing () nil |
f36ca6af |
1700 | (table table) |
1701 | (row unsigned-int) |
1702 | (spacing unsigned-int)) |
1703 | |
e5b416f0 |
1704 | (defbinding %table-set-row-spacings () nil |
1705 | (table table) |
1706 | (spacing unsigned-int)) |
1707 | |
1708 | (defun (setf table-row-spacing) (spacing table &optional row) |
1709 | (if row |
1710 | (%table-set-row-spacing table row spacing) |
1711 | (%table-set-row-spacings table spacing)) |
f36ca6af |
1712 | spacing) |
1713 | |
e5b416f0 |
1714 | (defbinding %table-get-row-spacing () unsigned-int |
f36ca6af |
1715 | (table table) |
e5b416f0 |
1716 | (row unsigned-int)) |
1717 | |
1718 | (defbinding %table-get-default-row-spacing () unsigned-int |
1719 | (table table)) |
1720 | |
1721 | (defun table-row-spacing (table &optional row) |
1722 | (if row |
1723 | (%table-get-row-spacing table row) |
1724 | (%table-get-default-row-spacing table))) |
1725 | |
f36ca6af |
1726 | |
bbaeff4b |
1727 | (defbinding %table-set-col-spacing () nil |
f36ca6af |
1728 | (table table) |
1729 | (col unsigned-int) |
1730 | (spacing unsigned-int)) |
1731 | |
e5b416f0 |
1732 | (defbinding %table-set-col-spacings () nil |
1733 | (table table) |
1734 | (spacing unsigned-int)) |
1735 | |
1736 | (defun (setf table-col-spacing) (spacing table &optional col) |
1737 | (if col |
1738 | (%table-set-col-spacing table col spacing) |
1739 | (%table-set-col-spacings table spacing)) |
f36ca6af |
1740 | spacing) |
1741 | |
e5b416f0 |
1742 | (defbinding %table-get-col-spacing () unsigned-int |
f36ca6af |
1743 | (table table) |
e5b416f0 |
1744 | (col unsigned-int)) |
1745 | |
1746 | (defbinding %table-get-default-col-spacing () unsigned-int |
1747 | (table table)) |
1748 | |
1749 | (defun table-col-spacing (table &optional col) |
1750 | (if col |
1751 | (%table-get-col-spacing table col) |
1752 | (%table-get-default-col-spacing table))) |
1753 | |
1754 | |
f36ca6af |
1755 | |
1756 | ;;; Toolbar |
1757 | |
cb4bf772 |
1758 | (defmethod initialize-instance ((toolbar toolbar) &rest initargs &key tooltips) |
1759 | (if (eq tooltips t) |
1760 | (apply #'call-next-method toolbar |
1761 | :tooltips (make-instance 'tooltips) initargs) |
1762 | (call-next-method))) |
560af5c5 |
1763 | |
cb4bf772 |
1764 | (defbinding %toolbar-insert () nil |
f5b67f2b |
1765 | (toolbar toolbar) |
cb4bf772 |
1766 | (tool-item tool-item) |
1767 | (position position)) |
f36ca6af |
1768 | |
cb4bf772 |
1769 | (defun toolbar-insert (toolbar tool-item &optional (position :end)) |
1770 | (%toolbar-insert toolbar tool-item position) |
1771 | (%tool-item-update-tooltips tool-item)) |
f5b67f2b |
1772 | |
cb4bf772 |
1773 | (defbinding toolbar-get-item-index () int |
1774 | (toolbar toolbar) |
1775 | (item tool-item)) |
f36ca6af |
1776 | |
cb4bf772 |
1777 | (defbinding toolbar-get-nth-item () tool-item |
1778 | (toolbar toolbar) |
1779 | (n int)) |
f36ca6af |
1780 | |
cb4bf772 |
1781 | (defbinding toolbar-get-drop-index () int |
1782 | (toolbar toolbar) |
1783 | (x int) (y int)) |
f36ca6af |
1784 | |
cb4bf772 |
1785 | (defbinding toolbar-set-drop-highlight-item () nil |
1786 | (toolbar toolbar) |
1787 | (tool-item tool-item) |
1788 | (index int)) |
f36ca6af |
1789 | |
560af5c5 |
1790 | |
cb4bf772 |
1791 | ;;; Tool button |
560af5c5 |
1792 | |
cb4bf772 |
1793 | (defmethod initialize-instance ((button tool-button) &rest initargs &key icon) |
1794 | (if (and icon (not (typep icon 'widget))) |
1795 | (apply #'call-next-method button :icon (create-image-widget icon) initargs) |
1796 | (call-next-method))) |
560af5c5 |
1797 | |
1798 | |
cb4bf772 |
1799 | ;;; Tool item |
560af5c5 |
1800 | |
cb4bf772 |
1801 | (defbinding tool-item-set-tooltip () nil |
1802 | (tool-item tool-item) |
1803 | (tooltips tooltips) |
1804 | (tip-text string) |
1805 | (tip-private string)) |
560af5c5 |
1806 | |
560af5c5 |
1807 | |
cb4bf772 |
1808 | (defun %tool-item-update-tooltips (tool-item) |
1809 | (when (and |
1810 | (slot-boundp tool-item 'parent) |
1811 | (or |
1812 | (user-data-p tool-item 'tip-text) |
1813 | (user-data-p tool-item 'tip-private))) |
1814 | (tool-item-set-tooltip |
1815 | tool-item (toolbar-tooltips (widget-parent tool-item)) |
1816 | (or (user-data tool-item 'tip-text) "") |
1817 | (or (user-data tool-item 'tip-private) "")))) |
1818 | |
1819 | (defmethod (setf tool-item-tip-text) ((tip-text string) (tool-item tool-item)) |
1820 | (setf (user-data tool-item 'tip-text) tip-text) |
1821 | (%tool-item-update-tooltips tool-item) |
1822 | tip-text) |
1823 | |
1824 | (defmethod (setf tool-item-tip-private) ((tip-private string) (tool-item tool-item)) |
1825 | (setf (user-data tool-item 'tip-private) tip-private) |
1826 | (%tool-item-update-tooltips tool-item) |
1827 | tip-private) |
1828 | |
1829 | (defmethod container-add ((toolbar toolbar) (tool-item tool-item) &rest args) |
1830 | (declare (ignore args)) |
1831 | (prog1 |
1832 | (call-next-method) |
1833 | (%tool-item-update-tooltips tool-item))) |
560af5c5 |
1834 | |
d76e9fca |
1835 | |
1836 | (defbinding tool-item-retrieve-proxy-menu-item () widget |
1837 | (tool-item tool-item)) |
1838 | |
1839 | (defbinding (tool-item-proxy-menu-item |
1840 | "gtk_tool_item_get_proxy_menu_item") () menu-item |
1841 | (tool-item tool-item) |
1842 | (menu-item-id string)) |
1843 | |
1844 | (defbinding %tool-item-set-proxy-menu-item () nil |
1845 | (tool-item tool-item) |
1846 | (menu-item-id string) |
1847 | (menu-item menu-item)) |
1848 | |
1849 | (defun (setf tool-item-proxy-menu-item) (menu-item menu-item-id tool-item) |
1850 | (%tool-item-set-proxy-menu-item menu-item-id tool-item menu-item) |
1851 | menu-item) |
1852 | |
1853 | #+gtk2.6 |
1854 | (defbinding tool-item-rebuild-menu () nil |
1855 | (tool-item tool-item)) |
1856 | |
1857 | |
bbaeff4b |
1858 | ;;; Editable |
1047e159 |
1859 | |
bbaeff4b |
1860 | (defbinding editable-select-region (editable &optional (start 0) end) nil |
f36ca6af |
1861 | (editable editable) |
1862 | (start int) |
1863 | ((or end -1) int)) |
560af5c5 |
1864 | |
1047e159 |
1865 | (defbinding editable-get-selection-bounds (editable) nil |
1866 | (editable editable) |
1867 | (start int :out) |
1868 | (end int :out)) |
1869 | |
d76e9fca |
1870 | (defbinding editable-insert-text (editable text &optional (position 0)) nil |
f36ca6af |
1871 | (editable editable) |
1872 | (text string) |
1873 | ((length text) int) |
cb4bf772 |
1874 | (position position-type :in-out)) |
560af5c5 |
1875 | |
f36ca6af |
1876 | (defun editable-append-text (editable text) |
1877 | (editable-insert-text editable text nil)) |
560af5c5 |
1878 | |
f36ca6af |
1879 | (defun editable-prepend-text (editable text) |
1880 | (editable-insert-text editable text 0)) |
560af5c5 |
1881 | |
bbaeff4b |
1882 | (defbinding editable-delete-text (editable &optional (start 0) end) nil |
f36ca6af |
1883 | (editable editable) |
1884 | (start int) |
1885 | ((or end -1) int)) |
560af5c5 |
1886 | |
bbaeff4b |
1887 | (defbinding (editable-text "gtk_editable_get_chars") |
f36ca6af |
1888 | (editable &optional (start 0) end) string |
1889 | (editable editable) |
1890 | (start int) |
1891 | ((or end -1) int)) |
560af5c5 |
1892 | |
f36ca6af |
1893 | (defun (setf editable-text) (text editable) |
1894 | (if text |
1895 | (editable-delete-text |
1896 | editable |
1897 | (editable-insert-text editable text)) |
1898 | (editable-delete-text editable)) |
1899 | text) |
560af5c5 |
1900 | |
bbaeff4b |
1901 | (defbinding editable-cut-clipboard () nil |
f36ca6af |
1902 | (editable editable)) |
560af5c5 |
1903 | |
bbaeff4b |
1904 | (defbinding editable-copy-clipboard () nil |
f36ca6af |
1905 | (editable editable)) |
560af5c5 |
1906 | |
bbaeff4b |
1907 | (defbinding editable-paste-clipboard () nil |
f36ca6af |
1908 | (editable editable)) |
560af5c5 |
1909 | |
bbaeff4b |
1910 | (defbinding editable-delete-selection () nil |
f36ca6af |
1911 | (editable editable)) |
560af5c5 |
1912 | |
560af5c5 |
1913 | |
560af5c5 |
1914 | |
f36ca6af |
1915 | ;;; Spin button |
560af5c5 |
1916 | |
d76e9fca |
1917 | (defbinding spin-button-configure () nil |
1918 | (spin-button spin-button) |
1919 | (adjustment adjustment) |
1920 | (climb-rate double-float) |
1921 | (digits unsigned-int)) |
1922 | |
1923 | (defbinding spin-button-set-range () nil |
1924 | (spin-button spin-button) |
1925 | (min double-float) |
1926 | (max double-float)) |
1927 | |
1928 | (defbinding spin-button-get-range () nil |
1929 | (spin-button spin-button) |
1930 | (min double-float :out) |
1931 | (max double-float :out)) |
1932 | |
f36ca6af |
1933 | (defun spin-button-value-as-int (spin-button) |
1934 | (round (spin-button-value spin-button))) |
560af5c5 |
1935 | |
bbaeff4b |
1936 | (defbinding spin-button-spin () nil |
f36ca6af |
1937 | (spin-button spin-button) |
1938 | (direction spin-type) |
1939 | (increment single-float)) |
560af5c5 |
1940 | |
bbaeff4b |
1941 | (defbinding spin-button-update () nil |
f36ca6af |
1942 | (spin-button spin-button)) |
560af5c5 |
1943 | |
1944 | |
1945 | |
1946 | ; ;;; Ruler |
1947 | |
bbaeff4b |
1948 | (defbinding ruler-set-range () nil |
f36ca6af |
1949 | (ruler ruler) |
1950 | (lower single-float) |
1951 | (upper single-float) |
1952 | (position single-float) |
1953 | (max-size single-float)) |
560af5c5 |
1954 | |
68f519e0 |
1955 | (defbinding ruler-get-range () nil |
1956 | (ruler ruler) |
1957 | (lower single-float :out) |
1958 | (upper single-float :out) |
1959 | (position single-float :out) |
1960 | (max-size single-float :out)) |
560af5c5 |
1961 | |
560af5c5 |
1962 | |
560af5c5 |
1963 | |
d520140e |
1964 | ;;; Range |
560af5c5 |
1965 | |
1047e159 |
1966 | (defun range-lower (range) |
1967 | (adjustment-lower (range-adjustment range))) |
560af5c5 |
1968 | |
1047e159 |
1969 | (defun range-upper (range) |
1970 | (adjustment-upper (range-adjustment range))) |
560af5c5 |
1971 | |
1047e159 |
1972 | (defun (setf range-lower) (value range) |
1973 | (setf (adjustment-lower (range-adjustment range)) value)) |
560af5c5 |
1974 | |
1047e159 |
1975 | (defun (setf range-upper) (value range) |
1976 | (setf (adjustment-upper (range-adjustment range)) value)) |
560af5c5 |
1977 | |
1047e159 |
1978 | (defun range-page-increment (range) |
1979 | (adjustment-page-increment (range-adjustment range))) |
560af5c5 |
1980 | |
1047e159 |
1981 | (defun range-step-increment (range) |
1982 | (adjustment-step-increment (range-adjustment range))) |
560af5c5 |
1983 | |
1047e159 |
1984 | (defun (setf range-page-increment) (value range) |
1985 | (setf (adjustment-page-increment (range-adjustment range)) value)) |
560af5c5 |
1986 | |
1047e159 |
1987 | (defun (setf range-step-increment) (value range) |
1988 | (setf (adjustment-step-increment (range-adjustment range)) value)) |
560af5c5 |
1989 | |
1047e159 |
1990 | (defbinding range-set-range () nil |
d520140e |
1991 | (range range) |
1047e159 |
1992 | (lower double-float) |
1993 | (upper double-float)) |
560af5c5 |
1994 | |
1047e159 |
1995 | (defbinding range-set-increments () nil |
d520140e |
1996 | (range range) |
1047e159 |
1997 | (step double-float) |
1998 | (page double-float)) |
560af5c5 |
1999 | |
560af5c5 |
2000 | |
d520140e |
2001 | ;;; Scale |
560af5c5 |
2002 | |
68f519e0 |
2003 | (defbinding scale-get-layout-offsets () nil |
2004 | (scale scale) |
2005 | (x int :out) |
2006 | (y int :out)) |
560af5c5 |
2007 | |
560af5c5 |
2008 | |
d520140e |
2009 | ;;; Progress bar |
560af5c5 |
2010 | |
bbaeff4b |
2011 | (defbinding progress-bar-pulse () nil |
d520140e |
2012 | (progress-bar progress-bar)) |
560af5c5 |
2013 | |
2014 | |
c49be931 |
2015 | ;;; Size group |
2016 | |
2017 | (defmethod initialize-instance ((size-group size-group) &rest initargs |
2018 | &key widget widgets) |
2019 | (declare (ignore widget widgets)) |
2020 | (prog1 |
2021 | (call-next-method) |
2022 | (initial-add size-group #'size-group-add-widget |
2023 | initargs :widget :widgets))) |
2024 | |
2025 | |
2026 | (defbinding size-group-add-widget () nil |
2027 | (size-group size-group) |
2028 | (widget widget)) |
2029 | |
2030 | (defbinding size-group-remove-widget () nil |
2031 | (size-group size-group) |
2032 | (widget widget)) |
2033 | |
560af5c5 |
2034 | |
f5b67f2b |
2035 | ;;; Stock items |
2036 | |
73d58e01 |
2037 | (defbinding %stock-item-copy () pointer |
2038 | (location pointer)) |
2039 | |
2040 | (defbinding %stock-item-free () nil |
2041 | (location pointer)) |
f5b67f2b |
2042 | |
73d58e01 |
2043 | (defmethod reference-foreign ((class (eql (find-class 'stock-item))) location) |
2044 | (%stock-item-copy location)) |
2045 | |
2046 | (defmethod unreference-foreign ((class (eql (find-class 'stock-item))) location) |
2047 | (%stock-item-free location)) |
2048 | |
2049 | (defbinding stock-add (stock-item) nil |
2050 | (stock-item stock-item) |
2051 | (1 unsigned-int)) |
2052 | |
2053 | (defbinding stock-list-ids () (gslist string)) |
2054 | |
2055 | (defbinding %stock-lookup () boolean |
2056 | (stock-id string) |
2057 | (location pointer)) |
2058 | |
2059 | (defun stock-lookup (stock-id) |
2060 | (let ((location |
2061 | (allocate-memory (proxy-instance-size (find-class 'stock-item))))) |
2062 | (unwind-protect |
2063 | (when (%stock-lookup stock-id location) |
2064 | (ensure-proxy-instance 'stock-item (%stock-item-copy location))) |
2065 | (deallocate-memory location)))) |
560af5c5 |
2066 | |
2067 | |
2068 | ;;; Tooltips |
2069 | |
bbaeff4b |
2070 | (defbinding tooltips-enable () nil |
d520140e |
2071 | (tooltips tooltips)) |
560af5c5 |
2072 | |
bbaeff4b |
2073 | (defbinding tooltips-disable () nil |
d520140e |
2074 | (tooltips tooltips)) |
560af5c5 |
2075 | |
e5b416f0 |
2076 | (defun (setf tooltips-enabled-p) (enable tooltips) |
2077 | (if enable |
2078 | (tooltips-enable tooltips) |
2079 | (tooltips-disable tooltips))) |
2080 | |
bbaeff4b |
2081 | (defbinding tooltips-set-tip () nil |
d520140e |
2082 | (tooltips tooltips) |
2083 | (widget widget) |
2084 | (tip-text string) |
2085 | (tip-private string)) |
560af5c5 |
2086 | |
d76e9fca |
2087 | (defbinding tooltips-data-get () tooltips-data |
2088 | (widget widget)) |
2089 | |
bbaeff4b |
2090 | (defbinding tooltips-force-window () nil |
d520140e |
2091 | (tooltips tooltips)) |
560af5c5 |
2092 | |
d76e9fca |
2093 | (defbinding tooltips-get-info-from-tip-window () boolean |
2094 | (tip-window window) |
2095 | (tooltips tooltips :out) |
2096 | (current-widget widget :out)) |
560af5c5 |
2097 | |
2098 | |
d520140e |
2099 | ;;; Rc |
560af5c5 |
2100 | |
bbaeff4b |
2101 | (defbinding rc-add-default-file (filename) nil |
d520140e |
2102 | ((namestring (truename filename)) string)) |
560af5c5 |
2103 | |
bbaeff4b |
2104 | (defbinding rc-parse (filename) nil |
d520140e |
2105 | ((namestring (truename filename)) string)) |
560af5c5 |
2106 | |
bbaeff4b |
2107 | (defbinding rc-parse-string () nil |
d520140e |
2108 | (rc-string string)) |
560af5c5 |
2109 | |
bbaeff4b |
2110 | (defbinding rc-reparse-all () nil) |
560af5c5 |
2111 | |
bbaeff4b |
2112 | (defbinding rc-get-style () style |
d520140e |
2113 | (widget widget)) |