home *** CD-ROM | disk | FTP | other *** search
- //
- // MiscThreeStateButtonCell.h -- cell class for the three state button
- // Written by Don Yacktman (c) 1993 by Don Yacktman.
- // Version 1.0. All rights reserved.
- //
- // This notice may not be removed from this source code.
- //
- // This is a free object! Contact the author for the latest version.
- // Don Yacktman, 4279 N. Ivy Lane, Provo, UT, 84604
- // e-mail: Don_Yacktman@byu.edu
- //
- // 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>
-
- // The three state button...
-
- // the values of these are arbitrary and chosen to avoid conflict
- // with the NeXT #defines in ButtonCell.h... use them with -setType:
- #define MISC_CYCLIC_THREE_STATE 100 // cycles through three states
- #define MISC_PLAIN_THREE_STATE 101 // alt click for third state
-
- @interface MiscThreeStateButtonCell:ButtonCell
- {
- char *thirdTitle; // title for the third state
- id _thirdImage; // image for the third state
- char *trueAltTitle; // title for the third state
- id _trueAltImage; // image for the third state
- BOOL isCyclic; // if not, ALT click gives third state.
- BOOL thirdState; // if we're in the third state.
- }
-
- // the basics
- - init;
- - copyFromZone:(NXZone *)zone;
- - free;
-
- // override to set the "true" instance variables...
- - (const char *)altTitle;
- - setAltTitle:(const char *)aString;
- - (const char *)altIcon;
- - setAltIcon:(const char *)iconName;
- - altImage;
- - setAltImage:image;
-
- // setting and getting the third image/title
- - (const char *)thirdTitle;
- - setThirdTitle:(const char *)aString;
- - (const char *)thirdIcon;
- - setThirdIcon:(const char *)iconName;
- - thirdImage;
- - setThirdImage:image;
- - setType:(int)aType;
- - (BOOL)isCyclic;
-
- // Need to override these to provide for the third state
- - (const char *)stringValue;
- - setStringValue:(const char *)aString;
- - setStringValueNoCopy:(const char *)aString;
- - (int)intValue;
- - setIntValue:(int)anInt;
- - (float)floatValue;
- - setFloatValue:(float)aFloat;
- - (double)doubleValue;
- - setDoubleValue:(double)aDouble;
-
- // these override the drawing to deal with the extra
- // image/icon and title
- - getDrawRect:(NXRect *)theRect;
- - getTitleRect:(NXRect *)theRect;
- - getIconRect:(NXRect *)theRect;
- - calcCellSize:(NXSize *)theSize inRect:(const NXRect *)aRect;
- - drawInside:(const NXRect *)aRect inView:controlView;
- - highlight:(const NXRect *)cellFrame inView:controlView lit:(BOOL)flag;
- - (BOOL)trackMouse:(NXEvent *)theEvent inRect:(const NXRect *)cellFrame
- ofView:controlView;
- - performClick:sender;
- - performAltClick:sender;
- - write:(NXTypedStream *)stream;
- - read:(NXTypedStream *)stream;
-
- - replaceAltTitle:(const char *)aString;
- - replaceTitle:(const char *)aString;
-
- @end
-