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