;; -*- scheme -*-
; vim:syntax=scheme:sw=2

(define-boxed Event
  (in-module "Dia")
  (c-name "DiaEvent")
  (gtype-id "DIA_TYPE_EVENT")
)

(define-boxed CanvasIter
  (in-module "Dia")
  (c-name "DiaCanvasIter")
  (gtype-id "DIA_TYPE_CANVAS_ITER")
  (copy-func "dia_canvas_iter_copy")
  (release-func "g_free")
)

;;
;; interface definitions
;;
(define-interface CanvasGroupableIface
  (in-module "Dia")
  (c-name "DiaCanvasGroupable")
  (gtype-id "DIA_TYPE_CANVAS_GROUPABLE")
)

(define-interface CanvasEditableIface
  (in-module "Dia")
  (c-name "DiaCanvasEditable")
  (gtype-id "DIA_TYPE_CANVAS_EDITABLE")
)

; Create a dummy class that "implements" the DiaCanvasGroupable interface
(define-object CanvasGroupable
  (in-module "Dia")
  (parent "GObject")
  (implements "DiaCanvasGroupable")
  (c-name "DiaCanvasGroupableImpl")
  (gtype-id "DIA_TYPE_CANVAS_GROUPABLE")
)

(define-object CanvasEditable
  (in-module "Dia")
  (parent "GObject")
  (implements "DiaCanvasEditable")
  (c-name "DiaCanvasEditableImpl")
  (gtype-id "DIA_TYPE_CANVAS_EDITABLE")
)

;;
;; object definitions
;;
(define-object Canvas
  (in-module "Dia")
  (parent "GObject")
  (c-name "DiaCanvas")
  (gtype-id "DIA_TYPE_CANVAS")
  (fields
    '("DiaCanvasItem*" "root")
    '("gboolean" "allow_state_requests")
    '("gboolean" "in_undo")
  )
)

(define-object CanvasItem
  (in-module "Dia")
  (parent "GObject")
  (c-name "DiaCanvasItem")
  (gtype-id "DIA_TYPE_CANVAS_ITEM")
  (fields
    '("DiaCanvasItemFlags" "flags")
    '("DiaCanvas*" "canvas" (null-ok))
    '("DiaCanvasItem*" "parent" (null-ok))
    '("GList*" "handles" (null-ok))
    '("DiaRectangle*" "bounds")
    '("DiaAffine" "affine")
  )
)

(define-object CanvasGroup
  (in-module "Dia")
  (parent "DiaCanvasItem")
  (implements "DiaCanvasGroupable")
  (c-name "DiaCanvasGroup")
  (gtype-id "DIA_TYPE_CANVAS_GROUP")
  (fields
    '("DiaCanvasItem*" "children" (null-ok))
  )
)

(define-object CanvasElement
  (in-module "Dia")
  (parent "DiaCanvasItem")
  (c-name "DiaCanvasElement")
  (gtype-id "DIA_TYPE_CANVAS_ELEMENT")
  (fields
    '("gdouble" "width")
    '("gdouble" "height")
    '("gdouble" "min_width")
    '("gdouble" "min_height")
  )
)

(define-object CanvasImage
  (in-module "Dia")
  (parent "DiaCanvasElement")
  (c-name "DiaCanvasImage")
  (gtype-id "DIA_TYPE_CANVAS_IMAGE")
)

(define-object CanvasBox
  (in-module "Dia")
  (parent "DiaCanvasElement")
  (c-name "DiaCanvasBox")
  (gtype-id "DIA_TYPE_CANVAS_BOX")
)

(define-object CanvasLine
  (in-module "Dia")
  (parent "DiaCanvasItem")
  (c-name "DiaCanvasLine")
  (gtype-id "DIA_TYPE_CANVAS_LINE")
)

(define-object CanvasText
  (in-module "Dia")
  (parent "DiaCanvasItem")
  (implements "DiaCanvasEditable")
  (c-name "DiaCanvasText")
  (gtype-id "DIA_TYPE_CANVAS_TEXT")
  (fields
    '("GString*" "text")
    '("gdouble" "width")
    '("gdouble" "height")
    '("gint" "cursor")
    '("gboolean" "multiline")
    '("gboolean" "editable")
  )
)

(define-object Constraint
  (in-module "Dia")
  (parent "GObject")
  (c-name "DiaConstraint")
  (gtype-id "DIA_TYPE_CONSTRAINT")
)

(define-object Handle
  (in-module "Dia")
  (parent "GObject")
  (c-name "DiaHandle")
  (gtype-id "DIA_TYPE_HANDLE")
  (fields
    '("DiaCanvasItem*" "owner")
    '("DiaCanvasItem*" "connected_to" (null-ok))
    '("gboolean" "movable")
    '("gboolean" "connectable")
    '("DiaVariable*" "x")
    '("DiaVariable*" "y")
    '("DiaVariable*" "wx")
    '("DiaVariable*" "wy")
  )
)

(define-object Solver
  (in-module "Dia")
  (parent "GObject")
  (c-name "DiaSolver")
  (gtype-id "DIA_TYPE_SOLVER")
)

;(define-object PlacementTool
;  (in-module "Dia")
;  (parent "DiaTool")
;  (c-name "DiaPlacementTool")
;  (gtype-id "DIA_TYPE_PLACEMENT_TOOL")
;  (fields
;    '("DiaCanvasItem*" "new_object" (null-ok))
;  )
;)

(define-object Variable
  (in-module "Dia")
  (parent "GObject")
  (c-name "DiaVariable")
  (gtype-id "DIA_TYPE_VARIABLE")
  (fields
    '("gdouble" "value")
    '("DiaStrength" "strength")
  )
)

(define-object ExportSVG
  (in-module "Dia")
  (parent "GObject")
  (c-name "DiaExportSVG")
  (gtype-id "DIA_TYPE_EXPORT_SVG")
)


;; Enumerations and flags ...

(define-flags CanvasItemFlags
  (in-module "Dia")
  (c-name "DiaCanvasItemFlags")
  (gtype-id "DIA_TYPE_CANVAS_ITEM_FLAGS")
  (values
    '("visible" "DIA_VISIBLE")
    '("interactive" "DIA_INTERACTIVE")
    '("composite" "DIA_COMPOSITE")
    '("need-update" "DIA_NEED_UPDATE")
    '("update-all" "DIA_UPDATE_ALL")
  )
)

(define-enum CanvasItemUIStateFlags
  (in-module "Dia")
  (c-name "DiaCanvasItemUIStateFlags")
  (gtype-id "DIA_TYPE_CANVAS_ITEM_UI_STATE_FLAGS")
  (values
    '("unselected" "DIA_UI_STATE_UNSELECTED")
    '("selected" "DIA_UI_STATE_SELECTED")
    '("focused" "DIA_UI_STATE_FOCUSED")
    '("grabbed" "DIA_UI_STATE_GRABBED")
    '("unchanged" "DIA_UI_STATE_UNCHANGED")
  )
)

(define-enum CanvasElementHandle
  (in-module "Dia")
  (c-name "DiaCanvasElementHandle")
  (gtype-id "DIA_TYPE_CANVAS_ELEMENT_HANDLE")
  (values
    '("nw" "DIA_HANDLE_NW")
    '("n" "DIA_HANDLE_N")
    '("ne" "DIA_HANDLE_NE")
    '("e" "DIA_HANDLE_E")
    '("se" "DIA_HANDLE_SE")
    '("s" "DIA_HANDLE_S")
    '("sw" "DIA_HANDLE_SW")
    '("w" "DIA_HANDLE_W")
  )
)

(define-enum EventType
  (in-module "Dia")
  (c-name "DiaEventType")
  (gtype-id "DIA_TYPE_EVENT_TYPE")
  (values
    '("button-press" "DIA_EVENT_BUTTON_PRESS")
    '("2button-press" "DIA_EVENT_2BUTTON_PRESS")
    '("3button-press" "DIA_EVENT_3BUTTON_PRESS")
    '("button-release" "DIA_EVENT_BUTTON_RELEASE")
    '("motion" "DIA_EVENT_MOTION")
    '("key-press" "DIA_EVENT_KEY_PRESS")
    '("key-release" "DIA_EVENT_KEY_RELEASE")
  )
)

(define-flags EventMask
  (in-module "Dia")
  (c-name "DiaEventMask")
  (gtype-id "DIA_TYPE_EVENT_MASK")
  (values
    '("shift" "DIA_EVENT_MASK_SHIFT")
    '("lock" "DIA_EVENT_MASK_LOCK")
    '("ctrl" "DIA_EVENT_MASK_CTRL")
    '("mod1" "DIA_EVENT_MASK_MOD1")
    '("alt" "DIA_EVENT_MASK_ALT")
    '("mod2" "DIA_EVENT_MASK_MOD2")
    '("mod3" "DIA_EVENT_MASK_MOD3")
    '("mod4" "DIA_EVENT_MASK_MOD4")
    '("mod5" "DIA_EVENT_MASK_MOD5")
    '("button1" "DIA_EVENT_MASK_BUTTON1")
    '("button2" "DIA_EVENT_MASK_BUTTON2")
    '("button3" "DIA_EVENT_MASK_BUTTON3")
    '("button4" "DIA_EVENT_MASK_BUTTON4")
    '("button5" "DIA_EVENT_MASK_BUTTON5")
  )
)

(define-enum Strength
  (in-module "Dia")
  (c-name "DiaStrength")
  (gtype-id "DIA_TYPE_STRENGTH")
  (values
    '("very-weak" "DIA_STRENGTH_VERY_WEAK")
    '("weak" "DIA_STRENGTH_WEAK")
    '("medium" "DIA_STRENGTH_MEDIUM")
    '("strong" "DIA_STRENGTH_STRONG")
    '("very-strong" "DIA_STRENGTH_VERY_STRONG")
    '("required" "DIA_STRENGTH_REQUIRED")
  )
)



; This is a special function for setting callback functions in the new items
; class structure. This function should be called after gobject.type_register()
; and only if you inherit directly from a canvas item in the diacanvas module.
(define-function set_callbacks
  (in-module "Dia")
  (c-name "dia_canvas_item_set_callbacks")
  (return-type "none")
)

(define-function set_groupable
  (in-module "Dia")
  (c-name "dia_canvas_item_set_groupable")
  (return-type "none")
)

(define-function set_editable
  (in-module "Dia")
  (c-name "dia_canvas_item_set_editable")
  (return-type "none")
)


;; From dia-canvas.h

(define-function dia_canvas_iter_get_type
  (in-module "Dia")
  (c-name "dia_canvas_iter_get_type")
  (return-type "GType")
)

(define-function dia_canvas_item_handles_get_type
  (in-module "Dia")
  (c-name "dia_canvas_item_handles_get_type")
  (return-type "GType")
)

(define-function dia_canvas_get_type
  (in-module "Dia")
  (c-name "dia_canvas_get_type")
  (return-type "GType")
)

(define-function dia_canvas_new
  (is-constructor-of "DiaCanvas")
  (c-name "dia_canvas_new")
  (return-type "DiaCanvas*")
)

(define-method request_update
  (of-object "DiaCanvas")
  (c-name "dia_canvas_request_update")
  (return-type "none")
)

(define-method update_now
  (of-object "DiaCanvas")
  (c-name "dia_canvas_update_now")
  (return-type "none")
)

(define-method resolve_now
  (of-object "DiaCanvas")
  (c-name "dia_canvas_resolve_now")
  (return-type "none")
)

(define-method set_extents
  (of-object "DiaCanvas")
  (c-name "dia_canvas_set_extents")
  (return-type "none")
  (parameters
    '("const-DiaRectangle*" "extents")
  )
)

(define-method set_static_extents
  (of-object "DiaCanvas")
  (c-name "dia_canvas_set_static_extents")
  (return-type "none")
  (parameters
    '("gboolean" "stat")
  )
)

(define-method snap_to_grid
  (of-object "DiaCanvas")
  (c-name "dia_canvas_snap_to_grid")
  (return-type "none")
  (parameters
    '("gdouble*" "x")
    '("gdouble*" "y")
  )
)

(define-method set_snap_to_grid
  (of-object "DiaCanvas")
  (c-name "dia_canvas_set_snap_to_grid")
  (return-type "none")
  (parameters
    '("gboolean" "snap")
  )
)

(define-method glue_handle
  (of-object "DiaCanvas")
  (c-name "dia_canvas_glue_handle")
  (return-type "gdouble")
  (parameters
    '("const-DiaHandle*" "handle")
    '("const-gdouble" "dest_x")
    '("const-gdouble" "dest_y")
    '("gdouble*" "glue_x")
    '("gdouble*" "glue_y")
    '("DiaCanvasItem**" "item")
  )
)

(define-method find_objects_in_rectangle
  (of-object "DiaCanvas")
  (c-name "dia_canvas_find_objects_in_rectangle")
  (return-type "GList*")
  (parameters
    '("DiaRectangle*" "rect")
  )
)

(define-method add_constraint
  (of-object "DiaCanvas")
  (c-name "dia_canvas_add_constraint")
  (return-type "none")
  (parameters
    '("DiaConstraint*" "c")
  )
)

(define-method remove_constraint
  (of-object "DiaCanvas")
  (c-name "dia_canvas_remove_constraint")
  (return-type "none")
  (parameters
    '("DiaConstraint*" "c")
  )
)

(define-method get_pango_layout
  (of-object "DiaCanvas")
  (c-name "dia_canvas_get_pango_layout")
  (return-type "PangoLayout*")
)

(define-method redraw_views
  (of-object "DiaCanvas")
  (c-name "dia_canvas_redraw_views")
  (return-type "none")
)

(define-method preserve
  (of-object "DiaCanvas")
  (c-name "dia_canvas_preserve")
  (return-type "none")
  (parameters
    '("GObject*" "object")
    '("const-char*" "property_name")
    '("const-GValue*" "value")
    '("gboolean" "last" (default "NULL"))
  )
)

(define-method preserve_property
  (of-object "DiaCanvas")
  (c-name "dia_canvas_preserve_property")
  (return-type "none")
  (parameters
    '("GObject*" "object")
    '("const-char*" "property_name")
  )
)

(define-method preserve_property_last
  (of-object "DiaCanvas")
  (c-name "dia_canvas_preserve_property_last")
  (return-type "none")
  (parameters
    '("GObject*" "object")
    '("const-char*" "property_name")
  )
)

(define-method push_undo
  (of-object "DiaCanvas")
  (c-name "dia_canvas_push_undo")
  (return-type "none")
  (parameters
    '("const-char*" "optional_comment" (null-ok) (default "NULL"))
  )
)

(define-method pop_undo
  (of-object "DiaCanvas")
  (c-name "dia_canvas_pop_undo")
  (return-type "none")
)

(define-method pop_redo
  (of-object "DiaCanvas")
  (c-name "dia_canvas_pop_redo")
  (return-type "none")
)

(define-method clear_undo
  (of-object "DiaCanvas")
  (c-name "dia_canvas_clear_undo")
  (return-type "none")
)

(define-method clear_redo
  (of-object "DiaCanvas")
  (c-name "dia_canvas_clear_redo")
  (return-type "none")
)

(define-method get_undo_depth
  (of-object "DiaCanvas")
  (c-name "dia_canvas_get_undo_depth")
  (return-type "guint")
)

(define-method get_redo_depth
  (of-object "DiaCanvas")
  (c-name "dia_canvas_get_redo_depth")
  (return-type "guint")
)

(define-method set_undo_stack_depth
  (of-object "DiaCanvas")
  (c-name "dia_canvas_set_undo_stack_depth")
  (return-type "none")
  (parameters
    '("guint" "depth")
  )
)

(define-method get_undo_stack_depth
  (of-object "DiaCanvas")
  (c-name "dia_canvas_get_undo_stack_depth")
  (return-type "guint")
)


;; From dia-canvas-item.h

(define-function dia_canvas_item_get_type
  (in-module "Dia")
  (c-name "dia_canvas_item_get_type")
  (return-type "GType")
)

; Should not be used since it fucks up creation of Python canvas items.
;(define-function dia_canvas_item_create
;  (in-module "Dia")
;  (c-name "dia_canvas_item_create")
;  (return-type "DiaCanvasItem*")
;  (parameters
;    '("GType" "type")
;    '("const-gchar*" "first_arg_name" (null-ok))
;  )
;  (varargs #t)
;)

(define-method set
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_set")
  (return-type "none")
  (parameters
    '("const-gchar*" "first_arg_name")
  )
  (varargs #t)
) 

(define-method set_flags
  (of-object "DiaCanvasItem")
  (c-name "DIA_SET_FLAGS")
  (parameters
    '("DiaCanvasItemFlags" "flags")
  )
)

(define-method unset_flags
  (of-object "DiaCanvasItem")
  (c-name "DIA_UNSET_FLAGS")
  (parameters
    '("DiaCanvasItemFlags" "flags")
  )
)

(define-method request_update
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_request_update")
  (return-type "none")
)

(define-method update_now
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_update_now")
  (return-type "none")
)

(define-method update_child
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_update_child")
  (parameters
    '("DiaCanvasItem*" "child")
    '("DiaAffine" "affine")
  )
  (return-type "none")
)

(define-method get_bounds
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_get_bounds")
  (parameters
    '("DiaAffine" "child")
  )
  (return-type "DiaRectangle*")
)

(define-method set_bounds
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_set_bounds")
  (return-type "none")
)

(define-method expand_bounds
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_expand_bounds")
  (return-type "none")
  (parameters
    ("gdouble" "d")
  )
)

(define-method affine_w2i
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_affine_w2i")
  (return-type "none")
  (parameters
    '("gdouble[6]" "affine")
  )
)

(define-method affine_i2w
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_affine_i2w")
  (return-type "none")
  (parameters
    '("gdouble[6]" "affine")
  )
)

(define-method affine_point_w2i
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_affine_point_w2i")
  (return-type "none")
  (parameters
    '("gdouble*" "x")
    '("gdouble*" "y")
  )
)

(define-method affine_point_i2w
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_affine_point_i2w")
  (return-type "none")
  (parameters
    '("gdouble*" "x")
    '("gdouble*" "y")
  )
)

(define-method update_handles_i2w
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_update_handles_i2w")
  (return-type "none")
)

(define-method update_handles_w2i
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_update_handles_w2i")
  (return-type "none")
)

(define-method connect_handle
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_connect")
  (return-type "gboolean")
  (parameters
    '("DiaHandle*" "handle")
  )
)

(define-method disconnect_handle
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_disconnect")
  (return-type "gboolean")
  (parameters
    '("DiaHandle*" "handle")
  )
)

(define-method disconnect_handles
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_disconnect_handles")
  (return-type "gboolean")
)

(define-method select
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_select")
  (return-type "none")
)

(define-method unselect
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_unselect")
  (return-type "none")
)

(define-method is_selected
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_is_selected")
  (return-type "gboolean")
)

(define-method focus
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_focus")
  (return-type "none")
)

(define-method unfocus
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_unfocus")
  (return-type "none")
)

(define-method is_focused
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_is_focused")
  (return-type "gboolean")
)

(define-method grab
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_grab")
  (return-type "none")
)

(define-method ungrab
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_ungrab")
  (return-type "none")
)

(define-method is_grabbed
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_is_grabbed")
  (return-type "gboolean")
)

(define-method visible
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_visible")
  (return-type "none")
)

(define-method invisible
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_invisible")
  (return-type "none")
)

(define-method is_visible
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_is_visible")
  (return-type "gboolean")
)

(define-method identity
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_identity")
  (return-type "none")
)

(define-method scale
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_scale")
  (return-type "none")
  (parameters
    '("gdouble" "sx")
    '("gdouble" "sy")
  )
)

(define-method rotate
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_rotate")
  (return-type "none")
  (parameters
    '("gdouble" "degrees")
  )
)

(define-method shear_x
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_shear_x")
  (return-type "none")
  (parameters
    '("gdouble" "dx")
    '("gdouble" "dy")
  )
)

(define-method shear_y
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_shear_y")
  (return-type "none")
  (parameters
    '("gdouble" "dx")
    '("gdouble" "dy")
  )
)

(define-method set_bounds
  (of-object "DiaCanvasItem")
  (c-name "__no_c_function_available")
  (return-type "none")
  (parameters
    '("DiaRectangle*" "bounds")
  )
)

(define-method move
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_move")
  (return-type "none")
  (parameters
    '("gdouble" "dx")
    '("gdouble" "dy")
  )
)

(define-method flip
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_flip")
  (return-type "none")
  (parameters
    '("gboolean" "horz")
    '("gboolean" "vert")
  )
)

(define-method move_interactive
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_move_interactive")
  (return-type "none")
  (parameters
    '("gdouble" "dx")
    '("gdouble" "dy")
  )
)

(define-method bb_affine
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_bb_affine")
  (return-type "none")
  (parameters
    '("gdouble" "affine[6]")
    '("gdouble*" "x1")
    '("gdouble*" "y1")
    '("gdouble*" "x2")
    '("gdouble*" "y2")
  )
)

(define-method preserve_property
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_preserve_property")
  (return-type "none")
  (parameters
    '("const-gchar*" "property_name" (null-ok))
  )
)

(define-method set_parent
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_set_parent")
  (return-type "none")
  (parameters
    '("DiaCanvasItem*" "new_parent" (null-ok))
  )
)

(define-method set_child_of
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_set_child_of")
  (return-type "none")
  (parameters
    '("DiaCanvasItem*" "new_parent" (null-ok))
  )
)

;(define-method get_shape_iter
;  (of-object "DiaCanvasItem")
;  (c-name "dia_canvas_item_get_shape_iter")
;  (return-type "gboolean")
;  (parameters
;    '("DiaCanvasIter*" "iter")
;  )
;)

;(define-method shape_next
;  (of-object "DiaCanvasItem")
;  (c-name "dia_canvas_item_shape_next")
;  (return-type "gboolean")
;  (parameters
;    '("DiaCanvasIter*" "iter")
;  )
;)

;(define-method shape_value
;  (of-object "DiaCanvasItem")
;  (c-name "dia_canvas_item_shape_value")
;  (return-type "DiaShape*")
;  (parameters
;    '("DiaCanvasIter*" "iter")
;  )
;)

;; Added to aid users with generator based shape retrieval
;;
(define-method shape_iter
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_shape_iter")
  (return-type "Generator")
)

(define-method on_update
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_on_update")
  (return-type "none")
  (parameters
    '("DiaAffine" "affine")
  )
)

(define-method on_shape_iter
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_on_shape_iter")
  (return-type "PyIter*")
)

(define-method on_point
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_on_point")
  (return-type "gdouble")
  (parameters
    '("gdouble" "x")
    '("gdouble" "y")
  )
)

(define-method on_move
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_on_move")
  (return-type "none")
  (parameters
    '("gdouble" "x")
    '("gdouble" "y")
    '("gboolean" "interactive")
  )
)

(define-method on_event
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_on_event")
  (return-type "gboolean")
  (parameters
    '("DiaEvent*" "event")
  )
)

(define-method on_handle_motion
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_on_handle_motion")
  (return-type "none")
  (parameters
    '("DiaHandle*" "handle")
    '("gdouble*" "wx")
    '("gdouble*" "wy")
    '("DiaEventMask" "mask")
  )
)

(define-method on_glue
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_on_glue")
  (return-type "gdouble")
  (parameters
    '("DiaHandle*" "handle")
    '("gdouble*" "*wx")
    '("gdouble*" "*wy")
  )
)

(define-method on_connect_handle
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_on_connect_handle")
  (return-type "gboolean")
  (parameters
    '("DiaHandle*" "handle")
  )
)

(define-method on_disconnect_handle
  (of-object "DiaCanvasItem")
  (c-name "dia_canvas_item_on_disconnect_handle")
  (return-type "gboolean")
  (parameters
    '("DiaHandle*" "handle")
  )
)


;; From dia-canvas-groupable.h

(define-function dia_canvas_groupable_get_type
  (in-module "Dia")
  (c-name "dia_canvas_groupable_get_type")
  (return-type "GType")
)

(define-method add
  (of-object "DiaCanvasGroupable")
  (c-name "dia_canvas_groupable_add")
  (return-type "none")
  (parameters
    '("DiaCanvasItem*" "item")
  )
)

(define-method remove
  (of-object "DiaCanvasGroupable")
  (c-name "dia_canvas_groupable_remove")
  (return-type "none")
  (parameters
    '("DiaCanvasItem*" "item")
  )
)

(define-method groupable_iter
  (of-object "DiaCanvasGroupable")
  (c-name "dia_canvas_groupable_iter")
  (return-type "PyIter*")
)

;(define-method get_iter
;  (of-object "DiaCanvasGroupable")
;  (c-name "dia_canvas_groupable_get_iter")
;  (return-type "gboolean")
;  (parameters
;    '("DiaCanvasIter*" "iter")
;  )
;)

;(define-method next
;  (of-object "DiaCanvasGroupable")
;  (c-name "dia_canvas_groupable_next")
;  (return-type "gboolean")
;  (parameters
;    '("DiaCanvasIter*" "iter")
;  )
;)

;(define-method value
;  (of-object "DiaCanvasGroupable")
;  (c-name "dia_canvas_groupable_value")
;  (return-type "DiaCanvasItem*")
;  (parameters
;    '("DiaCanvasIter*" "iter")
;  )
;)

(define-method length
  (of-object "DiaCanvasGroupable")
  (c-name "dia_canvas_groupable_length")
  (return-type "gint")
)

(define-method pos
  (of-object "DiaCanvasGroupable")
  (c-name "dia_canvas_groupable_pos")
  (return-type "gint")
  (parameters
    '("DiaCanvasItem*" "item")
  )
)


;; From dia-canvas-editable.h

(define-function dia_canvas_editable_get_type
  (in-module "Dia")
  (c-name "dia_canvas_editable_get_type")
  (return-type "GType")
)

(define-method start_editing
  (of-object "DiaCanvasEditable")
  (c-name "dia_canvas_editable_start_editing")
  (return-type "none")
  (parameters
    '("DiaShapeText*" "text_shape")
  )
)

(define-method editing_done
  (of-object "DiaCanvasEditable")
  (c-name "dia_canvas_editable_editing_done")
  (return-type "none")
  (parameters
    '("DiaShapeText*" "text_shape")
    '("const-gchar*" "new_text")
  )
)

(define-method text_changed
  (of-object "DiaCanvasEditable")
  (c-name "dia_canvas_editable_text_changed")
  (return-type "none")
  (parameters
    '("DiaShapeText*" "text_shape")
    '("const-gchar*" "new_text")
  )
)


;; From dia-canvas-group.h

(define-function dia_canvas_group_get_type
  (in-module "Dia")
  (c-name "dia_canvas_group_get_type")
  (return-type "GType")
)

(define-function dia_canvas_group_new
  (is-constructor-of "DiaCanvasGroup")
  (c-name "dia_canvas_group_new")
  (return-type "DiaCanvasItem*")
  (varargs #t)
)

; This function should not be used since it does not instantiate canvas items
; written in Python correctly...
;(define-method create_item
;  (of-object "DiaCanvasGroup")
;  (c-name "dia_canvas_group_create_item")
;  (return-type "DiaCanvasItem*")
;  (parameters
;    '("GType" "type")
;    '("const-gchar*" "first_arg_name" (null-ok))
;  )
;  (varargs #t)
;)

(define-method raise_item
  (of-object "DiaCanvasGroup")
  (c-name "dia_canvas_group_raise_item")
  (return-type "none")
  (parameters
    '("DiaCanvasItem*" "item")
    '("gint" "pos")
  )
)

(define-method lower_item
  (of-object "DiaCanvasGroup")
  (c-name "dia_canvas_group_lower_item")
  (return-type "none")
  (parameters
    '("DiaCanvasItem*" "item")
    '("gint" "pos")
  )
)

(define-function dia_canvas_group_foreach
  (in-module "Dia")
  (c-name "dia_canvas_group_foreach")
  (return-type "gint")
  (parameters
    '("DiaCanvasItem*" "item")
    '("DiaCanvasItemForeachFunc" "func")
    '("gpointer" "data")
  )
)


;; From dia-handle.h

(define-function dia_handle_get_type
  (in-module "Dia")
  (c-name "dia_handle_get_type")
  (return-type "GType")
)

; TODO: Add optional pos.
(define-function dia_handle_new
  (is-constructor-of "DiaHandle")
  (c-name "dia_handle_new")
  (return-type "DiaHandle*")
  (parameters
    '("DiaCanvasItem*" "owner")
  )
)

;(define-function dia_handle_new_with_pos
;  (in-module "Dia")
;  (c-name "dia_handle_new_with_pos")
;  (return-type "DiaHandle*")
;  (parameters
;    '("DiaCanvasItem*" "owner")
;    '("gdouble" "x")
;    '("gdouble" "y")
;  )
;)

(define-method set_strength
  (of-object "DiaHandle")
  (c-name "dia_handle_set_strength")
  (return-type "none")
  (parameters
    '("DiaStrength" "strength")
  )
)

(define-method get_pos_i
  (of-object "DiaHandle")
  (c-name "dia_handle_get_pos_i")
  (return-type "none")
  (parameters
    '("gdouble*" "x")
    '("gdouble*" "y")
  )
)

(define-method get_pos_w
  (of-object "DiaHandle")
  (c-name "dia_handle_get_pos_w")
  (return-type "none")
  (parameters
    '("gdouble*" "x")
    '("gdouble*" "y")
  )
)

(define-method set_pos_i
  (of-object "DiaHandle")
  (c-name "dia_handle_set_pos_i")
  (return-type "none")
  (parameters
    '("gdouble" "x")
    '("gdouble" "y")
  )
)

(define-method set_pos_i_affine
  (of-object "DiaHandle")
  (c-name "dia_handle_set_pos_i_affine")
  (return-type "none")
  (parameters
    '("gdouble" "x")
    '("gdouble" "y")
    '("const-gdouble[6]" "affine")
  )
)

(define-method set_pos_w
  (of-object "DiaHandle")
  (c-name "dia_handle_set_pos_w")
  (return-type "none")
  (parameters
    '("gdouble" "x")
    '("gdouble" "y")
  )
)

(define-method distance_i
  (of-object "DiaHandle")
  (c-name "dia_handle_distance_i")
  (return-type "gdouble")
  (parameters
    '("gdouble" "x")
    '("gdouble" "y")
  )
)

(define-method distance_w
  (of-object "DiaHandle")
  (c-name "dia_handle_distance_w")
  (return-type "gdouble")
  (parameters
    '("gdouble" "x")
    '("gdouble" "y")
  )
)

(define-method update_i2w_affine
  (of-object "DiaHandle")
  (c-name "dia_handle_update_i2w_affine")
  (return-type "none")
  (parameters
    '("const-gdouble[6]" "affine")
  )
)

(define-method request_update_w2i
  (of-object "DiaHandle")
  (c-name "dia_handle_request_update_w2i")
  (return-type "none")
)

(define-method update_w2i
  (of-object "DiaHandle")
  (c-name "dia_handle_update_w2i")
  (return-type "none")
)

(define-method update_w2i_affine
  (of-object "DiaHandle")
  (c-name "dia_handle_update_w2i_affine")
  (return-type "none")
  (parameters
    '("const-gdouble[6]" "affine")
  )
)

(define-function dia_handle_size
  (in-module "Dia")
  (c-name "dia_handle_size")
  (return-type "gint")
)

(define-method add_constraint
  (of-object "DiaHandle")
  (c-name "dia_handle_add_constraint")
  (return-type "none")
  (parameters
    '("DiaConstraint*" "c")
  )
)

(define-method add_line_constraint
  (of-object "DiaHandle")
  (c-name "dia_handle_add_line_constraint")
  (return-type "none")
  (parameters
    '("DiaHandle*" "end")
    '("DiaHandle*" "middle")
  )
)

(define-method remove_constraint
  (of-object "DiaHandle")
  (c-name "dia_handle_remove_constraint")
  (return-type "none")
  (parameters
    '("DiaConstraint*" "c")
  )
)

(define-method remove_all_constraints
  (of-object "DiaHandle")
  (c-name "dia_handle_remove_all_constraints")
  (return-type "none")
)


;; From dia-geometry.h

(define-function color
  (in-module "Dia")
  (c-name "DIA_COLOR_A")
  (return-type "gulong")
  (parameters
    '("gint" "r")
    '("gint" "g")
    '("gint" "b")
    '("gint" "a" (default "255"))
  )
)


;; From dia-variable.h

(define-function dia_variable_get_type
  (in-module "Dia")
  (c-name "dia_variable_get_type")
  (return-type "GType")
)

(define-function dia_variable_new
  (is-constructor-of "DiaVariable")
  (c-name "dia_variable_new")
  (return-type "DiaVariable*")
)

(define-method set_value
  (of-object "DiaVariable")
  (c-name "dia_variable_set_value")
  (return-type "none")
  (parameters
    '("gdouble" "value")
  )
)

(define-method get_value
  (of-object "DiaVariable")
  (c-name "dia_variable_get_value")
  (return-type "gdouble")
)

(define-method set_strength
  (of-object "DiaVariable")
  (c-name "dia_variable_set_strength")
  (return-type "none")
  (parameters
    '("DiaStrength" "strength")
  )
)

(define-method get_strength
  (of-object "DiaVariable")
  (c-name "dia_variable_get_strength")
  (return-type "DiaStrength")
)


;; From dia-constraint.h

(define-function dia_constraint_get_type
  (in-module "Dia")
  (c-name "dia_constraint_get_type")
  (return-type "GType")
)

(define-function dia_constraint_new
  (is-constructor-of "DiaConstraint")
  (c-name "dia_constraint_new")
  (return-type "DiaConstraint*")
)

(define-method add
  (of-object "DiaConstraint")
  (c-name "dia_constraint_add")
  (return-type "none")
  (parameters
    '("DiaVariable*" "var" (null-ok) (default "NULL"))
    '("gdouble" "c" (default "1.0"))
  )
)

;(define-method add_expression
;  (of-object "DiaConstraint")
;  (c-name "dia_constraint_add_expression")
;  (return-type "none")
;  (parameters
;    '("DiaExpression*" "expr")
;  )
;)

(define-method times
  (of-object "DiaConstraint")
  (c-name "dia_constraint_times")
  (return-type "none")
  (parameters
    '("gdouble" "c")
  )
)

(define-method has_variables
  (of-object "DiaConstraint")
  (c-name "dia_constraint_has_variables")
  (return-type "gboolean")
)

(define-method optimize
  (of-object "DiaConstraint")
  (c-name "dia_constraint_optimize")
  (return-type "none")
)

(define-method solve
  (of-object "DiaConstraint")
  (c-name "dia_constraint_solve")
  (return-type "gdouble")
  (parameters
    '("DiaVariable*" "var")
  )
)

;(define-method foreach
;  (of-object "DiaConstraint")
;  (c-name "dia_constraint_foreach")
;  (return-type "none")
;  (parameters
;    '("DiaConstraintFunc" "func")
;    '("gpointer" "user_data")
;  )
;)

;(define-function dia_expression_add
;  (in-module "Dia")
;  (c-name "dia_expression_add")
;  (return-type "none")
;  (parameters
;    '("DiaExpression**" "expr")
;    '("DiaVariable*" "var")
;    '("gdouble" "c")
;  )
;)

;(define-function dia_expression_add_expression
;  (in-module "Dia")
;  (c-name "dia_expression_add_expression")
;  (return-type "none")
;  (parameters
;    '("DiaExpression**" "expr")
;    '("DiaExpression*" "expr2")
;  )
;)

;(define-method times
;  (of-object "DiaExpression")
;  (c-name "dia_expression_times")
;  (return-type "none")
;  (parameters
;    '("gdouble" "c")
;  )
;)

;(define-method free
;  (of-object "DiaExpression")
;  (c-name "dia_expression_free")
;  (return-type "none")
;)

(define-method freeze
  (of-object "DiaConstraint")
  (c-name "dia_constraint_freeze")
  (return-type "none")
)

(define-method thaw
  (of-object "DiaConstraint")
  (c-name "dia_constraint_thaw")
  (return-type "none")
)


;; From dia-solver.h

(define-function dia_solver_get_type
  (in-module "Dia")
  (c-name "dia_solver_get_type")
  (return-type "GType")
)

(define-function dia_solver_new
  (is-constructor-of "DiaSolver")
  (c-name "dia_solver_new")
  (return-type "DiaSolver*")
)

(define-method add_constraint
  (of-object "DiaSolver")
  (c-name "dia_solver_add_constraint")
  (return-type "none")
  (parameters
    '("DiaConstraint*" "constraint")
  )
)

(define-method remove_constraint
  (of-object "DiaSolver")
  (c-name "dia_solver_remove_constraint")
  (return-type "none")
  (parameters
    '("DiaConstraint*" "constraint")
  )
)

(define-method resolve
  (of-object "DiaSolver")
  (c-name "dia_solver_resolve")
  (return-type "none")
)


;; From dia-canvas-line.h

(define-function dia_canvas_line_get_type
  (in-module "Dia")
  (c-name "dia_canvas_line_get_type")
  (return-type "GType")
)

(define-function dia_canvas_line_new
  (is-constructor-of "DiaCanvasLine")
  (c-name "dia_canvas_line_new")
  (return-type "DiaCanvasItem*")
  (varargs #t)
)

(define-method get_closest_segment
  (of-object "DiaCanvasLine")
  (c-name "dia_canvas_line_get_closest_segment")
  (return-type "gint")
  (parameters
    '("gdouble" "x")
    '("gdouble" "y")
  )
)


;; From dia-canvas-element.h

(define-function dia_canvas_element_get_type
  (in-module "Dia")
  (c-name "dia_canvas_element_get_type")
  (return-type "GType")
)

(define-method align_handles
  (of-object "DiaCanvasElement")
  (c-name "dia_canvas_element_align_handles")
  (return-type "none")
)


;; From dia-canvas-box.h

(define-function dia_canvas_box_get_type
  (in-module "Dia")
  (c-name "dia_canvas_box_get_type")
  (return-type "GType")
)

(define-function dia_canvas_box_new
  (is-constructor-of "DiaCanvasBox")
  (c-name "dia_canvas_box_new")
  (return-type "DiaCanvasItem*")
  (varargs #t)
)


;; From dia-canvas-text.h

(define-function dia_canvas_text_get_type
  (in-module "Dia")
  (c-name "dia_canvas_text_get_type")
  (return-type "GType")
)

(define-function dia_canvas_text_new
  (is-constructor-of "DiaCanvasText")
  (c-name "dia_canvas_text_new")
  (return-type "DiaCanvasItem*")
  (varargs #t)
)


;; From dia-canvas-image.h

(define-function dia_canvas_image_get_type
  (in-module "Dia")
  (c-name "dia_canvas_image_get_type")
  (return-type "GType")
)

(define-function dia_canvas_image_new
  (is-constructor-of "DiaCanvasImage")
  (c-name "dia_canvas_image_new")
  (return-type "DiaCanvasItem*")
  (varargs #t)
)


;; From dia-export-svg.h

(define-function dia_export_svg_new
  (is-constructor-of "DiaExportSVG")
  (c-name "dia_export_svg_new")
  (return-type "DiaExportSVG*")
)

(define-method render
  (of-object "DiaExportSVG")
  (c-name "dia_export_svg_render")
  (return-type "none")
  (parameters
    '("DiaCanvas*" "canvas")
  )
)

(define-method save
  (of-object "DiaExportSVG")
  (c-name "dia_export_svg_save")
  (return-type "none")
  (parameters
    '("const-gchar*" "filename")
    '("GError**" "error")
  )
)

