chiark / gitweb /
11741cecb8eebf91953151fddf9ec217e889716e
[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.19 2004-11-15 19:24:11 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 static-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 int))
127 (register-type 'tree-path "GtkTreePath")
128
129
130
131 (define-types-by-introspection "Gtk"
132   ;; Manually defined
133   ("GtkObject" :ignore t)
134   ("GtkRequisition" :ignore t)
135   ("GtkBorder" :ignore t)
136   ("GtkTreeIter" :ignore t)
137   ("GtkTreePath" :ignore t)
138
139   ;; Manual override
140   ("GtkWidget"
141    :slots
142    ((child-slots
143      :allocation :instance
144      :accessor widget-child-slots
145      :type container-child)
146     (parent-window
147      :allocation :virtual
148      :getter "gtk_widget_get_parent_window"
149      :setter "gtk_widget_set_parent_window"
150      :accessor widget-parent-window
151      :type gdk:window)
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"
167      :setter "gtk_widget_set_colormap"
168      :initarg :colormap
169      :accessor widget-colormap
170      :type gdk:colormap)
171     (visual
172      :allocation :virtual
173      :getter "gtk_widget_get_visual"
174      :reader widget-visual
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      
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)
218     (focus-chain
219      :allocation :virtual
220      :getter container-focus-chain
221      :setter (setf container-focus-chain))
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
241      :getter "gtk_bin_get_child"
242      :setter (setf bin-child)
243      :reader bin-child
244      :type widget)))
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
315      :type window)))
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
335      :type menu)
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
348      :getter menu-item-label
349      :setter (setf menu-item-label)
350      :initarg :label
351      :type string)
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)
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
365      :type menu-item)))
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)))
396
397   ("GtkPaned"
398    :slots
399    ((child1
400     :allocation :virtual
401     :getter paned-child1
402     :setter (setf paned-child1)
403     :initarg :child1
404     :type widget)
405    (child2
406     :allocation :virtual
407     :getter paned-child2
408     :setter (setf paned-child2)
409     :initarg :child2
410     :type widget)))
411
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)
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)
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
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)))
465
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   
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
511    ((vbox
512      :allocation :virtual
513      :getter "gtk_dialog_get_vbox"
514      :reader dialog-vbox
515      :type widget)
516     (action-area
517      :allocation :virtual
518      :getter "gtk_dialog_get_action_area"
519      :reader dialog-action-area
520      :type widget)))
521
522   ("GtkCombo"
523    :slots
524    ((entry
525      :allocation :virtual
526      :getter "gtk_combo_get_entry"
527      :reader combo-entry
528      :type entry)))
529   
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)))))
537
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)))))
545
546   ("GtkFileSelection"
547    :slots
548    ((action-area
549      :allocation :virtual
550      :getter "gtk_file_selection_get_action_area"
551      :reader file-selection-action-area
552      :type widget)
553     (ok-button
554      :allocation :virtual
555      :getter "gtk_file_selection_get_ok_button"
556      :reader file-selection-ok-button
557      :type widget)
558     (cancel-button
559      :allocation :virtual
560      :getter "gtk_file_selection_get_cancel_button"
561      :reader file-selection-cancel-button
562      :type widget)))
563
564   ("GtkLayout"
565    :slots
566    ((bin-window
567      :allocation :virtual
568      :getter "gtk_layout_get_bin_window"
569      :reader layout-bin-window
570      :type gdk:window)))
571
572   ("GtkFixed"
573    :slots
574    ((has-window
575      :allocation :virtual
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)))
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
676   ("GtkTreeView"
677    :slots
678    ((columns
679      :allocation :virtual
680      :getter "gtk_tree_view_get_columns"
681      :reader tree-view-columns 
682      :type (glist tree-view-column))))
683
684   ("GtkTreeModel"
685    :slots
686    ((n-columns
687      :allocation :virtual
688      :getter "gtk_tree_model_get_n_columns"
689      :reader tree-model-n-columns 
690      :type int)))
691
692   ("GtkComboBox"
693    :slots
694    ((active-iter
695      :allocation :virtual
696      :getter "gtk_combo_box_get_active_iter"
697      :setter "gtk_combo_box_set_active_iter"
698      :accessor combo-box-active-iter 
699      :type tree-iter)))
700
701
702      
703   ;; Not needed
704   ("GtkFundamentalType" :ignore t)
705   ("GtkArgFlags" :ignore t)
706
707   
708   ;; Deprecated widgets
709   ("GtkCList" :ignore-prefix t)
710   ("GtkCTree" :ignore-prefix t)
711   ("GtkList" :ignore t)
712   ("GtkListItem" :ignore t)
713   ("GtkTree" :ignore t)
714   ("GtkTreeItem" :ignore t)
715   ("GtkItemFactory" :ignore t)
716   ("GtkText" :ignore-prefix t :except ("GtkTextDirection"))
717   ("GtkPacker" :ignore-prefix t)
718   ("GtkPixmap" :ignore t)
719   ("GtkPreview" :ignore-prefix t)
720   ("GtkProgres" :ignore t)
721   ("GtkTipsQuery" :ignore t)
722   ("GtkOldEditable" :ignore t)
723   ("GtkCombo" :ignore t)
724   ("GtkOptionMenu" :ignore t)
725
726   ;; What are these?
727   ("GtkFileSystemModule" :ignore t)
728   ("GtkIMModule" :ignore t)
729   ("GtkThemeEngine" :ignore t)
730
731   )