chiark / gitweb /
Toolbar demo updated to use the new API
[clg] / gtk / gtktypes.lisp
index 21517909733b62e58c3a86e4d6e90c21664da91f..5a3b811883fef0fcbc594b55ac6dc2934e563709 100644 (file)
@@ -15,7 +15,7 @@
 ;; License along with this library; if not, write to the Free Software
 ;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-;; $Id: gtktypes.lisp,v 1.20 2004-11-21 17:57:56 espen Exp $
+;; $Id: gtktypes.lisp,v 1.28 2005-01-06 21:05:46 espen Exp $
 
 
 (in-package "GTK")
@@ -106,7 +106,7 @@ (defclass stock-item (struct)
     :accessor stock-item-translation-domain
     :initarg :translation-domain
     :type string))
-  (:metaclass static-struct-class))
+  (:metaclass struct-class))
 
 ;; We don't really need to access any of these slots, but we need to
 ;; specify the size of the struct somehow 
@@ -126,6 +126,15 @@ (defclass tree-iter (boxed)
 (deftype tree-path () '(vector integer))
 (register-type 'tree-path "GtkTreePath")
 
+(deftype position () '(or int (enum (:start 0) (:end -1))))
+
+;; Forward definitions
+(defclass widget (%object)
+  ()
+  (:metaclass gobject-class))
+(defclass container (widget)
+  ()
+  (:metaclass gobject-class))
 
 
 (define-types-by-introspection "Gtk"
@@ -135,20 +144,15 @@ (define-types-by-introspection "Gtk"
   ("GtkBorder" :ignore t)
   ("GtkTreeIter" :ignore t)
   ("GtkTreePath" :ignore t)
+;  ("GtkStyle" :ignore t)
 
   ;; Manual override
   ("GtkWidget"
    :slots
-   ((child-slots
+   ((child-properties
      :allocation :instance
-     :accessor widget-child-slots
+     :accessor widget-child-properties
      :type container-child)
-    (parent-window
-     :allocation :virtual
-     :getter "gtk_widget_get_parent_window"
-     :setter "gtk_widget_set_parent_window"
-     :accessor widget-parent-window
-     :type gdk:window)
     (window
      :allocation :virtual
      :getter "gtk_widget_get_window"
@@ -198,16 +202,30 @@ (define-types-by-introspection "Gtk"
      :setter "gtk_widget_set_child_visible"
      :accessor widget-child-visible-p
      :initarg :child-visible
-     :type boolean)))
+     :type boolean)
+    (width-request
+     :merge t :unbound -1)
+    (height-request
+     :merge t :unbound -1)))
      
   ("GtkContainer"
    :slots
-   ((child
-     :ignore t)
+   ((child :ignore t)
     (children
      :allocation :virtual
      :getter container-children
-     :setter (setf container-children))
+     :setter (setf container-children)
+     ;; The following doesn't work because gtk_container_get_children doesn't
+     ;; increase the reference count of the children
+;     :getter "gtk_container_get_children"
+;     :reader container-children
+;     :type (glist widget)
+     )
+    (child-type
+     :allocation :virtual
+     :getter "gtk_container_child_type"
+     :reader container-child-type
+     :type gtype)
     (focus-child
      :allocation :virtual
      :getter "gtk_container_get_focus_child"
@@ -232,7 +250,14 @@ (define-types-by-introspection "Gtk"
      :setter "gtk_container_set_focus_vadjustment"
      :accessor container-focus-vadjustment
      :initarg :focus-vadjustment
-     :type adjustment)))
+     :type adjustment)
+    (reallocate-redraws
+     :allocation :virtual
+     :getter "gtk_container_get_reallocate_redraws"
+     :setter "gtk_container_set_reallocate_redraws"
+     :accessor container-reallocate-redraws
+     :initarg :reallocate-redraws
+     :type boolean)))
       
   ("GtkBin"
    :slots
@@ -245,14 +270,7 @@ (define-types-by-introspection "Gtk"
 
   ("GtkWindow"
    :slots
-   ((gravity
-     :allocation :virtual
-     :getter "gtk_window_get_gravity"
-     :setter "gtk_window_set_gravity"
-     :accessor window-gravity
-     :initarg :gravity
-     :type gdk:gravity)
-    (focus-widget
+   ((focus-widget
      :allocation :virtual
      :getter "gtk_window_get_focus"
      :setter "gtk_window_set_focus"
@@ -266,13 +284,6 @@     (default-widget
      :accessor window-default-widget
      :initarg :default-widget
      :type widget)
-    (decorated
-     :allocation :virtual
-     :getter "gtk_window_get_decorated"
-     :setter "gtk_window_set_decorated"
-     :accessor window-decorated-p
-     :initarg :decorated
-     :type boolean)
     (has-frame
      :allocation :virtual
      :getter "gtk_window_get_has_frame"
@@ -280,25 +291,13 @@     (default-widget
      :accessor window-has-frame-p
      :initarg :has-frame
      :type boolean)
-    (role
+    (icon-list
      :allocation :virtual
-     :getter "gtk_window_get_role"
-     :setter "gtk_window_set_role"
-     :accessor window-role
-     :initarg :role
-     :type string)
-    (type-hint
-     :allocation :virtual
-     :getter "gtk_window_get_type_hint"
-     :setter "gtk_window_set_type_hint"
-     :accessor window-type-hint
-     :initarg :type-hint
-     :type gdk:window-type-hint)
-    (icon
-     :allocation :virtual
-     :getter window-icon
-     :setter (setf window-icon)
-     :initarg :icon)
+     :getter "gtk_window_get_icon_list"
+     :setter "gtk_window_set_icon_list"
+     :accessor window-icon-list
+     :initarg :icon-list
+     :type (glist gdk:pixbuf))
     (mnemonic-modifier
      :allocation :virtual
      :getter "gtk_window_get_mnemonic_modifier"
@@ -312,8 +311,24 @@     (default-widget
      :setter "gtk_window_set_transient_for"
      :accessor window-transient-for
      :initarg :transient-for
-     :type window)))
+     :type window)
+    (group
+     :allocation :virtual
+     :getter "gtk_window_get_group"
+     :setter (setf window-group)
+     :reader window-group
+     :initarg :group
+     :type window-group)
+    (default-width :merge t :unbound -1)
+    (default-height :merge t :unbound -1)))
   
+  ("GtkWindowGroup"
+   :slots
+   ((grabs
+     :allocation :alien
+     :accessor window-group-grabs
+     :type (gslist window))))
+
   ("GtkTooltips"
    :slots
    ((enabled
@@ -324,31 +339,18 @@     (default-widget
      :initarg :enabled
      :type boolean)))
   
-  ("GtkOptionMenu"
-   :slots
-   ((menu
-     :allocation :virtual
-     :getter "gtk_option_menu_get_menu"
-     :setter (setf option-menu-menu)
-     :reader option-menu-menu
-     :initarg :menu
-     :type menu)
-    (history
-     :allocation :virtual
-     :getter "gtk_option_menu_get_history"
-     :setter "gtk_option_menu_set_history"
-     :accessor option-menu-history
-     :initarg :history
-     :type unsigned-int)))
-
   ("GtkMenuItem"
    :slots
    ((label
      :allocation :virtual
      :getter menu-item-label
      :setter (setf menu-item-label)
-     :initarg :label
      :type string)
+    (use-underline
+     :allocation :user-data
+     :initform nil
+     :initarg :use-underline
+     :accessor menu-item-use-underline-p)
     (right-justified
      :allocation :virtual
      :getter "gtk_menu_item_get_right_justified"
@@ -359,10 +361,10 @@     (default-widget
     (submenu
      :allocation :virtual
      :getter "gtk_menu_item_get_submenu"
-     :setter (setf menu-item-submenu)
-     :reader menu-item-submenu
+     :setter "gtk_menu_item_set_submenu"
+     :accessor menu-item-submenu
      :initarg :submenu
-     :type menu-item)))
+     :type widget)))
 
   ("GtkColorSelectionDialog"
    :slots
@@ -398,14 +400,16 @@     (default-widget
    :slots
    ((child1
     :allocation :virtual
-    :getter paned-child1
-    :setter (setf paned-child1)
+    :getter "gtk_paned_get_child1"
+    :setter "gtk_paned_add1"
+    :accessor paned-child1
     :initarg :child1
     :type widget)
    (child2
     :allocation :virtual
-    :getter paned-child2
-    :setter (setf paned-child2)
+    :getter "gtk_paned_get_child2"
+    :setter "gtk_paned_add2"
+    :accessor paned-child2
     :initarg :child2
     :type widget)))
 
@@ -418,13 +422,6 @@     (default-widget
      :accessor menu-accel-group
      :initarg :accel-group
      :type accel-group)
-    (title
-     :allocation :virtual
-     :getter "gtk_menu_get_title"
-     :setter "gtk_menu_set_title"
-     :accessor menu-title
-     :initarg :title
-     :type string)
     (active
      :allocation :virtual
      :getter "gtk_menu_get_active"
@@ -432,36 +429,100 @@     (default-widget
      :reader menu-active
      :initarg :active
      :type widget)
-    (tornoff
+    (screen
+     :allocation :virtual
+     :getter "gtk_menu_get_screen"
+     :setter "gtk_menu_set_screen"
+     :accessor menu-screen
+     :initarg :screen
+     :type gdk:screen)
+    (attach-widget
+     :allocation :virtual
+     :getter "gtk_menu_get_attach_widget"
+     :reader menu-attach-widget
+     :type widget)
+    #-gtk2.6
+    (tearoff-state
      :allocation :virtual
      :getter "gtk_menu_get_tearoff_state"
      :setter "gtk_menu_set_tearoff_state"
-     :accessor menu-tornoff-p
-     :initarg :tearoff
+     :accessor menu-tearoff-state-p
+     :initarg :tearoff-state
      :type boolean)))
 
   ("GtkToolbar"
    :slots
-   ((tooltips
+   ((show-tooltips
      :allocation :virtual
      :getter "gtk_toolbar_get_tooltips"
      :setter "gtk_toolbar_set_tooltips"
-     :accessor toolbar-tooltips-p
-     :initarg :tooltips
+     :accessor toolbar-show-tooltips-p
+     :initarg :show-tooltips
      :type boolean)
-    (icon-size
+    (tooltips
      :allocation :virtual
-     :getter "gtk_toolbar_get_icon_size"
-     :setter "gtk_toolbar_set_icon_size"
-     :accessor toolbar-icon-size
-     :initarg :icon-size
-     :type icon-size)
+     :getter "gtk_toolbar_get_tooltips_object"
+     :reader toolbar-tooltips
+     :type tooltips)
     (toolbar-style
      :allocation :property
      :pname "toolbar-style"
      :initarg :toolbar-style
      :accessor toolbar-style
-     :type toolbar-style)))
+     :type toolbar-style)
+    (n-items
+     :allocation :virtual
+     :getter "gtk_toolbar_get_n_items"
+     :reader toolbar-n-items
+     :type int)))
+
+  ("GtkToolItem"
+   :slots
+   ((use-drag-window
+     :allocation :virtual
+     :getter "gtk_tool_item_get_use_drag_window"
+     :setter "gtk_tool_item_set_use_drag_window"
+     :accessor tool-item-use-drag-window-p
+     :initarg :drag-window
+     :type boolean)
+    (tip-text 
+     :allocation :user-data
+     :setter (setf tool-item-tip-text)
+     :initarg :tip-text
+     :reader tool-item-tip-text)
+    (tip-private
+     :allocation :user-data
+     :setter (setf tool-item-tip-private)
+     :initarg :tip-private
+     :reader tool-item-tip-private)))
+
+  ("GtkToolButton"
+   :slots
+   ((stock-id :merge t :initarg :stock)
+    (icon-widget :merge t :initarg :icon)))
+
+  ("GtkToggleToolButton"
+   :slots
+   ((active
+     :allocation :virtual
+     :getter "gtk_toggle_tool_button_get_active"
+     :setter "gtk_toggle_tool_button_get_active"
+     :accessor toggle-tool-button-active-p
+     :initarg :active
+     :type boolean)))
+
+  ("GtkRadioToolButton"
+   :slots
+   ((group
+     :allocation :virtual
+     :getter "gtk_radio_tool_button_get_group"
+     :reader radio-tool-button-group
+     :type (copy-of (gslist widget)))
+    (value 
+     :allocation :user-data
+     :initarg :value
+     :accessor radio-tool-button-value
+     :documentation "Value passed as argument to the activate callback")))
 
   ("GtkNotebook"
    :slots
@@ -491,6 +552,16 @@     (default-widget
     (activity-blocks :ignore t)
     (discrete-blocks :ignore t)))
 
+  ("GtkHandleBox"
+   :slots
+   ; deprecated property
+   ((shadow :ignore t)))
+
+  ("GtkFrame"
+   :slots
+   ; deprecated property
+   ((shadow :ignore t)))
+
   ("GtkTable"
    :slots
    ((column-spacing
@@ -519,21 +590,46 @@     (default-widget
      :reader dialog-action-area
      :type widget)))
 
-  ("GtkCombo"
+  ("GtkEntry"
+   :slots
+   ((layout
+     :allocation :virtual
+     :getter "gtk_entry_get_layout"
+     :reader entry-layout
+     :type pango:layout)
+    (completion
+     :getter "gtk_entry_get_completion"
+     :setter "gtk_entry_set_completion"
+     :initarg :completion
+     :accessor entry-completion
+     :type entry-completion)
+    (max-length :merge t :unbound 0)
+    #+gtk2.6
+    (with-chars :merge t :unbound -1)))
+
+  ("GtkEntryCompletion"
    :slots
    ((entry
      :allocation :virtual
-     :getter "gtk_combo_get_entry"
-     :reader combo-entry
-     :type entry)))
-  
+     :getter "gtk_entry_completion_get_entry"
+     :reader entry-completion-entry
+     :type entry)
+    (minimum-key-length :merge t :unbound -1)
+    #+gtk2.6
+    (text-column :merge t :unbound -1)))
+
   ("GtkRadioButton"
    :slots
    ((group
      :allocation :virtual
      :getter "gtk_radio_button_get_group"
      :reader radio-button-group
-     :type (static (gslist widget)))))
+     :type (copy-of (gslist widget)))
+    (value 
+     :allocation :user-data
+     :initarg :value
+     :accessor radio-button-value
+     :documentation "Value passed as argument to the activate callback")))
 
   ("GtkRadioMenuItem"
    :slots
@@ -541,7 +637,12 @@     (default-widget
      :allocation :virtual
      :getter "gtk_radio_menu_item_get_group"
      :reader radio-menu-item-group
-     :type (static (gslist widget)))))
+     :type (copy-of (gslist widget)))
+    (value 
+     :allocation :user-data
+     :initarg :value
+     :accessor radio-menu-item-value
+     :documentation "Value passed as argument to the activate callback")))
 
   ("GtkFileSelection"
    :slots
@@ -611,9 +712,18 @@     (default-widget
 
   ("GtkImage"
    :slots
-   ((file :ignore t)))
-       
-  ;; Interfaces
+   ((file :ignore t)
+    #+gtk2.6
+    (pixel-size :merge t :unbound -1)))
+
+  ("GtkLabel"
+   :slots
+   ((layout
+     :allocation :virtual
+     :getter "gtk_label_get_layout"
+     :reader label-layout
+     :type pango:layout)))
+
   ("GtkEditable"
    :slots
    ((editable
@@ -629,7 +739,7 @@     (default-widget
      :setter "gtk_editable_set_position"
      :reader editable-position
      :initarg :position
-     :type int)
+     :type position)
     (text
      :allocation :virtual
      :getter editable-text
@@ -718,8 +828,100 @@     (default-widget
      :accessor combo-box-active-iter 
      :type tree-iter)))
 
+  ("GtkTextBuffer"
+   :slots
+   ((line-count
+     :allocation :virtual
+     :getter "gtk_text_buffer_get_line_count"
+     :reader text-buffer-line-count
+     :type int)
+    (char-count
+     :allocation :virtual
+     :getter "gtk_text_buffer_get_char_count"
+     :reader text-buffer-char-count
+     :type int)
+    (modified
+     :allocation :virtual
+     :getter "gtk_text_buffer_get_modified"
+     :setter "gtk_text_buffer_set_modified"
+     :accessor text-buffer-modifed-p
+     :type boolean)))
+
+  ("GtkTextView"
+   :slots
+   ((default-attributes
+     :allocation :virtual
+     :getter "gtk_text_view_get_default_attributes"
+     :reader text-view-default-attributes
+     :type text-attributes)))
+
+  ("GtkTextTagTable"
+   :slots
+   ((size
+     :allocation :virtual
+     :getter "gtk_text_tag_table_get_size"
+     :reader text-tag-table-size
+     :type int)))
+
+  ("GtkTextTag"
+   :slots
+   ((priority
+     :allocation :virtual
+     :getter "gtk_text_tag_get_priority"
+     :setter "gtk_text_tag_set_priority"
+     :accessor text-tag-priority
+     :type int)
+    (weight
+     :merge t :type pango:weight)))
+
+  ("GtkUIManager"
+   :type ui-manager
+   :slots
+   ((action-groups
+     :allocation :virtual
+     :getter "gtk_ui_manager_get_action_groups"
+     :reader ui-manager-action-groups
+     :type (copy-of (glist action-group)))
+    (accel-group
+     :allocation :virtual
+     :getter "gtk_ui_manager_get_accel_group"
+     :reader ui-manager-accel-group
+     :type accel-group)))
+
+  ("GtkUIManagerItemType"
+   :type ui-manager-item-type)
+
+  ("GtkToggle"
+   :slots
+   ((accelerator
+     :allocation :virtual
+     :getter action-accelerator)))
+
+  ("GtkToggleAction"
+   :slots
+   ((active
+     :allocation :virtual
+     :getter "gtk_toggle_action_get_active"
+     :setter "gtk_toggle_action_set_active"
+     :initarg :active
+     :accessor toggle-action-active-p
+     :type boolean)))
+
+  ("GtkRadioAction"
+   :slots
+   ((group
+     :allocation :virtual
+     :getter "gtk_radio_button_get_group"
+     :reader radio-action-group
+     :type (copy-of (gslist widget)))
+    (%value
+     :allocation :property  :pname "value"
+     :readable nil :type int)
+    (value 
+     :allocation :virtual
+     :getter radio-action-value)))
+
 
-     
   ;; Not needed
   ("GtkFundamentalType" :ignore t)
   ("GtkArgFlags" :ignore t)
@@ -733,7 +935,7 @@     (default-widget
   ("GtkTree" :ignore t)
   ("GtkTreeItem" :ignore t)
   ("GtkItemFactory" :ignore t)
-  ("GtkText" :ignore-prefix t :except ("GtkTextDirection"))
+  ("GtkText" :ignore t)
   ("GtkPacker" :ignore-prefix t)
   ("GtkPixmap" :ignore t)
   ("GtkPreview" :ignore-prefix t)
@@ -749,3 +951,74 @@     (default-widget
   ("GtkThemeEngine" :ignore t)
 
   )
+
+
+(defclass text-iter (boxed)
+  ((buffer
+    :allocation :virtual
+    :getter "gtk_text_iter_get_buffer"
+    :reader text-iter-buffer
+    :type text-buffer)
+   (offset
+    :allocation :virtual
+    :getter "gtk_text_iter_get_offset"
+    :setter "gtk_text_iter_set_offset"
+    :accessor text-iter-offset
+    :type int)
+   (line
+    :allocation :virtual
+    :getter "gtk_text_iter_get_line"
+    :setter "gtk_text_iter_set_line"
+    :accessor text-iter-line
+    :type int)
+   (line-offset
+    :allocation :virtual
+    :getter "gtk_text_iter_get_line_offset"
+    :setter "gtk_text_iter_set_line_offset"
+    :accessor text-iter-line-offset
+    :type int)
+   (line-index
+    :allocation :virtual
+    :getter "gtk_text_iter_get_line_index"
+    :setter "gtk_text_iter_set_line_index"
+    :accessor text-iter-line-index
+    :type int)
+   (visible-line-index
+    :allocation :virtual
+    :getter "gtk_text_iter_get_visible_line_index"
+    :setter "gtk_text_iter_set_visible_line_index"
+    :accessor text-iter-visible-line-index
+    :type int)
+   (visible-line-offset
+    :allocation :virtual
+    :getter "gtk_text_iter_get_visible_line_offset"
+    :setter "gtk_text_iter_set_visible_line_offset"
+    :accessor text-iter-visible-line-offset
+    :type int)
+   ;; Workaround to get correct size 
+   (dummy14
+     :allocation :alien :offset #.(* 13 (size-of 'pointer))
+     :type pointer))
+  (:metaclass boxed-class 
+   ;; I am pretty sure this was working in older versons on CMUCL
+   :size #.(* 14 (size-of 'pointer))))
+
+
+(defclass tooltips-data (struct)
+  ((tooltips
+    :allocation :alien
+    :reader tooltips-data-tooltips
+    :type tooltips)
+   (widget
+    :allocation :alien
+    :reader tooltips-data-widget
+    :type widget)
+   (tip-text
+    :allocation :alien
+    :reader tooltips-data-tip-text
+    :type string)
+   (tip-private
+    :allocation :alien
+    :reader tooltips-data-tip-private
+    :type string))
+  (:metaclass struct-class))