-(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))
- (cond
- ((consp parent)
- (with-slots ((container parent) child-slots) widget
- (setf
- container (car parent)
- child-slots
- (apply
- #'make-instance
- (slot-value (class-of container) 'child-class)
- :parent container :child widget (cdr parent)))))
- (parent
- (setf (slot-value widget 'parent) parent)))
- (call-next-method))
+(defmethod shared-initialize ((widget widget) names &rest initargs &key parent)
+ (remf initargs :parent)
+ (prog1
+ (apply #'call-next-method widget names initargs)
+ (when parent
+ (let ((old-parent (widget-parent widget))
+ (parent (first (mklist parent)))
+ (args (rest (mklist parent))))
+ (when old-parent
+ (container-remove old-parent widget))
+ (apply #'container-add parent widget args)))))
+
+(defmethod shared-initialize :after ((widget widget) names &rest initargs
+ &key show-all)
+ (declare (ignore initargs names))
+ (when show-all
+ (widget-show-all widget)))