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