chiark / gitweb /
Added selection in list and tree widgets
[clg] / gtk / gtktypes.lisp
CommitLineData
560af5c5 1;; Common Lisp bindings for GTK+ v2.0.x
56460319 2;; Copyright (C) 1999-2001 Espen S. Johnsen <espen@users.sourceforge.org>
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
f4175703 18;; $Id: gtktypes.lisp,v 1.20 2004-11-21 17:57:56 espen Exp $
560af5c5 19
20
21(in-package "GTK")
22
2719586f 23(defclass requisition (boxed)
24 ((width
25 :allocation :alien
26 :accessor requisition-width
27 :initarg :width
28 :type int)
29 (height
30 :allocation :alien
31 :accessor requisition-height
32 :initarg :height
33 :type int))
1047e159 34 (:metaclass boxed-class))
35
2719586f 36
e6d40e16 37(defclass allocation (struct)
38 ((x
39 :allocation :alien
40 :accessor allocation-width
41 :initarg :x
42 :type int)
43 (y
44 :allocation :alien
45 :accessor allocation-width
46 :initarg :width
47 :type int)
48 (width
49 :allocation :alien
50 :accessor allocation-width
51 :initarg :width
52 :type int)
53 (height
54 :allocation :alien
55 :accessor allocation-height
56 :initarg :height
57 :type int))
9adccb27 58 (:metaclass struct-class))
e6d40e16 59
2719586f 60(defclass border (boxed)
61 ((left
62 :allocation :alien
63 :accessor border-left
64 :initarg :left
65 :type int)
66 (right
67 :allocation :alien
68 :accessor border-right
69 :initarg :right
70 :type int)
71 (top
72 :allocation :alien
73 :accessor border-top
74 :initarg :top
75 :type int)
76 (bottom
77 :allocation :alien
78 :accessor border-bottom
79 :initarg :bottom
80 :type int))
1047e159 81 (:metaclass boxed-class))
2719586f 82
f5b67f2b 83(defclass stock-item (struct)
84 ((id
85 :allocation :alien
86 :accessor stock-item-id
87 :initarg :id
88 :type string)
89 (label
90 :allocation :alien
91 :accessor stock-item-label
92 :initarg :label
93 :type string)
94 (modifier
95 :allocation :alien
96 :accessor stock-item-modifier
97 :initarg :modifier
98 :type gdk:modifier-type)
99 (keyval
100 :allocation :alien
101 :accessor stock-item-keyval
102 :initarg :keyval
103 :type int)
104 (translation-domain
105 :allocation :alien
106 :accessor stock-item-translation-domain
107 :initarg :translation-domain
108 :type string))
9adccb27 109 (:metaclass static-struct-class))
f5b67f2b 110
2a8752b0 111;; We don't really need to access any of these slots, but we need to
112;; specify the size of the struct somehow
113(defclass tree-iter (boxed)
114 ((stamp :allocation :alien :type int)
115 (user-data :allocation :alien :type pointer)
116 (user-data2 :allocation :alien :type pointer)
117 (user-data3 :allocation :alien :type pointer))
118 (:metaclass boxed-class))
119
120
121;; (defclass tree-path (boxed)
122;; ((depth :allocation :alien :type int)
123;; (indices :allocation :alien :type pointer))
124;; (:metaclass boxed-class))
125
f4175703 126(deftype tree-path () '(vector integer))
2a8752b0 127(register-type 'tree-path "GtkTreePath")
128
129
560af5c5 130
2719586f 131(define-types-by-introspection "Gtk"
132 ;; Manually defined
133 ("GtkObject" :ignore t)
134 ("GtkRequisition" :ignore t)
135 ("GtkBorder" :ignore t)
2a8752b0 136 ("GtkTreeIter" :ignore t)
137 ("GtkTreePath" :ignore t)
1047e159 138
5b51dee1 139 ;; Manual override
140 ("GtkWidget"
141 :slots
142 ((child-slots
1047e159 143 :allocation :instance
144 :accessor widget-child-slots
145 :type container-child)
e6d40e16 146 (parent-window
5b51dee1 147 :allocation :virtual
e6d40e16 148 :getter "gtk_widget_get_parent_window"
149 :setter "gtk_widget_set_parent_window"
150 :accessor widget-parent-window
151 :type gdk:window)
5b51dee1 152 (window
153 :allocation :virtual
154 :getter "gtk_widget_get_window"
155 :reader widget-window
156 :type gdk:window)
157 (state
158 :allocation :virtual
159 :getter "gtk_widget_get_state"
160 :setter "gtk_widget_set_state"
161 :accessor widget-state
162 :initarg :state
163 :type state-type)
164 (colormap
165 :allocation :virtual
166 :getter "gtk_widget_get_colormap"
e6d40e16 167 :setter "gtk_widget_set_colormap"
168 :initarg :colormap
169 :accessor widget-colormap
5b51dee1 170 :type gdk:colormap)
171 (visual
172 :allocation :virtual
173 :getter "gtk_widget_get_visual"
174 :reader widget-visual
e6d40e16 175 :type gdk:visual)
176 (direction
177 :allocation :virtual
178 :getter "gtk_widget_get_direction"
179 :setter "gtk_widget_set_direction"
180 :accessor widget-direction
181 :initarg :direction
182 :type text-direction)
183 (composite-name
184 :allocation :virtual
185 :getter "gtk_widget_get_composite_name"
186 :setter "gtk_widget_set_composite_name"
187 :accessor widget-composite-name
188 :initarg :composite-name
189 :type string)
190 (settings
191 :allocation :virtual
192 :getter "gtk_widget_get_settings"
193 :accessor widget-settings
194 :type settings)
195 (child-visible
196 :allocation :virtual
197 :getter "gtk_widget_get_child_visible"
198 :setter "gtk_widget_set_child_visible"
199 :accessor widget-child-visible-p
200 :initarg :child-visible
201 :type boolean)))
202
5b51dee1 203 ("GtkContainer"
204 :slots
205 ((child
206 :ignore t)
207 (children
208 :allocation :virtual
209 :getter container-children
210 :setter (setf container-children))
211 (focus-child
212 :allocation :virtual
213 :getter "gtk_container_get_focus_child"
214 :setter "gtk_container_set_focus_child"
215 :accessor container-focus-child
216 :initarg :focus-child
217 :type widget)
e6d40e16 218 (focus-chain
219 :allocation :virtual
220 :getter container-focus-chain
221 :setter (setf container-focus-chain))
5b51dee1 222 (focus-hadjustment
223 :allocation :virtual
224 :getter "gtk_container_get_focus_hadjustment"
225 :setter "gtk_container_set_focus_hadjustment"
226 :accessor container-focus-hadjustment
227 :initarg :focus-hadjustment
228 :type adjustment)
229 (focus-vadjustment
230 :allocation :virtual
231 :getter "gtk_container_get_focus_vadjustment"
232 :setter "gtk_container_set_focus_vadjustment"
233 :accessor container-focus-vadjustment
234 :initarg :focus-vadjustment
235 :type adjustment)))
236
237 ("GtkBin"
238 :slots
239 ((child
240 :allocation :virtual
56460319 241 :getter "gtk_bin_get_child"
242 :setter (setf bin-child)
243 :reader bin-child
244 :type widget)))
3f73963b 245
246 ("GtkWindow"
247 :slots
248 ((gravity
249 :allocation :virtual
250 :getter "gtk_window_get_gravity"
251 :setter "gtk_window_set_gravity"
252 :accessor window-gravity
253 :initarg :gravity
254 :type gdk:gravity)
255 (focus-widget
256 :allocation :virtual
257 :getter "gtk_window_get_focus"
258 :setter "gtk_window_set_focus"
259 :accessor window-focus-widget
260 :initarg :focus-widget
261 :type widget)
262 (default-widget
263 :allocation :virtual
264 :getter "gtk_window_get_default"
265 :setter "gtk_window_set_default"
266 :accessor window-default-widget
267 :initarg :default-widget
268 :type widget)
269 (decorated
270 :allocation :virtual
271 :getter "gtk_window_get_decorated"
272 :setter "gtk_window_set_decorated"
273 :accessor window-decorated-p
274 :initarg :decorated
275 :type boolean)
276 (has-frame
277 :allocation :virtual
278 :getter "gtk_window_get_has_frame"
279 :setter "gtk_window_set_has_frame"
280 :accessor window-has-frame-p
281 :initarg :has-frame
282 :type boolean)
283 (role
284 :allocation :virtual
285 :getter "gtk_window_get_role"
286 :setter "gtk_window_set_role"
287 :accessor window-role
288 :initarg :role
289 :type string)
290 (type-hint
291 :allocation :virtual
292 :getter "gtk_window_get_type_hint"
293 :setter "gtk_window_set_type_hint"
294 :accessor window-type-hint
295 :initarg :type-hint
296 :type gdk:window-type-hint)
297 (icon
298 :allocation :virtual
299 :getter window-icon
300 :setter (setf window-icon)
301 :initarg :icon)
302 (mnemonic-modifier
303 :allocation :virtual
304 :getter "gtk_window_get_mnemonic_modifier"
305 :setter "gtk_window_set_mnemonic_modifier"
306 :accessor window-mnemonic-modifier
307 :initarg :mnemonic-modifier
308 :type gdk:modifier-type)
309 (transient-for
310 :allocation :virtual
311 :getter "gtk_window_get_transient_for"
312 :setter "gtk_window_set_transient_for"
313 :accessor window-transient-for
314 :initarg :transient-for
f5b67f2b 315 :type window)))
5b51dee1 316
317 ("GtkTooltips"
318 :slots
319 ((enabled
320 :allocation :virtual
321 :getter "gtk_tooltips_get_enabled"
322 :setter (setf tooltips-enabled-p)
323 :reader tooltips-enabled-p
324 :initarg :enabled
325 :type boolean)))
326
327 ("GtkOptionMenu"
328 :slots
329 ((menu
330 :allocation :virtual
331 :getter "gtk_option_menu_get_menu"
332 :setter (setf option-menu-menu)
333 :reader option-menu-menu
334 :initarg :menu
f5b67f2b 335 :type menu)
5b51dee1 336 (history
337 :allocation :virtual
338 :getter "gtk_option_menu_get_history"
339 :setter "gtk_option_menu_set_history"
340 :accessor option-menu-history
341 :initarg :history
342 :type unsigned-int)))
343
344 ("GtkMenuItem"
345 :slots
346 ((label
347 :allocation :virtual
f5b67f2b 348 :getter menu-item-label
349 :setter (setf menu-item-label)
5b51dee1 350 :initarg :label
351 :type string)
f5b67f2b 352 (right-justified
353 :allocation :virtual
354 :getter "gtk_menu_item_get_right_justified"
355 :setter "gtk_menu_item_set_right_justified"
356 :accessor menu-item-right-justified-p
357 :initarg :right-justified
358 :type boolean)
5b51dee1 359 (submenu
360 :allocation :virtual
361 :getter "gtk_menu_item_get_submenu"
362 :setter (setf menu-item-submenu)
363 :reader menu-item-submenu
364 :initarg :submenu
f5b67f2b 365 :type menu-item)))
5b51dee1 366
367 ("GtkColorSelectionDialog"
368 :slots
369 ((colorsel
370 :allocation :alien
371 :reader color-selection-dialog-colorsel
372 :type widget)
373 (ok-button
374 :allocation :alien
375 :reader color-selection-dialog-ok-button
376 :type widget)
377 (cancel-button
378 :allocation :alien
379 :reader color-selection-dialog-cancel-button
380 :type widget)
381 (help-button
382 :allocation :alien
383 :reader color-selection-dialog-help-button
384 :type widget)))
385
386 ("GtkScrolledWindow"
387 :slots
388 ((hscrollbar
389 :allocation :alien
390 :reader scrolled-window-hscrollbar
391 :type widget)
392 (vscrollbar
393 :allocation :alien
394 :reader scrolled-window-vscrollbar
395 :type widget)))
560af5c5 396
5b51dee1 397 ("GtkPaned"
1047e159 398 :slots
5b51dee1 399 ((child1
560af5c5 400 :allocation :virtual
5b51dee1 401 :getter paned-child1
402 :setter (setf paned-child1)
403 :initarg :child1
560af5c5 404 :type widget)
5b51dee1 405 (child2
2d379b6a 406 :allocation :virtual
5b51dee1 407 :getter paned-child2
408 :setter (setf paned-child2)
409 :initarg :child2
410 :type widget)))
560af5c5 411
5b51dee1 412 ("GtkMenu"
413 :slots
414 ((accel-group
415 :allocation :virtual
416 :getter "gtk_menu_get_accel_group"
417 :setter "gtk_menu_set_accel_group"
418 :accessor menu-accel-group
419 :initarg :accel-group
420 :type accel-group)
f5b67f2b 421 (title
422 :allocation :virtual
423 :getter "gtk_menu_get_title"
424 :setter "gtk_menu_set_title"
425 :accessor menu-title
426 :initarg :title
427 :type string)
5b51dee1 428 (active
429 :allocation :virtual
430 :getter "gtk_menu_get_active"
431 :setter (setf menu-active)
432 :reader menu-active
433 :initarg :active
434 :type widget)
435 (tornoff
436 :allocation :virtual
437 :getter "gtk_menu_get_tearoff_state"
438 :setter "gtk_menu_set_tearoff_state"
439 :accessor menu-tornoff-p
440 :initarg :tearoff
441 :type boolean)))
442
443 ("GtkToolbar"
444 :slots
445 ((tooltips
446 :allocation :virtual
447 :getter "gtk_toolbar_get_tooltips"
448 :setter "gtk_toolbar_set_tooltips"
449 :accessor toolbar-tooltips-p
450 :initarg :tooltips
451 :type boolean)
452 (icon-size
453 :allocation :virtual
454 :getter "gtk_toolbar_get_icon_size"
455 :setter "gtk_toolbar_set_icon_size"
456 :accessor toolbar-icon-size
457 :initarg :icon-size
1047e159 458 :type icon-size)
459 (toolbar-style
460 :allocation :property
461 :pname "toolbar-style"
462 :initarg :toolbar-style
463 :accessor toolbar-style
464 :type toolbar-style)))
5b51dee1 465
f5b67f2b 466 ("GtkNotebook"
467 :slots
468 ((current-page
469 :allocation :virtual
470 :getter notebook-current-page
471 :setter (setf notebook-current-page)
472 :initarg :current-page)
473 (page :ignore t)))
474
5b51dee1 475 ("GtkRuler"
476 :slots
477 ((metric
478 :allocation :virtual
479 :getter "gtk_ruler_get_metric"
480 :setter "gtk_ruler_set_metric"
481 :accessor ruler-metric
482 :initarg :metric
483 :type metric-type)))
484
485 ("GtkProgressBar"
486 :slots
487 ; deprecated properties
488 ((bar-style :ignore t)
489 (adjustment :ignore t)
490 (activity-step :ignore t)
491 (activity-blocks :ignore t)
492 (discrete-blocks :ignore t)))
493
494 ("GtkTable"
495 :slots
496 ((column-spacing
497 :allocation :virtual
498 :getter "gtk_table_get_default_col_spacing"
499 :setter "gtk_table_set_col_spacings"
500 :initarg :column-spacing
501 :type unsigned-int)
502 (row-spacing
503 :allocation :virtual
504 :getter "gtk_table_get_default_row_spacing"
505 :setter "gtk_table_set_row_spacings"
506 :initarg :row-spacing
507 :type unsigned-int)))
508
509 ("GtkDialog"
510 :slots
1047e159 511 ((vbox
5b51dee1 512 :allocation :virtual
513 :getter "gtk_dialog_get_vbox"
1047e159 514 :reader dialog-vbox
5b51dee1 515 :type widget)
516 (action-area
517 :allocation :virtual
518 :getter "gtk_dialog_get_action_area"
519 :reader dialog-action-area
520 :type widget)))
2ed3bebb 521
5b51dee1 522 ("GtkCombo"
523 :slots
524 ((entry
525 :allocation :virtual
526 :getter "gtk_combo_get_entry"
527 :reader combo-entry
528 :type entry)))
f5b67f2b 529
5b51dee1 530 ("GtkRadioButton"
531 :slots
532 ((group
533 :allocation :virtual
534 :getter "gtk_radio_button_get_group"
535 :reader radio-button-group
536 :type (static (gslist widget)))))
d520140e 537
5b51dee1 538 ("GtkRadioMenuItem"
539 :slots
540 ((group
541 :allocation :virtual
542 :getter "gtk_radio_menu_item_get_group"
543 :reader radio-menu-item-group
544 :type (static (gslist widget)))))
560af5c5 545
5b51dee1 546 ("GtkFileSelection"
547 :slots
548 ((action-area
d520140e 549 :allocation :virtual
5b51dee1 550 :getter "gtk_file_selection_get_action_area"
d520140e 551 :reader file-selection-action-area
552 :type widget)
553 (ok-button
554 :allocation :virtual
5b51dee1 555 :getter "gtk_file_selection_get_ok_button"
d520140e 556 :reader file-selection-ok-button
557 :type widget)
558 (cancel-button
559 :allocation :virtual
5b51dee1 560 :getter "gtk_file_selection_get_cancel_button"
d520140e 561 :reader file-selection-cancel-button
5b51dee1 562 :type widget)))
563
564 ("GtkLayout"
565 :slots
566 ((bin-window
1047e159 567 :allocation :virtual
5b51dee1 568 :getter "gtk_layout_get_bin_window"
569 :reader layout-bin-window
f784870f 570 :type gdk:window)))
f5b67f2b 571
572 ("GtkFixed"
573 :slots
574 ((has-window
1047e159 575 :allocation :virtual
f5b67f2b 576 :getter "gtk_fixed_get_has_window"
577 :setter "gtk_fixed_set_has_window"
578 :reader fixed-has-window-p
579 :initarg :has-window
580 :type boolean)))
1047e159 581
582 ("GtkRange"
583 :slots
584 ((value
585 :allocation :virtual
586 :getter "gtk_range_get_value"
587 :setter "gtk_range_set_value"
588 :initarg :value
589 :accessor range-value
590 :type double-float)
591 (upper
592 :allocation :virtual
593 :getter range-upper
594 :setter (setf range-upper)
595 :initarg :upper)
596 (lower
597 :allocation :virtual
598 :getter range-lower
599 :setter (setf range-lower)
600 :initarg :lower)
601 (step-increment
602 :allocation :virtual
603 :getter range-step-increment
604 :setter (setf range-step-increment)
605 :initarg :step-increment)
606 (page-increment
607 :allocation :virtual
608 :getter range-page-increment
609 :setter (setf range-page-increment)
610 :initarg :page-increment)))
611
612 ("GtkImage"
613 :slots
614 ((file :ignore t)))
615
616 ;; Interfaces
617 ("GtkEditable"
618 :slots
619 ((editable
620 :allocation :virtual
621 :getter "gtk_editable_get_editable"
622 :setter "gtk_editable_set_editable"
623 :reader editable-editable-p
624 :initarg :editable
625 :type boolean)
626 (position
627 :allocation :virtual
628 :getter "gtk_editable_get_position"
629 :setter "gtk_editable_set_position"
630 :reader editable-position
631 :initarg :position
632 :type int)
633 (text
634 :allocation :virtual
635 :getter editable-text
636 :setter (setf editable-text)
637 :initarg text)))
638
639 ("GtkFileChooser"
640 :slots
641 ((filename
642 :allocation :virtual
643 :getter "gtk_file_chooser_get_filename"
644 :setter "gtk_file_chooser_set_filename"
645 :accessor file-chooser-filename
646 :initarg :filename
647 :type string)
648 (current-name
649 :allocation :virtual
650 :setter "gtk_file_chooser_set_current_name"
651 :accessor file-choser-current-name
652 :initarg :current-name
653 :type string)
654 (current-folder
655 :allocation :virtual
656 :setter "gtk_file_chooser_set_current_folder"
657 :setter "gtk_file_chooser_get_current_folder"
658 :accessor file-choser-current-folder
659 :initarg :current-folder
660 :type string)
661 (uri
662 :allocation :virtual
663 :getter "gtk_file_chooser_get_uri"
664 :setter "gtk_file_chooser_set_uri"
665 :accessor file-choser-uri
666 :initarg :uri
667 :type string)
668 (current-folder-uri
669 :allocation :virtual
670 :setter "gtk_file_chooser_set_current_folder_uri"
671 :setter "gtk_file_chooser_get_current_folder_uri"
672 :accessor file-choser-current-folder-uri
673 :initarg :current-folder-uri
674 :type string)))
675
1a1949c7 676 ("GtkTreeView"
677 :slots
678 ((columns
679 :allocation :virtual
680 :getter "gtk_tree_view_get_columns"
681 :reader tree-view-columns
f4175703 682 :type (glist tree-view-column))
683 (selection
684 :allocation :virtual
685 :getter "gtk_tree_view_get_selection"
686 :reader tree-view-selection
687 :type tree-selection)))
1a1949c7 688
2a8752b0 689 ("GtkTreeModel"
690 :slots
691 ((n-columns
692 :allocation :virtual
693 :getter "gtk_tree_model_get_n_columns"
694 :reader tree-model-n-columns
695 :type int)))
696
f4175703 697 ("GtkTreeSelection"
698 :slots
699 ((mode
700 :allocation :virtual
701 :getter "gtk_tree_selection_get_mode"
702 :setter "gtk_tree_selection_set_mode"
703 :accessor tree-selection-mode
704 :initarg :mode
705 :type selection-mode)
706 (tree-view
707 :allocation :virtual
708 :getter "gtk_tree_selection_get_mode"
709 :reader tree-selection-mode
710 :type tree-view)))
711
1a1949c7 712 ("GtkComboBox"
713 :slots
714 ((active-iter
715 :allocation :virtual
716 :getter "gtk_combo_box_get_active_iter"
717 :setter "gtk_combo_box_set_active_iter"
718 :accessor combo-box-active-iter
719 :type tree-iter)))
720
2a8752b0 721
5b51dee1 722
723 ;; Not needed
724 ("GtkFundamentalType" :ignore t)
725 ("GtkArgFlags" :ignore t)
560af5c5 726
d520140e 727
5b51dee1 728 ;; Deprecated widgets
729 ("GtkCList" :ignore-prefix t)
730 ("GtkCTree" :ignore-prefix t)
1a1949c7 731 ("GtkList" :ignore t)
732 ("GtkListItem" :ignore t)
5b51dee1 733 ("GtkTree" :ignore t)
734 ("GtkTreeItem" :ignore t)
1a1949c7 735 ("GtkItemFactory" :ignore t)
e6d40e16 736 ("GtkText" :ignore-prefix t :except ("GtkTextDirection"))
5b51dee1 737 ("GtkPacker" :ignore-prefix t)
738 ("GtkPixmap" :ignore t)
739 ("GtkPreview" :ignore-prefix t)
1a1949c7 740 ("GtkProgres" :ignore t)
5b51dee1 741 ("GtkTipsQuery" :ignore t)
1047e159 742 ("GtkOldEditable" :ignore t)
1a1949c7 743 ("GtkCombo" :ignore t)
744 ("GtkOptionMenu" :ignore t)
1047e159 745
746 ;; What are these?
747 ("GtkFileSystemModule" :ignore t)
748 ("GtkIMModule" :ignore t)
749 ("GtkThemeEngine" :ignore t)
750
751 )