+(defbinding item-toggle () nil
+ (item item))
+
+
+
+;;; Menu item
+
+(defmethod initialize-instance ((item menu-item) &key label)
+ (prog1
+ (call-next-method)
+ (when label
+ (setf (menu-item-label item) label))))
+
+
+(defun (setf menu-item-label) (label menu-item)
+ (make-instance 'accel-label
+ :label label :xalign 0.0 :yalign 0.5 :accel-widget menu-item
+ :use-underline (menu-item-use-underline-p menu-item)
+ :visible t :parent menu-item)
+ label)
+
+(defun menu-item-label (menu-item)
+ (when (and (slot-boundp menu-item 'child)
+ (typep (bin-child menu-item) 'label))
+ (label-label (bin-child menu-item))))
+
+(defbinding menu-item-remove-submenu () nil
+ (menu-item menu-item))
+
+(defbinding menu-item-set-accel-path () nil
+ (menu-item menu-item)
+ (accel-path string))
+
+(defbinding menu-item-select () nil
+ (menu-item menu-item))
+
+(defbinding menu-item-deselect () nil
+ (menu-item menu-item))
+
+(defbinding menu-item-activate () nil
+ (menu-item menu-item))
+
+(defbinding menu-item-toggle-size-request () nil
+ (menu-item menu-item)
+ (requisition int :out))
+
+(defbinding menu-item-toggle-size-allocate () nil
+ (menu-item menu-item)
+ (allocation int))
+
+
+;;; Menu tool button
+
+#?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
+(defbinding menu-tool-button-set-arrow-tooltip () nil
+ (menu-tool-button menu-tool-button)
+ (tooltips tooltips)
+ (tip-text string)
+ (tip-private string))
+
+
+;;; Message dialog
+
+(defmethod allocate-foreign ((dialog message-dialog) &key (message-type :info)
+ (buttons :close) flags transient-parent)
+ (%message-dialog-new transient-parent flags message-type buttons))
+
+
+(defmethod shared-initialize ((dialog message-dialog) names &key text
+ #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
+ secondary-text)
+ (declare (ignore names))
+ (when text
+ (message-dialog-set-markup dialog text))
+ #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
+ (when secondary-text
+ (message-dialog-format-secondary-markup dialog secondary-text))
+ (call-next-method))
+
+
+(defbinding %message-dialog-new () pointer
+ (parent (or null window))
+ (flags dialog-flags)
+ (type message-type)
+ (buttons buttons-type)
+ (nil null))
+
+(defbinding message-dialog-set-markup () nil
+ (message-dialog message-dialog)
+ (markup string))
+
+#?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
+(defbinding message-dialog-format-secondary-text () nil
+ (message-dialog message-dialog)
+ (text string))
+
+#?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
+(defbinding message-dialog-format-secondary-markup () nil
+ (message-dialog message-dialog)
+ (markup string))
+
+
+
+;;; Radio menu item
+
+(defbinding %radio-menu-item-get-group () pointer
+ (radio-menu-item radio-menu-item))
+
+(defbinding %radio-menu-item-set-group () nil
+ (radio-menu-item radio-menu-item)
+ (group pointer))
+
+(defmethod activate-radio-widget ((item radio-menu-item))
+ (menu-item-activate item))
+
+(defmethod add-to-radio-group ((item1 radio-menu-item) (item2 radio-menu-item))
+ "Add ITEM1 to the group which ITEM2 belongs to."
+ (%radio-menu-item-set-group item1 (%radio-menu-item-get-group item2)))
+
+(defmethod add-activate-callback ((item radio-menu-item) function &key object after)
+ (%add-activate-callback item 'activate function object after))
+
+(defmethod initialize-instance ((item radio-menu-item) &key group)
+ (prog1
+ (call-next-method)
+ (when group
+ (add-to-radio-group item group))))
+
+
+
+;;; Radio tool button
+
+(defbinding %radio-tool-button-get-group () pointer
+ (radio-tool-button radio-tool-button))
+
+(defbinding %radio-tool-button-set-group () nil
+ (radio-tool-button radio-tool-button)
+ (group pointer))
+
+(defmethod activate-radio-widget ((button radio-tool-button))
+ (signal-emit button 'clicked))
+
+(defmethod add-to-radio-group ((button1 radio-tool-button) (button2 radio-tool-button))
+ "Add BUTTON1 to the group which BUTTON2 belongs to."
+ (%radio-tool-button-set-group button1 (%radio-tool-button-get-group button2)))
+(defmethod add-activate-callback ((button radio-tool-button) function &key object after)
+ (%add-activate-callback button 'clicked function object after))
+
+(defmethod initialize-instance ((button radio-tool-button) &key group)
+ (prog1
+ (call-next-method)
+ (when group
+ (add-to-radio-group button group))))
+
+
+
+;;; Toggle button
+
+(defbinding toggle-button-toggled () nil
+ (toggle-button toggle-button))
+
+
+;;; Window
+
+(defmethod initialize-instance ((window window) &rest initargs
+ &key display accel-group accel-groups)
+ (declare (ignore accel-group accel-groups))
+ (prog1
+ (if display
+ (apply #'call-next-method
+ window :screen (gdk:display-get-default-screen (gdk:ensure-display display)) initargs)
+ (call-next-method))
+ (initial-add window #'window-add-accel-group
+ initargs :accel-group :accel-groups)))
+
+#-debug-ref-counting
+(defmethod print-object ((window window) stream)
+ (if (and
+ (proxy-valid-p window)
+ (slot-boundp window 'title)
+ (not (zerop (length (window-title window)))))
+ (print-unreadable-object (window stream :type t :identity nil)
+ (format stream "~S at 0x~X"
+ (window-title window) (pointer-address (foreign-location window))))
+ (call-next-method)))
+
+(defbinding window-set-wmclass () nil
+ (window window)
+ (wmclass-name string)
+ (wmclass-class string))
+
+(defbinding window-add-accel-group () nil
+ (window window)
+ (accel-group accel-group))
+
+(defbinding window-remove-accel-group () nil
+ (window window)
+ (accel-group accel-group))
+
+(defbinding window-activate-focus () int
+ (window window))
+
+(defbinding window-activate-default () int
+ (window window))
+
+(defbinding window-set-default-size (window width height) int
+ (window window)
+ ((or width -1) int)
+ ((or height -1) int))
+
+(defbinding %window-set-geometry-hints () nil
+ (window window)
+ (widget (or widget null))
+ (geometry gdk:geometry)
+ (geometry-mask gdk:window-hints))
+
+(defun window-set-geometry-hints (window &key widget min-width min-height
+ max-width max-height base-width base-height
+ width-inc height-inc gravity
+ aspect (min-aspect aspect) (max-aspect aspect))
+ (let ((geometry (make-instance 'gdk:geometry
+ :min-width (or min-width -1)
+ :min-height (or min-height -1)
+ :max-width (or max-width -1)
+ :max-height (or max-height -1)
+ :base-width (or base-width 0)
+ :base-height (or base-height 0)
+ :width-inc (or width-inc 0)
+ :height-inc (or height-inc 0)
+ :min-aspect (or min-aspect 0)
+ :max-aspect (or max-aspect 0)))
+ (mask ()))
+ (when (or min-width min-height)
+ (push :min-size mask))
+ (when (or max-width max-height)
+ (push :max-size mask))
+ (when (or base-width base-height)
+ (push :base-size mask))
+ (when (or width-inc height-inc)
+ (push :resize-inc mask))
+ (when (or min-aspect max-aspect)
+ (push :aspect mask))
+ (when gravity
+ (push :win-gravity mask)
+ (setf (gdk:geometry-gravity geometry) gravity))
+ (%window-set-geometry-hints window widget geometry mask)))
+
+(defbinding window-list-toplevels () (glist (copy-of window))
+ "Returns a list of all existing toplevel windows.")
+
+(defbinding window-add-mnemonic (window key target) nil
+ (window window)
+ ((gdk:keyval-from-name key) unsigned-int)
+ (target widget))
+
+(defbinding window-remove-mnemonic (window key target) nil
+ (window window)
+ ((gdk:keyval-from-name key) unsigned-int)
+ (target widget))
+
+(defbinding window-mnemonic-activate (window key modifier) nil
+ (window window)
+ ((gdk:keyval-from-name key) unsigned-int)
+ (modifier gdk:modifier-type))
+
+(defbinding window-activate-key () boolean
+ (window window)
+ (event gdk:key-event))
+
+(defbinding window-propagate-key-event () boolean
+ (window window)
+ (event gdk:key-event))
+
+#?-(pkg-exists-p "gtk+-2.0" :atleast-version "2.8.0")
+(defbinding window-present () nil
+ (window window))
+
+#?(pkg-exists-p "gtk+-2.0" :atleast-version "2.8.0")
+(progn
+ (defbinding %window-present () nil
+ (window window))
+
+ (defbinding %window-present-with-time () nil
+ (window window)
+ (timespamp unsigned-int))
+
+ (defun window-present (window &optional timestamp)
+ (if timestamp
+ (%window-present-with-time window timestamp)
+ (%window-present window))))
+
+(defbinding window-iconify () nil
+ (window window))
+
+(defbinding window-deiconify () nil
+ (window window))
+
+(defbinding window-stick () nil
+ (window window))
+
+(defbinding window-unstick () nil
+ (window window))
+
+(defbinding window-maximize () nil
+ (window window))
+
+(defbinding window-unmaximize () nil
+ (window window))
+
+(defbinding window-fullscreen () nil
+ (window window))
+
+(defbinding window-unfullscreen () nil
+ (window window))
+
+(defbinding window-set-keep-above () nil
+ (window window)
+ (setting boolean))
+
+(defbinding window-set-keep-below () nil
+ (window window)
+ (setting boolean))
+
+(defbinding window-begin-resize-drag () nil
+ (window window)
+ (edge gdk:window-edge)
+ (button int)
+ (root-x int) (root-y int)
+ (timestamp unsigned-int))
+
+(defbinding window-begin-move-drag () nil
+ (window window)
+ (edge gdk:window-edge)
+ (button int)
+ (root-x int) (root-y int)
+ (timestamp unsigned-int))
+
+(defbinding window-set-frame-dimensions () nil
+ (window window)
+ (left int) (top int) (rigth int) (bottom int))