annotate lisp/oobr/tree-nx/TreeButton.m @ 14:9ee227acff29 r19-15b90

Import from CVS: tag r19-15b90
author cvs
date Mon, 13 Aug 2007 08:48:42 +0200
parents 376386a54a3c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 //
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 // TreeButton.m -- a class to attach to tree data structures
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 // This class requires the String class, also by Don Yacktman.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 // Written by Don Yacktman (c) 1993 by Don Yacktman.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 // All rights reserved.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 //
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 // I doubt this will be useful for much beyond what it does in the demo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 // program supplied in this directory.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 //
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 // You may use and copy this class freely as long as you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 // comply with the following terms:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 // (1) If you use this class in an application which you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 // intend to sell commercially, as shareware, or otherwise,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 // you may only do so with express written permission
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 // of the author. Use in applications which will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 // be distributed free of charge is encouraged.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 // (2) You must include the source code to this object and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 // all accompanying documentation with your application,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 // or provide it to users if requested, free of charge.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 // (3) Do not remove the author's name or any of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 // copyright notices
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 //
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 #import "TreeButton.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 #import "TreeButtonCell.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 #import "NamedTree.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 @implementation TreeButton
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 static id treeButtonCell;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 + initialize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 if (self == [TreeButton class]) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 treeButtonCell = [TreeButtonCell class]; // default cell class
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 return self;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 + setCellClass:classId
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 treeButtonCell = classId;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 return self;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 - initFrame:(const NXRect *)frameRect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 id oldCell;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 [super initFrame:frameRect];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 oldCell = [self setCell:[[[treeButtonCell alloc] init] setParent:self]];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 [oldCell free];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 return self;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 - wasSelected:sender
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 { // message is sent here by the Cell if the user clicked the button
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 if ([myTreeNode respondsTo:@selector(activateNode:)])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 [myTreeNode activateNode:self];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 return self;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 - treeNode { return myTreeNode; }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 - setTreeNode:node { myTreeNode = node; return self; }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 @end