CorkFunctions.h File Reference
Miscellaneous functions and constants available to Corkboard plug-ins.
More...
Detailed Description
Miscellaneous functions and constants available to Corkboard plug-ins.
Function Documentation
| NSComparisonResult CorkCompareVersions |
( |
NSString * |
v1, |
|
|
NSString * |
v2 | |
|
) |
| | |
Compares two strings as if they represented versions.
- v1: The first version to compare.
- v2: The second version to compare.
- Returns:
- The relative order of the two strings when compared as versions.
- Warning:
- If either string does not validly represent a version (i.e. major.minor.revision) then the result is undefined (but the function will return.)
- See also:
- CorkGetVersion()
- Since:
- CorkCore 1.0
| void CorkDeactivate |
( |
void |
|
) |
|
Deactivates the Corkboard UI, if active.
If you need to open an external application or otherwise relieve Corkboard of focus, this function will allow you to dismiss the Corkboard UI.
- Warning:
- You should never call this function without consent from the user.
- Since:
- CorkCore 1.0.1
| NSBundle* CorkGetCorkCoreBundle |
( |
void |
|
) |
|
CorkCore's bundle.
- Returns:
- The bundle belonging to the CorkCore framework, or nil on error.
If you need to access CorkCore's bundle or resources, this method will let you avoid hard-coding CorkCore's bundle identifier or a reference to one of its classes.
- See also:
- CorkGetCorkCoreCFBundle()
- Since:
- CorkCore 1.0
| CFBundleRef CorkGetCorkCoreCFBundle |
( |
void |
|
) |
|
CorkCore's bundle.
- Returns:
- The bundle belonging to the CorkCore framework, or NULL on error.
If you need to access CorkCore's bundle or resources through Core Foundation instead of Cocoa, this method will let you avoid hard-coding CorkCore's bundle identifier.
- See also:
- CorkGetCorkCoreBundle()
- Since:
- CorkCore 1.0
| NSSize CorkGetHistoryItemSize |
( |
void |
|
) |
|
Gets the size of an interpreter instance when it is part of the clipboard history.
- Returns:
- The size of an interpreter instance when it is part of the clipboard history.
When part of the clipboard history, an interpreter instance's view has a fixed size (subject to change in future releases.) This function returns that size, which you can then use to modify what and how you draw the contents of that interpreter instance.
- See also:
- CorkPboardInterpreterIsHistoryItemArgumentKey
- Since:
- CorkCore 1.1
| BOOL CorkGetSizeOfFileAtPath |
( |
NSString * |
path, |
|
|
BOOL |
traverseLinks, |
|
|
uintmax_t * |
outSize | |
|
) |
| | |
Gets the size of the specified file.
- path: The path to the file to be examined.
- traverseLinks: Whether or not to traverse symbolic links and aliases to get to the target file.
- outSize: A pointer to a location in memory large enough to hold a uintmax_t value; the size of the target file in bytes is placed therein.
- Returns:
- On success, YES is returned and the size of the target file is placed in the memory pointed to by outSize. On error, if outSize is NULL, if path refers to a directory, or if path refers to a file that does not exist, NO is returned and the memory pointed to by outSize is not modified.
The file size is calculated including all forks (data fork, resource fork, etc.) of the file, instead of just the data fork (which is all that is examined by NSFileManager and other Cocoa classes.) If you only want to display the size of a file's data fork, you should retrieve the size of the file with NSFileManager, or use the Carbon File Manager functions for it or other forks.
- See also:
- CorkStringFromFileSize(uintmax_t)
CorkStringFromSizeOfFileAtPath(NSString *, BOOL)
- Since:
- CorkCore 1.0
| NSTimeInterval CorkGetSmallestPossibleDuration |
( |
void |
|
) |
|
The smallest time interval that can be represented on the current system.
- Returns:
- The smallest time interval (i.e. the time interval closest to but greater than zero) in seconds.
NSTimeInterval values have finite precision because they are based on a floating-point type (double on all current Mac OS X systems.) This function merely returns the smallest positive time interval that can be represented on the system; not all APIs are able to support this level of precision.
- Since:
- CorkCore 1.0.3
| NSTimeInterval CorkGetStandardAnimationDuration |
( |
NSEvent * |
event |
) |
|
The time interval used by Corkboard for animation durations.
- event: The event from which the time interval is calculated. Pass nil to use the current event.
- Returns:
- The time interval in seconds most Core Animation-based animation uses given the state repesented by event (or the current event if event is nil), or 0.0 on error or if the user has disabled UI animation.
Many visual actions can be animated on Mac OS X. If your interpreter instance wishes to animate some aspect of its view in response to a user action, this function will give you the time interval that works best with the current configuration and state.
For example, if the user is holding down modifier keys such as Shift, that might speed up or slow down animations (exactly what happens being an implementation detail.) Alternatively, the user might have animations disabled, in which case he or she would not want user interface elements to continue animating.
The function's return value can be thought of as a single unit of time. For longer or shorter animations, it often makes sense to use a factor or multiple of the return value.
- Since:
- CorkCore 1.0
| CFUUIDRef CorkGetUUID |
( |
void |
|
) |
|
Gets a newly-generated UUID.
- Returns:
- A new Core Foundation CFUUID object, or NULL on error. This function has Get semantics, not Copy semantics.
UUIDs are useful in a number of situations, but support for them is not provided at the Objective-C level. This function is intended to simplify UUID access.
- See also:
- CorkGetUUIDString()
- Since:
- CorkCore 1.2
| NSString* CorkGetUUIDString |
( |
void |
|
) |
|
Gets the string representation of a newly-generated UUID.
- Returns:
- The string representation of a newly-generated UUID, or nil on error.
UUIDs are useful in a number of situations, but support for them is not provided at the Objective-C level. This function is intended to simplify UUID access.
- See also:
- CorkGetUUID()
- Since:
- CorkCore 1.2
| NSString* CorkGetVersion |
( |
void |
|
) |
|
Retrieves the version string in CorkCore's Info.plist file.
- Returns:
- The version string of CorkCore (which is normally the same as that of of Corkboard), or nil on error. The string is not localized.
You can use this function to check that your interpreter is being used in a particular version of Corkboard, etc. The format of the returned string is the same as a typical CFBundleVersion string (i.e. major.minor.revision).
- See also:
- CorkCompareVersions(NSString *, NSString *)
- Since:
- CorkCore 1.0
| BOOL CorkIsActive |
( |
void |
|
) |
|
Checks whether the Corkboard UI is visible.
- Returns:
- Whether or not the Corkboard UI is visible.
Messages may be sent to instances of your interpreter while the Corkboard UI is hidden; you can use this function to determine whether or not it is visible to the user (and adjust your resource usage accordingly.)
- Returns:
- If the UI is in the process of appearing or disappearing, this function will return YES (as the UI is already/still interactive at these times.) On error, this function will return NO.
- Since:
- CorkCore 1.0
| ScrapFlavorType CorkPasteboardTypeGetScrapManagerFlavor |
( |
NSString * |
pboardType |
) |
|
Converts an NSPasteboard type to a traditional Scrap Manager flavor.
- pboardType: The pasteboard type to convert.
- Returns:
- If pboardType represents a Scrap Manager flavor, that flavor is returned; otherwise, kUnknownType is returned.
When writing data to a pasteboard, the system will frequently duplicate data under Carbon Scrap Manager flavors for technical and compatibility reasons; as well, many Carbon applications, especially older ones, prefer Scrap Manager flavors over Cocoa-style pasteboard types.
When examining available pasteboard data, you may wish to convert a pasteboard type to a Scrap Manager flavor. This function allows you to do that.
- Warning:
- The entire Scrap Manager API is deprecated in Mac OS X 10.5 Leopard and newer, and is unavailable for 64-bit binaries. This function is provided primarily for diagnostic purposes. Also be aware that the Scrap Manager does not provide a one-to-one interface with the Cocoa pasteboard system; data may be provided to your interpreter class from a pasteboard that cannot be accessed through the Scrap Manager, or through pasteboard types that cannot be converted to or from Scrap Manager flavors.
Not available on iPhone OS. There is no Scrap Manager on iPhone OS.
- See also:
- Scrap Manager Reference (ADC) for information on the Scrap Manager.
CorkPasteboardTypeIsScrapManagerFlavor
CorkScrapManagerFlavorGetPasteboardType
- Since:
- CorkCore 1.0.2
| BOOL CorkPasteboardTypeIsDynamicUTI |
( |
NSString * |
pboardType |
) |
|
Whether or not the supplied pasteboard type is a dynamic UTI.
- pboardType: The pasteboard type to examine.
- Returns:
- Whether or not pboardType is a Scrap Manager flavor.
When writing data to a pasteboard, the system will frequently duplicate data under dynamic UTIs for technical reasons. When examining available pasteboard data, you may wish to determine if any of the data is stored under a dynamic UTI. You can use this function to find out.
- See also:
- Uniform Type Identifiers Overview (ADC) for information on UTIs and their use in Mac OS X.
- Since:
- CorkCore 1.0.2
| BOOL CorkPasteboardTypeIsScrapManagerFlavor |
( |
NSString * |
pboardType |
) |
|
Whether or not the supplied pasteboard type is a Scrap Manager flavor.
- pboardType: The pasteboard type to examine.
- Returns:
- Whether or not pboardType is a Scrap Manager flavor.
When writing data to a pasteboard, the system will frequently duplicate data under Carbon Scrap Manager flavors for technical and compatibility reasons; as well, many Carbon applications, especially older ones, prefer Scrap Manager flavors over Cocoa-style pasteboard types.
When examining available pasteboard data, you may wish to determine if any of the data is stored under a Scrap Manager flavor. You can use this function to find out.
- Warning:
- The entire Scrap Manager API is deprecated in Mac OS X 10.5 Leopard and newer, and is unavailable for 64-bit binaries. This function is provided primarily for diagnostic purposes. Also be aware that the Scrap Manager does not provide a one-to-one interface with the Cocoa pasteboard system; data may be provided to your interpreter class from a pasteboard that cannot be accessed through the Scrap Manager, or through pasteboard types that cannot be converted to or from Scrap Manager flavors.
Not available on iPhone OS. There is no Scrap Manager on iPhone OS.
- See also:
- Scrap Manager Reference (ADC) for information on the Scrap Manager.
CorkPasteboardTypeGetScrapManagerFlavor
- Since:
- CorkCore 1.0.2
| NSString* CorkScrapManagerFlavorGetPasteboardType |
( |
ScrapFlavorType |
sft |
) |
|
Converts a traditional Scrap Manager flavor to an NSPasteboard type.
- sft: The Scrap Manager flavor to convert.
- Returns:
- sft encoded as an NSString suitable for use with NSPasteboard.
When writing data to a pasteboard, the system will frequently duplicate data under Carbon Scrap Manager flavors for technical and compatibility reasons; as well, many Carbon applications, especially older ones, prefer Scrap Manager flavors over Cocoa-style pasteboard types.
When examining available pasteboard data, you may wish to convert a Scrap Manager flavor to a pasteboard type. This function allows you to do that.
- Warning:
- The entire Scrap Manager API is deprecated in Mac OS X 10.5 Leopard and newer, and is unavailable for 64-bit binaries. This function is provided primarily for diagnostic purposes. Also be aware that the Scrap Manager does not provide a one-to-one interface with the Cocoa pasteboard system; data may be provided to your interpreter class from a pasteboard that cannot be accessed through the Scrap Manager, or through pasteboard types that cannot be converted to or from Scrap Manager flavors.
Not available on iPhone OS. There is no Scrap Manager on iPhone OS.
- See also:
- Scrap Manager Reference (ADC) for information on the Scrap Manager.
CorkPasteboardTypeGetScrapManagerFlavor
- Since:
- CorkCore 1.3
| NSString* CorkStringFromFileSize |
( |
uintmax_t |
sz |
) |
|
Converts a file or data size to a localized string representing that value.
- sz: The file or data size, in bytes.
- Returns:
- A localized string representation of sz. The string is suitable for display, not for storage or parsing.
The file size is scaled as appropriate; for example, if the size is 1,048,576 bytes, the string returned describes (in a localized fashion) 1.0 mebibytes. For example, on a computer in Russia, the returned string might equal "1,0 МБ"; the same string in England might equal "1.0 MB"; in France it might equal "1,0 Mo". The number of significant digits is an implementation detail.
The user's current locale is used as the basis for localization.
- See also:
- CorkStringFromSizeOfFileAtPath(NSString *, BOOL)
CorkGetSizeOfFileAtPath(NSString *, BOOL, uintmax_t *)
- Since:
- CorkCore 1.0
| NSString* CorkStringFromSizeOfFileAtPath |
( |
NSString * |
path, |
|
|
BOOL |
traverseLinks | |
|
) |
| | |