
Author: junrue Date: Wed Jul 5 10:55:13 2006 New Revision: 177 Modified: trunk/README.txt trunk/docs/manual/api.texinfo trunk/docs/manual/overview.texinfo trunk/src/uitoolkit/widgets/heap-layout.lisp trunk/src/uitoolkit/widgets/layout.lisp trunk/src/uitoolkit/widgets/widget-classes.lisp Log: added layout-managed base class, modified window and group inheritance accordingly, some initial related refactoring in the layout code Modified: trunk/README.txt ============================================================================== --- trunk/README.txt (original) +++ trunk/README.txt Wed Jul 5 10:55:13 2006 @@ -15,17 +15,17 @@ - ASDF http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/cclan/asdf/ - - Cells - http://common-lisp.net/project/cells/ + - Cells (latest from CVS) + http://www.common-lisp.net/project/cells/ - CFFI (cffi-060606 or later) http://common-lisp.net/project/cffi/ - lw-compat - http://common-lisp.net/project/cl-containers/lw-compat/lw-compat_latest.tar.... + http://common-lisp.net/project/closer/downloads.html - Closer to MOP - http://common-lisp.net/project/cl-containers/closer-mop/closer-mop_latest.ta... + http://common-lisp.net/project/closer/downloads.html - ImageMagick 6.2.6.5-Q16 http://www.imagemagick.org/download/binaries/ImageMagick-6.2.6-5-Q16-windows... Modified: trunk/docs/manual/api.texinfo ============================================================================== --- trunk/docs/manual/api.texinfo (original) +++ trunk/docs/manual/api.texinfo Wed Jul 5 10:55:13 2006 @@ -524,7 +524,7 @@ @end deftp @anchor{group} -@deftp Class group layout children location size style +@deftp Class group children location size style @strong{NOTE:} this class is not yet fully implemented and does not yet participate in the layout protocol.@*@* A @code{group} represents a logical rectangular aggregation @@ -606,9 +606,27 @@ @end deffn @end deftp +@anchor{layout-managed} +@deftp Class layout-managed layout layout-p +Instances of this class employ a @ref{layout-manager} to maintain +the positions and sizes of their children. +@deffn Accessor layout-of +Accepts or returns the @ref{layout-manager} associated with this +container. +@end deffn +@deffn Initarg :layout +Accepts a @ref{layout-manager} object whose responsibility is to manage +the direct children of this container. +@end deffn +@deffn Reader layout-p => boolean +Returns T if layout behavior is enabled for this container; +@sc{nil} otherwise. +@end deffn +@end deftp + @anchor{menu} @deftp Class menu -The menu class represents a container for menu items and submenus. It +This class represents a container for menu items and submenus. It derives from @ref{widget-with-items}. @end deftp @@ -732,23 +750,12 @@ @anchor{window} @deftp Class window layout-p layout maximum-size minimum-size -This is the base class for user-defined @ref{widget}s that serve as containers. -@deffn Accessor layout-of -Accepts or returns the @ref{layout-manager} associated with this -@code{window}. -@end deffn +This is the base class for user-defined @ref{widget}s that serve as containers; +it is also a @ref{layout-managed} subclass. @deffn Accessor maximum-size @end deffn @deffn Accessor minimum-size @end deffn -@deffn Initarg :layout -Accepts a @ref{layout-manager} object whose responsibility is to manage -the direct children of this @code{window}. -@end deffn -@deffn Reader layout-p => boolean -Returns T if layout behavior is enabled for the @code{window}; -@sc{nil} otherwise. -@end deffn @deffn Initarg :maximum-size @end deffn @deffn Initarg :minimum-size Modified: trunk/docs/manual/overview.texinfo ============================================================================== --- trunk/docs/manual/overview.texinfo (original) +++ trunk/docs/manual/overview.texinfo Wed Jul 5 10:55:13 2006 @@ -73,14 +73,14 @@ @item ASDF @url{http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/cclan/asdf} -@item Cells -@url{http://common-lisp.net/project/cells} +@item Cells (latest from CVS) +@url{http://www.common-lisp.net/project/cells/} @item CFFI @url{http://common-lisp.net/project/cffi} @item Closer to MOP -@url{http://common-lisp.net/project/cl-containers/closer-mop/closer-mop_latest.tar.gz} +@url{http://common-lisp.net/project/closer/downloads.html} @item ImageMagick @url{http://www.imagemagick.org/download/binaries/ImageMagick-6.2.6-5-Q16-windows-dll.exe} @@ -89,7 +89,7 @@ @url{http://www.cs.northwestern.edu/academics/courses/325/readings/lisp-unit.html} @item lw-compat -@url{http://common-lisp.net/project/cl-containers/lw-compat/lw-compat_latest.tar.gz} +@url{http://common-lisp.net/project/closer/downloads.html} @end table Modified: trunk/src/uitoolkit/widgets/heap-layout.lisp ============================================================================== --- trunk/src/uitoolkit/widgets/heap-layout.lisp (original) +++ trunk/src/uitoolkit/widgets/heap-layout.lisp Wed Jul 5 10:55:13 2006 @@ -68,12 +68,12 @@ (declare (ignore parent)) (cons kid bounds))))) -(defmethod perform ((self heap-layout) win width-hint height-hint) +(defmethod perform ((self heap-layout) (container layout-managed) width-hint height-hint) (let ((kids nil) (hdwp (cffi:null-pointer)) (top (top-child-of self))) - (when (layout-p win) - (setf kids (compute-layout self win width-hint height-hint)) + (when (layout-p container) + (setf kids (compute-layout self container width-hint height-hint)) (setf hdwp (gfs::begin-defer-window-pos (length kids))) (loop for k in kids do (let* ((rect (cdr k)) Modified: trunk/src/uitoolkit/widgets/layout.lisp ============================================================================== --- trunk/src/uitoolkit/widgets/layout.lisp (original) +++ trunk/src/uitoolkit/widgets/layout.lisp Wed Jul 5 10:55:13 2006 @@ -59,12 +59,12 @@ (setf (top-margin-of layout) vertical-margins) (setf (bottom-margin-of layout) vertical-margins))) -(defmethod perform ((layout layout-manager) win width-hint height-hint) - "Calls compute-layout for a window and then handles the actual moving and resizing of its children." +(defmethod perform ((self layout-manager) (container layout-managed) width-hint height-hint) + "Calls compute-layout for a container and then handles the actual moving and resizing of its children." (let ((kids nil) (hdwp (cffi:null-pointer))) - (when (layout-p win) - (setf kids (compute-layout layout win width-hint height-hint)) + (when (layout-p container) + (setf kids (compute-layout self container width-hint height-hint)) (setf hdwp (gfs::begin-defer-window-pos (length kids))) (loop for k in kids do (let* ((rect (cdr k)) Modified: trunk/src/uitoolkit/widgets/widget-classes.lisp ============================================================================== --- trunk/src/uitoolkit/widgets/widget-classes.lisp (original) +++ trunk/src/uitoolkit/widgets/widget-classes.lisp Wed Jul 5 10:55:13 2006 @@ -39,12 +39,18 @@ (defclass event-dispatcher () () (:documentation "Instances of this class receive events on behalf of user interface objects.")) -(defclass group () - ((layout +(defclass layout-managed () + ((layout-p + :reader layout-p + :initform t) + (layout :accessor layout-of :initarg :layout - :initform nil) - (children + :initform nil)) + (:documentation "Instances of this class employ a layout manager to organize their children.")) + +(defclass group (layout-managed) + ((children :accessor children-of :initarg :children :initform nil) @@ -60,7 +66,7 @@ :accessor style-of :initarg :style :initform nil)) - (:documentation "Instances of this class act as lightweight containers for other objects.")) + (:documentation "Instances of this class act as logical containers for other objects.")) (defclass event-source (gfs:native-object) ((dispatcher @@ -143,15 +149,8 @@ (defclass menu (widget-with-items) () (:documentation "The menu class represents a container for menu items (and submenus).")) -(defclass window (widget) - ((layout-p - :reader layout-p - :initform t) - (layout - :accessor layout-of - :initarg :layout - :initform nil) - (maximum-size +(defclass window (widget layout-managed) + ((maximum-size :accessor maximum-size :initarg :maximum-size :initform nil)