chiark / gitweb /
gtk-export.lisp renamed
[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.15 2002-04-02 15:03:47 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   (:alien-name "GtkTypeRequisition"))
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 proxy-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   (:alien-name "GtkTypeBorder"))
83
84 (defclass adjustment (%object)
85   ((lower
86     :allocation :alien
87     :accessor adjustment-lower
88     :initarg :lower
89     :type single-float)
90    (upper
91     :allocation :alien
92     :accessor adjustment-upper
93     :initarg :upper
94     :type single-float)
95    (%value ; to get the offset right
96     :allocation :alien
97     :type single-float)
98    (step-increment
99     :allocation :alien
100     :accessor adjustment-step-increment
101     :initarg :step-increment
102     :type single-float)
103    (page-increment
104     :allocation :alien
105     :accessor adjustment-page-increment
106     :initarg :page-increment
107     :type single-float)
108    (page-size
109     :allocation :alien
110     :accessor adjustment-page-size
111     :initarg :page-size
112     :type single-float)
113    (value
114     :allocation :virtual
115     :getter "gtk_adjustment_get_value"
116     :setter "gtk_adjustment_set_value"
117     :accessor adjustment-value
118     :initarg :value
119     :type single-float))
120   (:metaclass gobject-class)
121   (:alien-name "GtkAdjustment"))
122
123 (defclass stock-item (struct)
124   ((id
125     :allocation :alien
126     :accessor stock-item-id
127     :initarg :id
128     :type string)
129    (label
130     :allocation :alien
131     :accessor stock-item-label
132     :initarg :label
133     :type string)
134    (modifier
135     :allocation :alien
136     :accessor stock-item-modifier
137     :initarg :modifier
138     :type gdk:modifier-type)
139    (keyval
140     :allocation :alien
141     :accessor stock-item-keyval
142     :initarg :keyval
143     :type int)
144    (translation-domain
145     :allocation :alien
146     :accessor stock-item-translation-domain
147     :initarg :translation-domain
148     :type string))
149   (:metaclass proxy-class))
150
151
152
153 (define-types-by-introspection "Gtk"
154   ;; Manually defined
155   ("GtkObject" :ignore t)
156   ("GtkRequisition" :ignore t)
157   ("GtkBorder" :ignore t)
158   ("GtkAdjustment" :ignore t)
159
160   
161   ;; Manual override
162   ("GtkWidget"
163    :slots
164    ((child-slots
165     :allocation :instance
166     :accessor widget-child-slots
167     :type container-child)
168     (parent-window
169      :allocation :virtual
170      :getter "gtk_widget_get_parent_window"
171      :setter "gtk_widget_set_parent_window"
172      :accessor widget-parent-window
173      :type gdk:window)
174     (window
175      :allocation :virtual
176      :getter "gtk_widget_get_window"
177      :reader widget-window
178      :type gdk:window)
179     (state
180      :allocation :virtual
181      :getter "gtk_widget_get_state"
182      :setter "gtk_widget_set_state"
183      :accessor widget-state
184      :initarg :state
185      :type state-type)
186     (colormap
187      :allocation :virtual
188      :getter "gtk_widget_get_colormap"
189      :setter "gtk_widget_set_colormap"
190      :initarg :colormap
191      :accessor widget-colormap
192      :type gdk:colormap)
193     (visual
194      :allocation :virtual
195      :getter "gtk_widget_get_visual"
196      :reader widget-visual
197      :type gdk:visual)
198     (direction
199      :allocation :virtual
200      :getter "gtk_widget_get_direction"
201      :setter "gtk_widget_set_direction"
202      :accessor widget-direction
203      :initarg :direction
204      :type text-direction)
205     (composite-name
206      :allocation :virtual
207      :getter "gtk_widget_get_composite_name"
208      :setter "gtk_widget_set_composite_name"
209      :accessor widget-composite-name
210      :initarg :composite-name
211      :type string)
212     (settings
213      :allocation :virtual
214      :getter "gtk_widget_get_settings"
215      :accessor widget-settings
216      :type settings)
217     (child-visible
218      :allocation :virtual
219      :getter "gtk_widget_get_child_visible"
220      :setter "gtk_widget_set_child_visible"
221      :accessor widget-child-visible-p
222      :initarg :child-visible
223      :type boolean)))
224      
225   ("GtkContainer"
226    :slots
227    ((child
228      :ignore t)
229     (children
230      :allocation :virtual
231      :getter container-children
232      :setter (setf container-children))
233     (focus-child
234      :allocation :virtual
235      :getter "gtk_container_get_focus_child"
236      :setter "gtk_container_set_focus_child"
237      :accessor container-focus-child
238      :initarg :focus-child
239      :type widget)
240     (focus-chain
241      :allocation :virtual
242      :getter container-focus-chain
243      :setter (setf container-focus-chain))
244     (focus-hadjustment
245      :allocation :virtual
246      :getter "gtk_container_get_focus_hadjustment"
247      :setter "gtk_container_set_focus_hadjustment"
248      :accessor container-focus-hadjustment
249      :initarg :focus-hadjustment
250      :type adjustment)
251     (focus-vadjustment
252      :allocation :virtual
253      :getter "gtk_container_get_focus_vadjustment"
254      :setter "gtk_container_set_focus_vadjustment"
255      :accessor container-focus-vadjustment
256      :initarg :focus-vadjustment
257      :type adjustment)))
258       
259   ("GtkBin"
260    :slots
261    ((child
262      :allocation :virtual
263      :getter "gtk_bin_get_child"
264      :setter (setf bin-child)
265      :reader bin-child
266      :type widget)))
267
268   ("GtkWindow"
269    :slots
270    ((gravity
271      :allocation :virtual
272      :getter "gtk_window_get_gravity"
273      :setter "gtk_window_set_gravity"
274      :accessor window-gravity
275      :initarg :gravity
276      :type gdk:gravity)
277     (focus-widget
278      :allocation :virtual
279      :getter "gtk_window_get_focus"
280      :setter "gtk_window_set_focus"
281      :accessor window-focus-widget
282      :initarg :focus-widget
283      :type widget)
284     (default-widget
285      :allocation :virtual
286      :getter "gtk_window_get_default"
287      :setter "gtk_window_set_default"
288      :accessor window-default-widget
289      :initarg :default-widget
290      :type widget)
291     (decorated
292      :allocation :virtual
293      :getter "gtk_window_get_decorated"
294      :setter "gtk_window_set_decorated"
295      :accessor window-decorated-p
296      :initarg :decorated
297      :type boolean)
298     (has-frame
299      :allocation :virtual
300      :getter "gtk_window_get_has_frame"
301      :setter "gtk_window_set_has_frame"
302      :accessor window-has-frame-p
303      :initarg :has-frame
304      :type boolean)
305     (role
306      :allocation :virtual
307      :getter "gtk_window_get_role"
308      :setter "gtk_window_set_role"
309      :accessor window-role
310      :initarg :role
311      :type string)
312     (type-hint
313      :allocation :virtual
314      :getter "gtk_window_get_type_hint"
315      :setter "gtk_window_set_type_hint"
316      :accessor window-type-hint
317      :initarg :type-hint
318      :type gdk:window-type-hint)
319     (icon
320      :allocation :virtual
321      :getter window-icon
322      :setter (setf window-icon)
323      :initarg :icon)
324     (mnemonic-modifier
325      :allocation :virtual
326      :getter "gtk_window_get_mnemonic_modifier"
327      :setter "gtk_window_set_mnemonic_modifier"
328      :accessor window-mnemonic-modifier
329      :initarg :mnemonic-modifier
330      :type gdk:modifier-type)
331     (transient-for
332      :allocation :virtual
333      :getter "gtk_window_get_transient_for"
334      :setter "gtk_window_set_transient_for"
335      :accessor window-transient-for
336      :initarg :transient-for
337      :type window)))
338   
339   ("GtkTooltips"
340    :slots
341    ((enabled
342      :allocation :virtual
343      :getter "gtk_tooltips_get_enabled"
344      :setter (setf tooltips-enabled-p)
345      :reader tooltips-enabled-p
346      :initarg :enabled
347      :type boolean)))
348   
349   ("GtkOptionMenu"
350    :slots
351    ((menu
352      :allocation :virtual
353      :getter "gtk_option_menu_get_menu"
354      :setter (setf option-menu-menu)
355      :reader option-menu-menu
356      :initarg :menu
357      :type menu)
358     (history
359      :allocation :virtual
360      :getter "gtk_option_menu_get_history"
361      :setter "gtk_option_menu_set_history"
362      :accessor option-menu-history
363      :initarg :history
364      :type unsigned-int)))
365
366   ("GtkMenuItem"
367    :slots
368    ((label
369      :allocation :virtual
370      :getter menu-item-label
371      :setter (setf menu-item-label)
372      :initarg :label
373      :type string)
374     (right-justified
375      :allocation :virtual
376      :getter "gtk_menu_item_get_right_justified"
377      :setter "gtk_menu_item_set_right_justified"
378      :accessor menu-item-right-justified-p
379      :initarg :right-justified
380      :type boolean)
381     (submenu
382      :allocation :virtual
383      :getter "gtk_menu_item_get_submenu"
384      :setter (setf menu-item-submenu)
385      :reader menu-item-submenu
386      :initarg :submenu
387      :type menu-item)))
388
389   ("GtkColorSelectionDialog"
390    :slots
391    ((colorsel
392      :allocation :alien
393      :reader color-selection-dialog-colorsel
394      :type widget)
395     (ok-button
396      :allocation :alien
397      :reader color-selection-dialog-ok-button
398      :type widget)
399     (cancel-button
400      :allocation :alien
401      :reader color-selection-dialog-cancel-button
402      :type widget)
403     (help-button
404      :allocation :alien
405      :reader color-selection-dialog-help-button
406      :type widget)))
407
408   ("GtkScrolledWindow"
409    :slots
410    ((hscrollbar
411      :allocation :alien
412      :reader scrolled-window-hscrollbar
413      :type widget)
414     (vscrollbar
415      :allocation :alien
416      :reader scrolled-window-vscrollbar
417      :type widget)))
418
419   ("GtkPaned"
420    :slot
421    ((child1
422     :allocation :virtual
423     :getter paned-child1
424     :setter (setf paned-child1)
425     :initarg :child1
426     :type widget)
427    (child2
428     :allocation :virtual
429     :getter paned-child2
430     :setter (setf paned-child2)
431     :initarg :child2
432     :type widget)))
433
434   ("GtkMenu"
435    :slots
436    ((accel-group
437      :allocation :virtual
438      :getter "gtk_menu_get_accel_group"
439      :setter "gtk_menu_set_accel_group"
440      :accessor menu-accel-group
441      :initarg :accel-group
442      :type accel-group)
443     (title
444      :allocation :virtual
445      :getter "gtk_menu_get_title"
446      :setter "gtk_menu_set_title"
447      :accessor menu-title
448      :initarg :title
449      :type string)
450     (active
451      :allocation :virtual
452      :getter "gtk_menu_get_active"
453      :setter (setf menu-active)
454      :reader menu-active
455      :initarg :active
456      :type widget)
457     (tornoff
458      :allocation :virtual
459      :getter "gtk_menu_get_tearoff_state"
460      :setter "gtk_menu_set_tearoff_state"
461      :accessor menu-tornoff-p
462      :initarg :tearoff
463      :type boolean)))
464
465   ("GtkToolbar"
466    :slots
467    ((tooltips
468      :allocation :virtual
469      :getter "gtk_toolbar_get_tooltips"
470      :setter "gtk_toolbar_set_tooltips"
471      :accessor toolbar-tooltips-p
472      :initarg :tooltips
473      :type boolean)
474     (icon-size
475      :allocation :virtual
476      :getter "gtk_toolbar_get_icon_size"
477      :setter "gtk_toolbar_set_icon_size"
478      :accessor toolbar-icon-size
479      :initarg :icon-size
480      :type icon-size)))
481
482   ("GtkNotebook"
483    :slots
484    ((current-page
485      :allocation :virtual
486      :getter notebook-current-page
487      :setter (setf notebook-current-page)
488      :initarg :current-page)
489     (page :ignore t)))
490   
491   ("GtkRuler"
492    :slots
493    ((metric
494      :allocation :virtual
495      :getter "gtk_ruler_get_metric"
496      :setter "gtk_ruler_set_metric"
497      :accessor ruler-metric
498      :initarg :metric
499      :type metric-type)))
500
501   ("GtkProgressBar"
502    :slots
503    ; deprecated properties
504    ((bar-style :ignore t)
505     (adjustment :ignore t)
506     (activity-step :ignore t)
507     (activity-blocks :ignore t)
508     (discrete-blocks :ignore t)))
509
510   ("GtkTable"
511    :slots
512    ((column-spacing
513      :allocation :virtual
514      :getter "gtk_table_get_default_col_spacing"
515      :setter "gtk_table_set_col_spacings"
516      :initarg :column-spacing
517      :type unsigned-int)
518     (row-spacing
519      :allocation :virtual
520      :getter "gtk_table_get_default_row_spacing"
521      :setter "gtk_table_set_row_spacings"
522      :initarg :row-spacing
523      :type unsigned-int)))
524
525   ("GtkDialog"
526    :slots
527    ((main-area
528      :allocation :virtual
529      :getter "gtk_dialog_get_vbox"
530      :reader dialog-main-area
531      :type widget)
532     (action-area
533      :allocation :virtual
534      :getter "gtk_dialog_get_action_area"
535      :reader dialog-action-area
536      :type widget)))
537
538   ("GtkCombo"
539    :slots
540    ((entry
541      :allocation :virtual
542      :getter "gtk_combo_get_entry"
543      :reader combo-entry
544      :type entry)))
545   
546   ("GtkRadioButton"
547    :slots
548    ((group
549      :allocation :virtual
550      :getter "gtk_radio_button_get_group"
551      :reader radio-button-group
552      :type (static (gslist widget)))))
553
554   ("GtkRadioMenuItem"
555    :slots
556    ((group
557      :allocation :virtual
558      :getter "gtk_radio_menu_item_get_group"
559      :reader radio-menu-item-group
560      :type (static (gslist widget)))))
561
562   ("GtkFileSelection"
563    :slots
564    ((action-area
565      :allocation :virtual
566      :getter "gtk_file_selection_get_action_area"
567      :reader file-selection-action-area
568      :type widget)
569     (ok-button
570      :allocation :virtual
571      :getter "gtk_file_selection_get_ok_button"
572      :reader file-selection-ok-button
573      :type widget)
574     (cancel-button
575      :allocation :virtual
576      :getter "gtk_file_selection_get_cancel_button"
577      :reader file-selection-cancel-button
578      :type widget)))
579
580   ("GtkLayout"
581    :slots
582    ((bin-window
583      :getter "gtk_layout_get_bin_window"
584      :reader layout-bin-window
585      :type gdk:window)))
586
587   ("GtkFixed"
588    :slots
589    ((has-window
590      :getter "gtk_fixed_get_has_window"
591      :setter "gtk_fixed_set_has_window"
592      :reader fixed-has-window-p
593      :initarg :has-window
594      :type boolean)))
595      
596   ;; Not needed
597   ("GtkFundamentalType" :ignore t)
598   ("GtkArgFlags" :ignore t)
599
600   
601   ;; Deprecated widgets
602   ("GtkCList" :ignore-prefix t)
603   ("GtkCTree" :ignore-prefix t)
604   ("GtkList" :ignore-prefix t)
605   ("GtkTree" :ignore t)
606   ("GtkTreeItem" :ignore t)
607   ("GtkText" :ignore-prefix t :except ("GtkTextDirection"))
608   ("GtkPacker" :ignore-prefix t)
609   ("GtkPixmap" :ignore t)
610   ("GtkPreview" :ignore-prefix t)
611   ("GtkTipsQuery" :ignore t)
612   ("GtkOldEditable" :ignore t))