-(eval-when (:compile-toplevel :load-toplevel :execute)
- (defclass widget (object)
- ((child-slots
- :allocation :instance
- :accessor widget-child-slots
- :type container-child)
- (name
- :allocation :arg
- :accessor widget-name
- :initarg :name
- :type string)
- (parent
- :allocation :arg
- :accessor widget-parent
-; :initarg :parent
- :type container)
- (x
- :allocation :arg
- :accessor widget-x-position
- :initarg :x
- :type int)
- (y
- :allocation :arg
- :accessor widget-y-position
- :initarg :y
- :type int)
- (width
- :allocation :arg
- :accessor widget-width
- :initarg :width
- :type int)
- (height
- :allocation :arg
- :accessor widget-height
- :initarg :height
- :type int)
- (visible
- :allocation :arg
- :accessor widget-visible-p
- :initarg :visible
- :type boolean)
- (sensitive
- :allocation :arg
- :accessor widget-sensitive-p
- :initarg :sensitive
- :type boolean)
- (app-paintable
- :allocation :arg
- :reader widget-app-paintable-p
-; :access :read-only
- :type boolean)
- (can-focus
- :allocation :arg
- :accessor widget-can-focus-p
- :initarg :can-focus
- :type boolean)
- (has-focus
- :allocation :arg
- :accessor widget-has-focus-p
- :initarg :has-focus
- :type boolean)
- (can-default
- :allocation :arg
- :accessor widget-can-default-p
- :initarg :can-default
- :type boolean)
- (has-default
- :allocation :arg
- :accessor widget-has-default-p
- :initarg :has-default
- :type boolean)
- (receives-default
- :allocation :arg
- :accessor widget-receives-default-p
- :initarg :receives-default
- :type boolean)
- (composite-child
- :allocation :arg
- :accessor widget-composite-child-p
- :initarg :composite-child
- :type boolean)
-; (style
-; :allocation :arg
-; :accessor widget-style
-; :initarg :style
-; :type style)
- (events
- :allocation :arg
- :accessor widget-events
- :initarg :events
- :type gdk:event-mask)
- (extension-events
- :allocation :arg
- :accessor widget-extension-events
- :initarg :extpension-events
- :type gdk:event-mask)
- (state
- :allocation :virtual
- :location ("gtk_widget_get_state" "gtk_widget_set_state")
- :accessor widget-state
- :initarg :state
- :type state-type)
- (window
- :allocation :virtual
- :location "gtk_widget_get_window"
- :reader widget-window
- :type gdk:window)
- (colormap
- :allocation :virtual
- :location "gtk_widget_get_colormap"
- :reader widget-colormap
- :type gdk:colormap)
- (visual
- :allocation :virtual
- :location "gtk_widget_get_visual"
- :reader widget-visual
- :type gdk:visual))
- (:metaclass object-class)
- (:alien-name "GtkWidget")))
-
-
-(defmethod initialize-instance ((widget widget) &rest initargs &key parent)
- (declare (ignore initargs))
+#-debug-ref-counting
+(defmethod print-object ((widget widget) stream)
+ (if (and
+ (proxy-valid-p widget)
+ (slot-boundp widget 'name) (not (zerop (length (widget-name widget)))))
+ (print-unreadable-object (widget stream :type t :identity nil)
+ (format stream "~S at 0x~X"
+ (widget-name widget) (sap-int (foreign-location widget))))
+ (call-next-method)))
+
+(defmethod shared-initialize ((widget widget) names &key (visible nil visible-p))
+ (when (and visible-p (not visible)) ; widget explicit set as not visible
+ (setf (user-data widget 'hidden-p) t)
+ (signal-connect widget 'show
+ #'(lambda ()
+ (unset-user-data widget 'hidden-p))
+ :remove t))
+ (call-next-method))
+
+(defmethod shared-initialize :after ((widget widget) names &key parent visible)
+ (declare (ignore names))
+ (when visible
+ (widget-show widget))
+ (when parent
+ (when (slot-boundp widget 'parent)
+ (container-remove (widget-parent widget) widget))
+ (destructuring-bind (parent &rest args) (mklist parent)
+ (apply #'container-add parent widget args))))
+
+(defmethod slot-unbound ((class gobject-class) (object widget)
+ (slot (eql 'child-properties)))