Author: junrue Date: Fri Sep 22 23:33:53 2006 New Revision: 265
Modified: trunk/src/tests/uitoolkit/mock-objects.lisp trunk/src/tests/uitoolkit/scroll-grid-panel.lisp trunk/src/uitoolkit/widgets/control.lisp trunk/src/uitoolkit/widgets/heap-layout.lisp trunk/src/uitoolkit/widgets/list-box.lisp trunk/src/uitoolkit/widgets/scrollbar.lisp trunk/src/uitoolkit/widgets/widget-classes.lisp trunk/src/uitoolkit/widgets/window.lisp Log: got rid of accessors for min-size and max-size slots of control and window, to further discourage direct access of those slots by application code
Modified: trunk/src/tests/uitoolkit/mock-objects.lisp ============================================================================== --- trunk/src/tests/uitoolkit/mock-objects.lisp (original) +++ trunk/src/tests/uitoolkit/mock-objects.lisp Fri Sep 22 23:33:53 2006 @@ -74,11 +74,9 @@ :initarg :actual-size :initform (gfs:make-size)) (max-size - :accessor max-size-of :initarg :max-size :initform (gfs:make-size :width +max-widget-size+ :height +max-widget-size+)) (min-size - :accessor min-size-of :initarg :min-size :initform (gfs:make-size))))
@@ -89,12 +87,12 @@ (gfs:make-point))
(defmethod gfw:minimum-size ((self mock-widget)) - (gfs:make-size :width (gfs:size-width (min-size-of self)) - :height (gfs:size-height (min-size-of self)))) + (gfs:make-size :width (gfs:size-width (slot-value self 'min-size)) + :height (gfs:size-height (slot-value self 'min-size))))
(defmethod gfw:preferred-size ((self mock-widget) width-hint height-hint) (let ((size (gfs:make-size)) - (min-size (min-size-of self))) + (min-size (slot-value self 'min-size))) (if (< width-hint 0) (setf (gfs:size-width size) (gfs:size-width min-size)) (setf (gfs:size-width size) width-hint)) @@ -104,7 +102,7 @@ size))
(defmethod gfw:text-baseline ((self mock-widget)) - (floor (* (gfs:size-height (min-size-of self)) 3) 4)) + (floor (* (gfs:size-height (slot-value self 'min-size)) 3) 4))
(defmethod gfw:visible-p ((self mock-widget)) (visibility-of self))
Modified: trunk/src/tests/uitoolkit/scroll-grid-panel.lisp ============================================================================== --- trunk/src/tests/uitoolkit/scroll-grid-panel.lisp (original) +++ trunk/src/tests/uitoolkit/scroll-grid-panel.lisp Fri Sep 22 23:33:53 2006 @@ -48,7 +48,7 @@ (panel (make-instance 'gfw:panel :dispatcher (make-instance 'scroll-grid-panel-events) :parent parent))) (setf (gfw:maximum-size panel) panel-size) - (assert (gfs:equal-size-p panel-size (gfw::max-size-of panel))) + (assert (gfs:equal-size-p panel-size (slot-value panel 'gfw::max-size))) #| (let* ((gc (make-instance 'gfg:graphics-context :widget panel)) (font (make-instance 'gfg:font :gc gc)))
Modified: trunk/src/uitoolkit/widgets/control.lisp ============================================================================== --- trunk/src/uitoolkit/widgets/control.lisp (original) +++ trunk/src/uitoolkit/widgets/control.lisp Fri Sep 22 23:33:53 2006 @@ -161,22 +161,22 @@ (setf (dispatcher self) (make-instance (class-name class))))))
(defmethod maximum-size ((self control)) - (max-size-of self)) + (slot-value self 'max-size))
(defmethod (setf maximum-size) (max-size (self control)) - (setf (max-size-of self) max-size) + (setf (slot-value self 'max-size) max-size) (unless (gfs:disposed-p self) (let ((size (constrain-new-size max-size (size self) #'min))) (setf (size self) size))))
(defmethod minimum-size ((self control)) - (let ((size (min-size-of self))) + (let ((size (slot-value self 'min-size))) (if (null size) (preferred-size self -1 -1) size)))
(defmethod (setf minimum-size) (min-size (self control)) - (setf (min-size-of self) min-size) + (setf (slot-value self 'min-size) min-size) (unless (gfs:disposed-p self) (let ((size (constrain-new-size min-size (size self) #'max))) (setf (size self) size))))
Modified: trunk/src/uitoolkit/widgets/heap-layout.lisp ============================================================================== --- trunk/src/uitoolkit/widgets/heap-layout.lisp (original) +++ trunk/src/uitoolkit/widgets/heap-layout.lisp Fri Sep 22 23:33:53 2006 @@ -80,8 +80,8 @@ (if spec (let ((bounds (cdr spec))) (setf (gfs:size bounds) (gfs::clamp-size (gfs:size bounds) - (min-size-of top) - (max-size-of top))) + (slot-value top 'min-size) + (slot-value top 'max-size))) (setf (cdr spec) bounds)))) (arrange-hwnds kid-specs (lambda (item) (if (eql top item)
Modified: trunk/src/uitoolkit/widgets/list-box.lisp ============================================================================== --- trunk/src/uitoolkit/widgets/list-box.lisp (original) +++ trunk/src/uitoolkit/widgets/list-box.lisp Fri Sep 22 23:33:53 2006 @@ -247,8 +247,8 @@
(defmethod preferred-size ((self list-box) width-hint height-hint) (let ((hwnd (gfs:handle self)) - (min-size (min-size-of self)) - (max-size (max-size-of self)) + (min-size (slot-value self 'min-size)) + (max-size (slot-value self 'max-size)) (size (gfs:make-size :width width-hint :height height-hint)) (b-width (* (border-width self) 2))) (cond
Modified: trunk/src/uitoolkit/widgets/scrollbar.lisp ============================================================================== --- trunk/src/uitoolkit/widgets/scrollbar.lisp (original) +++ trunk/src/uitoolkit/widgets/scrollbar.lisp Fri Sep 22 23:33:53 2006 @@ -131,7 +131,7 @@ (let ((orient (orientation-of self))) (unless (or (= orient gfs::+sb-horz+) (= orient gfs::+sb-vert+)) (error 'gfs:toolkit-error :detail "invalid standard scrollbar orientation"))) - (setf (slot-value self 'dispatcher) nil)) + (setf (slot-value self 'dispatcher) nil)) ; standard scrollbars don't use dispatchers
(defmethod page-increment ((self standard-scrollbar)) (destructuring-bind (limits pagesize pos trackpos)
Modified: trunk/src/uitoolkit/widgets/widget-classes.lisp ============================================================================== --- trunk/src/uitoolkit/widgets/widget-classes.lisp (original) +++ trunk/src/uitoolkit/widgets/widget-classes.lisp Fri Sep 22 23:33:53 2006 @@ -147,11 +147,9 @@ :accessor pixel-point-of :initform nil) (max-size - :accessor max-size-of :initarg :maximum-size :initform nil) (min-size - :accessor min-size-of :initarg :minimum-size :initform nil)) (:documentation "The base class for widgets having pre-defined native behavior.")) @@ -219,11 +217,9 @@
(defclass window (widget layout-managed) ((max-size - :accessor max-size-of :initarg :maximum-size :initform nil) (min-size - :accessor min-size-of :initarg :minimum-size :initform nil)) (:documentation "Base class for user-defined widgets that serve as containers."))
Modified: trunk/src/uitoolkit/widgets/window.lisp ============================================================================== --- trunk/src/uitoolkit/widgets/window.lisp (original) +++ trunk/src/uitoolkit/widgets/window.lisp Fri Sep 22 23:33:53 2006 @@ -284,10 +284,10 @@ tmp)))
(defmethod maximum-size ((self window)) - (max-size-of self)) + (slot-value self 'max-size))
(defmethod (setf maximum-size) (max-size (self window)) - (setf (max-size-of self) max-size) + (setf (slot-value self 'max-size) max-size) (unless (gfs:disposed-p self) (let ((size (constrain-new-size max-size (size self) #'min))) (setf (size self) size) @@ -296,10 +296,10 @@ size)))
(defmethod minimum-size ((self window)) - (min-size-of self)) + (slot-value self 'min-size))
(defmethod (setf minimum-size) (min-size (self window)) - (setf (min-size-of self) min-size) + (setf (slot-value self 'min-size) min-size) (unless (gfs:disposed-p self) (let ((size (constrain-new-size min-size (size self) #'max))) (setf (size self) size)
graphic-forms-cvs@common-lisp.net