view dstep/coreservices/launchservices/LSInfo.d @ 11:07194b026fa4

Added bindings to a couple of frameworks, new license + some other things
author Jacob Carlborg <doob@me.com>
date Sat, 01 Aug 2009 15:03:28 +0200
parents
children
line wrap: on
line source

/**
 * Copyright: Copyright (c) 2009 Jacob Carlborg.
 * Authors: Jacob Carlborg
 * Version: Initial created: Jul 22, 2009 
 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
 */
module dstep.coreservices.launchservices.LSInfo;

//import dstep.AvailabilityMacros;
import dstep.coreservices.carboncore.CarbonCore;
import dstep.corefoundation.CoreFoundation;

alias uint LSInitializeFlags;
alias uint LSRequestedInfo;
alias uint LSItemInfoFlags;
alias uint LSRolesMask;
alias uint LSAcceptanceFlags;
alias uint LSHandlerOptions;

extern (C)
{
	extern
	{
		const CFStringRef kLSItemContentType;
		const CFStringRef kLSItemFileType;
		const CFStringRef kLSItemFileCreator;
		const CFStringRef kLSItemExtension;
		const CFStringRef kLSItemDisplayName;
		const CFStringRef kLSItemDisplayKind;
		const CFStringRef kLSItemRoleHandlerDisplayName;
		const CFStringRef kLSItemIsInvisible;
		const CFStringRef kLSItemExtensionIsHidden;
		const CFStringRef kLSItemQuarantineProperties;
	}
}

enum
{
	kLSAppInTrashErr = -10660,
	kLSExecutableIncorrectFormat = -10661,
	kLSAttributeNotFoundErr = -10662,
	kLSAttributeNotSettableErr = -10663,
	kLSUnknownErr = -10810,
	kLSNotAnApplicationErr = -10811,
	kLSNotInitializedErr = -10812,
	kLSDataUnavailableErr = -10813,
	kLSApplicationNotFoundErr = -10814,
	kLSUnknownTypeErr = -10815,
	kLSDataTooOldErr = -10816,
	kLSDataErr = -10817,
	kLSLaunchInProgressErr = -10818,
	kLSNotRegisteredErr = -10819,
	kLSAppDoesNotClaimTypeErr = -10820,
	kLSAppDoesNotSupportSchemeWarning = -10821,
	kLSServerCommunicationErr = -10822,
	kLSCannotSetInfoErr = -10823,
	kLSNoRegistrationInfoErr = -10824,
	kLSIncompatibleSystemVersionErr = -10825,
	kLSNoLaunchPermissionErr = -10826,
	kLSNoExecutableErr = -10827,
	kLSNoClassicEnvironmentErr = -10828,
	kLSMultipleSessionsNotSupportedErr = -10829
}

enum
{
	kLSInitializeDefaults = 0x00000001
}

enum
{
	kLSMinCatInfoBitmap = (kFSCatInfoNodeFlags | kFSCatInfoParentDirID | kFSCatInfoFinderInfo | kFSCatInfoFinderXInfo)
}

enum
{
	kLSRequestExtension = 0x00000001,
	kLSRequestTypeCreator = 0x00000002,
	kLSRequestBasicFlagsOnly = 0x00000004,
	kLSRequestAppTypeFlags = 0x00000008,
	kLSRequestAllFlags = 0x00000010,
	kLSRequestIconAndKind = 0x00000020,
	kLSRequestExtensionFlagsOnly = 0x00000040,
	kLSRequestAllInfo = cast(uint)0xFFFFFFFF
}

enum
{
	kLSItemInfoIsPlainFile = 0x00000001,
	kLSItemInfoIsPackage = 0x00000002,
	kLSItemInfoIsApplication = 0x00000004,
	kLSItemInfoIsContainer = 0x00000008,
	kLSItemInfoIsAliasFile = 0x00000010,
	kLSItemInfoIsSymlink = 0x00000020,
	kLSItemInfoIsInvisible = 0x00000040,
	kLSItemInfoIsNativeApp = 0x00000080,
	kLSItemInfoIsClassicApp = 0x00000100,
	kLSItemInfoAppPrefersNative = 0x00000200,
	kLSItemInfoAppPrefersClassic = 0x00000400,
	kLSItemInfoAppIsScriptable = 0x00000800,
	kLSItemInfoIsVolume = 0x00001000,
	kLSItemInfoExtensionIsHidden = 0x00100000
}

enum
{
	kLSRolesNone = 0x00000001,
	kLSRolesViewer = 0x00000002,
	kLSRolesEditor = 0x00000004,
	kLSRolesShell = 0x00000008,
	kLSRolesAll = cast(uint)0xFFFFFFFF
}

enum
{
	kLSUnknownType = 0,
	kLSUnknownCreator = 0
}

enum
{
	kLSAcceptDefault = 0x00000001,
	kLSAcceptAllowLoginUI = 0x00000002
}

enum
{
	kLSHandlerOptionsDefault = 0,
	kLSHandlerOptionsIgnoreCreator = 1
}

struct LSItemInfoRecord
{
	uint flags;
	uint filetype;
	uint creator;
	CFStringRef extension;
}

extern (C)
{
	int LSInit (uint inFlags);
	int LSTerm ();
	int LSCopyItemInfoForRef (FSRef* inItemRef, uint inWhichInfo, LSItemInfoRecord* outItemInfo);
	int LSCopyItemInfoForURL (CFURLRef inURL, uint inWhichInfo, LSItemInfoRecord* outItemInfo);
	int LSGetExtensionInfo (uint inNameLen, wchar* inNameBuffer, UniCharCount* outExtStartIndex);
	int LSCopyDisplayNameForRef (FSRef* inRef, CFStringRef* outDisplayName);
	int LSCopyDisplayNameForURL (CFURLRef inURL, CFStringRef* outDisplayName);
	int LSSetExtensionHiddenForRef (FSRef* inRef, ubyte inHide);
	int LSSetExtensionHiddenForURL (CFURLRef inURL, ubyte inHide);
	int LSCopyKindStringForRef (FSRef* inFSRef, CFStringRef* outKindString);
	int LSCopyKindStringForURL (CFURLRef inURL, CFStringRef* outKindString);
	int LSCopyKindStringForTypeInfo (uint inType, uint inCreator, CFStringRef inExtension, CFStringRef* outKindString);
	int LSCopyKindStringForMIMEType (CFStringRef inMIMEType, CFStringRef* outKindString);
	int LSGetApplicationForItem (FSRef* inItemRef, uint inRoleMask, FSRef* outAppRef, CFURLRef* outAppURL);
	int LSGetApplicationForInfo (uint inType, uint inCreator, CFStringRef inExtension, uint inRoleMask, FSRef* outAppRef, CFURLRef* outAppURL);
	int LSCopyApplicationForMIMEType (CFStringRef inMIMEType, uint inRoleMask, CFURLRef* outAppURL);
	int LSGetApplicationForURL (CFURLRef inURL, uint inRoleMask, FSRef* outAppRef, CFURLRef* outAppURL);
	int LSFindApplicationForInfo (uint inCreator, CFStringRef inBundleID, CFStringRef inName, FSRef* outAppRef, CFURLRef* outAppURL);
	int LSCanRefAcceptItem (FSRef* inItemFSRef, FSRef* inTargetRef, uint inRoleMask, uint inFlags, char* outAcceptsItem);
	int LSCanURLAcceptURL (CFURLRef inItemURL, CFURLRef inTargetURL, uint inRoleMask, uint inFlags, char* outAcceptsItem);
	int LSRegisterURL (CFURLRef inURL, ubyte inUpdate);
	int LSRegisterFSRef (FSRef* inRef, ubyte inUpdate);
	CFArrayRef LSCopyApplicationURLsForURL (CFURLRef inURL, uint inRoleMask);
	int LSCopyItemAttribute (FSRef* inItem, uint inRoles, CFStringRef inAttributeName, CFTypeRef* outValue);
	int LSCopyItemAttributes (FSRef* inItem, uint inRoles, CFArrayRef inAttributeNames, CFDictionaryRef* outValues);
	int LSSetItemAttribute (FSRef* inItem, uint inRoles, CFStringRef inAttributeName, CFTypeRef inValue);
	CFStringRef LSCopyDefaultRoleHandlerForContentType (CFStringRef inContentType, uint inRole);
	CFArrayRef LSCopyAllRoleHandlersForContentType (CFStringRef inContentType, uint inRole);
	int LSSetDefaultRoleHandlerForContentType (CFStringRef inContentType, uint inRole, CFStringRef inHandlerBundleID);
	uint LSGetHandlerOptionsForContentType (CFStringRef inContentType);
	int LSSetHandlerOptionsForContentType (CFStringRef inContentType, uint inOptions);
	CFStringRef LSCopyDefaultHandlerForURLScheme (CFStringRef inURLScheme);
	CFArrayRef LSCopyAllHandlersForURLScheme (CFStringRef inURLScheme);
	int LSSetDefaultHandlerForURLScheme (CFStringRef inURLScheme, CFStringRef inHandlerBundleID);
}