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