home *** CD-ROM | disk | FTP | other *** search
- /* MiscInspectorManager.h
- *
- * This is a general class that should make it easy to implement Inspectors
- * as we know them from the WM or IB...but more general purpose.
- * Anyway. It's not a real inspector. It's the class the manages the selection
- * and all the different inspectors.
- *
- * Usage: Just create an subclass of this object and provide it with the
- * necessary NIB + connections. The default might work with little
- * or no changes for a lot of apps.
- *
- * Every possible inspector has to register her to be added to the list
- * of inspectors. Finding inspectors for a certain selecton goes this
- * way: - Every inspector is asked if he wants to inspect the selection.
- * This is done in the same order they have been added (0...n)
- *
- * - If an inspector feed like doing some work it will be added
- * to the swapViews controller list.
- *
- * - There can be only one inspector(viewController ) for one
- * trigger. So the last inspector has the highest priority and
- * can replace inspectors registered before.
- * This feature is used to handle default inspectors. For more
- * details see below.
- *
- * If selectionCount > 1 then selection returns a List !! that holds
- * the objects to be inspected.
- *
- * Don't try [[inpsector window] makeKeyAndOrderFront:self]. Use the
- * inspectors method instead. Otherwise the shown inspectors might not
- * be correct. This is not a bug. Its really a feature.
- *
- * Notes: InspectorWrappers appear like single inspectors but normally will
- * register for more than one trigger(attribute). For more detail
- * see the notes for a wrapper.
- *
- * The title of the Inspector window is set by the single inspectors
- * acording to the title of their views window!
- *
- * Written by: Thomas Engel
- * Created: 08.02.1994 (Copyright 1994 Thomas Engel)
- * Last modified: 25.02.1994
- */
-
- // This object is included in the MiscKit by permission from the author
- // and its use is governed by the MiscKit license, found in the file
- // "LICENSE.rtf" in the MiscKit distribution. Please refer to that file
- // for a list of all applicable permissions and restrictions.
-
- #import <appkit/appkit.h>
-
- @interface MiscInspectorManager:Object
- {
- id window;
- id okButton;
- id revertButton;
- id buttonsSuperview;
- BOOL buttonsVisible;
- id swapView;
- id selection;
- unsigned selectionCount;
-
- id inspectors;
- id notApplInspector;
- id noSelInspector;
- id multiSelInspector;
- }
-
- // During the init we will load the NIB.
- // This is the easiest way we can ensure that keyboard shortcuts insie the
- // inspector popup will work before we have seen the inspector for the first
- // time.
- // If you want to save space and don't like this early init just override it.
- // If you want a different filename for you main inspector NIB then override
- // the loadNibSection.
-
- - init;
- - loadNibSection;
-
- - makeKeyAndOrderFront:sender;
-
- // These are the methods for setting the selection. You might inspecto single
- // objects or a List of objects. However. When you inspect a List the has only
- // one object inside it has the same affect as useing the simple inspect.
- // So if you want multiple selections...just always use a list. I will work
- // with no pain.
-
- - inspect:anObject;
- - inspectList:aList;
- - selection;
- - (unsigned)selectionCount;
-
- // UpdateInspectors does the real work of finding all the useful inspectors
- // for the current selection and updating the swapViews controllerList.
- // If a registered object knows the addWrappedControllers method the manager
- // will use this method and let the inspector register himself at the swapView.
- // This is how wrappers work.
- //
- // Add default inspectors is called during the init.
- // This simple inspectorManager does only add NoSelection, NotApplicable,
- // MultiSelection (for more details set the single classes)
- // Normally each app has a set of inspectors it might want to preload at
- // startup and not at runtime. So this is the place.
- // Add your default inspectors in your masterInspector class. But remember to
- // [super addDefaultInspectors] if you want to keep the three Misc DefaultInsp.
- // Also be aware that the order of adding is significant!
-
- - addInspector:anInspector;
- - addDefaultInspectors;
- - updateInspectors;
-
- // Here are some interface handling methods.
-
- - setSwapView:anObject;
- - swapView;
-
- - window;
- - setOkButton:aButton;
- - okButton;
- - setRevertButton:aButton;
- - revertButton;
- - setShowButtons:(BOOL)flag;
-
- // oK and revert try to hand the action down to the current Inspector.
-
- - ok:sender;
- - revert:sender;
-
- - touch:sender;
- - textDidChange:sender;
-
- // We will be the swapViews delegate so we can take care of some swapping
- // cleanups etc.
- // Remember to include a call to super. (First place in Will, last in Did)
- // Otherwise the command-keys of the popUp might not work!
-
- - viewWillSwap:sender;
- - viewDidSwap:sender;
-
- @end
-
- /*
- * History: 25.02.94 Seems like I forgot the ok,revert here ... hmm
- *
- * 08.02.94 A complete redesign for the MiscKit. Only the basic idea
- * remains the same as in earlier versins.
- *
- * 20.12.93 Moved some code to a MasterInspector and made this class
- * more abstract and general purpose.
- *
- * 18.12.93 Decided to provide a master-control-system :-)
- * All inspectors have to register themselves.
- *
- * 14.12.93 Added some methods for easy object inspection. Some of
- * them should be move to the MultipagePanel someday.
- *
- * 25.11.93 Created a copy of the pref-manager.
- *
- *
- * Hints: Leaving the decision to the inspector wether he can handle a
- * selection or not frees the inspector from a limitation in the kind
- * of possible selections. This way its easy to allow multiple
- * selections to be inspected properly.
- * For more flexibility it is recommended to use a list Object for
- * storing the selections. Thats how mixed-selections are made.
- *
- *
- * Future: Should add the methods for setting a selection like: addToSelection:
- * removeFromSelection, setSelection:, inspectSelection.
- * This way the inspector would store the selection(List).
- * But normally the selection changes with switching to a different
- * main window so I makes more sense to store selection infos inside
- * a window or document.
- * So this feature might not get implemented here anytime soon.
- *
- * What I might add is that hiding the ok/revert buttons might
- * cause the swapView to become larger. I not really sure about this
- * one but it sounds a little bit useful. Let's see.
- *
- *
- * Bugs: - unknown to me :-)
- *
- * - Well. Ok/revert buttons must have the same superview. But this is
- * not a bug.
- */