1 ;; Common Lisp bindings for GTK+ v2.x
2 ;; Copyright 1999-2005 Espen S. Johnsen <espen@users.sf.net>
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:
12 ;; The above copyright notice and this permission notice shall be
13 ;; included in all copies or substantial portions of the Software.
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.
23 ;; $Id: gtktypes.lisp,v 1.41 2006-02-06 11:59:47 espen Exp $
27 (defclass requisition (boxed)
30 :accessor requisition-width
35 :accessor requisition-height
38 (:metaclass boxed-class))
41 (defclass allocation (struct)
44 :accessor allocation-width
49 :accessor allocation-width
54 :accessor allocation-width
59 :accessor allocation-height
62 (:metaclass struct-class))
64 (defclass border (boxed)
72 :accessor border-right
82 :accessor border-bottom
85 (:metaclass boxed-class))
87 (defclass stock-item (struct)
90 :accessor stock-item-id
95 :accessor stock-item-label
100 :accessor stock-item-modifier
102 :type gdk:modifier-type)
105 :accessor stock-item-keyval
110 :accessor stock-item-translation-domain
111 :initarg :translation-domain
113 (:metaclass struct-class))
115 ;; We don't really need to access any slots in this class, so we just
116 ;; specify the total size
117 (defclass tree-iter (boxed)
119 ;; (stamp :allocation :alien :type int)
120 ;; (user-data :allocation :alien :type pointer)
121 ;; (user-data2 :allocation :alien :type pointer)
122 ;; (user-data3 :allocation :alien :type pointer)
124 (:metaclass boxed-class)
125 (:size #.(+ (size-of 'int) (* 3 (size-of 'pointer)))))
128 ;; (defclass tree-path (boxed)
129 ;; ((depth :allocation :alien :type int)
130 ;; (indices :allocation :alien :type pointer))
131 ;; (:metaclass boxed-class))
133 (deftype tree-path () '(vector integer))
134 (register-type 'tree-path '|gtk_tree_path_get_type|)
137 '(or int (enum (:start 0) (:end -1) (:first 0) (:last -1))))
139 (defmethod reader-function ((type (eql 'position)) &rest args)
140 (declare (ignore type args))
141 (reader-function 'int))
145 (define-types-by-introspection "Gtk"
147 ("GtkObject" :ignore t)
148 ("GtkRequisition" :ignore t)
149 ("GtkBorder" :ignore t)
150 ("GtkTreeIter" :ignore t)
151 ("GtkTreePath" :ignore t)
152 ; ("GtkStyle" :ignore t)
159 :accessor widget-child-properties
160 :type container-child)
163 :getter "gtk_widget_get_window"
164 :reader widget-window
166 (parent :merge t :initarg nil)
167 (visible :merge t :initarg nil)
170 :getter %widget-parent-window
171 :setter "gtk_widget_set_parent_window"
172 :accessor widget-parent-window
173 :initarg :parent-window
177 :getter "gtk_widget_get_state"
178 :setter "gtk_widget_set_state"
179 :accessor widget-state
184 :getter "gtk_widget_get_colormap"
185 :setter "gtk_widget_set_colormap"
187 :accessor widget-colormap
191 :getter "gtk_widget_get_visual"
192 :reader widget-visual
196 :getter "gtk_widget_get_direction"
197 :setter "gtk_widget_set_direction"
198 :accessor widget-direction
200 :type text-direction)
203 :getter "gtk_widget_get_composite_name"
204 :setter "gtk_widget_set_composite_name"
205 :accessor widget-composite-name
206 :initarg :composite-name
207 :type (copy-of string)) ; will leak the string when setting
210 :getter "gtk_widget_get_settings"
211 :accessor widget-settings
215 :getter "gtk_widget_get_child_visible"
216 :setter "gtk_widget_set_child_visible"
217 :accessor widget-child-visible-p
218 :initarg :child-visible
221 :merge t :unbound -1)
223 :merge t :unbound -1)))
230 :getter container-children
231 :setter (setf container-children)
232 ;; The following doesn't work because gtk_container_get_children doesn't
233 ;; increase the reference count of the children
234 ; :getter "gtk_container_get_children"
235 ; :reader container-children
236 ; :type (glist widget)
240 :getter "gtk_container_child_type"
241 :reader container-child-type
245 :getter "gtk_container_get_focus_child"
246 :setter "gtk_container_set_focus_child"
247 :accessor container-focus-child
248 :initarg :focus-child
252 :getter container-focus-chain
253 :setter (setf container-focus-chain))
256 :getter "gtk_container_get_focus_hadjustment"
257 :setter "gtk_container_set_focus_hadjustment"
258 :accessor container-focus-hadjustment
259 :initarg :focus-hadjustment
263 :getter "gtk_container_get_focus_vadjustment"
264 :setter "gtk_container_set_focus_vadjustment"
265 :accessor container-focus-vadjustment
266 :initarg :focus-vadjustment
270 :getter "gtk_container_get_reallocate_redraws"
271 :setter "gtk_container_set_reallocate_redraws"
272 :accessor container-reallocate-redraws
273 :initarg :reallocate-redraws
280 :getter "gtk_bin_get_child"
281 :setter (setf bin-child)
289 :getter "gtk_window_get_focus"
290 :setter "gtk_window_set_focus"
291 :accessor window-focus-widget
292 :initarg :focus-widget
296 :getter "gtk_window_get_default"
297 :setter "gtk_window_set_default"
298 :accessor window-default-widget
299 :initarg :default-widget
303 :getter "gtk_window_get_has_frame"
304 :setter "gtk_window_set_has_frame"
305 :accessor window-has-frame-p
310 :getter "gtk_window_get_icon_list"
311 :setter "gtk_window_set_icon_list"
312 :accessor window-icon-list
314 :type (glist gdk:pixbuf))
317 :getter "gtk_window_get_mnemonic_modifier"
318 :setter "gtk_window_set_mnemonic_modifier"
319 :accessor window-mnemonic-modifier
320 :initarg :mnemonic-modifier
321 :type gdk:modifier-type)
324 :getter "gtk_window_get_transient_for"
325 :setter "gtk_window_set_transient_for"
326 :accessor window-transient-for
327 :initarg :transient-for
331 :getter "gtk_window_get_group"
332 :setter (setf window-group)
336 (default-width :merge t :unbound -1)
337 (default-height :merge t :unbound -1)))
343 :accessor window-group-grabs
344 :type (gslist window))))
350 :getter "gtk_tooltips_get_enabled"
351 :setter (setf tooltips-enabled-p)
352 :reader tooltips-enabled-p
360 :getter menu-item-label
361 :setter (setf menu-item-label)
364 :allocation :user-data
366 :initarg :use-underline
367 :accessor menu-item-use-underline-p)
370 :getter "gtk_menu_item_get_right_justified"
371 :setter "gtk_menu_item_set_right_justified"
372 :accessor menu-item-right-justified-p
373 :initarg :right-justified
377 :getter "gtk_menu_item_get_submenu"
378 :setter "gtk_menu_item_set_submenu"
379 :accessor menu-item-submenu
387 :getter "gtk_menu_shell_get_take_focus"
388 :setter "gtk_menu_shell_set_take_focus"
389 :accessor menu-shell-take-focus-p
392 ("GtkColorSelectionDialog"
396 :reader color-selection-dialog-colorsel
400 :reader color-selection-dialog-ok-button
404 :reader color-selection-dialog-cancel-button
408 :reader color-selection-dialog-help-button
416 :reader scrolled-window-hscrollbar
421 :reader scrolled-window-vscrollbar
426 :getter "gtk_scrolled_window_get_hscrollbar"
427 :reader scrolled-window-hscrollbar
432 :getter "gtk_scrolled_window_get_hscrollbar"
433 :reader scrolled-window-vscrollbar
440 :getter "gtk_paned_get_child1"
441 :setter "gtk_paned_add1"
442 :accessor paned-child1
447 :getter "gtk_paned_get_child2"
448 :setter "gtk_paned_add2"
449 :accessor paned-child2
457 :getter "gtk_menu_get_accel_group"
458 :setter "gtk_menu_set_accel_group"
459 :accessor menu-accel-group
460 :initarg :accel-group
464 :getter "gtk_menu_get_active"
465 :setter (setf menu-active)
471 :getter "gtk_menu_get_screen"
472 :setter "gtk_menu_set_screen"
473 :accessor menu-screen
478 :getter "gtk_menu_get_attach_widget"
479 :reader menu-attach-widget
484 :getter "gtk_menu_get_tearoff_state"
485 :setter "gtk_menu_set_tearoff_state"
486 :accessor menu-tearoff-state-p
487 :initarg :tearoff-state
494 :getter "gtk_toolbar_get_tooltips"
495 :setter "gtk_toolbar_set_tooltips"
496 :accessor toolbar-show-tooltips-p
497 :initarg :show-tooltips
501 :getter "gtk_toolbar_get_tooltips_object"
502 :reader toolbar-tooltips
505 :allocation :property
506 :pname "toolbar-style"
507 :initarg :toolbar-style
508 :accessor toolbar-style
512 :getter "gtk_toolbar_get_n_items"
513 :reader toolbar-n-items
520 :getter "gtk_tool_item_get_use_drag_window"
521 :setter "gtk_tool_item_set_use_drag_window"
522 :accessor tool-item-use-drag-window-p
523 :initarg :drag-window
526 :allocation :user-data
527 :setter (setf tool-item-tip-text)
529 :reader tool-item-tip-text)
531 :allocation :user-data
532 :setter (setf tool-item-tip-private)
533 :initarg :tip-private
534 :reader tool-item-tip-private)))
538 ((stock-id :merge t :initarg :stock)
539 (icon-widget :merge t :initarg :icon)))
541 ("GtkToggleToolButton"
545 :getter "gtk_toggle_tool_button_get_active"
546 :setter "gtk_toggle_tool_button_get_active"
547 :accessor toggle-tool-button-active-p
551 ("GtkRadioToolButton"
555 :getter "gtk_radio_tool_button_get_group"
556 :reader radio-tool-button-group
557 :type (copy-of (gslist widget)))
559 :allocation :user-data
561 :accessor radio-tool-button-value
562 :documentation "Value passed as argument to the activate callback")))
568 :getter %notebook-current-page
569 :setter (setf notebook-current-page)
570 :reader notebook-current-page
572 :initarg :current-page)
575 :getter "gtk_notebook_get_current_page"
576 :setter "gtk_notebook_set_current_page"
578 :initarg :current-page-num
579 :accessor notebook-current-page-num
586 :getter "gtk_ruler_get_metric"
587 :setter "gtk_ruler_set_metric"
588 :accessor ruler-metric
594 ; deprecated properties
595 ((bar-style :ignore t)
596 (adjustment :ignore t)
597 (activity-step :ignore t)
598 (activity-blocks :ignore t)
599 (discrete-blocks :ignore t)))
603 ; deprecated property
604 ((shadow :ignore t)))
608 ; deprecated property
609 ((shadow :ignore t)))
615 :getter "gtk_table_get_default_col_spacing"
616 :setter "gtk_table_set_col_spacings"
617 :initarg :column-spacing
621 :getter "gtk_table_get_default_row_spacing"
622 :setter "gtk_table_set_row_spacings"
623 :initarg :row-spacing
624 :type unsigned-int)))
630 :getter "gtk_dialog_get_vbox"
635 :getter "gtk_dialog_get_action_area"
636 :reader dialog-action-area
643 :getter "gtk_entry_get_layout"
648 :getter "gtk_entry_get_completion"
649 :setter "gtk_entry_set_completion"
651 :accessor entry-completion
652 :type entry-completion)
653 (max-length :merge t :unbound 0)
655 (width-chars :merge t :unbound -1)))
657 ("GtkEntryCompletion"
661 :getter "gtk_entry_completion_get_entry"
662 :reader entry-completion-entry
664 (minimum-key-length :merge t :unbound -1)
666 (text-column :merge t :unbound -1)))
672 :getter "gtk_radio_button_get_group"
673 :reader radio-button-group
674 :type (copy-of (gslist widget)))
676 :allocation :user-data
678 :accessor radio-button-value
679 :documentation "Value passed as argument to the activate callback")))
685 :getter "gtk_radio_menu_item_get_group"
686 :reader radio-menu-item-group
687 :type (copy-of (gslist widget)))
689 :allocation :user-data
691 :accessor radio-menu-item-value
692 :documentation "Value passed as argument to the activate callback")))
698 :getter "gtk_layout_get_bin_window"
699 :reader layout-bin-window
706 :getter "gtk_fixed_get_has_window"
707 :setter "gtk_fixed_set_has_window"
708 :reader fixed-has-window-p
716 :getter "gtk_range_get_value"
717 :setter "gtk_range_set_value"
719 :accessor range-value
724 :setter (setf range-upper)
729 :setter (setf range-lower)
733 :getter range-step-increment
734 :setter (setf range-step-increment)
735 :initarg :step-increment)
738 :getter range-page-increment
739 :setter (setf range-page-increment)
740 :initarg :page-increment)))
746 (pixel-size :merge t :unbound -1)))
752 :getter "gtk_label_get_layout"
754 :type pango:layout)))
760 :getter "gtk_scale_get_layout"
762 :type pango:layout)))
768 :getter "gtk_editable_get_editable"
769 :setter "gtk_editable_set_editable"
770 :reader editable-editable-p
775 :getter "gtk_editable_get_position"
776 :setter "gtk_editable_set_position"
777 :reader editable-position
782 :getter editable-text
783 :setter (setf editable-text)
790 :getter "gtk_file_chooser_get_filename"
791 :setter "gtk_file_chooser_set_filename"
792 :accessor file-chooser-filename
797 :setter "gtk_file_chooser_set_current_name"
798 :accessor file-chooser-current-name
799 :initarg :current-name
803 :setter "gtk_file_chooser_set_current_folder"
804 :setter "gtk_file_chooser_get_current_folder"
805 :accessor file-chooser-current-folder
806 :initarg :current-folder
810 :getter "gtk_file_chooser_get_uri"
811 :setter "gtk_file_chooser_set_uri"
812 :accessor file-chooser-uri
817 :setter "gtk_file_chooser_set_current_folder_uri"
818 :setter "gtk_file_chooser_get_current_folder_uri"
819 :accessor file-chooser-current-folder-uri
820 :initarg :current-folder-uri
827 :getter "gtk_file_filter_get_name"
828 :setter "gtk_file_filter_set_name"
829 :accessor file-filter-name
837 :getter "gtk_tree_view_get_columns"
838 :reader tree-view-columns
839 :type (glist tree-view-column))
842 :getter "gtk_tree_view_get_selection"
843 :reader tree-view-selection
844 :type tree-selection)))
850 :getter "gtk_tree_model_get_n_columns"
851 :reader tree-model-n-columns
858 :getter "gtk_tree_selection_get_mode"
859 :setter "gtk_tree_selection_set_mode"
860 :accessor tree-selection-mode
862 :type selection-mode)
865 :getter "gtk_tree_selection_get_mode"
866 :reader tree-selection-mode
873 :getter "gtk_combo_box_get_active_iter"
874 :setter "gtk_combo_box_set_active_iter"
875 :accessor combo-box-active-iter
882 :getter "gtk_text_buffer_get_line_count"
883 :reader text-buffer-line-count
887 :getter "gtk_text_buffer_get_char_count"
888 :reader text-buffer-char-count
892 :getter "gtk_text_buffer_get_modified"
893 :setter "gtk_text_buffer_set_modified"
894 :accessor text-buffer-modifed-p
901 :getter "gtk_text_view_get_default_attributes"
902 :reader text-view-default-attributes
903 :type text-attributes)))
909 :getter "gtk_text_tag_table_get_size"
910 :reader text-tag-table-size
917 :getter "gtk_text_tag_get_priority"
918 :setter "gtk_text_tag_set_priority"
919 :accessor text-tag-priority
922 :merge t :type pango:weight)))
928 :getter "gtk_text_mark_get_buffer"
929 :reader text-mark-buffer
933 :getter "gtk_text_mark_get_name"
934 :reader text-mark-name
938 :getter "gtk_text_mark_get_visible"
939 :setter "gtk_text_mark_set_visible"
940 :accessor text-mark-visible-p
944 :getter "gtk_text_mark_get_deleted"
945 :reader text-mark-deleted-p
949 :getter "gtk_text_mark_get_left_gravity"
950 :reader text-mark-left-gravity-p
958 :getter "gtk_ui_manager_get_action_groups"
959 :reader ui-manager-action-groups
960 :type (copy-of (glist action-group)))
963 :getter "gtk_ui_manager_get_accel_group"
964 :reader ui-manager-accel-group
967 ("GtkUIManagerItemType"
968 :type ui-manager-item-type)
973 :allocation :user-data :initarg :accelerator
974 :reader action-accelerator)))
980 :getter "gtk_toggle_action_get_active"
981 :setter "gtk_toggle_action_set_active"
983 :accessor toggle-action-active-p
990 :getter "gtk_radio_button_get_group"
991 :reader radio-action-group
992 :type (copy-of (gslist widget)))
994 :allocation :property :pname "value" :type int
995 :documentation "A hack so we can use the alien function gtk_radio_action_get_current_value to retrieve the active radio action in a group.")
997 :allocation :user-data :initarg :value :accessor radio-action-value)))
1002 :allocation :virtual
1003 :getter "gtk_color_selection_get_previous_alpha"
1004 :setter "gtk_color_selection_get_previous_alpha"
1005 :initarg :previous-alpha
1006 :accessor color-selection-previous-alpha
1007 :type (unsigned 16))
1009 :allocation :virtual
1010 :getter "gtk_color_selection_get_previous_color"
1011 :setter "gtk_color_selection_get_previous_color"
1012 :initarg :previous-color
1013 :accessor color-selection-previous-color
1018 ; deprecated property
1024 :allocation :virtual
1025 :getter "gtk_clipboard_get_display"
1026 :reader clipboard-display
1027 :type gdk:display)))
1032 ((text-column :merge t :setter %icon-view-set-text-column)
1033 (markup-column :merge t :setter %icon-view-set-markup-column)
1034 (pixbuf-column :merge t :setter %icon-view-set-pixbuf-column)))
1037 ("GtkFundamentalType" :ignore t)
1038 ("GtkArgFlags" :ignore t)
1041 ;; Deprecated widgets
1042 ("GtkCList" :ignore-prefix t)
1043 ("GtkCTree" :ignore-prefix t)
1044 ("GtkList" :ignore t)
1045 ("GtkListItem" :ignore t)
1046 ("GtkTree" :ignore t)
1047 ("GtkTreeItem" :ignore t)
1048 ("GtkItemFactory" :ignore t)
1049 ("GtkText" :ignore t)
1050 ("GtkPacker" :ignore-prefix t)
1051 ("GtkPixmap" :ignore t)
1052 ("GtkPreview" :ignore-prefix t)
1053 ("GtkProgres" :ignore t)
1054 ("GtkTipsQuery" :ignore t)
1055 ("GtkOldEditable" :ignore t)
1056 ("GtkCombo" :ignore t)
1057 ("GtkOptionMenu" :ignore t)
1058 ("GtkFileSelection" :ignore t)
1062 ("GtkFileSystemModule" :ignore t)
1063 ("GtkIMModule" :ignore t)
1064 ("GtkThemeEngine" :ignore t))
1067 (defclass text-iter (boxed)
1069 :allocation :virtual
1070 :getter "gtk_text_iter_get_buffer"
1071 :reader text-iter-buffer
1072 :type pointer) ;text-buffer)
1074 :allocation :virtual
1075 :getter "gtk_text_iter_get_offset"
1076 :setter "gtk_text_iter_set_offset"
1077 :accessor text-iter-offset
1080 :allocation :virtual
1081 :getter "gtk_text_iter_get_line"
1082 :setter "gtk_text_iter_set_line"
1083 :accessor text-iter-line
1086 :allocation :virtual
1087 :getter "gtk_text_iter_get_line_offset"
1088 :setter "gtk_text_iter_set_line_offset"
1089 :accessor text-iter-line-offset
1092 :allocation :virtual
1093 :getter "gtk_text_iter_get_line_index"
1094 :setter "gtk_text_iter_set_line_index"
1095 :accessor text-iter-line-index
1098 :allocation :virtual
1099 :getter "gtk_text_iter_get_visible_line_index"
1100 :setter "gtk_text_iter_set_visible_line_index"
1101 :accessor text-iter-visible-line-index
1103 (visible-line-offset
1104 :allocation :virtual
1105 :getter "gtk_text_iter_get_visible_line_offset"
1106 :setter "gtk_text_iter_set_visible_line_offset"
1107 :accessor text-iter-visible-line-offset
1109 (:metaclass boxed-class)
1110 (:size #.(* 14 (size-of 'pointer))))
1113 (defclass tooltips-data (struct)
1116 :reader tooltips-data-tooltips
1120 :reader tooltips-data-widget
1124 :reader tooltips-data-tip-text
1128 :reader tooltips-data-tip-private
1130 (:metaclass struct-class))
1132 (defclass file-filter-info (struct)
1136 :type file-filter-flags)
1147 :initarg :display-name
1153 (:metaclass struct-class))
1156 (defclass accel-key (struct)
1162 :type gdk:modifier-type)
1165 :type (unsigned 16)))
1166 (:metaclass struct-class))
1168 (defclass accel-group-entry (struct)
1172 :type (inlined accel-key))
1179 (:metaclass struct-class))
1182 (define-enum-type drop-position
1183 :no-drop :drop-into :drop-left :drop-right :drop-above :drop-below)
1186 (defclass target-entry (struct)
1189 :accessor target-entry-target
1194 :accessor target-entry-flags
1199 :accessor target-entry-id
1201 :type unsigned-int))
1202 (:metaclass struct-class))
1205 (defclass selection-data (boxed)
1207 :allocation :alien :type gdk:atom
1208 :reader selection-data-selection)
1210 :allocation :alien :type gdk:atom
1211 :reader selection-data-target)
1213 :allocation :alien :type gdk:atom
1214 :reader selection-data-type)
1216 :allocation :alien :type int
1217 :reader selection-data-format)
1219 :allocation :alien :type pointer
1220 :reader selection-data-data)
1222 :allocation :alien :type int
1223 :reader selection-data-length)
1225 :allocation :alien :type gdk:display
1226 :reader selection-data-display))
1227 (:metaclass boxed-class))
1230 (defclass target-list (proxy)
1232 (:metaclass proxy-class))