Source

eieio / eieio-speedbar.el

Diff from to

eieio-speedbar.el

 ;;; eieio-speedbar.el -- Classes for managing speedbar displays.
 
 ;;;
-;; Copyright (C) 1999, 2000, 2001 Eric M. Ludlam
+;; Copyright (C) 1999, 2000, 2001, 2002 Eric M. Ludlam
 ;;
 ;; Author: <zappo@gnu.org>
 ;; RCS: $Id$
 ;;
 ;; 1) Objects that will have lists of items that can be expanded
 ;;    should also inherit from the classes:
+;;  * `eieio-speedbar'                  - specify your own button behavior
 ;;  * `eieio-speedbar-directory-button' - objects that behave like directories
 ;;  * `eieio-speedbar-file-button'      - objects that behave like files
 ;;
 	       "The type of expansion button used for objects of this class.
 Possible values are those symbols supported by the `exp-button-type' argument
 to `speedbar-make-tag-line'."
-	       :allocation class)
+	       :allocation :class)
    (buttonface :initform speedbar-tag-face
 	       :type (or symbol face)
 	       :documentation
 	       "The face used on the textual part of the button for this class.
 See `speedbar-make-tag-line' for details."
-	       :allocation class)
+	       :allocation :class)
    (expanded :initform nil
 	     :type boolean
 	     :documentation
 	     "State of an object being expanded in speedbar.")
    )
   "Class which provides basic speedbar support for child classes.
-Add one of thie child classes to this class to the parent list of a class.")
+Add one of thie child classes to this class to the parent list of a class."
+  :abstract t)
 
 (defclass eieio-speedbar-directory-button (eieio-speedbar)
   ((buttontype :initform angle)
    (buttonface :initform speedbar-directory-face))
-  "Class providing support for objects which behave like a directory.")
+  "Class providing support for objects which behave like a directory."
+  :abstract t)
 
 (defclass eieio-speedbar-file-button (eieio-speedbar)
   ((buttontype :initform bracket)
    (buttonface :initform speedbar-file-face))
-  "Class providing support for objects which behave like a directory.")
+  "Class providing support for objects which behave like a directory."
+  :abstract t)
 
 
 ;;; Methods to eieio-speedbar-* which do not need to be overriden
   (let ((children (eieio-speedbar-object-children object))
 	(exp (oref object expanded)))
     (if (not children)
-	(speedbar-make-tag-line (oref object buttontype)
-				?? nil nil
-				(eieio-speedbar-object-buttonname object)
-				'eieio-speedbar-object-click
-				object
-				(oref object buttonface)
-				depth)
+	(if (eq (oref object buttontype) 'expandtag)
+	    (speedbar-make-tag-line 'statictag
+				    ?  nil nil
+				    (eieio-speedbar-object-buttonname object)
+				    'eieio-speedbar-object-click
+				    object
+				    (oref object buttonface)
+				    depth)
+	  (speedbar-make-tag-line (oref object buttontype)
+				  ?  nil nil
+				  (eieio-speedbar-object-buttonname object)
+				  'eieio-speedbar-object-click
+				  object
+				  (oref object buttonface)
+				  depth))
       (speedbar-make-tag-line (oref object buttontype)
 			      (if exp ?- ?+)
 			      'eieio-speedbar-object-expand
 
 (defmethod eieio-speedbar-child-make-tag-lines ((object eieio-speedbar) depth)
   "Base method for creating tag lines for non-object children."
-  (error "You must implement `eieio-speedbar-child-make-tag-lnes' for %s"
+  (error "You must implement `eieio-speedbar-child-make-tag-lines' for %s"
 	 (object-name object)))
 
 (defmethod eieio-speedbar-expand ((object eieio-speedbar) depth)
 	   (mapcar (lambda (car)
 		     (eieio-speedbar-make-tag-line car depth))
 		   children))
-	  (t (eieio-speedbar-child-make-tag-lines object depth)))))
+	  (children (eieio-speedbar-child-make-tag-lines object depth)))))
 
 
 ;;; Speedbar specific function callbacks.