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