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