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