home *** CD-ROM | disk | FTP | other *** search
- /* MiscSwapView.h
- *
- * This subclass of View is able to swap different views into itself. It's
- * used to implement any kind of multipage windows. (Inspectors, Prefs...)
- * This object is a redesign of Greg Bruds swapView.
- *
- * Catergories: - ByObject: Handles automatic swapping. See next headersction.
- *
- * Usage: Just instantiate a view inside IB and tell it what view to show
- * next. The MiscSwapView will take care of putting the views back where
- * they came from once they will swap out again.
- * You can used buffered (faster) or nonButffered (less memory and fast
- * enough) swapping.
- *
- * Notes: This view by default resizes its subview to it current size. But you
- * can decide how they are resized by the default NeXTSTEP view resizing
- * settings as with every view.
- * When using buffered composing resizing is turned OFF because of some
- * ugly problems.
- *
- * Not using buffered views will save memory and allow resizing
- * over the slightly faster swapping. With fast hardware this might not
- * be of any concern at all...so keep the ports rolling:HP, Sun, PPC...?
- * To implement buffered views the views windows have to be none
- * deffered and retained. You HAVE to make your window non defered
- * inside IB. (SwapView makes them retained on its own)
- * If you know a way to make windows non defered during runtime..please
- * let me know.
- *
- * Remember to deactivate objects inside a view that has swapped out.
- * ColorWell are a good example of such a object!
- *
- * Improved by: Thomas Engel
- * First changes: 24.01.1994 (Copyright 1994 Thomas Engel)
- * Last modified: 24.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 MiscSwapView:View
- {
- id contentView;
- id contentViewsHomeView;
- NXRect contentViewsHomeRect;
- id delegate;
- float backgroundGray;
- BOOL useBuffering;
-
- // Instances for the ByObject category
-
- id trigger;
- id controllers;
- id currentController;
- BOOL tagComparison;
- }
-
- // Basic view init and freeing
-
- - init;
- - initFrame:(const NXRect *)frameRect;
- - free;
-
- // Basic instance-control method and delegate setting.
- // More details on buffering are at the top of this header file.
-
- - setDelegate:(id)anObject;
- - delegate;
- - setBackgroundGray:(float)aColor;
- - (float)backgroundGray;
- - setUseBuffering:(BOOL)flag;
- - (BOOL)doesUseBuffering;
-
- // The real work..there's some swapping swapping going on...tadadatadaa..
-
- - setContentView:aView;
- - contentView;
- - contentViewsHomeView;
-
- // Archiving
-
- - write:(NXTypedStream *)stream;
- - read:(NXTypedStream *)stream;
-
- @end
-
- // This method might be implemented by the delegate but is quite useless here
- // because somebody has to trigger the swapping an he knows when something
- // changes.
- // But once we will handle swapping on our own we might need this.
-
- @interface Object(MiscSwapViewDelegate)
-
- - viewWillSwap:sender;
- - viewDidSwap:sender;
-
- @end
-
- /*
- * History: 24.02.94 Some changes to support buffering.
- *
- * 24.01.94 Took my old swapView and wrote it again...
- *
- * 21.01.94 Did some work to the resizing of swapView.
- *
- * 19.11.93 Started to do some cleanups in this HeaderFile and
- * resizing got implemented into the object.
- *
- * 17.11.93 Played around with resizing and found it right.
- *
- *
- * Bugs: - There might be problems with swapping out a view with an active
- * colorWell. Here some should take care a deactive them.
- * You might use the delegate and viewWillSwap.
- * Normally you will use subviewControllers and they will recieve
- * swapIn/Out too and can take care of that inside their revert/ok
- * methods or what ever.
- *
- * - Using buffering doe disable resizing. Maybe there is a solution to
- * this porblem. If there is one I might add a setResizing:YES/NO
- * method.
- *
- * - Read & write do nothing at all. I'm not even sure wether they should
- * do something ?
- */
-
- /* ------------------------------------------------------------------------- */
-
- /* MiscSwapView_ByObject
- *
- * This is a MiscSwapView category. I can handle swapping of different
- * contentViews (controlled by MiscSwapContentsController's) into ourself by
- * comparing trigger objects.
- *
- * Usage: To work properly every contentsController has to register itself
- * at the corresponding swapView. The object triggering the swap
- * should invoke the sV-object and this one has to decide which
- * contentsController has to come to front.
- * The trigger instance stores the triggering object to have it at
- * hand when a findController(..) needs it to make the decision.
- *
- * For the first time the swapView will be uninitialized! The app
- * has to trigger some kind of default swap maybe by a
- * [swapView swapAction:defaultObject];
- *
- * Notes: To implement a different controller-finding behavior you should only
- * override the findControllerByTag/object methods. They should return
- * the contentsController to use next ... or nil.
- * Sometimes swapAction can provide a trigger adjustment too. As done
- * with the ..ByMatrix class.
- *
- * Written by: Thomas Engel
- * Created: 24.01.1994 (Copyleft)
- * Last modified: 08.03.1994
- */
-
- @interface MiscSwapView(ByObject)
-
- // swapContentView is invoked by the action-buttons.
- // And if somebody wants to know who triggered the swap..[trigger]
-
- - swapContentView:sender;
- - trigger;
-
- // Here are some methods that allow some contentsController handling.
- // There should be no need to change the list by hand!
-
- - addController:sender;
- - removeController:sender;
- - removeAllControllers;
- - controllers;
- - contentsController;
-
- - setTagComparison:(BOOL)flag;
- - (BOOL)doesTagComparison;
-
- // These are the methods that decides which controller to show activate next.
- // Here is the place to add some custom behavior. The methods byTag/object
- // should work with no pain in any subclass too. For details see the popup and
- // ByMatrix subclasses of MiscSwapView.
- // Sometime you just have to make some minor fixes inside findController.
-
- - findController;
- - findControllerByTag:(int)aTag;
- - findControllerByObject:aTrigger;
-
- @end
-
- /*
- * History: 08.03.94 Chenged the findMethods to make them nicer for other
- * actions.
- *
- * 14.02.94 Some minor changes to make it a swapView category.
- *
- * 24.01.94 Made it a subclass of MiscSwapView
- *
- * 08.01.94 Switched to tagComparison for better reading.
- * choosesByTagFirst was not that nice.
- *
- * 21.12.93 Derived from my old swapPopManager this is a simple usable
- * and subcallable object.
- * Some viewController handling methods added.
- *
- * 04.12.93 Added the delegates methods.
- *
- * 04.11.93 First methods hacked together.
- *
- *
- * Bugs: - not really
- *
- * - swapContentView. Ok. I could have stay with Greg's swapAction but I
- * don't find it a good method name. If you like it - creat your own
- * compatibility category.
- */
-