2 |
3 | /*!
4 | @brief RPCountedToken is an NSString with a count.
5 | Although the count may be used for any arbitrary purpose, it is normally used to
6 | represent the number of times that an RPCountedToken has been "added" to its parent collection.
7 | Because its count is settable, it is used internally by RPTokenControl to represent tokens,
8 | and may be used externally in applications where the inability to set the count makes
9 | NSCountedSet too cumbersome.
10 | @detail
11 | INHERITANCE
12 | RPCountedToken is a subclass of NSObject
13 | SYSTEM REQUIREMENTS
14 | RPTokenControl has been tested on systems as early as Mac OS 10.3.
15 | KVC-COMPLIANT PROPERTIES
16 | The following properties may be set and observed using key-value coding,
17 | except those noted as read-only may be only observed.
18 | Accessor methods may also be available.
19 |
20 | -
21 |
NSString* text
22 | The string.
23 |
24 | -
25 |
NSInteger count
26 | The count. The value count=0 is reserved for the special "ellipsis" RPCountedToken
27 |
28 |
29 | VERSION HISTORY, AUTHOR, ETC.
30 | See RPTokenControl.h for this info.
31 | */
32 | @interface RPCountedToken : NSObject {
33 | NSString *_text ;
34 | NSInteger _count ;
35 | // _count = 0 denotes a special "ellipsis token"
36 | }
37 |
38 | /*!
39 | @brief designated initializer, sets both instance variables.
40 | @param text new value for the text property of the receiver
41 | @param count new value for the count property of the receiver
42 | @result an instance of RPCountedToken
43 | */
44 | - (id)initWithText:(NSString*)text
45 | count:(NSInteger)count ;
46 | /*!
47 | @brief Increments the count property of the receiver.
48 | */
49 | - (void)incCount ;
50 |
51 | /*!
52 | @brief getter for the ivar text
53 | */
54 | - (NSString*)text ;
55 |
56 | /*!
57 | @result The text value of the receiver with the count value appended in square brackets.
58 | Example: "MyText [5]"
59 | */
60 | - (NSString*)textWithCountAppended ;
61 |
62 | /*!
63 | @brief getter for the ivar count
64 | */
65 | - (NSInteger)count ;
66 |
67 | /*!
68 | @result NSOrderedAscending, NSOrderedSame or NSOrderedDescending,
69 | determined by sending -localizedCaseInsensitiveCompare:other to the receiver.
70 | */
71 | - (NSComparisonResult)textCompare:(RPCountedToken*)other ;
72 |
73 | /*!
74 | @result if count of the receiver < count of other, returns NSOrderedDescending.
75 | If count of the receiver > count of other, returns NSOrderedAscending.
76 | If count of the receiver == count of other, returns result of -textCompare:other.
77 | */
78 | - (NSComparisonResult)countCompare:(RPCountedToken*)other ;
79 |
80 | /*!
81 | @result If the receiver is an ellipsis token, returns YES.
82 | Otherwise, returns NO.
83 | @details With the current design, -[myCountedToken isEllipsisToken] is equivalent to
84 | -[myCountedToken count] == 0 && myCountedToken != nil. This method is a convenience
85 | and attempt to avert future bugs.
86 | */
87 | - (BOOL)isEllipsisToken ;
88 |
89 | /*!
90 | @brief gets a special "ellipsis" RPCountedToken
91 | @details The text of the special "ellipsis" RPCountedToken is a one-character string,
92 | the unicode eliipsis (0x2026). The count is 0. This special RPCountedToken is used by
93 | RPTokenControl as the last token when there are too many to fit in the given frame.
94 | @result an autoreleased instance of the special "ellipsis" RPCountedoken
95 | */
96 | + (RPCountedToken*)ellipsisToken ;
97 |
98 | /*!
99 | @brief Returns YES if the receiver's text to another given
100 | RPCountedToken's text, or equal to another given string
101 |
102 | @details Note that this is a rather liberal definition of
103 | isEqual:. The 'count' is ignored!
104 | */
105 | - (BOOL)isEqual:(id)other ;
106 |
107 | @end
108 |
109 |
--------------------------------------------------------------------------------
/RPTokenControlKit/RPCountedToken/Classes/RPCountedToken/Methods/Methods.html:
--------------------------------------------------------------------------------
1 |
3 |
4 | Methods
5 |
6 | Methods
7 |
8 |
9 | Abstract: getter for the ivar count
10 |
11 | - (int)count;
12 |
13 |
14 |
15 |
16 |
17 | - (NSComparisonResult)countCompare:(RPCountedToken*)other;
18 |
19 |
20 | Result: if count of the receiver < count of other, returns NSOrderedDescending.
21 | If count of the receiver > count of other, returns NSOrderedAscending.
22 | If count of the receiver == count of other, returns result of -textCompare:other.
23 |
24 |
25 |
26 |
27 | Abstract: gets a special "ellipsis" RPCountedToken
28 |
29 | + (RPCountedToken*)ellipsisToken;
30 |
31 | The text of the special "ellipsis" RPCountedToken is a one-character string,
32 | the unicode eliipsis (0x2026). The count is 0. This special RPCountedToken is used by
33 | RPTokenControl as the last token when there are too many to fit in the given frame.
34 |
35 | Result: an autoreleased instance of the special "ellipsis" RPCountedoken
36 |
37 |
38 |
39 |
40 | Abstract: Increments the count property of the receiver.
41 |
42 | - (void)incCount;
43 |
44 |
45 |
46 |
47 |
48 | Abstract: designated initializer, sets both instance variables.
49 |
50 | - (id)initWithText:(NSString*)text
51 | count:(int)count;
52 |
53 |
54 | Parameters
55 |
56 |
57 | | Name | Description |
58 | | text | new value for the text property of the receiver |
59 | | count | new value for the count property of the receiver |
60 |
61 |
62 | Result: an instance of RPCountedToken
63 |
64 |
65 |
66 |
67 | - (BOOL)isEllipsisToken;
68 |
69 | With the current design, -[myCountedToken isEllipsisToken] is equivalent to
70 | -[myCountedToken count] == 0 && myCountedToken != nil. This method is a convenience
71 | and attempt to avert future bugs.
72 |
73 | Result: If the receiver is an ellipsis token, returns YES.
74 | Otherwise, returns NO.
75 |
76 |
77 |
78 |
79 | Abstract: getter for the ivar text
80 |
81 | - (NSString*)text;
82 |
83 |
84 |
85 |
86 |
87 | - (NSComparisonResult)textCompare:(RPCountedToken*)other;
88 |
89 |
90 | Result: NSOrderedAscending, NSOrderedSame or NSOrderedDescending,
91 | determined by sending -localizedCaseInsensitiveCompare:other to the receiver.
92 |
93 |
94 |
95 |
96 | - (NSString*)textWithCountAppended;
97 |
98 |
99 | Result: The text value of the receiver with the count value appended in square brackets.
100 | Example: "MyText [5]"
101 |
102 |
103 | (Last Updated 2/8/2008)
104 |
105 |
--------------------------------------------------------------------------------
/RPTokenControlKit/Documentation/RPCountedToken/Classes/RPCountedToken/Methods/Methods.html:
--------------------------------------------------------------------------------
1 |
3 |
4 | Methods
5 |
6 | Methods
7 |
8 |
9 | Abstract: getter for the ivar count
10 |
11 | - (int)count;
12 |
13 |
14 |
15 |
16 |
17 | - (NSComparisonResult)countCompare:(RPCountedToken*)other;
18 |
19 |
20 | Result: if count of the receiver < count of other, returns NSOrderedDescending.
21 | If count of the receiver > count of other, returns NSOrderedAscending.
22 | If count of the receiver == count of other, returns result of -textCompare:other.
23 |
24 |
25 |
26 |
27 | Abstract: gets a special "ellipsis" RPCountedToken
28 |
29 | + (RPCountedToken*)ellipsisToken;
30 |
31 | The text of the special "ellipsis" RPCountedToken is a one-character string,
32 | the unicode eliipsis (0x2026). The count is 0. This special RPCountedToken is used by
33 | RPTokenControl as the last token when there are too many to fit in the given frame.
34 |
35 | Result: an autoreleased instance of the special "ellipsis" RPCountedoken
36 |
37 |
38 |
39 |
40 | Abstract: Increments the count property of the receiver.
41 |
42 | - (void)incCount;
43 |
44 |
45 |
46 |
47 |
48 | Abstract: designated initializer, sets both instance variables.
49 |
50 | - (id)initWithText:(NSString*)text
51 | count:(int)count;
52 |
53 |
54 | Parameters
55 |
56 |
57 | | Name | Description |
58 | | text | new value for the text property of the receiver |
59 | | count | new value for the count property of the receiver |
60 |
61 |
62 | Result: an instance of RPCountedToken
63 |
64 |
65 |
66 |
67 | - (BOOL)isEllipsisToken;
68 |
69 | With the current design, -[myCountedToken isEllipsisToken] is equivalent to
70 | -[myCountedToken count] == 0 && myCountedToken != nil. This method is a convenience
71 | and attempt to avert future bugs.
72 |
73 | Result: If the receiver is an ellipsis token, returns YES.
74 | Otherwise, returns NO.
75 |
76 |
77 |
78 |
79 | Abstract: getter for the ivar text
80 |
81 | - (NSString*)text;
82 |
83 |
84 |
85 |
86 |
87 | - (NSComparisonResult)textCompare:(RPCountedToken*)other;
88 |
89 |
90 | Result: NSOrderedAscending, NSOrderedSame or NSOrderedDescending,
91 | determined by sending -localizedCaseInsensitiveCompare:other to the receiver.
92 |
93 |
94 |
95 |
96 | - (NSString*)textWithCountAppended;
97 |
98 |
99 | Result: The text value of the receiver with the count value appended in square brackets.
100 | Example: "MyText [5]"
101 |
102 |
103 | (Last Updated 2/8/2008)
104 |
105 |
--------------------------------------------------------------------------------
/RPTokenControlKit/RPCountedToken/Classes/RPCountedToken/CompositePage.html:
--------------------------------------------------------------------------------
1 |
3 |
4 | RPCountedToken
5 |
6 | RPCountedToken
7 | Abstract
8 | RPCountedToken is an NSString with a count.
9 | Although the count may be used for any arbitrary purpose, it is normally used to
10 | represent the number of times that an RPCountedToken has been "added" to its parent collection.
11 | Because its count is settable, it is used internally by RPTokenControl to represent tokens,
12 | and may be used externally in applications where the inability to set the count makes
13 | NSCountedSet too cumbersome.
14 | Discussion
15 | INHERITANCE
16 | RPCountedToken is a subclass of NSObject
17 | SYSTEM REQUIREMENTS
18 | RPTokenControl has been tested on systems as early as Mac OS 10.3.
19 | KVC-COMPLIANT PROPERTIES
20 | The following properties may be set and observed using key-value coding,
21 | except those noted as read-only may be only observed.
22 | Accessor methods may also be available.
23 |
24 | -
25 |
NSString* text
26 | The string.
27 |
28 | -
29 |
int count
30 | The count. The value count=0 is reserved for the special "ellipsis" RPCountedToken
31 |
32 |
33 | VERSION HISTORY, AUTHOR, ETC.
34 | See RPTokenControl.h for this info.
35 |
Methods
36 |
37 |
38 | Abstract: getter for the ivar count
39 |
40 | - (int)count;
41 |
42 |
43 |
44 |
45 |
46 | - (NSComparisonResult)countCompare:(RPCountedToken*)other;
47 |
48 |
49 | Result: if count of the receiver < count of other, returns NSOrderedDescending.
50 | If count of the receiver > count of other, returns NSOrderedAscending.
51 | If count of the receiver == count of other, returns result of -textCompare:other.
52 |
53 |
54 |
55 |
56 | Abstract: gets a special "ellipsis" RPCountedToken
57 |
58 | + (RPCountedToken*)ellipsisToken;
59 |
60 | The text of the special "ellipsis" RPCountedToken is a one-character string,
61 | the unicode eliipsis (0x2026). The count is 0. This special RPCountedToken is used by
62 | RPTokenControl as the last token when there are too many to fit in the given frame.
63 |
64 | Result: an autoreleased instance of the special "ellipsis" RPCountedoken
65 |
66 |
67 |
68 |
69 | Abstract: Increments the count property of the receiver.
70 |
71 | - (void)incCount;
72 |
73 |
74 |
75 |
76 |
77 | Abstract: designated initializer, sets both instance variables.
78 |
79 | - (id)initWithText:(NSString*)text
80 | count:(int)count;
81 |
82 |
83 | Parameters
84 |
85 |
86 | | Name | Description |
87 | | text | new value for the text property of the receiver |
88 | | count | new value for the count property of the receiver |
89 |
90 |
91 | Result: an instance of RPCountedToken
92 |
93 |
94 |
95 |
96 | - (BOOL)isEllipsisToken;
97 |
98 | With the current design, -[myCountedToken isEllipsisToken] is equivalent to
99 | -[myCountedToken count] == 0 && myCountedToken != nil. This method is a convenience
100 | and attempt to avert future bugs.
101 |
102 | Result: If the receiver is an ellipsis token, returns YES.
103 | Otherwise, returns NO.
104 |
105 |
106 |
107 |
108 | Abstract: getter for the ivar text
109 |
110 | - (NSString*)text;
111 |
112 |
113 |
114 |
115 |
116 | - (NSComparisonResult)textCompare:(RPCountedToken*)other;
117 |
118 |
119 | Result: NSOrderedAscending, NSOrderedSame or NSOrderedDescending,
120 | determined by sending -localizedCaseInsensitiveCompare:other to the receiver.
121 |
122 |
123 |
124 |
125 | - (NSString*)textWithCountAppended;
126 |
127 |
128 | Result: The text value of the receiver with the count value appended in square brackets.
129 | Example: "MyText [5]"
130 |
131 |
132 | (Last Updated 2/8/2008)
133 |
134 |
--------------------------------------------------------------------------------
/RPTokenControlKit/Documentation/RPCountedToken/Classes/RPCountedToken/CompositePage.html:
--------------------------------------------------------------------------------
1 |
3 |
4 | RPCountedToken
5 |
6 | RPCountedToken
7 | Abstract
8 | RPCountedToken is an NSString with a count.
9 | Although the count may be used for any arbitrary purpose, it is normally used to
10 | represent the number of times that an RPCountedToken has been "added" to its parent collection.
11 | Because its count is settable, it is used internally by RPTokenControl to represent tokens,
12 | and may be used externally in applications where the inability to set the count makes
13 | NSCountedSet too cumbersome.
14 | Discussion
15 | INHERITANCE
16 | RPCountedToken is a subclass of NSObject
17 | SYSTEM REQUIREMENTS
18 | RPTokenControl has been tested on systems as early as Mac OS 10.3.
19 | KVC-COMPLIANT PROPERTIES
20 | The following properties may be set and observed using key-value coding,
21 | except those noted as read-only may be only observed.
22 | Accessor methods may also be available.
23 |
24 | -
25 |
NSString* text
26 | The string.
27 |
28 | -
29 |
int count
30 | The count. The value count=0 is reserved for the special "ellipsis" RPCountedToken
31 |
32 |
33 | VERSION HISTORY, AUTHOR, ETC.
34 | See RPTokenControl.h for this info.
35 |
Methods
36 |
37 |
38 | Abstract: getter for the ivar count
39 |
40 | - (int)count;
41 |
42 |
43 |
44 |
45 |
46 | - (NSComparisonResult)countCompare:(RPCountedToken*)other;
47 |
48 |
49 | Result: if count of the receiver < count of other, returns NSOrderedDescending.
50 | If count of the receiver > count of other, returns NSOrderedAscending.
51 | If count of the receiver == count of other, returns result of -textCompare:other.
52 |
53 |
54 |
55 |
56 | Abstract: gets a special "ellipsis" RPCountedToken
57 |
58 | + (RPCountedToken*)ellipsisToken;
59 |
60 | The text of the special "ellipsis" RPCountedToken is a one-character string,
61 | the unicode eliipsis (0x2026). The count is 0. This special RPCountedToken is used by
62 | RPTokenControl as the last token when there are too many to fit in the given frame.
63 |
64 | Result: an autoreleased instance of the special "ellipsis" RPCountedoken
65 |
66 |
67 |
68 |
69 | Abstract: Increments the count property of the receiver.
70 |
71 | - (void)incCount;
72 |
73 |
74 |
75 |
76 |
77 | Abstract: designated initializer, sets both instance variables.
78 |
79 | - (id)initWithText:(NSString*)text
80 | count:(int)count;
81 |
82 |
83 | Parameters
84 |
85 |
86 | | Name | Description |
87 | | text | new value for the text property of the receiver |
88 | | count | new value for the count property of the receiver |
89 |
90 |
91 | Result: an instance of RPCountedToken
92 |
93 |
94 |
95 |
96 | - (BOOL)isEllipsisToken;
97 |
98 | With the current design, -[myCountedToken isEllipsisToken] is equivalent to
99 | -[myCountedToken count] == 0 && myCountedToken != nil. This method is a convenience
100 | and attempt to avert future bugs.
101 |
102 | Result: If the receiver is an ellipsis token, returns YES.
103 | Otherwise, returns NO.
104 |
105 |
106 |
107 |
108 | Abstract: getter for the ivar text
109 |
110 | - (NSString*)text;
111 |
112 |
113 |
114 |
115 |
116 | - (NSComparisonResult)textCompare:(RPCountedToken*)other;
117 |
118 |
119 | Result: NSOrderedAscending, NSOrderedSame or NSOrderedDescending,
120 | determined by sending -localizedCaseInsensitiveCompare:other to the receiver.
121 |
122 |
123 |
124 |
125 | - (NSString*)textWithCountAppended;
126 |
127 |
128 | Result: The text value of the receiver with the count value appended in square brackets.
129 | Example: "MyText [5]"
130 |
131 |
132 | (Last Updated 2/8/2008)
133 |
134 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | #########################
2 | # .gitignore file for Xcode4 / macOS Source projects
3 | #
4 | # Version 2.1
5 | # For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
6 | #
7 | # 2013 updates:
8 | # - fixed the broken "save personal Schemes"
9 | # - added line-by-line explanations for EVERYTHING (some were missing)
10 | #
11 | # NB: if you are storing "built" products, this WILL NOT WORK,
12 | # and you should use a different .gitignore (or none at all)
13 | # This file is for SOURCE projects, where there are many extra
14 | # files that we want to exclude
15 | #
16 | #########################
17 |
18 | #####
19 | # macOS temporary files that should never be committed
20 | # See http://www.westwind.com/reference/os-x/invisibles.html
21 | .DS_Store
22 |
23 | # See http://www.westwind.com/reference/os-x/invisibles.html
24 | .Trashes
25 |
26 | # See http://www.westwind.com/reference/os-x/invisibles.html
27 | *.swp
28 |
29 | # *.lock - this is used and abused by many editors for many different things.
30 | # For the main ones I use (e.g. Eclipse), it should be excluded
31 | # from source-control, but YMMV
32 | *.lock
33 |
34 | #
35 | # profile - REMOVED temporarily (on double-checking, this seems incorrect; I can't find it in macOS docs?)
36 | #profile
37 |
38 |
39 | ####
40 | # Xcode temporary files that should never be committed
41 | # # NB: NIB/XIB files still exist even on Storyboard projects, so we want this...
42 | *~.nib
43 |
44 | ####
45 | # Xcode build files -
46 | #
47 | # NB: slash on the end, so we only remove the FOLDER, not any files that were badly named "DerivedData"
48 | DerivedData/
49 |
50 | # NB: slash on the end, so we only remove the FOLDER, not any files that were badly named "build"
51 | build/
52 |
53 |
54 | #####
55 | # Xcode private settings (window sizes, bookmarks, breakpoints, custom executables, smart groups)
56 | #
57 | # This is complicated:
58 | #
59 | # SOMETIMES you need to put this file in version control.
60 | # Apple designed it poorly - if you use "custom executables", they are
61 | # saved in this file.
62 | # 99% of projects do NOT use those, so they do NOT want to version control this file.
63 | # ..but if you're in the 1%, comment out the line "*.pbxuser"
64 |
65 | # .pbxuser. See http://lists.apple.com/archives/xcode-users/2004/Jan/msg00193.html
66 | *.pbxuser
67 |
68 | # .mode1v3. See http://lists.apple.com/archives/xcode-users/2007/Oct/msg00465.html
69 | *.mode1v3
70 |
71 | # .mode2v3. See http://lists.apple.com/archives/xcode-users/2007/Oct/msg00465.html
72 | *.mode2v3
73 |
74 | # .perspectivev3. See http://stackoverflow.com/questions/5223297/xcode-projects-what-is-a-perspectivev3-file
75 | *.perspectivev3
76 |
77 | # NB: also, whitelist the default ones, some projects need to use these
78 | !default.pbxuser
79 | !default.mode1v3
80 | !default.mode2v3
81 | !default.perspectivev3
82 |
83 |
84 | ####
85 | # Xcode 4 - semi-personal settings
86 | #
87 | #
88 | # OPTION 1: ---------------------------------
89 | # throw away ALL personal settings (including custom schemes!
90 | # - unless they are "shared")
91 | #
92 | # NB: this is exclusive with OPTION 2 below
93 | xcuserdata
94 | xcshareddata
95 |
96 | *.xcbkptlist
97 |
98 | # OPTION 2: ---------------------------------
99 | # get rid of ALL personal settings, but KEEP SOME OF THEM
100 | # - NB: you must manually uncomment the bits you want to keep
101 | #
102 | # NB: this is exclusive with OPTION 1 above
103 | #
104 | #xcuserdata/**/*
105 |
106 | # (requires option 2 above): Personal Schemes
107 | #
108 | #!xcuserdata/**/xcschemes/*
109 |
110 | ####
111 | # XCode 4 workspaces - more detailed
112 | #
113 | # Workspaces are important! They are a core feature of Xcode - don't exclude them :)
114 | #
115 | # Workspace layout is quite spammy. For reference:
116 | #
117 | # /(root)/
118 | # /(project-name).xcodeproj/
119 | # project.pbxproj
120 | # /project.xcworkspace/
121 | # contents.xcworkspacedata
122 | # /xcuserdata/
123 | # /(your name)/xcuserdatad/
124 | # UserInterfaceState.xcuserstate
125 | # /xcsshareddata/
126 | # /xcschemes/
127 | # (shared scheme name).xcscheme
128 | # /xcuserdata/
129 | # /(your name)/xcuserdatad/
130 | # (private scheme).xcscheme
131 | # xcschememanagement.plist
132 | #
133 | #
134 |
135 | ####
136 | # Xcode 4 - Deprecated classes
137 | # Allegedly, if you manually "deprecate" your classes, they get moved here.
138 | # We're using source-control, so this is a "feature" that we do not want!
139 | *.moved-aside
140 |
141 | # BBEdit "project" records. I think these are created by BBEdit when you File > New > Project and may be modified when you File > Open Recent > Projects.
142 | *.bbprojectd
143 | */*.bbprojectd
144 |
145 | # Xcode Breakpoint List
146 | *.xcbkptlist
147 |
148 | # Miscellaneous Non-Primary-Source files in this project
149 | UpdateNews.html
150 | Update-News-for-MacUpdate.html
151 | Update-News-for-MacUpdate.txt
152 | BookMacsterTests/Data
153 | BookMacsterTests/Data/Bkmslfs
154 | ExtensionsBrowser/Chrome/BookMacsterButton.crx
155 | ExtensionsBrowser/Chrome/BookMacsterSync.crx
156 | ExtensionsBrowser/Chrome/BookMacsterButton.zip
157 | ExtensionsBrowser/Chrome/BookMacsterSync.zip
158 | Resources/Localized/en.lproj/HelpBook/*
159 | HelpBookSources/_Identifier_Lookup.data
160 | HelpBookSources/_Table_of_Contents.html
161 |
162 |
--------------------------------------------------------------------------------
/RPTokenControlKit/RPTokenControl/Classes/RPTokenControl/Methods/Methods.html:
--------------------------------------------------------------------------------
1 |
3 |
4 | Methods
5 |
6 | Methods
7 |
8 |
9 | Abstract: getter for ivar delegate
10 |
11 | - (id)delegate;
12 |
13 |
14 |
15 |
16 |
17 | Abstract: getter for ivar disallowedCharacterSet
18 |
19 | - (NSCharacterSet *)disallowedCharacterSet;
20 |
21 |
22 |
23 |
24 |
25 | Abstract: getter for ivar linkDragType
26 |
27 | - (NSString *)linkDragType;
28 |
29 |
30 |
31 |
32 |
33 | Abstract: getter for ivar placeholderString
34 |
35 | - (NSString *)placeholderString;
36 |
37 |
38 |
39 |
40 |
41 | Abstract: getter for ivar selectedIndexSet
42 |
43 | - (NSIndexSet*)selectedIndexSet;
44 |
45 |
46 | Result: an immutable copy of selectedIndexSet
47 |
48 |
49 |
50 |
51 | Abstract: An NSArray of the tokens selected in the control view
52 |
53 | - (NSArray*)selectedTokens;
54 |
55 |
56 |
57 | Result: An array of NSStrings. Each string is the text of a selected token. Counts are not provided.
58 |
59 |
60 |
61 |
62 | Abstract: setter for ivar appendCountsToStrings
63 |
64 | - (void)setAppendCountsToStrings:(BOOL)yn;
65 |
66 | Invoking this method will recalculate the receiver's layout
67 | and mark the receiver with -setNeedsDisplay.
68 |
69 |
70 |
71 |
72 | Abstract: setter for ivar backgroundWhiteness
73 |
74 | - (void)setBackgroundWhiteness:(float)whiteness;
75 |
76 | Invoking this method will recalculate the receiver's layout
77 | and mark the receiver with -setNeedsDisplay.
78 |
79 |
80 |
81 |
82 | Abstract: setter for ivar delegate
83 |
84 | - (void)setDelegate:(id)delegate;
85 |
86 |
87 |
88 |
89 |
90 | Abstract: setter for ivar disallowedCharacterSet
91 |
92 | - (void)setDisallowedCharacterSet:(NSCharacterSet *)newDisallowedCharacterSet;
93 |
94 |
95 |
96 |
97 |
98 | Abstract: setter for the ivar dragImage
99 |
100 | - (void)setDragImage:(NSImage*)image;
101 |
102 |
103 |
104 |
105 |
106 | Abstract: setter for ivar isEditable
107 |
108 | - (void)setEditable:(BOOL)yn;
109 |
110 |
111 |
112 |
113 |
114 | Abstract: setter for ivar fixedFontSize
115 |
116 | - (void)setFixedFontSize:(float)x;
117 |
118 | Invoking this method will recalculate the receiver's layout
119 | and mark the receiver with -setNeedsDisplay.
120 |
121 |
122 |
123 |
124 | Abstract: setter for ivar linkDragType
125 |
126 | - (void)setLinkDragType:(NSString*)linkDragType;
127 |
128 |
129 |
130 |
131 |
132 | Abstract: setter for the ivar maxFontSIze
133 |
134 | - (void)setMaxFontSize:(float)x;
135 |
136 | Invoking this method will recalculate the receiver's layout
137 | and mark the receiver with -setNeedsDisplay.
138 |
139 |
140 |
141 |
142 | Abstract: setter for ivar maxTokensToDisplay
143 |
144 | - (void)setMaxTokensToDisplay:(int)maxTokensToDisplay;
145 |
146 | Invoking this method will recalculate the receiver's layout
147 | and mark the receiver with -setNeedsDisplay.
148 | If not set, all tokens that fit will be displayed
149 |
150 |
151 |
152 |
153 | Abstract: setter for the ivar minFontSize
154 |
155 | - (void)setMinFontSize:(float)x;
156 |
157 | Invoking this method will recalculate the receiver's layout
158 | and mark the receiver with -setNeedsDisplay.
159 |
160 |
161 |
162 |
163 | Abstract: setter for ivar placeholderString
164 |
165 | - (void)setPlaceholderString:(NSString *)newPlaceholderString;
166 |
167 |
168 |
169 |
170 |
171 | Abstract: setter for ivar selectedIndexSet
172 |
173 | - (void)setSelectedIndexSet:(NSIndexSet*)newSelectedIndexSet;
174 |
175 | Makes a mutable copy of the argument.
176 | Make sure that the range of the argument is within the range of tokens
177 |
178 |
179 |
180 |
181 | Abstract: setter for the ivar showsCountsAsToolTips.
182 |
183 | - (void)setShowsCountsAsToolTips:(BOOL)yn;
184 |
185 | It would look silly to set this to YES if setAppendCountsToStrings is also YES.
186 | If not set, will default to NO.
187 |
188 |
189 |
190 |
191 | Abstract: setter for the ivar showsReflections
192 |
193 | - (void)setShowsReflections:(BOOL)yn;
194 |
195 | Invoking this method will recalculate the receiver's layout
196 | and mark the receiver with -setNeedsDisplay.
197 |
198 |
199 |
200 |
201 | Abstract: setter for ivar tokens
202 |
203 | - (void)setTokens:(id)tokens;
204 |
205 |
206 |
207 |
208 |
209 | Abstract: getter for ivar tokens
210 |
211 | - (id)tokens;
212 |
213 |
214 |
215 |
216 | (Last Updated 2/8/2008)
217 |
218 |
--------------------------------------------------------------------------------
/RPTokenControlKit/Documentation/RPTokenControl/Classes/RPTokenControl/Methods/Methods.html:
--------------------------------------------------------------------------------
1 |
3 |
4 | Methods
5 |
6 | Methods
7 |
8 |
9 | Abstract: getter for ivar delegate
10 |
11 | - (id)delegate;
12 |
13 |
14 |
15 |
16 |
17 | Abstract: getter for ivar disallowedCharacterSet
18 |
19 | - (NSCharacterSet *)disallowedCharacterSet;
20 |
21 |
22 |
23 |
24 |
25 | Abstract: getter for ivar linkDragType
26 |
27 | - (NSString *)linkDragType;
28 |
29 |
30 |
31 |
32 |
33 | Abstract: getter for ivar placeholderString
34 |
35 | - (NSString *)placeholderString;
36 |
37 |
38 |
39 |
40 |
41 | Abstract: getter for ivar selectedIndexSet
42 |
43 | - (NSIndexSet*)selectedIndexSet;
44 |
45 |
46 | Result: an immutable copy of selectedIndexSet
47 |
48 |
49 |
50 |
51 | Abstract: An NSArray of the tokens selected in the control view
52 |
53 | - (NSArray*)selectedTokens;
54 |
55 |
56 |
57 | Result: An array of NSStrings. Each string is the text of a selected token. Counts are not provided.
58 |
59 |
60 |
61 |
62 | Abstract: setter for ivar appendCountsToStrings
63 |
64 | - (void)setAppendCountsToStrings:(BOOL)yn;
65 |
66 | Invoking this method will recalculate the receiver's layout
67 | and mark the receiver with -setNeedsDisplay.
68 |
69 |
70 |
71 |
72 | Abstract: setter for ivar backgroundWhiteness
73 |
74 | - (void)setBackgroundWhiteness:(float)whiteness;
75 |
76 | Invoking this method will recalculate the receiver's layout
77 | and mark the receiver with -setNeedsDisplay.
78 |
79 |
80 |
81 |
82 | Abstract: setter for ivar delegate
83 |
84 | - (void)setDelegate:(id)delegate;
85 |
86 |
87 |
88 |
89 |
90 | Abstract: setter for ivar disallowedCharacterSet
91 |
92 | - (void)setDisallowedCharacterSet:(NSCharacterSet *)newDisallowedCharacterSet;
93 |
94 |
95 |
96 |
97 |
98 | Abstract: setter for the ivar dragImage
99 |
100 | - (void)setDragImage:(NSImage*)image;
101 |
102 |
103 |
104 |
105 |
106 | Abstract: setter for ivar isEditable
107 |
108 | - (void)setEditable:(BOOL)yn;
109 |
110 |
111 |
112 |
113 |
114 | Abstract: setter for ivar fixedFontSize
115 |
116 | - (void)setFixedFontSize:(float)x;
117 |
118 | Invoking this method will recalculate the receiver's layout
119 | and mark the receiver with -setNeedsDisplay.
120 |
121 |
122 |
123 |
124 | Abstract: setter for ivar linkDragType
125 |
126 | - (void)setLinkDragType:(NSString*)linkDragType;
127 |
128 |
129 |
130 |
131 |
132 | Abstract: setter for the ivar maxFontSIze
133 |
134 | - (void)setMaxFontSize:(float)x;
135 |
136 | Invoking this method will recalculate the receiver's layout
137 | and mark the receiver with -setNeedsDisplay.
138 |
139 |
140 |
141 |
142 | Abstract: setter for ivar maxTokensToDisplay
143 |
144 | - (void)setMaxTokensToDisplay:(int)maxTokensToDisplay;
145 |
146 | Invoking this method will recalculate the receiver's layout
147 | and mark the receiver with -setNeedsDisplay.
148 | If not set, all tokens that fit will be displayed
149 |
150 |
151 |
152 |
153 | Abstract: setter for the ivar minFontSize
154 |
155 | - (void)setMinFontSize:(float)x;
156 |
157 | Invoking this method will recalculate the receiver's layout
158 | and mark the receiver with -setNeedsDisplay.
159 |
160 |
161 |
162 |
163 | Abstract: setter for ivar placeholderString
164 |
165 | - (void)setPlaceholderString:(NSString *)newPlaceholderString;
166 |
167 |
168 |
169 |
170 |
171 | Abstract: setter for ivar selectedIndexSet
172 |
173 | - (void)setSelectedIndexSet:(NSIndexSet*)newSelectedIndexSet;
174 |
175 | Makes a mutable copy of the argument.
176 | Make sure that the range of the argument is within the range of tokens
177 |
178 |
179 |
180 |
181 | Abstract: setter for the ivar showsCountsAsToolTips.
182 |
183 | - (void)setShowsCountsAsToolTips:(BOOL)yn;
184 |
185 | It would look silly to set this to YES if setAppendCountsToStrings is also YES.
186 | If not set, will default to NO.
187 |
188 |
189 |
190 |
191 | Abstract: setter for the ivar showsReflections
192 |
193 | - (void)setShowsReflections:(BOOL)yn;
194 |
195 | Invoking this method will recalculate the receiver's layout
196 | and mark the receiver with -setNeedsDisplay.
197 |
198 |
199 |
200 |
201 | Abstract: setter for ivar tokens
202 |
203 | - (void)setTokens:(id)tokens;
204 |
205 |
206 |
207 |
208 |
209 | Abstract: getter for ivar tokens
210 |
211 | - (id)tokens;
212 |
213 |
214 |
215 |
216 | (Last Updated 2/8/2008)
217 |
218 |
--------------------------------------------------------------------------------
/RPTokenControlDemo.xcodeproj/jk.pbxuser:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | 29B97313FDCFA39411CA2CEA /* Project object */ = {
4 | activeBuildConfigurationName = Debug;
5 | activeExecutable = 4846E3000D214A2B00767A0A /* RPTokenControlDemo */;
6 | activeTarget = 8D1107260486CEB800E47090 /* RPTokenControlDemo */;
7 | addToTargets = (
8 | 8D1107260486CEB800E47090 /* RPTokenControlDemo */,
9 | );
10 | codeSenseManager = 4846E3040D214A4A00767A0A /* Code sense */;
11 | executables = (
12 | 4846E3000D214A2B00767A0A /* RPTokenControlDemo */,
13 | );
14 | perUserDictionary = {
15 | PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = {
16 | PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
17 | PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID;
18 | PBXFileTableDataSourceColumnWidthsKey = (
19 | 20,
20 | 482,
21 | 20,
22 | 48,
23 | 43,
24 | 43,
25 | 20,
26 | );
27 | PBXFileTableDataSourceColumnsKey = (
28 | PBXFileDataSource_FiletypeID,
29 | PBXFileDataSource_Filename_ColumnID,
30 | PBXFileDataSource_Built_ColumnID,
31 | PBXFileDataSource_ObjectSize_ColumnID,
32 | PBXFileDataSource_Errors_ColumnID,
33 | PBXFileDataSource_Warnings_ColumnID,
34 | PBXFileDataSource_Target_ColumnID,
35 | );
36 | };
37 | PBXPerProjectTemplateStateSaveDate = 362709605;
38 | PBXWorkspaceStateSaveDate = 362709605;
39 | };
40 | perUserProjectItems = {
41 | 480AC05913649CEB0011EF83 /* PBXTextBookmark */ = 480AC05913649CEB0011EF83 /* PBXTextBookmark */;
42 | 480AC05A13649CEB0011EF83 /* PBXTextBookmark */ = 480AC05A13649CEB0011EF83 /* PBXTextBookmark */;
43 | 480AC05B13649CEB0011EF83 /* PBXTextBookmark */ = 480AC05B13649CEB0011EF83 /* PBXTextBookmark */;
44 | 480AC05C13649CEB0011EF83 /* PBXTextBookmark */ = 480AC05C13649CEB0011EF83 /* PBXTextBookmark */;
45 | 480AC05D13649CEB0011EF83 /* PBXTextBookmark */ = 480AC05D13649CEB0011EF83 /* PBXTextBookmark */;
46 | 480AC05E13649CEB0011EF83 /* PBXTextBookmark */ = 480AC05E13649CEB0011EF83 /* PBXTextBookmark */;
47 | 4898EFA0159E82FB00141F40 /* PBXTextBookmark */ = 4898EFA0159E82FB00141F40 /* PBXTextBookmark */;
48 | 4898EFA1159E82FB00141F40 /* PBXTextBookmark */ = 4898EFA1159E82FB00141F40 /* PBXTextBookmark */;
49 | 4898F116159FB48A00141F40 /* PBXTextBookmark */ = 4898F116159FB48A00141F40 /* PBXTextBookmark */;
50 | 4898F117159FB48A00141F40 /* XCBuildMessageTextBookmark */ = 4898F117159FB48A00141F40 /* XCBuildMessageTextBookmark */;
51 | 4898F12E159FB62F00141F40 /* PBXTextBookmark */ = 4898F12E159FB62F00141F40 /* PBXTextBookmark */;
52 | };
53 | sourceControlManager = 4846E3030D214A4A00767A0A /* Source Control */;
54 | userBuildSettings = {
55 | };
56 | };
57 | 29B97316FDCFA39411CA2CEA /* main.m */ = {
58 | uiCtxt = {
59 | sepNavIntBoundsRect = "{{0, 0}, {660, 407}}";
60 | sepNavSelRange = "{0, 0}";
61 | sepNavVisRange = "{0, 258}";
62 | };
63 | };
64 | 32CA4F630368D1EE00C91783 /* RPTokenControlDemo_Prefix.pch */ = {
65 | uiCtxt = {
66 | sepNavIntBoundsRect = "{{0, 0}, {660, 407}}";
67 | sepNavSelRange = "{0, 0}";
68 | sepNavVisRange = "{0, 167}";
69 | };
70 | };
71 | 4801A1650D214EEC00EC697C /* RPBlackReflectionUtils.h */ = {
72 | uiCtxt = {
73 | sepNavIntBoundsRect = "{{0, 0}, {563, 749}}";
74 | sepNavSelRange = "{0, 0}";
75 | sepNavVisRange = "{0, 400}";
76 | };
77 | };
78 | 4801A1660D214EEC00EC697C /* RPBlackReflectionUtils.m */ = {
79 | uiCtxt = {
80 | sepNavIntBoundsRect = "{{0, 0}, {968, 749}}";
81 | sepNavSelRange = "{0, 0}";
82 | sepNavVisRange = "{0, 2153}";
83 | };
84 | };
85 | 4801A1670D214EEC00EC697C /* RPCountedToken.h */ = {
86 | uiCtxt = {
87 | sepNavIntBoundsRect = "{{0, 0}, {660, 1484}}";
88 | sepNavSelRange = "{1064, 54}";
89 | sepNavVisRange = "{679, 861}";
90 | };
91 | };
92 | 4801A1680D214EEC00EC697C /* RPCountedToken.m */ = {
93 | uiCtxt = {
94 | sepNavIntBoundsRect = "{{0, 0}, {867, 1148}}";
95 | sepNavSelRange = "{194, 0}";
96 | sepNavVisRange = "{0, 325}";
97 | };
98 | };
99 | 4801A1690D214EEC00EC697C /* RPTokenControl.h */ = {
100 | uiCtxt = {
101 | sepNavIntBoundsRect = "{{0, 0}, {882, 5166}}";
102 | sepNavSelRange = "{14758, 0}";
103 | sepNavVisRange = "{14286, 784}";
104 | };
105 | };
106 | 4801A16A0D214EEC00EC697C /* RPTokenControl.m */ = {
107 | uiCtxt = {
108 | sepNavIntBoundsRect = "{{0, 0}, {756, 30618}}";
109 | sepNavSelRange = "{66154, 0}";
110 | sepNavVisRange = "{16778, 1843}";
111 | sepNavWindowFrame = "{{38, 78}, {691, 898}}";
112 | };
113 | };
114 | 4801A16F0D214F4B00EC697C /* AppController.h */ = {
115 | uiCtxt = {
116 | sepNavIntBoundsRect = "{{0, 0}, {660, 407}}";
117 | sepNavSelRange = "{274, 0}";
118 | sepNavVisRange = "{0, 362}";
119 | };
120 | };
121 | 4801A1700D214F4B00EC697C /* AppController.m */ = {
122 | uiCtxt = {
123 | sepNavIntBoundsRect = "{{0, 0}, {867, 1036}}";
124 | sepNavSelRange = "{2126, 0}";
125 | sepNavVisRange = "{1816, 372}";
126 | };
127 | };
128 | 480AC05913649CEB0011EF83 /* PBXTextBookmark */ = {
129 | isa = PBXTextBookmark;
130 | fRef = 32CA4F630368D1EE00C91783 /* RPTokenControlDemo_Prefix.pch */;
131 | name = "RPTokenControlDemo_Prefix.pch: 1";
132 | rLen = 0;
133 | rLoc = 0;
134 | rType = 0;
135 | vrLen = 167;
136 | vrLoc = 0;
137 | };
138 | 480AC05A13649CEB0011EF83 /* PBXTextBookmark */ = {
139 | isa = PBXTextBookmark;
140 | fRef = 29B97316FDCFA39411CA2CEA /* main.m */;
141 | name = "main.m: 1";
142 | rLen = 0;
143 | rLoc = 0;
144 | rType = 0;
145 | vrLen = 258;
146 | vrLoc = 0;
147 | };
148 | 480AC05B13649CEB0011EF83 /* PBXTextBookmark */ = {
149 | isa = PBXTextBookmark;
150 | fRef = 4801A1670D214EEC00EC697C /* RPCountedToken.h */;
151 | name = "RPCountedToken.h: 29";
152 | rLen = 54;
153 | rLoc = 1064;
154 | rType = 0;
155 | vrLen = 861;
156 | vrLoc = 679;
157 | };
158 | 480AC05C13649CEB0011EF83 /* PBXTextBookmark */ = {
159 | isa = PBXTextBookmark;
160 | fRef = 4801A1680D214EEC00EC697C /* RPCountedToken.m */;
161 | name = "RPCountedToken.m: 40";
162 | rLen = 13;
163 | rLoc = 623;
164 | rType = 0;
165 | vrLen = 706;
166 | vrLoc = 343;
167 | };
168 | 480AC05D13649CEB0011EF83 /* PBXTextBookmark */ = {
169 | isa = PBXTextBookmark;
170 | fRef = 4801A16F0D214F4B00EC697C /* AppController.h */;
171 | name = "AppController.h: 13";
172 | rLen = 0;
173 | rLoc = 274;
174 | rType = 0;
175 | vrLen = 362;
176 | vrLoc = 0;
177 | };
178 | 480AC05E13649CEB0011EF83 /* PBXTextBookmark */ = {
179 | isa = PBXTextBookmark;
180 | fRef = 4801A1690D214EEC00EC697C /* RPTokenControl.h */;
181 | name = "RPTokenControl.h: 355";
182 | rLen = 0;
183 | rLoc = 15445;
184 | rType = 0;
185 | vrLen = 784;
186 | vrLoc = 14286;
187 | };
188 | 4846E3000D214A2B00767A0A /* RPTokenControlDemo */ = {
189 | isa = PBXExecutable;
190 | activeArgIndices = (
191 | );
192 | argumentStrings = (
193 | );
194 | autoAttachOnCrash = 1;
195 | breakpointsEnabled = 0;
196 | configStateDict = {
197 | };
198 | customDataFormattersEnabled = 1;
199 | dataTipCustomDataFormattersEnabled = 1;
200 | dataTipShowTypeColumn = 1;
201 | dataTipSortType = 0;
202 | debuggerPlugin = GDBDebugging;
203 | disassemblyDisplayState = 0;
204 | dylibVariantSuffix = "";
205 | enableDebugStr = 1;
206 | environmentEntries = (
207 | );
208 | executableSystemSymbolLevel = 0;
209 | executableUserSymbolLevel = 0;
210 | libgmallocEnabled = 0;
211 | name = RPTokenControlDemo;
212 | savedGlobals = {
213 | };
214 | showTypeColumn = 0;
215 | sourceDirectories = (
216 | );
217 | variableFormatDictionary = {
218 | };
219 | };
220 | 4846E3030D214A4A00767A0A /* Source Control */ = {
221 | isa = PBXSourceControlManager;
222 | fallbackIsa = XCSourceControlManager;
223 | isSCMEnabled = 0;
224 | scmConfiguration = {
225 | repositoryNamesForRoots = {
226 | "" = "";
227 | };
228 | };
229 | };
230 | 4846E3040D214A4A00767A0A /* Code sense */ = {
231 | isa = PBXCodeSenseManager;
232 | indexTemplatePath = "";
233 | };
234 | 4898EF96159E829D00141F40 /* NSObject+SSYBindingsHelp.h */ = {
235 | uiCtxt = {
236 | sepNavIntBoundsRect = "{{0, 0}, {660, 425}}";
237 | sepNavSelRange = "{0, 0}";
238 | sepNavVisRange = "{0, 904}";
239 | };
240 | };
241 | 4898EF97159E829D00141F40 /* NSObject+SSYBindingsHelp.m */ = {
242 | uiCtxt = {
243 | sepNavIntBoundsRect = "{{0, 0}, {660, 561}}";
244 | sepNavSelRange = "{0, 0}";
245 | sepNavVisRange = "{0, 408}";
246 | };
247 | };
248 | 4898EFA0159E82FB00141F40 /* PBXTextBookmark */ = {
249 | isa = PBXTextBookmark;
250 | fRef = 4801A1700D214F4B00EC697C /* AppController.m */;
251 | name = "AppController.m: 72";
252 | rLen = 0;
253 | rLoc = 2126;
254 | rType = 0;
255 | vrLen = 955;
256 | vrLoc = 1234;
257 | };
258 | 4898EFA1159E82FB00141F40 /* PBXTextBookmark */ = {
259 | isa = PBXTextBookmark;
260 | fRef = 4898EF96159E829D00141F40 /* NSObject+SSYBindingsHelp.h */;
261 | name = "NSObject+SSYBindingsHelp.h: 1";
262 | rLen = 0;
263 | rLoc = 0;
264 | rType = 0;
265 | vrLen = 904;
266 | vrLoc = 0;
267 | };
268 | 4898F116159FB48A00141F40 /* PBXTextBookmark */ = {
269 | isa = PBXTextBookmark;
270 | fRef = 4898EF97159E829D00141F40 /* NSObject+SSYBindingsHelp.m */;
271 | name = "NSObject+SSYBindingsHelp.m: 1";
272 | rLen = 0;
273 | rLoc = 0;
274 | rType = 0;
275 | vrLen = 408;
276 | vrLoc = 0;
277 | };
278 | 4898F117159FB48A00141F40 /* XCBuildMessageTextBookmark */ = {
279 | isa = PBXTextBookmark;
280 | comments = "'e' undeclared (first use in this function)";
281 | fRef = 4801A16A0D214EEC00EC697C /* RPTokenControl.m */;
282 | fallbackIsa = XCBuildMessageTextBookmark;
283 | rLen = 1;
284 | rLoc = 638;
285 | rType = 1;
286 | };
287 | 4898F12E159FB62F00141F40 /* PBXTextBookmark */ = {
288 | isa = PBXTextBookmark;
289 | fRef = 4801A16A0D214EEC00EC697C /* RPTokenControl.m */;
290 | name = "RPTokenControl.m: 2191";
291 | rLen = 0;
292 | rLoc = 66154;
293 | rType = 0;
294 | vrLen = 1843;
295 | vrLoc = 16778;
296 | };
297 | 8D1107260486CEB800E47090 /* RPTokenControlDemo */ = {
298 | activeExec = 0;
299 | executables = (
300 | 4846E3000D214A2B00767A0A /* RPTokenControlDemo */,
301 | );
302 | };
303 | }
304 |
--------------------------------------------------------------------------------
/RPTokenControlKit/RPTokenControl/Classes/RPTokenControl/RPTokenControl.html:
--------------------------------------------------------------------------------
1 |
3 |
4 | API Documentation
5 |
6 |
7 |
8 | RPTokenControl
9 | Abstract: RPTokenControl is a replacement for NSTokenField.
10 | It is geared toward looking presenting a nice-looking "Tag Cloud" for bookmarks.
11 | In that context, think "token" = "tag".
12 |
13 | INHERITANCE
14 | RPTokenControl is a subclass of NSControl : NSView : NSObject
15 | SYSTEM REQUIREMENTS
16 | RPTokenControl requires Mac OS 10.3 or later, but will only accept drags when running under Mac OS 10.4 or later.
17 | KVC-COMPLIANT PROPERTIES
18 | The following properties may be set and observed using key-value coding,
19 | except those noted as read-only may be only observed.
20 | Accessor methods may also be available.
21 |
22 | -
23 |
id tokens
24 | The tokens displayed in the control.
25 | May be an NSArray, NSSet or NSCountedSet of tokens.
26 | The array elements (tokens) may be NSString or RPCountedToken objects.
27 |
28 | A token is composed of (1) text (a string) and, optionally, (2) a count.
29 | If is an NSCountedSet, counts are evaluated with -countForObject:.
30 | In other collections, NSString objects have an implied count of 1.
31 |
32 | Note: NSCountedSet has some limitations. For example, you cannot setCount:
33 | for an object. The only way to set a members count to N is to add it N times. Arghhhh.
34 | Thus, for many applications, a simple collection of RPCountedToken objects may be better
35 | than an NSCountedSet.
36 |
37 | If tokens is nil, the view will display the string set the value of ivar placeholderString.
38 |
39 |
40 | -
41 |
NSMutableIndexSet* selectedIndexSet
42 | Index set giving the indexes of tokens that are selected (highlighted) in the RPTokenControl.
43 | "Safe" accessors which make immutable copies are available.
44 |
45 | -
46 |
NSArray* selectedTokens
47 | An array of NSString objects, the text values of all tokens which are selected (highlighted) in the RPTokenControl.
48 | This array is derived from selectedIndexSet.
49 | This property is KVC-compliant for reading only.
50 | You can observe it to find when the selection has changed.
51 | But there is no actual instance variable and there is no setter.
52 |
53 | -
54 |
NSCharacterSet* disallowedCharacterSet
55 | If, while typing in a new token, the user enters a character from the disallowedCharacterSet, it will be replaced
56 | with an underscore ("_"), and the System Alert will sound. The user may continue typing after this happens.
57 |
58 | Note that this behaves differently than the tokenizingCharacterSet ivar of NSTokenField,
59 | which causes editing to end in the token being edited. To end editing a token in
60 | RPTokenControl, the user (naturally) types 'return'.
61 |
62 | -
63 |
NSString* placeholderString
64 | String which will be displayed if tokens is nil or empty.
65 |
66 | -
67 |
int maxTokensToDisplay
68 | Defines the maximum number of tokens that will be displayed.
69 | Default value is infinite = NSNotFound.
70 |
71 | -
72 |
BOOL showsReflections
73 | Defines whether or not the view shows a pretty, Leopard-dock-like
74 | reflection of each token.
75 | Default value is NO.
76 |
77 | -
78 |
float backgroundWhiteness
79 | Defines the background color drawn in between the tokens.
80 | Uses grayscale from 0.0=black to 1.0=white.
81 | Default value is 1.0 (white)
82 |
83 | -
84 |
BOOL appendCountsToStrings
85 | Sets whether or not tokens will be drawn with their count appended in square brackets.
86 | For example, if YES, a token "MyToken" with count 5 will appear as "MyToken [5]".
87 | It would look silly to set this to YES if setShowsCountsAsToolTips is also YES.
88 | Default value is NO.
89 | -
90 |
float fixedFontSize
91 | Defines a "fixed" font size to be used from drawing all tokens.
92 | If this value is not 0.0, all tokens will be drawn with font size equal to this value.
93 | If this value is 0.0, variable font sizes, from minFontSize to maxFontSize will be used.
94 | Default value is 0.0 (use variable font sizes0.
95 |
96 | -
97 |
float minFontSize
98 | Defines the smallest font size, used to draw the smallest-count tokens.
99 | However, this value is ignored if fixedFontSize == 0.0.
100 |
101 | -
102 |
float maxFontSize
103 | Defines the largest font size, used to draw the largest-count tokens.
104 | However, this value is ignored if fixedFontSize == 0.0.
105 |
106 | -
107 |
BOOL showsCountsAsToolTips
108 | Defines whether or not tokens will have tooltips that indicate their counts.
109 | It would look silly to set this to YES if setAppendCountsToStrings is also YES.
110 | Default value is NO.
111 | -
112 |
BOOL isEditable
113 | If YES,
114 |
115 | - The 'delete' key will delete selected tokens when the RPTokenControl is firstResponder
116 | - New tokens can be typed in when the RPTokenControl is firstResponder.
117 |
- New tokens can be dragged in as described in Drag Destination.
118 |
119 | If NO, none of the above will work.
120 |
121 | -
122 |
NSString* linkDragType
123 | The linkDragType is useful if you would like special behavior when objects of this
124 | externally-defined drag type are dragged onto the RPTokenControl.
125 | This behavior may "link" the dragged object to the destination token,
126 | affecting the source instead of the destination, kind of a "reverse" drag.
127 | For example, if you set linkDragType to be a 'bookmark' type,
128 | and the tokens in your RPTokenControl represented available bookmark "tags",
129 | you could (in external code), add the destination token to the
130 | dragged bookmark's "tags", thus "tagging" the dragged bookmark.
131 |
132 | -
133 |
NSImage* dragImage
134 | Defines the cursor image that will be shown when a token is dragged.
135 | If not set, Cocoa uses a default image.
136 | -
137 |
138 |
id delegate
139 | If a linkDragType has been set, during a drag which includes a linkDragType
140 | into the RPTokenControl, RPTokenControl will, after testing that the delegate responds,
141 | send the following messages to the delegate:
142 |
143 | - -draggingEntered:
144 | - -draggingUpdated:
145 | - -performDragOperation:
146 | - -draggingExited:
147 |
148 | For documentation of when these messages will be sent, their parameters and expected
149 | return values, see Cocoa's "NSDraggingDestination Protocol Reference" document.
150 |
151 |
152 | TARGET-ACTION
153 | RPTokenControl will send an action to its target when its selection changes.
154 | (Observing selectedTokens or selectedIndexSet is an alternative to this.)
155 | DRAGGING SOURCE
156 | RPTokenControl provides four pasteboard types to the dragging pasteboard.
157 |
158 | - NSStringPboardType: NSString of the last selected token
159 | - NSTabularTextPboardType: tab-separated string of selected tokens
160 | - RPTokenPboardType: same as NSString PboardType
161 | - RPTabularTokenPboardType: same as NSTabularTextPboardType
162 |
163 | Although the payload is the same as the first two types, the last two
164 | types are provided to distinguish drags from the RPTokenControl from
165 | drags of text from other sources. This is in case the app wants to
166 | do something different when it receives "token" strings.
167 |
168 | Dragging a token always initiates a NSDragOperationCopy operation.
169 | Dragged tokens are never removed from the RPTokenControl
170 |
171 | DRAGGING DESTINATION
172 | If system is Mac OS 10.3, or if ivar isEditable=NO, RPTokenControl is not a dragging destination.
173 | Attempted drags will return NSDragOperationNone.
174 |
175 | If system if Mac OS 10.4 or later, and if ivar isEditable=YES,
176 | tokens or strings dragged into RPTokenControl will be added to tokens.
177 | They will not be selected.
178 | Drag destination supports only strings, not counts.
179 | New tokens dropped in will have a count of 1.
180 |
181 | If the pasteboard contains an object of the set linkDragType, it will takes precedence.
182 | Behavior will be only as described above in delegate.
183 | No token will be added, and other drag types on sender's the pasteboard will be ignored.
184 | VERSION HISTORY
185 |
186 | - Version 1.0.2. 2008 Feb 06.
187 | - -setTokens now retains old value of _tokens until after triggering change notification
188 | to observer. This was sometimes causing crashes in Tiger but not Leopard.
189 | - The ellipsis token is now better behaved. When clicking the ellipsisToken, instead of
190 | being selected, the leftmost displayed token is scrolled off and, if there is room,
191 | the rightmost token which was truncated is scrolled in. Scrolling can be activated
192 | in either direction by using the arrow keys when the end tag is selected.
193 | - Fixed bug in -keyDown which caused NSArray exception to be logged if down-arrow
194 | key was typed when no tokens were selected.
195 | - Fixed bug in -drawRect which caused focus ring to scroll with the RPTokenControl
196 | when enclosed in a scroll view. Did this by replacing two dozen lines of very stupid
197 | code with three lines of smart code.
198 |
199 | - Version 1.0.1. 2008 Jan 02.
200 | - Added hysteresis so that drag does not begin until significant mouse movement.
201 |
202 | - Version 1.0.0. 2007 Dec 26
203 | - Initial release.
204 |
205 |
206 | AUTHOR
207 | RPTokenControl is an adaptation of Robert Pointon's Tag Cloud NSView.
208 | It was adapted by Jerry Krinock jerry at ieee.org in San Jose, California USA.
209 | (I'm not afraid of more spam, but a bug in HeaderDoc does not allow at-sign to be used even if it is backslash-escaped as documented.)
210 |
211 |
(Last Updated 2/8/2008)
212 |
HTML documentation generated by HeaderDoc
213 |
214 |
215 |
216 |
--------------------------------------------------------------------------------
/RPTokenControlKit/Documentation/RPTokenControl/Classes/RPTokenControl/RPTokenControl.html:
--------------------------------------------------------------------------------
1 |
3 |
4 | API Documentation
5 |
6 |
7 |
8 | RPTokenControl
9 | Abstract: RPTokenControl is a replacement for NSTokenField.
10 | It is geared toward looking presenting a nice-looking "Tag Cloud" for bookmarks.
11 | In that context, think "token" = "tag".
12 |
13 | INHERITANCE
14 | RPTokenControl is a subclass of NSControl : NSView : NSObject
15 | SYSTEM REQUIREMENTS
16 | RPTokenControl requires Mac OS 10.3 or later, but will only accept drags when running under Mac OS 10.4 or later.
17 | KVC-COMPLIANT PROPERTIES
18 | The following properties may be set and observed using key-value coding,
19 | except those noted as read-only may be only observed.
20 | Accessor methods may also be available.
21 |
22 | -
23 |
id tokens
24 | The tokens displayed in the control.
25 | May be an NSArray, NSSet or NSCountedSet of tokens.
26 | The array elements (tokens) may be NSString or RPCountedToken objects.
27 |
28 | A token is composed of (1) text (a string) and, optionally, (2) a count.
29 | If is an NSCountedSet, counts are evaluated with -countForObject:.
30 | In other collections, NSString objects have an implied count of 1.
31 |
32 | Note: NSCountedSet has some limitations. For example, you cannot setCount:
33 | for an object. The only way to set a members count to N is to add it N times. Arghhhh.
34 | Thus, for many applications, a simple collection of RPCountedToken objects may be better
35 | than an NSCountedSet.
36 |
37 | If tokens is nil, the view will display the string set the value of ivar placeholderString.
38 |
39 |
40 | -
41 |
NSMutableIndexSet* selectedIndexSet
42 | Index set giving the indexes of tokens that are selected (highlighted) in the RPTokenControl.
43 | "Safe" accessors which make immutable copies are available.
44 |
45 | -
46 |
NSArray* selectedTokens
47 | An array of NSString objects, the text values of all tokens which are selected (highlighted) in the RPTokenControl.
48 | This array is derived from selectedIndexSet.
49 | This property is KVC-compliant for reading only.
50 | You can observe it to find when the selection has changed.
51 | But there is no actual instance variable and there is no setter.
52 |
53 | -
54 |
NSCharacterSet* disallowedCharacterSet
55 | If, while typing in a new token, the user enters a character from the disallowedCharacterSet, it will be replaced
56 | with an underscore ("_"), and the System Alert will sound. The user may continue typing after this happens.
57 |
58 | Note that this behaves differently than the tokenizingCharacterSet ivar of NSTokenField,
59 | which causes editing to end in the token being edited. To end editing a token in
60 | RPTokenControl, the user (naturally) types 'return'.
61 |
62 | -
63 |
NSString* placeholderString
64 | String which will be displayed if tokens is nil or empty.
65 |
66 | -
67 |
int maxTokensToDisplay
68 | Defines the maximum number of tokens that will be displayed.
69 | Default value is infinite = NSNotFound.
70 |
71 | -
72 |
BOOL showsReflections
73 | Defines whether or not the view shows a pretty, Leopard-dock-like
74 | reflection of each token.
75 | Default value is NO.
76 |
77 | -
78 |
float backgroundWhiteness
79 | Defines the background color drawn in between the tokens.
80 | Uses grayscale from 0.0=black to 1.0=white.
81 | Default value is 1.0 (white)
82 |
83 | -
84 |
BOOL appendCountsToStrings
85 | Sets whether or not tokens will be drawn with their count appended in square brackets.
86 | For example, if YES, a token "MyToken" with count 5 will appear as "MyToken [5]".
87 | It would look silly to set this to YES if setShowsCountsAsToolTips is also YES.
88 | Default value is NO.
89 | -
90 |
float fixedFontSize
91 | Defines a "fixed" font size to be used from drawing all tokens.
92 | If this value is not 0.0, all tokens will be drawn with font size equal to this value.
93 | If this value is 0.0, variable font sizes, from minFontSize to maxFontSize will be used.
94 | Default value is 0.0 (use variable font sizes0.
95 |
96 | -
97 |
float minFontSize
98 | Defines the smallest font size, used to draw the smallest-count tokens.
99 | However, this value is ignored if fixedFontSize == 0.0.
100 |
101 | -
102 |
float maxFontSize
103 | Defines the largest font size, used to draw the largest-count tokens.
104 | However, this value is ignored if fixedFontSize == 0.0.
105 |
106 | -
107 |
BOOL showsCountsAsToolTips
108 | Defines whether or not tokens will have tooltips that indicate their counts.
109 | It would look silly to set this to YES if setAppendCountsToStrings is also YES.
110 | Default value is NO.
111 | -
112 |
BOOL isEditable
113 | If YES,
114 |
115 | - The 'delete' key will delete selected tokens when the RPTokenControl is firstResponder
116 | - New tokens can be typed in when the RPTokenControl is firstResponder.
117 |
- New tokens can be dragged in as described in Drag Destination.
118 |
119 | If NO, none of the above will work.
120 |
121 | -
122 |
NSString* linkDragType
123 | The linkDragType is useful if you would like special behavior when objects of this
124 | externally-defined drag type are dragged onto the RPTokenControl.
125 | This behavior may "link" the dragged object to the destination token,
126 | affecting the source instead of the destination, kind of a "reverse" drag.
127 | For example, if you set linkDragType to be a 'bookmark' type,
128 | and the tokens in your RPTokenControl represented available bookmark "tags",
129 | you could (in external code), add the destination token to the
130 | dragged bookmark's "tags", thus "tagging" the dragged bookmark.
131 |
132 | -
133 |
NSImage* dragImage
134 | Defines the cursor image that will be shown when a token is dragged.
135 | If not set, Cocoa uses a default image.
136 | -
137 |
138 |
id delegate
139 | If a linkDragType has been set, during a drag which includes a linkDragType
140 | into the RPTokenControl, RPTokenControl will, after testing that the delegate responds,
141 | send the following messages to the delegate:
142 |
143 | - -draggingEntered:
144 | - -draggingUpdated:
145 | - -performDragOperation:
146 | - -draggingExited:
147 |
148 | For documentation of when these messages will be sent, their parameters and expected
149 | return values, see Cocoa's "NSDraggingDestination Protocol Reference" document.
150 |
151 |
152 | TARGET-ACTION
153 | RPTokenControl will send an action to its target when its selection changes.
154 | (Observing selectedTokens or selectedIndexSet is an alternative to this.)
155 | DRAGGING SOURCE
156 | RPTokenControl provides four pasteboard types to the dragging pasteboard.
157 |
158 | - NSStringPboardType: NSString of the last selected token
159 | - NSTabularTextPboardType: tab-separated string of selected tokens
160 | - RPTokenPboardType: same as NSString PboardType
161 | - RPTabularTokenPboardType: same as NSTabularTextPboardType
162 |
163 | Although the payload is the same as the first two types, the last two
164 | types are provided to distinguish drags from the RPTokenControl from
165 | drags of text from other sources. This is in case the app wants to
166 | do something different when it receives "token" strings.
167 |
168 | Dragging a token always initiates a NSDragOperationCopy operation.
169 | Dragged tokens are never removed from the RPTokenControl
170 |
171 | DRAGGING DESTINATION
172 | If system is Mac OS 10.3, or if ivar isEditable=NO, RPTokenControl is not a dragging destination.
173 | Attempted drags will return NSDragOperationNone.
174 |
175 | If system if Mac OS 10.4 or later, and if ivar isEditable=YES,
176 | tokens or strings dragged into RPTokenControl will be added to tokens.
177 | They will not be selected.
178 | Drag destination supports only strings, not counts.
179 | New tokens dropped in will have a count of 1.
180 |
181 | If the pasteboard contains an object of the set linkDragType, it will takes precedence.
182 | Behavior will be only as described above in delegate.
183 | No token will be added, and other drag types on sender's the pasteboard will be ignored.
184 | VERSION HISTORY
185 |
186 | - Version 1.0.2. 2008 Feb 06.
187 | - -setTokens now retains old value of _tokens until after triggering change notification
188 | to observer. This was sometimes causing crashes in Tiger but not Leopard.
189 | - The ellipsis token is now better behaved. When clicking the ellipsisToken, instead of
190 | being selected, the leftmost displayed token is scrolled off and, if there is room,
191 | the rightmost token which was truncated is scrolled in. Scrolling can be activated
192 | in either direction by using the arrow keys when the end tag is selected.
193 | - Fixed bug in -keyDown which caused NSArray exception to be logged if down-arrow
194 | key was typed when no tokens were selected.
195 | - Fixed bug in -drawRect which caused focus ring to scroll with the RPTokenControl
196 | when enclosed in a scroll view. Did this by replacing two dozen lines of very stupid
197 | code with three lines of smart code.
198 |
199 | - Version 1.0.1. 2008 Jan 02.
200 | - Added hysteresis so that drag does not begin until significant mouse movement.
201 |
202 | - Version 1.0.0. 2007 Dec 26
203 | - Initial release.
204 |
205 |
206 | AUTHOR
207 | RPTokenControl is an adaptation of ` Pointon's Tag Cloud NSView.
208 | It was adapted by Jerry Krinock jerry at ieee.org in San Jose, California USA.
209 | (I'm not afraid of more spam, but a bug in HeaderDoc does not allow at-sign to be used even if it is backslash-escaped as documented.)
210 |
211 |
(Last Updated 2/8/2008)
212 |
HTML documentation generated by HeaderDoc
213 |
214 |
215 |
216 |
--------------------------------------------------------------------------------
/RPTokenControlDemo.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 44;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 4801A16C0D214EEC00EC697C /* RPBlackReflectionUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 4801A1660D214EEC00EC697C /* RPBlackReflectionUtils.m */; };
11 | 4801A16D0D214EEC00EC697C /* RPCountedToken.m in Sources */ = {isa = PBXBuildFile; fileRef = 4801A1680D214EEC00EC697C /* RPCountedToken.m */; };
12 | 4801A16E0D214EEC00EC697C /* RPTokenControl.m in Sources */ = {isa = PBXBuildFile; fileRef = 4801A16A0D214EEC00EC697C /* RPTokenControl.m */; };
13 | 4801A1710D214F4B00EC697C /* AppController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4801A1700D214F4B00EC697C /* AppController.m */; };
14 | 48D3BB170D2C038C0075C33D /* Documentation in Resources */ = {isa = PBXBuildFile; fileRef = 48D3BAF20D2C038C0075C33D /* Documentation */; };
15 | 48F3249F0DA2AF0F000A8FFC /* NSView+FocusRing.m in Sources */ = {isa = PBXBuildFile; fileRef = 48F3249E0DA2AF0F000A8FFC /* NSView+FocusRing.m */; };
16 | 48F38A721C9B0483004A9D5A /* NSObject+SSYBindingsHelp.m in Sources */ = {isa = PBXBuildFile; fileRef = 48F38A711C9B0483004A9D5A /* NSObject+SSYBindingsHelp.m */; };
17 | 8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */ = {isa = PBXBuildFile; fileRef = 29B97318FDCFA39411CA2CEA /* MainMenu.nib */; };
18 | 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; };
19 | 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; };
20 | 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
21 | /* End PBXBuildFile section */
22 |
23 | /* Begin PBXFileReference section */
24 | 089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; };
25 | 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; };
26 | 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = ""; };
27 | 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
28 | 29B97319FDCFA39411CA2CEA /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/MainMenu.nib; sourceTree = ""; };
29 | 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; };
30 | 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; };
31 | 32CA4F630368D1EE00C91783 /* RPTokenControlDemo_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RPTokenControlDemo_Prefix.pch; sourceTree = ""; };
32 | 4801A1650D214EEC00EC697C /* RPBlackReflectionUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RPBlackReflectionUtils.h; sourceTree = ""; };
33 | 4801A1660D214EEC00EC697C /* RPBlackReflectionUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RPBlackReflectionUtils.m; sourceTree = ""; };
34 | 4801A1670D214EEC00EC697C /* RPCountedToken.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RPCountedToken.h; sourceTree = ""; };
35 | 4801A1680D214EEC00EC697C /* RPCountedToken.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RPCountedToken.m; sourceTree = ""; };
36 | 4801A1690D214EEC00EC697C /* RPTokenControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RPTokenControl.h; sourceTree = ""; };
37 | 4801A16A0D214EEC00EC697C /* RPTokenControl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RPTokenControl.m; sourceTree = ""; };
38 | 4801A16F0D214F4B00EC697C /* AppController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppController.h; sourceTree = ""; };
39 | 4801A1700D214F4B00EC697C /* AppController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppController.m; sourceTree = ""; };
40 | 48D3BAF20D2C038C0075C33D /* Documentation */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Documentation; sourceTree = ""; };
41 | 48F3249D0DA2AF0F000A8FFC /* NSView+FocusRing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSView+FocusRing.h"; sourceTree = ""; };
42 | 48F3249E0DA2AF0F000A8FFC /* NSView+FocusRing.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSView+FocusRing.m"; sourceTree = ""; };
43 | 48F38A701C9B0483004A9D5A /* NSObject+SSYBindingsHelp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSObject+SSYBindingsHelp.h"; path = "RPTokenControlKit/NSObject+SSYBindingsHelp.h"; sourceTree = ""; };
44 | 48F38A711C9B0483004A9D5A /* NSObject+SSYBindingsHelp.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSObject+SSYBindingsHelp.m"; path = "RPTokenControlKit/NSObject+SSYBindingsHelp.m"; sourceTree = ""; };
45 | 48F38A731C9B057B004A9D5A /* SSY+Countability.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "SSY+Countability.h"; path = "RPTokenControlKit/SSY+Countability.h"; sourceTree = ""; };
46 | 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
47 | 8D1107320486CEB800E47090 /* RPTokenControlDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RPTokenControlDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
48 | /* End PBXFileReference section */
49 |
50 | /* Begin PBXFrameworksBuildPhase section */
51 | 8D11072E0486CEB800E47090 /* Frameworks */ = {
52 | isa = PBXFrameworksBuildPhase;
53 | buildActionMask = 2147483647;
54 | files = (
55 | 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
56 | );
57 | runOnlyForDeploymentPostprocessing = 0;
58 | };
59 | /* End PBXFrameworksBuildPhase section */
60 |
61 | /* Begin PBXGroup section */
62 | 080E96DDFE201D6D7F000001 /* Classes */ = {
63 | isa = PBXGroup;
64 | children = (
65 | 4801A16F0D214F4B00EC697C /* AppController.h */,
66 | 4801A1700D214F4B00EC697C /* AppController.m */,
67 | );
68 | name = Classes;
69 | sourceTree = "";
70 | };
71 | 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = {
72 | isa = PBXGroup;
73 | children = (
74 | 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,
75 | );
76 | name = "Linked Frameworks";
77 | sourceTree = "";
78 | };
79 | 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = {
80 | isa = PBXGroup;
81 | children = (
82 | 29B97324FDCFA39411CA2CEA /* AppKit.framework */,
83 | 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */,
84 | 29B97325FDCFA39411CA2CEA /* Foundation.framework */,
85 | );
86 | name = "Other Frameworks";
87 | sourceTree = "";
88 | };
89 | 19C28FACFE9D520D11CA2CBB /* Products */ = {
90 | isa = PBXGroup;
91 | children = (
92 | 8D1107320486CEB800E47090 /* RPTokenControlDemo.app */,
93 | );
94 | name = Products;
95 | sourceTree = "";
96 | };
97 | 29B97314FDCFA39411CA2CEA /* RPTokenControlDemo */ = {
98 | isa = PBXGroup;
99 | children = (
100 | 080E96DDFE201D6D7F000001 /* Classes */,
101 | 4801A1620D214EEC00EC697C /* RPTokenControlKit */,
102 | 4898EF9D159E82BE00141F40 /* External Dependencies */,
103 | 29B97315FDCFA39411CA2CEA /* Other Sources */,
104 | 29B97317FDCFA39411CA2CEA /* Resources */,
105 | 29B97323FDCFA39411CA2CEA /* Frameworks */,
106 | 19C28FACFE9D520D11CA2CBB /* Products */,
107 | );
108 | name = RPTokenControlDemo;
109 | sourceTree = "";
110 | };
111 | 29B97315FDCFA39411CA2CEA /* Other Sources */ = {
112 | isa = PBXGroup;
113 | children = (
114 | 32CA4F630368D1EE00C91783 /* RPTokenControlDemo_Prefix.pch */,
115 | 29B97316FDCFA39411CA2CEA /* main.m */,
116 | );
117 | name = "Other Sources";
118 | sourceTree = "";
119 | };
120 | 29B97317FDCFA39411CA2CEA /* Resources */ = {
121 | isa = PBXGroup;
122 | children = (
123 | 8D1107310486CEB800E47090 /* Info.plist */,
124 | 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */,
125 | 29B97318FDCFA39411CA2CEA /* MainMenu.nib */,
126 | );
127 | name = Resources;
128 | sourceTree = "";
129 | };
130 | 29B97323FDCFA39411CA2CEA /* Frameworks */ = {
131 | isa = PBXGroup;
132 | children = (
133 | 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */,
134 | 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */,
135 | );
136 | name = Frameworks;
137 | sourceTree = "";
138 | };
139 | 4801A1620D214EEC00EC697C /* RPTokenControlKit */ = {
140 | isa = PBXGroup;
141 | children = (
142 | 48D3BAF20D2C038C0075C33D /* Documentation */,
143 | 48F3249D0DA2AF0F000A8FFC /* NSView+FocusRing.h */,
144 | 48F3249E0DA2AF0F000A8FFC /* NSView+FocusRing.m */,
145 | 4801A1650D214EEC00EC697C /* RPBlackReflectionUtils.h */,
146 | 4801A1660D214EEC00EC697C /* RPBlackReflectionUtils.m */,
147 | 4801A1670D214EEC00EC697C /* RPCountedToken.h */,
148 | 4801A1680D214EEC00EC697C /* RPCountedToken.m */,
149 | 4801A1690D214EEC00EC697C /* RPTokenControl.h */,
150 | 4801A16A0D214EEC00EC697C /* RPTokenControl.m */,
151 | );
152 | path = RPTokenControlKit;
153 | sourceTree = "";
154 | };
155 | 4898EF9D159E82BE00141F40 /* External Dependencies */ = {
156 | isa = PBXGroup;
157 | children = (
158 | 48F38A731C9B057B004A9D5A /* SSY+Countability.h */,
159 | 48F38A701C9B0483004A9D5A /* NSObject+SSYBindingsHelp.h */,
160 | 48F38A711C9B0483004A9D5A /* NSObject+SSYBindingsHelp.m */,
161 | );
162 | name = "External Dependencies";
163 | sourceTree = "";
164 | };
165 | /* End PBXGroup section */
166 |
167 | /* Begin PBXNativeTarget section */
168 | 8D1107260486CEB800E47090 /* RPTokenControlDemo */ = {
169 | isa = PBXNativeTarget;
170 | buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "RPTokenControlDemo" */;
171 | buildPhases = (
172 | 8D1107290486CEB800E47090 /* Resources */,
173 | 8D11072C0486CEB800E47090 /* Sources */,
174 | 8D11072E0486CEB800E47090 /* Frameworks */,
175 | );
176 | buildRules = (
177 | );
178 | dependencies = (
179 | );
180 | name = RPTokenControlDemo;
181 | productInstallPath = "$(HOME)/Applications";
182 | productName = RPTokenControlDemo;
183 | productReference = 8D1107320486CEB800E47090 /* RPTokenControlDemo.app */;
184 | productType = "com.apple.product-type.application";
185 | };
186 | /* End PBXNativeTarget section */
187 |
188 | /* Begin PBXProject section */
189 | 29B97313FDCFA39411CA2CEA /* Project object */ = {
190 | isa = PBXProject;
191 | attributes = {
192 | };
193 | buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "RPTokenControlDemo" */;
194 | compatibilityVersion = "Xcode 3.0";
195 | developmentRegion = English;
196 | hasScannedForEncodings = 1;
197 | knownRegions = (
198 | English,
199 | Japanese,
200 | French,
201 | German,
202 | );
203 | mainGroup = 29B97314FDCFA39411CA2CEA /* RPTokenControlDemo */;
204 | projectDirPath = "";
205 | projectRoot = "";
206 | targets = (
207 | 8D1107260486CEB800E47090 /* RPTokenControlDemo */,
208 | );
209 | };
210 | /* End PBXProject section */
211 |
212 | /* Begin PBXResourcesBuildPhase section */
213 | 8D1107290486CEB800E47090 /* Resources */ = {
214 | isa = PBXResourcesBuildPhase;
215 | buildActionMask = 2147483647;
216 | files = (
217 | 8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */,
218 | 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */,
219 | 48D3BB170D2C038C0075C33D /* Documentation in Resources */,
220 | );
221 | runOnlyForDeploymentPostprocessing = 0;
222 | };
223 | /* End PBXResourcesBuildPhase section */
224 |
225 | /* Begin PBXSourcesBuildPhase section */
226 | 8D11072C0486CEB800E47090 /* Sources */ = {
227 | isa = PBXSourcesBuildPhase;
228 | buildActionMask = 2147483647;
229 | files = (
230 | 8D11072D0486CEB800E47090 /* main.m in Sources */,
231 | 4801A16C0D214EEC00EC697C /* RPBlackReflectionUtils.m in Sources */,
232 | 48F38A721C9B0483004A9D5A /* NSObject+SSYBindingsHelp.m in Sources */,
233 | 4801A16D0D214EEC00EC697C /* RPCountedToken.m in Sources */,
234 | 4801A16E0D214EEC00EC697C /* RPTokenControl.m in Sources */,
235 | 4801A1710D214F4B00EC697C /* AppController.m in Sources */,
236 | 48F3249F0DA2AF0F000A8FFC /* NSView+FocusRing.m in Sources */,
237 | );
238 | runOnlyForDeploymentPostprocessing = 0;
239 | };
240 | /* End PBXSourcesBuildPhase section */
241 |
242 | /* Begin PBXVariantGroup section */
243 | 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = {
244 | isa = PBXVariantGroup;
245 | children = (
246 | 089C165DFE840E0CC02AAC07 /* English */,
247 | );
248 | name = InfoPlist.strings;
249 | sourceTree = "";
250 | };
251 | 29B97318FDCFA39411CA2CEA /* MainMenu.nib */ = {
252 | isa = PBXVariantGroup;
253 | children = (
254 | 29B97319FDCFA39411CA2CEA /* English */,
255 | );
256 | name = MainMenu.nib;
257 | sourceTree = "";
258 | };
259 | /* End PBXVariantGroup section */
260 |
261 | /* Begin XCBuildConfiguration section */
262 | C01FCF4B08A954540054247B /* Debug */ = {
263 | isa = XCBuildConfiguration;
264 | buildSettings = {
265 | COPY_PHASE_STRIP = NO;
266 | GCC_DYNAMIC_NO_PIC = NO;
267 | GCC_ENABLE_FIX_AND_CONTINUE = YES;
268 | GCC_MODEL_TUNING = G5;
269 | GCC_OPTIMIZATION_LEVEL = 0;
270 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
271 | GCC_PREFIX_HEADER = RPTokenControlDemo_Prefix.pch;
272 | INFOPLIST_FILE = Info.plist;
273 | INSTALL_PATH = "$(HOME)/Applications";
274 | PRODUCT_NAME = RPTokenControlDemo;
275 | WRAPPER_EXTENSION = app;
276 | ZERO_LINK = YES;
277 | };
278 | name = Debug;
279 | };
280 | C01FCF4C08A954540054247B /* Release */ = {
281 | isa = XCBuildConfiguration;
282 | buildSettings = {
283 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
284 | GCC_MODEL_TUNING = G5;
285 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
286 | GCC_PREFIX_HEADER = RPTokenControlDemo_Prefix.pch;
287 | INFOPLIST_FILE = Info.plist;
288 | INSTALL_PATH = "$(HOME)/Applications";
289 | PRODUCT_NAME = RPTokenControlDemo;
290 | WRAPPER_EXTENSION = app;
291 | };
292 | name = Release;
293 | };
294 | C01FCF4F08A954540054247B /* Debug */ = {
295 | isa = XCBuildConfiguration;
296 | buildSettings = {
297 | GCC_WARN_ABOUT_RETURN_TYPE = YES;
298 | GCC_WARN_UNUSED_VARIABLE = YES;
299 | MACOSX_DEPLOYMENT_TARGET = 10.5;
300 | PREBINDING = NO;
301 | SDKROOT = macosx;
302 | };
303 | name = Debug;
304 | };
305 | C01FCF5008A954540054247B /* Release */ = {
306 | isa = XCBuildConfiguration;
307 | buildSettings = {
308 | GCC_WARN_ABOUT_RETURN_TYPE = YES;
309 | GCC_WARN_UNUSED_VARIABLE = YES;
310 | MACOSX_DEPLOYMENT_TARGET = 10.5;
311 | PREBINDING = NO;
312 | SDKROOT = macosx;
313 | };
314 | name = Release;
315 | };
316 | /* End XCBuildConfiguration section */
317 |
318 | /* Begin XCConfigurationList section */
319 | C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "RPTokenControlDemo" */ = {
320 | isa = XCConfigurationList;
321 | buildConfigurations = (
322 | C01FCF4B08A954540054247B /* Debug */,
323 | C01FCF4C08A954540054247B /* Release */,
324 | );
325 | defaultConfigurationIsVisible = 0;
326 | defaultConfigurationName = Release;
327 | };
328 | C01FCF4E08A954540054247B /* Build configuration list for PBXProject "RPTokenControlDemo" */ = {
329 | isa = XCConfigurationList;
330 | buildConfigurations = (
331 | C01FCF4F08A954540054247B /* Debug */,
332 | C01FCF5008A954540054247B /* Release */,
333 | );
334 | defaultConfigurationIsVisible = 0;
335 | defaultConfigurationName = Release;
336 | };
337 | /* End XCConfigurationList section */
338 | };
339 | rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
340 | }
341 |
--------------------------------------------------------------------------------
/RPTokenControlKit/RPTokenControl/Classes/RPTokenControl/CompositePage.html:
--------------------------------------------------------------------------------
1 |
3 |
4 | RPTokenControl
5 |
6 | RPTokenControl
7 | Abstract
8 | RPTokenControl is a replacement for NSTokenField.
9 | It is geared toward looking presenting a nice-looking "Tag Cloud" for bookmarks.
10 | In that context, think "token" = "tag".
11 | Discussion
12 | INHERITANCE
13 | RPTokenControl is a subclass of NSControl : NSView : NSObject
14 | SYSTEM REQUIREMENTS
15 | RPTokenControl requires Mac OS 10.3 or later, but will only accept drags when running under Mac OS 10.4 or later.
16 | KVC-COMPLIANT PROPERTIES
17 | The following properties may be set and observed using key-value coding,
18 | except those noted as read-only may be only observed.
19 | Accessor methods may also be available.
20 |
21 | -
22 |
id tokens
23 | The tokens displayed in the control.
24 | May be an NSArray, NSSet or NSCountedSet of tokens.
25 | The array elements (tokens) may be NSString or RPCountedToken objects.
26 |
27 | A token is composed of (1) text (a string) and, optionally, (2) a count.
28 | If is an NSCountedSet, counts are evaluated with -countForObject:.
29 | In other collections, NSString objects have an implied count of 1.
30 |
31 | Note: NSCountedSet has some limitations. For example, you cannot setCount:
32 | for an object. The only way to set a members count to N is to add it N times. Arghhhh.
33 | Thus, for many applications, a simple collection of RPCountedToken objects may be better
34 | than an NSCountedSet.
35 |
36 | If tokens is nil, the view will display the string set the value of ivar placeholderString.
37 |
38 |
39 | -
40 |
NSMutableIndexSet* selectedIndexSet
41 | Index set giving the indexes of tokens that are selected (highlighted) in the RPTokenControl.
42 | "Safe" accessors which make immutable copies are available.
43 |
44 | -
45 |
NSArray* selectedTokens
46 | An array of NSString objects, the text values of all tokens which are selected (highlighted) in the RPTokenControl.
47 | This array is derived from selectedIndexSet.
48 | This property is KVC-compliant for reading only.
49 | You can observe it to find when the selection has changed.
50 | But there is no actual instance variable and there is no setter.
51 |
52 | -
53 |
NSCharacterSet* disallowedCharacterSet
54 | If, while typing in a new token, the user enters a character from the disallowedCharacterSet, it will be replaced
55 | with an underscore ("_"), and the System Alert will sound. The user may continue typing after this happens.
56 |
57 | Note that this behaves differently than the tokenizingCharacterSet ivar of NSTokenField,
58 | which causes editing to end in the token being edited. To end editing a token in
59 | RPTokenControl, the user (naturally) types 'return'.
60 |
61 | -
62 |
NSString* placeholderString
63 | String which will be displayed if tokens is nil or empty.
64 |
65 | -
66 |
int maxTokensToDisplay
67 | Defines the maximum number of tokens that will be displayed.
68 | Default value is infinite = NSNotFound.
69 |
70 | -
71 |
BOOL showsReflections
72 | Defines whether or not the view shows a pretty, Leopard-dock-like
73 | reflection of each token.
74 | Default value is NO.
75 |
76 | -
77 |
float backgroundWhiteness
78 | Defines the background color drawn in between the tokens.
79 | Uses grayscale from 0.0=black to 1.0=white.
80 | Default value is 1.0 (white)
81 |
82 | -
83 |
BOOL appendCountsToStrings
84 | Sets whether or not tokens will be drawn with their count appended in square brackets.
85 | For example, if YES, a token "MyToken" with count 5 will appear as "MyToken [5]".
86 | It would look silly to set this to YES if setShowsCountsAsToolTips is also YES.
87 | Default value is NO.
88 | -
89 |
float fixedFontSize
90 | Defines a "fixed" font size to be used from drawing all tokens.
91 | If this value is not 0.0, all tokens will be drawn with font size equal to this value.
92 | If this value is 0.0, variable font sizes, from minFontSize to maxFontSize will be used.
93 | Default value is 0.0 (use variable font sizes0.
94 |
95 | -
96 |
float minFontSize
97 | Defines the smallest font size, used to draw the smallest-count tokens.
98 | However, this value is ignored if fixedFontSize == 0.0.
99 |
100 | -
101 |
float maxFontSize
102 | Defines the largest font size, used to draw the largest-count tokens.
103 | However, this value is ignored if fixedFontSize == 0.0.
104 |
105 | -
106 |
BOOL showsCountsAsToolTips
107 | Defines whether or not tokens will have tooltips that indicate their counts.
108 | It would look silly to set this to YES if setAppendCountsToStrings is also YES.
109 | Default value is NO.
110 | -
111 |
BOOL isEditable
112 | If YES,
113 |
114 | - The 'delete' key will delete selected tokens when the RPTokenControl is firstResponder
115 | - New tokens can be typed in when the RPTokenControl is firstResponder.
116 |
- New tokens can be dragged in as described in Drag Destination.
117 |
118 | If NO, none of the above will work.
119 |
120 | -
121 |
NSString* linkDragType
122 | The linkDragType is useful if you would like special behavior when objects of this
123 | externally-defined drag type are dragged onto the RPTokenControl.
124 | This behavior may "link" the dragged object to the destination token,
125 | affecting the source instead of the destination, kind of a "reverse" drag.
126 | For example, if you set linkDragType to be a 'bookmark' type,
127 | and the tokens in your RPTokenControl represented available bookmark "tags",
128 | you could (in external code), add the destination token to the
129 | dragged bookmark's "tags", thus "tagging" the dragged bookmark.
130 |
131 | -
132 |
NSImage* dragImage
133 | Defines the cursor image that will be shown when a token is dragged.
134 | If not set, Cocoa uses a default image.
135 | -
136 |
137 |
id delegate
138 | If a linkDragType has been set, during a drag which includes a linkDragType
139 | into the RPTokenControl, RPTokenControl will, after testing that the delegate responds,
140 | send the following messages to the delegate:
141 |
142 | - -draggingEntered:
143 | - -draggingUpdated:
144 | - -performDragOperation:
145 | - -draggingExited:
146 |
147 | For documentation of when these messages will be sent, their parameters and expected
148 | return values, see Cocoa's "NSDraggingDestination Protocol Reference" document.
149 |
150 |
151 | TARGET-ACTION
152 | RPTokenControl will send an action to its target when its selection changes.
153 | (Observing selectedTokens or selectedIndexSet is an alternative to this.)
154 | DRAGGING SOURCE
155 | RPTokenControl provides four pasteboard types to the dragging pasteboard.
156 |
157 | - NSStringPboardType: NSString of the last selected token
158 | - NSTabularTextPboardType: tab-separated string of selected tokens
159 | - RPTokenPboardType: same as NSString PboardType
160 | - RPTabularTokenPboardType: same as NSTabularTextPboardType
161 |
162 | Although the payload is the same as the first two types, the last two
163 | types are provided to distinguish drags from the RPTokenControl from
164 | drags of text from other sources. This is in case the app wants to
165 | do something different when it receives "token" strings.
166 |
167 | Dragging a token always initiates a NSDragOperationCopy operation.
168 | Dragged tokens are never removed from the RPTokenControl
169 |
170 | DRAGGING DESTINATION
171 | If system is Mac OS 10.3, or if ivar isEditable=NO, RPTokenControl is not a dragging destination.
172 | Attempted drags will return NSDragOperationNone.
173 |
174 | If system if Mac OS 10.4 or later, and if ivar isEditable=YES,
175 | tokens or strings dragged into RPTokenControl will be added to tokens.
176 | They will not be selected.
177 | Drag destination supports only strings, not counts.
178 | New tokens dropped in will have a count of 1.
179 |
180 | If the pasteboard contains an object of the set linkDragType, it will takes precedence.
181 | Behavior will be only as described above in delegate.
182 | No token will be added, and other drag types on sender's the pasteboard will be ignored.
183 | VERSION HISTORY
184 |
185 | - Version 1.0.2. 2008 Feb 06.
186 | - -setTokens now retains old value of _tokens until after triggering change notification
187 | to observer. This was sometimes causing crashes in Tiger but not Leopard.
188 | - The ellipsis token is now better behaved. When clicking the ellipsisToken, instead of
189 | being selected, the leftmost displayed token is scrolled off and, if there is room,
190 | the rightmost token which was truncated is scrolled in. Scrolling can be activated
191 | in either direction by using the arrow keys when the end tag is selected.
192 | - Fixed bug in -keyDown which caused NSArray exception to be logged if down-arrow
193 | key was typed when no tokens were selected.
194 | - Fixed bug in -drawRect which caused focus ring to scroll with the RPTokenControl
195 | when enclosed in a scroll view. Did this by replacing two dozen lines of very stupid
196 | code with three lines of smart code.
197 |
198 | - Version 1.0.1. 2008 Jan 02.
199 | - Added hysteresis so that drag does not begin until significant mouse movement.
200 |
201 | - Version 1.0.0. 2007 Dec 26
202 | - Initial release.
203 |
204 |
205 | AUTHOR
206 | RPTokenControl is an adaptation of Robert Pointon's Tag Cloud NSView.
207 | It was adapted by Jerry Krinock jerry at ieee.org in San Jose, California USA.
208 | (I'm not afraid of more spam, but a bug in HeaderDoc does not allow at-sign to be used even if it is backslash-escaped as documented.)
209 |
Methods
210 |
211 |
212 | Abstract: getter for ivar delegate
213 |
214 | - (id)delegate;
215 |
216 |
217 |
218 |
219 |
220 | Abstract: getter for ivar disallowedCharacterSet
221 |
222 | - (NSCharacterSet *)disallowedCharacterSet;
223 |
224 |
225 |
226 |
227 |
228 | Abstract: getter for ivar linkDragType
229 |
230 | - (NSString *)linkDragType;
231 |
232 |
233 |
234 |
235 |
236 | Abstract: getter for ivar placeholderString
237 |
238 | - (NSString *)placeholderString;
239 |
240 |
241 |
242 |
243 |
244 | Abstract: getter for ivar selectedIndexSet
245 |
246 | - (NSIndexSet*)selectedIndexSet;
247 |
248 |
249 | Result: an immutable copy of selectedIndexSet
250 |
251 |
252 |
253 |
254 | Abstract: An NSArray of the tokens selected in the control view
255 |
256 | - (NSArray*)selectedTokens;
257 |
258 |
259 |
260 | Result: An array of NSStrings. Each string is the text of a selected token. Counts are not provided.
261 |
262 |
263 |
264 |
265 | Abstract: setter for ivar appendCountsToStrings
266 |
267 | - (void)setAppendCountsToStrings:(BOOL)yn;
268 |
269 | Invoking this method will recalculate the receiver's layout
270 | and mark the receiver with -setNeedsDisplay.
271 |
272 |
273 |
274 |
275 | Abstract: setter for ivar backgroundWhiteness
276 |
277 | - (void)setBackgroundWhiteness:(float)whiteness;
278 |
279 | Invoking this method will recalculate the receiver's layout
280 | and mark the receiver with -setNeedsDisplay.
281 |
282 |
283 |
284 |
285 | Abstract: setter for ivar delegate
286 |
287 | - (void)setDelegate:(id)delegate;
288 |
289 |
290 |
291 |
292 |
293 | Abstract: setter for ivar disallowedCharacterSet
294 |
295 | - (void)setDisallowedCharacterSet:(NSCharacterSet *)newDisallowedCharacterSet;
296 |
297 |
298 |
299 |
300 |
301 | Abstract: setter for the ivar dragImage
302 |
303 | - (void)setDragImage:(NSImage*)image;
304 |
305 |
306 |
307 |
308 |
309 | Abstract: setter for ivar isEditable
310 |
311 | - (void)setEditable:(BOOL)yn;
312 |
313 |
314 |
315 |
316 |
317 | Abstract: setter for ivar fixedFontSize
318 |
319 | - (void)setFixedFontSize:(float)x;
320 |
321 | Invoking this method will recalculate the receiver's layout
322 | and mark the receiver with -setNeedsDisplay.
323 |
324 |
325 |
326 |
327 | Abstract: setter for ivar linkDragType
328 |
329 | - (void)setLinkDragType:(NSString*)linkDragType;
330 |
331 |
332 |
333 |
334 |
335 | Abstract: setter for the ivar maxFontSIze
336 |
337 | - (void)setMaxFontSize:(float)x;
338 |
339 | Invoking this method will recalculate the receiver's layout
340 | and mark the receiver with -setNeedsDisplay.
341 |
342 |
343 |
344 |
345 | Abstract: setter for ivar maxTokensToDisplay
346 |
347 | - (void)setMaxTokensToDisplay:(int)maxTokensToDisplay;
348 |
349 | Invoking this method will recalculate the receiver's layout
350 | and mark the receiver with -setNeedsDisplay.
351 | If not set, all tokens that fit will be displayed
352 |
353 |
354 |
355 |
356 | Abstract: setter for the ivar minFontSize
357 |
358 | - (void)setMinFontSize:(float)x;
359 |
360 | Invoking this method will recalculate the receiver's layout
361 | and mark the receiver with -setNeedsDisplay.
362 |
363 |
364 |
365 |
366 | Abstract: setter for ivar placeholderString
367 |
368 | - (void)setPlaceholderString:(NSString *)newPlaceholderString;
369 |
370 |
371 |
372 |
373 |
374 | Abstract: setter for ivar selectedIndexSet
375 |
376 | - (void)setSelectedIndexSet:(NSIndexSet*)newSelectedIndexSet;
377 |
378 | Makes a mutable copy of the argument.
379 | Make sure that the range of the argument is within the range of tokens
380 |
381 |
382 |
383 |
384 | Abstract: setter for the ivar showsCountsAsToolTips.
385 |
386 | - (void)setShowsCountsAsToolTips:(BOOL)yn;
387 |
388 | It would look silly to set this to YES if setAppendCountsToStrings is also YES.
389 | If not set, will default to NO.
390 |
391 |
392 |
393 |
394 | Abstract: setter for the ivar showsReflections
395 |
396 | - (void)setShowsReflections:(BOOL)yn;
397 |
398 | Invoking this method will recalculate the receiver's layout
399 | and mark the receiver with -setNeedsDisplay.
400 |
401 |
402 |
403 |
404 | Abstract: setter for ivar tokens
405 |
406 | - (void)setTokens:(id)tokens;
407 |
408 |
409 |
410 |
411 |
412 | Abstract: getter for ivar tokens
413 |
414 | - (id)tokens;
415 |
416 |
417 |
418 |
419 | (Last Updated 2/8/2008)
420 |
421 |
--------------------------------------------------------------------------------
/RPTokenControlKit/Documentation/RPTokenControl/Classes/RPTokenControl/CompositePage.html:
--------------------------------------------------------------------------------
1 |
3 |
4 | RPTokenControl
5 |
6 | RPTokenControl
7 | Abstract
8 | RPTokenControl is a replacement for NSTokenField.
9 | It is geared toward looking presenting a nice-looking "Tag Cloud" for bookmarks.
10 | In that context, think "token" = "tag".
11 | Discussion
12 | INHERITANCE
13 | RPTokenControl is a subclass of NSControl : NSView : NSObject
14 | SYSTEM REQUIREMENTS
15 | RPTokenControl requires Mac OS 10.3 or later, but will only accept drags when running under Mac OS 10.4 or later.
16 | KVC-COMPLIANT PROPERTIES
17 | The following properties may be set and observed using key-value coding,
18 | except those noted as read-only may be only observed.
19 | Accessor methods may also be available.
20 |
21 | -
22 |
id tokens
23 | The tokens displayed in the control.
24 | May be an NSArray, NSSet or NSCountedSet of tokens.
25 | The array elements (tokens) may be NSString or RPCountedToken objects.
26 |
27 | A token is composed of (1) text (a string) and, optionally, (2) a count.
28 | If is an NSCountedSet, counts are evaluated with -countForObject:.
29 | In other collections, NSString objects have an implied count of 1.
30 |
31 | Note: NSCountedSet has some limitations. For example, you cannot setCount:
32 | for an object. The only way to set a members count to N is to add it N times. Arghhhh.
33 | Thus, for many applications, a simple collection of RPCountedToken objects may be better
34 | than an NSCountedSet.
35 |
36 | If tokens is nil, the view will display the string set the value of ivar placeholderString.
37 |
38 |
39 | -
40 |
NSMutableIndexSet* selectedIndexSet
41 | Index set giving the indexes of tokens that are selected (highlighted) in the RPTokenControl.
42 | "Safe" accessors which make immutable copies are available.
43 |
44 | -
45 |
NSArray* selectedTokens
46 | An array of NSString objects, the text values of all tokens which are selected (highlighted) in the RPTokenControl.
47 | This array is derived from selectedIndexSet.
48 | This property is KVC-compliant for reading only.
49 | You can observe it to find when the selection has changed.
50 | But there is no actual instance variable and there is no setter.
51 |
52 | -
53 |
NSCharacterSet* disallowedCharacterSet
54 | If, while typing in a new token, the user enters a character from the disallowedCharacterSet, it will be replaced
55 | with an underscore ("_"), and the System Alert will sound. The user may continue typing after this happens.
56 |
57 | Note that this behaves differently than the tokenizingCharacterSet ivar of NSTokenField,
58 | which causes editing to end in the token being edited. To end editing a token in
59 | RPTokenControl, the user (naturally) types 'return'.
60 |
61 | -
62 |
NSString* placeholderString
63 | String which will be displayed if tokens is nil or empty.
64 |
65 | -
66 |
int maxTokensToDisplay
67 | Defines the maximum number of tokens that will be displayed.
68 | Default value is infinite = NSNotFound.
69 |
70 | -
71 |
BOOL showsReflections
72 | Defines whether or not the view shows a pretty, Leopard-dock-like
73 | reflection of each token.
74 | Default value is NO.
75 |
76 | -
77 |
float backgroundWhiteness
78 | Defines the background color drawn in between the tokens.
79 | Uses grayscale from 0.0=black to 1.0=white.
80 | Default value is 1.0 (white)
81 |
82 | -
83 |
BOOL appendCountsToStrings
84 | Sets whether or not tokens will be drawn with their count appended in square brackets.
85 | For example, if YES, a token "MyToken" with count 5 will appear as "MyToken [5]".
86 | It would look silly to set this to YES if setShowsCountsAsToolTips is also YES.
87 | Default value is NO.
88 | -
89 |
float fixedFontSize
90 | Defines a "fixed" font size to be used from drawing all tokens.
91 | If this value is not 0.0, all tokens will be drawn with font size equal to this value.
92 | If this value is 0.0, variable font sizes, from minFontSize to maxFontSize will be used.
93 | Default value is 0.0 (use variable font sizes0.
94 |
95 | -
96 |
float minFontSize
97 | Defines the smallest font size, used to draw the smallest-count tokens.
98 | However, this value is ignored if fixedFontSize == 0.0.
99 |
100 | -
101 |
float maxFontSize
102 | Defines the largest font size, used to draw the largest-count tokens.
103 | However, this value is ignored if fixedFontSize == 0.0.
104 |
105 | -
106 |
BOOL showsCountsAsToolTips
107 | Defines whether or not tokens will have tooltips that indicate their counts.
108 | It would look silly to set this to YES if setAppendCountsToStrings is also YES.
109 | Default value is NO.
110 | -
111 |
BOOL isEditable
112 | If YES,
113 |
114 | - The 'delete' key will delete selected tokens when the RPTokenControl is firstResponder
115 | - New tokens can be typed in when the RPTokenControl is firstResponder.
116 |
- New tokens can be dragged in as described in Drag Destination.
117 |
118 | If NO, none of the above will work.
119 |
120 | -
121 |
NSString* linkDragType
122 | The linkDragType is useful if you would like special behavior when objects of this
123 | externally-defined drag type are dragged onto the RPTokenControl.
124 | This behavior may "link" the dragged object to the destination token,
125 | affecting the source instead of the destination, kind of a "reverse" drag.
126 | For example, if you set linkDragType to be a 'bookmark' type,
127 | and the tokens in your RPTokenControl represented available bookmark "tags",
128 | you could (in external code), add the destination token to the
129 | dragged bookmark's "tags", thus "tagging" the dragged bookmark.
130 |
131 | -
132 |
NSImage* dragImage
133 | Defines the cursor image that will be shown when a token is dragged.
134 | If not set, Cocoa uses a default image.
135 | -
136 |
137 |
id delegate
138 | If a linkDragType has been set, during a drag which includes a linkDragType
139 | into the RPTokenControl, RPTokenControl will, after testing that the delegate responds,
140 | send the following messages to the delegate:
141 |
142 | - -draggingEntered:
143 | - -draggingUpdated:
144 | - -performDragOperation:
145 | - -draggingExited:
146 |
147 | For documentation of when these messages will be sent, their parameters and expected
148 | return values, see Cocoa's "NSDraggingDestination Protocol Reference" document.
149 |
150 |
151 | TARGET-ACTION
152 | RPTokenControl will send an action to its target when its selection changes.
153 | (Observing selectedTokens or selectedIndexSet is an alternative to this.)
154 | DRAGGING SOURCE
155 | RPTokenControl provides four pasteboard types to the dragging pasteboard.
156 |
157 | - NSStringPboardType: NSString of the last selected token
158 | - NSTabularTextPboardType: tab-separated string of selected tokens
159 | - RPTokenPboardType: same as NSString PboardType
160 | - RPTabularTokenPboardType: same as NSTabularTextPboardType
161 |
162 | Although the payload is the same as the first two types, the last two
163 | types are provided to distinguish drags from the RPTokenControl from
164 | drags of text from other sources. This is in case the app wants to
165 | do something different when it receives "token" strings.
166 |
167 | Dragging a token always initiates a NSDragOperationCopy operation.
168 | Dragged tokens are never removed from the RPTokenControl
169 |
170 | DRAGGING DESTINATION
171 | If system is Mac OS 10.3, or if ivar isEditable=NO, RPTokenControl is not a dragging destination.
172 | Attempted drags will return NSDragOperationNone.
173 |
174 | If system if Mac OS 10.4 or later, and if ivar isEditable=YES,
175 | tokens or strings dragged into RPTokenControl will be added to tokens.
176 | They will not be selected.
177 | Drag destination supports only strings, not counts.
178 | New tokens dropped in will have a count of 1.
179 |
180 | If the pasteboard contains an object of the set linkDragType, it will takes precedence.
181 | Behavior will be only as described above in delegate.
182 | No token will be added, and other drag types on sender's the pasteboard will be ignored.
183 | VERSION HISTORY
184 |
185 | - Version 1.0.2. 2008 Feb 06.
186 | - -setTokens now retains old value of _tokens until after triggering change notification
187 | to observer. This was sometimes causing crashes in Tiger but not Leopard.
188 | - The ellipsis token is now better behaved. When clicking the ellipsisToken, instead of
189 | being selected, the leftmost displayed token is scrolled off and, if there is room,
190 | the rightmost token which was truncated is scrolled in. Scrolling can be activated
191 | in either direction by using the arrow keys when the end tag is selected.
192 | - Fixed bug in -keyDown which caused NSArray exception to be logged if down-arrow
193 | key was typed when no tokens were selected.
194 | - Fixed bug in -drawRect which caused focus ring to scroll with the RPTokenControl
195 | when enclosed in a scroll view. Did this by replacing two dozen lines of very stupid
196 | code with three lines of smart code.
197 |
198 | - Version 1.0.1. 2008 Jan 02.
199 | - Added hysteresis so that drag does not begin until significant mouse movement.
200 |
201 | - Version 1.0.0. 2007 Dec 26
202 | - Initial release.
203 |
204 |
205 | AUTHOR
206 | RPTokenControl is an adaptation of Robert Pointon's Tag Cloud NSView.
207 | It was adapted by Jerry Krinock jerry at ieee.org in San Jose, California USA.
208 | (I'm not afraid of more spam, but a bug in HeaderDoc does not allow at-sign to be used even if it is backslash-escaped as documented.)
209 |
Methods
210 |
211 |
212 | Abstract: getter for ivar delegate
213 |
214 | - (id)delegate;
215 |
216 |
217 |
218 |
219 |
220 | Abstract: getter for ivar disallowedCharacterSet
221 |
222 | - (NSCharacterSet *)disallowedCharacterSet;
223 |
224 |
225 |
226 |
227 |
228 | Abstract: getter for ivar linkDragType
229 |
230 | - (NSString *)linkDragType;
231 |
232 |
233 |
234 |
235 |
236 | Abstract: getter for ivar placeholderString
237 |
238 | - (NSString *)placeholderString;
239 |
240 |
241 |
242 |
243 |
244 | Abstract: getter for ivar selectedIndexSet
245 |
246 | - (NSIndexSet*)selectedIndexSet;
247 |
248 |
249 | Result: an immutable copy of selectedIndexSet
250 |
251 |
252 |
253 |
254 | Abstract: An NSArray of the tokens selected in the control view
255 |
256 | - (NSArray*)selectedTokens;
257 |
258 |
259 |
260 | Result: An array of NSStrings. Each string is the text of a selected token. Counts are not provided.
261 |
262 |
263 |
264 |
265 | Abstract: setter for ivar appendCountsToStrings
266 |
267 | - (void)setAppendCountsToStrings:(BOOL)yn;
268 |
269 | Invoking this method will recalculate the receiver's layout
270 | and mark the receiver with -setNeedsDisplay.
271 |
272 |
273 |
274 |
275 | Abstract: setter for ivar backgroundWhiteness
276 |
277 | - (void)setBackgroundWhiteness:(float)whiteness;
278 |
279 | Invoking this method will recalculate the receiver's layout
280 | and mark the receiver with -setNeedsDisplay.
281 |
282 |
283 |
284 |
285 | Abstract: setter for ivar delegate
286 |
287 | - (void)setDelegate:(id)delegate;
288 |
289 |
290 |
291 |
292 |
293 | Abstract: setter for ivar disallowedCharacterSet
294 |
295 | - (void)setDisallowedCharacterSet:(NSCharacterSet *)newDisallowedCharacterSet;
296 |
297 |
298 |
299 |
300 |
301 | Abstract: setter for the ivar dragImage
302 |
303 | - (void)setDragImage:(NSImage*)image;
304 |
305 |
306 |
307 |
308 |
309 | Abstract: setter for ivar isEditable
310 |
311 | - (void)setEditable:(BOOL)yn;
312 |
313 |
314 |
315 |
316 |
317 | Abstract: setter for ivar fixedFontSize
318 |
319 | - (void)setFixedFontSize:(float)x;
320 |
321 | Invoking this method will recalculate the receiver's layout
322 | and mark the receiver with -setNeedsDisplay.
323 |
324 |
325 |
326 |
327 | Abstract: setter for ivar linkDragType
328 |
329 | - (void)setLinkDragType:(NSString*)linkDragType;
330 |
331 |
332 |
333 |
334 |
335 | Abstract: setter for the ivar maxFontSIze
336 |
337 | - (void)setMaxFontSize:(float)x;
338 |
339 | Invoking this method will recalculate the receiver's layout
340 | and mark the receiver with -setNeedsDisplay.
341 |
342 |
343 |
344 |
345 | Abstract: setter for ivar maxTokensToDisplay
346 |
347 | - (void)setMaxTokensToDisplay:(int)maxTokensToDisplay;
348 |
349 | Invoking this method will recalculate the receiver's layout
350 | and mark the receiver with -setNeedsDisplay.
351 | If not set, all tokens that fit will be displayed
352 |
353 |
354 |
355 |
356 | Abstract: setter for the ivar minFontSize
357 |
358 | - (void)setMinFontSize:(float)x;
359 |
360 | Invoking this method will recalculate the receiver's layout
361 | and mark the receiver with -setNeedsDisplay.
362 |
363 |
364 |
365 |
366 | Abstract: setter for ivar placeholderString
367 |
368 | - (void)setPlaceholderString:(NSString *)newPlaceholderString;
369 |
370 |
371 |
372 |
373 |
374 | Abstract: setter for ivar selectedIndexSet
375 |
376 | - (void)setSelectedIndexSet:(NSIndexSet*)newSelectedIndexSet;
377 |
378 | Makes a mutable copy of the argument.
379 | Make sure that the range of the argument is within the range of tokens
380 |
381 |
382 |
383 |
384 | Abstract: setter for the ivar showsCountsAsToolTips.
385 |
386 | - (void)setShowsCountsAsToolTips:(BOOL)yn;
387 |
388 | It would look silly to set this to YES if setAppendCountsToStrings is also YES.
389 | If not set, will default to NO.
390 |
391 |
392 |
393 |
394 | Abstract: setter for the ivar showsReflections
395 |
396 | - (void)setShowsReflections:(BOOL)yn;
397 |
398 | Invoking this method will recalculate the receiver's layout
399 | and mark the receiver with -setNeedsDisplay.
400 |
401 |
402 |
403 |
404 | Abstract: setter for ivar tokens
405 |
406 | - (void)setTokens:(id)tokens;
407 |
408 |
409 |
410 |
411 |
412 | Abstract: getter for ivar tokens
413 |
414 | - (id)tokens;
415 |
416 |
417 |
418 |
419 | (Last Updated 2/8/2008)
420 |
421 |
--------------------------------------------------------------------------------
/RPTokenControlKit/RPTokenControl.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | extern id const SSYNoTokensMarker ;
4 |
5 | #define RPTokenFancyEffectReflection 1
6 | #define RPTokenFancyEffectShadow 2
7 |
8 | enum RPTokenControlTokenColorScheme_enum {
9 | RPTokenControlTokenColorSchemeBlue,
10 | RPTokenControlTokenColorSchemeWhite
11 | } ;
12 | typedef enum RPTokenControlTokenColorScheme_enum RPTokenControlTokenColorScheme ;
13 |
14 | /*!
15 | @brief RPTokenControl is a replacement for NSTokenField.
16 | It is geared toward looking presenting a nice-looking "Tag Cloud" for bookmarks.
17 | In that context, think "token" = "tag".
18 | @detail
19 | INHERITANCE
20 | RPTokenControl is a subclass of NSControl : NSView : NSObject
21 | SYSTEM REQUIREMENTS
22 | RPTokenControl requires Mac OS 10.7 or later. It was originally written for
23 | macOS 10.3, though, so it still has some old-fashioned accessors, etc.
24 | KVC-COMPLIANT PROPERTIES
25 | The following properties may be set and observed using key-value coding,
26 | except those noted as read-only may be only observed.
27 | Accessor methods may also be available.
28 |
29 | -
30 |
id objectValue
31 | The tokens displayed in the control.
32 | May be an NSArray, NSSet or NSCountedSet of strings, or an NSStateMarker.
33 |
34 | A token is composed of (1) text (a string) and, optionally, (2) a count.
35 | If is an NSCountedSet, counts are evaluated with -countForObject:.
36 | In other collections, NSString objects have an implied count of 1.
37 |
38 | Note: NSCountedSet has some limitations. For example, you cannot setCount:
39 | for an object. The only way to set a members count to N is to add it N times.
40 |
41 |
42 | If objectValue is nil, the view will display the No Tokens placeholder.
43 |
44 |
45 | -
46 |
NSMutableIndexSet* selectedIndexSet
47 | Index set giving the indexes of tokens that are selected (highlighted) in the
48 | RPTokenControl. "Safe" accessors which make immutable copies are available.
49 |
50 | -
51 |
NSArray* selectedTokens
52 | An array of NSString objects, the text values of all tokens which are selected (highlighted) in the RPTokenControl.
53 | This array is derived from selectedIndexSet.
54 | This property is KVC-compliant for reading only.
55 | You can observe it to find when the selection has changed.
56 | But there is no actual instance variable and there is no setter.
57 |
58 | -
59 |
NSCharacterSet* disallowedCharacterSet and replacementString
60 | If, while typing in a new token, the user enters a character from the disallowedCharacterSet, it will be replaced
61 | with the replacementString, and the System Alert will sound. The user may continue typing after this happens.
62 | Note: Don't confuse disallowedCharacterSet with tokenizingCharacterSet. During -awakeFromNib, replacmentString
63 | is set to @"_"
64 |
65 | -
66 |
NSString* placeholderString
67 | String which will be displayed if tokens is nil or empty.
68 |
69 | -
70 |
NSInteger maxTokensToDisplay
71 | Defines the maximum number of tokens that will be displayed.
72 | Default value is infinite = NSNotFound.
73 |
74 | -
75 |
BOOL fancyEffects
76 | Defines whether or not the view shows a pretty, Leopard-dock-like
77 | reflection of each token and/or a shadow. Pass 0 for no fancy effects.
78 | For fancy effects, pass RPTokenFancyEffectReflection and/or
79 | RPTokenFancyEffectShadow. They *or* bitwise (although that would definitely
80 | look pretty ridiculous nowadays.)
81 |
82 | -
83 |
RPTokenControlTokenColorScheme tokenColorScheme
84 | Determines whether the tokens are blue (like NSTokenField) or white.
85 | The default is RPTokenControlColorSchemeBlue.
86 |
87 | -
88 |
float backgroundWhiteness
89 | Defines the background color drawn in between the tokens.
90 | Uses grayscale from 0.0=black to 1.0=white.
91 | Default value is 1.0 (white)
92 |
93 | -
94 |
float cornerRadiusFactor
95 | Should be between 0.0 and 0.5. 0.0 means square corners. 0.5 means maximum
96 | roundness, like NSTokenField. Value of 0.2 or less allows tokens to be
97 | packed in as tightly as possible. Larger values give more loose packing.
98 | Default value is 0.5.
99 |
100 | -
101 |
float widthPaddingMultiplier
102 | Should be > 1.0. Indicates the width of the padding between the edge of
103 | each token and the text, on the left and right, as a multiple of the
104 | corner radius. 1.0 creates the smallest tokens. 3.0 makes roomy tokens,
105 | like NSTokenField. The default value is 3.0.
106 |
107 | -
108 |
BOOL appendCountsToStrings
109 | Sets whether or not tokens will be drawn with their count appended in square brackets.
110 | For example, if YES, a token "MyToken" with count 5 will appear as "MyToken [5]".
111 | It would look silly to set this to YES if setShowsCountsAsToolTips is also YES.
112 | Default value is NO.
113 | -
114 |
float fixedFontSize
115 | Defines a "fixed" font size to be used from drawing all tokens.
116 | If this value is not 0.0, all tokens will be drawn with font size equal to this value.
117 | If this value is 0.0, variable font sizes, from minFontSize to maxFontSize will be used.
118 | Default value is 0.0 (use variable font sizes).
119 |
120 | -
121 |
float minFontSize
122 | Defines the smallest font size, used to draw the smallest-count tokens.
123 | However, this value is ignored if fixedFontSize == 0.0.
124 |
125 | -
126 |
float maxFontSize
127 | Defines the largest font size, used to draw the largest-count tokens.
128 | However, this value is ignored if fixedFontSize == 0.0.
129 |
130 | -
131 |
BOOL showsCountsAsToolTips
132 | Defines whether or not tokens will have tooltips that indicate their counts.
133 | It would look silly to set this to YES if setAppendCountsToStrings is also YES.
134 | Default value is NO.
135 | -
136 |
RPTokenControlEditability
137 |
138 |
139 | | Value |
140 | The 'delete' key will delete selected tokens when the RPTokenControl is firstResponder |
141 | New tokens can be typed in when the RPTokenControl is firstResponder. |
142 | New tokens can be dragged in as described in Drag Destination. |
143 |
144 |
145 | | RPTokenControlEditability0 |
146 | NO |
147 | NO |
148 | NO |
149 |
150 |
151 | | RPTokenControlEditability1 |
152 | YES |
153 | NO |
154 | NO |
155 |
156 |
157 | | RPTokenControlEditability2 |
158 | YES |
159 | YES |
160 | YES |
161 |
162 |
163 |
164 | -
165 |
NSString* linkDragType
166 | The linkDragType is useful if you would like special behavior when objects of this
167 | externally-defined drag type are dragged onto the RPTokenControl.
168 | This behavior may "link" the dragged object to the destination token,
169 | affecting the source instead of the destination, kind of a "reverse" drag.
170 | For example, if you set linkDragType to be a 'bookmark' type,
171 | and the tokens in your RPTokenControl represented available bookmark "tags",
172 | you could (in external code), add the destination token to the
173 | dragged bookmark's "tags", thus "tagging" the dragged bookmark.
174 |
175 | -
176 |
NSImage* dragImage
177 | Defines the cursor image that will be shown when a token is dragged.
178 | If not set, Cocoa uses a default image.
179 | -
180 |
181 |
id delegate
182 | Dragging
183 | If a linkDragType has been set, during a drag which includes a linkDragType
184 | into the RPTokenControl, RPTokenControl will, after testing that the delegate responds,
185 | send the following messages to the delegate:
186 |
187 | - -draggingEntered:
188 | - -draggingUpdated:
189 | - -performDragOperation:
190 | - -draggingExited:
191 |
192 | For documentation of when these messages will be sent, their parameters and expected
193 | return values, see Cocoa's "NSDraggingDestination Protocol Reference" document.
194 |
195 |
196 | Renaming Tokens
197 | If the delegate responds to the RPTokenControlDelegate protocol optional method
198 | -tokenControl:renameToken:, a contextual menu item "Rename 'xxx'" will be
199 | available when performing a secondary click on a token, and click that menu
200 | item will send a -tokenControl:renameToken: message to the delegate.
201 | BINDINGS
202 | RPTokenControl has the following bindings exposed:
203 |
204 | - value
Bindings access to the property objectValue
205 | - enabled
206 | - toolTip
207 | - fixedFontSize
208 |
209 | TARGET-ACTION
210 | RPTokenControl will send an action to its target when its selection changes
211 | due to a mouseUp or mouseDown event.
212 | (Observing selectedTokens or selectedIndexSet is an alternative to this.)
213 | DRAGGING SOURCE
214 | RPTokenControl provides four pasteboard types to the dragging pasteboard.
215 |
216 | - NSPasteboardTypeString: NSString of the last selected token
217 | - NSPasteboardTypeTabularText: tab-separated string of selected tokens
218 | - RPTokenControlPasteboardTypeTokens: same as NSString PboardType
219 | - RPTokenControlPasteboardTypeTabularTokens: same as NSPasteboardTypeTabularText
220 |
221 | Although the payload is the same as the first two types, the last two
222 | types are provided to distinguish drags from the RPTokenControl from
223 | drags of text from other sources. This is in case the app wants to
224 | do something different when it receives "token" strings.
225 |
226 | Dragging a token always initiates a NSDragOperationCopy operation.
227 | Dragged tokens are never removed from the RPTokenControl
228 |
229 | DRAGGING DESTINATION
230 | If ivar isEditable=YES, tokens or strings dragged into RPTokenControl will be
231 | added to tokens. They will not be selected. Drag destination supports only
232 | strings, not counts. New tokens dropped in will have a count of 1.
233 |
234 | If the pasteboard contains an object of the set linkDragType, it will takes
235 | precedence. Behavior will be only as described above in
236 | delegate. No token will be added,
237 | and other drag types on sender's the pasteboard will be ignored.
238 |
239 | VERSION HISTORY
240 |
241 | - Version 5. 20170523.
242 | - Added VoiceOver (accessibility) support
243 | - Now compiles with Automatic Reference Counting or not, instead of just not.
244 |
245 | - Version 4. 20150304.
246 | - Fixed deprecations to 10.8+ Deployment Target
247 | - Now requires OS X 10.7 or later.
248 |
249 | - Version 3.1. 20131208.
250 | - Added -encodeWithCoder:, -initWithCoder:. Thanks to crispinb for
251 | noticing this.
252 |
253 | - Version 3.0. 20130830.
254 | - Added parameters so that the tokens may be configured to look pretty much
255 | like the blue tokens in Apple's NSTokenField, and the property values which do
256 | this are now *default* . Yes, folks: Shadows and reflections are not cool any
257 | more. You can still get them, but you need to modify you code to set the new
258 | properties 'fancyEffects' and 'tokenColorScheme' accordingly. Also,
259 | the property 'showsReflections' has been removed. To replace it, use
260 | 'fancyEffects'.
261 |
262 | - Version 2.4. 20130514.
263 | - Fixed documentation (in this file) and demo project to reflect the fact that
264 | setting the objectValue of RPTokenControl to a set of RPCountedToken objects
265 | is no longer supported.
266 | - In demo project Build Settings, updated Build Settings to work in Xcode 4.
267 | Base SDK is now "Latest macOS", Architectures are now Xcode default instead
268 | of ppc + i386.
269 |
270 | - Version 2.3. 20130415.
271 | - -keyDown: now forwards un-handled 'tab' key down events to super, as is
272 | proper.
273 |
274 | - Version 2.2. 20121203.
275 | - Added a contextual menu to tokens, with items "Delete" and, optionally,
276 | "Rename".
277 | - If editability is < 2, receiving a key down event whose character is the
278 | first character of a token now causes the enclosing scroll view, if any,
279 | to scroll to the first such token.
280 | - 64-bit clean
281 |
282 | - Version 2.1. 20120710.
283 | - Removed a -retain which could cause a crash. See Note 20120629.
284 |
285 | - Version 2.0. 20100127.
286 | - Now requires macOS 10.5 or later.
287 | - Known issue: Typing in tokens does not work properly. I'm using it
288 | non-editable at this time.
289 | - Some bindings support has been added.
290 | - To be more of a drop-in replacement for NSTokenField, the attribute "tokens" has been changed to
291 | "objectValue".
292 |
293 | - Version 1.2. 20100116.
294 | - Instead of always changing the selection in response to mouseDown:, the selection is
295 | now changed in response to mouseDown: if the shift or cmd key is down, but instead
296 | in response to mouseUp: if the shift or cmd key is not down. This is the way Apple's
297 | apps do it (I checked Safari's Edit Bookmarks and a Finder browser), and allows
298 | a drag of multiple items to be initiated immediately instead of requiring a wonky
299 | triple-click.
300 | - When the vertical scroller is not needed, the tag cloud content now increases its
301 | width slightly to cover the freed stripe on the right, and vice versa.
302 |
303 | - Version 1.1. 20090730.
304 | - No longer retains the delegate. This was causing a retain cycle in my app, and
305 | I believe that not retaining the delegate would be more conventional Cocoa behavior.
306 |
307 | - Version 1.0.2. 20080206.
308 | - -setTokens now retains old value of _tokens until after triggering change notification
309 | to observer. This was sometimes causing crashes in Tiger but not Leopard.
310 | - The ellipsis token is now better behaved. When clicking the ellipsisToken, instead of
311 | being selected, the leftmost displayed token is scrolled off and, if there is room,
312 | the rightmost token which was truncated is scrolled in. Scrolling can be activated
313 | in either direction by using the arrow keys when the end tag is selected.
314 | - Fixed bug in -keyDown which caused NSArray exception to be logged if down-arrow
315 | key was typed when no tokens were selected.
316 | - Fixed bug in -drawRect which caused focus ring to scroll with the RPTokenControl
317 | when enclosed in a scroll view. Did this by replacing two dozen lines of very stupid
318 | code with three lines of smart code.
319 |
320 | - Version 1.0.1. 20080102.
321 | - Added hysteresis so that drag does not begin until significant mouse movement.
322 |
323 | - Version 1.0.0. 20071226
324 | - Initial release.
325 |
326 |
327 | AUTHOR
328 | RPTokenControl is an adaptation of Robert Pointon's Tag Cloud NSView.
329 | It was adapted by Jerry Krinock jerry at ieee.org in San Jose, California USA.
330 | (I'm not afraid of more spam, but a bug in HeaderDoc does not allow at-sign to be used even if it is backslash-escaped as documented.)
331 | */
332 |
333 | enum RPTokenControlEditability_enum {
334 | RPTokenControlEditability0,
335 | RPTokenControlEditability1,
336 | RPTokenControlEditability2
337 | } ;
338 | typedef enum RPTokenControlEditability_enum RPTokenControlEditability ;
339 |
340 | /*!
341 | @brief Notification which is posted whenever the user deletes tokens
342 | by selecting them and hitting the 'delete' key
343 | @details Note that this can only happen if you have set the receiver's
344 | editability to a value >= RPTokenControlEditability1. The 'object'
345 | of the posted notification will be the affected RPTokenControl. The 'userInfo'
346 | dictionary of the posted notification will contain one key,
347 | RPTokenControlUserDeletedTokensKey, whose value is an array of strings
348 | which are the deleted tokens.
349 |
350 | Note added 20121203: This notification nonsense is maybe very stupid. I'm
351 | thinking that I should have instead declared a delegate method for deleting
352 | tokens from the data model, following the pattern which I have now used for
353 | renaming tokens.
354 | */
355 | extern NSString* const RPTokenControlUserDeletedTokensNotification ;
356 | extern NSString* const RPTokenControlUserDeletedTokensKey ;
357 |
358 | @class RPTokenControl ;
359 |
360 | @protocol RPTokenControlDelegate
361 |
362 | - (void)tokenControl:(RPTokenControl*)control
363 | renameToken:(NSString*)token ;
364 |
365 | /*!
366 | @brief Returns a localized title of a contextual menu item which deletes one
367 | or more tokens
368 | @details Typically, returns, for example, "Delete 'Foo'" if there is only one
369 | token proposed to be deleted, or "Delete 5 Tags" if more than one.
370 |
371 | If the delegate does not implement this method, a default, English menu
372 | item title will appear in the contextual menu.
373 | @param count The number of tokens which will be deleted if the user clicks
374 | the subject menu item
375 | @param tokenName If count is 1, the name of the item which may be deleted.
376 | Otherwise, an arbitrary string which should be ignored.
377 | */
378 | - (NSString*)menuItemTitleToDeleteTokenControl:(RPTokenControl*)tokenControl
379 | count:(NSInteger)count
380 | tokenName:(NSString*)tokenName ;
381 |
382 | @end
383 |
384 | @interface RPTokenControl : NSControl <
385 | NSTextFieldDelegate,
386 | NSDraggingSource,
387 | NSPasteboardWriting,
388 | NSAccessibilityGroup
389 | > {
390 | id m_objectValue ;
391 | NSInteger _maxTokensToDisplay ;
392 | NSInteger _firstTokenToDisplay ;
393 | NSInteger _fancyEffects ;
394 | float _backgroundWhiteness ;
395 | NSInteger _tokenColorScheme ;
396 | float _cornerRadiusFactor ;
397 | float _widthPaddingMultiplier ;
398 | NSInteger _lastSelectedIndex ;
399 | BOOL _appendCountsToStrings ;
400 | BOOL _showsCountsAsToolTips ;
401 | float _minFontSize ;
402 | float _maxFontSize ;
403 | CGFloat m_fixedFontSize ;
404 | RPTokenControlEditability m_editablity ;
405 | BOOL m_canDeleteTags ;
406 | NSArray* _accessibilityChildren;
407 |
408 |
409 | NSImage* _dragImage ;
410 | NSMutableArray* _framedTokens ;
411 | NSMutableArray* _truncatedTokens ;
412 | NSCharacterSet* m_disallowedCharacterSet ;
413 | NSString* m_replacementString ;
414 | NSCharacterSet* m_tokenizingCharacterSet ;
415 | unichar m_tokenizingCharacter ;
416 | NSString* m_noTokensPlaceholder ;
417 | NSString* m_noSelectionPlaceholder ;
418 | NSString* m_multipleValuesPlaceholder ;
419 | NSString* m_notApplicablePlaceholder ;
420 | NSObject * m_delegate ;
421 | NSString* _linkDragType ;
422 | NSMutableIndexSet* _selectedIndexSet ;
423 | NSMutableString* _tokenBeingEdited ;
424 | NSInteger _indexOfFramedTokenBeingEdited ;
425 | NSTextField* _textField ;
426 | BOOL _isDoingLayout ;
427 | NSPoint _mouseDownPoint ; // for hysteresis in beginning drag
428 | }
429 |
430 | @property (retain) NSImage* dragImage ;
431 | @property (retain) NSMutableString* tokenBeingEdited ;
432 | @property (copy) NSString* linkDragType ;
433 | @property (assign) NSObject * delegate ;
434 | @property (retain) NSCharacterSet* disallowedCharacterSet ;
435 | @property (copy) NSString* replacementString ;
436 | @property (retain) NSCharacterSet* tokenizingCharacterSet ;
437 | @property (assign) unichar tokenizingCharacter ;
438 | @property (copy) NSString* noTokensPlaceholder ;
439 | @property (copy) NSString* noSelectionPlaceholder ;
440 | @property (copy) NSString* multipleValuesPlaceholder ;
441 | @property (copy) NSString* notApplicablePlaceholder ;
442 | @property (assign) CGFloat fixedFontSize ;
443 | @property (assign) RPTokenControlEditability editability ;
444 |
445 | /*!
446 | @brief An NSArray of the tokens selected in the control view
447 |
448 | @details tokenizingCharacter and tokenizingCharacterSet have an assymetrical relationship.
449 | Setting a tokenizingCharacter will set tokenizingCharacterSet to a new set
450 | containing that single character. But setting tokenizingCharacterSet will not
451 | affect the value of tokenizingCharacter. When parsing user input for tokenizing
452 | characters, RPTokenControl will always use the current value of tokenizingCharacterSet.
453 |
454 | @result An array of NSStrings. Each string is the text of a selected token. Counts are not provided.
455 | */
456 | - (NSArray*)selectedTokens ;
457 |
458 | /*!
459 | @brief getter for ivar selectedIndexSet
460 | @result an immutable copy of selectedIndexSet
461 | */
462 | - (NSIndexSet*)selectedIndexSet ;
463 |
464 | /*!
465 | @brief setter for ivar selectedIndexSet
466 | @details Makes a mutable copy of the argument.
467 | Make sure that the range of the argument is within the range of tokens
468 | */
469 | - (void)setSelectedIndexSet:(NSIndexSet*)newSelectedIndexSet ;
470 |
471 | /*!
472 | @brief setter for ivar maxTokensToDisplay
473 | @details Invoking this method will recalculate the receiver's layout
474 | and mark the receiver with -setNeedsDisplay.
475 | If not set, all tokens that fit will be displayed
476 | */
477 | - (void)setMaxTokensToDisplay:(NSInteger)maxTokensToDisplay ;
478 |
479 | /*!
480 | @brief setter for the ivar fancyEffects
481 | @details Invoking this method will recalculate the receiver's layout
482 | and mark the receiver with -setNeedsDisplay.
483 | */
484 | - (void)setFancyEffects:(NSInteger)fancyEffects ;
485 |
486 | /*!
487 | @brief setter for ivar backgroundWhiteness
488 | @details Invoking this method will recalculate the receiver's layout
489 | and mark the receiver with -setNeedsDisplay.
490 | */
491 | - (void)setBackgroundWhiteness:(float)whiteness ;
492 |
493 | /*!
494 | @brief setter for ivar tokenColorScheme
495 | @details Invoking this method will recalculate the receiver's layout
496 | and mark the receiver with -setNeedsDisplay.
497 | */
498 | - (void)setTokenColorScheme:(RPTokenControlTokenColorScheme)tokenColorScheme ;
499 |
500 | /*!
501 | @brief setter for ivar cornerRadiusFactor
502 | @details Invoking this method will recalculate the receiver's layout
503 | and mark the receiver with -setNeedsDisplay.
504 | */
505 | - (void)setCornerRadiusFactor:(float)whiteness ;
506 |
507 | /*!
508 | @brief setter for ivar widthPaddingMultiplier
509 | @details Invoking this method will recalculate the receiver's layout
510 | and mark the receiver with -setNeedsDisplay.
511 | */
512 | - (void)setWidthPaddingMultiplier:(float)widthPaddingMultiplier ;
513 |
514 | /*!
515 | @brief setter for ivar appendCountsToStrings
516 | @details Invoking this method will recalculate the receiver's layout
517 | and mark the receiver with -setNeedsDisplay.
518 | */
519 | - (void)setAppendCountsToStrings:(BOOL)yn ;
520 |
521 | /*!
522 | @brief setter for the ivar minFontSize
523 | @details Invoking this method will recalculate the receiver's layout
524 | and mark the receiver with -setNeedsDisplay.
525 | */
526 | - (void)setMinFontSize:(float)x ; // defaults to 11.0 if not set
527 |
528 | /*!
529 | @brief setter for the ivar maxFontSIze
530 | @details Invoking this method will recalculate the receiver's layout
531 | and mark the receiver with -setNeedsDisplay.
532 | */
533 | - (void)setMaxFontSize:(float)x ; // defaults to 40.0 if not set
534 |
535 | /*!
536 | @brief setter for the ivar showsCountsAsToolTips.
537 | @details It would look silly to set this to YES if setAppendCountsToStrings is also YES.
538 | If not set, will default to NO.
539 | */
540 | - (void)setShowsCountsAsToolTips:(BOOL)yn ;
541 |
542 | /*!
543 | @brief setter for ivar editability
544 | */
545 | - (void)setEditability:(RPTokenControlEditability)editability ;
546 |
547 |
548 | @end
549 |
--------------------------------------------------------------------------------