annotate pkg-src/tree-nx/NamedTree.m @ 191:ecf6ba7b0a10 r20-3b22

Import from CVS: tag r20-3b22
author cvs
date Mon, 13 Aug 2007 09:57:38 +0200
parents 0132846995bd
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
1 //
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
2 // NamedTree.m -- a generic class to build tree data structures
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
3 // This class requires the String class, also by Don Yacktman.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
4 // Written by Don Yacktman (c) 1993 by Don Yacktman.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
5 // All rights reserved.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
6 //
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
7 // You may use and copy this class freely as long as you
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
8 // comply with the following terms:
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
9 // (1) If you use this class in an application which you
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
10 // intend to sell commercially, as shareware, or otherwise,
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
11 // you may only do so with express written permission
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
12 // of the author. Use in applications which will
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
13 // be distributed free of charge is encouraged.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
14 // (2) You must include the source code to this object and
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
15 // all accompanying documentation with your application,
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
16 // or provide it to users if requested, free of charge.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
17 // (3) Do not remove the author's name or any of the
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
18 // copyright notices
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
19 //
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
20
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
21 #import "NamedTree.h"
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
22 #import "TreeView.h"
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
23
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
24 @implementation NamedTree
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
25
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
26 - setTreeName:string { treeName = string; return self; }
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
27 - (const char *)treeName { return [treeName stringValue]; }
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
28
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
29 - activateNode:sender
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
30 {
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
31 // int msgDelivered;
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
32
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
33 // this action message is sent whenever the button associated with
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
34 // this node is clicked by the user.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
35 [[sender superview] setCurrentButton:sender];
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
36 [self act:sender];
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
37 return self;
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
38 }
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
39
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
40 - act:sender
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
41 {
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
42 const char* nodeVal = [((value) ? value : label) stringValue];
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
43
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
44 printf("%s^^%s^^%s\n", [self treeName], "br-edit", nodeVal);
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
45 // msgDelivered = [[NXApp appSpeaker] selectorRPC:"nxBrowserMsg"
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
46 // paramTypes:"ccc",
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
47 // [self treeName], "br-edit", nodeVal];
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
48 // if (msgDelivered != 0)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
49 // fprintf(stderr, "Class display request not accepted.\n");
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
50
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
51 return self;
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
52 }
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
53
0132846995bd Import from CVS: tag r20-3b8
cvs
parents:
diff changeset
54 @end