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