# HG changeset patch # User Jacob Carlborg # Date 1262552771 -3600 # Node ID 19885b43130eb94bbec7266bb47a0188446b716a # Parent 7ff919f595d5183f444b288379a7b444066411a1 Huge update, the bridge actually works now diff -r 7ff919f595d5 -r 19885b43130e .hgignore --- a/.hgignore Mon Aug 03 15:31:48 2009 +0200 +++ b/.hgignore Sun Jan 03 22:06:11 2010 +0100 @@ -2,9 +2,10 @@ *.DS_Store *.o dsss_objs +dsss_docs +dsss_imports dsss.last *.orig -dsss_imports *.sh *.a *.rf diff -r 7ff919f595d5 -r 19885b43130e dsss.conf --- a/dsss.conf Mon Aug 03 15:31:48 2009 +0200 +++ b/dsss.conf Sun Jan 03 22:06:11 2010 +0100 @@ -1,2 +1,14 @@ [dstep] -exclude += dstep/foundation \ No newline at end of file +#target=cocoa-d-test + +version (GNU){ + buildflags += -framework Foundation -framework ApplicationServices -framework CoreFoundation -framework CoreServices -framework DiskArbitration -framework Security -framework QuartzCore -framework QTKit -framework AppKit +} + +version (LDC) { + buildflags += -L-framework -LFoundation -L-framework -LApplicationServices -L-framework -LCoreFoundation -L-framework -LCoreServices -L-framework -LDiskArbitration -L-framework -LSecurity -L-framework -LQuartzCore -L-framework -LQTKit -L-framework -LAppKit +} + +version (DigitalMars) { + buildflags += -L-framework -LFoundation -L-framework -LApplicationServices -L-framework -LCoreFoundation -L-framework -LCoreServices -L-framework -LDiskArbitration -L-framework -LSecurity -L-framework -LQuartzCore -L-framework -LQTKit -L-framework -LAppKit +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/AppKit.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/AppKit.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,180 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.AppKit; + +public: + +import dstep.appkit.AppKitDefines; +import dstep.appkit.AppKitErrors; +import dstep.appkit.NSATSTypesetter; +import dstep.appkit.NSAccessibility; +import dstep.appkit.NSActionCell; +import dstep.appkit.NSAffineTransform; +import dstep.appkit.NSAlert; +import dstep.appkit.NSAnimation; +import dstep.appkit.NSAnimationContext; +import dstep.appkit.NSAppleScriptExtensions; +import dstep.appkit.NSApplication; +import dstep.appkit.NSApplicationScripting; +import dstep.appkit.NSArrayController; +import dstep.appkit.NSAttributedString; +import dstep.appkit.NSBezierPath; +import dstep.appkit.NSBitmapImageRep; +import dstep.appkit.NSBox; +import dstep.appkit.NSBrowser; +import dstep.appkit.NSBrowserCell; +import dstep.appkit.NSButton; +import dstep.appkit.NSButtonCell; +import dstep.appkit.NSCIImageRep; +import dstep.appkit.NSCachedImageRep; +import dstep.appkit.NSCell; +import dstep.appkit.NSClipView; +import dstep.appkit.NSCollectionView; +import dstep.appkit.NSColor; +import dstep.appkit.NSColorList; +import dstep.appkit.NSColorPanel; +import dstep.appkit.NSColorPicker; +import dstep.appkit.NSColorPicking; +import dstep.appkit.NSColorSpace; +import dstep.appkit.NSColorWell; +import dstep.appkit.NSComboBox; +import dstep.appkit.NSComboBoxCell; +import dstep.appkit.NSControl; +import dstep.appkit.NSController; +import dstep.appkit.NSCursor; +import dstep.appkit.NSCustomImageRep; +import dstep.appkit.NSDatePicker; +import dstep.appkit.NSDatePickerCell; +import dstep.appkit.NSDictionaryController; +import dstep.appkit.NSDockTile; +import dstep.appkit.NSDocument; +import dstep.appkit.NSDocumentController; +import dstep.appkit.NSDocumentScripting; +import dstep.appkit.NSDragging; +import dstep.appkit.NSDrawer; +import dstep.appkit.NSEPSImageRep; +import dstep.appkit.NSErrors; +import dstep.appkit.NSEvent; +import dstep.appkit.NSFileWrapper; +import dstep.appkit.NSFont; +import dstep.appkit.NSFontDescriptor; +import dstep.appkit.NSFontManager; +import dstep.appkit.NSFontPanel; +import dstep.appkit.NSForm; +import dstep.appkit.NSFormCell; +import dstep.appkit.NSGlyphGenerator; +import dstep.appkit.NSGlyphInfo; +import dstep.appkit.NSGradient; +import dstep.appkit.NSGraphics; +import dstep.appkit.NSGraphicsContext; +import dstep.appkit.NSHelpManager; +import dstep.appkit.NSImage; +import dstep.appkit.NSImageCell; +import dstep.appkit.NSImageRep; +import dstep.appkit.NSImageView; +import dstep.appkit.NSInputManager; +import dstep.appkit.NSInputServer; +import dstep.appkit.NSInterfaceStyle; +import dstep.appkit.NSKeyValueBinding; +import dstep.appkit.NSLayoutManager; +import dstep.appkit.NSLevelIndicator; +import dstep.appkit.NSLevelIndicatorCell; +import dstep.appkit.NSMatrix; +import dstep.appkit.NSMenu; +import dstep.appkit.NSMenuItem; +import dstep.appkit.NSMenuItemCell; +import dstep.appkit.NSMenuView; +import dstep.appkit.NSMovie; +import dstep.appkit.NSMovieView; +import dstep.appkit.NSNib; +import dstep.appkit.NSNibDeclarations; +import dstep.appkit.NSNibLoading; +import dstep.appkit.NSObjectController; +import dstep.appkit.NSOpenGL; +import dstep.appkit.NSOpenGLView; +import dstep.appkit.NSOpenPanel; +import dstep.appkit.NSOutlineView; +import dstep.appkit.NSPDFImageRep; +import dstep.appkit.NSPICTImageRep; +import dstep.appkit.NSPageLayout; +import dstep.appkit.NSPanel; +import dstep.appkit.NSParagraphStyle; +import dstep.appkit.NSPasteboard; +import dstep.appkit.NSPathCell; +import dstep.appkit.NSPathComponentCell; +import dstep.appkit.NSPathControl; +import dstep.appkit.NSPersistentDocument; +import dstep.appkit.NSPopUpButton; +import dstep.appkit.NSPopUpButtonCell; +import dstep.appkit.NSPredicateEditor; +import dstep.appkit.NSPredicateEditorRowTemplate; +import dstep.appkit.NSPrintInfo; +import dstep.appkit.NSPrintOperation; +import dstep.appkit.NSPrintPanel; +import dstep.appkit.NSPrinter; +import dstep.appkit.NSProgressIndicator; +import dstep.appkit.NSQuickDrawView; +import dstep.appkit.NSResponder; +import dstep.appkit.NSRuleEditor; +import dstep.appkit.NSRulerMarker; +import dstep.appkit.NSRulerView; +import dstep.appkit.NSSavePanel; +import dstep.appkit.NSScreen; +import dstep.appkit.NSScrollView; +import dstep.appkit.NSScroller; +import dstep.appkit.NSSearchField; +import dstep.appkit.NSSearchFieldCell; +import dstep.appkit.NSSecureTextField; +import dstep.appkit.NSSegmentedCell; +import dstep.appkit.NSSegmentedControl; +import dstep.appkit.NSShadow; +import dstep.appkit.NSSlider; +import dstep.appkit.NSSliderCell; +import dstep.appkit.NSSound; +import dstep.appkit.NSSpeechRecognizer; +import dstep.appkit.NSSpeechSynthesizer; +import dstep.appkit.NSSpellChecker; +import dstep.appkit.NSSpellProtocol; +import dstep.appkit.NSSplitView; +import dstep.appkit.NSStatusBar; +import dstep.appkit.NSStatusItem; +import dstep.appkit.NSStepper; +import dstep.appkit.NSStepperCell; +import dstep.appkit.NSStringDrawing; +import dstep.appkit.NSTabView; +import dstep.appkit.NSTabViewItem; +import dstep.appkit.NSTableColumn; +import dstep.appkit.NSTableHeaderCell; +import dstep.appkit.NSTableHeaderView; +import dstep.appkit.NSTableView; +import dstep.appkit.NSText; +import dstep.appkit.NSTextAttachment; +import dstep.appkit.NSTextContainer; +import dstep.appkit.NSTextField; +import dstep.appkit.NSTextFieldCell; +import dstep.appkit.NSTextInputClient; +import dstep.appkit.NSTextList; +import dstep.appkit.NSTextStorage; +import dstep.appkit.NSTextStorageScripting; +import dstep.appkit.NSTextTable; +import dstep.appkit.NSTextView; +import dstep.appkit.NSTokenField; +import dstep.appkit.NSTokenFieldCell; +import dstep.appkit.NSToolbar; +import dstep.appkit.NSToolbarItem; +import dstep.appkit.NSToolbarItemGroup; +import dstep.appkit.NSTrackingArea; +import dstep.appkit.NSTreeController; +import dstep.appkit.NSTreeNode; +import dstep.appkit.NSUserDefaultsController; +import dstep.appkit.NSView; +import dstep.appkit.NSViewController; +import dstep.appkit.NSWindow; +import dstep.appkit.NSWindowController; +import dstep.appkit.NSWindowScripting; +import dstep.appkit.NSWorkspace; +import dstep.foundation.Foundation; diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/AppKitDefines.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/AppKitDefines.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,12 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.AppKitDefines; + +//import dstep.AvailabilityMacros; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/AppKitErrors.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/AppKitErrors.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,28 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.AppKitErrors; + +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +enum +{ + NSTextReadInapplicableDocumentTypeError = 65806, + NSTextWriteInapplicableDocumentTypeError = 66062, + NSTextReadWriteErrorMinimum = 65792, + NSTextReadWriteErrorMaximum = 66303, + NSServiceApplicationNotFoundError = 66560, + NSServiceApplicationLaunchFailedError = 66561, + NSServiceRequestTimedOutError = 66562, + NSServiceInvalidPasteboardDataError = 66563, + NSServiceMalformedServiceDictionaryError = 66564, + NSServiceMiscellaneousError = 66800, + NSServiceErrorMinimum = 66560, + NSServiceErrorMaximum = 66817 +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSATSTypesetter.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSATSTypesetter.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,40 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSATSTypesetter; + +//import dstep.appkit.NSParagraphStyle; +import dstep.appkit.NSTypesetter; +import dstep.foundation.NSGeometry; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +const TNSPantherCompatibility = ` + + NSRect lineFragmentRectForProposedRect (NSRect proposedRect, NSRectPointer remainingRect) + { + return invokeObjcSelf!(NSRect, "lineFragmentRectForProposedRect:remainingRect:", NSRect, NSRectPointer)(proposedRect, remainingRect); + } + + //mixin ObjcBindMethod!(lineFragmentRectForProposedRect, "lineFragmentRectForProposedRect:remainingRect:"); + +`; + +class NSATSTypesetter : NSTypesetter +{ + mixin (ObjcWrap); + + static NSATSTypesetter sharedTypesetter () + { + return invokeObjcSelfClass!(NSATSTypesetter, "sharedTypesetter"); + } + + // NSPantherCompatibility + NSRect lineFragmentRectForProposedRect (NSRect proposedRect, NSRectPointer remainingRect) + { + return invokeObjcSelf!(NSRect, "lineFragmentRectForProposedRect:remainingRect:", NSRect, NSRectPointer)(proposedRect, remainingRect); + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSAccessibility.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSAccessibility.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,2380 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSAccessibility; + +import dstep.appkit.AppKitDefines; +import dstep.foundation.NSArray; +import dstep.appkit.NSErrors; +import dstep.foundation.NSString; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.appkit.NSAccessibility_bindings; + +private +{ + NSString NSAccessibilityErrorCodeExceptionInfo_; + NSString NSAccessibilityRoleAttribute_; + NSString NSAccessibilityRoleDescriptionAttribute_; + NSString NSAccessibilitySubroleAttribute_; + NSString NSAccessibilityHelpAttribute_; + NSString NSAccessibilityValueAttribute_; + NSString NSAccessibilityMinValueAttribute_; + NSString NSAccessibilityMaxValueAttribute_; + NSString NSAccessibilityEnabledAttribute_; + NSString NSAccessibilityFocusedAttribute_; + NSString NSAccessibilityParentAttribute_; + NSString NSAccessibilityChildrenAttribute_; + NSString NSAccessibilityWindowAttribute_; + NSString NSAccessibilityTopLevelUIElementAttribute_; + NSString NSAccessibilitySelectedChildrenAttribute_; + NSString NSAccessibilityVisibleChildrenAttribute_; + NSString NSAccessibilityPositionAttribute_; + NSString NSAccessibilitySizeAttribute_; + NSString NSAccessibilityContentsAttribute_; + NSString NSAccessibilityTitleAttribute_; + NSString NSAccessibilityDescriptionAttribute_; + NSString NSAccessibilityShownMenuAttribute_; + NSString NSAccessibilityValueDescriptionAttribute_; + NSString NSAccessibilityPreviousContentsAttribute_; + NSString NSAccessibilityNextContentsAttribute_; + NSString NSAccessibilityHeaderAttribute_; + NSString NSAccessibilityEditedAttribute_; + NSString NSAccessibilityTabsAttribute_; + NSString NSAccessibilityHorizontalScrollBarAttribute_; + NSString NSAccessibilityVerticalScrollBarAttribute_; + NSString NSAccessibilityOverflowButtonAttribute_; + NSString NSAccessibilityIncrementButtonAttribute_; + NSString NSAccessibilityDecrementButtonAttribute_; + NSString NSAccessibilityFilenameAttribute_; + NSString NSAccessibilityExpandedAttribute_; + NSString NSAccessibilitySelectedAttribute_; + NSString NSAccessibilitySplittersAttribute_; + NSString NSAccessibilityDocumentAttribute_; + NSString NSAccessibilityURLAttribute_; + NSString NSAccessibilityIndexAttribute_; + NSString NSAccessibilityRowCountAttribute_; + NSString NSAccessibilityColumnCountAttribute_; + NSString NSAccessibilityOrderedByRowAttribute_; + NSString NSAccessibilityTitleUIElementAttribute_; + NSString NSAccessibilityServesAsTitleForUIElementsAttribute_; + NSString NSAccessibilityLinkedUIElementsAttribute_; + NSString NSAccessibilitySelectedTextAttribute_; + NSString NSAccessibilitySelectedTextRangeAttribute_; + NSString NSAccessibilityNumberOfCharactersAttribute_; + NSString NSAccessibilityVisibleCharacterRangeAttribute_; + NSString NSAccessibilitySharedTextUIElementsAttribute_; + NSString NSAccessibilitySharedCharacterRangeAttribute_; + NSString NSAccessibilityInsertionPointLineNumberAttribute_; + NSString NSAccessibilitySelectedTextRangesAttribute_; + NSString NSAccessibilityLineForIndexParameterizedAttribute_; + NSString NSAccessibilityRangeForLineParameterizedAttribute_; + NSString NSAccessibilityStringForRangeParameterizedAttribute_; + NSString NSAccessibilityRangeForPositionParameterizedAttribute_; + NSString NSAccessibilityRangeForIndexParameterizedAttribute_; + NSString NSAccessibilityBoundsForRangeParameterizedAttribute_; + NSString NSAccessibilityRTFForRangeParameterizedAttribute_; + NSString NSAccessibilityStyleRangeForIndexParameterizedAttribute_; + NSString NSAccessibilityAttributedStringForRangeParameterizedAttribute_; + NSString NSAccessibilityFontTextAttribute_; + NSString NSAccessibilityForegroundColorTextAttribute_; + NSString NSAccessibilityBackgroundColorTextAttribute_; + NSString NSAccessibilityUnderlineColorTextAttribute_; + NSString NSAccessibilityStrikethroughColorTextAttribute_; + NSString NSAccessibilityUnderlineTextAttribute_; + NSString NSAccessibilitySuperscriptTextAttribute_; + NSString NSAccessibilityStrikethroughTextAttribute_; + NSString NSAccessibilityShadowTextAttribute_; + NSString NSAccessibilityAttachmentTextAttribute_; + NSString NSAccessibilityLinkTextAttribute_; + NSString NSAccessibilityMisspelledTextAttribute_; + NSString NSAccessibilityFontNameKey_; + NSString NSAccessibilityFontFamilyKey_; + NSString NSAccessibilityVisibleNameKey_; + NSString NSAccessibilityFontSizeKey_; + NSString NSAccessibilityMainAttribute_; + NSString NSAccessibilityMinimizedAttribute_; + NSString NSAccessibilityCloseButtonAttribute_; + NSString NSAccessibilityZoomButtonAttribute_; + NSString NSAccessibilityMinimizeButtonAttribute_; + NSString NSAccessibilityToolbarButtonAttribute_; + NSString NSAccessibilityProxyAttribute_; + NSString NSAccessibilityGrowAreaAttribute_; + NSString NSAccessibilityModalAttribute_; + NSString NSAccessibilityDefaultButtonAttribute_; + NSString NSAccessibilityCancelButtonAttribute_; + NSString NSAccessibilityMenuBarAttribute_; + NSString NSAccessibilityWindowsAttribute_; + NSString NSAccessibilityFrontmostAttribute_; + NSString NSAccessibilityHiddenAttribute_; + NSString NSAccessibilityMainWindowAttribute_; + NSString NSAccessibilityFocusedWindowAttribute_; + NSString NSAccessibilityFocusedUIElementAttribute_; + NSString NSAccessibilityOrientationAttribute_; + NSString NSAccessibilityVerticalOrientationValue_; + NSString NSAccessibilityHorizontalOrientationValue_; + NSString NSAccessibilityColumnTitlesAttribute_; + NSString NSAccessibilitySearchButtonAttribute_; + NSString NSAccessibilitySearchMenuAttribute_; + NSString NSAccessibilityClearButtonAttribute_; + NSString NSAccessibilityRowsAttribute_; + NSString NSAccessibilityVisibleRowsAttribute_; + NSString NSAccessibilitySelectedRowsAttribute_; + NSString NSAccessibilityColumnsAttribute_; + NSString NSAccessibilityVisibleColumnsAttribute_; + NSString NSAccessibilitySelectedColumnsAttribute_; + NSString NSAccessibilitySortDirectionAttribute_; + NSString NSAccessibilityAscendingSortDirectionValue_; + NSString NSAccessibilityDescendingSortDirectionValue_; + NSString NSAccessibilityUnknownSortDirectionValue_; + NSString NSAccessibilityDisclosingAttribute_; + NSString NSAccessibilityDisclosedRowsAttribute_; + NSString NSAccessibilityDisclosedByRowAttribute_; + NSString NSAccessibilityDisclosureLevelAttribute_; + NSString NSAccessibilityAllowedValuesAttribute_; + NSString NSAccessibilityLabelUIElementsAttribute_; + NSString NSAccessibilityLabelValueAttribute_; + NSString NSAccessibilityMatteHoleAttribute_; + NSString NSAccessibilityMatteContentUIElementAttribute_; + NSString NSAccessibilityMarkerUIElementsAttribute_; + NSString NSAccessibilityMarkerValuesAttribute_; + NSString NSAccessibilityMarkerGroupUIElementAttribute_; + NSString NSAccessibilityUnitsAttribute_; + NSString NSAccessibilityUnitDescriptionAttribute_; + NSString NSAccessibilityMarkerTypeAttribute_; + NSString NSAccessibilityMarkerTypeDescriptionAttribute_; + NSString NSAccessibilityLeftTabStopMarkerTypeValue_; + NSString NSAccessibilityRightTabStopMarkerTypeValue_; + NSString NSAccessibilityCenterTabStopMarkerTypeValue_; + NSString NSAccessibilityDecimalTabStopMarkerTypeValue_; + NSString NSAccessibilityHeadIndentMarkerTypeValue_; + NSString NSAccessibilityTailIndentMarkerTypeValue_; + NSString NSAccessibilityFirstLineIndentMarkerTypeValue_; + NSString NSAccessibilityUnknownMarkerTypeValue_; + NSString NSAccessibilityInchesUnitValue_; + NSString NSAccessibilityCentimetersUnitValue_; + NSString NSAccessibilityPointsUnitValue_; + NSString NSAccessibilityPicasUnitValue_; + NSString NSAccessibilityUnknownUnitValue_; + NSString NSAccessibilityPressAction_; + NSString NSAccessibilityIncrementAction_; + NSString NSAccessibilityDecrementAction_; + NSString NSAccessibilityConfirmAction_; + NSString NSAccessibilityPickAction_; + NSString NSAccessibilityCancelAction_; + NSString NSAccessibilityRaiseAction_; + NSString NSAccessibilityShowMenuAction_; + NSString NSAccessibilityDeleteAction_; + NSString NSAccessibilityMainWindowChangedNotification_; + NSString NSAccessibilityFocusedWindowChangedNotification_; + NSString NSAccessibilityFocusedUIElementChangedNotification_; + NSString NSAccessibilityApplicationActivatedNotification_; + NSString NSAccessibilityApplicationDeactivatedNotification_; + NSString NSAccessibilityApplicationHiddenNotification_; + NSString NSAccessibilityApplicationShownNotification_; + NSString NSAccessibilityWindowCreatedNotification_; + NSString NSAccessibilityWindowMovedNotification_; + NSString NSAccessibilityWindowResizedNotification_; + NSString NSAccessibilityWindowMiniaturizedNotification_; + NSString NSAccessibilityWindowDeminiaturizedNotification_; + NSString NSAccessibilityDrawerCreatedNotification_; + NSString NSAccessibilitySheetCreatedNotification_; + NSString NSAccessibilityUIElementDestroyedNotification_; + NSString NSAccessibilityValueChangedNotification_; + NSString NSAccessibilityTitleChangedNotification_; + NSString NSAccessibilityResizedNotification_; + NSString NSAccessibilityMovedNotification_; + NSString NSAccessibilityCreatedNotification_; + NSString NSAccessibilityHelpTagCreatedNotification_; + NSString NSAccessibilitySelectedTextChangedNotification_; + NSString NSAccessibilityRowCountChangedNotification_; + NSString NSAccessibilitySelectedChildrenChangedNotification_; + NSString NSAccessibilitySelectedRowsChangedNotification_; + NSString NSAccessibilitySelectedColumnsChangedNotification_; + NSString NSAccessibilityUnknownRole_; + NSString NSAccessibilityButtonRole_; + NSString NSAccessibilityRadioButtonRole_; + NSString NSAccessibilityCheckBoxRole_; + NSString NSAccessibilitySliderRole_; + NSString NSAccessibilityTabGroupRole_; + NSString NSAccessibilityTextFieldRole_; + NSString NSAccessibilityStaticTextRole_; + NSString NSAccessibilityTextAreaRole_; + NSString NSAccessibilityScrollAreaRole_; + NSString NSAccessibilityPopUpButtonRole_; + NSString NSAccessibilityMenuButtonRole_; + NSString NSAccessibilityTableRole_; + NSString NSAccessibilityApplicationRole_; + NSString NSAccessibilityGroupRole_; + NSString NSAccessibilityRadioGroupRole_; + NSString NSAccessibilityListRole_; + NSString NSAccessibilityScrollBarRole_; + NSString NSAccessibilityValueIndicatorRole_; + NSString NSAccessibilityImageRole_; + NSString NSAccessibilityMenuBarRole_; + NSString NSAccessibilityMenuRole_; + NSString NSAccessibilityMenuItemRole_; + NSString NSAccessibilityColumnRole_; + NSString NSAccessibilityRowRole_; + NSString NSAccessibilityToolbarRole_; + NSString NSAccessibilityBusyIndicatorRole_; + NSString NSAccessibilityProgressIndicatorRole_; + NSString NSAccessibilityWindowRole_; + NSString NSAccessibilityDrawerRole_; + NSString NSAccessibilitySystemWideRole_; + NSString NSAccessibilityOutlineRole_; + NSString NSAccessibilityIncrementorRole_; + NSString NSAccessibilityBrowserRole_; + NSString NSAccessibilityComboBoxRole_; + NSString NSAccessibilitySplitGroupRole_; + NSString NSAccessibilitySplitterRole_; + NSString NSAccessibilityColorWellRole_; + NSString NSAccessibilityGrowAreaRole_; + NSString NSAccessibilitySheetRole_; + NSString NSAccessibilityHelpTagRole_; + NSString NSAccessibilityMatteRole_; + NSString NSAccessibilityRulerRole_; + NSString NSAccessibilityRulerMarkerRole_; + NSString NSAccessibilitySortButtonRole_; + NSString NSAccessibilityLinkRole_; + NSString NSAccessibilityDisclosureTriangleRole_; + NSString NSAccessibilityGridRole_; + NSString NSAccessibilityUnknownSubrole_; + NSString NSAccessibilityCloseButtonSubrole_; + NSString NSAccessibilityZoomButtonSubrole_; + NSString NSAccessibilityMinimizeButtonSubrole_; + NSString NSAccessibilityToolbarButtonSubrole_; + NSString NSAccessibilityTableRowSubrole_; + NSString NSAccessibilityOutlineRowSubrole_; + NSString NSAccessibilitySecureTextFieldSubrole_; + NSString NSAccessibilityStandardWindowSubrole_; + NSString NSAccessibilityDialogSubrole_; + NSString NSAccessibilitySystemDialogSubrole_; + NSString NSAccessibilityFloatingWindowSubrole_; + NSString NSAccessibilitySystemFloatingWindowSubrole_; + NSString NSAccessibilityIncrementArrowSubrole_; + NSString NSAccessibilityDecrementArrowSubrole_; + NSString NSAccessibilityIncrementPageSubrole_; + NSString NSAccessibilityDecrementPageSubrole_; + NSString NSAccessibilitySearchFieldSubrole_; + NSString NSAccessibilityTextAttachmentSubrole_; + NSString NSAccessibilityTextLinkSubrole_; + NSString NSAccessibilityTimelineSubrole_; +} + +NSString NSAccessibilityErrorCodeExceptionInfo () +{ + if (NSAccessibilityErrorCodeExceptionInfo_) + return NSAccessibilityErrorCodeExceptionInfo_; + + return NSAccessibilityErrorCodeExceptionInfo_ = new NSString(bindings.NSAccessibilityErrorCodeExceptionInfo); +} + +NSString NSAccessibilityRoleAttribute () +{ + if (NSAccessibilityRoleAttribute_) + return NSAccessibilityRoleAttribute_; + + return NSAccessibilityRoleAttribute_ = new NSString(bindings.NSAccessibilityRoleAttribute); +} + +NSString NSAccessibilityRoleDescriptionAttribute () +{ + if (NSAccessibilityRoleDescriptionAttribute_) + return NSAccessibilityRoleDescriptionAttribute_; + + return NSAccessibilityRoleDescriptionAttribute_ = new NSString(bindings.NSAccessibilityRoleDescriptionAttribute); +} + +NSString NSAccessibilitySubroleAttribute () +{ + if (NSAccessibilitySubroleAttribute_) + return NSAccessibilitySubroleAttribute_; + + return NSAccessibilitySubroleAttribute_ = new NSString(bindings.NSAccessibilitySubroleAttribute); +} + +NSString NSAccessibilityHelpAttribute () +{ + if (NSAccessibilityHelpAttribute_) + return NSAccessibilityHelpAttribute_; + + return NSAccessibilityHelpAttribute_ = new NSString(bindings.NSAccessibilityHelpAttribute); +} + +NSString NSAccessibilityValueAttribute () +{ + if (NSAccessibilityValueAttribute_) + return NSAccessibilityValueAttribute_; + + return NSAccessibilityValueAttribute_ = new NSString(bindings.NSAccessibilityValueAttribute); +} + +NSString NSAccessibilityMinValueAttribute () +{ + if (NSAccessibilityMinValueAttribute_) + return NSAccessibilityMinValueAttribute_; + + return NSAccessibilityMinValueAttribute_ = new NSString(bindings.NSAccessibilityMinValueAttribute); +} + +NSString NSAccessibilityMaxValueAttribute () +{ + if (NSAccessibilityMaxValueAttribute_) + return NSAccessibilityMaxValueAttribute_; + + return NSAccessibilityMaxValueAttribute_ = new NSString(bindings.NSAccessibilityMaxValueAttribute); +} + +NSString NSAccessibilityEnabledAttribute () +{ + if (NSAccessibilityEnabledAttribute_) + return NSAccessibilityEnabledAttribute_; + + return NSAccessibilityEnabledAttribute_ = new NSString(bindings.NSAccessibilityEnabledAttribute); +} + +NSString NSAccessibilityFocusedAttribute () +{ + if (NSAccessibilityFocusedAttribute_) + return NSAccessibilityFocusedAttribute_; + + return NSAccessibilityFocusedAttribute_ = new NSString(bindings.NSAccessibilityFocusedAttribute); +} + +NSString NSAccessibilityParentAttribute () +{ + if (NSAccessibilityParentAttribute_) + return NSAccessibilityParentAttribute_; + + return NSAccessibilityParentAttribute_ = new NSString(bindings.NSAccessibilityParentAttribute); +} + +NSString NSAccessibilityChildrenAttribute () +{ + if (NSAccessibilityChildrenAttribute_) + return NSAccessibilityChildrenAttribute_; + + return NSAccessibilityChildrenAttribute_ = new NSString(bindings.NSAccessibilityChildrenAttribute); +} + +NSString NSAccessibilityWindowAttribute () +{ + if (NSAccessibilityWindowAttribute_) + return NSAccessibilityWindowAttribute_; + + return NSAccessibilityWindowAttribute_ = new NSString(bindings.NSAccessibilityWindowAttribute); +} + +NSString NSAccessibilityTopLevelUIElementAttribute () +{ + if (NSAccessibilityTopLevelUIElementAttribute_) + return NSAccessibilityTopLevelUIElementAttribute_; + + return NSAccessibilityTopLevelUIElementAttribute_ = new NSString(bindings.NSAccessibilityTopLevelUIElementAttribute); +} + +NSString NSAccessibilitySelectedChildrenAttribute () +{ + if (NSAccessibilitySelectedChildrenAttribute_) + return NSAccessibilitySelectedChildrenAttribute_; + + return NSAccessibilitySelectedChildrenAttribute_ = new NSString(bindings.NSAccessibilitySelectedChildrenAttribute); +} + +NSString NSAccessibilityVisibleChildrenAttribute () +{ + if (NSAccessibilityVisibleChildrenAttribute_) + return NSAccessibilityVisibleChildrenAttribute_; + + return NSAccessibilityVisibleChildrenAttribute_ = new NSString(bindings.NSAccessibilityVisibleChildrenAttribute); +} + +NSString NSAccessibilityPositionAttribute () +{ + if (NSAccessibilityPositionAttribute_) + return NSAccessibilityPositionAttribute_; + + return NSAccessibilityPositionAttribute_ = new NSString(bindings.NSAccessibilityPositionAttribute); +} + +NSString NSAccessibilitySizeAttribute () +{ + if (NSAccessibilitySizeAttribute_) + return NSAccessibilitySizeAttribute_; + + return NSAccessibilitySizeAttribute_ = new NSString(bindings.NSAccessibilitySizeAttribute); +} + +NSString NSAccessibilityContentsAttribute () +{ + if (NSAccessibilityContentsAttribute_) + return NSAccessibilityContentsAttribute_; + + return NSAccessibilityContentsAttribute_ = new NSString(bindings.NSAccessibilityContentsAttribute); +} + +NSString NSAccessibilityTitleAttribute () +{ + if (NSAccessibilityTitleAttribute_) + return NSAccessibilityTitleAttribute_; + + return NSAccessibilityTitleAttribute_ = new NSString(bindings.NSAccessibilityTitleAttribute); +} + +NSString NSAccessibilityDescriptionAttribute () +{ + if (NSAccessibilityDescriptionAttribute_) + return NSAccessibilityDescriptionAttribute_; + + return NSAccessibilityDescriptionAttribute_ = new NSString(bindings.NSAccessibilityDescriptionAttribute); +} + +NSString NSAccessibilityShownMenuAttribute () +{ + if (NSAccessibilityShownMenuAttribute_) + return NSAccessibilityShownMenuAttribute_; + + return NSAccessibilityShownMenuAttribute_ = new NSString(bindings.NSAccessibilityShownMenuAttribute); +} + +NSString NSAccessibilityValueDescriptionAttribute () +{ + if (NSAccessibilityValueDescriptionAttribute_) + return NSAccessibilityValueDescriptionAttribute_; + + return NSAccessibilityValueDescriptionAttribute_ = new NSString(bindings.NSAccessibilityValueDescriptionAttribute); +} + +NSString NSAccessibilityPreviousContentsAttribute () +{ + if (NSAccessibilityPreviousContentsAttribute_) + return NSAccessibilityPreviousContentsAttribute_; + + return NSAccessibilityPreviousContentsAttribute_ = new NSString(bindings.NSAccessibilityPreviousContentsAttribute); +} + +NSString NSAccessibilityNextContentsAttribute () +{ + if (NSAccessibilityNextContentsAttribute_) + return NSAccessibilityNextContentsAttribute_; + + return NSAccessibilityNextContentsAttribute_ = new NSString(bindings.NSAccessibilityNextContentsAttribute); +} + +NSString NSAccessibilityHeaderAttribute () +{ + if (NSAccessibilityHeaderAttribute_) + return NSAccessibilityHeaderAttribute_; + + return NSAccessibilityHeaderAttribute_ = new NSString(bindings.NSAccessibilityHeaderAttribute); +} + +NSString NSAccessibilityEditedAttribute () +{ + if (NSAccessibilityEditedAttribute_) + return NSAccessibilityEditedAttribute_; + + return NSAccessibilityEditedAttribute_ = new NSString(bindings.NSAccessibilityEditedAttribute); +} + +NSString NSAccessibilityTabsAttribute () +{ + if (NSAccessibilityTabsAttribute_) + return NSAccessibilityTabsAttribute_; + + return NSAccessibilityTabsAttribute_ = new NSString(bindings.NSAccessibilityTabsAttribute); +} + +NSString NSAccessibilityHorizontalScrollBarAttribute () +{ + if (NSAccessibilityHorizontalScrollBarAttribute_) + return NSAccessibilityHorizontalScrollBarAttribute_; + + return NSAccessibilityHorizontalScrollBarAttribute_ = new NSString(bindings.NSAccessibilityHorizontalScrollBarAttribute); +} + +NSString NSAccessibilityVerticalScrollBarAttribute () +{ + if (NSAccessibilityVerticalScrollBarAttribute_) + return NSAccessibilityVerticalScrollBarAttribute_; + + return NSAccessibilityVerticalScrollBarAttribute_ = new NSString(bindings.NSAccessibilityVerticalScrollBarAttribute); +} + +NSString NSAccessibilityOverflowButtonAttribute () +{ + if (NSAccessibilityOverflowButtonAttribute_) + return NSAccessibilityOverflowButtonAttribute_; + + return NSAccessibilityOverflowButtonAttribute_ = new NSString(bindings.NSAccessibilityOverflowButtonAttribute); +} + +NSString NSAccessibilityIncrementButtonAttribute () +{ + if (NSAccessibilityIncrementButtonAttribute_) + return NSAccessibilityIncrementButtonAttribute_; + + return NSAccessibilityIncrementButtonAttribute_ = new NSString(bindings.NSAccessibilityIncrementButtonAttribute); +} + +NSString NSAccessibilityDecrementButtonAttribute () +{ + if (NSAccessibilityDecrementButtonAttribute_) + return NSAccessibilityDecrementButtonAttribute_; + + return NSAccessibilityDecrementButtonAttribute_ = new NSString(bindings.NSAccessibilityDecrementButtonAttribute); +} + +NSString NSAccessibilityFilenameAttribute () +{ + if (NSAccessibilityFilenameAttribute_) + return NSAccessibilityFilenameAttribute_; + + return NSAccessibilityFilenameAttribute_ = new NSString(bindings.NSAccessibilityFilenameAttribute); +} + +NSString NSAccessibilityExpandedAttribute () +{ + if (NSAccessibilityExpandedAttribute_) + return NSAccessibilityExpandedAttribute_; + + return NSAccessibilityExpandedAttribute_ = new NSString(bindings.NSAccessibilityExpandedAttribute); +} + +NSString NSAccessibilitySelectedAttribute () +{ + if (NSAccessibilitySelectedAttribute_) + return NSAccessibilitySelectedAttribute_; + + return NSAccessibilitySelectedAttribute_ = new NSString(bindings.NSAccessibilitySelectedAttribute); +} + +NSString NSAccessibilitySplittersAttribute () +{ + if (NSAccessibilitySplittersAttribute_) + return NSAccessibilitySplittersAttribute_; + + return NSAccessibilitySplittersAttribute_ = new NSString(bindings.NSAccessibilitySplittersAttribute); +} + +NSString NSAccessibilityDocumentAttribute () +{ + if (NSAccessibilityDocumentAttribute_) + return NSAccessibilityDocumentAttribute_; + + return NSAccessibilityDocumentAttribute_ = new NSString(bindings.NSAccessibilityDocumentAttribute); +} + +NSString NSAccessibilityURLAttribute () +{ + if (NSAccessibilityURLAttribute_) + return NSAccessibilityURLAttribute_; + + return NSAccessibilityURLAttribute_ = new NSString(bindings.NSAccessibilityURLAttribute); +} + +NSString NSAccessibilityIndexAttribute () +{ + if (NSAccessibilityIndexAttribute_) + return NSAccessibilityIndexAttribute_; + + return NSAccessibilityIndexAttribute_ = new NSString(bindings.NSAccessibilityIndexAttribute); +} + +NSString NSAccessibilityRowCountAttribute () +{ + if (NSAccessibilityRowCountAttribute_) + return NSAccessibilityRowCountAttribute_; + + return NSAccessibilityRowCountAttribute_ = new NSString(bindings.NSAccessibilityRowCountAttribute); +} + +NSString NSAccessibilityColumnCountAttribute () +{ + if (NSAccessibilityColumnCountAttribute_) + return NSAccessibilityColumnCountAttribute_; + + return NSAccessibilityColumnCountAttribute_ = new NSString(bindings.NSAccessibilityColumnCountAttribute); +} + +NSString NSAccessibilityOrderedByRowAttribute () +{ + if (NSAccessibilityOrderedByRowAttribute_) + return NSAccessibilityOrderedByRowAttribute_; + + return NSAccessibilityOrderedByRowAttribute_ = new NSString(bindings.NSAccessibilityOrderedByRowAttribute); +} + +NSString NSAccessibilityTitleUIElementAttribute () +{ + if (NSAccessibilityTitleUIElementAttribute_) + return NSAccessibilityTitleUIElementAttribute_; + + return NSAccessibilityTitleUIElementAttribute_ = new NSString(bindings.NSAccessibilityTitleUIElementAttribute); +} + +NSString NSAccessibilityServesAsTitleForUIElementsAttribute () +{ + if (NSAccessibilityServesAsTitleForUIElementsAttribute_) + return NSAccessibilityServesAsTitleForUIElementsAttribute_; + + return NSAccessibilityServesAsTitleForUIElementsAttribute_ = new NSString(bindings.NSAccessibilityServesAsTitleForUIElementsAttribute); +} + +NSString NSAccessibilityLinkedUIElementsAttribute () +{ + if (NSAccessibilityLinkedUIElementsAttribute_) + return NSAccessibilityLinkedUIElementsAttribute_; + + return NSAccessibilityLinkedUIElementsAttribute_ = new NSString(bindings.NSAccessibilityLinkedUIElementsAttribute); +} + +NSString NSAccessibilitySelectedTextAttribute () +{ + if (NSAccessibilitySelectedTextAttribute_) + return NSAccessibilitySelectedTextAttribute_; + + return NSAccessibilitySelectedTextAttribute_ = new NSString(bindings.NSAccessibilitySelectedTextAttribute); +} + +NSString NSAccessibilitySelectedTextRangeAttribute () +{ + if (NSAccessibilitySelectedTextRangeAttribute_) + return NSAccessibilitySelectedTextRangeAttribute_; + + return NSAccessibilitySelectedTextRangeAttribute_ = new NSString(bindings.NSAccessibilitySelectedTextRangeAttribute); +} + +NSString NSAccessibilityNumberOfCharactersAttribute () +{ + if (NSAccessibilityNumberOfCharactersAttribute_) + return NSAccessibilityNumberOfCharactersAttribute_; + + return NSAccessibilityNumberOfCharactersAttribute_ = new NSString(bindings.NSAccessibilityNumberOfCharactersAttribute); +} + +NSString NSAccessibilityVisibleCharacterRangeAttribute () +{ + if (NSAccessibilityVisibleCharacterRangeAttribute_) + return NSAccessibilityVisibleCharacterRangeAttribute_; + + return NSAccessibilityVisibleCharacterRangeAttribute_ = new NSString(bindings.NSAccessibilityVisibleCharacterRangeAttribute); +} + +NSString NSAccessibilitySharedTextUIElementsAttribute () +{ + if (NSAccessibilitySharedTextUIElementsAttribute_) + return NSAccessibilitySharedTextUIElementsAttribute_; + + return NSAccessibilitySharedTextUIElementsAttribute_ = new NSString(bindings.NSAccessibilitySharedTextUIElementsAttribute); +} + +NSString NSAccessibilitySharedCharacterRangeAttribute () +{ + if (NSAccessibilitySharedCharacterRangeAttribute_) + return NSAccessibilitySharedCharacterRangeAttribute_; + + return NSAccessibilitySharedCharacterRangeAttribute_ = new NSString(bindings.NSAccessibilitySharedCharacterRangeAttribute); +} + +NSString NSAccessibilityInsertionPointLineNumberAttribute () +{ + if (NSAccessibilityInsertionPointLineNumberAttribute_) + return NSAccessibilityInsertionPointLineNumberAttribute_; + + return NSAccessibilityInsertionPointLineNumberAttribute_ = new NSString(bindings.NSAccessibilityInsertionPointLineNumberAttribute); +} + +NSString NSAccessibilitySelectedTextRangesAttribute () +{ + if (NSAccessibilitySelectedTextRangesAttribute_) + return NSAccessibilitySelectedTextRangesAttribute_; + + return NSAccessibilitySelectedTextRangesAttribute_ = new NSString(bindings.NSAccessibilitySelectedTextRangesAttribute); +} + +NSString NSAccessibilityLineForIndexParameterizedAttribute () +{ + if (NSAccessibilityLineForIndexParameterizedAttribute_) + return NSAccessibilityLineForIndexParameterizedAttribute_; + + return NSAccessibilityLineForIndexParameterizedAttribute_ = new NSString(bindings.NSAccessibilityLineForIndexParameterizedAttribute); +} + +NSString NSAccessibilityRangeForLineParameterizedAttribute () +{ + if (NSAccessibilityRangeForLineParameterizedAttribute_) + return NSAccessibilityRangeForLineParameterizedAttribute_; + + return NSAccessibilityRangeForLineParameterizedAttribute_ = new NSString(bindings.NSAccessibilityRangeForLineParameterizedAttribute); +} + +NSString NSAccessibilityStringForRangeParameterizedAttribute () +{ + if (NSAccessibilityStringForRangeParameterizedAttribute_) + return NSAccessibilityStringForRangeParameterizedAttribute_; + + return NSAccessibilityStringForRangeParameterizedAttribute_ = new NSString(bindings.NSAccessibilityStringForRangeParameterizedAttribute); +} + +NSString NSAccessibilityRangeForPositionParameterizedAttribute () +{ + if (NSAccessibilityRangeForPositionParameterizedAttribute_) + return NSAccessibilityRangeForPositionParameterizedAttribute_; + + return NSAccessibilityRangeForPositionParameterizedAttribute_ = new NSString(bindings.NSAccessibilityRangeForPositionParameterizedAttribute); +} + +NSString NSAccessibilityRangeForIndexParameterizedAttribute () +{ + if (NSAccessibilityRangeForIndexParameterizedAttribute_) + return NSAccessibilityRangeForIndexParameterizedAttribute_; + + return NSAccessibilityRangeForIndexParameterizedAttribute_ = new NSString(bindings.NSAccessibilityRangeForIndexParameterizedAttribute); +} + +NSString NSAccessibilityBoundsForRangeParameterizedAttribute () +{ + if (NSAccessibilityBoundsForRangeParameterizedAttribute_) + return NSAccessibilityBoundsForRangeParameterizedAttribute_; + + return NSAccessibilityBoundsForRangeParameterizedAttribute_ = new NSString(bindings.NSAccessibilityBoundsForRangeParameterizedAttribute); +} + +NSString NSAccessibilityRTFForRangeParameterizedAttribute () +{ + if (NSAccessibilityRTFForRangeParameterizedAttribute_) + return NSAccessibilityRTFForRangeParameterizedAttribute_; + + return NSAccessibilityRTFForRangeParameterizedAttribute_ = new NSString(bindings.NSAccessibilityRTFForRangeParameterizedAttribute); +} + +NSString NSAccessibilityStyleRangeForIndexParameterizedAttribute () +{ + if (NSAccessibilityStyleRangeForIndexParameterizedAttribute_) + return NSAccessibilityStyleRangeForIndexParameterizedAttribute_; + + return NSAccessibilityStyleRangeForIndexParameterizedAttribute_ = new NSString(bindings.NSAccessibilityStyleRangeForIndexParameterizedAttribute); +} + +NSString NSAccessibilityAttributedStringForRangeParameterizedAttribute () +{ + if (NSAccessibilityAttributedStringForRangeParameterizedAttribute_) + return NSAccessibilityAttributedStringForRangeParameterizedAttribute_; + + return NSAccessibilityAttributedStringForRangeParameterizedAttribute_ = new NSString(bindings.NSAccessibilityAttributedStringForRangeParameterizedAttribute); +} + +NSString NSAccessibilityFontTextAttribute () +{ + if (NSAccessibilityFontTextAttribute_) + return NSAccessibilityFontTextAttribute_; + + return NSAccessibilityFontTextAttribute_ = new NSString(bindings.NSAccessibilityFontTextAttribute); +} + +NSString NSAccessibilityForegroundColorTextAttribute () +{ + if (NSAccessibilityForegroundColorTextAttribute_) + return NSAccessibilityForegroundColorTextAttribute_; + + return NSAccessibilityForegroundColorTextAttribute_ = new NSString(bindings.NSAccessibilityForegroundColorTextAttribute); +} + +NSString NSAccessibilityBackgroundColorTextAttribute () +{ + if (NSAccessibilityBackgroundColorTextAttribute_) + return NSAccessibilityBackgroundColorTextAttribute_; + + return NSAccessibilityBackgroundColorTextAttribute_ = new NSString(bindings.NSAccessibilityBackgroundColorTextAttribute); +} + +NSString NSAccessibilityUnderlineColorTextAttribute () +{ + if (NSAccessibilityUnderlineColorTextAttribute_) + return NSAccessibilityUnderlineColorTextAttribute_; + + return NSAccessibilityUnderlineColorTextAttribute_ = new NSString(bindings.NSAccessibilityUnderlineColorTextAttribute); +} + +NSString NSAccessibilityStrikethroughColorTextAttribute () +{ + if (NSAccessibilityStrikethroughColorTextAttribute_) + return NSAccessibilityStrikethroughColorTextAttribute_; + + return NSAccessibilityStrikethroughColorTextAttribute_ = new NSString(bindings.NSAccessibilityStrikethroughColorTextAttribute); +} + +NSString NSAccessibilityUnderlineTextAttribute () +{ + if (NSAccessibilityUnderlineTextAttribute_) + return NSAccessibilityUnderlineTextAttribute_; + + return NSAccessibilityUnderlineTextAttribute_ = new NSString(bindings.NSAccessibilityUnderlineTextAttribute); +} + +NSString NSAccessibilitySuperscriptTextAttribute () +{ + if (NSAccessibilitySuperscriptTextAttribute_) + return NSAccessibilitySuperscriptTextAttribute_; + + return NSAccessibilitySuperscriptTextAttribute_ = new NSString(bindings.NSAccessibilitySuperscriptTextAttribute); +} + +NSString NSAccessibilityStrikethroughTextAttribute () +{ + if (NSAccessibilityStrikethroughTextAttribute_) + return NSAccessibilityStrikethroughTextAttribute_; + + return NSAccessibilityStrikethroughTextAttribute_ = new NSString(bindings.NSAccessibilityStrikethroughTextAttribute); +} + +NSString NSAccessibilityShadowTextAttribute () +{ + if (NSAccessibilityShadowTextAttribute_) + return NSAccessibilityShadowTextAttribute_; + + return NSAccessibilityShadowTextAttribute_ = new NSString(bindings.NSAccessibilityShadowTextAttribute); +} + +NSString NSAccessibilityAttachmentTextAttribute () +{ + if (NSAccessibilityAttachmentTextAttribute_) + return NSAccessibilityAttachmentTextAttribute_; + + return NSAccessibilityAttachmentTextAttribute_ = new NSString(bindings.NSAccessibilityAttachmentTextAttribute); +} + +NSString NSAccessibilityLinkTextAttribute () +{ + if (NSAccessibilityLinkTextAttribute_) + return NSAccessibilityLinkTextAttribute_; + + return NSAccessibilityLinkTextAttribute_ = new NSString(bindings.NSAccessibilityLinkTextAttribute); +} + +NSString NSAccessibilityMisspelledTextAttribute () +{ + if (NSAccessibilityMisspelledTextAttribute_) + return NSAccessibilityMisspelledTextAttribute_; + + return NSAccessibilityMisspelledTextAttribute_ = new NSString(bindings.NSAccessibilityMisspelledTextAttribute); +} + +NSString NSAccessibilityFontNameKey () +{ + if (NSAccessibilityFontNameKey_) + return NSAccessibilityFontNameKey_; + + return NSAccessibilityFontNameKey_ = new NSString(bindings.NSAccessibilityFontNameKey); +} + +NSString NSAccessibilityFontFamilyKey () +{ + if (NSAccessibilityFontFamilyKey_) + return NSAccessibilityFontFamilyKey_; + + return NSAccessibilityFontFamilyKey_ = new NSString(bindings.NSAccessibilityFontFamilyKey); +} + +NSString NSAccessibilityVisibleNameKey () +{ + if (NSAccessibilityVisibleNameKey_) + return NSAccessibilityVisibleNameKey_; + + return NSAccessibilityVisibleNameKey_ = new NSString(bindings.NSAccessibilityVisibleNameKey); +} + +NSString NSAccessibilityFontSizeKey () +{ + if (NSAccessibilityFontSizeKey_) + return NSAccessibilityFontSizeKey_; + + return NSAccessibilityFontSizeKey_ = new NSString(bindings.NSAccessibilityFontSizeKey); +} + +NSString NSAccessibilityMainAttribute () +{ + if (NSAccessibilityMainAttribute_) + return NSAccessibilityMainAttribute_; + + return NSAccessibilityMainAttribute_ = new NSString(bindings.NSAccessibilityMainAttribute); +} + +NSString NSAccessibilityMinimizedAttribute () +{ + if (NSAccessibilityMinimizedAttribute_) + return NSAccessibilityMinimizedAttribute_; + + return NSAccessibilityMinimizedAttribute_ = new NSString(bindings.NSAccessibilityMinimizedAttribute); +} + +NSString NSAccessibilityCloseButtonAttribute () +{ + if (NSAccessibilityCloseButtonAttribute_) + return NSAccessibilityCloseButtonAttribute_; + + return NSAccessibilityCloseButtonAttribute_ = new NSString(bindings.NSAccessibilityCloseButtonAttribute); +} + +NSString NSAccessibilityZoomButtonAttribute () +{ + if (NSAccessibilityZoomButtonAttribute_) + return NSAccessibilityZoomButtonAttribute_; + + return NSAccessibilityZoomButtonAttribute_ = new NSString(bindings.NSAccessibilityZoomButtonAttribute); +} + +NSString NSAccessibilityMinimizeButtonAttribute () +{ + if (NSAccessibilityMinimizeButtonAttribute_) + return NSAccessibilityMinimizeButtonAttribute_; + + return NSAccessibilityMinimizeButtonAttribute_ = new NSString(bindings.NSAccessibilityMinimizeButtonAttribute); +} + +NSString NSAccessibilityToolbarButtonAttribute () +{ + if (NSAccessibilityToolbarButtonAttribute_) + return NSAccessibilityToolbarButtonAttribute_; + + return NSAccessibilityToolbarButtonAttribute_ = new NSString(bindings.NSAccessibilityToolbarButtonAttribute); +} + +NSString NSAccessibilityProxyAttribute () +{ + if (NSAccessibilityProxyAttribute_) + return NSAccessibilityProxyAttribute_; + + return NSAccessibilityProxyAttribute_ = new NSString(bindings.NSAccessibilityProxyAttribute); +} + +NSString NSAccessibilityGrowAreaAttribute () +{ + if (NSAccessibilityGrowAreaAttribute_) + return NSAccessibilityGrowAreaAttribute_; + + return NSAccessibilityGrowAreaAttribute_ = new NSString(bindings.NSAccessibilityGrowAreaAttribute); +} + +NSString NSAccessibilityModalAttribute () +{ + if (NSAccessibilityModalAttribute_) + return NSAccessibilityModalAttribute_; + + return NSAccessibilityModalAttribute_ = new NSString(bindings.NSAccessibilityModalAttribute); +} + +NSString NSAccessibilityDefaultButtonAttribute () +{ + if (NSAccessibilityDefaultButtonAttribute_) + return NSAccessibilityDefaultButtonAttribute_; + + return NSAccessibilityDefaultButtonAttribute_ = new NSString(bindings.NSAccessibilityDefaultButtonAttribute); +} + +NSString NSAccessibilityCancelButtonAttribute () +{ + if (NSAccessibilityCancelButtonAttribute_) + return NSAccessibilityCancelButtonAttribute_; + + return NSAccessibilityCancelButtonAttribute_ = new NSString(bindings.NSAccessibilityCancelButtonAttribute); +} + +NSString NSAccessibilityMenuBarAttribute () +{ + if (NSAccessibilityMenuBarAttribute_) + return NSAccessibilityMenuBarAttribute_; + + return NSAccessibilityMenuBarAttribute_ = new NSString(bindings.NSAccessibilityMenuBarAttribute); +} + +NSString NSAccessibilityWindowsAttribute () +{ + if (NSAccessibilityWindowsAttribute_) + return NSAccessibilityWindowsAttribute_; + + return NSAccessibilityWindowsAttribute_ = new NSString(bindings.NSAccessibilityWindowsAttribute); +} + +NSString NSAccessibilityFrontmostAttribute () +{ + if (NSAccessibilityFrontmostAttribute_) + return NSAccessibilityFrontmostAttribute_; + + return NSAccessibilityFrontmostAttribute_ = new NSString(bindings.NSAccessibilityFrontmostAttribute); +} + +NSString NSAccessibilityHiddenAttribute () +{ + if (NSAccessibilityHiddenAttribute_) + return NSAccessibilityHiddenAttribute_; + + return NSAccessibilityHiddenAttribute_ = new NSString(bindings.NSAccessibilityHiddenAttribute); +} + +NSString NSAccessibilityMainWindowAttribute () +{ + if (NSAccessibilityMainWindowAttribute_) + return NSAccessibilityMainWindowAttribute_; + + return NSAccessibilityMainWindowAttribute_ = new NSString(bindings.NSAccessibilityMainWindowAttribute); +} + +NSString NSAccessibilityFocusedWindowAttribute () +{ + if (NSAccessibilityFocusedWindowAttribute_) + return NSAccessibilityFocusedWindowAttribute_; + + return NSAccessibilityFocusedWindowAttribute_ = new NSString(bindings.NSAccessibilityFocusedWindowAttribute); +} + +NSString NSAccessibilityFocusedUIElementAttribute () +{ + if (NSAccessibilityFocusedUIElementAttribute_) + return NSAccessibilityFocusedUIElementAttribute_; + + return NSAccessibilityFocusedUIElementAttribute_ = new NSString(bindings.NSAccessibilityFocusedUIElementAttribute); +} + +NSString NSAccessibilityOrientationAttribute () +{ + if (NSAccessibilityOrientationAttribute_) + return NSAccessibilityOrientationAttribute_; + + return NSAccessibilityOrientationAttribute_ = new NSString(bindings.NSAccessibilityOrientationAttribute); +} + +NSString NSAccessibilityVerticalOrientationValue () +{ + if (NSAccessibilityVerticalOrientationValue_) + return NSAccessibilityVerticalOrientationValue_; + + return NSAccessibilityVerticalOrientationValue_ = new NSString(bindings.NSAccessibilityVerticalOrientationValue); +} + +NSString NSAccessibilityHorizontalOrientationValue () +{ + if (NSAccessibilityHorizontalOrientationValue_) + return NSAccessibilityHorizontalOrientationValue_; + + return NSAccessibilityHorizontalOrientationValue_ = new NSString(bindings.NSAccessibilityHorizontalOrientationValue); +} + +NSString NSAccessibilityColumnTitlesAttribute () +{ + if (NSAccessibilityColumnTitlesAttribute_) + return NSAccessibilityColumnTitlesAttribute_; + + return NSAccessibilityColumnTitlesAttribute_ = new NSString(bindings.NSAccessibilityColumnTitlesAttribute); +} + +NSString NSAccessibilitySearchButtonAttribute () +{ + if (NSAccessibilitySearchButtonAttribute_) + return NSAccessibilitySearchButtonAttribute_; + + return NSAccessibilitySearchButtonAttribute_ = new NSString(bindings.NSAccessibilitySearchButtonAttribute); +} + +NSString NSAccessibilitySearchMenuAttribute () +{ + if (NSAccessibilitySearchMenuAttribute_) + return NSAccessibilitySearchMenuAttribute_; + + return NSAccessibilitySearchMenuAttribute_ = new NSString(bindings.NSAccessibilitySearchMenuAttribute); +} + +NSString NSAccessibilityClearButtonAttribute () +{ + if (NSAccessibilityClearButtonAttribute_) + return NSAccessibilityClearButtonAttribute_; + + return NSAccessibilityClearButtonAttribute_ = new NSString(bindings.NSAccessibilityClearButtonAttribute); +} + +NSString NSAccessibilityRowsAttribute () +{ + if (NSAccessibilityRowsAttribute_) + return NSAccessibilityRowsAttribute_; + + return NSAccessibilityRowsAttribute_ = new NSString(bindings.NSAccessibilityRowsAttribute); +} + +NSString NSAccessibilityVisibleRowsAttribute () +{ + if (NSAccessibilityVisibleRowsAttribute_) + return NSAccessibilityVisibleRowsAttribute_; + + return NSAccessibilityVisibleRowsAttribute_ = new NSString(bindings.NSAccessibilityVisibleRowsAttribute); +} + +NSString NSAccessibilitySelectedRowsAttribute () +{ + if (NSAccessibilitySelectedRowsAttribute_) + return NSAccessibilitySelectedRowsAttribute_; + + return NSAccessibilitySelectedRowsAttribute_ = new NSString(bindings.NSAccessibilitySelectedRowsAttribute); +} + +NSString NSAccessibilityColumnsAttribute () +{ + if (NSAccessibilityColumnsAttribute_) + return NSAccessibilityColumnsAttribute_; + + return NSAccessibilityColumnsAttribute_ = new NSString(bindings.NSAccessibilityColumnsAttribute); +} + +NSString NSAccessibilityVisibleColumnsAttribute () +{ + if (NSAccessibilityVisibleColumnsAttribute_) + return NSAccessibilityVisibleColumnsAttribute_; + + return NSAccessibilityVisibleColumnsAttribute_ = new NSString(bindings.NSAccessibilityVisibleColumnsAttribute); +} + +NSString NSAccessibilitySelectedColumnsAttribute () +{ + if (NSAccessibilitySelectedColumnsAttribute_) + return NSAccessibilitySelectedColumnsAttribute_; + + return NSAccessibilitySelectedColumnsAttribute_ = new NSString(bindings.NSAccessibilitySelectedColumnsAttribute); +} + +NSString NSAccessibilitySortDirectionAttribute () +{ + if (NSAccessibilitySortDirectionAttribute_) + return NSAccessibilitySortDirectionAttribute_; + + return NSAccessibilitySortDirectionAttribute_ = new NSString(bindings.NSAccessibilitySortDirectionAttribute); +} + +NSString NSAccessibilityAscendingSortDirectionValue () +{ + if (NSAccessibilityAscendingSortDirectionValue_) + return NSAccessibilityAscendingSortDirectionValue_; + + return NSAccessibilityAscendingSortDirectionValue_ = new NSString(bindings.NSAccessibilityAscendingSortDirectionValue); +} + +NSString NSAccessibilityDescendingSortDirectionValue () +{ + if (NSAccessibilityDescendingSortDirectionValue_) + return NSAccessibilityDescendingSortDirectionValue_; + + return NSAccessibilityDescendingSortDirectionValue_ = new NSString(bindings.NSAccessibilityDescendingSortDirectionValue); +} + +NSString NSAccessibilityUnknownSortDirectionValue () +{ + if (NSAccessibilityUnknownSortDirectionValue_) + return NSAccessibilityUnknownSortDirectionValue_; + + return NSAccessibilityUnknownSortDirectionValue_ = new NSString(bindings.NSAccessibilityUnknownSortDirectionValue); +} + +NSString NSAccessibilityDisclosingAttribute () +{ + if (NSAccessibilityDisclosingAttribute_) + return NSAccessibilityDisclosingAttribute_; + + return NSAccessibilityDisclosingAttribute_ = new NSString(bindings.NSAccessibilityDisclosingAttribute); +} + +NSString NSAccessibilityDisclosedRowsAttribute () +{ + if (NSAccessibilityDisclosedRowsAttribute_) + return NSAccessibilityDisclosedRowsAttribute_; + + return NSAccessibilityDisclosedRowsAttribute_ = new NSString(bindings.NSAccessibilityDisclosedRowsAttribute); +} + +NSString NSAccessibilityDisclosedByRowAttribute () +{ + if (NSAccessibilityDisclosedByRowAttribute_) + return NSAccessibilityDisclosedByRowAttribute_; + + return NSAccessibilityDisclosedByRowAttribute_ = new NSString(bindings.NSAccessibilityDisclosedByRowAttribute); +} + +NSString NSAccessibilityDisclosureLevelAttribute () +{ + if (NSAccessibilityDisclosureLevelAttribute_) + return NSAccessibilityDisclosureLevelAttribute_; + + return NSAccessibilityDisclosureLevelAttribute_ = new NSString(bindings.NSAccessibilityDisclosureLevelAttribute); +} + +NSString NSAccessibilityAllowedValuesAttribute () +{ + if (NSAccessibilityAllowedValuesAttribute_) + return NSAccessibilityAllowedValuesAttribute_; + + return NSAccessibilityAllowedValuesAttribute_ = new NSString(bindings.NSAccessibilityAllowedValuesAttribute); +} + +NSString NSAccessibilityLabelUIElementsAttribute () +{ + if (NSAccessibilityLabelUIElementsAttribute_) + return NSAccessibilityLabelUIElementsAttribute_; + + return NSAccessibilityLabelUIElementsAttribute_ = new NSString(bindings.NSAccessibilityLabelUIElementsAttribute); +} + +NSString NSAccessibilityLabelValueAttribute () +{ + if (NSAccessibilityLabelValueAttribute_) + return NSAccessibilityLabelValueAttribute_; + + return NSAccessibilityLabelValueAttribute_ = new NSString(bindings.NSAccessibilityLabelValueAttribute); +} + +NSString NSAccessibilityMatteHoleAttribute () +{ + if (NSAccessibilityMatteHoleAttribute_) + return NSAccessibilityMatteHoleAttribute_; + + return NSAccessibilityMatteHoleAttribute_ = new NSString(bindings.NSAccessibilityMatteHoleAttribute); +} + +NSString NSAccessibilityMatteContentUIElementAttribute () +{ + if (NSAccessibilityMatteContentUIElementAttribute_) + return NSAccessibilityMatteContentUIElementAttribute_; + + return NSAccessibilityMatteContentUIElementAttribute_ = new NSString(bindings.NSAccessibilityMatteContentUIElementAttribute); +} + +NSString NSAccessibilityMarkerUIElementsAttribute () +{ + if (NSAccessibilityMarkerUIElementsAttribute_) + return NSAccessibilityMarkerUIElementsAttribute_; + + return NSAccessibilityMarkerUIElementsAttribute_ = new NSString(bindings.NSAccessibilityMarkerUIElementsAttribute); +} + +NSString NSAccessibilityMarkerValuesAttribute () +{ + if (NSAccessibilityMarkerValuesAttribute_) + return NSAccessibilityMarkerValuesAttribute_; + + return NSAccessibilityMarkerValuesAttribute_ = new NSString(bindings.NSAccessibilityMarkerValuesAttribute); +} + +NSString NSAccessibilityMarkerGroupUIElementAttribute () +{ + if (NSAccessibilityMarkerGroupUIElementAttribute_) + return NSAccessibilityMarkerGroupUIElementAttribute_; + + return NSAccessibilityMarkerGroupUIElementAttribute_ = new NSString(bindings.NSAccessibilityMarkerGroupUIElementAttribute); +} + +NSString NSAccessibilityUnitsAttribute () +{ + if (NSAccessibilityUnitsAttribute_) + return NSAccessibilityUnitsAttribute_; + + return NSAccessibilityUnitsAttribute_ = new NSString(bindings.NSAccessibilityUnitsAttribute); +} + +NSString NSAccessibilityUnitDescriptionAttribute () +{ + if (NSAccessibilityUnitDescriptionAttribute_) + return NSAccessibilityUnitDescriptionAttribute_; + + return NSAccessibilityUnitDescriptionAttribute_ = new NSString(bindings.NSAccessibilityUnitDescriptionAttribute); +} + +NSString NSAccessibilityMarkerTypeAttribute () +{ + if (NSAccessibilityMarkerTypeAttribute_) + return NSAccessibilityMarkerTypeAttribute_; + + return NSAccessibilityMarkerTypeAttribute_ = new NSString(bindings.NSAccessibilityMarkerTypeAttribute); +} + +NSString NSAccessibilityMarkerTypeDescriptionAttribute () +{ + if (NSAccessibilityMarkerTypeDescriptionAttribute_) + return NSAccessibilityMarkerTypeDescriptionAttribute_; + + return NSAccessibilityMarkerTypeDescriptionAttribute_ = new NSString(bindings.NSAccessibilityMarkerTypeDescriptionAttribute); +} + +NSString NSAccessibilityLeftTabStopMarkerTypeValue () +{ + if (NSAccessibilityLeftTabStopMarkerTypeValue_) + return NSAccessibilityLeftTabStopMarkerTypeValue_; + + return NSAccessibilityLeftTabStopMarkerTypeValue_ = new NSString(bindings.NSAccessibilityLeftTabStopMarkerTypeValue); +} + +NSString NSAccessibilityRightTabStopMarkerTypeValue () +{ + if (NSAccessibilityRightTabStopMarkerTypeValue_) + return NSAccessibilityRightTabStopMarkerTypeValue_; + + return NSAccessibilityRightTabStopMarkerTypeValue_ = new NSString(bindings.NSAccessibilityRightTabStopMarkerTypeValue); +} + +NSString NSAccessibilityCenterTabStopMarkerTypeValue () +{ + if (NSAccessibilityCenterTabStopMarkerTypeValue_) + return NSAccessibilityCenterTabStopMarkerTypeValue_; + + return NSAccessibilityCenterTabStopMarkerTypeValue_ = new NSString(bindings.NSAccessibilityCenterTabStopMarkerTypeValue); +} + +NSString NSAccessibilityDecimalTabStopMarkerTypeValue () +{ + if (NSAccessibilityDecimalTabStopMarkerTypeValue_) + return NSAccessibilityDecimalTabStopMarkerTypeValue_; + + return NSAccessibilityDecimalTabStopMarkerTypeValue_ = new NSString(bindings.NSAccessibilityDecimalTabStopMarkerTypeValue); +} + +NSString NSAccessibilityHeadIndentMarkerTypeValue () +{ + if (NSAccessibilityHeadIndentMarkerTypeValue_) + return NSAccessibilityHeadIndentMarkerTypeValue_; + + return NSAccessibilityHeadIndentMarkerTypeValue_ = new NSString(bindings.NSAccessibilityHeadIndentMarkerTypeValue); +} + +NSString NSAccessibilityTailIndentMarkerTypeValue () +{ + if (NSAccessibilityTailIndentMarkerTypeValue_) + return NSAccessibilityTailIndentMarkerTypeValue_; + + return NSAccessibilityTailIndentMarkerTypeValue_ = new NSString(bindings.NSAccessibilityTailIndentMarkerTypeValue); +} + +NSString NSAccessibilityFirstLineIndentMarkerTypeValue () +{ + if (NSAccessibilityFirstLineIndentMarkerTypeValue_) + return NSAccessibilityFirstLineIndentMarkerTypeValue_; + + return NSAccessibilityFirstLineIndentMarkerTypeValue_ = new NSString(bindings.NSAccessibilityFirstLineIndentMarkerTypeValue); +} + +NSString NSAccessibilityUnknownMarkerTypeValue () +{ + if (NSAccessibilityUnknownMarkerTypeValue_) + return NSAccessibilityUnknownMarkerTypeValue_; + + return NSAccessibilityUnknownMarkerTypeValue_ = new NSString(bindings.NSAccessibilityUnknownMarkerTypeValue); +} + +NSString NSAccessibilityInchesUnitValue () +{ + if (NSAccessibilityInchesUnitValue_) + return NSAccessibilityInchesUnitValue_; + + return NSAccessibilityInchesUnitValue_ = new NSString(bindings.NSAccessibilityInchesUnitValue); +} + +NSString NSAccessibilityCentimetersUnitValue () +{ + if (NSAccessibilityCentimetersUnitValue_) + return NSAccessibilityCentimetersUnitValue_; + + return NSAccessibilityCentimetersUnitValue_ = new NSString(bindings.NSAccessibilityCentimetersUnitValue); +} + +NSString NSAccessibilityPointsUnitValue () +{ + if (NSAccessibilityPointsUnitValue_) + return NSAccessibilityPointsUnitValue_; + + return NSAccessibilityPointsUnitValue_ = new NSString(bindings.NSAccessibilityPointsUnitValue); +} + +NSString NSAccessibilityPicasUnitValue () +{ + if (NSAccessibilityPicasUnitValue_) + return NSAccessibilityPicasUnitValue_; + + return NSAccessibilityPicasUnitValue_ = new NSString(bindings.NSAccessibilityPicasUnitValue); +} + +NSString NSAccessibilityUnknownUnitValue () +{ + if (NSAccessibilityUnknownUnitValue_) + return NSAccessibilityUnknownUnitValue_; + + return NSAccessibilityUnknownUnitValue_ = new NSString(bindings.NSAccessibilityUnknownUnitValue); +} + +NSString NSAccessibilityPressAction () +{ + if (NSAccessibilityPressAction_) + return NSAccessibilityPressAction_; + + return NSAccessibilityPressAction_ = new NSString(bindings.NSAccessibilityPressAction); +} + +NSString NSAccessibilityIncrementAction () +{ + if (NSAccessibilityIncrementAction_) + return NSAccessibilityIncrementAction_; + + return NSAccessibilityIncrementAction_ = new NSString(bindings.NSAccessibilityIncrementAction); +} + +NSString NSAccessibilityDecrementAction () +{ + if (NSAccessibilityDecrementAction_) + return NSAccessibilityDecrementAction_; + + return NSAccessibilityDecrementAction_ = new NSString(bindings.NSAccessibilityDecrementAction); +} + +NSString NSAccessibilityConfirmAction () +{ + if (NSAccessibilityConfirmAction_) + return NSAccessibilityConfirmAction_; + + return NSAccessibilityConfirmAction_ = new NSString(bindings.NSAccessibilityConfirmAction); +} + +NSString NSAccessibilityPickAction () +{ + if (NSAccessibilityPickAction_) + return NSAccessibilityPickAction_; + + return NSAccessibilityPickAction_ = new NSString(bindings.NSAccessibilityPickAction); +} + +NSString NSAccessibilityCancelAction () +{ + if (NSAccessibilityCancelAction_) + return NSAccessibilityCancelAction_; + + return NSAccessibilityCancelAction_ = new NSString(bindings.NSAccessibilityCancelAction); +} + +NSString NSAccessibilityRaiseAction () +{ + if (NSAccessibilityRaiseAction_) + return NSAccessibilityRaiseAction_; + + return NSAccessibilityRaiseAction_ = new NSString(bindings.NSAccessibilityRaiseAction); +} + +NSString NSAccessibilityShowMenuAction () +{ + if (NSAccessibilityShowMenuAction_) + return NSAccessibilityShowMenuAction_; + + return NSAccessibilityShowMenuAction_ = new NSString(bindings.NSAccessibilityShowMenuAction); +} + +NSString NSAccessibilityDeleteAction () +{ + if (NSAccessibilityDeleteAction_) + return NSAccessibilityDeleteAction_; + + return NSAccessibilityDeleteAction_ = new NSString(bindings.NSAccessibilityDeleteAction); +} + +NSString NSAccessibilityMainWindowChangedNotification () +{ + if (NSAccessibilityMainWindowChangedNotification_) + return NSAccessibilityMainWindowChangedNotification_; + + return NSAccessibilityMainWindowChangedNotification_ = new NSString(bindings.NSAccessibilityMainWindowChangedNotification); +} + +NSString NSAccessibilityFocusedWindowChangedNotification () +{ + if (NSAccessibilityFocusedWindowChangedNotification_) + return NSAccessibilityFocusedWindowChangedNotification_; + + return NSAccessibilityFocusedWindowChangedNotification_ = new NSString(bindings.NSAccessibilityFocusedWindowChangedNotification); +} + +NSString NSAccessibilityFocusedUIElementChangedNotification () +{ + if (NSAccessibilityFocusedUIElementChangedNotification_) + return NSAccessibilityFocusedUIElementChangedNotification_; + + return NSAccessibilityFocusedUIElementChangedNotification_ = new NSString(bindings.NSAccessibilityFocusedUIElementChangedNotification); +} + +NSString NSAccessibilityApplicationActivatedNotification () +{ + if (NSAccessibilityApplicationActivatedNotification_) + return NSAccessibilityApplicationActivatedNotification_; + + return NSAccessibilityApplicationActivatedNotification_ = new NSString(bindings.NSAccessibilityApplicationActivatedNotification); +} + +NSString NSAccessibilityApplicationDeactivatedNotification () +{ + if (NSAccessibilityApplicationDeactivatedNotification_) + return NSAccessibilityApplicationDeactivatedNotification_; + + return NSAccessibilityApplicationDeactivatedNotification_ = new NSString(bindings.NSAccessibilityApplicationDeactivatedNotification); +} + +NSString NSAccessibilityApplicationHiddenNotification () +{ + if (NSAccessibilityApplicationHiddenNotification_) + return NSAccessibilityApplicationHiddenNotification_; + + return NSAccessibilityApplicationHiddenNotification_ = new NSString(bindings.NSAccessibilityApplicationHiddenNotification); +} + +NSString NSAccessibilityApplicationShownNotification () +{ + if (NSAccessibilityApplicationShownNotification_) + return NSAccessibilityApplicationShownNotification_; + + return NSAccessibilityApplicationShownNotification_ = new NSString(bindings.NSAccessibilityApplicationShownNotification); +} + +NSString NSAccessibilityWindowCreatedNotification () +{ + if (NSAccessibilityWindowCreatedNotification_) + return NSAccessibilityWindowCreatedNotification_; + + return NSAccessibilityWindowCreatedNotification_ = new NSString(bindings.NSAccessibilityWindowCreatedNotification); +} + +NSString NSAccessibilityWindowMovedNotification () +{ + if (NSAccessibilityWindowMovedNotification_) + return NSAccessibilityWindowMovedNotification_; + + return NSAccessibilityWindowMovedNotification_ = new NSString(bindings.NSAccessibilityWindowMovedNotification); +} + +NSString NSAccessibilityWindowResizedNotification () +{ + if (NSAccessibilityWindowResizedNotification_) + return NSAccessibilityWindowResizedNotification_; + + return NSAccessibilityWindowResizedNotification_ = new NSString(bindings.NSAccessibilityWindowResizedNotification); +} + +NSString NSAccessibilityWindowMiniaturizedNotification () +{ + if (NSAccessibilityWindowMiniaturizedNotification_) + return NSAccessibilityWindowMiniaturizedNotification_; + + return NSAccessibilityWindowMiniaturizedNotification_ = new NSString(bindings.NSAccessibilityWindowMiniaturizedNotification); +} + +NSString NSAccessibilityWindowDeminiaturizedNotification () +{ + if (NSAccessibilityWindowDeminiaturizedNotification_) + return NSAccessibilityWindowDeminiaturizedNotification_; + + return NSAccessibilityWindowDeminiaturizedNotification_ = new NSString(bindings.NSAccessibilityWindowDeminiaturizedNotification); +} + +NSString NSAccessibilityDrawerCreatedNotification () +{ + if (NSAccessibilityDrawerCreatedNotification_) + return NSAccessibilityDrawerCreatedNotification_; + + return NSAccessibilityDrawerCreatedNotification_ = new NSString(bindings.NSAccessibilityDrawerCreatedNotification); +} + +NSString NSAccessibilitySheetCreatedNotification () +{ + if (NSAccessibilitySheetCreatedNotification_) + return NSAccessibilitySheetCreatedNotification_; + + return NSAccessibilitySheetCreatedNotification_ = new NSString(bindings.NSAccessibilitySheetCreatedNotification); +} + +NSString NSAccessibilityUIElementDestroyedNotification () +{ + if (NSAccessibilityUIElementDestroyedNotification_) + return NSAccessibilityUIElementDestroyedNotification_; + + return NSAccessibilityUIElementDestroyedNotification_ = new NSString(bindings.NSAccessibilityUIElementDestroyedNotification); +} + +NSString NSAccessibilityValueChangedNotification () +{ + if (NSAccessibilityValueChangedNotification_) + return NSAccessibilityValueChangedNotification_; + + return NSAccessibilityValueChangedNotification_ = new NSString(bindings.NSAccessibilityValueChangedNotification); +} + +NSString NSAccessibilityTitleChangedNotification () +{ + if (NSAccessibilityTitleChangedNotification_) + return NSAccessibilityTitleChangedNotification_; + + return NSAccessibilityTitleChangedNotification_ = new NSString(bindings.NSAccessibilityTitleChangedNotification); +} + +NSString NSAccessibilityResizedNotification () +{ + if (NSAccessibilityResizedNotification_) + return NSAccessibilityResizedNotification_; + + return NSAccessibilityResizedNotification_ = new NSString(bindings.NSAccessibilityResizedNotification); +} + +NSString NSAccessibilityMovedNotification () +{ + if (NSAccessibilityMovedNotification_) + return NSAccessibilityMovedNotification_; + + return NSAccessibilityMovedNotification_ = new NSString(bindings.NSAccessibilityMovedNotification); +} + +NSString NSAccessibilityCreatedNotification () +{ + if (NSAccessibilityCreatedNotification_) + return NSAccessibilityCreatedNotification_; + + return NSAccessibilityCreatedNotification_ = new NSString(bindings.NSAccessibilityCreatedNotification); +} + +NSString NSAccessibilityHelpTagCreatedNotification () +{ + if (NSAccessibilityHelpTagCreatedNotification_) + return NSAccessibilityHelpTagCreatedNotification_; + + return NSAccessibilityHelpTagCreatedNotification_ = new NSString(bindings.NSAccessibilityHelpTagCreatedNotification); +} + +NSString NSAccessibilitySelectedTextChangedNotification () +{ + if (NSAccessibilitySelectedTextChangedNotification_) + return NSAccessibilitySelectedTextChangedNotification_; + + return NSAccessibilitySelectedTextChangedNotification_ = new NSString(bindings.NSAccessibilitySelectedTextChangedNotification); +} + +NSString NSAccessibilityRowCountChangedNotification () +{ + if (NSAccessibilityRowCountChangedNotification_) + return NSAccessibilityRowCountChangedNotification_; + + return NSAccessibilityRowCountChangedNotification_ = new NSString(bindings.NSAccessibilityRowCountChangedNotification); +} + +NSString NSAccessibilitySelectedChildrenChangedNotification () +{ + if (NSAccessibilitySelectedChildrenChangedNotification_) + return NSAccessibilitySelectedChildrenChangedNotification_; + + return NSAccessibilitySelectedChildrenChangedNotification_ = new NSString(bindings.NSAccessibilitySelectedChildrenChangedNotification); +} + +NSString NSAccessibilitySelectedRowsChangedNotification () +{ + if (NSAccessibilitySelectedRowsChangedNotification_) + return NSAccessibilitySelectedRowsChangedNotification_; + + return NSAccessibilitySelectedRowsChangedNotification_ = new NSString(bindings.NSAccessibilitySelectedRowsChangedNotification); +} + +NSString NSAccessibilitySelectedColumnsChangedNotification () +{ + if (NSAccessibilitySelectedColumnsChangedNotification_) + return NSAccessibilitySelectedColumnsChangedNotification_; + + return NSAccessibilitySelectedColumnsChangedNotification_ = new NSString(bindings.NSAccessibilitySelectedColumnsChangedNotification); +} + +NSString NSAccessibilityUnknownRole () +{ + if (NSAccessibilityUnknownRole_) + return NSAccessibilityUnknownRole_; + + return NSAccessibilityUnknownRole_ = new NSString(bindings.NSAccessibilityUnknownRole); +} + +NSString NSAccessibilityButtonRole () +{ + if (NSAccessibilityButtonRole_) + return NSAccessibilityButtonRole_; + + return NSAccessibilityButtonRole_ = new NSString(bindings.NSAccessibilityButtonRole); +} + +NSString NSAccessibilityRadioButtonRole () +{ + if (NSAccessibilityRadioButtonRole_) + return NSAccessibilityRadioButtonRole_; + + return NSAccessibilityRadioButtonRole_ = new NSString(bindings.NSAccessibilityRadioButtonRole); +} + +NSString NSAccessibilityCheckBoxRole () +{ + if (NSAccessibilityCheckBoxRole_) + return NSAccessibilityCheckBoxRole_; + + return NSAccessibilityCheckBoxRole_ = new NSString(bindings.NSAccessibilityCheckBoxRole); +} + +NSString NSAccessibilitySliderRole () +{ + if (NSAccessibilitySliderRole_) + return NSAccessibilitySliderRole_; + + return NSAccessibilitySliderRole_ = new NSString(bindings.NSAccessibilitySliderRole); +} + +NSString NSAccessibilityTabGroupRole () +{ + if (NSAccessibilityTabGroupRole_) + return NSAccessibilityTabGroupRole_; + + return NSAccessibilityTabGroupRole_ = new NSString(bindings.NSAccessibilityTabGroupRole); +} + +NSString NSAccessibilityTextFieldRole () +{ + if (NSAccessibilityTextFieldRole_) + return NSAccessibilityTextFieldRole_; + + return NSAccessibilityTextFieldRole_ = new NSString(bindings.NSAccessibilityTextFieldRole); +} + +NSString NSAccessibilityStaticTextRole () +{ + if (NSAccessibilityStaticTextRole_) + return NSAccessibilityStaticTextRole_; + + return NSAccessibilityStaticTextRole_ = new NSString(bindings.NSAccessibilityStaticTextRole); +} + +NSString NSAccessibilityTextAreaRole () +{ + if (NSAccessibilityTextAreaRole_) + return NSAccessibilityTextAreaRole_; + + return NSAccessibilityTextAreaRole_ = new NSString(bindings.NSAccessibilityTextAreaRole); +} + +NSString NSAccessibilityScrollAreaRole () +{ + if (NSAccessibilityScrollAreaRole_) + return NSAccessibilityScrollAreaRole_; + + return NSAccessibilityScrollAreaRole_ = new NSString(bindings.NSAccessibilityScrollAreaRole); +} + +NSString NSAccessibilityPopUpButtonRole () +{ + if (NSAccessibilityPopUpButtonRole_) + return NSAccessibilityPopUpButtonRole_; + + return NSAccessibilityPopUpButtonRole_ = new NSString(bindings.NSAccessibilityPopUpButtonRole); +} + +NSString NSAccessibilityMenuButtonRole () +{ + if (NSAccessibilityMenuButtonRole_) + return NSAccessibilityMenuButtonRole_; + + return NSAccessibilityMenuButtonRole_ = new NSString(bindings.NSAccessibilityMenuButtonRole); +} + +NSString NSAccessibilityTableRole () +{ + if (NSAccessibilityTableRole_) + return NSAccessibilityTableRole_; + + return NSAccessibilityTableRole_ = new NSString(bindings.NSAccessibilityTableRole); +} + +NSString NSAccessibilityApplicationRole () +{ + if (NSAccessibilityApplicationRole_) + return NSAccessibilityApplicationRole_; + + return NSAccessibilityApplicationRole_ = new NSString(bindings.NSAccessibilityApplicationRole); +} + +NSString NSAccessibilityGroupRole () +{ + if (NSAccessibilityGroupRole_) + return NSAccessibilityGroupRole_; + + return NSAccessibilityGroupRole_ = new NSString(bindings.NSAccessibilityGroupRole); +} + +NSString NSAccessibilityRadioGroupRole () +{ + if (NSAccessibilityRadioGroupRole_) + return NSAccessibilityRadioGroupRole_; + + return NSAccessibilityRadioGroupRole_ = new NSString(bindings.NSAccessibilityRadioGroupRole); +} + +NSString NSAccessibilityListRole () +{ + if (NSAccessibilityListRole_) + return NSAccessibilityListRole_; + + return NSAccessibilityListRole_ = new NSString(bindings.NSAccessibilityListRole); +} + +NSString NSAccessibilityScrollBarRole () +{ + if (NSAccessibilityScrollBarRole_) + return NSAccessibilityScrollBarRole_; + + return NSAccessibilityScrollBarRole_ = new NSString(bindings.NSAccessibilityScrollBarRole); +} + +NSString NSAccessibilityValueIndicatorRole () +{ + if (NSAccessibilityValueIndicatorRole_) + return NSAccessibilityValueIndicatorRole_; + + return NSAccessibilityValueIndicatorRole_ = new NSString(bindings.NSAccessibilityValueIndicatorRole); +} + +NSString NSAccessibilityImageRole () +{ + if (NSAccessibilityImageRole_) + return NSAccessibilityImageRole_; + + return NSAccessibilityImageRole_ = new NSString(bindings.NSAccessibilityImageRole); +} + +NSString NSAccessibilityMenuBarRole () +{ + if (NSAccessibilityMenuBarRole_) + return NSAccessibilityMenuBarRole_; + + return NSAccessibilityMenuBarRole_ = new NSString(bindings.NSAccessibilityMenuBarRole); +} + +NSString NSAccessibilityMenuRole () +{ + if (NSAccessibilityMenuRole_) + return NSAccessibilityMenuRole_; + + return NSAccessibilityMenuRole_ = new NSString(bindings.NSAccessibilityMenuRole); +} + +NSString NSAccessibilityMenuItemRole () +{ + if (NSAccessibilityMenuItemRole_) + return NSAccessibilityMenuItemRole_; + + return NSAccessibilityMenuItemRole_ = new NSString(bindings.NSAccessibilityMenuItemRole); +} + +NSString NSAccessibilityColumnRole () +{ + if (NSAccessibilityColumnRole_) + return NSAccessibilityColumnRole_; + + return NSAccessibilityColumnRole_ = new NSString(bindings.NSAccessibilityColumnRole); +} + +NSString NSAccessibilityRowRole () +{ + if (NSAccessibilityRowRole_) + return NSAccessibilityRowRole_; + + return NSAccessibilityRowRole_ = new NSString(bindings.NSAccessibilityRowRole); +} + +NSString NSAccessibilityToolbarRole () +{ + if (NSAccessibilityToolbarRole_) + return NSAccessibilityToolbarRole_; + + return NSAccessibilityToolbarRole_ = new NSString(bindings.NSAccessibilityToolbarRole); +} + +NSString NSAccessibilityBusyIndicatorRole () +{ + if (NSAccessibilityBusyIndicatorRole_) + return NSAccessibilityBusyIndicatorRole_; + + return NSAccessibilityBusyIndicatorRole_ = new NSString(bindings.NSAccessibilityBusyIndicatorRole); +} + +NSString NSAccessibilityProgressIndicatorRole () +{ + if (NSAccessibilityProgressIndicatorRole_) + return NSAccessibilityProgressIndicatorRole_; + + return NSAccessibilityProgressIndicatorRole_ = new NSString(bindings.NSAccessibilityProgressIndicatorRole); +} + +NSString NSAccessibilityWindowRole () +{ + if (NSAccessibilityWindowRole_) + return NSAccessibilityWindowRole_; + + return NSAccessibilityWindowRole_ = new NSString(bindings.NSAccessibilityWindowRole); +} + +NSString NSAccessibilityDrawerRole () +{ + if (NSAccessibilityDrawerRole_) + return NSAccessibilityDrawerRole_; + + return NSAccessibilityDrawerRole_ = new NSString(bindings.NSAccessibilityDrawerRole); +} + +NSString NSAccessibilitySystemWideRole () +{ + if (NSAccessibilitySystemWideRole_) + return NSAccessibilitySystemWideRole_; + + return NSAccessibilitySystemWideRole_ = new NSString(bindings.NSAccessibilitySystemWideRole); +} + +NSString NSAccessibilityOutlineRole () +{ + if (NSAccessibilityOutlineRole_) + return NSAccessibilityOutlineRole_; + + return NSAccessibilityOutlineRole_ = new NSString(bindings.NSAccessibilityOutlineRole); +} + +NSString NSAccessibilityIncrementorRole () +{ + if (NSAccessibilityIncrementorRole_) + return NSAccessibilityIncrementorRole_; + + return NSAccessibilityIncrementorRole_ = new NSString(bindings.NSAccessibilityIncrementorRole); +} + +NSString NSAccessibilityBrowserRole () +{ + if (NSAccessibilityBrowserRole_) + return NSAccessibilityBrowserRole_; + + return NSAccessibilityBrowserRole_ = new NSString(bindings.NSAccessibilityBrowserRole); +} + +NSString NSAccessibilityComboBoxRole () +{ + if (NSAccessibilityComboBoxRole_) + return NSAccessibilityComboBoxRole_; + + return NSAccessibilityComboBoxRole_ = new NSString(bindings.NSAccessibilityComboBoxRole); +} + +NSString NSAccessibilitySplitGroupRole () +{ + if (NSAccessibilitySplitGroupRole_) + return NSAccessibilitySplitGroupRole_; + + return NSAccessibilitySplitGroupRole_ = new NSString(bindings.NSAccessibilitySplitGroupRole); +} + +NSString NSAccessibilitySplitterRole () +{ + if (NSAccessibilitySplitterRole_) + return NSAccessibilitySplitterRole_; + + return NSAccessibilitySplitterRole_ = new NSString(bindings.NSAccessibilitySplitterRole); +} + +NSString NSAccessibilityColorWellRole () +{ + if (NSAccessibilityColorWellRole_) + return NSAccessibilityColorWellRole_; + + return NSAccessibilityColorWellRole_ = new NSString(bindings.NSAccessibilityColorWellRole); +} + +NSString NSAccessibilityGrowAreaRole () +{ + if (NSAccessibilityGrowAreaRole_) + return NSAccessibilityGrowAreaRole_; + + return NSAccessibilityGrowAreaRole_ = new NSString(bindings.NSAccessibilityGrowAreaRole); +} + +NSString NSAccessibilitySheetRole () +{ + if (NSAccessibilitySheetRole_) + return NSAccessibilitySheetRole_; + + return NSAccessibilitySheetRole_ = new NSString(bindings.NSAccessibilitySheetRole); +} + +NSString NSAccessibilityHelpTagRole () +{ + if (NSAccessibilityHelpTagRole_) + return NSAccessibilityHelpTagRole_; + + return NSAccessibilityHelpTagRole_ = new NSString(bindings.NSAccessibilityHelpTagRole); +} + +NSString NSAccessibilityMatteRole () +{ + if (NSAccessibilityMatteRole_) + return NSAccessibilityMatteRole_; + + return NSAccessibilityMatteRole_ = new NSString(bindings.NSAccessibilityMatteRole); +} + +NSString NSAccessibilityRulerRole () +{ + if (NSAccessibilityRulerRole_) + return NSAccessibilityRulerRole_; + + return NSAccessibilityRulerRole_ = new NSString(bindings.NSAccessibilityRulerRole); +} + +NSString NSAccessibilityRulerMarkerRole () +{ + if (NSAccessibilityRulerMarkerRole_) + return NSAccessibilityRulerMarkerRole_; + + return NSAccessibilityRulerMarkerRole_ = new NSString(bindings.NSAccessibilityRulerMarkerRole); +} + +NSString NSAccessibilitySortButtonRole () +{ + if (NSAccessibilitySortButtonRole_) + return NSAccessibilitySortButtonRole_; + + return NSAccessibilitySortButtonRole_ = new NSString(bindings.NSAccessibilitySortButtonRole); +} + +NSString NSAccessibilityLinkRole () +{ + if (NSAccessibilityLinkRole_) + return NSAccessibilityLinkRole_; + + return NSAccessibilityLinkRole_ = new NSString(bindings.NSAccessibilityLinkRole); +} + +NSString NSAccessibilityDisclosureTriangleRole () +{ + if (NSAccessibilityDisclosureTriangleRole_) + return NSAccessibilityDisclosureTriangleRole_; + + return NSAccessibilityDisclosureTriangleRole_ = new NSString(bindings.NSAccessibilityDisclosureTriangleRole); +} + +NSString NSAccessibilityGridRole () +{ + if (NSAccessibilityGridRole_) + return NSAccessibilityGridRole_; + + return NSAccessibilityGridRole_ = new NSString(bindings.NSAccessibilityGridRole); +} + +NSString NSAccessibilityUnknownSubrole () +{ + if (NSAccessibilityUnknownSubrole_) + return NSAccessibilityUnknownSubrole_; + + return NSAccessibilityUnknownSubrole_ = new NSString(bindings.NSAccessibilityUnknownSubrole); +} + +NSString NSAccessibilityCloseButtonSubrole () +{ + if (NSAccessibilityCloseButtonSubrole_) + return NSAccessibilityCloseButtonSubrole_; + + return NSAccessibilityCloseButtonSubrole_ = new NSString(bindings.NSAccessibilityCloseButtonSubrole); +} + +NSString NSAccessibilityZoomButtonSubrole () +{ + if (NSAccessibilityZoomButtonSubrole_) + return NSAccessibilityZoomButtonSubrole_; + + return NSAccessibilityZoomButtonSubrole_ = new NSString(bindings.NSAccessibilityZoomButtonSubrole); +} + +NSString NSAccessibilityMinimizeButtonSubrole () +{ + if (NSAccessibilityMinimizeButtonSubrole_) + return NSAccessibilityMinimizeButtonSubrole_; + + return NSAccessibilityMinimizeButtonSubrole_ = new NSString(bindings.NSAccessibilityMinimizeButtonSubrole); +} + +NSString NSAccessibilityToolbarButtonSubrole () +{ + if (NSAccessibilityToolbarButtonSubrole_) + return NSAccessibilityToolbarButtonSubrole_; + + return NSAccessibilityToolbarButtonSubrole_ = new NSString(bindings.NSAccessibilityToolbarButtonSubrole); +} + +NSString NSAccessibilityTableRowSubrole () +{ + if (NSAccessibilityTableRowSubrole_) + return NSAccessibilityTableRowSubrole_; + + return NSAccessibilityTableRowSubrole_ = new NSString(bindings.NSAccessibilityTableRowSubrole); +} + +NSString NSAccessibilityOutlineRowSubrole () +{ + if (NSAccessibilityOutlineRowSubrole_) + return NSAccessibilityOutlineRowSubrole_; + + return NSAccessibilityOutlineRowSubrole_ = new NSString(bindings.NSAccessibilityOutlineRowSubrole); +} + +NSString NSAccessibilitySecureTextFieldSubrole () +{ + if (NSAccessibilitySecureTextFieldSubrole_) + return NSAccessibilitySecureTextFieldSubrole_; + + return NSAccessibilitySecureTextFieldSubrole_ = new NSString(bindings.NSAccessibilitySecureTextFieldSubrole); +} + +NSString NSAccessibilityStandardWindowSubrole () +{ + if (NSAccessibilityStandardWindowSubrole_) + return NSAccessibilityStandardWindowSubrole_; + + return NSAccessibilityStandardWindowSubrole_ = new NSString(bindings.NSAccessibilityStandardWindowSubrole); +} + +NSString NSAccessibilityDialogSubrole () +{ + if (NSAccessibilityDialogSubrole_) + return NSAccessibilityDialogSubrole_; + + return NSAccessibilityDialogSubrole_ = new NSString(bindings.NSAccessibilityDialogSubrole); +} + +NSString NSAccessibilitySystemDialogSubrole () +{ + if (NSAccessibilitySystemDialogSubrole_) + return NSAccessibilitySystemDialogSubrole_; + + return NSAccessibilitySystemDialogSubrole_ = new NSString(bindings.NSAccessibilitySystemDialogSubrole); +} + +NSString NSAccessibilityFloatingWindowSubrole () +{ + if (NSAccessibilityFloatingWindowSubrole_) + return NSAccessibilityFloatingWindowSubrole_; + + return NSAccessibilityFloatingWindowSubrole_ = new NSString(bindings.NSAccessibilityFloatingWindowSubrole); +} + +NSString NSAccessibilitySystemFloatingWindowSubrole () +{ + if (NSAccessibilitySystemFloatingWindowSubrole_) + return NSAccessibilitySystemFloatingWindowSubrole_; + + return NSAccessibilitySystemFloatingWindowSubrole_ = new NSString(bindings.NSAccessibilitySystemFloatingWindowSubrole); +} + +NSString NSAccessibilityIncrementArrowSubrole () +{ + if (NSAccessibilityIncrementArrowSubrole_) + return NSAccessibilityIncrementArrowSubrole_; + + return NSAccessibilityIncrementArrowSubrole_ = new NSString(bindings.NSAccessibilityIncrementArrowSubrole); +} + +NSString NSAccessibilityDecrementArrowSubrole () +{ + if (NSAccessibilityDecrementArrowSubrole_) + return NSAccessibilityDecrementArrowSubrole_; + + return NSAccessibilityDecrementArrowSubrole_ = new NSString(bindings.NSAccessibilityDecrementArrowSubrole); +} + +NSString NSAccessibilityIncrementPageSubrole () +{ + if (NSAccessibilityIncrementPageSubrole_) + return NSAccessibilityIncrementPageSubrole_; + + return NSAccessibilityIncrementPageSubrole_ = new NSString(bindings.NSAccessibilityIncrementPageSubrole); +} + +NSString NSAccessibilityDecrementPageSubrole () +{ + if (NSAccessibilityDecrementPageSubrole_) + return NSAccessibilityDecrementPageSubrole_; + + return NSAccessibilityDecrementPageSubrole_ = new NSString(bindings.NSAccessibilityDecrementPageSubrole); +} + +NSString NSAccessibilitySearchFieldSubrole () +{ + if (NSAccessibilitySearchFieldSubrole_) + return NSAccessibilitySearchFieldSubrole_; + + return NSAccessibilitySearchFieldSubrole_ = new NSString(bindings.NSAccessibilitySearchFieldSubrole); +} + +NSString NSAccessibilityTextAttachmentSubrole () +{ + if (NSAccessibilityTextAttachmentSubrole_) + return NSAccessibilityTextAttachmentSubrole_; + + return NSAccessibilityTextAttachmentSubrole_ = new NSString(bindings.NSAccessibilityTextAttachmentSubrole); +} + +NSString NSAccessibilityTextLinkSubrole () +{ + if (NSAccessibilityTextLinkSubrole_) + return NSAccessibilityTextLinkSubrole_; + + return NSAccessibilityTextLinkSubrole_ = new NSString(bindings.NSAccessibilityTextLinkSubrole); +} + +NSString NSAccessibilityTimelineSubrole () +{ + if (NSAccessibilityTimelineSubrole_) + return NSAccessibilityTimelineSubrole_; + + return NSAccessibilityTimelineSubrole_ = new NSString(bindings.NSAccessibilityTimelineSubrole); +} + +const TNSAccessibility = ` + + NSArray accessibilityAttributeNames () + { + return invokeObjcSelf!(NSArray, "accessibilityAttributeNames"); + } + + Object accessibilityAttributeValue (NSString attribute) + { + return invokeObjcSelf!(Object, "accessibilityAttributeValue:", NSString)(attribute); + } + + bool accessibilityIsAttributeSettable (NSString attribute) + { + return invokeObjcSelf!(bool, "accessibilityIsAttributeSettable:", NSString)(attribute); + } + + void accessibilitySetValue (Object value, NSString attribute) + { + return invokeObjcSelf!(void, "accessibilitySetValue:forAttribute:", Object, NSString)(value, attribute); + } + + NSArray accessibilityParameterizedAttributeNames () + { + return invokeObjcSelf!(NSArray, "accessibilityParameterizedAttributeNames"); + } + + Object accessibilityAttributeValue (NSString attribute, Object parameter) + { + return invokeObjcSelf!(Object, "accessibilityAttributeValue:forParameter:", NSString, Object)(attribute, parameter); + } + + NSArray accessibilityActionNames () + { + return invokeObjcSelf!(NSArray, "accessibilityActionNames"); + } + + NSString accessibilityActionDescription (NSString action) + { + return invokeObjcSelf!(NSString, "accessibilityActionDescription:", NSString)(action); + } + + void accessibilityPerformAction (NSString action) + { + return invokeObjcSelf!(void, "accessibilityPerformAction:", NSString)(action); + } + + bool accessibilityIsIgnored () + { + return invokeObjcSelf!(bool, "accessibilityIsIgnored"); + } + + Object accessibilityHitTest (NSPoint point) + { + return invokeObjcSelf!(Object, "accessibilityHitTest:", NSPoint)(point); + } + + Object accessibilityFocusedUIElement () + { + return invokeObjcSelf!(Object, "accessibilityFocusedUIElement"); + } + + //mixin ObjcBindMethod!(accessibilityAttributeNames, "accessibilityAttributeNames"); + //mixin ObjcBindMethod!(accessibilityAttributeValue, "accessibilityAttributeValue:"); + //mixin ObjcBindMethod!(accessibilityIsAttributeSettable, "accessibilityIsAttributeSettable:"); + //mixin ObjcBindMethod!(accessibilitySetValue, "accessibilitySetValue:forAttribute:"); + //mixin ObjcBindMethod!(accessibilityParameterizedAttributeNames, "accessibilityParameterizedAttributeNames"); + //mixin ObjcBindMethod!(accessibilityAttributeValue, "accessibilityAttributeValue:forParameter:"); + //mixin ObjcBindMethod!(accessibilityActionNames, "accessibilityActionNames"); + //mixin ObjcBindMethod!(accessibilityActionDescription, "accessibilityActionDescription:"); + //mixin ObjcBindMethod!(accessibilityPerformAction, "accessibilityPerformAction:"); + //mixin ObjcBindMethod!(accessibilityIsIgnored, "accessibilityIsIgnored"); + //mixin ObjcBindMethod!(accessibilityHitTest, "accessibilityHitTest:"); + //mixin ObjcBindMethod!(accessibilityFocusedUIElement, "accessibilityFocusedUIElement"); + +`; + +const TNSAccessibilityAdditions = ` + + bool accessibilitySetOverrideValue (Object value, NSString attribute) + { + return invokeObjcSelf!(bool, "accessibilitySetOverrideValue:forAttribute:", Object, NSString)(value, attribute); + } + + //mixin ObjcBindMethod!(accessibilitySetOverrideValue, "accessibilitySetOverrideValue:forAttribute:"); + +`; +/* +NSString NSAccessibilityRoleDescription (NSString role, NSString subrole) +{ + return Bridge.invokeObjcFunction!(NSString, bindings.NSAccessibilityRoleDescription, NSString, NSString)(role, subrole); +} + +NSString NSAccessibilityRoleDescriptionForUIElement (Object element) +{ + return Bridge.invokeObjcFunction!(NSString, bindings.NSAccessibilityRoleDescriptionForUIElement, Object)(element); +} + +NSString NSAccessibilityActionDescription (NSString action) +{ + return Bridge.invokeObjcFunction!(NSString, bindings.NSAccessibilityActionDescription, NSString)(action); +} + +void NSAccessibilityRaiseBadArgumentException (Object element, NSString attribute, Object value) +{ + return Bridge.invokeObjcFunction!(void, bindings.NSAccessibilityRaiseBadArgumentException, Object, NSString, Object)(element, attribute, value); +} + +Object NSAccessibilityUnignoredAncestor (Object element) +{ + return Bridge.invokeObjcFunction!(Object, bindings.NSAccessibilityUnignoredAncestor, Object)(element); +} + +Object NSAccessibilityUnignoredDescendant (Object element) +{ + return Bridge.invokeObjcFunction!(Object, bindings.NSAccessibilityUnignoredDescendant, Object)(element); +} + +NSArray NSAccessibilityUnignoredChildren (NSArray originalChildren) +{ + return Bridge.invokeObjcFunction!(NSArray, bindings.NSAccessibilityUnignoredChildren, NSArray)(originalChildren); +} + +NSArray NSAccessibilityUnignoredChildrenForOnlyChild (Object originalChild) +{ + return Bridge.invokeObjcFunction!(NSArray, bindings.NSAccessibilityUnignoredChildrenForOnlyChild, Object)(originalChild); +} + +void NSAccessibilityPostNotification (Object element, NSString notification) +{ + return Bridge.invokeObjcFunction!(void, bindings.NSAccessibilityPostNotification, Object, NSString)(element, notification); +} + +*/ \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSAccessibility_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSAccessibility_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,284 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSAccessibility_bindings; + +import dstep.appkit.AppKitDefines; +import dstep.foundation.NSArray; +import dstep.appkit.NSErrors; +import dstep.foundation.NSString; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + + +extern (C) +{ + extern + { + package const id NSAccessibilityErrorCodeExceptionInfo; + package const id NSAccessibilityRoleAttribute; + package const id NSAccessibilityRoleDescriptionAttribute; + package const id NSAccessibilitySubroleAttribute; + package const id NSAccessibilityHelpAttribute; + package const id NSAccessibilityValueAttribute; + package const id NSAccessibilityMinValueAttribute; + package const id NSAccessibilityMaxValueAttribute; + package const id NSAccessibilityEnabledAttribute; + package const id NSAccessibilityFocusedAttribute; + package const id NSAccessibilityParentAttribute; + package const id NSAccessibilityChildrenAttribute; + package const id NSAccessibilityWindowAttribute; + package const id NSAccessibilityTopLevelUIElementAttribute; + package const id NSAccessibilitySelectedChildrenAttribute; + package const id NSAccessibilityVisibleChildrenAttribute; + package const id NSAccessibilityPositionAttribute; + package const id NSAccessibilitySizeAttribute; + package const id NSAccessibilityContentsAttribute; + package const id NSAccessibilityTitleAttribute; + package const id NSAccessibilityDescriptionAttribute; + package const id NSAccessibilityShownMenuAttribute; + package const id NSAccessibilityValueDescriptionAttribute; + package const id NSAccessibilityPreviousContentsAttribute; + package const id NSAccessibilityNextContentsAttribute; + package const id NSAccessibilityHeaderAttribute; + package const id NSAccessibilityEditedAttribute; + package const id NSAccessibilityTabsAttribute; + package const id NSAccessibilityHorizontalScrollBarAttribute; + package const id NSAccessibilityVerticalScrollBarAttribute; + package const id NSAccessibilityOverflowButtonAttribute; + package const id NSAccessibilityIncrementButtonAttribute; + package const id NSAccessibilityDecrementButtonAttribute; + package const id NSAccessibilityFilenameAttribute; + package const id NSAccessibilityExpandedAttribute; + package const id NSAccessibilitySelectedAttribute; + package const id NSAccessibilitySplittersAttribute; + package const id NSAccessibilityDocumentAttribute; + package const id NSAccessibilityURLAttribute; + package const id NSAccessibilityIndexAttribute; + package const id NSAccessibilityRowCountAttribute; + package const id NSAccessibilityColumnCountAttribute; + package const id NSAccessibilityOrderedByRowAttribute; + package const id NSAccessibilityTitleUIElementAttribute; + package const id NSAccessibilityServesAsTitleForUIElementsAttribute; + package const id NSAccessibilityLinkedUIElementsAttribute; + package const id NSAccessibilitySelectedTextAttribute; + package const id NSAccessibilitySelectedTextRangeAttribute; + package const id NSAccessibilityNumberOfCharactersAttribute; + package const id NSAccessibilityVisibleCharacterRangeAttribute; + package const id NSAccessibilitySharedTextUIElementsAttribute; + package const id NSAccessibilitySharedCharacterRangeAttribute; + package const id NSAccessibilityInsertionPointLineNumberAttribute; + package const id NSAccessibilitySelectedTextRangesAttribute; + package const id NSAccessibilityLineForIndexParameterizedAttribute; + package const id NSAccessibilityRangeForLineParameterizedAttribute; + package const id NSAccessibilityStringForRangeParameterizedAttribute; + package const id NSAccessibilityRangeForPositionParameterizedAttribute; + package const id NSAccessibilityRangeForIndexParameterizedAttribute; + package const id NSAccessibilityBoundsForRangeParameterizedAttribute; + package const id NSAccessibilityRTFForRangeParameterizedAttribute; + package const id NSAccessibilityStyleRangeForIndexParameterizedAttribute; + package const id NSAccessibilityAttributedStringForRangeParameterizedAttribute; + package const id NSAccessibilityFontTextAttribute; + package const id NSAccessibilityForegroundColorTextAttribute; + package const id NSAccessibilityBackgroundColorTextAttribute; + package const id NSAccessibilityUnderlineColorTextAttribute; + package const id NSAccessibilityStrikethroughColorTextAttribute; + package const id NSAccessibilityUnderlineTextAttribute; + package const id NSAccessibilitySuperscriptTextAttribute; + package const id NSAccessibilityStrikethroughTextAttribute; + package const id NSAccessibilityShadowTextAttribute; + package const id NSAccessibilityAttachmentTextAttribute; + package const id NSAccessibilityLinkTextAttribute; + package const id NSAccessibilityMisspelledTextAttribute; + package const id NSAccessibilityFontNameKey; + package const id NSAccessibilityFontFamilyKey; + package const id NSAccessibilityVisibleNameKey; + package const id NSAccessibilityFontSizeKey; + package const id NSAccessibilityMainAttribute; + package const id NSAccessibilityMinimizedAttribute; + package const id NSAccessibilityCloseButtonAttribute; + package const id NSAccessibilityZoomButtonAttribute; + package const id NSAccessibilityMinimizeButtonAttribute; + package const id NSAccessibilityToolbarButtonAttribute; + package const id NSAccessibilityProxyAttribute; + package const id NSAccessibilityGrowAreaAttribute; + package const id NSAccessibilityModalAttribute; + package const id NSAccessibilityDefaultButtonAttribute; + package const id NSAccessibilityCancelButtonAttribute; + package const id NSAccessibilityMenuBarAttribute; + package const id NSAccessibilityWindowsAttribute; + package const id NSAccessibilityFrontmostAttribute; + package const id NSAccessibilityHiddenAttribute; + package const id NSAccessibilityMainWindowAttribute; + package const id NSAccessibilityFocusedWindowAttribute; + package const id NSAccessibilityFocusedUIElementAttribute; + package const id NSAccessibilityOrientationAttribute; + package const id NSAccessibilityVerticalOrientationValue; + package const id NSAccessibilityHorizontalOrientationValue; + package const id NSAccessibilityColumnTitlesAttribute; + package const id NSAccessibilitySearchButtonAttribute; + package const id NSAccessibilitySearchMenuAttribute; + package const id NSAccessibilityClearButtonAttribute; + package const id NSAccessibilityRowsAttribute; + package const id NSAccessibilityVisibleRowsAttribute; + package const id NSAccessibilitySelectedRowsAttribute; + package const id NSAccessibilityColumnsAttribute; + package const id NSAccessibilityVisibleColumnsAttribute; + package const id NSAccessibilitySelectedColumnsAttribute; + package const id NSAccessibilitySortDirectionAttribute; + package const id NSAccessibilityAscendingSortDirectionValue; + package const id NSAccessibilityDescendingSortDirectionValue; + package const id NSAccessibilityUnknownSortDirectionValue; + package const id NSAccessibilityDisclosingAttribute; + package const id NSAccessibilityDisclosedRowsAttribute; + package const id NSAccessibilityDisclosedByRowAttribute; + package const id NSAccessibilityDisclosureLevelAttribute; + package const id NSAccessibilityAllowedValuesAttribute; + package const id NSAccessibilityLabelUIElementsAttribute; + package const id NSAccessibilityLabelValueAttribute; + package const id NSAccessibilityMatteHoleAttribute; + package const id NSAccessibilityMatteContentUIElementAttribute; + package const id NSAccessibilityMarkerUIElementsAttribute; + package const id NSAccessibilityMarkerValuesAttribute; + package const id NSAccessibilityMarkerGroupUIElementAttribute; + package const id NSAccessibilityUnitsAttribute; + package const id NSAccessibilityUnitDescriptionAttribute; + package const id NSAccessibilityMarkerTypeAttribute; + package const id NSAccessibilityMarkerTypeDescriptionAttribute; + package const id NSAccessibilityLeftTabStopMarkerTypeValue; + package const id NSAccessibilityRightTabStopMarkerTypeValue; + package const id NSAccessibilityCenterTabStopMarkerTypeValue; + package const id NSAccessibilityDecimalTabStopMarkerTypeValue; + package const id NSAccessibilityHeadIndentMarkerTypeValue; + package const id NSAccessibilityTailIndentMarkerTypeValue; + package const id NSAccessibilityFirstLineIndentMarkerTypeValue; + package const id NSAccessibilityUnknownMarkerTypeValue; + package const id NSAccessibilityInchesUnitValue; + package const id NSAccessibilityCentimetersUnitValue; + package const id NSAccessibilityPointsUnitValue; + package const id NSAccessibilityPicasUnitValue; + package const id NSAccessibilityUnknownUnitValue; + package const id NSAccessibilityPressAction; + package const id NSAccessibilityIncrementAction; + package const id NSAccessibilityDecrementAction; + package const id NSAccessibilityConfirmAction; + package const id NSAccessibilityPickAction; + package const id NSAccessibilityCancelAction; + package const id NSAccessibilityRaiseAction; + package const id NSAccessibilityShowMenuAction; + package const id NSAccessibilityDeleteAction; + package const id NSAccessibilityMainWindowChangedNotification; + package const id NSAccessibilityFocusedWindowChangedNotification; + package const id NSAccessibilityFocusedUIElementChangedNotification; + package const id NSAccessibilityApplicationActivatedNotification; + package const id NSAccessibilityApplicationDeactivatedNotification; + package const id NSAccessibilityApplicationHiddenNotification; + package const id NSAccessibilityApplicationShownNotification; + package const id NSAccessibilityWindowCreatedNotification; + package const id NSAccessibilityWindowMovedNotification; + package const id NSAccessibilityWindowResizedNotification; + package const id NSAccessibilityWindowMiniaturizedNotification; + package const id NSAccessibilityWindowDeminiaturizedNotification; + package const id NSAccessibilityDrawerCreatedNotification; + package const id NSAccessibilitySheetCreatedNotification; + package const id NSAccessibilityUIElementDestroyedNotification; + package const id NSAccessibilityValueChangedNotification; + package const id NSAccessibilityTitleChangedNotification; + package const id NSAccessibilityResizedNotification; + package const id NSAccessibilityMovedNotification; + package const id NSAccessibilityCreatedNotification; + package const id NSAccessibilityHelpTagCreatedNotification; + package const id NSAccessibilitySelectedTextChangedNotification; + package const id NSAccessibilityRowCountChangedNotification; + package const id NSAccessibilitySelectedChildrenChangedNotification; + package const id NSAccessibilitySelectedRowsChangedNotification; + package const id NSAccessibilitySelectedColumnsChangedNotification; + package const id NSAccessibilityUnknownRole; + package const id NSAccessibilityButtonRole; + package const id NSAccessibilityRadioButtonRole; + package const id NSAccessibilityCheckBoxRole; + package const id NSAccessibilitySliderRole; + package const id NSAccessibilityTabGroupRole; + package const id NSAccessibilityTextFieldRole; + package const id NSAccessibilityStaticTextRole; + package const id NSAccessibilityTextAreaRole; + package const id NSAccessibilityScrollAreaRole; + package const id NSAccessibilityPopUpButtonRole; + package const id NSAccessibilityMenuButtonRole; + package const id NSAccessibilityTableRole; + package const id NSAccessibilityApplicationRole; + package const id NSAccessibilityGroupRole; + package const id NSAccessibilityRadioGroupRole; + package const id NSAccessibilityListRole; + package const id NSAccessibilityScrollBarRole; + package const id NSAccessibilityValueIndicatorRole; + package const id NSAccessibilityImageRole; + package const id NSAccessibilityMenuBarRole; + package const id NSAccessibilityMenuRole; + package const id NSAccessibilityMenuItemRole; + package const id NSAccessibilityColumnRole; + package const id NSAccessibilityRowRole; + package const id NSAccessibilityToolbarRole; + package const id NSAccessibilityBusyIndicatorRole; + package const id NSAccessibilityProgressIndicatorRole; + package const id NSAccessibilityWindowRole; + package const id NSAccessibilityDrawerRole; + package const id NSAccessibilitySystemWideRole; + package const id NSAccessibilityOutlineRole; + package const id NSAccessibilityIncrementorRole; + package const id NSAccessibilityBrowserRole; + package const id NSAccessibilityComboBoxRole; + package const id NSAccessibilitySplitGroupRole; + package const id NSAccessibilitySplitterRole; + package const id NSAccessibilityColorWellRole; + package const id NSAccessibilityGrowAreaRole; + package const id NSAccessibilitySheetRole; + package const id NSAccessibilityHelpTagRole; + package const id NSAccessibilityMatteRole; + package const id NSAccessibilityRulerRole; + package const id NSAccessibilityRulerMarkerRole; + package const id NSAccessibilitySortButtonRole; + package const id NSAccessibilityLinkRole; + package const id NSAccessibilityDisclosureTriangleRole; + package const id NSAccessibilityGridRole; + package const id NSAccessibilityUnknownSubrole; + package const id NSAccessibilityCloseButtonSubrole; + package const id NSAccessibilityZoomButtonSubrole; + package const id NSAccessibilityMinimizeButtonSubrole; + package const id NSAccessibilityToolbarButtonSubrole; + package const id NSAccessibilityTableRowSubrole; + package const id NSAccessibilityOutlineRowSubrole; + package const id NSAccessibilitySecureTextFieldSubrole; + package const id NSAccessibilityStandardWindowSubrole; + package const id NSAccessibilityDialogSubrole; + package const id NSAccessibilitySystemDialogSubrole; + package const id NSAccessibilityFloatingWindowSubrole; + package const id NSAccessibilitySystemFloatingWindowSubrole; + package const id NSAccessibilityIncrementArrowSubrole; + package const id NSAccessibilityDecrementArrowSubrole; + package const id NSAccessibilityIncrementPageSubrole; + package const id NSAccessibilityDecrementPageSubrole; + package const id NSAccessibilitySearchFieldSubrole; + package const id NSAccessibilityTextAttachmentSubrole; + package const id NSAccessibilityTextLinkSubrole; + package const id NSAccessibilityTimelineSubrole; + } +} + +extern (C) +{ + package id NSAccessibilityRoleDescription (id role, id subrole); + package id NSAccessibilityRoleDescriptionForUIElement (id element); + package id NSAccessibilityActionDescription (id action); + package void NSAccessibilityRaiseBadArgumentException (id element, id attribute, id value); + package id NSAccessibilityUnignoredAncestor (id element); + package id NSAccessibilityUnignoredDescendant (id element); + package id NSAccessibilityUnignoredChildren (id originalChildren); + package id NSAccessibilityUnignoredChildrenForOnlyChild (id originalChild); + package void NSAccessibilityPostNotification (id element, id notification); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSActionCell.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSActionCell.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,128 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSActionCell; + +import dstep.appkit.NSCell; +import dstep.appkit.NSFont; +import dstep.appkit.NSImage; +import dstep.appkit.NSView; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSActionCell : NSCell +{ + mixin (ObjcWrap); + + NSView controlView () + { + return invokeObjcSelf!(NSView, "controlView"); + } + + void setControlView (NSView view) + { + return invokeObjcSelf!(void, "setControlView:", NSView)(view); + } + + void setFont (NSFont fontObj) + { + return invokeObjcSelf!(void, "setFont:", NSFont)(fontObj); + } + + void setAlignment (uint mode) + { + return invokeObjcSelf!(void, "setAlignment:", uint)(mode); + } + + void setBordered (bool flag) + { + return invokeObjcSelf!(void, "setBordered:", bool)(flag); + } + + void setBezeled (bool flag) + { + return invokeObjcSelf!(void, "setBezeled:", bool)(flag); + } + + void setEnabled (bool flag) + { + return invokeObjcSelf!(void, "setEnabled:", bool)(flag); + } + + void setFloatingPointFormat (bool autoRange, NSUInteger leftDigits, NSUInteger rightDigits) + { + return invokeObjcSelf!(void, "setFloatingPointFormat:left:right:", bool, NSUInteger, NSUInteger)(autoRange, leftDigits, rightDigits); + } + + void setImage (NSImage image) + { + return invokeObjcSelf!(void, "setImage:", NSImage)(image); + } + + Object target () + { + return invokeObjcSelf!(Object, "target"); + } + + void setTarget (Object anObject) + { + return invokeObjcSelf!(void, "setTarget:", Object)(anObject); + } + + SEL action () + { + return invokeObjcSelf!(SEL, "action"); + } + + void setAction (SEL aSelector) + { + return invokeObjcSelf!(void, "setAction:", SEL)(aSelector); + } + + NSInteger tag () + { + return invokeObjcSelf!(NSInteger, "tag"); + } + + void setTag (NSInteger anInt) + { + return invokeObjcSelf!(void, "setTag:", NSInteger)(anInt); + } + + NSString stringValue () + { + return invokeObjcSelf!(NSString, "stringValue"); + } + + int intValue () + { + return invokeObjcSelf!(int, "intValue"); + } + + float floatValue () + { + return invokeObjcSelf!(float, "floatValue"); + } + + double doubleValue () + { + return invokeObjcSelf!(double, "doubleValue"); + } + + void setObjectValue (INSCopying obj) + { + return invokeObjcSelf!(void, "setObjectValue:", INSCopying)(obj); + } + + NSInteger integerValue () + { + return invokeObjcSelf!(NSInteger, "integerValue"); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSAffineTransform.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSAffineTransform.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,166 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSAffineTransform; + +import dstep.appkit.NSBezierPath; +import dstep.appkit.NSFileWrapper; +import dstep.appkit.NSTextList; +import dstep.appkit.NSTextTable; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSAffineTransform; +import dstep.foundation.NSCoder; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +struct NSAffineTransformStruct +{ + CGFloat m11; + CGFloat m12; + CGFloat m21; + CGFloat m22; + CGFloat tX; + CGFloat tY; +} + +const TNSAppKitAdditons = ` + + NSBezierPath transformBezierPath (NSBezierPath aPath) + { + return invokeObjcSelf!(NSBezierPath, "transformBezierPath:", NSBezierPath)(aPath); + } + + void set () + { + return invokeObjcSelf!(void, "set"); + } + + void concat () + { + return invokeObjcSelf!(void, "concat"); + } + + //mixin ObjcBindMethod!(transformBezierPath, "transformBezierPath:"); + //mixin ObjcBindMethod!(set, "set"); + //mixin ObjcBindMethod!(concat, "concat"); + +`; + +class NSAffineTransform : NSObject, INSCopying, INSCoding +{ + mixin (ObjcWrap); + + static NSAffineTransform transform () + { + return invokeObjcSelfClass!(NSAffineTransform, "transform"); + } + + NSAffineTransform initWithTransform (NSAffineTransform transform) + { + id result = invokeObjcSelf!(id, "initWithTransform:", NSAffineTransform)(transform); + return result is this.objcObject ? this : (result !is null ? new NSAffineTransform(result) : null); + } + + this (NSAffineTransform transform) + { + super(NSAffineTransform.alloc.initWithTransform(transform).objcObject); + } + + void translateXBy (CGFloat deltaX, CGFloat deltaY) + { + return invokeObjcSelf!(void, "translateXBy:yBy:", CGFloat, CGFloat)(deltaX, deltaY); + } + + void rotateByDegrees (CGFloat angle) + { + return invokeObjcSelf!(void, "rotateByDegrees:", CGFloat)(angle); + } + + void rotateByRadians (CGFloat angle) + { + return invokeObjcSelf!(void, "rotateByRadians:", CGFloat)(angle); + } + + void scaleBy (CGFloat scale) + { + return invokeObjcSelf!(void, "scaleBy:", CGFloat)(scale); + } + + void scaleXBy (CGFloat scaleX, CGFloat scaleY) + { + return invokeObjcSelf!(void, "scaleXBy:yBy:", CGFloat, CGFloat)(scaleX, scaleY); + } + + void invert () + { + return invokeObjcSelf!(void, "invert"); + } + + void appendTransform (NSAffineTransform transform) + { + return invokeObjcSelf!(void, "appendTransform:", NSAffineTransform)(transform); + } + + void prependTransform (NSAffineTransform transform) + { + return invokeObjcSelf!(void, "prependTransform:", NSAffineTransform)(transform); + } + + NSPoint transformPoint (NSPoint aPoint) + { + return invokeObjcSelf!(NSPoint, "transformPoint:", NSPoint)(aPoint); + } + + NSSize transformSize (NSSize aSize) + { + return invokeObjcSelf!(NSSize, "transformSize:", NSSize)(aSize); + } + + NSAffineTransformStruct transformStruct () + { + return invokeObjcSelf!(NSAffineTransformStruct, "transformStruct"); + } + + void setTransformStruct (NSAffineTransformStruct transformStruct) + { + return invokeObjcSelf!(void, "setTransformStruct:", NSAffineTransformStruct)(transformStruct); + } + + NSObject copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(NSObject, "copyWithZone:", NSZone*)(zone); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + NSAffineTransform initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(NSAffineTransform, "initWithCoder:", NSCoder)(aDecoder); + } + + // NSAppKitAdditons + NSBezierPath transformBezierPath (NSBezierPath aPath) + { + return invokeObjcSelf!(NSBezierPath, "transformBezierPath:", NSBezierPath)(aPath); + } + + void set () + { + return invokeObjcSelf!(void, "set"); + } + + void concat () + { + return invokeObjcSelf!(void, "concat"); + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSAlert.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSAlert.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,190 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSAlert; + +import dstep.appkit.NSButton; +import dstep.appkit.NSGraphics; +import dstep.appkit.NSImage; +import dstep.appkit.NSPanel; +import dstep.appkit.NSTextField; +import dstep.appkit.NSView; +import dstep.appkit.NSWindow; +import dstep.foundation.NSArray; +import dstep.foundation.NSError; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +alias NSUInteger NSAlertStyle; + +enum +{ + NSWarningAlertStyle = 0, + NSInformationalAlertStyle = 1, + NSCriticalAlertStyle = 2 +} + +enum +{ + NSAlertFirstButtonReturn = 1000, + NSAlertSecondButtonReturn = 1001, + NSAlertThirdButtonReturn = 1002 +} + +class NSAlert : NSObject +{ + mixin (ObjcWrap); + + static NSAlert alertWithError (NSError error) + { + return invokeObjcSelfClass!(NSAlert, "alertWithError:", NSError)(error); + } + + static NSAlert alertWithMessageText (NSString message, NSString defaultButton, NSString alternateButton, NSString otherButton, NSString informativeTextWithFormat, ...) + { + return invokeObjcSelfClass!(NSAlert, "alertWithMessageText:defaultButton:alternateButton:otherButton:informativeTextWithFormat:", NSString, NSString, NSString, NSString, NSString)(message, defaultButton, alternateButton, otherButton, informativeTextWithFormat); + } + + void setMessageText (NSString messageText) + { + return invokeObjcSelf!(void, "setMessageText:", NSString)(messageText); + } + + void setInformativeText (NSString informativeText) + { + return invokeObjcSelf!(void, "setInformativeText:", NSString)(informativeText); + } + + NSString messageText () + { + return invokeObjcSelf!(NSString, "messageText"); + } + + NSString informativeText () + { + return invokeObjcSelf!(NSString, "informativeText"); + } + + void setIcon (NSImage icon) + { + return invokeObjcSelf!(void, "setIcon:", NSImage)(icon); + } + + NSImage icon () + { + return invokeObjcSelf!(NSImage, "icon"); + } + + NSButton addButtonWithTitle (NSString title) + { + return invokeObjcSelf!(NSButton, "addButtonWithTitle:", NSString)(title); + } + + NSArray buttons () + { + return invokeObjcSelf!(NSArray, "buttons"); + } + + void setShowsHelp (bool showsHelp) + { + return invokeObjcSelf!(void, "setShowsHelp:", bool)(showsHelp); + } + + bool showsHelp () + { + return invokeObjcSelf!(bool, "showsHelp"); + } + + void setHelpAnchor (NSString anchor) + { + return invokeObjcSelf!(void, "setHelpAnchor:", NSString)(anchor); + } + + NSString helpAnchor () + { + return invokeObjcSelf!(NSString, "helpAnchor"); + } + + void setAlertStyle (uint style) + { + return invokeObjcSelf!(void, "setAlertStyle:", uint)(style); + } + + uint alertStyle () + { + return invokeObjcSelf!(uint, "alertStyle"); + } + + void setDelegate (Object delegate_) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(delegate_); + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + void setShowsSuppressionButton (bool flag) + { + return invokeObjcSelf!(void, "setShowsSuppressionButton:", bool)(flag); + } + + bool showsSuppressionButton () + { + return invokeObjcSelf!(bool, "showsSuppressionButton"); + } + + NSButton suppressionButton () + { + return invokeObjcSelf!(NSButton, "suppressionButton"); + } + + void setAccessoryView (NSView view) + { + return invokeObjcSelf!(void, "setAccessoryView:", NSView)(view); + } + + NSView accessoryView () + { + return invokeObjcSelf!(NSView, "accessoryView"); + } + + void layout () + { + return invokeObjcSelf!(void, "layout"); + } + + NSInteger runModal () + { + return invokeObjcSelf!(NSInteger, "runModal"); + } + + void beginSheetModalForWindow (NSWindow window, Object delegate_, SEL didEndSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "beginSheetModalForWindow:modalDelegate:didEndSelector:contextInfo:", NSWindow, Object, SEL, void*)(window, delegate_, didEndSelector, contextInfo); + } + + Object window () + { + return invokeObjcSelf!(Object, "window"); + } +} + +const TNSAlertDelegate = ` + + bool alertShowHelp (NSAlert alert) + { + return invokeObjcSelf!(bool, "alertShowHelp:", NSAlert)(alert); + } + + //mixin ObjcBindMethod!(alertShowHelp, "alertShowHelp:"); + +`; + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSAnimation.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSAnimation.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,369 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSAnimation; + +import dstep.appkit.AppKitDefines; +import dstep.appkit.NSGraphicsContext; +import dstep.foundation.NSArray; +import dstep.foundation.NSCoder; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSTimer; +import dstep.foundation.NSString; +import dstep.foundation.NSZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.appkit.NSAnimation_bindings; + +alias NSUInteger NSAnimationCurve; +alias NSUInteger NSAnimationBlockingMode; +alias float NSAnimationProgress; + +private +{ + NSString NSAnimationProgressMarkNotification_; + NSString NSAnimationProgressMark_; + NSString NSViewAnimationTargetKey_; + NSString NSViewAnimationStartFrameKey_; + NSString NSViewAnimationEndFrameKey_; + NSString NSViewAnimationEffectKey_; + NSString NSViewAnimationFadeInEffect_; + NSString NSViewAnimationFadeOutEffect_; + NSString NSAnimationTriggerOrderIn_; + NSString NSAnimationTriggerOrderOut_; +} + +NSString NSAnimationProgressMarkNotification () +{ + if (NSAnimationProgressMarkNotification_) + return NSAnimationProgressMarkNotification_; + + return NSAnimationProgressMarkNotification_ = new NSString(bindings.NSAnimationProgressMarkNotification); +} + +NSString NSAnimationProgressMark () +{ + if (NSAnimationProgressMark_) + return NSAnimationProgressMark_; + + return NSAnimationProgressMark_ = new NSString(bindings.NSAnimationProgressMark); +} + +NSString NSViewAnimationTargetKey () +{ + if (NSViewAnimationTargetKey_) + return NSViewAnimationTargetKey_; + + return NSViewAnimationTargetKey_ = new NSString(bindings.NSViewAnimationTargetKey); +} + +NSString NSViewAnimationStartFrameKey () +{ + if (NSViewAnimationStartFrameKey_) + return NSViewAnimationStartFrameKey_; + + return NSViewAnimationStartFrameKey_ = new NSString(bindings.NSViewAnimationStartFrameKey); +} + +NSString NSViewAnimationEndFrameKey () +{ + if (NSViewAnimationEndFrameKey_) + return NSViewAnimationEndFrameKey_; + + return NSViewAnimationEndFrameKey_ = new NSString(bindings.NSViewAnimationEndFrameKey); +} + +NSString NSViewAnimationEffectKey () +{ + if (NSViewAnimationEffectKey_) + return NSViewAnimationEffectKey_; + + return NSViewAnimationEffectKey_ = new NSString(bindings.NSViewAnimationEffectKey); +} + +NSString NSViewAnimationFadeInEffect () +{ + if (NSViewAnimationFadeInEffect_) + return NSViewAnimationFadeInEffect_; + + return NSViewAnimationFadeInEffect_ = new NSString(bindings.NSViewAnimationFadeInEffect); +} + +NSString NSViewAnimationFadeOutEffect () +{ + if (NSViewAnimationFadeOutEffect_) + return NSViewAnimationFadeOutEffect_; + + return NSViewAnimationFadeOutEffect_ = new NSString(bindings.NSViewAnimationFadeOutEffect); +} + +NSString NSAnimationTriggerOrderIn () +{ + if (NSAnimationTriggerOrderIn_) + return NSAnimationTriggerOrderIn_; + + return NSAnimationTriggerOrderIn_ = new NSString(bindings.NSAnimationTriggerOrderIn); +} + +NSString NSAnimationTriggerOrderOut () +{ + if (NSAnimationTriggerOrderOut_) + return NSAnimationTriggerOrderOut_; + + return NSAnimationTriggerOrderOut_ = new NSString(bindings.NSAnimationTriggerOrderOut); +} + +enum +{ + NSAnimationEaseInOut, + NSAnimationEaseIn, + NSAnimationEaseOut, + NSAnimationLinear +} + +enum +{ + NSAnimationBlocking, + NSAnimationNonblocking, + NSAnimationNonblockingThreaded +} + +class NSAnimation : NSObject, INSCopying, INSCoding +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + typeof(this) copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); + } + + NSAnimation initWithDuration (double duration, uint animationCurve) + { + id result = invokeObjcSelf!(id, "initWithDuration:animationCurve:", double, uint)(duration, animationCurve); + return result is this.objcObject ? this : (result !is null ? new NSAnimation(result) : null); + } + + this (double duration, uint animationCurve) + { + super(NSAnimation.alloc.initWithDuration(duration, animationCurve).objcObject); + } + + void startAnimation () + { + return invokeObjcSelf!(void, "startAnimation"); + } + + void stopAnimation () + { + return invokeObjcSelf!(void, "stopAnimation"); + } + + bool isAnimating () + { + return invokeObjcSelf!(bool, "isAnimating"); + } + + float currentProgress () + { + return invokeObjcSelf!(float, "currentProgress"); + } + + void setCurrentProgress (float progress) + { + return invokeObjcSelf!(void, "setCurrentProgress:", float)(progress); + } + + void setDuration (double duration) + { + return invokeObjcSelf!(void, "setDuration:", double)(duration); + } + + double duration () + { + return invokeObjcSelf!(double, "duration"); + } + + uint animationBlockingMode () + { + return invokeObjcSelf!(uint, "animationBlockingMode"); + } + + void setAnimationBlockingMode (uint animationBlockingMode) + { + return invokeObjcSelf!(void, "setAnimationBlockingMode:", uint)(animationBlockingMode); + } + + void setFrameRate (float framesPerSecond) + { + return invokeObjcSelf!(void, "setFrameRate:", float)(framesPerSecond); + } + + float frameRate () + { + return invokeObjcSelf!(float, "frameRate"); + } + + void setAnimationCurve (uint curve) + { + return invokeObjcSelf!(void, "setAnimationCurve:", uint)(curve); + } + + uint animationCurve () + { + return invokeObjcSelf!(uint, "animationCurve"); + } + + float currentValue () + { + return invokeObjcSelf!(float, "currentValue"); + } + + void setDelegate (Object delegate_) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(delegate_); + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + NSArray progressMarks () + { + return invokeObjcSelf!(NSArray, "progressMarks"); + } + + void setProgressMarks (NSArray progressMarks) + { + return invokeObjcSelf!(void, "setProgressMarks:", NSArray)(progressMarks); + } + + void addProgressMark (float progressMark) + { + return invokeObjcSelf!(void, "addProgressMark:", float)(progressMark); + } + + void removeProgressMark (float progressMark) + { + return invokeObjcSelf!(void, "removeProgressMark:", float)(progressMark); + } + + void startWhenAnimation (NSAnimation animation, float startProgress) + { + return invokeObjcSelf!(void, "startWhenAnimation:reachesProgress:", NSAnimation, float)(animation, startProgress); + } + + void stopWhenAnimation (NSAnimation animation, float stopProgress) + { + return invokeObjcSelf!(void, "stopWhenAnimation:reachesProgress:", NSAnimation, float)(animation, stopProgress); + } + + void clearStartAnimation () + { + return invokeObjcSelf!(void, "clearStartAnimation"); + } + + void clearStopAnimation () + { + return invokeObjcSelf!(void, "clearStopAnimation"); + } + + NSArray runLoopModesForAnimating () + { + return invokeObjcSelf!(NSArray, "runLoopModesForAnimating"); + } + +} + +class NSViewAnimation : NSAnimation +{ + mixin (ObjcWrap); + + NSViewAnimation initWithViewAnimations (NSArray viewAnimations) + { + id result = invokeObjcSelf!(id, "initWithViewAnimations:", NSArray)(viewAnimations); + return result is this.objcObject ? this : (result !is null ? new NSViewAnimation(result) : null); + } + + this (NSArray viewAnimations) + { + super(NSViewAnimation.alloc.initWithViewAnimations(viewAnimations).objcObject); + } + + NSArray viewAnimations () + { + return invokeObjcSelf!(NSArray, "viewAnimations"); + } + + void setViewAnimations (NSArray viewAnimations) + { + return invokeObjcSelf!(void, "setViewAnimations:", NSArray)(viewAnimations); + } +} + +interface INSAnimatablePropertyContainer +{ + Object animator (); + NSDictionary animations (); + void setAnimations (NSDictionary dict); + Object animationForKey (NSString key); + static Object defaultAnimationForKey (NSString key); +} + +const TNSAnimationDelegate = ` + + bool animationShouldStart (NSAnimation animation) + { + return invokeObjcSelf!(bool, "animationShouldStart:", NSAnimation)(animation); + } + + void animationDidStop (NSAnimation animation) + { + return invokeObjcSelf!(void, "animationDidStop:", NSAnimation)(animation); + } + + void animationDidEnd (NSAnimation animation) + { + return invokeObjcSelf!(void, "animationDidEnd:", NSAnimation)(animation); + } + + float animation (NSAnimation animation, float progress) + { + return invokeObjcSelf!(float, "animation:valueForProgress:", NSAnimation, float)(animation, progress); + } + + void animation (NSAnimation animation, float progress) + { + return invokeObjcSelf!(void, "animation:didReachProgressMark:", NSAnimation, float)(animation, progress); + } + + //mixin ObjcBindMethod!(animationShouldStart, "animationShouldStart:"); + //mixin ObjcBindMethod!(animationDidStop, "animationDidStop:"); + //mixin ObjcBindMethod!(animationDidEnd, "animationDidEnd:"); + //mixin ObjcBindMethod!(animation, "animation:valueForProgress:"); + //mixin ObjcBindMethod!(animation, "animation:didReachProgressMark:"); + +`; + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSAnimationContext.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSAnimationContext.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,44 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSAnimationContext; + +import dstep.appkit.AppKitDefines; +import dstep.foundation.NSDate; +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSAnimationContext : NSObject +{ + mixin (ObjcWrap); + + static void beginGrouping () + { + return invokeObjcSelfClass!(void, "beginGrouping"); + } + + static void endGrouping () + { + return invokeObjcSelfClass!(void, "endGrouping"); + } + + static NSAnimationContext currentContext () + { + return invokeObjcSelfClass!(NSAnimationContext, "currentContext"); + } + + void setDuration (double duration) + { + return invokeObjcSelf!(void, "setDuration:", double)(duration); + } + + double duration () + { + return invokeObjcSelf!(double, "duration"); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSAnimation_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSAnimation_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,27 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSAnimation_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package id NSAnimationProgressMarkNotification; + package id NSAnimationProgressMark; + package id NSViewAnimationTargetKey; + package id NSViewAnimationStartFrameKey; + package id NSViewAnimationEndFrameKey; + package id NSViewAnimationEffectKey; + package id NSViewAnimationFadeInEffect; + package id NSViewAnimationFadeOutEffect; + package id NSAnimationTriggerOrderIn; + package id NSAnimationTriggerOrderOut; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSAppleScriptExtensions.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSAppleScriptExtensions.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,24 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSAppleScriptExtensions; + +import dstep.appkit.NSAttributedString; +import dstep.foundation.NSAppleScript; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +const TNSExtensions = ` + + NSAttributedString richTextSource () + { + return invokeObjcSelf!(NSAttributedString, "richTextSource"); + } + + //mixin ObjcBindMethod!(richTextSource, "richTextSource"); + +`; + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSApplication.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSApplication.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,1022 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSApplication; + +import dstep.appkit.AppKitDefines; +import dstep.appkit.NSColorPanel; +import dstep.appkit.NSDockTile; +import dstep.appkit.NSEvent; +import dstep.appkit.NSGraphicsContext; +import dstep.appkit.NSHelpManager; +import dstep.appkit.NSImage; +import dstep.appkit.NSMenu; +import dstep.appkit.NSPageLayout; +import dstep.appkit.NSPasteboard; +import dstep.appkit.NSResponder; +import dstep.appkit.NSUserInterfaceValidation; +import dstep.appkit.NSWindow; +import dstep.foundation.NSArray; +import dstep.foundation.NSDate; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSError; +import dstep.foundation.NSException; +import dstep.foundation.NSNotification; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSString; +import dstep.internal.String; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.appkit.NSApplication_bindings; + +struct _NSModalSession; +struct NSThreadPrivate; + +alias _NSModalSession* NSModalSession; +alias NSThreadPrivate _NSThreadPrivate; +alias NSUInteger NSRequestUserAttentionType; +alias NSUInteger NSApplicationDelegateReply; +alias NSUInteger NSApplicationTerminateReply; +alias NSUInteger NSApplicationPrintReply; + +extern (C) +{ + extern + { + const double NSAppKitVersionNumber; + } +} + +private +{ + NSString NSModalPanelRunLoopMode_; + NSString NSEventTrackingRunLoopMode_; + NSApplication NSApp_; + NSString NSApplicationDidBecomeActiveNotification_; + NSString NSApplicationDidHideNotification_; + NSString NSApplicationDidFinishLaunchingNotification_; + NSString NSApplicationDidResignActiveNotification_; + NSString NSApplicationDidUnhideNotification_; + NSString NSApplicationDidUpdateNotification_; + NSString NSApplicationWillBecomeActiveNotification_; + NSString NSApplicationWillHideNotification_; + NSString NSApplicationWillFinishLaunchingNotification_; + NSString NSApplicationWillResignActiveNotification_; + NSString NSApplicationWillUnhideNotification_; + NSString NSApplicationWillUpdateNotification_; + NSString NSApplicationWillTerminateNotification_; + NSString NSApplicationDidChangeScreenParametersNotification_; +} + +NSString NSModalPanelRunLoopMode () +{ + if (NSModalPanelRunLoopMode_) + return NSModalPanelRunLoopMode_; + + return NSModalPanelRunLoopMode_ = new NSString(bindings.NSModalPanelRunLoopMode); +} + +NSString NSEventTrackingRunLoopMode () +{ + if (NSEventTrackingRunLoopMode_) + return NSEventTrackingRunLoopMode_; + + return NSEventTrackingRunLoopMode_ = new NSString(bindings.NSEventTrackingRunLoopMode); +} + +NSApplication NSApp () +{ + if (NSApp_) + return NSApp_; + + return NSApp_ = new NSApplication(bindings.NSApp); +} + +NSString NSApplicationDidBecomeActiveNotification () +{ + if (NSApplicationDidBecomeActiveNotification_) + return NSApplicationDidBecomeActiveNotification_; + + return NSApplicationDidBecomeActiveNotification_ = new NSString(bindings.NSApplicationDidBecomeActiveNotification); +} + +NSString NSApplicationDidHideNotification () +{ + if (NSApplicationDidHideNotification_) + return NSApplicationDidHideNotification_; + + return NSApplicationDidHideNotification_ = new NSString(bindings.NSApplicationDidHideNotification); +} + +NSString NSApplicationDidFinishLaunchingNotification () +{ + if (NSApplicationDidFinishLaunchingNotification_) + return NSApplicationDidFinishLaunchingNotification_; + + return NSApplicationDidFinishLaunchingNotification_ = new NSString(bindings.NSApplicationDidFinishLaunchingNotification); +} + +NSString NSApplicationDidResignActiveNotification () +{ + if (NSApplicationDidResignActiveNotification_) + return NSApplicationDidResignActiveNotification_; + + return NSApplicationDidResignActiveNotification_ = new NSString(bindings.NSApplicationDidResignActiveNotification); +} + +NSString NSApplicationDidUnhideNotification () +{ + if (NSApplicationDidUnhideNotification_) + return NSApplicationDidUnhideNotification_; + + return NSApplicationDidUnhideNotification_ = new NSString(bindings.NSApplicationDidUnhideNotification); +} + +NSString NSApplicationDidUpdateNotification () +{ + if (NSApplicationDidUpdateNotification_) + return NSApplicationDidUpdateNotification_; + + return NSApplicationDidUpdateNotification_ = new NSString(bindings.NSApplicationDidUpdateNotification); +} + +NSString NSApplicationWillBecomeActiveNotification () +{ + if (NSApplicationWillBecomeActiveNotification_) + return NSApplicationWillBecomeActiveNotification_; + + return NSApplicationWillBecomeActiveNotification_ = new NSString(bindings.NSApplicationWillBecomeActiveNotification); +} + +NSString NSApplicationWillHideNotification () +{ + if (NSApplicationWillHideNotification_) + return NSApplicationWillHideNotification_; + + return NSApplicationWillHideNotification_ = new NSString(bindings.NSApplicationWillHideNotification); +} + +NSString NSApplicationWillFinishLaunchingNotification () +{ + if (NSApplicationWillFinishLaunchingNotification_) + return NSApplicationWillFinishLaunchingNotification_; + + return NSApplicationWillFinishLaunchingNotification_ = new NSString(bindings.NSApplicationWillFinishLaunchingNotification); +} + +NSString NSApplicationWillResignActiveNotification () +{ + if (NSApplicationWillResignActiveNotification_) + return NSApplicationWillResignActiveNotification_; + + return NSApplicationWillResignActiveNotification_ = new NSString(bindings.NSApplicationWillResignActiveNotification); +} + +NSString NSApplicationWillUnhideNotification () +{ + if (NSApplicationWillUnhideNotification_) + return NSApplicationWillUnhideNotification_; + + return NSApplicationWillUnhideNotification_ = new NSString(bindings.NSApplicationWillUnhideNotification); +} + +NSString NSApplicationWillUpdateNotification () +{ + if (NSApplicationWillUpdateNotification_) + return NSApplicationWillUpdateNotification_; + + return NSApplicationWillUpdateNotification_ = new NSString(bindings.NSApplicationWillUpdateNotification); +} + +NSString NSApplicationWillTerminateNotification () +{ + if (NSApplicationWillTerminateNotification_) + return NSApplicationWillTerminateNotification_; + + return NSApplicationWillTerminateNotification_ = new NSString(bindings.NSApplicationWillTerminateNotification); +} + +NSString NSApplicationDidChangeScreenParametersNotification () +{ + if (NSApplicationDidChangeScreenParametersNotification_) + return NSApplicationDidChangeScreenParametersNotification_; + + return NSApplicationDidChangeScreenParametersNotification_ = new NSString(bindings.NSApplicationDidChangeScreenParametersNotification); +} + +enum +{ + NSRunStoppedResponse = (-1000), + NSRunAbortedResponse = (-1001), + NSRunContinuesResponse = (-1002) +} + +enum +{ + NSUpdateWindowsRunLoopOrdering = 500000 +} + +enum +{ + NSCriticalRequest = 0, + NSInformationalRequest = 10 +} + +enum +{ + NSApplicationDelegateReplySuccess = 0, + NSApplicationDelegateReplyCancel = 1, + NSApplicationDelegateReplyFailure = 2 +} + +enum +{ + NSTerminateCancel = 0, + NSTerminateNow = 1, + NSTerminateLater = 2 +} + +enum +{ + NSPrintingCancelled = 0, + NSPrintingSuccess = 1, + NSPrintingFailure = 3, + NSPrintingReplyLater = 2 +} + +const TNSServicesMenu = ` + + void setServicesMenu (NSMenu aMenu) + { + return invokeObjcSelf!(void, "setServicesMenu:", NSMenu)(aMenu); + } + + NSMenu servicesMenu () + { + return invokeObjcSelf!(NSMenu, "servicesMenu"); + } + + void registerServicesMenuSendTypes (NSArray sendTypes, NSArray returnTypes) + { + return invokeObjcSelf!(void, "registerServicesMenuSendTypes:returnTypes:", NSArray, NSArray)(sendTypes, returnTypes); + } + + //mixin ObjcBindMethod!(setServicesMenu, "setServicesMenu:"); + //mixin ObjcBindMethod!(servicesMenu, "servicesMenu"); + //mixin ObjcBindMethod!(registerServicesMenuSendTypes, "registerServicesMenuSendTypes:returnTypes:"); + +`; + +const TNSServicesRequests = ` + + bool writeSelectionToPasteboard (NSPasteboard pboard, NSArray types) + { + return invokeObjcSelf!(bool, "writeSelectionToPasteboard:types:", NSPasteboard, NSArray)(pboard, types); + } + + bool readSelectionFromPasteboard (NSPasteboard pboard) + { + return invokeObjcSelf!(bool, "readSelectionFromPasteboard:", NSPasteboard)(pboard); + } + + //mixin ObjcBindMethod!(writeSelectionToPasteboard, "writeSelectionToPasteboard:types:"); + //mixin ObjcBindMethod!(readSelectionFromPasteboard, "readSelectionFromPasteboard:"); + +`; + +const TNSStandardAboutPanel = ` + + void orderFrontStandardAboutPanel (Object sender) + { + return invokeObjcSelf!(void, "orderFrontStandardAboutPanel:", Object)(sender); + } + + void orderFrontStandardAboutPanelWithOptions (NSDictionary optionsDictionary) + { + return invokeObjcSelf!(void, "orderFrontStandardAboutPanelWithOptions:", NSDictionary)(optionsDictionary); + } + + //mixin ObjcBindMethod!(orderFrontStandardAboutPanel, "orderFrontStandardAboutPanel:"); + //mixin ObjcBindMethod!(orderFrontStandardAboutPanelWithOptions, "orderFrontStandardAboutPanelWithOptions:"); + +`; + +const TNSWindowsMenu = ` + + void setWindowsMenu (NSMenu aMenu) + { + return invokeObjcSelf!(void, "setWindowsMenu:", NSMenu)(aMenu); + } + + NSMenu windowsMenu () + { + return invokeObjcSelf!(NSMenu, "windowsMenu"); + } + + void arrangeInFront (Object sender) + { + return invokeObjcSelf!(void, "arrangeInFront:", Object)(sender); + } + + void removeWindowsItem (NSWindow win) + { + return invokeObjcSelf!(void, "removeWindowsItem:", NSWindow)(win); + } + + void addWindowsItem (NSWindow win, NSString aString, bool isFilename) + { + return invokeObjcSelf!(void, "addWindowsItem:title:filename:", NSWindow, NSString, bool)(win, aString, isFilename); + } + + void changeWindowsItem (NSWindow win, NSString aString, bool isFilename) + { + return invokeObjcSelf!(void, "changeWindowsItem:title:filename:", NSWindow, NSString, bool)(win, aString, isFilename); + } + + void updateWindowsItem (NSWindow win) + { + return invokeObjcSelf!(void, "updateWindowsItem:", NSWindow)(win); + } + + void miniaturizeAll (Object sender) + { + return invokeObjcSelf!(void, "miniaturizeAll:", Object)(sender); + } + + //mixin ObjcBindMethod!(setWindowsMenu, "setWindowsMenu:"); + //mixin ObjcBindMethod!(windowsMenu, "windowsMenu"); + //mixin ObjcBindMethod!(arrangeInFront, "arrangeInFront:"); + //mixin ObjcBindMethod!(removeWindowsItem, "removeWindowsItem:"); + //mixin ObjcBindMethod!(addWindowsItem, "addWindowsItem:title:filename:"); + //mixin ObjcBindMethod!(changeWindowsItem, "changeWindowsItem:title:filename:"); + //mixin ObjcBindMethod!(updateWindowsItem, "updateWindowsItem:"); + //mixin ObjcBindMethod!(miniaturizeAll, "miniaturizeAll:"); + +`; + +const TNSApplicationDelegate = ` + + uint applicationShouldTerminate (NSApplication sender) + { + return invokeObjcSelf!(uint, "applicationShouldTerminate:", NSApplication)(sender); + } + + bool application (NSApplication sender, NSString filename) + { + return invokeObjcSelf!(bool, "application:openFile:", NSApplication, NSString)(sender, filename); + } + + void application (NSApplication sender, NSArray filenames) + { + return invokeObjcSelf!(void, "application:openFiles:", NSApplication, NSArray)(sender, filenames); + } + + bool application (NSApplication sender, NSString filename) + { + return invokeObjcSelf!(bool, "application:openTempFile:", NSApplication, NSString)(sender, filename); + } + + bool applicationShouldOpenUntitledFile (NSApplication sender) + { + return invokeObjcSelf!(bool, "applicationShouldOpenUntitledFile:", NSApplication)(sender); + } + + bool applicationOpenUntitledFile (NSApplication sender) + { + return invokeObjcSelf!(bool, "applicationOpenUntitledFile:", NSApplication)(sender); + } + + bool application (Object sender, NSString filename) + { + return invokeObjcSelf!(bool, "application:openFileWithoutUI:", Object, NSString)(sender, filename); + } + + bool application (NSApplication sender, NSString filename) + { + return invokeObjcSelf!(bool, "application:printFile:", NSApplication, NSString)(sender, filename); + } + + uint application (NSApplication application, NSArray fileNames, NSDictionary printSettings, bool showPrintPanels) + { + return invokeObjcSelf!(uint, "application:printFiles:withSettings:showPrintPanels:", NSApplication, NSArray, NSDictionary, bool)(application, fileNames, printSettings, showPrintPanels); + } + + void application (NSApplication sender, NSArray filenames) + { + return invokeObjcSelf!(void, "application:printFiles:", NSApplication, NSArray)(sender, filenames); + } + + bool applicationShouldTerminateAfterLastWindowClosed (NSApplication sender) + { + return invokeObjcSelf!(bool, "applicationShouldTerminateAfterLastWindowClosed:", NSApplication)(sender); + } + + bool applicationShouldHandleReopen (NSApplication sender, bool flag) + { + return invokeObjcSelf!(bool, "applicationShouldHandleReopen:hasVisibleWindows:", NSApplication, bool)(sender, flag); + } + + NSMenu applicationDockMenu (NSApplication sender) + { + return invokeObjcSelf!(NSMenu, "applicationDockMenu:", NSApplication)(sender); + } + + NSError application (NSApplication application, NSError error) + { + return invokeObjcSelf!(NSError, "application:willPresentError:", NSApplication, NSError)(application, error); + } + + //mixin ObjcBindMethod!(applicationShouldTerminate, "applicationShouldTerminate:"); + //mixin ObjcBindMethod!(application, "application:openFile:"); + //mixin ObjcBindMethod!(application, "application:openFiles:"); + //mixin ObjcBindMethod!(application, "application:openTempFile:"); + //mixin ObjcBindMethod!(applicationShouldOpenUntitledFile, "applicationShouldOpenUntitledFile:"); + //mixin ObjcBindMethod!(applicationOpenUntitledFile, "applicationOpenUntitledFile:"); + //mixin ObjcBindMethod!(application, "application:openFileWithoutUI:"); + //mixin ObjcBindMethod!(application, "application:printFile:"); + //mixin ObjcBindMethod!(application, "application:printFiles:withSettings:showPrintPanels:"); + //mixin ObjcBindMethod!(application, "application:printFiles:"); + //mixin ObjcBindMethod!(applicationShouldTerminateAfterLastWindowClosed, "applicationShouldTerminateAfterLastWindowClosed:"); + //mixin ObjcBindMethod!(applicationShouldHandleReopen, "applicationShouldHandleReopen:hasVisibleWindows:"); + //mixin ObjcBindMethod!(applicationDockMenu, "applicationDockMenu:"); + //mixin ObjcBindMethod!(application, "application:willPresentError:"); + +`; + +const TNSApplicationNotifications = ` + + void applicationWillFinishLaunching (NSNotification notification) + { + return invokeObjcSelf!(void, "applicationWillFinishLaunching:", NSNotification)(notification); + } + + void applicationDidFinishLaunching (NSNotification notification) + { + return invokeObjcSelf!(void, "applicationDidFinishLaunching:", NSNotification)(notification); + } + + void applicationWillHide (NSNotification notification) + { + return invokeObjcSelf!(void, "applicationWillHide:", NSNotification)(notification); + } + + void applicationDidHide (NSNotification notification) + { + return invokeObjcSelf!(void, "applicationDidHide:", NSNotification)(notification); + } + + void applicationWillUnhide (NSNotification notification) + { + return invokeObjcSelf!(void, "applicationWillUnhide:", NSNotification)(notification); + } + + void applicationDidUnhide (NSNotification notification) + { + return invokeObjcSelf!(void, "applicationDidUnhide:", NSNotification)(notification); + } + + void applicationWillBecomeActive (NSNotification notification) + { + return invokeObjcSelf!(void, "applicationWillBecomeActive:", NSNotification)(notification); + } + + void applicationDidBecomeActive (NSNotification notification) + { + return invokeObjcSelf!(void, "applicationDidBecomeActive:", NSNotification)(notification); + } + + void applicationWillResignActive (NSNotification notification) + { + return invokeObjcSelf!(void, "applicationWillResignActive:", NSNotification)(notification); + } + + void applicationDidResignActive (NSNotification notification) + { + return invokeObjcSelf!(void, "applicationDidResignActive:", NSNotification)(notification); + } + + void applicationWillUpdate (NSNotification notification) + { + return invokeObjcSelf!(void, "applicationWillUpdate:", NSNotification)(notification); + } + + void applicationDidUpdate (NSNotification notification) + { + return invokeObjcSelf!(void, "applicationDidUpdate:", NSNotification)(notification); + } + + void applicationWillTerminate (NSNotification notification) + { + return invokeObjcSelf!(void, "applicationWillTerminate:", NSNotification)(notification); + } + + void applicationDidChangeScreenParameters (NSNotification notification) + { + return invokeObjcSelf!(void, "applicationDidChangeScreenParameters:", NSNotification)(notification); + } + + //mixin ObjcBindMethod!(applicationWillFinishLaunching, "applicationWillFinishLaunching:"); + //mixin ObjcBindMethod!(applicationDidFinishLaunching, "applicationDidFinishLaunching:"); + //mixin ObjcBindMethod!(applicationWillHide, "applicationWillHide:"); + //mixin ObjcBindMethod!(applicationDidHide, "applicationDidHide:"); + //mixin ObjcBindMethod!(applicationWillUnhide, "applicationWillUnhide:"); + //mixin ObjcBindMethod!(applicationDidUnhide, "applicationDidUnhide:"); + //mixin ObjcBindMethod!(applicationWillBecomeActive, "applicationWillBecomeActive:"); + //mixin ObjcBindMethod!(applicationDidBecomeActive, "applicationDidBecomeActive:"); + //mixin ObjcBindMethod!(applicationWillResignActive, "applicationWillResignActive:"); + //mixin ObjcBindMethod!(applicationDidResignActive, "applicationDidResignActive:"); + //mixin ObjcBindMethod!(applicationWillUpdate, "applicationWillUpdate:"); + //mixin ObjcBindMethod!(applicationDidUpdate, "applicationDidUpdate:"); + //mixin ObjcBindMethod!(applicationWillTerminate, "applicationWillTerminate:"); + //mixin ObjcBindMethod!(applicationDidChangeScreenParameters, "applicationDidChangeScreenParameters:"); + +`; + +const TNSServicesHandling = ` + + void setServicesProvider (Object provider) + { + return invokeObjcSelf!(void, "setServicesProvider:", Object)(provider); + } + + Object servicesProvider () + { + return invokeObjcSelf!(Object, "servicesProvider"); + } + + //mixin ObjcBindMethod!(setServicesProvider, "setServicesProvider:"); + //mixin ObjcBindMethod!(servicesProvider, "servicesProvider"); + +`; + +class NSApplication : NSResponder, INSUserInterfaceValidations +{ + mixin (ObjcWrap); + + static NSApplication sharedApplication () + { + return invokeObjcSelfClass!(NSApplication, "sharedApplication"); + } + + void setDelegate (Object anObject) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(anObject); + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + NSGraphicsContext context () + { + return invokeObjcSelf!(NSGraphicsContext, "context"); + } + + void hide (Object sender) + { + return invokeObjcSelf!(void, "hide:", Object)(sender); + } + + void unhide (Object sender) + { + return invokeObjcSelf!(void, "unhide:", Object)(sender); + } + + void unhideWithoutActivation () + { + return invokeObjcSelf!(void, "unhideWithoutActivation"); + } + + NSWindow windowWithWindowNumber (NSInteger windowNum) + { + return invokeObjcSelf!(NSWindow, "windowWithWindowNumber:", NSInteger)(windowNum); + } + + NSWindow mainWindow () + { + return invokeObjcSelf!(NSWindow, "mainWindow"); + } + + NSWindow keyWindow () + { + return invokeObjcSelf!(NSWindow, "keyWindow"); + } + + bool isActive () + { + return invokeObjcSelf!(bool, "isActive"); + } + + bool isHidden () + { + return invokeObjcSelf!(bool, "isHidden"); + } + + bool isRunning () + { + return invokeObjcSelf!(bool, "isRunning"); + } + + void deactivate () + { + return invokeObjcSelf!(void, "deactivate"); + } + + void activateIgnoringOtherApps (bool flag) + { + return invokeObjcSelf!(void, "activateIgnoringOtherApps:", bool)(flag); + } + + void hideOtherApplications (Object sender) + { + return invokeObjcSelf!(void, "hideOtherApplications:", Object)(sender); + } + + void unhideAllApplications (Object sender) + { + return invokeObjcSelf!(void, "unhideAllApplications:", Object)(sender); + } + + void finishLaunching () + { + return invokeObjcSelf!(void, "finishLaunching"); + } + + void run () + { + return invokeObjcSelf!(void, "run"); + } + + NSInteger runModalForWindow (NSWindow theWindow) + { + return invokeObjcSelf!(NSInteger, "runModalForWindow:", NSWindow)(theWindow); + } + + void stop (Object sender) + { + return invokeObjcSelf!(void, "stop:", Object)(sender); + } + + void stopModal () + { + return invokeObjcSelf!(void, "stopModal"); + } + + void stopModalWithCode (NSInteger returnCode) + { + return invokeObjcSelf!(void, "stopModalWithCode:", NSInteger)(returnCode); + } + + void abortModal () + { + return invokeObjcSelf!(void, "abortModal"); + } + + NSWindow modalWindow () + { + return invokeObjcSelf!(NSWindow, "modalWindow"); + } + + NSModalSession beginModalSessionForWindow (NSWindow theWindow) + { + return invokeObjcSelf!(NSModalSession, "beginModalSessionForWindow:", NSWindow)(theWindow); + } + + NSInteger runModalSession (NSModalSession session) + { + return invokeObjcSelf!(NSInteger, "runModalSession:", NSModalSession)(session); + } + + void endModalSession (NSModalSession session) + { + return invokeObjcSelf!(void, "endModalSession:", NSModalSession)(session); + } + + void terminate (Object sender) + { + return invokeObjcSelf!(void, "terminate:", Object)(sender); + } + + NSInteger requestUserAttention (uint requestType) + { + return invokeObjcSelf!(NSInteger, "requestUserAttention:", uint)(requestType); + } + + void cancelUserAttentionRequest (NSInteger request) + { + return invokeObjcSelf!(void, "cancelUserAttentionRequest:", NSInteger)(request); + } + + void beginSheet (NSWindow sheet, NSWindow docWindow, Object modalDelegate, SEL didEndSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo:", NSWindow, NSWindow, Object, SEL, void*)(sheet, docWindow, modalDelegate, didEndSelector, contextInfo); + } + + void endSheet (NSWindow sheet) + { + return invokeObjcSelf!(void, "endSheet:", NSWindow)(sheet); + } + + void endSheet (NSWindow sheet, NSInteger returnCode) + { + return invokeObjcSelf!(void, "endSheet:returnCode:", NSWindow, NSInteger)(sheet, returnCode); + } + + NSInteger runModalForWindow (NSWindow theWindow, NSWindow docWindow) + { + return invokeObjcSelf!(NSInteger, "runModalForWindow:relativeToWindow:", NSWindow, NSWindow)(theWindow, docWindow); + } + + NSModalSession beginModalSessionForWindow (NSWindow theWindow, NSWindow docWindow) + { + return invokeObjcSelf!(NSModalSession, "beginModalSessionForWindow:relativeToWindow:", NSWindow, NSWindow)(theWindow, docWindow); + } + + NSEvent nextEventMatchingMask (NSUInteger mask, NSDate expiration, NSString mode, bool deqFlag) + { + return invokeObjcSelf!(NSEvent, "nextEventMatchingMask:untilDate:inMode:dequeue:", NSUInteger, NSDate, NSString, bool)(mask, expiration, mode, deqFlag); + } + + void discardEventsMatchingMask (NSUInteger mask, NSEvent lastEvent) + { + return invokeObjcSelf!(void, "discardEventsMatchingMask:beforeEvent:", NSUInteger, NSEvent)(mask, lastEvent); + } + + void postEvent (NSEvent event, bool flag) + { + return invokeObjcSelf!(void, "postEvent:atStart:", NSEvent, bool)(event, flag); + } + + NSEvent currentEvent () + { + return invokeObjcSelf!(NSEvent, "currentEvent"); + } + + void sendEvent (NSEvent theEvent) + { + return invokeObjcSelf!(void, "sendEvent:", NSEvent)(theEvent); + } + + void preventWindowOrdering () + { + return invokeObjcSelf!(void, "preventWindowOrdering"); + } + + NSWindow makeWindowsPerform (SEL aSelector, bool flag) + { + return invokeObjcSelf!(NSWindow, "makeWindowsPerform:inOrder:", SEL, bool)(aSelector, flag); + } + + NSArray windows () + { + return invokeObjcSelf!(NSArray, "windows"); + } + + void setWindowsNeedUpdate (bool needUpdate) + { + return invokeObjcSelf!(void, "setWindowsNeedUpdate:", bool)(needUpdate); + } + + void updateWindows () + { + return invokeObjcSelf!(void, "updateWindows"); + } + + void setMainMenu (NSMenu aMenu) + { + return invokeObjcSelf!(void, "setMainMenu:", NSMenu)(aMenu); + } + + NSMenu mainMenu () + { + return invokeObjcSelf!(NSMenu, "mainMenu"); + } + + void setApplicationIconImage (NSImage image) + { + return invokeObjcSelf!(void, "setApplicationIconImage:", NSImage)(image); + } + + NSImage applicationIconImage () + { + return invokeObjcSelf!(NSImage, "applicationIconImage"); + } + + NSDockTile dockTile () + { + return invokeObjcSelf!(NSDockTile, "dockTile"); + } + + bool sendAction (SEL theAction, Object theTarget, Object sender) + { + return invokeObjcSelf!(bool, "sendAction:to:from:", SEL, Object, Object)(theAction, theTarget, sender); + } + + Object targetForAction (SEL theAction) + { + return invokeObjcSelf!(Object, "targetForAction:", SEL)(theAction); + } + + Object targetForAction (SEL theAction, Object theTarget, Object sender) + { + return invokeObjcSelf!(Object, "targetForAction:to:from:", SEL, Object, Object)(theAction, theTarget, sender); + } + + bool tryToPerform (SEL anAction, Object anObject) + { + return invokeObjcSelf!(bool, "tryToPerform:with:", SEL, Object)(anAction, anObject); + } + + Object validRequestorForSendType (NSString sendType, NSString returnType) + { + return invokeObjcSelf!(Object, "validRequestorForSendType:returnType:", NSString, NSString)(sendType, returnType); + } + + void reportException (NSException theException) + { + return invokeObjcSelf!(void, "reportException:", NSException)(theException); + } + + static void detachDrawingThread (SEL selector, Object target, Object argument) + { + return invokeObjcSelfClass!(void, "detachDrawingThread:toTarget:withObject:", SEL, Object, Object)(selector, target, argument); + } + + void replyToApplicationShouldTerminate (bool shouldTerminate) + { + return invokeObjcSelf!(void, "replyToApplicationShouldTerminate:", bool)(shouldTerminate); + } + + void replyToOpenOrPrint (uint reply) + { + return invokeObjcSelf!(void, "replyToOpenOrPrint:", uint)(reply); + } + + void orderFrontCharacterPalette (Object sender) + { + return invokeObjcSelf!(void, "orderFrontCharacterPalette:", Object)(sender); + } + + bool validateUserInterfaceItem (INSValidatedUserInterfaceItem anItem) + { + return invokeObjcSelf!(bool, "validateUserInterfaceItem:", INSValidatedUserInterfaceItem)(anItem); + } + + // NSServicesMenu + void setServicesMenu (NSMenu aMenu) + { + return invokeObjcSelf!(void, "setServicesMenu:", NSMenu)(aMenu); + } + + NSMenu servicesMenu () + { + return invokeObjcSelf!(NSMenu, "servicesMenu"); + } + + void registerServicesMenuSendTypes (NSArray sendTypes, NSArray returnTypes) + { + return invokeObjcSelf!(void, "registerServicesMenuSendTypes:returnTypes:", NSArray, NSArray)(sendTypes, returnTypes); + } + + // NSApplicationHelpExtension + void activateContextHelpMode (Object sender) + { + return invokeObjcSelf!(void, "activateContextHelpMode:", Object)(sender); + } + + void showHelp (Object sender) + { + return invokeObjcSelf!(void, "showHelp:", Object)(sender); + } + + // NSStandardAboutPanel + void orderFrontStandardAboutPanel (Object sender) + { + return invokeObjcSelf!(void, "orderFrontStandardAboutPanel:", Object)(sender); + } + + void orderFrontStandardAboutPanelWithOptions (NSDictionary optionsDictionary) + { + return invokeObjcSelf!(void, "orderFrontStandardAboutPanelWithOptions:", NSDictionary)(optionsDictionary); + } + + // NSWindowsMenu + void setWindowsMenu (NSMenu aMenu) + { + return invokeObjcSelf!(void, "setWindowsMenu:", NSMenu)(aMenu); + } + + NSMenu windowsMenu () + { + return invokeObjcSelf!(NSMenu, "windowsMenu"); + } + + void arrangeInFront (Object sender) + { + return invokeObjcSelf!(void, "arrangeInFront:", Object)(sender); + } + + void removeWindowsItem (NSWindow win) + { + return invokeObjcSelf!(void, "removeWindowsItem:", NSWindow)(win); + } + + void addWindowsItem (NSWindow win, NSString aString, bool isFilename) + { + return invokeObjcSelf!(void, "addWindowsItem:title:filename:", NSWindow, NSString, bool)(win, aString, isFilename); + } + + void changeWindowsItem (NSWindow win, NSString aString, bool isFilename) + { + return invokeObjcSelf!(void, "changeWindowsItem:title:filename:", NSWindow, NSString, bool)(win, aString, isFilename); + } + + void updateWindowsItem (NSWindow win) + { + return invokeObjcSelf!(void, "updateWindowsItem:", NSWindow)(win); + } + + void miniaturizeAll (Object sender) + { + return invokeObjcSelf!(void, "miniaturizeAll:", Object)(sender); + } + + // NSPageLayoutPanel + void runPageLayout (Object sender) + { + return invokeObjcSelf!(void, "runPageLayout:", Object)(sender); + } + + // NSServicesHandling + void setServicesProvider (Object provider) + { + return invokeObjcSelf!(void, "setServicesProvider:", Object)(provider); + } + + Object servicesProvider () + { + return invokeObjcSelf!(Object, "servicesProvider"); + } + + // NSColorPanel + void orderFrontColorPanel (Object sender) + { + return invokeObjcSelf!(void, "orderFrontColorPanel:", Object)(sender); + } +} + +bool NSShowsServicesMenuItem (NSString itemName) +{ + return Bridge.invokeObjcFunction!(bool, bindings.NSShowsServicesMenuItem, NSString)(itemName); +} + +NSInteger NSSetShowsServicesMenuItem (NSString itemName, bool enabled) +{ + return Bridge.invokeObjcFunction!(NSInteger, bindings.NSSetShowsServicesMenuItem, NSString, bool)(itemName, enabled); +} + +bool NSPerformService (NSString itemName, NSPasteboard pboard) +{ + return Bridge.invokeObjcFunction!(bool, bindings.NSPerformService, NSString, NSPasteboard)(itemName, pboard); +} + +void NSRegisterServicesProvider (Object provider, NSString name) +{ + return Bridge.invokeObjcFunction!(void, bindings.NSRegisterServicesProvider, Object, NSString)(provider, name); +} + +void NSUnregisterServicesProvider (NSString name) +{ + return Bridge.invokeObjcFunction!(void, bindings.NSUnregisterServicesProvider, NSString)(name); +} + +int NSApplicationMain (string[] args) +{ + if (args.length == 0) + return NSApplicationMain(0, null); + + char*[] cArgs; + cArgs.reserve(args.length); + + foreach (str ; args) + cArgs ~= (str ~ '\0').ptr; + + return NSApplicationMain(cArgs.length, cArgs.ptr); +} + +int NSApplicationMain () +{ + return NSApplicationMain(0, null); +} + +extern (C) +{ + int NSApplicationMain (int argc, char** argv); + bool NSApplicationLoad (); + void NSUpdateDynamicServices (); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSApplicationScripting.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSApplicationScripting.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,23 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSApplicationScripting; + +import dstep.appkit.NSApplication; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +const TNSApplicationScriptingDelegation = ` + + bool application (NSApplication sender, NSString key) + { + return invokeObjcSelf!(bool, "application:delegateHandlesKey:", NSApplication, NSString)(sender, key); + } + + //mixin ObjcBindMethod!(application, "application:delegateHandlesKey:"); + +`; + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSApplication_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSApplication_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,43 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSApplication_bindings; + +import dstep.foundation.NSObjCRuntime; +import dstep.objc.objc; + +extern (C) +{ + extern + { + package id NSModalPanelRunLoopMode; + package id NSEventTrackingRunLoopMode; + package id NSApp; + package id NSApplicationDidBecomeActiveNotification; + package id NSApplicationDidHideNotification; + package id NSApplicationDidFinishLaunchingNotification; + package id NSApplicationDidResignActiveNotification; + package id NSApplicationDidUnhideNotification; + package id NSApplicationDidUpdateNotification; + package id NSApplicationWillBecomeActiveNotification; + package id NSApplicationWillHideNotification; + package id NSApplicationWillFinishLaunchingNotification; + package id NSApplicationWillResignActiveNotification; + package id NSApplicationWillUnhideNotification; + package id NSApplicationWillUpdateNotification; + package id NSApplicationWillTerminateNotification; + package id NSApplicationDidChangeScreenParametersNotification; + } +} + +extern (C) +{ + package bool NSShowsServicesMenuItem (id itemName); + package NSInteger NSSetShowsServicesMenuItem (id itemName, bool enabled); + package bool NSPerformService (id itemName, id pboard); + package void NSRegisterServicesProvider (id provider, id name); + package void NSUnregisterServicesProvider (id name); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSArrayController.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSArrayController.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,256 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSArrayController; + +import dstep.appkit.NSObjectController; +import dstep.foundation.NSArray; +import dstep.foundation.NSIndexSet; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSPredicate; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSArrayController : NSObjectController +{ + mixin (ObjcWrap); + + void rearrangeObjects () + { + return invokeObjcSelf!(void, "rearrangeObjects"); + } + + void setAutomaticallyRearrangesObjects (bool flag) + { + return invokeObjcSelf!(void, "setAutomaticallyRearrangesObjects:", bool)(flag); + } + + bool automaticallyRearrangesObjects () + { + return invokeObjcSelf!(bool, "automaticallyRearrangesObjects"); + } + + NSArray automaticRearrangementKeyPaths () + { + return invokeObjcSelf!(NSArray, "automaticRearrangementKeyPaths"); + } + + void didChangeArrangementCriteria () + { + return invokeObjcSelf!(void, "didChangeArrangementCriteria"); + } + + void setSortDescriptors (NSArray sortDescriptors) + { + return invokeObjcSelf!(void, "setSortDescriptors:", NSArray)(sortDescriptors); + } + + NSArray sortDescriptors () + { + return invokeObjcSelf!(NSArray, "sortDescriptors"); + } + + void setFilterPredicate (NSPredicate filterPredicate) + { + return invokeObjcSelf!(void, "setFilterPredicate:", NSPredicate)(filterPredicate); + } + + NSPredicate filterPredicate () + { + return invokeObjcSelf!(NSPredicate, "filterPredicate"); + } + + void setClearsFilterPredicateOnInsertion (bool flag) + { + return invokeObjcSelf!(void, "setClearsFilterPredicateOnInsertion:", bool)(flag); + } + + bool clearsFilterPredicateOnInsertion () + { + return invokeObjcSelf!(bool, "clearsFilterPredicateOnInsertion"); + } + + NSArray arrangeObjects (NSArray objects) + { + return invokeObjcSelf!(NSArray, "arrangeObjects:", NSArray)(objects); + } + + Object arrangedObjects () + { + return invokeObjcSelf!(Object, "arrangedObjects"); + } + + void setAvoidsEmptySelection (bool flag) + { + return invokeObjcSelf!(void, "setAvoidsEmptySelection:", bool)(flag); + } + + bool avoidsEmptySelection () + { + return invokeObjcSelf!(bool, "avoidsEmptySelection"); + } + + void setPreservesSelection (bool flag) + { + return invokeObjcSelf!(void, "setPreservesSelection:", bool)(flag); + } + + bool preservesSelection () + { + return invokeObjcSelf!(bool, "preservesSelection"); + } + + void setSelectsInsertedObjects (bool flag) + { + return invokeObjcSelf!(void, "setSelectsInsertedObjects:", bool)(flag); + } + + bool selectsInsertedObjects () + { + return invokeObjcSelf!(bool, "selectsInsertedObjects"); + } + + void setAlwaysUsesMultipleValuesMarker (bool flag) + { + return invokeObjcSelf!(void, "setAlwaysUsesMultipleValuesMarker:", bool)(flag); + } + + bool alwaysUsesMultipleValuesMarker () + { + return invokeObjcSelf!(bool, "alwaysUsesMultipleValuesMarker"); + } + + bool setSelectionIndexes (NSIndexSet indexes) + { + return invokeObjcSelf!(bool, "setSelectionIndexes:", NSIndexSet)(indexes); + } + + NSIndexSet selectionIndexes () + { + return invokeObjcSelf!(NSIndexSet, "selectionIndexes"); + } + + bool setSelectionIndex (NSUInteger index) + { + return invokeObjcSelf!(bool, "setSelectionIndex:", NSUInteger)(index); + } + + NSUInteger selectionIndex () + { + return invokeObjcSelf!(NSUInteger, "selectionIndex"); + } + + bool addSelectionIndexes (NSIndexSet indexes) + { + return invokeObjcSelf!(bool, "addSelectionIndexes:", NSIndexSet)(indexes); + } + + bool removeSelectionIndexes (NSIndexSet indexes) + { + return invokeObjcSelf!(bool, "removeSelectionIndexes:", NSIndexSet)(indexes); + } + + bool setSelectedObjects (NSArray objects) + { + return invokeObjcSelf!(bool, "setSelectedObjects:", NSArray)(objects); + } + + NSArray selectedObjects () + { + return invokeObjcSelf!(NSArray, "selectedObjects"); + } + + bool addSelectedObjects (NSArray objects) + { + return invokeObjcSelf!(bool, "addSelectedObjects:", NSArray)(objects); + } + + bool removeSelectedObjects (NSArray objects) + { + return invokeObjcSelf!(bool, "removeSelectedObjects:", NSArray)(objects); + } + + void add (Object sender) + { + return invokeObjcSelf!(void, "add:", Object)(sender); + } + + void remove (Object sender) + { + return invokeObjcSelf!(void, "remove:", Object)(sender); + } + + void insert (Object sender) + { + return invokeObjcSelf!(void, "insert:", Object)(sender); + } + + bool canInsert () + { + return invokeObjcSelf!(bool, "canInsert"); + } + + void selectNext (Object sender) + { + return invokeObjcSelf!(void, "selectNext:", Object)(sender); + } + + void selectPrevious (Object sender) + { + return invokeObjcSelf!(void, "selectPrevious:", Object)(sender); + } + + bool canSelectNext () + { + return invokeObjcSelf!(bool, "canSelectNext"); + } + + bool canSelectPrevious () + { + return invokeObjcSelf!(bool, "canSelectPrevious"); + } + + void addObject (Object object) + { + return invokeObjcSelf!(void, "addObject:", Object)(object); + } + + void addObjects (NSArray objects) + { + return invokeObjcSelf!(void, "addObjects:", NSArray)(objects); + } + + void insertObject (Object object, NSUInteger index) + { + return invokeObjcSelf!(void, "insertObject:atArrangedObjectIndex:", Object, NSUInteger)(object, index); + } + + void insertObjects (NSArray objects, NSIndexSet indexes) + { + return invokeObjcSelf!(void, "insertObjects:atArrangedObjectIndexes:", NSArray, NSIndexSet)(objects, indexes); + } + + void removeObjectAtArrangedObjectIndex (NSUInteger index) + { + return invokeObjcSelf!(void, "removeObjectAtArrangedObjectIndex:", NSUInteger)(index); + } + + void removeObjectsAtArrangedObjectIndexes (NSIndexSet indexes) + { + return invokeObjcSelf!(void, "removeObjectsAtArrangedObjectIndexes:", NSIndexSet)(indexes); + } + + void removeObject (Object object) + { + return invokeObjcSelf!(void, "removeObject:", Object)(object); + } + + void removeObjects (NSArray objects) + { + return invokeObjcSelf!(void, "removeObjects:", NSArray)(objects); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSAttributedString.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSAttributedString.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,1395 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSAttributedString; + +import dstep.appkit.AppKitDefines; +import dstep.appkit.NSFileWrapper; +import dstep.appkit.NSFontManager; +import dstep.appkit.NSText; +import dstep.appkit.NSTextList; +import dstep.appkit.NSTextTable; +import dstep.foundation.NSAttributedString; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSString; +import dstep.foundation.NSURL; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.appkit.NSAttributedString_bindings; + +extern (C) +{ + extern + { + NSUInteger NSUnderlineByWordMask; + NSUInteger NSUnderlineStrikethroughMask; + } +} + +private +{ + NSString NSFontAttributeName_; + NSString NSParagraphStyleAttributeName_; + NSString NSForegroundColorAttributeName_; + NSString NSUnderlineStyleAttributeName_; + NSString NSSuperscriptAttributeName_; + NSString NSBackgroundColorAttributeName_; + NSString NSAttachmentAttributeName_; + NSString NSLigatureAttributeName_; + NSString NSBaselineOffsetAttributeName_; + NSString NSKernAttributeName_; + NSString NSLinkAttributeName_; + NSString NSStrokeWidthAttributeName_; + NSString NSStrokeColorAttributeName_; + NSString NSUnderlineColorAttributeName_; + NSString NSStrikethroughStyleAttributeName_; + NSString NSStrikethroughColorAttributeName_; + NSString NSShadowAttributeName_; + NSString NSObliquenessAttributeName_; + NSString NSExpansionAttributeName_; + NSString NSCursorAttributeName_; + NSString NSToolTipAttributeName_; + NSString NSCharacterShapeAttributeName_; + NSString NSGlyphInfoAttributeName_; + NSString NSMarkedClauseSegmentAttributeName_; + NSString NSSpellingStateAttributeName_; + NSString NSPlainTextDocumentType_; + NSString NSRTFTextDocumentType_; + NSString NSRTFDTextDocumentType_; + NSString NSMacSimpleTextDocumentType_; + NSString NSHTMLTextDocumentType_; + NSString NSDocFormatTextDocumentType_; + NSString NSWordMLTextDocumentType_; + NSString NSWebArchiveTextDocumentType_; + NSString NSOfficeOpenXMLTextDocumentType_; + NSString NSOpenDocumentTextDocumentType_; + NSString NSPaperSizeDocumentAttribute_; + NSString NSLeftMarginDocumentAttribute_; + NSString NSRightMarginDocumentAttribute_; + NSString NSTopMarginDocumentAttribute_; + NSString NSBottomMarginDocumentAttribute_; + NSString NSViewSizeDocumentAttribute_; + NSString NSViewZoomDocumentAttribute_; + NSString NSViewModeDocumentAttribute_; + NSString NSDocumentTypeDocumentAttribute_; + NSString NSReadOnlyDocumentAttribute_; + NSString NSConvertedDocumentAttribute_; + NSString NSCocoaVersionDocumentAttribute_; + NSString NSBackgroundColorDocumentAttribute_; + NSString NSHyphenationFactorDocumentAttribute_; + NSString NSDefaultTabIntervalDocumentAttribute_; + NSString NSCharacterEncodingDocumentAttribute_; + NSString NSTitleDocumentAttribute_; + NSString NSCompanyDocumentAttribute_; + NSString NSCopyrightDocumentAttribute_; + NSString NSSubjectDocumentAttribute_; + NSString NSAuthorDocumentAttribute_; + NSString NSKeywordsDocumentAttribute_; + NSString NSCommentDocumentAttribute_; + NSString NSEditorDocumentAttribute_; + NSString NSCreationTimeDocumentAttribute_; + NSString NSModificationTimeDocumentAttribute_; + NSString NSExcludedElementsDocumentAttribute_; + NSString NSTextEncodingNameDocumentAttribute_; + NSString NSPrefixSpacesDocumentAttribute_; + NSString NSDocumentTypeDocumentOption_; + NSString NSDefaultAttributesDocumentOption_; + NSString NSCharacterEncodingDocumentOption_; + NSString NSTextEncodingNameDocumentOption_; + NSString NSBaseURLDocumentOption_; + NSString NSTimeoutDocumentOption_; + NSString NSWebPreferencesDocumentOption_; + NSString NSWebResourceLoadDelegateDocumentOption_; + NSString NSTextSizeMultiplierDocumentOption_; +} + +NSString NSFontAttributeName () +{ + if (NSFontAttributeName_) + return NSFontAttributeName_; + + return NSFontAttributeName_ = new NSString(bindings.NSFontAttributeName); +} + +NSString NSParagraphStyleAttributeName () +{ + if (NSParagraphStyleAttributeName_) + return NSParagraphStyleAttributeName_; + + return NSParagraphStyleAttributeName_ = new NSString(bindings.NSParagraphStyleAttributeName); +} + +NSString NSForegroundColorAttributeName () +{ + if (NSForegroundColorAttributeName_) + return NSForegroundColorAttributeName_; + + return NSForegroundColorAttributeName_ = new NSString(bindings.NSForegroundColorAttributeName); +} + +NSString NSUnderlineStyleAttributeName () +{ + if (NSUnderlineStyleAttributeName_) + return NSUnderlineStyleAttributeName_; + + return NSUnderlineStyleAttributeName_ = new NSString(bindings.NSUnderlineStyleAttributeName); +} + +NSString NSSuperscriptAttributeName () +{ + if (NSSuperscriptAttributeName_) + return NSSuperscriptAttributeName_; + + return NSSuperscriptAttributeName_ = new NSString(bindings.NSSuperscriptAttributeName); +} + +NSString NSBackgroundColorAttributeName () +{ + if (NSBackgroundColorAttributeName_) + return NSBackgroundColorAttributeName_; + + return NSBackgroundColorAttributeName_ = new NSString(bindings.NSBackgroundColorAttributeName); +} + +NSString NSAttachmentAttributeName () +{ + if (NSAttachmentAttributeName_) + return NSAttachmentAttributeName_; + + return NSAttachmentAttributeName_ = new NSString(bindings.NSAttachmentAttributeName); +} + +NSString NSLigatureAttributeName () +{ + if (NSLigatureAttributeName_) + return NSLigatureAttributeName_; + + return NSLigatureAttributeName_ = new NSString(bindings.NSLigatureAttributeName); +} + +NSString NSBaselineOffsetAttributeName () +{ + if (NSBaselineOffsetAttributeName_) + return NSBaselineOffsetAttributeName_; + + return NSBaselineOffsetAttributeName_ = new NSString(bindings.NSBaselineOffsetAttributeName); +} + +NSString NSKernAttributeName () +{ + if (NSKernAttributeName_) + return NSKernAttributeName_; + + return NSKernAttributeName_ = new NSString(bindings.NSKernAttributeName); +} + +NSString NSLinkAttributeName () +{ + if (NSLinkAttributeName_) + return NSLinkAttributeName_; + + return NSLinkAttributeName_ = new NSString(bindings.NSLinkAttributeName); +} + +NSString NSStrokeWidthAttributeName () +{ + if (NSStrokeWidthAttributeName_) + return NSStrokeWidthAttributeName_; + + return NSStrokeWidthAttributeName_ = new NSString(bindings.NSStrokeWidthAttributeName); +} + +NSString NSStrokeColorAttributeName () +{ + if (NSStrokeColorAttributeName_) + return NSStrokeColorAttributeName_; + + return NSStrokeColorAttributeName_ = new NSString(bindings.NSStrokeColorAttributeName); +} + +NSString NSUnderlineColorAttributeName () +{ + if (NSUnderlineColorAttributeName_) + return NSUnderlineColorAttributeName_; + + return NSUnderlineColorAttributeName_ = new NSString(bindings.NSUnderlineColorAttributeName); +} + +NSString NSStrikethroughStyleAttributeName () +{ + if (NSStrikethroughStyleAttributeName_) + return NSStrikethroughStyleAttributeName_; + + return NSStrikethroughStyleAttributeName_ = new NSString(bindings.NSStrikethroughStyleAttributeName); +} + +NSString NSStrikethroughColorAttributeName () +{ + if (NSStrikethroughColorAttributeName_) + return NSStrikethroughColorAttributeName_; + + return NSStrikethroughColorAttributeName_ = new NSString(bindings.NSStrikethroughColorAttributeName); +} + +NSString NSShadowAttributeName () +{ + if (NSShadowAttributeName_) + return NSShadowAttributeName_; + + return NSShadowAttributeName_ = new NSString(bindings.NSShadowAttributeName); +} + +NSString NSObliquenessAttributeName () +{ + if (NSObliquenessAttributeName_) + return NSObliquenessAttributeName_; + + return NSObliquenessAttributeName_ = new NSString(bindings.NSObliquenessAttributeName); +} + +NSString NSExpansionAttributeName () +{ + if (NSExpansionAttributeName_) + return NSExpansionAttributeName_; + + return NSExpansionAttributeName_ = new NSString(bindings.NSExpansionAttributeName); +} + +NSString NSCursorAttributeName () +{ + if (NSCursorAttributeName_) + return NSCursorAttributeName_; + + return NSCursorAttributeName_ = new NSString(bindings.NSCursorAttributeName); +} + +NSString NSToolTipAttributeName () +{ + if (NSToolTipAttributeName_) + return NSToolTipAttributeName_; + + return NSToolTipAttributeName_ = new NSString(bindings.NSToolTipAttributeName); +} + +NSString NSCharacterShapeAttributeName () +{ + if (NSCharacterShapeAttributeName_) + return NSCharacterShapeAttributeName_; + + return NSCharacterShapeAttributeName_ = new NSString(bindings.NSCharacterShapeAttributeName); +} + +NSString NSGlyphInfoAttributeName () +{ + if (NSGlyphInfoAttributeName_) + return NSGlyphInfoAttributeName_; + + return NSGlyphInfoAttributeName_ = new NSString(bindings.NSGlyphInfoAttributeName); +} + +NSString NSMarkedClauseSegmentAttributeName () +{ + if (NSMarkedClauseSegmentAttributeName_) + return NSMarkedClauseSegmentAttributeName_; + + return NSMarkedClauseSegmentAttributeName_ = new NSString(bindings.NSMarkedClauseSegmentAttributeName); +} + +NSString NSSpellingStateAttributeName () +{ + if (NSSpellingStateAttributeName_) + return NSSpellingStateAttributeName_; + + return NSSpellingStateAttributeName_ = new NSString(bindings.NSSpellingStateAttributeName); +} + +NSString NSPlainTextDocumentType () +{ + if (NSPlainTextDocumentType_) + return NSPlainTextDocumentType_; + + return NSPlainTextDocumentType_ = new NSString(bindings.NSPlainTextDocumentType); +} + +NSString NSRTFTextDocumentType () +{ + if (NSRTFTextDocumentType_) + return NSRTFTextDocumentType_; + + return NSRTFTextDocumentType_ = new NSString(bindings.NSRTFTextDocumentType); +} + +NSString NSRTFDTextDocumentType () +{ + if (NSRTFDTextDocumentType_) + return NSRTFDTextDocumentType_; + + return NSRTFDTextDocumentType_ = new NSString(bindings.NSRTFDTextDocumentType); +} + +NSString NSMacSimpleTextDocumentType () +{ + if (NSMacSimpleTextDocumentType_) + return NSMacSimpleTextDocumentType_; + + return NSMacSimpleTextDocumentType_ = new NSString(bindings.NSMacSimpleTextDocumentType); +} + +NSString NSHTMLTextDocumentType () +{ + if (NSHTMLTextDocumentType_) + return NSHTMLTextDocumentType_; + + return NSHTMLTextDocumentType_ = new NSString(bindings.NSHTMLTextDocumentType); +} + +NSString NSDocFormatTextDocumentType () +{ + if (NSDocFormatTextDocumentType_) + return NSDocFormatTextDocumentType_; + + return NSDocFormatTextDocumentType_ = new NSString(bindings.NSDocFormatTextDocumentType); +} + +NSString NSWordMLTextDocumentType () +{ + if (NSWordMLTextDocumentType_) + return NSWordMLTextDocumentType_; + + return NSWordMLTextDocumentType_ = new NSString(bindings.NSWordMLTextDocumentType); +} + +NSString NSWebArchiveTextDocumentType () +{ + if (NSWebArchiveTextDocumentType_) + return NSWebArchiveTextDocumentType_; + + return NSWebArchiveTextDocumentType_ = new NSString(bindings.NSWebArchiveTextDocumentType); +} + +NSString NSOfficeOpenXMLTextDocumentType () +{ + if (NSOfficeOpenXMLTextDocumentType_) + return NSOfficeOpenXMLTextDocumentType_; + + return NSOfficeOpenXMLTextDocumentType_ = new NSString(bindings.NSOfficeOpenXMLTextDocumentType); +} + +NSString NSOpenDocumentTextDocumentType () +{ + if (NSOpenDocumentTextDocumentType_) + return NSOpenDocumentTextDocumentType_; + + return NSOpenDocumentTextDocumentType_ = new NSString(bindings.NSOpenDocumentTextDocumentType); +} + +NSString NSPaperSizeDocumentAttribute () +{ + if (NSPaperSizeDocumentAttribute_) + return NSPaperSizeDocumentAttribute_; + + return NSPaperSizeDocumentAttribute_ = new NSString(bindings.NSPaperSizeDocumentAttribute); +} + +NSString NSLeftMarginDocumentAttribute () +{ + if (NSLeftMarginDocumentAttribute_) + return NSLeftMarginDocumentAttribute_; + + return NSLeftMarginDocumentAttribute_ = new NSString(bindings.NSLeftMarginDocumentAttribute); +} + +NSString NSRightMarginDocumentAttribute () +{ + if (NSRightMarginDocumentAttribute_) + return NSRightMarginDocumentAttribute_; + + return NSRightMarginDocumentAttribute_ = new NSString(bindings.NSRightMarginDocumentAttribute); +} + +NSString NSTopMarginDocumentAttribute () +{ + if (NSTopMarginDocumentAttribute_) + return NSTopMarginDocumentAttribute_; + + return NSTopMarginDocumentAttribute_ = new NSString(bindings.NSTopMarginDocumentAttribute); +} + +NSString NSBottomMarginDocumentAttribute () +{ + if (NSBottomMarginDocumentAttribute_) + return NSBottomMarginDocumentAttribute_; + + return NSBottomMarginDocumentAttribute_ = new NSString(bindings.NSBottomMarginDocumentAttribute); +} + +NSString NSViewSizeDocumentAttribute () +{ + if (NSViewSizeDocumentAttribute_) + return NSViewSizeDocumentAttribute_; + + return NSViewSizeDocumentAttribute_ = new NSString(bindings.NSViewSizeDocumentAttribute); +} + +NSString NSViewZoomDocumentAttribute () +{ + if (NSViewZoomDocumentAttribute_) + return NSViewZoomDocumentAttribute_; + + return NSViewZoomDocumentAttribute_ = new NSString(bindings.NSViewZoomDocumentAttribute); +} + +NSString NSViewModeDocumentAttribute () +{ + if (NSViewModeDocumentAttribute_) + return NSViewModeDocumentAttribute_; + + return NSViewModeDocumentAttribute_ = new NSString(bindings.NSViewModeDocumentAttribute); +} + +NSString NSDocumentTypeDocumentAttribute () +{ + if (NSDocumentTypeDocumentAttribute_) + return NSDocumentTypeDocumentAttribute_; + + return NSDocumentTypeDocumentAttribute_ = new NSString(bindings.NSDocumentTypeDocumentAttribute); +} + +NSString NSReadOnlyDocumentAttribute () +{ + if (NSReadOnlyDocumentAttribute_) + return NSReadOnlyDocumentAttribute_; + + return NSReadOnlyDocumentAttribute_ = new NSString(bindings.NSReadOnlyDocumentAttribute); +} + +NSString NSConvertedDocumentAttribute () +{ + if (NSConvertedDocumentAttribute_) + return NSConvertedDocumentAttribute_; + + return NSConvertedDocumentAttribute_ = new NSString(bindings.NSConvertedDocumentAttribute); +} + +NSString NSCocoaVersionDocumentAttribute () +{ + if (NSCocoaVersionDocumentAttribute_) + return NSCocoaVersionDocumentAttribute_; + + return NSCocoaVersionDocumentAttribute_ = new NSString(bindings.NSCocoaVersionDocumentAttribute); +} + +NSString NSBackgroundColorDocumentAttribute () +{ + if (NSBackgroundColorDocumentAttribute_) + return NSBackgroundColorDocumentAttribute_; + + return NSBackgroundColorDocumentAttribute_ = new NSString(bindings.NSBackgroundColorDocumentAttribute); +} + +NSString NSHyphenationFactorDocumentAttribute () +{ + if (NSHyphenationFactorDocumentAttribute_) + return NSHyphenationFactorDocumentAttribute_; + + return NSHyphenationFactorDocumentAttribute_ = new NSString(bindings.NSHyphenationFactorDocumentAttribute); +} + +NSString NSDefaultTabIntervalDocumentAttribute () +{ + if (NSDefaultTabIntervalDocumentAttribute_) + return NSDefaultTabIntervalDocumentAttribute_; + + return NSDefaultTabIntervalDocumentAttribute_ = new NSString(bindings.NSDefaultTabIntervalDocumentAttribute); +} + +NSString NSCharacterEncodingDocumentAttribute () +{ + if (NSCharacterEncodingDocumentAttribute_) + return NSCharacterEncodingDocumentAttribute_; + + return NSCharacterEncodingDocumentAttribute_ = new NSString(bindings.NSCharacterEncodingDocumentAttribute); +} + +NSString NSTitleDocumentAttribute () +{ + if (NSTitleDocumentAttribute_) + return NSTitleDocumentAttribute_; + + return NSTitleDocumentAttribute_ = new NSString(bindings.NSTitleDocumentAttribute); +} + +NSString NSCompanyDocumentAttribute () +{ + if (NSCompanyDocumentAttribute_) + return NSCompanyDocumentAttribute_; + + return NSCompanyDocumentAttribute_ = new NSString(bindings.NSCompanyDocumentAttribute); +} + +NSString NSCopyrightDocumentAttribute () +{ + if (NSCopyrightDocumentAttribute_) + return NSCopyrightDocumentAttribute_; + + return NSCopyrightDocumentAttribute_ = new NSString(bindings.NSCopyrightDocumentAttribute); +} + +NSString NSSubjectDocumentAttribute () +{ + if (NSSubjectDocumentAttribute_) + return NSSubjectDocumentAttribute_; + + return NSSubjectDocumentAttribute_ = new NSString(bindings.NSSubjectDocumentAttribute); +} + +NSString NSAuthorDocumentAttribute () +{ + if (NSAuthorDocumentAttribute_) + return NSAuthorDocumentAttribute_; + + return NSAuthorDocumentAttribute_ = new NSString(bindings.NSAuthorDocumentAttribute); +} + +NSString NSKeywordsDocumentAttribute () +{ + if (NSKeywordsDocumentAttribute_) + return NSKeywordsDocumentAttribute_; + + return NSKeywordsDocumentAttribute_ = new NSString(bindings.NSKeywordsDocumentAttribute); +} + +NSString NSCommentDocumentAttribute () +{ + if (NSCommentDocumentAttribute_) + return NSCommentDocumentAttribute_; + + return NSCommentDocumentAttribute_ = new NSString(bindings.NSCommentDocumentAttribute); +} + +NSString NSEditorDocumentAttribute () +{ + if (NSEditorDocumentAttribute_) + return NSEditorDocumentAttribute_; + + return NSEditorDocumentAttribute_ = new NSString(bindings.NSEditorDocumentAttribute); +} + +NSString NSCreationTimeDocumentAttribute () +{ + if (NSCreationTimeDocumentAttribute_) + return NSCreationTimeDocumentAttribute_; + + return NSCreationTimeDocumentAttribute_ = new NSString(bindings.NSCreationTimeDocumentAttribute); +} + +NSString NSModificationTimeDocumentAttribute () +{ + if (NSModificationTimeDocumentAttribute_) + return NSModificationTimeDocumentAttribute_; + + return NSModificationTimeDocumentAttribute_ = new NSString(bindings.NSModificationTimeDocumentAttribute); +} + +NSString NSExcludedElementsDocumentAttribute () +{ + if (NSExcludedElementsDocumentAttribute_) + return NSExcludedElementsDocumentAttribute_; + + return NSExcludedElementsDocumentAttribute_ = new NSString(bindings.NSExcludedElementsDocumentAttribute); +} + +NSString NSTextEncodingNameDocumentAttribute () +{ + if (NSTextEncodingNameDocumentAttribute_) + return NSTextEncodingNameDocumentAttribute_; + + return NSTextEncodingNameDocumentAttribute_ = new NSString(bindings.NSTextEncodingNameDocumentAttribute); +} + +NSString NSPrefixSpacesDocumentAttribute () +{ + if (NSPrefixSpacesDocumentAttribute_) + return NSPrefixSpacesDocumentAttribute_; + + return NSPrefixSpacesDocumentAttribute_ = new NSString(bindings.NSPrefixSpacesDocumentAttribute); +} + +NSString NSDocumentTypeDocumentOption () +{ + if (NSDocumentTypeDocumentOption_) + return NSDocumentTypeDocumentOption_; + + return NSDocumentTypeDocumentOption_ = new NSString(bindings.NSDocumentTypeDocumentOption); +} + +NSString NSDefaultAttributesDocumentOption () +{ + if (NSDefaultAttributesDocumentOption_) + return NSDefaultAttributesDocumentOption_; + + return NSDefaultAttributesDocumentOption_ = new NSString(bindings.NSDefaultAttributesDocumentOption); +} + +NSString NSCharacterEncodingDocumentOption () +{ + if (NSCharacterEncodingDocumentOption_) + return NSCharacterEncodingDocumentOption_; + + return NSCharacterEncodingDocumentOption_ = new NSString(bindings.NSCharacterEncodingDocumentOption); +} + +NSString NSTextEncodingNameDocumentOption () +{ + if (NSTextEncodingNameDocumentOption_) + return NSTextEncodingNameDocumentOption_; + + return NSTextEncodingNameDocumentOption_ = new NSString(bindings.NSTextEncodingNameDocumentOption); +} + +NSString NSBaseURLDocumentOption () +{ + if (NSBaseURLDocumentOption_) + return NSBaseURLDocumentOption_; + + return NSBaseURLDocumentOption_ = new NSString(bindings.NSBaseURLDocumentOption); +} + +NSString NSTimeoutDocumentOption () +{ + if (NSTimeoutDocumentOption_) + return NSTimeoutDocumentOption_; + + return NSTimeoutDocumentOption_ = new NSString(bindings.NSTimeoutDocumentOption); +} + +NSString NSWebPreferencesDocumentOption () +{ + if (NSWebPreferencesDocumentOption_) + return NSWebPreferencesDocumentOption_; + + return NSWebPreferencesDocumentOption_ = new NSString(bindings.NSWebPreferencesDocumentOption); +} + +NSString NSWebResourceLoadDelegateDocumentOption () +{ + if (NSWebResourceLoadDelegateDocumentOption_) + return NSWebResourceLoadDelegateDocumentOption_; + + return NSWebResourceLoadDelegateDocumentOption_ = new NSString(bindings.NSWebResourceLoadDelegateDocumentOption); +} + +NSString NSTextSizeMultiplierDocumentOption () +{ + if (NSTextSizeMultiplierDocumentOption_) + return NSTextSizeMultiplierDocumentOption_; + + return NSTextSizeMultiplierDocumentOption_ = new NSString(bindings.NSTextSizeMultiplierDocumentOption); +} + +enum +{ + NSUnderlineStyleNone = 0x00, + NSUnderlineStyleSingle = 0x01, + NSUnderlineStyleThick = 0x02, + NSUnderlineStyleDouble = 0x09 +} + +enum +{ + NSUnderlinePatternSolid = 0x0000, + NSUnderlinePatternDot = 0x0100, + NSUnderlinePatternDash = 0x0200, + NSUnderlinePatternDashDot = 0x0300, + NSUnderlinePatternDashDotDot = 0x0400 +} + +enum +{ + NSSpellingStateSpellingFlag = (1 << 0), + NSSpellingStateGrammarFlag = (1 << 1) +} + +enum +{ + NSNoUnderlineStyle = 0, + NSSingleUnderlineStyle +} + +const TNSMutableAttributedStringKitAdditions = ` + + bool readFromURL (NSURL url, NSDictionary opts, ref NSDictionary dict, ref NSError error) + { + id __arg2; + id __arg3; + + if (dict) + __arg2 = dict.objcObject; + + if (error) + __arg3 = error.objcObject; + + bool result = invokeObjcSelf!(bool, "readFromURL:options:documentAttributes:error:", NSURL, NSDictionary, id*, id*)(url, opts, &__arg2, &__arg3); + + if (__arg2) + dict = new NSDictionary(__arg2); + if (__arg3) + error = new NSError(__arg3); + + return result; + } + + bool readFromData (NSData data, NSDictionary opts, ref NSDictionary dict, ref NSError error) + { + id __arg2; + id __arg3; + + if (dict) + __arg2 = dict.objcObject; + + if (error) + __arg3 = error.objcObject; + + bool result = invokeObjcSelf!(bool, "readFromData:options:documentAttributes:error:", NSData, NSDictionary, id*, id*)(data, opts, &__arg2, &__arg3); + + if (__arg2) + dict = new NSDictionary(__arg2); + if (__arg3) + error = new NSError(__arg3); + + return result; + } + + bool readFromURL (NSURL url, NSDictionary options, ref NSDictionary dict) + { + id __arg2; + + if (dict) + __arg2 = dict.objcObject; + + bool result = invokeObjcSelf!(bool, "readFromURL:options:documentAttributes:", NSURL, NSDictionary, id*)(url, options, &__arg2); + + if (__arg2) + dict = new NSDictionary(__arg2); + + return result; + } + + bool readFromData (NSData data, NSDictionary options, ref NSDictionary dict) + { + id __arg2; + + if (dict) + __arg2 = dict.objcObject; + + bool result = invokeObjcSelf!(bool, "readFromData:options:documentAttributes:", NSData, NSDictionary, id*)(data, options, &__arg2); + + if (__arg2) + dict = new NSDictionary(__arg2); + + return result; + } + + void superscriptRange (NSRange range) + { + return invokeObjcSelf!(void, "superscriptRange:", NSRange)(range); + } + + void subscriptRange (NSRange range) + { + return invokeObjcSelf!(void, "subscriptRange:", NSRange)(range); + } + + void unscriptRange (NSRange range) + { + return invokeObjcSelf!(void, "unscriptRange:", NSRange)(range); + } + + void applyFontTraits (uint traitMask, NSRange range) + { + return invokeObjcSelf!(void, "applyFontTraits:range:", uint, NSRange)(traitMask, range); + } + + void setAlignment (uint alignment, NSRange range) + { + return invokeObjcSelf!(void, "setAlignment:range:", uint, NSRange)(alignment, range); + } + + void setBaseWritingDirection (int writingDirection, NSRange range) + { + return invokeObjcSelf!(void, "setBaseWritingDirection:range:", int, NSRange)(writingDirection, range); + } + + void fixAttributesInRange (NSRange range) + { + return invokeObjcSelf!(void, "fixAttributesInRange:", NSRange)(range); + } + + void fixFontAttributeInRange (NSRange range) + { + return invokeObjcSelf!(void, "fixFontAttributeInRange:", NSRange)(range); + } + + void fixParagraphStyleAttributeInRange (NSRange range) + { + return invokeObjcSelf!(void, "fixParagraphStyleAttributeInRange:", NSRange)(range); + } + + void fixAttachmentAttributeInRange (NSRange range) + { + return invokeObjcSelf!(void, "fixAttachmentAttributeInRange:", NSRange)(range); + } + + ////mixin ObjcBindMethod!(readFromURL, bool, "readFromURL:options:documentAttributes:error:", NSURL, NSDictionary, ref NSDictionary, ref NSError); + ////mixin ObjcBindMethod!(readFromData, bool, "readFromData:options:documentAttributes:error:", NSData, NSDictionary, ref NSDictionary, ref NSError); + ////mixin ObjcBindMethod!(readFromURL, bool, "readFromURL:options:documentAttributes:", NSURL, NSDictionary, ref NSDictionary, ref NSError); + ////mixin ObjcBindMethod!(readFromData, bool, "readFromData:options:documentAttributes:", NSData, NSDictionary, ref NSDictionary, ref NSError); + //mixin ObjcBindMethod!(superscriptRange, "superscriptRange:"); + //mixin ObjcBindMethod!(subscriptRange, "subscriptRange:"); + //mixin ObjcBindMethod!(unscriptRange, "unscriptRange:"); + //mixin ObjcBindMethod!(applyFontTraits, "applyFontTraits:range:"); + //mixin ObjcBindMethod!(setAlignment, "setAlignment:range:"); + //mixin ObjcBindMethod!(setBaseWritingDirection, "setBaseWritingDirection:range:"); + //mixin ObjcBindMethod!(fixAttributesInRange, "fixAttributesInRange:"); + //mixin ObjcBindMethod!(fixFontAttributeInRange, "fixFontAttributeInRange:"); + //mixin ObjcBindMethod!(fixParagraphStyleAttributeInRange, "fixParagraphStyleAttributeInRange:"); + //mixin ObjcBindMethod!(fixAttachmentAttributeInRange, "fixAttachmentAttributeInRange:"); + +`; + +const TNSExtendedAttributedString = ` + + //import dstep.appkit.NSAttributedString; + + Object attribute (NSString attrName, NSUInteger location, NSRangePointer range) + { + return invokeObjcSelf!(Object, "attribute:atIndex:effectiveRange:", NSString, NSUInteger, NSRangePointer)(attrName, location, range); + } + + NSAttributedString attributedSubstringFromRange (NSRange range) + { + return invokeObjcSelf!(NSAttributedString, "attributedSubstringFromRange:", NSRange)(range); + } + + NSDictionary attributesAtIndex (NSUInteger location, NSRangePointer range, NSRange rangeLimit) + { + return invokeObjcSelf!(NSDictionary, "attributesAtIndex:longestEffectiveRange:inRange:", NSUInteger, NSRangePointer, NSRange)(location, range, rangeLimit); + } + + Object attribute (NSString attrName, NSUInteger location, NSRangePointer range, NSRange rangeLimit) + { + return invokeObjcSelf!(Object, "attribute:atIndex:longestEffectiveRange:inRange:", NSString, NSUInteger, NSRangePointer, NSRange)(attrName, location, range, rangeLimit); + } + + bool isEqualToAttributedString (NSAttributedString other) + { + return invokeObjcSelf!(bool, "isEqualToAttributedString:", NSAttributedString)(other); + } + + //mixin ObjcBindMethod!(attribute, "attribute:atIndex:effectiveRange:"); + //mixin ObjcBindMethod!(attributedSubstringFromRange, "attributedSubstringFromRange:"); + //mixin ObjcBindMethod!(attributesAtIndex, "attributesAtIndex:longestEffectiveRange:inRange:"); + //mixin ObjcBindMethod!(attribute, "attribute:atIndex:longestEffectiveRange:inRange:"); + //mixin ObjcBindMethod!(isEqualToAttributedString, "isEqualToAttributedString:"); + //mixin ObjcBindMethod!(initWithString, "initWithString:"); + //mixin ObjcBindMethod!(initWithString, "initWithString:attributes:"); + //mixin ObjcBindMethod!(initWithAttributedString, "initWithAttributedString:"); + +`; + +const TNSDeprecatedKitAdditions = ` + + static NSArray textFileTypes () + { + return invokeObjcSelfClass!(NSArray, "textFileTypes"); + } + + static NSArray textPasteboardTypes () + { + return invokeObjcSelfClass!(NSArray, "textPasteboardTypes"); + } + + static NSArray textUnfilteredFileTypes () + { + return invokeObjcSelfClass!(NSArray, "textUnfilteredFileTypes"); + } + + static NSArray textUnfilteredPasteboardTypes () + { + return invokeObjcSelfClass!(NSArray, "textUnfilteredPasteboardTypes"); + } + + //mixin ObjcBindClassMethod!(textFileTypes, "textFileTypes"); + //mixin ObjcBindClassMethod!(textPasteboardTypes, "textPasteboardTypes"); + //mixin ObjcBindClassMethod!(textUnfilteredFileTypes, "textUnfilteredFileTypes"); + //mixin ObjcBindClassMethod!(textUnfilteredPasteboardTypes, "textUnfilteredPasteboardTypes"); + +`; + +const TNSAttributedStringKitAdditions = ` + + /*import dstep.appkit.NSFileWrapper; + import dstep.appkit.NSTextList; + import dstep.appkit.NSTextTable;*/ + + NSDictionary fontAttributesInRange (NSRange range) + { + return invokeObjcSelf!(NSDictionary, "fontAttributesInRange:", NSRange)(range); + } + + NSDictionary rulerAttributesInRange (NSRange range) + { + return invokeObjcSelf!(NSDictionary, "rulerAttributesInRange:", NSRange)(range); + } + + bool containsAttachments () + { + return invokeObjcSelf!(bool, "containsAttachments"); + } + + NSUInteger lineBreakBeforeIndex (NSUInteger location, NSRange aRange) + { + return invokeObjcSelf!(NSUInteger, "lineBreakBeforeIndex:withinRange:", NSUInteger, NSRange)(location, aRange); + } + + NSUInteger lineBreakByHyphenatingBeforeIndex (NSUInteger location, NSRange aRange) + { + return invokeObjcSelf!(NSUInteger, "lineBreakByHyphenatingBeforeIndex:withinRange:", NSUInteger, NSRange)(location, aRange); + } + + NSRange doubleClickAtIndex (NSUInteger location) + { + return invokeObjcSelf!(NSRange, "doubleClickAtIndex:", NSUInteger)(location); + } + + NSUInteger nextWordFromIndex (NSUInteger location, bool isForward) + { + return invokeObjcSelf!(NSUInteger, "nextWordFromIndex:forward:", NSUInteger, bool)(location, isForward); + } + + NSURL URLAtIndex (NSUInteger location, NSRangePointer effectiveRange) + { + return invokeObjcSelf!(NSURL, "URLAtIndex:effectiveRange:", NSUInteger, NSRangePointer)(location, effectiveRange); + } + + static NSArray textTypes () + { + return invokeObjcSelfClass!(NSArray, "textTypes"); + } + + static NSArray textUnfilteredTypes () + { + return invokeObjcSelfClass!(NSArray, "textUnfilteredTypes"); + } + + NSRange rangeOfTextBlock (NSTextBlock block, NSUInteger location) + { + return invokeObjcSelf!(NSRange, "rangeOfTextBlock:atIndex:", NSTextBlock, NSUInteger)(block, location); + } + + NSRange rangeOfTextTable (NSTextTable table, NSUInteger location) + { + return invokeObjcSelf!(NSRange, "rangeOfTextTable:atIndex:", NSTextTable, NSUInteger)(table, location); + } + + NSRange rangeOfTextList (NSTextList list, NSUInteger location) + { + return invokeObjcSelf!(NSRange, "rangeOfTextList:atIndex:", NSTextList, NSUInteger)(list, location); + } + + NSInteger itemNumberInTextList (NSTextList list, NSUInteger location) + { + return invokeObjcSelf!(NSInteger, "itemNumberInTextList:atIndex:", NSTextList, NSUInteger)(list, location); + } + + typeof(this) initWithURL (NSURL url, NSDictionary options, ref NSDictionary dict, ref NSError error) + { + id __arg2; + id __arg3; + + if (dict) + __arg2 = dict.objcObject; + + if (error) + __arg3 = error.objcObject; + + id result = invokeObjcSelf!(id, "initWithURL:options:documentAttributes:error:", NSURL, NSDictionary, id*, id*)(url, options, &__arg2, &__arg3); + + if (__arg2) + dict = new NSDictionary(__arg2); + if (__arg3) + error = new NSError(__arg3); + + return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); + } + + this (NSURL url, NSDictionary options, ref NSDictionary dict, ref NSError error) + { + super(typeof(this).alloc.initWithURL(url, options, dict, error).objcObject); + } + + typeof(this) initWithData (NSData data, NSDictionary options, ref NSDictionary dict, ref NSError error) + { + id __arg2; + id __arg3; + + if (dict) + __arg2 = dict.objcObject; + + if (error) + __arg3 = error.objcObject; + + id result = invokeObjcSelf!(id, "initWithData:options:documentAttributes:error:", NSData, NSDictionary, id*, id*)(data, options, &__arg2, &__arg3); + + if (__arg2) + dict = new NSDictionary(__arg2); + if (__arg3) + error = new NSError(__arg3); + + return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); + } + + this (NSData data, NSDictionary options, ref NSDictionary dict, ref NSError error) + { + super(typeof(this).alloc.initWithData(data, options, dict, error).objcObject); + } + + typeof(this) initWithPath (NSString path, ref NSDictionary dict) + { + id __arg1; + + if (dict) + __arg1 = dict.objcObject; + + id result = invokeObjcSelf!(id, "initWithPath:documentAttributes:", NSString, id*)(path, &__arg1); + + if (__arg1) + dict = new NSDictionary(__arg1); + + return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); + } + + this (NSString path, ref NSDictionary dict) + { + super(typeof(this).alloc.initWithPath(path, dict).objcObject); + } + + typeof(this) initWithURL (NSURL url, ref NSDictionary dict) + { + id __arg1; + + if (dict) + __arg1 = dict.objcObject; + + id result = invokeObjcSelf!(id, "initWithURL:documentAttributes:", NSURL, id*)(url, &__arg1); + + if (__arg1) + dict = new NSDictionary(__arg1); + + return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); + } + + this (NSURL url, ref NSDictionary dict) + { + super(typeof(this).alloc.initWithURL(url, dict).objcObject); + } + + typeof(this) initWithRTF (NSData data, ref NSDictionary dict) + { + id __arg1; + + if (dict) + __arg1 = dict.objcObject; + + id result = invokeObjcSelf!(id, "initWithRTF:documentAttributes:", NSData, id*)(data, &__arg1); + + if (__arg1) + dict = new NSDictionary(__arg1); + + return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); + } + + this (NSData data, ref NSDictionary dict) + { + super(typeof(this).alloc.initWithRTF(data, dict).objcObject); + } + + typeof(this) initWithRTFD (NSData data, ref NSDictionary dict) + { + id __arg1; + + if (dict) + __arg1 = dict.objcObject; + + id result = invokeObjcSelf!(id, "initWithRTFD:documentAttributes:", NSData, id*)(data, &__arg1); + + if (__arg1) + dict = new NSDictionary(__arg1); + + return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); + } + + this (NSData data, ref NSDictionary dict) + { + super(typeof(this).alloc.initWithRTFD(data, dict).objcObject); + } + + typeof(this) initWithHTML (NSData data, ref NSDictionary dict) + { + id __arg1; + + if (dict) + __arg1 = dict.objcObject; + + id result = invokeObjcSelf!(id, "initWithHTML:documentAttributes:", NSData, id*)(data, &__arg1); + + if (__arg1) + dict = new NSDictionary(__arg1); + + return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); + } + + this (NSData data, ref NSDictionary dict) + { + super(typeof(this).alloc.initWithHTML(data, dict).objcObject); + } + + typeof(this) initWithHTML (NSData data, NSURL base, ref NSDictionary dict) + { + id __arg2; + + if (dict) + __arg2 = dict.objcObject; + + id result = invokeObjcSelf!(id, "initWithHTML:baseURL:documentAttributes:", NSData, NSURL, id*)(data, base, &__arg2); + + if (__arg2) + dict = new NSDictionary(__arg2); + + return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); + } + + this (NSData data, NSURL base, ref NSDictionary dict) + { + super(typeof(this).alloc.initWithHTML(data, base, dict).objcObject); + } + + typeof(this) initWithDocFormat (NSData data, ref NSDictionary dict) + { + id __arg1; + + if (dict) + __arg1 = dict.objcObject; + + id result = invokeObjcSelf!(id, "initWithDocFormat:documentAttributes:", NSData, id*)(data, &__arg1); + + if (__arg1) + dict = new NSDictionary(__arg1); + + return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); + } + + this (NSData data, ref NSDictionary dict) + { + super(typeof(this).alloc.initWithDocFormat(data, dict).objcObject); + } + + typeof(this) initWithHTML (NSData data, NSDictionary options, ref NSDictionary dict) + { + id __arg2; + + if (dict) + __arg2 = dict.objcObject; + + id result = invokeObjcSelf!(id, "initWithHTML:options:documentAttributes:", NSData, NSDictionary, id*)(data, options, &__arg2); + + if (__arg2) + dict = new NSDictionary(__arg2); + + return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); + } + + this (NSData data, NSDictionary options, ref NSDictionary dict) + { + super(typeof(this).alloc.initWithHTML(data, options, dict).objcObject); + } + + typeof(this) initWithRTFDFileWrapper (NSFileWrapper wrapper, ref NSDictionary dict) + { + id __arg1; + + if (dict) + __arg1 = dict.objcObject; + + id result = invokeObjcSelf!(id, "initWithRTFDFileWrapper:documentAttributes:", NSFileWrapper, id*)(wrapper, &__arg1); + + if (__arg1) + dict = new NSDictionary(__arg1); + + return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); + } + + this (NSFileWrapper wrapper, ref NSDictionary dict) + { + super(typeof(this).alloc.initWithRTFDFileWrapper(wrapper, dict).objcObject); + } + + NSData dataFromRange (NSRange range, NSDictionary dict, ref NSError error) + { + id __arg2; + + if (error) + __arg2 = error.objcObject; + + NSData result = invokeObjcSelf!(NSData, "dataFromRange:documentAttributes:error:", NSRange, NSDictionary, id*)(range, dict, &__arg2); + + if (__arg2) + error = new NSError(__arg2); + + return result; + } + + NSFileWrapper fileWrapperFromRange (NSRange range, NSDictionary dict, ref NSError error) + { + id __arg2; + + if (error) + __arg2 = error.objcObject; + + NSFileWrapper result = invokeObjcSelf!(NSFileWrapper, "fileWrapperFromRange:documentAttributes:error:", NSRange, NSDictionary, id*)(range, dict, &__arg2); + + if (__arg2) + error = new NSError(__arg2); + + return result; + } + + NSData RTFFromRange (NSRange range, NSDictionary dict) + { + return invokeObjcSelf!(NSData, "RTFFromRange:documentAttributes:", NSRange, NSDictionary)(range, dict); + } + + NSData RTFDFromRange (NSRange range, NSDictionary dict) + { + return invokeObjcSelf!(NSData, "RTFDFromRange:documentAttributes:", NSRange, NSDictionary)(range, dict); + } + + NSFileWrapper RTFDFileWrapperFromRange (NSRange range, NSDictionary dict) + { + return invokeObjcSelf!(NSFileWrapper, "RTFDFileWrapperFromRange:documentAttributes:", NSRange, NSDictionary)(range, dict); + } + + NSData docFormatFromRange (NSRange range, NSDictionary dict) + { + return invokeObjcSelf!(NSData, "docFormatFromRange:documentAttributes:", NSRange, NSDictionary)(range, dict); + } + + //mixin ObjcBindMethod!(fontAttributesInRange, "fontAttributesInRange:"); + //mixin ObjcBindMethod!(rulerAttributesInRange, "rulerAttributesInRange:"); + //mixin ObjcBindMethod!(containsAttachments, "containsAttachments"); + //mixin ObjcBindMethod!(lineBreakBeforeIndex, "lineBreakBeforeIndex:withinRange:"); + //mixin ObjcBindMethod!(lineBreakByHyphenatingBeforeIndex, "lineBreakByHyphenatingBeforeIndex:withinRange:"); + //mixin ObjcBindMethod!(doubleClickAtIndex, "doubleClickAtIndex:"); + //mixin ObjcBindMethod!(nextWordFromIndex, "nextWordFromIndex:forward:"); + //mixin ObjcBindMethod!(URLAtIndex, "URLAtIndex:effectiveRange:"); + //mixin ObjcBindClassMethod!(textTypes, "textTypes"); + //mixin ObjcBindClassMethod!(textUnfilteredTypes, "textUnfilteredTypes"); + //mixin ObjcBindMethod!(rangeOfTextBlock, "rangeOfTextBlock:atIndex:"); + //mixin ObjcBindMethod!(rangeOfTextTable, "rangeOfTextTable:atIndex:"); + //mixin ObjcBindMethod!(rangeOfTextList, "rangeOfTextList:atIndex:"); + //mixin ObjcBindMethod!(itemNumberInTextList, "itemNumberInTextList:atIndex:"); + /*//mixin ObjcBindMethod!(initWithURL, "initWithURL:options:documentAttributes:error:"); + //mixin ObjcBindMethod!(initWithData, "initWithData:options:documentAttributes:error:"); + //mixin ObjcBindMethod!(initWithPath, "initWithPath:documentAttributes:"); + //mixin ObjcBindMethod!(initWithURL, "initWithURL:documentAttributes:"); + //mixin ObjcBindMethod!(initWithRTF, "initWithRTF:documentAttributes:"); + //mixin ObjcBindMethod!(initWithRTFD, "initWithRTFD:documentAttributes:"); + //mixin ObjcBindMethod!(initWithHTML, "initWithHTML:documentAttributes:"); + //mixin ObjcBindMethod!(initWithHTML, "initWithHTML:baseURL:documentAttributes:"); + //mixin ObjcBindMethod!(initWithDocFormat, "initWithDocFormat:documentAttributes:"); + //mixin ObjcBindMethod!(initWithHTML, "initWithHTML:options:documentAttributes:"); + //mixin ObjcBindMethod!(initWithRTFDFileWrapper, "initWithRTFDFileWrapper:documentAttributes:");*/ + /*//mixin ObjcBindMethod!(dataFromRange, "dataFromRange:documentAttributes:error:"); + //mixin ObjcBindMethod!(fileWrapperFromRange, "fileWrapperFromRange:documentAttributes:error:");*/ + //mixin ObjcBindMethod!(RTFFromRange, "RTFFromRange:documentAttributes:"); + //mixin ObjcBindMethod!(RTFDFromRange, "RTFDFromRange:documentAttributes:"); + //mixin ObjcBindMethod!(RTFDFileWrapperFromRange, "RTFDFileWrapperFromRange:documentAttributes:"); + //mixin ObjcBindMethod!(docFormatFromRange, "docFormatFromRange:documentAttributes:"); + +`; + +const TNSExtendedMutableAttributedString = ` + + /*NSMutableString mutableString () + { + return invokeObjcSelf!(NSMutableString, "mutableString"); + }*/ + + void addAttribute (NSString name, Object value, NSRange range) + { + return invokeObjcSelf!(void, "addAttribute:value:range:", NSString, Object, NSRange)(name, value, range); + } + + void addAttributes (NSDictionary attrs, NSRange range) + { + return invokeObjcSelf!(void, "addAttributes:range:", NSDictionary, NSRange)(attrs, range); + } + + void removeAttribute (NSString name, NSRange range) + { + return invokeObjcSelf!(void, "removeAttribute:range:", NSString, NSRange)(name, range); + } + + void replaceCharactersInRange (NSRange range, NSAttributedString attrString) + { + return invokeObjcSelf!(void, "replaceCharactersInRange:withAttributedString:", NSRange, NSAttributedString)(range, attrString); + } + + void insertAttributedString (NSAttributedString attrString, NSUInteger loc) + { + return invokeObjcSelf!(void, "insertAttributedString:atIndex:", NSAttributedString, NSUInteger)(attrString, loc); + } + + void appendAttributedString (NSAttributedString attrString) + { + return invokeObjcSelf!(void, "appendAttributedString:", NSAttributedString)(attrString); + } + + void deleteCharactersInRange (NSRange range) + { + return invokeObjcSelf!(void, "deleteCharactersInRange:", NSRange)(range); + } + + void setAttributedString (NSAttributedString attrString) + { + return invokeObjcSelf!(void, "setAttributedString:", NSAttributedString)(attrString); + } + + /*void beginEditing () + { + return invokeObjcSelf!(void, "beginEditing"); + } + + void endEditing () + { + return invokeObjcSelf!(void, "endEditing"); + }*/ + + ////mixin ObjcBindMethod!(mutableString, "mutableString"); + //mixin ObjcBindMethod!(addAttribute, "addAttribute:value:range:"); + //mixin ObjcBindMethod!(addAttributes, "addAttributes:range:"); + //mixin ObjcBindMethod!(removeAttribute, "removeAttribute:range:"); + //mixin ObjcBindMethod!(replaceCharactersInRange, "replaceCharactersInRange:withAttributedString:"); + //mixin ObjcBindMethod!(insertAttributedString, "insertAttributedString:atIndex:"); + //mixin ObjcBindMethod!(appendAttributedString, "appendAttributedString:"); + //mixin ObjcBindMethod!(deleteCharactersInRange, "deleteCharactersInRange:"); + //mixin ObjcBindMethod!(setAttributedString, "setAttributedString:"); + /*//mixin ObjcBindMethod!(beginEditing, "beginEditing"); + //mixin ObjcBindMethod!(endEditing, "endEditing");*/ + +`; + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSAttributedString_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSAttributedString_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,90 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSAttributedString_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package id NSFontAttributeName; + package id NSParagraphStyleAttributeName; + package id NSForegroundColorAttributeName; + package id NSUnderlineStyleAttributeName; + package id NSSuperscriptAttributeName; + package id NSBackgroundColorAttributeName; + package id NSAttachmentAttributeName; + package id NSLigatureAttributeName; + package id NSBaselineOffsetAttributeName; + package id NSKernAttributeName; + package id NSLinkAttributeName; + package id NSStrokeWidthAttributeName; + package id NSStrokeColorAttributeName; + package id NSUnderlineColorAttributeName; + package id NSStrikethroughStyleAttributeName; + package id NSStrikethroughColorAttributeName; + package id NSShadowAttributeName; + package id NSObliquenessAttributeName; + package id NSExpansionAttributeName; + package id NSCursorAttributeName; + package id NSToolTipAttributeName; + package id NSCharacterShapeAttributeName; + package id NSGlyphInfoAttributeName; + package id NSMarkedClauseSegmentAttributeName; + package id NSSpellingStateAttributeName; + package id NSPlainTextDocumentType; + package id NSRTFTextDocumentType; + package id NSRTFDTextDocumentType; + package id NSMacSimpleTextDocumentType; + package id NSHTMLTextDocumentType; + package id NSDocFormatTextDocumentType; + package id NSWordMLTextDocumentType; + package id NSWebArchiveTextDocumentType; + package id NSOfficeOpenXMLTextDocumentType; + package id NSOpenDocumentTextDocumentType; + package id NSPaperSizeDocumentAttribute; + package id NSLeftMarginDocumentAttribute; + package id NSRightMarginDocumentAttribute; + package id NSTopMarginDocumentAttribute; + package id NSBottomMarginDocumentAttribute; + package id NSViewSizeDocumentAttribute; + package id NSViewZoomDocumentAttribute; + package id NSViewModeDocumentAttribute; + package id NSDocumentTypeDocumentAttribute; + package id NSReadOnlyDocumentAttribute; + package id NSConvertedDocumentAttribute; + package id NSCocoaVersionDocumentAttribute; + package id NSBackgroundColorDocumentAttribute; + package id NSHyphenationFactorDocumentAttribute; + package id NSDefaultTabIntervalDocumentAttribute; + package id NSCharacterEncodingDocumentAttribute; + package id NSTitleDocumentAttribute; + package id NSCompanyDocumentAttribute; + package id NSCopyrightDocumentAttribute; + package id NSSubjectDocumentAttribute; + package id NSAuthorDocumentAttribute; + package id NSKeywordsDocumentAttribute; + package id NSCommentDocumentAttribute; + package id NSEditorDocumentAttribute; + package id NSCreationTimeDocumentAttribute; + package id NSModificationTimeDocumentAttribute; + package id NSExcludedElementsDocumentAttribute; + package id NSTextEncodingNameDocumentAttribute; + package id NSPrefixSpacesDocumentAttribute; + package id NSDocumentTypeDocumentOption; + package id NSDefaultAttributesDocumentOption; + package id NSCharacterEncodingDocumentOption; + package id NSTextEncodingNameDocumentOption; + package id NSBaseURLDocumentOption; + package id NSTimeoutDocumentOption; + package id NSWebPreferencesDocumentOption; + package id NSWebResourceLoadDelegateDocumentOption; + package id NSTextSizeMultiplierDocumentOption; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSBezierPath.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSBezierPath.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,440 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSBezierPath; + +import dstep.appkit.NSAffineTransform; +import dstep.appkit.NSFont; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSCoder; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +alias NSUInteger NSLineCapStyle; +alias NSUInteger NSLineJoinStyle; +alias NSUInteger NSWindingRule; +alias NSUInteger NSBezierPathElement; + +enum +{ + NSButtLineCapStyle = 0, + NSRoundLineCapStyle = 1, + NSSquareLineCapStyle = 2 +} + +enum +{ + NSMiterLineJoinStyle = 0, + NSRoundLineJoinStyle = 1, + NSBevelLineJoinStyle = 2 +} + +enum +{ + NSNonZeroWindingRule = 0, + NSEvenOddWindingRule = 1 +} + +enum +{ + NSMoveToBezierPathElement, + NSLineToBezierPathElement, + NSCurveToBezierPathElement, + NSClosePathBezierPathElement +} + +class NSBezierPath : NSObject, INSCopying, INSCoding +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + typeof(this) copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); + } + + static NSBezierPath bezierPath () + { + return invokeObjcSelfClass!(NSBezierPath, "bezierPath"); + } + + static NSBezierPath bezierPathWithRect (NSRect rect) + { + return invokeObjcSelfClass!(NSBezierPath, "bezierPathWithRect:", NSRect)(rect); + } + + static NSBezierPath bezierPathWithOvalInRect (NSRect rect) + { + return invokeObjcSelfClass!(NSBezierPath, "bezierPathWithOvalInRect:", NSRect)(rect); + } + + static NSBezierPath bezierPathWithRoundedRect (NSRect rect, CGFloat xRadius, CGFloat yRadius) + { + return invokeObjcSelfClass!(NSBezierPath, "bezierPathWithRoundedRect:xRadius:yRadius:", NSRect, CGFloat, CGFloat)(rect, xRadius, yRadius); + } + + static void fillRect (NSRect rect) + { + return invokeObjcSelfClass!(void, "fillRect:", NSRect)(rect); + } + + static void strokeRect (NSRect rect) + { + return invokeObjcSelfClass!(void, "strokeRect:", NSRect)(rect); + } + + static void clipRect (NSRect rect) + { + return invokeObjcSelfClass!(void, "clipRect:", NSRect)(rect); + } + + static void strokeLineFromPoint (NSPoint point1, NSPoint point2) + { + return invokeObjcSelfClass!(void, "strokeLineFromPoint:toPoint:", NSPoint, NSPoint)(point1, point2); + } + + static void drawPackedGlyphs (char* packedGlyphs, NSPoint point) + { + return invokeObjcSelfClass!(void, "drawPackedGlyphs:atPoint:", char*, NSPoint)(packedGlyphs, point); + } + + static void setDefaultMiterLimit (CGFloat limit) + { + return invokeObjcSelfClass!(void, "setDefaultMiterLimit:", CGFloat)(limit); + } + + static CGFloat defaultMiterLimit () + { + return invokeObjcSelfClass!(CGFloat, "defaultMiterLimit"); + } + + static void setDefaultFlatness (CGFloat flatness) + { + return invokeObjcSelfClass!(void, "setDefaultFlatness:", CGFloat)(flatness); + } + + static CGFloat defaultFlatness () + { + return invokeObjcSelfClass!(CGFloat, "defaultFlatness"); + } + + static void setDefaultWindingRule (uint windingRule) + { + return invokeObjcSelfClass!(void, "setDefaultWindingRule:", uint)(windingRule); + } + + static uint defaultWindingRule () + { + return invokeObjcSelfClass!(uint, "defaultWindingRule"); + } + + static void setDefaultLineCapStyle (uint lineCapStyle) + { + return invokeObjcSelfClass!(void, "setDefaultLineCapStyle:", uint)(lineCapStyle); + } + + static uint defaultLineCapStyle () + { + return invokeObjcSelfClass!(uint, "defaultLineCapStyle"); + } + + static void setDefaultLineJoinStyle (uint lineJoinStyle) + { + return invokeObjcSelfClass!(void, "setDefaultLineJoinStyle:", uint)(lineJoinStyle); + } + + static uint defaultLineJoinStyle () + { + return invokeObjcSelfClass!(uint, "defaultLineJoinStyle"); + } + + static void setDefaultLineWidth (CGFloat lineWidth) + { + return invokeObjcSelfClass!(void, "setDefaultLineWidth:", CGFloat)(lineWidth); + } + + static CGFloat defaultLineWidth () + { + return invokeObjcSelfClass!(CGFloat, "defaultLineWidth"); + } + + void moveToPoint (NSPoint point) + { + return invokeObjcSelf!(void, "moveToPoint:", NSPoint)(point); + } + + void lineToPoint (NSPoint point) + { + return invokeObjcSelf!(void, "lineToPoint:", NSPoint)(point); + } + + void curveToPoint (NSPoint endPoint, NSPoint controlPoint1, NSPoint controlPoint2) + { + return invokeObjcSelf!(void, "curveToPoint:controlPoint1:controlPoint2:", NSPoint, NSPoint, NSPoint)(endPoint, controlPoint1, controlPoint2); + } + + void closePath () + { + return invokeObjcSelf!(void, "closePath"); + } + + void removeAllPoints () + { + return invokeObjcSelf!(void, "removeAllPoints"); + } + + void relativeMoveToPoint (NSPoint point) + { + return invokeObjcSelf!(void, "relativeMoveToPoint:", NSPoint)(point); + } + + void relativeLineToPoint (NSPoint point) + { + return invokeObjcSelf!(void, "relativeLineToPoint:", NSPoint)(point); + } + + void relativeCurveToPoint (NSPoint endPoint, NSPoint controlPoint1, NSPoint controlPoint2) + { + return invokeObjcSelf!(void, "relativeCurveToPoint:controlPoint1:controlPoint2:", NSPoint, NSPoint, NSPoint)(endPoint, controlPoint1, controlPoint2); + } + + CGFloat lineWidth () + { + return invokeObjcSelf!(CGFloat, "lineWidth"); + } + + void setLineWidth (CGFloat lineWidth) + { + return invokeObjcSelf!(void, "setLineWidth:", CGFloat)(lineWidth); + } + + uint lineCapStyle () + { + return invokeObjcSelf!(uint, "lineCapStyle"); + } + + void setLineCapStyle (uint lineCapStyle) + { + return invokeObjcSelf!(void, "setLineCapStyle:", uint)(lineCapStyle); + } + + uint lineJoinStyle () + { + return invokeObjcSelf!(uint, "lineJoinStyle"); + } + + void setLineJoinStyle (uint lineJoinStyle) + { + return invokeObjcSelf!(void, "setLineJoinStyle:", uint)(lineJoinStyle); + } + + uint windingRule () + { + return invokeObjcSelf!(uint, "windingRule"); + } + + void setWindingRule (uint windingRule) + { + return invokeObjcSelf!(void, "setWindingRule:", uint)(windingRule); + } + + CGFloat miterLimit () + { + return invokeObjcSelf!(CGFloat, "miterLimit"); + } + + void setMiterLimit (CGFloat miterLimit) + { + return invokeObjcSelf!(void, "setMiterLimit:", CGFloat)(miterLimit); + } + + CGFloat flatness () + { + return invokeObjcSelf!(CGFloat, "flatness"); + } + + void setFlatness (CGFloat flatness) + { + return invokeObjcSelf!(void, "setFlatness:", CGFloat)(flatness); + } + + void getLineDash (CGFloat* pattern, NSInteger* count, CGFloat* phase) + { + return invokeObjcSelf!(void, "getLineDash:count:phase:", CGFloat*, NSInteger*, CGFloat*)(pattern, count, phase); + } + + void setLineDash (CGFloat* pattern, NSInteger count, CGFloat phase) + { + return invokeObjcSelf!(void, "setLineDash:count:phase:", CGFloat*, NSInteger, CGFloat)(pattern, count, phase); + } + + void stroke () + { + return invokeObjcSelf!(void, "stroke"); + } + + void fill () + { + return invokeObjcSelf!(void, "fill"); + } + + void addClip () + { + return invokeObjcSelf!(void, "addClip"); + } + + void setClip () + { + return invokeObjcSelf!(void, "setClip"); + } + + NSBezierPath bezierPathByFlatteningPath () + { + id result = invokeObjcSelf!(id, "bezierPathByFlatteningPath"); + return result is this.objcObject ? this : (result !is null ? new NSBezierPath(result) : null); + } + + NSBezierPath bezierPathByReversingPath () + { + id result = invokeObjcSelf!(id, "bezierPathByReversingPath"); + return result is this.objcObject ? this : (result !is null ? new NSBezierPath(result) : null); + } + + void transformUsingAffineTransform (NSAffineTransform transform) + { + return invokeObjcSelf!(void, "transformUsingAffineTransform:", NSAffineTransform)(transform); + } + + bool isEmpty () + { + return invokeObjcSelf!(bool, "isEmpty"); + } + + NSPoint currentPoint () + { + return invokeObjcSelf!(NSPoint, "currentPoint"); + } + + NSRect controlPointBounds () + { + return invokeObjcSelf!(NSRect, "controlPointBounds"); + } + + NSRect bounds () + { + return invokeObjcSelf!(NSRect, "bounds"); + } + + NSInteger elementCount () + { + return invokeObjcSelf!(NSInteger, "elementCount"); + } + + uint elementAtIndex (NSInteger index, NSPointArray points) + { + return invokeObjcSelf!(uint, "elementAtIndex:associatedPoints:", NSInteger, NSPointArray)(index, points); + } + + uint elementAtIndex (NSInteger index) + { + return invokeObjcSelf!(uint, "elementAtIndex:", NSInteger)(index); + } + + void setAssociatedPoints (NSPointArray points, NSInteger index) + { + return invokeObjcSelf!(void, "setAssociatedPoints:atIndex:", NSPointArray, NSInteger)(points, index); + } + + void appendBezierPath (NSBezierPath path) + { + return invokeObjcSelf!(void, "appendBezierPath:", NSBezierPath)(path); + } + + void appendBezierPathWithRect (NSRect rect) + { + return invokeObjcSelf!(void, "appendBezierPathWithRect:", NSRect)(rect); + } + + void appendBezierPathWithPoints (NSPointArray points, NSInteger count) + { + return invokeObjcSelf!(void, "appendBezierPathWithPoints:count:", NSPointArray, NSInteger)(points, count); + } + + void appendBezierPathWithOvalInRect (NSRect rect) + { + return invokeObjcSelf!(void, "appendBezierPathWithOvalInRect:", NSRect)(rect); + } + + void appendBezierPathWithArcWithCenter (NSPoint center, CGFloat radius, CGFloat startAngle, CGFloat endAngle, bool clockwise) + { + return invokeObjcSelf!(void, "appendBezierPathWithArcWithCenter:radius:startAngle:endAngle:clockwise:", NSPoint, CGFloat, CGFloat, CGFloat, bool)(center, radius, startAngle, endAngle, clockwise); + } + + void appendBezierPathWithArcWithCenter (NSPoint center, CGFloat radius, CGFloat startAngle, CGFloat endAngle) + { + return invokeObjcSelf!(void, "appendBezierPathWithArcWithCenter:radius:startAngle:endAngle:", NSPoint, CGFloat, CGFloat, CGFloat)(center, radius, startAngle, endAngle); + } + + void appendBezierPathWithArcFromPoint (NSPoint point1, NSPoint point2, CGFloat radius) + { + return invokeObjcSelf!(void, "appendBezierPathWithArcFromPoint:toPoint:radius:", NSPoint, NSPoint, CGFloat)(point1, point2, radius); + } + + void appendBezierPathWithGlyph (uint glyph, NSFont font) + { + return invokeObjcSelf!(void, "appendBezierPathWithGlyph:inFont:", uint, NSFont)(glyph, font); + } + + void appendBezierPathWithGlyphs (NSGlyph* glyphs, NSInteger count, NSFont font) + { + return invokeObjcSelf!(void, "appendBezierPathWithGlyphs:count:inFont:", NSGlyph*, NSInteger, NSFont)(glyphs, count, font); + } + + void appendBezierPathWithPackedGlyphs (char* packedGlyphs) + { + return invokeObjcSelf!(void, "appendBezierPathWithPackedGlyphs:", char*)(packedGlyphs); + } + + void appendBezierPathWithRoundedRect (NSRect rect, CGFloat xRadius, CGFloat yRadius) + { + return invokeObjcSelf!(void, "appendBezierPathWithRoundedRect:xRadius:yRadius:", NSRect, CGFloat, CGFloat)(rect, xRadius, yRadius); + } + + bool containsPoint (NSPoint point) + { + return invokeObjcSelf!(bool, "containsPoint:", NSPoint)(point); + } + + bool cachesBezierPath () + { + return invokeObjcSelf!(bool, "cachesBezierPath"); + } + + void setCachesBezierPath (bool flag) + { + return invokeObjcSelf!(void, "setCachesBezierPath:", bool)(flag); + } + +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSBitmapImageRep.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSBitmapImageRep.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,464 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSBitmapImageRep; + +import dstep.appkit.NSColor; +import dstep.appkit.NSImageRep; +import dstep.applicationservices.coregraphics.CGImage; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSArray; +import dstep.foundation.NSData; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.quartzcore.CIImage; + +import bindings = dstep.appkit.NSBitmapImageRep_bindings; + +alias NSUInteger NSTIFFCompression; +alias NSUInteger NSBitmapImageFileType; +alias NSInteger NSImageRepLoadStatus; +alias NSUInteger NSBitmapFormat; + +private +{ + NSString NSImageCompressionMethod_; + NSString NSImageCompressionFactor_; + NSString NSImageDitherTransparency_; + NSString NSImageRGBColorTable_; + NSString NSImageInterlaced_; + NSString NSImageColorSyncProfileData_; + NSString NSImageFrameCount_; + NSString NSImageCurrentFrame_; + NSString NSImageCurrentFrameDuration_; + NSString NSImageLoopCount_; + NSString NSImageGamma_; + NSString NSImageProgressive_; + NSString NSImageEXIFData_; + NSString NSImageFallbackBackgroundColor_; +} + +NSString NSImageCompressionMethod () +{ + if (NSImageCompressionMethod_) + return NSImageCompressionMethod_; + + return NSImageCompressionMethod_ = new NSString(bindings.NSImageCompressionMethod); +} + +NSString NSImageCompressionFactor () +{ + if (NSImageCompressionFactor_) + return NSImageCompressionFactor_; + + return NSImageCompressionFactor_ = new NSString(bindings.NSImageCompressionFactor); +} + +NSString NSImageDitherTransparency () +{ + if (NSImageDitherTransparency_) + return NSImageDitherTransparency_; + + return NSImageDitherTransparency_ = new NSString(bindings.NSImageDitherTransparency); +} + +NSString NSImageRGBColorTable () +{ + if (NSImageRGBColorTable_) + return NSImageRGBColorTable_; + + return NSImageRGBColorTable_ = new NSString(bindings.NSImageRGBColorTable); +} + +NSString NSImageInterlaced () +{ + if (NSImageInterlaced_) + return NSImageInterlaced_; + + return NSImageInterlaced_ = new NSString(bindings.NSImageInterlaced); +} + +NSString NSImageColorSyncProfileData () +{ + if (NSImageColorSyncProfileData_) + return NSImageColorSyncProfileData_; + + return NSImageColorSyncProfileData_ = new NSString(bindings.NSImageColorSyncProfileData); +} + +NSString NSImageFrameCount () +{ + if (NSImageFrameCount_) + return NSImageFrameCount_; + + return NSImageFrameCount_ = new NSString(bindings.NSImageFrameCount); +} + +NSString NSImageCurrentFrame () +{ + if (NSImageCurrentFrame_) + return NSImageCurrentFrame_; + + return NSImageCurrentFrame_ = new NSString(bindings.NSImageCurrentFrame); +} + +NSString NSImageCurrentFrameDuration () +{ + if (NSImageCurrentFrameDuration_) + return NSImageCurrentFrameDuration_; + + return NSImageCurrentFrameDuration_ = new NSString(bindings.NSImageCurrentFrameDuration); +} + +NSString NSImageLoopCount () +{ + if (NSImageLoopCount_) + return NSImageLoopCount_; + + return NSImageLoopCount_ = new NSString(bindings.NSImageLoopCount); +} + +NSString NSImageGamma () +{ + if (NSImageGamma_) + return NSImageGamma_; + + return NSImageGamma_ = new NSString(bindings.NSImageGamma); +} + +NSString NSImageProgressive () +{ + if (NSImageProgressive_) + return NSImageProgressive_; + + return NSImageProgressive_ = new NSString(bindings.NSImageProgressive); +} + +NSString NSImageEXIFData () +{ + if (NSImageEXIFData_) + return NSImageEXIFData_; + + return NSImageEXIFData_ = new NSString(bindings.NSImageEXIFData); +} + +NSString NSImageFallbackBackgroundColor () +{ + if (NSImageFallbackBackgroundColor_) + return NSImageFallbackBackgroundColor_; + + return NSImageFallbackBackgroundColor_ = new NSString(bindings.NSImageFallbackBackgroundColor); +} + +enum +{ + NSTIFFCompressionNone = 1, + NSTIFFCompressionCCITTFAX3 = 3, + NSTIFFCompressionCCITTFAX4 = 4, + NSTIFFCompressionLZW = 5, + NSTIFFCompressionJPEG = 6, + NSTIFFCompressionNEXT = 32766, + NSTIFFCompressionPackBits = 32773, + NSTIFFCompressionOldJPEG = 32865 +} + +enum +{ + NSTIFFFileType, + NSBMPFileType, + NSGIFFileType, + NSJPEGFileType, + NSPNGFileType, + NSJPEG2000FileType +} + +enum +{ + NSImageRepLoadStatusUnknownType = -1, + NSImageRepLoadStatusReadingHeader = -2, + NSImageRepLoadStatusWillNeedAllData = -3, + NSImageRepLoadStatusInvalidData = -4, + NSImageRepLoadStatusUnexpectedEOF = -5, + NSImageRepLoadStatusCompleted = -6 +} + +enum +{ + NSAlphaFirstBitmapFormat = 1 << 0, + NSAlphaNonpremultipliedBitmapFormat = 1 << 1, + NSFloatingPointSamplesBitmapFormat = 1 << 2 +} + +const TNSBitmapImageFileTypeExtensions = ` + + static NSData representationOfImageRepsInArray (NSArray imageReps, uint storageType, NSDictionary properties) + { + return invokeObjcSelfClass!(NSData, "representationOfImageRepsInArray:usingType:properties:", NSArray, uint, NSDictionary)(imageReps, storageType, properties); + } + + NSData representationUsingType (uint storageType, NSDictionary properties) + { + return invokeObjcSelf!(NSData, "representationUsingType:properties:", uint, NSDictionary)(storageType, properties); + } + + void setProperty (NSString property, Object value) + { + return invokeObjcSelf!(void, "setProperty:withValue:", NSString, Object)(property, value); + } + + Object valueForProperty (NSString property) + { + return invokeObjcSelf!(Object, "valueForProperty:", NSString)(property); + } + + //mixin ObjcBindClassMethod!(representationOfImageRepsInArray, "representationOfImageRepsInArray:usingType:properties:"); + //mixin ObjcBindMethod!(representationUsingType, "representationUsingType:properties:"); + //mixin ObjcBindMethod!(setProperty, "setProperty:withValue:"); + //mixin ObjcBindMethod!(valueForProperty, "valueForProperty:"); + +`; + +class NSBitmapImageRep : NSImageRep +{ + mixin (ObjcWrap); + + NSBitmapImageRep initWithFocusedViewRect (NSRect rect) + { + id result = invokeObjcSelf!(id, "initWithFocusedViewRect:", NSRect)(rect); + return result is this.objcObject ? this : (result !is null ? new NSBitmapImageRep(result) : null); + } + + this (NSRect rect) + { + super(NSBitmapImageRep.alloc.initWithFocusedViewRect(rect).objcObject); + } + + NSBitmapImageRep initWithBitmapDataPlanes (ubyte** planes, NSInteger width, NSInteger height, NSInteger bps, NSInteger spp, bool alpha, bool isPlanar, NSString colorSpaceName, NSInteger rBytes, NSInteger pBits) + { + id result = invokeObjcSelf!(id, "initWithBitmapDataPlanes:pixelsWide:pixelsHigh:bitsPerSample:samplesPerPixel:hasAlpha:isPlanar:colorSpaceName:bytesPerRow:bitsPerPixel:", ubyte**, NSInteger, NSInteger, NSInteger, NSInteger, bool, bool, NSString, NSInteger, NSInteger)(planes, width, height, bps, spp, alpha, isPlanar, colorSpaceName, rBytes, pBits); + return result is this.objcObject ? this : (result !is null ? new NSBitmapImageRep(result) : null); + } + + this (ubyte** planes, NSInteger width, NSInteger height, NSInteger bps, NSInteger spp, bool alpha, bool isPlanar, NSString colorSpaceName, NSInteger rBytes, NSInteger pBits) + { + super(NSBitmapImageRep.alloc.initWithBitmapDataPlanes(planes, width, height, bps, spp, alpha, isPlanar, colorSpaceName, rBytes, pBits).objcObject); + } + + NSBitmapImageRep initWithBitmapDataPlanes (ubyte** planes, NSInteger width, NSInteger height, NSInteger bps, NSInteger spp, bool alpha, bool isPlanar, NSString colorSpaceName, uint bitmapFormat, NSInteger rBytes, NSInteger pBits) + { + id result = invokeObjcSelf!(id, "initWithBitmapDataPlanes:pixelsWide:pixelsHigh:bitsPerSample:samplesPerPixel:hasAlpha:isPlanar:colorSpaceName:bitmapFormat:bytesPerRow:bitsPerPixel:", ubyte**, NSInteger, NSInteger, NSInteger, NSInteger, bool, bool, NSString, uint, NSInteger, NSInteger)(planes, width, height, bps, spp, alpha, isPlanar, colorSpaceName, bitmapFormat, rBytes, pBits); + return result is this.objcObject ? this : (result !is null ? new NSBitmapImageRep(result) : null); + } + + this (ubyte** planes, NSInteger width, NSInteger height, NSInteger bps, NSInteger spp, bool alpha, bool isPlanar, NSString colorSpaceName, uint bitmapFormat, NSInteger rBytes, NSInteger pBits) + { + super(NSBitmapImageRep.alloc.initWithBitmapDataPlanes(planes, width, height, bps, spp, alpha, isPlanar, colorSpaceName, bitmapFormat, rBytes, pBits).objcObject); + } + + NSBitmapImageRep initWithCGImage (CGImageRef cgImage) + { + id result = invokeObjcSelf!(id, "initWithCGImage:", CGImageRef)(cgImage); + return result is this.objcObject ? this : (result !is null ? new NSBitmapImageRep(result) : null); + } + + this (CGImageRef cgImage) + { + super(NSBitmapImageRep.alloc.initWithCGImage(cgImage).objcObject); + } + + NSBitmapImageRep initWithCIImage (CIImage ciImage) + { + id result = invokeObjcSelf!(id, "initWithCIImage:", CIImage)(ciImage); + return result is this.objcObject ? this : (result !is null ? new NSBitmapImageRep(result) : null); + } + + this (CIImage ciImage) + { + super(NSBitmapImageRep.alloc.initWithCIImage(ciImage).objcObject); + } + + static NSArray imageRepsWithData (NSData data) + { + return invokeObjcSelfClass!(NSArray, "imageRepsWithData:", NSData)(data); + } + + static Object imageRepWithData (NSData data) + { + return invokeObjcSelfClass!(Object, "imageRepWithData:", NSData)(data); + } + + NSBitmapImageRep initWithData (NSData data) + { + id result = invokeObjcSelf!(id, "initWithData:", NSData)(data); + return result is this.objcObject ? this : (result !is null ? new NSBitmapImageRep(result) : null); + } + + this (NSData data) + { + super(NSBitmapImageRep.alloc.initWithData(data).objcObject); + } + + char* bitmapData () + { + return invokeObjcSelf!(char*, "bitmapData"); + } + + void getBitmapDataPlanes (ubyte** data) + { + return invokeObjcSelf!(void, "getBitmapDataPlanes:", ubyte**)(data); + } + + bool isPlanar () + { + return invokeObjcSelf!(bool, "isPlanar"); + } + + NSInteger samplesPerPixel () + { + return invokeObjcSelf!(NSInteger, "samplesPerPixel"); + } + + NSInteger bitsPerPixel () + { + return invokeObjcSelf!(NSInteger, "bitsPerPixel"); + } + + NSInteger bytesPerRow () + { + return invokeObjcSelf!(NSInteger, "bytesPerRow"); + } + + NSInteger bytesPerPlane () + { + return invokeObjcSelf!(NSInteger, "bytesPerPlane"); + } + + NSInteger numberOfPlanes () + { + return invokeObjcSelf!(NSInteger, "numberOfPlanes"); + } + + uint bitmapFormat () + { + return invokeObjcSelf!(uint, "bitmapFormat"); + } + + void getCompression (NSTIFFCompression* compression, float* factor) + { + return invokeObjcSelf!(void, "getCompression:factor:", NSTIFFCompression*, float*)(compression, factor); + } + + void setCompression (uint compression, float factor) + { + return invokeObjcSelf!(void, "setCompression:factor:", uint, float)(compression, factor); + } + + NSData TIFFRepresentation () + { + return invokeObjcSelf!(NSData, "TIFFRepresentation"); + } + + NSData TIFFRepresentationUsingCompression (uint comp, float factor) + { + return invokeObjcSelf!(NSData, "TIFFRepresentationUsingCompression:factor:", uint, float)(comp, factor); + } + + static NSData TIFFRepresentationOfImageRepsInArray (NSArray array) + { + return invokeObjcSelfClass!(NSData, "TIFFRepresentationOfImageRepsInArray:", NSArray)(array); + } + + static NSData TIFFRepresentationOfImageRepsInArray (NSArray array, uint comp, float factor) + { + return invokeObjcSelfClass!(NSData, "TIFFRepresentationOfImageRepsInArray:usingCompression:factor:", NSArray, uint, float)(array, comp, factor); + } + + static void getTIFFCompressionTypes (NSTIFFCompression** list, NSInteger* numTypes) + { + return invokeObjcSelfClass!(void, "getTIFFCompressionTypes:count:", NSTIFFCompression**, NSInteger*)(list, numTypes); + } + + static NSString localizedNameForTIFFCompressionType (uint compression) + { + return invokeObjcSelfClass!(NSString, "localizedNameForTIFFCompressionType:", uint)(compression); + } + + bool canBeCompressedUsing (uint compression) + { + return invokeObjcSelf!(bool, "canBeCompressedUsing:", uint)(compression); + } + + void colorizeByMappingGray (CGFloat midPoint, NSColor midPointColor, NSColor shadowColor, NSColor lightColor) + { + return invokeObjcSelf!(void, "colorizeByMappingGray:toColor:blackMapping:whiteMapping:", CGFloat, NSColor, NSColor, NSColor)(midPoint, midPointColor, shadowColor, lightColor); + } + + NSBitmapImageRep initForIncrementalLoad () + { + id result = invokeObjcSelf!(id, "initForIncrementalLoad"); + return result is this.objcObject ? this : (result !is null ? new NSBitmapImageRep(result) : null); + } + + this () + { + super(NSBitmapImageRep.alloc.initForIncrementalLoad.objcObject); + } + + NSInteger incrementalLoadFromData (NSData data, bool complete) + { + return invokeObjcSelf!(NSInteger, "incrementalLoadFromData:complete:", NSData, bool)(data, complete); + } + + void setColor (NSColor color, NSInteger x, NSInteger y) + { + return invokeObjcSelf!(void, "setColor:atX:y:", NSColor, NSInteger, NSInteger)(color, x, y); + } + + NSColor colorAtX (NSInteger x, NSInteger y) + { + return invokeObjcSelf!(NSColor, "colorAtX:y:", NSInteger, NSInteger)(x, y); + } + + void getPixel (NSUInteger* p, NSInteger x, NSInteger y) + { + return invokeObjcSelf!(void, "getPixel:atX:y:", NSUInteger*, NSInteger, NSInteger)(p, x, y); + } + + void setPixel (NSUInteger* p, NSInteger x, NSInteger y) + { + return invokeObjcSelf!(void, "setPixel:atX:y:", NSUInteger*, NSInteger, NSInteger)(p, x, y); + } + + CGImageRef CGImage () + { + return invokeObjcSelf!(CGImageRef, "CGImage"); + } + + // NSBitmapImageFileTypeExtensions + static NSData representationOfImageRepsInArray (NSArray imageReps, uint storageType, NSDictionary properties) + { + return invokeObjcSelfClass!(NSData, "representationOfImageRepsInArray:usingType:properties:", NSArray, uint, NSDictionary)(imageReps, storageType, properties); + } + + NSData representationUsingType (uint storageType, NSDictionary properties) + { + return invokeObjcSelf!(NSData, "representationUsingType:properties:", uint, NSDictionary)(storageType, properties); + } + + void setProperty (NSString property, Object value) + { + return invokeObjcSelf!(void, "setProperty:withValue:", NSString, Object)(property, value); + } + + Object valueForProperty (NSString property) + { + return invokeObjcSelf!(Object, "valueForProperty:", NSString)(property); + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSBitmapImageRep_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSBitmapImageRep_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,31 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSBitmapImageRep_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package id NSImageCompressionMethod; + package id NSImageCompressionFactor; + package id NSImageDitherTransparency; + package id NSImageRGBColorTable; + package id NSImageInterlaced; + package id NSImageColorSyncProfileData; + package id NSImageFrameCount; + package id NSImageCurrentFrame; + package id NSImageCurrentFrameDuration; + package id NSImageLoopCount; + package id NSImageGamma; + package id NSImageProgressive; + package id NSImageEXIFData; + package id NSImageFallbackBackgroundColor; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSBox.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSBox.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,244 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSBox; + +import dstep.appkit.NSColor; +import dstep.appkit.NSFont; +import dstep.appkit.NSView; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +alias NSUInteger NSTitlePosition; +alias NSUInteger NSBoxType; + +enum +{ + NSNoTitle = 0, + NSAboveTop = 1, + NSAtTop = 2, + NSBelowTop = 3, + NSAboveBottom = 4, + NSAtBottom = 5, + NSBelowBottom = 6 +} + +enum +{ + NSBoxPrimary = 0, + NSBoxSecondary = 1, + NSBoxSeparator = 2, + NSBoxOldStyle = 3, + NSBoxCustom = 4 +} + +const TNSCustomBoxTypeProperties = ` + + CGFloat borderWidth () + { + return invokeObjcSelf!(CGFloat, "borderWidth"); + } + + void setBorderWidth (CGFloat borderWidth) + { + return invokeObjcSelf!(void, "setBorderWidth:", CGFloat)(borderWidth); + } + + CGFloat cornerRadius () + { + return invokeObjcSelf!(CGFloat, "cornerRadius"); + } + + void setCornerRadius (CGFloat cornerRadius) + { + return invokeObjcSelf!(void, "setCornerRadius:", CGFloat)(cornerRadius); + } + + NSColor borderColor () + { + return invokeObjcSelf!(NSColor, "borderColor"); + } + + void setBorderColor (NSColor borderColor) + { + return invokeObjcSelf!(void, "setBorderColor:", NSColor)(borderColor); + } + + NSColor fillColor () + { + return invokeObjcSelf!(NSColor, "fillColor"); + } + + void setFillColor (NSColor fillColor) + { + return invokeObjcSelf!(void, "setFillColor:", NSColor)(fillColor); + } + + //mixin ObjcBindMethod!(borderWidth, "borderWidth"); + //mixin ObjcBindMethod!(setBorderWidth, "setBorderWidth:"); + //mixin ObjcBindMethod!(cornerRadius, "cornerRadius"); + //mixin ObjcBindMethod!(setCornerRadius, "setCornerRadius:"); + //mixin ObjcBindMethod!(borderColor, "borderColor"); + //mixin ObjcBindMethod!(setBorderColor, "setBorderColor:"); + //mixin ObjcBindMethod!(fillColor, "fillColor"); + //mixin ObjcBindMethod!(setFillColor, "setFillColor:"); + +`; + +class NSBox : NSView +{ + mixin (ObjcWrap); + + uint borderType () + { + return invokeObjcSelf!(uint, "borderType"); + } + + uint titlePosition () + { + return invokeObjcSelf!(uint, "titlePosition"); + } + + void setBorderType (uint aType) + { + return invokeObjcSelf!(void, "setBorderType:", uint)(aType); + } + + void setBoxType (uint boxType) + { + return invokeObjcSelf!(void, "setBoxType:", uint)(boxType); + } + + uint boxType () + { + return invokeObjcSelf!(uint, "boxType"); + } + + void setTitlePosition (uint aPosition) + { + return invokeObjcSelf!(void, "setTitlePosition:", uint)(aPosition); + } + + NSString title () + { + return invokeObjcSelf!(NSString, "title"); + } + + void setTitle (NSString aString) + { + return invokeObjcSelf!(void, "setTitle:", NSString)(aString); + } + + NSFont titleFont () + { + return invokeObjcSelf!(NSFont, "titleFont"); + } + + void setTitleFont (NSFont fontObj) + { + return invokeObjcSelf!(void, "setTitleFont:", NSFont)(fontObj); + } + + NSRect borderRect () + { + return invokeObjcSelf!(NSRect, "borderRect"); + } + + NSRect titleRect () + { + return invokeObjcSelf!(NSRect, "titleRect"); + } + + Object titleCell () + { + return invokeObjcSelf!(Object, "titleCell"); + } + + void sizeToFit () + { + return invokeObjcSelf!(void, "sizeToFit"); + } + + NSSize contentViewMargins () + { + return invokeObjcSelf!(NSSize, "contentViewMargins"); + } + + void setContentViewMargins (NSSize offsetSize) + { + return invokeObjcSelf!(void, "setContentViewMargins:", NSSize)(offsetSize); + } + + void setFrameFromContentFrame (NSRect contentFrame) + { + return invokeObjcSelf!(void, "setFrameFromContentFrame:", NSRect)(contentFrame); + } + + Object contentView () + { + return invokeObjcSelf!(Object, "contentView"); + } + + void setContentView (NSView aView) + { + return invokeObjcSelf!(void, "setContentView:", NSView)(aView); + } + + bool isTransparent () + { + return invokeObjcSelf!(bool, "isTransparent"); + } + + void setTransparent (bool flag) + { + return invokeObjcSelf!(void, "setTransparent:", bool)(flag); + } + + // NSCustomBoxTypeProperties + CGFloat borderWidth () + { + return invokeObjcSelf!(CGFloat, "borderWidth"); + } + + void setBorderWidth (CGFloat borderWidth) + { + return invokeObjcSelf!(void, "setBorderWidth:", CGFloat)(borderWidth); + } + + CGFloat cornerRadius () + { + return invokeObjcSelf!(CGFloat, "cornerRadius"); + } + + void setCornerRadius (CGFloat cornerRadius) + { + return invokeObjcSelf!(void, "setCornerRadius:", CGFloat)(cornerRadius); + } + + NSColor borderColor () + { + return invokeObjcSelf!(NSColor, "borderColor"); + } + + void setBorderColor (NSColor borderColor) + { + return invokeObjcSelf!(void, "setBorderColor:", NSColor)(borderColor); + } + + NSColor fillColor () + { + return invokeObjcSelf!(NSColor, "fillColor"); + } + + void setFillColor (NSColor fillColor) + { + return invokeObjcSelf!(void, "setFillColor:", NSColor)(fillColor); + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSBrowser.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSBrowser.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,714 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSBrowser; + +import dstep.appkit.NSCell; +import dstep.appkit.NSColor; +import dstep.appkit.NSControl; +import dstep.appkit.NSDragging; +import dstep.appkit.NSEvent; +import dstep.appkit.NSImage; +import dstep.appkit.NSMatrix; +import dstep.appkit.NSScroller; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSArray; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSIndexSet; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.appkit.NSBrowser_bindings; + +alias NSUInteger NSBrowserColumnResizingType; +alias NSUInteger NSBrowserDropOperation; + +private +{ + NSString NSBrowserColumnConfigurationDidChangeNotification_; +} + +NSString NSBrowserColumnConfigurationDidChangeNotification () +{ + if (NSBrowserColumnConfigurationDidChangeNotification_) + return NSBrowserColumnConfigurationDidChangeNotification_; + + return NSBrowserColumnConfigurationDidChangeNotification_ = new NSString(bindings.NSBrowserColumnConfigurationDidChangeNotification); +} + +enum +{ + NSBrowserNoColumnResizing = 0, + NSBrowserAutoColumnResizing = 1, + NSBrowserUserColumnResizing = 2 +} + +enum +{ + NSBrowserDropOn, + NSBrowserDropAbove +} + +struct _Brflags +{ + uint firstVisibleCalculationDisabled; + uint prefersAllColumnUserResizing; + uint usesSmallScrollers; + uint usesSmallSizeTitleFont; + uint actionNeedsToBeSent; + uint acceptsFirstMouse; + uint refusesFirstResponder; + uint disableCompositing; + uint delegateSelectsCellsByRow; + uint allowsIncrementalSearching; + uint time; + uint hasHorizontalScroller; + uint prohibitEmptySel; + uint sendActionOnArrowKeys; + uint dontDrawTitles; + uint acceptArrowKeys; + uint delegateValidatesColumns; + uint delegateDoesNotCreateRowsInMatrix; + uint delegateSelectsCellsByString; + uint delegateSetsTitles; + uint delegateImplementsWillDisplayCell; + uint separateColumns; + uint titleFromPrevious; + uint isTitled; + uint reuseColumns; + uint allowsBranchSelection; + uint allowsMultipleSelection; +} + +class NSBrowser : NSControl +{ + mixin (ObjcWrap); + + static Class cellClass () + { + return invokeObjcSelfClass!(Class, "cellClass"); + } + + void loadColumnZero () + { + return invokeObjcSelf!(void, "loadColumnZero"); + } + + bool isLoaded () + { + return invokeObjcSelf!(bool, "isLoaded"); + } + + void setDoubleAction (SEL aSelector) + { + return invokeObjcSelf!(void, "setDoubleAction:", SEL)(aSelector); + } + + SEL doubleAction () + { + return invokeObjcSelf!(SEL, "doubleAction"); + } + + void setMatrixClass (Class factoryId) + { + return invokeObjcSelf!(void, "setMatrixClass:", Class)(factoryId); + } + + Class matrixClass () + { + return invokeObjcSelf!(Class, "matrixClass"); + } + + void setCellClass (Class factoryId) + { + return invokeObjcSelf!(void, "setCellClass:", Class)(factoryId); + } + + void setCellPrototype (NSCell aCell) + { + return invokeObjcSelf!(void, "setCellPrototype:", NSCell)(aCell); + } + + Object cellPrototype () + { + return invokeObjcSelf!(Object, "cellPrototype"); + } + + void setDelegate (Object anObject) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(anObject); + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + void setReusesColumns (bool flag) + { + return invokeObjcSelf!(void, "setReusesColumns:", bool)(flag); + } + + bool reusesColumns () + { + return invokeObjcSelf!(bool, "reusesColumns"); + } + + void setHasHorizontalScroller (bool flag) + { + return invokeObjcSelf!(void, "setHasHorizontalScroller:", bool)(flag); + } + + bool hasHorizontalScroller () + { + return invokeObjcSelf!(bool, "hasHorizontalScroller"); + } + + void setSeparatesColumns (bool flag) + { + return invokeObjcSelf!(void, "setSeparatesColumns:", bool)(flag); + } + + bool separatesColumns () + { + return invokeObjcSelf!(bool, "separatesColumns"); + } + + void setTitled (bool flag) + { + return invokeObjcSelf!(void, "setTitled:", bool)(flag); + } + + bool isTitled () + { + return invokeObjcSelf!(bool, "isTitled"); + } + + void setMinColumnWidth (CGFloat columnWidth) + { + return invokeObjcSelf!(void, "setMinColumnWidth:", CGFloat)(columnWidth); + } + + CGFloat minColumnWidth () + { + return invokeObjcSelf!(CGFloat, "minColumnWidth"); + } + + void setMaxVisibleColumns (NSInteger columnCount) + { + return invokeObjcSelf!(void, "setMaxVisibleColumns:", NSInteger)(columnCount); + } + + NSInteger maxVisibleColumns () + { + return invokeObjcSelf!(NSInteger, "maxVisibleColumns"); + } + + void setAllowsMultipleSelection (bool flag) + { + return invokeObjcSelf!(void, "setAllowsMultipleSelection:", bool)(flag); + } + + bool allowsMultipleSelection () + { + return invokeObjcSelf!(bool, "allowsMultipleSelection"); + } + + void setAllowsBranchSelection (bool flag) + { + return invokeObjcSelf!(void, "setAllowsBranchSelection:", bool)(flag); + } + + bool allowsBranchSelection () + { + return invokeObjcSelf!(bool, "allowsBranchSelection"); + } + + void setAllowsEmptySelection (bool flag) + { + return invokeObjcSelf!(void, "setAllowsEmptySelection:", bool)(flag); + } + + bool allowsEmptySelection () + { + return invokeObjcSelf!(bool, "allowsEmptySelection"); + } + + void setTakesTitleFromPreviousColumn (bool flag) + { + return invokeObjcSelf!(void, "setTakesTitleFromPreviousColumn:", bool)(flag); + } + + bool takesTitleFromPreviousColumn () + { + return invokeObjcSelf!(bool, "takesTitleFromPreviousColumn"); + } + + void setAcceptsArrowKeys (bool flag) + { + return invokeObjcSelf!(void, "setAcceptsArrowKeys:", bool)(flag); + } + + bool acceptsArrowKeys () + { + return invokeObjcSelf!(bool, "acceptsArrowKeys"); + } + + void setSendsActionOnArrowKeys (bool flag) + { + return invokeObjcSelf!(void, "setSendsActionOnArrowKeys:", bool)(flag); + } + + bool sendsActionOnArrowKeys () + { + return invokeObjcSelf!(bool, "sendsActionOnArrowKeys"); + } + + void setTitle (NSString aString, NSInteger column) + { + return invokeObjcSelf!(void, "setTitle:ofColumn:", NSString, NSInteger)(aString, column); + } + + NSString titleOfColumn (NSInteger column) + { + return invokeObjcSelf!(NSString, "titleOfColumn:", NSInteger)(column); + } + + void setPathSeparator (NSString newString) + { + return invokeObjcSelf!(void, "setPathSeparator:", NSString)(newString); + } + + NSString pathSeparator () + { + return invokeObjcSelf!(NSString, "pathSeparator"); + } + + bool setPath (NSString path) + { + return invokeObjcSelf!(bool, "setPath:", NSString)(path); + } + + NSString path () + { + return invokeObjcSelf!(NSString, "path"); + } + + NSString pathToColumn (NSInteger column) + { + return invokeObjcSelf!(NSString, "pathToColumn:", NSInteger)(column); + } + + NSInteger selectedColumn () + { + return invokeObjcSelf!(NSInteger, "selectedColumn"); + } + + Object selectedCell () + { + return invokeObjcSelf!(Object, "selectedCell"); + } + + Object selectedCellInColumn (NSInteger column) + { + return invokeObjcSelf!(Object, "selectedCellInColumn:", NSInteger)(column); + } + + NSArray selectedCells () + { + return invokeObjcSelf!(NSArray, "selectedCells"); + } + + void selectRow (NSInteger row, NSInteger column) + { + return invokeObjcSelf!(void, "selectRow:inColumn:", NSInteger, NSInteger)(row, column); + } + + NSInteger selectedRowInColumn (NSInteger column) + { + return invokeObjcSelf!(NSInteger, "selectedRowInColumn:", NSInteger)(column); + } + + void selectRowIndexes (NSIndexSet indexes, NSInteger column) + { + return invokeObjcSelf!(void, "selectRowIndexes:inColumn:", NSIndexSet, NSInteger)(indexes, column); + } + + NSIndexSet selectedRowIndexesInColumn (NSInteger column) + { + return invokeObjcSelf!(NSIndexSet, "selectedRowIndexesInColumn:", NSInteger)(column); + } + + void reloadColumn (NSInteger column) + { + return invokeObjcSelf!(void, "reloadColumn:", NSInteger)(column); + } + + void validateVisibleColumns () + { + return invokeObjcSelf!(void, "validateVisibleColumns"); + } + + void scrollColumnsRightBy (NSInteger shiftAmount) + { + return invokeObjcSelf!(void, "scrollColumnsRightBy:", NSInteger)(shiftAmount); + } + + void scrollColumnsLeftBy (NSInteger shiftAmount) + { + return invokeObjcSelf!(void, "scrollColumnsLeftBy:", NSInteger)(shiftAmount); + } + + void scrollColumnToVisible (NSInteger column) + { + return invokeObjcSelf!(void, "scrollColumnToVisible:", NSInteger)(column); + } + + void setLastColumn (NSInteger column) + { + return invokeObjcSelf!(void, "setLastColumn:", NSInteger)(column); + } + + NSInteger lastColumn () + { + return invokeObjcSelf!(NSInteger, "lastColumn"); + } + + void addColumn () + { + return invokeObjcSelf!(void, "addColumn"); + } + + NSInteger numberOfVisibleColumns () + { + return invokeObjcSelf!(NSInteger, "numberOfVisibleColumns"); + } + + NSInteger firstVisibleColumn () + { + return invokeObjcSelf!(NSInteger, "firstVisibleColumn"); + } + + NSInteger lastVisibleColumn () + { + return invokeObjcSelf!(NSInteger, "lastVisibleColumn"); + } + + NSInteger columnOfMatrix (NSMatrix matrix) + { + return invokeObjcSelf!(NSInteger, "columnOfMatrix:", NSMatrix)(matrix); + } + + NSMatrix matrixInColumn (NSInteger column) + { + return invokeObjcSelf!(NSMatrix, "matrixInColumn:", NSInteger)(column); + } + + Object loadedCellAtRow (NSInteger row, NSInteger col) + { + return invokeObjcSelf!(Object, "loadedCellAtRow:column:", NSInteger, NSInteger)(row, col); + } + + void selectAll (Object sender) + { + return invokeObjcSelf!(void, "selectAll:", Object)(sender); + } + + void tile () + { + return invokeObjcSelf!(void, "tile"); + } + + void doClick (Object sender) + { + return invokeObjcSelf!(void, "doClick:", Object)(sender); + } + + void doDoubleClick (Object sender) + { + return invokeObjcSelf!(void, "doDoubleClick:", Object)(sender); + } + + bool sendAction () + { + return invokeObjcSelf!(bool, "sendAction"); + } + + NSRect titleFrameOfColumn (NSInteger column) + { + return invokeObjcSelf!(NSRect, "titleFrameOfColumn:", NSInteger)(column); + } + + void drawTitleOfColumn (NSInteger column, NSRect aRect) + { + return invokeObjcSelf!(void, "drawTitleOfColumn:inRect:", NSInteger, NSRect)(column, aRect); + } + + CGFloat titleHeight () + { + return invokeObjcSelf!(CGFloat, "titleHeight"); + } + + NSRect frameOfColumn (NSInteger column) + { + return invokeObjcSelf!(NSRect, "frameOfColumn:", NSInteger)(column); + } + + NSRect frameOfInsideOfColumn (NSInteger column) + { + return invokeObjcSelf!(NSRect, "frameOfInsideOfColumn:", NSInteger)(column); + } + + CGFloat columnWidthForColumnContentWidth (CGFloat columnContentWidth) + { + return invokeObjcSelf!(CGFloat, "columnWidthForColumnContentWidth:", CGFloat)(columnContentWidth); + } + + CGFloat columnContentWidthForColumnWidth (CGFloat columnWidth) + { + return invokeObjcSelf!(CGFloat, "columnContentWidthForColumnWidth:", CGFloat)(columnWidth); + } + + void setColumnResizingType (uint columnResizingType) + { + return invokeObjcSelf!(void, "setColumnResizingType:", uint)(columnResizingType); + } + + uint columnResizingType () + { + return invokeObjcSelf!(uint, "columnResizingType"); + } + + void setPrefersAllColumnUserResizing (bool prefersAllColumnResizing) + { + return invokeObjcSelf!(void, "setPrefersAllColumnUserResizing:", bool)(prefersAllColumnResizing); + } + + bool prefersAllColumnUserResizing () + { + return invokeObjcSelf!(bool, "prefersAllColumnUserResizing"); + } + + void setWidth (CGFloat columnWidth, NSInteger columnIndex) + { + return invokeObjcSelf!(void, "setWidth:ofColumn:", CGFloat, NSInteger)(columnWidth, columnIndex); + } + + CGFloat widthOfColumn (NSInteger column) + { + return invokeObjcSelf!(CGFloat, "widthOfColumn:", NSInteger)(column); + } + + void setColumnsAutosaveName (NSString name) + { + return invokeObjcSelf!(void, "setColumnsAutosaveName:", NSString)(name); + } + + NSString columnsAutosaveName () + { + return invokeObjcSelf!(NSString, "columnsAutosaveName"); + } + + static void removeSavedColumnsWithAutosaveName (NSString name) + { + return invokeObjcSelfClass!(void, "removeSavedColumnsWithAutosaveName:", NSString)(name); + } + + bool canDragRowsWithIndexes (NSIndexSet rowIndexes, NSInteger column, NSEvent event) + { + return invokeObjcSelf!(bool, "canDragRowsWithIndexes:inColumn:withEvent:", NSIndexSet, NSInteger, NSEvent)(rowIndexes, column, event); + } + + NSImage draggingImageForRowsWithIndexes (NSIndexSet rowIndexes, NSInteger column, NSEvent event, NSPointPointer dragImageOffset) + { + return invokeObjcSelf!(NSImage, "draggingImageForRowsWithIndexes:inColumn:withEvent:offset:", NSIndexSet, NSInteger, NSEvent, NSPointPointer)(rowIndexes, column, event, dragImageOffset); + } + + void setDraggingSourceOperationMask (uint mask, bool isLocal) + { + return invokeObjcSelf!(void, "setDraggingSourceOperationMask:forLocal:", uint, bool)(mask, isLocal); + } + + bool allowsTypeSelect () + { + return invokeObjcSelf!(bool, "allowsTypeSelect"); + } + + void setAllowsTypeSelect (bool value) + { + return invokeObjcSelf!(void, "setAllowsTypeSelect:", bool)(value); + } + + void setBackgroundColor (NSColor color) + { + return invokeObjcSelf!(void, "setBackgroundColor:", NSColor)(color); + } + + NSColor backgroundColor () + { + return invokeObjcSelf!(NSColor, "backgroundColor"); + } + + void displayColumn (NSInteger column) + { + return invokeObjcSelf!(void, "displayColumn:", NSInteger)(column); + } + + void displayAllColumns () + { + return invokeObjcSelf!(void, "displayAllColumns"); + } + + void scrollViaScroller (NSScroller sender) + { + return invokeObjcSelf!(void, "scrollViaScroller:", NSScroller)(sender); + } + + void updateScroller () + { + return invokeObjcSelf!(void, "updateScroller"); + } +} + +const TNSBrowserDelegate = ` + + NSInteger browser (NSBrowser sender, NSInteger column) + { + return invokeObjcSelf!(NSInteger, "browser:numberOfRowsInColumn:", NSBrowser, NSInteger)(sender, column); + } + + void browser (NSBrowser sender, NSInteger column, NSMatrix matrix) + { + return invokeObjcSelf!(void, "browser:createRowsForColumn:inMatrix:", NSBrowser, NSInteger, NSMatrix)(sender, column, matrix); + } + + void browser (NSBrowser sender, Object cell, NSInteger row, NSInteger column) + { + return invokeObjcSelf!(void, "browser:willDisplayCell:atRow:column:", NSBrowser, Object, NSInteger, NSInteger)(sender, cell, row, column); + } + + NSString browser (NSBrowser sender, NSInteger column) + { + return invokeObjcSelf!(NSString, "browser:titleOfColumn:", NSBrowser, NSInteger)(sender, column); + } + + bool browser (NSBrowser sender, NSString title, NSInteger column) + { + return invokeObjcSelf!(bool, "browser:selectCellWithString:inColumn:", NSBrowser, NSString, NSInteger)(sender, title, column); + } + + bool browser (NSBrowser sender, NSInteger row, NSInteger column) + { + return invokeObjcSelf!(bool, "browser:selectRow:inColumn:", NSBrowser, NSInteger, NSInteger)(sender, row, column); + } + + bool browser (NSBrowser sender, NSInteger column) + { + return invokeObjcSelf!(bool, "browser:isColumnValid:", NSBrowser, NSInteger)(sender, column); + } + + void browserWillScroll (NSBrowser sender) + { + return invokeObjcSelf!(void, "browserWillScroll:", NSBrowser)(sender); + } + + void browserDidScroll (NSBrowser sender) + { + return invokeObjcSelf!(void, "browserDidScroll:", NSBrowser)(sender); + } + + CGFloat browser (NSBrowser browser, NSInteger columnIndex, bool forUserResize, CGFloat suggestedWidth) + { + return invokeObjcSelf!(CGFloat, "browser:shouldSizeColumn:forUserResize:toWidth:", NSBrowser, NSInteger, bool, CGFloat)(browser, columnIndex, forUserResize, suggestedWidth); + } + + CGFloat browser (NSBrowser browser, NSInteger columnIndex) + { + return invokeObjcSelf!(CGFloat, "browser:sizeToFitWidthOfColumn:", NSBrowser, NSInteger)(browser, columnIndex); + } + + void browserColumnConfigurationDidChange (NSNotification notification) + { + return invokeObjcSelf!(void, "browserColumnConfigurationDidChange:", NSNotification)(notification); + } + + bool browser (NSBrowser browser, NSInteger row, NSInteger column) + { + return invokeObjcSelf!(bool, "browser:shouldShowCellExpansionForRow:column:", NSBrowser, NSInteger, NSInteger)(browser, row, column); + } + + bool browser (NSBrowser browser, NSIndexSet rowIndexes, NSInteger column, NSPasteboard pasteboard) + { + return invokeObjcSelf!(bool, "browser:writeRowsWithIndexes:inColumn:toPasteboard:", NSBrowser, NSIndexSet, NSInteger, NSPasteboard)(browser, rowIndexes, column, pasteboard); + } + + NSArray browser (NSBrowser browser, NSURL dropDestination, NSIndexSet rowIndexes, NSInteger column) + { + return invokeObjcSelf!(NSArray, "browser:namesOfPromisedFilesDroppedAtDestination:forDraggedRowsWithIndexes:inColumn:", NSBrowser, NSURL, NSIndexSet, NSInteger)(browser, dropDestination, rowIndexes, column); + } + + bool browser (NSBrowser browser, NSIndexSet rowIndexes, NSInteger column, NSEvent event) + { + return invokeObjcSelf!(bool, "browser:canDragRowsWithIndexes:inColumn:withEvent:", NSBrowser, NSIndexSet, NSInteger, NSEvent)(browser, rowIndexes, column, event); + } + + NSImage browser (NSBrowser browser, NSIndexSet rowIndexes, NSInteger column, NSEvent event, NSPointPointer dragImageOffset) + { + return invokeObjcSelf!(NSImage, "browser:draggingImageForRowsWithIndexes:inColumn:withEvent:offset:", NSBrowser, NSIndexSet, NSInteger, NSEvent, NSPointPointer)(browser, rowIndexes, column, event, dragImageOffset); + } + + uint browser (NSBrowser browser, INSDraggingInfo info, NSInteger* row, NSInteger* column, NSBrowserDropOperation* dropOperation) + { + return invokeObjcSelf!(uint, "browser:validateDrop:proposedRow:column:dropOperation:", NSBrowser, INSDraggingInfo, NSInteger*, NSInteger*, NSBrowserDropOperation*)(browser, info, row, column, dropOperation); + } + + bool browser (NSBrowser browser, INSDraggingInfo info, NSInteger row, NSInteger column, uint dropOperation) + { + return invokeObjcSelf!(bool, "browser:acceptDrop:atRow:column:dropOperation:", NSBrowser, INSDraggingInfo, NSInteger, NSInteger, uint)(browser, info, row, column, dropOperation); + } + + NSString browser (NSBrowser browser, NSInteger row, NSInteger column) + { + return invokeObjcSelf!(NSString, "browser:typeSelectStringForRow:inColumn:", NSBrowser, NSInteger, NSInteger)(browser, row, column); + } + + bool browser (NSBrowser browser, NSEvent event, NSString searchString) + { + return invokeObjcSelf!(bool, "browser:shouldTypeSelectForEvent:withCurrentSearchString:", NSBrowser, NSEvent, NSString)(browser, event, searchString); + } + + NSInteger browser (NSBrowser browser, NSInteger startRow, NSInteger endRow, NSInteger column, NSString searchString) + { + return invokeObjcSelf!(NSInteger, "browser:nextTypeSelectMatchFromRow:toRow:inColumn:forString:", NSBrowser, NSInteger, NSInteger, NSInteger, NSString)(browser, startRow, endRow, column, searchString); + } + + //mixin ObjcBindMethod!(browser, "browser:numberOfRowsInColumn:"); + //mixin ObjcBindMethod!(browser, "browser:createRowsForColumn:inMatrix:"); + //mixin ObjcBindMethod!(browser, "browser:willDisplayCell:atRow:column:"); + //mixin ObjcBindMethod!(browser, "browser:titleOfColumn:"); + //mixin ObjcBindMethod!(browser, "browser:selectCellWithString:inColumn:"); + //mixin ObjcBindMethod!(browser, "browser:selectRow:inColumn:"); + //mixin ObjcBindMethod!(browser, "browser:isColumnValid:"); + //mixin ObjcBindMethod!(browserWillScroll, "browserWillScroll:"); + //mixin ObjcBindMethod!(browserDidScroll, "browserDidScroll:"); + //mixin ObjcBindMethod!(browser, "browser:shouldSizeColumn:forUserResize:toWidth:"); + //mixin ObjcBindMethod!(browser, "browser:sizeToFitWidthOfColumn:"); + //mixin ObjcBindMethod!(browserColumnConfigurationDidChange, "browserColumnConfigurationDidChange:"); + //mixin ObjcBindMethod!(browser, "browser:shouldShowCellExpansionForRow:column:"); + //mixin ObjcBindMethod!(browser, "browser:writeRowsWithIndexes:inColumn:toPasteboard:"); + //mixin ObjcBindMethod!(browser, "browser:namesOfPromisedFilesDroppedAtDestination:forDraggedRowsWithIndexes:inColumn:"); + //mixin ObjcBindMethod!(browser, "browser:canDragRowsWithIndexes:inColumn:withEvent:"); + //mixin ObjcBindMethod!(browser, "browser:draggingImageForRowsWithIndexes:inColumn:withEvent:offset:"); + //mixin ObjcBindMethod!(browser, "browser:validateDrop:proposedRow:column:dropOperation:"); + //mixin ObjcBindMethod!(browser, "browser:acceptDrop:atRow:column:dropOperation:"); + //mixin ObjcBindMethod!(browser, "browser:typeSelectStringForRow:inColumn:"); + //mixin ObjcBindMethod!(browser, "browser:shouldTypeSelectForEvent:withCurrentSearchString:"); + //mixin ObjcBindMethod!(browser, "browser:nextTypeSelectMatchFromRow:toRow:inColumn:forString:"); + +`; + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSBrowserCell.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSBrowserCell.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,85 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSBrowserCell; + +import dstep.appkit.NSCell; +import dstep.appkit.NSColor; +import dstep.appkit.NSImage; +import dstep.appkit.NSView; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSBrowserCell : NSCell +{ + mixin (ObjcWrap); + + static NSImage branchImage () + { + return invokeObjcSelfClass!(NSImage, "branchImage"); + } + + static NSImage highlightedBranchImage () + { + return invokeObjcSelfClass!(NSImage, "highlightedBranchImage"); + } + + NSColor highlightColorInView (NSView controlView) + { + return invokeObjcSelf!(NSColor, "highlightColorInView:", NSView)(controlView); + } + + bool isLeaf () + { + return invokeObjcSelf!(bool, "isLeaf"); + } + + void setLeaf (bool flag) + { + return invokeObjcSelf!(void, "setLeaf:", bool)(flag); + } + + bool isLoaded () + { + return invokeObjcSelf!(bool, "isLoaded"); + } + + void setLoaded (bool flag) + { + return invokeObjcSelf!(void, "setLoaded:", bool)(flag); + } + + void reset () + { + return invokeObjcSelf!(void, "reset"); + } + + void set () + { + return invokeObjcSelf!(void, "set"); + } + + void setImage (NSImage image) + { + return invokeObjcSelf!(void, "setImage:", NSImage)(image); + } + + NSImage image () + { + return invokeObjcSelf!(NSImage, "image"); + } + + void setAlternateImage (NSImage newAltImage) + { + return invokeObjcSelf!(void, "setAlternateImage:", NSImage)(newAltImage); + } + + NSImage alternateImage () + { + return invokeObjcSelf!(NSImage, "alternateImage"); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSBrowser_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSBrowser_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,18 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSBrowser_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package id NSBrowserColumnConfigurationDidChangeNotification; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSButton.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSButton.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,327 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSButton; + +import dstep.appkit.NSButtonCell; +import dstep.appkit.NSControl; +import dstep.appkit.NSEvent; +import dstep.appkit.NSImage; +import dstep.appkit.NSSound; +import dstep.appkit.NSUserInterfaceValidation; +import dstep.foundation.NSAttributedString; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +const TNSButtonMixedState = ` + + void setAllowsMixedState (bool flag) + { + return invokeObjcSelf!(void, "setAllowsMixedState:", bool)(flag); + } + + bool allowsMixedState () + { + return invokeObjcSelf!(bool, "allowsMixedState"); + } + + void setNextState () + { + return invokeObjcSelf!(void, "setNextState"); + } + + //mixin ObjcBindMethod!(setAllowsMixedState, "setAllowsMixedState:"); + //mixin ObjcBindMethod!(allowsMixedState, "allowsMixedState"); + //mixin ObjcBindMethod!(setNextState, "setNextState"); + +`; + +const TNSButtonAttributedStringMethods = ` + + NSAttributedString attributedTitle () + { + return invokeObjcSelf!(NSAttributedString, "attributedTitle"); + } + + void setAttributedTitle (NSAttributedString aString) + { + return invokeObjcSelf!(void, "setAttributedTitle:", NSAttributedString)(aString); + } + + NSAttributedString attributedAlternateTitle () + { + return invokeObjcSelf!(NSAttributedString, "attributedAlternateTitle"); + } + + void setAttributedAlternateTitle (NSAttributedString obj) + { + return invokeObjcSelf!(void, "setAttributedAlternateTitle:", NSAttributedString)(obj); + } + + //mixin ObjcBindMethod!(attributedTitle, "attributedTitle"); + //mixin ObjcBindMethod!(setAttributedTitle, "setAttributedTitle:"); + //mixin ObjcBindMethod!(attributedAlternateTitle, "attributedAlternateTitle"); + //mixin ObjcBindMethod!(setAttributedAlternateTitle, "setAttributedAlternateTitle:"); + +`; + +const TNSButtonSoundExtensions = ` + + void setSound (NSSound aSound) + { + return invokeObjcSelf!(void, "setSound:", NSSound)(aSound); + } + + NSSound sound () + { + return invokeObjcSelf!(NSSound, "sound"); + } + + //mixin ObjcBindMethod!(setSound, "setSound:"); + //mixin ObjcBindMethod!(sound, "sound"); + +`; + +const TNSButtonBezelStyles = ` + + void setBezelStyle (uint bezelStyle) + { + return invokeObjcSelf!(void, "setBezelStyle:", uint)(bezelStyle); + } + + uint bezelStyle () + { + return invokeObjcSelf!(uint, "bezelStyle"); + } + + //mixin ObjcBindMethod!(setBezelStyle, "setBezelStyle:"); + //mixin ObjcBindMethod!(bezelStyle, "bezelStyle"); + +`; + +const TNSButtonBorder = ` + + void setShowsBorderOnlyWhileMouseInside (bool show) + { + return invokeObjcSelf!(void, "setShowsBorderOnlyWhileMouseInside:", bool)(show); + } + + bool showsBorderOnlyWhileMouseInside () + { + return invokeObjcSelf!(bool, "showsBorderOnlyWhileMouseInside"); + } + + //mixin ObjcBindMethod!(setShowsBorderOnlyWhileMouseInside, "setShowsBorderOnlyWhileMouseInside:"); + //mixin ObjcBindMethod!(showsBorderOnlyWhileMouseInside, "showsBorderOnlyWhileMouseInside"); + +`; + +class NSButton : NSControl, INSUserInterfaceValidations +{ + mixin (ObjcWrap); + + NSString title () + { + return invokeObjcSelf!(NSString, "title"); + } + + void setTitle (NSString aString) + { + return invokeObjcSelf!(void, "setTitle:", NSString)(aString); + } + + NSString alternateTitle () + { + return invokeObjcSelf!(NSString, "alternateTitle"); + } + + void setAlternateTitle (NSString aString) + { + return invokeObjcSelf!(void, "setAlternateTitle:", NSString)(aString); + } + + NSImage image () + { + return invokeObjcSelf!(NSImage, "image"); + } + + void setImage (NSImage image) + { + return invokeObjcSelf!(void, "setImage:", NSImage)(image); + } + + NSImage alternateImage () + { + return invokeObjcSelf!(NSImage, "alternateImage"); + } + + void setAlternateImage (NSImage image) + { + return invokeObjcSelf!(void, "setAlternateImage:", NSImage)(image); + } + + uint imagePosition () + { + return invokeObjcSelf!(uint, "imagePosition"); + } + + void setImagePosition (uint aPosition) + { + return invokeObjcSelf!(void, "setImagePosition:", uint)(aPosition); + } + + void setButtonType (uint aType) + { + return invokeObjcSelf!(void, "setButtonType:", uint)(aType); + } + + NSInteger state () + { + return invokeObjcSelf!(NSInteger, "state"); + } + + void setState (NSInteger value) + { + return invokeObjcSelf!(void, "setState:", NSInteger)(value); + } + + bool isBordered () + { + return invokeObjcSelf!(bool, "isBordered"); + } + + void setBordered (bool flag) + { + return invokeObjcSelf!(void, "setBordered:", bool)(flag); + } + + bool isTransparent () + { + return invokeObjcSelf!(bool, "isTransparent"); + } + + void setTransparent (bool flag) + { + return invokeObjcSelf!(void, "setTransparent:", bool)(flag); + } + + void setPeriodicDelay (float delay, float interval) + { + return invokeObjcSelf!(void, "setPeriodicDelay:interval:", float, float)(delay, interval); + } + + void getPeriodicDelay (float* delay, float* interval) + { + return invokeObjcSelf!(void, "getPeriodicDelay:interval:", float*, float*)(delay, interval); + } + + NSString keyEquivalent () + { + return invokeObjcSelf!(NSString, "keyEquivalent"); + } + + void setKeyEquivalent (NSString charCode) + { + return invokeObjcSelf!(void, "setKeyEquivalent:", NSString)(charCode); + } + + NSUInteger keyEquivalentModifierMask () + { + return invokeObjcSelf!(NSUInteger, "keyEquivalentModifierMask"); + } + + void setKeyEquivalentModifierMask (NSUInteger mask) + { + return invokeObjcSelf!(void, "setKeyEquivalentModifierMask:", NSUInteger)(mask); + } + + void highlight (bool flag) + { + return invokeObjcSelf!(void, "highlight:", bool)(flag); + } + + bool performKeyEquivalent (NSEvent key) + { + return invokeObjcSelf!(bool, "performKeyEquivalent:", NSEvent)(key); + } + + bool validateUserInterfaceItem (INSValidatedUserInterfaceItem anItem) + { + return invokeObjcSelf!(bool, "validateUserInterfaceItem:", INSValidatedUserInterfaceItem)(anItem); + } + + // NSButtonMixedState + void setAllowsMixedState (bool flag) + { + return invokeObjcSelf!(void, "setAllowsMixedState:", bool)(flag); + } + + bool allowsMixedState () + { + return invokeObjcSelf!(bool, "allowsMixedState"); + } + + void setNextState () + { + return invokeObjcSelf!(void, "setNextState"); + } + + // NSButtonAttributedStringMethods + NSAttributedString attributedTitle () + { + return invokeObjcSelf!(NSAttributedString, "attributedTitle"); + } + + void setAttributedTitle (NSAttributedString aString) + { + return invokeObjcSelf!(void, "setAttributedTitle:", NSAttributedString)(aString); + } + + NSAttributedString attributedAlternateTitle () + { + return invokeObjcSelf!(NSAttributedString, "attributedAlternateTitle"); + } + + void setAttributedAlternateTitle (NSAttributedString obj) + { + return invokeObjcSelf!(void, "setAttributedAlternateTitle:", NSAttributedString)(obj); + } + + // NSButtonSoundExtensions + void setSound (NSSound aSound) + { + return invokeObjcSelf!(void, "setSound:", NSSound)(aSound); + } + + NSSound sound () + { + return invokeObjcSelf!(NSSound, "sound"); + } + + // NSButtonBezelStyles + void setBezelStyle (uint bezelStyle) + { + return invokeObjcSelf!(void, "setBezelStyle:", uint)(bezelStyle); + } + + uint bezelStyle () + { + return invokeObjcSelf!(uint, "bezelStyle"); + } + + // NSButtonBorder + void setShowsBorderOnlyWhileMouseInside (bool show) + { + return invokeObjcSelf!(void, "setShowsBorderOnlyWhileMouseInside:", bool)(show); + } + + bool showsBorderOnlyWhileMouseInside () + { + return invokeObjcSelf!(bool, "showsBorderOnlyWhileMouseInside"); + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSButtonCell.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSButtonCell.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,493 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSButtonCell; + +import dstep.appkit.NSActionCell; +import dstep.appkit.NSAttributedString; +import dstep.appkit.NSColor; +import dstep.appkit.NSEvent; +import dstep.appkit.NSFont; +import dstep.appkit.NSImage; +import dstep.appkit.NSSound; +import dstep.appkit.NSView; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSAttributedString; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +alias NSUInteger NSButtonType; +alias NSUInteger NSBezelStyle; +alias NSUInteger NSGradientType; + +enum +{ + NSMomentaryLightButton = 0, + NSPushOnPushOffButton = 1, + NSToggleButton = 2, + NSSwitchButton = 3, + NSRadioButton = 4, + NSMomentaryChangeButton = 5, + NSOnOffButton = 6, + NSMomentaryPushInButton = 7, + NSMomentaryPushButton = 0, + NSMomentaryLight = 7 +} + +enum +{ + NSRoundedBezelStyle = 1, + NSRegularSquareBezelStyle = 2, + NSThickSquareBezelStyle = 3, + NSThickerSquareBezelStyle = 4, + NSDisclosureBezelStyle = 5, + NSShadowlessSquareBezelStyle = 6, + NSCircularBezelStyle = 7, + NSTexturedSquareBezelStyle = 8, + NSHelpButtonBezelStyle = 9, + NSSmallSquareBezelStyle = 10, + NSTexturedRoundedBezelStyle = 11, + NSRoundRectBezelStyle = 12, + NSRecessedBezelStyle = 13, + NSRoundedDisclosureBezelStyle = 14, + NSSmallIconButtonBezelStyle = 2 +} + +enum +{ + NSGradientNone = 0, + NSGradientConcaveWeak = 1, + NSGradientConcaveStrong = 2, + NSGradientConvexWeak = 3, + NSGradientConvexStrong = 4 +} + +struct _BCFlags +{ + uint alternateMnemonicLocation; + uint useButtonImageSource; + uint gradientType; + uint doesNotDimImage; + uint inset; + uint transparent; + uint lastState; + uint hasKeyEquivalentInsteadOfImage; + uint imageSizeDiff; + uint imageAndText; + uint bottomOrLeft; + uint horizontal; + uint imageOverlaps; + uint bordered; + uint drawing; + uint lightByGray; + uint lightByBackground; + uint lightByContents; + uint changeGray; + uint changeBackground; + uint changeContents; + uint pushIn; +} + + +struct _BCFlags2 +{ + uint bezelStyle; + uint showsBorderOnlyWhileMouseInside; + uint mouseInside; + uint bezelStyle2; + uint imageScaling; + uint keyEquivalentModifierMask; +} + +const TNSButtonCellExtensions = ` + + uint gradientType () + { + return invokeObjcSelf!(uint, "gradientType"); + } + + void setGradientType (uint type) + { + return invokeObjcSelf!(void, "setGradientType:", uint)(type); + } + + void setImageDimsWhenDisabled (bool flag) + { + return invokeObjcSelf!(void, "setImageDimsWhenDisabled:", bool)(flag); + } + + bool imageDimsWhenDisabled () + { + return invokeObjcSelf!(bool, "imageDimsWhenDisabled"); + } + + void setShowsBorderOnlyWhileMouseInside (bool show) + { + return invokeObjcSelf!(void, "setShowsBorderOnlyWhileMouseInside:", bool)(show); + } + + bool showsBorderOnlyWhileMouseInside () + { + return invokeObjcSelf!(bool, "showsBorderOnlyWhileMouseInside"); + } + + void mouseEntered (NSEvent event) + { + return invokeObjcSelf!(void, "mouseEntered:", NSEvent)(event); + } + + void mouseExited (NSEvent event) + { + return invokeObjcSelf!(void, "mouseExited:", NSEvent)(event); + } + + NSColor backgroundColor () + { + return invokeObjcSelf!(NSColor, "backgroundColor"); + } + + void setBackgroundColor (NSColor color) + { + return invokeObjcSelf!(void, "setBackgroundColor:", NSColor)(color); + } + + //mixin ObjcBindMethod!(gradientType, "gradientType"); + //mixin ObjcBindMethod!(setGradientType, "setGradientType:"); + //mixin ObjcBindMethod!(setImageDimsWhenDisabled, "setImageDimsWhenDisabled:"); + //mixin ObjcBindMethod!(imageDimsWhenDisabled, "imageDimsWhenDisabled"); + //mixin ObjcBindMethod!(setShowsBorderOnlyWhileMouseInside, "setShowsBorderOnlyWhileMouseInside:"); + //mixin ObjcBindMethod!(showsBorderOnlyWhileMouseInside, "showsBorderOnlyWhileMouseInside"); + //mixin ObjcBindMethod!(mouseEntered, "mouseEntered:"); + //mixin ObjcBindMethod!(mouseExited, "mouseExited:"); + //mixin ObjcBindMethod!(backgroundColor, "backgroundColor"); + //mixin ObjcBindMethod!(setBackgroundColor, "setBackgroundColor:"); + +`; + +const TNSButtonCellBezelStyles = ` + + void setBezelStyle (uint bezelStyle) + { + return invokeObjcSelf!(void, "setBezelStyle:", uint)(bezelStyle); + } + + uint bezelStyle () + { + return invokeObjcSelf!(uint, "bezelStyle"); + } + + //mixin ObjcBindMethod!(setBezelStyle, "setBezelStyle:"); + //mixin ObjcBindMethod!(bezelStyle, "bezelStyle"); + +`; + +const TNSButtonCellSoundExtensions = ` + + void setSound (NSSound aSound) + { + return invokeObjcSelf!(void, "setSound:", NSSound)(aSound); + } + + NSSound sound () + { + return invokeObjcSelf!(NSSound, "sound"); + } + + //mixin ObjcBindMethod!(setSound, "setSound:"); + //mixin ObjcBindMethod!(sound, "sound"); + +`; + +const TNSButtonCellAttributedStringMethods = ` + + NSAttributedString attributedTitle () + { + return invokeObjcSelf!(NSAttributedString, "attributedTitle"); + } + + void setAttributedTitle (NSAttributedString obj) + { + return invokeObjcSelf!(void, "setAttributedTitle:", NSAttributedString)(obj); + } + + NSAttributedString attributedAlternateTitle () + { + return invokeObjcSelf!(NSAttributedString, "attributedAlternateTitle"); + } + + void setAttributedAlternateTitle (NSAttributedString obj) + { + return invokeObjcSelf!(void, "setAttributedAlternateTitle:", NSAttributedString)(obj); + } + + //mixin ObjcBindMethod!(attributedTitle, "attributedTitle"); + //mixin ObjcBindMethod!(setAttributedTitle, "setAttributedTitle:"); + //mixin ObjcBindMethod!(attributedAlternateTitle, "attributedAlternateTitle"); + //mixin ObjcBindMethod!(setAttributedAlternateTitle, "setAttributedAlternateTitle:"); + +`; + +class NSButtonCell : NSActionCell +{ + mixin (ObjcWrap); + + NSString title () + { + return invokeObjcSelf!(NSString, "title"); + } + + void setTitle (NSString aString) + { + return invokeObjcSelf!(void, "setTitle:", NSString)(aString); + } + + NSString alternateTitle () + { + return invokeObjcSelf!(NSString, "alternateTitle"); + } + + void setAlternateTitle (NSString aString) + { + return invokeObjcSelf!(void, "setAlternateTitle:", NSString)(aString); + } + + NSImage alternateImage () + { + return invokeObjcSelf!(NSImage, "alternateImage"); + } + + void setAlternateImage (NSImage image) + { + return invokeObjcSelf!(void, "setAlternateImage:", NSImage)(image); + } + + uint imagePosition () + { + return invokeObjcSelf!(uint, "imagePosition"); + } + + void setImagePosition (uint aPosition) + { + return invokeObjcSelf!(void, "setImagePosition:", uint)(aPosition); + } + + uint imageScaling () + { + return invokeObjcSelf!(uint, "imageScaling"); + } + + void setImageScaling (uint scaling) + { + return invokeObjcSelf!(void, "setImageScaling:", uint)(scaling); + } + + NSInteger highlightsBy () + { + return invokeObjcSelf!(NSInteger, "highlightsBy"); + } + + void setHighlightsBy (NSInteger aType) + { + return invokeObjcSelf!(void, "setHighlightsBy:", NSInteger)(aType); + } + + NSInteger showsStateBy () + { + return invokeObjcSelf!(NSInteger, "showsStateBy"); + } + + void setShowsStateBy (NSInteger aType) + { + return invokeObjcSelf!(void, "setShowsStateBy:", NSInteger)(aType); + } + + void setButtonType (uint aType) + { + return invokeObjcSelf!(void, "setButtonType:", uint)(aType); + } + + bool isOpaque () + { + return invokeObjcSelf!(bool, "isOpaque"); + } + + void setFont (NSFont fontObj) + { + return invokeObjcSelf!(void, "setFont:", NSFont)(fontObj); + } + + bool isTransparent () + { + return invokeObjcSelf!(bool, "isTransparent"); + } + + void setTransparent (bool flag) + { + return invokeObjcSelf!(void, "setTransparent:", bool)(flag); + } + + void setPeriodicDelay (float delay, float interval) + { + return invokeObjcSelf!(void, "setPeriodicDelay:interval:", float, float)(delay, interval); + } + + void getPeriodicDelay (float* delay, float* interval) + { + return invokeObjcSelf!(void, "getPeriodicDelay:interval:", float*, float*)(delay, interval); + } + + NSString keyEquivalent () + { + return invokeObjcSelf!(NSString, "keyEquivalent"); + } + + void setKeyEquivalent (NSString aKeyEquivalent) + { + return invokeObjcSelf!(void, "setKeyEquivalent:", NSString)(aKeyEquivalent); + } + + NSUInteger keyEquivalentModifierMask () + { + return invokeObjcSelf!(NSUInteger, "keyEquivalentModifierMask"); + } + + void setKeyEquivalentModifierMask (NSUInteger mask) + { + return invokeObjcSelf!(void, "setKeyEquivalentModifierMask:", NSUInteger)(mask); + } + + NSFont keyEquivalentFont () + { + return invokeObjcSelf!(NSFont, "keyEquivalentFont"); + } + + void setKeyEquivalentFont (NSFont fontObj) + { + return invokeObjcSelf!(void, "setKeyEquivalentFont:", NSFont)(fontObj); + } + + void setKeyEquivalentFont (NSString fontName, CGFloat fontSize) + { + return invokeObjcSelf!(void, "setKeyEquivalentFont:size:", NSString, CGFloat)(fontName, fontSize); + } + + void performClick (Object sender) + { + return invokeObjcSelf!(void, "performClick:", Object)(sender); + } + + void drawImage (NSImage image, NSRect frame, NSView controlView) + { + return invokeObjcSelf!(void, "drawImage:withFrame:inView:", NSImage, NSRect, NSView)(image, frame, controlView); + } + + NSRect drawTitle (NSAttributedString title, NSRect frame, NSView controlView) + { + return invokeObjcSelf!(NSRect, "drawTitle:withFrame:inView:", NSAttributedString, NSRect, NSView)(title, frame, controlView); + } + + void drawBezelWithFrame (NSRect frame, NSView controlView) + { + return invokeObjcSelf!(void, "drawBezelWithFrame:inView:", NSRect, NSView)(frame, controlView); + } + + // NSButtonCellExtensions + uint gradientType () + { + return invokeObjcSelf!(uint, "gradientType"); + } + + void setGradientType (uint type) + { + return invokeObjcSelf!(void, "setGradientType:", uint)(type); + } + + void setImageDimsWhenDisabled (bool flag) + { + return invokeObjcSelf!(void, "setImageDimsWhenDisabled:", bool)(flag); + } + + bool imageDimsWhenDisabled () + { + return invokeObjcSelf!(bool, "imageDimsWhenDisabled"); + } + + void setShowsBorderOnlyWhileMouseInside (bool show) + { + return invokeObjcSelf!(void, "setShowsBorderOnlyWhileMouseInside:", bool)(show); + } + + bool showsBorderOnlyWhileMouseInside () + { + return invokeObjcSelf!(bool, "showsBorderOnlyWhileMouseInside"); + } + + void mouseEntered (NSEvent event) + { + return invokeObjcSelf!(void, "mouseEntered:", NSEvent)(event); + } + + void mouseExited (NSEvent event) + { + return invokeObjcSelf!(void, "mouseExited:", NSEvent)(event); + } + + NSColor backgroundColor () + { + return invokeObjcSelf!(NSColor, "backgroundColor"); + } + + void setBackgroundColor (NSColor color) + { + return invokeObjcSelf!(void, "setBackgroundColor:", NSColor)(color); + } + + // NSButtonCellBezelStyles + void setBezelStyle (uint bezelStyle) + { + return invokeObjcSelf!(void, "setBezelStyle:", uint)(bezelStyle); + } + + uint bezelStyle () + { + return invokeObjcSelf!(uint, "bezelStyle"); + } + + // NSButtonCellSoundExtensions + void setSound (NSSound aSound) + { + return invokeObjcSelf!(void, "setSound:", NSSound)(aSound); + } + + NSSound sound () + { + return invokeObjcSelf!(NSSound, "sound"); + } + + // NSButtonCellAttributedStringMethods + NSAttributedString attributedTitle () + { + return invokeObjcSelf!(NSAttributedString, "attributedTitle"); + } + + void setAttributedTitle (NSAttributedString obj) + { + return invokeObjcSelf!(void, "setAttributedTitle:", NSAttributedString)(obj); + } + + NSAttributedString attributedAlternateTitle () + { + return invokeObjcSelf!(NSAttributedString, "attributedAlternateTitle"); + } + + void setAttributedAlternateTitle (NSAttributedString obj) + { + return invokeObjcSelf!(void, "setAttributedAlternateTitle:", NSAttributedString)(obj); + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSCIImageRep.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSCIImageRep.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,41 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSCIImageRep; + +import dstep.appkit.NSBitmapImageRep; +import dstep.appkit.NSGraphics; +import dstep.appkit.NSImageRep; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.quartzcore.CIImage; + +class NSCIImageRep : NSImageRep +{ + mixin (ObjcWrap); + + static Object imageRepWithCIImage (CIImage image) + { + return invokeObjcSelfClass!(Object, "imageRepWithCIImage:", CIImage)(image); + } + + NSCIImageRep initWithCIImage (CIImage image) + { + id result = invokeObjcSelf!(id, "initWithCIImage:", CIImage)(image); + return result is this.objcObject ? this : (result !is null ? new NSCIImageRep(result) : null); + } + + this (CIImage image) + { + super(NSCIImageRep.alloc.initWithCIImage(image).objcObject); + } + + CIImage CIImage_ () + { + return invokeObjcSelf!(CIImage, "CIImage"); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSCachedImageRep.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSCachedImageRep.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,52 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSCachedImageRep; + +import dstep.appkit.NSGraphics; +import dstep.appkit.NSImageRep; +import dstep.appkit.NSWindow; +import dstep.foundation.NSGeometry; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSCachedImageRep : NSImageRep +{ + mixin (ObjcWrap); + + NSCachedImageRep initWithWindow (NSWindow win, NSRect rect) + { + id result = invokeObjcSelf!(id, "initWithWindow:rect:", NSWindow, NSRect)(win, rect); + return result is this.objcObject ? this : (result !is null ? new NSCachedImageRep(result) : null); + } + + this (NSWindow win, NSRect rect) + { + super(NSCachedImageRep.alloc.initWithWindow(win, rect).objcObject); + } + + NSCachedImageRep initWithSize (NSSize size, int depth, bool flag, bool alpha) + { + id result = invokeObjcSelf!(id, "initWithSize:depth:separate:alpha:", NSSize, int, bool, bool)(size, depth, flag, alpha); + return result is this.objcObject ? this : (result !is null ? new NSCachedImageRep(result) : null); + } + + this (NSSize size, int depth, bool flag, bool alpha) + { + super(NSCachedImageRep.alloc.initWithSize(size, depth, flag, alpha).objcObject); + } + + NSWindow window () + { + return invokeObjcSelf!(NSWindow, "window"); + } + + NSRect rect () + { + return invokeObjcSelf!(NSRect, "rect"); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSCell.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSCell.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,1033 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSCell; + +import dstep.appkit.NSAttributedString; +import dstep.appkit.NSColor; +import dstep.appkit.NSEvent; +import dstep.appkit.NSFont; +import dstep.appkit.NSImage; +import dstep.appkit.NSMenu; +import dstep.appkit.NSParagraphStyle; +import dstep.appkit.NSText; +import dstep.appkit.NSView; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSAttributedString; +import dstep.foundation.NSCoder; +import dstep.foundation.NSFormatter; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.appkit.NSCell_bindings; + +alias NSUInteger NSCellType; +alias NSUInteger NSCellAttribute; +alias NSUInteger NSCellImagePosition; +alias NSUInteger NSImageScaling; +alias NSInteger NSCellStateValue; +alias NSUInteger NSControlTint; +alias NSUInteger NSControlSize; +alias NSInteger NSBackgroundStyle; + +private +{ + NSString NSControlTintDidChangeNotification_; +} + +NSString NSControlTintDidChangeNotification () +{ + if (NSControlTintDidChangeNotification_) + return NSControlTintDidChangeNotification_; + + return NSControlTintDidChangeNotification_ = new NSString(bindings.NSControlTintDidChangeNotification); +} + +enum +{ + NSAnyType = 0, + NSIntType = 1, + NSPositiveIntType = 2, + NSFloatType = 3, + NSPositiveFloatType = 4, + NSDoubleType = 6, + NSPositiveDoubleType = 7 +} + +enum +{ + NSNullCellType = 0, + NSTextCellType = 1, + NSImageCellType = 2 +} + +enum +{ + NSCellDisabled = 0, + NSCellState = 1, + NSPushInCell = 2, + NSCellEditable = 3, + NSChangeGrayCell = 4, + NSCellHighlighted = 5, + NSCellLightsByContents = 6, + NSCellLightsByGray = 7, + NSChangeBackgroundCell = 8, + NSCellLightsByBackground = 9, + NSCellIsBordered = 10, + NSCellHasOverlappingImage = 11, + NSCellHasImageHorizontal = 12, + NSCellHasImageOnLeftOrBottom = 13, + NSCellChangesContents = 14, + NSCellIsInsetButton = 15, + NSCellAllowsMixedState = 16 +} + +enum +{ + NSNoImage = 0, + NSImageOnly = 1, + NSImageLeft = 2, + NSImageRight = 3, + NSImageBelow = 4, + NSImageAbove = 5, + NSImageOverlaps = 6 +} + +enum +{ + NSScaleProportionally = 0, + NSScaleToFit, + NSScaleNone +} + +enum +{ + NSImageScaleProportionallyDown = 0, + NSImageScaleAxesIndependently, + NSImageScaleNone, + NSImageScaleProportionallyUpOrDown +} + +enum +{ + NSMixedState = -1, + NSOffState = 0, + NSOnState = 1 +} + +enum +{ + NSNoCellMask = 0, + NSContentsCellMask = 1, + NSPushInCellMask = 2, + NSChangeGrayCellMask = 4, + NSChangeBackgroundCellMask = 8 +} + +enum +{ + NSDefaultControlTint = 0, + NSBlueControlTint = 1, + NSGraphiteControlTint = 6, + NSClearControlTint = 7 +} + +enum +{ + NSRegularControlSize, + NSSmallControlSize, + NSMiniControlSize +} + +enum +{ + NSCellHitNone = 0, + NSCellHitContentArea = 1 << 0, + NSCellHitEditableTextArea = 1 << 1, + NSCellHitTrackableArea = 1 << 2 +} + +enum +{ + NSBackgroundStyleLight = 0, + NSBackgroundStyleDark, + NSBackgroundStyleRaised, + NSBackgroundStyleLowered +} + +struct _CFlags +{ + uint state; + uint highlighted; + uint disabled; + uint editable; + uint type; + uint vCentered; + uint hCentered; + uint bordered; + uint bezeled; + uint selectable; + uint scrollable; + uint continuous; + uint actOnMouseDown; + uint isLeaf; + uint invalidObjectValue; + uint invalidFont; + uint lineBreakMode; + uint backgroundStyle; + uint reserved1; + uint actOnMouseDragged; + uint isLoaded; + uint truncateLastLine; + uint dontActOnMouseUp; + uint isWhite; + uint useUserKeyEquivalent; + uint showsFirstResponder; + uint focusRingType; + uint wasSelectable; + uint hasInvalidObject; + uint allowsEditingTextAttributes; + uint importsGraphics; + uint alignment; + uint reserved; + uint refusesFirstResponder; + uint needsHighlightedText; + uint dontAllowsUndo; + uint currentlyEditing; + uint allowsMixedState; + uint inMixedState; + uint sendsActionOnEndEditing; + uint inSendAction; + uint menuWasSet; + uint controlTint; + uint controlSize; + uint branchImageDisabled; + uint drawingInRevealover; + uint needsHighlightedTextHint; +} + +const TNSCellMixedState = ` + + void setAllowsMixedState (bool flag) + { + return invokeObjcSelf!(void, "setAllowsMixedState:", bool)(flag); + } + + bool allowsMixedState () + { + return invokeObjcSelf!(bool, "allowsMixedState"); + } + + NSInteger nextState () + { + return invokeObjcSelf!(NSInteger, "nextState"); + } + + void setNextState () + { + return invokeObjcSelf!(void, "setNextState"); + } + + //mixin ObjcBindMethod!(setAllowsMixedState, "setAllowsMixedState:"); + //mixin ObjcBindMethod!(allowsMixedState, "allowsMixedState"); + //mixin ObjcBindMethod!(nextState, "nextState"); + //mixin ObjcBindMethod!(setNextState, "setNextState"); + +`; + +const TNSCellBackgroundStyle = ` + + int backgroundStyle () + { + return invokeObjcSelf!(int, "backgroundStyle"); + } + + void setBackgroundStyle (int style) + { + return invokeObjcSelf!(void, "setBackgroundStyle:", int)(style); + } + + int interiorBackgroundStyle () + { + return invokeObjcSelf!(int, "interiorBackgroundStyle"); + } + + //mixin ObjcBindMethod!(backgroundStyle, "backgroundStyle"); + //mixin ObjcBindMethod!(setBackgroundStyle, "setBackgroundStyle:"); + //mixin ObjcBindMethod!(interiorBackgroundStyle, "interiorBackgroundStyle"); + +`; + +const TNSCellExpansion = ` + + NSRect expansionFrameWithFrame (NSRect cellFrame, NSView view) + { + return invokeObjcSelf!(NSRect, "expansionFrameWithFrame:inView:", NSRect, NSView)(cellFrame, view); + } + + void drawWithExpansionFrame (NSRect cellFrame, NSView view) + { + return invokeObjcSelf!(void, "drawWithExpansionFrame:inView:", NSRect, NSView)(cellFrame, view); + } + + //mixin ObjcBindMethod!(expansionFrameWithFrame, "expansionFrameWithFrame:inView:"); + //mixin ObjcBindMethod!(drawWithExpansionFrame, "drawWithExpansionFrame:inView:"); + +`; + +const TNSCellHitTest = ` + + NSUInteger hitTestForEvent (NSEvent event, NSRect cellFrame, NSView controlView) + { + return invokeObjcSelf!(NSUInteger, "hitTestForEvent:inRect:ofView:", NSEvent, NSRect, NSView)(event, cellFrame, controlView); + } + + //mixin ObjcBindMethod!(hitTestForEvent, "hitTestForEvent:inRect:ofView:"); + +`; + +const TNSCellAttributedStringMethods = ` + + NSAttributedString attributedStringValue () + { + return invokeObjcSelf!(NSAttributedString, "attributedStringValue"); + } + + void setAttributedStringValue (NSAttributedString obj) + { + return invokeObjcSelf!(void, "setAttributedStringValue:", NSAttributedString)(obj); + } + + bool allowsEditingTextAttributes () + { + return invokeObjcSelf!(bool, "allowsEditingTextAttributes"); + } + + void setAllowsEditingTextAttributes (bool flag) + { + return invokeObjcSelf!(void, "setAllowsEditingTextAttributes:", bool)(flag); + } + + bool importsGraphics () + { + return invokeObjcSelf!(bool, "importsGraphics"); + } + + void setImportsGraphics (bool flag) + { + return invokeObjcSelf!(void, "setImportsGraphics:", bool)(flag); + } + + //mixin ObjcBindMethod!(attributedStringValue, "attributedStringValue"); + //mixin ObjcBindMethod!(setAttributedStringValue, "setAttributedStringValue:"); + //mixin ObjcBindMethod!(allowsEditingTextAttributes, "allowsEditingTextAttributes"); + //mixin ObjcBindMethod!(setAllowsEditingTextAttributes, "setAllowsEditingTextAttributes:"); + //mixin ObjcBindMethod!(importsGraphics, "importsGraphics"); + //mixin ObjcBindMethod!(setImportsGraphics, "setImportsGraphics:"); + +`; + +class NSCell : NSObject, INSCopying, INSCoding +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + typeof(this) copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); + } + + static bool prefersTrackingUntilMouseUp () + { + return invokeObjcSelfClass!(bool, "prefersTrackingUntilMouseUp"); + } + + NSCell initTextCell (NSString aString) + { + id result = invokeObjcSelf!(id, "initTextCell:", NSString)(aString); + return result is this.objcObject ? this : (result !is null ? new NSCell(result) : null); + } + + this (NSString aString) + { + super(NSCell.alloc.initTextCell(aString).objcObject); + } + + NSCell initImageCell (NSImage image) + { + id result = invokeObjcSelf!(id, "initImageCell:", NSImage)(image); + return result is this.objcObject ? this : (result !is null ? new NSCell(result) : null); + } + + this (NSImage image) + { + super(NSCell.alloc.initImageCell(image).objcObject); + } + + NSView controlView () + { + return invokeObjcSelf!(NSView, "controlView"); + } + + void setControlView (NSView view) + { + return invokeObjcSelf!(void, "setControlView:", NSView)(view); + } + + uint type () + { + return invokeObjcSelf!(uint, "type"); + } + + void setType (uint aType) + { + return invokeObjcSelf!(void, "setType:", uint)(aType); + } + + NSInteger state () + { + return invokeObjcSelf!(NSInteger, "state"); + } + + void setState (NSInteger value) + { + return invokeObjcSelf!(void, "setState:", NSInteger)(value); + } + + Object target () + { + return invokeObjcSelf!(Object, "target"); + } + + void setTarget (Object anObject) + { + return invokeObjcSelf!(void, "setTarget:", Object)(anObject); + } + + SEL action () + { + return invokeObjcSelf!(SEL, "action"); + } + + void setAction (SEL aSelector) + { + return invokeObjcSelf!(void, "setAction:", SEL)(aSelector); + } + + NSInteger tag () + { + return invokeObjcSelf!(NSInteger, "tag"); + } + + void setTag (NSInteger anInt) + { + return invokeObjcSelf!(void, "setTag:", NSInteger)(anInt); + } + + NSString title () + { + return invokeObjcSelf!(NSString, "title"); + } + + void setTitle (NSString aString) + { + return invokeObjcSelf!(void, "setTitle:", NSString)(aString); + } + + bool isOpaque () + { + return invokeObjcSelf!(bool, "isOpaque"); + } + + bool isEnabled () + { + return invokeObjcSelf!(bool, "isEnabled"); + } + + void setEnabled (bool flag) + { + return invokeObjcSelf!(void, "setEnabled:", bool)(flag); + } + + NSInteger sendActionOn (NSInteger mask) + { + return invokeObjcSelf!(NSInteger, "sendActionOn:", NSInteger)(mask); + } + + bool isContinuous () + { + return invokeObjcSelf!(bool, "isContinuous"); + } + + void setContinuous (bool flag) + { + return invokeObjcSelf!(void, "setContinuous:", bool)(flag); + } + + bool isEditable () + { + return invokeObjcSelf!(bool, "isEditable"); + } + + void setEditable (bool flag) + { + return invokeObjcSelf!(void, "setEditable:", bool)(flag); + } + + bool isSelectable () + { + return invokeObjcSelf!(bool, "isSelectable"); + } + + void setSelectable (bool flag) + { + return invokeObjcSelf!(void, "setSelectable:", bool)(flag); + } + + bool isBordered () + { + return invokeObjcSelf!(bool, "isBordered"); + } + + void setBordered (bool flag) + { + return invokeObjcSelf!(void, "setBordered:", bool)(flag); + } + + bool isBezeled () + { + return invokeObjcSelf!(bool, "isBezeled"); + } + + void setBezeled (bool flag) + { + return invokeObjcSelf!(void, "setBezeled:", bool)(flag); + } + + bool isScrollable () + { + return invokeObjcSelf!(bool, "isScrollable"); + } + + void setScrollable (bool flag) + { + return invokeObjcSelf!(void, "setScrollable:", bool)(flag); + } + + bool isHighlighted () + { + return invokeObjcSelf!(bool, "isHighlighted"); + } + + void setHighlighted (bool flag) + { + return invokeObjcSelf!(void, "setHighlighted:", bool)(flag); + } + + uint alignment () + { + return invokeObjcSelf!(uint, "alignment"); + } + + void setAlignment (uint mode) + { + return invokeObjcSelf!(void, "setAlignment:", uint)(mode); + } + + bool wraps () + { + return invokeObjcSelf!(bool, "wraps"); + } + + void setWraps (bool flag) + { + return invokeObjcSelf!(void, "setWraps:", bool)(flag); + } + + NSFont font () + { + return invokeObjcSelf!(NSFont, "font"); + } + + void setFont (NSFont fontObj) + { + return invokeObjcSelf!(void, "setFont:", NSFont)(fontObj); + } + + NSInteger entryType () + { + return invokeObjcSelf!(NSInteger, "entryType"); + } + + void setEntryType (NSInteger aType) + { + return invokeObjcSelf!(void, "setEntryType:", NSInteger)(aType); + } + + bool isEntryAcceptable (NSString aString) + { + return invokeObjcSelf!(bool, "isEntryAcceptable:", NSString)(aString); + } + + void setFloatingPointFormat (bool autoRange, NSUInteger leftDigits, NSUInteger rightDigits) + { + return invokeObjcSelf!(void, "setFloatingPointFormat:left:right:", bool, NSUInteger, NSUInteger)(autoRange, leftDigits, rightDigits); + } + + NSString keyEquivalent () + { + return invokeObjcSelf!(NSString, "keyEquivalent"); + } + + void setFormatter (NSFormatter newFormatter) + { + return invokeObjcSelf!(void, "setFormatter:", NSFormatter)(newFormatter); + } + + Object formatter () + { + return invokeObjcSelf!(Object, "formatter"); + } + + Object objectValue () + { + return invokeObjcSelf!(Object, "objectValue"); + } + + void setObjectValue (INSCopying obj) + { + return invokeObjcSelf!(void, "setObjectValue:", INSCopying)(obj); + } + + bool hasValidObjectValue () + { + return invokeObjcSelf!(bool, "hasValidObjectValue"); + } + + NSString stringValue () + { + return invokeObjcSelf!(NSString, "stringValue"); + } + + void setStringValue (NSString aString) + { + return invokeObjcSelf!(void, "setStringValue:", NSString)(aString); + } + + int compare (Object otherCell) + { + return invokeObjcSelf!(int, "compare:", Object)(otherCell); + } + + int intValue () + { + return invokeObjcSelf!(int, "intValue"); + } + + void setIntValue (int anInt) + { + return invokeObjcSelf!(void, "setIntValue:", int)(anInt); + } + + float floatValue () + { + return invokeObjcSelf!(float, "floatValue"); + } + + void setFloatValue (float aFloat) + { + return invokeObjcSelf!(void, "setFloatValue:", float)(aFloat); + } + + double doubleValue () + { + return invokeObjcSelf!(double, "doubleValue"); + } + + void setDoubleValue (double aDouble) + { + return invokeObjcSelf!(void, "setDoubleValue:", double)(aDouble); + } + + void takeIntValueFrom (Object sender) + { + return invokeObjcSelf!(void, "takeIntValueFrom:", Object)(sender); + } + + void takeFloatValueFrom (Object sender) + { + return invokeObjcSelf!(void, "takeFloatValueFrom:", Object)(sender); + } + + void takeDoubleValueFrom (Object sender) + { + return invokeObjcSelf!(void, "takeDoubleValueFrom:", Object)(sender); + } + + void takeStringValueFrom (Object sender) + { + return invokeObjcSelf!(void, "takeStringValueFrom:", Object)(sender); + } + + void takeObjectValueFrom (Object sender) + { + return invokeObjcSelf!(void, "takeObjectValueFrom:", Object)(sender); + } + + NSImage image () + { + return invokeObjcSelf!(NSImage, "image"); + } + + void setImage (NSImage image) + { + return invokeObjcSelf!(void, "setImage:", NSImage)(image); + } + + void setControlTint (uint controlTint) + { + return invokeObjcSelf!(void, "setControlTint:", uint)(controlTint); + } + + uint controlTint () + { + return invokeObjcSelf!(uint, "controlTint"); + } + + void setControlSize (uint size) + { + return invokeObjcSelf!(void, "setControlSize:", uint)(size); + } + + uint controlSize () + { + return invokeObjcSelf!(uint, "controlSize"); + } + + Object representedObject () + { + return invokeObjcSelf!(Object, "representedObject"); + } + + void setRepresentedObject (Object anObject) + { + return invokeObjcSelf!(void, "setRepresentedObject:", Object)(anObject); + } + + NSInteger cellAttribute (uint aParameter) + { + return invokeObjcSelf!(NSInteger, "cellAttribute:", uint)(aParameter); + } + + void setCellAttribute (uint aParameter, NSInteger value) + { + return invokeObjcSelf!(void, "setCellAttribute:to:", uint, NSInteger)(aParameter, value); + } + + NSRect imageRectForBounds (NSRect theRect) + { + return invokeObjcSelf!(NSRect, "imageRectForBounds:", NSRect)(theRect); + } + + NSRect titleRectForBounds (NSRect theRect) + { + return invokeObjcSelf!(NSRect, "titleRectForBounds:", NSRect)(theRect); + } + + NSRect drawingRectForBounds (NSRect theRect) + { + return invokeObjcSelf!(NSRect, "drawingRectForBounds:", NSRect)(theRect); + } + + NSSize cellSize () + { + return invokeObjcSelf!(NSSize, "cellSize"); + } + + NSSize cellSizeForBounds (NSRect aRect) + { + return invokeObjcSelf!(NSSize, "cellSizeForBounds:", NSRect)(aRect); + } + + NSColor highlightColorWithFrame (NSRect cellFrame, NSView controlView) + { + return invokeObjcSelf!(NSColor, "highlightColorWithFrame:inView:", NSRect, NSView)(cellFrame, controlView); + } + + void calcDrawInfo (NSRect aRect) + { + return invokeObjcSelf!(void, "calcDrawInfo:", NSRect)(aRect); + } + + NSText setUpFieldEditorAttributes (NSText textObj) + { + return invokeObjcSelf!(NSText, "setUpFieldEditorAttributes:", NSText)(textObj); + } + + void drawInteriorWithFrame (NSRect cellFrame, NSView controlView) + { + return invokeObjcSelf!(void, "drawInteriorWithFrame:inView:", NSRect, NSView)(cellFrame, controlView); + } + + void drawWithFrame (NSRect cellFrame, NSView controlView) + { + return invokeObjcSelf!(void, "drawWithFrame:inView:", NSRect, NSView)(cellFrame, controlView); + } + + void highlight (bool flag, NSRect cellFrame, NSView controlView) + { + return invokeObjcSelf!(void, "highlight:withFrame:inView:", bool, NSRect, NSView)(flag, cellFrame, controlView); + } + + NSInteger mouseDownFlags () + { + return invokeObjcSelf!(NSInteger, "mouseDownFlags"); + } + + void getPeriodicDelay (float* delay, float* interval) + { + return invokeObjcSelf!(void, "getPeriodicDelay:interval:", float*, float*)(delay, interval); + } + + bool startTrackingAt (NSPoint startPoint, NSView controlView) + { + return invokeObjcSelf!(bool, "startTrackingAt:inView:", NSPoint, NSView)(startPoint, controlView); + } + + bool continueTracking (NSPoint lastPoint, NSPoint currentPoint, NSView controlView) + { + return invokeObjcSelf!(bool, "continueTracking:at:inView:", NSPoint, NSPoint, NSView)(lastPoint, currentPoint, controlView); + } + + void stopTracking (NSPoint lastPoint, NSPoint stopPoint, NSView controlView, bool flag) + { + return invokeObjcSelf!(void, "stopTracking:at:inView:mouseIsUp:", NSPoint, NSPoint, NSView, bool)(lastPoint, stopPoint, controlView, flag); + } + + bool trackMouse (NSEvent theEvent, NSRect cellFrame, NSView controlView, bool flag) + { + return invokeObjcSelf!(bool, "trackMouse:inRect:ofView:untilMouseUp:", NSEvent, NSRect, NSView, bool)(theEvent, cellFrame, controlView, flag); + } + + void editWithFrame (NSRect aRect, NSView controlView, NSText textObj, Object anObject, NSEvent theEvent) + { + return invokeObjcSelf!(void, "editWithFrame:inView:editor:delegate:event:", NSRect, NSView, NSText, Object, NSEvent)(aRect, controlView, textObj, anObject, theEvent); + } + + void selectWithFrame (NSRect aRect, NSView controlView, NSText textObj, Object anObject, NSInteger selStart, NSInteger selLength) + { + return invokeObjcSelf!(void, "selectWithFrame:inView:editor:delegate:start:length:", NSRect, NSView, NSText, Object, NSInteger, NSInteger)(aRect, controlView, textObj, anObject, selStart, selLength); + } + + void endEditing (NSText textObj) + { + return invokeObjcSelf!(void, "endEditing:", NSText)(textObj); + } + + void resetCursorRect (NSRect cellFrame, NSView controlView) + { + return invokeObjcSelf!(void, "resetCursorRect:inView:", NSRect, NSView)(cellFrame, controlView); + } + + void setMenu (NSMenu aMenu) + { + return invokeObjcSelf!(void, "setMenu:", NSMenu)(aMenu); + } + + NSMenu menu () + { + return invokeObjcSelf!(NSMenu, "menu"); + } + + NSMenu menuForEvent (NSEvent event, NSRect cellFrame, NSView view) + { + return invokeObjcSelf!(NSMenu, "menuForEvent:inRect:ofView:", NSEvent, NSRect, NSView)(event, cellFrame, view); + } + + static NSMenu defaultMenu () + { + return invokeObjcSelfClass!(NSMenu, "defaultMenu"); + } + + void setSendsActionOnEndEditing (bool flag) + { + return invokeObjcSelf!(void, "setSendsActionOnEndEditing:", bool)(flag); + } + + bool sendsActionOnEndEditing () + { + return invokeObjcSelf!(bool, "sendsActionOnEndEditing"); + } + + int baseWritingDirection () + { + return invokeObjcSelf!(int, "baseWritingDirection"); + } + + void setBaseWritingDirection (int writingDirection) + { + return invokeObjcSelf!(void, "setBaseWritingDirection:", int)(writingDirection); + } + + void setLineBreakMode (uint mode) + { + return invokeObjcSelf!(void, "setLineBreakMode:", uint)(mode); + } + + uint lineBreakMode () + { + return invokeObjcSelf!(uint, "lineBreakMode"); + } + + void setAllowsUndo (bool allowsUndo) + { + return invokeObjcSelf!(void, "setAllowsUndo:", bool)(allowsUndo); + } + + bool allowsUndo () + { + return invokeObjcSelf!(bool, "allowsUndo"); + } + + NSInteger integerValue () + { + return invokeObjcSelf!(NSInteger, "integerValue"); + } + + void setIntegerValue (NSInteger anInteger) + { + return invokeObjcSelf!(void, "setIntegerValue:", NSInteger)(anInteger); + } + + void takeIntegerValueFrom (Object sender) + { + return invokeObjcSelf!(void, "takeIntegerValueFrom:", Object)(sender); + } + + bool truncatesLastVisibleLine () + { + return invokeObjcSelf!(bool, "truncatesLastVisibleLine"); + } + + void setTruncatesLastVisibleLine (bool flag) + { + return invokeObjcSelf!(void, "setTruncatesLastVisibleLine:", bool)(flag); + } + + // NSCellMixedState + void setAllowsMixedState (bool flag) + { + return invokeObjcSelf!(void, "setAllowsMixedState:", bool)(flag); + } + + bool allowsMixedState () + { + return invokeObjcSelf!(bool, "allowsMixedState"); + } + + NSInteger nextState () + { + return invokeObjcSelf!(NSInteger, "nextState"); + } + + void setNextState () + { + return invokeObjcSelf!(void, "setNextState"); + } + + // NSCellBackgroundStyle + int backgroundStyle () + { + return invokeObjcSelf!(int, "backgroundStyle"); + } + + void setBackgroundStyle (int style) + { + return invokeObjcSelf!(void, "setBackgroundStyle:", int)(style); + } + + int interiorBackgroundStyle () + { + return invokeObjcSelf!(int, "interiorBackgroundStyle"); + } + + // NSCellExpansion + NSRect expansionFrameWithFrame (NSRect cellFrame, NSView view) + { + return invokeObjcSelf!(NSRect, "expansionFrameWithFrame:inView:", NSRect, NSView)(cellFrame, view); + } + + void drawWithExpansionFrame (NSRect cellFrame, NSView view) + { + return invokeObjcSelf!(void, "drawWithExpansionFrame:inView:", NSRect, NSView)(cellFrame, view); + } + + // NSCellHitTest + NSUInteger hitTestForEvent (NSEvent event, NSRect cellFrame, NSView controlView) + { + return invokeObjcSelf!(NSUInteger, "hitTestForEvent:inRect:ofView:", NSEvent, NSRect, NSView)(event, cellFrame, controlView); + } + + // NSCellAttributedStringMethods + NSAttributedString attributedStringValue () + { + return invokeObjcSelf!(NSAttributedString, "attributedStringValue"); + } + + void setAttributedStringValue (NSAttributedString obj) + { + return invokeObjcSelf!(void, "setAttributedStringValue:", NSAttributedString)(obj); + } + + bool allowsEditingTextAttributes () + { + return invokeObjcSelf!(bool, "allowsEditingTextAttributes"); + } + + void setAllowsEditingTextAttributes (bool flag) + { + return invokeObjcSelf!(void, "setAllowsEditingTextAttributes:", bool)(flag); + } + + bool importsGraphics () + { + return invokeObjcSelf!(bool, "importsGraphics"); + } + + void setImportsGraphics (bool flag) + { + return invokeObjcSelf!(void, "setImportsGraphics:", bool)(flag); + } +} + +void NSDrawThreePartImage (NSRect frame, NSImage startCap, NSImage centerFill, NSImage endCap, bool vertical, uint op, CGFloat alphaFraction, bool flipped) +{ + return Bridge.invokeObjcFunction!(void, bindings.NSDrawThreePartImage, NSRect, NSImage, NSImage, NSImage, bool, uint, CGFloat, bool)(frame, startCap, centerFill, endCap, vertical, op, alphaFraction, flipped); +} + +void NSDrawNinePartImage (NSRect frame, NSImage topLeftCorner, NSImage topEdgeFill, NSImage topRightCorner, NSImage leftEdgeFill, NSImage centerFill, NSImage rightEdgeFill, NSImage bottomLeftCorner, NSImage bottomEdgeFill, NSImage bottomRightCorner, uint op, CGFloat alphaFraction, bool flipped) +{ + return Bridge.invokeObjcFunction!(void, bindings.NSDrawNinePartImage, NSRect, NSImage, NSImage, NSImage, NSImage, NSImage, NSImage, NSImage, NSImage, NSImage, uint, CGFloat, bool)(frame, topLeftCorner, topEdgeFill, topRightCorner, leftEdgeFill, centerFill, rightEdgeFill, bottomLeftCorner, bottomEdgeFill, bottomRightCorner, op, alphaFraction, flipped); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSCell_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSCell_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,26 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSCell_bindings; + +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.objc.objc; + +extern (C) +{ + extern + { + package id NSControlTintDidChangeNotification; + } +} + +extern (C) +{ + package void NSDrawThreePartImage (NSRect frame, id startCap, id centerFill, id endCap, bool vertical, uint op, CGFloat alphaFraction, bool flipped); + package void NSDrawNinePartImage (NSRect frame, id topLeftCorner, id topEdgeFill, id topRightCorner, id leftEdgeFill, id centerFill, id rightEdgeFill, id bottomLeftCorner, id bottomEdgeFill, id bottomRightCorner, uint op, CGFloat alphaFraction, bool flipped); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSClipView.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSClipView.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,124 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSClipView; + +import dstep.appkit.NSColor; +import dstep.appkit.NSCursor; +import dstep.appkit.NSEvent; +import dstep.appkit.NSView; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSNotification; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSClipView : NSView +{ + mixin (ObjcWrap); + + void setBackgroundColor (NSColor color) + { + return invokeObjcSelf!(void, "setBackgroundColor:", NSColor)(color); + } + + NSColor backgroundColor () + { + return invokeObjcSelf!(NSColor, "backgroundColor"); + } + + void setDrawsBackground (bool flag) + { + return invokeObjcSelf!(void, "setDrawsBackground:", bool)(flag); + } + + bool drawsBackground () + { + return invokeObjcSelf!(bool, "drawsBackground"); + } + + void setDocumentView (NSView aView) + { + return invokeObjcSelf!(void, "setDocumentView:", NSView)(aView); + } + + Object documentView () + { + return invokeObjcSelf!(Object, "documentView"); + } + + NSRect documentRect () + { + return invokeObjcSelf!(NSRect, "documentRect"); + } + + void setDocumentCursor (NSCursor anObj) + { + return invokeObjcSelf!(void, "setDocumentCursor:", NSCursor)(anObj); + } + + NSCursor documentCursor () + { + return invokeObjcSelf!(NSCursor, "documentCursor"); + } + + NSRect documentVisibleRect () + { + return invokeObjcSelf!(NSRect, "documentVisibleRect"); + } + + void viewFrameChanged (NSNotification notification) + { + return invokeObjcSelf!(void, "viewFrameChanged:", NSNotification)(notification); + } + + void viewBoundsChanged (NSNotification notification) + { + return invokeObjcSelf!(void, "viewBoundsChanged:", NSNotification)(notification); + } + + void setCopiesOnScroll (bool flag) + { + return invokeObjcSelf!(void, "setCopiesOnScroll:", bool)(flag); + } + + bool copiesOnScroll () + { + return invokeObjcSelf!(bool, "copiesOnScroll"); + } + + bool autoscroll (NSEvent theEvent) + { + return invokeObjcSelf!(bool, "autoscroll:", NSEvent)(theEvent); + } + + NSPoint constrainScrollPoint (NSPoint newOrigin) + { + return invokeObjcSelf!(NSPoint, "constrainScrollPoint:", NSPoint)(newOrigin); + } + + void scrollToPoint (NSPoint newOrigin) + { + return invokeObjcSelf!(void, "scrollToPoint:", NSPoint)(newOrigin); + } +} + +const TNSClipViewSuperview = ` + + void reflectScrolledClipView (NSClipView aClipView) + { + return invokeObjcSelf!(void, "reflectScrolledClipView:", NSClipView)(aClipView); + } + + void scrollClipView (NSClipView aClipView, NSPoint aPoint) + { + return invokeObjcSelf!(void, "scrollClipView:toPoint:", NSClipView, NSPoint)(aClipView, aPoint); + } + + //mixin ObjcBindMethod!(reflectScrolledClipView, "reflectScrolledClipView:"); + //mixin ObjcBindMethod!(scrollClipView, "scrollClipView:toPoint:"); + +`; + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSCollectionView.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSCollectionView.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,198 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSCollectionView; + +import dstep.appkit.NSAnimation; +import dstep.appkit.NSView; +import dstep.foundation.NSArray; +import dstep.foundation.NSCoder; +import dstep.foundation.NSData; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSIndexSet; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSSet; +import dstep.foundation.NSZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSCollectionViewItem : NSObject, INSCopying, INSCoding +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + typeof(this) copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); + } + + NSCollectionView collectionView () + { + return invokeObjcSelf!(NSCollectionView, "collectionView"); + } + + void setRepresentedObject (Object object) + { + return invokeObjcSelf!(void, "setRepresentedObject:", Object)(object); + } + + Object representedObject () + { + return invokeObjcSelf!(Object, "representedObject"); + } + + void setView (NSView view) + { + return invokeObjcSelf!(void, "setView:", NSView)(view); + } + + NSView view () + { + return invokeObjcSelf!(NSView, "view"); + } + + void setSelected (bool flag) + { + return invokeObjcSelf!(void, "setSelected:", bool)(flag); + } + + bool isSelected () + { + return invokeObjcSelf!(bool, "isSelected"); + } + +} + +class NSCollectionView : NSView +{ + mixin (ObjcWrap); + + bool isFirstResponder () + { + return invokeObjcSelf!(bool, "isFirstResponder"); + } + + void setContent (NSArray content) + { + return invokeObjcSelf!(void, "setContent:", NSArray)(content); + } + + NSArray content () + { + return invokeObjcSelf!(NSArray, "content"); + } + + void setSelectable (bool flag) + { + return invokeObjcSelf!(void, "setSelectable:", bool)(flag); + } + + bool isSelectable () + { + return invokeObjcSelf!(bool, "isSelectable"); + } + + void setAllowsMultipleSelection (bool flag) + { + return invokeObjcSelf!(void, "setAllowsMultipleSelection:", bool)(flag); + } + + bool allowsMultipleSelection () + { + return invokeObjcSelf!(bool, "allowsMultipleSelection"); + } + + void setSelectionIndexes (NSIndexSet indexes) + { + return invokeObjcSelf!(void, "setSelectionIndexes:", NSIndexSet)(indexes); + } + + NSIndexSet selectionIndexes () + { + return invokeObjcSelf!(NSIndexSet, "selectionIndexes"); + } + + NSCollectionViewItem newItemForRepresentedObject (Object object) + { + return invokeObjcSelf!(NSCollectionViewItem, "newItemForRepresentedObject:", Object)(object); + } + + void setItemPrototype (NSCollectionViewItem prototype) + { + return invokeObjcSelf!(void, "setItemPrototype:", NSCollectionViewItem)(prototype); + } + + NSCollectionViewItem itemPrototype () + { + return invokeObjcSelf!(NSCollectionViewItem, "itemPrototype"); + } + + void setMaxNumberOfRows (NSUInteger number) + { + return invokeObjcSelf!(void, "setMaxNumberOfRows:", NSUInteger)(number); + } + + NSUInteger maxNumberOfRows () + { + return invokeObjcSelf!(NSUInteger, "maxNumberOfRows"); + } + + void setMaxNumberOfColumns (NSUInteger number) + { + return invokeObjcSelf!(void, "setMaxNumberOfColumns:", NSUInteger)(number); + } + + NSUInteger maxNumberOfColumns () + { + return invokeObjcSelf!(NSUInteger, "maxNumberOfColumns"); + } + + void setMinItemSize (NSSize size) + { + return invokeObjcSelf!(void, "setMinItemSize:", NSSize)(size); + } + + NSSize minItemSize () + { + return invokeObjcSelf!(NSSize, "minItemSize"); + } + + void setMaxItemSize (NSSize size) + { + return invokeObjcSelf!(void, "setMaxItemSize:", NSSize)(size); + } + + NSSize maxItemSize () + { + return invokeObjcSelf!(NSSize, "maxItemSize"); + } + + void setBackgroundColors (NSArray colors) + { + return invokeObjcSelf!(void, "setBackgroundColors:", NSArray)(colors); + } + + NSArray backgroundColors () + { + return invokeObjcSelf!(NSArray, "backgroundColors"); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSColor.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSColor.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,597 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSColor; + +import dstep.appkit.AppKitDefines; +import dstep.appkit.NSCell; +import dstep.appkit.NSColorSpace; +import dstep.appkit.NSImage; +import dstep.appkit.NSPasteboard; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSArray; +import dstep.foundation.NSCoder; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.quartzcore.CIColor; + +import bindings = dstep.appkit.NSColor_bindings; + +private +{ + NSString NSSystemColorsDidChangeNotification_; +} + +NSString NSSystemColorsDidChangeNotification () +{ + if (NSSystemColorsDidChangeNotification_) + return NSSystemColorsDidChangeNotification_; + + return NSSystemColorsDidChangeNotification_ = new NSString(bindings.NSSystemColorsDidChangeNotification); +} + +class NSColor : NSObject, INSCopying, INSCoding +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + typeof(this) copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); + } + + static NSColor colorWithCalibratedWhite (CGFloat white, CGFloat alpha) + { + return invokeObjcSelfClass!(NSColor, "colorWithCalibratedWhite:alpha:", CGFloat, CGFloat)(white, alpha); + } + + static NSColor colorWithCalibratedHue (CGFloat hue, CGFloat saturation, CGFloat brightness, CGFloat alpha) + { + return invokeObjcSelfClass!(NSColor, "colorWithCalibratedHue:saturation:brightness:alpha:", CGFloat, CGFloat, CGFloat, CGFloat)(hue, saturation, brightness, alpha); + } + + static NSColor colorWithCalibratedRed (CGFloat red, CGFloat green, CGFloat blue, CGFloat alpha) + { + return invokeObjcSelfClass!(NSColor, "colorWithCalibratedRed:green:blue:alpha:", CGFloat, CGFloat, CGFloat, CGFloat)(red, green, blue, alpha); + } + + static NSColor colorWithDeviceWhite (CGFloat white, CGFloat alpha) + { + return invokeObjcSelfClass!(NSColor, "colorWithDeviceWhite:alpha:", CGFloat, CGFloat)(white, alpha); + } + + static NSColor colorWithDeviceHue (CGFloat hue, CGFloat saturation, CGFloat brightness, CGFloat alpha) + { + return invokeObjcSelfClass!(NSColor, "colorWithDeviceHue:saturation:brightness:alpha:", CGFloat, CGFloat, CGFloat, CGFloat)(hue, saturation, brightness, alpha); + } + + static NSColor colorWithDeviceRed (CGFloat red, CGFloat green, CGFloat blue, CGFloat alpha) + { + return invokeObjcSelfClass!(NSColor, "colorWithDeviceRed:green:blue:alpha:", CGFloat, CGFloat, CGFloat, CGFloat)(red, green, blue, alpha); + } + + static NSColor colorWithDeviceCyan (CGFloat cyan, CGFloat magenta, CGFloat yellow, CGFloat black, CGFloat alpha) + { + return invokeObjcSelfClass!(NSColor, "colorWithDeviceCyan:magenta:yellow:black:alpha:", CGFloat, CGFloat, CGFloat, CGFloat, CGFloat)(cyan, magenta, yellow, black, alpha); + } + + static NSColor colorWithCatalogName (NSString listName, NSString colorName) + { + return invokeObjcSelfClass!(NSColor, "colorWithCatalogName:colorName:", NSString, NSString)(listName, colorName); + } + + static NSColor colorWithColorSpace (NSColorSpace space, CGFloat* components, NSInteger numberOfComponents) + { + return invokeObjcSelfClass!(NSColor, "colorWithColorSpace:components:count:", NSColorSpace, CGFloat*, NSInteger)(space, components, numberOfComponents); + } + + static NSColor blackColor () + { + return invokeObjcSelfClass!(NSColor, "blackColor"); + } + + static NSColor darkGrayColor () + { + return invokeObjcSelfClass!(NSColor, "darkGrayColor"); + } + + static NSColor lightGrayColor () + { + return invokeObjcSelfClass!(NSColor, "lightGrayColor"); + } + + static NSColor whiteColor () + { + return invokeObjcSelfClass!(NSColor, "whiteColor"); + } + + static NSColor grayColor () + { + return invokeObjcSelfClass!(NSColor, "grayColor"); + } + + static NSColor redColor () + { + return invokeObjcSelfClass!(NSColor, "redColor"); + } + + static NSColor greenColor () + { + return invokeObjcSelfClass!(NSColor, "greenColor"); + } + + static NSColor blueColor () + { + return invokeObjcSelfClass!(NSColor, "blueColor"); + } + + static NSColor cyanColor () + { + return invokeObjcSelfClass!(NSColor, "cyanColor"); + } + + static NSColor yellowColor () + { + return invokeObjcSelfClass!(NSColor, "yellowColor"); + } + + static NSColor magentaColor () + { + return invokeObjcSelfClass!(NSColor, "magentaColor"); + } + + static NSColor orangeColor () + { + return invokeObjcSelfClass!(NSColor, "orangeColor"); + } + + static NSColor purpleColor () + { + return invokeObjcSelfClass!(NSColor, "purpleColor"); + } + + static NSColor brownColor () + { + return invokeObjcSelfClass!(NSColor, "brownColor"); + } + + static NSColor clearColor () + { + return invokeObjcSelfClass!(NSColor, "clearColor"); + } + + static NSColor controlShadowColor () + { + return invokeObjcSelfClass!(NSColor, "controlShadowColor"); + } + + static NSColor controlDarkShadowColor () + { + return invokeObjcSelfClass!(NSColor, "controlDarkShadowColor"); + } + + static NSColor controlColor () + { + return invokeObjcSelfClass!(NSColor, "controlColor"); + } + + static NSColor controlHighlightColor () + { + return invokeObjcSelfClass!(NSColor, "controlHighlightColor"); + } + + static NSColor controlLightHighlightColor () + { + return invokeObjcSelfClass!(NSColor, "controlLightHighlightColor"); + } + + static NSColor controlTextColor () + { + return invokeObjcSelfClass!(NSColor, "controlTextColor"); + } + + static NSColor controlBackgroundColor () + { + return invokeObjcSelfClass!(NSColor, "controlBackgroundColor"); + } + + static NSColor selectedControlColor () + { + return invokeObjcSelfClass!(NSColor, "selectedControlColor"); + } + + static NSColor secondarySelectedControlColor () + { + return invokeObjcSelfClass!(NSColor, "secondarySelectedControlColor"); + } + + static NSColor selectedControlTextColor () + { + return invokeObjcSelfClass!(NSColor, "selectedControlTextColor"); + } + + static NSColor disabledControlTextColor () + { + return invokeObjcSelfClass!(NSColor, "disabledControlTextColor"); + } + + static NSColor textColor () + { + return invokeObjcSelfClass!(NSColor, "textColor"); + } + + static NSColor textBackgroundColor () + { + return invokeObjcSelfClass!(NSColor, "textBackgroundColor"); + } + + static NSColor selectedTextColor () + { + return invokeObjcSelfClass!(NSColor, "selectedTextColor"); + } + + static NSColor selectedTextBackgroundColor () + { + return invokeObjcSelfClass!(NSColor, "selectedTextBackgroundColor"); + } + + static NSColor gridColor () + { + return invokeObjcSelfClass!(NSColor, "gridColor"); + } + + static NSColor keyboardFocusIndicatorColor () + { + return invokeObjcSelfClass!(NSColor, "keyboardFocusIndicatorColor"); + } + + static NSColor windowBackgroundColor () + { + return invokeObjcSelfClass!(NSColor, "windowBackgroundColor"); + } + + static NSColor scrollBarColor () + { + return invokeObjcSelfClass!(NSColor, "scrollBarColor"); + } + + static NSColor knobColor () + { + return invokeObjcSelfClass!(NSColor, "knobColor"); + } + + static NSColor selectedKnobColor () + { + return invokeObjcSelfClass!(NSColor, "selectedKnobColor"); + } + + static NSColor windowFrameColor () + { + return invokeObjcSelfClass!(NSColor, "windowFrameColor"); + } + + static NSColor windowFrameTextColor () + { + return invokeObjcSelfClass!(NSColor, "windowFrameTextColor"); + } + + static NSColor selectedMenuItemColor () + { + return invokeObjcSelfClass!(NSColor, "selectedMenuItemColor"); + } + + static NSColor selectedMenuItemTextColor () + { + return invokeObjcSelfClass!(NSColor, "selectedMenuItemTextColor"); + } + + static NSColor highlightColor () + { + return invokeObjcSelfClass!(NSColor, "highlightColor"); + } + + static NSColor shadowColor () + { + return invokeObjcSelfClass!(NSColor, "shadowColor"); + } + + static NSColor headerColor () + { + return invokeObjcSelfClass!(NSColor, "headerColor"); + } + + static NSColor headerTextColor () + { + return invokeObjcSelfClass!(NSColor, "headerTextColor"); + } + + static NSColor alternateSelectedControlColor () + { + return invokeObjcSelfClass!(NSColor, "alternateSelectedControlColor"); + } + + static NSColor alternateSelectedControlTextColor () + { + return invokeObjcSelfClass!(NSColor, "alternateSelectedControlTextColor"); + } + + static NSArray controlAlternatingRowBackgroundColors () + { + return invokeObjcSelfClass!(NSArray, "controlAlternatingRowBackgroundColors"); + } + + NSColor highlightWithLevel (CGFloat val) + { + id result = invokeObjcSelf!(id, "highlightWithLevel:", CGFloat)(val); + return result is this.objcObject ? this : (result !is null ? new NSColor(result) : null); + } + + NSColor shadowWithLevel (CGFloat val) + { + id result = invokeObjcSelf!(id, "shadowWithLevel:", CGFloat)(val); + return result is this.objcObject ? this : (result !is null ? new NSColor(result) : null); + } + + static NSColor colorForControlTint (uint controlTint) + { + return invokeObjcSelfClass!(NSColor, "colorForControlTint:", uint)(controlTint); + } + + static uint currentControlTint () + { + return invokeObjcSelfClass!(uint, "currentControlTint"); + } + + void set () + { + return invokeObjcSelf!(void, "set"); + } + + void setFill () + { + return invokeObjcSelf!(void, "setFill"); + } + + void setStroke () + { + return invokeObjcSelf!(void, "setStroke"); + } + + NSString colorSpaceName () + { + return invokeObjcSelf!(NSString, "colorSpaceName"); + } + + NSColor colorUsingColorSpaceName (NSString colorSpace) + { + id result = invokeObjcSelf!(id, "colorUsingColorSpaceName:", NSString)(colorSpace); + return result is this.objcObject ? this : (result !is null ? new NSColor(result) : null); + } + + NSColor colorUsingColorSpaceName (NSString colorSpace, NSDictionary deviceDescription) + { + id result = invokeObjcSelf!(id, "colorUsingColorSpaceName:device:", NSString, NSDictionary)(colorSpace, deviceDescription); + return result is this.objcObject ? this : (result !is null ? new NSColor(result) : null); + } + + NSColor colorUsingColorSpace (NSColorSpace space) + { + id result = invokeObjcSelf!(id, "colorUsingColorSpace:", NSColorSpace)(space); + return result is this.objcObject ? this : (result !is null ? new NSColor(result) : null); + } + + NSColor blendedColorWithFraction (CGFloat fraction, NSColor color) + { + id result = invokeObjcSelf!(id, "blendedColorWithFraction:ofColor:", CGFloat, NSColor)(fraction, color); + return result is this.objcObject ? this : (result !is null ? new NSColor(result) : null); + } + + NSColor colorWithAlphaComponent (CGFloat alpha) + { + id result = invokeObjcSelf!(id, "colorWithAlphaComponent:", CGFloat)(alpha); + return result is this.objcObject ? this : (result !is null ? new NSColor(result) : null); + } + + NSString catalogNameComponent () + { + return invokeObjcSelf!(NSString, "catalogNameComponent"); + } + + NSString colorNameComponent () + { + return invokeObjcSelf!(NSString, "colorNameComponent"); + } + + NSString localizedCatalogNameComponent () + { + return invokeObjcSelf!(NSString, "localizedCatalogNameComponent"); + } + + NSString localizedColorNameComponent () + { + return invokeObjcSelf!(NSString, "localizedColorNameComponent"); + } + + CGFloat redComponent () + { + return invokeObjcSelf!(CGFloat, "redComponent"); + } + + CGFloat greenComponent () + { + return invokeObjcSelf!(CGFloat, "greenComponent"); + } + + CGFloat blueComponent () + { + return invokeObjcSelf!(CGFloat, "blueComponent"); + } + + void getRed (CGFloat* red, CGFloat* green, CGFloat* blue, CGFloat* alpha) + { + return invokeObjcSelf!(void, "getRed:green:blue:alpha:", CGFloat*, CGFloat*, CGFloat*, CGFloat*)(red, green, blue, alpha); + } + + CGFloat hueComponent () + { + return invokeObjcSelf!(CGFloat, "hueComponent"); + } + + CGFloat saturationComponent () + { + return invokeObjcSelf!(CGFloat, "saturationComponent"); + } + + CGFloat brightnessComponent () + { + return invokeObjcSelf!(CGFloat, "brightnessComponent"); + } + + void getHue (CGFloat* hue, CGFloat* saturation, CGFloat* brightness, CGFloat* alpha) + { + return invokeObjcSelf!(void, "getHue:saturation:brightness:alpha:", CGFloat*, CGFloat*, CGFloat*, CGFloat*)(hue, saturation, brightness, alpha); + } + + CGFloat whiteComponent () + { + return invokeObjcSelf!(CGFloat, "whiteComponent"); + } + + void getWhite (CGFloat* white, CGFloat* alpha) + { + return invokeObjcSelf!(void, "getWhite:alpha:", CGFloat*, CGFloat*)(white, alpha); + } + + CGFloat cyanComponent () + { + return invokeObjcSelf!(CGFloat, "cyanComponent"); + } + + CGFloat magentaComponent () + { + return invokeObjcSelf!(CGFloat, "magentaComponent"); + } + + CGFloat yellowComponent () + { + return invokeObjcSelf!(CGFloat, "yellowComponent"); + } + + CGFloat blackComponent () + { + return invokeObjcSelf!(CGFloat, "blackComponent"); + } + + void getCyan (CGFloat* cyan, CGFloat* magenta, CGFloat* yellow, CGFloat* black, CGFloat* alpha) + { + return invokeObjcSelf!(void, "getCyan:magenta:yellow:black:alpha:", CGFloat*, CGFloat*, CGFloat*, CGFloat*, CGFloat*)(cyan, magenta, yellow, black, alpha); + } + + NSColorSpace colorSpace () + { + return invokeObjcSelf!(NSColorSpace, "colorSpace"); + } + + NSInteger numberOfComponents () + { + return invokeObjcSelf!(NSInteger, "numberOfComponents"); + } + + void getComponents (CGFloat* components) + { + return invokeObjcSelf!(void, "getComponents:", CGFloat*)(components); + } + + CGFloat alphaComponent () + { + return invokeObjcSelf!(CGFloat, "alphaComponent"); + } + + static NSColor colorFromPasteboard (NSPasteboard pasteBoard) + { + return invokeObjcSelfClass!(NSColor, "colorFromPasteboard:", NSPasteboard)(pasteBoard); + } + + void writeToPasteboard (NSPasteboard pasteBoard) + { + return invokeObjcSelf!(void, "writeToPasteboard:", NSPasteboard)(pasteBoard); + } + + static NSColor colorWithPatternImage (NSImage image) + { + return invokeObjcSelfClass!(NSColor, "colorWithPatternImage:", NSImage)(image); + } + + NSImage patternImage () + { + return invokeObjcSelf!(NSImage, "patternImage"); + } + + void drawSwatchInRect (NSRect rect) + { + return invokeObjcSelf!(void, "drawSwatchInRect:", NSRect)(rect); + } + + static void setIgnoresAlpha (bool flag) + { + return invokeObjcSelfClass!(void, "setIgnoresAlpha:", bool)(flag); + } + + static bool ignoresAlpha () + { + return invokeObjcSelfClass!(bool, "ignoresAlpha"); + } + +} + +const TNSAppKitColorExtensions = ` + + NSColor decodeNXColor () + { + return invokeObjcSelf!(NSColor, "decodeNXColor"); + } + + //mixin ObjcBindMethod!(decodeNXColor, "decodeNXColor"); + +`; + +const TNSAppKitAdditions = ` + + NSAppKitAdditions initWithColor (NSColor color) + { + id result = invokeObjcSelf!(id, "initWithColor:", NSColor)(color); + return result is this.objcObject ? this : (result !is null ? new NSAppKitAdditions(result) : null); + } + + this (NSColor color) + { + super(NSAppKitAdditions.alloc.initWithColor(color).objcObject); + } + + //mixin ObjcBindMethod!(initWithColor, "initWithColor:"); + +`; + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSColorList.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSColorList.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,134 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSColorList; + +import dstep.appkit.AppKitDefines; +import dstep.foundation.NSArray; +import dstep.appkit.NSColor; +import dstep.corefoundation.CFDictionary; +import dstep.foundation.NSArray; +import dstep.foundation.NSBundle; +import dstep.foundation.NSCoder; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.appkit.NSColorList_bindings; + +private +{ + NSString NSColorListDidChangeNotification_; +} + +NSString NSColorListDidChangeNotification () +{ + if (NSColorListDidChangeNotification_) + return NSColorListDidChangeNotification_; + + return NSColorListDidChangeNotification_ = new NSString(bindings.NSColorListDidChangeNotification); +} + +class NSColorList : NSObject, INSCoding +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + static NSArray availableColorLists () + { + return invokeObjcSelfClass!(NSArray, "availableColorLists"); + } + + static NSColorList colorListNamed (NSString name) + { + return invokeObjcSelfClass!(NSColorList, "colorListNamed:", NSString)(name); + } + + NSColorList initWithName (NSString name) + { + id result = invokeObjcSelf!(id, "initWithName:", NSString)(name); + return result is this.objcObject ? this : (result !is null ? new NSColorList(result) : null); + } + + this (NSString name) + { + super(NSColorList.alloc.initWithName(name).objcObject); + } + + NSColorList initWithName (NSString name, NSString path) + { + id result = invokeObjcSelf!(id, "initWithName:fromFile:", NSString, NSString)(name, path); + return result is this.objcObject ? this : (result !is null ? new NSColorList(result) : null); + } + + this (NSString name, NSString path) + { + super(NSColorList.alloc.initWithName(name, path).objcObject); + } + + NSString name () + { + return invokeObjcSelf!(NSString, "name"); + } + + void setColor (NSColor color, NSString key) + { + return invokeObjcSelf!(void, "setColor:forKey:", NSColor, NSString)(color, key); + } + + void insertColor (NSColor color, NSString key, NSUInteger loc) + { + return invokeObjcSelf!(void, "insertColor:key:atIndex:", NSColor, NSString, NSUInteger)(color, key, loc); + } + + void removeColorWithKey (NSString key) + { + return invokeObjcSelf!(void, "removeColorWithKey:", NSString)(key); + } + + NSColor colorWithKey (NSString key) + { + return invokeObjcSelf!(NSColor, "colorWithKey:", NSString)(key); + } + + NSArray allKeys () + { + return invokeObjcSelf!(NSArray, "allKeys"); + } + + bool isEditable () + { + return invokeObjcSelf!(bool, "isEditable"); + } + + bool writeToFile (NSString path) + { + return invokeObjcSelf!(bool, "writeToFile:", NSString)(path); + } + + void removeFile () + { + return invokeObjcSelf!(void, "removeFile"); + } + +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSColorList_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSColorList_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,17 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSColorList_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package id NSColorListDidChangeNotification; + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSColorPanel.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSColorPanel.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,191 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSColorPanel; + +import dstep.appkit.NSApplication; +import dstep.appkit.NSColor; +import dstep.appkit.NSColorList; +import dstep.appkit.NSEvent; +import dstep.appkit.NSPanel; +import dstep.appkit.NSView; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSArray; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.appkit.NSColorPanel_bindings; + +alias NSInteger NSColorPanelMode; + +private +{ + NSString NSColorPanelColorDidChangeNotification_; +} + +NSString NSColorPanelColorDidChangeNotification () +{ + if (NSColorPanelColorDidChangeNotification_) + return NSColorPanelColorDidChangeNotification_; + + return NSColorPanelColorDidChangeNotification_ = new NSString(bindings.NSColorPanelColorDidChangeNotification); +} + +enum +{ + NSNoModeColorPanel = -1, + NSGrayModeColorPanel = 0, + NSRGBModeColorPanel = 1, + NSCMYKModeColorPanel = 2, + NSHSBModeColorPanel = 3, + NSCustomPaletteModeColorPanel = 4, + NSColorListModeColorPanel = 5, + NSWheelModeColorPanel = 6, + NSCrayonModeColorPanel = 7 +} + +enum +{ + NSColorPanelGrayModeMask = 0x00000001, + NSColorPanelRGBModeMask = 0x00000002, + NSColorPanelCMYKModeMask = 0x00000004, + NSColorPanelHSBModeMask = 0x00000008, + NSColorPanelCustomPaletteModeMask = 0x00000010, + NSColorPanelColorListModeMask = 0x00000020, + NSColorPanelWheelModeMask = 0x00000040, + NSColorPanelCrayonModeMask = 0x00000080, + NSColorPanelAllModesMask = 0x0000ffff +} + +class NSColorPanel : NSPanel +{ + mixin (ObjcWrap); + + static NSColorPanel sharedColorPanel () + { + return invokeObjcSelfClass!(NSColorPanel, "sharedColorPanel"); + } + + static bool sharedColorPanelExists () + { + return invokeObjcSelfClass!(bool, "sharedColorPanelExists"); + } + + static bool dragColor (NSColor color, NSEvent theEvent, NSView sourceView) + { + return invokeObjcSelfClass!(bool, "dragColor:withEvent:fromView:", NSColor, NSEvent, NSView)(color, theEvent, sourceView); + } + + static void setPickerMask (NSUInteger mask) + { + return invokeObjcSelfClass!(void, "setPickerMask:", NSUInteger)(mask); + } + + static void setPickerMode (int mode) + { + return invokeObjcSelfClass!(void, "setPickerMode:", int)(mode); + } + + void setAccessoryView (NSView aView) + { + return invokeObjcSelf!(void, "setAccessoryView:", NSView)(aView); + } + + NSView accessoryView () + { + return invokeObjcSelf!(NSView, "accessoryView"); + } + + void setContinuous (bool flag) + { + return invokeObjcSelf!(void, "setContinuous:", bool)(flag); + } + + bool isContinuous () + { + return invokeObjcSelf!(bool, "isContinuous"); + } + + void setShowsAlpha (bool flag) + { + return invokeObjcSelf!(void, "setShowsAlpha:", bool)(flag); + } + + bool showsAlpha () + { + return invokeObjcSelf!(bool, "showsAlpha"); + } + + void setMode (int mode) + { + return invokeObjcSelf!(void, "setMode:", int)(mode); + } + + int mode () + { + return invokeObjcSelf!(int, "mode"); + } + + void setColor (NSColor color) + { + return invokeObjcSelf!(void, "setColor:", NSColor)(color); + } + + NSColor color () + { + return invokeObjcSelf!(NSColor, "color"); + } + + CGFloat alpha () + { + return invokeObjcSelf!(CGFloat, "alpha"); + } + + void setAction (SEL aSelector) + { + return invokeObjcSelf!(void, "setAction:", SEL)(aSelector); + } + + void setTarget (Object anObject) + { + return invokeObjcSelf!(void, "setTarget:", Object)(anObject); + } + + void attachColorList (NSColorList colorList) + { + return invokeObjcSelf!(void, "attachColorList:", NSColorList)(colorList); + } + + void detachColorList (NSColorList colorList) + { + return invokeObjcSelf!(void, "detachColorList:", NSColorList)(colorList); + } +} + +const TNSColorPanelResponderMethod = ` + + void changeColor (Object sender) + { + return invokeObjcSelf!(void, "changeColor:", Object)(sender); + } + + //mixin ObjcBindMethod!(changeColor, "changeColor:"); + +`; + +const TNSColorPanel = ` + + void orderFrontColorPanel (Object sender) + { + return invokeObjcSelf!(void, "orderFrontColorPanel:", Object)(sender); + } + + //mixin ObjcBindMethod!(orderFrontColorPanel, "orderFrontColorPanel:"); + +`; + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSColorPanel_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSColorPanel_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,18 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSColorPanel_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package id NSColorPanelColorDidChangeNotification; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSColorPicker.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSColorPicker.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,106 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSColorPicker; + +import dstep.appkit.NSButtonCell; +import dstep.appkit.NSColorList; +import dstep.appkit.NSColorPanel; +import dstep.appkit.NSColorPicking; +import dstep.appkit.NSImage; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSColorPicker : NSObject, INSColorPickingDefault +{ + mixin (ObjcWrap); + + NSColorPicker initWithPickerMask (NSUInteger mask, NSColorPanel owningColorPanel) + { + id result = invokeObjcSelf!(id, "initWithPickerMask:colorPanel:", NSUInteger, NSColorPanel)(mask, owningColorPanel); + return result is this.objcObject ? this : (result !is null ? new NSColorPicker(result) : null); + } + + this (NSUInteger mask, NSColorPanel owningColorPanel) + { + super(NSColorPicker.alloc.initWithPickerMask(mask, owningColorPanel).objcObject); + } + + NSColorPanel colorPanel () + { + return invokeObjcSelf!(NSColorPanel, "colorPanel"); + } + + NSImage provideNewButtonImage () + { + return invokeObjcSelf!(NSImage, "provideNewButtonImage"); + } + + void insertNewButtonImage (NSImage newButtonImage, NSButtonCell buttonCell) + { + return invokeObjcSelf!(void, "insertNewButtonImage:in:", NSImage, NSButtonCell)(newButtonImage, buttonCell); + } + + void viewSizeChanged (Object sender) + { + return invokeObjcSelf!(void, "viewSizeChanged:", Object)(sender); + } + + void attachColorList (NSColorList colorList) + { + return invokeObjcSelf!(void, "attachColorList:", NSColorList)(colorList); + } + + void detachColorList (NSColorList colorList) + { + return invokeObjcSelf!(void, "detachColorList:", NSColorList)(colorList); + } + + void setMode (int mode) + { + return invokeObjcSelf!(void, "setMode:", int)(mode); + } + + NSString buttonToolTip () + { + return invokeObjcSelf!(NSString, "buttonToolTip"); + } + + NSSize minContentSize () + { + return invokeObjcSelf!(NSSize, "minContentSize"); + } + + void insertNewButtonImage (NSImage newButtonImage, NSButtonCell buttonCell) + { + return invokeObjcSelf!(void, "insertNewButtonImage:in:", NSImage, NSButtonCell)(newButtonImage, buttonCell); + } + + void viewSizeChanged (Object sender) + { + return invokeObjcSelf!(void, "viewSizeChanged:", Object)(sender); + } + + void alphaControlAddedOrRemoved (Object sender) + { + return invokeObjcSelf!(void, "alphaControlAddedOrRemoved:", Object)(sender); + } + + void attachColorList (NSColorList colorList) + { + return invokeObjcSelf!(void, "attachColorList:", NSColorList)(colorList); + } + + void detachColorList (NSColorList colorList) + { + return invokeObjcSelf!(void, "detachColorList:", NSColorList)(colorList); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSColorPicking.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSColorPicking.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,43 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSColorPicking; + +import dstep.appkit.NSButtonCell; +import dstep.appkit.NSColor; +import dstep.appkit.NSColorList; +import dstep.appkit.NSColorPanel; +import dstep.appkit.NSImage; +import dstep.appkit.NSView; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +interface INSColorPickingCustom : INSColorPickingDefault +{ + bool supportsMode (int mode); + int currentMode (); + NSView provideNewView (bool initialRequest); + void setColor (NSColor newColor); +} + +interface INSColorPickingDefault +{ + Object initWithPickerMask (NSUInteger mask, NSColorPanel owningColorPanel); + NSImage provideNewButtonImage (); + void insertNewButtonImage (NSImage newButtonImage, NSButtonCell buttonCell); + void viewSizeChanged (Object sender); + void alphaControlAddedOrRemoved (Object sender); + void attachColorList (NSColorList colorList); + void detachColorList (NSColorList colorList); + void setMode (int mode); + NSString buttonToolTip (); + NSSize minContentSize (); +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSColorSpace.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSColorSpace.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,156 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSColorSpace; + +import dstep.appkit.AppKitDefines; +import dstep.applicationservices.ApplicationServices; +import dstep.foundation.NSCoder; +import dstep.foundation.NSData; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +alias NSInteger NSColorSpaceModel; + +enum +{ + NSUnknownColorSpaceModel = -1, + NSGrayColorSpaceModel, + NSRGBColorSpaceModel, + NSCMYKColorSpaceModel, + NSLABColorSpaceModel, + NSDeviceNColorSpaceModel, + NSIndexedColorSpaceModel, + NSPatternColorSpaceModel +} + +class NSColorSpace : NSObject, INSCoding +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + NSColorSpace initWithICCProfileData (NSData iccData) + { + id result = invokeObjcSelf!(id, "initWithICCProfileData:", NSData)(iccData); + return result is this.objcObject ? this : (result !is null ? new NSColorSpace(result) : null); + } + + this (NSData iccData) + { + super(NSColorSpace.alloc.initWithICCProfileData(iccData).objcObject); + } + + NSData ICCProfileData () + { + return invokeObjcSelf!(NSData, "ICCProfileData"); + } + + NSColorSpace initWithColorSyncProfile (void* prof) + { + id result = invokeObjcSelf!(id, "initWithColorSyncProfile:", void*)(prof); + return result is this.objcObject ? this : (result !is null ? new NSColorSpace(result) : null); + } + + this (void* prof) + { + super(NSColorSpace.alloc.initWithColorSyncProfile(prof).objcObject); + } + + void* colorSyncProfile () + { + return invokeObjcSelf!(void*, "colorSyncProfile"); + } + + NSColorSpace initWithCGColorSpace (CGColorSpaceRef cgColorSpace) + { + id result = invokeObjcSelf!(id, "initWithCGColorSpace:", CGColorSpaceRef)(cgColorSpace); + return result is this.objcObject ? this : (result !is null ? new NSColorSpace(result) : null); + } + + this (CGColorSpaceRef cgColorSpace) + { + super(NSColorSpace.alloc.initWithCGColorSpace(cgColorSpace).objcObject); + } + + CGColorSpaceRef CGColorSpace () + { + return invokeObjcSelf!(CGColorSpaceRef, "CGColorSpace"); + } + + NSInteger numberOfColorComponents () + { + return invokeObjcSelf!(NSInteger, "numberOfColorComponents"); + } + + int colorSpaceModel () + { + return invokeObjcSelf!(int, "colorSpaceModel"); + } + + NSString localizedName () + { + return invokeObjcSelf!(NSString, "localizedName"); + } + + static NSColorSpace genericRGBColorSpace () + { + return invokeObjcSelfClass!(NSColorSpace, "genericRGBColorSpace"); + } + + static NSColorSpace genericGrayColorSpace () + { + return invokeObjcSelfClass!(NSColorSpace, "genericGrayColorSpace"); + } + + static NSColorSpace genericCMYKColorSpace () + { + return invokeObjcSelfClass!(NSColorSpace, "genericCMYKColorSpace"); + } + + static NSColorSpace deviceRGBColorSpace () + { + return invokeObjcSelfClass!(NSColorSpace, "deviceRGBColorSpace"); + } + + static NSColorSpace deviceGrayColorSpace () + { + return invokeObjcSelfClass!(NSColorSpace, "deviceGrayColorSpace"); + } + + static NSColorSpace deviceCMYKColorSpace () + { + return invokeObjcSelfClass!(NSColorSpace, "deviceCMYKColorSpace"); + } + + static NSColorSpace sRGBColorSpace () + { + return invokeObjcSelfClass!(NSColorSpace, "sRGBColorSpace"); + } + + static NSColorSpace adobeRGB1998ColorSpace () + { + return invokeObjcSelfClass!(NSColorSpace, "adobeRGB1998ColorSpace"); + } + +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSColorWell.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSColorWell.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,64 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSColorWell; + +import dstep.appkit.NSControl; +import dstep.appkit.NSColor; +import dstep.foundation.NSGeometry; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSColorWell : NSControl +{ + mixin (ObjcWrap); + + void deactivate () + { + return invokeObjcSelf!(void, "deactivate"); + } + + void activate (bool exclusive) + { + return invokeObjcSelf!(void, "activate:", bool)(exclusive); + } + + bool isActive () + { + return invokeObjcSelf!(bool, "isActive"); + } + + void drawWellInside (NSRect insideRect) + { + return invokeObjcSelf!(void, "drawWellInside:", NSRect)(insideRect); + } + + bool isBordered () + { + return invokeObjcSelf!(bool, "isBordered"); + } + + void setBordered (bool flag) + { + return invokeObjcSelf!(void, "setBordered:", bool)(flag); + } + + void takeColorFrom (Object sender) + { + return invokeObjcSelf!(void, "takeColorFrom:", Object)(sender); + } + + void setColor (NSColor color) + { + return invokeObjcSelf!(void, "setColor:", NSColor)(color); + } + + NSColor color () + { + return invokeObjcSelf!(NSColor, "color"); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSColor_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSColor_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,18 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSColor_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package id NSSystemColorsDidChangeNotification; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSComboBox.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSComboBox.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,297 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSComboBox; + +import dstep.appkit.NSTextField; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSArray; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.appkit.NSComboBox_bindings; + +private +{ + NSString NSComboBoxWillPopUpNotification_; + NSString NSComboBoxWillDismissNotification_; + NSString NSComboBoxSelectionDidChangeNotification_; + NSString NSComboBoxSelectionIsChangingNotification_; +} + +NSString NSComboBoxWillPopUpNotification () +{ + if (NSComboBoxWillPopUpNotification_) + return NSComboBoxWillPopUpNotification_; + + return NSComboBoxWillPopUpNotification_ = new NSString(bindings.NSComboBoxWillPopUpNotification); +} + +NSString NSComboBoxWillDismissNotification () +{ + if (NSComboBoxWillDismissNotification_) + return NSComboBoxWillDismissNotification_; + + return NSComboBoxWillDismissNotification_ = new NSString(bindings.NSComboBoxWillDismissNotification); +} + +NSString NSComboBoxSelectionDidChangeNotification () +{ + if (NSComboBoxSelectionDidChangeNotification_) + return NSComboBoxSelectionDidChangeNotification_; + + return NSComboBoxSelectionDidChangeNotification_ = new NSString(bindings.NSComboBoxSelectionDidChangeNotification); +} + +NSString NSComboBoxSelectionIsChangingNotification () +{ + if (NSComboBoxSelectionIsChangingNotification_) + return NSComboBoxSelectionIsChangingNotification_; + + return NSComboBoxSelectionIsChangingNotification_ = new NSString(bindings.NSComboBoxSelectionIsChangingNotification); +} + +class NSComboBox : NSTextField +{ + mixin (ObjcWrap); + + bool hasVerticalScroller () + { + return invokeObjcSelf!(bool, "hasVerticalScroller"); + } + + void setHasVerticalScroller (bool flag) + { + return invokeObjcSelf!(void, "setHasVerticalScroller:", bool)(flag); + } + + NSSize intercellSpacing () + { + return invokeObjcSelf!(NSSize, "intercellSpacing"); + } + + void setIntercellSpacing (NSSize aSize) + { + return invokeObjcSelf!(void, "setIntercellSpacing:", NSSize)(aSize); + } + + CGFloat itemHeight () + { + return invokeObjcSelf!(CGFloat, "itemHeight"); + } + + void setItemHeight (CGFloat itemHeight) + { + return invokeObjcSelf!(void, "setItemHeight:", CGFloat)(itemHeight); + } + + NSInteger numberOfVisibleItems () + { + return invokeObjcSelf!(NSInteger, "numberOfVisibleItems"); + } + + void setNumberOfVisibleItems (NSInteger visibleItems) + { + return invokeObjcSelf!(void, "setNumberOfVisibleItems:", NSInteger)(visibleItems); + } + + void setButtonBordered (bool flag) + { + return invokeObjcSelf!(void, "setButtonBordered:", bool)(flag); + } + + bool isButtonBordered () + { + return invokeObjcSelf!(bool, "isButtonBordered"); + } + + void reloadData () + { + return invokeObjcSelf!(void, "reloadData"); + } + + void noteNumberOfItemsChanged () + { + return invokeObjcSelf!(void, "noteNumberOfItemsChanged"); + } + + void setUsesDataSource (bool flag) + { + return invokeObjcSelf!(void, "setUsesDataSource:", bool)(flag); + } + + bool usesDataSource () + { + return invokeObjcSelf!(bool, "usesDataSource"); + } + + void scrollItemAtIndexToTop (NSInteger index) + { + return invokeObjcSelf!(void, "scrollItemAtIndexToTop:", NSInteger)(index); + } + + void scrollItemAtIndexToVisible (NSInteger index) + { + return invokeObjcSelf!(void, "scrollItemAtIndexToVisible:", NSInteger)(index); + } + + void selectItemAtIndex (NSInteger index) + { + return invokeObjcSelf!(void, "selectItemAtIndex:", NSInteger)(index); + } + + void deselectItemAtIndex (NSInteger index) + { + return invokeObjcSelf!(void, "deselectItemAtIndex:", NSInteger)(index); + } + + NSInteger indexOfSelectedItem () + { + return invokeObjcSelf!(NSInteger, "indexOfSelectedItem"); + } + + NSInteger numberOfItems () + { + return invokeObjcSelf!(NSInteger, "numberOfItems"); + } + + bool completes () + { + return invokeObjcSelf!(bool, "completes"); + } + + void setCompletes (bool completes) + { + return invokeObjcSelf!(void, "setCompletes:", bool)(completes); + } + + Object dataSource () + { + return invokeObjcSelf!(Object, "dataSource"); + } + + void setDataSource (Object aSource) + { + return invokeObjcSelf!(void, "setDataSource:", Object)(aSource); + } + + void addItemWithObjectValue (Object object) + { + return invokeObjcSelf!(void, "addItemWithObjectValue:", Object)(object); + } + + void addItemsWithObjectValues (NSArray objects) + { + return invokeObjcSelf!(void, "addItemsWithObjectValues:", NSArray)(objects); + } + + void insertItemWithObjectValue (Object object, NSInteger index) + { + return invokeObjcSelf!(void, "insertItemWithObjectValue:atIndex:", Object, NSInteger)(object, index); + } + + void removeItemWithObjectValue (Object object) + { + return invokeObjcSelf!(void, "removeItemWithObjectValue:", Object)(object); + } + + void removeItemAtIndex (NSInteger index) + { + return invokeObjcSelf!(void, "removeItemAtIndex:", NSInteger)(index); + } + + void removeAllItems () + { + return invokeObjcSelf!(void, "removeAllItems"); + } + + void selectItemWithObjectValue (Object object) + { + return invokeObjcSelf!(void, "selectItemWithObjectValue:", Object)(object); + } + + Object itemObjectValueAtIndex (NSInteger index) + { + return invokeObjcSelf!(Object, "itemObjectValueAtIndex:", NSInteger)(index); + } + + Object objectValueOfSelectedItem () + { + return invokeObjcSelf!(Object, "objectValueOfSelectedItem"); + } + + NSInteger indexOfItemWithObjectValue (Object object) + { + return invokeObjcSelf!(NSInteger, "indexOfItemWithObjectValue:", Object)(object); + } + + NSArray objectValues () + { + return invokeObjcSelf!(NSArray, "objectValues"); + } +} + +const TNSComboBoxDataSource = ` + + NSInteger numberOfItemsInComboBox (NSComboBox aComboBox) + { + return invokeObjcSelf!(NSInteger, "numberOfItemsInComboBox:", NSComboBox)(aComboBox); + } + + Object comboBox (NSComboBox aComboBox, NSInteger index) + { + return invokeObjcSelf!(Object, "comboBox:objectValueForItemAtIndex:", NSComboBox, NSInteger)(aComboBox, index); + } + + NSUInteger comboBox (NSComboBox aComboBox, NSString string) + { + return invokeObjcSelf!(NSUInteger, "comboBox:indexOfItemWithStringValue:", NSComboBox, NSString)(aComboBox, string); + } + + NSString comboBox (NSComboBox aComboBox, NSString string) + { + return invokeObjcSelf!(NSString, "comboBox:completedString:", NSComboBox, NSString)(aComboBox, string); + } + + //mixin ObjcBindMethod!(numberOfItemsInComboBox, "numberOfItemsInComboBox:"); + //mixin ObjcBindMethod!(comboBox, "comboBox:objectValueForItemAtIndex:"); + //mixin ObjcBindMethod!(comboBox, "comboBox:indexOfItemWithStringValue:"); + //mixin ObjcBindMethod!(comboBox, "comboBox:completedString:"); + +`; + +const TNSComboBoxNotifications = ` + + void comboBoxWillPopUp (NSNotification notification) + { + return invokeObjcSelf!(void, "comboBoxWillPopUp:", NSNotification)(notification); + } + + void comboBoxWillDismiss (NSNotification notification) + { + return invokeObjcSelf!(void, "comboBoxWillDismiss:", NSNotification)(notification); + } + + void comboBoxSelectionDidChange (NSNotification notification) + { + return invokeObjcSelf!(void, "comboBoxSelectionDidChange:", NSNotification)(notification); + } + + void comboBoxSelectionIsChanging (NSNotification notification) + { + return invokeObjcSelf!(void, "comboBoxSelectionIsChanging:", NSNotification)(notification); + } + + //mixin ObjcBindMethod!(comboBoxWillPopUp, "comboBoxWillPopUp:"); + //mixin ObjcBindMethod!(comboBoxWillDismiss, "comboBoxWillDismiss:"); + //mixin ObjcBindMethod!(comboBoxSelectionDidChange, "comboBoxSelectionDidChange:"); + //mixin ObjcBindMethod!(comboBoxSelectionIsChanging, "comboBoxSelectionIsChanging:"); + +`; + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSComboBoxCell.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSComboBoxCell.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,233 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSComboBoxCell; + +import dstep.appkit.NSButtonCell; +import dstep.appkit.NSTableView; +import dstep.appkit.NSTextFieldCell; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSArray; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSComboBoxCell : NSTextFieldCell +{ + mixin (ObjcWrap); + + bool hasVerticalScroller () + { + return invokeObjcSelf!(bool, "hasVerticalScroller"); + } + + void setHasVerticalScroller (bool flag) + { + return invokeObjcSelf!(void, "setHasVerticalScroller:", bool)(flag); + } + + NSSize intercellSpacing () + { + return invokeObjcSelf!(NSSize, "intercellSpacing"); + } + + void setIntercellSpacing (NSSize aSize) + { + return invokeObjcSelf!(void, "setIntercellSpacing:", NSSize)(aSize); + } + + CGFloat itemHeight () + { + return invokeObjcSelf!(CGFloat, "itemHeight"); + } + + void setItemHeight (CGFloat itemHeight) + { + return invokeObjcSelf!(void, "setItemHeight:", CGFloat)(itemHeight); + } + + NSInteger numberOfVisibleItems () + { + return invokeObjcSelf!(NSInteger, "numberOfVisibleItems"); + } + + void setNumberOfVisibleItems (NSInteger visibleItems) + { + return invokeObjcSelf!(void, "setNumberOfVisibleItems:", NSInteger)(visibleItems); + } + + void setButtonBordered (bool flag) + { + return invokeObjcSelf!(void, "setButtonBordered:", bool)(flag); + } + + bool isButtonBordered () + { + return invokeObjcSelf!(bool, "isButtonBordered"); + } + + void reloadData () + { + return invokeObjcSelf!(void, "reloadData"); + } + + void noteNumberOfItemsChanged () + { + return invokeObjcSelf!(void, "noteNumberOfItemsChanged"); + } + + void setUsesDataSource (bool flag) + { + return invokeObjcSelf!(void, "setUsesDataSource:", bool)(flag); + } + + bool usesDataSource () + { + return invokeObjcSelf!(bool, "usesDataSource"); + } + + void scrollItemAtIndexToTop (NSInteger index) + { + return invokeObjcSelf!(void, "scrollItemAtIndexToTop:", NSInteger)(index); + } + + void scrollItemAtIndexToVisible (NSInteger index) + { + return invokeObjcSelf!(void, "scrollItemAtIndexToVisible:", NSInteger)(index); + } + + void selectItemAtIndex (NSInteger index) + { + return invokeObjcSelf!(void, "selectItemAtIndex:", NSInteger)(index); + } + + void deselectItemAtIndex (NSInteger index) + { + return invokeObjcSelf!(void, "deselectItemAtIndex:", NSInteger)(index); + } + + NSInteger indexOfSelectedItem () + { + return invokeObjcSelf!(NSInteger, "indexOfSelectedItem"); + } + + NSInteger numberOfItems () + { + return invokeObjcSelf!(NSInteger, "numberOfItems"); + } + + bool completes () + { + return invokeObjcSelf!(bool, "completes"); + } + + void setCompletes (bool completes) + { + return invokeObjcSelf!(void, "setCompletes:", bool)(completes); + } + + NSString completedString (NSString string) + { + return invokeObjcSelf!(NSString, "completedString:", NSString)(string); + } + + Object dataSource () + { + return invokeObjcSelf!(Object, "dataSource"); + } + + void setDataSource (Object aSource) + { + return invokeObjcSelf!(void, "setDataSource:", Object)(aSource); + } + + void addItemWithObjectValue (Object object) + { + return invokeObjcSelf!(void, "addItemWithObjectValue:", Object)(object); + } + + void addItemsWithObjectValues (NSArray objects) + { + return invokeObjcSelf!(void, "addItemsWithObjectValues:", NSArray)(objects); + } + + void insertItemWithObjectValue (Object object, NSInteger index) + { + return invokeObjcSelf!(void, "insertItemWithObjectValue:atIndex:", Object, NSInteger)(object, index); + } + + void removeItemWithObjectValue (Object object) + { + return invokeObjcSelf!(void, "removeItemWithObjectValue:", Object)(object); + } + + void removeItemAtIndex (NSInteger index) + { + return invokeObjcSelf!(void, "removeItemAtIndex:", NSInteger)(index); + } + + void removeAllItems () + { + return invokeObjcSelf!(void, "removeAllItems"); + } + + void selectItemWithObjectValue (Object object) + { + return invokeObjcSelf!(void, "selectItemWithObjectValue:", Object)(object); + } + + Object itemObjectValueAtIndex (NSInteger index) + { + return invokeObjcSelf!(Object, "itemObjectValueAtIndex:", NSInteger)(index); + } + + Object objectValueOfSelectedItem () + { + return invokeObjcSelf!(Object, "objectValueOfSelectedItem"); + } + + NSInteger indexOfItemWithObjectValue (Object object) + { + return invokeObjcSelf!(NSInteger, "indexOfItemWithObjectValue:", Object)(object); + } + + NSArray objectValues () + { + return invokeObjcSelf!(NSArray, "objectValues"); + } +} + +const TNSComboBoxCellDataSource = ` + + NSInteger numberOfItemsInComboBoxCell (NSComboBoxCell comboBoxCell) + { + return invokeObjcSelf!(NSInteger, "numberOfItemsInComboBoxCell:", NSComboBoxCell)(comboBoxCell); + } + + Object comboBoxCell (NSComboBoxCell aComboBoxCell, NSInteger index) + { + return invokeObjcSelf!(Object, "comboBoxCell:objectValueForItemAtIndex:", NSComboBoxCell, NSInteger)(aComboBoxCell, index); + } + + NSUInteger comboBoxCell (NSComboBoxCell aComboBoxCell, NSString string) + { + return invokeObjcSelf!(NSUInteger, "comboBoxCell:indexOfItemWithStringValue:", NSComboBoxCell, NSString)(aComboBoxCell, string); + } + + NSString comboBoxCell (NSComboBoxCell aComboBoxCell, NSString uncompletedString) + { + return invokeObjcSelf!(NSString, "comboBoxCell:completedString:", NSComboBoxCell, NSString)(aComboBoxCell, uncompletedString); + } + + //mixin ObjcBindMethod!(numberOfItemsInComboBoxCell, "numberOfItemsInComboBoxCell:"); + //mixin ObjcBindMethod!(comboBoxCell, "comboBoxCell:objectValueForItemAtIndex:"); + //mixin ObjcBindMethod!(comboBoxCell, "comboBoxCell:indexOfItemWithStringValue:"); + //mixin ObjcBindMethod!(comboBoxCell, "comboBoxCell:completedString:"); + +`; + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSComboBox_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSComboBox_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,21 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSComboBox_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package id NSComboBoxWillPopUpNotification; + package id NSComboBoxWillDismissNotification; + package id NSComboBoxSelectionDidChangeNotification; + package id NSComboBoxSelectionIsChangingNotification; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSControl.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSControl.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,465 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSControl; + +import dstep.appkit.NSCell; +import dstep.appkit.NSEvent; +import dstep.appkit.NSFont; +import dstep.appkit.NSText; +import dstep.appkit.NSTextView; +import dstep.appkit.NSView; +import dstep.foundation.NSAttributedString; +import dstep.foundation.NSFormatter; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSNotification; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.appkit.NSControl_bindings; + +private +{ + NSString NSControlTextDidBeginEditingNotification_; + NSString NSControlTextDidEndEditingNotification_; + NSString NSControlTextDidChangeNotification_; +} + +NSString NSControlTextDidBeginEditingNotification () +{ + if (NSControlTextDidBeginEditingNotification_) + return NSControlTextDidBeginEditingNotification_; + + return NSControlTextDidBeginEditingNotification_ = new NSString(bindings.NSControlTextDidBeginEditingNotification); +} + +NSString NSControlTextDidEndEditingNotification () +{ + if (NSControlTextDidEndEditingNotification_) + return NSControlTextDidEndEditingNotification_; + + return NSControlTextDidEndEditingNotification_ = new NSString(bindings.NSControlTextDidEndEditingNotification); +} + +NSString NSControlTextDidChangeNotification () +{ + if (NSControlTextDidChangeNotification_) + return NSControlTextDidChangeNotification_; + + return NSControlTextDidChangeNotification_ = new NSString(bindings.NSControlTextDidChangeNotification); +} + +const TNSControlSubclassNotifications = ` + + void controlTextDidBeginEditing (NSNotification obj) + { + return invokeObjcSelf!(void, "controlTextDidBeginEditing:", NSNotification)(obj); + } + + void controlTextDidEndEditing (NSNotification obj) + { + return invokeObjcSelf!(void, "controlTextDidEndEditing:", NSNotification)(obj); + } + + void controlTextDidChange (NSNotification obj) + { + return invokeObjcSelf!(void, "controlTextDidChange:", NSNotification)(obj); + } + + //mixin ObjcBindMethod!(controlTextDidBeginEditing, "controlTextDidBeginEditing:"); + //mixin ObjcBindMethod!(controlTextDidEndEditing, "controlTextDidEndEditing:"); + //mixin ObjcBindMethod!(controlTextDidChange, "controlTextDidChange:"); + +`; + +const TNSControlAttributedStringMethods = ` + + NSAttributedString attributedStringValue () + { + return invokeObjcSelf!(NSAttributedString, "attributedStringValue"); + } + + void setAttributedStringValue (NSAttributedString obj) + { + return invokeObjcSelf!(void, "setAttributedStringValue:", NSAttributedString)(obj); + } + + //mixin ObjcBindMethod!(attributedStringValue, "attributedStringValue"); + //mixin ObjcBindMethod!(setAttributedStringValue, "setAttributedStringValue:"); + +`; + +const TNSControlSubclassDelegate = ` + + bool control (NSControl control, NSText fieldEditor) + { + return invokeObjcSelf!(bool, "control:textShouldBeginEditing:", NSControl, NSText)(control, fieldEditor); + } + + bool control (NSControl control, NSText fieldEditor) + { + return invokeObjcSelf!(bool, "control:textShouldEndEditing:", NSControl, NSText)(control, fieldEditor); + } + + bool control (NSControl control, NSString string, NSString error) + { + return invokeObjcSelf!(bool, "control:didFailToFormatString:errorDescription:", NSControl, NSString, NSString)(control, string, error); + } + + void control (NSControl control, NSString string, NSString error) + { + return invokeObjcSelf!(void, "control:didFailToValidatePartialString:errorDescription:", NSControl, NSString, NSString)(control, string, error); + } + + bool control (NSControl control, Object obj) + { + return invokeObjcSelf!(bool, "control:isValidObject:", NSControl, Object)(control, obj); + } + + bool control (NSControl control, NSTextView textView, SEL commandSelector) + { + return invokeObjcSelf!(bool, "control:textView:doCommandBySelector:", NSControl, NSTextView, SEL)(control, textView, commandSelector); + } + + NSArray control (NSControl control, NSTextView textView, NSArray words, NSRange charRange, NSInteger* index) + { + return invokeObjcSelf!(NSArray, "control:textView:completions:forPartialWordRange:indexOfSelectedItem:", NSControl, NSTextView, NSArray, NSRange, NSInteger*)(control, textView, words, charRange, index); + } + + //mixin ObjcBindMethod!(control, "control:textShouldBeginEditing:"); + //mixin ObjcBindMethod!(control, "control:textShouldEndEditing:"); + //mixin ObjcBindMethod!(control, "control:didFailToFormatString:errorDescription:"); + //mixin ObjcBindMethod!(control, "control:didFailToValidatePartialString:errorDescription:"); + //mixin ObjcBindMethod!(control, "control:isValidObject:"); + //mixin ObjcBindMethod!(control, "control:textView:doCommandBySelector:"); + //mixin ObjcBindMethod!(control, "control:textView:completions:forPartialWordRange:indexOfSelectedItem:"); + +`; + +class NSControl : NSView +{ + mixin (ObjcWrap); + + static void setCellClass (Class factoryId) + { + return invokeObjcSelfClass!(void, "setCellClass:", Class)(factoryId); + } + + static Class cellClass () + { + return invokeObjcSelfClass!(Class, "cellClass"); + } + + NSControl initWithFrame (NSRect frameRect) + { + id result = invokeObjcSelf!(id, "initWithFrame:", NSRect)(frameRect); + return result is this.objcObject ? this : (result !is null ? new NSControl(result) : null); + } + + this (NSRect frameRect) + { + super(NSControl.alloc.initWithFrame(frameRect).objcObject); + } + + void sizeToFit () + { + return invokeObjcSelf!(void, "sizeToFit"); + } + + void calcSize () + { + return invokeObjcSelf!(void, "calcSize"); + } + + Object cell () + { + return invokeObjcSelf!(Object, "cell"); + } + + void setCell (NSCell aCell) + { + return invokeObjcSelf!(void, "setCell:", NSCell)(aCell); + } + + Object selectedCell () + { + return invokeObjcSelf!(Object, "selectedCell"); + } + + Object target () + { + return invokeObjcSelf!(Object, "target"); + } + + void setTarget (Object anObject) + { + return invokeObjcSelf!(void, "setTarget:", Object)(anObject); + } + + SEL action () + { + return invokeObjcSelf!(SEL, "action"); + } + + void setAction (SEL aSelector) + { + return invokeObjcSelf!(void, "setAction:", SEL)(aSelector); + } + + NSInteger tag () + { + return invokeObjcSelf!(NSInteger, "tag"); + } + + void setTag (NSInteger anInt) + { + return invokeObjcSelf!(void, "setTag:", NSInteger)(anInt); + } + + NSInteger selectedTag () + { + return invokeObjcSelf!(NSInteger, "selectedTag"); + } + + void setIgnoresMultiClick (bool flag) + { + return invokeObjcSelf!(void, "setIgnoresMultiClick:", bool)(flag); + } + + bool ignoresMultiClick () + { + return invokeObjcSelf!(bool, "ignoresMultiClick"); + } + + NSInteger sendActionOn (NSInteger mask) + { + return invokeObjcSelf!(NSInteger, "sendActionOn:", NSInteger)(mask); + } + + bool isContinuous () + { + return invokeObjcSelf!(bool, "isContinuous"); + } + + void setContinuous (bool flag) + { + return invokeObjcSelf!(void, "setContinuous:", bool)(flag); + } + + bool isEnabled () + { + return invokeObjcSelf!(bool, "isEnabled"); + } + + void setEnabled (bool flag) + { + return invokeObjcSelf!(void, "setEnabled:", bool)(flag); + } + + void setFloatingPointFormat (bool autoRange, NSUInteger leftDigits, NSUInteger rightDigits) + { + return invokeObjcSelf!(void, "setFloatingPointFormat:left:right:", bool, NSUInteger, NSUInteger)(autoRange, leftDigits, rightDigits); + } + + uint alignment () + { + return invokeObjcSelf!(uint, "alignment"); + } + + void setAlignment (uint mode) + { + return invokeObjcSelf!(void, "setAlignment:", uint)(mode); + } + + NSFont font () + { + return invokeObjcSelf!(NSFont, "font"); + } + + void setFont (NSFont fontObj) + { + return invokeObjcSelf!(void, "setFont:", NSFont)(fontObj); + } + + void setFormatter (NSFormatter newFormatter) + { + return invokeObjcSelf!(void, "setFormatter:", NSFormatter)(newFormatter); + } + + Object formatter () + { + return invokeObjcSelf!(Object, "formatter"); + } + + void setObjectValue (INSCopying obj) + { + return invokeObjcSelf!(void, "setObjectValue:", INSCopying)(obj); + } + + void setStringValue (NSString aString) + { + return invokeObjcSelf!(void, "setStringValue:", NSString)(aString); + } + + void setIntValue (int anInt) + { + return invokeObjcSelf!(void, "setIntValue:", int)(anInt); + } + + void setFloatValue (float aFloat) + { + return invokeObjcSelf!(void, "setFloatValue:", float)(aFloat); + } + + void setDoubleValue (double aDouble) + { + return invokeObjcSelf!(void, "setDoubleValue:", double)(aDouble); + } + + Object objectValue () + { + return invokeObjcSelf!(Object, "objectValue"); + } + + NSString stringValue () + { + return invokeObjcSelf!(NSString, "stringValue"); + } + + int intValue () + { + return invokeObjcSelf!(int, "intValue"); + } + + float floatValue () + { + return invokeObjcSelf!(float, "floatValue"); + } + + double doubleValue () + { + return invokeObjcSelf!(double, "doubleValue"); + } + + void setNeedsDisplay () + { + return invokeObjcSelf!(void, "setNeedsDisplay"); + } + + void updateCell (NSCell aCell) + { + return invokeObjcSelf!(void, "updateCell:", NSCell)(aCell); + } + + void updateCellInside (NSCell aCell) + { + return invokeObjcSelf!(void, "updateCellInside:", NSCell)(aCell); + } + + void drawCellInside (NSCell aCell) + { + return invokeObjcSelf!(void, "drawCellInside:", NSCell)(aCell); + } + + void drawCell (NSCell aCell) + { + return invokeObjcSelf!(void, "drawCell:", NSCell)(aCell); + } + + void selectCell (NSCell aCell) + { + return invokeObjcSelf!(void, "selectCell:", NSCell)(aCell); + } + + bool sendAction (SEL theAction, Object theTarget) + { + return invokeObjcSelf!(bool, "sendAction:to:", SEL, Object)(theAction, theTarget); + } + + void takeIntValueFrom (Object sender) + { + return invokeObjcSelf!(void, "takeIntValueFrom:", Object)(sender); + } + + void takeFloatValueFrom (Object sender) + { + return invokeObjcSelf!(void, "takeFloatValueFrom:", Object)(sender); + } + + void takeDoubleValueFrom (Object sender) + { + return invokeObjcSelf!(void, "takeDoubleValueFrom:", Object)(sender); + } + + void takeStringValueFrom (Object sender) + { + return invokeObjcSelf!(void, "takeStringValueFrom:", Object)(sender); + } + + void takeObjectValueFrom (Object sender) + { + return invokeObjcSelf!(void, "takeObjectValueFrom:", Object)(sender); + } + + NSText currentEditor () + { + return invokeObjcSelf!(NSText, "currentEditor"); + } + + bool abortEditing () + { + return invokeObjcSelf!(bool, "abortEditing"); + } + + void validateEditing () + { + return invokeObjcSelf!(void, "validateEditing"); + } + + void mouseDown (NSEvent theEvent) + { + return invokeObjcSelf!(void, "mouseDown:", NSEvent)(theEvent); + } + + int baseWritingDirection () + { + return invokeObjcSelf!(int, "baseWritingDirection"); + } + + void setBaseWritingDirection (int writingDirection) + { + return invokeObjcSelf!(void, "setBaseWritingDirection:", int)(writingDirection); + } + + NSInteger integerValue () + { + return invokeObjcSelf!(NSInteger, "integerValue"); + } + + void setIntegerValue (NSInteger anInteger) + { + return invokeObjcSelf!(void, "setIntegerValue:", NSInteger)(anInteger); + } + + void takeIntegerValueFrom (Object sender) + { + return invokeObjcSelf!(void, "takeIntegerValueFrom:", Object)(sender); + } + + // NSControlAttributedStringMethods + NSAttributedString attributedStringValue () + { + return invokeObjcSelf!(NSAttributedString, "attributedStringValue"); + } + + void setAttributedStringValue (NSAttributedString obj) + { + return invokeObjcSelf!(void, "setAttributedStringValue:", NSAttributedString)(obj); + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSControl_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSControl_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,20 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSControl_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package id NSControlTextDidBeginEditingNotification; + package id NSControlTextDidEndEditingNotification; + package id NSControlTextDidChangeNotification; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSController.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSController.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,66 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSController; + +import dstep.appkit.NSKeyValueBinding; +import dstep.corefoundation.CoreFoundation; +import dstep.foundation.NSCoder; +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSController : NSObject, INSCoding +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + void objectDidBeginEditing (Object editor) + { + return invokeObjcSelf!(void, "objectDidBeginEditing:", Object)(editor); + } + + void objectDidEndEditing (Object editor) + { + return invokeObjcSelf!(void, "objectDidEndEditing:", Object)(editor); + } + + void discardEditing () + { + return invokeObjcSelf!(void, "discardEditing"); + } + + bool commitEditing () + { + return invokeObjcSelf!(bool, "commitEditing"); + } + + void commitEditingWithDelegate (Object delegate_, SEL didCommitSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "commitEditingWithDelegate:didCommitSelector:contextInfo:", Object, SEL, void*)(delegate_, didCommitSelector, contextInfo); + } + + bool isEditing () + { + return invokeObjcSelf!(bool, "isEditing"); + } + +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSCursor.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSCursor.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,205 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSCursor; + +import dstep.appkit.NSColor; +import dstep.appkit.NSEvent; +import dstep.appkit.NSImage; +import dstep.foundation.NSCoder; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSCursor : NSObject, INSCoding +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + static NSCursor currentCursor () + { + return invokeObjcSelfClass!(NSCursor, "currentCursor"); + } + + static NSCursor arrowCursor () + { + return invokeObjcSelfClass!(NSCursor, "arrowCursor"); + } + + static NSCursor IBeamCursor () + { + return invokeObjcSelfClass!(NSCursor, "IBeamCursor"); + } + + static NSCursor pointingHandCursor () + { + return invokeObjcSelfClass!(NSCursor, "pointingHandCursor"); + } + + static NSCursor closedHandCursor () + { + return invokeObjcSelfClass!(NSCursor, "closedHandCursor"); + } + + static NSCursor openHandCursor () + { + return invokeObjcSelfClass!(NSCursor, "openHandCursor"); + } + + static NSCursor resizeLeftCursor () + { + return invokeObjcSelfClass!(NSCursor, "resizeLeftCursor"); + } + + static NSCursor resizeRightCursor () + { + return invokeObjcSelfClass!(NSCursor, "resizeRightCursor"); + } + + static NSCursor resizeLeftRightCursor () + { + return invokeObjcSelfClass!(NSCursor, "resizeLeftRightCursor"); + } + + static NSCursor resizeUpCursor () + { + return invokeObjcSelfClass!(NSCursor, "resizeUpCursor"); + } + + static NSCursor resizeDownCursor () + { + return invokeObjcSelfClass!(NSCursor, "resizeDownCursor"); + } + + static NSCursor resizeUpDownCursor () + { + return invokeObjcSelfClass!(NSCursor, "resizeUpDownCursor"); + } + + static NSCursor crosshairCursor () + { + return invokeObjcSelfClass!(NSCursor, "crosshairCursor"); + } + + static NSCursor disappearingItemCursor () + { + return invokeObjcSelfClass!(NSCursor, "disappearingItemCursor"); + } + + NSCursor initWithImage (NSImage newImage, NSPoint aPoint) + { + id result = invokeObjcSelf!(id, "initWithImage:hotSpot:", NSImage, NSPoint)(newImage, aPoint); + return result is this.objcObject ? this : (result !is null ? new NSCursor(result) : null); + } + + this (NSImage newImage, NSPoint aPoint) + { + super(NSCursor.alloc.initWithImage(newImage, aPoint).objcObject); + } + + NSCursor initWithImage (NSImage newImage, NSColor fg, NSColor bg, NSPoint hotSpot) + { + id result = invokeObjcSelf!(id, "initWithImage:foregroundColorHint:backgroundColorHint:hotSpot:", NSImage, NSColor, NSColor, NSPoint)(newImage, fg, bg, hotSpot); + return result is this.objcObject ? this : (result !is null ? new NSCursor(result) : null); + } + + this (NSImage newImage, NSColor fg, NSColor bg, NSPoint hotSpot) + { + super(NSCursor.alloc.initWithImage(newImage, fg, bg, hotSpot).objcObject); + } + + static void hide () + { + return invokeObjcSelfClass!(void, "hide"); + } + + static void unhide () + { + return invokeObjcSelfClass!(void, "unhide"); + } + + static void setHiddenUntilMouseMoves (bool flag) + { + return invokeObjcSelfClass!(void, "setHiddenUntilMouseMoves:", bool)(flag); + } + + static void pop_static () + { + return invokeObjcSelfClass!(void, "pop"); + } + + NSImage image () + { + return invokeObjcSelf!(NSImage, "image"); + } + + NSPoint hotSpot () + { + return invokeObjcSelf!(NSPoint, "hotSpot"); + } + + void push () + { + return invokeObjcSelf!(void, "push"); + } + + void pop () + { + return invokeObjcSelf!(void, "pop"); + } + + void set () + { + return invokeObjcSelf!(void, "set"); + } + + void setOnMouseExited (bool flag) + { + return invokeObjcSelf!(void, "setOnMouseExited:", bool)(flag); + } + + void setOnMouseEntered (bool flag) + { + return invokeObjcSelf!(void, "setOnMouseEntered:", bool)(flag); + } + + bool isSetOnMouseExited () + { + return invokeObjcSelf!(bool, "isSetOnMouseExited"); + } + + bool isSetOnMouseEntered () + { + return invokeObjcSelf!(bool, "isSetOnMouseEntered"); + } + + void mouseEntered (NSEvent theEvent) + { + return invokeObjcSelf!(void, "mouseEntered:", NSEvent)(theEvent); + } + + void mouseExited (NSEvent theEvent) + { + return invokeObjcSelf!(void, "mouseExited:", NSEvent)(theEvent); + } + +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSCustomImageRep.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSCustomImageRep.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,38 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSCustomImageRep; + +import dstep.appkit.NSImageRep; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSCustomImageRep : NSImageRep +{ + mixin (ObjcWrap); + + NSCustomImageRep initWithDrawSelector (SEL aMethod, Object anObject) + { + id result = invokeObjcSelf!(id, "initWithDrawSelector:delegate:", SEL, Object)(aMethod, anObject); + return result is this.objcObject ? this : (result !is null ? new NSCustomImageRep(result) : null); + } + + this (SEL aMethod, Object anObject) + { + super(NSCustomImageRep.alloc.initWithDrawSelector(aMethod, anObject).objcObject); + } + + SEL drawSelector () + { + return invokeObjcSelf!(SEL, "drawSelector"); + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSDatePicker.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSDatePicker.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,183 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSDatePicker; + +import dstep.appkit.NSColor; +import dstep.appkit.NSControl; +import dstep.appkit.NSDatePickerCell; +import dstep.foundation.NSCalendar; +import dstep.foundation.NSDate; +import dstep.foundation.NSLocale; +import dstep.foundation.NSTimeZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSDatePicker : NSControl +{ + mixin (ObjcWrap); + + uint datePickerStyle () + { + return invokeObjcSelf!(uint, "datePickerStyle"); + } + + void setDatePickerStyle (uint newStyle) + { + return invokeObjcSelf!(void, "setDatePickerStyle:", uint)(newStyle); + } + + bool isBezeled () + { + return invokeObjcSelf!(bool, "isBezeled"); + } + + void setBezeled (bool flag) + { + return invokeObjcSelf!(void, "setBezeled:", bool)(flag); + } + + bool isBordered () + { + return invokeObjcSelf!(bool, "isBordered"); + } + + void setBordered (bool flag) + { + return invokeObjcSelf!(void, "setBordered:", bool)(flag); + } + + bool drawsBackground () + { + return invokeObjcSelf!(bool, "drawsBackground"); + } + + void setDrawsBackground (bool flag) + { + return invokeObjcSelf!(void, "setDrawsBackground:", bool)(flag); + } + + NSColor backgroundColor () + { + return invokeObjcSelf!(NSColor, "backgroundColor"); + } + + void setBackgroundColor (NSColor color) + { + return invokeObjcSelf!(void, "setBackgroundColor:", NSColor)(color); + } + + NSColor textColor () + { + return invokeObjcSelf!(NSColor, "textColor"); + } + + void setTextColor (NSColor color) + { + return invokeObjcSelf!(void, "setTextColor:", NSColor)(color); + } + + uint datePickerMode () + { + return invokeObjcSelf!(uint, "datePickerMode"); + } + + void setDatePickerMode (uint newMode) + { + return invokeObjcSelf!(void, "setDatePickerMode:", uint)(newMode); + } + + uint datePickerElements () + { + return invokeObjcSelf!(uint, "datePickerElements"); + } + + void setDatePickerElements (uint elementFlags) + { + return invokeObjcSelf!(void, "setDatePickerElements:", uint)(elementFlags); + } + + NSCalendar calendar () + { + return invokeObjcSelf!(NSCalendar, "calendar"); + } + + void setCalendar (NSCalendar newCalendar) + { + return invokeObjcSelf!(void, "setCalendar:", NSCalendar)(newCalendar); + } + + NSLocale locale () + { + return invokeObjcSelf!(NSLocale, "locale"); + } + + void setLocale (NSLocale newLocale) + { + return invokeObjcSelf!(void, "setLocale:", NSLocale)(newLocale); + } + + NSTimeZone timeZone () + { + return invokeObjcSelf!(NSTimeZone, "timeZone"); + } + + void setTimeZone (NSTimeZone newTimeZone) + { + return invokeObjcSelf!(void, "setTimeZone:", NSTimeZone)(newTimeZone); + } + + NSDate dateValue () + { + return invokeObjcSelf!(NSDate, "dateValue"); + } + + void setDateValue (NSDate newStartDate) + { + return invokeObjcSelf!(void, "setDateValue:", NSDate)(newStartDate); + } + + double timeInterval () + { + return invokeObjcSelf!(double, "timeInterval"); + } + + void setTimeInterval (double newTimeInterval) + { + return invokeObjcSelf!(void, "setTimeInterval:", double)(newTimeInterval); + } + + NSDate minDate () + { + return invokeObjcSelf!(NSDate, "minDate"); + } + + void setMinDate (NSDate date) + { + return invokeObjcSelf!(void, "setMinDate:", NSDate)(date); + } + + NSDate maxDate () + { + return invokeObjcSelf!(NSDate, "maxDate"); + } + + void setMaxDate (NSDate date) + { + return invokeObjcSelf!(void, "setMaxDate:", NSDate)(date); + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + void setDelegate (Object anObject) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(anObject); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSDatePickerCell.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSDatePickerCell.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,201 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSDatePickerCell; + +import dstep.appkit.NSActionCell; +import dstep.appkit.NSColor; +import dstep.foundation.NSCalendar; +import dstep.foundation.NSDate; +import dstep.foundation.NSLocale; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSTimeZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +alias NSUInteger NSDatePickerStyle; +alias NSUInteger NSDatePickerMode; +alias NSUInteger NSDatePickerElementFlags; + +enum +{ + NSTextFieldAndStepperDatePickerStyle = 0, + NSClockAndCalendarDatePickerStyle = 1, + NSTextFieldDatePickerStyle = 2 +} + +enum +{ + NSSingleDateMode = 0, + NSRangeDateMode = 1 +} + +enum +{ + NSHourMinuteDatePickerElementFlag = 0x000c, + NSHourMinuteSecondDatePickerElementFlag = 0x000e, + NSTimeZoneDatePickerElementFlag = 0x0010, + NSYearMonthDatePickerElementFlag = 0x00c0, + NSYearMonthDayDatePickerElementFlag = 0x00e0, + NSEraDatePickerElementFlag = 0x0100 +} + +class NSDatePickerCell : NSActionCell +{ + mixin (ObjcWrap); + + uint datePickerStyle () + { + return invokeObjcSelf!(uint, "datePickerStyle"); + } + + void setDatePickerStyle (uint newStyle) + { + return invokeObjcSelf!(void, "setDatePickerStyle:", uint)(newStyle); + } + + bool drawsBackground () + { + return invokeObjcSelf!(bool, "drawsBackground"); + } + + void setDrawsBackground (bool flag) + { + return invokeObjcSelf!(void, "setDrawsBackground:", bool)(flag); + } + + NSColor backgroundColor () + { + return invokeObjcSelf!(NSColor, "backgroundColor"); + } + + void setBackgroundColor (NSColor color) + { + return invokeObjcSelf!(void, "setBackgroundColor:", NSColor)(color); + } + + NSColor textColor () + { + return invokeObjcSelf!(NSColor, "textColor"); + } + + void setTextColor (NSColor color) + { + return invokeObjcSelf!(void, "setTextColor:", NSColor)(color); + } + + uint datePickerMode () + { + return invokeObjcSelf!(uint, "datePickerMode"); + } + + void setDatePickerMode (uint newMode) + { + return invokeObjcSelf!(void, "setDatePickerMode:", uint)(newMode); + } + + uint datePickerElements () + { + return invokeObjcSelf!(uint, "datePickerElements"); + } + + void setDatePickerElements (uint elementFlags) + { + return invokeObjcSelf!(void, "setDatePickerElements:", uint)(elementFlags); + } + + NSCalendar calendar () + { + return invokeObjcSelf!(NSCalendar, "calendar"); + } + + void setCalendar (NSCalendar newCalendar) + { + return invokeObjcSelf!(void, "setCalendar:", NSCalendar)(newCalendar); + } + + NSLocale locale () + { + return invokeObjcSelf!(NSLocale, "locale"); + } + + void setLocale (NSLocale newLocale) + { + return invokeObjcSelf!(void, "setLocale:", NSLocale)(newLocale); + } + + NSTimeZone timeZone () + { + return invokeObjcSelf!(NSTimeZone, "timeZone"); + } + + void setTimeZone (NSTimeZone newTimeZone) + { + return invokeObjcSelf!(void, "setTimeZone:", NSTimeZone)(newTimeZone); + } + + NSDate dateValue () + { + return invokeObjcSelf!(NSDate, "dateValue"); + } + + void setDateValue (NSDate newStartDate) + { + return invokeObjcSelf!(void, "setDateValue:", NSDate)(newStartDate); + } + + double timeInterval () + { + return invokeObjcSelf!(double, "timeInterval"); + } + + void setTimeInterval (double newTimeInterval) + { + return invokeObjcSelf!(void, "setTimeInterval:", double)(newTimeInterval); + } + + NSDate minDate () + { + return invokeObjcSelf!(NSDate, "minDate"); + } + + void setMinDate (NSDate date) + { + return invokeObjcSelf!(void, "setMinDate:", NSDate)(date); + } + + NSDate maxDate () + { + return invokeObjcSelf!(NSDate, "maxDate"); + } + + void setMaxDate (NSDate date) + { + return invokeObjcSelf!(void, "setMaxDate:", NSDate)(date); + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + void setDelegate (Object anObject) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(anObject); + } +} + +const TNSDatePickerCellDelegate = ` + + void datePickerCell (NSDatePickerCell aDatePickerCell, NSDate** proposedDateValue, NSTimeInterval* proposedTimeInterval) + { + return invokeObjcSelf!(void, "datePickerCell:validateProposedDateValue:timeInterval:", NSDatePickerCell, NSDate**, NSTimeInterval*)(aDatePickerCell, proposedDateValue, proposedTimeInterval); + } + + //mixin ObjcBindMethod!(datePickerCell, "datePickerCell:validateProposedDateValue:timeInterval:"); + +`; + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSDictionaryController.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSDictionaryController.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,144 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSDictionaryController; + +import dstep.appkit.NSArrayController; +import dstep.foundation.NSArray; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSDictionaryController : NSArrayController +{ + mixin (ObjcWrap); + + Object newObject () + { + return invokeObjcSelf!(Object, "newObject"); + } + + void setInitialKey (NSString key) + { + return invokeObjcSelf!(void, "setInitialKey:", NSString)(key); + } + + NSDictionaryController initialKey () + { + id result = invokeObjcSelf!(id, "initialKey"); + return result is this.objcObject ? this : (result !is null ? new NSDictionaryController(result) : null); + } + + this () + { + super(NSDictionaryController.alloc.initialKey.objcObject); + } + + void setInitialValue (Object value) + { + return invokeObjcSelf!(void, "setInitialValue:", Object)(value); + } + + NSDictionaryController initialValue () + { + id result = invokeObjcSelf!(id, "initialValue"); + return result is this.objcObject ? this : (result !is null ? new NSDictionaryController(result) : null); + } + + this () + { + super(NSDictionaryController.alloc.initialValue.objcObject); + } + + void setIncludedKeys (NSArray keys) + { + return invokeObjcSelf!(void, "setIncludedKeys:", NSArray)(keys); + } + + NSArray includedKeys () + { + return invokeObjcSelf!(NSArray, "includedKeys"); + } + + void setExcludedKeys (NSArray keys) + { + return invokeObjcSelf!(void, "setExcludedKeys:", NSArray)(keys); + } + + NSArray excludedKeys () + { + return invokeObjcSelf!(NSArray, "excludedKeys"); + } + + void setLocalizedKeyDictionary (NSDictionary dictionary) + { + return invokeObjcSelf!(void, "setLocalizedKeyDictionary:", NSDictionary)(dictionary); + } + + NSDictionary localizedKeyDictionary () + { + return invokeObjcSelf!(NSDictionary, "localizedKeyDictionary"); + } + + void setLocalizedKeyTable (NSString stringsFileName) + { + return invokeObjcSelf!(void, "setLocalizedKeyTable:", NSString)(stringsFileName); + } + + NSString localizedKeyTable () + { + return invokeObjcSelf!(NSString, "localizedKeyTable"); + } +} + +const TNSDictionaryControllerKeyValuePair = ` + + void setLocalizedKey (NSString localizedKey) + { + return invokeObjcSelf!(void, "setLocalizedKey:", NSString)(localizedKey); + } + + NSString localizedKey () + { + return invokeObjcSelf!(NSString, "localizedKey"); + } + + void setKey (NSString key) + { + return invokeObjcSelf!(void, "setKey:", NSString)(key); + } + + NSString key () + { + return invokeObjcSelf!(NSString, "key"); + } + + void setValue (Object value) + { + return invokeObjcSelf!(void, "setValue:", Object)(value); + } + + Object value () + { + return invokeObjcSelf!(Object, "value"); + } + + bool isExplicitlyIncluded () + { + return invokeObjcSelf!(bool, "isExplicitlyIncluded"); + } + + //mixin ObjcBindMethod!(setLocalizedKey, "setLocalizedKey:"); + //mixin ObjcBindMethod!(localizedKey, "localizedKey"); + //mixin ObjcBindMethod!(setKey, "setKey:"); + //mixin ObjcBindMethod!(key, "key"); + //mixin ObjcBindMethod!(setValue, "setValue:"); + //mixin ObjcBindMethod!(value, "value"); + //mixin ObjcBindMethod!(isExplicitlyIncluded, "isExplicitlyIncluded"); + +`; + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSDockTile.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSDockTile.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,65 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSDockTile; + +import dstep.appkit.NSView; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSDockTile : NSObject +{ + mixin (ObjcWrap); + + NSSize size () + { + return invokeObjcSelf!(NSSize, "size"); + } + + void setContentView (NSView view) + { + return invokeObjcSelf!(void, "setContentView:", NSView)(view); + } + + NSView contentView () + { + return invokeObjcSelf!(NSView, "contentView"); + } + + void display () + { + return invokeObjcSelf!(void, "display"); + } + + void setShowsApplicationBadge (bool flag) + { + return invokeObjcSelf!(void, "setShowsApplicationBadge:", bool)(flag); + } + + bool showsApplicationBadge () + { + return invokeObjcSelf!(bool, "showsApplicationBadge"); + } + + void setBadgeLabel (NSString string) + { + return invokeObjcSelf!(void, "setBadgeLabel:", NSString)(string); + } + + NSString badgeLabel () + { + return invokeObjcSelf!(NSString, "badgeLabel"); + } + + Object owner () + { + return invokeObjcSelf!(Object, "owner"); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSDocument.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSDocument.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,883 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSDocument; + +import dstep.appkit.NSDocumentScripting; +import dstep.appkit.NSFileWrapper; +import dstep.appkit.NSMenuItem; +import dstep.appkit.NSNibDeclarations; +import dstep.appkit.NSPageLayout; +import dstep.appkit.NSPrintInfo; +import dstep.appkit.NSPrintOperation; +import dstep.appkit.NSSavePanel; +import dstep.appkit.NSUserInterfaceValidation; +import dstep.appkit.NSView; +import dstep.appkit.NSWindow; +import dstep.appkit.NSWindowController; +import dstep.foundation.NSArray; +import dstep.foundation.NSData; +import dstep.foundation.NSDate; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSError; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSScriptCommand; +import dstep.foundation.NSScriptObjectSpecifiers; +import dstep.foundation.NSScriptStandardSuiteCommands; +import dstep.foundation.NSString; +import dstep.foundation.NSUndoManager; +import dstep.foundation.NSURL; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +alias NSUInteger NSDocumentChangeType; +alias NSUInteger NSSaveOperationType; + +enum +{ + NSChangeDone = 0, + NSChangeUndone = 1, + NSChangeCleared = 2, + NSChangeRedone = 5, + NSChangeReadOtherContents = 3, + NSChangeAutosaved = 4 +} + +enum +{ + NSSaveOperation = 0, + NSSaveAsOperation = 1, + NSSaveToOperation = 2, + NSAutosaveOperation = 3 +} + +const TNSDeprecated = ` + + NSData dataRepresentationOfType (NSString type) + { + return invokeObjcSelf!(NSData, "dataRepresentationOfType:", NSString)(type); + } + + NSDictionary fileAttributesToWriteToFile (NSString fullDocumentPath, NSString documentTypeName, uint saveOperationType) + { + return invokeObjcSelf!(NSDictionary, "fileAttributesToWriteToFile:ofType:saveOperation:", NSString, NSString, uint)(fullDocumentPath, documentTypeName, saveOperationType); + } + + NSString fileName () + { + return invokeObjcSelf!(NSString, "fileName"); + } + + NSFileWrapper fileWrapperRepresentationOfType (NSString type) + { + return invokeObjcSelf!(NSFileWrapper, "fileWrapperRepresentationOfType:", NSString)(type); + } + + typeof(this) initWithContentsOfFile (NSString absolutePath, NSString typeName) + { + id result = invokeObjcSelf!(id, "initWithContentsOfFile:ofType:", NSString, NSString)(absolutePath, typeName); + return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); + } + + this (NSString absolutePath, NSString typeName) + { + super(typeof(this).alloc.initWithContentsOfFile(absolutePath, typeName).objcObject); + } + + typeof(this) initWithContentsOfURL (NSURL absoluteURL, NSString typeName) + { + id result = invokeObjcSelf!(id, "initWithContentsOfURL:ofType:", NSURL, NSString)(absoluteURL, typeName); + return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); + } + + this (NSURL absoluteURL, NSString typeName) + { + super(typeof(this).alloc.initWithContentsOfURL(absoluteURL, typeName).objcObject); + } + + bool loadDataRepresentation (NSData data, NSString type) + { + return invokeObjcSelf!(bool, "loadDataRepresentation:ofType:", NSData, NSString)(data, type); + } + + bool loadFileWrapperRepresentation (NSFileWrapper wrapper, NSString type) + { + return invokeObjcSelf!(bool, "loadFileWrapperRepresentation:ofType:", NSFileWrapper, NSString)(wrapper, type); + } + + void printShowingPrintPanel (bool flag) + { + return invokeObjcSelf!(void, "printShowingPrintPanel:", bool)(flag); + } + + bool readFromFile (NSString fileName, NSString type) + { + return invokeObjcSelf!(bool, "readFromFile:ofType:", NSString, NSString)(fileName, type); + } + + bool readFromURL (NSURL url, NSString type) + { + return invokeObjcSelf!(bool, "readFromURL:ofType:", NSURL, NSString)(url, type); + } + + bool revertToSavedFromFile (NSString fileName, NSString type) + { + return invokeObjcSelf!(bool, "revertToSavedFromFile:ofType:", NSString, NSString)(fileName, type); + } + + bool revertToSavedFromURL (NSURL url, NSString type) + { + return invokeObjcSelf!(bool, "revertToSavedFromURL:ofType:", NSURL, NSString)(url, type); + } + + NSInteger runModalPageLayoutWithPrintInfo (NSPrintInfo printInfo) + { + return invokeObjcSelf!(NSInteger, "runModalPageLayoutWithPrintInfo:", NSPrintInfo)(printInfo); + } + + void saveToFile (NSString fileName, uint saveOperation, Object delegate_, SEL didSaveSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "saveToFile:saveOperation:delegate:didSaveSelector:contextInfo:", NSString, uint, Object, SEL, void*)(fileName, saveOperation, delegate_, didSaveSelector, contextInfo); + } + + void setFileName (NSString fileName) + { + return invokeObjcSelf!(void, "setFileName:", NSString)(fileName); + } + + bool writeToFile (NSString fileName, NSString type) + { + return invokeObjcSelf!(bool, "writeToFile:ofType:", NSString, NSString)(fileName, type); + } + + bool writeToFile (NSString fullDocumentPath, NSString documentTypeName, NSString fullOriginalDocumentPath, uint saveOperationType) + { + return invokeObjcSelf!(bool, "writeToFile:ofType:originalFile:saveOperation:", NSString, NSString, NSString, uint)(fullDocumentPath, documentTypeName, fullOriginalDocumentPath, saveOperationType); + } + + bool writeToURL (NSURL url, NSString type) + { + return invokeObjcSelf!(bool, "writeToURL:ofType:", NSURL, NSString)(url, type); + } + + bool writeWithBackupToFile (NSString fullDocumentPath, NSString documentTypeName, uint saveOperationType) + { + return invokeObjcSelf!(bool, "writeWithBackupToFile:ofType:saveOperation:", NSString, NSString, uint)(fullDocumentPath, documentTypeName, saveOperationType); + } + + //mixin ObjcBindMethod!(dataRepresentationOfType, "dataRepresentationOfType:"); + //mixin ObjcBindMethod!(fileAttributesToWriteToFile, "fileAttributesToWriteToFile:ofType:saveOperation:"); + //mixin ObjcBindMethod!(fileName, "fileName"); + //mixin ObjcBindMethod!(fileWrapperRepresentationOfType, "fileWrapperRepresentationOfType:"); + //mixin ObjcBindMethod!(initWithContentsOfFile, "initWithContentsOfFile:ofType:"); + //mixin ObjcBindMethod!(initWithContentsOfURL, "initWithContentsOfURL:ofType:"); + //mixin ObjcBindMethod!(loadDataRepresentation, "loadDataRepresentation:ofType:"); + //mixin ObjcBindMethod!(loadFileWrapperRepresentation, "loadFileWrapperRepresentation:ofType:"); + //mixin ObjcBindMethod!(printShowingPrintPanel, "printShowingPrintPanel:"); + //mixin ObjcBindMethod!(readFromFile, "readFromFile:ofType:"); + ////mixin ObjcBindMethod!(readFromURL, "readFromURL:ofType:"); + //mixin ObjcBindMethod!(revertToSavedFromFile, "revertToSavedFromFile:ofType:"); + //mixin ObjcBindMethod!(revertToSavedFromURL, "revertToSavedFromURL:ofType:"); + //mixin ObjcBindMethod!(runModalPageLayoutWithPrintInfo, "runModalPageLayoutWithPrintInfo:"); + //mixin ObjcBindMethod!(saveToFile, "saveToFile:saveOperation:delegate:didSaveSelector:contextInfo:"); + //mixin ObjcBindMethod!(setFileName, "setFileName:"); + //mixin ObjcBindMethod!(writeToFile, "writeToFile:ofType:"); + //mixin ObjcBindMethod!(writeToFile, "writeToFile:ofType:originalFile:saveOperation:"); + ////mixin ObjcBindMethod!(writeToURL, "writeToURL:ofType:"); + //mixin ObjcBindMethod!(writeWithBackupToFile, "writeWithBackupToFile:ofType:saveOperation:"); + +`; + +class NSDocument : NSObject, INSUserInterfaceValidations +{ + mixin (ObjcWrap); + + NSDocument init () + { + id result = invokeObjcSelf!(id, "init"); + return result is this.objcObject ? this : (result !is null ? new NSDocument(result) : null); + } + + this () + { + super(NSDocument.alloc.init.objcObject); + } + + NSDocument initWithType (NSString typeName, ref NSError outError) + { + id error; + + if (outError) + error = new objc_object; + + id result = invokeObjcSelf!(id, "initWithType:error:", NSString, id*)(typeName, &error); + + if (error) + outError = new NSError(error); + + return result is this.objcObject ? this : (result !is null ? new NSDocument(result) : null); + } + + this (NSString typeName, ref NSError outError) + { + super(NSDocument.alloc.initWithType(typeName, outError).objcObject); + } + + NSDocument initForURL (NSURL absoluteDocumentURL, NSURL absoluteDocumentContentsURL, NSString typeName, ref NSError outError) + { + id error; + + if (outError) + error = new objc_object; + + id result = invokeObjcSelf!(id, "initForURL:withContentsOfURL:ofType:error:", NSURL, NSURL, NSString, id*)(absoluteDocumentURL, absoluteDocumentContentsURL, typeName, &error); + + if (error) + outError = new NSError(error); + + return result is this.objcObject ? this : (result !is null ? new NSDocument(result) : null); + } + + this (NSURL absoluteDocumentURL, NSURL absoluteDocumentContentsURL, NSString typeName, ref NSError outError) + { + super(NSDocument.alloc.initForURL(absoluteDocumentURL, absoluteDocumentContentsURL, typeName, outError).objcObject); + } + + void setFileType (NSString typeName) + { + return invokeObjcSelf!(void, "setFileType:", NSString)(typeName); + } + + NSString fileType () + { + return invokeObjcSelf!(NSString, "fileType"); + } + + void setFileURL (NSURL absoluteURL) + { + return invokeObjcSelf!(void, "setFileURL:", NSURL)(absoluteURL); + } + + NSURL fileURL () + { + return invokeObjcSelf!(NSURL, "fileURL"); + } + + void setFileModificationDate (NSDate modificationDate) + { + return invokeObjcSelf!(void, "setFileModificationDate:", NSDate)(modificationDate); + } + + NSDate fileModificationDate () + { + return invokeObjcSelf!(NSDate, "fileModificationDate"); + } + + void revertDocumentToSaved (Object sender) + { + return invokeObjcSelf!(void, "revertDocumentToSaved:", Object)(sender); + } + + bool revertToContentsOfURL (NSURL absoluteURL, NSString typeName, ref NSError outError) + { + id error; + + if (outError) + error = new objc_object; + + bool result = invokeObjcSelf!(bool, "revertToContentsOfURL:ofType:error:", NSURL, NSString, id*)(absoluteURL, typeName, &error); + + if (error) + outError = new NSError(error); + + return result; + } + + bool readFromURL (NSURL absoluteURL, NSString typeName, ref NSError outError) + { + id error; + + if (outError) + error = outError.objcObject; + + bool result = invokeObjcSelf!(bool, "readFromURL:ofType:error:", NSURL, NSString, id*)(absoluteURL, typeName, &error); + + if (error) + outError = new NSError(error); + + return result; + } + + bool readFromFileWrapper (NSFileWrapper fileWrapper, NSString typeName, ref NSError outError) + { + id error; + + if (outError) + error = new objc_object; + + bool result = invokeObjcSelf!(bool, "readFromFileWrapper:ofType:error:", NSFileWrapper, NSString, id*)(fileWrapper, typeName, &error); + + if (error) + outError = new NSError(error); + + return result; + } + + bool readFromData (NSData data, NSString typeName, ref NSError outError) + { + id error; + + if (outError) + error = new objc_object; + + bool result = invokeObjcSelf!(bool, "readFromData:ofType:error:", NSData, NSString, id*)(data, typeName, &error); + + if (error) + outError = new NSError(error); + + return result; + } + + bool writeToURL (NSURL absoluteURL, NSString typeName, ref NSError outError) + { + id error; + + if (outError) + error = new objc_object; + + bool result = invokeObjcSelf!(bool, "writeToURL:ofType:error:", NSURL, NSString, id*)(absoluteURL, typeName, &error); + + if (error) + outError = new NSError(error); + + return result; + } + + NSFileWrapper fileWrapperOfType (NSString typeName, ref NSError outError) + { + id error; + + if (outError) + error = new objc_object; + + NSFileWrapper result = invokeObjcSelf!(NSFileWrapper, "fileWrapperOfType:error:", NSString, id*)(typeName, &error); + + if (error) + outError = new NSError(error); + + return result; + } + + NSData dataOfType (NSString typeName, ref NSError outError) + { + id error; + + if (outError) + error = new objc_object; + + NSData result = invokeObjcSelf!(NSData, "dataOfType:error:", NSString, id*)(typeName, &error); + + if (error) + outError = new NSError(error); + + return result; + } + + bool writeSafelyToURL (NSURL absoluteURL, NSString typeName, uint saveOperation, ref NSError outError) + { + id error; + + if (outError) + error = new objc_object; + + bool result = invokeObjcSelf!(bool, "writeSafelyToURL:ofType:forSaveOperation:error:", NSURL, NSString, uint, id*)(absoluteURL, typeName, saveOperation, &error); + + if (error) + outError = new NSError(error); + + return result; + } + + bool writeToURL (NSURL absoluteURL, NSString typeName, uint saveOperation, NSURL absoluteOriginalContentsURL, ref NSError outError) + { + id error; + + if (outError) + error = new objc_object; + + bool result = invokeObjcSelf!(bool, "writeToURL:ofType:forSaveOperation:originalContentsURL:error:", NSURL, NSString, uint, NSURL, id*)(absoluteURL, typeName, saveOperation, absoluteOriginalContentsURL, &error); + + if (error) + outError = new NSError(error); + + return result; + } + + NSDictionary fileAttributesToWriteToURL (NSURL absoluteURL, NSString typeName, uint saveOperation, NSURL absoluteOriginalContentsURL, ref NSError outError) + { + id error; + + if (outError) + error = new objc_object; + + NSDictionary result = invokeObjcSelf!(NSDictionary, "fileAttributesToWriteToURL:ofType:forSaveOperation:originalContentsURL:error:", NSURL, NSString, uint, NSURL, id*)(absoluteURL, typeName, saveOperation, absoluteOriginalContentsURL, &error); + + if (error) + outError = new NSError(error); + + return result; + } + + bool keepBackupFile () + { + return invokeObjcSelf!(bool, "keepBackupFile"); + } + + void saveDocument (Object sender) + { + return invokeObjcSelf!(void, "saveDocument:", Object)(sender); + } + + void saveDocumentAs (Object sender) + { + return invokeObjcSelf!(void, "saveDocumentAs:", Object)(sender); + } + + void saveDocumentTo (Object sender) + { + return invokeObjcSelf!(void, "saveDocumentTo:", Object)(sender); + } + + void saveDocumentWithDelegate (Object delegate_, SEL didSaveSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "saveDocumentWithDelegate:didSaveSelector:contextInfo:", Object, SEL, void*)(delegate_, didSaveSelector, contextInfo); + } + + void runModalSavePanelForSaveOperation (uint saveOperation, Object delegate_, SEL didSaveSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "runModalSavePanelForSaveOperation:delegate:didSaveSelector:contextInfo:", uint, Object, SEL, void*)(saveOperation, delegate_, didSaveSelector, contextInfo); + } + + bool shouldRunSavePanelWithAccessoryView () + { + return invokeObjcSelf!(bool, "shouldRunSavePanelWithAccessoryView"); + } + + bool prepareSavePanel (NSSavePanel savePanel) + { + return invokeObjcSelf!(bool, "prepareSavePanel:", NSSavePanel)(savePanel); + } + + bool fileNameExtensionWasHiddenInLastRunSavePanel () + { + return invokeObjcSelf!(bool, "fileNameExtensionWasHiddenInLastRunSavePanel"); + } + + NSString fileTypeFromLastRunSavePanel () + { + return invokeObjcSelf!(NSString, "fileTypeFromLastRunSavePanel"); + } + + void saveToURL (NSURL absoluteURL, NSString typeName, uint saveOperation, Object delegate_, SEL didSaveSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "saveToURL:ofType:forSaveOperation:delegate:didSaveSelector:contextInfo:", NSURL, NSString, uint, Object, SEL, void*)(absoluteURL, typeName, saveOperation, delegate_, didSaveSelector, contextInfo); + } + + bool saveToURL (NSURL absoluteURL, NSString typeName, uint saveOperation, ref NSError outError) + { + id error; + + if (outError) + error = new objc_object; + + bool result = invokeObjcSelf!(bool, "saveToURL:ofType:forSaveOperation:error:", NSURL, NSString, uint, id*)(absoluteURL, typeName, saveOperation, &error); + + if (error) + outError = new NSError(error); + + return result; + } + + bool hasUnautosavedChanges () + { + return invokeObjcSelf!(bool, "hasUnautosavedChanges"); + } + + void autosaveDocumentWithDelegate (Object delegate_, SEL didAutosaveSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "autosaveDocumentWithDelegate:didAutosaveSelector:contextInfo:", Object, SEL, void*)(delegate_, didAutosaveSelector, contextInfo); + } + + NSString autosavingFileType () + { + return invokeObjcSelf!(NSString, "autosavingFileType"); + } + + void setAutosavedContentsFileURL (NSURL absoluteURL) + { + return invokeObjcSelf!(void, "setAutosavedContentsFileURL:", NSURL)(absoluteURL); + } + + NSURL autosavedContentsFileURL () + { + return invokeObjcSelf!(NSURL, "autosavedContentsFileURL"); + } + + void canCloseDocumentWithDelegate (Object delegate_, SEL shouldCloseSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "canCloseDocumentWithDelegate:shouldCloseSelector:contextInfo:", Object, SEL, void*)(delegate_, shouldCloseSelector, contextInfo); + } + + void close () + { + return invokeObjcSelf!(void, "close"); + } + + void runPageLayout (Object sender) + { + return invokeObjcSelf!(void, "runPageLayout:", Object)(sender); + } + + void runModalPageLayoutWithPrintInfo (NSPrintInfo printInfo, Object delegate_, SEL didRunSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "runModalPageLayoutWithPrintInfo:delegate:didRunSelector:contextInfo:", NSPrintInfo, Object, SEL, void*)(printInfo, delegate_, didRunSelector, contextInfo); + } + + bool preparePageLayout (NSPageLayout pageLayout) + { + return invokeObjcSelf!(bool, "preparePageLayout:", NSPageLayout)(pageLayout); + } + + bool shouldChangePrintInfo (NSPrintInfo newPrintInfo) + { + return invokeObjcSelf!(bool, "shouldChangePrintInfo:", NSPrintInfo)(newPrintInfo); + } + + void setPrintInfo (NSPrintInfo printInfo) + { + return invokeObjcSelf!(void, "setPrintInfo:", NSPrintInfo)(printInfo); + } + + NSPrintInfo printInfo () + { + return invokeObjcSelf!(NSPrintInfo, "printInfo"); + } + + void printDocument (Object sender) + { + return invokeObjcSelf!(void, "printDocument:", Object)(sender); + } + + void printDocumentWithSettings (NSDictionary printSettings, bool showPrintPanel, Object delegate_, SEL didPrintSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "printDocumentWithSettings:showPrintPanel:delegate:didPrintSelector:contextInfo:", NSDictionary, bool, Object, SEL, void*)(printSettings, showPrintPanel, delegate_, didPrintSelector, contextInfo); + } + + NSPrintOperation printOperationWithSettings (NSDictionary printSettings, ref NSError outError) + { + id error; + + if (outError) + error = new objc_object; + + NSPrintOperation result = invokeObjcSelf!(NSPrintOperation, "printOperationWithSettings:error:", NSDictionary, id*)(printSettings, &error); + + if (error) + outError = new NSError(error); + + return result; + } + + void runModalPrintOperation (NSPrintOperation printOperation, Object delegate_, SEL didRunSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "runModalPrintOperation:delegate:didRunSelector:contextInfo:", NSPrintOperation, Object, SEL, void*)(printOperation, delegate_, didRunSelector, contextInfo); + } + + bool isDocumentEdited () + { + return invokeObjcSelf!(bool, "isDocumentEdited"); + } + + void updateChangeCount (uint change) + { + return invokeObjcSelf!(void, "updateChangeCount:", uint)(change); + } + + void setUndoManager (NSUndoManager undoManager) + { + return invokeObjcSelf!(void, "setUndoManager:", NSUndoManager)(undoManager); + } + + NSUndoManager undoManager () + { + return invokeObjcSelf!(NSUndoManager, "undoManager"); + } + + void setHasUndoManager (bool hasUndoManager) + { + return invokeObjcSelf!(void, "setHasUndoManager:", bool)(hasUndoManager); + } + + bool hasUndoManager () + { + return invokeObjcSelf!(bool, "hasUndoManager"); + } + + void presentError (NSError error, NSWindow window, Object delegate_, SEL didPresentSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "presentError:modalForWindow:delegate:didPresentSelector:contextInfo:", NSError, NSWindow, Object, SEL, void*)(error, window, delegate_, didPresentSelector, contextInfo); + } + + bool presentError (NSError error) + { + return invokeObjcSelf!(bool, "presentError:", NSError)(error); + } + + NSError willPresentError (NSError error) + { + return invokeObjcSelf!(NSError, "willPresentError:", NSError)(error); + } + + void makeWindowControllers () + { + return invokeObjcSelf!(void, "makeWindowControllers"); + } + + NSString windowNibName () + { + return invokeObjcSelf!(NSString, "windowNibName"); + } + + void windowControllerWillLoadNib (NSWindowController windowController) + { + return invokeObjcSelf!(void, "windowControllerWillLoadNib:", NSWindowController)(windowController); + } + + void windowControllerDidLoadNib (NSWindowController windowController) + { + return invokeObjcSelf!(void, "windowControllerDidLoadNib:", NSWindowController)(windowController); + } + + void setWindow (NSWindow window) + { + return invokeObjcSelf!(void, "setWindow:", NSWindow)(window); + } + + void addWindowController (NSWindowController windowController) + { + return invokeObjcSelf!(void, "addWindowController:", NSWindowController)(windowController); + } + + void removeWindowController (NSWindowController windowController) + { + return invokeObjcSelf!(void, "removeWindowController:", NSWindowController)(windowController); + } + + void showWindows () + { + return invokeObjcSelf!(void, "showWindows"); + } + + NSArray windowControllers () + { + return invokeObjcSelf!(NSArray, "windowControllers"); + } + + void shouldCloseWindowController (NSWindowController windowController, Object delegate_, SEL shouldCloseSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "shouldCloseWindowController:delegate:shouldCloseSelector:contextInfo:", NSWindowController, Object, SEL, void*)(windowController, delegate_, shouldCloseSelector, contextInfo); + } + + NSString displayName () + { + return invokeObjcSelf!(NSString, "displayName"); + } + + NSWindow windowForSheet () + { + return invokeObjcSelf!(NSWindow, "windowForSheet"); + } + + static NSArray readableTypes () + { + return invokeObjcSelfClass!(NSArray, "readableTypes"); + } + + static NSArray writableTypes () + { + return invokeObjcSelfClass!(NSArray, "writableTypes"); + } + + static bool isNativeType (NSString type) + { + return invokeObjcSelfClass!(bool, "isNativeType:", NSString)(type); + } + + NSArray writableTypesForSaveOperation (uint saveOperation) + { + return invokeObjcSelf!(NSArray, "writableTypesForSaveOperation:", uint)(saveOperation); + } + + NSString fileNameExtensionForType (NSString typeName, uint saveOperation) + { + return invokeObjcSelf!(NSString, "fileNameExtensionForType:saveOperation:", NSString, uint)(typeName, saveOperation); + } + + bool validateUserInterfaceItem (INSValidatedUserInterfaceItem anItem) + { + return invokeObjcSelf!(bool, "validateUserInterfaceItem:", INSValidatedUserInterfaceItem)(anItem); + } + + bool validateUserInterfaceItem (INSValidatedUserInterfaceItem anItem) + { + return invokeObjcSelf!(bool, "validateUserInterfaceItem:", INSValidatedUserInterfaceItem)(anItem); + } + + // NSDeprecated + NSData dataRepresentationOfType (NSString type) + { + return invokeObjcSelf!(NSData, "dataRepresentationOfType:", NSString)(type); + } + + NSDictionary fileAttributesToWriteToFile (NSString fullDocumentPath, NSString documentTypeName, uint saveOperationType) + { + return invokeObjcSelf!(NSDictionary, "fileAttributesToWriteToFile:ofType:saveOperation:", NSString, NSString, uint)(fullDocumentPath, documentTypeName, saveOperationType); + } + + NSString fileName () + { + return invokeObjcSelf!(NSString, "fileName"); + } + + NSFileWrapper fileWrapperRepresentationOfType (NSString type) + { + return invokeObjcSelf!(NSFileWrapper, "fileWrapperRepresentationOfType:", NSString)(type); + } + + typeof(this) initWithContentsOfFile (NSString absolutePath, NSString typeName) + { + id result = invokeObjcSelf!(id, "initWithContentsOfFile:ofType:", NSString, NSString)(absolutePath, typeName); + return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); + } + + this (NSString absolutePath, NSString typeName) + { + super(typeof(this).alloc.initWithContentsOfFile(absolutePath, typeName).objcObject); + } + + typeof(this) initWithContentsOfURL (NSURL absoluteURL, NSString typeName) + { + id result = invokeObjcSelf!(id, "initWithContentsOfURL:ofType:", NSURL, NSString)(absoluteURL, typeName); + return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); + } + + this (NSURL absoluteURL, NSString typeName) + { + super(typeof(this).alloc.initWithContentsOfURL(absoluteURL, typeName).objcObject); + } + + bool loadDataRepresentation (NSData data, NSString type) + { + return invokeObjcSelf!(bool, "loadDataRepresentation:ofType:", NSData, NSString)(data, type); + } + + bool loadFileWrapperRepresentation (NSFileWrapper wrapper, NSString type) + { + return invokeObjcSelf!(bool, "loadFileWrapperRepresentation:ofType:", NSFileWrapper, NSString)(wrapper, type); + } + + void printShowingPrintPanel (bool flag) + { + return invokeObjcSelf!(void, "printShowingPrintPanel:", bool)(flag); + } + + bool readFromFile (NSString fileName, NSString type) + { + return invokeObjcSelf!(bool, "readFromFile:ofType:", NSString, NSString)(fileName, type); + } + + bool readFromURL (NSURL url, NSString type) + { + return invokeObjcSelf!(bool, "readFromURL:ofType:", NSURL, NSString)(url, type); + } + + bool revertToSavedFromFile (NSString fileName, NSString type) + { + return invokeObjcSelf!(bool, "revertToSavedFromFile:ofType:", NSString, NSString)(fileName, type); + } + + bool revertToSavedFromURL (NSURL url, NSString type) + { + return invokeObjcSelf!(bool, "revertToSavedFromURL:ofType:", NSURL, NSString)(url, type); + } + + NSInteger runModalPageLayoutWithPrintInfo (NSPrintInfo printInfo) + { + return invokeObjcSelf!(NSInteger, "runModalPageLayoutWithPrintInfo:", NSPrintInfo)(printInfo); + } + + void saveToFile (NSString fileName, uint saveOperation, Object delegate_, SEL didSaveSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "saveToFile:saveOperation:delegate:didSaveSelector:contextInfo:", NSString, uint, Object, SEL, void*)(fileName, saveOperation, delegate_, didSaveSelector, contextInfo); + } + + void setFileName (NSString fileName) + { + return invokeObjcSelf!(void, "setFileName:", NSString)(fileName); + } + + bool writeToFile (NSString fileName, NSString type) + { + return invokeObjcSelf!(bool, "writeToFile:ofType:", NSString, NSString)(fileName, type); + } + + bool writeToFile (NSString fullDocumentPath, NSString documentTypeName, NSString fullOriginalDocumentPath, uint saveOperationType) + { + return invokeObjcSelf!(bool, "writeToFile:ofType:originalFile:saveOperation:", NSString, NSString, NSString, uint)(fullDocumentPath, documentTypeName, fullOriginalDocumentPath, saveOperationType); + } + + bool writeToURL (NSURL url, NSString type) + { + return invokeObjcSelf!(bool, "writeToURL:ofType:", NSURL, NSString)(url, type); + } + + bool writeWithBackupToFile (NSString fullDocumentPath, NSString documentTypeName, uint saveOperationType) + { + return invokeObjcSelf!(bool, "writeWithBackupToFile:ofType:saveOperation:", NSString, NSString, uint)(fullDocumentPath, documentTypeName, saveOperationType); + } + + // NSScripting + NSString lastComponentOfFileName () + { + return invokeObjcSelf!(NSString, "lastComponentOfFileName"); + } + + void setLastComponentOfFileName (NSString str) + { + return invokeObjcSelf!(void, "setLastComponentOfFileName:", NSString)(str); + } + + Object handleSaveScriptCommand (NSScriptCommand command) + { + return invokeObjcSelf!(Object, "handleSaveScriptCommand:", NSScriptCommand)(command); + } + + Object handleCloseScriptCommand (NSCloseCommand command) + { + return invokeObjcSelf!(Object, "handleCloseScriptCommand:", NSCloseCommand)(command); + } + + Object handlePrintScriptCommand (NSScriptCommand command) + { + return invokeObjcSelf!(Object, "handlePrintScriptCommand:", NSScriptCommand)(command); + } + + NSScriptObjectSpecifier objectSpecifier () + { + return invokeObjcSelf!(NSScriptObjectSpecifier, "objectSpecifier"); + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSDocumentController.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSDocumentController.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,322 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSDocumentController; + +import dstep.foundation.NSArray; +import dstep.appkit.NSDocument; +import dstep.appkit.NSMenuItem; +import dstep.appkit.NSNibDeclarations; +import dstep.appkit.NSOpenPanel; +import dstep.appkit.NSUserInterfaceValidation; +import dstep.appkit.NSWindow; +import dstep.foundation.NSCoder; +import dstep.foundation.NSDate; +import dstep.foundation.NSError; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSURL; +import dstep.foundation.NSZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSDocumentController : NSObject, INSCoding, INSUserInterfaceValidations +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + static Object sharedDocumentController () + { + return invokeObjcSelfClass!(Object, "sharedDocumentController"); + } + + NSDocumentController init () + { + id result = invokeObjcSelf!(id, "init"); + return result is this.objcObject ? this : (result !is null ? new NSDocumentController(result) : null); + } + + this () + { + super(NSDocumentController.alloc.init.objcObject); + } + + NSArray documents () + { + return invokeObjcSelf!(NSArray, "documents"); + } + + Object currentDocument () + { + return invokeObjcSelf!(Object, "currentDocument"); + } + + NSString currentDirectory () + { + return invokeObjcSelf!(NSString, "currentDirectory"); + } + + Object documentForURL (NSURL absoluteURL) + { + return invokeObjcSelf!(Object, "documentForURL:", NSURL)(absoluteURL); + } + + Object documentForWindow (NSWindow window) + { + return invokeObjcSelf!(Object, "documentForWindow:", NSWindow)(window); + } + + void addDocument (NSDocument document) + { + return invokeObjcSelf!(void, "addDocument:", NSDocument)(document); + } + + void removeDocument (NSDocument document) + { + return invokeObjcSelf!(void, "removeDocument:", NSDocument)(document); + } + + void newDocument (Object sender) + { + return invokeObjcSelf!(void, "newDocument:", Object)(sender); + } + + Object openUntitledDocumentAndDisplay (bool displayDocument, ref NSError outError) + { + id error; + + if (outError) + error = new objc_object; + + Object result = invokeObjcSelf!(Object, "openUntitledDocumentAndDisplay:error:", bool, id*)(displayDocument, &error); + + if (error) + outError = new NSError(error); + + return result; + } + + Object makeUntitledDocumentOfType (NSString typeName, ref NSError outError) + { + id error; + + if (outError) + error = new objc_object; + + Object result = invokeObjcSelf!(Object, "makeUntitledDocumentOfType:error:", NSString, id*)(typeName, &error); + + if (error) + outError = new NSError(error); + + return result; + } + + void openDocument (Object sender) + { + return invokeObjcSelf!(void, "openDocument:", Object)(sender); + } + + NSArray URLsFromRunningOpenPanel () + { + return invokeObjcSelf!(NSArray, "URLsFromRunningOpenPanel"); + } + + NSInteger runModalOpenPanel (NSOpenPanel openPanel, NSArray types) + { + return invokeObjcSelf!(NSInteger, "runModalOpenPanel:forTypes:", NSOpenPanel, NSArray)(openPanel, types); + } + + Object openDocumentWithContentsOfURL (NSURL absoluteURL, bool displayDocument, ref NSError outError) + { + id error; + + if (outError) + error = new objc_object; + + Object result = invokeObjcSelf!(Object, "openDocumentWithContentsOfURL:display:error:", NSURL, bool, id*)(absoluteURL, displayDocument, &error); + + if (error) + outError = new NSError(error); + + return result; + } + + Object makeDocumentWithContentsOfURL (NSURL absoluteURL, NSString typeName, ref NSError outError) + { + id error; + + if (outError) + error = new objc_object; + + Object result = invokeObjcSelf!(Object, "makeDocumentWithContentsOfURL:ofType:error:", NSURL, NSString, id*)(absoluteURL, typeName, &error); + + if (error) + outError = new NSError(error); + + return result; + } + + bool reopenDocumentForURL (NSURL absoluteDocumentURL, NSURL absoluteDocumentContentsURL, ref NSError outError) + { + id error; + + if (outError) + error = new objc_object; + + bool result = invokeObjcSelf!(bool, "reopenDocumentForURL:withContentsOfURL:error:", NSURL, NSURL, id*)(absoluteDocumentURL, absoluteDocumentContentsURL, &error); + + if (error) + outError = new NSError(error); + + return result; + } + + Object makeDocumentForURL (NSURL absoluteDocumentURL, NSURL absoluteDocumentContentsURL, NSString typeName, ref NSError outError) + { + id error; + + if (outError) + error = new objc_object; + + Object result = invokeObjcSelf!(Object, "makeDocumentForURL:withContentsOfURL:ofType:error:", NSURL, NSURL, NSString, id*)(absoluteDocumentURL, absoluteDocumentContentsURL, typeName, &error); + + if (error) + outError = new NSError(error); + + return result; + } + + void setAutosavingDelay (double autosavingDelay) + { + return invokeObjcSelf!(void, "setAutosavingDelay:", double)(autosavingDelay); + } + + double autosavingDelay () + { + return invokeObjcSelf!(double, "autosavingDelay"); + } + + void saveAllDocuments (Object sender) + { + return invokeObjcSelf!(void, "saveAllDocuments:", Object)(sender); + } + + bool hasEditedDocuments () + { + return invokeObjcSelf!(bool, "hasEditedDocuments"); + } + + void reviewUnsavedDocumentsWithAlertTitle (NSString title, bool cancellable, Object delegate_, SEL didReviewAllSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "reviewUnsavedDocumentsWithAlertTitle:cancellable:delegate:didReviewAllSelector:contextInfo:", NSString, bool, Object, SEL, void*)(title, cancellable, delegate_, didReviewAllSelector, contextInfo); + } + + void closeAllDocumentsWithDelegate (Object delegate_, SEL didCloseAllSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "closeAllDocumentsWithDelegate:didCloseAllSelector:contextInfo:", Object, SEL, void*)(delegate_, didCloseAllSelector, contextInfo); + } + + void presentError (NSError error, NSWindow window, Object delegate_, SEL didPresentSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "presentError:modalForWindow:delegate:didPresentSelector:contextInfo:", NSError, NSWindow, Object, SEL, void*)(error, window, delegate_, didPresentSelector, contextInfo); + } + + bool presentError (NSError error) + { + return invokeObjcSelf!(bool, "presentError:", NSError)(error); + } + + NSError willPresentError (NSError error) + { + return invokeObjcSelf!(NSError, "willPresentError:", NSError)(error); + } + + NSUInteger maximumRecentDocumentCount () + { + return invokeObjcSelf!(NSUInteger, "maximumRecentDocumentCount"); + } + + void clearRecentDocuments (Object sender) + { + return invokeObjcSelf!(void, "clearRecentDocuments:", Object)(sender); + } + + void noteNewRecentDocument (NSDocument document) + { + return invokeObjcSelf!(void, "noteNewRecentDocument:", NSDocument)(document); + } + + void noteNewRecentDocumentURL (NSURL absoluteURL) + { + return invokeObjcSelf!(void, "noteNewRecentDocumentURL:", NSURL)(absoluteURL); + } + + NSArray recentDocumentURLs () + { + return invokeObjcSelf!(NSArray, "recentDocumentURLs"); + } + + NSString defaultType () + { + return invokeObjcSelf!(NSString, "defaultType"); + } + + NSString typeForContentsOfURL (NSURL inAbsoluteURL, ref NSError outError) + { + id error; + + if (outError) + error = new objc_object; + + NSString result = invokeObjcSelf!(NSString, "typeForContentsOfURL:error:", NSURL, id*)(inAbsoluteURL, &error); + + if (error) + outError = new NSError(error); + + return result; + } + + NSArray documentClassNames () + { + return invokeObjcSelf!(NSArray, "documentClassNames"); + } + + Class documentClassForType (NSString typeName) + { + return invokeObjcSelf!(Class, "documentClassForType:", NSString)(typeName); + } + + NSString displayNameForType (NSString typeName) + { + return invokeObjcSelf!(NSString, "displayNameForType:", NSString)(typeName); + } + + bool validateUserInterfaceItem (INSValidatedUserInterfaceItem anItem) + { + return invokeObjcSelf!(bool, "validateUserInterfaceItem:", INSValidatedUserInterfaceItem)(anItem); + } + + bool validateUserInterfaceItem (INSValidatedUserInterfaceItem anItem) + { + return invokeObjcSelf!(bool, "validateUserInterfaceItem:", INSValidatedUserInterfaceItem)(anItem); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSDocumentScripting.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSDocumentScripting.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,45 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSDocumentScripting; + +import dstep.appkit.NSDocument; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +const TNSScripting = ` + + NSString lastComponentOfFileName () + { + return invokeObjcSelf!(NSString, "lastComponentOfFileName"); + } + + void setLastComponentOfFileName (NSString str) + { + return invokeObjcSelf!(void, "setLastComponentOfFileName:", NSString)(str); + } + + Object handleSaveScriptCommand (NSScriptCommand command) + { + return invokeObjcSelf!(Object, "handleSaveScriptCommand:", NSScriptCommand)(command); + } + + Object handleCloseScriptCommand (NSCloseCommand command) + { + return invokeObjcSelf!(Object, "handleCloseScriptCommand:", NSCloseCommand)(command); + } + + Object handlePrintScriptCommand (NSScriptCommand command) + { + return invokeObjcSelf!(Object, "handlePrintScriptCommand:", NSScriptCommand)(command); + } + + NSScriptObjectSpecifier objectSpecifier () + { + return invokeObjcSelf!(NSScriptObjectSpecifier, "objectSpecifier"); + } +`; \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSDragging.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSDragging.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,148 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSDragging; + +import dstep.appkit.NSImage; +import dstep.appkit.NSPasteboard; +import dstep.appkit.NSWindow; +import dstep.foundation.NSArray; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSURL; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +typedef NSUInteger NSDragOperation; + +enum : NSUInteger +{ + NSDragOperationNone = 0, + NSDragOperationCopy = 1, + NSDragOperationLink = 2, + NSDragOperationGeneric = 4, + NSDragOperationPrivate = 8, + NSDragOperationAll_Obsolete = 15, + NSDragOperationMove = 16, + NSDragOperationDelete = 32, + NSDragOperationEvery = (2147483647L * 2UL + 1UL) +} + +interface INSDraggingInfo +{ + NSWindow draggingDestinationWindow (); + uint draggingSourceOperationMask (); + NSPoint draggingLocation (); + NSPoint draggedImageLocation (); + NSImage draggedImage (); + NSPasteboard draggingPasteboard (); + Object draggingSource (); + NSInteger draggingSequenceNumber (); + void slideDraggedImageTo (NSPoint screenPoint); + NSArray namesOfPromisedFilesDroppedAtDestination (NSURL dropDestination); +} + +const TNSDraggingSource = ` + + uint draggingSourceOperationMaskForLocal (bool flag) + { + return invokeObjcSelf!(uint, "draggingSourceOperationMaskForLocal:", bool)(flag); + } + + NSArray namesOfPromisedFilesDroppedAtDestination (NSURL dropDestination) + { + return invokeObjcSelf!(NSArray, "namesOfPromisedFilesDroppedAtDestination:", NSURL)(dropDestination); + } + + void draggedImage (NSImage image, NSPoint screenPoint) + { + return invokeObjcSelf!(void, "draggedImage:beganAt:", NSImage, NSPoint)(image, screenPoint); + } + + void draggedImage (NSImage image, NSPoint screenPoint, uint operation) + { + return invokeObjcSelf!(void, "draggedImage:endedAt:operation:", NSImage, NSPoint, uint)(image, screenPoint, operation); + } + + void draggedImage (NSImage image, NSPoint screenPoint) + { + return invokeObjcSelf!(void, "draggedImage:movedTo:", NSImage, NSPoint)(image, screenPoint); + } + + bool ignoreModifierKeysWhileDragging () + { + return invokeObjcSelf!(bool, "ignoreModifierKeysWhileDragging"); + } + + void draggedImage (NSImage image, NSPoint screenPoint, bool flag) + { + return invokeObjcSelf!(void, "draggedImage:endedAt:deposited:", NSImage, NSPoint, bool)(image, screenPoint, flag); + } + + //mixin ObjcBindMethod!(draggingSourceOperationMaskForLocal, "draggingSourceOperationMaskForLocal:"); + //mixin ObjcBindMethod!(namesOfPromisedFilesDroppedAtDestination, "namesOfPromisedFilesDroppedAtDestination:"); + //mixin ObjcBindMethod!(draggedImage, "draggedImage:beganAt:"); + //mixin ObjcBindMethod!(draggedImage, "draggedImage:endedAt:operation:"); + //mixin ObjcBindMethod!(draggedImage, "draggedImage:movedTo:"); + //mixin ObjcBindMethod!(ignoreModifierKeysWhileDragging, "ignoreModifierKeysWhileDragging"); + //mixin ObjcBindMethod!(draggedImage, "draggedImage:endedAt:deposited:"); + +`; + +const TNSDraggingDestination = ` + + uint draggingEntered (INSDraggingInfo sender) + { + return invokeObjcSelf!(uint, "draggingEntered:", INSDraggingInfo)(sender); + } + + uint draggingUpdated (INSDraggingInfo sender) + { + return invokeObjcSelf!(uint, "draggingUpdated:", INSDraggingInfo)(sender); + } + + void draggingExited (INSDraggingInfo sender) + { + return invokeObjcSelf!(void, "draggingExited:", INSDraggingInfo)(sender); + } + + bool prepareForDragOperation (INSDraggingInfo sender) + { + return invokeObjcSelf!(bool, "prepareForDragOperation:", INSDraggingInfo)(sender); + } + + bool performDragOperation (INSDraggingInfo sender) + { + return invokeObjcSelf!(bool, "performDragOperation:", INSDraggingInfo)(sender); + } + + void concludeDragOperation (INSDraggingInfo sender) + { + return invokeObjcSelf!(void, "concludeDragOperation:", INSDraggingInfo)(sender); + } + + void draggingEnded (INSDraggingInfo sender) + { + return invokeObjcSelf!(void, "draggingEnded:", INSDraggingInfo)(sender); + } + + bool wantsPeriodicDraggingUpdates () + { + return invokeObjcSelf!(bool, "wantsPeriodicDraggingUpdates"); + } + + //mixin ObjcBindMethod!(draggingEntered, "draggingEntered:"); + //mixin ObjcBindMethod!(draggingUpdated, "draggingUpdated:"); + //mixin ObjcBindMethod!(draggingExited, "draggingExited:"); + //mixin ObjcBindMethod!(prepareForDragOperation, "prepareForDragOperation:"); + //mixin ObjcBindMethod!(performDragOperation, "performDragOperation:"); + //mixin ObjcBindMethod!(concludeDragOperation, "concludeDragOperation:"); + //mixin ObjcBindMethod!(draggingEnded, "draggingEnded:"); + //mixin ObjcBindMethod!(wantsPeriodicDraggingUpdates, "wantsPeriodicDraggingUpdates"); + +`; + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSDrawer.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSDrawer.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,286 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSDrawer; + +import dstep.appkit.AppKitDefines; +import dstep.appkit.NSResponder; +import dstep.appkit.NSView; +import dstep.appkit.NSWindow; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.corefoundation.CFDate; +import dstep.corefoundation.CFRunLoop; +import dstep.foundation.NSArray; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSLock; +import dstep.foundation.NSNotification; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.appkit.NSDrawer_bindings; + +alias NSUInteger NSDrawerState; + +private +{ + NSString NSDrawerWillOpenNotification_; + NSString NSDrawerDidOpenNotification_; + NSString NSDrawerWillCloseNotification_; + NSString NSDrawerDidCloseNotification_; +} + +NSString NSDrawerWillOpenNotification () +{ + if (NSDrawerWillOpenNotification_) + return NSDrawerWillOpenNotification_; + + return NSDrawerWillOpenNotification_ = new NSString(bindings.NSDrawerWillOpenNotification); +} + +NSString NSDrawerDidOpenNotification () +{ + if (NSDrawerDidOpenNotification_) + return NSDrawerDidOpenNotification_; + + return NSDrawerDidOpenNotification_ = new NSString(bindings.NSDrawerDidOpenNotification); +} + +NSString NSDrawerWillCloseNotification () +{ + if (NSDrawerWillCloseNotification_) + return NSDrawerWillCloseNotification_; + + return NSDrawerWillCloseNotification_ = new NSString(bindings.NSDrawerWillCloseNotification); +} + +NSString NSDrawerDidCloseNotification () +{ + if (NSDrawerDidCloseNotification_) + return NSDrawerDidCloseNotification_; + + return NSDrawerDidCloseNotification_ = new NSString(bindings.NSDrawerDidCloseNotification); +} + +enum +{ + NSDrawerClosedState = 0, + NSDrawerOpeningState = 1, + NSDrawerOpenState = 2, + NSDrawerClosingState = 3 +} + +class NSDrawer : NSResponder +{ + mixin (ObjcWrap); + + NSDrawer initWithContentSize (NSSize contentSize, int edge) + { + id result = invokeObjcSelf!(id, "initWithContentSize:preferredEdge:", NSSize, int)(contentSize, edge); + return result is this.objcObject ? this : (result !is null ? new NSDrawer(result) : null); + } + + this (NSSize contentSize, int edge) + { + super(NSDrawer.alloc.initWithContentSize(contentSize, edge).objcObject); + } + + void setParentWindow (NSWindow parent) + { + return invokeObjcSelf!(void, "setParentWindow:", NSWindow)(parent); + } + + NSWindow parentWindow () + { + return invokeObjcSelf!(NSWindow, "parentWindow"); + } + + void setContentView (NSView aView) + { + return invokeObjcSelf!(void, "setContentView:", NSView)(aView); + } + + NSView contentView () + { + return invokeObjcSelf!(NSView, "contentView"); + } + + void setPreferredEdge (int edge) + { + return invokeObjcSelf!(void, "setPreferredEdge:", int)(edge); + } + + int preferredEdge () + { + return invokeObjcSelf!(int, "preferredEdge"); + } + + void setDelegate (Object anObject) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(anObject); + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + void open () + { + return invokeObjcSelf!(void, "open"); + } + + void openOnEdge (int edge) + { + return invokeObjcSelf!(void, "openOnEdge:", int)(edge); + } + + void close () + { + return invokeObjcSelf!(void, "close"); + } + + void open (Object sender) + { + return invokeObjcSelf!(void, "open:", Object)(sender); + } + + void close (Object sender) + { + return invokeObjcSelf!(void, "close:", Object)(sender); + } + + void toggle (Object sender) + { + return invokeObjcSelf!(void, "toggle:", Object)(sender); + } + + NSInteger state () + { + return invokeObjcSelf!(NSInteger, "state"); + } + + int edge () + { + return invokeObjcSelf!(int, "edge"); + } + + void setContentSize (NSSize size) + { + return invokeObjcSelf!(void, "setContentSize:", NSSize)(size); + } + + NSSize contentSize () + { + return invokeObjcSelf!(NSSize, "contentSize"); + } + + void setMinContentSize (NSSize size) + { + return invokeObjcSelf!(void, "setMinContentSize:", NSSize)(size); + } + + NSSize minContentSize () + { + return invokeObjcSelf!(NSSize, "minContentSize"); + } + + void setMaxContentSize (NSSize size) + { + return invokeObjcSelf!(void, "setMaxContentSize:", NSSize)(size); + } + + NSSize maxContentSize () + { + return invokeObjcSelf!(NSSize, "maxContentSize"); + } + + void setLeadingOffset (CGFloat offset) + { + return invokeObjcSelf!(void, "setLeadingOffset:", CGFloat)(offset); + } + + CGFloat leadingOffset () + { + return invokeObjcSelf!(CGFloat, "leadingOffset"); + } + + void setTrailingOffset (CGFloat offset) + { + return invokeObjcSelf!(void, "setTrailingOffset:", CGFloat)(offset); + } + + CGFloat trailingOffset () + { + return invokeObjcSelf!(CGFloat, "trailingOffset"); + } +} + +const TDrawers = ` + + NSArray drawers () + { + return invokeObjcSelf!(NSArray, "drawers"); + } + + //mixin ObjcBindMethod!(drawers, "drawers"); + +`; + +const TNSDrawerDelegate = ` + + bool drawerShouldOpen (NSDrawer sender) + { + return invokeObjcSelf!(bool, "drawerShouldOpen:", NSDrawer)(sender); + } + + bool drawerShouldClose (NSDrawer sender) + { + return invokeObjcSelf!(bool, "drawerShouldClose:", NSDrawer)(sender); + } + + NSSize drawerWillResizeContents (NSDrawer sender, NSSize contentSize) + { + return invokeObjcSelf!(NSSize, "drawerWillResizeContents:toSize:", NSDrawer, NSSize)(sender, contentSize); + } + + //mixin ObjcBindMethod!(drawerShouldOpen, "drawerShouldOpen:"); + //mixin ObjcBindMethod!(drawerShouldClose, "drawerShouldClose:"); + //mixin ObjcBindMethod!(drawerWillResizeContents, "drawerWillResizeContents:toSize:"); + +`; + +const TNSDrawerNotifications = ` + + void drawerWillOpen (NSNotification notification) + { + return invokeObjcSelf!(void, "drawerWillOpen:", NSNotification)(notification); + } + + void drawerDidOpen (NSNotification notification) + { + return invokeObjcSelf!(void, "drawerDidOpen:", NSNotification)(notification); + } + + void drawerWillClose (NSNotification notification) + { + return invokeObjcSelf!(void, "drawerWillClose:", NSNotification)(notification); + } + + void drawerDidClose (NSNotification notification) + { + return invokeObjcSelf!(void, "drawerDidClose:", NSNotification)(notification); + } + + //mixin ObjcBindMethod!(drawerWillOpen, "drawerWillOpen:"); + //mixin ObjcBindMethod!(drawerDidOpen, "drawerDidOpen:"); + //mixin ObjcBindMethod!(drawerWillClose, "drawerWillClose:"); + //mixin ObjcBindMethod!(drawerDidClose, "drawerDidClose:"); + +`; + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSDrawer_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSDrawer_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,21 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSDrawer_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package id NSDrawerWillOpenNotification; + package id NSDrawerDidOpenNotification; + package id NSDrawerWillCloseNotification; + package id NSDrawerDidCloseNotification; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSEPSImageRep.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSEPSImageRep.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,51 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSEPSImageRep; + +import dstep.appkit.NSImageRep; +import dstep.appkit.NSPDFImageRep; +import dstep.foundation.NSData; +import dstep.foundation.NSGeometry; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSEPSImageRep : NSImageRep +{ + mixin (ObjcWrap); + + static Object imageRepWithData (NSData epsData) + { + return invokeObjcSelfClass!(Object, "imageRepWithData:", NSData)(epsData); + } + + NSEPSImageRep initWithData (NSData epsData) + { + id result = invokeObjcSelf!(id, "initWithData:", NSData)(epsData); + return result is this.objcObject ? this : (result !is null ? new NSEPSImageRep(result) : null); + } + + this (NSData epsData) + { + super(NSEPSImageRep.alloc.initWithData(epsData).objcObject); + } + + void prepareGState () + { + return invokeObjcSelf!(void, "prepareGState"); + } + + NSData EPSRepresentation () + { + return invokeObjcSelf!(NSData, "EPSRepresentation"); + } + + NSRect boundingBox () + { + return invokeObjcSelf!(NSRect, "boundingBox"); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSErrors.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSErrors.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,343 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSErrors; + +import dstep.appkit.AppKitDefines; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.appkit.NSErrors_bindings; + +private +{ + NSString NSTextLineTooLongException_; + NSString NSTextNoSelectionException_; + NSString NSWordTablesWriteException_; + NSString NSWordTablesReadException_; + NSString NSTextReadException_; + NSString NSTextWriteException_; + NSString NSPasteboardCommunicationException_; + NSString NSPrintingCommunicationException_; + NSString NSAbortModalException_; + NSString NSAbortPrintingException_; + NSString NSIllegalSelectorException_; + NSString NSAppKitVirtualMemoryException_; + NSString NSBadRTFDirectiveException_; + NSString NSBadRTFFontTableException_; + NSString NSBadRTFStyleSheetException_; + NSString NSTypedStreamVersionException_; + NSString NSTIFFException_; + NSString NSPrintPackageException_; + NSString NSBadRTFColorTableException_; + NSString NSDraggingException_; + NSString NSColorListIOException_; + NSString NSColorListNotEditableException_; + NSString NSBadBitmapParametersException_; + NSString NSWindowServerCommunicationException_; + NSString NSFontUnavailableException_; + NSString NSPPDIncludeNotFoundException_; + NSString NSPPDParseException_; + NSString NSPPDIncludeStackOverflowException_; + NSString NSPPDIncludeStackUnderflowException_; + NSString NSRTFPropertyStackOverflowException_; + NSString NSAppKitIgnoredException_; + NSString NSBadComparisonException_; + NSString NSImageCacheException_; + NSString NSNibLoadingException_; + NSString NSBrowserIllegalDelegateException_; + NSString NSAccessibilityException_; +} + +NSString NSTextLineTooLongException () +{ + if (NSTextLineTooLongException_) + return NSTextLineTooLongException_; + + return NSTextLineTooLongException_ = new NSString(bindings.NSTextLineTooLongException); +} + +NSString NSTextNoSelectionException () +{ + if (NSTextNoSelectionException_) + return NSTextNoSelectionException_; + + return NSTextNoSelectionException_ = new NSString(bindings.NSTextNoSelectionException); +} + +NSString NSWordTablesWriteException () +{ + if (NSWordTablesWriteException_) + return NSWordTablesWriteException_; + + return NSWordTablesWriteException_ = new NSString(bindings.NSWordTablesWriteException); +} + +NSString NSWordTablesReadException () +{ + if (NSWordTablesReadException_) + return NSWordTablesReadException_; + + return NSWordTablesReadException_ = new NSString(bindings.NSWordTablesReadException); +} + +NSString NSTextReadException () +{ + if (NSTextReadException_) + return NSTextReadException_; + + return NSTextReadException_ = new NSString(bindings.NSTextReadException); +} + +NSString NSTextWriteException () +{ + if (NSTextWriteException_) + return NSTextWriteException_; + + return NSTextWriteException_ = new NSString(bindings.NSTextWriteException); +} + +NSString NSPasteboardCommunicationException () +{ + if (NSPasteboardCommunicationException_) + return NSPasteboardCommunicationException_; + + return NSPasteboardCommunicationException_ = new NSString(bindings.NSPasteboardCommunicationException); +} + +NSString NSPrintingCommunicationException () +{ + if (NSPrintingCommunicationException_) + return NSPrintingCommunicationException_; + + return NSPrintingCommunicationException_ = new NSString(bindings.NSPrintingCommunicationException); +} + +NSString NSAbortModalException () +{ + if (NSAbortModalException_) + return NSAbortModalException_; + + return NSAbortModalException_ = new NSString(bindings.NSAbortModalException); +} + +NSString NSAbortPrintingException () +{ + if (NSAbortPrintingException_) + return NSAbortPrintingException_; + + return NSAbortPrintingException_ = new NSString(bindings.NSAbortPrintingException); +} + +NSString NSIllegalSelectorException () +{ + if (NSIllegalSelectorException_) + return NSIllegalSelectorException_; + + return NSIllegalSelectorException_ = new NSString(bindings.NSIllegalSelectorException); +} + +NSString NSAppKitVirtualMemoryException () +{ + if (NSAppKitVirtualMemoryException_) + return NSAppKitVirtualMemoryException_; + + return NSAppKitVirtualMemoryException_ = new NSString(bindings.NSAppKitVirtualMemoryException); +} + +NSString NSBadRTFDirectiveException () +{ + if (NSBadRTFDirectiveException_) + return NSBadRTFDirectiveException_; + + return NSBadRTFDirectiveException_ = new NSString(bindings.NSBadRTFDirectiveException); +} + +NSString NSBadRTFFontTableException () +{ + if (NSBadRTFFontTableException_) + return NSBadRTFFontTableException_; + + return NSBadRTFFontTableException_ = new NSString(bindings.NSBadRTFFontTableException); +} + +NSString NSBadRTFStyleSheetException () +{ + if (NSBadRTFStyleSheetException_) + return NSBadRTFStyleSheetException_; + + return NSBadRTFStyleSheetException_ = new NSString(bindings.NSBadRTFStyleSheetException); +} + +NSString NSTypedStreamVersionException () +{ + if (NSTypedStreamVersionException_) + return NSTypedStreamVersionException_; + + return NSTypedStreamVersionException_ = new NSString(bindings.NSTypedStreamVersionException); +} + +NSString NSTIFFException () +{ + if (NSTIFFException_) + return NSTIFFException_; + + return NSTIFFException_ = new NSString(bindings.NSTIFFException); +} + +NSString NSPrintPackageException () +{ + if (NSPrintPackageException_) + return NSPrintPackageException_; + + return NSPrintPackageException_ = new NSString(bindings.NSPrintPackageException); +} + +NSString NSBadRTFColorTableException () +{ + if (NSBadRTFColorTableException_) + return NSBadRTFColorTableException_; + + return NSBadRTFColorTableException_ = new NSString(bindings.NSBadRTFColorTableException); +} + +NSString NSDraggingException () +{ + if (NSDraggingException_) + return NSDraggingException_; + + return NSDraggingException_ = new NSString(bindings.NSDraggingException); +} + +NSString NSColorListIOException () +{ + if (NSColorListIOException_) + return NSColorListIOException_; + + return NSColorListIOException_ = new NSString(bindings.NSColorListIOException); +} + +NSString NSColorListNotEditableException () +{ + if (NSColorListNotEditableException_) + return NSColorListNotEditableException_; + + return NSColorListNotEditableException_ = new NSString(bindings.NSColorListNotEditableException); +} + +NSString NSBadBitmapParametersException () +{ + if (NSBadBitmapParametersException_) + return NSBadBitmapParametersException_; + + return NSBadBitmapParametersException_ = new NSString(bindings.NSBadBitmapParametersException); +} + +NSString NSWindowServerCommunicationException () +{ + if (NSWindowServerCommunicationException_) + return NSWindowServerCommunicationException_; + + return NSWindowServerCommunicationException_ = new NSString(bindings.NSWindowServerCommunicationException); +} + +NSString NSFontUnavailableException () +{ + if (NSFontUnavailableException_) + return NSFontUnavailableException_; + + return NSFontUnavailableException_ = new NSString(bindings.NSFontUnavailableException); +} + +NSString NSPPDIncludeNotFoundException () +{ + if (NSPPDIncludeNotFoundException_) + return NSPPDIncludeNotFoundException_; + + return NSPPDIncludeNotFoundException_ = new NSString(bindings.NSPPDIncludeNotFoundException); +} + +NSString NSPPDParseException () +{ + if (NSPPDParseException_) + return NSPPDParseException_; + + return NSPPDParseException_ = new NSString(bindings.NSPPDParseException); +} + +NSString NSPPDIncludeStackOverflowException () +{ + if (NSPPDIncludeStackOverflowException_) + return NSPPDIncludeStackOverflowException_; + + return NSPPDIncludeStackOverflowException_ = new NSString(bindings.NSPPDIncludeStackOverflowException); +} + +NSString NSPPDIncludeStackUnderflowException () +{ + if (NSPPDIncludeStackUnderflowException_) + return NSPPDIncludeStackUnderflowException_; + + return NSPPDIncludeStackUnderflowException_ = new NSString(bindings.NSPPDIncludeStackUnderflowException); +} + +NSString NSRTFPropertyStackOverflowException () +{ + if (NSRTFPropertyStackOverflowException_) + return NSRTFPropertyStackOverflowException_; + + return NSRTFPropertyStackOverflowException_ = new NSString(bindings.NSRTFPropertyStackOverflowException); +} + +NSString NSAppKitIgnoredException () +{ + if (NSAppKitIgnoredException_) + return NSAppKitIgnoredException_; + + return NSAppKitIgnoredException_ = new NSString(bindings.NSAppKitIgnoredException); +} + +NSString NSBadComparisonException () +{ + if (NSBadComparisonException_) + return NSBadComparisonException_; + + return NSBadComparisonException_ = new NSString(bindings.NSBadComparisonException); +} + +NSString NSImageCacheException () +{ + if (NSImageCacheException_) + return NSImageCacheException_; + + return NSImageCacheException_ = new NSString(bindings.NSImageCacheException); +} + +NSString NSNibLoadingException () +{ + if (NSNibLoadingException_) + return NSNibLoadingException_; + + return NSNibLoadingException_ = new NSString(bindings.NSNibLoadingException); +} + +NSString NSBrowserIllegalDelegateException () +{ + if (NSBrowserIllegalDelegateException_) + return NSBrowserIllegalDelegateException_; + + return NSBrowserIllegalDelegateException_ = new NSString(bindings.NSBrowserIllegalDelegateException); +} + +NSString NSAccessibilityException () +{ + if (NSAccessibilityException_) + return NSAccessibilityException_; + + return NSAccessibilityException_ = new NSString(bindings.NSAccessibilityException); +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSErrors_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSErrors_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,53 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSErrors_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package id NSTextLineTooLongException; + package id NSTextNoSelectionException; + package id NSWordTablesWriteException; + package id NSWordTablesReadException; + package id NSTextReadException; + package id NSTextWriteException; + package id NSPasteboardCommunicationException; + package id NSPrintingCommunicationException; + package id NSAbortModalException; + package id NSAbortPrintingException; + package id NSIllegalSelectorException; + package id NSAppKitVirtualMemoryException; + package id NSBadRTFDirectiveException; + package id NSBadRTFFontTableException; + package id NSBadRTFStyleSheetException; + package id NSTypedStreamVersionException; + package id NSTIFFException; + package id NSPrintPackageException; + package id NSBadRTFColorTableException; + package id NSDraggingException; + package id NSColorListIOException; + package id NSColorListNotEditableException; + package id NSBadBitmapParametersException; + package id NSWindowServerCommunicationException; + package id NSFontUnavailableException; + package id NSPPDIncludeNotFoundException; + package id NSPPDParseException; + package id NSPPDIncludeStackOverflowException; + package id NSPPDIncludeStackUnderflowException; + package id NSRTFPropertyStackOverflowException; + package id NSAppKitIgnoredException; + package id NSBadComparisonException; + package id NSImageCacheException; + package id NSNibLoadingException; + package id NSBrowserIllegalDelegateException; + package id NSAccessibilityException; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSEvent.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSEvent.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,533 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSEvent; + +import dstep.appkit.NSGraphicsContext; +import dstep.appkit.NSTrackingArea; +import dstep.appkit.NSWindow; +import dstep.applicationservices.ApplicationServices; +import dstep.foundation.NSCoder; +import dstep.foundation.NSDate; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSZone; +//import dstep.iokit.hidsystem.IOLLEvent; +import dstep.internal.Version; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +typedef NSUInteger NSEventType; +typedef NSUInteger NSPointingDeviceType; + +enum : NSUInteger +{ + NSLeftMouseDown = 1, + NSLeftMouseUp = 2, + NSRightMouseDown = 3, + NSRightMouseUp = 4, + NSMouseMoved = 5, + NSLeftMouseDragged = 6, + NSRightMouseDragged = 7, + NSMouseEntered = 8, + NSMouseExited = 9, + NSKeyDown = 10, + NSKeyUp = 11, + NSFlagsChanged = 12, + NSAppKitDefined = 13, + NSSystemDefined = 14, + NSApplicationDefined = 15, + NSPeriodic = 16, + NSCursorUpdate = 17, + NSScrollWheel = 22, + NSTabletPoint = 23, + NSTabletProximity = 24, + NSOtherMouseDown = 25, + NSOtherMouseUp = 26, + NSOtherMouseDragged = 27 +} + +enum : NSUInteger +{ + NSLeftMouseDownMask = 1 << NSLeftMouseDown, + NSLeftMouseUpMask = 1 << NSLeftMouseUp, + NSRightMouseDownMask = 1 << NSRightMouseDown, + NSRightMouseUpMask = 1 << NSRightMouseUp, + NSMouseMovedMask = 1 << NSMouseMoved, + NSLeftMouseDraggedMask = 1 << NSLeftMouseDragged, + NSRightMouseDraggedMask = 1 << NSRightMouseDragged, + NSMouseEnteredMask = 1 << NSMouseEntered, + NSMouseExitedMask = 1 << NSMouseExited, + NSKeyDownMask = 1 << NSKeyDown, + NSKeyUpMask = 1 << NSKeyUp, + NSFlagsChangedMask = 1 << NSFlagsChanged, + NSAppKitDefinedMask = 1 << NSAppKitDefined, + NSSystemDefinedMask = 1 << NSSystemDefined, + NSApplicationDefinedMask = 1 << NSApplicationDefined, + NSPeriodicMask = 1 << NSPeriodic, + NSCursorUpdateMask = 1 << NSCursorUpdate, + NSScrollWheelMask = 1 << NSScrollWheel, + NSTabletPointMask = 1 << NSTabletPoint, + NSTabletProximityMask = 1 << NSTabletProximity, + NSOtherMouseDownMask = 1 << NSOtherMouseDown, + NSOtherMouseUpMask = 1 << NSOtherMouseUp, + NSOtherMouseDraggedMask = 1 << NSOtherMouseDragged, + NSAnyEventMask = (2147483647L * 2UL + 1UL) +} + +version (D_LP64) +{ + enum : ulong + { + NSAlphaShiftKeyMask = 1 << 16, + NSShiftKeyMask = 1 << 17, + NSControlKeyMask = 1 << 18, + NSAlternateKeyMask = 1 << 19, + NSCommandKeyMask = 1 << 20, + NSNumericPadKeyMask = 1 << 21, + NSHelpKeyMask = 1 << 22, + NSFunctionKeyMask = 1 << 23, + NSDeviceIndependentModifierFlagsMask = 0xffff0000UL + } +} + +else +{ + enum : uint + { + NSAlphaShiftKeyMask = 1 << 16, + NSShiftKeyMask = 1 << 17, + NSControlKeyMask = 1 << 18, + NSAlternateKeyMask = 1 << 19, + NSCommandKeyMask = 1 << 20, + NSNumericPadKeyMask = 1 << 21, + NSHelpKeyMask = 1 << 22, + NSFunctionKeyMask = 1 << 23, + NSDeviceIndependentModifierFlagsMask = 0xffff0000U + } +} + +enum +{ + NSUnknownPointingDevice = 0, + NSPenPointingDevice = 1, + NSCursorPointingDevice = 2, + NSEraserPointingDevice = 3 +} + +enum +{ + NSPenTipMask = 0x0001, + NSPenLowerSideMask = 0x0002, + NSPenUpperSideMask = 0x0004 +} + +enum +{ + NSUpArrowFunctionKey = 0xF700, + NSDownArrowFunctionKey = 0xF701, + NSLeftArrowFunctionKey = 0xF702, + NSRightArrowFunctionKey = 0xF703, + NSF1FunctionKey = 0xF704, + NSF2FunctionKey = 0xF705, + NSF3FunctionKey = 0xF706, + NSF4FunctionKey = 0xF707, + NSF5FunctionKey = 0xF708, + NSF6FunctionKey = 0xF709, + NSF7FunctionKey = 0xF70A, + NSF8FunctionKey = 0xF70B, + NSF9FunctionKey = 0xF70C, + NSF10FunctionKey = 0xF70D, + NSF11FunctionKey = 0xF70E, + NSF12FunctionKey = 0xF70F, + NSF13FunctionKey = 0xF710, + NSF14FunctionKey = 0xF711, + NSF15FunctionKey = 0xF712, + NSF16FunctionKey = 0xF713, + NSF17FunctionKey = 0xF714, + NSF18FunctionKey = 0xF715, + NSF19FunctionKey = 0xF716, + NSF20FunctionKey = 0xF717, + NSF21FunctionKey = 0xF718, + NSF22FunctionKey = 0xF719, + NSF23FunctionKey = 0xF71A, + NSF24FunctionKey = 0xF71B, + NSF25FunctionKey = 0xF71C, + NSF26FunctionKey = 0xF71D, + NSF27FunctionKey = 0xF71E, + NSF28FunctionKey = 0xF71F, + NSF29FunctionKey = 0xF720, + NSF30FunctionKey = 0xF721, + NSF31FunctionKey = 0xF722, + NSF32FunctionKey = 0xF723, + NSF33FunctionKey = 0xF724, + NSF34FunctionKey = 0xF725, + NSF35FunctionKey = 0xF726, + NSInsertFunctionKey = 0xF727, + NSDeleteFunctionKey = 0xF728, + NSHomeFunctionKey = 0xF729, + NSBeginFunctionKey = 0xF72A, + NSEndFunctionKey = 0xF72B, + NSPageUpFunctionKey = 0xF72C, + NSPageDownFunctionKey = 0xF72D, + NSPrintScreenFunctionKey = 0xF72E, + NSScrollLockFunctionKey = 0xF72F, + NSPauseFunctionKey = 0xF730, + NSSysReqFunctionKey = 0xF731, + NSBreakFunctionKey = 0xF732, + NSResetFunctionKey = 0xF733, + NSStopFunctionKey = 0xF734, + NSMenuFunctionKey = 0xF735, + NSUserFunctionKey = 0xF736, + NSSystemFunctionKey = 0xF737, + NSPrintFunctionKey = 0xF738, + NSClearLineFunctionKey = 0xF739, + NSClearDisplayFunctionKey = 0xF73A, + NSInsertLineFunctionKey = 0xF73B, + NSDeleteLineFunctionKey = 0xF73C, + NSInsertCharFunctionKey = 0xF73D, + NSDeleteCharFunctionKey = 0xF73E, + NSPrevFunctionKey = 0xF73F, + NSNextFunctionKey = 0xF740, + NSSelectFunctionKey = 0xF741, + NSExecuteFunctionKey = 0xF742, + NSUndoFunctionKey = 0xF743, + NSRedoFunctionKey = 0xF744, + NSFindFunctionKey = 0xF745, + NSHelpFunctionKey = 0xF746, + NSModeSwitchFunctionKey = 0xF747 +} + +enum +{ + NSWindowExposedEventType = 0, + NSApplicationActivatedEventType = 1, + NSApplicationDeactivatedEventType = 2, + NSWindowMovedEventType = 4, + NSScreenChangedEventType = 8, + NSAWTEventType = 16 +} + +enum +{ + NSPowerOffEventType = 1 +} + +enum +{ + NSMouseEventSubtype = 0, + NSTabletPointEventSubtype = 1, + NSTabletProximityEventSubtype = 2 +} + +class NSEvent : NSObject, INSCopying, INSCoding +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + typeof(this) copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); + } + + uint type () + { + return invokeObjcSelf!(uint, "type"); + } + + NSUInteger modifierFlags () + { + return invokeObjcSelf!(NSUInteger, "modifierFlags"); + } + + double timestamp () + { + return invokeObjcSelf!(double, "timestamp"); + } + + NSWindow window () + { + return invokeObjcSelf!(NSWindow, "window"); + } + + NSInteger windowNumber () + { + return invokeObjcSelf!(NSInteger, "windowNumber"); + } + + NSGraphicsContext context () + { + return invokeObjcSelf!(NSGraphicsContext, "context"); + } + + NSInteger clickCount () + { + return invokeObjcSelf!(NSInteger, "clickCount"); + } + + NSInteger buttonNumber () + { + return invokeObjcSelf!(NSInteger, "buttonNumber"); + } + + NSInteger eventNumber () + { + return invokeObjcSelf!(NSInteger, "eventNumber"); + } + + float pressure () + { + return invokeObjcSelf!(float, "pressure"); + } + + NSPoint locationInWindow () + { + return invokeObjcSelf!(NSPoint, "locationInWindow"); + } + + CGFloat deltaX () + { + return invokeObjcSelf!(CGFloat, "deltaX"); + } + + CGFloat deltaY () + { + return invokeObjcSelf!(CGFloat, "deltaY"); + } + + CGFloat deltaZ () + { + return invokeObjcSelf!(CGFloat, "deltaZ"); + } + + NSString characters () + { + return invokeObjcSelf!(NSString, "characters"); + } + + NSString charactersIgnoringModifiers () + { + return invokeObjcSelf!(NSString, "charactersIgnoringModifiers"); + } + + bool isARepeat () + { + return invokeObjcSelf!(bool, "isARepeat"); + } + + ushort keyCode () + { + return invokeObjcSelf!(ushort, "keyCode"); + } + + NSInteger trackingNumber () + { + return invokeObjcSelf!(NSInteger, "trackingNumber"); + } + + void* userData () + { + return invokeObjcSelf!(void*, "userData"); + } + + NSTrackingArea trackingArea () + { + return invokeObjcSelf!(NSTrackingArea, "trackingArea"); + } + + short subtype () + { + return invokeObjcSelf!(short, "subtype"); + } + + NSInteger data1 () + { + return invokeObjcSelf!(NSInteger, "data1"); + } + + NSInteger data2 () + { + return invokeObjcSelf!(NSInteger, "data2"); + } + + void* eventRef () + { + return invokeObjcSelf!(void*, "eventRef"); + } + + static NSEvent eventWithEventRef (void* eventRef) + { + return invokeObjcSelfClass!(NSEvent, "eventWithEventRef:", void*)(eventRef); + } + + CGEventRef CGEvent () + { + return invokeObjcSelf!(CGEventRef, "CGEvent"); + } + + static NSEvent eventWithCGEvent (CGEventRef cgEvent) + { + return invokeObjcSelfClass!(NSEvent, "eventWithCGEvent:", CGEventRef)(cgEvent); + } + + static void setMouseCoalescingEnabled (bool flag) + { + return invokeObjcSelfClass!(void, "setMouseCoalescingEnabled:", bool)(flag); + } + + static bool isMouseCoalescingEnabled () + { + return invokeObjcSelfClass!(bool, "isMouseCoalescingEnabled"); + } + + NSUInteger deviceID () + { + return invokeObjcSelf!(NSUInteger, "deviceID"); + } + + NSInteger absoluteX () + { + return invokeObjcSelf!(NSInteger, "absoluteX"); + } + + NSInteger absoluteY () + { + return invokeObjcSelf!(NSInteger, "absoluteY"); + } + + NSInteger absoluteZ () + { + return invokeObjcSelf!(NSInteger, "absoluteZ"); + } + + NSUInteger buttonMask () + { + return invokeObjcSelf!(NSUInteger, "buttonMask"); + } + + NSPoint tilt () + { + return invokeObjcSelf!(NSPoint, "tilt"); + } + + float rotation () + { + return invokeObjcSelf!(float, "rotation"); + } + + float tangentialPressure () + { + return invokeObjcSelf!(float, "tangentialPressure"); + } + + Object vendorDefined () + { + return invokeObjcSelf!(Object, "vendorDefined"); + } + + NSUInteger vendorID () + { + return invokeObjcSelf!(NSUInteger, "vendorID"); + } + + NSUInteger tabletID () + { + return invokeObjcSelf!(NSUInteger, "tabletID"); + } + + NSUInteger pointingDeviceID () + { + return invokeObjcSelf!(NSUInteger, "pointingDeviceID"); + } + + NSUInteger systemTabletID () + { + return invokeObjcSelf!(NSUInteger, "systemTabletID"); + } + + NSUInteger vendorPointingDeviceType () + { + return invokeObjcSelf!(NSUInteger, "vendorPointingDeviceType"); + } + + NSUInteger pointingDeviceSerialNumber () + { + return invokeObjcSelf!(NSUInteger, "pointingDeviceSerialNumber"); + } + + ulong uniqueID () + { + return invokeObjcSelf!(ulong, "uniqueID"); + } + + NSUInteger capabilityMask () + { + return invokeObjcSelf!(NSUInteger, "capabilityMask"); + } + + uint pointingDeviceType () + { + return invokeObjcSelf!(uint, "pointingDeviceType"); + } + + bool isEnteringProximity () + { + return invokeObjcSelf!(bool, "isEnteringProximity"); + } + + static void startPeriodicEventsAfterDelay (double delay, double period) + { + return invokeObjcSelfClass!(void, "startPeriodicEventsAfterDelay:withPeriod:", double, double)(delay, period); + } + + static void stopPeriodicEvents () + { + return invokeObjcSelfClass!(void, "stopPeriodicEvents"); + } + + static NSEvent mouseEventWithType (uint type, NSPoint location, NSUInteger flags, double time, NSInteger wNum, NSGraphicsContext context, NSInteger eNum, NSInteger cNum, float pressure) + { + return invokeObjcSelfClass!(NSEvent, "mouseEventWithType:location:modifierFlags:timestamp:windowNumber:context:eventNumber:clickCount:pressure:", uint, NSPoint, NSUInteger, double, NSInteger, NSGraphicsContext, NSInteger, NSInteger, float)(type, location, flags, time, wNum, context, eNum, cNum, pressure); + } + + static NSEvent keyEventWithType (uint type, NSPoint location, NSUInteger flags, double time, NSInteger wNum, NSGraphicsContext context, NSString keys, NSString ukeys, bool flag, ushort code) + { + return invokeObjcSelfClass!(NSEvent, "keyEventWithType:location:modifierFlags:timestamp:windowNumber:context:characters:charactersIgnoringModifiers:isARepeat:keyCode:", uint, NSPoint, NSUInteger, double, NSInteger, NSGraphicsContext, NSString, NSString, bool, ushort)(type, location, flags, time, wNum, context, keys, ukeys, flag, code); + } + + static NSEvent enterExitEventWithType (uint type, NSPoint location, NSUInteger flags, double time, NSInteger wNum, NSGraphicsContext context, NSInteger eNum, NSInteger tNum, void* data) + { + return invokeObjcSelfClass!(NSEvent, "enterExitEventWithType:location:modifierFlags:timestamp:windowNumber:context:eventNumber:trackingNumber:userData:", uint, NSPoint, NSUInteger, double, NSInteger, NSGraphicsContext, NSInteger, NSInteger, void*)(type, location, flags, time, wNum, context, eNum, tNum, data); + } + + static NSEvent otherEventWithType (uint type, NSPoint location, NSUInteger flags, double time, NSInteger wNum, NSGraphicsContext context, short subtype, NSInteger d1, NSInteger d2) + { + return invokeObjcSelfClass!(NSEvent, "otherEventWithType:location:modifierFlags:timestamp:windowNumber:context:subtype:data1:data2:", uint, NSPoint, NSUInteger, double, NSInteger, NSGraphicsContext, short, NSInteger, NSInteger)(type, location, flags, time, wNum, context, subtype, d1, d2); + } + + static NSPoint mouseLocation () + { + return invokeObjcSelfClass!(NSPoint, "mouseLocation"); + } + +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSFileWrapper.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSFileWrapper.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,213 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSFileWrapper; + +import dstep.appkit.NSImage; +import dstep.foundation.NSCoder; +import dstep.foundation.NSData; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSFileWrapper : NSObject, INSCoding +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + NSFileWrapper initDirectoryWithFileWrappers (NSDictionary docs) + { + id result = invokeObjcSelf!(id, "initDirectoryWithFileWrappers:", NSDictionary)(docs); + return result is this.objcObject ? this : (result !is null ? new NSFileWrapper(result) : null); + } + + this (NSDictionary docs) + { + super(NSFileWrapper.alloc.initDirectoryWithFileWrappers(docs).objcObject); + } + + NSFileWrapper initRegularFileWithContents (NSData data) + { + id result = invokeObjcSelf!(id, "initRegularFileWithContents:", NSData)(data); + return result is this.objcObject ? this : (result !is null ? new NSFileWrapper(result) : null); + } + + this (NSData data) + { + super(NSFileWrapper.alloc.initRegularFileWithContents(data).objcObject); + } + + NSFileWrapper initSymbolicLinkWithDestination (NSString path) + { + id result = invokeObjcSelf!(id, "initSymbolicLinkWithDestination:", NSString)(path); + return result is this.objcObject ? this : (result !is null ? new NSFileWrapper(result) : null); + } + + this (NSString path) + { + super(NSFileWrapper.alloc.initSymbolicLinkWithDestination(path).objcObject); + } + + NSFileWrapper initWithPath (NSString path) + { + id result = invokeObjcSelf!(id, "initWithPath:", NSString)(path); + return result is this.objcObject ? this : (result !is null ? new NSFileWrapper(result) : null); + } + + this (NSString path) + { + super(NSFileWrapper.alloc.initWithPath(path).objcObject); + } + + NSFileWrapper initWithSerializedRepresentation (NSData data) + { + id result = invokeObjcSelf!(id, "initWithSerializedRepresentation:", NSData)(data); + return result is this.objcObject ? this : (result !is null ? new NSFileWrapper(result) : null); + } + + this (NSData data) + { + super(NSFileWrapper.alloc.initWithSerializedRepresentation(data).objcObject); + } + + bool writeToFile (NSString path, bool atomicFlag, bool updateFilenamesFlag) + { + return invokeObjcSelf!(bool, "writeToFile:atomically:updateFilenames:", NSString, bool, bool)(path, atomicFlag, updateFilenamesFlag); + } + + NSData serializedRepresentation () + { + return invokeObjcSelf!(NSData, "serializedRepresentation"); + } + + void setFilename (NSString filename) + { + return invokeObjcSelf!(void, "setFilename:", NSString)(filename); + } + + NSString filename () + { + return invokeObjcSelf!(NSString, "filename"); + } + + void setPreferredFilename (NSString filename) + { + return invokeObjcSelf!(void, "setPreferredFilename:", NSString)(filename); + } + + NSString preferredFilename () + { + return invokeObjcSelf!(NSString, "preferredFilename"); + } + + void setFileAttributes (NSDictionary attributes) + { + return invokeObjcSelf!(void, "setFileAttributes:", NSDictionary)(attributes); + } + + NSDictionary fileAttributes () + { + return invokeObjcSelf!(NSDictionary, "fileAttributes"); + } + + bool isRegularFile () + { + return invokeObjcSelf!(bool, "isRegularFile"); + } + + bool isDirectory () + { + return invokeObjcSelf!(bool, "isDirectory"); + } + + bool isSymbolicLink () + { + return invokeObjcSelf!(bool, "isSymbolicLink"); + } + + void setIcon (NSImage icon) + { + return invokeObjcSelf!(void, "setIcon:", NSImage)(icon); + } + + NSImage icon () + { + return invokeObjcSelf!(NSImage, "icon"); + } + + bool needsToBeUpdatedFromPath (NSString path) + { + return invokeObjcSelf!(bool, "needsToBeUpdatedFromPath:", NSString)(path); + } + + bool updateFromPath (NSString path) + { + return invokeObjcSelf!(bool, "updateFromPath:", NSString)(path); + } + + NSString addFileWrapper (NSFileWrapper doc) + { + return invokeObjcSelf!(NSString, "addFileWrapper:", NSFileWrapper)(doc); + } + + void removeFileWrapper (NSFileWrapper doc) + { + return invokeObjcSelf!(void, "removeFileWrapper:", NSFileWrapper)(doc); + } + + NSDictionary fileWrappers () + { + return invokeObjcSelf!(NSDictionary, "fileWrappers"); + } + + NSString keyForFileWrapper (NSFileWrapper doc) + { + return invokeObjcSelf!(NSString, "keyForFileWrapper:", NSFileWrapper)(doc); + } + + NSString addFileWithPath (NSString path) + { + return invokeObjcSelf!(NSString, "addFileWithPath:", NSString)(path); + } + + NSString addRegularFileWithContents (NSData data, NSString filename) + { + return invokeObjcSelf!(NSString, "addRegularFileWithContents:preferredFilename:", NSData, NSString)(data, filename); + } + + NSString addSymbolicLinkWithDestination (NSString path, NSString filename) + { + return invokeObjcSelf!(NSString, "addSymbolicLinkWithDestination:preferredFilename:", NSString, NSString)(path, filename); + } + + NSData regularFileContents () + { + return invokeObjcSelf!(NSData, "regularFileContents"); + } + + NSString symbolicLinkDestination () + { + return invokeObjcSelf!(NSString, "symbolicLinkDestination"); + } + +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSFont.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSFont.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,387 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSFont; + +import dstep.appkit.AppKitDefines; +import dstep.appkit.NSAffineTransform; +import dstep.appkit.NSCell; +import dstep.appkit.NSFontDescriptor; +import dstep.appkit.NSGraphicsContext; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSCharacterSet; +import dstep.foundation.NSCoder; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.appkit.NSFont_bindings; + +alias uint NSGlyph; +typedef NSUInteger NSMultibyteGlyphPacking; +typedef NSUInteger NSFontRenderingMode; + +extern (C) +{ + extern + { + const CGFloat* NSFontIdentityMatrix; + } +} + +private +{ + NSString NSAntialiasThresholdChangedNotification_; + NSString NSFontSetChangedNotification_; +} + +NSString NSAntialiasThresholdChangedNotification () +{ + if (NSAntialiasThresholdChangedNotification_) + return NSAntialiasThresholdChangedNotification_; + + return NSAntialiasThresholdChangedNotification_ = new NSString(bindings.NSAntialiasThresholdChangedNotification); +} + +NSString NSFontSetChangedNotification () +{ + if (NSFontSetChangedNotification_) + return NSFontSetChangedNotification_; + + return NSFontSetChangedNotification_ = new NSString(bindings.NSFontSetChangedNotification); +} + +enum +{ + NSControlGlyph = 0x00FFFFFF, + NSNullGlyph = 0x0 +} + +enum +{ + NSNativeShortGlyphPacking = 5 +} + +enum +{ + NSFontDefaultRenderingMode = 0, + NSFontAntialiasedRenderingMode = 1, + NSFontIntegerAdvancementsRenderingMode = 2, + NSFontAntialiasedIntegerAdvancementsRenderingMode = 3 +} + +class NSFont : NSObject, INSCopying, INSCoding +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + typeof(this) copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); + } + + static NSFont fontWithName (NSString fontName, CGFloat fontSize) + { + return invokeObjcSelfClass!(NSFont, "fontWithName:size:", NSString, CGFloat)(fontName, fontSize); + } + + static NSFont fontWithName (NSString fontName, CGFloat* fontMatrix) + { + return invokeObjcSelfClass!(NSFont, "fontWithName:matrix:", NSString, CGFloat*)(fontName, fontMatrix); + } + + static NSFont fontWithDescriptor (NSFontDescriptor fontDescriptor, CGFloat fontSize) + { + return invokeObjcSelfClass!(NSFont, "fontWithDescriptor:size:", NSFontDescriptor, CGFloat)(fontDescriptor, fontSize); + } + + static NSFont fontWithDescriptor (NSFontDescriptor fontDescriptor, NSAffineTransform textTransform) + { + return invokeObjcSelfClass!(NSFont, "fontWithDescriptor:textTransform:", NSFontDescriptor, NSAffineTransform)(fontDescriptor, textTransform); + } + + static NSFont userFontOfSize (CGFloat fontSize) + { + return invokeObjcSelfClass!(NSFont, "userFontOfSize:", CGFloat)(fontSize); + } + + static NSFont userFixedPitchFontOfSize (CGFloat fontSize) + { + return invokeObjcSelfClass!(NSFont, "userFixedPitchFontOfSize:", CGFloat)(fontSize); + } + + static void setUserFont (NSFont aFont) + { + return invokeObjcSelfClass!(void, "setUserFont:", NSFont)(aFont); + } + + static void setUserFixedPitchFont (NSFont aFont) + { + return invokeObjcSelfClass!(void, "setUserFixedPitchFont:", NSFont)(aFont); + } + + static NSFont systemFontOfSize (CGFloat fontSize) + { + return invokeObjcSelfClass!(NSFont, "systemFontOfSize:", CGFloat)(fontSize); + } + + static NSFont boldSystemFontOfSize (CGFloat fontSize) + { + return invokeObjcSelfClass!(NSFont, "boldSystemFontOfSize:", CGFloat)(fontSize); + } + + static NSFont labelFontOfSize (CGFloat fontSize) + { + return invokeObjcSelfClass!(NSFont, "labelFontOfSize:", CGFloat)(fontSize); + } + + static NSFont titleBarFontOfSize (CGFloat fontSize) + { + return invokeObjcSelfClass!(NSFont, "titleBarFontOfSize:", CGFloat)(fontSize); + } + + static NSFont menuFontOfSize (CGFloat fontSize) + { + return invokeObjcSelfClass!(NSFont, "menuFontOfSize:", CGFloat)(fontSize); + } + + static NSFont menuBarFontOfSize (CGFloat fontSize) + { + return invokeObjcSelfClass!(NSFont, "menuBarFontOfSize:", CGFloat)(fontSize); + } + + static NSFont messageFontOfSize (CGFloat fontSize) + { + return invokeObjcSelfClass!(NSFont, "messageFontOfSize:", CGFloat)(fontSize); + } + + static NSFont paletteFontOfSize (CGFloat fontSize) + { + return invokeObjcSelfClass!(NSFont, "paletteFontOfSize:", CGFloat)(fontSize); + } + + static NSFont toolTipsFontOfSize (CGFloat fontSize) + { + return invokeObjcSelfClass!(NSFont, "toolTipsFontOfSize:", CGFloat)(fontSize); + } + + static NSFont controlContentFontOfSize (CGFloat fontSize) + { + return invokeObjcSelfClass!(NSFont, "controlContentFontOfSize:", CGFloat)(fontSize); + } + + static CGFloat systemFontSize () + { + return invokeObjcSelfClass!(CGFloat, "systemFontSize"); + } + + static CGFloat smallSystemFontSize () + { + return invokeObjcSelfClass!(CGFloat, "smallSystemFontSize"); + } + + static CGFloat labelFontSize () + { + return invokeObjcSelfClass!(CGFloat, "labelFontSize"); + } + + static CGFloat systemFontSizeForControlSize (uint controlSize) + { + return invokeObjcSelfClass!(CGFloat, "systemFontSizeForControlSize:", uint)(controlSize); + } + + NSString fontName () + { + return invokeObjcSelf!(NSString, "fontName"); + } + + CGFloat pointSize () + { + return invokeObjcSelf!(CGFloat, "pointSize"); + } + + CGFloat* matrix () + { + return invokeObjcSelf!(CGFloat*, "matrix"); + } + + NSString familyName () + { + return invokeObjcSelf!(NSString, "familyName"); + } + + NSString displayName () + { + return invokeObjcSelf!(NSString, "displayName"); + } + + NSFontDescriptor fontDescriptor () + { + return invokeObjcSelf!(NSFontDescriptor, "fontDescriptor"); + } + + NSAffineTransform textTransform () + { + return invokeObjcSelf!(NSAffineTransform, "textTransform"); + } + + NSUInteger numberOfGlyphs () + { + return invokeObjcSelf!(NSUInteger, "numberOfGlyphs"); + } + + uint mostCompatibleStringEncoding () + { + return invokeObjcSelf!(uint, "mostCompatibleStringEncoding"); + } + + uint glyphWithName (NSString aName) + { + return invokeObjcSelf!(uint, "glyphWithName:", NSString)(aName); + } + + NSCharacterSet coveredCharacterSet () + { + return invokeObjcSelf!(NSCharacterSet, "coveredCharacterSet"); + } + + NSRect boundingRectForFont () + { + return invokeObjcSelf!(NSRect, "boundingRectForFont"); + } + + NSSize maximumAdvancement () + { + return invokeObjcSelf!(NSSize, "maximumAdvancement"); + } + + CGFloat ascender () + { + return invokeObjcSelf!(CGFloat, "ascender"); + } + + CGFloat descender () + { + return invokeObjcSelf!(CGFloat, "descender"); + } + + CGFloat leading () + { + return invokeObjcSelf!(CGFloat, "leading"); + } + + CGFloat underlinePosition () + { + return invokeObjcSelf!(CGFloat, "underlinePosition"); + } + + CGFloat underlineThickness () + { + return invokeObjcSelf!(CGFloat, "underlineThickness"); + } + + CGFloat italicAngle () + { + return invokeObjcSelf!(CGFloat, "italicAngle"); + } + + CGFloat capHeight () + { + return invokeObjcSelf!(CGFloat, "capHeight"); + } + + CGFloat xHeight () + { + return invokeObjcSelf!(CGFloat, "xHeight"); + } + + bool isFixedPitch () + { + return invokeObjcSelf!(bool, "isFixedPitch"); + } + + NSRect boundingRectForGlyph (uint aGlyph) + { + return invokeObjcSelf!(NSRect, "boundingRectForGlyph:", uint)(aGlyph); + } + + NSSize advancementForGlyph (uint ag) + { + return invokeObjcSelf!(NSSize, "advancementForGlyph:", uint)(ag); + } + + void getBoundingRects (NSRectArray bounds, NSGlyph* glyphs, NSUInteger glyphCount) + { + return invokeObjcSelf!(void, "getBoundingRects:forGlyphs:count:", NSRectArray, NSGlyph*, NSUInteger)(bounds, glyphs, glyphCount); + } + + void getAdvancements (NSSizeArray advancements, NSGlyph* glyphs, NSUInteger glyphCount) + { + return invokeObjcSelf!(void, "getAdvancements:forGlyphs:count:", NSSizeArray, NSGlyph*, NSUInteger)(advancements, glyphs, glyphCount); + } + + void getAdvancements (NSSizeArray advancements, void* packedGlyphs, NSUInteger length) + { + return invokeObjcSelf!(void, "getAdvancements:forPackedGlyphs:length:", NSSizeArray, void*, NSUInteger)(advancements, packedGlyphs, length); + } + + void set () + { + return invokeObjcSelf!(void, "set"); + } + + void setInContext (NSGraphicsContext graphicsContext) + { + return invokeObjcSelf!(void, "setInContext:", NSGraphicsContext)(graphicsContext); + } + + NSFont printerFont () + { + id result = invokeObjcSelf!(id, "printerFont"); + return result is this.objcObject ? this : (result !is null ? new NSFont(result) : null); + } + + NSFont screenFont () + { + id result = invokeObjcSelf!(id, "screenFont"); + return result is this.objcObject ? this : (result !is null ? new NSFont(result) : null); + } + + NSFont screenFontWithRenderingMode (uint renderingMode) + { + id result = invokeObjcSelf!(id, "screenFontWithRenderingMode:", uint)(renderingMode); + return result is this.objcObject ? this : (result !is null ? new NSFont(result) : null); + } + + uint renderingMode () + { + return invokeObjcSelf!(uint, "renderingMode"); + } + +} + +extern (C) +{ + NSInteger NSConvertGlyphsToPackedGlyphs (NSGlyph* glBuf, NSInteger count, uint packing, char* packedGlyphs); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSFontDescriptor.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSFontDescriptor.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,398 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSFontDescriptor; + +import dstep.appkit.AppKitDefines; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSAffineTransform; +import dstep.foundation.NSArray; +import dstep.foundation.NSCoder; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObject; +import dstep.foundation.NSSet; +import dstep.foundation.NSString; +import dstep.foundation.NSZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.appkit.NSFontDescriptor_bindings; + +alias uint NSFontSymbolicTraits; +alias uint NSFontFamilyClass; + +private +{ + NSString NSFontFamilyAttribute_; + NSString NSFontNameAttribute_; + NSString NSFontFaceAttribute_; + NSString NSFontSizeAttribute_; + NSString NSFontVisibleNameAttribute_; + NSString NSFontMatrixAttribute_; + NSString NSFontVariationAttribute_; + NSString NSFontCharacterSetAttribute_; + NSString NSFontCascadeListAttribute_; + NSString NSFontTraitsAttribute_; + NSString NSFontFixedAdvanceAttribute_; + NSString NSFontFeatureSettingsAttribute_; + NSString NSFontSymbolicTrait_; + NSString NSFontWeightTrait_; + NSString NSFontWidthTrait_; + NSString NSFontSlantTrait_; + NSString NSFontVariationAxisIdentifierKey_; + NSString NSFontVariationAxisMinimumValueKey_; + NSString NSFontVariationAxisMaximumValueKey_; + NSString NSFontVariationAxisDefaultValueKey_; + NSString NSFontVariationAxisNameKey_; + NSString NSFontFeatureTypeIdentifierKey_; + NSString NSFontFeatureSelectorIdentifierKey_; +} + +NSString NSFontFamilyAttribute () +{ + if (NSFontFamilyAttribute_) + return NSFontFamilyAttribute_; + + return NSFontFamilyAttribute_ = new NSString(bindings.NSFontFamilyAttribute); +} + +NSString NSFontNameAttribute () +{ + if (NSFontNameAttribute_) + return NSFontNameAttribute_; + + return NSFontNameAttribute_ = new NSString(bindings.NSFontNameAttribute); +} + +NSString NSFontFaceAttribute () +{ + if (NSFontFaceAttribute_) + return NSFontFaceAttribute_; + + return NSFontFaceAttribute_ = new NSString(bindings.NSFontFaceAttribute); +} + +NSString NSFontSizeAttribute () +{ + if (NSFontSizeAttribute_) + return NSFontSizeAttribute_; + + return NSFontSizeAttribute_ = new NSString(bindings.NSFontSizeAttribute); +} + +NSString NSFontVisibleNameAttribute () +{ + if (NSFontVisibleNameAttribute_) + return NSFontVisibleNameAttribute_; + + return NSFontVisibleNameAttribute_ = new NSString(bindings.NSFontVisibleNameAttribute); +} + +NSString NSFontMatrixAttribute () +{ + if (NSFontMatrixAttribute_) + return NSFontMatrixAttribute_; + + return NSFontMatrixAttribute_ = new NSString(bindings.NSFontMatrixAttribute); +} + +NSString NSFontVariationAttribute () +{ + if (NSFontVariationAttribute_) + return NSFontVariationAttribute_; + + return NSFontVariationAttribute_ = new NSString(bindings.NSFontVariationAttribute); +} + +NSString NSFontCharacterSetAttribute () +{ + if (NSFontCharacterSetAttribute_) + return NSFontCharacterSetAttribute_; + + return NSFontCharacterSetAttribute_ = new NSString(bindings.NSFontCharacterSetAttribute); +} + +NSString NSFontCascadeListAttribute () +{ + if (NSFontCascadeListAttribute_) + return NSFontCascadeListAttribute_; + + return NSFontCascadeListAttribute_ = new NSString(bindings.NSFontCascadeListAttribute); +} + +NSString NSFontTraitsAttribute () +{ + if (NSFontTraitsAttribute_) + return NSFontTraitsAttribute_; + + return NSFontTraitsAttribute_ = new NSString(bindings.NSFontTraitsAttribute); +} + +NSString NSFontFixedAdvanceAttribute () +{ + if (NSFontFixedAdvanceAttribute_) + return NSFontFixedAdvanceAttribute_; + + return NSFontFixedAdvanceAttribute_ = new NSString(bindings.NSFontFixedAdvanceAttribute); +} + +NSString NSFontFeatureSettingsAttribute () +{ + if (NSFontFeatureSettingsAttribute_) + return NSFontFeatureSettingsAttribute_; + + return NSFontFeatureSettingsAttribute_ = new NSString(bindings.NSFontFeatureSettingsAttribute); +} + +NSString NSFontSymbolicTrait () +{ + if (NSFontSymbolicTrait_) + return NSFontSymbolicTrait_; + + return NSFontSymbolicTrait_ = new NSString(bindings.NSFontSymbolicTrait); +} + +NSString NSFontWeightTrait () +{ + if (NSFontWeightTrait_) + return NSFontWeightTrait_; + + return NSFontWeightTrait_ = new NSString(bindings.NSFontWeightTrait); +} + +NSString NSFontWidthTrait () +{ + if (NSFontWidthTrait_) + return NSFontWidthTrait_; + + return NSFontWidthTrait_ = new NSString(bindings.NSFontWidthTrait); +} + +NSString NSFontSlantTrait () +{ + if (NSFontSlantTrait_) + return NSFontSlantTrait_; + + return NSFontSlantTrait_ = new NSString(bindings.NSFontSlantTrait); +} + +NSString NSFontVariationAxisIdentifierKey () +{ + if (NSFontVariationAxisIdentifierKey_) + return NSFontVariationAxisIdentifierKey_; + + return NSFontVariationAxisIdentifierKey_ = new NSString(bindings.NSFontVariationAxisIdentifierKey); +} + +NSString NSFontVariationAxisMinimumValueKey () +{ + if (NSFontVariationAxisMinimumValueKey_) + return NSFontVariationAxisMinimumValueKey_; + + return NSFontVariationAxisMinimumValueKey_ = new NSString(bindings.NSFontVariationAxisMinimumValueKey); +} + +NSString NSFontVariationAxisMaximumValueKey () +{ + if (NSFontVariationAxisMaximumValueKey_) + return NSFontVariationAxisMaximumValueKey_; + + return NSFontVariationAxisMaximumValueKey_ = new NSString(bindings.NSFontVariationAxisMaximumValueKey); +} + +NSString NSFontVariationAxisDefaultValueKey () +{ + if (NSFontVariationAxisDefaultValueKey_) + return NSFontVariationAxisDefaultValueKey_; + + return NSFontVariationAxisDefaultValueKey_ = new NSString(bindings.NSFontVariationAxisDefaultValueKey); +} + +NSString NSFontVariationAxisNameKey () +{ + if (NSFontVariationAxisNameKey_) + return NSFontVariationAxisNameKey_; + + return NSFontVariationAxisNameKey_ = new NSString(bindings.NSFontVariationAxisNameKey); +} + +NSString NSFontFeatureTypeIdentifierKey () +{ + if (NSFontFeatureTypeIdentifierKey_) + return NSFontFeatureTypeIdentifierKey_; + + return NSFontFeatureTypeIdentifierKey_ = new NSString(bindings.NSFontFeatureTypeIdentifierKey); +} + +NSString NSFontFeatureSelectorIdentifierKey () +{ + if (NSFontFeatureSelectorIdentifierKey_) + return NSFontFeatureSelectorIdentifierKey_; + + return NSFontFeatureSelectorIdentifierKey_ = new NSString(bindings.NSFontFeatureSelectorIdentifierKey); +} + +enum +{ + NSFontUnknownClass = 0 << 28, + NSFontOldStyleSerifsClass = 1 << 28, + NSFontTransitionalSerifsClass = 2 << 28, + NSFontModernSerifsClass = 3 << 28, + NSFontClarendonSerifsClass = 4 << 28, + NSFontSlabSerifsClass = 5 << 28, + NSFontFreeformSerifsClass = 7 << 28, + NSFontSansSerifClass = 8 << 28, + NSFontOrnamentalsClass = 9 << 28, + NSFontScriptsClass = 10 << 28, + NSFontSymbolicClass = 12 << 28 +} + +enum +{ + NSFontFamilyClassMask = 0xF0000000 +} + +enum +{ + NSFontItalicTrait = (1 << 0), + NSFontBoldTrait = (1 << 1), + NSFontExpandedTrait = (1 << 5), + NSFontCondensedTrait = (1 << 6), + NSFontMonoSpaceTrait = (1 << 10), + NSFontVerticalTrait = (1 << 11), + NSFontUIOptimizedTrait = (1 << 12) +} + +class NSFontDescriptor : NSObject, INSCopying, INSCoding +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + typeof(this) copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); + } + + NSString postscriptName () + { + return invokeObjcSelf!(NSString, "postscriptName"); + } + + CGFloat pointSize () + { + return invokeObjcSelf!(CGFloat, "pointSize"); + } + + NSAffineTransform matrix () + { + return invokeObjcSelf!(NSAffineTransform, "matrix"); + } + + uint symbolicTraits () + { + return invokeObjcSelf!(uint, "symbolicTraits"); + } + + Object objectForKey (NSString anAttribute) + { + return invokeObjcSelf!(Object, "objectForKey:", NSString)(anAttribute); + } + + NSDictionary fontAttributes () + { + return invokeObjcSelf!(NSDictionary, "fontAttributes"); + } + + static NSFontDescriptor fontDescriptorWithFontAttributes (NSDictionary attributes) + { + return invokeObjcSelfClass!(NSFontDescriptor, "fontDescriptorWithFontAttributes:", NSDictionary)(attributes); + } + + static NSFontDescriptor fontDescriptorWithName (NSString fontName, CGFloat size) + { + return invokeObjcSelfClass!(NSFontDescriptor, "fontDescriptorWithName:size:", NSString, CGFloat)(fontName, size); + } + + static NSFontDescriptor fontDescriptorWithName (NSString fontName, NSAffineTransform matrix) + { + return invokeObjcSelfClass!(NSFontDescriptor, "fontDescriptorWithName:matrix:", NSString, NSAffineTransform)(fontName, matrix); + } + + NSFontDescriptor initWithFontAttributes (NSDictionary attributes) + { + id result = invokeObjcSelf!(id, "initWithFontAttributes:", NSDictionary)(attributes); + return result is this.objcObject ? this : (result !is null ? new NSFontDescriptor(result) : null); + } + + this (NSDictionary attributes) + { + super(NSFontDescriptor.alloc.initWithFontAttributes(attributes).objcObject); + } + + NSArray matchingFontDescriptorsWithMandatoryKeys (NSSet mandatoryKeys) + { + return invokeObjcSelf!(NSArray, "matchingFontDescriptorsWithMandatoryKeys:", NSSet)(mandatoryKeys); + } + + NSFontDescriptor matchingFontDescriptorWithMandatoryKeys (NSSet mandatoryKeys) + { + id result = invokeObjcSelf!(id, "matchingFontDescriptorWithMandatoryKeys:", NSSet)(mandatoryKeys); + return result is this.objcObject ? this : (result !is null ? new NSFontDescriptor(result) : null); + } + + NSFontDescriptor fontDescriptorByAddingAttributes (NSDictionary attributes) + { + id result = invokeObjcSelf!(id, "fontDescriptorByAddingAttributes:", NSDictionary)(attributes); + return result is this.objcObject ? this : (result !is null ? new NSFontDescriptor(result) : null); + } + + NSFontDescriptor fontDescriptorWithSymbolicTraits (uint symbolicTraits) + { + id result = invokeObjcSelf!(id, "fontDescriptorWithSymbolicTraits:", uint)(symbolicTraits); + return result is this.objcObject ? this : (result !is null ? new NSFontDescriptor(result) : null); + } + + NSFontDescriptor fontDescriptorWithSize (CGFloat newPointSize) + { + id result = invokeObjcSelf!(id, "fontDescriptorWithSize:", CGFloat)(newPointSize); + return result is this.objcObject ? this : (result !is null ? new NSFontDescriptor(result) : null); + } + + NSFontDescriptor fontDescriptorWithMatrix (NSAffineTransform matrix) + { + id result = invokeObjcSelf!(id, "fontDescriptorWithMatrix:", NSAffineTransform)(matrix); + return result is this.objcObject ? this : (result !is null ? new NSFontDescriptor(result) : null); + } + + NSFontDescriptor fontDescriptorWithFace (NSString newFace) + { + id result = invokeObjcSelf!(id, "fontDescriptorWithFace:", NSString)(newFace); + return result is this.objcObject ? this : (result !is null ? new NSFontDescriptor(result) : null); + } + + NSFontDescriptor fontDescriptorWithFamily (NSString newFamily) + { + id result = invokeObjcSelf!(id, "fontDescriptorWithFamily:", NSString)(newFamily); + return result is this.objcObject ? this : (result !is null ? new NSFontDescriptor(result) : null); + } + +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSFontDescriptor_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSFontDescriptor_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,40 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSFontDescriptor_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package id NSFontFamilyAttribute; + package id NSFontNameAttribute; + package id NSFontFaceAttribute; + package id NSFontSizeAttribute; + package id NSFontVisibleNameAttribute; + package id NSFontMatrixAttribute; + package id NSFontVariationAttribute; + package id NSFontCharacterSetAttribute; + package id NSFontCascadeListAttribute; + package id NSFontTraitsAttribute; + package id NSFontFixedAdvanceAttribute; + package id NSFontFeatureSettingsAttribute; + package id NSFontSymbolicTrait; + package id NSFontWeightTrait; + package id NSFontWidthTrait; + package id NSFontSlantTrait; + package id NSFontVariationAxisIdentifierKey; + package id NSFontVariationAxisMinimumValueKey; + package id NSFontVariationAxisMaximumValueKey; + package id NSFontVariationAxisDefaultValueKey; + package id NSFontVariationAxisNameKey; + package id NSFontFeatureTypeIdentifierKey; + package id NSFontFeatureSelectorIdentifierKey; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSFontManager.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSFontManager.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,393 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSFontManager; + +import dstep.appkit.NSFont; +import dstep.appkit.NSFontDescriptor; +import dstep.appkit.NSFontPanel; +import dstep.appkit.NSMenu; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSArray; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +typedef NSUInteger NSFontTraitMask; +typedef NSUInteger NSFontAction; + +enum +{ + NSItalicFontMask = 0x00000001, + NSBoldFontMask = 0x00000002, + NSUnboldFontMask = 0x00000004, + NSNonStandardCharacterSetFontMask = 0x00000008, + NSNarrowFontMask = 0x00000010, + NSExpandedFontMask = 0x00000020, + NSCondensedFontMask = 0x00000040, + NSSmallCapsFontMask = 0x00000080, + NSPosterFontMask = 0x00000100, + NSCompressedFontMask = 0x00000200, + NSFixedPitchFontMask = 0x00000400, + NSUnitalicFontMask = 0x01000000 +} + +enum +{ + NSFontCollectionApplicationOnlyMask = 1 << 0 +} + +enum +{ + NSNoFontChangeAction = 0, + NSViaPanelFontAction = 1, + NSAddTraitFontAction = 2, + NSSizeUpFontAction = 3, + NSSizeDownFontAction = 4, + NSHeavierFontAction = 5, + NSLighterFontAction = 6, + NSRemoveTraitFontAction = 7 +} + +const TNSFontManagerMenuActionMethods = ` + + bool fontNamed (NSString fName, uint someTraits) + { + return invokeObjcSelf!(bool, "fontNamed:hasTraits:", NSString, uint)(fName, someTraits); + } + + NSArray availableFontNamesWithTraits (uint someTraits) + { + return invokeObjcSelf!(NSArray, "availableFontNamesWithTraits:", uint)(someTraits); + } + + void addFontTrait (Object sender) + { + return invokeObjcSelf!(void, "addFontTrait:", Object)(sender); + } + + void removeFontTrait (Object sender) + { + return invokeObjcSelf!(void, "removeFontTrait:", Object)(sender); + } + + void modifyFontViaPanel (Object sender) + { + return invokeObjcSelf!(void, "modifyFontViaPanel:", Object)(sender); + } + + void modifyFont (Object sender) + { + return invokeObjcSelf!(void, "modifyFont:", Object)(sender); + } + + void orderFrontFontPanel (Object sender) + { + return invokeObjcSelf!(void, "orderFrontFontPanel:", Object)(sender); + } + + void orderFrontStylesPanel (Object sender) + { + return invokeObjcSelf!(void, "orderFrontStylesPanel:", Object)(sender); + } + + //mixin ObjcBindMethod!(fontNamed, "fontNamed:hasTraits:"); + //mixin ObjcBindMethod!(availableFontNamesWithTraits, "availableFontNamesWithTraits:"); + //mixin ObjcBindMethod!(addFontTrait, "addFontTrait:"); + //mixin ObjcBindMethod!(removeFontTrait, "removeFontTrait:"); + //mixin ObjcBindMethod!(modifyFontViaPanel, "modifyFontViaPanel:"); + //mixin ObjcBindMethod!(modifyFont, "modifyFont:"); + //mixin ObjcBindMethod!(orderFrontFontPanel, "orderFrontFontPanel:"); + //mixin ObjcBindMethod!(orderFrontStylesPanel, "orderFrontStylesPanel:"); + +`; + +const TNSFontManagerResponderMethod = ` + + void changeFont (Object sender) + { + return invokeObjcSelf!(void, "changeFont:", Object)(sender); + } + + //mixin ObjcBindMethod!(changeFont, "changeFont:"); + +`; + +const TNSFontManagerDelegate = ` + + bool fontManager (Object sender, NSString fontName) + { + return invokeObjcSelf!(bool, "fontManager:willIncludeFont:", Object, NSString)(sender, fontName); + } + + //mixin ObjcBindMethod!(fontManager, "fontManager:willIncludeFont:"); + +`; + +class NSFontManager : NSObject +{ + mixin (ObjcWrap); + + static void setFontPanelFactory (Class factoryId) + { + return invokeObjcSelfClass!(void, "setFontPanelFactory:", Class)(factoryId); + } + + static void setFontManagerFactory (Class factoryId) + { + return invokeObjcSelfClass!(void, "setFontManagerFactory:", Class)(factoryId); + } + + static NSFontManager sharedFontManager () + { + return invokeObjcSelfClass!(NSFontManager, "sharedFontManager"); + } + + bool isMultiple () + { + return invokeObjcSelf!(bool, "isMultiple"); + } + + NSFont selectedFont () + { + return invokeObjcSelf!(NSFont, "selectedFont"); + } + + void setSelectedFont (NSFont fontObj, bool flag) + { + return invokeObjcSelf!(void, "setSelectedFont:isMultiple:", NSFont, bool)(fontObj, flag); + } + + void setFontMenu (NSMenu newMenu) + { + return invokeObjcSelf!(void, "setFontMenu:", NSMenu)(newMenu); + } + + NSMenu fontMenu (bool create) + { + return invokeObjcSelf!(NSMenu, "fontMenu:", bool)(create); + } + + NSFontPanel fontPanel (bool create) + { + return invokeObjcSelf!(NSFontPanel, "fontPanel:", bool)(create); + } + + NSFont fontWithFamily (NSString family, uint traits, NSInteger weight, CGFloat size) + { + return invokeObjcSelf!(NSFont, "fontWithFamily:traits:weight:size:", NSString, uint, NSInteger, CGFloat)(family, traits, weight, size); + } + + uint traitsOfFont (NSFont fontObj) + { + return invokeObjcSelf!(uint, "traitsOfFont:", NSFont)(fontObj); + } + + NSInteger weightOfFont (NSFont fontObj) + { + return invokeObjcSelf!(NSInteger, "weightOfFont:", NSFont)(fontObj); + } + + NSArray availableFonts () + { + return invokeObjcSelf!(NSArray, "availableFonts"); + } + + NSArray availableFontFamilies () + { + return invokeObjcSelf!(NSArray, "availableFontFamilies"); + } + + NSArray availableMembersOfFontFamily (NSString fam) + { + return invokeObjcSelf!(NSArray, "availableMembersOfFontFamily:", NSString)(fam); + } + + NSFont convertFont (NSFont fontObj) + { + return invokeObjcSelf!(NSFont, "convertFont:", NSFont)(fontObj); + } + + NSFont convertFont (NSFont fontObj, CGFloat size) + { + return invokeObjcSelf!(NSFont, "convertFont:toSize:", NSFont, CGFloat)(fontObj, size); + } + + NSFont convertFont (NSFont fontObj, NSString typeface) + { + return invokeObjcSelf!(NSFont, "convertFont:toFace:", NSFont, NSString)(fontObj, typeface); + } + + NSFont convertFont (NSFont fontObj, NSString family) + { + return invokeObjcSelf!(NSFont, "convertFont:toFamily:", NSFont, NSString)(fontObj, family); + } + + NSFont convertFont (NSFont fontObj, uint trait) + { + return invokeObjcSelf!(NSFont, "convertFont:toHaveTrait:", NSFont, uint)(fontObj, trait); + } + + NSFont convertFont (NSFont fontObj, uint trait) + { + return invokeObjcSelf!(NSFont, "convertFont:toNotHaveTrait:", NSFont, uint)(fontObj, trait); + } + + NSFont convertWeight (bool upFlag, NSFont fontObj) + { + return invokeObjcSelf!(NSFont, "convertWeight:ofFont:", bool, NSFont)(upFlag, fontObj); + } + + bool isEnabled () + { + return invokeObjcSelf!(bool, "isEnabled"); + } + + void setEnabled (bool flag) + { + return invokeObjcSelf!(void, "setEnabled:", bool)(flag); + } + + SEL action () + { + return invokeObjcSelf!(SEL, "action"); + } + + void setAction (SEL aSelector) + { + return invokeObjcSelf!(void, "setAction:", SEL)(aSelector); + } + + bool sendAction () + { + return invokeObjcSelf!(bool, "sendAction"); + } + + void setDelegate (Object anObject) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(anObject); + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + NSString localizedNameForFamily (NSString family, NSString faceKey) + { + return invokeObjcSelf!(NSString, "localizedNameForFamily:face:", NSString, NSString)(family, faceKey); + } + + void setSelectedAttributes (NSDictionary attributes, bool flag) + { + return invokeObjcSelf!(void, "setSelectedAttributes:isMultiple:", NSDictionary, bool)(attributes, flag); + } + + NSDictionary convertAttributes (NSDictionary attributes) + { + return invokeObjcSelf!(NSDictionary, "convertAttributes:", NSDictionary)(attributes); + } + + NSArray availableFontNamesMatchingFontDescriptor (NSFontDescriptor descriptor) + { + return invokeObjcSelf!(NSArray, "availableFontNamesMatchingFontDescriptor:", NSFontDescriptor)(descriptor); + } + + NSArray collectionNames () + { + return invokeObjcSelf!(NSArray, "collectionNames"); + } + + NSArray fontDescriptorsInCollection (NSString collectionNames) + { + return invokeObjcSelf!(NSArray, "fontDescriptorsInCollection:", NSString)(collectionNames); + } + + bool addCollection (NSString collectionName, NSInteger collectionOptions) + { + return invokeObjcSelf!(bool, "addCollection:options:", NSString, NSInteger)(collectionName, collectionOptions); + } + + bool removeCollection (NSString collectionName) + { + return invokeObjcSelf!(bool, "removeCollection:", NSString)(collectionName); + } + + void addFontDescriptors (NSArray descriptors, NSString collectionName) + { + return invokeObjcSelf!(void, "addFontDescriptors:toCollection:", NSArray, NSString)(descriptors, collectionName); + } + + void removeFontDescriptor (NSFontDescriptor descriptor, NSString collection) + { + return invokeObjcSelf!(void, "removeFontDescriptor:fromCollection:", NSFontDescriptor, NSString)(descriptor, collection); + } + + uint currentFontAction () + { + return invokeObjcSelf!(uint, "currentFontAction"); + } + + uint convertFontTraits (uint traits) + { + return invokeObjcSelf!(uint, "convertFontTraits:", uint)(traits); + } + + void setTarget (Object aTarget) + { + return invokeObjcSelf!(void, "setTarget:", Object)(aTarget); + } + + Object target () + { + return invokeObjcSelf!(Object, "target"); + } + + // NSFontManagerMenuActionMethods + bool fontNamed (NSString fName, uint someTraits) + { + return invokeObjcSelf!(bool, "fontNamed:hasTraits:", NSString, uint)(fName, someTraits); + } + + NSArray availableFontNamesWithTraits (uint someTraits) + { + return invokeObjcSelf!(NSArray, "availableFontNamesWithTraits:", uint)(someTraits); + } + + void addFontTrait (Object sender) + { + return invokeObjcSelf!(void, "addFontTrait:", Object)(sender); + } + + void removeFontTrait (Object sender) + { + return invokeObjcSelf!(void, "removeFontTrait:", Object)(sender); + } + + void modifyFontViaPanel (Object sender) + { + return invokeObjcSelf!(void, "modifyFontViaPanel:", Object)(sender); + } + + void modifyFont (Object sender) + { + return invokeObjcSelf!(void, "modifyFont:", Object)(sender); + } + + void orderFrontFontPanel (Object sender) + { + return invokeObjcSelf!(void, "orderFrontFontPanel:", Object)(sender); + } + + void orderFrontStylesPanel (Object sender) + { + return invokeObjcSelf!(void, "orderFrontStylesPanel:", Object)(sender); + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSFontPanel.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSFontPanel.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,106 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSFontPanel; + +import dstep.appkit.NSFont; +import dstep.appkit.NSPanel; +import dstep.appkit.NSView; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +enum +{ + NSFPPreviewButton = 131, + NSFPRevertButton = 130, + NSFPSetButton = 132, + NSFPPreviewField = 128, + NSFPSizeField = 129, + NSFPSizeTitle = 133, + NSFPCurrentField = 134 +} + +enum +{ + NSFontPanelFaceModeMask = 1 << 0, + NSFontPanelSizeModeMask = 1 << 1, + NSFontPanelCollectionModeMask = 1 << 2, + NSFontPanelUnderlineEffectModeMask = 1<<8, + NSFontPanelStrikethroughEffectModeMask = 1<<9, + NSFontPanelTextColorEffectModeMask = 1<< 10, + NSFontPanelDocumentColorEffectModeMask = 1<<11, + NSFontPanelShadowEffectModeMask = 1<<12, + NSFontPanelAllEffectsModeMask = 0XFFF00, + NSFontPanelStandardModesMask = 0xFFFF, + NSFontPanelAllModesMask = 0xFFFFFFFF +} + +class NSFontPanel : NSPanel +{ + mixin (ObjcWrap); + + static NSFontPanel sharedFontPanel () + { + return invokeObjcSelfClass!(NSFontPanel, "sharedFontPanel"); + } + + static bool sharedFontPanelExists () + { + return invokeObjcSelfClass!(bool, "sharedFontPanelExists"); + } + + NSView accessoryView () + { + return invokeObjcSelf!(NSView, "accessoryView"); + } + + void setAccessoryView (NSView aView) + { + return invokeObjcSelf!(void, "setAccessoryView:", NSView)(aView); + } + + void setPanelFont (NSFont fontObj, bool flag) + { + return invokeObjcSelf!(void, "setPanelFont:isMultiple:", NSFont, bool)(fontObj, flag); + } + + NSFont panelConvertFont (NSFont fontObj) + { + return invokeObjcSelf!(NSFont, "panelConvertFont:", NSFont)(fontObj); + } + + bool worksWhenModal () + { + return invokeObjcSelf!(bool, "worksWhenModal"); + } + + bool isEnabled () + { + return invokeObjcSelf!(bool, "isEnabled"); + } + + void setEnabled (bool flag) + { + return invokeObjcSelf!(void, "setEnabled:", bool)(flag); + } + + void reloadDefaultFontFamilies () + { + return invokeObjcSelf!(void, "reloadDefaultFontFamilies"); + } +} + +const TNSFontPanelValidationAdditions = ` + + NSUInteger validModesForFontPanel (NSFontPanel fontPanel) + { + return invokeObjcSelf!(NSUInteger, "validModesForFontPanel:", NSFontPanel)(fontPanel); + } + + //mixin ObjcBindMethod!(validModesForFontPanel, "validModesForFontPanel:"); + +`; + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSFont_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSFont_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,22 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSFont_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package id NSAntialiasThresholdChangedNotification; + package id NSFontSetChangedNotification; + } +} + +extern (C) +{ +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSForm.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSForm.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,118 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSForm; + +import dstep.appkit.NSFont; +import dstep.appkit.NSFormCell; +import dstep.appkit.NSMatrix; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSForm : NSMatrix +{ + mixin (ObjcWrap); + + NSInteger indexOfSelectedItem () + { + return invokeObjcSelf!(NSInteger, "indexOfSelectedItem"); + } + + void setEntryWidth (CGFloat width) + { + return invokeObjcSelf!(void, "setEntryWidth:", CGFloat)(width); + } + + void setInterlineSpacing (CGFloat spacing) + { + return invokeObjcSelf!(void, "setInterlineSpacing:", CGFloat)(spacing); + } + + void setBordered (bool flag) + { + return invokeObjcSelf!(void, "setBordered:", bool)(flag); + } + + void setBezeled (bool flag) + { + return invokeObjcSelf!(void, "setBezeled:", bool)(flag); + } + + void setTitleAlignment (uint mode) + { + return invokeObjcSelf!(void, "setTitleAlignment:", uint)(mode); + } + + void setTextAlignment (uint mode) + { + return invokeObjcSelf!(void, "setTextAlignment:", uint)(mode); + } + + void setTitleFont (NSFont fontObj) + { + return invokeObjcSelf!(void, "setTitleFont:", NSFont)(fontObj); + } + + void setTextFont (NSFont fontObj) + { + return invokeObjcSelf!(void, "setTextFont:", NSFont)(fontObj); + } + + Object cellAtIndex (NSInteger index) + { + return invokeObjcSelf!(Object, "cellAtIndex:", NSInteger)(index); + } + + void drawCellAtIndex (NSInteger index) + { + return invokeObjcSelf!(void, "drawCellAtIndex:", NSInteger)(index); + } + + NSFormCell addEntry (NSString title) + { + return invokeObjcSelf!(NSFormCell, "addEntry:", NSString)(title); + } + + NSFormCell insertEntry (NSString title, NSInteger index) + { + return invokeObjcSelf!(NSFormCell, "insertEntry:atIndex:", NSString, NSInteger)(title, index); + } + + void removeEntryAtIndex (NSInteger index) + { + return invokeObjcSelf!(void, "removeEntryAtIndex:", NSInteger)(index); + } + + NSInteger indexOfCellWithTag (NSInteger aTag) + { + return invokeObjcSelf!(NSInteger, "indexOfCellWithTag:", NSInteger)(aTag); + } + + void selectTextAtIndex (NSInteger index) + { + return invokeObjcSelf!(void, "selectTextAtIndex:", NSInteger)(index); + } + + void setFrameSize (NSSize newSize) + { + return invokeObjcSelf!(void, "setFrameSize:", NSSize)(newSize); + } + + void setTitleBaseWritingDirection (int writingDirection) + { + return invokeObjcSelf!(void, "setTitleBaseWritingDirection:", int)(writingDirection); + } + + void setTextBaseWritingDirection (int writingDirection) + { + return invokeObjcSelf!(void, "setTextBaseWritingDirection:", int)(writingDirection); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSFormCell.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSFormCell.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,157 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSFormCell; + +import dstep.appkit.NSActionCell; +import dstep.appkit.NSFont; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSAttributedString; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +const TNSKeyboardUI = ` + + void setTitleWithMnemonic (NSString stringWithAmpersand) + { + return invokeObjcSelf!(void, "setTitleWithMnemonic:", NSString)(stringWithAmpersand); + } + + //mixin ObjcBindMethod!(setTitleWithMnemonic, "setTitleWithMnemonic:"); + +`; + +const TNSFormCellAttributedStringMethods = ` + + NSAttributedString attributedTitle () + { + return invokeObjcSelf!(NSAttributedString, "attributedTitle"); + } + + void setAttributedTitle (NSAttributedString obj) + { + return invokeObjcSelf!(void, "setAttributedTitle:", NSAttributedString)(obj); + } + + //mixin ObjcBindMethod!(attributedTitle, "attributedTitle"); + //mixin ObjcBindMethod!(setAttributedTitle, "setAttributedTitle:"); + +`; + +class NSFormCell : NSActionCell +{ + mixin (ObjcWrap); + + NSFormCell initTextCell (NSString aString) + { + id result = invokeObjcSelf!(id, "initTextCell:", NSString)(aString); + return result is this.objcObject ? this : (result !is null ? new NSFormCell(result) : null); + } + + this (NSString aString) + { + super(NSFormCell.alloc.initTextCell(aString).objcObject); + } + + CGFloat titleWidth (NSSize aSize) + { + return invokeObjcSelf!(CGFloat, "titleWidth:", NSSize)(aSize); + } + + CGFloat titleWidth () + { + return invokeObjcSelf!(CGFloat, "titleWidth"); + } + + void setTitleWidth (CGFloat width) + { + return invokeObjcSelf!(void, "setTitleWidth:", CGFloat)(width); + } + + NSString title () + { + return invokeObjcSelf!(NSString, "title"); + } + + void setTitle (NSString aString) + { + return invokeObjcSelf!(void, "setTitle:", NSString)(aString); + } + + NSFont titleFont () + { + return invokeObjcSelf!(NSFont, "titleFont"); + } + + void setTitleFont (NSFont fontObj) + { + return invokeObjcSelf!(void, "setTitleFont:", NSFont)(fontObj); + } + + uint titleAlignment () + { + return invokeObjcSelf!(uint, "titleAlignment"); + } + + void setTitleAlignment (uint mode) + { + return invokeObjcSelf!(void, "setTitleAlignment:", uint)(mode); + } + + bool isOpaque () + { + return invokeObjcSelf!(bool, "isOpaque"); + } + + void setPlaceholderString (NSString string) + { + return invokeObjcSelf!(void, "setPlaceholderString:", NSString)(string); + } + + NSString placeholderString () + { + return invokeObjcSelf!(NSString, "placeholderString"); + } + + void setPlaceholderAttributedString (NSAttributedString string) + { + return invokeObjcSelf!(void, "setPlaceholderAttributedString:", NSAttributedString)(string); + } + + NSAttributedString placeholderAttributedString () + { + return invokeObjcSelf!(NSAttributedString, "placeholderAttributedString"); + } + + int titleBaseWritingDirection () + { + return invokeObjcSelf!(int, "titleBaseWritingDirection"); + } + + void setTitleBaseWritingDirection (int writingDirection) + { + return invokeObjcSelf!(void, "setTitleBaseWritingDirection:", int)(writingDirection); + } + + // NSKeyboardUI + void setTitleWithMnemonic (NSString stringWithAmpersand) + { + return invokeObjcSelf!(void, "setTitleWithMnemonic:", NSString)(stringWithAmpersand); + } + + // NSFormCellAttributedStringMethods + NSAttributedString attributedTitle () + { + return invokeObjcSelf!(NSAttributedString, "attributedTitle"); + } + + void setAttributedTitle (NSAttributedString obj) + { + return invokeObjcSelf!(void, "setAttributedTitle:", NSAttributedString)(obj); + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSGlyphGenerator.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSGlyphGenerator.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,45 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSGlyphGenerator; + +import dstep.appkit.NSFont; +import dstep.foundation.NSAttributedString; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +enum +{ + NSShowControlGlyphs = (1 << 0), + NSShowInvisibleGlyphs = (1 << 1), + NSWantsBidiLevels = (1 << 2) +} + +class NSGlyphGenerator : NSObject +{ + mixin (ObjcWrap); + + void generateGlyphsForGlyphStorage (INSGlyphStorage glyphStorage, NSUInteger nChars, NSUInteger* glyphIndex, NSUInteger* charIndex) + { + return invokeObjcSelf!(void, "generateGlyphsForGlyphStorage:desiredNumberOfCharacters:glyphIndex:characterIndex:", INSGlyphStorage, NSUInteger, NSUInteger*, NSUInteger*)(glyphStorage, nChars, glyphIndex, charIndex); + } + + static Object sharedGlyphGenerator () + { + return invokeObjcSelfClass!(Object, "sharedGlyphGenerator"); + } +} + +interface INSGlyphStorage +{ + void insertGlyphs (NSGlyph* glyphs, NSUInteger length, NSUInteger glyphIndex, NSUInteger charIndex); + void setIntAttribute (NSInteger attributeTag, NSInteger val, NSUInteger glyphIndex); + NSAttributedString attributedString (); + NSUInteger layoutOptions (); +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSGlyphInfo.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSGlyphInfo.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,85 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSGlyphInfo; + +import dstep.appkit.NSFont; +import dstep.foundation.NSCoder; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +typedef NSUInteger NSCharacterCollection; + +enum +{ + NSIdentityMappingCharacterCollection = 0, + NSAdobeCNS1CharacterCollection = 1, + NSAdobeGB1CharacterCollection = 2, + NSAdobeJapan1CharacterCollection = 3, + NSAdobeJapan2CharacterCollection = 4, + NSAdobeKorea1CharacterCollection = 5 +} + +class NSGlyphInfo : NSObject, INSCopying, INSCoding +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + typeof(this) copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); + } + + static NSGlyphInfo glyphInfoWithGlyphName (NSString glyphName, NSFont font, NSString theString) + { + return invokeObjcSelfClass!(NSGlyphInfo, "glyphInfoWithGlyphName:forFont:baseString:", NSString, NSFont, NSString)(glyphName, font, theString); + } + + static NSGlyphInfo glyphInfoWithGlyph (uint glyph, NSFont font, NSString theString) + { + return invokeObjcSelfClass!(NSGlyphInfo, "glyphInfoWithGlyph:forFont:baseString:", uint, NSFont, NSString)(glyph, font, theString); + } + + static NSGlyphInfo glyphInfoWithCharacterIdentifier (NSUInteger cid, uint characterCollection, NSString theString) + { + return invokeObjcSelfClass!(NSGlyphInfo, "glyphInfoWithCharacterIdentifier:collection:baseString:", NSUInteger, uint, NSString)(cid, characterCollection, theString); + } + + NSString glyphName () + { + return invokeObjcSelf!(NSString, "glyphName"); + } + + NSUInteger characterIdentifier () + { + return invokeObjcSelf!(NSUInteger, "characterIdentifier"); + } + + uint characterCollection () + { + return invokeObjcSelf!(uint, "characterCollection"); + } + +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSGradient.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSGradient.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,157 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSGradient; + +import dstep.appkit.NSBezierPath; +import dstep.appkit.NSColor; +import dstep.appkit.NSColorSpace; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSArray; +import dstep.foundation.NSCoder; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +typedef NSUInteger NSGradientDrawingOptions; + +enum +{ + NSGradientDrawsBeforeStartingLocation = (1 << 0), + NSGradientDrawsAfterEndingLocation = (1 << 1) +} + +class NSGradient : NSObject, INSCopying, INSCoding +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + typeof(this) copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); + } + + NSGradient initWithStartingColor (NSColor startingColor, NSColor endingColor) + { + id result = invokeObjcSelf!(id, "initWithStartingColor:endingColor:", NSColor, NSColor)(startingColor, endingColor); + return result is this.objcObject ? this : (result !is null ? new NSGradient(result) : null); + } + + this (NSColor startingColor, NSColor endingColor) + { + super(NSGradient.alloc.initWithStartingColor(startingColor, endingColor).objcObject); + } + + NSGradient initWithColors (NSArray colorArray) + { + id result = invokeObjcSelf!(id, "initWithColors:", NSArray)(colorArray); + return result is this.objcObject ? this : (result !is null ? new NSGradient(result) : null); + } + + this (NSArray colorArray) + { + super(NSGradient.alloc.initWithColors(colorArray).objcObject); + } + + NSGradient initWithColorsAndLocations (NSColor initWithColorsAndLocations, ...) + { + id result = invokeObjcSelf!(id, "initWithColorsAndLocations:", NSColor)(initWithColorsAndLocations); + return result is this.objcObject ? this : (result !is null ? new NSGradient(result) : null); + } + + this (NSColor initWithColorsAndLocations, ...) + { + super(NSGradient.alloc.initWithColorsAndLocations(initWithColorsAndLocations).objcObject); + } + + NSGradient initWithColors (NSArray colorArray, CGFloat* locations, NSColorSpace colorSpace) + { + id result = invokeObjcSelf!(id, "initWithColors:atLocations:colorSpace:", NSArray, CGFloat*, NSColorSpace)(colorArray, locations, colorSpace); + return result is this.objcObject ? this : (result !is null ? new NSGradient(result) : null); + } + + this (NSArray colorArray, CGFloat* locations, NSColorSpace colorSpace) + { + super(NSGradient.alloc.initWithColors(colorArray, locations, colorSpace).objcObject); + } + + void drawFromPoint (NSPoint startingPoint, NSPoint endingPoint, uint options) + { + return invokeObjcSelf!(void, "drawFromPoint:toPoint:options:", NSPoint, NSPoint, uint)(startingPoint, endingPoint, options); + } + + void drawInRect (NSRect rect, CGFloat angle) + { + return invokeObjcSelf!(void, "drawInRect:angle:", NSRect, CGFloat)(rect, angle); + } + + void drawInBezierPath (NSBezierPath path, CGFloat angle) + { + return invokeObjcSelf!(void, "drawInBezierPath:angle:", NSBezierPath, CGFloat)(path, angle); + } + + void drawFromCenter (NSPoint startCenter, CGFloat startRadius, NSPoint endCenter, CGFloat endRadius, uint options) + { + return invokeObjcSelf!(void, "drawFromCenter:radius:toCenter:radius:options:", NSPoint, CGFloat, NSPoint, CGFloat, uint)(startCenter, startRadius, endCenter, endRadius, options); + } + + void drawInRect (NSRect rect, NSPoint relativeCenterPosition) + { + return invokeObjcSelf!(void, "drawInRect:relativeCenterPosition:", NSRect, NSPoint)(rect, relativeCenterPosition); + } + + void drawInBezierPath (NSBezierPath path, NSPoint relativeCenterPosition) + { + return invokeObjcSelf!(void, "drawInBezierPath:relativeCenterPosition:", NSBezierPath, NSPoint)(path, relativeCenterPosition); + } + + NSColorSpace colorSpace () + { + return invokeObjcSelf!(NSColorSpace, "colorSpace"); + } + + NSInteger numberOfColorStops () + { + return invokeObjcSelf!(NSInteger, "numberOfColorStops"); + } + + void getColor (ref NSColor color, CGFloat* location, NSInteger index) + { + id c; + + if (color) + c = color.objcObject; + + invokeObjcSelf!(void, "getColor:location:atIndex:", id*, CGFloat*, NSInteger)(&c, location, index); + + if (c) + color = new NSColor(c); + } + + NSColor interpolatedColorAtLocation (CGFloat location) + { + return invokeObjcSelf!(NSColor, "interpolatedColorAtLocation:", CGFloat)(location); + } + +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSGraphics.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSGraphics.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,310 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSGraphics; + +import dstep.appkit.AppKitDefines; +import dstep.appkit.NSColor; +import dstep.appkit.NSView; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.appkit.NSGraphics_bindings; + +alias NSUInteger NSCompositingOperation; +alias NSUInteger NSBackingStoreType; +alias NSInteger NSWindowOrderingMode; +alias NSUInteger NSFocusRingPlacement; +alias NSUInteger NSFocusRingType; +alias int NSWindowDepth; +alias NSUInteger NSAnimationEffect; + +extern (C) +{ + extern + { + const CGFloat NSWhite; + const CGFloat NSLightGray; + const CGFloat NSDarkGray; + const CGFloat NSBlack; + } +} + +private +{ + NSString NSCalibratedWhiteColorSpace_; + NSString NSCalibratedBlackColorSpace_; + NSString NSCalibratedRGBColorSpace_; + NSString NSDeviceWhiteColorSpace_; + NSString NSDeviceBlackColorSpace_; + NSString NSDeviceRGBColorSpace_; + NSString NSDeviceCMYKColorSpace_; + NSString NSNamedColorSpace_; + NSString NSPatternColorSpace_; + NSString NSCustomColorSpace_; + NSString NSDeviceResolution_; + NSString NSDeviceColorSpaceName_; + NSString NSDeviceBitsPerSample_; + NSString NSDeviceIsScreen_; + NSString NSDeviceIsPrinter_; + NSString NSDeviceSize_; +} + +NSString NSCalibratedWhiteColorSpace () +{ + if (NSCalibratedWhiteColorSpace_) + return NSCalibratedWhiteColorSpace_; + + return NSCalibratedWhiteColorSpace_ = new NSString(bindings.NSCalibratedWhiteColorSpace); +} + +NSString NSCalibratedBlackColorSpace () +{ + if (NSCalibratedBlackColorSpace_) + return NSCalibratedBlackColorSpace_; + + return NSCalibratedBlackColorSpace_ = new NSString(bindings.NSCalibratedBlackColorSpace); +} + +NSString NSCalibratedRGBColorSpace () +{ + if (NSCalibratedRGBColorSpace_) + return NSCalibratedRGBColorSpace_; + + return NSCalibratedRGBColorSpace_ = new NSString(bindings.NSCalibratedRGBColorSpace); +} + +NSString NSDeviceWhiteColorSpace () +{ + if (NSDeviceWhiteColorSpace_) + return NSDeviceWhiteColorSpace_; + + return NSDeviceWhiteColorSpace_ = new NSString(bindings.NSDeviceWhiteColorSpace); +} + +NSString NSDeviceBlackColorSpace () +{ + if (NSDeviceBlackColorSpace_) + return NSDeviceBlackColorSpace_; + + return NSDeviceBlackColorSpace_ = new NSString(bindings.NSDeviceBlackColorSpace); +} + +NSString NSDeviceRGBColorSpace () +{ + if (NSDeviceRGBColorSpace_) + return NSDeviceRGBColorSpace_; + + return NSDeviceRGBColorSpace_ = new NSString(bindings.NSDeviceRGBColorSpace); +} + +NSString NSDeviceCMYKColorSpace () +{ + if (NSDeviceCMYKColorSpace_) + return NSDeviceCMYKColorSpace_; + + return NSDeviceCMYKColorSpace_ = new NSString(bindings.NSDeviceCMYKColorSpace); +} + +NSString NSNamedColorSpace () +{ + if (NSNamedColorSpace_) + return NSNamedColorSpace_; + + return NSNamedColorSpace_ = new NSString(bindings.NSNamedColorSpace); +} + +NSString NSPatternColorSpace () +{ + if (NSPatternColorSpace_) + return NSPatternColorSpace_; + + return NSPatternColorSpace_ = new NSString(bindings.NSPatternColorSpace); +} + +NSString NSCustomColorSpace () +{ + if (NSCustomColorSpace_) + return NSCustomColorSpace_; + + return NSCustomColorSpace_ = new NSString(bindings.NSCustomColorSpace); +} + +NSString NSDeviceResolution () +{ + if (NSDeviceResolution_) + return NSDeviceResolution_; + + return NSDeviceResolution_ = new NSString(bindings.NSDeviceResolution); +} + +NSString NSDeviceColorSpaceName () +{ + if (NSDeviceColorSpaceName_) + return NSDeviceColorSpaceName_; + + return NSDeviceColorSpaceName_ = new NSString(bindings.NSDeviceColorSpaceName); +} + +NSString NSDeviceBitsPerSample () +{ + if (NSDeviceBitsPerSample_) + return NSDeviceBitsPerSample_; + + return NSDeviceBitsPerSample_ = new NSString(bindings.NSDeviceBitsPerSample); +} + +NSString NSDeviceIsScreen () +{ + if (NSDeviceIsScreen_) + return NSDeviceIsScreen_; + + return NSDeviceIsScreen_ = new NSString(bindings.NSDeviceIsScreen); +} + +NSString NSDeviceIsPrinter () +{ + if (NSDeviceIsPrinter_) + return NSDeviceIsPrinter_; + + return NSDeviceIsPrinter_ = new NSString(bindings.NSDeviceIsPrinter); +} + +NSString NSDeviceSize () +{ + if (NSDeviceSize_) + return NSDeviceSize_; + + return NSDeviceSize_ = new NSString(bindings.NSDeviceSize); +} + +enum +{ + NSCompositeClear = 0, + NSCompositeCopy = 1, + NSCompositeSourceOver = 2, + NSCompositeSourceIn = 3, + NSCompositeSourceOut = 4, + NSCompositeSourceAtop = 5, + NSCompositeDestinationOver = 6, + NSCompositeDestinationIn = 7, + NSCompositeDestinationOut = 8, + NSCompositeDestinationAtop = 9, + NSCompositeXOR = 10, + NSCompositePlusDarker = 11, + NSCompositeHighlight = 12, + NSCompositePlusLighter = 13 +} + +enum +{ + NSBackingStoreRetained = 0, + NSBackingStoreNonretained = 1, + NSBackingStoreBuffered = 2 +} + +enum +{ + NSWindowAbove = 1, + NSWindowBelow = -1, + NSWindowOut = 0 +} + +enum +{ + NSFocusRingOnly = 0, + NSFocusRingBelow = 1, + NSFocusRingAbove = 2 +} + +enum +{ + NSFocusRingTypeDefault = 0, + NSFocusRingTypeNone = 1, + NSFocusRingTypeExterior = 2 +} + +enum +{ + NSAnimationEffectDisappearingItemDefault = 0, + NSAnimationEffectPoof = 10 +} +/* +int NSBestDepth (NSString colorSpace, NSInteger bps, NSInteger bpp, bool planar, bool* exactMatch) +{ + return Bridge.invokeObjcFunction!(int, bindings.NSBestDepth, NSString, NSInteger, NSInteger, bool, bool*)(colorSpace, bps, bpp, planar, exactMatch); +} + +NSString NSColorSpaceFromDepth (int depth) +{ + return Bridge.invokeObjcFunction!(NSString, bindings.NSColorSpaceFromDepth, int)(depth); +} + +NSInteger NSNumberOfColorComponents (NSString colorSpaceName) +{ + return Bridge.invokeObjcFunction!(NSInteger, bindings.NSNumberOfColorComponents, NSString)(colorSpaceName); +} + +NSColor NSReadPixel (NSPoint passedPoint) +{ + return Bridge.invokeObjcFunction!(NSColor, bindings.NSReadPixel, NSPoint)(passedPoint); +} + +void NSDrawBitmap (NSRect rect, NSInteger width, NSInteger height, NSInteger bps, NSInteger spp, NSInteger bpp, NSInteger bpr, bool isPlanar, bool hasAlpha, NSString colorSpaceName, char*[5] data) +{ + return Bridge.invokeObjcFunction!(void, bindings.NSDrawBitmap, NSRect, NSInteger, NSInteger, NSInteger, NSInteger, NSInteger, NSInteger, bool, bool, NSString, char*[5])(rect, width, height, bps, spp, bpp, bpr, isPlanar, hasAlpha, colorSpaceName, data); +} + +void NSShowAnimationEffect (uint animationEffect, NSPoint centerLocation, NSSize size, Object animationDelegate, SEL didEndSelector, void* contextInfo) +{ + return Bridge.invokeObjcFunction!(void, bindings.NSShowAnimationEffect, uint, NSPoint, NSSize, Object, SEL, void*)(animationEffect, centerLocation, size, animationDelegate, didEndSelector, contextInfo); +} +*/ +extern (C) +{ + bool NSPlanarFromDepth (int depth); + NSInteger NSBitsPerSampleFromDepth (int depth); + NSInteger NSBitsPerPixelFromDepth (int depth); + NSWindowDepth* NSAvailableWindowDepths (); + void NSRectFill (NSRect aRect); + void NSRectFillList (NSRect* rects, NSInteger count); + void NSRectFillListWithGrays (NSRect* rects, CGFloat* grays, NSInteger num); + void NSRectFillListWithColors (NSRect* rects, NSColor** colors, NSInteger num); + void NSRectFillUsingOperation (NSRect aRect, uint op); + void NSRectFillListUsingOperation (NSRect* rects, NSInteger count, uint op); + void NSRectFillListWithColorsUsingOperation (NSRect* rects, NSColor** colors, NSInteger num, uint op); + void NSFrameRect (NSRect aRect); + void NSFrameRectWithWidth (NSRect aRect, CGFloat frameWidth); + void NSFrameRectWithWidthUsingOperation (NSRect aRect, CGFloat frameWidth, uint op); + void NSRectClip (NSRect aRect); + void NSRectClipList (NSRect* rects, NSInteger count); + NSRect NSDrawTiledRects (NSRect boundsRect, NSRect clipRect, NSRectEdge* sides, CGFloat* grays, NSInteger count); + void NSDrawGrayBezel (NSRect aRect, NSRect clipRect); + void NSDrawGroove (NSRect aRect, NSRect clipRect); + void NSDrawWhiteBezel (NSRect aRect, NSRect clipRect); + void NSDrawButton (NSRect aRect, NSRect clipRect); + void NSEraseRect (NSRect aRect); + void NSCopyBits (NSInteger srcGState, NSRect srcRect, NSPoint destPoint); + void NSHighlightRect (NSRect aRect); + void NSBeep (); + void NSCountWindows (NSInteger* count); + void NSWindowList (NSInteger size, NSInteger* list); + void NSCountWindowsForContext (NSInteger context, NSInteger* count); + void NSWindowListForContext (NSInteger context, NSInteger size, NSInteger* list); + NSInteger NSGetWindowServerMemory (NSInteger context, NSInteger* virtualMemory, NSInteger* windowBackingMemory, NSString** windowDumpString); + NSRect NSDrawColorTiledRects (NSRect boundsRect, NSRect clipRect, NSRectEdge* sides, NSColor** colors, NSInteger count); + void NSDrawDarkBezel (NSRect aRect, NSRect clipRect); + void NSDrawLightBezel (NSRect aRect, NSRect clipRect); + void NSDottedFrameRect (NSRect aRect); + void NSDrawWindowBackground (NSRect aRect); + void NSSetFocusRingStyle (uint placement); + void NSDisableScreenUpdates (); + void NSEnableScreenUpdates (); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSGraphicsContext.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSGraphicsContext.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,315 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSGraphicsContext; + +import dstep.appkit.AppKitDefines; +import dstep.appkit.NSBitmapImageRep; +import dstep.appkit.NSGraphics; +import dstep.appkit.NSWindow; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.quartzcore.CIContext; + +import bindings = dstep.appkit.NSGraphicsContext_bindings; + +typedef NSUInteger NSImageInterpolation; +typedef NSInteger NSColorRenderingIntent; + +private +{ + NSString NSGraphicsContextDestinationAttributeName_; + NSString NSGraphicsContextRepresentationFormatAttributeName_; + NSString NSGraphicsContextPSFormat_; + NSString NSGraphicsContextPDFFormat_; +} + +NSString NSGraphicsContextDestinationAttributeName () +{ + if (NSGraphicsContextDestinationAttributeName_) + return NSGraphicsContextDestinationAttributeName_; + + return NSGraphicsContextDestinationAttributeName_ = new NSString(bindings.NSGraphicsContextDestinationAttributeName); +} + +NSString NSGraphicsContextRepresentationFormatAttributeName () +{ + if (NSGraphicsContextRepresentationFormatAttributeName_) + return NSGraphicsContextRepresentationFormatAttributeName_; + + return NSGraphicsContextRepresentationFormatAttributeName_ = new NSString(bindings.NSGraphicsContextRepresentationFormatAttributeName); +} + +NSString NSGraphicsContextPSFormat () +{ + if (NSGraphicsContextPSFormat_) + return NSGraphicsContextPSFormat_; + + return NSGraphicsContextPSFormat_ = new NSString(bindings.NSGraphicsContextPSFormat); +} + +NSString NSGraphicsContextPDFFormat () +{ + if (NSGraphicsContextPDFFormat_) + return NSGraphicsContextPDFFormat_; + + return NSGraphicsContextPDFFormat_ = new NSString(bindings.NSGraphicsContextPDFFormat); +} + +enum +{ + NSImageInterpolationDefault, + NSImageInterpolationNone, + NSImageInterpolationLow, + NSImageInterpolationHigh +} + +enum +{ + NSColorRenderingIntentDefault, + NSColorRenderingIntentAbsoluteColorimetric, + NSColorRenderingIntentRelativeColorimetric, + NSColorRenderingIntentPerceptual, + NSColorRenderingIntentSaturation +} + +const TNSQuartzCoreAdditions = ` + + CIContext CIContext_ () + { + return invokeObjcSelf!(CIContext, "CIContext"); + } + + //mixin ObjcBindMethod!(CIContext_, "CIContext"); + +`; + +const TNSGraphicsContext_RenderingOptions = ` + + void setShouldAntialias (bool antialias) + { + return invokeObjcSelf!(void, "setShouldAntialias:", bool)(antialias); + } + + bool shouldAntialias () + { + return invokeObjcSelf!(bool, "shouldAntialias"); + } + + void setImageInterpolation (uint interpolation) + { + return invokeObjcSelf!(void, "setImageInterpolation:", uint)(interpolation); + } + + uint imageInterpolation () + { + return invokeObjcSelf!(uint, "imageInterpolation"); + } + + void setPatternPhase (NSPoint phase) + { + return invokeObjcSelf!(void, "setPatternPhase:", NSPoint)(phase); + } + + NSPoint patternPhase () + { + return invokeObjcSelf!(NSPoint, "patternPhase"); + } + + void setCompositingOperation (uint operation) + { + return invokeObjcSelf!(void, "setCompositingOperation:", uint)(operation); + } + + uint compositingOperation () + { + return invokeObjcSelf!(uint, "compositingOperation"); + } + + int colorRenderingIntent () + { + return invokeObjcSelf!(int, "colorRenderingIntent"); + } + + void setColorRenderingIntent (int renderingIntent) + { + return invokeObjcSelf!(void, "setColorRenderingIntent:", int)(renderingIntent); + } + + //mixin ObjcBindMethod!(setShouldAntialias, "setShouldAntialias:"); + //mixin ObjcBindMethod!(shouldAntialias, "shouldAntialias"); + //mixin ObjcBindMethod!(setImageInterpolation, "setImageInterpolation:"); + //mixin ObjcBindMethod!(imageInterpolation, "imageInterpolation"); + //mixin ObjcBindMethod!(setPatternPhase, "setPatternPhase:"); + //mixin ObjcBindMethod!(patternPhase, "patternPhase"); + //mixin ObjcBindMethod!(setCompositingOperation, "setCompositingOperation:"); + //mixin ObjcBindMethod!(compositingOperation, "compositingOperation"); + //mixin ObjcBindMethod!(colorRenderingIntent, "colorRenderingIntent"); + //mixin ObjcBindMethod!(setColorRenderingIntent, "setColorRenderingIntent:"); + +`; + +class NSGraphicsContext : NSObject +{ + mixin (ObjcWrap); + + static NSGraphicsContext graphicsContextWithAttributes (NSDictionary attributes) + { + return invokeObjcSelfClass!(NSGraphicsContext, "graphicsContextWithAttributes:", NSDictionary)(attributes); + } + + static NSGraphicsContext graphicsContextWithWindow (NSWindow window) + { + return invokeObjcSelfClass!(NSGraphicsContext, "graphicsContextWithWindow:", NSWindow)(window); + } + + static NSGraphicsContext graphicsContextWithBitmapImageRep (NSBitmapImageRep bitmapRep) + { + return invokeObjcSelfClass!(NSGraphicsContext, "graphicsContextWithBitmapImageRep:", NSBitmapImageRep)(bitmapRep); + } + + static NSGraphicsContext graphicsContextWithGraphicsPort (void* graphicsPort, bool initialFlippedState) + { + return invokeObjcSelfClass!(NSGraphicsContext, "graphicsContextWithGraphicsPort:flipped:", void*, bool)(graphicsPort, initialFlippedState); + } + + static NSGraphicsContext currentContext () + { + return invokeObjcSelfClass!(NSGraphicsContext, "currentContext"); + } + + static void setCurrentContext (NSGraphicsContext context) + { + return invokeObjcSelfClass!(void, "setCurrentContext:", NSGraphicsContext)(context); + } + + static bool currentContextDrawingToScreen () + { + return invokeObjcSelfClass!(bool, "currentContextDrawingToScreen"); + } + + static void saveGraphicsState_static () + { + return invokeObjcSelfClass!(void, "saveGraphicsState"); + } + + static void restoreGraphicsState_static () + { + return invokeObjcSelfClass!(void, "restoreGraphicsState"); + } + + static void setGraphicsState (NSInteger gState) + { + return invokeObjcSelfClass!(void, "setGraphicsState:", NSInteger)(gState); + } + + NSDictionary attributes () + { + return invokeObjcSelf!(NSDictionary, "attributes"); + } + + bool isDrawingToScreen () + { + return invokeObjcSelf!(bool, "isDrawingToScreen"); + } + + void saveGraphicsState () + { + return invokeObjcSelf!(void, "saveGraphicsState"); + } + + void restoreGraphicsState () + { + return invokeObjcSelf!(void, "restoreGraphicsState"); + } + + void flushGraphics () + { + return invokeObjcSelf!(void, "flushGraphics"); + } + + Object focusStack () + { + return invokeObjcSelf!(Object, "focusStack"); + } + + void setFocusStack (Object stack) + { + return invokeObjcSelf!(void, "setFocusStack:", Object)(stack); + } + + void* graphicsPort () + { + return invokeObjcSelf!(void*, "graphicsPort"); + } + + bool isFlipped () + { + return invokeObjcSelf!(bool, "isFlipped"); + } + + // NSQuartzCoreAdditions + CIContext CIContext_ () + { + return invokeObjcSelf!(CIContext, "CIContext"); + } + + // NSGraphicsContext_RenderingOptions + void setShouldAntialias (bool antialias) + { + return invokeObjcSelf!(void, "setShouldAntialias:", bool)(antialias); + } + + bool shouldAntialias () + { + return invokeObjcSelf!(bool, "shouldAntialias"); + } + + void setImageInterpolation (uint interpolation) + { + return invokeObjcSelf!(void, "setImageInterpolation:", uint)(interpolation); + } + + uint imageInterpolation () + { + return invokeObjcSelf!(uint, "imageInterpolation"); + } + + void setPatternPhase (NSPoint phase) + { + return invokeObjcSelf!(void, "setPatternPhase:", NSPoint)(phase); + } + + NSPoint patternPhase () + { + return invokeObjcSelf!(NSPoint, "patternPhase"); + } + + void setCompositingOperation (uint operation) + { + return invokeObjcSelf!(void, "setCompositingOperation:", uint)(operation); + } + + uint compositingOperation () + { + return invokeObjcSelf!(uint, "compositingOperation"); + } + + int colorRenderingIntent () + { + return invokeObjcSelf!(int, "colorRenderingIntent"); + } + + void setColorRenderingIntent (int renderingIntent) + { + return invokeObjcSelf!(void, "setColorRenderingIntent:", int)(renderingIntent); + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSGraphicsContext_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSGraphicsContext_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,21 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSGraphicsContext_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package id NSGraphicsContextDestinationAttributeName; + package id NSGraphicsContextRepresentationFormatAttributeName; + package id NSGraphicsContextPSFormat; + package id NSGraphicsContextPDFFormat; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSGraphics_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSGraphics_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,44 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSGraphics_bindings; + +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.objc.objc; + +extern (C) +{ + extern + { + package id NSCalibratedWhiteColorSpace; + package id NSCalibratedBlackColorSpace; + package id NSCalibratedRGBColorSpace; + package id NSDeviceWhiteColorSpace; + package id NSDeviceBlackColorSpace; + package id NSDeviceRGBColorSpace; + package id NSDeviceCMYKColorSpace; + package id NSNamedColorSpace; + package id NSPatternColorSpace; + package id NSCustomColorSpace; + package id NSDeviceResolution; + package id NSDeviceColorSpaceName; + package id NSDeviceBitsPerSample; + package id NSDeviceIsScreen; + package id NSDeviceIsPrinter; + package id NSDeviceSize; + } +} + +extern (C) +{ + package int NSBestDepth (id colorSpace, NSInteger bps, NSInteger bpp, bool planar, bool* exactMatch); + package id NSColorSpaceFromDepth (int depth); + package NSInteger NSNumberOfColorComponents (id colorSpaceName); + package id NSReadPixel (NSPoint passedPoint); + package void NSDrawBitmap (NSRect rect, NSInteger width, NSInteger height, NSInteger bps, NSInteger spp, NSInteger bpp, NSInteger bpr, bool isPlanar, bool hasAlpha, id colorSpaceName, char*[5] data); + package void NSShowAnimationEffect (uint animationEffect, NSPoint centerLocation, NSSize size, id animationDelegate, SEL didEndSelector, void* contextInfo); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSHelpManager.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSHelpManager.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,123 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSHelpManager; + +import dstep.appkit.AppKitDefines; +import dstep.appkit.NSApplication; +import dstep.appkit.NSAttributedString; +import dstep.appkit.NSWindow; +import dstep.foundation.NSAttributedString; +import dstep.foundation.NSBundle; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSMapTable; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.appkit.NSHelpManager_bindings; + +private +{ + NSString NSContextHelpModeDidActivateNotification_; + NSString NSContextHelpModeDidDeactivateNotification_; +} + +NSString NSContextHelpModeDidActivateNotification () +{ + if (NSContextHelpModeDidActivateNotification_) + return NSContextHelpModeDidActivateNotification_; + + return NSContextHelpModeDidActivateNotification_ = new NSString(bindings.NSContextHelpModeDidActivateNotification); +} + +NSString NSContextHelpModeDidDeactivateNotification () +{ + if (NSContextHelpModeDidDeactivateNotification_) + return NSContextHelpModeDidDeactivateNotification_; + + return NSContextHelpModeDidDeactivateNotification_ = new NSString(bindings.NSContextHelpModeDidDeactivateNotification); +} + +class NSHelpManager : NSObject +{ + mixin (ObjcWrap); + + static NSHelpManager sharedHelpManager () + { + return invokeObjcSelfClass!(NSHelpManager, "sharedHelpManager"); + } + + static void setContextHelpModeActive (bool active) + { + return invokeObjcSelfClass!(void, "setContextHelpModeActive:", bool)(active); + } + + static bool isContextHelpModeActive () + { + return invokeObjcSelfClass!(bool, "isContextHelpModeActive"); + } + + void setContextHelp (NSAttributedString attrString, Object object) + { + return invokeObjcSelf!(void, "setContextHelp:forObject:", NSAttributedString, Object)(attrString, object); + } + + void removeContextHelpForObject (Object object) + { + return invokeObjcSelf!(void, "removeContextHelpForObject:", Object)(object); + } + + NSAttributedString contextHelpForObject (Object object) + { + return invokeObjcSelf!(NSAttributedString, "contextHelpForObject:", Object)(object); + } + + bool showContextHelpForObject (Object object, NSPoint pt) + { + return invokeObjcSelf!(bool, "showContextHelpForObject:locationHint:", Object, NSPoint)(object, pt); + } + + void openHelpAnchor (NSString anchor, NSString book) + { + return invokeObjcSelf!(void, "openHelpAnchor:inBook:", NSString, NSString)(anchor, book); + } + + void findString (NSString query, NSString book) + { + return invokeObjcSelf!(void, "findString:inBook:", NSString, NSString)(query, book); + } +} + +const TNSApplicationHelpExtension = ` + + void activateContextHelpMode (Object sender) + { + return invokeObjcSelf!(void, "activateContextHelpMode:", Object)(sender); + } + + void showHelp (Object sender) + { + return invokeObjcSelf!(void, "showHelp:", Object)(sender); + } + + //mixin ObjcBindMethod!(activateContextHelpMode, "activateContextHelpMode:"); + //mixin ObjcBindMethod!(showHelp, "showHelp:"); + +`; + +const TNSBundleHelpExtension = ` + + NSAttributedString contextHelpForKey (NSString key) + { + return invokeObjcSelf!(NSAttributedString, "contextHelpForKey:", NSString)(key); + } + + //mixin ObjcBindMethod!(contextHelpForKey, "contextHelpForKey:"); + +`; + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSHelpManager_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSHelpManager_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,19 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSHelpManager_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package id NSContextHelpModeDidActivateNotification; + package id NSContextHelpModeDidDeactivateNotification; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSImage.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSImage.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,913 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSImage; + +import dstep.appkit.NSBitmapImageRep; +import dstep.appkit.NSColor; +import dstep.appkit.NSGraphics; +import dstep.appkit.NSImageRep; +import dstep.appkit.NSPasteboard; +import dstep.applicationservices.ApplicationServices; +import dstep.foundation.NSArray; +import dstep.foundation.NSBundle; +import dstep.foundation.NSCoder; +import dstep.foundation.NSData; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSURL; +import dstep.foundation.NSZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.appkit.NSImage_bindings; + +typedef NSUInteger NSImageLoadStatus; +typedef NSUInteger NSImageCacheMode; + +private struct OpaqueIconRef; +alias OpaqueIconRef* IconRef; + +private +{ + NSString NSImageNameQuickLookTemplate_; + NSString NSImageNameBluetoothTemplate_; + NSString NSImageNameIChatTheaterTemplate_; + NSString NSImageNameSlideshowTemplate_; + NSString NSImageNameActionTemplate_; + NSString NSImageNameSmartBadgeTemplate_; + NSString NSImageNameIconViewTemplate_; + NSString NSImageNameListViewTemplate_; + NSString NSImageNameColumnViewTemplate_; + NSString NSImageNameFlowViewTemplate_; + NSString NSImageNamePathTemplate_; + NSString NSImageNameInvalidDataFreestandingTemplate_; + NSString NSImageNameLockLockedTemplate_; + NSString NSImageNameLockUnlockedTemplate_; + NSString NSImageNameGoRightTemplate_; + NSString NSImageNameGoLeftTemplate_; + NSString NSImageNameRightFacingTriangleTemplate_; + NSString NSImageNameLeftFacingTriangleTemplate_; + NSString NSImageNameAddTemplate_; + NSString NSImageNameRemoveTemplate_; + NSString NSImageNameRevealFreestandingTemplate_; + NSString NSImageNameFollowLinkFreestandingTemplate_; + NSString NSImageNameEnterFullScreenTemplate_; + NSString NSImageNameExitFullScreenTemplate_; + NSString NSImageNameStopProgressTemplate_; + NSString NSImageNameStopProgressFreestandingTemplate_; + NSString NSImageNameRefreshTemplate_; + NSString NSImageNameRefreshFreestandingTemplate_; + NSString NSImageNameBonjour_; + NSString NSImageNameDotMac_; + NSString NSImageNameComputer_; + NSString NSImageNameFolderBurnable_; + NSString NSImageNameFolderSmart_; + NSString NSImageNameNetwork_; + NSString NSImageNameMultipleDocuments_; + NSString NSImageNameUserAccounts_; + NSString NSImageNamePreferencesGeneral_; + NSString NSImageNameAdvanced_; + NSString NSImageNameInfo_; + NSString NSImageNameFontPanel_; + NSString NSImageNameColorPanel_; + NSString NSImageNameUser_; + NSString NSImageNameUserGroup_; + NSString NSImageNameEveryone_; +} + +NSString NSImageNameQuickLookTemplate () +{ + if (NSImageNameQuickLookTemplate_) + return NSImageNameQuickLookTemplate_; + + return NSImageNameQuickLookTemplate_ = new NSString(bindings.NSImageNameQuickLookTemplate); +} + +NSString NSImageNameBluetoothTemplate () +{ + if (NSImageNameBluetoothTemplate_) + return NSImageNameBluetoothTemplate_; + + return NSImageNameBluetoothTemplate_ = new NSString(bindings.NSImageNameBluetoothTemplate); +} + +NSString NSImageNameIChatTheaterTemplate () +{ + if (NSImageNameIChatTheaterTemplate_) + return NSImageNameIChatTheaterTemplate_; + + return NSImageNameIChatTheaterTemplate_ = new NSString(bindings.NSImageNameIChatTheaterTemplate); +} + +NSString NSImageNameSlideshowTemplate () +{ + if (NSImageNameSlideshowTemplate_) + return NSImageNameSlideshowTemplate_; + + return NSImageNameSlideshowTemplate_ = new NSString(bindings.NSImageNameSlideshowTemplate); +} + +NSString NSImageNameActionTemplate () +{ + if (NSImageNameActionTemplate_) + return NSImageNameActionTemplate_; + + return NSImageNameActionTemplate_ = new NSString(bindings.NSImageNameActionTemplate); +} + +NSString NSImageNameSmartBadgeTemplate () +{ + if (NSImageNameSmartBadgeTemplate_) + return NSImageNameSmartBadgeTemplate_; + + return NSImageNameSmartBadgeTemplate_ = new NSString(bindings.NSImageNameSmartBadgeTemplate); +} + +NSString NSImageNameIconViewTemplate () +{ + if (NSImageNameIconViewTemplate_) + return NSImageNameIconViewTemplate_; + + return NSImageNameIconViewTemplate_ = new NSString(bindings.NSImageNameIconViewTemplate); +} + +NSString NSImageNameListViewTemplate () +{ + if (NSImageNameListViewTemplate_) + return NSImageNameListViewTemplate_; + + return NSImageNameListViewTemplate_ = new NSString(bindings.NSImageNameListViewTemplate); +} + +NSString NSImageNameColumnViewTemplate () +{ + if (NSImageNameColumnViewTemplate_) + return NSImageNameColumnViewTemplate_; + + return NSImageNameColumnViewTemplate_ = new NSString(bindings.NSImageNameColumnViewTemplate); +} + +NSString NSImageNameFlowViewTemplate () +{ + if (NSImageNameFlowViewTemplate_) + return NSImageNameFlowViewTemplate_; + + return NSImageNameFlowViewTemplate_ = new NSString(bindings.NSImageNameFlowViewTemplate); +} + +NSString NSImageNamePathTemplate () +{ + if (NSImageNamePathTemplate_) + return NSImageNamePathTemplate_; + + return NSImageNamePathTemplate_ = new NSString(bindings.NSImageNamePathTemplate); +} + +NSString NSImageNameInvalidDataFreestandingTemplate () +{ + if (NSImageNameInvalidDataFreestandingTemplate_) + return NSImageNameInvalidDataFreestandingTemplate_; + + return NSImageNameInvalidDataFreestandingTemplate_ = new NSString(bindings.NSImageNameInvalidDataFreestandingTemplate); +} + +NSString NSImageNameLockLockedTemplate () +{ + if (NSImageNameLockLockedTemplate_) + return NSImageNameLockLockedTemplate_; + + return NSImageNameLockLockedTemplate_ = new NSString(bindings.NSImageNameLockLockedTemplate); +} + +NSString NSImageNameLockUnlockedTemplate () +{ + if (NSImageNameLockUnlockedTemplate_) + return NSImageNameLockUnlockedTemplate_; + + return NSImageNameLockUnlockedTemplate_ = new NSString(bindings.NSImageNameLockUnlockedTemplate); +} + +NSString NSImageNameGoRightTemplate () +{ + if (NSImageNameGoRightTemplate_) + return NSImageNameGoRightTemplate_; + + return NSImageNameGoRightTemplate_ = new NSString(bindings.NSImageNameGoRightTemplate); +} + +NSString NSImageNameGoLeftTemplate () +{ + if (NSImageNameGoLeftTemplate_) + return NSImageNameGoLeftTemplate_; + + return NSImageNameGoLeftTemplate_ = new NSString(bindings.NSImageNameGoLeftTemplate); +} + +NSString NSImageNameRightFacingTriangleTemplate () +{ + if (NSImageNameRightFacingTriangleTemplate_) + return NSImageNameRightFacingTriangleTemplate_; + + return NSImageNameRightFacingTriangleTemplate_ = new NSString(bindings.NSImageNameRightFacingTriangleTemplate); +} + +NSString NSImageNameLeftFacingTriangleTemplate () +{ + if (NSImageNameLeftFacingTriangleTemplate_) + return NSImageNameLeftFacingTriangleTemplate_; + + return NSImageNameLeftFacingTriangleTemplate_ = new NSString(bindings.NSImageNameLeftFacingTriangleTemplate); +} + +NSString NSImageNameAddTemplate () +{ + if (NSImageNameAddTemplate_) + return NSImageNameAddTemplate_; + + return NSImageNameAddTemplate_ = new NSString(bindings.NSImageNameAddTemplate); +} + +NSString NSImageNameRemoveTemplate () +{ + if (NSImageNameRemoveTemplate_) + return NSImageNameRemoveTemplate_; + + return NSImageNameRemoveTemplate_ = new NSString(bindings.NSImageNameRemoveTemplate); +} + +NSString NSImageNameRevealFreestandingTemplate () +{ + if (NSImageNameRevealFreestandingTemplate_) + return NSImageNameRevealFreestandingTemplate_; + + return NSImageNameRevealFreestandingTemplate_ = new NSString(bindings.NSImageNameRevealFreestandingTemplate); +} + +NSString NSImageNameFollowLinkFreestandingTemplate () +{ + if (NSImageNameFollowLinkFreestandingTemplate_) + return NSImageNameFollowLinkFreestandingTemplate_; + + return NSImageNameFollowLinkFreestandingTemplate_ = new NSString(bindings.NSImageNameFollowLinkFreestandingTemplate); +} + +NSString NSImageNameEnterFullScreenTemplate () +{ + if (NSImageNameEnterFullScreenTemplate_) + return NSImageNameEnterFullScreenTemplate_; + + return NSImageNameEnterFullScreenTemplate_ = new NSString(bindings.NSImageNameEnterFullScreenTemplate); +} + +NSString NSImageNameExitFullScreenTemplate () +{ + if (NSImageNameExitFullScreenTemplate_) + return NSImageNameExitFullScreenTemplate_; + + return NSImageNameExitFullScreenTemplate_ = new NSString(bindings.NSImageNameExitFullScreenTemplate); +} + +NSString NSImageNameStopProgressTemplate () +{ + if (NSImageNameStopProgressTemplate_) + return NSImageNameStopProgressTemplate_; + + return NSImageNameStopProgressTemplate_ = new NSString(bindings.NSImageNameStopProgressTemplate); +} + +NSString NSImageNameStopProgressFreestandingTemplate () +{ + if (NSImageNameStopProgressFreestandingTemplate_) + return NSImageNameStopProgressFreestandingTemplate_; + + return NSImageNameStopProgressFreestandingTemplate_ = new NSString(bindings.NSImageNameStopProgressFreestandingTemplate); +} + +NSString NSImageNameRefreshTemplate () +{ + if (NSImageNameRefreshTemplate_) + return NSImageNameRefreshTemplate_; + + return NSImageNameRefreshTemplate_ = new NSString(bindings.NSImageNameRefreshTemplate); +} + +NSString NSImageNameRefreshFreestandingTemplate () +{ + if (NSImageNameRefreshFreestandingTemplate_) + return NSImageNameRefreshFreestandingTemplate_; + + return NSImageNameRefreshFreestandingTemplate_ = new NSString(bindings.NSImageNameRefreshFreestandingTemplate); +} + +NSString NSImageNameBonjour () +{ + if (NSImageNameBonjour_) + return NSImageNameBonjour_; + + return NSImageNameBonjour_ = new NSString(bindings.NSImageNameBonjour); +} + +NSString NSImageNameDotMac () +{ + if (NSImageNameDotMac_) + return NSImageNameDotMac_; + + return NSImageNameDotMac_ = new NSString(bindings.NSImageNameDotMac); +} + +NSString NSImageNameComputer () +{ + if (NSImageNameComputer_) + return NSImageNameComputer_; + + return NSImageNameComputer_ = new NSString(bindings.NSImageNameComputer); +} + +NSString NSImageNameFolderBurnable () +{ + if (NSImageNameFolderBurnable_) + return NSImageNameFolderBurnable_; + + return NSImageNameFolderBurnable_ = new NSString(bindings.NSImageNameFolderBurnable); +} + +NSString NSImageNameFolderSmart () +{ + if (NSImageNameFolderSmart_) + return NSImageNameFolderSmart_; + + return NSImageNameFolderSmart_ = new NSString(bindings.NSImageNameFolderSmart); +} + +NSString NSImageNameNetwork () +{ + if (NSImageNameNetwork_) + return NSImageNameNetwork_; + + return NSImageNameNetwork_ = new NSString(bindings.NSImageNameNetwork); +} + +NSString NSImageNameMultipleDocuments () +{ + if (NSImageNameMultipleDocuments_) + return NSImageNameMultipleDocuments_; + + return NSImageNameMultipleDocuments_ = new NSString(bindings.NSImageNameMultipleDocuments); +} + +NSString NSImageNameUserAccounts () +{ + if (NSImageNameUserAccounts_) + return NSImageNameUserAccounts_; + + return NSImageNameUserAccounts_ = new NSString(bindings.NSImageNameUserAccounts); +} + +NSString NSImageNamePreferencesGeneral () +{ + if (NSImageNamePreferencesGeneral_) + return NSImageNamePreferencesGeneral_; + + return NSImageNamePreferencesGeneral_ = new NSString(bindings.NSImageNamePreferencesGeneral); +} + +NSString NSImageNameAdvanced () +{ + if (NSImageNameAdvanced_) + return NSImageNameAdvanced_; + + return NSImageNameAdvanced_ = new NSString(bindings.NSImageNameAdvanced); +} + +NSString NSImageNameInfo () +{ + if (NSImageNameInfo_) + return NSImageNameInfo_; + + return NSImageNameInfo_ = new NSString(bindings.NSImageNameInfo); +} + +NSString NSImageNameFontPanel () +{ + if (NSImageNameFontPanel_) + return NSImageNameFontPanel_; + + return NSImageNameFontPanel_ = new NSString(bindings.NSImageNameFontPanel); +} + +NSString NSImageNameColorPanel () +{ + if (NSImageNameColorPanel_) + return NSImageNameColorPanel_; + + return NSImageNameColorPanel_ = new NSString(bindings.NSImageNameColorPanel); +} + +NSString NSImageNameUser () +{ + if (NSImageNameUser_) + return NSImageNameUser_; + + return NSImageNameUser_ = new NSString(bindings.NSImageNameUser); +} + +NSString NSImageNameUserGroup () +{ + if (NSImageNameUserGroup_) + return NSImageNameUserGroup_; + + return NSImageNameUserGroup_ = new NSString(bindings.NSImageNameUserGroup); +} + +NSString NSImageNameEveryone () +{ + if (NSImageNameEveryone_) + return NSImageNameEveryone_; + + return NSImageNameEveryone_ = new NSString(bindings.NSImageNameEveryone); +} + +enum +{ + NSImageLoadStatusCompleted, + NSImageLoadStatusCancelled, + NSImageLoadStatusInvalidData, + NSImageLoadStatusUnexpectedEOF, + NSImageLoadStatusReadError +} + +enum +{ + NSImageCacheDefault, + NSImageCacheAlways, + NSImageCacheBySize, + NSImageCacheNever +} + +class NSImage : NSObject, INSCopying, INSCoding +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + typeof(this) copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); + } + + static Object imageNamed (NSString name) + { + return invokeObjcSelfClass!(Object, "imageNamed:", NSString)(name); + } + + NSImage initWithSize (NSSize aSize) + { + id result = invokeObjcSelf!(id, "initWithSize:", NSSize)(aSize); + return result is this.objcObject ? this : (result !is null ? new NSImage(result) : null); + } + + this (NSSize aSize) + { + super(NSImage.alloc.initWithSize(aSize).objcObject); + } + + NSImage initWithData (NSData data) + { + id result = invokeObjcSelf!(id, "initWithData:", NSData)(data); + return result is this.objcObject ? this : (result !is null ? new NSImage(result) : null); + } + + this (NSData data) + { + super(NSImage.alloc.initWithData(data).objcObject); + } + + NSImage initWithContentsOfFile (NSString fileName) + { + id result = invokeObjcSelf!(id, "initWithContentsOfFile:", NSString)(fileName); + return result is this.objcObject ? this : (result !is null ? new NSImage(result) : null); + } + + this (NSString fileName) + { + super(NSImage.alloc.initWithContentsOfFile(fileName).objcObject); + } + + NSImage initWithContentsOfURL (NSURL url) + { + id result = invokeObjcSelf!(id, "initWithContentsOfURL:", NSURL)(url); + return result is this.objcObject ? this : (result !is null ? new NSImage(result) : null); + } + + this (NSURL url) + { + super(NSImage.alloc.initWithContentsOfURL(url).objcObject); + } + + NSImage initByReferencingFile (NSString fileName) + { + id result = invokeObjcSelf!(id, "initByReferencingFile:", NSString)(fileName); + return result is this.objcObject ? this : (result !is null ? new NSImage(result) : null); + } + + this (NSString fileName) + { + super(NSImage.alloc.initByReferencingFile(fileName).objcObject); + } + + NSImage initByReferencingURL (NSURL url) + { + id result = invokeObjcSelf!(id, "initByReferencingURL:", NSURL)(url); + return result is this.objcObject ? this : (result !is null ? new NSImage(result) : null); + } + + this (NSURL url) + { + super(NSImage.alloc.initByReferencingURL(url).objcObject); + } + + NSImage initWithIconRef (IconRef iconRef) + { + id result = invokeObjcSelf!(id, "initWithIconRef:", IconRef)(iconRef); + return result is this.objcObject ? this : (result !is null ? new NSImage(result) : null); + } + + this (IconRef iconRef) + { + super(NSImage.alloc.initWithIconRef(iconRef).objcObject); + } + + NSImage initWithPasteboard (NSPasteboard pasteboard) + { + id result = invokeObjcSelf!(id, "initWithPasteboard:", NSPasteboard)(pasteboard); + return result is this.objcObject ? this : (result !is null ? new NSImage(result) : null); + } + + this (NSPasteboard pasteboard) + { + super(NSImage.alloc.initWithPasteboard(pasteboard).objcObject); + } + + void setSize (NSSize aSize) + { + return invokeObjcSelf!(void, "setSize:", NSSize)(aSize); + } + + NSSize size () + { + return invokeObjcSelf!(NSSize, "size"); + } + + bool setName (NSString string) + { + return invokeObjcSelf!(bool, "setName:", NSString)(string); + } + + NSString name () + { + return invokeObjcSelf!(NSString, "name"); + } + + void setScalesWhenResized (bool flag) + { + return invokeObjcSelf!(void, "setScalesWhenResized:", bool)(flag); + } + + bool scalesWhenResized () + { + return invokeObjcSelf!(bool, "scalesWhenResized"); + } + + void setDataRetained (bool flag) + { + return invokeObjcSelf!(void, "setDataRetained:", bool)(flag); + } + + bool isDataRetained () + { + return invokeObjcSelf!(bool, "isDataRetained"); + } + + void setCachedSeparately (bool flag) + { + return invokeObjcSelf!(void, "setCachedSeparately:", bool)(flag); + } + + bool isCachedSeparately () + { + return invokeObjcSelf!(bool, "isCachedSeparately"); + } + + void setCacheDepthMatchesImageDepth (bool flag) + { + return invokeObjcSelf!(void, "setCacheDepthMatchesImageDepth:", bool)(flag); + } + + bool cacheDepthMatchesImageDepth () + { + return invokeObjcSelf!(bool, "cacheDepthMatchesImageDepth"); + } + + void setBackgroundColor (NSColor aColor) + { + return invokeObjcSelf!(void, "setBackgroundColor:", NSColor)(aColor); + } + + NSColor backgroundColor () + { + return invokeObjcSelf!(NSColor, "backgroundColor"); + } + + void setUsesEPSOnResolutionMismatch (bool flag) + { + return invokeObjcSelf!(void, "setUsesEPSOnResolutionMismatch:", bool)(flag); + } + + bool usesEPSOnResolutionMismatch () + { + return invokeObjcSelf!(bool, "usesEPSOnResolutionMismatch"); + } + + void setPrefersColorMatch (bool flag) + { + return invokeObjcSelf!(void, "setPrefersColorMatch:", bool)(flag); + } + + bool prefersColorMatch () + { + return invokeObjcSelf!(bool, "prefersColorMatch"); + } + + void setMatchesOnMultipleResolution (bool flag) + { + return invokeObjcSelf!(void, "setMatchesOnMultipleResolution:", bool)(flag); + } + + bool matchesOnMultipleResolution () + { + return invokeObjcSelf!(bool, "matchesOnMultipleResolution"); + } + + void dissolveToPoint (NSPoint point, CGFloat aFloat) + { + return invokeObjcSelf!(void, "dissolveToPoint:fraction:", NSPoint, CGFloat)(point, aFloat); + } + + void dissolveToPoint (NSPoint point, NSRect rect, CGFloat aFloat) + { + return invokeObjcSelf!(void, "dissolveToPoint:fromRect:fraction:", NSPoint, NSRect, CGFloat)(point, rect, aFloat); + } + + void compositeToPoint (NSPoint point, uint op) + { + return invokeObjcSelf!(void, "compositeToPoint:operation:", NSPoint, uint)(point, op); + } + + void compositeToPoint (NSPoint point, NSRect rect, uint op) + { + return invokeObjcSelf!(void, "compositeToPoint:fromRect:operation:", NSPoint, NSRect, uint)(point, rect, op); + } + + void compositeToPoint (NSPoint point, uint op, CGFloat delta) + { + return invokeObjcSelf!(void, "compositeToPoint:operation:fraction:", NSPoint, uint, CGFloat)(point, op, delta); + } + + void compositeToPoint (NSPoint point, NSRect rect, uint op, CGFloat delta) + { + return invokeObjcSelf!(void, "compositeToPoint:fromRect:operation:fraction:", NSPoint, NSRect, uint, CGFloat)(point, rect, op, delta); + } + + void drawAtPoint (NSPoint point, NSRect fromRect, uint op, CGFloat delta) + { + return invokeObjcSelf!(void, "drawAtPoint:fromRect:operation:fraction:", NSPoint, NSRect, uint, CGFloat)(point, fromRect, op, delta); + } + + void drawInRect (NSRect rect, NSRect fromRect, uint op, CGFloat delta) + { + return invokeObjcSelf!(void, "drawInRect:fromRect:operation:fraction:", NSRect, NSRect, uint, CGFloat)(rect, fromRect, op, delta); + } + + bool drawRepresentation (NSImageRep imageRep, NSRect rect) + { + return invokeObjcSelf!(bool, "drawRepresentation:inRect:", NSImageRep, NSRect)(imageRep, rect); + } + + void recache () + { + return invokeObjcSelf!(void, "recache"); + } + + NSData TIFFRepresentation () + { + return invokeObjcSelf!(NSData, "TIFFRepresentation"); + } + + NSData TIFFRepresentationUsingCompression (uint comp, float aFloat) + { + return invokeObjcSelf!(NSData, "TIFFRepresentationUsingCompression:factor:", uint, float)(comp, aFloat); + } + + NSArray representations () + { + return invokeObjcSelf!(NSArray, "representations"); + } + + void addRepresentations (NSArray imageReps) + { + return invokeObjcSelf!(void, "addRepresentations:", NSArray)(imageReps); + } + + void addRepresentation (NSImageRep imageRep) + { + return invokeObjcSelf!(void, "addRepresentation:", NSImageRep)(imageRep); + } + + void removeRepresentation (NSImageRep imageRep) + { + return invokeObjcSelf!(void, "removeRepresentation:", NSImageRep)(imageRep); + } + + bool isValid () + { + return invokeObjcSelf!(bool, "isValid"); + } + + void lockFocus () + { + return invokeObjcSelf!(void, "lockFocus"); + } + + void lockFocusOnRepresentation (NSImageRep imageRepresentation) + { + return invokeObjcSelf!(void, "lockFocusOnRepresentation:", NSImageRep)(imageRepresentation); + } + + void unlockFocus () + { + return invokeObjcSelf!(void, "unlockFocus"); + } + + NSImageRep bestRepresentationForDevice (NSDictionary deviceDescription) + { + return invokeObjcSelf!(NSImageRep, "bestRepresentationForDevice:", NSDictionary)(deviceDescription); + } + + void setDelegate (Object anObject) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(anObject); + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + static NSArray imageUnfilteredFileTypes () + { + return invokeObjcSelfClass!(NSArray, "imageUnfilteredFileTypes"); + } + + static NSArray imageUnfilteredPasteboardTypes () + { + return invokeObjcSelfClass!(NSArray, "imageUnfilteredPasteboardTypes"); + } + + static NSArray imageFileTypes () + { + return invokeObjcSelfClass!(NSArray, "imageFileTypes"); + } + + static NSArray imagePasteboardTypes () + { + return invokeObjcSelfClass!(NSArray, "imagePasteboardTypes"); + } + + static NSArray imageTypes () + { + return invokeObjcSelfClass!(NSArray, "imageTypes"); + } + + static NSArray imageUnfilteredTypes () + { + return invokeObjcSelfClass!(NSArray, "imageUnfilteredTypes"); + } + + static bool canInitWithPasteboard (NSPasteboard pasteboard) + { + return invokeObjcSelfClass!(bool, "canInitWithPasteboard:", NSPasteboard)(pasteboard); + } + + void setFlipped (bool flag) + { + return invokeObjcSelf!(void, "setFlipped:", bool)(flag); + } + + bool isFlipped () + { + return invokeObjcSelf!(bool, "isFlipped"); + } + + void cancelIncrementalLoad () + { + return invokeObjcSelf!(void, "cancelIncrementalLoad"); + } + + void setCacheMode (uint mode) + { + return invokeObjcSelf!(void, "setCacheMode:", uint)(mode); + } + + uint cacheMode () + { + return invokeObjcSelf!(uint, "cacheMode"); + } + + NSRect alignmentRect () + { + return invokeObjcSelf!(NSRect, "alignmentRect"); + } + + void setAlignmentRect (NSRect rect) + { + return invokeObjcSelf!(void, "setAlignmentRect:", NSRect)(rect); + } + + bool isTemplate () + { + return invokeObjcSelf!(bool, "isTemplate"); + } + + void setTemplate (bool isTemplate) + { + return invokeObjcSelf!(void, "setTemplate:", bool)(isTemplate); + } + +} + +const TNSImageDelegate = ` + + NSImage imageDidNotDraw (Object sender, NSRect aRect) + { + return invokeObjcSelf!(NSImage, "imageDidNotDraw:inRect:", Object, NSRect)(sender, aRect); + } + + void image (NSImage image, NSImageRep rep) + { + return invokeObjcSelf!(void, "image:willLoadRepresentation:", NSImage, NSImageRep)(image, rep); + } + + void image (NSImage image, NSImageRep rep) + { + return invokeObjcSelf!(void, "image:didLoadRepresentationHeader:", NSImage, NSImageRep)(image, rep); + } + + void image (NSImage image, NSImageRep rep, NSInteger rows) + { + return invokeObjcSelf!(void, "image:didLoadPartOfRepresentation:withValidRows:", NSImage, NSImageRep, NSInteger)(image, rep, rows); + } + + void image (NSImage image, NSImageRep rep, uint status) + { + return invokeObjcSelf!(void, "image:didLoadRepresentation:withStatus:", NSImage, NSImageRep, uint)(image, rep, status); + } + + //mixin ObjcBindMethod!(imageDidNotDraw, "imageDidNotDraw:inRect:"); + //mixin ObjcBindMethod!(image, "image:willLoadRepresentation:"); + //mixin ObjcBindMethod!(image, "image:didLoadRepresentationHeader:"); + //mixin ObjcBindMethod!(image, "image:didLoadPartOfRepresentation:withValidRows:"); + //mixin ObjcBindMethod!(image, "image:didLoadRepresentation:withStatus:"); + +`; + +const TNSBundleImageExtension = ` + + NSString pathForImageResource (NSString name) + { + return invokeObjcSelf!(NSString, "pathForImageResource:", NSString)(name); + } + + //mixin ObjcBindMethod!(pathForImageResource, "pathForImageResource:"); + +`; + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSImageCell.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSImageCell.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,98 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSImageCell; + +import dstep.appkit.NSCell; +import dstep.appkit.NSImage; +import dstep.foundation.NSCoder; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +alias NSUInteger NSImageAlignment; +alias NSUInteger NSImageFrameStyle; + +enum +{ + NSImageAlignCenter = 0, + NSImageAlignTop, + NSImageAlignTopLeft, + NSImageAlignTopRight, + NSImageAlignLeft, + NSImageAlignBottom, + NSImageAlignBottomLeft, + NSImageAlignBottomRight, + NSImageAlignRight +} + +enum +{ + NSImageFrameNone = 0, + NSImageFramePhoto, + NSImageFrameGrayBezel, + NSImageFrameGroove, + NSImageFrameButton +} + +class NSImageCell : NSCell, INSCopying, INSCoding +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + typeof(this) copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); + } + + uint imageAlignment () + { + return invokeObjcSelf!(uint, "imageAlignment"); + } + + void setImageAlignment (uint newAlign) + { + return invokeObjcSelf!(void, "setImageAlignment:", uint)(newAlign); + } + + uint imageScaling () + { + return invokeObjcSelf!(uint, "imageScaling"); + } + + void setImageScaling (uint newScaling) + { + return invokeObjcSelf!(void, "setImageScaling:", uint)(newScaling); + } + + uint imageFrameStyle () + { + return invokeObjcSelf!(uint, "imageFrameStyle"); + } + + void setImageFrameStyle (uint newStyle) + { + return invokeObjcSelf!(void, "setImageFrameStyle:", uint)(newStyle); + } + +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSImageRep.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSImageRep.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,258 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSImageRep; + +import dstep.appkit.AppKitDefines; +import dstep.appkit.NSPasteboard; +import dstep.foundation.NSArray; +import dstep.foundation.NSCoder; +import dstep.foundation.NSData; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSURL; +import dstep.foundation.NSZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.appkit.NSImageRep_bindings; + +private +{ + NSString NSImageRepRegistryDidChangeNotification_; +} + +NSString NSImageRepRegistryDidChangeNotification () +{ + if (NSImageRepRegistryDidChangeNotification_) + return NSImageRepRegistryDidChangeNotification_; + + return NSImageRepRegistryDidChangeNotification_ = new NSString(bindings.NSImageRepRegistryDidChangeNotification); +} + +enum +{ + NSImageRepMatchesDevice = 0 +} + +class NSImageRep : NSObject, INSCopying, INSCoding +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + typeof(this) copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); + } + + bool draw () + { + return invokeObjcSelf!(bool, "draw"); + } + + bool drawAtPoint (NSPoint point) + { + return invokeObjcSelf!(bool, "drawAtPoint:", NSPoint)(point); + } + + bool drawInRect (NSRect rect) + { + return invokeObjcSelf!(bool, "drawInRect:", NSRect)(rect); + } + + void setSize (NSSize aSize) + { + return invokeObjcSelf!(void, "setSize:", NSSize)(aSize); + } + + NSSize size () + { + return invokeObjcSelf!(NSSize, "size"); + } + + void setAlpha (bool flag) + { + return invokeObjcSelf!(void, "setAlpha:", bool)(flag); + } + + bool hasAlpha () + { + return invokeObjcSelf!(bool, "hasAlpha"); + } + + void setOpaque (bool flag) + { + return invokeObjcSelf!(void, "setOpaque:", bool)(flag); + } + + bool isOpaque () + { + return invokeObjcSelf!(bool, "isOpaque"); + } + + void setColorSpaceName (NSString string) + { + return invokeObjcSelf!(void, "setColorSpaceName:", NSString)(string); + } + + NSString colorSpaceName () + { + return invokeObjcSelf!(NSString, "colorSpaceName"); + } + + void setBitsPerSample (NSInteger anInt) + { + return invokeObjcSelf!(void, "setBitsPerSample:", NSInteger)(anInt); + } + + NSInteger bitsPerSample () + { + return invokeObjcSelf!(NSInteger, "bitsPerSample"); + } + + void setPixelsWide (NSInteger anInt) + { + return invokeObjcSelf!(void, "setPixelsWide:", NSInteger)(anInt); + } + + NSInteger pixelsWide () + { + return invokeObjcSelf!(NSInteger, "pixelsWide"); + } + + void setPixelsHigh (NSInteger anInt) + { + return invokeObjcSelf!(void, "setPixelsHigh:", NSInteger)(anInt); + } + + NSInteger pixelsHigh () + { + return invokeObjcSelf!(NSInteger, "pixelsHigh"); + } + + static void registerImageRepClass (Class imageRepClass) + { + return invokeObjcSelfClass!(void, "registerImageRepClass:", Class)(imageRepClass); + } + + static void unregisterImageRepClass (Class imageRepClass) + { + return invokeObjcSelfClass!(void, "unregisterImageRepClass:", Class)(imageRepClass); + } + + static NSArray registeredImageRepClasses () + { + return invokeObjcSelfClass!(NSArray, "registeredImageRepClasses"); + } + + static Class imageRepClassForFileType (NSString type) + { + return invokeObjcSelfClass!(Class, "imageRepClassForFileType:", NSString)(type); + } + + static Class imageRepClassForPasteboardType (NSString type) + { + return invokeObjcSelfClass!(Class, "imageRepClassForPasteboardType:", NSString)(type); + } + + static Class imageRepClassForType (NSString type) + { + return invokeObjcSelfClass!(Class, "imageRepClassForType:", NSString)(type); + } + + static Class imageRepClassForData (NSData data) + { + return invokeObjcSelfClass!(Class, "imageRepClassForData:", NSData)(data); + } + + static bool canInitWithData (NSData data) + { + return invokeObjcSelfClass!(bool, "canInitWithData:", NSData)(data); + } + + static NSArray imageUnfilteredFileTypes () + { + return invokeObjcSelfClass!(NSArray, "imageUnfilteredFileTypes"); + } + + static NSArray imageUnfilteredPasteboardTypes () + { + return invokeObjcSelfClass!(NSArray, "imageUnfilteredPasteboardTypes"); + } + + static NSArray imageFileTypes () + { + return invokeObjcSelfClass!(NSArray, "imageFileTypes"); + } + + static NSArray imagePasteboardTypes () + { + return invokeObjcSelfClass!(NSArray, "imagePasteboardTypes"); + } + + static NSArray imageUnfilteredTypes () + { + return invokeObjcSelfClass!(NSArray, "imageUnfilteredTypes"); + } + + static NSArray imageTypes () + { + return invokeObjcSelfClass!(NSArray, "imageTypes"); + } + + static bool canInitWithPasteboard (NSPasteboard pasteboard) + { + return invokeObjcSelfClass!(bool, "canInitWithPasteboard:", NSPasteboard)(pasteboard); + } + + static NSArray imageRepsWithContentsOfFile (NSString filename) + { + return invokeObjcSelfClass!(NSArray, "imageRepsWithContentsOfFile:", NSString)(filename); + } + + static Object imageRepWithContentsOfFile (NSString filename) + { + return invokeObjcSelfClass!(Object, "imageRepWithContentsOfFile:", NSString)(filename); + } + + static NSArray imageRepsWithContentsOfURL (NSURL url) + { + return invokeObjcSelfClass!(NSArray, "imageRepsWithContentsOfURL:", NSURL)(url); + } + + static Object imageRepWithContentsOfURL (NSURL url) + { + return invokeObjcSelfClass!(Object, "imageRepWithContentsOfURL:", NSURL)(url); + } + + static NSArray imageRepsWithPasteboard (NSPasteboard pasteboard) + { + return invokeObjcSelfClass!(NSArray, "imageRepsWithPasteboard:", NSPasteboard)(pasteboard); + } + + static Object imageRepWithPasteboard (NSPasteboard pasteboard) + { + return invokeObjcSelfClass!(Object, "imageRepWithPasteboard:", NSPasteboard)(pasteboard); + } + +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSImageRep_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSImageRep_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,18 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSImageRep_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package id NSImageRepRegistryDidChangeNotification; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSImageView.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSImageView.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,89 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSImageView; + +import dstep.appkit.NSControl; +import dstep.appkit.NSImage; +import dstep.appkit.NSImageCell; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSImageView : NSControl +{ + mixin (ObjcWrap); + + NSImage image () + { + return invokeObjcSelf!(NSImage, "image"); + } + + void setImage (NSImage newImage) + { + return invokeObjcSelf!(void, "setImage:", NSImage)(newImage); + } + + uint imageAlignment () + { + return invokeObjcSelf!(uint, "imageAlignment"); + } + + void setImageAlignment (uint newAlign) + { + return invokeObjcSelf!(void, "setImageAlignment:", uint)(newAlign); + } + + uint imageScaling () + { + return invokeObjcSelf!(uint, "imageScaling"); + } + + void setImageScaling (uint newScaling) + { + return invokeObjcSelf!(void, "setImageScaling:", uint)(newScaling); + } + + uint imageFrameStyle () + { + return invokeObjcSelf!(uint, "imageFrameStyle"); + } + + void setImageFrameStyle (uint newStyle) + { + return invokeObjcSelf!(void, "setImageFrameStyle:", uint)(newStyle); + } + + void setEditable (bool yn) + { + return invokeObjcSelf!(void, "setEditable:", bool)(yn); + } + + bool isEditable () + { + return invokeObjcSelf!(bool, "isEditable"); + } + + void setAnimates (bool flag) + { + return invokeObjcSelf!(void, "setAnimates:", bool)(flag); + } + + bool animates () + { + return invokeObjcSelf!(bool, "animates"); + } + + bool allowsCutCopyPaste () + { + return invokeObjcSelf!(bool, "allowsCutCopyPaste"); + } + + void setAllowsCutCopyPaste (bool allow) + { + return invokeObjcSelf!(void, "setAllowsCutCopyPaste:", bool)(allow); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSImage_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSImage_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,61 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSImage_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package const id NSImageNameQuickLookTemplate; + package const id NSImageNameBluetoothTemplate; + package const id NSImageNameIChatTheaterTemplate; + package const id NSImageNameSlideshowTemplate; + package const id NSImageNameActionTemplate; + package const id NSImageNameSmartBadgeTemplate; + package const id NSImageNameIconViewTemplate; + package const id NSImageNameListViewTemplate; + package const id NSImageNameColumnViewTemplate; + package const id NSImageNameFlowViewTemplate; + package const id NSImageNamePathTemplate; + package const id NSImageNameInvalidDataFreestandingTemplate; + package const id NSImageNameLockLockedTemplate; + package const id NSImageNameLockUnlockedTemplate; + package const id NSImageNameGoRightTemplate; + package const id NSImageNameGoLeftTemplate; + package const id NSImageNameRightFacingTriangleTemplate; + package const id NSImageNameLeftFacingTriangleTemplate; + package const id NSImageNameAddTemplate; + package const id NSImageNameRemoveTemplate; + package const id NSImageNameRevealFreestandingTemplate; + package const id NSImageNameFollowLinkFreestandingTemplate; + package const id NSImageNameEnterFullScreenTemplate; + package const id NSImageNameExitFullScreenTemplate; + package const id NSImageNameStopProgressTemplate; + package const id NSImageNameStopProgressFreestandingTemplate; + package const id NSImageNameRefreshTemplate; + package const id NSImageNameRefreshFreestandingTemplate; + package const id NSImageNameBonjour; + package const id NSImageNameDotMac; + package const id NSImageNameComputer; + package const id NSImageNameFolderBurnable; + package const id NSImageNameFolderSmart; + package const id NSImageNameNetwork; + package const id NSImageNameMultipleDocuments; + package const id NSImageNameUserAccounts; + package const id NSImageNamePreferencesGeneral; + package const id NSImageNameAdvanced; + package const id NSImageNameInfo; + package const id NSImageNameFontPanel; + package const id NSImageNameColorPanel; + package const id NSImageNameUser; + package const id NSImageNameUserGroup; + package const id NSImageNameEveryone; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSInputManager.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSInputManager.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,178 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSInputManager; + +import dstep.foundation.NSArray; +import dstep.appkit.NSAttributedString; +import dstep.appkit.NSEvent; +import dstep.appkit.NSImage; +import dstep.appkit.NSInputServer; +import dstep.foundation.NSAttributedString; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSRange; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSInputManager : NSObject, INSTextInput +{ + mixin (ObjcWrap); + + static NSInputManager currentInputManager () + { + return invokeObjcSelfClass!(NSInputManager, "currentInputManager"); + } + + static void cycleToNextInputLanguage (Object sender) + { + return invokeObjcSelfClass!(void, "cycleToNextInputLanguage:", Object)(sender); + } + + static void cycleToNextInputServerInLanguage (Object sender) + { + return invokeObjcSelfClass!(void, "cycleToNextInputServerInLanguage:", Object)(sender); + } + + NSInputManager initWithName (NSString inputServerName, NSString hostName) + { + id result = invokeObjcSelf!(id, "initWithName:host:", NSString, NSString)(inputServerName, hostName); + return result is this.objcObject ? this : (result !is null ? new NSInputManager(result) : null); + } + + this (NSString inputServerName, NSString hostName) + { + super(NSInputManager.alloc.initWithName(inputServerName, hostName).objcObject); + } + + NSString localizedInputManagerName () + { + return invokeObjcSelf!(NSString, "localizedInputManagerName"); + } + + void markedTextAbandoned (Object cli) + { + return invokeObjcSelf!(void, "markedTextAbandoned:", Object)(cli); + } + + void markedTextSelectionChanged (NSRange newSel, Object cli) + { + return invokeObjcSelf!(void, "markedTextSelectionChanged:client:", NSRange, Object)(newSel, cli); + } + + bool wantsToInterpretAllKeystrokes () + { + return invokeObjcSelf!(bool, "wantsToInterpretAllKeystrokes"); + } + + NSString language () + { + return invokeObjcSelf!(NSString, "language"); + } + + NSImage image () + { + return invokeObjcSelf!(NSImage, "image"); + } + + NSInputServer server () + { + return invokeObjcSelf!(NSInputServer, "server"); + } + + bool wantsToHandleMouseEvents () + { + return invokeObjcSelf!(bool, "wantsToHandleMouseEvents"); + } + + bool handleMouseEvent (NSEvent theMouseEvent) + { + return invokeObjcSelf!(bool, "handleMouseEvent:", NSEvent)(theMouseEvent); + } + + bool wantsToDelayTextChangeNotifications () + { + return invokeObjcSelf!(bool, "wantsToDelayTextChangeNotifications"); + } + + void insertText (Object aString) + { + return invokeObjcSelf!(void, "insertText:", Object)(aString); + } + + void doCommandBySelector (SEL aSelector) + { + return invokeObjcSelf!(void, "doCommandBySelector:", SEL)(aSelector); + } + + void setMarkedText (Object aString, NSRange selRange) + { + return invokeObjcSelf!(void, "setMarkedText:selectedRange:", Object, NSRange)(aString, selRange); + } + + void unmarkText () + { + return invokeObjcSelf!(void, "unmarkText"); + } + + bool hasMarkedText () + { + return invokeObjcSelf!(bool, "hasMarkedText"); + } + + NSInteger conversationIdentifier () + { + return invokeObjcSelf!(NSInteger, "conversationIdentifier"); + } + + NSAttributedString attributedSubstringFromRange (NSRange theRange) + { + return invokeObjcSelf!(NSAttributedString, "attributedSubstringFromRange:", NSRange)(theRange); + } + + NSRange markedRange () + { + return invokeObjcSelf!(NSRange, "markedRange"); + } + + NSRange selectedRange () + { + return invokeObjcSelf!(NSRange, "selectedRange"); + } + + NSRect firstRectForCharacterRange (NSRange theRange) + { + return invokeObjcSelf!(NSRect, "firstRectForCharacterRange:", NSRange)(theRange); + } + + NSUInteger characterIndexForPoint (NSPoint thePoint) + { + return invokeObjcSelf!(NSUInteger, "characterIndexForPoint:", NSPoint)(thePoint); + } + + NSArray validAttributesForMarkedText () + { + return invokeObjcSelf!(NSArray, "validAttributesForMarkedText"); + } +} + +interface INSTextInput +{ + void insertText (Object aString); + void doCommandBySelector (SEL aSelector); + void setMarkedText (Object aString, NSRange selRange); + void unmarkText (); + bool hasMarkedText (); + NSInteger conversationIdentifier (); + NSAttributedString attributedSubstringFromRange (NSRange theRange); + NSRange markedRange (); + NSRange selectedRange (); + NSRect firstRectForCharacterRange (NSRange theRange); + NSUInteger characterIndexForPoint (NSPoint thePoint); + NSArray validAttributesForMarkedText (); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSInputServer.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSInputServer.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,148 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSInputServer; + +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSRange; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSInputServer : NSObject, INSInputServiceProvider, INSInputServerMouseTracker +{ + mixin (ObjcWrap); + + NSInputServer initWithDelegate (Object aDelegate, NSString name) + { + id result = invokeObjcSelf!(id, "initWithDelegate:name:", Object, NSString)(aDelegate, name); + return result is this.objcObject ? this : (result !is null ? new NSInputServer(result) : null); + } + + this (Object aDelegate, NSString name) + { + super(NSInputServer.alloc.initWithDelegate(aDelegate, name).objcObject); + } + + void insertText (Object aString, Object sender) + { + return invokeObjcSelf!(void, "insertText:client:", Object, Object)(aString, sender); + } + + void doCommandBySelector (SEL aSelector, Object sender) + { + return invokeObjcSelf!(void, "doCommandBySelector:client:", SEL, Object)(aSelector, sender); + } + + void markedTextAbandoned (Object sender) + { + return invokeObjcSelf!(void, "markedTextAbandoned:", Object)(sender); + } + + void markedTextSelectionChanged (NSRange newSel, Object sender) + { + return invokeObjcSelf!(void, "markedTextSelectionChanged:client:", NSRange, Object)(newSel, sender); + } + + void terminate (Object sender) + { + return invokeObjcSelf!(void, "terminate:", Object)(sender); + } + + bool canBeDisabled () + { + return invokeObjcSelf!(bool, "canBeDisabled"); + } + + bool wantsToInterpretAllKeystrokes () + { + return invokeObjcSelf!(bool, "wantsToInterpretAllKeystrokes"); + } + + bool wantsToHandleMouseEvents () + { + return invokeObjcSelf!(bool, "wantsToHandleMouseEvents"); + } + + bool wantsToDelayTextChangeNotifications () + { + return invokeObjcSelf!(bool, "wantsToDelayTextChangeNotifications"); + } + + void inputClientBecomeActive (Object sender) + { + return invokeObjcSelf!(void, "inputClientBecomeActive:", Object)(sender); + } + + void inputClientResignActive (Object sender) + { + return invokeObjcSelf!(void, "inputClientResignActive:", Object)(sender); + } + + void inputClientEnabled (Object sender) + { + return invokeObjcSelf!(void, "inputClientEnabled:", Object)(sender); + } + + void inputClientDisabled (Object sender) + { + return invokeObjcSelf!(void, "inputClientDisabled:", Object)(sender); + } + + void activeConversationWillChange (Object sender, NSInteger oldConversation) + { + return invokeObjcSelf!(void, "activeConversationWillChange:fromOldConversation:", Object, NSInteger)(sender, oldConversation); + } + + void activeConversationChanged (Object sender, NSInteger newConversation) + { + return invokeObjcSelf!(void, "activeConversationChanged:toNewConversation:", Object, NSInteger)(sender, newConversation); + } + + bool mouseDownOnCharacterIndex (NSUInteger theIndex, NSPoint thePoint, NSUInteger theFlags, Object sender) + { + return invokeObjcSelf!(bool, "mouseDownOnCharacterIndex:atCoordinate:withModifier:client:", NSUInteger, NSPoint, NSUInteger, Object)(theIndex, thePoint, theFlags, sender); + } + + bool mouseDraggedOnCharacterIndex (NSUInteger theIndex, NSPoint thePoint, NSUInteger theFlags, Object sender) + { + return invokeObjcSelf!(bool, "mouseDraggedOnCharacterIndex:atCoordinate:withModifier:client:", NSUInteger, NSPoint, NSUInteger, Object)(theIndex, thePoint, theFlags, sender); + } + + void mouseUpOnCharacterIndex (NSUInteger theIndex, NSPoint thePoint, NSUInteger theFlags, Object sender) + { + return invokeObjcSelf!(void, "mouseUpOnCharacterIndex:atCoordinate:withModifier:client:", NSUInteger, NSPoint, NSUInteger, Object)(theIndex, thePoint, theFlags, sender); + } +} + +interface INSInputServiceProvider +{ + void insertText (Object aString, Object sender); + void doCommandBySelector (SEL aSelector, Object sender); + void markedTextAbandoned (Object sender); + void markedTextSelectionChanged (NSRange newSel, Object sender); + void terminate (Object sender); + bool canBeDisabled (); + bool wantsToInterpretAllKeystrokes (); + bool wantsToHandleMouseEvents (); + bool wantsToDelayTextChangeNotifications (); + void inputClientBecomeActive (Object sender); + void inputClientResignActive (Object sender); + void inputClientEnabled (Object sender); + void inputClientDisabled (Object sender); + void activeConversationWillChange (Object sender, NSInteger oldConversation); + void activeConversationChanged (Object sender, NSInteger newConversation); +} + +interface INSInputServerMouseTracker +{ + bool mouseDownOnCharacterIndex (NSUInteger theIndex, NSPoint thePoint, NSUInteger theFlags, Object sender); + bool mouseDraggedOnCharacterIndex (NSUInteger theIndex, NSPoint thePoint, NSUInteger theFlags, Object sender); + void mouseUpOnCharacterIndex (NSUInteger theIndex, NSPoint thePoint, NSUInteger theFlags, Object sender); +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSInterfaceStyle.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSInterfaceStyle.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,62 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSInterfaceStyle; + +import dstep.appkit.AppKitDefines; +import dstep.appkit.NSResponder; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.appkit.NSInterfaceStyle_bindings; + +alias NSUInteger NSInterfaceStyle; + +private +{ + NSString NSInterfaceStyleDefault_; +} + +NSString NSInterfaceStyleDefault () +{ + if (NSInterfaceStyleDefault_) + return NSInterfaceStyleDefault_; + + return NSInterfaceStyleDefault_ = new NSString(bindings.NSInterfaceStyleDefault); +} + +enum +{ + NSNoInterfaceStyle = 0, + NSNextStepInterfaceStyle = 1, + NSWindows95InterfaceStyle = 2, + NSMacintoshInterfaceStyle = 3 +} + +const TNSInterfaceStyle = ` + + uint interfaceStyle () + { + return invokeObjcSelf!(uint, "interfaceStyle"); + } + + void setInterfaceStyle (uint interfaceStyle) + { + return invokeObjcSelf!(void, "setInterfaceStyle:", uint)(interfaceStyle); + } + + //mixin ObjcBindMethod!(interfaceStyle, "interfaceStyle"); + //mixin ObjcBindMethod!(setInterfaceStyle, "setInterfaceStyle:"); + +`; +/* +uint NSInterfaceStyleForKey (NSString key, NSResponder responder) +{ + return Bridge.invokeObjcFunction!(uint, bindings.NSInterfaceStyleForKey, NSString, NSResponder)(key, responder); +} +*/ \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSInterfaceStyle_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSInterfaceStyle_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,22 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSInterfaceStyle_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package id NSInterfaceStyleDefault; + } +} + +extern (C) +{ + package uint NSInterfaceStyleForKey (id key, id responder); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSKeyValueBinding.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSKeyValueBinding.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,1103 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSKeyValueBinding; + +import dstep.appkit.AppKitDefines; +import dstep.foundation.NSArray; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSString; +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.appkit.NSKeyValueBinding_bindings; + +extern (C) +{ + extern + { + package id NSMultipleValuesMarker; + package id NSNoSelectionMarker; + package id NSNotApplicableMarker; + } +} + +private +{ + NSString NSObservedObjectKey_; + NSString NSObservedKeyPathKey_; + NSString NSOptionsKey_; + NSString NSAlignmentBinding_; + NSString NSAlternateImageBinding_; + NSString NSAlternateTitleBinding_; + NSString NSAnimateBinding_; + NSString NSAnimationDelayBinding_; + NSString NSArgumentBinding_; + NSString NSAttributedStringBinding_; + NSString NSContentArrayBinding_; + NSString NSContentArrayForMultipleSelectionBinding_; + NSString NSContentBinding_; + NSString NSContentDictionaryBinding_; + NSString NSContentHeightBinding_; + NSString NSContentObjectBinding_; + NSString NSContentObjectsBinding_; + NSString NSContentSetBinding_; + NSString NSContentValuesBinding_; + NSString NSContentWidthBinding_; + NSString NSCriticalValueBinding_; + NSString NSDataBinding_; + NSString NSDisplayPatternTitleBinding_; + NSString NSDisplayPatternValueBinding_; + NSString NSDocumentEditedBinding_; + NSString NSDoubleClickArgumentBinding_; + NSString NSDoubleClickTargetBinding_; + NSString NSEditableBinding_; + NSString NSEnabledBinding_; + NSString NSExcludedKeysBinding_; + NSString NSFilterPredicateBinding_; + NSString NSFontBinding_; + NSString NSFontBoldBinding_; + NSString NSFontFamilyNameBinding_; + NSString NSFontItalicBinding_; + NSString NSFontNameBinding_; + NSString NSFontSizeBinding_; + NSString NSHeaderTitleBinding_; + NSString NSHiddenBinding_; + NSString NSImageBinding_; + NSString NSIncludedKeysBinding_; + NSString NSInitialKeyBinding_; + NSString NSInitialValueBinding_; + NSString NSIsIndeterminateBinding_; + NSString NSLabelBinding_; + NSString NSLocalizedKeyDictionaryBinding_; + NSString NSManagedObjectContextBinding_; + NSString NSMaximumRecentsBinding_; + NSString NSMaxValueBinding_; + NSString NSMaxWidthBinding_; + NSString NSMinValueBinding_; + NSString NSMinWidthBinding_; + NSString NSMixedStateImageBinding_; + NSString NSOffStateImageBinding_; + NSString NSOnStateImageBinding_; + NSString NSPredicateBinding_; + NSString NSRecentSearchesBinding_; + NSString NSRepresentedFilenameBinding_; + NSString NSRowHeightBinding_; + NSString NSSelectedIdentifierBinding_; + NSString NSSelectedIndexBinding_; + NSString NSSelectedLabelBinding_; + NSString NSSelectedObjectBinding_; + NSString NSSelectedObjectsBinding_; + NSString NSSelectedTagBinding_; + NSString NSSelectedValueBinding_; + NSString NSSelectedValuesBinding_; + NSString NSSelectionIndexesBinding_; + NSString NSSelectionIndexPathsBinding_; + NSString NSSortDescriptorsBinding_; + NSString NSTargetBinding_; + NSString NSTextColorBinding_; + NSString NSTitleBinding_; + NSString NSToolTipBinding_; + NSString NSTransparentBinding_; + NSString NSValueBinding_; + NSString NSValuePathBinding_; + NSString NSValueURLBinding_; + NSString NSVisibleBinding_; + NSString NSWarningValueBinding_; + NSString NSWidthBinding_; + NSString NSAllowsEditingMultipleValuesSelectionBindingOption_; + NSString NSAllowsNullArgumentBindingOption_; + NSString NSAlwaysPresentsApplicationModalAlertsBindingOption_; + NSString NSConditionallySetsEditableBindingOption_; + NSString NSConditionallySetsEnabledBindingOption_; + NSString NSConditionallySetsHiddenBindingOption_; + NSString NSContinuouslyUpdatesValueBindingOption_; + NSString NSCreatesSortDescriptorBindingOption_; + NSString NSDeletesObjectsOnRemoveBindingsOption_; + NSString NSDisplayNameBindingOption_; + NSString NSDisplayPatternBindingOption_; + NSString NSContentPlacementTagBindingOption_; + NSString NSHandlesContentAsCompoundValueBindingOption_; + NSString NSInsertsNullPlaceholderBindingOption_; + NSString NSInvokesSeparatelyWithArrayObjectsBindingOption_; + NSString NSMultipleValuesPlaceholderBindingOption_; + NSString NSNoSelectionPlaceholderBindingOption_; + NSString NSNotApplicablePlaceholderBindingOption_; + NSString NSNullPlaceholderBindingOption_; + NSString NSRaisesForNotApplicableKeysBindingOption_; + NSString NSPredicateFormatBindingOption_; + NSString NSSelectorNameBindingOption_; + NSString NSSelectsAllWhenSettingContentBindingOption_; + NSString NSValidatesImmediatelyBindingOption_; + NSString NSValueTransformerNameBindingOption_; + NSString NSValueTransformerBindingOption_; +} + +NSString NSObservedObjectKey () +{ + if (NSObservedObjectKey_) + return NSObservedObjectKey_; + + return NSObservedObjectKey_ = new NSString(bindings.NSObservedObjectKey); +} + +NSString NSObservedKeyPathKey () +{ + if (NSObservedKeyPathKey_) + return NSObservedKeyPathKey_; + + return NSObservedKeyPathKey_ = new NSString(bindings.NSObservedKeyPathKey); +} + +NSString NSOptionsKey () +{ + if (NSOptionsKey_) + return NSOptionsKey_; + + return NSOptionsKey_ = new NSString(bindings.NSOptionsKey); +} + +NSString NSAlignmentBinding () +{ + if (NSAlignmentBinding_) + return NSAlignmentBinding_; + + return NSAlignmentBinding_ = new NSString(bindings.NSAlignmentBinding); +} + +NSString NSAlternateImageBinding () +{ + if (NSAlternateImageBinding_) + return NSAlternateImageBinding_; + + return NSAlternateImageBinding_ = new NSString(bindings.NSAlternateImageBinding); +} + +NSString NSAlternateTitleBinding () +{ + if (NSAlternateTitleBinding_) + return NSAlternateTitleBinding_; + + return NSAlternateTitleBinding_ = new NSString(bindings.NSAlternateTitleBinding); +} + +NSString NSAnimateBinding () +{ + if (NSAnimateBinding_) + return NSAnimateBinding_; + + return NSAnimateBinding_ = new NSString(bindings.NSAnimateBinding); +} + +NSString NSAnimationDelayBinding () +{ + if (NSAnimationDelayBinding_) + return NSAnimationDelayBinding_; + + return NSAnimationDelayBinding_ = new NSString(bindings.NSAnimationDelayBinding); +} + +NSString NSArgumentBinding () +{ + if (NSArgumentBinding_) + return NSArgumentBinding_; + + return NSArgumentBinding_ = new NSString(bindings.NSArgumentBinding); +} + +NSString NSAttributedStringBinding () +{ + if (NSAttributedStringBinding_) + return NSAttributedStringBinding_; + + return NSAttributedStringBinding_ = new NSString(bindings.NSAttributedStringBinding); +} + +NSString NSContentArrayBinding () +{ + if (NSContentArrayBinding_) + return NSContentArrayBinding_; + + return NSContentArrayBinding_ = new NSString(bindings.NSContentArrayBinding); +} + +NSString NSContentArrayForMultipleSelectionBinding () +{ + if (NSContentArrayForMultipleSelectionBinding_) + return NSContentArrayForMultipleSelectionBinding_; + + return NSContentArrayForMultipleSelectionBinding_ = new NSString(bindings.NSContentArrayForMultipleSelectionBinding); +} + +NSString NSContentBinding () +{ + if (NSContentBinding_) + return NSContentBinding_; + + return NSContentBinding_ = new NSString(bindings.NSContentBinding); +} + +NSString NSContentDictionaryBinding () +{ + if (NSContentDictionaryBinding_) + return NSContentDictionaryBinding_; + + return NSContentDictionaryBinding_ = new NSString(bindings.NSContentDictionaryBinding); +} + +NSString NSContentHeightBinding () +{ + if (NSContentHeightBinding_) + return NSContentHeightBinding_; + + return NSContentHeightBinding_ = new NSString(bindings.NSContentHeightBinding); +} + +NSString NSContentObjectBinding () +{ + if (NSContentObjectBinding_) + return NSContentObjectBinding_; + + return NSContentObjectBinding_ = new NSString(bindings.NSContentObjectBinding); +} + +NSString NSContentObjectsBinding () +{ + if (NSContentObjectsBinding_) + return NSContentObjectsBinding_; + + return NSContentObjectsBinding_ = new NSString(bindings.NSContentObjectsBinding); +} + +NSString NSContentSetBinding () +{ + if (NSContentSetBinding_) + return NSContentSetBinding_; + + return NSContentSetBinding_ = new NSString(bindings.NSContentSetBinding); +} + +NSString NSContentValuesBinding () +{ + if (NSContentValuesBinding_) + return NSContentValuesBinding_; + + return NSContentValuesBinding_ = new NSString(bindings.NSContentValuesBinding); +} + +NSString NSContentWidthBinding () +{ + if (NSContentWidthBinding_) + return NSContentWidthBinding_; + + return NSContentWidthBinding_ = new NSString(bindings.NSContentWidthBinding); +} + +NSString NSCriticalValueBinding () +{ + if (NSCriticalValueBinding_) + return NSCriticalValueBinding_; + + return NSCriticalValueBinding_ = new NSString(bindings.NSCriticalValueBinding); +} + +NSString NSDataBinding () +{ + if (NSDataBinding_) + return NSDataBinding_; + + return NSDataBinding_ = new NSString(bindings.NSDataBinding); +} + +NSString NSDisplayPatternTitleBinding () +{ + if (NSDisplayPatternTitleBinding_) + return NSDisplayPatternTitleBinding_; + + return NSDisplayPatternTitleBinding_ = new NSString(bindings.NSDisplayPatternTitleBinding); +} + +NSString NSDisplayPatternValueBinding () +{ + if (NSDisplayPatternValueBinding_) + return NSDisplayPatternValueBinding_; + + return NSDisplayPatternValueBinding_ = new NSString(bindings.NSDisplayPatternValueBinding); +} + +NSString NSDocumentEditedBinding () +{ + if (NSDocumentEditedBinding_) + return NSDocumentEditedBinding_; + + return NSDocumentEditedBinding_ = new NSString(bindings.NSDocumentEditedBinding); +} + +NSString NSDoubleClickArgumentBinding () +{ + if (NSDoubleClickArgumentBinding_) + return NSDoubleClickArgumentBinding_; + + return NSDoubleClickArgumentBinding_ = new NSString(bindings.NSDoubleClickArgumentBinding); +} + +NSString NSDoubleClickTargetBinding () +{ + if (NSDoubleClickTargetBinding_) + return NSDoubleClickTargetBinding_; + + return NSDoubleClickTargetBinding_ = new NSString(bindings.NSDoubleClickTargetBinding); +} + +NSString NSEditableBinding () +{ + if (NSEditableBinding_) + return NSEditableBinding_; + + return NSEditableBinding_ = new NSString(bindings.NSEditableBinding); +} + +NSString NSEnabledBinding () +{ + if (NSEnabledBinding_) + return NSEnabledBinding_; + + return NSEnabledBinding_ = new NSString(bindings.NSEnabledBinding); +} + +NSString NSExcludedKeysBinding () +{ + if (NSExcludedKeysBinding_) + return NSExcludedKeysBinding_; + + return NSExcludedKeysBinding_ = new NSString(bindings.NSExcludedKeysBinding); +} + +NSString NSFilterPredicateBinding () +{ + if (NSFilterPredicateBinding_) + return NSFilterPredicateBinding_; + + return NSFilterPredicateBinding_ = new NSString(bindings.NSFilterPredicateBinding); +} + +NSString NSFontBinding () +{ + if (NSFontBinding_) + return NSFontBinding_; + + return NSFontBinding_ = new NSString(bindings.NSFontBinding); +} + +NSString NSFontBoldBinding () +{ + if (NSFontBoldBinding_) + return NSFontBoldBinding_; + + return NSFontBoldBinding_ = new NSString(bindings.NSFontBoldBinding); +} + +NSString NSFontFamilyNameBinding () +{ + if (NSFontFamilyNameBinding_) + return NSFontFamilyNameBinding_; + + return NSFontFamilyNameBinding_ = new NSString(bindings.NSFontFamilyNameBinding); +} + +NSString NSFontItalicBinding () +{ + if (NSFontItalicBinding_) + return NSFontItalicBinding_; + + return NSFontItalicBinding_ = new NSString(bindings.NSFontItalicBinding); +} + +NSString NSFontNameBinding () +{ + if (NSFontNameBinding_) + return NSFontNameBinding_; + + return NSFontNameBinding_ = new NSString(bindings.NSFontNameBinding); +} + +NSString NSFontSizeBinding () +{ + if (NSFontSizeBinding_) + return NSFontSizeBinding_; + + return NSFontSizeBinding_ = new NSString(bindings.NSFontSizeBinding); +} + +NSString NSHeaderTitleBinding () +{ + if (NSHeaderTitleBinding_) + return NSHeaderTitleBinding_; + + return NSHeaderTitleBinding_ = new NSString(bindings.NSHeaderTitleBinding); +} + +NSString NSHiddenBinding () +{ + if (NSHiddenBinding_) + return NSHiddenBinding_; + + return NSHiddenBinding_ = new NSString(bindings.NSHiddenBinding); +} + +NSString NSImageBinding () +{ + if (NSImageBinding_) + return NSImageBinding_; + + return NSImageBinding_ = new NSString(bindings.NSImageBinding); +} + +NSString NSIncludedKeysBinding () +{ + if (NSIncludedKeysBinding_) + return NSIncludedKeysBinding_; + + return NSIncludedKeysBinding_ = new NSString(bindings.NSIncludedKeysBinding); +} + +NSString NSInitialKeyBinding () +{ + if (NSInitialKeyBinding_) + return NSInitialKeyBinding_; + + return NSInitialKeyBinding_ = new NSString(bindings.NSInitialKeyBinding); +} + +NSString NSInitialValueBinding () +{ + if (NSInitialValueBinding_) + return NSInitialValueBinding_; + + return NSInitialValueBinding_ = new NSString(bindings.NSInitialValueBinding); +} + +NSString NSIsIndeterminateBinding () +{ + if (NSIsIndeterminateBinding_) + return NSIsIndeterminateBinding_; + + return NSIsIndeterminateBinding_ = new NSString(bindings.NSIsIndeterminateBinding); +} + +NSString NSLabelBinding () +{ + if (NSLabelBinding_) + return NSLabelBinding_; + + return NSLabelBinding_ = new NSString(bindings.NSLabelBinding); +} + +NSString NSLocalizedKeyDictionaryBinding () +{ + if (NSLocalizedKeyDictionaryBinding_) + return NSLocalizedKeyDictionaryBinding_; + + return NSLocalizedKeyDictionaryBinding_ = new NSString(bindings.NSLocalizedKeyDictionaryBinding); +} + +NSString NSManagedObjectContextBinding () +{ + if (NSManagedObjectContextBinding_) + return NSManagedObjectContextBinding_; + + return NSManagedObjectContextBinding_ = new NSString(bindings.NSManagedObjectContextBinding); +} + +NSString NSMaximumRecentsBinding () +{ + if (NSMaximumRecentsBinding_) + return NSMaximumRecentsBinding_; + + return NSMaximumRecentsBinding_ = new NSString(bindings.NSMaximumRecentsBinding); +} + +NSString NSMaxValueBinding () +{ + if (NSMaxValueBinding_) + return NSMaxValueBinding_; + + return NSMaxValueBinding_ = new NSString(bindings.NSMaxValueBinding); +} + +NSString NSMaxWidthBinding () +{ + if (NSMaxWidthBinding_) + return NSMaxWidthBinding_; + + return NSMaxWidthBinding_ = new NSString(bindings.NSMaxWidthBinding); +} + +NSString NSMinValueBinding () +{ + if (NSMinValueBinding_) + return NSMinValueBinding_; + + return NSMinValueBinding_ = new NSString(bindings.NSMinValueBinding); +} + +NSString NSMinWidthBinding () +{ + if (NSMinWidthBinding_) + return NSMinWidthBinding_; + + return NSMinWidthBinding_ = new NSString(bindings.NSMinWidthBinding); +} + +NSString NSMixedStateImageBinding () +{ + if (NSMixedStateImageBinding_) + return NSMixedStateImageBinding_; + + return NSMixedStateImageBinding_ = new NSString(bindings.NSMixedStateImageBinding); +} + +NSString NSOffStateImageBinding () +{ + if (NSOffStateImageBinding_) + return NSOffStateImageBinding_; + + return NSOffStateImageBinding_ = new NSString(bindings.NSOffStateImageBinding); +} + +NSString NSOnStateImageBinding () +{ + if (NSOnStateImageBinding_) + return NSOnStateImageBinding_; + + return NSOnStateImageBinding_ = new NSString(bindings.NSOnStateImageBinding); +} + +NSString NSPredicateBinding () +{ + if (NSPredicateBinding_) + return NSPredicateBinding_; + + return NSPredicateBinding_ = new NSString(bindings.NSPredicateBinding); +} + +NSString NSRecentSearchesBinding () +{ + if (NSRecentSearchesBinding_) + return NSRecentSearchesBinding_; + + return NSRecentSearchesBinding_ = new NSString(bindings.NSRecentSearchesBinding); +} + +NSString NSRepresentedFilenameBinding () +{ + if (NSRepresentedFilenameBinding_) + return NSRepresentedFilenameBinding_; + + return NSRepresentedFilenameBinding_ = new NSString(bindings.NSRepresentedFilenameBinding); +} + +NSString NSRowHeightBinding () +{ + if (NSRowHeightBinding_) + return NSRowHeightBinding_; + + return NSRowHeightBinding_ = new NSString(bindings.NSRowHeightBinding); +} + +NSString NSSelectedIdentifierBinding () +{ + if (NSSelectedIdentifierBinding_) + return NSSelectedIdentifierBinding_; + + return NSSelectedIdentifierBinding_ = new NSString(bindings.NSSelectedIdentifierBinding); +} + +NSString NSSelectedIndexBinding () +{ + if (NSSelectedIndexBinding_) + return NSSelectedIndexBinding_; + + return NSSelectedIndexBinding_ = new NSString(bindings.NSSelectedIndexBinding); +} + +NSString NSSelectedLabelBinding () +{ + if (NSSelectedLabelBinding_) + return NSSelectedLabelBinding_; + + return NSSelectedLabelBinding_ = new NSString(bindings.NSSelectedLabelBinding); +} + +NSString NSSelectedObjectBinding () +{ + if (NSSelectedObjectBinding_) + return NSSelectedObjectBinding_; + + return NSSelectedObjectBinding_ = new NSString(bindings.NSSelectedObjectBinding); +} + +NSString NSSelectedObjectsBinding () +{ + if (NSSelectedObjectsBinding_) + return NSSelectedObjectsBinding_; + + return NSSelectedObjectsBinding_ = new NSString(bindings.NSSelectedObjectsBinding); +} + +NSString NSSelectedTagBinding () +{ + if (NSSelectedTagBinding_) + return NSSelectedTagBinding_; + + return NSSelectedTagBinding_ = new NSString(bindings.NSSelectedTagBinding); +} + +NSString NSSelectedValueBinding () +{ + if (NSSelectedValueBinding_) + return NSSelectedValueBinding_; + + return NSSelectedValueBinding_ = new NSString(bindings.NSSelectedValueBinding); +} + +NSString NSSelectedValuesBinding () +{ + if (NSSelectedValuesBinding_) + return NSSelectedValuesBinding_; + + return NSSelectedValuesBinding_ = new NSString(bindings.NSSelectedValuesBinding); +} + +NSString NSSelectionIndexesBinding () +{ + if (NSSelectionIndexesBinding_) + return NSSelectionIndexesBinding_; + + return NSSelectionIndexesBinding_ = new NSString(bindings.NSSelectionIndexesBinding); +} + +NSString NSSelectionIndexPathsBinding () +{ + if (NSSelectionIndexPathsBinding_) + return NSSelectionIndexPathsBinding_; + + return NSSelectionIndexPathsBinding_ = new NSString(bindings.NSSelectionIndexPathsBinding); +} + +NSString NSSortDescriptorsBinding () +{ + if (NSSortDescriptorsBinding_) + return NSSortDescriptorsBinding_; + + return NSSortDescriptorsBinding_ = new NSString(bindings.NSSortDescriptorsBinding); +} + +NSString NSTargetBinding () +{ + if (NSTargetBinding_) + return NSTargetBinding_; + + return NSTargetBinding_ = new NSString(bindings.NSTargetBinding); +} + +NSString NSTextColorBinding () +{ + if (NSTextColorBinding_) + return NSTextColorBinding_; + + return NSTextColorBinding_ = new NSString(bindings.NSTextColorBinding); +} + +NSString NSTitleBinding () +{ + if (NSTitleBinding_) + return NSTitleBinding_; + + return NSTitleBinding_ = new NSString(bindings.NSTitleBinding); +} + +NSString NSToolTipBinding () +{ + if (NSToolTipBinding_) + return NSToolTipBinding_; + + return NSToolTipBinding_ = new NSString(bindings.NSToolTipBinding); +} + +NSString NSTransparentBinding () +{ + if (NSTransparentBinding_) + return NSTransparentBinding_; + + return NSTransparentBinding_ = new NSString(bindings.NSTransparentBinding); +} + +NSString NSValueBinding () +{ + if (NSValueBinding_) + return NSValueBinding_; + + return NSValueBinding_ = new NSString(bindings.NSValueBinding); +} + +NSString NSValuePathBinding () +{ + if (NSValuePathBinding_) + return NSValuePathBinding_; + + return NSValuePathBinding_ = new NSString(bindings.NSValuePathBinding); +} + +NSString NSValueURLBinding () +{ + if (NSValueURLBinding_) + return NSValueURLBinding_; + + return NSValueURLBinding_ = new NSString(bindings.NSValueURLBinding); +} + +NSString NSVisibleBinding () +{ + if (NSVisibleBinding_) + return NSVisibleBinding_; + + return NSVisibleBinding_ = new NSString(bindings.NSVisibleBinding); +} + +NSString NSWarningValueBinding () +{ + if (NSWarningValueBinding_) + return NSWarningValueBinding_; + + return NSWarningValueBinding_ = new NSString(bindings.NSWarningValueBinding); +} + +NSString NSWidthBinding () +{ + if (NSWidthBinding_) + return NSWidthBinding_; + + return NSWidthBinding_ = new NSString(bindings.NSWidthBinding); +} + +NSString NSAllowsEditingMultipleValuesSelectionBindingOption () +{ + if (NSAllowsEditingMultipleValuesSelectionBindingOption_) + return NSAllowsEditingMultipleValuesSelectionBindingOption_; + + return NSAllowsEditingMultipleValuesSelectionBindingOption_ = new NSString(bindings.NSAllowsEditingMultipleValuesSelectionBindingOption); +} + +NSString NSAllowsNullArgumentBindingOption () +{ + if (NSAllowsNullArgumentBindingOption_) + return NSAllowsNullArgumentBindingOption_; + + return NSAllowsNullArgumentBindingOption_ = new NSString(bindings.NSAllowsNullArgumentBindingOption); +} + +NSString NSAlwaysPresentsApplicationModalAlertsBindingOption () +{ + if (NSAlwaysPresentsApplicationModalAlertsBindingOption_) + return NSAlwaysPresentsApplicationModalAlertsBindingOption_; + + return NSAlwaysPresentsApplicationModalAlertsBindingOption_ = new NSString(bindings.NSAlwaysPresentsApplicationModalAlertsBindingOption); +} + +NSString NSConditionallySetsEditableBindingOption () +{ + if (NSConditionallySetsEditableBindingOption_) + return NSConditionallySetsEditableBindingOption_; + + return NSConditionallySetsEditableBindingOption_ = new NSString(bindings.NSConditionallySetsEditableBindingOption); +} + +NSString NSConditionallySetsEnabledBindingOption () +{ + if (NSConditionallySetsEnabledBindingOption_) + return NSConditionallySetsEnabledBindingOption_; + + return NSConditionallySetsEnabledBindingOption_ = new NSString(bindings.NSConditionallySetsEnabledBindingOption); +} + +NSString NSConditionallySetsHiddenBindingOption () +{ + if (NSConditionallySetsHiddenBindingOption_) + return NSConditionallySetsHiddenBindingOption_; + + return NSConditionallySetsHiddenBindingOption_ = new NSString(bindings.NSConditionallySetsHiddenBindingOption); +} + +NSString NSContinuouslyUpdatesValueBindingOption () +{ + if (NSContinuouslyUpdatesValueBindingOption_) + return NSContinuouslyUpdatesValueBindingOption_; + + return NSContinuouslyUpdatesValueBindingOption_ = new NSString(bindings.NSContinuouslyUpdatesValueBindingOption); +} + +NSString NSCreatesSortDescriptorBindingOption () +{ + if (NSCreatesSortDescriptorBindingOption_) + return NSCreatesSortDescriptorBindingOption_; + + return NSCreatesSortDescriptorBindingOption_ = new NSString(bindings.NSCreatesSortDescriptorBindingOption); +} + +NSString NSDeletesObjectsOnRemoveBindingsOption () +{ + if (NSDeletesObjectsOnRemoveBindingsOption_) + return NSDeletesObjectsOnRemoveBindingsOption_; + + return NSDeletesObjectsOnRemoveBindingsOption_ = new NSString(bindings.NSDeletesObjectsOnRemoveBindingsOption); +} + +NSString NSDisplayNameBindingOption () +{ + if (NSDisplayNameBindingOption_) + return NSDisplayNameBindingOption_; + + return NSDisplayNameBindingOption_ = new NSString(bindings.NSDisplayNameBindingOption); +} + +NSString NSDisplayPatternBindingOption () +{ + if (NSDisplayPatternBindingOption_) + return NSDisplayPatternBindingOption_; + + return NSDisplayPatternBindingOption_ = new NSString(bindings.NSDisplayPatternBindingOption); +} + +NSString NSContentPlacementTagBindingOption () +{ + if (NSContentPlacementTagBindingOption_) + return NSContentPlacementTagBindingOption_; + + return NSContentPlacementTagBindingOption_ = new NSString(bindings.NSContentPlacementTagBindingOption); +} + +NSString NSHandlesContentAsCompoundValueBindingOption () +{ + if (NSHandlesContentAsCompoundValueBindingOption_) + return NSHandlesContentAsCompoundValueBindingOption_; + + return NSHandlesContentAsCompoundValueBindingOption_ = new NSString(bindings.NSHandlesContentAsCompoundValueBindingOption); +} + +NSString NSInsertsNullPlaceholderBindingOption () +{ + if (NSInsertsNullPlaceholderBindingOption_) + return NSInsertsNullPlaceholderBindingOption_; + + return NSInsertsNullPlaceholderBindingOption_ = new NSString(bindings.NSInsertsNullPlaceholderBindingOption); +} + +NSString NSInvokesSeparatelyWithArrayObjectsBindingOption () +{ + if (NSInvokesSeparatelyWithArrayObjectsBindingOption_) + return NSInvokesSeparatelyWithArrayObjectsBindingOption_; + + return NSInvokesSeparatelyWithArrayObjectsBindingOption_ = new NSString(bindings.NSInvokesSeparatelyWithArrayObjectsBindingOption); +} + +NSString NSMultipleValuesPlaceholderBindingOption () +{ + if (NSMultipleValuesPlaceholderBindingOption_) + return NSMultipleValuesPlaceholderBindingOption_; + + return NSMultipleValuesPlaceholderBindingOption_ = new NSString(bindings.NSMultipleValuesPlaceholderBindingOption); +} + +NSString NSNoSelectionPlaceholderBindingOption () +{ + if (NSNoSelectionPlaceholderBindingOption_) + return NSNoSelectionPlaceholderBindingOption_; + + return NSNoSelectionPlaceholderBindingOption_ = new NSString(bindings.NSNoSelectionPlaceholderBindingOption); +} + +NSString NSNotApplicablePlaceholderBindingOption () +{ + if (NSNotApplicablePlaceholderBindingOption_) + return NSNotApplicablePlaceholderBindingOption_; + + return NSNotApplicablePlaceholderBindingOption_ = new NSString(bindings.NSNotApplicablePlaceholderBindingOption); +} + +NSString NSNullPlaceholderBindingOption () +{ + if (NSNullPlaceholderBindingOption_) + return NSNullPlaceholderBindingOption_; + + return NSNullPlaceholderBindingOption_ = new NSString(bindings.NSNullPlaceholderBindingOption); +} + +NSString NSRaisesForNotApplicableKeysBindingOption () +{ + if (NSRaisesForNotApplicableKeysBindingOption_) + return NSRaisesForNotApplicableKeysBindingOption_; + + return NSRaisesForNotApplicableKeysBindingOption_ = new NSString(bindings.NSRaisesForNotApplicableKeysBindingOption); +} + +NSString NSPredicateFormatBindingOption () +{ + if (NSPredicateFormatBindingOption_) + return NSPredicateFormatBindingOption_; + + return NSPredicateFormatBindingOption_ = new NSString(bindings.NSPredicateFormatBindingOption); +} + +NSString NSSelectorNameBindingOption () +{ + if (NSSelectorNameBindingOption_) + return NSSelectorNameBindingOption_; + + return NSSelectorNameBindingOption_ = new NSString(bindings.NSSelectorNameBindingOption); +} + +NSString NSSelectsAllWhenSettingContentBindingOption () +{ + if (NSSelectsAllWhenSettingContentBindingOption_) + return NSSelectsAllWhenSettingContentBindingOption_; + + return NSSelectsAllWhenSettingContentBindingOption_ = new NSString(bindings.NSSelectsAllWhenSettingContentBindingOption); +} + +NSString NSValidatesImmediatelyBindingOption () +{ + if (NSValidatesImmediatelyBindingOption_) + return NSValidatesImmediatelyBindingOption_; + + return NSValidatesImmediatelyBindingOption_ = new NSString(bindings.NSValidatesImmediatelyBindingOption); +} + +NSString NSValueTransformerNameBindingOption () +{ + if (NSValueTransformerNameBindingOption_) + return NSValueTransformerNameBindingOption_; + + return NSValueTransformerNameBindingOption_ = new NSString(bindings.NSValueTransformerNameBindingOption); +} + +NSString NSValueTransformerBindingOption () +{ + if (NSValueTransformerBindingOption_) + return NSValueTransformerBindingOption_; + + return NSValueTransformerBindingOption_ = new NSString(bindings.NSValueTransformerBindingOption); +} + +const TNSKeyValueBindingCreation = ` + + static void exposeBinding (NSString binding) + { + return invokeObjcSelfClass!(void, "exposeBinding:", NSString)(binding); + } + + NSArray exposedBindings () + { + return invokeObjcSelf!(NSArray, "exposedBindings"); + } + + Class valueClassForBinding (NSString binding) + { + return invokeObjcSelf!(Class, "valueClassForBinding:", NSString)(binding); + } + + void bind (NSString binding, Object observable, NSString keyPath, NSDictionary options) + { + return invokeObjcSelf!(void, "bind:toObject:withKeyPath:options:", NSString, Object, NSString, NSDictionary)(binding, observable, keyPath, options); + } + + void unbind (NSString binding) + { + return invokeObjcSelf!(void, "unbind:", NSString)(binding); + } + + NSDictionary infoForBinding (NSString binding) + { + return invokeObjcSelf!(NSDictionary, "infoForBinding:", NSString)(binding); + } + + NSArray optionDescriptionsForBinding (NSString aBinding) + { + return invokeObjcSelf!(NSArray, "optionDescriptionsForBinding:", NSString)(aBinding); + } + + //mixin ObjcBindClassMethod!(exposeBinding, "exposeBinding:"); + //mixin ObjcBindMethod!(exposedBindings, "exposedBindings"); + //mixin ObjcBindMethod!(valueClassForBinding, "valueClassForBinding:"); + //mixin ObjcBindMethod!(bind, "bind:toObject:withKeyPath:options:"); + //mixin ObjcBindMethod!(unbind, "unbind:"); + //mixin ObjcBindMethod!(infoForBinding, "infoForBinding:"); + //mixin ObjcBindMethod!(optionDescriptionsForBinding, "optionDescriptionsForBinding:"); + +`; + +const TNSEditor = ` + + void discardEditing () + { + return invokeObjcSelf!(void, "discardEditing"); + } + + bool commitEditing () + { + return invokeObjcSelf!(bool, "commitEditing"); + } + + void commitEditingWithDelegate (Object delegate_, SEL didCommitSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "commitEditingWithDelegate:didCommitSelector:contextInfo:", Object, SEL, void*)(delegate_, didCommitSelector, contextInfo); + } + + //mixin ObjcBindMethod!(discardEditing, "discardEditing"); + //mixin ObjcBindMethod!(commitEditing, "commitEditing"); + //mixin ObjcBindMethod!(commitEditingWithDelegate, "commitEditingWithDelegate:didCommitSelector:contextInfo:"); + +`; + +const TNSPlaceholders = ` + + static void setDefaultPlaceholder (Object placeholder, Object marker, NSString binding) + { + return invokeObjcSelfClass!(void, "setDefaultPlaceholder:forMarker:withBinding:", Object, Object, NSString)(placeholder, marker, binding); + } + + static Object defaultPlaceholderForMarker (Object marker, NSString binding) + { + return invokeObjcSelfClass!(Object, "defaultPlaceholderForMarker:withBinding:", Object, NSString)(marker, binding); + } + + //mixin ObjcBindClassMethod!(setDefaultPlaceholder, "setDefaultPlaceholder:forMarker:withBinding:"); + //mixin ObjcBindClassMethod!(defaultPlaceholderForMarker, "defaultPlaceholderForMarker:withBinding:"); + +`; + +const TNSEditorRegistration = ` + + void objectDidBeginEditing (Object editor) + { + return invokeObjcSelf!(void, "objectDidBeginEditing:", Object)(editor); + } + + void objectDidEndEditing (Object editor) + { + return invokeObjcSelf!(void, "objectDidEndEditing:", Object)(editor); + } + + //mixin ObjcBindMethod!(objectDidBeginEditing, "objectDidBeginEditing:"); + //mixin ObjcBindMethod!(objectDidEndEditing, "objectDidEndEditing:"); + +`; +/* +bool NSIsControllerMarker (Object object) +{ + return Bridge.invokeObjcFunction!(bool, bindings.NSIsControllerMarker, Object)(object); +}*/ \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSKeyValueBinding_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSKeyValueBinding_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,128 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSKeyValueBinding_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package id NSObservedObjectKey; + package id NSObservedKeyPathKey; + package id NSOptionsKey; + package id NSAlignmentBinding; + package id NSAlternateImageBinding; + package id NSAlternateTitleBinding; + package id NSAnimateBinding; + package id NSAnimationDelayBinding; + package id NSArgumentBinding; + package id NSAttributedStringBinding; + package id NSContentArrayBinding; + package id NSContentArrayForMultipleSelectionBinding; + package id NSContentBinding; + package id NSContentDictionaryBinding; + package id NSContentHeightBinding; + package id NSContentObjectBinding; + package id NSContentObjectsBinding; + package id NSContentSetBinding; + package id NSContentValuesBinding; + package id NSContentWidthBinding; + package id NSCriticalValueBinding; + package id NSDataBinding; + package id NSDisplayPatternTitleBinding; + package id NSDisplayPatternValueBinding; + package id NSDocumentEditedBinding; + package id NSDoubleClickArgumentBinding; + package id NSDoubleClickTargetBinding; + package id NSEditableBinding; + package id NSEnabledBinding; + package id NSExcludedKeysBinding; + package id NSFilterPredicateBinding; + package id NSFontBinding; + package id NSFontBoldBinding; + package id NSFontFamilyNameBinding; + package id NSFontItalicBinding; + package id NSFontNameBinding; + package id NSFontSizeBinding; + package id NSHeaderTitleBinding; + package id NSHiddenBinding; + package id NSImageBinding; + package id NSIncludedKeysBinding; + package id NSInitialKeyBinding; + package id NSInitialValueBinding; + package id NSIsIndeterminateBinding; + package id NSLabelBinding; + package id NSLocalizedKeyDictionaryBinding; + package id NSManagedObjectContextBinding; + package id NSMaximumRecentsBinding; + package id NSMaxValueBinding; + package id NSMaxWidthBinding; + package id NSMinValueBinding; + package id NSMinWidthBinding; + package id NSMixedStateImageBinding; + package id NSOffStateImageBinding; + package id NSOnStateImageBinding; + package id NSPredicateBinding; + package id NSRecentSearchesBinding; + package id NSRepresentedFilenameBinding; + package id NSRowHeightBinding; + package id NSSelectedIdentifierBinding; + package id NSSelectedIndexBinding; + package id NSSelectedLabelBinding; + package id NSSelectedObjectBinding; + package id NSSelectedObjectsBinding; + package id NSSelectedTagBinding; + package id NSSelectedValueBinding; + package id NSSelectedValuesBinding; + package id NSSelectionIndexesBinding; + package id NSSelectionIndexPathsBinding; + package id NSSortDescriptorsBinding; + package id NSTargetBinding; + package id NSTextColorBinding; + package id NSTitleBinding; + package id NSToolTipBinding; + package id NSTransparentBinding; + package id NSValueBinding; + package id NSValuePathBinding; + package id NSValueURLBinding; + package id NSVisibleBinding; + package id NSWarningValueBinding; + package id NSWidthBinding; + package id NSAllowsEditingMultipleValuesSelectionBindingOption; + package id NSAllowsNullArgumentBindingOption; + package id NSAlwaysPresentsApplicationModalAlertsBindingOption; + package id NSConditionallySetsEditableBindingOption; + package id NSConditionallySetsEnabledBindingOption; + package id NSConditionallySetsHiddenBindingOption; + package id NSContinuouslyUpdatesValueBindingOption; + package id NSCreatesSortDescriptorBindingOption; + package id NSDeletesObjectsOnRemoveBindingsOption; + package id NSDisplayNameBindingOption; + package id NSDisplayPatternBindingOption; + package id NSContentPlacementTagBindingOption; + package id NSHandlesContentAsCompoundValueBindingOption; + package id NSInsertsNullPlaceholderBindingOption; + package id NSInvokesSeparatelyWithArrayObjectsBindingOption; + package id NSMultipleValuesPlaceholderBindingOption; + package id NSNoSelectionPlaceholderBindingOption; + package id NSNotApplicablePlaceholderBindingOption; + package id NSNullPlaceholderBindingOption; + package id NSRaisesForNotApplicableKeysBindingOption; + package id NSPredicateFormatBindingOption; + package id NSSelectorNameBindingOption; + package id NSSelectsAllWhenSettingContentBindingOption; + package id NSValidatesImmediatelyBindingOption; + package id NSValueTransformerNameBindingOption; + package id NSValueTransformerBindingOption; + } +} + +extern (C) +{ + package bool NSIsControllerMarker (id object); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSLayoutManager.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSLayoutManager.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,888 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSLayoutManager; + +import dstep.appkit.NSBox; +import dstep.appkit.NSCell; +import dstep.appkit.NSColor; +import dstep.appkit.NSEvent; +import dstep.appkit.NSFont; +import dstep.appkit.NSGlyphGenerator; +import dstep.appkit.NSImageCell; +import dstep.appkit.NSMatrix; +import dstep.appkit.NSParagraphStyle; +import dstep.appkit.NSRulerMarker; +import dstep.appkit.NSRulerView; +import dstep.appkit.NSTextContainer; +import dstep.appkit.NSTextField; +import dstep.appkit.NSTextStorage; +import dstep.appkit.NSTextTable; +import dstep.appkit.NSTextView; +import dstep.appkit.NSTypesetter; +import dstep.appkit.NSView; +import dstep.appkit.NSWindow; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSArray; +import dstep.foundation.NSAttributedString; +import dstep.foundation.NSCoder; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSRange; +import dstep.foundation.NSString; +import dstep.foundation.NSZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +alias NSUInteger NSGlyphInscription; +alias NSInteger NSTypesetterBehavior; + +enum +{ + NSGlyphAttributeSoft = 0, + NSGlyphAttributeElastic = 1, + NSGlyphAttributeBidiLevel = 2, + NSGlyphAttributeInscribe = 5 +} + +enum +{ + NSGlyphInscribeBase = 0, + NSGlyphInscribeBelow = 1, + NSGlyphInscribeAbove = 2, + NSGlyphInscribeOverstrike = 3, + NSGlyphInscribeOverBelow = 4 +} + +enum +{ + NSTypesetterLatestBehavior = -1, + NSTypesetterOriginalBehavior = 0, + NSTypesetterBehavior_10_2_WithCompatibility = 1, + NSTypesetterBehavior_10_2 = 2, + NSTypesetterBehavior_10_3 = 3, + NSTypesetterBehavior_10_4 = 4 +} + +const TNSTextViewSupport = ` + + NSArray rulerMarkersForTextView (NSTextView view, NSParagraphStyle style, NSRulerView ruler) + { + return invokeObjcSelf!(NSArray, "rulerMarkersForTextView:paragraphStyle:ruler:", NSTextView, NSParagraphStyle, NSRulerView)(view, style, ruler); + } + + NSView rulerAccessoryViewForTextView (NSTextView view, NSParagraphStyle style, NSRulerView ruler, bool isEnabled) + { + return invokeObjcSelf!(NSView, "rulerAccessoryViewForTextView:paragraphStyle:ruler:enabled:", NSTextView, NSParagraphStyle, NSRulerView, bool)(view, style, ruler, isEnabled); + } + + bool layoutManagerOwnsFirstResponderInWindow (NSWindow window) + { + return invokeObjcSelf!(bool, "layoutManagerOwnsFirstResponderInWindow:", NSWindow)(window); + } + + NSTextView firstTextView () + { + return invokeObjcSelf!(NSTextView, "firstTextView"); + } + + NSTextView textViewForBeginningOfSelection () + { + return invokeObjcSelf!(NSTextView, "textViewForBeginningOfSelection"); + } + + void drawBackgroundForGlyphRange (NSRange glyphsToShow, NSPoint origin) + { + return invokeObjcSelf!(void, "drawBackgroundForGlyphRange:atPoint:", NSRange, NSPoint)(glyphsToShow, origin); + } + + void drawGlyphsForGlyphRange (NSRange glyphsToShow, NSPoint origin) + { + return invokeObjcSelf!(void, "drawGlyphsForGlyphRange:atPoint:", NSRange, NSPoint)(glyphsToShow, origin); + } + + void showPackedGlyphs (char* glyphs, NSUInteger glyphLen, NSRange glyphRange, NSPoint point, NSFont font, NSColor color, NSSize printingAdjustment) + { + return invokeObjcSelf!(void, "showPackedGlyphs:length:glyphRange:atPoint:font:color:printingAdjustment:", char*, NSUInteger, NSRange, NSPoint, NSFont, NSColor, NSSize)(glyphs, glyphLen, glyphRange, point, font, color, printingAdjustment); + } + + void showAttachmentCell (NSCell cell, NSRect rect, NSUInteger attachmentIndex) + { + return invokeObjcSelf!(void, "showAttachmentCell:inRect:characterIndex:", NSCell, NSRect, NSUInteger)(cell, rect, attachmentIndex); + } + + void drawUnderlineForGlyphRange (NSRange glyphRange, NSInteger underlineVal, CGFloat baselineOffset, NSRect lineRect, NSRange lineGlyphRange, NSPoint containerOrigin) + { + return invokeObjcSelf!(void, "drawUnderlineForGlyphRange:underlineType:baselineOffset:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:", NSRange, NSInteger, CGFloat, NSRect, NSRange, NSPoint)(glyphRange, underlineVal, baselineOffset, lineRect, lineGlyphRange, containerOrigin); + } + + void underlineGlyphRange (NSRange glyphRange, NSInteger underlineVal, NSRect lineRect, NSRange lineGlyphRange, NSPoint containerOrigin) + { + return invokeObjcSelf!(void, "underlineGlyphRange:underlineType:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:", NSRange, NSInteger, NSRect, NSRange, NSPoint)(glyphRange, underlineVal, lineRect, lineGlyphRange, containerOrigin); + } + + void drawStrikethroughForGlyphRange (NSRange glyphRange, NSInteger strikethroughVal, CGFloat baselineOffset, NSRect lineRect, NSRange lineGlyphRange, NSPoint containerOrigin) + { + return invokeObjcSelf!(void, "drawStrikethroughForGlyphRange:strikethroughType:baselineOffset:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:", NSRange, NSInteger, CGFloat, NSRect, NSRange, NSPoint)(glyphRange, strikethroughVal, baselineOffset, lineRect, lineGlyphRange, containerOrigin); + } + + void strikethroughGlyphRange (NSRange glyphRange, NSInteger strikethroughVal, NSRect lineRect, NSRange lineGlyphRange, NSPoint containerOrigin) + { + return invokeObjcSelf!(void, "strikethroughGlyphRange:strikethroughType:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:", NSRange, NSInteger, NSRect, NSRange, NSPoint)(glyphRange, strikethroughVal, lineRect, lineGlyphRange, containerOrigin); + } + + //mixin ObjcBindMethod!(rulerMarkersForTextView, "rulerMarkersForTextView:paragraphStyle:ruler:"); + //mixin ObjcBindMethod!(rulerAccessoryViewForTextView, "rulerAccessoryViewForTextView:paragraphStyle:ruler:enabled:"); + //mixin ObjcBindMethod!(layoutManagerOwnsFirstResponderInWindow, "layoutManagerOwnsFirstResponderInWindow:"); + //mixin ObjcBindMethod!(firstTextView, "firstTextView"); + //mixin ObjcBindMethod!(textViewForBeginningOfSelection, "textViewForBeginningOfSelection"); + //mixin ObjcBindMethod!(drawBackgroundForGlyphRange, "drawBackgroundForGlyphRange:atPoint:"); + //mixin ObjcBindMethod!(drawGlyphsForGlyphRange, "drawGlyphsForGlyphRange:atPoint:"); + //mixin ObjcBindMethod!(showPackedGlyphs, "showPackedGlyphs:length:glyphRange:atPoint:font:color:printingAdjustment:"); + //mixin ObjcBindMethod!(showAttachmentCell, "showAttachmentCell:inRect:characterIndex:"); + //mixin ObjcBindMethod!(drawUnderlineForGlyphRange, "drawUnderlineForGlyphRange:underlineType:baselineOffset:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:"); + //mixin ObjcBindMethod!(underlineGlyphRange, "underlineGlyphRange:underlineType:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:"); + //mixin ObjcBindMethod!(drawStrikethroughForGlyphRange, "drawStrikethroughForGlyphRange:strikethroughType:baselineOffset:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:"); + //mixin ObjcBindMethod!(strikethroughGlyphRange, "strikethroughGlyphRange:strikethroughType:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:"); + +`; + +const TNSLayoutManagerDelegate = ` + + void layoutManagerDidInvalidateLayout (NSLayoutManager sender) + { + return invokeObjcSelf!(void, "layoutManagerDidInvalidateLayout:", NSLayoutManager)(sender); + } + + void layoutManager (NSLayoutManager layoutManager, NSTextContainer textContainer, bool layoutFinishedFlag) + { + return invokeObjcSelf!(void, "layoutManager:didCompleteLayoutForTextContainer:atEnd:", NSLayoutManager, NSTextContainer, bool)(layoutManager, textContainer, layoutFinishedFlag); + } + + NSDictionary layoutManager (NSLayoutManager layoutManager, NSDictionary attrs, bool toScreen, NSUInteger charIndex, NSRangePointer effectiveCharRange) + { + return invokeObjcSelf!(NSDictionary, "layoutManager:shouldUseTemporaryAttributes:forDrawingToScreen:atCharacterIndex:effectiveRange:", NSLayoutManager, NSDictionary, bool, NSUInteger, NSRangePointer)(layoutManager, attrs, toScreen, charIndex, effectiveCharRange); + } + + //mixin ObjcBindMethod!(layoutManagerDidInvalidateLayout, "layoutManagerDidInvalidateLayout:"); + //mixin ObjcBindMethod!(layoutManager, "layoutManager:didCompleteLayoutForTextContainer:atEnd:"); + //mixin ObjcBindMethod!(layoutManager, "layoutManager:shouldUseTemporaryAttributes:forDrawingToScreen:atCharacterIndex:effectiveRange:"); + +`; + +class NSLayoutManager : NSObject, INSCoding, INSGlyphStorage +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + typeof(this) copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); + } + + NSLayoutManager init () + { + id result = invokeObjcSelf!(id, "init"); + return result is this.objcObject ? this : (result !is null ? new NSLayoutManager(result) : null); + } + + this () + { + super(NSLayoutManager.alloc.init.objcObject); + } + + NSTextStorage textStorage () + { + return invokeObjcSelf!(NSTextStorage, "textStorage"); + } + + void setTextStorage (NSTextStorage textStorage) + { + return invokeObjcSelf!(void, "setTextStorage:", NSTextStorage)(textStorage); + } + + NSAttributedString attributedString () + { + return invokeObjcSelf!(NSAttributedString, "attributedString"); + } + + void replaceTextStorage (NSTextStorage newTextStorage) + { + return invokeObjcSelf!(void, "replaceTextStorage:", NSTextStorage)(newTextStorage); + } + + NSGlyphGenerator glyphGenerator () + { + return invokeObjcSelf!(NSGlyphGenerator, "glyphGenerator"); + } + + void setGlyphGenerator (NSGlyphGenerator glyphGenerator) + { + return invokeObjcSelf!(void, "setGlyphGenerator:", NSGlyphGenerator)(glyphGenerator); + } + + NSTypesetter typesetter () + { + return invokeObjcSelf!(NSTypesetter, "typesetter"); + } + + void setTypesetter (NSTypesetter typesetter) + { + return invokeObjcSelf!(void, "setTypesetter:", NSTypesetter)(typesetter); + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + void setDelegate (Object delegate_) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(delegate_); + } + + NSArray textContainers () + { + return invokeObjcSelf!(NSArray, "textContainers"); + } + + void addTextContainer (NSTextContainer container) + { + return invokeObjcSelf!(void, "addTextContainer:", NSTextContainer)(container); + } + + void insertTextContainer (NSTextContainer container, NSUInteger index) + { + return invokeObjcSelf!(void, "insertTextContainer:atIndex:", NSTextContainer, NSUInteger)(container, index); + } + + void removeTextContainerAtIndex (NSUInteger index) + { + return invokeObjcSelf!(void, "removeTextContainerAtIndex:", NSUInteger)(index); + } + + void textContainerChangedGeometry (NSTextContainer container) + { + return invokeObjcSelf!(void, "textContainerChangedGeometry:", NSTextContainer)(container); + } + + void textContainerChangedTextView (NSTextContainer container) + { + return invokeObjcSelf!(void, "textContainerChangedTextView:", NSTextContainer)(container); + } + + void setBackgroundLayoutEnabled (bool flag) + { + return invokeObjcSelf!(void, "setBackgroundLayoutEnabled:", bool)(flag); + } + + bool backgroundLayoutEnabled () + { + return invokeObjcSelf!(bool, "backgroundLayoutEnabled"); + } + + void setUsesScreenFonts (bool flag) + { + return invokeObjcSelf!(void, "setUsesScreenFonts:", bool)(flag); + } + + bool usesScreenFonts () + { + return invokeObjcSelf!(bool, "usesScreenFonts"); + } + + void setShowsInvisibleCharacters (bool flag) + { + return invokeObjcSelf!(void, "setShowsInvisibleCharacters:", bool)(flag); + } + + bool showsInvisibleCharacters () + { + return invokeObjcSelf!(bool, "showsInvisibleCharacters"); + } + + void setShowsControlCharacters (bool flag) + { + return invokeObjcSelf!(void, "setShowsControlCharacters:", bool)(flag); + } + + bool showsControlCharacters () + { + return invokeObjcSelf!(bool, "showsControlCharacters"); + } + + void setHyphenationFactor (float factor) + { + return invokeObjcSelf!(void, "setHyphenationFactor:", float)(factor); + } + + float hyphenationFactor () + { + return invokeObjcSelf!(float, "hyphenationFactor"); + } + + void setDefaultAttachmentScaling (uint scaling) + { + return invokeObjcSelf!(void, "setDefaultAttachmentScaling:", uint)(scaling); + } + + uint defaultAttachmentScaling () + { + return invokeObjcSelf!(uint, "defaultAttachmentScaling"); + } + + void setTypesetterBehavior (int theBehavior) + { + return invokeObjcSelf!(void, "setTypesetterBehavior:", int)(theBehavior); + } + + int typesetterBehavior () + { + return invokeObjcSelf!(int, "typesetterBehavior"); + } + + NSUInteger layoutOptions () + { + return invokeObjcSelf!(NSUInteger, "layoutOptions"); + } + + void setAllowsNonContiguousLayout (bool flag) + { + return invokeObjcSelf!(void, "setAllowsNonContiguousLayout:", bool)(flag); + } + + bool allowsNonContiguousLayout () + { + return invokeObjcSelf!(bool, "allowsNonContiguousLayout"); + } + + bool hasNonContiguousLayout () + { + return invokeObjcSelf!(bool, "hasNonContiguousLayout"); + } + + void invalidateGlyphsForCharacterRange (NSRange charRange, NSInteger delta, NSRangePointer actualCharRange) + { + return invokeObjcSelf!(void, "invalidateGlyphsForCharacterRange:changeInLength:actualCharacterRange:", NSRange, NSInteger, NSRangePointer)(charRange, delta, actualCharRange); + } + + void invalidateLayoutForCharacterRange (NSRange charRange, NSRangePointer actualCharRange) + { + return invokeObjcSelf!(void, "invalidateLayoutForCharacterRange:actualCharacterRange:", NSRange, NSRangePointer)(charRange, actualCharRange); + } + + void invalidateLayoutForCharacterRange (NSRange charRange, bool flag, NSRangePointer actualCharRange) + { + return invokeObjcSelf!(void, "invalidateLayoutForCharacterRange:isSoft:actualCharacterRange:", NSRange, bool, NSRangePointer)(charRange, flag, actualCharRange); + } + + void invalidateDisplayForCharacterRange (NSRange charRange) + { + return invokeObjcSelf!(void, "invalidateDisplayForCharacterRange:", NSRange)(charRange); + } + + void invalidateDisplayForGlyphRange (NSRange glyphRange) + { + return invokeObjcSelf!(void, "invalidateDisplayForGlyphRange:", NSRange)(glyphRange); + } + + void textStorage (NSTextStorage str, NSUInteger editedMask, NSRange newCharRange, NSInteger delta, NSRange invalidatedCharRange) + { + return invokeObjcSelf!(void, "textStorage:edited:range:changeInLength:invalidatedRange:", NSTextStorage, NSUInteger, NSRange, NSInteger, NSRange)(str, editedMask, newCharRange, delta, invalidatedCharRange); + } + + void ensureGlyphsForCharacterRange (NSRange charRange) + { + return invokeObjcSelf!(void, "ensureGlyphsForCharacterRange:", NSRange)(charRange); + } + + void ensureGlyphsForGlyphRange (NSRange glyphRange) + { + return invokeObjcSelf!(void, "ensureGlyphsForGlyphRange:", NSRange)(glyphRange); + } + + void ensureLayoutForCharacterRange (NSRange charRange) + { + return invokeObjcSelf!(void, "ensureLayoutForCharacterRange:", NSRange)(charRange); + } + + void ensureLayoutForGlyphRange (NSRange glyphRange) + { + return invokeObjcSelf!(void, "ensureLayoutForGlyphRange:", NSRange)(glyphRange); + } + + void ensureLayoutForTextContainer (NSTextContainer container) + { + return invokeObjcSelf!(void, "ensureLayoutForTextContainer:", NSTextContainer)(container); + } + + void ensureLayoutForBoundingRect (NSRect bounds, NSTextContainer container) + { + return invokeObjcSelf!(void, "ensureLayoutForBoundingRect:inTextContainer:", NSRect, NSTextContainer)(bounds, container); + } + + void insertGlyphs (NSGlyph* glyphs, NSUInteger length, NSUInteger glyphIndex, NSUInteger charIndex) + { + return invokeObjcSelf!(void, "insertGlyphs:length:forStartingGlyphAtIndex:characterIndex:", NSGlyph*, NSUInteger, NSUInteger, NSUInteger)(glyphs, length, glyphIndex, charIndex); + } + + void insertGlyph (uint glyph, NSUInteger glyphIndex, NSUInteger charIndex) + { + return invokeObjcSelf!(void, "insertGlyph:atGlyphIndex:characterIndex:", uint, NSUInteger, NSUInteger)(glyph, glyphIndex, charIndex); + } + + void replaceGlyphAtIndex (NSUInteger glyphIndex, uint newGlyph) + { + return invokeObjcSelf!(void, "replaceGlyphAtIndex:withGlyph:", NSUInteger, uint)(glyphIndex, newGlyph); + } + + void deleteGlyphsInRange (NSRange glyphRange) + { + return invokeObjcSelf!(void, "deleteGlyphsInRange:", NSRange)(glyphRange); + } + + void setCharacterIndex (NSUInteger charIndex, NSUInteger glyphIndex) + { + return invokeObjcSelf!(void, "setCharacterIndex:forGlyphAtIndex:", NSUInteger, NSUInteger)(charIndex, glyphIndex); + } + + void setIntAttribute (NSInteger attributeTag, NSInteger val, NSUInteger glyphIndex) + { + return invokeObjcSelf!(void, "setIntAttribute:value:forGlyphAtIndex:", NSInteger, NSInteger, NSUInteger)(attributeTag, val, glyphIndex); + } + + void invalidateGlyphsOnLayoutInvalidationForGlyphRange (NSRange glyphRange) + { + return invokeObjcSelf!(void, "invalidateGlyphsOnLayoutInvalidationForGlyphRange:", NSRange)(glyphRange); + } + + NSUInteger numberOfGlyphs () + { + return invokeObjcSelf!(NSUInteger, "numberOfGlyphs"); + } + + uint glyphAtIndex (NSUInteger glyphIndex, bool* isValidIndex) + { + return invokeObjcSelf!(uint, "glyphAtIndex:isValidIndex:", NSUInteger, bool*)(glyphIndex, isValidIndex); + } + + uint glyphAtIndex (NSUInteger glyphIndex) + { + return invokeObjcSelf!(uint, "glyphAtIndex:", NSUInteger)(glyphIndex); + } + + bool isValidGlyphIndex (NSUInteger glyphIndex) + { + return invokeObjcSelf!(bool, "isValidGlyphIndex:", NSUInteger)(glyphIndex); + } + + NSUInteger characterIndexForGlyphAtIndex (NSUInteger glyphIndex) + { + return invokeObjcSelf!(NSUInteger, "characterIndexForGlyphAtIndex:", NSUInteger)(glyphIndex); + } + + NSUInteger glyphIndexForCharacterAtIndex (NSUInteger charIndex) + { + return invokeObjcSelf!(NSUInteger, "glyphIndexForCharacterAtIndex:", NSUInteger)(charIndex); + } + + NSInteger intAttribute (NSInteger attributeTag, NSUInteger glyphIndex) + { + return invokeObjcSelf!(NSInteger, "intAttribute:forGlyphAtIndex:", NSInteger, NSUInteger)(attributeTag, glyphIndex); + } + + NSUInteger getGlyphsInRange (NSRange glyphRange, NSGlyph* glyphBuffer, NSUInteger* charIndexBuffer, NSGlyphInscription* inscribeBuffer, bool* elasticBuffer) + { + return invokeObjcSelf!(NSUInteger, "getGlyphsInRange:glyphs:characterIndexes:glyphInscriptions:elasticBits:", NSRange, NSGlyph*, NSUInteger*, NSGlyphInscription*, bool*)(glyphRange, glyphBuffer, charIndexBuffer, inscribeBuffer, elasticBuffer); + } + + NSUInteger getGlyphsInRange (NSRange glyphRange, NSGlyph* glyphBuffer, NSUInteger* charIndexBuffer, NSGlyphInscription* inscribeBuffer, bool* elasticBuffer, char* bidiLevelBuffer) + { + return invokeObjcSelf!(NSUInteger, "getGlyphsInRange:glyphs:characterIndexes:glyphInscriptions:elasticBits:bidiLevels:", NSRange, NSGlyph*, NSUInteger*, NSGlyphInscription*, bool*, char*)(glyphRange, glyphBuffer, charIndexBuffer, inscribeBuffer, elasticBuffer, bidiLevelBuffer); + } + + NSUInteger getGlyphs (NSGlyph* glyphArray, NSRange glyphRange) + { + return invokeObjcSelf!(NSUInteger, "getGlyphs:range:", NSGlyph*, NSRange)(glyphArray, glyphRange); + } + + void setTextContainer (NSTextContainer container, NSRange glyphRange) + { + return invokeObjcSelf!(void, "setTextContainer:forGlyphRange:", NSTextContainer, NSRange)(container, glyphRange); + } + + void setLineFragmentRect (NSRect fragmentRect, NSRange glyphRange, NSRect usedRect) + { + return invokeObjcSelf!(void, "setLineFragmentRect:forGlyphRange:usedRect:", NSRect, NSRange, NSRect)(fragmentRect, glyphRange, usedRect); + } + + void setExtraLineFragmentRect (NSRect fragmentRect, NSRect usedRect, NSTextContainer container) + { + return invokeObjcSelf!(void, "setExtraLineFragmentRect:usedRect:textContainer:", NSRect, NSRect, NSTextContainer)(fragmentRect, usedRect, container); + } + + void setLocation (NSPoint location, NSRange glyphRange) + { + return invokeObjcSelf!(void, "setLocation:forStartOfGlyphRange:", NSPoint, NSRange)(location, glyphRange); + } + + void setLocations (NSPointArray locations, NSUInteger* glyphIndexes, NSUInteger count, NSRange glyphRange) + { + return invokeObjcSelf!(void, "setLocations:startingGlyphIndexes:count:forGlyphRange:", NSPointArray, NSUInteger*, NSUInteger, NSRange)(locations, glyphIndexes, count, glyphRange); + } + + void setNotShownAttribute (bool flag, NSUInteger glyphIndex) + { + return invokeObjcSelf!(void, "setNotShownAttribute:forGlyphAtIndex:", bool, NSUInteger)(flag, glyphIndex); + } + + void setDrawsOutsideLineFragment (bool flag, NSUInteger glyphIndex) + { + return invokeObjcSelf!(void, "setDrawsOutsideLineFragment:forGlyphAtIndex:", bool, NSUInteger)(flag, glyphIndex); + } + + void setAttachmentSize (NSSize attachmentSize, NSRange glyphRange) + { + return invokeObjcSelf!(void, "setAttachmentSize:forGlyphRange:", NSSize, NSRange)(attachmentSize, glyphRange); + } + + void getFirstUnlaidCharacterIndex (NSUInteger* charIndex, NSUInteger* glyphIndex) + { + return invokeObjcSelf!(void, "getFirstUnlaidCharacterIndex:glyphIndex:", NSUInteger*, NSUInteger*)(charIndex, glyphIndex); + } + + NSUInteger firstUnlaidCharacterIndex () + { + return invokeObjcSelf!(NSUInteger, "firstUnlaidCharacterIndex"); + } + + NSUInteger firstUnlaidGlyphIndex () + { + return invokeObjcSelf!(NSUInteger, "firstUnlaidGlyphIndex"); + } + + NSTextContainer textContainerForGlyphAtIndex (NSUInteger glyphIndex, NSRangePointer effectiveGlyphRange) + { + return invokeObjcSelf!(NSTextContainer, "textContainerForGlyphAtIndex:effectiveRange:", NSUInteger, NSRangePointer)(glyphIndex, effectiveGlyphRange); + } + + NSRect usedRectForTextContainer (NSTextContainer container) + { + return invokeObjcSelf!(NSRect, "usedRectForTextContainer:", NSTextContainer)(container); + } + + NSRect lineFragmentRectForGlyphAtIndex (NSUInteger glyphIndex, NSRangePointer effectiveGlyphRange) + { + return invokeObjcSelf!(NSRect, "lineFragmentRectForGlyphAtIndex:effectiveRange:", NSUInteger, NSRangePointer)(glyphIndex, effectiveGlyphRange); + } + + NSRect lineFragmentUsedRectForGlyphAtIndex (NSUInteger glyphIndex, NSRangePointer effectiveGlyphRange) + { + return invokeObjcSelf!(NSRect, "lineFragmentUsedRectForGlyphAtIndex:effectiveRange:", NSUInteger, NSRangePointer)(glyphIndex, effectiveGlyphRange); + } + + NSRect lineFragmentRectForGlyphAtIndex (NSUInteger glyphIndex, NSRangePointer effectiveGlyphRange, bool flag) + { + return invokeObjcSelf!(NSRect, "lineFragmentRectForGlyphAtIndex:effectiveRange:withoutAdditionalLayout:", NSUInteger, NSRangePointer, bool)(glyphIndex, effectiveGlyphRange, flag); + } + + NSRect lineFragmentUsedRectForGlyphAtIndex (NSUInteger glyphIndex, NSRangePointer effectiveGlyphRange, bool flag) + { + return invokeObjcSelf!(NSRect, "lineFragmentUsedRectForGlyphAtIndex:effectiveRange:withoutAdditionalLayout:", NSUInteger, NSRangePointer, bool)(glyphIndex, effectiveGlyphRange, flag); + } + + NSTextContainer textContainerForGlyphAtIndex (NSUInteger glyphIndex, NSRangePointer effectiveGlyphRange, bool flag) + { + return invokeObjcSelf!(NSTextContainer, "textContainerForGlyphAtIndex:effectiveRange:withoutAdditionalLayout:", NSUInteger, NSRangePointer, bool)(glyphIndex, effectiveGlyphRange, flag); + } + + NSRect extraLineFragmentRect () + { + return invokeObjcSelf!(NSRect, "extraLineFragmentRect"); + } + + NSRect extraLineFragmentUsedRect () + { + return invokeObjcSelf!(NSRect, "extraLineFragmentUsedRect"); + } + + NSTextContainer extraLineFragmentTextContainer () + { + return invokeObjcSelf!(NSTextContainer, "extraLineFragmentTextContainer"); + } + + NSPoint locationForGlyphAtIndex (NSUInteger glyphIndex) + { + return invokeObjcSelf!(NSPoint, "locationForGlyphAtIndex:", NSUInteger)(glyphIndex); + } + + bool notShownAttributeForGlyphAtIndex (NSUInteger glyphIndex) + { + return invokeObjcSelf!(bool, "notShownAttributeForGlyphAtIndex:", NSUInteger)(glyphIndex); + } + + bool drawsOutsideLineFragmentForGlyphAtIndex (NSUInteger glyphIndex) + { + return invokeObjcSelf!(bool, "drawsOutsideLineFragmentForGlyphAtIndex:", NSUInteger)(glyphIndex); + } + + NSSize attachmentSizeForGlyphAtIndex (NSUInteger glyphIndex) + { + return invokeObjcSelf!(NSSize, "attachmentSizeForGlyphAtIndex:", NSUInteger)(glyphIndex); + } + + void setLayoutRect (NSRect rect, NSTextBlock block, NSRange glyphRange) + { + return invokeObjcSelf!(void, "setLayoutRect:forTextBlock:glyphRange:", NSRect, NSTextBlock, NSRange)(rect, block, glyphRange); + } + + void setBoundsRect (NSRect rect, NSTextBlock block, NSRange glyphRange) + { + return invokeObjcSelf!(void, "setBoundsRect:forTextBlock:glyphRange:", NSRect, NSTextBlock, NSRange)(rect, block, glyphRange); + } + + NSRect layoutRectForTextBlock (NSTextBlock block, NSRange glyphRange) + { + return invokeObjcSelf!(NSRect, "layoutRectForTextBlock:glyphRange:", NSTextBlock, NSRange)(block, glyphRange); + } + + NSRect boundsRectForTextBlock (NSTextBlock block, NSRange glyphRange) + { + return invokeObjcSelf!(NSRect, "boundsRectForTextBlock:glyphRange:", NSTextBlock, NSRange)(block, glyphRange); + } + + NSRect layoutRectForTextBlock (NSTextBlock block, NSUInteger glyphIndex, NSRangePointer effectiveGlyphRange) + { + return invokeObjcSelf!(NSRect, "layoutRectForTextBlock:atIndex:effectiveRange:", NSTextBlock, NSUInteger, NSRangePointer)(block, glyphIndex, effectiveGlyphRange); + } + + NSRect boundsRectForTextBlock (NSTextBlock block, NSUInteger glyphIndex, NSRangePointer effectiveGlyphRange) + { + return invokeObjcSelf!(NSRect, "boundsRectForTextBlock:atIndex:effectiveRange:", NSTextBlock, NSUInteger, NSRangePointer)(block, glyphIndex, effectiveGlyphRange); + } + + NSRange glyphRangeForCharacterRange (NSRange charRange, NSRangePointer actualCharRange) + { + return invokeObjcSelf!(NSRange, "glyphRangeForCharacterRange:actualCharacterRange:", NSRange, NSRangePointer)(charRange, actualCharRange); + } + + NSRange characterRangeForGlyphRange (NSRange glyphRange, NSRangePointer actualGlyphRange) + { + return invokeObjcSelf!(NSRange, "characterRangeForGlyphRange:actualGlyphRange:", NSRange, NSRangePointer)(glyphRange, actualGlyphRange); + } + + NSRange glyphRangeForTextContainer (NSTextContainer container) + { + return invokeObjcSelf!(NSRange, "glyphRangeForTextContainer:", NSTextContainer)(container); + } + + NSRange rangeOfNominallySpacedGlyphsContainingIndex (NSUInteger glyphIndex) + { + return invokeObjcSelf!(NSRange, "rangeOfNominallySpacedGlyphsContainingIndex:", NSUInteger)(glyphIndex); + } + + NSRectArray rectArrayForCharacterRange (NSRange charRange, NSRange selCharRange, NSTextContainer container, NSUInteger* rectCount) + { + return invokeObjcSelf!(NSRectArray, "rectArrayForCharacterRange:withinSelectedCharacterRange:inTextContainer:rectCount:", NSRange, NSRange, NSTextContainer, NSUInteger*)(charRange, selCharRange, container, rectCount); + } + + NSRectArray rectArrayForGlyphRange (NSRange glyphRange, NSRange selGlyphRange, NSTextContainer container, NSUInteger* rectCount) + { + return invokeObjcSelf!(NSRectArray, "rectArrayForGlyphRange:withinSelectedGlyphRange:inTextContainer:rectCount:", NSRange, NSRange, NSTextContainer, NSUInteger*)(glyphRange, selGlyphRange, container, rectCount); + } + + NSRect boundingRectForGlyphRange (NSRange glyphRange, NSTextContainer container) + { + return invokeObjcSelf!(NSRect, "boundingRectForGlyphRange:inTextContainer:", NSRange, NSTextContainer)(glyphRange, container); + } + + NSRange glyphRangeForBoundingRect (NSRect bounds, NSTextContainer container) + { + return invokeObjcSelf!(NSRange, "glyphRangeForBoundingRect:inTextContainer:", NSRect, NSTextContainer)(bounds, container); + } + + NSRange glyphRangeForBoundingRectWithoutAdditionalLayout (NSRect bounds, NSTextContainer container) + { + return invokeObjcSelf!(NSRange, "glyphRangeForBoundingRectWithoutAdditionalLayout:inTextContainer:", NSRect, NSTextContainer)(bounds, container); + } + + NSUInteger glyphIndexForPoint (NSPoint point, NSTextContainer container, CGFloat* partialFraction) + { + return invokeObjcSelf!(NSUInteger, "glyphIndexForPoint:inTextContainer:fractionOfDistanceThroughGlyph:", NSPoint, NSTextContainer, CGFloat*)(point, container, partialFraction); + } + + NSUInteger glyphIndexForPoint (NSPoint point, NSTextContainer container) + { + return invokeObjcSelf!(NSUInteger, "glyphIndexForPoint:inTextContainer:", NSPoint, NSTextContainer)(point, container); + } + + CGFloat fractionOfDistanceThroughGlyphForPoint (NSPoint point, NSTextContainer container) + { + return invokeObjcSelf!(CGFloat, "fractionOfDistanceThroughGlyphForPoint:inTextContainer:", NSPoint, NSTextContainer)(point, container); + } + + NSUInteger getLineFragmentInsertionPointsForCharacterAtIndex (NSUInteger charIndex, bool aFlag, bool dFlag, CGFloat* positions, NSUInteger* charIndexes) + { + return invokeObjcSelf!(NSUInteger, "getLineFragmentInsertionPointsForCharacterAtIndex:alternatePositions:inDisplayOrder:positions:characterIndexes:", NSUInteger, bool, bool, CGFloat*, NSUInteger*)(charIndex, aFlag, dFlag, positions, charIndexes); + } + + NSDictionary temporaryAttributesAtCharacterIndex (NSUInteger charIndex, NSRangePointer effectiveCharRange) + { + return invokeObjcSelf!(NSDictionary, "temporaryAttributesAtCharacterIndex:effectiveRange:", NSUInteger, NSRangePointer)(charIndex, effectiveCharRange); + } + + void setTemporaryAttributes (NSDictionary attrs, NSRange charRange) + { + return invokeObjcSelf!(void, "setTemporaryAttributes:forCharacterRange:", NSDictionary, NSRange)(attrs, charRange); + } + + void addTemporaryAttributes (NSDictionary attrs, NSRange charRange) + { + return invokeObjcSelf!(void, "addTemporaryAttributes:forCharacterRange:", NSDictionary, NSRange)(attrs, charRange); + } + + void removeTemporaryAttribute (NSString attrName, NSRange charRange) + { + return invokeObjcSelf!(void, "removeTemporaryAttribute:forCharacterRange:", NSString, NSRange)(attrName, charRange); + } + + Object temporaryAttribute (NSString attrName, NSUInteger location, NSRangePointer range) + { + return invokeObjcSelf!(Object, "temporaryAttribute:atCharacterIndex:effectiveRange:", NSString, NSUInteger, NSRangePointer)(attrName, location, range); + } + + Object temporaryAttribute (NSString attrName, NSUInteger location, NSRangePointer range, NSRange rangeLimit) + { + return invokeObjcSelf!(Object, "temporaryAttribute:atCharacterIndex:longestEffectiveRange:inRange:", NSString, NSUInteger, NSRangePointer, NSRange)(attrName, location, range, rangeLimit); + } + + NSDictionary temporaryAttributesAtCharacterIndex (NSUInteger location, NSRangePointer range, NSRange rangeLimit) + { + return invokeObjcSelf!(NSDictionary, "temporaryAttributesAtCharacterIndex:longestEffectiveRange:inRange:", NSUInteger, NSRangePointer, NSRange)(location, range, rangeLimit); + } + + void addTemporaryAttribute (NSString attrName, Object value, NSRange charRange) + { + return invokeObjcSelf!(void, "addTemporaryAttribute:value:forCharacterRange:", NSString, Object, NSRange)(attrName, value, charRange); + } + + NSFont substituteFontForFont (NSFont originalFont) + { + return invokeObjcSelf!(NSFont, "substituteFontForFont:", NSFont)(originalFont); + } + + CGFloat defaultLineHeightForFont (NSFont theFont) + { + return invokeObjcSelf!(CGFloat, "defaultLineHeightForFont:", NSFont)(theFont); + } + + CGFloat defaultBaselineOffsetForFont (NSFont theFont) + { + return invokeObjcSelf!(CGFloat, "defaultBaselineOffsetForFont:", NSFont)(theFont); + } + + bool usesFontLeading () + { + return invokeObjcSelf!(bool, "usesFontLeading"); + } + + void setUsesFontLeading (bool flag) + { + return invokeObjcSelf!(void, "setUsesFontLeading:", bool)(flag); + } + + void insertGlyphs (NSGlyph* glyphs, NSUInteger length, NSUInteger glyphIndex, NSUInteger charIndex) + { + return invokeObjcSelf!(void, "insertGlyphs:length:forStartingGlyphAtIndex:characterIndex:", NSGlyph*, NSUInteger, NSUInteger, NSUInteger)(glyphs, length, glyphIndex, charIndex); + } + + void setIntAttribute (NSInteger attributeTag, NSInteger val, NSUInteger glyphIndex) + { + return invokeObjcSelf!(void, "setIntAttribute:value:forGlyphAtIndex:", NSInteger, NSInteger, NSUInteger)(attributeTag, val, glyphIndex); + } + + // NSTextViewSupport + NSArray rulerMarkersForTextView (NSTextView view, NSParagraphStyle style, NSRulerView ruler) + { + return invokeObjcSelf!(NSArray, "rulerMarkersForTextView:paragraphStyle:ruler:", NSTextView, NSParagraphStyle, NSRulerView)(view, style, ruler); + } + + NSView rulerAccessoryViewForTextView (NSTextView view, NSParagraphStyle style, NSRulerView ruler, bool isEnabled) + { + return invokeObjcSelf!(NSView, "rulerAccessoryViewForTextView:paragraphStyle:ruler:enabled:", NSTextView, NSParagraphStyle, NSRulerView, bool)(view, style, ruler, isEnabled); + } + + bool layoutManagerOwnsFirstResponderInWindow (NSWindow window) + { + return invokeObjcSelf!(bool, "layoutManagerOwnsFirstResponderInWindow:", NSWindow)(window); + } + + NSTextView firstTextView () + { + return invokeObjcSelf!(NSTextView, "firstTextView"); + } + + NSTextView textViewForBeginningOfSelection () + { + return invokeObjcSelf!(NSTextView, "textViewForBeginningOfSelection"); + } + + void drawBackgroundForGlyphRange (NSRange glyphsToShow, NSPoint origin) + { + return invokeObjcSelf!(void, "drawBackgroundForGlyphRange:atPoint:", NSRange, NSPoint)(glyphsToShow, origin); + } + + void drawGlyphsForGlyphRange (NSRange glyphsToShow, NSPoint origin) + { + return invokeObjcSelf!(void, "drawGlyphsForGlyphRange:atPoint:", NSRange, NSPoint)(glyphsToShow, origin); + } + + void showPackedGlyphs (char* glyphs, NSUInteger glyphLen, NSRange glyphRange, NSPoint point, NSFont font, NSColor color, NSSize printingAdjustment) + { + return invokeObjcSelf!(void, "showPackedGlyphs:length:glyphRange:atPoint:font:color:printingAdjustment:", char*, NSUInteger, NSRange, NSPoint, NSFont, NSColor, NSSize)(glyphs, glyphLen, glyphRange, point, font, color, printingAdjustment); + } + + void showAttachmentCell (NSCell cell, NSRect rect, NSUInteger attachmentIndex) + { + return invokeObjcSelf!(void, "showAttachmentCell:inRect:characterIndex:", NSCell, NSRect, NSUInteger)(cell, rect, attachmentIndex); + } + + void drawUnderlineForGlyphRange (NSRange glyphRange, NSInteger underlineVal, CGFloat baselineOffset, NSRect lineRect, NSRange lineGlyphRange, NSPoint containerOrigin) + { + return invokeObjcSelf!(void, "drawUnderlineForGlyphRange:underlineType:baselineOffset:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:", NSRange, NSInteger, CGFloat, NSRect, NSRange, NSPoint)(glyphRange, underlineVal, baselineOffset, lineRect, lineGlyphRange, containerOrigin); + } + + void underlineGlyphRange (NSRange glyphRange, NSInteger underlineVal, NSRect lineRect, NSRange lineGlyphRange, NSPoint containerOrigin) + { + return invokeObjcSelf!(void, "underlineGlyphRange:underlineType:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:", NSRange, NSInteger, NSRect, NSRange, NSPoint)(glyphRange, underlineVal, lineRect, lineGlyphRange, containerOrigin); + } + + void drawStrikethroughForGlyphRange (NSRange glyphRange, NSInteger strikethroughVal, CGFloat baselineOffset, NSRect lineRect, NSRange lineGlyphRange, NSPoint containerOrigin) + { + return invokeObjcSelf!(void, "drawStrikethroughForGlyphRange:strikethroughType:baselineOffset:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:", NSRange, NSInteger, CGFloat, NSRect, NSRange, NSPoint)(glyphRange, strikethroughVal, baselineOffset, lineRect, lineGlyphRange, containerOrigin); + } + + void strikethroughGlyphRange (NSRange glyphRange, NSInteger strikethroughVal, NSRect lineRect, NSRange lineGlyphRange, NSPoint containerOrigin) + { + return invokeObjcSelf!(void, "strikethroughGlyphRange:strikethroughType:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:", NSRange, NSInteger, NSRect, NSRange, NSPoint)(glyphRange, strikethroughVal, lineRect, lineGlyphRange, containerOrigin); + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSLevelIndicator.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSLevelIndicator.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,100 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSLevelIndicator; + +import dstep.appkit.NSControl; +import dstep.appkit.NSLevelIndicatorCell; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSLevelIndicator : NSControl +{ + mixin (ObjcWrap); + + double minValue () + { + return invokeObjcSelf!(double, "minValue"); + } + + void setMinValue (double minValue) + { + return invokeObjcSelf!(void, "setMinValue:", double)(minValue); + } + + double maxValue () + { + return invokeObjcSelf!(double, "maxValue"); + } + + void setMaxValue (double maxValue) + { + return invokeObjcSelf!(void, "setMaxValue:", double)(maxValue); + } + + double warningValue () + { + return invokeObjcSelf!(double, "warningValue"); + } + + void setWarningValue (double warningValue) + { + return invokeObjcSelf!(void, "setWarningValue:", double)(warningValue); + } + + double criticalValue () + { + return invokeObjcSelf!(double, "criticalValue"); + } + + void setCriticalValue (double criticalValue) + { + return invokeObjcSelf!(void, "setCriticalValue:", double)(criticalValue); + } + + uint tickMarkPosition () + { + return invokeObjcSelf!(uint, "tickMarkPosition"); + } + + void setTickMarkPosition (uint position) + { + return invokeObjcSelf!(void, "setTickMarkPosition:", uint)(position); + } + + NSInteger numberOfTickMarks () + { + return invokeObjcSelf!(NSInteger, "numberOfTickMarks"); + } + + void setNumberOfTickMarks (NSInteger count) + { + return invokeObjcSelf!(void, "setNumberOfTickMarks:", NSInteger)(count); + } + + NSInteger numberOfMajorTickMarks () + { + return invokeObjcSelf!(NSInteger, "numberOfMajorTickMarks"); + } + + void setNumberOfMajorTickMarks (NSInteger count) + { + return invokeObjcSelf!(void, "setNumberOfMajorTickMarks:", NSInteger)(count); + } + + double tickMarkValueAtIndex (NSInteger index) + { + return invokeObjcSelf!(double, "tickMarkValueAtIndex:", NSInteger)(index); + } + + NSRect rectOfTickMarkAtIndex (NSInteger index) + { + return invokeObjcSelf!(NSRect, "rectOfTickMarkAtIndex:", NSInteger)(index); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSLevelIndicatorCell.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSLevelIndicatorCell.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,137 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSLevelIndicatorCell; + +import dstep.appkit.NSActionCell; +import dstep.appkit.NSImage; +import dstep.appkit.NSSliderCell; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +alias NSUInteger NSLevelIndicatorStyle; + +enum +{ + NSRelevancyLevelIndicatorStyle, + NSContinuousCapacityLevelIndicatorStyle, + NSDiscreteCapacityLevelIndicatorStyle, + NSRatingLevelIndicatorStyle +} + +class NSLevelIndicatorCell : NSActionCell +{ + mixin (ObjcWrap); + + NSLevelIndicatorCell initWithLevelIndicatorStyle (uint levelIndicatorStyle) + { + id result = invokeObjcSelf!(id, "initWithLevelIndicatorStyle:", uint)(levelIndicatorStyle); + return result is this.objcObject ? this : (result !is null ? new NSLevelIndicatorCell(result) : null); + } + + this (uint levelIndicatorStyle) + { + super(NSLevelIndicatorCell.alloc.initWithLevelIndicatorStyle(levelIndicatorStyle).objcObject); + } + + uint levelIndicatorStyle () + { + return invokeObjcSelf!(uint, "levelIndicatorStyle"); + } + + void setLevelIndicatorStyle (uint levelIndicatorStyle) + { + return invokeObjcSelf!(void, "setLevelIndicatorStyle:", uint)(levelIndicatorStyle); + } + + double minValue () + { + return invokeObjcSelf!(double, "minValue"); + } + + void setMinValue (double minValue) + { + return invokeObjcSelf!(void, "setMinValue:", double)(minValue); + } + + double maxValue () + { + return invokeObjcSelf!(double, "maxValue"); + } + + void setMaxValue (double maxValue) + { + return invokeObjcSelf!(void, "setMaxValue:", double)(maxValue); + } + + double warningValue () + { + return invokeObjcSelf!(double, "warningValue"); + } + + void setWarningValue (double warningValue) + { + return invokeObjcSelf!(void, "setWarningValue:", double)(warningValue); + } + + double criticalValue () + { + return invokeObjcSelf!(double, "criticalValue"); + } + + void setCriticalValue (double criticalValue) + { + return invokeObjcSelf!(void, "setCriticalValue:", double)(criticalValue); + } + + void setTickMarkPosition (uint position) + { + return invokeObjcSelf!(void, "setTickMarkPosition:", uint)(position); + } + + uint tickMarkPosition () + { + return invokeObjcSelf!(uint, "tickMarkPosition"); + } + + void setNumberOfTickMarks (NSInteger count) + { + return invokeObjcSelf!(void, "setNumberOfTickMarks:", NSInteger)(count); + } + + NSInteger numberOfTickMarks () + { + return invokeObjcSelf!(NSInteger, "numberOfTickMarks"); + } + + void setNumberOfMajorTickMarks (NSInteger count) + { + return invokeObjcSelf!(void, "setNumberOfMajorTickMarks:", NSInteger)(count); + } + + NSInteger numberOfMajorTickMarks () + { + return invokeObjcSelf!(NSInteger, "numberOfMajorTickMarks"); + } + + NSRect rectOfTickMarkAtIndex (NSInteger index) + { + return invokeObjcSelf!(NSRect, "rectOfTickMarkAtIndex:", NSInteger)(index); + } + + double tickMarkValueAtIndex (NSInteger index) + { + return invokeObjcSelf!(double, "tickMarkValueAtIndex:", NSInteger)(index); + } + + void setImage (NSImage image) + { + return invokeObjcSelf!(void, "setImage:", NSImage)(image); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSMatrix.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSMatrix.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,549 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSMatrix; + +import dstep.appkit.NSCell; +import dstep.appkit.NSColor; +import dstep.appkit.NSControl; +import dstep.appkit.NSEvent; +import dstep.appkit.NSText; +import dstep.appkit.NSUserInterfaceValidation; +import dstep.foundation.NSArray; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSNotification; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +alias NSUInteger NSMatrixMode; + +private alias extern (C) NSInteger function (id, id, void *) Comperator; + +enum +{ + NSRadioModeMatrix = 0, + NSHighlightModeMatrix = 1, + NSListModeMatrix = 2, + NSTrackModeMatrix = 3 +} + +struct _MFlags +{ + uint reservedMatrix; + uint browserOptimizationsEnabled; + uint needsRedrawBeforeFirstLiveResizeCache; + uint tmpAllowNonVisibleCellsToBecomeFirstResponder; + uint subclassIsSafeForLiveResize; + uint hasCachedSubclassIsSafeForLiveResize; + uint liveResizeImageCacheingEnabled; + uint checkForSimpleTrackingMode; + uint useSimpleTrackingMode; + uint refusesFirstResponder; + uint dontScroll; + uint changingSelectionWithKeyboard; + uint onlySetKeyCell; + uint currentlySelectingCell; + uint allowsIncrementalSearching; + uint tabKeyTraversesCellsExplicitlySet; + uint tabKeyTraversesCells; + uint drawingAncestor; + uint autosizeCells; + uint drawsBackground; + uint drawsCellBackground; + uint selectionByRect; + uint autoscroll; + uint allowEmptySel; + uint listMode; + uint radioMode; + uint highlightMode; +} + +class NSMatrix : NSControl, INSUserInterfaceValidations +{ + mixin (ObjcWrap); + + NSMatrix initWithFrame (NSRect frameRect) + { + id result = invokeObjcSelf!(id, "initWithFrame:", NSRect)(frameRect); + return result is this.objcObject ? this : (result !is null ? new NSMatrix(result) : null); + } + + this (NSRect frameRect) + { + super(NSMatrix.alloc.initWithFrame(frameRect).objcObject); + } + + NSMatrix initWithFrame (NSRect frameRect, uint aMode, NSCell aCell, NSInteger rowsHigh, NSInteger colsWide) + { + id result = invokeObjcSelf!(id, "initWithFrame:mode:prototype:numberOfRows:numberOfColumns:", NSRect, uint, NSCell, NSInteger, NSInteger)(frameRect, aMode, aCell, rowsHigh, colsWide); + return result is this.objcObject ? this : (result !is null ? new NSMatrix(result) : null); + } + + this (NSRect frameRect, uint aMode, NSCell aCell, NSInteger rowsHigh, NSInteger colsWide) + { + super(NSMatrix.alloc.initWithFrame(frameRect, aMode, aCell, rowsHigh, colsWide).objcObject); + } + + NSMatrix initWithFrame (NSRect frameRect, uint aMode, Class factoryId, NSInteger rowsHigh, NSInteger colsWide) + { + id result = invokeObjcSelf!(id, "initWithFrame:mode:cellClass:numberOfRows:numberOfColumns:", NSRect, uint, Class, NSInteger, NSInteger)(frameRect, aMode, factoryId, rowsHigh, colsWide); + return result is this.objcObject ? this : (result !is null ? new NSMatrix(result) : null); + } + + this (NSRect frameRect, uint aMode, Class factoryId, NSInteger rowsHigh, NSInteger colsWide) + { + super(NSMatrix.alloc.initWithFrame(frameRect, aMode, factoryId, rowsHigh, colsWide).objcObject); + } + + void setCellClass (Class factoryId) + { + return invokeObjcSelf!(void, "setCellClass:", Class)(factoryId); + } + + Class cellClass () + { + return invokeObjcSelf!(Class, "cellClass"); + } + + Object prototype () + { + return invokeObjcSelf!(Object, "prototype"); + } + + void setPrototype (NSCell aCell) + { + return invokeObjcSelf!(void, "setPrototype:", NSCell)(aCell); + } + + NSCell makeCellAtRow (NSInteger row, NSInteger col) + { + return invokeObjcSelf!(NSCell, "makeCellAtRow:column:", NSInteger, NSInteger)(row, col); + } + + uint mode () + { + return invokeObjcSelf!(uint, "mode"); + } + + void setMode (uint aMode) + { + return invokeObjcSelf!(void, "setMode:", uint)(aMode); + } + + void setAllowsEmptySelection (bool flag) + { + return invokeObjcSelf!(void, "setAllowsEmptySelection:", bool)(flag); + } + + bool allowsEmptySelection () + { + return invokeObjcSelf!(bool, "allowsEmptySelection"); + } + + void sendAction (SEL aSelector, Object anObject, bool flag) + { + return invokeObjcSelf!(void, "sendAction:to:forAllCells:", SEL, Object, bool)(aSelector, anObject, flag); + } + + NSArray cells () + { + return invokeObjcSelf!(NSArray, "cells"); + } + + void sortUsingSelector (SEL comparator) + { + return invokeObjcSelf!(void, "sortUsingSelector:", SEL)(comparator); + } + + void sortUsingFunction (Comperator compare, void* context) + { + return invokeObjcSelf!(void, "sortUsingFunction:context:", Comperator, void*)(compare, context); + } + + Object selectedCell () + { + return invokeObjcSelf!(Object, "selectedCell"); + } + + NSArray selectedCells () + { + return invokeObjcSelf!(NSArray, "selectedCells"); + } + + NSInteger selectedRow () + { + return invokeObjcSelf!(NSInteger, "selectedRow"); + } + + NSInteger selectedColumn () + { + return invokeObjcSelf!(NSInteger, "selectedColumn"); + } + + void setSelectionByRect (bool flag) + { + return invokeObjcSelf!(void, "setSelectionByRect:", bool)(flag); + } + + bool isSelectionByRect () + { + return invokeObjcSelf!(bool, "isSelectionByRect"); + } + + void setSelectionFrom (NSInteger startPos, NSInteger endPos, NSInteger anchorPos, bool lit) + { + return invokeObjcSelf!(void, "setSelectionFrom:to:anchor:highlight:", NSInteger, NSInteger, NSInteger, bool)(startPos, endPos, anchorPos, lit); + } + + void deselectSelectedCell () + { + return invokeObjcSelf!(void, "deselectSelectedCell"); + } + + void deselectAllCells () + { + return invokeObjcSelf!(void, "deselectAllCells"); + } + + void selectCellAtRow (NSInteger row, NSInteger col) + { + return invokeObjcSelf!(void, "selectCellAtRow:column:", NSInteger, NSInteger)(row, col); + } + + void selectAll (Object sender) + { + return invokeObjcSelf!(void, "selectAll:", Object)(sender); + } + + bool selectCellWithTag (NSInteger anInt) + { + return invokeObjcSelf!(bool, "selectCellWithTag:", NSInteger)(anInt); + } + + NSSize cellSize () + { + return invokeObjcSelf!(NSSize, "cellSize"); + } + + void setCellSize (NSSize aSize) + { + return invokeObjcSelf!(void, "setCellSize:", NSSize)(aSize); + } + + NSSize intercellSpacing () + { + return invokeObjcSelf!(NSSize, "intercellSpacing"); + } + + void setIntercellSpacing (NSSize aSize) + { + return invokeObjcSelf!(void, "setIntercellSpacing:", NSSize)(aSize); + } + + void setScrollable (bool flag) + { + return invokeObjcSelf!(void, "setScrollable:", bool)(flag); + } + + void setBackgroundColor (NSColor color) + { + return invokeObjcSelf!(void, "setBackgroundColor:", NSColor)(color); + } + + NSColor backgroundColor () + { + return invokeObjcSelf!(NSColor, "backgroundColor"); + } + + void setCellBackgroundColor (NSColor color) + { + return invokeObjcSelf!(void, "setCellBackgroundColor:", NSColor)(color); + } + + NSColor cellBackgroundColor () + { + return invokeObjcSelf!(NSColor, "cellBackgroundColor"); + } + + void setDrawsCellBackground (bool flag) + { + return invokeObjcSelf!(void, "setDrawsCellBackground:", bool)(flag); + } + + bool drawsCellBackground () + { + return invokeObjcSelf!(bool, "drawsCellBackground"); + } + + void setDrawsBackground (bool flag) + { + return invokeObjcSelf!(void, "setDrawsBackground:", bool)(flag); + } + + bool drawsBackground () + { + return invokeObjcSelf!(bool, "drawsBackground"); + } + + void setState (NSInteger value, NSInteger row, NSInteger col) + { + return invokeObjcSelf!(void, "setState:atRow:column:", NSInteger, NSInteger, NSInteger)(value, row, col); + } + + void getNumberOfRows (NSInteger* rowCount, NSInteger* colCount) + { + return invokeObjcSelf!(void, "getNumberOfRows:columns:", NSInteger*, NSInteger*)(rowCount, colCount); + } + + NSInteger numberOfRows () + { + return invokeObjcSelf!(NSInteger, "numberOfRows"); + } + + NSInteger numberOfColumns () + { + return invokeObjcSelf!(NSInteger, "numberOfColumns"); + } + + Object cellAtRow (NSInteger row, NSInteger col) + { + return invokeObjcSelf!(Object, "cellAtRow:column:", NSInteger, NSInteger)(row, col); + } + + NSRect cellFrameAtRow (NSInteger row, NSInteger col) + { + return invokeObjcSelf!(NSRect, "cellFrameAtRow:column:", NSInteger, NSInteger)(row, col); + } + + bool getRow (NSInteger* row, NSInteger* col, NSCell aCell) + { + return invokeObjcSelf!(bool, "getRow:column:ofCell:", NSInteger*, NSInteger*, NSCell)(row, col, aCell); + } + + bool getRow (NSInteger* row, NSInteger* col, NSPoint aPoint) + { + return invokeObjcSelf!(bool, "getRow:column:forPoint:", NSInteger*, NSInteger*, NSPoint)(row, col, aPoint); + } + + void renewRows (NSInteger newRows, NSInteger newCols) + { + return invokeObjcSelf!(void, "renewRows:columns:", NSInteger, NSInteger)(newRows, newCols); + } + + void putCell (NSCell newCell, NSInteger row, NSInteger col) + { + return invokeObjcSelf!(void, "putCell:atRow:column:", NSCell, NSInteger, NSInteger)(newCell, row, col); + } + + void addRow () + { + return invokeObjcSelf!(void, "addRow"); + } + + void addRowWithCells (NSArray newCells) + { + return invokeObjcSelf!(void, "addRowWithCells:", NSArray)(newCells); + } + + void insertRow (NSInteger row) + { + return invokeObjcSelf!(void, "insertRow:", NSInteger)(row); + } + + void insertRow (NSInteger row, NSArray newCells) + { + return invokeObjcSelf!(void, "insertRow:withCells:", NSInteger, NSArray)(row, newCells); + } + + void removeRow (NSInteger row) + { + return invokeObjcSelf!(void, "removeRow:", NSInteger)(row); + } + + void addColumn () + { + return invokeObjcSelf!(void, "addColumn"); + } + + void addColumnWithCells (NSArray newCells) + { + return invokeObjcSelf!(void, "addColumnWithCells:", NSArray)(newCells); + } + + void insertColumn (NSInteger column) + { + return invokeObjcSelf!(void, "insertColumn:", NSInteger)(column); + } + + void insertColumn (NSInteger column, NSArray newCells) + { + return invokeObjcSelf!(void, "insertColumn:withCells:", NSInteger, NSArray)(column, newCells); + } + + void removeColumn (NSInteger col) + { + return invokeObjcSelf!(void, "removeColumn:", NSInteger)(col); + } + + Object cellWithTag (NSInteger anInt) + { + return invokeObjcSelf!(Object, "cellWithTag:", NSInteger)(anInt); + } + + SEL doubleAction () + { + return invokeObjcSelf!(SEL, "doubleAction"); + } + + void setDoubleAction (SEL aSelector) + { + return invokeObjcSelf!(void, "setDoubleAction:", SEL)(aSelector); + } + + void setAutosizesCells (bool flag) + { + return invokeObjcSelf!(void, "setAutosizesCells:", bool)(flag); + } + + bool autosizesCells () + { + return invokeObjcSelf!(bool, "autosizesCells"); + } + + void sizeToCells () + { + return invokeObjcSelf!(void, "sizeToCells"); + } + + void setValidateSize (bool flag) + { + return invokeObjcSelf!(void, "setValidateSize:", bool)(flag); + } + + void drawCellAtRow (NSInteger row, NSInteger col) + { + return invokeObjcSelf!(void, "drawCellAtRow:column:", NSInteger, NSInteger)(row, col); + } + + void highlightCell (bool flag, NSInteger row, NSInteger col) + { + return invokeObjcSelf!(void, "highlightCell:atRow:column:", bool, NSInteger, NSInteger)(flag, row, col); + } + + void setAutoscroll (bool flag) + { + return invokeObjcSelf!(void, "setAutoscroll:", bool)(flag); + } + + bool isAutoscroll () + { + return invokeObjcSelf!(bool, "isAutoscroll"); + } + + void scrollCellToVisibleAtRow (NSInteger row, NSInteger col) + { + return invokeObjcSelf!(void, "scrollCellToVisibleAtRow:column:", NSInteger, NSInteger)(row, col); + } + + NSInteger mouseDownFlags () + { + return invokeObjcSelf!(NSInteger, "mouseDownFlags"); + } + + void mouseDown (NSEvent theEvent) + { + return invokeObjcSelf!(void, "mouseDown:", NSEvent)(theEvent); + } + + bool performKeyEquivalent (NSEvent theEvent) + { + return invokeObjcSelf!(bool, "performKeyEquivalent:", NSEvent)(theEvent); + } + + bool sendAction () + { + return invokeObjcSelf!(bool, "sendAction"); + } + + void sendDoubleAction () + { + return invokeObjcSelf!(void, "sendDoubleAction"); + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + void setDelegate (Object anObject) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(anObject); + } + + bool textShouldBeginEditing (NSText textObject) + { + return invokeObjcSelf!(bool, "textShouldBeginEditing:", NSText)(textObject); + } + + bool textShouldEndEditing (NSText textObject) + { + return invokeObjcSelf!(bool, "textShouldEndEditing:", NSText)(textObject); + } + + void textDidBeginEditing (NSNotification notification) + { + return invokeObjcSelf!(void, "textDidBeginEditing:", NSNotification)(notification); + } + + void textDidEndEditing (NSNotification notification) + { + return invokeObjcSelf!(void, "textDidEndEditing:", NSNotification)(notification); + } + + void textDidChange (NSNotification notification) + { + return invokeObjcSelf!(void, "textDidChange:", NSNotification)(notification); + } + + void selectText (Object sender) + { + return invokeObjcSelf!(void, "selectText:", Object)(sender); + } + + Object selectTextAtRow (NSInteger row, NSInteger col) + { + return invokeObjcSelf!(Object, "selectTextAtRow:column:", NSInteger, NSInteger)(row, col); + } + + bool acceptsFirstMouse (NSEvent theEvent) + { + return invokeObjcSelf!(bool, "acceptsFirstMouse:", NSEvent)(theEvent); + } + + void resetCursorRects () + { + return invokeObjcSelf!(void, "resetCursorRects"); + } + + void setToolTip (NSString toolTipString, NSCell cell) + { + return invokeObjcSelf!(void, "setToolTip:forCell:", NSString, NSCell)(toolTipString, cell); + } + + NSString toolTipForCell (NSCell cell) + { + return invokeObjcSelf!(NSString, "toolTipForCell:", NSCell)(cell); + } + + bool validateUserInterfaceItem (INSValidatedUserInterfaceItem anItem) + { + return invokeObjcSelf!(bool, "validateUserInterfaceItem:", INSValidatedUserInterfaceItem)(anItem); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSMenu.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSMenu.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,480 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSMenu; + +import dstep.appkit.AppKitDefines; +import dstep.appkit.NSEvent; +import dstep.appkit.NSFont; +import dstep.appkit.NSMenuItem; +import dstep.appkit.NSView; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSArray; +import dstep.foundation.NSCoder; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.appkit.NSMenu_bindings; + +private +{ + NSString NSMenuWillSendActionNotification_; + NSString NSMenuDidSendActionNotification_; + NSString NSMenuDidAddItemNotification_; + NSString NSMenuDidRemoveItemNotification_; + NSString NSMenuDidChangeItemNotification_; + NSString NSMenuDidBeginTrackingNotification_; + NSString NSMenuDidEndTrackingNotification_; +} + +NSString NSMenuWillSendActionNotification () +{ + if (NSMenuWillSendActionNotification_) + return NSMenuWillSendActionNotification_; + + return NSMenuWillSendActionNotification_ = new NSString(bindings.NSMenuWillSendActionNotification); +} + +NSString NSMenuDidSendActionNotification () +{ + if (NSMenuDidSendActionNotification_) + return NSMenuDidSendActionNotification_; + + return NSMenuDidSendActionNotification_ = new NSString(bindings.NSMenuDidSendActionNotification); +} + +NSString NSMenuDidAddItemNotification () +{ + if (NSMenuDidAddItemNotification_) + return NSMenuDidAddItemNotification_; + + return NSMenuDidAddItemNotification_ = new NSString(bindings.NSMenuDidAddItemNotification); +} + +NSString NSMenuDidRemoveItemNotification () +{ + if (NSMenuDidRemoveItemNotification_) + return NSMenuDidRemoveItemNotification_; + + return NSMenuDidRemoveItemNotification_ = new NSString(bindings.NSMenuDidRemoveItemNotification); +} + +NSString NSMenuDidChangeItemNotification () +{ + if (NSMenuDidChangeItemNotification_) + return NSMenuDidChangeItemNotification_; + + return NSMenuDidChangeItemNotification_ = new NSString(bindings.NSMenuDidChangeItemNotification); +} + +NSString NSMenuDidBeginTrackingNotification () +{ + if (NSMenuDidBeginTrackingNotification_) + return NSMenuDidBeginTrackingNotification_; + + return NSMenuDidBeginTrackingNotification_ = new NSString(bindings.NSMenuDidBeginTrackingNotification); +} + +NSString NSMenuDidEndTrackingNotification () +{ + if (NSMenuDidEndTrackingNotification_) + return NSMenuDidEndTrackingNotification_; + + return NSMenuDidEndTrackingNotification_ = new NSString(bindings.NSMenuDidEndTrackingNotification); +} + +const TNSMenuDelegate = ` + + void menuNeedsUpdate (NSMenu menu) + { + return invokeObjcSelf!(void, "menuNeedsUpdate:", NSMenu)(menu); + } + + NSInteger numberOfItemsInMenu (NSMenu menu) + { + return invokeObjcSelf!(NSInteger, "numberOfItemsInMenu:", NSMenu)(menu); + } + + bool menu (NSMenu menu, NSMenuItem item, NSInteger index, bool shouldCancel) + { + return invokeObjcSelf!(bool, "menu:updateItem:atIndex:shouldCancel:", NSMenu, NSMenuItem, NSInteger, bool)(menu, item, index, shouldCancel); + } + + bool menuHasKeyEquivalent (NSMenu menu, NSEvent event, id* target, SEL* action) + { + return invokeObjcSelf!(bool, "menuHasKeyEquivalent:forEvent:target:action:", NSMenu, NSEvent, id*, SEL*)(menu, event, target, action); + } + + void menuWillOpen (NSMenu menu) + { + return invokeObjcSelf!(void, "menuWillOpen:", NSMenu)(menu); + } + + void menuDidClose (NSMenu menu) + { + return invokeObjcSelf!(void, "menuDidClose:", NSMenu)(menu); + } + + void menu (NSMenu menu, NSMenuItem item) + { + return invokeObjcSelf!(void, "menu:willHighlightItem:", NSMenu, NSMenuItem)(menu, item); + } + + //mixin ObjcBindMethod!(menuNeedsUpdate, "menuNeedsUpdate:"); + //mixin ObjcBindMethod!(numberOfItemsInMenu, "numberOfItemsInMenu:"); + //mixin ObjcBindMethod!(menu, "menu:updateItem:atIndex:shouldCancel:"); + //mixin ObjcBindMethod!(menuHasKeyEquivalent, "menuHasKeyEquivalent:forEvent:target:action:"); + //mixin ObjcBindMethod!(menuWillOpen, "menuWillOpen:"); + //mixin ObjcBindMethod!(menuDidClose, "menuDidClose:"); + //mixin ObjcBindMethod!(menu, "menu:willHighlightItem:"); + +`; + +const TNSSubmenuAction = ` + + void submenuAction (Object sender) + { + return invokeObjcSelf!(void, "submenuAction:", Object)(sender); + } + + //mixin ObjcBindMethod!(submenuAction, "submenuAction:"); + +`; + +const TNSMenuValidation = ` + + bool validateMenuItem (NSMenuItem menuItem) + { + return invokeObjcSelf!(bool, "validateMenuItem:", NSMenuItem)(menuItem); + } + + //mixin ObjcBindMethod!(validateMenuItem, "validateMenuItem:"); + +`; + +class NSMenu : NSObject, INSCopying, INSCoding +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + typeof(this) copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); + } + + static void setMenuZone (NSZone* aZone) + { + return invokeObjcSelfClass!(void, "setMenuZone:", NSZone*)(aZone); + } + + static NSZone* menuZone () + { + return invokeObjcSelfClass!(NSZone*, "menuZone"); + } + + static void popUpContextMenu (NSMenu menu, NSEvent event, NSView view) + { + return invokeObjcSelfClass!(void, "popUpContextMenu:withEvent:forView:", NSMenu, NSEvent, NSView)(menu, event, view); + } + + static void popUpContextMenu (NSMenu menu, NSEvent event, NSView view, NSFont font) + { + return invokeObjcSelfClass!(void, "popUpContextMenu:withEvent:forView:withFont:", NSMenu, NSEvent, NSView, NSFont)(menu, event, view, font); + } + + static void setMenuBarVisible (bool visible) + { + return invokeObjcSelfClass!(void, "setMenuBarVisible:", bool)(visible); + } + + static bool menuBarVisible () + { + return invokeObjcSelfClass!(bool, "menuBarVisible"); + } + + NSMenu initWithTitle (NSString aTitle) + { + id result = invokeObjcSelf!(id, "initWithTitle:", NSString)(aTitle); + return result is this.objcObject ? this : (result !is null ? new NSMenu(result) : null); + } + + this (NSString aTitle) + { + super(NSMenu.alloc.initWithTitle(aTitle).objcObject); + } + + void setTitle (NSString aString) + { + return invokeObjcSelf!(void, "setTitle:", NSString)(aString); + } + + NSString title () + { + return invokeObjcSelf!(NSString, "title"); + } + + void setSupermenu (NSMenu supermenu) + { + return invokeObjcSelf!(void, "setSupermenu:", NSMenu)(supermenu); + } + + NSMenu supermenu () + { + id result = invokeObjcSelf!(id, "supermenu"); + return result is this.objcObject ? this : (result !is null ? new NSMenu(result) : null); + } + + void insertItem (NSMenuItem newItem, NSInteger index) + { + return invokeObjcSelf!(void, "insertItem:atIndex:", NSMenuItem, NSInteger)(newItem, index); + } + + void addItem (NSMenuItem newItem) + { + return invokeObjcSelf!(void, "addItem:", NSMenuItem)(newItem); + } + + NSMenuItem insertItemWithTitle (NSString aString, SEL aSelector, NSString charCode, NSInteger index) + { + return invokeObjcSelf!(NSMenuItem, "insertItemWithTitle:action:keyEquivalent:atIndex:", NSString, SEL, NSString, NSInteger)(aString, aSelector, charCode, index); + } + + NSMenuItem addItemWithTitle (NSString aString, SEL aSelector, NSString charCode) + { + return invokeObjcSelf!(NSMenuItem, "addItemWithTitle:action:keyEquivalent:", NSString, SEL, NSString)(aString, aSelector, charCode); + } + + void removeItemAtIndex (NSInteger index) + { + return invokeObjcSelf!(void, "removeItemAtIndex:", NSInteger)(index); + } + + void removeItem (NSMenuItem item) + { + return invokeObjcSelf!(void, "removeItem:", NSMenuItem)(item); + } + + void setSubmenu (NSMenu aMenu, NSMenuItem anItem) + { + return invokeObjcSelf!(void, "setSubmenu:forItem:", NSMenu, NSMenuItem)(aMenu, anItem); + } + + NSArray itemArray () + { + return invokeObjcSelf!(NSArray, "itemArray"); + } + + NSInteger numberOfItems () + { + return invokeObjcSelf!(NSInteger, "numberOfItems"); + } + + NSInteger indexOfItem (NSMenuItem index) + { + return invokeObjcSelf!(NSInteger, "indexOfItem:", NSMenuItem)(index); + } + + NSInteger indexOfItemWithTitle (NSString aTitle) + { + return invokeObjcSelf!(NSInteger, "indexOfItemWithTitle:", NSString)(aTitle); + } + + NSInteger indexOfItemWithTag (NSInteger aTag) + { + return invokeObjcSelf!(NSInteger, "indexOfItemWithTag:", NSInteger)(aTag); + } + + NSInteger indexOfItemWithRepresentedObject (Object object) + { + return invokeObjcSelf!(NSInteger, "indexOfItemWithRepresentedObject:", Object)(object); + } + + NSInteger indexOfItemWithSubmenu (NSMenu submenu) + { + return invokeObjcSelf!(NSInteger, "indexOfItemWithSubmenu:", NSMenu)(submenu); + } + + NSInteger indexOfItemWithTarget (Object target, SEL actionSelector) + { + return invokeObjcSelf!(NSInteger, "indexOfItemWithTarget:andAction:", Object, SEL)(target, actionSelector); + } + + NSMenuItem itemAtIndex (NSInteger index) + { + return invokeObjcSelf!(NSMenuItem, "itemAtIndex:", NSInteger)(index); + } + + NSMenuItem itemWithTitle (NSString aTitle) + { + return invokeObjcSelf!(NSMenuItem, "itemWithTitle:", NSString)(aTitle); + } + + NSMenuItem itemWithTag (NSInteger tag) + { + return invokeObjcSelf!(NSMenuItem, "itemWithTag:", NSInteger)(tag); + } + + void setAutoenablesItems (bool flag) + { + return invokeObjcSelf!(void, "setAutoenablesItems:", bool)(flag); + } + + bool autoenablesItems () + { + return invokeObjcSelf!(bool, "autoenablesItems"); + } + + bool performKeyEquivalent (NSEvent theEvent) + { + return invokeObjcSelf!(bool, "performKeyEquivalent:", NSEvent)(theEvent); + } + + void update () + { + return invokeObjcSelf!(void, "update"); + } + + void setMenuChangedMessagesEnabled (bool flag) + { + return invokeObjcSelf!(void, "setMenuChangedMessagesEnabled:", bool)(flag); + } + + bool menuChangedMessagesEnabled () + { + return invokeObjcSelf!(bool, "menuChangedMessagesEnabled"); + } + + void itemChanged (NSMenuItem item) + { + return invokeObjcSelf!(void, "itemChanged:", NSMenuItem)(item); + } + + void helpRequested (NSEvent eventPtr) + { + return invokeObjcSelf!(void, "helpRequested:", NSEvent)(eventPtr); + } + + void setMenuRepresentation (Object menuRep) + { + return invokeObjcSelf!(void, "setMenuRepresentation:", Object)(menuRep); + } + + Object menuRepresentation () + { + return invokeObjcSelf!(Object, "menuRepresentation"); + } + + void setContextMenuRepresentation (Object menuRep) + { + return invokeObjcSelf!(void, "setContextMenuRepresentation:", Object)(menuRep); + } + + Object contextMenuRepresentation () + { + return invokeObjcSelf!(Object, "contextMenuRepresentation"); + } + + void setTearOffMenuRepresentation (Object menuRep) + { + return invokeObjcSelf!(void, "setTearOffMenuRepresentation:", Object)(menuRep); + } + + Object tearOffMenuRepresentation () + { + return invokeObjcSelf!(Object, "tearOffMenuRepresentation"); + } + + bool isTornOff () + { + return invokeObjcSelf!(bool, "isTornOff"); + } + + NSMenu attachedMenu () + { + id result = invokeObjcSelf!(id, "attachedMenu"); + return result is this.objcObject ? this : (result !is null ? new NSMenu(result) : null); + } + + bool isAttached () + { + return invokeObjcSelf!(bool, "isAttached"); + } + + void sizeToFit () + { + return invokeObjcSelf!(void, "sizeToFit"); + } + + NSPoint locationForSubmenu (NSMenu aSubmenu) + { + return invokeObjcSelf!(NSPoint, "locationForSubmenu:", NSMenu)(aSubmenu); + } + + void performActionForItemAtIndex (NSInteger index) + { + return invokeObjcSelf!(void, "performActionForItemAtIndex:", NSInteger)(index); + } + + void setDelegate (Object anObject) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(anObject); + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + CGFloat menuBarHeight () + { + return invokeObjcSelf!(CGFloat, "menuBarHeight"); + } + + void cancelTracking () + { + return invokeObjcSelf!(void, "cancelTracking"); + } + + NSMenuItem highlightedItem () + { + return invokeObjcSelf!(NSMenuItem, "highlightedItem"); + } + + void setShowsStateColumn (bool showsState) + { + return invokeObjcSelf!(void, "setShowsStateColumn:", bool)(showsState); + } + + bool showsStateColumn () + { + return invokeObjcSelf!(bool, "showsStateColumn"); + } + + // NSSubmenuAction + void submenuAction (Object sender) + { + return invokeObjcSelf!(void, "submenuAction:", Object)(sender); + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSMenuItem.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSMenuItem.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,399 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSMenuItem; + +import dstep.appkit.AppKitDefines; +import dstep.appkit.NSAttributedString; +import dstep.appkit.NSImage; +import dstep.appkit.NSMenu; +import dstep.appkit.NSUserInterfaceValidation; +import dstep.appkit.NSView; +import dstep.foundation.NSAttributedString; +import dstep.foundation.NSCoder; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSMenuItem : NSObject, INSCopying, INSCoding, INSValidatedUserInterfaceItem +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + typeof(this) copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); + } + + static void setUsesUserKeyEquivalents (bool flag) + { + return invokeObjcSelfClass!(void, "setUsesUserKeyEquivalents:", bool)(flag); + } + + static bool usesUserKeyEquivalents () + { + return invokeObjcSelfClass!(bool, "usesUserKeyEquivalents"); + } + + static NSMenuItem separatorItem () + { + return invokeObjcSelfClass!(NSMenuItem, "separatorItem"); + } + + NSMenuItem initWithTitle (NSString aString, SEL aSelector, NSString charCode) + { + id result = invokeObjcSelf!(id, "initWithTitle:action:keyEquivalent:", NSString, SEL, NSString)(aString, aSelector, charCode); + return result is this.objcObject ? this : (result !is null ? new NSMenuItem(result) : null); + } + + this (NSString aString, SEL aSelector, NSString charCode) + { + super(NSMenuItem.alloc.initWithTitle(aString, aSelector, charCode).objcObject); + } + + void setMenu (NSMenu menu) + { + return invokeObjcSelf!(void, "setMenu:", NSMenu)(menu); + } + + NSMenu menu () + { + return invokeObjcSelf!(NSMenu, "menu"); + } + + bool hasSubmenu () + { + return invokeObjcSelf!(bool, "hasSubmenu"); + } + + void setSubmenu (NSMenu submenu) + { + return invokeObjcSelf!(void, "setSubmenu:", NSMenu)(submenu); + } + + NSMenu submenu () + { + return invokeObjcSelf!(NSMenu, "submenu"); + } + + void setTitle (NSString aString) + { + return invokeObjcSelf!(void, "setTitle:", NSString)(aString); + } + + NSString title () + { + return invokeObjcSelf!(NSString, "title"); + } + + void setAttributedTitle (NSAttributedString string) + { + return invokeObjcSelf!(void, "setAttributedTitle:", NSAttributedString)(string); + } + + NSAttributedString attributedTitle () + { + return invokeObjcSelf!(NSAttributedString, "attributedTitle"); + } + + bool isSeparatorItem () + { + return invokeObjcSelf!(bool, "isSeparatorItem"); + } + + void setKeyEquivalent (NSString aKeyEquivalent) + { + return invokeObjcSelf!(void, "setKeyEquivalent:", NSString)(aKeyEquivalent); + } + + NSString keyEquivalent () + { + return invokeObjcSelf!(NSString, "keyEquivalent"); + } + + void setKeyEquivalentModifierMask (NSUInteger mask) + { + return invokeObjcSelf!(void, "setKeyEquivalentModifierMask:", NSUInteger)(mask); + } + + NSUInteger keyEquivalentModifierMask () + { + return invokeObjcSelf!(NSUInteger, "keyEquivalentModifierMask"); + } + + NSString userKeyEquivalent () + { + return invokeObjcSelf!(NSString, "userKeyEquivalent"); + } + + void setMnemonicLocation (NSUInteger location) + { + return invokeObjcSelf!(void, "setMnemonicLocation:", NSUInteger)(location); + } + + NSUInteger mnemonicLocation () + { + return invokeObjcSelf!(NSUInteger, "mnemonicLocation"); + } + + NSString mnemonic () + { + return invokeObjcSelf!(NSString, "mnemonic"); + } + + void setTitleWithMnemonic (NSString stringWithAmpersand) + { + return invokeObjcSelf!(void, "setTitleWithMnemonic:", NSString)(stringWithAmpersand); + } + + void setImage (NSImage menuImage) + { + return invokeObjcSelf!(void, "setImage:", NSImage)(menuImage); + } + + NSImage image () + { + return invokeObjcSelf!(NSImage, "image"); + } + + void setState (NSInteger state) + { + return invokeObjcSelf!(void, "setState:", NSInteger)(state); + } + + NSInteger state () + { + return invokeObjcSelf!(NSInteger, "state"); + } + + void setOnStateImage (NSImage image) + { + return invokeObjcSelf!(void, "setOnStateImage:", NSImage)(image); + } + + NSImage onStateImage () + { + return invokeObjcSelf!(NSImage, "onStateImage"); + } + + void setOffStateImage (NSImage image) + { + return invokeObjcSelf!(void, "setOffStateImage:", NSImage)(image); + } + + NSImage offStateImage () + { + return invokeObjcSelf!(NSImage, "offStateImage"); + } + + void setMixedStateImage (NSImage image) + { + return invokeObjcSelf!(void, "setMixedStateImage:", NSImage)(image); + } + + NSImage mixedStateImage () + { + return invokeObjcSelf!(NSImage, "mixedStateImage"); + } + + void setEnabled (bool flag) + { + return invokeObjcSelf!(void, "setEnabled:", bool)(flag); + } + + bool isEnabled () + { + return invokeObjcSelf!(bool, "isEnabled"); + } + + void setAlternate (bool isAlternate) + { + return invokeObjcSelf!(void, "setAlternate:", bool)(isAlternate); + } + + bool isAlternate () + { + return invokeObjcSelf!(bool, "isAlternate"); + } + + void setIndentationLevel (NSInteger indentationLevel) + { + return invokeObjcSelf!(void, "setIndentationLevel:", NSInteger)(indentationLevel); + } + + NSInteger indentationLevel () + { + return invokeObjcSelf!(NSInteger, "indentationLevel"); + } + + void setTarget (Object anObject) + { + return invokeObjcSelf!(void, "setTarget:", Object)(anObject); + } + + Object target () + { + return invokeObjcSelf!(Object, "target"); + } + + void setAction (SEL aSelector) + { + return invokeObjcSelf!(void, "setAction:", SEL)(aSelector); + } + + SEL action () + { + return invokeObjcSelf!(SEL, "action"); + } + + void setTag (NSInteger anInt) + { + return invokeObjcSelf!(void, "setTag:", NSInteger)(anInt); + } + + NSInteger tag () + { + return invokeObjcSelf!(NSInteger, "tag"); + } + + void setRepresentedObject (Object anObject) + { + return invokeObjcSelf!(void, "setRepresentedObject:", Object)(anObject); + } + + Object representedObject () + { + return invokeObjcSelf!(Object, "representedObject"); + } + + void setView (NSView view) + { + return invokeObjcSelf!(void, "setView:", NSView)(view); + } + + NSView view () + { + return invokeObjcSelf!(NSView, "view"); + } + + bool isHighlighted () + { + return invokeObjcSelf!(bool, "isHighlighted"); + } + + void setHidden (bool hidden) + { + return invokeObjcSelf!(void, "setHidden:", bool)(hidden); + } + + bool isHidden () + { + return invokeObjcSelf!(bool, "isHidden"); + } + + bool isHiddenOrHasHiddenAncestor () + { + return invokeObjcSelf!(bool, "isHiddenOrHasHiddenAncestor"); + } + + void setToolTip (NSString toolTip) + { + return invokeObjcSelf!(void, "setToolTip:", NSString)(toolTip); + } + + NSString toolTip () + { + return invokeObjcSelf!(NSString, "toolTip"); + } +} + +interface INSMenuItem +{ + static void setUsesUserKeyEquivalents (bool flag); + static bool usesUserKeyEquivalents (); + static NSMenuItem separatorItem (); + Object initWithTitle (NSString aString, SEL aSelector, NSString charCode); + void setMenu (NSMenu menu); + NSMenu menu (); + bool hasSubmenu (); + void setSubmenu (NSMenu submenu); + NSMenu submenu (); + void setTitle (NSString aString); + NSString title (); + void setAttributedTitle (NSAttributedString string); + NSAttributedString attributedTitle (); + bool isSeparatorItem (); + void setKeyEquivalent (NSString aKeyEquivalent); + NSString keyEquivalent (); + void setKeyEquivalentModifierMask (NSUInteger mask); + NSUInteger keyEquivalentModifierMask (); + NSString userKeyEquivalent (); + void setMnemonicLocation (NSUInteger location); + NSUInteger mnemonicLocation (); + NSString mnemonic (); + void setTitleWithMnemonic (NSString stringWithAmpersand); + void setImage (NSImage menuImage); + NSImage image (); + void setState (NSInteger state); + NSInteger state (); + void setOnStateImage (NSImage image); + NSImage onStateImage (); + void setOffStateImage (NSImage image); + NSImage offStateImage (); + void setMixedStateImage (NSImage image); + NSImage mixedStateImage (); + void setEnabled (bool flag); + bool isEnabled (); + void setAlternate (bool isAlternate); + bool isAlternate (); + void setIndentationLevel (NSInteger indentationLevel); + NSInteger indentationLevel (); + void setTarget (Object anObject); + Object target (); + void setAction (SEL aSelector); + SEL action (); + void setTag (NSInteger anInt); + NSInteger tag (); + void setRepresentedObject (Object anObject); + Object representedObject (); + void setView (NSView view); + NSView view (); + bool isHighlighted (); + void setHidden (bool hidden); + bool isHidden (); + bool isHiddenOrHasHiddenAncestor (); + void setToolTip (NSString toolTip); + NSString toolTip (); +} + +const TNSViewEnclosingMenuItem = ` + + NSMenuItem enclosingMenuItem () + { + return invokeObjcSelf!(NSMenuItem, "enclosingMenuItem"); + } + + //mixin ObjcBindMethod!(enclosingMenuItem, "enclosingMenuItem"); + +`; + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSMenuItemCell.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSMenuItemCell.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,129 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSMenuItemCell; + +import dstep.appkit.NSButtonCell; +import dstep.appkit.NSMenu; +import dstep.appkit.NSMenuItem; +import dstep.appkit.NSMenuView; +import dstep.appkit.NSView; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSMenuItemCell : NSButtonCell +{ + mixin (ObjcWrap); + + void setMenuItem (NSMenuItem item) + { + return invokeObjcSelf!(void, "setMenuItem:", NSMenuItem)(item); + } + + NSMenuItem menuItem () + { + return invokeObjcSelf!(NSMenuItem, "menuItem"); + } + + void setNeedsSizing (bool flag) + { + return invokeObjcSelf!(void, "setNeedsSizing:", bool)(flag); + } + + bool needsSizing () + { + return invokeObjcSelf!(bool, "needsSizing"); + } + + void calcSize () + { + return invokeObjcSelf!(void, "calcSize"); + } + + void setNeedsDisplay (bool flag) + { + return invokeObjcSelf!(void, "setNeedsDisplay:", bool)(flag); + } + + bool needsDisplay () + { + return invokeObjcSelf!(bool, "needsDisplay"); + } + + CGFloat stateImageWidth () + { + return invokeObjcSelf!(CGFloat, "stateImageWidth"); + } + + CGFloat imageWidth () + { + return invokeObjcSelf!(CGFloat, "imageWidth"); + } + + CGFloat titleWidth () + { + return invokeObjcSelf!(CGFloat, "titleWidth"); + } + + CGFloat keyEquivalentWidth () + { + return invokeObjcSelf!(CGFloat, "keyEquivalentWidth"); + } + + NSRect stateImageRectForBounds (NSRect cellFrame) + { + return invokeObjcSelf!(NSRect, "stateImageRectForBounds:", NSRect)(cellFrame); + } + + NSRect titleRectForBounds (NSRect cellFrame) + { + return invokeObjcSelf!(NSRect, "titleRectForBounds:", NSRect)(cellFrame); + } + + NSRect keyEquivalentRectForBounds (NSRect cellFrame) + { + return invokeObjcSelf!(NSRect, "keyEquivalentRectForBounds:", NSRect)(cellFrame); + } + + void drawSeparatorItemWithFrame (NSRect cellFrame, NSView controlView) + { + return invokeObjcSelf!(void, "drawSeparatorItemWithFrame:inView:", NSRect, NSView)(cellFrame, controlView); + } + + void drawStateImageWithFrame (NSRect cellFrame, NSView controlView) + { + return invokeObjcSelf!(void, "drawStateImageWithFrame:inView:", NSRect, NSView)(cellFrame, controlView); + } + + void drawImageWithFrame (NSRect cellFrame, NSView controlView) + { + return invokeObjcSelf!(void, "drawImageWithFrame:inView:", NSRect, NSView)(cellFrame, controlView); + } + + void drawTitleWithFrame (NSRect cellFrame, NSView controlView) + { + return invokeObjcSelf!(void, "drawTitleWithFrame:inView:", NSRect, NSView)(cellFrame, controlView); + } + + void drawKeyEquivalentWithFrame (NSRect cellFrame, NSView controlView) + { + return invokeObjcSelf!(void, "drawKeyEquivalentWithFrame:inView:", NSRect, NSView)(cellFrame, controlView); + } + + void drawBorderAndBackgroundWithFrame (NSRect cellFrame, NSView controlView) + { + return invokeObjcSelf!(void, "drawBorderAndBackgroundWithFrame:inView:", NSRect, NSView)(cellFrame, controlView); + } + + NSInteger tag () + { + return invokeObjcSelf!(NSInteger, "tag"); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSMenuView.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSMenuView.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,240 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSMenuView; + +import dstep.appkit.AppKitDefines; +import dstep.appkit.NSEvent; +import dstep.appkit.NSFont; +import dstep.appkit.NSMenu; +import dstep.appkit.NSMenuItem; +import dstep.appkit.NSMenuItemCell; +import dstep.appkit.NSScreen; +import dstep.appkit.NSView; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSNotification; +import dstep.foundation.NSObjCRuntime; +import dstep.internal.Version; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +static if (!D_LP64): + +class NSMenuView : NSView +{ + mixin (ObjcWrap); + + static CGFloat menuBarHeight () + { + return invokeObjcSelfClass!(CGFloat, "menuBarHeight"); + } + + NSMenuView initWithFrame (NSRect frame) + { + return invokeObjcSelf!(NSMenuView, "initWithFrame:", NSRect)(frame); + } + + NSMenuView initAsTearOff () + { + return invokeObjcSelf!(NSMenuView, "initAsTearOff"); + } + + void setMenu (NSMenu menu) + { + return invokeObjcSelf!(NSMenuView, "setMenu:", NSMenu)(menu); + } + + NSMenu menu () + { + return invokeObjcSelf!(NSMenu, "menu"); + } + + void itemChanged (NSNotification notification) + { + return invokeObjcSelf!(void, "itemChanged:", NSNotification)(notification); + } + + void itemAdded (NSNotification notification) + { + return invokeObjcSelf!(void, "itemAdded:", NSNotification)(notification); + } + + void itemRemoved (NSNotification notification) + { + return invokeObjcSelf!(void, "itemRemoved:", NSNotification)(notification); + } + + void update () + { + return invokeObjcSelf!(void, "update"); + } + + void setHorizontal (bool flag) + { + return invokeObjcSelf!(void, "setHorizontal:", bool)(flag); + } + + bool isHorizontal () + { + return invokeObjcSelf!(bool, "isHorizontal"); + } + + void setFont (NSFont font) + { + return invokeObjcSelf!(void, "setFont:", NSFont)(font); + } + + NSFont font () + { + return invokeObjcSelf!(NSFont, "font"); + } + + NSRect innerRect () + { + return invokeObjcSelf!(NSRect, "innerRect"); + } + + NSRect rectOfItemAtIndex (NSInteger index) + { + return invokeObjcSelf!(NSRect, "rectOfItemAtIndex:", NSInteger)(index); + } + + NSInteger indexOfItemAtPoint (NSPoint point) + { + return invokeObjcSelf!(NSInteger, "indexOfItemAtPoint:", NSPoint)(point); + } + + void setNeedsDisplayForItemAtIndex (NSInteger index) + { + return invokeObjcSelf!(void, "setNeedsDisplayForItemAtIndex:", NSInteger)(index); + } + + void setHighlightedItemIndex (NSInteger index) + { + return invokeObjcSelf!(void, "setHighlightedItemIndex:", NSInteger)(index); + } + + NSInteger highlightedItemIndex () + { + return invokeObjcSelf!(NSInteger, "highlightedItemIndex"); + } + + CGFloat stateImageOffset () + { + return invokeObjcSelf!(CGFloat, "stateImageOffset"); + } + + CGFloat stateImageWidth () + { + return invokeObjcSelf!(CGFloat, "stateImageWidth"); + } + + CGFloat imageAndTitleOffset () + { + return invokeObjcSelf!(CGFloat, "imageAndTitleOffset"); + } + + CGFloat imageAndTitleWidth () + { + return invokeObjcSelf!(CGFloat, "imageAndTitleWidth"); + } + + CGFloat keyEquivalentOffset () + { + return invokeObjcSelf!(CGFloat, "keyEquivalentOffset"); + } + + CGFloat keyEquivalentWidth () + { + return invokeObjcSelf!(CGFloat, "keyEquivalentWidth"); + } + + void setMenuItemCell (NSMenuItemCell cell, NSInteger index) + { + return invokeObjcSelf!(void, "setMenuItemCell:forItemAtIndex:", NSMenuItemCell, NSInteger)(cell, index); + } + + NSMenuItemCell menuItemCellForItemAtIndex (NSInteger index) + { + return invokeObjcSelf!(NSMenuItemCell, "menuItemCellForItemAtIndex:", NSInteger)(index); + } + + NSMenuView attachedMenuView () + { + return invokeObjcSelf!(NSMenuView, "attachedMenuView"); + } + + void setNeedsSizing (bool flag) + { + return invokeObjcSelf!(void, "setNeedsSizing:", bool)(flag); + } + + bool needsSizing () + { + return invokeObjcSelf!(bool, "needsSizing"); + } + + void sizeToFit () + { + return invokeObjcSelf!(void, "sizeToFit"); + } + + NSMenu attachedMenu () + { + return invokeObjcSelf!(NSMenu, "attachedMenu"); + } + + bool isAttached () + { + return invokeObjcSelf!(bool, "isAttached"); + } + + bool isTornOff () + { + return invokeObjcSelf!(bool, "isTornOff"); + } + + NSPoint locationForSubmenu (NSMenu aSubmenu) + { + return invokeObjcSelf!(NSPoint, "locationForSubmenu:", NSMenu)(aSubmenu); + } + + void setWindowFrameForAttachingToRect (NSRect screenRect, NSScreen screen, NSRectEdge edge, NSInteger selectedItemIndex) + { + return invokeObjcSelf!(void, "setWindowFrameForAttachingToRect:onScreen:preferredEdge:popUpSelectedItem:", NSRect, NSScreen, NSRectEdge, NSInteger)(screenRect, screen, edge, selectedItemIndex); + } + + void detachSubmenu () + { + return invokeObjcSelf!(void, "detachSubmenu"); + } + + void attachSubmenuForItemAtIndex (NSInteger index) + { + return invokeObjcSelf!(void, "attachSubmenuForItemAtIndex:", NSInteger)(index); + } + + void performActionWithHighlightingForItemAtIndex (NSInteger index) + { + return invokeObjcSelf!(void, "performActionWithHighlightingForItemAtIndex:", NSInteger)(index); + } + + bool trackWithEvent (NSEvent event) + { + return invokeObjcSelf!(bool, "trackWithEvent:", NSEvent)(event); + } + + CGFloat horizontalEdgePadding () + { + return invokeObjcSelf!(CGFloat, "horizontalEdgePadding"); + } + + void setHorizontalEdgePadding (CGFloat pad) + { + return invokeObjcSelf!(void, "setHorizontalEdgePadding:", CGFloat)(pad); + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSMenu_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSMenu_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,24 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSMenu_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package id NSMenuWillSendActionNotification; + package id NSMenuDidSendActionNotification; + package id NSMenuDidAddItemNotification; + package id NSMenuDidRemoveItemNotification; + package id NSMenuDidChangeItemNotification; + package id NSMenuDidBeginTrackingNotification; + package id NSMenuDidEndTrackingNotification; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSMovie.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSMovie.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,52 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSMovie; + +import dstep.appkit.NSPasteboard; +import dstep.foundation.NSCoder; +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.qtkit.QTMovie; + +class NSMovie : NSObject, INSCoding +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + NSMovie initWithMovie (QTMovie movie) + { + id result = invokeObjcSelf!(id, "initWithMovie:", QTMovie)(movie); + return result is this.objcObject ? this : (result !is null ? new NSMovie(result) : null); + } + + this (QTMovie movie) + { + super(NSMovie.alloc.initWithMovie(movie).objcObject); + } + + QTMovie QTMovie_ () + { + return invokeObjcSelf!(QTMovie, "QTMovie"); + } + +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSMovieView.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSMovieView.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,228 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSMovieView; + +import dstep.appkit.NSMovie; +import dstep.appkit.NSUserInterfaceValidation; +import dstep.appkit.NSView; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.internal.Version; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +static if (!D_LP64): + +enum : NSUInteger +{ + NSQTMovieNormalPlayback, + NSQTMovieLoopingPlayback, + NSQTMovieLoopingBackAndForthPlayback +} + +typedef NSUInteger NSQTMovieLoopMode; + +struct _MVFlags +{ + uint editable;// :1; + NSQTMovieLoopMode loopMode; //:3; + uint playsEveryFrame; //:1; + uint playsSelectionOnly; //:1; + uint controllerVisible; //:1; + uint reserved; //:25; +} + +class NSMovieView : NSView, INSUserInterfaceValidations +{ + mixin (ObjcWrap); + + bool validateUserInterfaceItem (INSValidatedUserInterfaceItem anItem) + { + return invokeObjcSelf!(bool, "validateUserInterfaceItem:", INSValidatedUserInterfaceItem)(anItem); + } + + void setMovie (NSMovie movie) + { + return invokeObjcSelf!(void, "setMovie:", NSMovie)(movie); + } + + NSMovie movie () + { + return invokeObjcSelf!(NSMovie, "movie"); + } + + void* movieController () + { + return invokeObjcSelf!(void*, "movieController"); + } + + NSRect movieRect () + { + return invokeObjcSelf!(NSRect, "movieRect"); + } + + void start (Object sender) + { + return invokeObjcSelf!(void, "start:", Object)(sender); + } + + void stop (Object sender) + { + return invokeObjcSelf!(void, "stop:", Object)(sender); + } + + bool isPlaying () + { + return invokeObjcSelf!(bool, "isPlaying"); + } + + void gotoPosterFrame (Object sender) + { + return invokeObjcSelf!(void, "gotoPosterFrame:", Object)(sender); + } + + void gotoBeginning (Object sender) + { + return invokeObjcSelf!(void, "gotoBeginning:", Object)(sender); + } + + void gotoEnd (Object sender) + { + return invokeObjcSelf!(void, "gotoEnd:", Object)(sender); + } + + void stepForward (Object sender) + { + return invokeObjcSelf!(void, "stepForward:", Object)(sender); + } + + void stepBack (Object sender) + { + return invokeObjcSelf!(void, "stepBack:", Object)(sender); + } + + void setRate (float rate) + { + return invokeObjcSelf!(void, "setRate:", float)(rate); + } + + float rate () + { + return invokeObjcSelf!(float, "rate"); + } + + void setVolume (float volume) + { + return invokeObjcSelf!(void, "setVolume:", float)(volume); + } + + float volume () + { + return invokeObjcSelf!(float, "volume"); + } + + void setMuted (bool mute) + { + return invokeObjcSelf!(void, "setMuted:", bool)(mute); + } + + bool isMuted () + { + return invokeObjcSelf!(bool, "isMuted"); + } + + void setLoopMode (NSQTMovieLoopMode mode) + { + return invokeObjcSelf!(void, "setLoopMode:", NSQTMovieLoopMode)(mode); + } + + NSQTMovieLoopMode loopMode () + { + return invokeObjcSelf!(NSQTMovieLoopMode, "loopMode"); + } + + void setPlaysSelectionOnly (bool flag) + { + return invokeObjcSelf!(void, "setPlaysSelectionOnly:", bool)(flag); + } + + bool playsSelectionOnly () + { + return invokeObjcSelf!(bool, "playsSelectionOnly"); + } + + void setPlaysEveryFrame (bool flag) + { + return invokeObjcSelf!(void, "setPlaysEveryFrame:", bool)(flag); + } + + bool playsEveryFrame () + { + return invokeObjcSelf!(bool, "playsEveryFrame"); + } + + void showController (bool show, bool adjustingSize) + { + return invokeObjcSelf!(void, "showController:adjustingSize:", bool, bool)(show, adjustingSize); + } + + bool isControllerVisible () + { + return invokeObjcSelf!(bool, "isControllerVisible"); + } + + void resizeWithMagnification (CGFloat magnification) + { + return invokeObjcSelf!(void, "resizeWithMagnification:", CGFloat)(magnification); + } + + NSSize sizeForMagnification (CGFloat magnification) + { + return invokeObjcSelf!(NSSize, "sizeForMagnification:", CGFloat)(magnification); + } + + void setEditable (bool editable) + { + return invokeObjcSelf!(void, "setEditable:", bool)(editable); + } + + bool isEditable () + { + return invokeObjcSelf!(bool, "isEditable"); + } + + void cut (Object sender) + { + return invokeObjcSelf!(void, "cut:", Object)(sender); + } + + void copy (Object sender) + { + return invokeObjcSelf!(void, "copy:", Object)(sender); + } + + void paste (Object sender) + { + return invokeObjcSelf!(void, "paste:", Object)(sender); + } + + void delete_ (Object sender) + { + return invokeObjcSelf!(void, "delete:", Object)(sender); + } + + void selectAll (Object sender) + { + return invokeObjcSelf!(void, "selectAll:", Object)(sender); + } + + void clear (Object sender) + { + return invokeObjcSelf!(void, "clear:", Object)(sender); + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSNib.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSNib.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,106 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSNib; + +import dstep.appkit.AppKitDefines; +import dstep.foundation.NSArray; +import dstep.foundation.NSBundle; +import dstep.foundation.NSCoder; +import dstep.foundation.NSData; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSURL; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.appkit.NSNib_bindings; + +private +{ + NSString NSNibOwner_; + NSString NSNibTopLevelObjects_; +} + +NSString NSNibOwner () +{ + if (NSNibOwner_) + return NSNibOwner_; + + return NSNibOwner_ = new NSString(bindings.NSNibOwner); +} + +NSString NSNibTopLevelObjects () +{ + if (NSNibTopLevelObjects_) + return NSNibTopLevelObjects_; + + return NSNibTopLevelObjects_ = new NSString(bindings.NSNibTopLevelObjects); +} + +class NSNib : NSObject, INSCoding +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + NSNib initWithContentsOfURL (NSURL nibFileURL) + { + id result = invokeObjcSelf!(id, "initWithContentsOfURL:", NSURL)(nibFileURL); + return result is this.objcObject ? this : (result !is null ? new NSNib(result) : null); + } + + this (NSURL nibFileURL) + { + super(NSNib.alloc.initWithContentsOfURL(nibFileURL).objcObject); + } + + NSNib initWithNibNamed (NSString nibName, NSBundle bundle) + { + id result = invokeObjcSelf!(id, "initWithNibNamed:bundle:", NSString, NSBundle)(nibName, bundle); + return result is this.objcObject ? this : (result !is null ? new NSNib(result) : null); + } + + this (NSString nibName, NSBundle bundle) + { + super(NSNib.alloc.initWithNibNamed(nibName, bundle).objcObject); + } + + bool instantiateNibWithExternalNameTable (NSDictionary externalNameTable) + { + return invokeObjcSelf!(bool, "instantiateNibWithExternalNameTable:", NSDictionary)(externalNameTable); + } + + bool instantiateNibWithOwner (Object owner, ref NSArray topLevelObjects) + { + id objects; + + if (topLevelObjects) + objects = topLevelObjects.objcObject; + + bool result = invokeObjcSelf!(bool, "instantiateNibWithOwner:topLevelObjects:", Object, id*)(owner, &objects); + + if (objects) + topLevelObjects = new NSArray(objects); + + return result; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSNibConnector.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSNibConnector.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,75 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSNibConnector; + +import dstep.foundation.NSCoder; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSNibConnector : NSObject, INSCoding +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + Object source () + { + return invokeObjcSelf!(Object, "source"); + } + + void setSource (Object source) + { + return invokeObjcSelf!(void, "setSource:", Object)(source); + } + + Object destination () + { + return invokeObjcSelf!(Object, "destination"); + } + + void setDestination (Object destination) + { + return invokeObjcSelf!(void, "setDestination:", Object)(destination); + } + + NSString label () + { + return invokeObjcSelf!(NSString, "label"); + } + + void setLabel (NSString label) + { + return invokeObjcSelf!(void, "setLabel:", NSString)(label); + } + + void replaceObject (Object oldObject, Object newObject) + { + return invokeObjcSelf!(void, "replaceObject:withObject:", Object, Object)(oldObject, newObject); + } + + void establishConnection () + { + return invokeObjcSelf!(void, "establishConnection"); + } + +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSNibControlConnector.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSNibControlConnector.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,22 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSNibControlConnector; + +import dstep.appkit.NSNibConnector; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSNibControlConnector : NSNibConnector +{ + mixin (ObjcWrap); + + void establishConnection () + { + return invokeObjcSelf!(void, "establishConnection"); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSNibDeclarations.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSNibDeclarations.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,7 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSNibDeclarations; \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSNibLoading.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSNibLoading.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,48 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSNibLoading; + +import dstep.foundation.NSDictionary; +import dstep.foundation.NSString; +import dstep.foundation.NSBundle; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +const TNSNibLoading = ` + + static bool loadNibFile (NSString fileName, NSDictionary context, NSZone* zone) + { + return invokeObjcSelfClass!(bool, "loadNibFile:externalNameTable:withZone:", NSString, NSDictionary, NSZone*)(fileName, context, zone); + } + + static bool loadNibNamed (NSString nibName, Object owner) + { + return invokeObjcSelfClass!(bool, "loadNibNamed:owner:", NSString, Object)(nibName, owner); + } + + bool loadNibFile (NSString fileName, NSDictionary context, NSZone* zone) + { + return invokeObjcSelf!(bool, "loadNibFile:externalNameTable:withZone:", NSString, NSDictionary, NSZone*)(fileName, context, zone); + } + + //mixin ObjcBindClassMethod!(loadNibFile, "loadNibFile:externalNameTable:withZone:"); + //mixin ObjcBindClassMethod!(loadNibNamed, "loadNibNamed:owner:"); + //mixin ObjcBindMethod!(loadNibFile, "loadNibFile:externalNameTable:withZone:"); + +`; + +const TNSNibAwaking = ` + + void awakeFromNib () + { + return invokeObjcSelf!(void, "awakeFromNib"); + } + + //mixin ObjcBindMethod!(awakeFromNib, "awakeFromNib"); + +`; + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSNibOutletConnector.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSNibOutletConnector.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,22 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSNibOutletConnector; + +import dstep.appkit.NSNibConnector; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSNibOutletConnector : NSNibConnector +{ + mixin (ObjcWrap); + + void establishConnection () + { + return invokeObjcSelf!(void, "establishConnection"); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSNib_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSNib_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,19 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSNib_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package id NSNibOwner; + package id NSNibTopLevelObjects; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSObjectController.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSObjectController.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,257 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSObjectController; + +import dstep.appkit.NSController; +import dstep.appkit.NSMenu; +import dstep.appkit.NSUserInterfaceValidation; +import dstep.coredata.NSFetchRequest; +import dstep.coredata.NSManagedObjectContext; +import dstep.foundation.NSArray; +import dstep.foundation.NSError; +import dstep.foundation.NSPredicate; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +const TNSManagedController = ` + + NSManagedObjectContext managedObjectContext () + { + return invokeObjcSelf!(NSManagedObjectContext, "managedObjectContext"); + } + + void setManagedObjectContext (NSManagedObjectContext managedObjectContext) + { + return invokeObjcSelf!(void, "setManagedObjectContext:", NSManagedObjectContext)(managedObjectContext); + } + + NSString entityName () + { + return invokeObjcSelf!(NSString, "entityName"); + } + + void setEntityName (NSString entityName) + { + return invokeObjcSelf!(void, "setEntityName:", NSString)(entityName); + } + + NSPredicate fetchPredicate () + { + return invokeObjcSelf!(NSPredicate, "fetchPredicate"); + } + + void setFetchPredicate (NSPredicate predicate) + { + return invokeObjcSelf!(void, "setFetchPredicate:", NSPredicate)(predicate); + } + + bool fetchWithRequest (NSFetchRequest fetchRequest, bool merge, NSError** error) + { + return invokeObjcSelf!(bool, "fetchWithRequest:merge:error:", NSFetchRequest, bool, NSError**)(fetchRequest, merge, error); + } + + void fetch (Object sender) + { + return invokeObjcSelf!(void, "fetch:", Object)(sender); + } + + void setUsesLazyFetching (bool enabled) + { + return invokeObjcSelf!(void, "setUsesLazyFetching:", bool)(enabled); + } + + bool usesLazyFetching () + { + return invokeObjcSelf!(bool, "usesLazyFetching"); + } + + NSFetchRequest defaultFetchRequest () + { + return invokeObjcSelf!(NSFetchRequest, "defaultFetchRequest"); + } + + //mixin ObjcBindMethod!(managedObjectContext, "managedObjectContext"); + //mixin ObjcBindMethod!(setManagedObjectContext, "setManagedObjectContext:"); + //mixin ObjcBindMethod!(entityName, "entityName"); + //mixin ObjcBindMethod!(setEntityName, "setEntityName:"); + //mixin ObjcBindMethod!(fetchPredicate, "fetchPredicate"); + //mixin ObjcBindMethod!(setFetchPredicate, "setFetchPredicate:"); + //mixin ObjcBindMethod!(fetchWithRequest, "fetchWithRequest:merge:error:"); + //mixin ObjcBindMethod!(fetch, "fetch:"); + //mixin ObjcBindMethod!(setUsesLazyFetching, "setUsesLazyFetching:"); + //mixin ObjcBindMethod!(usesLazyFetching, "usesLazyFetching"); + //mixin ObjcBindMethod!(defaultFetchRequest, "defaultFetchRequest"); + +`; + +class NSObjectController : NSController +{ + mixin (ObjcWrap); + + NSObjectController initWithContent (Object content) + { + id result = invokeObjcSelf!(id, "initWithContent:", Object)(content); + return result is this.objcObject ? this : (result !is null ? new NSObjectController(result) : null); + } + + this (Object content) + { + super(NSObjectController.alloc.initWithContent(content).objcObject); + } + + void setContent (Object content) + { + return invokeObjcSelf!(void, "setContent:", Object)(content); + } + + Object content () + { + return invokeObjcSelf!(Object, "content"); + } + + Object selection () + { + return invokeObjcSelf!(Object, "selection"); + } + + NSArray selectedObjects () + { + return invokeObjcSelf!(NSArray, "selectedObjects"); + } + + void setAutomaticallyPreparesContent (bool flag) + { + return invokeObjcSelf!(void, "setAutomaticallyPreparesContent:", bool)(flag); + } + + bool automaticallyPreparesContent () + { + return invokeObjcSelf!(bool, "automaticallyPreparesContent"); + } + + void prepareContent () + { + return invokeObjcSelf!(void, "prepareContent"); + } + + void setObjectClass (Class objectClass) + { + return invokeObjcSelf!(void, "setObjectClass:", Class)(objectClass); + } + + Class objectClass () + { + return invokeObjcSelf!(Class, "objectClass"); + } + + Object newObject () + { + return invokeObjcSelf!(Object, "newObject"); + } + + void addObject (Object object) + { + return invokeObjcSelf!(void, "addObject:", Object)(object); + } + + void removeObject (Object object) + { + return invokeObjcSelf!(void, "removeObject:", Object)(object); + } + + void setEditable (bool flag) + { + return invokeObjcSelf!(void, "setEditable:", bool)(flag); + } + + bool isEditable () + { + return invokeObjcSelf!(bool, "isEditable"); + } + + void add (Object sender) + { + return invokeObjcSelf!(void, "add:", Object)(sender); + } + + bool canAdd () + { + return invokeObjcSelf!(bool, "canAdd"); + } + + void remove (Object sender) + { + return invokeObjcSelf!(void, "remove:", Object)(sender); + } + + bool canRemove () + { + return invokeObjcSelf!(bool, "canRemove"); + } + + bool validateUserInterfaceItem (INSValidatedUserInterfaceItem item) + { + return invokeObjcSelf!(bool, "validateUserInterfaceItem:", INSValidatedUserInterfaceItem)(item); + } + + // NSManagedController + NSManagedObjectContext managedObjectContext () + { + return invokeObjcSelf!(NSManagedObjectContext, "managedObjectContext"); + } + + void setManagedObjectContext (NSManagedObjectContext managedObjectContext) + { + return invokeObjcSelf!(void, "setManagedObjectContext:", NSManagedObjectContext)(managedObjectContext); + } + + NSString entityName () + { + return invokeObjcSelf!(NSString, "entityName"); + } + + void setEntityName (NSString entityName) + { + return invokeObjcSelf!(void, "setEntityName:", NSString)(entityName); + } + + NSPredicate fetchPredicate () + { + return invokeObjcSelf!(NSPredicate, "fetchPredicate"); + } + + void setFetchPredicate (NSPredicate predicate) + { + return invokeObjcSelf!(void, "setFetchPredicate:", NSPredicate)(predicate); + } + + bool fetchWithRequest (NSFetchRequest fetchRequest, bool merge, NSError** error) + { + return invokeObjcSelf!(bool, "fetchWithRequest:merge:error:", NSFetchRequest, bool, NSError**)(fetchRequest, merge, error); + } + + void fetch (Object sender) + { + return invokeObjcSelf!(void, "fetch:", Object)(sender); + } + + void setUsesLazyFetching (bool enabled) + { + return invokeObjcSelf!(void, "setUsesLazyFetching:", bool)(enabled); + } + + bool usesLazyFetching () + { + return invokeObjcSelf!(bool, "usesLazyFetching"); + } + + NSFetchRequest defaultFetchRequest () + { + return invokeObjcSelf!(NSFetchRequest, "defaultFetchRequest"); + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSOpenGL.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSOpenGL.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,321 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSOpenGL; + +import dstep.appkit.NSScreen; +import dstep.appkit.NSView; +import dstep.foundation.NSCoder; +import dstep.foundation.NSData; +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.opengl.gl; +import dstep.opengl.CGLTypes; + +typedef uint NSOpenGLPixelFormatAttribute; +alias _CGLPixelFormatObject NSOpenGLPixelFormatAuxiliary; +alias _CGLContextObject NSOpenGLContextAuxiliary; + +enum +{ + NSOpenGLGOFormatCacheSize = 501, + NSOpenGLGOClearFormatCache = 502, + NSOpenGLGORetainRenderers = 503, + NSOpenGLGOResetLibrary = 504 +} + +enum : uint +{ + NSOpenGLPFAAllRenderers = 1, + NSOpenGLPFADoubleBuffer = 5, + NSOpenGLPFAStereo = 6, + NSOpenGLPFAAuxBuffers = 7, + NSOpenGLPFAColorSize = 8, + NSOpenGLPFAAlphaSize = 11, + NSOpenGLPFADepthSize = 12, + NSOpenGLPFAStencilSize = 13, + NSOpenGLPFAAccumSize = 14, + NSOpenGLPFAMinimumPolicy = 51, + NSOpenGLPFAMaximumPolicy = 52, + NSOpenGLPFAOffScreen = 53, + NSOpenGLPFAFullScreen = 54, + NSOpenGLPFASampleBuffers = 55, + NSOpenGLPFASamples = 56, + NSOpenGLPFAAuxDepthStencil = 57, + NSOpenGLPFAColorFloat = 58, + NSOpenGLPFAMultisample = 59, + NSOpenGLPFASupersample = 60, + NSOpenGLPFASampleAlpha = 61, + NSOpenGLPFARendererID = 70, + NSOpenGLPFASingleRenderer = 71, + NSOpenGLPFANoRecovery = 72, + NSOpenGLPFAAccelerated = 73, + NSOpenGLPFAClosestPolicy = 74, + NSOpenGLPFARobust = 75, + NSOpenGLPFABackingStore = 76, + NSOpenGLPFAMPSafe = 78, + NSOpenGLPFAWindow = 80, + NSOpenGLPFAMultiScreen = 81, + NSOpenGLPFACompliant = 83, + NSOpenGLPFAScreenMask = 84, + NSOpenGLPFAPixelBuffer = 90, + NSOpenGLPFAAllowOfflineRenderers = 96, + NSOpenGLPFAVirtualScreenCount = 128 +} + +enum +{ + NSOpenGLCPSwapRectangle = 200, + NSOpenGLCPSwapRectangleEnable = 201, + NSOpenGLCPRasterizationEnable = 221, + NSOpenGLCPSwapInterval = 222, + NSOpenGLCPSurfaceOrder = 235, + NSOpenGLCPSurfaceOpacity = 236, + NSOpenGLCPStateValidation = 301 +} + +class NSOpenGLPixelFormat : NSObject, INSCoding +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + NSOpenGLPixelFormat initWithAttributes (NSOpenGLPixelFormatAttribute* attribs) + { + id result = invokeObjcSelf!(id, "initWithAttributes:", NSOpenGLPixelFormatAttribute*)(attribs); + return result is this.objcObject ? this : (result !is null ? new NSOpenGLPixelFormat(result) : null); + } + + this (NSOpenGLPixelFormatAttribute* attribs) + { + super(NSOpenGLPixelFormat.alloc.initWithAttributes(attribs).objcObject); + } + + NSOpenGLPixelFormat initWithData (NSData attribs) + { + id result = invokeObjcSelf!(id, "initWithData:", NSData)(attribs); + return result is this.objcObject ? this : (result !is null ? new NSOpenGLPixelFormat(result) : null); + } + + this (NSData attribs) + { + super(NSOpenGLPixelFormat.alloc.initWithData(attribs).objcObject); + } + + NSData attributes () + { + return invokeObjcSelf!(NSData, "attributes"); + } + + void setAttributes (NSData attribs) + { + return invokeObjcSelf!(void, "setAttributes:", NSData)(attribs); + } + + void getValues (ref GLint vals, uint attrib, int screen) + { + return invokeObjcSelf!(void, "getValues:forAttribute:forVirtualScreen:", GLint*, uint, int)(&vals, attrib, screen); + } + + int numberOfVirtualScreens () + { + return invokeObjcSelf!(int, "numberOfVirtualScreens"); + } + + void* CGLPixelFormatObj () + { + return invokeObjcSelf!(void*, "CGLPixelFormatObj"); + } + +} + +class NSOpenGLContext : NSObject +{ + mixin (ObjcWrap); + + NSOpenGLContext initWithFormat (NSOpenGLPixelFormat format, NSOpenGLContext share) + { + id result = invokeObjcSelf!(id, "initWithFormat:shareContext:", NSOpenGLPixelFormat, NSOpenGLContext)(format, share); + return result is this.objcObject ? this : (result !is null ? new NSOpenGLContext(result) : null); + } + + this (NSOpenGLPixelFormat format, NSOpenGLContext share) + { + super(NSOpenGLContext.alloc.initWithFormat(format, share).objcObject); + } + + void setView (NSView view) + { + return invokeObjcSelf!(void, "setView:", NSView)(view); + } + + NSView view () + { + return invokeObjcSelf!(NSView, "view"); + } + + void setFullScreen () + { + return invokeObjcSelf!(void, "setFullScreen"); + } + + void setOffScreen (void* baseaddr, int width, int height, int rowbytes) + { + return invokeObjcSelf!(void, "setOffScreen:width:height:rowbytes:", void*, int, int, int)(baseaddr, width, height, rowbytes); + } + + void clearDrawable () + { + return invokeObjcSelf!(void, "clearDrawable"); + } + + void update () + { + return invokeObjcSelf!(void, "update"); + } + + void flushBuffer () + { + return invokeObjcSelf!(void, "flushBuffer"); + } + + void makeCurrentContext () + { + return invokeObjcSelf!(void, "makeCurrentContext"); + } + + static void clearCurrentContext () + { + return invokeObjcSelfClass!(void, "clearCurrentContext"); + } + + static NSOpenGLContext currentContext () + { + return invokeObjcSelfClass!(NSOpenGLContext, "currentContext"); + } + + void copyAttributesFromContext (NSOpenGLContext context, uint mask) + { + return invokeObjcSelf!(void, "copyAttributesFromContext:withMask:", NSOpenGLContext, uint)(context, mask); + } + + void setValues (GLint* vals, int param) + { + return invokeObjcSelf!(void, "setValues:forParameter:", GLint*, int)(vals, param); + } + + void getValues (GLint* vals, int param) + { + return invokeObjcSelf!(void, "getValues:forParameter:", GLint*, int)(vals, param); + } + + void setCurrentVirtualScreen (int screen) + { + return invokeObjcSelf!(void, "setCurrentVirtualScreen:", int)(screen); + } + + int currentVirtualScreen () + { + return invokeObjcSelf!(int, "currentVirtualScreen"); + } + + void createTexture (uint target, NSView view, uint format) + { + return invokeObjcSelf!(void, "createTexture:fromView:internalFormat:", uint, NSView, uint)(target, view, format); + } + + void* CGLContextObj () + { + return invokeObjcSelf!(void*, "CGLContextObj"); + } + + void setPixelBuffer (NSOpenGLPixelBuffer pixelBuffer, uint face, int level, int screen) + { + return invokeObjcSelf!(void, "setPixelBuffer:cubeMapFace:mipMapLevel:currentVirtualScreen:", NSOpenGLPixelBuffer, uint, int, int)(pixelBuffer, face, level, screen); + } + + NSOpenGLPixelBuffer pixelBuffer () + { + return invokeObjcSelf!(NSOpenGLPixelBuffer, "pixelBuffer"); + } + + uint pixelBufferCubeMapFace () + { + return invokeObjcSelf!(uint, "pixelBufferCubeMapFace"); + } + + int pixelBufferMipMapLevel () + { + return invokeObjcSelf!(int, "pixelBufferMipMapLevel"); + } + + void setTextureImageToPixelBuffer (NSOpenGLPixelBuffer pixelBuffer, uint source) + { + return invokeObjcSelf!(void, "setTextureImageToPixelBuffer:colorBuffer:", NSOpenGLPixelBuffer, uint)(pixelBuffer, source); + } +} + +class NSOpenGLPixelBuffer : NSObject +{ + mixin (ObjcWrap); + + NSOpenGLPixelBuffer initWithTextureTarget (uint target, uint format, int maxLevel, int pixelsWide, int pixelsHigh) + { + id result = invokeObjcSelf!(id, "initWithTextureTarget:textureInternalFormat:textureMaxMipMapLevel:pixelsWide:pixelsHigh:", uint, uint, int, int, int)(target, format, maxLevel, pixelsWide, pixelsHigh); + return result is this.objcObject ? this : (result !is null ? new NSOpenGLPixelBuffer(result) : null); + } + + this (uint target, uint format, int maxLevel, int pixelsWide, int pixelsHigh) + { + super(NSOpenGLPixelBuffer.alloc.initWithTextureTarget(target, format, maxLevel, pixelsWide, pixelsHigh).objcObject); + } + + int pixelsWide () + { + return invokeObjcSelf!(int, "pixelsWide"); + } + + int pixelsHigh () + { + return invokeObjcSelf!(int, "pixelsHigh"); + } + + uint textureTarget () + { + return invokeObjcSelf!(uint, "textureTarget"); + } + + uint textureInternalFormat () + { + return invokeObjcSelf!(uint, "textureInternalFormat"); + } + + int textureMaxMipMapLevel () + { + return invokeObjcSelf!(int, "textureMaxMipMapLevel"); + } +} + +extern (C) +{ + void NSOpenGLSetOption (int pname, int param); + void NSOpenGLGetOption (int pname, GLint* param); + void NSOpenGLGetVersion (GLint* major, GLint* minor); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSOpenGLView.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSOpenGLView.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,75 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSOpenGLView; + +import dstep.appkit.NSOpenGL; +import dstep.appkit.NSView; +import dstep.foundation.NSGeometry; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSOpenGLView : NSView +{ + mixin (ObjcWrap); + + static NSOpenGLPixelFormat defaultPixelFormat () + { + return invokeObjcSelfClass!(NSOpenGLPixelFormat, "defaultPixelFormat"); + } + + NSOpenGLView initWithFrame (NSRect frameRect, NSOpenGLPixelFormat format) + { + id result = invokeObjcSelf!(id, "initWithFrame:pixelFormat:", NSRect, NSOpenGLPixelFormat)(frameRect, format); + return result is this.objcObject ? this : (result !is null ? new NSOpenGLView(result) : null); + } + + this (NSRect frameRect, NSOpenGLPixelFormat format) + { + super(NSOpenGLView.alloc.initWithFrame(frameRect, format).objcObject); + } + + void setOpenGLContext (NSOpenGLContext context) + { + return invokeObjcSelf!(void, "setOpenGLContext:", NSOpenGLContext)(context); + } + + NSOpenGLContext openGLContext () + { + return invokeObjcSelf!(NSOpenGLContext, "openGLContext"); + } + + void clearGLContext () + { + return invokeObjcSelf!(void, "clearGLContext"); + } + + void update () + { + return invokeObjcSelf!(void, "update"); + } + + void reshape () + { + return invokeObjcSelf!(void, "reshape"); + } + + void setPixelFormat (NSOpenGLPixelFormat pixelFormat) + { + return invokeObjcSelf!(void, "setPixelFormat:", NSOpenGLPixelFormat)(pixelFormat); + } + + NSOpenGLPixelFormat pixelFormat () + { + return invokeObjcSelf!(NSOpenGLPixelFormat, "pixelFormat"); + } + + void prepareOpenGL () + { + return invokeObjcSelf!(void, "prepareOpenGL"); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSOpenPanel.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSOpenPanel.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,125 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSOpenPanel; + +import dstep.appkit.NSSavePanel; +import dstep.foundation.NSArray; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSString; +import dstep.appkit.NSWindow; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +const TNSOpenPanelRuntime = ` + + void beginSheetForDirectory (NSString path, NSString name, NSArray fileTypes, NSWindow docWindow, Object delegate_, SEL didEndSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "beginSheetForDirectory:file:types:modalForWindow:modalDelegate:didEndSelector:contextInfo:", NSString, NSString, NSArray, NSWindow, Object, SEL, void*)(path, name, fileTypes, docWindow, delegate_, didEndSelector, contextInfo); + } + + void beginForDirectory (NSString path, NSString name, NSArray fileTypes, Object delegate_, SEL didEndSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "beginForDirectory:file:types:modelessDelegate:didEndSelector:contextInfo:", NSString, NSString, NSArray, Object, SEL, void*)(path, name, fileTypes, delegate_, didEndSelector, contextInfo); + } + + NSInteger runModalForDirectory (NSString path, NSString name, NSArray fileTypes) + { + return invokeObjcSelf!(NSInteger, "runModalForDirectory:file:types:", NSString, NSString, NSArray)(path, name, fileTypes); + } + + NSInteger runModalForTypes (NSArray fileTypes) + { + return invokeObjcSelf!(NSInteger, "runModalForTypes:", NSArray)(fileTypes); + } + + //mixin ObjcBindMethod!(beginSheetForDirectory, "beginSheetForDirectory:file:types:modalForWindow:modalDelegate:didEndSelector:contextInfo:"); + //mixin ObjcBindMethod!(beginForDirectory, "beginForDirectory:file:types:modelessDelegate:didEndSelector:contextInfo:"); + //mixin ObjcBindMethod!(runModalForDirectory, "runModalForDirectory:file:types:"); + //mixin ObjcBindMethod!(runModalForTypes, "runModalForTypes:"); + +`; + +class NSOpenPanel : NSSavePanel +{ + mixin (ObjcWrap); + + static NSOpenPanel openPanel () + { + return invokeObjcSelfClass!(NSOpenPanel, "openPanel"); + } + + NSArray URLs () + { + return invokeObjcSelf!(NSArray, "URLs"); + } + + NSArray filenames () + { + return invokeObjcSelf!(NSArray, "filenames"); + } + + bool resolvesAliases () + { + return invokeObjcSelf!(bool, "resolvesAliases"); + } + + void setResolvesAliases (bool flag) + { + return invokeObjcSelf!(void, "setResolvesAliases:", bool)(flag); + } + + bool canChooseDirectories () + { + return invokeObjcSelf!(bool, "canChooseDirectories"); + } + + void setCanChooseDirectories (bool flag) + { + return invokeObjcSelf!(void, "setCanChooseDirectories:", bool)(flag); + } + + bool allowsMultipleSelection () + { + return invokeObjcSelf!(bool, "allowsMultipleSelection"); + } + + void setAllowsMultipleSelection (bool flag) + { + return invokeObjcSelf!(void, "setAllowsMultipleSelection:", bool)(flag); + } + + bool canChooseFiles () + { + return invokeObjcSelf!(bool, "canChooseFiles"); + } + + void setCanChooseFiles (bool flag) + { + return invokeObjcSelf!(void, "setCanChooseFiles:", bool)(flag); + } + + // NSOpenPanelRuntime + void beginSheetForDirectory (NSString path, NSString name, NSArray fileTypes, NSWindow docWindow, Object delegate_, SEL didEndSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "beginSheetForDirectory:file:types:modalForWindow:modalDelegate:didEndSelector:contextInfo:", NSString, NSString, NSArray, NSWindow, Object, SEL, void*)(path, name, fileTypes, docWindow, delegate_, didEndSelector, contextInfo); + } + + void beginForDirectory (NSString path, NSString name, NSArray fileTypes, Object delegate_, SEL didEndSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "beginForDirectory:file:types:modelessDelegate:didEndSelector:contextInfo:", NSString, NSString, NSArray, Object, SEL, void*)(path, name, fileTypes, delegate_, didEndSelector, contextInfo); + } + + NSInteger runModalForDirectory (NSString path, NSString name, NSArray fileTypes) + { + return invokeObjcSelf!(NSInteger, "runModalForDirectory:file:types:", NSString, NSString, NSArray)(path, name, fileTypes); + } + + NSInteger runModalForTypes (NSArray fileTypes) + { + return invokeObjcSelf!(NSInteger, "runModalForTypes:", NSArray)(fileTypes); + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSOutlineView.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSOutlineView.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,525 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSOutlineView; + +import dstep.appkit.AppKitDefines; +import dstep.appkit.NSButtonCell; +import dstep.appkit.NSTableColumn; +import dstep.appkit.NSTableHeaderView; +import dstep.appkit.NSTableView; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.corefoundation.CFDictionary; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.appkit.NSOutlineView_bindings; + +private +{ + NSString NSOutlineViewSelectionDidChangeNotification_; + NSString NSOutlineViewColumnDidMoveNotification_; + NSString NSOutlineViewColumnDidResizeNotification_; + NSString NSOutlineViewSelectionIsChangingNotification_; + NSString NSOutlineViewItemWillExpandNotification_; + NSString NSOutlineViewItemDidExpandNotification_; + NSString NSOutlineViewItemWillCollapseNotification_; + NSString NSOutlineViewItemDidCollapseNotification_; +} + +NSString NSOutlineViewSelectionDidChangeNotification () +{ + if (NSOutlineViewSelectionDidChangeNotification_) + return NSOutlineViewSelectionDidChangeNotification_; + + return NSOutlineViewSelectionDidChangeNotification_ = new NSString(bindings.NSOutlineViewSelectionDidChangeNotification); +} + +NSString NSOutlineViewColumnDidMoveNotification () +{ + if (NSOutlineViewColumnDidMoveNotification_) + return NSOutlineViewColumnDidMoveNotification_; + + return NSOutlineViewColumnDidMoveNotification_ = new NSString(bindings.NSOutlineViewColumnDidMoveNotification); +} + +NSString NSOutlineViewColumnDidResizeNotification () +{ + if (NSOutlineViewColumnDidResizeNotification_) + return NSOutlineViewColumnDidResizeNotification_; + + return NSOutlineViewColumnDidResizeNotification_ = new NSString(bindings.NSOutlineViewColumnDidResizeNotification); +} + +NSString NSOutlineViewSelectionIsChangingNotification () +{ + if (NSOutlineViewSelectionIsChangingNotification_) + return NSOutlineViewSelectionIsChangingNotification_; + + return NSOutlineViewSelectionIsChangingNotification_ = new NSString(bindings.NSOutlineViewSelectionIsChangingNotification); +} + +NSString NSOutlineViewItemWillExpandNotification () +{ + if (NSOutlineViewItemWillExpandNotification_) + return NSOutlineViewItemWillExpandNotification_; + + return NSOutlineViewItemWillExpandNotification_ = new NSString(bindings.NSOutlineViewItemWillExpandNotification); +} + +NSString NSOutlineViewItemDidExpandNotification () +{ + if (NSOutlineViewItemDidExpandNotification_) + return NSOutlineViewItemDidExpandNotification_; + + return NSOutlineViewItemDidExpandNotification_ = new NSString(bindings.NSOutlineViewItemDidExpandNotification); +} + +NSString NSOutlineViewItemWillCollapseNotification () +{ + if (NSOutlineViewItemWillCollapseNotification_) + return NSOutlineViewItemWillCollapseNotification_; + + return NSOutlineViewItemWillCollapseNotification_ = new NSString(bindings.NSOutlineViewItemWillCollapseNotification); +} + +NSString NSOutlineViewItemDidCollapseNotification () +{ + if (NSOutlineViewItemDidCollapseNotification_) + return NSOutlineViewItemDidCollapseNotification_; + + return NSOutlineViewItemDidCollapseNotification_ = new NSString(bindings.NSOutlineViewItemDidCollapseNotification); +} + +enum +{ + NSOutlineViewDropOnItemIndex = -1 +} + +struct _OVFlags +{ + uint _reserved; + uint reloadingData; + uint validDataSourceMethods; + uint numberOfRowsDataExpandEntered; + uint delayRowEntryFreeDisabled; + uint delegateHeightOfRowByItem; + uint compatCollapseForceClearsExpandState; + uint autoExpandFlashState; + uint selectionAdjustmentDisabled; + uint removeChildInProgress; + uint delegateWillDisplayOutlineCell; + uint enableExpandNotifications; + uint autoSaveExpandItems; + uint autoresizesOutlineColumn; + uint delegateShouldExpandItem; + uint delegateShouldCollapseItem; + uint delegateSelectionShouldChangeInOutlineView; + uint delegateShouldSelectTableColumn; + uint delegateShouldSelectItem; + uint delegateShouldEditTableColumn; + uint delegateWillDisplayCell; +} + +class NSOutlineView : NSTableView +{ + mixin (ObjcWrap); + + void setOutlineTableColumn (NSTableColumn outlineTableColumn) + { + return invokeObjcSelf!(void, "setOutlineTableColumn:", NSTableColumn)(outlineTableColumn); + } + + NSTableColumn outlineTableColumn () + { + return invokeObjcSelf!(NSTableColumn, "outlineTableColumn"); + } + + bool isExpandable (Object item) + { + return invokeObjcSelf!(bool, "isExpandable:", Object)(item); + } + + void expandItem (Object item, bool expandChildren) + { + return invokeObjcSelf!(void, "expandItem:expandChildren:", Object, bool)(item, expandChildren); + } + + void expandItem (Object item) + { + return invokeObjcSelf!(void, "expandItem:", Object)(item); + } + + void collapseItem (Object item, bool collapseChildren) + { + return invokeObjcSelf!(void, "collapseItem:collapseChildren:", Object, bool)(item, collapseChildren); + } + + void collapseItem (Object item) + { + return invokeObjcSelf!(void, "collapseItem:", Object)(item); + } + + void reloadItem (Object item, bool reloadChildren) + { + return invokeObjcSelf!(void, "reloadItem:reloadChildren:", Object, bool)(item, reloadChildren); + } + + void reloadItem (Object item) + { + return invokeObjcSelf!(void, "reloadItem:", Object)(item); + } + + Object parentForItem (Object item) + { + return invokeObjcSelf!(Object, "parentForItem:", Object)(item); + } + + Object itemAtRow (NSInteger row) + { + return invokeObjcSelf!(Object, "itemAtRow:", NSInteger)(row); + } + + NSInteger rowForItem (Object item) + { + return invokeObjcSelf!(NSInteger, "rowForItem:", Object)(item); + } + + NSInteger levelForItem (Object item) + { + return invokeObjcSelf!(NSInteger, "levelForItem:", Object)(item); + } + + NSInteger levelForRow (NSInteger row) + { + return invokeObjcSelf!(NSInteger, "levelForRow:", NSInteger)(row); + } + + bool isItemExpanded (Object item) + { + return invokeObjcSelf!(bool, "isItemExpanded:", Object)(item); + } + + void setIndentationPerLevel (CGFloat indentationPerLevel) + { + return invokeObjcSelf!(void, "setIndentationPerLevel:", CGFloat)(indentationPerLevel); + } + + CGFloat indentationPerLevel () + { + return invokeObjcSelf!(CGFloat, "indentationPerLevel"); + } + + void setIndentationMarkerFollowsCell (bool drawInCell) + { + return invokeObjcSelf!(void, "setIndentationMarkerFollowsCell:", bool)(drawInCell); + } + + bool indentationMarkerFollowsCell () + { + return invokeObjcSelf!(bool, "indentationMarkerFollowsCell"); + } + + void setAutoresizesOutlineColumn (bool resize) + { + return invokeObjcSelf!(void, "setAutoresizesOutlineColumn:", bool)(resize); + } + + bool autoresizesOutlineColumn () + { + return invokeObjcSelf!(bool, "autoresizesOutlineColumn"); + } + + NSRect frameOfOutlineCellAtRow (NSInteger row) + { + return invokeObjcSelf!(NSRect, "frameOfOutlineCellAtRow:", NSInteger)(row); + } + + void setDropItem (Object item, NSInteger index) + { + return invokeObjcSelf!(void, "setDropItem:dropChildIndex:", Object, NSInteger)(item, index); + } + + bool shouldCollapseAutoExpandedItemsForDeposited (bool deposited) + { + return invokeObjcSelf!(bool, "shouldCollapseAutoExpandedItemsForDeposited:", bool)(deposited); + } + + bool autosaveExpandedItems () + { + return invokeObjcSelf!(bool, "autosaveExpandedItems"); + } + + void setAutosaveExpandedItems (bool save) + { + return invokeObjcSelf!(void, "setAutosaveExpandedItems:", bool)(save); + } +} + +const TNSOutlineViewDataSource = ` + + Object outlineView (NSOutlineView outlineView, NSInteger index, Object item) + { + return invokeObjcSelf!(Object, "outlineView:child:ofItem:", NSOutlineView, NSInteger, Object)(outlineView, index, item); + } + + bool outlineView (NSOutlineView outlineView, Object item) + { + return invokeObjcSelf!(bool, "outlineView:isItemExpandable:", NSOutlineView, Object)(outlineView, item); + } + + NSInteger outlineView (NSOutlineView outlineView, Object item) + { + return invokeObjcSelf!(NSInteger, "outlineView:numberOfChildrenOfItem:", NSOutlineView, Object)(outlineView, item); + } + + Object outlineView (NSOutlineView outlineView, NSTableColumn tableColumn, Object item) + { + return invokeObjcSelf!(Object, "outlineView:objectValueForTableColumn:byItem:", NSOutlineView, NSTableColumn, Object)(outlineView, tableColumn, item); + } + + void outlineView (NSOutlineView outlineView, Object object, NSTableColumn tableColumn, Object item) + { + return invokeObjcSelf!(void, "outlineView:setObjectValue:forTableColumn:byItem:", NSOutlineView, Object, NSTableColumn, Object)(outlineView, object, tableColumn, item); + } + + Object outlineView (NSOutlineView outlineView, Object object) + { + return invokeObjcSelf!(Object, "outlineView:itemForPersistentObject:", NSOutlineView, Object)(outlineView, object); + } + + Object outlineView (NSOutlineView outlineView, Object item) + { + return invokeObjcSelf!(Object, "outlineView:persistentObjectForItem:", NSOutlineView, Object)(outlineView, item); + } + + void outlineView (NSOutlineView outlineView, NSArray oldDescriptors) + { + return invokeObjcSelf!(void, "outlineView:sortDescriptorsDidChange:", NSOutlineView, NSArray)(outlineView, oldDescriptors); + } + + bool outlineView (NSOutlineView outlineView, NSArray items, NSPasteboard pasteboard) + { + return invokeObjcSelf!(bool, "outlineView:writeItems:toPasteboard:", NSOutlineView, NSArray, NSPasteboard)(outlineView, items, pasteboard); + } + + uint outlineView (NSOutlineView outlineView, INSDraggingInfo info, Object item, NSInteger index) + { + return invokeObjcSelf!(uint, "outlineView:validateDrop:proposedItem:proposedChildIndex:", NSOutlineView, INSDraggingInfo, Object, NSInteger)(outlineView, info, item, index); + } + + bool outlineView (NSOutlineView outlineView, INSDraggingInfo info, Object item, NSInteger index) + { + return invokeObjcSelf!(bool, "outlineView:acceptDrop:item:childIndex:", NSOutlineView, INSDraggingInfo, Object, NSInteger)(outlineView, info, item, index); + } + + NSArray outlineView (NSOutlineView outlineView, NSURL dropDestination, NSArray items) + { + return invokeObjcSelf!(NSArray, "outlineView:namesOfPromisedFilesDroppedAtDestination:forDraggedItems:", NSOutlineView, NSURL, NSArray)(outlineView, dropDestination, items); + } + + //mixin ObjcBindMethod!(outlineView, "outlineView:child:ofItem:"); + //mixin ObjcBindMethod!(outlineView, "outlineView:isItemExpandable:"); + //mixin ObjcBindMethod!(outlineView, "outlineView:numberOfChildrenOfItem:"); + //mixin ObjcBindMethod!(outlineView, "outlineView:objectValueForTableColumn:byItem:"); + //mixin ObjcBindMethod!(outlineView, "outlineView:setObjectValue:forTableColumn:byItem:"); + //mixin ObjcBindMethod!(outlineView, "outlineView:itemForPersistentObject:"); + //mixin ObjcBindMethod!(outlineView, "outlineView:persistentObjectForItem:"); + //mixin ObjcBindMethod!(outlineView, "outlineView:sortDescriptorsDidChange:"); + //mixin ObjcBindMethod!(outlineView, "outlineView:writeItems:toPasteboard:"); + //mixin ObjcBindMethod!(outlineView, "outlineView:validateDrop:proposedItem:proposedChildIndex:"); + //mixin ObjcBindMethod!(outlineView, "outlineView:acceptDrop:item:childIndex:"); + //mixin ObjcBindMethod!(outlineView, "outlineView:namesOfPromisedFilesDroppedAtDestination:forDraggedItems:"); + +`; + +const TNSOutlineViewNotifications = ` + + void outlineViewSelectionDidChange (NSNotification notification) + { + return invokeObjcSelf!(void, "outlineViewSelectionDidChange:", NSNotification)(notification); + } + + void outlineViewColumnDidMove (NSNotification notification) + { + return invokeObjcSelf!(void, "outlineViewColumnDidMove:", NSNotification)(notification); + } + + void outlineViewColumnDidResize (NSNotification notification) + { + return invokeObjcSelf!(void, "outlineViewColumnDidResize:", NSNotification)(notification); + } + + void outlineViewSelectionIsChanging (NSNotification notification) + { + return invokeObjcSelf!(void, "outlineViewSelectionIsChanging:", NSNotification)(notification); + } + + void outlineViewItemWillExpand (NSNotification notification) + { + return invokeObjcSelf!(void, "outlineViewItemWillExpand:", NSNotification)(notification); + } + + void outlineViewItemDidExpand (NSNotification notification) + { + return invokeObjcSelf!(void, "outlineViewItemDidExpand:", NSNotification)(notification); + } + + void outlineViewItemWillCollapse (NSNotification notification) + { + return invokeObjcSelf!(void, "outlineViewItemWillCollapse:", NSNotification)(notification); + } + + void outlineViewItemDidCollapse (NSNotification notification) + { + return invokeObjcSelf!(void, "outlineViewItemDidCollapse:", NSNotification)(notification); + } + + //mixin ObjcBindMethod!(outlineViewSelectionDidChange, "outlineViewSelectionDidChange:"); + //mixin ObjcBindMethod!(outlineViewColumnDidMove, "outlineViewColumnDidMove:"); + //mixin ObjcBindMethod!(outlineViewColumnDidResize, "outlineViewColumnDidResize:"); + //mixin ObjcBindMethod!(outlineViewSelectionIsChanging, "outlineViewSelectionIsChanging:"); + //mixin ObjcBindMethod!(outlineViewItemWillExpand, "outlineViewItemWillExpand:"); + //mixin ObjcBindMethod!(outlineViewItemDidExpand, "outlineViewItemDidExpand:"); + //mixin ObjcBindMethod!(outlineViewItemWillCollapse, "outlineViewItemWillCollapse:"); + //mixin ObjcBindMethod!(outlineViewItemDidCollapse, "outlineViewItemDidCollapse:"); + +`; + +const TNSOutlineViewDelegate = ` + + void outlineView (NSOutlineView outlineView, Object cell, NSTableColumn tableColumn, Object item) + { + return invokeObjcSelf!(void, "outlineView:willDisplayCell:forTableColumn:item:", NSOutlineView, Object, NSTableColumn, Object)(outlineView, cell, tableColumn, item); + } + + bool outlineView (NSOutlineView outlineView, NSTableColumn tableColumn, Object item) + { + return invokeObjcSelf!(bool, "outlineView:shouldEditTableColumn:item:", NSOutlineView, NSTableColumn, Object)(outlineView, tableColumn, item); + } + + bool selectionShouldChangeInOutlineView (NSOutlineView outlineView) + { + return invokeObjcSelf!(bool, "selectionShouldChangeInOutlineView:", NSOutlineView)(outlineView); + } + + bool outlineView (NSOutlineView outlineView, Object item) + { + return invokeObjcSelf!(bool, "outlineView:shouldSelectItem:", NSOutlineView, Object)(outlineView, item); + } + + NSIndexSet outlineView (NSOutlineView outlineView, NSIndexSet proposedSelectionIndexes) + { + return invokeObjcSelf!(NSIndexSet, "outlineView:selectionIndexesForProposedSelection:", NSOutlineView, NSIndexSet)(outlineView, proposedSelectionIndexes); + } + + bool outlineView (NSOutlineView outlineView, NSTableColumn tableColumn) + { + return invokeObjcSelf!(bool, "outlineView:shouldSelectTableColumn:", NSOutlineView, NSTableColumn)(outlineView, tableColumn); + } + + void outlineView (NSOutlineView outlineView, NSTableColumn tableColumn) + { + return invokeObjcSelf!(void, "outlineView:mouseDownInHeaderOfTableColumn:", NSOutlineView, NSTableColumn)(outlineView, tableColumn); + } + + void outlineView (NSOutlineView outlineView, NSTableColumn tableColumn) + { + return invokeObjcSelf!(void, "outlineView:didClickTableColumn:", NSOutlineView, NSTableColumn)(outlineView, tableColumn); + } + + void outlineView (NSOutlineView outlineView, NSTableColumn tableColumn) + { + return invokeObjcSelf!(void, "outlineView:didDragTableColumn:", NSOutlineView, NSTableColumn)(outlineView, tableColumn); + } + + NSString outlineView (NSOutlineView outlineView, NSCell cell, NSRectPointer rect, NSTableColumn tableColumn, Object item, NSPoint mouseLocation) + { + return invokeObjcSelf!(NSString, "outlineView:toolTipForCell:rect:tableColumn:item:mouseLocation:", NSOutlineView, NSCell, NSRectPointer, NSTableColumn, Object, NSPoint)(outlineView, cell, rect, tableColumn, item, mouseLocation); + } + + CGFloat outlineView (NSOutlineView outlineView, Object item) + { + return invokeObjcSelf!(CGFloat, "outlineView:heightOfRowByItem:", NSOutlineView, Object)(outlineView, item); + } + + NSString outlineView (NSOutlineView outlineView, NSTableColumn tableColumn, Object item) + { + return invokeObjcSelf!(NSString, "outlineView:typeSelectStringForTableColumn:item:", NSOutlineView, NSTableColumn, Object)(outlineView, tableColumn, item); + } + + Object outlineView (NSOutlineView outlineView, Object startItem, Object endItem, NSString searchString) + { + return invokeObjcSelf!(Object, "outlineView:nextTypeSelectMatchFromItem:toItem:forString:", NSOutlineView, Object, Object, NSString)(outlineView, startItem, endItem, searchString); + } + + bool outlineView (NSOutlineView outlineView, NSEvent event, NSString searchString) + { + return invokeObjcSelf!(bool, "outlineView:shouldTypeSelectForEvent:withCurrentSearchString:", NSOutlineView, NSEvent, NSString)(outlineView, event, searchString); + } + + bool outlineView (NSOutlineView outlineView, NSTableColumn tableColumn, Object item) + { + return invokeObjcSelf!(bool, "outlineView:shouldShowCellExpansionForTableColumn:item:", NSOutlineView, NSTableColumn, Object)(outlineView, tableColumn, item); + } + + bool outlineView (NSOutlineView outlineView, NSCell cell, NSTableColumn tableColumn, Object item) + { + return invokeObjcSelf!(bool, "outlineView:shouldTrackCell:forTableColumn:item:", NSOutlineView, NSCell, NSTableColumn, Object)(outlineView, cell, tableColumn, item); + } + + NSCell outlineView (NSOutlineView outlineView, NSTableColumn tableColumn, Object item) + { + return invokeObjcSelf!(NSCell, "outlineView:dataCellForTableColumn:item:", NSOutlineView, NSTableColumn, Object)(outlineView, tableColumn, item); + } + + bool outlineView (NSOutlineView outlineView, Object item) + { + return invokeObjcSelf!(bool, "outlineView:isGroupItem:", NSOutlineView, Object)(outlineView, item); + } + + bool outlineView (NSOutlineView outlineView, Object item) + { + return invokeObjcSelf!(bool, "outlineView:shouldExpandItem:", NSOutlineView, Object)(outlineView, item); + } + + bool outlineView (NSOutlineView outlineView, Object item) + { + return invokeObjcSelf!(bool, "outlineView:shouldCollapseItem:", NSOutlineView, Object)(outlineView, item); + } + + void outlineView (NSOutlineView outlineView, Object cell, NSTableColumn tableColumn, Object item) + { + return invokeObjcSelf!(void, "outlineView:willDisplayOutlineCell:forTableColumn:item:", NSOutlineView, Object, NSTableColumn, Object)(outlineView, cell, tableColumn, item); + } + + //mixin ObjcBindMethod!(outlineView, "outlineView:willDisplayCell:forTableColumn:item:"); + //mixin ObjcBindMethod!(outlineView, "outlineView:shouldEditTableColumn:item:"); + //mixin ObjcBindMethod!(selectionShouldChangeInOutlineView, "selectionShouldChangeInOutlineView:"); + //mixin ObjcBindMethod!(outlineView, "outlineView:shouldSelectItem:"); + //mixin ObjcBindMethod!(outlineView, "outlineView:selectionIndexesForProposedSelection:"); + //mixin ObjcBindMethod!(outlineView, "outlineView:shouldSelectTableColumn:"); + //mixin ObjcBindMethod!(outlineView, "outlineView:mouseDownInHeaderOfTableColumn:"); + //mixin ObjcBindMethod!(outlineView, "outlineView:didClickTableColumn:"); + //mixin ObjcBindMethod!(outlineView, "outlineView:didDragTableColumn:"); + //mixin ObjcBindMethod!(outlineView, "outlineView:toolTipForCell:rect:tableColumn:item:mouseLocation:"); + //mixin ObjcBindMethod!(outlineView, "outlineView:heightOfRowByItem:"); + //mixin ObjcBindMethod!(outlineView, "outlineView:typeSelectStringForTableColumn:item:"); + //mixin ObjcBindMethod!(outlineView, "outlineView:nextTypeSelectMatchFromItem:toItem:forString:"); + //mixin ObjcBindMethod!(outlineView, "outlineView:shouldTypeSelectForEvent:withCurrentSearchString:"); + //mixin ObjcBindMethod!(outlineView, "outlineView:shouldShowCellExpansionForTableColumn:item:"); + //mixin ObjcBindMethod!(outlineView, "outlineView:shouldTrackCell:forTableColumn:item:"); + //mixin ObjcBindMethod!(outlineView, "outlineView:dataCellForTableColumn:item:"); + //mixin ObjcBindMethod!(outlineView, "outlineView:isGroupItem:"); + //mixin ObjcBindMethod!(outlineView, "outlineView:shouldExpandItem:"); + //mixin ObjcBindMethod!(outlineView, "outlineView:shouldCollapseItem:"); + //mixin ObjcBindMethod!(outlineView, "outlineView:willDisplayOutlineCell:forTableColumn:item:"); + +`; + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSOutlineView_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSOutlineView_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,25 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSOutlineView_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package id NSOutlineViewSelectionDidChangeNotification; + package id NSOutlineViewColumnDidMoveNotification; + package id NSOutlineViewColumnDidResizeNotification; + package id NSOutlineViewSelectionIsChangingNotification; + package id NSOutlineViewItemWillExpandNotification; + package id NSOutlineViewItemDidExpandNotification; + package id NSOutlineViewItemWillCollapseNotification; + package id NSOutlineViewItemDidCollapseNotification; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSPDFImageRep.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSPDFImageRep.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,61 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSPDFImageRep; + +import dstep.appkit.NSImageRep; +import dstep.foundation.NSData; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSPDFImageRep : NSImageRep +{ + mixin (ObjcWrap); + + static Object imageRepWithData (NSData pdfData) + { + return invokeObjcSelfClass!(Object, "imageRepWithData:", NSData)(pdfData); + } + + NSPDFImageRep initWithData (NSData pdfData) + { + id result = invokeObjcSelf!(id, "initWithData:", NSData)(pdfData); + return result is this.objcObject ? this : (result !is null ? new NSPDFImageRep(result) : null); + } + + this (NSData pdfData) + { + super(NSPDFImageRep.alloc.initWithData(pdfData).objcObject); + } + + NSData PDFRepresentation () + { + return invokeObjcSelf!(NSData, "PDFRepresentation"); + } + + NSRect bounds () + { + return invokeObjcSelf!(NSRect, "bounds"); + } + + void setCurrentPage (NSInteger page) + { + return invokeObjcSelf!(void, "setCurrentPage:", NSInteger)(page); + } + + NSInteger currentPage () + { + return invokeObjcSelf!(NSInteger, "currentPage"); + } + + NSInteger pageCount () + { + return invokeObjcSelf!(NSInteger, "pageCount"); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSPICTImageRep.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSPICTImageRep.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,45 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSPICTImageRep; + +import dstep.appkit.NSImageRep; +import dstep.foundation.NSData; +import dstep.foundation.NSGeometry; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSPICTImageRep : NSImageRep +{ + mixin (ObjcWrap); + + static Object imageRepWithData (NSData pictData) + { + return invokeObjcSelfClass!(Object, "imageRepWithData:", NSData)(pictData); + } + + NSPICTImageRep initWithData (NSData pictData) + { + id result = invokeObjcSelf!(id, "initWithData:", NSData)(pictData); + return result is this.objcObject ? this : (result !is null ? new NSPICTImageRep(result) : null); + } + + this (NSData pictData) + { + super(NSPICTImageRep.alloc.initWithData(pictData).objcObject); + } + + NSData PICTRepresentation () + { + return invokeObjcSelf!(NSData, "PICTRepresentation"); + } + + NSRect boundingBox () + { + return invokeObjcSelf!(NSRect, "boundingBox"); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSPageLayout.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSPageLayout.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,74 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSPageLayout; + +import dstep.appkit.NSPrintInfo; +import dstep.appkit.NSView; +import dstep.appkit.NSViewController; +import dstep.appkit.NSWindow; +import dstep.appkit.NSWindowController; +import dstep.foundation.NSArray; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +const TNSPageLayoutPanel = ` + + void runPageLayout (Object sender) + { + return invokeObjcSelf!(void, "runPageLayout:", Object)(sender); + } + + //mixin ObjcBindMethod!(runPageLayout, "runPageLayout:"); + +`; + +class NSPageLayout : NSObject +{ + mixin (ObjcWrap); + + static NSPageLayout pageLayout () + { + return invokeObjcSelfClass!(NSPageLayout, "pageLayout"); + } + + void addAccessoryController (NSViewController accessoryController) + { + return invokeObjcSelf!(void, "addAccessoryController:", NSViewController)(accessoryController); + } + + void removeAccessoryController (NSViewController accessoryController) + { + return invokeObjcSelf!(void, "removeAccessoryController:", NSViewController)(accessoryController); + } + + NSArray accessoryControllers () + { + return invokeObjcSelf!(NSArray, "accessoryControllers"); + } + + void beginSheetWithPrintInfo (NSPrintInfo printInfo, NSWindow docWindow, Object delegate_, SEL didEndSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "beginSheetWithPrintInfo:modalForWindow:delegate:didEndSelector:contextInfo:", NSPrintInfo, NSWindow, Object, SEL, void*)(printInfo, docWindow, delegate_, didEndSelector, contextInfo); + } + + NSInteger runModalWithPrintInfo (NSPrintInfo printInfo) + { + return invokeObjcSelf!(NSInteger, "runModalWithPrintInfo:", NSPrintInfo)(printInfo); + } + + NSInteger runModal () + { + return invokeObjcSelf!(NSInteger, "runModal"); + } + + NSPrintInfo printInfo () + { + return invokeObjcSelf!(NSPrintInfo, "printInfo"); + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSPanel.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSPanel.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,146 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSPanel; + +import dstep.appkit.NSWindow; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.appkit.NSPanel_bindings; + +enum +{ + NSAlertDefaultReturn = 1, + NSAlertAlternateReturn = 0, + NSAlertOtherReturn = -1, + NSAlertErrorReturn = -2 +} + +enum +{ + NSOKButton = 1, + NSCancelButton = 0 +} + +enum +{ + NSUtilityWindowMask = 1 << 4, + NSDocModalWindowMask = 1 << 6 +} + +enum +{ + NSNonactivatingPanelMask = 1 << 7 +} + +enum +{ + NSHUDWindowMask = 1 << 13 +} + +class NSPanel : NSWindow +{ + mixin (ObjcWrap); + + bool isFloatingPanel () + { + return invokeObjcSelf!(bool, "isFloatingPanel"); + } + + void setFloatingPanel (bool flag) + { + return invokeObjcSelf!(void, "setFloatingPanel:", bool)(flag); + } + + bool becomesKeyOnlyIfNeeded () + { + return invokeObjcSelf!(bool, "becomesKeyOnlyIfNeeded"); + } + + void setBecomesKeyOnlyIfNeeded (bool flag) + { + return invokeObjcSelf!(void, "setBecomesKeyOnlyIfNeeded:", bool)(flag); + } + + bool worksWhenModal () + { + return invokeObjcSelf!(bool, "worksWhenModal"); + } + + void setWorksWhenModal (bool flag) + { + return invokeObjcSelf!(void, "setWorksWhenModal:", bool)(flag); + } +} + +NSInteger NSRunAlertPanel (ARGS...) (NSString title, NSString msgFormat, NSString defaultButton, NSString alternateButton, NSString otherButton, ARGS args) +{ + return Bridge.invokeObjcFunction!(NSInteger, bindings.NSRunAlertPanel, NSString, NSString, NSString, NSString, NSString)(title, msgFormat, defaultButton, alternateButton, otherButton, args); +} + +NSInteger NSRunInformationalAlertPanel (ARGS...) (NSString title, NSString msgFormat, NSString defaultButton, NSString alternateButton, NSString otherButton, ARGS args) +{ + return Bridge.invokeObjcFunction!(NSInteger, bindings.NSRunInformationalAlertPanel, NSString, NSString, NSString, NSString, NSString)(title, msgFormat, defaultButton, alternateButton, otherButton, args); +} + +NSInteger NSRunCriticalAlertPanel (ARGS...) (NSString title, NSString msgFormat, NSString defaultButton, NSString alternateButton, NSString otherButton, ARGS args) +{ + return Bridge.invokeObjcFunction!(NSInteger, bindings.NSRunCriticalAlertPanel, NSString, NSString, NSString, NSString, NSString)(title, msgFormat, defaultButton, alternateButton, otherButton, args); +} + +NSInteger NSRunAlertPanelRelativeToWindow (ARGS...) (NSString title, NSString msgFormat, NSString defaultButton, NSString alternateButton, NSString otherButton, NSWindow docWindow, ARGS args) +{ + return Bridge.invokeObjcFunction!(NSInteger, bindings.NSRunAlertPanelRelativeToWindow, NSString, NSString, NSString, NSString, NSString, NSWindow)(title, msgFormat, defaultButton, alternateButton, otherButton, docWindow, args); +} + +NSInteger NSRunInformationalAlertPanelRelativeToWindow (ARGS...) (NSString title, NSString msgFormat, NSString defaultButton, NSString alternateButton, NSString otherButton, NSWindow docWindow, ARGS args) +{ + return Bridge.invokeObjcFunction!(NSInteger, bindings.NSRunInformationalAlertPanelRelativeToWindow, NSString, NSString, NSString, NSString, NSString, NSWindow)(title, msgFormat, defaultButton, alternateButton, otherButton, docWindow, args); +} + +NSInteger NSRunCriticalAlertPanelRelativeToWindow (ARGS...) (NSString title, NSString msgFormat, NSString defaultButton, NSString alternateButton, NSString otherButton, NSWindow docWindow, ARGS args) +{ + return Bridge.invokeObjcFunction!(NSInteger, bindings.NSRunCriticalAlertPanelRelativeToWindow, NSString, NSString, NSString, NSString, NSString, NSWindow)(title, msgFormat, defaultButton, alternateButton, otherButton, docWindow), args; +} + +void NSBeginAlertSheet (ARGS...) (NSString title, NSString defaultButton, NSString alternateButton, NSString otherButton, NSWindow docWindow, Object modalDelegate, SEL didEndSelector, SEL didDismissSelector, void* contextInfo, NSString msgFormat, ARGS args) +{ + return Bridge.invokeObjcFunction!(void, bindings.NSBeginAlertSheet, NSString, NSString, NSString, NSString, NSWindow, Object, SEL, SEL, void*, NSString)(title, defaultButton, alternateButton, otherButton, docWindow, modalDelegate, didEndSelector, didDismissSelector, contextInfo, msgFormat, args); +} + +void NSBeginInformationalAlertSheet (ARGS...) (NSString title, NSString defaultButton, NSString alternateButton, NSString otherButton, NSWindow docWindow, Object modalDelegate, SEL didEndSelector, SEL didDismissSelector, void* contextInfo, NSString msgFormat, ARGS args) +{ + return Bridge.invokeObjcFunction!(void, bindings.NSBeginInformationalAlertSheet, NSString, NSString, NSString, NSString, NSWindow, Object, SEL, SEL, void*, NSString)(title, defaultButton, alternateButton, otherButton, docWindow, modalDelegate, didEndSelector, didDismissSelector, contextInfo, msgFormat, args); +} + +void NSBeginCriticalAlertSheet (ARGS...) (NSString title, NSString defaultButton, NSString alternateButton, NSString otherButton, NSWindow docWindow, Object modalDelegate, SEL didEndSelector, SEL didDismissSelector, void* contextInfo, NSString msgFormat, ARGS args) +{ + return Bridge.invokeObjcFunction!(void, bindings.NSBeginCriticalAlertSheet, NSString, NSString, NSString, NSString, NSWindow, Object, SEL, SEL, void*, NSString)(title, defaultButton, alternateButton, otherButton, docWindow, modalDelegate, didEndSelector, didDismissSelector, contextInfo, msgFormat, args); +} + +Object NSGetAlertPanel (ARGS...) (NSString title, NSString msgFormat, NSString defaultButton, NSString alternateButton, NSString otherButton, ARGS args) +{ + return Bridge.invokeObjcFunction!(Object, bindings.NSGetAlertPanel, NSString, NSString, NSString, NSString, NSString)(title, msgFormat, defaultButton, alternateButton, otherButton, args, args); +} + +Object NSGetInformationalAlertPanel (ARGS...) (NSString title, NSString msgFormat, NSString defaultButton, NSString alternateButton, NSString otherButton, ARGS args) +{ + return Bridge.invokeObjcFunction!(Object, bindings.NSGetInformationalAlertPanel, NSString, NSString, NSString, NSString, NSString)(title, msgFormat, defaultButton, alternateButton, otherButton, args, args); +} + +Object NSGetCriticalAlertPanel (ARGS...) (NSString title, NSString msgFormat, NSString defaultButton, NSString alternateButton, NSString otherButton, ARGS args) +{ + return Bridge.invokeObjcFunction!(Object, bindings.NSGetCriticalAlertPanel, NSString, NSString, NSString, NSString, NSString)(title, msgFormat, defaultButton, alternateButton, otherButton, args, args); +} + +void NSReleaseAlertPanel (Object panel) +{ + return Bridge.invokeObjcFunction!(void, bindings.NSReleaseAlertPanel, Object)(panel); +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSPanel_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSPanel_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,27 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Nov 20, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSPanel_bindings; + +import dstep.foundation.NSObjCRuntime; +import dstep.objc.objc; + +package: +extern (C): + +NSInteger NSRunAlertPanel (id title, id msgFormat, id defaultButton, id alternateButton, id otherButton, ...); +NSInteger NSRunInformationalAlertPanel (id title, id msgFormat, id defaultButton, id alternateButton, id otherButton, ...); +NSInteger NSRunCriticalAlertPanel (id title, id msgFormat, id defaultButton, id alternateButton, id otherButton, ...); +NSInteger NSRunAlertPanelRelativeToWindow (id title, id msgFormat, id defaultButton, id alternateButton, id otherButton, id docWindow, ...); +NSInteger NSRunInformationalAlertPanelRelativeToWindow (id title, id msgFormat, id defaultButton, id alternateButton, id otherButton, id docWindow, ...); +NSInteger NSRunCriticalAlertPanelRelativeToWindow (id title, id msgFormat, id defaultButton, id alternateButton, id otherButton, id docWindow, ...); +void NSBeginAlertSheet (id title, id defaultButton, id alternateButton, id otherButton, id docWindow, id modalDelegate, SEL didEndSelector, SEL didDismissSelector, void* contextInfo, id msgFormat, ...); +void NSBeginInformationalAlertSheet (id title, id defaultButton, id alternateButton, id otherButton, id docWindow, id modalDelegate, SEL didEndSelector, SEL didDismissSelector, void* contextInfo, id msgFormat, ...); +void NSBeginCriticalAlertSheet (id title, id defaultButton, id alternateButton, id otherButton, id docWindow, id modalDelegate, SEL didEndSelector, SEL didDismissSelector, void* contextInfo, id msgFormat, ...); +id NSGetAlertPanel (id title, id msgFormat, id defaultButton, id alternateButton, id otherButton, ...); +id NSGetInformationalAlertPanel (id title, id msgFormat, id defaultButton, id alternateButton, id otherButton, ...); +id NSGetCriticalAlertPanel (id title, id msgFormat, id defaultButton, id alternateButton, id otherButton, ...); +void NSReleaseAlertPanel (id panel); \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSParagraphStyle.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSParagraphStyle.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,375 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSParagraphStyle; + +import dstep.appkit.NSText; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSArray; +import dstep.foundation.NSCoder; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.appkit.NSParagraphStyle_bindings; + +alias NSUInteger NSTextTabType; +alias NSUInteger NSLineBreakMode; + +private +{ + NSString NSTabColumnTerminatorsAttributeName_; +} + +NSString NSTabColumnTerminatorsAttributeName () +{ + if (NSTabColumnTerminatorsAttributeName_) + return NSTabColumnTerminatorsAttributeName_; + + return NSTabColumnTerminatorsAttributeName_ = new NSString(bindings.NSTabColumnTerminatorsAttributeName); +} + +enum +{ + NSLeftTabStopType = 0, + NSRightTabStopType, + NSCenterTabStopType, + NSDecimalTabStopType +} + +enum +{ + NSLineBreakByWordWrapping = 0, + NSLineBreakByCharWrapping, + NSLineBreakByClipping, + NSLineBreakByTruncatingHead, + NSLineBreakByTruncatingTail, + NSLineBreakByTruncatingMiddle +} + +class NSTextTab : NSObject, INSCopying, INSCoding +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + typeof(this) copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); + } + + NSTextTab initWithTextAlignment (uint alignment, CGFloat loc, NSDictionary options) + { + id result = invokeObjcSelf!(id, "initWithTextAlignment:location:options:", uint, CGFloat, NSDictionary)(alignment, loc, options); + return result is this.objcObject ? this : (result !is null ? new NSTextTab(result) : null); + } + + this (uint alignment, CGFloat loc, NSDictionary options) + { + super(NSTextTab.alloc.initWithTextAlignment(alignment, loc, options).objcObject); + } + + uint alignment () + { + return invokeObjcSelf!(uint, "alignment"); + } + + NSDictionary options () + { + return invokeObjcSelf!(NSDictionary, "options"); + } + + NSTextTab initWithType (uint type, CGFloat loc) + { + id result = invokeObjcSelf!(id, "initWithType:location:", uint, CGFloat)(type, loc); + return result is this.objcObject ? this : (result !is null ? new NSTextTab(result) : null); + } + + this (uint type, CGFloat loc) + { + super(NSTextTab.alloc.initWithType(type, loc).objcObject); + } + + CGFloat location () + { + return invokeObjcSelf!(CGFloat, "location"); + } + + uint tabStopType () + { + return invokeObjcSelf!(uint, "tabStopType"); + } + +} + +class NSMutableParagraphStyle : NSParagraphStyle +{ + mixin (ObjcWrap); + + void setLineSpacing (CGFloat aFloat) + { + return invokeObjcSelf!(void, "setLineSpacing:", CGFloat)(aFloat); + } + + void setParagraphSpacing (CGFloat aFloat) + { + return invokeObjcSelf!(void, "setParagraphSpacing:", CGFloat)(aFloat); + } + + void setAlignment (uint alignment) + { + return invokeObjcSelf!(void, "setAlignment:", uint)(alignment); + } + + void setFirstLineHeadIndent (CGFloat aFloat) + { + return invokeObjcSelf!(void, "setFirstLineHeadIndent:", CGFloat)(aFloat); + } + + void setHeadIndent (CGFloat aFloat) + { + return invokeObjcSelf!(void, "setHeadIndent:", CGFloat)(aFloat); + } + + void setTailIndent (CGFloat aFloat) + { + return invokeObjcSelf!(void, "setTailIndent:", CGFloat)(aFloat); + } + + void setLineBreakMode (uint mode) + { + return invokeObjcSelf!(void, "setLineBreakMode:", uint)(mode); + } + + void setMinimumLineHeight (CGFloat aFloat) + { + return invokeObjcSelf!(void, "setMinimumLineHeight:", CGFloat)(aFloat); + } + + void setMaximumLineHeight (CGFloat aFloat) + { + return invokeObjcSelf!(void, "setMaximumLineHeight:", CGFloat)(aFloat); + } + + void addTabStop (NSTextTab anObject) + { + return invokeObjcSelf!(void, "addTabStop:", NSTextTab)(anObject); + } + + void removeTabStop (NSTextTab anObject) + { + return invokeObjcSelf!(void, "removeTabStop:", NSTextTab)(anObject); + } + + void setTabStops (NSArray array) + { + return invokeObjcSelf!(void, "setTabStops:", NSArray)(array); + } + + void setParagraphStyle (NSParagraphStyle obj) + { + return invokeObjcSelf!(void, "setParagraphStyle:", NSParagraphStyle)(obj); + } + + void setBaseWritingDirection (int writingDirection) + { + return invokeObjcSelf!(void, "setBaseWritingDirection:", int)(writingDirection); + } + + void setLineHeightMultiple (CGFloat aFloat) + { + return invokeObjcSelf!(void, "setLineHeightMultiple:", CGFloat)(aFloat); + } + + void setParagraphSpacingBefore (CGFloat aFloat) + { + return invokeObjcSelf!(void, "setParagraphSpacingBefore:", CGFloat)(aFloat); + } + + void setDefaultTabInterval (CGFloat aFloat) + { + return invokeObjcSelf!(void, "setDefaultTabInterval:", CGFloat)(aFloat); + } + + void setTextBlocks (NSArray array) + { + return invokeObjcSelf!(void, "setTextBlocks:", NSArray)(array); + } + + void setTextLists (NSArray array) + { + return invokeObjcSelf!(void, "setTextLists:", NSArray)(array); + } + + void setHyphenationFactor (float aFactor) + { + return invokeObjcSelf!(void, "setHyphenationFactor:", float)(aFactor); + } + + void setTighteningFactorForTruncation (float aFactor) + { + return invokeObjcSelf!(void, "setTighteningFactorForTruncation:", float)(aFactor); + } + + void setHeaderLevel (NSInteger level) + { + return invokeObjcSelf!(void, "setHeaderLevel:", NSInteger)(level); + } +} + +class NSParagraphStyle : NSObject, INSCopying, INSMutableCopying, INSCoding +{ + mixin (ObjcWrap); + + NSParagraphStyle mutableCopyWithZone (NSZone* aZone) + { + return invokeObjcSelf!(NSParagraphStyle, "mutableCopyWithZone:", NSZone*)(aZone); + } + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + typeof(this) copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); + } + + static NSParagraphStyle defaultParagraphStyle () + { + return invokeObjcSelfClass!(NSParagraphStyle, "defaultParagraphStyle"); + } + + static int defaultWritingDirectionForLanguage (NSString languageName) + { + return invokeObjcSelfClass!(int, "defaultWritingDirectionForLanguage:", NSString)(languageName); + } + + CGFloat lineSpacing () + { + return invokeObjcSelf!(CGFloat, "lineSpacing"); + } + + CGFloat paragraphSpacing () + { + return invokeObjcSelf!(CGFloat, "paragraphSpacing"); + } + + uint alignment () + { + return invokeObjcSelf!(uint, "alignment"); + } + + CGFloat headIndent () + { + return invokeObjcSelf!(CGFloat, "headIndent"); + } + + CGFloat tailIndent () + { + return invokeObjcSelf!(CGFloat, "tailIndent"); + } + + CGFloat firstLineHeadIndent () + { + return invokeObjcSelf!(CGFloat, "firstLineHeadIndent"); + } + + NSArray tabStops () + { + return invokeObjcSelf!(NSArray, "tabStops"); + } + + CGFloat minimumLineHeight () + { + return invokeObjcSelf!(CGFloat, "minimumLineHeight"); + } + + CGFloat maximumLineHeight () + { + return invokeObjcSelf!(CGFloat, "maximumLineHeight"); + } + + uint lineBreakMode () + { + return invokeObjcSelf!(uint, "lineBreakMode"); + } + + int baseWritingDirection () + { + return invokeObjcSelf!(int, "baseWritingDirection"); + } + + CGFloat lineHeightMultiple () + { + return invokeObjcSelf!(CGFloat, "lineHeightMultiple"); + } + + CGFloat paragraphSpacingBefore () + { + return invokeObjcSelf!(CGFloat, "paragraphSpacingBefore"); + } + + CGFloat defaultTabInterval () + { + return invokeObjcSelf!(CGFloat, "defaultTabInterval"); + } + + NSArray textBlocks () + { + return invokeObjcSelf!(NSArray, "textBlocks"); + } + + NSArray textLists () + { + return invokeObjcSelf!(NSArray, "textLists"); + } + + float hyphenationFactor () + { + return invokeObjcSelf!(float, "hyphenationFactor"); + } + + float tighteningFactorForTruncation () + { + return invokeObjcSelf!(float, "tighteningFactorForTruncation"); + } + + NSInteger headerLevel () + { + return invokeObjcSelf!(NSInteger, "headerLevel"); + } + +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSParagraphStyle_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSParagraphStyle_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,18 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSParagraphStyle_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package id NSTabColumnTerminatorsAttributeName; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSPasteboard.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSPasteboard.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,451 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSPasteboard; + +import dstep.appkit.AppKitDefines; +import dstep.appkit.NSFileWrapper; +import dstep.corefoundation.CFBase; +import dstep.foundation.NSArray; +import dstep.foundation.NSData; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSURL; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.appkit.NSPasteboard_bindings; + +private +{ + NSString NSStringPboardType_; + NSString NSFilenamesPboardType_; + NSString NSPostScriptPboardType_; + NSString NSTIFFPboardType_; + NSString NSRTFPboardType_; + NSString NSTabularTextPboardType_; + NSString NSFontPboardType_; + NSString NSRulerPboardType_; + NSString NSFileContentsPboardType_; + NSString NSColorPboardType_; + NSString NSRTFDPboardType_; + NSString NSHTMLPboardType_; + NSString NSPICTPboardType_; + NSString NSURLPboardType_; + NSString NSPDFPboardType_; + NSString NSVCardPboardType_; + NSString NSFilesPromisePboardType_; + NSString NSInkTextPboardType_; + NSString NSMultipleTextSelectionPboardType_; + NSString NSGeneralPboard_; + NSString NSFontPboard_; + NSString NSRulerPboard_; + NSString NSFindPboard_; + NSString NSDragPboard_; +} + +NSString NSStringPboardType () +{ + if (NSStringPboardType_) + return NSStringPboardType_; + + return NSStringPboardType_ = new NSString(bindings.NSStringPboardType); +} + +NSString NSFilenamesPboardType () +{ + if (NSFilenamesPboardType_) + return NSFilenamesPboardType_; + + return NSFilenamesPboardType_ = new NSString(bindings.NSFilenamesPboardType); +} + +NSString NSPostScriptPboardType () +{ + if (NSPostScriptPboardType_) + return NSPostScriptPboardType_; + + return NSPostScriptPboardType_ = new NSString(bindings.NSPostScriptPboardType); +} + +NSString NSTIFFPboardType () +{ + if (NSTIFFPboardType_) + return NSTIFFPboardType_; + + return NSTIFFPboardType_ = new NSString(bindings.NSTIFFPboardType); +} + +NSString NSRTFPboardType () +{ + if (NSRTFPboardType_) + return NSRTFPboardType_; + + return NSRTFPboardType_ = new NSString(bindings.NSRTFPboardType); +} + +NSString NSTabularTextPboardType () +{ + if (NSTabularTextPboardType_) + return NSTabularTextPboardType_; + + return NSTabularTextPboardType_ = new NSString(bindings.NSTabularTextPboardType); +} + +NSString NSFontPboardType () +{ + if (NSFontPboardType_) + return NSFontPboardType_; + + return NSFontPboardType_ = new NSString(bindings.NSFontPboardType); +} + +NSString NSRulerPboardType () +{ + if (NSRulerPboardType_) + return NSRulerPboardType_; + + return NSRulerPboardType_ = new NSString(bindings.NSRulerPboardType); +} + +NSString NSFileContentsPboardType () +{ + if (NSFileContentsPboardType_) + return NSFileContentsPboardType_; + + return NSFileContentsPboardType_ = new NSString(bindings.NSFileContentsPboardType); +} + +NSString NSColorPboardType () +{ + if (NSColorPboardType_) + return NSColorPboardType_; + + return NSColorPboardType_ = new NSString(bindings.NSColorPboardType); +} + +NSString NSRTFDPboardType () +{ + if (NSRTFDPboardType_) + return NSRTFDPboardType_; + + return NSRTFDPboardType_ = new NSString(bindings.NSRTFDPboardType); +} + +NSString NSHTMLPboardType () +{ + if (NSHTMLPboardType_) + return NSHTMLPboardType_; + + return NSHTMLPboardType_ = new NSString(bindings.NSHTMLPboardType); +} + +NSString NSPICTPboardType () +{ + if (NSPICTPboardType_) + return NSPICTPboardType_; + + return NSPICTPboardType_ = new NSString(bindings.NSPICTPboardType); +} + +NSString NSURLPboardType () +{ + if (NSURLPboardType_) + return NSURLPboardType_; + + return NSURLPboardType_ = new NSString(bindings.NSURLPboardType); +} + +NSString NSPDFPboardType () +{ + if (NSPDFPboardType_) + return NSPDFPboardType_; + + return NSPDFPboardType_ = new NSString(bindings.NSPDFPboardType); +} + +NSString NSVCardPboardType () +{ + if (NSVCardPboardType_) + return NSVCardPboardType_; + + return NSVCardPboardType_ = new NSString(bindings.NSVCardPboardType); +} + +NSString NSFilesPromisePboardType () +{ + if (NSFilesPromisePboardType_) + return NSFilesPromisePboardType_; + + return NSFilesPromisePboardType_ = new NSString(bindings.NSFilesPromisePboardType); +} + +NSString NSInkTextPboardType () +{ + if (NSInkTextPboardType_) + return NSInkTextPboardType_; + + return NSInkTextPboardType_ = new NSString(bindings.NSInkTextPboardType); +} + +NSString NSMultipleTextSelectionPboardType () +{ + if (NSMultipleTextSelectionPboardType_) + return NSMultipleTextSelectionPboardType_; + + return NSMultipleTextSelectionPboardType_ = new NSString(bindings.NSMultipleTextSelectionPboardType); +} + +NSString NSGeneralPboard () +{ + if (NSGeneralPboard_) + return NSGeneralPboard_; + + return NSGeneralPboard_ = new NSString(bindings.NSGeneralPboard); +} + +NSString NSFontPboard () +{ + if (NSFontPboard_) + return NSFontPboard_; + + return NSFontPboard_ = new NSString(bindings.NSFontPboard); +} + +NSString NSRulerPboard () +{ + if (NSRulerPboard_) + return NSRulerPboard_; + + return NSRulerPboard_ = new NSString(bindings.NSRulerPboard); +} + +NSString NSFindPboard () +{ + if (NSFindPboard_) + return NSFindPboard_; + + return NSFindPboard_ = new NSString(bindings.NSFindPboard); +} + +NSString NSDragPboard () +{ + if (NSDragPboard_) + return NSDragPboard_; + + return NSDragPboard_ = new NSString(bindings.NSDragPboard); +} + +const TNSFileContents = ` + + bool writeFileContents (NSString filename) + { + return invokeObjcSelf!(bool, "writeFileContents:", NSString)(filename); + } + + NSString readFileContentsType (NSString type, NSString filename) + { + return invokeObjcSelf!(NSString, "readFileContentsType:toFile:", NSString, NSString)(type, filename); + } + + bool writeFileWrapper (NSFileWrapper wrapper) + { + return invokeObjcSelf!(bool, "writeFileWrapper:", NSFileWrapper)(wrapper); + } + + NSFileWrapper readFileWrapper () + { + return invokeObjcSelf!(NSFileWrapper, "readFileWrapper"); + } + + //mixin ObjcBindMethod!(writeFileContents, "writeFileContents:"); + //mixin ObjcBindMethod!(readFileContentsType, "readFileContentsType:toFile:"); + //mixin ObjcBindMethod!(writeFileWrapper, "writeFileWrapper:"); + //mixin ObjcBindMethod!(readFileWrapper, "readFileWrapper"); + +`; + +const TNSPasteboardSupport = ` + + static NSURL URLFromPasteboard (NSPasteboard pasteBoard) + { + return invokeObjcSelfClass!(NSURL, "URLFromPasteboard:", NSPasteboard)(pasteBoard); + } + + void writeToPasteboard (NSPasteboard pasteBoard) + { + return invokeObjcSelf!(void, "writeToPasteboard:", NSPasteboard)(pasteBoard); + } + + //mixin ObjcBindClassMethod!(URLFromPasteboard, "URLFromPasteboard:"); + //mixin ObjcBindMethod!(writeToPasteboard, "writeToPasteboard:"); + +`; + +const TNSPasteboardOwner = ` + + void pasteboard (NSPasteboard sender, NSString type) + { + return invokeObjcSelf!(void, "pasteboard:provideDataForType:", NSPasteboard, NSString)(sender, type); + } + + void pasteboardChangedOwner (NSPasteboard sender) + { + return invokeObjcSelf!(void, "pasteboardChangedOwner:", NSPasteboard)(sender); + } + + //mixin ObjcBindMethod!(pasteboard, "pasteboard:provideDataForType:"); + //mixin ObjcBindMethod!(pasteboardChangedOwner, "pasteboardChangedOwner:"); + +`; + +class NSPasteboard : NSObject +{ + mixin (ObjcWrap); + + static NSPasteboard generalPasteboard () + { + return invokeObjcSelfClass!(NSPasteboard, "generalPasteboard"); + } + + static NSPasteboard pasteboardWithName (NSString name) + { + return invokeObjcSelfClass!(NSPasteboard, "pasteboardWithName:", NSString)(name); + } + + static NSPasteboard pasteboardWithUniqueName () + { + return invokeObjcSelfClass!(NSPasteboard, "pasteboardWithUniqueName"); + } + + static NSArray typesFilterableTo (NSString type) + { + return invokeObjcSelfClass!(NSArray, "typesFilterableTo:", NSString)(type); + } + + static NSPasteboard pasteboardByFilteringFile (NSString filename) + { + return invokeObjcSelfClass!(NSPasteboard, "pasteboardByFilteringFile:", NSString)(filename); + } + + static NSPasteboard pasteboardByFilteringData (NSData data, NSString type) + { + return invokeObjcSelfClass!(NSPasteboard, "pasteboardByFilteringData:ofType:", NSData, NSString)(data, type); + } + + static NSPasteboard pasteboardByFilteringTypesInPasteboard (NSPasteboard pboard) + { + return invokeObjcSelfClass!(NSPasteboard, "pasteboardByFilteringTypesInPasteboard:", NSPasteboard)(pboard); + } + + NSString name () + { + return invokeObjcSelf!(NSString, "name"); + } + + void releaseGlobally () + { + return invokeObjcSelf!(void, "releaseGlobally"); + } + + NSInteger declareTypes (NSArray newTypes, Object newOwner) + { + return invokeObjcSelf!(NSInteger, "declareTypes:owner:", NSArray, Object)(newTypes, newOwner); + } + + NSInteger addTypes (NSArray newTypes, Object newOwner) + { + return invokeObjcSelf!(NSInteger, "addTypes:owner:", NSArray, Object)(newTypes, newOwner); + } + + NSInteger changeCount () + { + return invokeObjcSelf!(NSInteger, "changeCount"); + } + + NSArray types () + { + return invokeObjcSelf!(NSArray, "types"); + } + + NSString availableTypeFromArray (NSArray types) + { + return invokeObjcSelf!(NSString, "availableTypeFromArray:", NSArray)(types); + } + + bool setData (NSData data, NSString dataType) + { + return invokeObjcSelf!(bool, "setData:forType:", NSData, NSString)(data, dataType); + } + + NSData dataForType (NSString dataType) + { + return invokeObjcSelf!(NSData, "dataForType:", NSString)(dataType); + } + + bool setPropertyList (Object plist, NSString dataType) + { + return invokeObjcSelf!(bool, "setPropertyList:forType:", Object, NSString)(plist, dataType); + } + + Object propertyListForType (NSString dataType) + { + return invokeObjcSelf!(Object, "propertyListForType:", NSString)(dataType); + } + + bool setString (NSString string, NSString dataType) + { + return invokeObjcSelf!(bool, "setString:forType:", NSString, NSString)(string, dataType); + } + + NSString stringForType (NSString dataType) + { + return invokeObjcSelf!(NSString, "stringForType:", NSString)(dataType); + } + + // NSFileContents + bool writeFileContents (NSString filename) + { + return invokeObjcSelf!(bool, "writeFileContents:", NSString)(filename); + } + + NSString readFileContentsType (NSString type, NSString filename) + { + return invokeObjcSelf!(NSString, "readFileContentsType:toFile:", NSString, NSString)(type, filename); + } + + bool writeFileWrapper (NSFileWrapper wrapper) + { + return invokeObjcSelf!(bool, "writeFileWrapper:", NSFileWrapper)(wrapper); + } + + NSFileWrapper readFileWrapper () + { + return invokeObjcSelf!(NSFileWrapper, "readFileWrapper"); + } +} + +NSString NSCreateFilenamePboardType (NSString fileType) +{ + return Bridge.invokeObjcFunction!(NSString, bindings.NSCreateFilenamePboardType, NSString)(fileType); +} + +NSString NSCreateFileContentsPboardType (NSString fileType) +{ + return Bridge.invokeObjcFunction!(NSString, bindings.NSCreateFileContentsPboardType, NSString)(fileType); +} + +NSString NSGetFileType (NSString pboardType) +{ + return Bridge.invokeObjcFunction!(NSString, bindings.NSGetFileType, NSString)(pboardType); +} + +NSArray NSGetFileTypes (NSArray pboardTypes) +{ + return Bridge.invokeObjcFunction!(NSArray, bindings.NSGetFileTypes, NSArray)(pboardTypes); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSPasteboard_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSPasteboard_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,50 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSPasteboard_bindings; + +import dstep.appkit.AppKitDefines; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package id NSStringPboardType; + package id NSFilenamesPboardType; + package id NSPostScriptPboardType; + package id NSTIFFPboardType; + package id NSRTFPboardType; + package id NSTabularTextPboardType; + package id NSFontPboardType; + package id NSRulerPboardType; + package id NSFileContentsPboardType; + package id NSColorPboardType; + package id NSRTFDPboardType; + package id NSHTMLPboardType; + package id NSPICTPboardType; + package id NSURLPboardType; + package id NSPDFPboardType; + package id NSVCardPboardType; + package id NSFilesPromisePboardType; + package id NSInkTextPboardType; + package id NSMultipleTextSelectionPboardType; + package id NSGeneralPboard; + package id NSFontPboard; + package id NSRulerPboard; + package id NSFindPboard; + package id NSDragPboard; + } +} + +extern (C) +{ + package id NSCreateFilenamePboardType (id fileType); + package id NSCreateFileContentsPboardType (id fileType); + package id NSGetFileType (id pboardType); + package id NSGetFileTypes (id pboardTypes); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSPathCell.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSPathCell.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,178 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSPathCell; + +import dstep.appkit.NSActionCell; +import dstep.appkit.NSAnimation; +import dstep.appkit.NSColor; +import dstep.appkit.NSEvent; +import dstep.appkit.NSMenu; +import dstep.appkit.NSView; +import dstep.foundation.NSArray; +import dstep.appkit.NSImage; +import dstep.appkit.NSOpenPanel; +import dstep.appkit.NSPathComponentCell; +import dstep.appkit.NSPopUpButtonCell; +import dstep.foundation.NSAttributedString; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSURL; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +typedef NSInteger NSPathStyle; + +enum +{ + NSPathStyleStandard, + NSPathStyleNavigationBar, + NSPathStylePopUp +} + +class NSPathCell : NSActionCell +{ + mixin (ObjcWrap); + + int pathStyle () + { + return invokeObjcSelf!(int, "pathStyle"); + } + + void setPathStyle (int style) + { + return invokeObjcSelf!(void, "setPathStyle:", int)(style); + } + + NSURL URL () + { + return invokeObjcSelf!(NSURL, "URL"); + } + + void setURL (NSURL url) + { + return invokeObjcSelf!(void, "setURL:", NSURL)(url); + } + + void setObjectValue (INSCopying obj) + { + return invokeObjcSelf!(void, "setObjectValue:", INSCopying)(obj); + } + + NSArray allowedTypes () + { + return invokeObjcSelf!(NSArray, "allowedTypes"); + } + + void setAllowedTypes (NSArray allowedTypes) + { + return invokeObjcSelf!(void, "setAllowedTypes:", NSArray)(allowedTypes); + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + void setDelegate (Object value) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(value); + } + + static Class pathComponentCellClass () + { + return invokeObjcSelfClass!(Class, "pathComponentCellClass"); + } + + NSArray pathComponentCells () + { + return invokeObjcSelf!(NSArray, "pathComponentCells"); + } + + void setPathComponentCells (NSArray cells) + { + return invokeObjcSelf!(void, "setPathComponentCells:", NSArray)(cells); + } + + NSRect rectOfPathComponentCell (NSPathComponentCell cell, NSRect frame, NSView view) + { + return invokeObjcSelf!(NSRect, "rectOfPathComponentCell:withFrame:inView:", NSPathComponentCell, NSRect, NSView)(cell, frame, view); + } + + NSPathComponentCell pathComponentCellAtPoint (NSPoint point, NSRect frame, NSView view) + { + return invokeObjcSelf!(NSPathComponentCell, "pathComponentCellAtPoint:withFrame:inView:", NSPoint, NSRect, NSView)(point, frame, view); + } + + NSPathComponentCell clickedPathComponentCell () + { + return invokeObjcSelf!(NSPathComponentCell, "clickedPathComponentCell"); + } + + void mouseEntered (NSEvent event, NSRect frame, NSView view) + { + return invokeObjcSelf!(void, "mouseEntered:withFrame:inView:", NSEvent, NSRect, NSView)(event, frame, view); + } + + void mouseExited (NSEvent event, NSRect frame, NSView view) + { + return invokeObjcSelf!(void, "mouseExited:withFrame:inView:", NSEvent, NSRect, NSView)(event, frame, view); + } + + SEL doubleAction () + { + return invokeObjcSelf!(SEL, "doubleAction"); + } + + void setDoubleAction (SEL action) + { + return invokeObjcSelf!(void, "setDoubleAction:", SEL)(action); + } + + void setBackgroundColor (NSColor color) + { + return invokeObjcSelf!(void, "setBackgroundColor:", NSColor)(color); + } + + NSColor backgroundColor () + { + return invokeObjcSelf!(NSColor, "backgroundColor"); + } + + void setPlaceholderString (NSString string) + { + return invokeObjcSelf!(void, "setPlaceholderString:", NSString)(string); + } + + NSString placeholderString () + { + return invokeObjcSelf!(NSString, "placeholderString"); + } + + void setPlaceholderAttributedString (NSAttributedString string) + { + return invokeObjcSelf!(void, "setPlaceholderAttributedString:", NSAttributedString)(string); + } + + NSAttributedString placeholderAttributedString () + { + return invokeObjcSelf!(NSAttributedString, "placeholderAttributedString"); + } + + void setControlSize (uint size) + { + return invokeObjcSelf!(void, "setControlSize:", uint)(size); + } +} + +interface INSPathCellDelegate : INSObject +{ + void pathCell (NSPathCell pathCell, NSOpenPanel openPanel); + void pathCell (NSPathCell pathCell, NSMenu menu); +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSPathComponentCell.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSPathComponentCell.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,41 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSPathComponentCell; + +import dstep.appkit.NSImage; +import dstep.appkit.NSTextFieldCell; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSURL; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSPathComponentCell : NSTextFieldCell +{ + mixin (ObjcWrap); + + NSImage image () + { + return invokeObjcSelf!(NSImage, "image"); + } + + void setImage (NSImage value) + { + return invokeObjcSelf!(void, "setImage:", NSImage)(value); + } + + NSURL URL () + { + return invokeObjcSelf!(NSURL, "URL"); + } + + void setURL (NSURL url) + { + return invokeObjcSelf!(void, "setURL:", NSURL)(url); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSPathControl.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSPathControl.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,106 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSPathControl; + +import dstep.appkit.NSColor; +import dstep.appkit.NSControl; +import dstep.appkit.NSDragging; +import dstep.appkit.NSMenu; +import dstep.appkit.NSOpenPanel; +import dstep.appkit.NSPasteboard; +import dstep.appkit.NSPathCell; +import dstep.appkit.NSPathComponentCell; +import dstep.foundation.NSArray; +import dstep.foundation.NSObject; +import dstep.foundation.NSURL; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSPathControl : NSControl +{ + mixin (ObjcWrap); + + NSURL URL () + { + return invokeObjcSelf!(NSURL, "URL"); + } + + void setURL (NSURL url) + { + return invokeObjcSelf!(void, "setURL:", NSURL)(url); + } + + SEL doubleAction () + { + return invokeObjcSelf!(SEL, "doubleAction"); + } + + void setDoubleAction (SEL action) + { + return invokeObjcSelf!(void, "setDoubleAction:", SEL)(action); + } + + int pathStyle () + { + return invokeObjcSelf!(int, "pathStyle"); + } + + void setPathStyle (int style) + { + return invokeObjcSelf!(void, "setPathStyle:", int)(style); + } + + NSPathComponentCell clickedPathComponentCell () + { + return invokeObjcSelf!(NSPathComponentCell, "clickedPathComponentCell"); + } + + NSArray pathComponentCells () + { + return invokeObjcSelf!(NSArray, "pathComponentCells"); + } + + void setPathComponentCells (NSArray cells) + { + return invokeObjcSelf!(void, "setPathComponentCells:", NSArray)(cells); + } + + void setBackgroundColor (NSColor color) + { + return invokeObjcSelf!(void, "setBackgroundColor:", NSColor)(color); + } + + NSColor backgroundColor () + { + return invokeObjcSelf!(NSColor, "backgroundColor"); + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + void setDelegate (Object delegate_) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(delegate_); + } + + void setDraggingSourceOperationMask (uint mask, bool isLocal) + { + return invokeObjcSelf!(void, "setDraggingSourceOperationMask:forLocal:", uint, bool)(mask, isLocal); + } +} + +interface INSPathControlDelegate : INSObject +{ + bool pathControl (NSPathControl pathControl, NSPathComponentCell pathComponentCell, NSPasteboard pasteboard); + uint pathControl (NSPathControl pathControl, INSDraggingInfo info); + bool pathControl (NSPathControl pathControl, INSDraggingInfo info); + void pathControl (NSPathControl pathControl, NSOpenPanel openPanel); + void pathControl (NSPathControl pathControl, NSMenu menu); +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSPersistentDocument.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSPersistentDocument.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,110 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSPersistentDocument; + +import dstep.appkit.NSDocument; +import dstep.coredata.NSManagedObjectContext; +import dstep.coredata.NSManagedObjectModel; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSError; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSURL; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +const TNSPersistentDocumentDeprecated = ` + + bool configurePersistentStoreCoordinatorForURL (NSURL url, NSString fileType, NSError** error) + { + return invokeObjcSelf!(bool, "configurePersistentStoreCoordinatorForURL:ofType:error:", NSURL, NSString, NSError**)(url, fileType, error); + } + + //mixin ObjcBindMethod!(configurePersistentStoreCoordinatorForURL, "configurePersistentStoreCoordinatorForURL:ofType:error:"); + +`; + +class NSPersistentDocument : NSDocument +{ + mixin (ObjcWrap); + + NSManagedObjectContext managedObjectContext () + { + return invokeObjcSelf!(NSManagedObjectContext, "managedObjectContext"); + } + + void setManagedObjectContext (NSManagedObjectContext managedObjectContext) + { + return invokeObjcSelf!(void, "setManagedObjectContext:", NSManagedObjectContext)(managedObjectContext); + } + + Object managedObjectModel () + { + return invokeObjcSelf!(Object, "managedObjectModel"); + } + + bool configurePersistentStoreCoordinatorForURL (NSURL url, NSString fileType, NSString configuration, NSDictionary storeOptions, NSError** error) + { + return invokeObjcSelf!(bool, "configurePersistentStoreCoordinatorForURL:ofType:modelConfiguration:storeOptions:error:", NSURL, NSString, NSString, NSDictionary, NSError**)(url, fileType, configuration, storeOptions, error); + } + + NSString persistentStoreTypeForFileType (NSString fileType) + { + return invokeObjcSelf!(NSString, "persistentStoreTypeForFileType:", NSString)(fileType); + } + + bool writeToURL (NSURL absoluteURL, NSString typeName, uint saveOperation, NSURL absoluteOriginalContentsURL, ref NSError error) + { + id err; + + if (error) + err = error.objcObject; + + bool result = invokeObjcSelf!(bool, "writeToURL:ofType:forSaveOperation:originalContentsURL:error:", NSURL, NSString, uint, NSURL, id*)(absoluteURL, typeName, saveOperation, absoluteOriginalContentsURL, &err); + + if (err) + error = new NSError(err); + + return result; + } + + bool readFromURL (NSURL absoluteURL, NSString typeName, ref NSError error) + { + id err; + + if (error) + err = error.objcObject; + + bool result = invokeObjcSelf!(bool, "readFromURL:ofType:error:", NSURL, NSString, id*)(absoluteURL, typeName, &err); + + if (err) + error = new NSError(err); + + return result; + } + + bool revertToContentsOfURL (NSURL inAbsoluteURL, NSString inTypeName, ref NSError outError) + { + id error; + + if (outError) + error = outError.objcObject; + + bool result = invokeObjcSelf!(bool, "revertToContentsOfURL:ofType:error:", NSURL, NSString, id*)(inAbsoluteURL, inTypeName, &error); + + if (error) + outError = new NSError(error); + + return result; + } + + // NSPersistentDocumentDeprecated + bool configurePersistentStoreCoordinatorForURL (NSURL url, NSString fileType, NSError** error) + { + return invokeObjcSelf!(bool, "configurePersistentStoreCoordinatorForURL:ofType:error:", NSURL, NSString, NSError**)(url, fileType, error); + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSPopUpButton.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSPopUpButton.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,225 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSPopUpButton; + +import dstep.appkit.NSButton; +import dstep.appkit.NSMenu; +import dstep.appkit.NSMenuItem; +import dstep.appkit.NSMenuItemCell; +import dstep.foundation.NSArray; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.appkit.NSPopUpButton_bindings; + +private +{ + NSString NSPopUpButtonWillPopUpNotification_; +} + +NSString NSPopUpButtonWillPopUpNotification () +{ + if (NSPopUpButtonWillPopUpNotification_) + return NSPopUpButtonWillPopUpNotification_; + + return NSPopUpButtonWillPopUpNotification_ = new NSString(bindings.NSPopUpButtonWillPopUpNotification); +} + +class NSPopUpButton : NSButton +{ + mixin (ObjcWrap); + + NSPopUpButton initWithFrame (NSRect buttonFrame, bool flag) + { + id result = invokeObjcSelf!(id, "initWithFrame:pullsDown:", NSRect, bool)(buttonFrame, flag); + return result is this.objcObject ? this : (result !is null ? new NSPopUpButton(result) : null); + } + + this (NSRect buttonFrame, bool flag) + { + super(NSPopUpButton.alloc.initWithFrame(buttonFrame, flag).objcObject); + } + + void setMenu (NSMenu menu) + { + return invokeObjcSelf!(void, "setMenu:", NSMenu)(menu); + } + + NSMenu menu () + { + return invokeObjcSelf!(NSMenu, "menu"); + } + + void setPullsDown (bool flag) + { + return invokeObjcSelf!(void, "setPullsDown:", bool)(flag); + } + + bool pullsDown () + { + return invokeObjcSelf!(bool, "pullsDown"); + } + + void setAutoenablesItems (bool flag) + { + return invokeObjcSelf!(void, "setAutoenablesItems:", bool)(flag); + } + + bool autoenablesItems () + { + return invokeObjcSelf!(bool, "autoenablesItems"); + } + + void setPreferredEdge (int edge) + { + return invokeObjcSelf!(void, "setPreferredEdge:", int)(edge); + } + + int preferredEdge () + { + return invokeObjcSelf!(int, "preferredEdge"); + } + + void addItemWithTitle (NSString title) + { + return invokeObjcSelf!(void, "addItemWithTitle:", NSString)(title); + } + + void addItemsWithTitles (NSArray itemTitles) + { + return invokeObjcSelf!(void, "addItemsWithTitles:", NSArray)(itemTitles); + } + + void insertItemWithTitle (NSString title, NSInteger index) + { + return invokeObjcSelf!(void, "insertItemWithTitle:atIndex:", NSString, NSInteger)(title, index); + } + + void removeItemWithTitle (NSString title) + { + return invokeObjcSelf!(void, "removeItemWithTitle:", NSString)(title); + } + + void removeItemAtIndex (NSInteger index) + { + return invokeObjcSelf!(void, "removeItemAtIndex:", NSInteger)(index); + } + + void removeAllItems () + { + return invokeObjcSelf!(void, "removeAllItems"); + } + + NSArray itemArray () + { + return invokeObjcSelf!(NSArray, "itemArray"); + } + + NSInteger numberOfItems () + { + return invokeObjcSelf!(NSInteger, "numberOfItems"); + } + + NSInteger indexOfItem (NSMenuItem item) + { + return invokeObjcSelf!(NSInteger, "indexOfItem:", NSMenuItem)(item); + } + + NSInteger indexOfItemWithTitle (NSString title) + { + return invokeObjcSelf!(NSInteger, "indexOfItemWithTitle:", NSString)(title); + } + + NSInteger indexOfItemWithTag (NSInteger tag) + { + return invokeObjcSelf!(NSInteger, "indexOfItemWithTag:", NSInteger)(tag); + } + + NSInteger indexOfItemWithRepresentedObject (Object obj) + { + return invokeObjcSelf!(NSInteger, "indexOfItemWithRepresentedObject:", Object)(obj); + } + + NSInteger indexOfItemWithTarget (Object target, SEL actionSelector) + { + return invokeObjcSelf!(NSInteger, "indexOfItemWithTarget:andAction:", Object, SEL)(target, actionSelector); + } + + NSMenuItem itemAtIndex (NSInteger index) + { + return invokeObjcSelf!(NSMenuItem, "itemAtIndex:", NSInteger)(index); + } + + NSMenuItem itemWithTitle (NSString title) + { + return invokeObjcSelf!(NSMenuItem, "itemWithTitle:", NSString)(title); + } + + NSMenuItem lastItem () + { + return invokeObjcSelf!(NSMenuItem, "lastItem"); + } + + void selectItem (NSMenuItem item) + { + return invokeObjcSelf!(void, "selectItem:", NSMenuItem)(item); + } + + void selectItemAtIndex (NSInteger index) + { + return invokeObjcSelf!(void, "selectItemAtIndex:", NSInteger)(index); + } + + void selectItemWithTitle (NSString title) + { + return invokeObjcSelf!(void, "selectItemWithTitle:", NSString)(title); + } + + bool selectItemWithTag (NSInteger tag) + { + return invokeObjcSelf!(bool, "selectItemWithTag:", NSInteger)(tag); + } + + void setTitle (NSString aString) + { + return invokeObjcSelf!(void, "setTitle:", NSString)(aString); + } + + NSMenuItem selectedItem () + { + return invokeObjcSelf!(NSMenuItem, "selectedItem"); + } + + NSInteger indexOfSelectedItem () + { + return invokeObjcSelf!(NSInteger, "indexOfSelectedItem"); + } + + void synchronizeTitleAndSelectedItem () + { + return invokeObjcSelf!(void, "synchronizeTitleAndSelectedItem"); + } + + NSString itemTitleAtIndex (NSInteger index) + { + return invokeObjcSelf!(NSString, "itemTitleAtIndex:", NSInteger)(index); + } + + NSArray itemTitles () + { + return invokeObjcSelf!(NSArray, "itemTitles"); + } + + NSString titleOfSelectedItem () + { + return invokeObjcSelf!(NSString, "titleOfSelectedItem"); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSPopUpButtonCell.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSPopUpButtonCell.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,289 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSPopUpButtonCell; + +import dstep.appkit.NSMenu; +import dstep.appkit.NSMenuItem; +import dstep.appkit.NSMenuItemCell; +import dstep.appkit.NSView; +import dstep.foundation.NSArray; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.appkit.NSPopUpButtonCell_bindings; + +typedef NSUInteger NSPopUpArrowPosition; + +private +{ + NSString NSPopUpButtonCellWillPopUpNotification_; +} + +NSString NSPopUpButtonCellWillPopUpNotification () +{ + if (NSPopUpButtonCellWillPopUpNotification_) + return NSPopUpButtonCellWillPopUpNotification_; + + return NSPopUpButtonCellWillPopUpNotification_ = new NSString(bindings.NSPopUpButtonCellWillPopUpNotification); +} + +enum +{ + NSPopUpNoArrow = 0, + NSPopUpArrowAtCenter = 1, + NSPopUpArrowAtBottom = 2 +} + +class NSPopUpButtonCell : NSMenuItemCell +{ + mixin (ObjcWrap); + + NSPopUpButtonCell initTextCell (NSString stringValue, bool pullDown) + { + id result = invokeObjcSelf!(id, "initTextCell:pullsDown:", NSString, bool)(stringValue, pullDown); + return result is this.objcObject ? this : (result !is null ? new NSPopUpButtonCell(result) : null); + } + + this (NSString stringValue, bool pullDown) + { + super(NSPopUpButtonCell.alloc.initTextCell(stringValue, pullDown).objcObject); + } + + void setMenu (NSMenu menu) + { + return invokeObjcSelf!(void, "setMenu:", NSMenu)(menu); + } + + NSMenu menu () + { + return invokeObjcSelf!(NSMenu, "menu"); + } + + void setPullsDown (bool flag) + { + return invokeObjcSelf!(void, "setPullsDown:", bool)(flag); + } + + bool pullsDown () + { + return invokeObjcSelf!(bool, "pullsDown"); + } + + void setAutoenablesItems (bool flag) + { + return invokeObjcSelf!(void, "setAutoenablesItems:", bool)(flag); + } + + bool autoenablesItems () + { + return invokeObjcSelf!(bool, "autoenablesItems"); + } + + void setPreferredEdge (int edge) + { + return invokeObjcSelf!(void, "setPreferredEdge:", int)(edge); + } + + int preferredEdge () + { + return invokeObjcSelf!(int, "preferredEdge"); + } + + void setUsesItemFromMenu (bool flag) + { + return invokeObjcSelf!(void, "setUsesItemFromMenu:", bool)(flag); + } + + bool usesItemFromMenu () + { + return invokeObjcSelf!(bool, "usesItemFromMenu"); + } + + void setAltersStateOfSelectedItem (bool flag) + { + return invokeObjcSelf!(void, "setAltersStateOfSelectedItem:", bool)(flag); + } + + bool altersStateOfSelectedItem () + { + return invokeObjcSelf!(bool, "altersStateOfSelectedItem"); + } + + void addItemWithTitle (NSString title) + { + return invokeObjcSelf!(void, "addItemWithTitle:", NSString)(title); + } + + void addItemsWithTitles (NSArray itemTitles) + { + return invokeObjcSelf!(void, "addItemsWithTitles:", NSArray)(itemTitles); + } + + void insertItemWithTitle (NSString title, NSInteger index) + { + return invokeObjcSelf!(void, "insertItemWithTitle:atIndex:", NSString, NSInteger)(title, index); + } + + void removeItemWithTitle (NSString title) + { + return invokeObjcSelf!(void, "removeItemWithTitle:", NSString)(title); + } + + void removeItemAtIndex (NSInteger index) + { + return invokeObjcSelf!(void, "removeItemAtIndex:", NSInteger)(index); + } + + void removeAllItems () + { + return invokeObjcSelf!(void, "removeAllItems"); + } + + NSArray itemArray () + { + return invokeObjcSelf!(NSArray, "itemArray"); + } + + NSInteger numberOfItems () + { + return invokeObjcSelf!(NSInteger, "numberOfItems"); + } + + NSInteger indexOfItem (NSMenuItem item) + { + return invokeObjcSelf!(NSInteger, "indexOfItem:", NSMenuItem)(item); + } + + NSInteger indexOfItemWithTitle (NSString title) + { + return invokeObjcSelf!(NSInteger, "indexOfItemWithTitle:", NSString)(title); + } + + NSInteger indexOfItemWithTag (NSInteger tag) + { + return invokeObjcSelf!(NSInteger, "indexOfItemWithTag:", NSInteger)(tag); + } + + NSInteger indexOfItemWithRepresentedObject (Object obj) + { + return invokeObjcSelf!(NSInteger, "indexOfItemWithRepresentedObject:", Object)(obj); + } + + NSInteger indexOfItemWithTarget (Object target, SEL actionSelector) + { + return invokeObjcSelf!(NSInteger, "indexOfItemWithTarget:andAction:", Object, SEL)(target, actionSelector); + } + + NSMenuItem itemAtIndex (NSInteger index) + { + return invokeObjcSelf!(NSMenuItem, "itemAtIndex:", NSInteger)(index); + } + + NSMenuItem itemWithTitle (NSString title) + { + return invokeObjcSelf!(NSMenuItem, "itemWithTitle:", NSString)(title); + } + + NSMenuItem lastItem () + { + return invokeObjcSelf!(NSMenuItem, "lastItem"); + } + + void selectItem (NSMenuItem item) + { + return invokeObjcSelf!(void, "selectItem:", NSMenuItem)(item); + } + + void selectItemAtIndex (NSInteger index) + { + return invokeObjcSelf!(void, "selectItemAtIndex:", NSInteger)(index); + } + + void selectItemWithTitle (NSString title) + { + return invokeObjcSelf!(void, "selectItemWithTitle:", NSString)(title); + } + + bool selectItemWithTag (NSInteger tag) + { + return invokeObjcSelf!(bool, "selectItemWithTag:", NSInteger)(tag); + } + + void setTitle (NSString aString) + { + return invokeObjcSelf!(void, "setTitle:", NSString)(aString); + } + + NSMenuItem selectedItem () + { + return invokeObjcSelf!(NSMenuItem, "selectedItem"); + } + + NSInteger indexOfSelectedItem () + { + return invokeObjcSelf!(NSInteger, "indexOfSelectedItem"); + } + + void synchronizeTitleAndSelectedItem () + { + return invokeObjcSelf!(void, "synchronizeTitleAndSelectedItem"); + } + + NSString itemTitleAtIndex (NSInteger index) + { + return invokeObjcSelf!(NSString, "itemTitleAtIndex:", NSInteger)(index); + } + + NSArray itemTitles () + { + return invokeObjcSelf!(NSArray, "itemTitles"); + } + + NSString titleOfSelectedItem () + { + return invokeObjcSelf!(NSString, "titleOfSelectedItem"); + } + + void attachPopUpWithFrame (NSRect cellFrame, NSView controlView) + { + return invokeObjcSelf!(void, "attachPopUpWithFrame:inView:", NSRect, NSView)(cellFrame, controlView); + } + + void dismissPopUp () + { + return invokeObjcSelf!(void, "dismissPopUp"); + } + + void performClickWithFrame (NSRect frame, NSView controlView) + { + return invokeObjcSelf!(void, "performClickWithFrame:inView:", NSRect, NSView)(frame, controlView); + } + + uint arrowPosition () + { + return invokeObjcSelf!(uint, "arrowPosition"); + } + + void setArrowPosition (uint position) + { + return invokeObjcSelf!(void, "setArrowPosition:", uint)(position); + } + + Object objectValue () + { + return invokeObjcSelf!(Object, "objectValue"); + } + + void setObjectValue (Object obj) + { + return invokeObjcSelf!(void, "setObjectValue:", Object)(obj); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSPopUpButtonCell_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSPopUpButtonCell_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,23 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSPopUpButtonCell_bindings; + +import dstep.appkit.NSMenu; +import dstep.appkit.NSMenuItem; +import dstep.appkit.NSMenuItemCell; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + + +extern (C) +{ + extern + { + package id NSPopUpButtonCellWillPopUpNotification; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSPopUpButton_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSPopUpButton_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,24 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSPopUpButton_bindings; + +import dstep.appkit.NSButton; +import dstep.appkit.NSMenu; +import dstep.appkit.NSMenuItem; +import dstep.appkit.NSMenuItemCell; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + + +extern (C) +{ + extern + { + package id NSPopUpButtonWillPopUpNotification; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSPredicateEditor.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSPredicateEditor.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,28 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSPredicateEditor; + +import dstep.foundation.NSArray; +import dstep.appkit.NSRuleEditor; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSPredicateEditor : NSRuleEditor +{ + mixin (ObjcWrap); + + void setRowTemplates (NSArray rowTemplates) + { + return invokeObjcSelf!(void, "setRowTemplates:", NSArray)(rowTemplates); + } + + NSArray rowTemplates () + { + return invokeObjcSelf!(NSArray, "rowTemplates"); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSPredicateEditorRowTemplate.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSPredicateEditorRowTemplate.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,144 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSPredicateEditorRowTemplate; + +import dstep.foundation.NSArray; +import dstep.coredata.NSAttributeDescription; +import dstep.coredata.NSEntityDescription; +import dstep.foundation.NSCoder; +import dstep.foundation.NSComparisonPredicate; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSPredicate; +import dstep.foundation.NSZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSPredicateEditorRowTemplate : NSObject, INSCoding, INSCopying +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + typeof(this) copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); + } + + double matchForPredicate (NSPredicate predicate) + { + return invokeObjcSelf!(double, "matchForPredicate:", NSPredicate)(predicate); + } + + NSArray templateViews () + { + return invokeObjcSelf!(NSArray, "templateViews"); + } + + void setPredicate (NSPredicate predicate) + { + return invokeObjcSelf!(void, "setPredicate:", NSPredicate)(predicate); + } + + NSPredicate predicateWithSubpredicates (NSArray subpredicates) + { + return invokeObjcSelf!(NSPredicate, "predicateWithSubpredicates:", NSArray)(subpredicates); + } + + NSArray displayableSubpredicatesOfPredicate (NSPredicate predicate) + { + return invokeObjcSelf!(NSArray, "displayableSubpredicatesOfPredicate:", NSPredicate)(predicate); + } + + NSPredicateEditorRowTemplate initWithLeftExpressions (NSArray leftExpressions, NSArray rightExpressions, uint modifier, NSArray operators, NSUInteger options) + { + id result = invokeObjcSelf!(id, "initWithLeftExpressions:rightExpressions:modifier:operators:options:", NSArray, NSArray, uint, NSArray, NSUInteger)(leftExpressions, rightExpressions, modifier, operators, options); + return result is this.objcObject ? this : (result !is null ? new NSPredicateEditorRowTemplate(result) : null); + } + + this (NSArray leftExpressions, NSArray rightExpressions, uint modifier, NSArray operators, NSUInteger options) + { + super(NSPredicateEditorRowTemplate.alloc.initWithLeftExpressions(leftExpressions, rightExpressions, modifier, operators, options).objcObject); + } + + NSPredicateEditorRowTemplate initWithLeftExpressions (NSArray leftExpressions, uint attributeType, uint modifier, NSArray operators, NSUInteger options) + { + id result = invokeObjcSelf!(id, "initWithLeftExpressions:rightExpressionAttributeType:modifier:operators:options:", NSArray, uint, uint, NSArray, NSUInteger)(leftExpressions, attributeType, modifier, operators, options); + return result is this.objcObject ? this : (result !is null ? new NSPredicateEditorRowTemplate(result) : null); + } + + this (NSArray leftExpressions, uint attributeType, uint modifier, NSArray operators, NSUInteger options) + { + super(NSPredicateEditorRowTemplate.alloc.initWithLeftExpressions(leftExpressions, attributeType, modifier, operators, options).objcObject); + } + + NSPredicateEditorRowTemplate initWithCompoundTypes (NSArray compoundTypes) + { + id result = invokeObjcSelf!(id, "initWithCompoundTypes:", NSArray)(compoundTypes); + return result is this.objcObject ? this : (result !is null ? new NSPredicateEditorRowTemplate(result) : null); + } + + this (NSArray compoundTypes) + { + super(NSPredicateEditorRowTemplate.alloc.initWithCompoundTypes(compoundTypes).objcObject); + } + + NSArray leftExpressions () + { + return invokeObjcSelf!(NSArray, "leftExpressions"); + } + + NSArray rightExpressions () + { + return invokeObjcSelf!(NSArray, "rightExpressions"); + } + + uint rightExpressionAttributeType () + { + return invokeObjcSelf!(uint, "rightExpressionAttributeType"); + } + + uint modifier () + { + return invokeObjcSelf!(uint, "modifier"); + } + + NSArray operators () + { + return invokeObjcSelf!(NSArray, "operators"); + } + + NSUInteger options () + { + return invokeObjcSelf!(NSUInteger, "options"); + } + + NSArray compoundTypes () + { + return invokeObjcSelf!(NSArray, "compoundTypes"); + } + + static NSArray templatesWithAttributeKeyPaths (NSArray keyPaths, NSEntityDescription entityDescription) + { + return invokeObjcSelfClass!(NSArray, "templatesWithAttributeKeyPaths:inEntityDescription:", NSArray, NSEntityDescription)(keyPaths, entityDescription); + } + +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSPrintInfo.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSPrintInfo.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,698 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSPrintInfo; + +import dstep.appkit.AppKitDefines; +import dstep.appkit.NSPrinter; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSCoder; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.appkit.NSPrintInfo_bindings; + +typedef NSUInteger NSPrintingOrientation; +typedef NSUInteger NSPrintingPaginationMode; + +private +{ + NSString NSPrintSpoolJob_; + NSString NSPrintPreviewJob_; + NSString NSPrintSaveJob_; + NSString NSPrintCancelJob_; + NSString NSPrintPaperName_; + NSString NSPrintPaperSize_; + NSString NSPrintOrientation_; + NSString NSPrintScalingFactor_; + NSString NSPrintLeftMargin_; + NSString NSPrintRightMargin_; + NSString NSPrintTopMargin_; + NSString NSPrintBottomMargin_; + NSString NSPrintHorizontallyCentered_; + NSString NSPrintVerticallyCentered_; + NSString NSPrintHorizontalPagination_; + NSString NSPrintVerticalPagination_; + NSString NSPrintPrinter_; + NSString NSPrintCopies_; + NSString NSPrintAllPages_; + NSString NSPrintFirstPage_; + NSString NSPrintLastPage_; + NSString NSPrintMustCollate_; + NSString NSPrintReversePageOrder_; + NSString NSPrintJobDisposition_; + NSString NSPrintSavePath_; + NSString NSPrintPagesAcross_; + NSString NSPrintPagesDown_; + NSString NSPrintTime_; + NSString NSPrintDetailedErrorReporting_; + NSString NSPrintFaxNumber_; + NSString NSPrintPrinterName_; + NSString NSPrintHeaderAndFooter_; + NSString NSPrintFormName_; + NSString NSPrintJobFeatures_; + NSString NSPrintManualFeed_; + NSString NSPrintPagesPerSheet_; + NSString NSPrintPaperFeed_; + NSString NSPrintFaxCoverSheetName_; + NSString NSPrintFaxHighResolution_; + NSString NSPrintFaxModem_; + NSString NSPrintFaxReceiverNames_; + NSString NSPrintFaxReceiverNumbers_; + NSString NSPrintFaxReturnReceipt_; + NSString NSPrintFaxSendTime_; + NSString NSPrintFaxTrimPageEnds_; + NSString NSPrintFaxUseCoverSheet_; + NSString NSPrintFaxJob_; +} + +NSString NSPrintSpoolJob () +{ + if (NSPrintSpoolJob_) + return NSPrintSpoolJob_; + + return NSPrintSpoolJob_ = new NSString(bindings.NSPrintSpoolJob); +} + +NSString NSPrintPreviewJob () +{ + if (NSPrintPreviewJob_) + return NSPrintPreviewJob_; + + return NSPrintPreviewJob_ = new NSString(bindings.NSPrintPreviewJob); +} + +NSString NSPrintSaveJob () +{ + if (NSPrintSaveJob_) + return NSPrintSaveJob_; + + return NSPrintSaveJob_ = new NSString(bindings.NSPrintSaveJob); +} + +NSString NSPrintCancelJob () +{ + if (NSPrintCancelJob_) + return NSPrintCancelJob_; + + return NSPrintCancelJob_ = new NSString(bindings.NSPrintCancelJob); +} + +NSString NSPrintPaperName () +{ + if (NSPrintPaperName_) + return NSPrintPaperName_; + + return NSPrintPaperName_ = new NSString(bindings.NSPrintPaperName); +} + +NSString NSPrintPaperSize () +{ + if (NSPrintPaperSize_) + return NSPrintPaperSize_; + + return NSPrintPaperSize_ = new NSString(bindings.NSPrintPaperSize); +} + +NSString NSPrintOrientation () +{ + if (NSPrintOrientation_) + return NSPrintOrientation_; + + return NSPrintOrientation_ = new NSString(bindings.NSPrintOrientation); +} + +NSString NSPrintScalingFactor () +{ + if (NSPrintScalingFactor_) + return NSPrintScalingFactor_; + + return NSPrintScalingFactor_ = new NSString(bindings.NSPrintScalingFactor); +} + +NSString NSPrintLeftMargin () +{ + if (NSPrintLeftMargin_) + return NSPrintLeftMargin_; + + return NSPrintLeftMargin_ = new NSString(bindings.NSPrintLeftMargin); +} + +NSString NSPrintRightMargin () +{ + if (NSPrintRightMargin_) + return NSPrintRightMargin_; + + return NSPrintRightMargin_ = new NSString(bindings.NSPrintRightMargin); +} + +NSString NSPrintTopMargin () +{ + if (NSPrintTopMargin_) + return NSPrintTopMargin_; + + return NSPrintTopMargin_ = new NSString(bindings.NSPrintTopMargin); +} + +NSString NSPrintBottomMargin () +{ + if (NSPrintBottomMargin_) + return NSPrintBottomMargin_; + + return NSPrintBottomMargin_ = new NSString(bindings.NSPrintBottomMargin); +} + +NSString NSPrintHorizontallyCentered () +{ + if (NSPrintHorizontallyCentered_) + return NSPrintHorizontallyCentered_; + + return NSPrintHorizontallyCentered_ = new NSString(bindings.NSPrintHorizontallyCentered); +} + +NSString NSPrintVerticallyCentered () +{ + if (NSPrintVerticallyCentered_) + return NSPrintVerticallyCentered_; + + return NSPrintVerticallyCentered_ = new NSString(bindings.NSPrintVerticallyCentered); +} + +NSString NSPrintHorizontalPagination () +{ + if (NSPrintHorizontalPagination_) + return NSPrintHorizontalPagination_; + + return NSPrintHorizontalPagination_ = new NSString(bindings.NSPrintHorizontalPagination); +} + +NSString NSPrintVerticalPagination () +{ + if (NSPrintVerticalPagination_) + return NSPrintVerticalPagination_; + + return NSPrintVerticalPagination_ = new NSString(bindings.NSPrintVerticalPagination); +} + +NSString NSPrintPrinter () +{ + if (NSPrintPrinter_) + return NSPrintPrinter_; + + return NSPrintPrinter_ = new NSString(bindings.NSPrintPrinter); +} + +NSString NSPrintCopies () +{ + if (NSPrintCopies_) + return NSPrintCopies_; + + return NSPrintCopies_ = new NSString(bindings.NSPrintCopies); +} + +NSString NSPrintAllPages () +{ + if (NSPrintAllPages_) + return NSPrintAllPages_; + + return NSPrintAllPages_ = new NSString(bindings.NSPrintAllPages); +} + +NSString NSPrintFirstPage () +{ + if (NSPrintFirstPage_) + return NSPrintFirstPage_; + + return NSPrintFirstPage_ = new NSString(bindings.NSPrintFirstPage); +} + +NSString NSPrintLastPage () +{ + if (NSPrintLastPage_) + return NSPrintLastPage_; + + return NSPrintLastPage_ = new NSString(bindings.NSPrintLastPage); +} + +NSString NSPrintMustCollate () +{ + if (NSPrintMustCollate_) + return NSPrintMustCollate_; + + return NSPrintMustCollate_ = new NSString(bindings.NSPrintMustCollate); +} + +NSString NSPrintReversePageOrder () +{ + if (NSPrintReversePageOrder_) + return NSPrintReversePageOrder_; + + return NSPrintReversePageOrder_ = new NSString(bindings.NSPrintReversePageOrder); +} + +NSString NSPrintJobDisposition () +{ + if (NSPrintJobDisposition_) + return NSPrintJobDisposition_; + + return NSPrintJobDisposition_ = new NSString(bindings.NSPrintJobDisposition); +} + +NSString NSPrintSavePath () +{ + if (NSPrintSavePath_) + return NSPrintSavePath_; + + return NSPrintSavePath_ = new NSString(bindings.NSPrintSavePath); +} + +NSString NSPrintPagesAcross () +{ + if (NSPrintPagesAcross_) + return NSPrintPagesAcross_; + + return NSPrintPagesAcross_ = new NSString(bindings.NSPrintPagesAcross); +} + +NSString NSPrintPagesDown () +{ + if (NSPrintPagesDown_) + return NSPrintPagesDown_; + + return NSPrintPagesDown_ = new NSString(bindings.NSPrintPagesDown); +} + +NSString NSPrintTime () +{ + if (NSPrintTime_) + return NSPrintTime_; + + return NSPrintTime_ = new NSString(bindings.NSPrintTime); +} + +NSString NSPrintDetailedErrorReporting () +{ + if (NSPrintDetailedErrorReporting_) + return NSPrintDetailedErrorReporting_; + + return NSPrintDetailedErrorReporting_ = new NSString(bindings.NSPrintDetailedErrorReporting); +} + +NSString NSPrintFaxNumber () +{ + if (NSPrintFaxNumber_) + return NSPrintFaxNumber_; + + return NSPrintFaxNumber_ = new NSString(bindings.NSPrintFaxNumber); +} + +NSString NSPrintPrinterName () +{ + if (NSPrintPrinterName_) + return NSPrintPrinterName_; + + return NSPrintPrinterName_ = new NSString(bindings.NSPrintPrinterName); +} + +NSString NSPrintHeaderAndFooter () +{ + if (NSPrintHeaderAndFooter_) + return NSPrintHeaderAndFooter_; + + return NSPrintHeaderAndFooter_ = new NSString(bindings.NSPrintHeaderAndFooter); +} + +NSString NSPrintFormName () +{ + if (NSPrintFormName_) + return NSPrintFormName_; + + return NSPrintFormName_ = new NSString(bindings.NSPrintFormName); +} + +NSString NSPrintJobFeatures () +{ + if (NSPrintJobFeatures_) + return NSPrintJobFeatures_; + + return NSPrintJobFeatures_ = new NSString(bindings.NSPrintJobFeatures); +} + +NSString NSPrintManualFeed () +{ + if (NSPrintManualFeed_) + return NSPrintManualFeed_; + + return NSPrintManualFeed_ = new NSString(bindings.NSPrintManualFeed); +} + +NSString NSPrintPagesPerSheet () +{ + if (NSPrintPagesPerSheet_) + return NSPrintPagesPerSheet_; + + return NSPrintPagesPerSheet_ = new NSString(bindings.NSPrintPagesPerSheet); +} + +NSString NSPrintPaperFeed () +{ + if (NSPrintPaperFeed_) + return NSPrintPaperFeed_; + + return NSPrintPaperFeed_ = new NSString(bindings.NSPrintPaperFeed); +} + +NSString NSPrintFaxCoverSheetName () +{ + if (NSPrintFaxCoverSheetName_) + return NSPrintFaxCoverSheetName_; + + return NSPrintFaxCoverSheetName_ = new NSString(bindings.NSPrintFaxCoverSheetName); +} + +NSString NSPrintFaxHighResolution () +{ + if (NSPrintFaxHighResolution_) + return NSPrintFaxHighResolution_; + + return NSPrintFaxHighResolution_ = new NSString(bindings.NSPrintFaxHighResolution); +} + +NSString NSPrintFaxModem () +{ + if (NSPrintFaxModem_) + return NSPrintFaxModem_; + + return NSPrintFaxModem_ = new NSString(bindings.NSPrintFaxModem); +} + +NSString NSPrintFaxReceiverNames () +{ + if (NSPrintFaxReceiverNames_) + return NSPrintFaxReceiverNames_; + + return NSPrintFaxReceiverNames_ = new NSString(bindings.NSPrintFaxReceiverNames); +} + +NSString NSPrintFaxReceiverNumbers () +{ + if (NSPrintFaxReceiverNumbers_) + return NSPrintFaxReceiverNumbers_; + + return NSPrintFaxReceiverNumbers_ = new NSString(bindings.NSPrintFaxReceiverNumbers); +} + +NSString NSPrintFaxReturnReceipt () +{ + if (NSPrintFaxReturnReceipt_) + return NSPrintFaxReturnReceipt_; + + return NSPrintFaxReturnReceipt_ = new NSString(bindings.NSPrintFaxReturnReceipt); +} + +NSString NSPrintFaxSendTime () +{ + if (NSPrintFaxSendTime_) + return NSPrintFaxSendTime_; + + return NSPrintFaxSendTime_ = new NSString(bindings.NSPrintFaxSendTime); +} + +NSString NSPrintFaxTrimPageEnds () +{ + if (NSPrintFaxTrimPageEnds_) + return NSPrintFaxTrimPageEnds_; + + return NSPrintFaxTrimPageEnds_ = new NSString(bindings.NSPrintFaxTrimPageEnds); +} + +NSString NSPrintFaxUseCoverSheet () +{ + if (NSPrintFaxUseCoverSheet_) + return NSPrintFaxUseCoverSheet_; + + return NSPrintFaxUseCoverSheet_ = new NSString(bindings.NSPrintFaxUseCoverSheet); +} + +NSString NSPrintFaxJob () +{ + if (NSPrintFaxJob_) + return NSPrintFaxJob_; + + return NSPrintFaxJob_ = new NSString(bindings.NSPrintFaxJob); +} + +enum : NSUInteger +{ + NSPortraitOrientation = 0, + NSLandscapeOrientation = 1 +} + +enum : NSUInteger +{ + NSAutoPagination = 0, + NSFitPagination = 1, + NSClipPagination = 2 +} + +class NSPrintInfo : NSObject, INSCopying, INSCoding +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + typeof(this) copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); + } + + static void setSharedPrintInfo (NSPrintInfo printInfo) + { + return invokeObjcSelfClass!(void, "setSharedPrintInfo:", NSPrintInfo)(printInfo); + } + + static NSPrintInfo sharedPrintInfo () + { + return invokeObjcSelfClass!(NSPrintInfo, "sharedPrintInfo"); + } + + NSPrintInfo initWithDictionary (NSDictionary attributes) + { + id result = invokeObjcSelf!(id, "initWithDictionary:", NSDictionary)(attributes); + return result is this.objcObject ? this : (result !is null ? new NSPrintInfo(result) : null); + } + + this (NSDictionary attributes) + { + super(NSPrintInfo.alloc.initWithDictionary(attributes).objcObject); + } + + NSMutableDictionary dictionary () + { + return invokeObjcSelf!(NSMutableDictionary, "dictionary"); + } + + void setPaperName (NSString name) + { + return invokeObjcSelf!(void, "setPaperName:", NSString)(name); + } + + void setPaperSize (NSSize size) + { + return invokeObjcSelf!(void, "setPaperSize:", NSSize)(size); + } + + void setOrientation (uint orientation) + { + return invokeObjcSelf!(void, "setOrientation:", uint)(orientation); + } + + NSString paperName () + { + return invokeObjcSelf!(NSString, "paperName"); + } + + NSSize paperSize () + { + return invokeObjcSelf!(NSSize, "paperSize"); + } + + uint orientation () + { + return invokeObjcSelf!(uint, "orientation"); + } + + void setLeftMargin (CGFloat margin) + { + return invokeObjcSelf!(void, "setLeftMargin:", CGFloat)(margin); + } + + void setRightMargin (CGFloat margin) + { + return invokeObjcSelf!(void, "setRightMargin:", CGFloat)(margin); + } + + void setTopMargin (CGFloat margin) + { + return invokeObjcSelf!(void, "setTopMargin:", CGFloat)(margin); + } + + void setBottomMargin (CGFloat margin) + { + return invokeObjcSelf!(void, "setBottomMargin:", CGFloat)(margin); + } + + CGFloat leftMargin () + { + return invokeObjcSelf!(CGFloat, "leftMargin"); + } + + CGFloat rightMargin () + { + return invokeObjcSelf!(CGFloat, "rightMargin"); + } + + CGFloat topMargin () + { + return invokeObjcSelf!(CGFloat, "topMargin"); + } + + CGFloat bottomMargin () + { + return invokeObjcSelf!(CGFloat, "bottomMargin"); + } + + void setHorizontallyCentered (bool flag) + { + return invokeObjcSelf!(void, "setHorizontallyCentered:", bool)(flag); + } + + void setVerticallyCentered (bool flag) + { + return invokeObjcSelf!(void, "setVerticallyCentered:", bool)(flag); + } + + bool isHorizontallyCentered () + { + return invokeObjcSelf!(bool, "isHorizontallyCentered"); + } + + bool isVerticallyCentered () + { + return invokeObjcSelf!(bool, "isVerticallyCentered"); + } + + void setHorizontalPagination (uint mode) + { + return invokeObjcSelf!(void, "setHorizontalPagination:", uint)(mode); + } + + void setVerticalPagination (uint mode) + { + return invokeObjcSelf!(void, "setVerticalPagination:", uint)(mode); + } + + uint horizontalPagination () + { + return invokeObjcSelf!(uint, "horizontalPagination"); + } + + uint verticalPagination () + { + return invokeObjcSelf!(uint, "verticalPagination"); + } + + void setJobDisposition (NSString disposition) + { + return invokeObjcSelf!(void, "setJobDisposition:", NSString)(disposition); + } + + NSString jobDisposition () + { + return invokeObjcSelf!(NSString, "jobDisposition"); + } + + void setPrinter (NSPrinter printer) + { + return invokeObjcSelf!(void, "setPrinter:", NSPrinter)(printer); + } + + NSPrinter printer () + { + return invokeObjcSelf!(NSPrinter, "printer"); + } + + void setUpPrintOperationDefaultValues () + { + return invokeObjcSelf!(void, "setUpPrintOperationDefaultValues"); + } + + NSRect imageablePageBounds () + { + return invokeObjcSelf!(NSRect, "imageablePageBounds"); + } + + NSString localizedPaperName () + { + return invokeObjcSelf!(NSString, "localizedPaperName"); + } + + static NSPrinter defaultPrinter () + { + return invokeObjcSelfClass!(NSPrinter, "defaultPrinter"); + } + + NSMutableDictionary printSettings () + { + return invokeObjcSelf!(NSMutableDictionary, "printSettings"); + } + + void* PMPrintSession () + { + return invokeObjcSelf!(void*, "PMPrintSession"); + } + + void* PMPageFormat () + { + return invokeObjcSelf!(void*, "PMPageFormat"); + } + + void* PMPrintSettings () + { + return invokeObjcSelf!(void*, "PMPrintSettings"); + } + + void updateFromPMPageFormat () + { + return invokeObjcSelf!(void, "updateFromPMPageFormat"); + } + + void updateFromPMPrintSettings () + { + return invokeObjcSelf!(void, "updateFromPMPrintSettings"); + } + +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSPrintInfo_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSPrintInfo_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,64 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSPrintInfo_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package id NSPrintSpoolJob; + package id NSPrintPreviewJob; + package id NSPrintSaveJob; + package id NSPrintCancelJob; + package id NSPrintPaperName; + package id NSPrintPaperSize; + package id NSPrintOrientation; + package id NSPrintScalingFactor; + package id NSPrintLeftMargin; + package id NSPrintRightMargin; + package id NSPrintTopMargin; + package id NSPrintBottomMargin; + package id NSPrintHorizontallyCentered; + package id NSPrintVerticallyCentered; + package id NSPrintHorizontalPagination; + package id NSPrintVerticalPagination; + package id NSPrintPrinter; + package id NSPrintCopies; + package id NSPrintAllPages; + package id NSPrintFirstPage; + package id NSPrintLastPage; + package id NSPrintMustCollate; + package id NSPrintReversePageOrder; + package id NSPrintJobDisposition; + package id NSPrintSavePath; + package id NSPrintPagesAcross; + package id NSPrintPagesDown; + package id NSPrintTime; + package id NSPrintDetailedErrorReporting; + package id NSPrintFaxNumber; + package id NSPrintPrinterName; + package id NSPrintHeaderAndFooter; + package id NSPrintFormName; + package id NSPrintJobFeatures; + package id NSPrintManualFeed; + package id NSPrintPagesPerSheet; + package id NSPrintPaperFeed; + package id NSPrintFaxCoverSheetName; + package id NSPrintFaxHighResolution; + package id NSPrintFaxModem; + package id NSPrintFaxReceiverNames; + package id NSPrintFaxReceiverNumbers; + package id NSPrintFaxReturnReceipt; + package id NSPrintFaxSendTime; + package id NSPrintFaxTrimPageEnds; + package id NSPrintFaxUseCoverSheet; + package id NSPrintFaxJob; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSPrintOperation.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSPrintOperation.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,228 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSPrintOperation; + +import dstep.appkit.AppKitDefines; +import dstep.appkit.NSGraphicsContext; +import dstep.appkit.NSPrintInfo; +import dstep.appkit.NSPrintPanel; +import dstep.appkit.NSView; +import dstep.appkit.NSWindow; +import dstep.foundation.NSData; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSRange; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.appkit.NSPrintOperation_bindings; + +alias NSInteger NSPrintingPageOrder; + +private +{ + NSString NSPrintOperationExistsException_; +} + +NSString NSPrintOperationExistsException () +{ + if (NSPrintOperationExistsException_) + return NSPrintOperationExistsException_; + + return NSPrintOperationExistsException_ = new NSString(bindings.NSPrintOperationExistsException); +} + +enum +{ + NSDescendingPageOrder = -1, + NSSpecialPageOrder = 0, + NSAscendingPageOrder = 1, + NSUnknownPageOrder = 2 +} + +class NSPrintOperation : NSObject +{ + mixin (ObjcWrap); + + static NSPrintOperation printOperationWithView (NSView view, NSPrintInfo printInfo) + { + return invokeObjcSelfClass!(NSPrintOperation, "printOperationWithView:printInfo:", NSView, NSPrintInfo)(view, printInfo); + } + + static NSPrintOperation PDFOperationWithView (NSView view, NSRect rect, NSMutableData data, NSPrintInfo printInfo) + { + return invokeObjcSelfClass!(NSPrintOperation, "PDFOperationWithView:insideRect:toData:printInfo:", NSView, NSRect, NSMutableData, NSPrintInfo)(view, rect, data, printInfo); + } + + static NSPrintOperation PDFOperationWithView (NSView view, NSRect rect, NSString path, NSPrintInfo printInfo) + { + return invokeObjcSelfClass!(NSPrintOperation, "PDFOperationWithView:insideRect:toPath:printInfo:", NSView, NSRect, NSString, NSPrintInfo)(view, rect, path, printInfo); + } + + static NSPrintOperation EPSOperationWithView (NSView view, NSRect rect, NSMutableData data, NSPrintInfo printInfo) + { + return invokeObjcSelfClass!(NSPrintOperation, "EPSOperationWithView:insideRect:toData:printInfo:", NSView, NSRect, NSMutableData, NSPrintInfo)(view, rect, data, printInfo); + } + + static NSPrintOperation EPSOperationWithView (NSView view, NSRect rect, NSString path, NSPrintInfo printInfo) + { + return invokeObjcSelfClass!(NSPrintOperation, "EPSOperationWithView:insideRect:toPath:printInfo:", NSView, NSRect, NSString, NSPrintInfo)(view, rect, path, printInfo); + } + + static NSPrintOperation printOperationWithView (NSView view) + { + return invokeObjcSelfClass!(NSPrintOperation, "printOperationWithView:", NSView)(view); + } + + static NSPrintOperation PDFOperationWithView (NSView view, NSRect rect, NSMutableData data) + { + return invokeObjcSelfClass!(NSPrintOperation, "PDFOperationWithView:insideRect:toData:", NSView, NSRect, NSMutableData)(view, rect, data); + } + + static NSPrintOperation EPSOperationWithView (NSView view, NSRect rect, NSMutableData data) + { + return invokeObjcSelfClass!(NSPrintOperation, "EPSOperationWithView:insideRect:toData:", NSView, NSRect, NSMutableData)(view, rect, data); + } + + static NSPrintOperation currentOperation () + { + return invokeObjcSelfClass!(NSPrintOperation, "currentOperation"); + } + + static void setCurrentOperation (NSPrintOperation operation) + { + return invokeObjcSelfClass!(void, "setCurrentOperation:", NSPrintOperation)(operation); + } + + bool isCopyingOperation () + { + return invokeObjcSelf!(bool, "isCopyingOperation"); + } + + void setJobTitle (NSString jobTitle) + { + return invokeObjcSelf!(void, "setJobTitle:", NSString)(jobTitle); + } + + NSString jobTitle () + { + return invokeObjcSelf!(NSString, "jobTitle"); + } + + void setShowsPrintPanel (bool flag) + { + return invokeObjcSelf!(void, "setShowsPrintPanel:", bool)(flag); + } + + bool showsPrintPanel () + { + return invokeObjcSelf!(bool, "showsPrintPanel"); + } + + void setShowsProgressPanel (bool flag) + { + return invokeObjcSelf!(void, "setShowsProgressPanel:", bool)(flag); + } + + bool showsProgressPanel () + { + return invokeObjcSelf!(bool, "showsProgressPanel"); + } + + void setPrintPanel (NSPrintPanel panel) + { + return invokeObjcSelf!(void, "setPrintPanel:", NSPrintPanel)(panel); + } + + NSPrintPanel printPanel () + { + return invokeObjcSelf!(NSPrintPanel, "printPanel"); + } + + void setCanSpawnSeparateThread (bool canSpawnSeparateThread) + { + return invokeObjcSelf!(void, "setCanSpawnSeparateThread:", bool)(canSpawnSeparateThread); + } + + bool canSpawnSeparateThread () + { + return invokeObjcSelf!(bool, "canSpawnSeparateThread"); + } + + void setPageOrder (int pageOrder) + { + return invokeObjcSelf!(void, "setPageOrder:", int)(pageOrder); + } + + int pageOrder () + { + return invokeObjcSelf!(int, "pageOrder"); + } + + void runOperationModalForWindow (NSWindow docWindow, Object delegate_, SEL didRunSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "runOperationModalForWindow:delegate:didRunSelector:contextInfo:", NSWindow, Object, SEL, void*)(docWindow, delegate_, didRunSelector, contextInfo); + } + + bool runOperation () + { + return invokeObjcSelf!(bool, "runOperation"); + } + + NSView view () + { + return invokeObjcSelf!(NSView, "view"); + } + + NSPrintInfo printInfo () + { + return invokeObjcSelf!(NSPrintInfo, "printInfo"); + } + + void setPrintInfo (NSPrintInfo printInfo) + { + return invokeObjcSelf!(void, "setPrintInfo:", NSPrintInfo)(printInfo); + } + + NSGraphicsContext context () + { + return invokeObjcSelf!(NSGraphicsContext, "context"); + } + + NSRange pageRange () + { + return invokeObjcSelf!(NSRange, "pageRange"); + } + + NSInteger currentPage () + { + return invokeObjcSelf!(NSInteger, "currentPage"); + } + + NSGraphicsContext createContext () + { + return invokeObjcSelf!(NSGraphicsContext, "createContext"); + } + + void destroyContext () + { + return invokeObjcSelf!(void, "destroyContext"); + } + + bool deliverResult () + { + return invokeObjcSelf!(bool, "deliverResult"); + } + + void cleanUpOperation () + { + return invokeObjcSelf!(void, "cleanUpOperation"); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSPrintOperation_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSPrintOperation_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,17 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSPrintOperation_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package id NSPrintOperationExistsException; + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSPrintPanel.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSPrintPanel.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,159 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSPrintPanel; + +import dstep.appkit.AppKitDefines; +import dstep.appkit.NSPrintInfo; +import dstep.appkit.NSView; +import dstep.appkit.NSViewController; +import dstep.appkit.NSWindow; +import dstep.appkit.NSWindowController; +import dstep.foundation.NSArray; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSSet; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.appkit.NSPrintPanel_bindings; + +typedef NSInteger NSPrintPanelOptions; + +private +{ + NSString NSPrintPhotoJobStyleHint_; + NSString NSPrintPanelAccessorySummaryItemNameKey_; + NSString NSPrintPanelAccessorySummaryItemDescriptionKey_; +} + +NSString NSPrintPhotoJobStyleHint () +{ + if (NSPrintPhotoJobStyleHint_) + return NSPrintPhotoJobStyleHint_; + + return NSPrintPhotoJobStyleHint_ = new NSString(bindings.NSPrintPhotoJobStyleHint); +} + +NSString NSPrintPanelAccessorySummaryItemNameKey () +{ + if (NSPrintPanelAccessorySummaryItemNameKey_) + return NSPrintPanelAccessorySummaryItemNameKey_; + + return NSPrintPanelAccessorySummaryItemNameKey_ = new NSString(bindings.NSPrintPanelAccessorySummaryItemNameKey); +} + +NSString NSPrintPanelAccessorySummaryItemDescriptionKey () +{ + if (NSPrintPanelAccessorySummaryItemDescriptionKey_) + return NSPrintPanelAccessorySummaryItemDescriptionKey_; + + return NSPrintPanelAccessorySummaryItemDescriptionKey_ = new NSString(bindings.NSPrintPanelAccessorySummaryItemDescriptionKey); +} + +enum : NSInteger +{ + NSPrintPanelShowsCopies = 0x01, + NSPrintPanelShowsPageRange = 0x02, + NSPrintPanelShowsPaperSize = 0x04, + NSPrintPanelShowsOrientation = 0x08, + NSPrintPanelShowsScaling = 0x10, + NSPrintPanelShowsPageSetupAccessory = 0x100, + NSPrintPanelShowsPreview = 0x20000 +} + +class NSPrintPanel : NSObject +{ + mixin (ObjcWrap); + + static NSPrintPanel printPanel () + { + return invokeObjcSelfClass!(NSPrintPanel, "printPanel"); + } + + void addAccessoryController (INSPrintPanelAccessorizing accessoryController) + { + return invokeObjcSelf!(void, "addAccessoryController:", INSPrintPanelAccessorizing)(accessoryController); + } + + void removeAccessoryController (INSPrintPanelAccessorizing accessoryController) + { + return invokeObjcSelf!(void, "removeAccessoryController:", INSPrintPanelAccessorizing)(accessoryController); + } + + NSArray accessoryControllers () + { + return invokeObjcSelf!(NSArray, "accessoryControllers"); + } + + void setOptions (int options) + { + return invokeObjcSelf!(void, "setOptions:", int)(options); + } + + int options () + { + return invokeObjcSelf!(int, "options"); + } + + void setDefaultButtonTitle (NSString defaultButtonTitle) + { + return invokeObjcSelf!(void, "setDefaultButtonTitle:", NSString)(defaultButtonTitle); + } + + NSString defaultButtonTitle () + { + return invokeObjcSelf!(NSString, "defaultButtonTitle"); + } + + void setHelpAnchor (NSString helpAnchor) + { + return invokeObjcSelf!(void, "setHelpAnchor:", NSString)(helpAnchor); + } + + NSString helpAnchor () + { + return invokeObjcSelf!(NSString, "helpAnchor"); + } + + void setJobStyleHint (NSString hint) + { + return invokeObjcSelf!(void, "setJobStyleHint:", NSString)(hint); + } + + NSString jobStyleHint () + { + return invokeObjcSelf!(NSString, "jobStyleHint"); + } + + void beginSheetWithPrintInfo (NSPrintInfo printInfo, NSWindow docWindow, Object delegate_, SEL didEndSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "beginSheetWithPrintInfo:modalForWindow:delegate:didEndSelector:contextInfo:", NSPrintInfo, NSWindow, Object, SEL, void*)(printInfo, docWindow, delegate_, didEndSelector, contextInfo); + } + + NSInteger runModalWithPrintInfo (NSPrintInfo printInfo) + { + return invokeObjcSelf!(NSInteger, "runModalWithPrintInfo:", NSPrintInfo)(printInfo); + } + + NSInteger runModal () + { + return invokeObjcSelf!(NSInteger, "runModal"); + } + + NSPrintInfo printInfo () + { + return invokeObjcSelf!(NSPrintInfo, "printInfo"); + } +} + +interface INSPrintPanelAccessorizing +{ + NSArray localizedSummaryItems (); + NSSet keyPathsForValuesAffectingPreview (); +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSPrintPanel_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSPrintPanel_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,20 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSPrintPanel_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package id NSPrintPhotoJobStyleHint; + package id NSPrintPanelAccessorySummaryItemNameKey; + package id NSPrintPanelAccessorySummaryItemDescriptionKey; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSPrinter.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSPrinter.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,144 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSPrinter; + +import dstep.foundation.NSArray; +import dstep.foundation.NSCoder; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSString; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +typedef NSUInteger NSPrinterTableStatus; + +enum : NSUInteger +{ + NSPrinterTableOK = 0, + NSPrinterTableNotFound = 1, + NSPrinterTableError = 2 +} + +class NSPrinter : NSObject, INSCopying, INSCoding +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + typeof(this) copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); + } + + static NSArray printerNames () + { + return invokeObjcSelfClass!(NSArray, "printerNames"); + } + + static NSArray printerTypes () + { + return invokeObjcSelfClass!(NSArray, "printerTypes"); + } + + static NSPrinter printerWithName (NSString name) + { + return invokeObjcSelfClass!(NSPrinter, "printerWithName:", NSString)(name); + } + + static NSPrinter printerWithType (NSString type) + { + return invokeObjcSelfClass!(NSPrinter, "printerWithType:", NSString)(type); + } + + NSString name () + { + return invokeObjcSelf!(NSString, "name"); + } + + NSString type () + { + return invokeObjcSelf!(NSString, "type"); + } + + NSInteger languageLevel () + { + return invokeObjcSelf!(NSInteger, "languageLevel"); + } + + NSSize pageSizeForPaper (NSString paperName) + { + return invokeObjcSelf!(NSSize, "pageSizeForPaper:", NSString)(paperName); + } + + uint statusForTable (NSString tableName) + { + return invokeObjcSelf!(uint, "statusForTable:", NSString)(tableName); + } + + bool isKey (NSString key, NSString table) + { + return invokeObjcSelf!(bool, "isKey:inTable:", NSString, NSString)(key, table); + } + + bool booleanForKey (NSString key, NSString table) + { + return invokeObjcSelf!(bool, "booleanForKey:inTable:", NSString, NSString)(key, table); + } + + float floatForKey (NSString key, NSString table) + { + return invokeObjcSelf!(float, "floatForKey:inTable:", NSString, NSString)(key, table); + } + + int intForKey (NSString key, NSString table) + { + return invokeObjcSelf!(int, "intForKey:inTable:", NSString, NSString)(key, table); + } + + NSRect rectForKey (NSString key, NSString table) + { + return invokeObjcSelf!(NSRect, "rectForKey:inTable:", NSString, NSString)(key, table); + } + + NSSize sizeForKey (NSString key, NSString table) + { + return invokeObjcSelf!(NSSize, "sizeForKey:inTable:", NSString, NSString)(key, table); + } + + NSString stringForKey (NSString key, NSString table) + { + return invokeObjcSelf!(NSString, "stringForKey:inTable:", NSString, NSString)(key, table); + } + + NSArray stringListForKey (NSString key, NSString table) + { + return invokeObjcSelf!(NSArray, "stringListForKey:inTable:", NSString, NSString)(key, table); + } + + NSDictionary deviceDescription () + { + return invokeObjcSelf!(NSDictionary, "deviceDescription"); + } + +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSProgressIndicator.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSProgressIndicator.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,175 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSProgressIndicator; + +import dstep.appkit.NSCell; +import dstep.appkit.NSView; +import dstep.foundation.NSDate; +import dstep.foundation.NSObjCRuntime; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +struct __NSProgressIndicatorThreadInfo; + +alias __NSProgressIndicatorThreadInfo _NSProgressIndicatorThreadInfo; +typedef NSUInteger NSProgressIndicatorThickness; +typedef NSUInteger NSProgressIndicatorStyle; + +enum +{ + NSProgressIndicatorPreferredThickness = 14, + NSProgressIndicatorPreferredSmallThickness = 10, + NSProgressIndicatorPreferredLargeThickness = 18, + NSProgressIndicatorPreferredAquaThickness = 12 +} + +enum +{ + NSProgressIndicatorBarStyle = 0, + NSProgressIndicatorSpinningStyle = 1 +} + +class NSProgressIndicator : NSView +{ + mixin (ObjcWrap); + + bool isIndeterminate () + { + return invokeObjcSelf!(bool, "isIndeterminate"); + } + + void setIndeterminate (bool flag) + { + return invokeObjcSelf!(void, "setIndeterminate:", bool)(flag); + } + + bool isBezeled () + { + return invokeObjcSelf!(bool, "isBezeled"); + } + + void setBezeled (bool flag) + { + return invokeObjcSelf!(void, "setBezeled:", bool)(flag); + } + + uint controlTint () + { + return invokeObjcSelf!(uint, "controlTint"); + } + + void setControlTint (uint tint) + { + return invokeObjcSelf!(void, "setControlTint:", uint)(tint); + } + + uint controlSize () + { + return invokeObjcSelf!(uint, "controlSize"); + } + + void setControlSize (uint size) + { + return invokeObjcSelf!(void, "setControlSize:", uint)(size); + } + + double doubleValue () + { + return invokeObjcSelf!(double, "doubleValue"); + } + + void setDoubleValue (double doubleValue) + { + return invokeObjcSelf!(void, "setDoubleValue:", double)(doubleValue); + } + + void incrementBy (double delta) + { + return invokeObjcSelf!(void, "incrementBy:", double)(delta); + } + + double minValue () + { + return invokeObjcSelf!(double, "minValue"); + } + + double maxValue () + { + return invokeObjcSelf!(double, "maxValue"); + } + + void setMinValue (double newMinimum) + { + return invokeObjcSelf!(void, "setMinValue:", double)(newMinimum); + } + + void setMaxValue (double newMaximum) + { + return invokeObjcSelf!(void, "setMaxValue:", double)(newMaximum); + } + + double animationDelay () + { + return invokeObjcSelf!(double, "animationDelay"); + } + + void setAnimationDelay (double delay) + { + return invokeObjcSelf!(void, "setAnimationDelay:", double)(delay); + } + + bool usesThreadedAnimation () + { + return invokeObjcSelf!(bool, "usesThreadedAnimation"); + } + + void setUsesThreadedAnimation (bool threadedAnimation) + { + return invokeObjcSelf!(void, "setUsesThreadedAnimation:", bool)(threadedAnimation); + } + + void startAnimation (Object sender) + { + return invokeObjcSelf!(void, "startAnimation:", Object)(sender); + } + + void stopAnimation (Object sender) + { + return invokeObjcSelf!(void, "stopAnimation:", Object)(sender); + } + + void animate (Object sender) + { + return invokeObjcSelf!(void, "animate:", Object)(sender); + } + + void setStyle (uint style) + { + return invokeObjcSelf!(void, "setStyle:", uint)(style); + } + + uint style () + { + return invokeObjcSelf!(uint, "style"); + } + + void sizeToFit () + { + return invokeObjcSelf!(void, "sizeToFit"); + } + + bool isDisplayedWhenStopped () + { + return invokeObjcSelf!(bool, "isDisplayedWhenStopped"); + } + + void setDisplayedWhenStopped (bool isDisplayed) + { + return invokeObjcSelf!(void, "setDisplayedWhenStopped:", bool)(isDisplayed); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSQuickDrawView.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSQuickDrawView.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,24 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSQuickDrawView; + +import dstep.appkit.NSView; +import dstep.internal.Version; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +static if (!D_LP64): + +class NSQuickDrawView : NSView +{ + mixin (ObjcWrap); + + void* qdPort () + { + return invokeObjcSelf!(void*, "qdPort"); + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSResponder.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSResponder.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,1059 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSResponder; + +import dstep.appkit.NSEvent; +import dstep.appkit.NSInterfaceStyle; +import dstep.appkit.NSMenu; +import dstep.appkit.NSWindow; +import dstep.foundation.NSArray; +import dstep.foundation.NSCoder; +import dstep.foundation.NSError; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSUndoManager; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +const TNSErrorPresentation = ` + + void presentError (NSError error, NSWindow window, Object delegate_, SEL didPresentSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "presentError:modalForWindow:delegate:didPresentSelector:contextInfo:", NSError, NSWindow, Object, SEL, void*)(error, window, delegate_, didPresentSelector, contextInfo); + } + + bool presentError (NSError error) + { + return invokeObjcSelf!(bool, "presentError:", NSError)(error); + } + + NSError willPresentError (NSError error) + { + return invokeObjcSelf!(NSError, "willPresentError:", NSError)(error); + } + + //mixin ObjcBindMethod!(presentError, "presentError:modalForWindow:delegate:didPresentSelector:contextInfo:"); + //mixin ObjcBindMethod!(presentError, "presentError:"); + //mixin ObjcBindMethod!(willPresentError, "willPresentError:"); + +`; + +const TNSUndoSupport = ` + + NSUndoManager undoManager () + { + return invokeObjcSelf!(NSUndoManager, "undoManager"); + } + + //mixin ObjcBindMethod!(undoManager, "undoManager"); + +`; + +const TNSStandardKeyBindingMethods = ` + + void insertText (Object insertString) + { + return invokeObjcSelf!(void, "insertText:", Object)(insertString); + } + + void doCommandBySelector (SEL aSelector) + { + return invokeObjcSelf!(void, "doCommandBySelector:", SEL)(aSelector); + } + + void moveForward (Object sender) + { + return invokeObjcSelf!(void, "moveForward:", Object)(sender); + } + + void moveRight (Object sender) + { + return invokeObjcSelf!(void, "moveRight:", Object)(sender); + } + + void moveBackward (Object sender) + { + return invokeObjcSelf!(void, "moveBackward:", Object)(sender); + } + + void moveLeft (Object sender) + { + return invokeObjcSelf!(void, "moveLeft:", Object)(sender); + } + + void moveUp (Object sender) + { + return invokeObjcSelf!(void, "moveUp:", Object)(sender); + } + + void moveDown (Object sender) + { + return invokeObjcSelf!(void, "moveDown:", Object)(sender); + } + + void moveWordForward (Object sender) + { + return invokeObjcSelf!(void, "moveWordForward:", Object)(sender); + } + + void moveWordBackward (Object sender) + { + return invokeObjcSelf!(void, "moveWordBackward:", Object)(sender); + } + + void moveToBeginningOfLine (Object sender) + { + return invokeObjcSelf!(void, "moveToBeginningOfLine:", Object)(sender); + } + + void moveToEndOfLine (Object sender) + { + return invokeObjcSelf!(void, "moveToEndOfLine:", Object)(sender); + } + + void moveToBeginningOfParagraph (Object sender) + { + return invokeObjcSelf!(void, "moveToBeginningOfParagraph:", Object)(sender); + } + + void moveToEndOfParagraph (Object sender) + { + return invokeObjcSelf!(void, "moveToEndOfParagraph:", Object)(sender); + } + + void moveToEndOfDocument (Object sender) + { + return invokeObjcSelf!(void, "moveToEndOfDocument:", Object)(sender); + } + + void moveToBeginningOfDocument (Object sender) + { + return invokeObjcSelf!(void, "moveToBeginningOfDocument:", Object)(sender); + } + + void pageDown (Object sender) + { + return invokeObjcSelf!(void, "pageDown:", Object)(sender); + } + + void pageUp (Object sender) + { + return invokeObjcSelf!(void, "pageUp:", Object)(sender); + } + + void centerSelectionInVisibleArea (Object sender) + { + return invokeObjcSelf!(void, "centerSelectionInVisibleArea:", Object)(sender); + } + + void moveBackwardAndModifySelection (Object sender) + { + return invokeObjcSelf!(void, "moveBackwardAndModifySelection:", Object)(sender); + } + + void moveForwardAndModifySelection (Object sender) + { + return invokeObjcSelf!(void, "moveForwardAndModifySelection:", Object)(sender); + } + + void moveWordForwardAndModifySelection (Object sender) + { + return invokeObjcSelf!(void, "moveWordForwardAndModifySelection:", Object)(sender); + } + + void moveWordBackwardAndModifySelection (Object sender) + { + return invokeObjcSelf!(void, "moveWordBackwardAndModifySelection:", Object)(sender); + } + + void moveUpAndModifySelection (Object sender) + { + return invokeObjcSelf!(void, "moveUpAndModifySelection:", Object)(sender); + } + + void moveDownAndModifySelection (Object sender) + { + return invokeObjcSelf!(void, "moveDownAndModifySelection:", Object)(sender); + } + + void moveWordRight (Object sender) + { + return invokeObjcSelf!(void, "moveWordRight:", Object)(sender); + } + + void moveWordLeft (Object sender) + { + return invokeObjcSelf!(void, "moveWordLeft:", Object)(sender); + } + + void moveRightAndModifySelection (Object sender) + { + return invokeObjcSelf!(void, "moveRightAndModifySelection:", Object)(sender); + } + + void moveLeftAndModifySelection (Object sender) + { + return invokeObjcSelf!(void, "moveLeftAndModifySelection:", Object)(sender); + } + + void moveWordRightAndModifySelection (Object sender) + { + return invokeObjcSelf!(void, "moveWordRightAndModifySelection:", Object)(sender); + } + + void moveWordLeftAndModifySelection (Object sender) + { + return invokeObjcSelf!(void, "moveWordLeftAndModifySelection:", Object)(sender); + } + + void scrollPageUp (Object sender) + { + return invokeObjcSelf!(void, "scrollPageUp:", Object)(sender); + } + + void scrollPageDown (Object sender) + { + return invokeObjcSelf!(void, "scrollPageDown:", Object)(sender); + } + + void scrollLineUp (Object sender) + { + return invokeObjcSelf!(void, "scrollLineUp:", Object)(sender); + } + + void scrollLineDown (Object sender) + { + return invokeObjcSelf!(void, "scrollLineDown:", Object)(sender); + } + + void transpose (Object sender) + { + return invokeObjcSelf!(void, "transpose:", Object)(sender); + } + + void transposeWords (Object sender) + { + return invokeObjcSelf!(void, "transposeWords:", Object)(sender); + } + + void selectAll (Object sender) + { + return invokeObjcSelf!(void, "selectAll:", Object)(sender); + } + + void selectParagraph (Object sender) + { + return invokeObjcSelf!(void, "selectParagraph:", Object)(sender); + } + + void selectLine (Object sender) + { + return invokeObjcSelf!(void, "selectLine:", Object)(sender); + } + + void selectWord (Object sender) + { + return invokeObjcSelf!(void, "selectWord:", Object)(sender); + } + + void indent (Object sender) + { + return invokeObjcSelf!(void, "indent:", Object)(sender); + } + + void insertTab (Object sender) + { + return invokeObjcSelf!(void, "insertTab:", Object)(sender); + } + + void insertBacktab (Object sender) + { + return invokeObjcSelf!(void, "insertBacktab:", Object)(sender); + } + + void insertNewline (Object sender) + { + return invokeObjcSelf!(void, "insertNewline:", Object)(sender); + } + + void insertParagraphSeparator (Object sender) + { + return invokeObjcSelf!(void, "insertParagraphSeparator:", Object)(sender); + } + + void insertNewlineIgnoringFieldEditor (Object sender) + { + return invokeObjcSelf!(void, "insertNewlineIgnoringFieldEditor:", Object)(sender); + } + + void insertTabIgnoringFieldEditor (Object sender) + { + return invokeObjcSelf!(void, "insertTabIgnoringFieldEditor:", Object)(sender); + } + + void insertLineBreak (Object sender) + { + return invokeObjcSelf!(void, "insertLineBreak:", Object)(sender); + } + + void insertContainerBreak (Object sender) + { + return invokeObjcSelf!(void, "insertContainerBreak:", Object)(sender); + } + + void changeCaseOfLetter (Object sender) + { + return invokeObjcSelf!(void, "changeCaseOfLetter:", Object)(sender); + } + + void uppercaseWord (Object sender) + { + return invokeObjcSelf!(void, "uppercaseWord:", Object)(sender); + } + + void lowercaseWord (Object sender) + { + return invokeObjcSelf!(void, "lowercaseWord:", Object)(sender); + } + + void capitalizeWord (Object sender) + { + return invokeObjcSelf!(void, "capitalizeWord:", Object)(sender); + } + + void deleteForward (Object sender) + { + return invokeObjcSelf!(void, "deleteForward:", Object)(sender); + } + + void deleteBackward (Object sender) + { + return invokeObjcSelf!(void, "deleteBackward:", Object)(sender); + } + + void deleteBackwardByDecomposingPreviousCharacter (Object sender) + { + return invokeObjcSelf!(void, "deleteBackwardByDecomposingPreviousCharacter:", Object)(sender); + } + + void deleteWordForward (Object sender) + { + return invokeObjcSelf!(void, "deleteWordForward:", Object)(sender); + } + + void deleteWordBackward (Object sender) + { + return invokeObjcSelf!(void, "deleteWordBackward:", Object)(sender); + } + + void deleteToBeginningOfLine (Object sender) + { + return invokeObjcSelf!(void, "deleteToBeginningOfLine:", Object)(sender); + } + + void deleteToEndOfLine (Object sender) + { + return invokeObjcSelf!(void, "deleteToEndOfLine:", Object)(sender); + } + + void deleteToBeginningOfParagraph (Object sender) + { + return invokeObjcSelf!(void, "deleteToBeginningOfParagraph:", Object)(sender); + } + + void deleteToEndOfParagraph (Object sender) + { + return invokeObjcSelf!(void, "deleteToEndOfParagraph:", Object)(sender); + } + + void yank (Object sender) + { + return invokeObjcSelf!(void, "yank:", Object)(sender); + } + + void complete (Object sender) + { + return invokeObjcSelf!(void, "complete:", Object)(sender); + } + + void setMark (Object sender) + { + return invokeObjcSelf!(void, "setMark:", Object)(sender); + } + + void deleteToMark (Object sender) + { + return invokeObjcSelf!(void, "deleteToMark:", Object)(sender); + } + + void selectToMark (Object sender) + { + return invokeObjcSelf!(void, "selectToMark:", Object)(sender); + } + + void swapWithMark (Object sender) + { + return invokeObjcSelf!(void, "swapWithMark:", Object)(sender); + } + + void cancelOperation (Object sender) + { + return invokeObjcSelf!(void, "cancelOperation:", Object)(sender); + } + + //mixin ObjcBindMethod!(insertText, "insertText:"); + //mixin ObjcBindMethod!(doCommandBySelector, "doCommandBySelector:"); + //mixin ObjcBindMethod!(moveForward, "moveForward:"); + //mixin ObjcBindMethod!(moveRight, "moveRight:"); + //mixin ObjcBindMethod!(moveBackward, "moveBackward:"); + //mixin ObjcBindMethod!(moveLeft, "moveLeft:"); + //mixin ObjcBindMethod!(moveUp, "moveUp:"); + //mixin ObjcBindMethod!(moveDown, "moveDown:"); + //mixin ObjcBindMethod!(moveWordForward, "moveWordForward:"); + //mixin ObjcBindMethod!(moveWordBackward, "moveWordBackward:"); + //mixin ObjcBindMethod!(moveToBeginningOfLine, "moveToBeginningOfLine:"); + //mixin ObjcBindMethod!(moveToEndOfLine, "moveToEndOfLine:"); + //mixin ObjcBindMethod!(moveToBeginningOfParagraph, "moveToBeginningOfParagraph:"); + //mixin ObjcBindMethod!(moveToEndOfParagraph, "moveToEndOfParagraph:"); + //mixin ObjcBindMethod!(moveToEndOfDocument, "moveToEndOfDocument:"); + //mixin ObjcBindMethod!(moveToBeginningOfDocument, "moveToBeginningOfDocument:"); + //mixin ObjcBindMethod!(pageDown, "pageDown:"); + //mixin ObjcBindMethod!(pageUp, "pageUp:"); + //mixin ObjcBindMethod!(centerSelectionInVisibleArea, "centerSelectionInVisibleArea:"); + //mixin ObjcBindMethod!(moveBackwardAndModifySelection, "moveBackwardAndModifySelection:"); + //mixin ObjcBindMethod!(moveForwardAndModifySelection, "moveForwardAndModifySelection:"); + //mixin ObjcBindMethod!(moveWordForwardAndModifySelection, "moveWordForwardAndModifySelection:"); + //mixin ObjcBindMethod!(moveWordBackwardAndModifySelection, "moveWordBackwardAndModifySelection:"); + //mixin ObjcBindMethod!(moveUpAndModifySelection, "moveUpAndModifySelection:"); + //mixin ObjcBindMethod!(moveDownAndModifySelection, "moveDownAndModifySelection:"); + //mixin ObjcBindMethod!(moveWordRight, "moveWordRight:"); + //mixin ObjcBindMethod!(moveWordLeft, "moveWordLeft:"); + //mixin ObjcBindMethod!(moveRightAndModifySelection, "moveRightAndModifySelection:"); + //mixin ObjcBindMethod!(moveLeftAndModifySelection, "moveLeftAndModifySelection:"); + //mixin ObjcBindMethod!(moveWordRightAndModifySelection, "moveWordRightAndModifySelection:"); + //mixin ObjcBindMethod!(moveWordLeftAndModifySelection, "moveWordLeftAndModifySelection:"); + //mixin ObjcBindMethod!(scrollPageUp, "scrollPageUp:"); + //mixin ObjcBindMethod!(scrollPageDown, "scrollPageDown:"); + //mixin ObjcBindMethod!(scrollLineUp, "scrollLineUp:"); + //mixin ObjcBindMethod!(scrollLineDown, "scrollLineDown:"); + //mixin ObjcBindMethod!(transpose, "transpose:"); + //mixin ObjcBindMethod!(transposeWords, "transposeWords:"); + //mixin ObjcBindMethod!(selectAll, "selectAll:"); + //mixin ObjcBindMethod!(selectParagraph, "selectParagraph:"); + //mixin ObjcBindMethod!(selectLine, "selectLine:"); + //mixin ObjcBindMethod!(selectWord, "selectWord:"); + //mixin ObjcBindMethod!(indent, "indent:"); + //mixin ObjcBindMethod!(insertTab, "insertTab:"); + //mixin ObjcBindMethod!(insertBacktab, "insertBacktab:"); + //mixin ObjcBindMethod!(insertNewline, "insertNewline:"); + //mixin ObjcBindMethod!(insertParagraphSeparator, "insertParagraphSeparator:"); + //mixin ObjcBindMethod!(insertNewlineIgnoringFieldEditor, "insertNewlineIgnoringFieldEditor:"); + //mixin ObjcBindMethod!(insertTabIgnoringFieldEditor, "insertTabIgnoringFieldEditor:"); + //mixin ObjcBindMethod!(insertLineBreak, "insertLineBreak:"); + //mixin ObjcBindMethod!(insertContainerBreak, "insertContainerBreak:"); + //mixin ObjcBindMethod!(changeCaseOfLetter, "changeCaseOfLetter:"); + //mixin ObjcBindMethod!(uppercaseWord, "uppercaseWord:"); + //mixin ObjcBindMethod!(lowercaseWord, "lowercaseWord:"); + //mixin ObjcBindMethod!(capitalizeWord, "capitalizeWord:"); + //mixin ObjcBindMethod!(deleteForward, "deleteForward:"); + //mixin ObjcBindMethod!(deleteBackward, "deleteBackward:"); + //mixin ObjcBindMethod!(deleteBackwardByDecomposingPreviousCharacter, "deleteBackwardByDecomposingPreviousCharacter:"); + //mixin ObjcBindMethod!(deleteWordForward, "deleteWordForward:"); + //mixin ObjcBindMethod!(deleteWordBackward, "deleteWordBackward:"); + //mixin ObjcBindMethod!(deleteToBeginningOfLine, "deleteToBeginningOfLine:"); + //mixin ObjcBindMethod!(deleteToEndOfLine, "deleteToEndOfLine:"); + //mixin ObjcBindMethod!(deleteToBeginningOfParagraph, "deleteToBeginningOfParagraph:"); + //mixin ObjcBindMethod!(deleteToEndOfParagraph, "deleteToEndOfParagraph:"); + //mixin ObjcBindMethod!(yank, "yank:"); + //mixin ObjcBindMethod!(complete, "complete:"); + //mixin ObjcBindMethod!(setMark, "setMark:"); + //mixin ObjcBindMethod!(deleteToMark, "deleteToMark:"); + //mixin ObjcBindMethod!(selectToMark, "selectToMark:"); + //mixin ObjcBindMethod!(swapWithMark, "swapWithMark:"); + //mixin ObjcBindMethod!(cancelOperation, "cancelOperation:"); + +`; + +class NSResponder : NSObject, INSCoding +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + NSResponder nextResponder () + { + id result = invokeObjcSelf!(id, "nextResponder"); + return result is this.objcObject ? this : (result !is null ? new NSResponder(result) : null); + } + + void setNextResponder (NSResponder aResponder) + { + return invokeObjcSelf!(void, "setNextResponder:", NSResponder)(aResponder); + } + + bool tryToPerform (SEL anAction, Object anObject) + { + return invokeObjcSelf!(bool, "tryToPerform:with:", SEL, Object)(anAction, anObject); + } + + bool performKeyEquivalent (NSEvent theEvent) + { + return invokeObjcSelf!(bool, "performKeyEquivalent:", NSEvent)(theEvent); + } + + Object validRequestorForSendType (NSString sendType, NSString returnType) + { + return invokeObjcSelf!(Object, "validRequestorForSendType:returnType:", NSString, NSString)(sendType, returnType); + } + + void mouseDown (NSEvent theEvent) + { + return invokeObjcSelf!(void, "mouseDown:", NSEvent)(theEvent); + } + + void rightMouseDown (NSEvent theEvent) + { + return invokeObjcSelf!(void, "rightMouseDown:", NSEvent)(theEvent); + } + + void otherMouseDown (NSEvent theEvent) + { + return invokeObjcSelf!(void, "otherMouseDown:", NSEvent)(theEvent); + } + + void mouseUp (NSEvent theEvent) + { + return invokeObjcSelf!(void, "mouseUp:", NSEvent)(theEvent); + } + + void rightMouseUp (NSEvent theEvent) + { + return invokeObjcSelf!(void, "rightMouseUp:", NSEvent)(theEvent); + } + + void otherMouseUp (NSEvent theEvent) + { + return invokeObjcSelf!(void, "otherMouseUp:", NSEvent)(theEvent); + } + + void mouseMoved (NSEvent theEvent) + { + return invokeObjcSelf!(void, "mouseMoved:", NSEvent)(theEvent); + } + + void mouseDragged (NSEvent theEvent) + { + return invokeObjcSelf!(void, "mouseDragged:", NSEvent)(theEvent); + } + + void scrollWheel (NSEvent theEvent) + { + return invokeObjcSelf!(void, "scrollWheel:", NSEvent)(theEvent); + } + + void rightMouseDragged (NSEvent theEvent) + { + return invokeObjcSelf!(void, "rightMouseDragged:", NSEvent)(theEvent); + } + + void otherMouseDragged (NSEvent theEvent) + { + return invokeObjcSelf!(void, "otherMouseDragged:", NSEvent)(theEvent); + } + + void mouseEntered (NSEvent theEvent) + { + return invokeObjcSelf!(void, "mouseEntered:", NSEvent)(theEvent); + } + + void mouseExited (NSEvent theEvent) + { + return invokeObjcSelf!(void, "mouseExited:", NSEvent)(theEvent); + } + + void keyDown (NSEvent theEvent) + { + return invokeObjcSelf!(void, "keyDown:", NSEvent)(theEvent); + } + + void keyUp (NSEvent theEvent) + { + return invokeObjcSelf!(void, "keyUp:", NSEvent)(theEvent); + } + + void flagsChanged (NSEvent theEvent) + { + return invokeObjcSelf!(void, "flagsChanged:", NSEvent)(theEvent); + } + + void tabletPoint (NSEvent theEvent) + { + return invokeObjcSelf!(void, "tabletPoint:", NSEvent)(theEvent); + } + + void tabletProximity (NSEvent theEvent) + { + return invokeObjcSelf!(void, "tabletProximity:", NSEvent)(theEvent); + } + + void cursorUpdate (NSEvent event) + { + return invokeObjcSelf!(void, "cursorUpdate:", NSEvent)(event); + } + + void noResponderFor (SEL eventSelector) + { + return invokeObjcSelf!(void, "noResponderFor:", SEL)(eventSelector); + } + + bool acceptsFirstResponder () + { + return invokeObjcSelf!(bool, "acceptsFirstResponder"); + } + + bool becomeFirstResponder () + { + return invokeObjcSelf!(bool, "becomeFirstResponder"); + } + + bool resignFirstResponder () + { + return invokeObjcSelf!(bool, "resignFirstResponder"); + } + + void interpretKeyEvents (NSArray eventArray) + { + return invokeObjcSelf!(void, "interpretKeyEvents:", NSArray)(eventArray); + } + + void flushBufferedKeyEvents () + { + return invokeObjcSelf!(void, "flushBufferedKeyEvents"); + } + + void setMenu (NSMenu menu) + { + return invokeObjcSelf!(void, "setMenu:", NSMenu)(menu); + } + + NSMenu menu () + { + return invokeObjcSelf!(NSMenu, "menu"); + } + + void showContextHelp (Object sender) + { + return invokeObjcSelf!(void, "showContextHelp:", Object)(sender); + } + + void helpRequested (NSEvent eventPtr) + { + return invokeObjcSelf!(void, "helpRequested:", NSEvent)(eventPtr); + } + + bool shouldBeTreatedAsInkEvent (NSEvent theEvent) + { + return invokeObjcSelf!(bool, "shouldBeTreatedAsInkEvent:", NSEvent)(theEvent); + } + + // NSInterfaceStyle + uint interfaceStyle () + { + return invokeObjcSelf!(uint, "interfaceStyle"); + } + + void setInterfaceStyle (uint interfaceStyle) + { + return invokeObjcSelf!(void, "setInterfaceStyle:", uint)(interfaceStyle); + } + + // NSErrorPresentation + void presentError (NSError error, NSWindow window, Object delegate_, SEL didPresentSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "presentError:modalForWindow:delegate:didPresentSelector:contextInfo:", NSError, NSWindow, Object, SEL, void*)(error, window, delegate_, didPresentSelector, contextInfo); + } + + bool presentError (NSError error) + { + return invokeObjcSelf!(bool, "presentError:", NSError)(error); + } + + NSError willPresentError (NSError error) + { + return invokeObjcSelf!(NSError, "willPresentError:", NSError)(error); + } + + // NSUndoSupport + NSUndoManager undoManager () + { + return invokeObjcSelf!(NSUndoManager, "undoManager"); + } + + // NSStandardKeyBindingMethods + void insertText (Object insertString) + { + return invokeObjcSelf!(void, "insertText:", Object)(insertString); + } + + void doCommandBySelector (SEL aSelector) + { + return invokeObjcSelf!(void, "doCommandBySelector:", SEL)(aSelector); + } + + void moveForward (Object sender) + { + return invokeObjcSelf!(void, "moveForward:", Object)(sender); + } + + void moveRight (Object sender) + { + return invokeObjcSelf!(void, "moveRight:", Object)(sender); + } + + void moveBackward (Object sender) + { + return invokeObjcSelf!(void, "moveBackward:", Object)(sender); + } + + void moveLeft (Object sender) + { + return invokeObjcSelf!(void, "moveLeft:", Object)(sender); + } + + void moveUp (Object sender) + { + return invokeObjcSelf!(void, "moveUp:", Object)(sender); + } + + void moveDown (Object sender) + { + return invokeObjcSelf!(void, "moveDown:", Object)(sender); + } + + void moveWordForward (Object sender) + { + return invokeObjcSelf!(void, "moveWordForward:", Object)(sender); + } + + void moveWordBackward (Object sender) + { + return invokeObjcSelf!(void, "moveWordBackward:", Object)(sender); + } + + void moveToBeginningOfLine (Object sender) + { + return invokeObjcSelf!(void, "moveToBeginningOfLine:", Object)(sender); + } + + void moveToEndOfLine (Object sender) + { + return invokeObjcSelf!(void, "moveToEndOfLine:", Object)(sender); + } + + void moveToBeginningOfParagraph (Object sender) + { + return invokeObjcSelf!(void, "moveToBeginningOfParagraph:", Object)(sender); + } + + void moveToEndOfParagraph (Object sender) + { + return invokeObjcSelf!(void, "moveToEndOfParagraph:", Object)(sender); + } + + void moveToEndOfDocument (Object sender) + { + return invokeObjcSelf!(void, "moveToEndOfDocument:", Object)(sender); + } + + void moveToBeginningOfDocument (Object sender) + { + return invokeObjcSelf!(void, "moveToBeginningOfDocument:", Object)(sender); + } + + void pageDown (Object sender) + { + return invokeObjcSelf!(void, "pageDown:", Object)(sender); + } + + void pageUp (Object sender) + { + return invokeObjcSelf!(void, "pageUp:", Object)(sender); + } + + void centerSelectionInVisibleArea (Object sender) + { + return invokeObjcSelf!(void, "centerSelectionInVisibleArea:", Object)(sender); + } + + void moveBackwardAndModifySelection (Object sender) + { + return invokeObjcSelf!(void, "moveBackwardAndModifySelection:", Object)(sender); + } + + void moveForwardAndModifySelection (Object sender) + { + return invokeObjcSelf!(void, "moveForwardAndModifySelection:", Object)(sender); + } + + void moveWordForwardAndModifySelection (Object sender) + { + return invokeObjcSelf!(void, "moveWordForwardAndModifySelection:", Object)(sender); + } + + void moveWordBackwardAndModifySelection (Object sender) + { + return invokeObjcSelf!(void, "moveWordBackwardAndModifySelection:", Object)(sender); + } + + void moveUpAndModifySelection (Object sender) + { + return invokeObjcSelf!(void, "moveUpAndModifySelection:", Object)(sender); + } + + void moveDownAndModifySelection (Object sender) + { + return invokeObjcSelf!(void, "moveDownAndModifySelection:", Object)(sender); + } + + void moveWordRight (Object sender) + { + return invokeObjcSelf!(void, "moveWordRight:", Object)(sender); + } + + void moveWordLeft (Object sender) + { + return invokeObjcSelf!(void, "moveWordLeft:", Object)(sender); + } + + void moveRightAndModifySelection (Object sender) + { + return invokeObjcSelf!(void, "moveRightAndModifySelection:", Object)(sender); + } + + void moveLeftAndModifySelection (Object sender) + { + return invokeObjcSelf!(void, "moveLeftAndModifySelection:", Object)(sender); + } + + void moveWordRightAndModifySelection (Object sender) + { + return invokeObjcSelf!(void, "moveWordRightAndModifySelection:", Object)(sender); + } + + void moveWordLeftAndModifySelection (Object sender) + { + return invokeObjcSelf!(void, "moveWordLeftAndModifySelection:", Object)(sender); + } + + void scrollPageUp (Object sender) + { + return invokeObjcSelf!(void, "scrollPageUp:", Object)(sender); + } + + void scrollPageDown (Object sender) + { + return invokeObjcSelf!(void, "scrollPageDown:", Object)(sender); + } + + void scrollLineUp (Object sender) + { + return invokeObjcSelf!(void, "scrollLineUp:", Object)(sender); + } + + void scrollLineDown (Object sender) + { + return invokeObjcSelf!(void, "scrollLineDown:", Object)(sender); + } + + void transpose (Object sender) + { + return invokeObjcSelf!(void, "transpose:", Object)(sender); + } + + void transposeWords (Object sender) + { + return invokeObjcSelf!(void, "transposeWords:", Object)(sender); + } + + void selectAll (Object sender) + { + return invokeObjcSelf!(void, "selectAll:", Object)(sender); + } + + void selectParagraph (Object sender) + { + return invokeObjcSelf!(void, "selectParagraph:", Object)(sender); + } + + void selectLine (Object sender) + { + return invokeObjcSelf!(void, "selectLine:", Object)(sender); + } + + void selectWord (Object sender) + { + return invokeObjcSelf!(void, "selectWord:", Object)(sender); + } + + void indent (Object sender) + { + return invokeObjcSelf!(void, "indent:", Object)(sender); + } + + void insertTab (Object sender) + { + return invokeObjcSelf!(void, "insertTab:", Object)(sender); + } + + void insertBacktab (Object sender) + { + return invokeObjcSelf!(void, "insertBacktab:", Object)(sender); + } + + void insertNewline (Object sender) + { + return invokeObjcSelf!(void, "insertNewline:", Object)(sender); + } + + void insertParagraphSeparator (Object sender) + { + return invokeObjcSelf!(void, "insertParagraphSeparator:", Object)(sender); + } + + void insertNewlineIgnoringFieldEditor (Object sender) + { + return invokeObjcSelf!(void, "insertNewlineIgnoringFieldEditor:", Object)(sender); + } + + void insertTabIgnoringFieldEditor (Object sender) + { + return invokeObjcSelf!(void, "insertTabIgnoringFieldEditor:", Object)(sender); + } + + void insertLineBreak (Object sender) + { + return invokeObjcSelf!(void, "insertLineBreak:", Object)(sender); + } + + void insertContainerBreak (Object sender) + { + return invokeObjcSelf!(void, "insertContainerBreak:", Object)(sender); + } + + void changeCaseOfLetter (Object sender) + { + return invokeObjcSelf!(void, "changeCaseOfLetter:", Object)(sender); + } + + void uppercaseWord (Object sender) + { + return invokeObjcSelf!(void, "uppercaseWord:", Object)(sender); + } + + void lowercaseWord (Object sender) + { + return invokeObjcSelf!(void, "lowercaseWord:", Object)(sender); + } + + void capitalizeWord (Object sender) + { + return invokeObjcSelf!(void, "capitalizeWord:", Object)(sender); + } + + void deleteForward (Object sender) + { + return invokeObjcSelf!(void, "deleteForward:", Object)(sender); + } + + void deleteBackward (Object sender) + { + return invokeObjcSelf!(void, "deleteBackward:", Object)(sender); + } + + void deleteBackwardByDecomposingPreviousCharacter (Object sender) + { + return invokeObjcSelf!(void, "deleteBackwardByDecomposingPreviousCharacter:", Object)(sender); + } + + void deleteWordForward (Object sender) + { + return invokeObjcSelf!(void, "deleteWordForward:", Object)(sender); + } + + void deleteWordBackward (Object sender) + { + return invokeObjcSelf!(void, "deleteWordBackward:", Object)(sender); + } + + void deleteToBeginningOfLine (Object sender) + { + return invokeObjcSelf!(void, "deleteToBeginningOfLine:", Object)(sender); + } + + void deleteToEndOfLine (Object sender) + { + return invokeObjcSelf!(void, "deleteToEndOfLine:", Object)(sender); + } + + void deleteToBeginningOfParagraph (Object sender) + { + return invokeObjcSelf!(void, "deleteToBeginningOfParagraph:", Object)(sender); + } + + void deleteToEndOfParagraph (Object sender) + { + return invokeObjcSelf!(void, "deleteToEndOfParagraph:", Object)(sender); + } + + void yank (Object sender) + { + return invokeObjcSelf!(void, "yank:", Object)(sender); + } + + void complete (Object sender) + { + return invokeObjcSelf!(void, "complete:", Object)(sender); + } + + void setMark (Object sender) + { + return invokeObjcSelf!(void, "setMark:", Object)(sender); + } + + void deleteToMark (Object sender) + { + return invokeObjcSelf!(void, "deleteToMark:", Object)(sender); + } + + void selectToMark (Object sender) + { + return invokeObjcSelf!(void, "selectToMark:", Object)(sender); + } + + void swapWithMark (Object sender) + { + return invokeObjcSelf!(void, "swapWithMark:", Object)(sender); + } + + void cancelOperation (Object sender) + { + return invokeObjcSelf!(void, "cancelOperation:", Object)(sender); + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSRuleEditor.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSRuleEditor.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,367 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSRuleEditor; + +import dstep.appkit.AppKitDefines; +import dstep.appkit.NSControl; +import dstep.appkit.NSView; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSArray; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSIndexSet; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSPredicate; +import dstep.foundation.NSString; +import dstep.foundation.NSTimer; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.appkit.NSRuleEditor_bindings; + +alias NSUInteger NSRuleEditorNestingMode; +alias NSUInteger NSRuleEditorRowType; + +private +{ + NSString NSRuleEditorPredicateLeftExpression_; + NSString NSRuleEditorPredicateRightExpression_; + NSString NSRuleEditorPredicateComparisonModifier_; + NSString NSRuleEditorPredicateOptions_; + NSString NSRuleEditorPredicateOperatorType_; + NSString NSRuleEditorPredicateCustomSelector_; + NSString NSRuleEditorPredicateCompoundType_; + NSString NSRuleEditorRowsDidChangeNotification_; +} + +NSString NSRuleEditorPredicateLeftExpression () +{ + if (NSRuleEditorPredicateLeftExpression_) + return NSRuleEditorPredicateLeftExpression_; + + return NSRuleEditorPredicateLeftExpression_ = new NSString(bindings.NSRuleEditorPredicateLeftExpression); +} + +NSString NSRuleEditorPredicateRightExpression () +{ + if (NSRuleEditorPredicateRightExpression_) + return NSRuleEditorPredicateRightExpression_; + + return NSRuleEditorPredicateRightExpression_ = new NSString(bindings.NSRuleEditorPredicateRightExpression); +} + +NSString NSRuleEditorPredicateComparisonModifier () +{ + if (NSRuleEditorPredicateComparisonModifier_) + return NSRuleEditorPredicateComparisonModifier_; + + return NSRuleEditorPredicateComparisonModifier_ = new NSString(bindings.NSRuleEditorPredicateComparisonModifier); +} + +NSString NSRuleEditorPredicateOptions () +{ + if (NSRuleEditorPredicateOptions_) + return NSRuleEditorPredicateOptions_; + + return NSRuleEditorPredicateOptions_ = new NSString(bindings.NSRuleEditorPredicateOptions); +} + +NSString NSRuleEditorPredicateOperatorType () +{ + if (NSRuleEditorPredicateOperatorType_) + return NSRuleEditorPredicateOperatorType_; + + return NSRuleEditorPredicateOperatorType_ = new NSString(bindings.NSRuleEditorPredicateOperatorType); +} + +NSString NSRuleEditorPredicateCustomSelector () +{ + if (NSRuleEditorPredicateCustomSelector_) + return NSRuleEditorPredicateCustomSelector_; + + return NSRuleEditorPredicateCustomSelector_ = new NSString(bindings.NSRuleEditorPredicateCustomSelector); +} + +NSString NSRuleEditorPredicateCompoundType () +{ + if (NSRuleEditorPredicateCompoundType_) + return NSRuleEditorPredicateCompoundType_; + + return NSRuleEditorPredicateCompoundType_ = new NSString(bindings.NSRuleEditorPredicateCompoundType); +} + +NSString NSRuleEditorRowsDidChangeNotification () +{ + if (NSRuleEditorRowsDidChangeNotification_) + return NSRuleEditorRowsDidChangeNotification_; + + return NSRuleEditorRowsDidChangeNotification_ = new NSString(bindings.NSRuleEditorRowsDidChangeNotification); +} + +enum +{ + NSRuleEditorNestingModeSingle, + NSRuleEditorNestingModeList, + NSRuleEditorNestingModeCompound, + NSRuleEditorNestingModeSimple +} + +enum +{ + NSRuleEditorRowTypeSimple, + NSRuleEditorRowTypeCompound +} + +class NSRuleEditor : NSControl +{ + mixin (ObjcWrap); + + void setDelegate (Object arg0) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(arg0); + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + void setFormattingStringsFilename (NSString stringsFilename) + { + return invokeObjcSelf!(void, "setFormattingStringsFilename:", NSString)(stringsFilename); + } + + NSString formattingStringsFilename () + { + return invokeObjcSelf!(NSString, "formattingStringsFilename"); + } + + void setFormattingDictionary (NSDictionary dictionary) + { + return invokeObjcSelf!(void, "setFormattingDictionary:", NSDictionary)(dictionary); + } + + NSDictionary formattingDictionary () + { + return invokeObjcSelf!(NSDictionary, "formattingDictionary"); + } + + void reloadCriteria () + { + return invokeObjcSelf!(void, "reloadCriteria"); + } + + void setNestingMode (uint mode) + { + return invokeObjcSelf!(void, "setNestingMode:", uint)(mode); + } + + uint nestingMode () + { + return invokeObjcSelf!(uint, "nestingMode"); + } + + void setRowHeight (CGFloat height) + { + return invokeObjcSelf!(void, "setRowHeight:", CGFloat)(height); + } + + CGFloat rowHeight () + { + return invokeObjcSelf!(CGFloat, "rowHeight"); + } + + void setEditable (bool editable) + { + return invokeObjcSelf!(void, "setEditable:", bool)(editable); + } + + bool isEditable () + { + return invokeObjcSelf!(bool, "isEditable"); + } + + void setCanRemoveAllRows (bool val) + { + return invokeObjcSelf!(void, "setCanRemoveAllRows:", bool)(val); + } + + bool canRemoveAllRows () + { + return invokeObjcSelf!(bool, "canRemoveAllRows"); + } + + NSPredicate predicate () + { + return invokeObjcSelf!(NSPredicate, "predicate"); + } + + void reloadPredicate () + { + return invokeObjcSelf!(void, "reloadPredicate"); + } + + NSPredicate predicateForRow (NSInteger row) + { + return invokeObjcSelf!(NSPredicate, "predicateForRow:", NSInteger)(row); + } + + NSInteger numberOfRows () + { + return invokeObjcSelf!(NSInteger, "numberOfRows"); + } + + NSIndexSet subrowIndexesForRow (NSInteger rowIndex) + { + return invokeObjcSelf!(NSIndexSet, "subrowIndexesForRow:", NSInteger)(rowIndex); + } + + NSArray criteriaForRow (NSInteger row) + { + return invokeObjcSelf!(NSArray, "criteriaForRow:", NSInteger)(row); + } + + NSArray displayValuesForRow (NSInteger row) + { + return invokeObjcSelf!(NSArray, "displayValuesForRow:", NSInteger)(row); + } + + NSInteger rowForDisplayValue (Object displayValue) + { + return invokeObjcSelf!(NSInteger, "rowForDisplayValue:", Object)(displayValue); + } + + uint rowTypeForRow (NSInteger rowIndex) + { + return invokeObjcSelf!(uint, "rowTypeForRow:", NSInteger)(rowIndex); + } + + NSInteger parentRowForRow (NSInteger rowIndex) + { + return invokeObjcSelf!(NSInteger, "parentRowForRow:", NSInteger)(rowIndex); + } + + void addRow (Object sender) + { + return invokeObjcSelf!(void, "addRow:", Object)(sender); + } + + void insertRowAtIndex (NSInteger rowIndex, uint rowType, NSInteger parentRow, bool shouldAnimate) + { + return invokeObjcSelf!(void, "insertRowAtIndex:withType:asSubrowOfRow:animate:", NSInteger, uint, NSInteger, bool)(rowIndex, rowType, parentRow, shouldAnimate); + } + + void setCriteria (NSArray criteria, NSArray values, NSInteger rowIndex) + { + return invokeObjcSelf!(void, "setCriteria:andDisplayValues:forRowAtIndex:", NSArray, NSArray, NSInteger)(criteria, values, rowIndex); + } + + void removeRowAtIndex (NSInteger rowIndex) + { + return invokeObjcSelf!(void, "removeRowAtIndex:", NSInteger)(rowIndex); + } + + void removeRowsAtIndexes (NSIndexSet rowIndexes, bool includeSubrows) + { + return invokeObjcSelf!(void, "removeRowsAtIndexes:includeSubrows:", NSIndexSet, bool)(rowIndexes, includeSubrows); + } + + NSIndexSet selectedRowIndexes () + { + return invokeObjcSelf!(NSIndexSet, "selectedRowIndexes"); + } + + void selectRowIndexes (NSIndexSet indexes, bool extend) + { + return invokeObjcSelf!(void, "selectRowIndexes:byExtendingSelection:", NSIndexSet, bool)(indexes, extend); + } + + void setRowClass (Class rowClass) + { + return invokeObjcSelf!(void, "setRowClass:", Class)(rowClass); + } + + Class rowClass () + { + return invokeObjcSelf!(Class, "rowClass"); + } + + void setRowTypeKeyPath (NSString keyPath) + { + return invokeObjcSelf!(void, "setRowTypeKeyPath:", NSString)(keyPath); + } + + NSString rowTypeKeyPath () + { + return invokeObjcSelf!(NSString, "rowTypeKeyPath"); + } + + void setSubrowsKeyPath (NSString keyPath) + { + return invokeObjcSelf!(void, "setSubrowsKeyPath:", NSString)(keyPath); + } + + NSString subrowsKeyPath () + { + return invokeObjcSelf!(NSString, "subrowsKeyPath"); + } + + void setCriteriaKeyPath (NSString keyPath) + { + return invokeObjcSelf!(void, "setCriteriaKeyPath:", NSString)(keyPath); + } + + NSString criteriaKeyPath () + { + return invokeObjcSelf!(NSString, "criteriaKeyPath"); + } + + void setDisplayValuesKeyPath (NSString keyPath) + { + return invokeObjcSelf!(void, "setDisplayValuesKeyPath:", NSString)(keyPath); + } + + NSString displayValuesKeyPath () + { + return invokeObjcSelf!(NSString, "displayValuesKeyPath"); + } +} + +const TNSRuleEditorDelegateMethods = ` + + NSInteger ruleEditor (NSRuleEditor editor, Object criterion, uint rowType) + { + return invokeObjcSelf!(NSInteger, "ruleEditor:numberOfChildrenForCriterion:withRowType:", NSRuleEditor, Object, uint)(editor, criterion, rowType); + } + + Object ruleEditor (NSRuleEditor editor, NSInteger index, Object criterion, uint rowType) + { + return invokeObjcSelf!(Object, "ruleEditor:child:forCriterion:withRowType:", NSRuleEditor, NSInteger, Object, uint)(editor, index, criterion, rowType); + } + + Object ruleEditor (NSRuleEditor editor, Object criterion, NSInteger row) + { + return invokeObjcSelf!(Object, "ruleEditor:displayValueForCriterion:inRow:", NSRuleEditor, Object, NSInteger)(editor, criterion, row); + } + + NSDictionary ruleEditor (NSRuleEditor editor, Object criterion, Object value, NSInteger row) + { + return invokeObjcSelf!(NSDictionary, "ruleEditor:predicatePartsForCriterion:withDisplayValue:inRow:", NSRuleEditor, Object, Object, NSInteger)(editor, criterion, value, row); + } + + void ruleEditorRowsDidChange (NSNotification notification) + { + return invokeObjcSelf!(void, "ruleEditorRowsDidChange:", NSNotification)(notification); + } + + //mixin ObjcBindMethod!(ruleEditor, "ruleEditor:numberOfChildrenForCriterion:withRowType:"); + //mixin ObjcBindMethod!(ruleEditor, "ruleEditor:child:forCriterion:withRowType:"); + //mixin ObjcBindMethod!(ruleEditor, "ruleEditor:displayValueForCriterion:inRow:"); + //mixin ObjcBindMethod!(ruleEditor, "ruleEditor:predicatePartsForCriterion:withDisplayValue:inRow:"); + //mixin ObjcBindMethod!(ruleEditorRowsDidChange, "ruleEditorRowsDidChange:"); + +`; + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSRuleEditor_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSRuleEditor_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,25 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSRuleEditor_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package const id NSRuleEditorPredicateLeftExpression; + package const id NSRuleEditorPredicateRightExpression; + package const id NSRuleEditorPredicateComparisonModifier; + package const id NSRuleEditorPredicateOptions; + package const id NSRuleEditorPredicateOperatorType; + package const id NSRuleEditorPredicateCustomSelector; + package const id NSRuleEditorPredicateCompoundType; + package const id NSRuleEditorRowsDidChangeNotification; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSRulerMarker.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSRulerMarker.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,146 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSRulerMarker; + +import dstep.appkit.NSEvent; +import dstep.appkit.NSImage; +import dstep.appkit.NSRulerView; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSCoder; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObject; +import dstep.foundation.NSZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSRulerMarker : NSObject, INSCopying, INSCoding +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + typeof(this) copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); + } + + NSRulerMarker initWithRulerView (NSRulerView ruler, CGFloat location, NSImage image, NSPoint imageOrigin) + { + id result = invokeObjcSelf!(id, "initWithRulerView:markerLocation:image:imageOrigin:", NSRulerView, CGFloat, NSImage, NSPoint)(ruler, location, image, imageOrigin); + return result is this.objcObject ? this : (result !is null ? new NSRulerMarker(result) : null); + } + + this (NSRulerView ruler, CGFloat location, NSImage image, NSPoint imageOrigin) + { + super(NSRulerMarker.alloc.initWithRulerView(ruler, location, image, imageOrigin).objcObject); + } + + NSRulerView ruler () + { + return invokeObjcSelf!(NSRulerView, "ruler"); + } + + void setMarkerLocation (CGFloat location) + { + return invokeObjcSelf!(void, "setMarkerLocation:", CGFloat)(location); + } + + CGFloat markerLocation () + { + return invokeObjcSelf!(CGFloat, "markerLocation"); + } + + void setImage (NSImage image) + { + return invokeObjcSelf!(void, "setImage:", NSImage)(image); + } + + NSImage image () + { + return invokeObjcSelf!(NSImage, "image"); + } + + void setImageOrigin (NSPoint imageOrigin) + { + return invokeObjcSelf!(void, "setImageOrigin:", NSPoint)(imageOrigin); + } + + NSPoint imageOrigin () + { + return invokeObjcSelf!(NSPoint, "imageOrigin"); + } + + void setMovable (bool flag) + { + return invokeObjcSelf!(void, "setMovable:", bool)(flag); + } + + void setRemovable (bool flag) + { + return invokeObjcSelf!(void, "setRemovable:", bool)(flag); + } + + bool isMovable () + { + return invokeObjcSelf!(bool, "isMovable"); + } + + bool isRemovable () + { + return invokeObjcSelf!(bool, "isRemovable"); + } + + bool isDragging () + { + return invokeObjcSelf!(bool, "isDragging"); + } + + void setRepresentedObject (INSCopying representedObject) + { + return invokeObjcSelf!(void, "setRepresentedObject:", INSCopying)(representedObject); + } + + INSCopying representedObject () + { + return invokeObjcSelf!(INSCopying, "representedObject"); + } + + NSRect imageRectInRuler () + { + return invokeObjcSelf!(NSRect, "imageRectInRuler"); + } + + CGFloat thicknessRequiredInRuler () + { + return invokeObjcSelf!(CGFloat, "thicknessRequiredInRuler"); + } + + void drawRect (NSRect rect) + { + return invokeObjcSelf!(void, "drawRect:", NSRect)(rect); + } + + bool trackMouse (NSEvent mouseDownEvent, bool isAdding) + { + return invokeObjcSelf!(bool, "trackMouse:adding:", NSEvent, bool)(mouseDownEvent, isAdding); + } + +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSRulerView.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSRulerView.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,264 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSRulerView; + +import dstep.appkit.NSEvent; +import dstep.appkit.NSRulerMarker; +import dstep.appkit.NSScrollView; +import dstep.appkit.NSView; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSArray; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +alias NSUInteger NSRulerOrientation; + +enum +{ + NSHorizontalRuler, + NSVerticalRuler +} + +class NSRulerView : NSView +{ + mixin (ObjcWrap); + + static void registerUnitWithName (NSString unitName, NSString abbreviation, CGFloat conversionFactor, NSArray stepUpCycle, NSArray stepDownCycle) + { + return invokeObjcSelfClass!(void, "registerUnitWithName:abbreviation:unitToPointsConversionFactor:stepUpCycle:stepDownCycle:", NSString, NSString, CGFloat, NSArray, NSArray)(unitName, abbreviation, conversionFactor, stepUpCycle, stepDownCycle); + } + + NSRulerView initWithScrollView (NSScrollView scrollView, uint orientation) + { + id result = invokeObjcSelf!(id, "initWithScrollView:orientation:", NSScrollView, uint)(scrollView, orientation); + return result is this.objcObject ? this : (result !is null ? new NSRulerView(result) : null); + } + + this (NSScrollView scrollView, uint orientation) + { + super(NSRulerView.alloc.initWithScrollView(scrollView, orientation).objcObject); + } + + void setScrollView (NSScrollView scrollView) + { + return invokeObjcSelf!(void, "setScrollView:", NSScrollView)(scrollView); + } + + NSScrollView scrollView () + { + return invokeObjcSelf!(NSScrollView, "scrollView"); + } + + void setOrientation (uint orientation) + { + return invokeObjcSelf!(void, "setOrientation:", uint)(orientation); + } + + uint orientation () + { + return invokeObjcSelf!(uint, "orientation"); + } + + CGFloat baselineLocation () + { + return invokeObjcSelf!(CGFloat, "baselineLocation"); + } + + CGFloat requiredThickness () + { + return invokeObjcSelf!(CGFloat, "requiredThickness"); + } + + void setRuleThickness (CGFloat thickness) + { + return invokeObjcSelf!(void, "setRuleThickness:", CGFloat)(thickness); + } + + CGFloat ruleThickness () + { + return invokeObjcSelf!(CGFloat, "ruleThickness"); + } + + void setReservedThicknessForMarkers (CGFloat thickness) + { + return invokeObjcSelf!(void, "setReservedThicknessForMarkers:", CGFloat)(thickness); + } + + CGFloat reservedThicknessForMarkers () + { + return invokeObjcSelf!(CGFloat, "reservedThicknessForMarkers"); + } + + void setReservedThicknessForAccessoryView (CGFloat thickness) + { + return invokeObjcSelf!(void, "setReservedThicknessForAccessoryView:", CGFloat)(thickness); + } + + CGFloat reservedThicknessForAccessoryView () + { + return invokeObjcSelf!(CGFloat, "reservedThicknessForAccessoryView"); + } + + void setMeasurementUnits (NSString unitName) + { + return invokeObjcSelf!(void, "setMeasurementUnits:", NSString)(unitName); + } + + NSString measurementUnits () + { + return invokeObjcSelf!(NSString, "measurementUnits"); + } + + void setOriginOffset (CGFloat offset) + { + return invokeObjcSelf!(void, "setOriginOffset:", CGFloat)(offset); + } + + CGFloat originOffset () + { + return invokeObjcSelf!(CGFloat, "originOffset"); + } + + void setClientView (NSView client) + { + return invokeObjcSelf!(void, "setClientView:", NSView)(client); + } + + NSView clientView () + { + return invokeObjcSelf!(NSView, "clientView"); + } + + void setMarkers (NSArray markers) + { + return invokeObjcSelf!(void, "setMarkers:", NSArray)(markers); + } + + void addMarker (NSRulerMarker marker) + { + return invokeObjcSelf!(void, "addMarker:", NSRulerMarker)(marker); + } + + void removeMarker (NSRulerMarker marker) + { + return invokeObjcSelf!(void, "removeMarker:", NSRulerMarker)(marker); + } + + NSArray markers () + { + return invokeObjcSelf!(NSArray, "markers"); + } + + bool trackMarker (NSRulerMarker marker, NSEvent event) + { + return invokeObjcSelf!(bool, "trackMarker:withMouseEvent:", NSRulerMarker, NSEvent)(marker, event); + } + + void setAccessoryView (NSView accessory) + { + return invokeObjcSelf!(void, "setAccessoryView:", NSView)(accessory); + } + + NSView accessoryView () + { + return invokeObjcSelf!(NSView, "accessoryView"); + } + + void moveRulerlineFromLocation (CGFloat oldLocation, CGFloat newLocation) + { + return invokeObjcSelf!(void, "moveRulerlineFromLocation:toLocation:", CGFloat, CGFloat)(oldLocation, newLocation); + } + + void invalidateHashMarks () + { + return invokeObjcSelf!(void, "invalidateHashMarks"); + } + + void drawHashMarksAndLabelsInRect (NSRect rect) + { + return invokeObjcSelf!(void, "drawHashMarksAndLabelsInRect:", NSRect)(rect); + } + + void drawMarkersInRect (NSRect rect) + { + return invokeObjcSelf!(void, "drawMarkersInRect:", NSRect)(rect); + } + + bool isFlipped () + { + return invokeObjcSelf!(bool, "isFlipped"); + } +} + +const TNSRulerMarkerClientViewDelegation = ` + + bool rulerView_shouldMoveMarker (NSRulerView ruler, NSRulerMarker marker) + { + return invokeObjcSelf!(bool, "rulerView:shouldMoveMarker:", NSRulerView, NSRulerMarker)(ruler, marker); + } + + CGFloat rulerView (NSRulerView ruler, NSRulerMarker marker, CGFloat location) + { + return invokeObjcSelf!(CGFloat, "rulerView:willMoveMarker:toLocation:", NSRulerView, NSRulerMarker, CGFloat)(ruler, marker, location); + } + + void rulerView (NSRulerView ruler, NSRulerMarker marker) + { + return invokeObjcSelf!(void, "rulerView:didMoveMarker:", NSRulerView, NSRulerMarker)(ruler, marker); + } + + void rulerView_shouldRemoveMarker (NSRulerView ruler, NSRulerMarker marker) + { + return invokeObjcSelf!(void, "rulerView:shouldRemoveMarker:", NSRulerView, NSRulerMarker)(ruler, marker); + } + + void rulerView_didRemoveMarker (NSRulerView ruler, NSRulerMarker marker) + { + return invokeObjcSelf!(void, "rulerView:didRemoveMarker:", NSRulerView, NSRulerMarker)(ruler, marker); + } + + bool rulerView_shouldAddMarker (NSRulerView ruler, NSRulerMarker marker) + { + return invokeObjcSelf!(bool, "rulerView:shouldAddMarker:", NSRulerView, NSRulerMarker)(ruler, marker); + } + + CGFloat rulerView_willAddMarker_atLocation (NSRulerView ruler, NSRulerMarker marker, CGFloat location) + { + return invokeObjcSelf!(CGFloat, "rulerView:willAddMarker:atLocation:", NSRulerView, NSRulerMarker, CGFloat)(ruler, marker, location); + } + + void rulerView_didAddMarker (NSRulerView ruler, NSRulerMarker marker) + { + return invokeObjcSelf!(void, "rulerView:didAddMarker:", NSRulerView, NSRulerMarker)(ruler, marker); + } + + void rulerView (NSRulerView ruler, NSEvent event) + { + return invokeObjcSelf!(void, "rulerView:handleMouseDown:", NSRulerView, NSEvent)(ruler, event); + } + + CGFloat rulerView (NSRulerView ruler, NSView newClient) + { + return invokeObjcSelf!(CGFloat, "rulerView:willSetClientView:", NSRulerView, NSView)(ruler, newClient); + } + + //mixin ObjcBindMethod!(rulerView_shouldMoveMarker, "rulerView:shouldMoveMarker:"); + //mixin ObjcBindMethod!(rulerView, CGFloat, "rulerView:willMoveMarker:toLocation:", NSRulerView, NSRulerMarker, CGFloat); + //mixin ObjcBindMethod!(rulerView, void, "rulerView:didMoveMarker:", NSRulerView, NSRulerMarker); + //mixin ObjcBindMethod!(rulerView_shouldRemoveMarker, "rulerView:shouldRemoveMarker:"); + //mixin ObjcBindMethod!(rulerView_didRemoveMarker, "rulerView:didRemoveMarker:"); + //mixin ObjcBindMethod!(rulerView_shouldAddMarker, "rulerView:shouldAddMarker:"); + //mixin ObjcBindMethod!(rulerView_willAddMarker_atLocation, "rulerView:willAddMarker:atLocation:"); + //mixin ObjcBindMethod!(rulerView_didAddMarker, "rulerView:didAddMarker:"); + //mixin ObjcBindMethod!(rulerView, void, "rulerView:handleMouseDown:", NSRulerView, NSEvent); + //mixin ObjcBindMethod!(rulerView, CGFloat, "rulerView:willSetClientView:", NSRulerView, NSView); + +`; + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSSavePanel.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSSavePanel.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,327 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSSavePanel; + +import dstep.appkit.NSBox; +import dstep.appkit.NSNibDeclarations; +import dstep.appkit.NSPanel; +import dstep.appkit.NSTextField; +import dstep.appkit.NSTextView; +import dstep.appkit.NSView; +import dstep.appkit.NSWindow; +import dstep.foundation.NSArray; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSString; +import dstep.foundation.NSURL; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +// This should no need to be here +private enum +{ + NSOKButton = 1, + NSCancelButton = 0 +} + +enum +{ + NSFileHandlingPanelCancelButton = NSCancelButton, + NSFileHandlingPanelOKButton = NSOKButton +} + +struct _SPFlags +{ + uint saveMode; + uint isExpanded; + uint allowsOtherFileTypes; + uint canCreateDirectories; + uint canSelectedHiddenExtension; + uint reserved; +} + +const TNSSavePanelRuntime = ` + + void ok (Object sender) + { + return invokeObjcSelf!(void, "ok:", Object)(sender); + } + + void cancel (Object sender) + { + return invokeObjcSelf!(void, "cancel:", Object)(sender); + } + + void beginSheetForDirectory (NSString path, NSString name, NSWindow docWindow, Object delegate_, SEL didEndSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "beginSheetForDirectory:file:modalForWindow:modalDelegate:didEndSelector:contextInfo:", NSString, NSString, NSWindow, Object, SEL, void*)(path, name, docWindow, delegate_, didEndSelector, contextInfo); + } + + NSInteger runModalForDirectory (NSString path, NSString name) + { + return invokeObjcSelf!(NSInteger, "runModalForDirectory:file:", NSString, NSString)(path, name); + } + + NSInteger runModal () + { + return invokeObjcSelf!(NSInteger, "runModal"); + } + + //mixin ObjcBindMethod!(ok, "ok:"); + //mixin ObjcBindMethod!(cancel, "cancel:"); + //mixin ObjcBindMethod!(beginSheetForDirectory, "beginSheetForDirectory:file:modalForWindow:modalDelegate:didEndSelector:contextInfo:"); + //mixin ObjcBindMethod!(runModalForDirectory, "runModalForDirectory:file:"); + //mixin ObjcBindMethod!(runModal, "runModal"); + +`; + +const TNSSavePanelDelegate = ` + + bool panel (Object sender, NSString filename) + { + return invokeObjcSelf!(bool, "panel:shouldShowFilename:", Object, NSString)(sender, filename); + } + + int panel (Object sender, NSString name1, NSString name2, bool caseSensitive) + { + return invokeObjcSelf!(int, "panel:compareFilename:with:caseSensitive:", Object, NSString, NSString, bool)(sender, name1, name2, caseSensitive); + } + + bool panel (Object sender, NSString filename) + { + return invokeObjcSelf!(bool, "panel:isValidFilename:", Object, NSString)(sender, filename); + } + + NSString panel (Object sender, NSString filename, bool okFlag) + { + return invokeObjcSelf!(NSString, "panel:userEnteredFilename:confirmed:", Object, NSString, bool)(sender, filename, okFlag); + } + + void panel (Object sender, bool expanding) + { + return invokeObjcSelf!(void, "panel:willExpand:", Object, bool)(sender, expanding); + } + + void panel (Object sender, NSString path) + { + return invokeObjcSelf!(void, "panel:directoryDidChange:", Object, NSString)(sender, path); + } + + void panelSelectionDidChange (Object sender) + { + return invokeObjcSelf!(void, "panelSelectionDidChange:", Object)(sender); + } + + //mixin ObjcBindMethod!(panel, "panel:shouldShowFilename:"); + //mixin ObjcBindMethod!(panel, "panel:compareFilename:with:caseSensitive:"); + //mixin ObjcBindMethod!(panel, "panel:isValidFilename:"); + //mixin ObjcBindMethod!(panel, "panel:userEnteredFilename:confirmed:"); + //mixin ObjcBindMethod!(panel, "panel:willExpand:"); + //mixin ObjcBindMethod!(panel, "panel:directoryDidChange:"); + //mixin ObjcBindMethod!(panelSelectionDidChange, "panelSelectionDidChange:"); + +`; + +class NSSavePanel : NSPanel +{ + mixin (ObjcWrap); + + static NSSavePanel savePanel () + { + return invokeObjcSelfClass!(NSSavePanel, "savePanel"); + } + + NSURL URL () + { + return invokeObjcSelf!(NSURL, "URL"); + } + + NSString filename () + { + return invokeObjcSelf!(NSString, "filename"); + } + + NSString directory () + { + return invokeObjcSelf!(NSString, "directory"); + } + + void setDirectory (NSString path) + { + return invokeObjcSelf!(void, "setDirectory:", NSString)(path); + } + + NSString requiredFileType () + { + return invokeObjcSelf!(NSString, "requiredFileType"); + } + + void setRequiredFileType (NSString type) + { + return invokeObjcSelf!(void, "setRequiredFileType:", NSString)(type); + } + + NSArray allowedFileTypes () + { + return invokeObjcSelf!(NSArray, "allowedFileTypes"); + } + + void setAllowedFileTypes (NSArray types) + { + return invokeObjcSelf!(void, "setAllowedFileTypes:", NSArray)(types); + } + + bool allowsOtherFileTypes () + { + return invokeObjcSelf!(bool, "allowsOtherFileTypes"); + } + + void setAllowsOtherFileTypes (bool flag) + { + return invokeObjcSelf!(void, "setAllowsOtherFileTypes:", bool)(flag); + } + + NSView accessoryView () + { + return invokeObjcSelf!(NSView, "accessoryView"); + } + + void setAccessoryView (NSView view) + { + return invokeObjcSelf!(void, "setAccessoryView:", NSView)(view); + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + void setDelegate (Object delegate_) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(delegate_); + } + + bool isExpanded () + { + return invokeObjcSelf!(bool, "isExpanded"); + } + + bool canCreateDirectories () + { + return invokeObjcSelf!(bool, "canCreateDirectories"); + } + + void setCanCreateDirectories (bool flag) + { + return invokeObjcSelf!(void, "setCanCreateDirectories:", bool)(flag); + } + + bool canSelectHiddenExtension () + { + return invokeObjcSelf!(bool, "canSelectHiddenExtension"); + } + + void setCanSelectHiddenExtension (bool flag) + { + return invokeObjcSelf!(void, "setCanSelectHiddenExtension:", bool)(flag); + } + + bool isExtensionHidden () + { + return invokeObjcSelf!(bool, "isExtensionHidden"); + } + + void setExtensionHidden (bool flag) + { + return invokeObjcSelf!(void, "setExtensionHidden:", bool)(flag); + } + + bool treatsFilePackagesAsDirectories () + { + return invokeObjcSelf!(bool, "treatsFilePackagesAsDirectories"); + } + + void setTreatsFilePackagesAsDirectories (bool flag) + { + return invokeObjcSelf!(void, "setTreatsFilePackagesAsDirectories:", bool)(flag); + } + + NSString prompt () + { + return invokeObjcSelf!(NSString, "prompt"); + } + + void setPrompt (NSString prompt) + { + return invokeObjcSelf!(void, "setPrompt:", NSString)(prompt); + } + + NSString title () + { + return invokeObjcSelf!(NSString, "title"); + } + + void setTitle (NSString title) + { + return invokeObjcSelf!(void, "setTitle:", NSString)(title); + } + + NSString nameFieldLabel () + { + return invokeObjcSelf!(NSString, "nameFieldLabel"); + } + + void setNameFieldLabel (NSString label) + { + return invokeObjcSelf!(void, "setNameFieldLabel:", NSString)(label); + } + + NSString message () + { + return invokeObjcSelf!(NSString, "message"); + } + + void setMessage (NSString message) + { + return invokeObjcSelf!(void, "setMessage:", NSString)(message); + } + + void validateVisibleColumns () + { + return invokeObjcSelf!(void, "validateVisibleColumns"); + } + + void selectText (Object sender) + { + return invokeObjcSelf!(void, "selectText:", Object)(sender); + } + + // NSSavePanelRuntime + void ok (Object sender) + { + return invokeObjcSelf!(void, "ok:", Object)(sender); + } + + void cancel (Object sender) + { + return invokeObjcSelf!(void, "cancel:", Object)(sender); + } + + void beginSheetForDirectory (NSString path, NSString name, NSWindow docWindow, Object delegate_, SEL didEndSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "beginSheetForDirectory:file:modalForWindow:modalDelegate:didEndSelector:contextInfo:", NSString, NSString, NSWindow, Object, SEL, void*)(path, name, docWindow, delegate_, didEndSelector, contextInfo); + } + + NSInteger runModalForDirectory (NSString path, NSString name) + { + return invokeObjcSelf!(NSInteger, "runModalForDirectory:file:", NSString, NSString)(path, name); + } + + NSInteger runModal () + { + return invokeObjcSelf!(NSInteger, "runModal"); + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSScreen.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSScreen.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,71 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSScreen; + +import dstep.appkit.NSGraphics; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSArray; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +struct NSScreenAuxiliary; + +alias NSScreenAuxiliary NSScreenAuxiliaryOpaque; + +class NSScreen : NSObject +{ + mixin (ObjcWrap); + + static NSArray screens () + { + return invokeObjcSelfClass!(NSArray, "screens"); + } + + static NSScreen mainScreen () + { + return invokeObjcSelfClass!(NSScreen, "mainScreen"); + } + + static NSScreen deepestScreen () + { + return invokeObjcSelfClass!(NSScreen, "deepestScreen"); + } + + int depth () + { + return invokeObjcSelf!(int, "depth"); + } + + NSRect frame () + { + return invokeObjcSelf!(NSRect, "frame"); + } + + NSRect visibleFrame () + { + return invokeObjcSelf!(NSRect, "visibleFrame"); + } + + NSDictionary deviceDescription () + { + return invokeObjcSelf!(NSDictionary, "deviceDescription"); + } + + NSWindowDepth* supportedWindowDepths () + { + return invokeObjcSelf!(NSWindowDepth*, "supportedWindowDepths"); + } + + CGFloat userSpaceScaleFactor () + { + return invokeObjcSelf!(CGFloat, "userSpaceScaleFactor"); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSScrollView.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSScrollView.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,400 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSScrollView; + +import dstep.appkit.NSClipView; +import dstep.appkit.NSColor; +import dstep.appkit.NSCursor; +import dstep.appkit.NSEvent; +import dstep.appkit.NSRulerView; +import dstep.appkit.NSScroller; +import dstep.appkit.NSView; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSDate; +import dstep.foundation.NSGeometry; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +struct _SFlags +{ + uint RESERVED; + uint autoforwardsScrollWheelEvents; + uint autohidesScrollers; + uint hasCustomLineBorderColor; + uint focusRingNeedsRedisplay; + uint skipRemoveSuperviewCheck; + uint doesNotDrawBackground; + uint needsTile; + uint hasVerticalRuler; + uint hasHorizontalRuler; + uint showRulers; + uint oldRulerInstalled; + uint borderType; + uint noDynamicScrolling; + uint hScrollerStatus; + uint vScrollerStatus; + uint hScrollerRequired; + uint vScrollerRequired; +} + +const TNSRulerSupport = ` + + static void setRulerViewClass (Class rulerViewClass) + { + return invokeObjcSelfClass!(void, "setRulerViewClass:", Class)(rulerViewClass); + } + + static Class rulerViewClass () + { + return invokeObjcSelfClass!(Class, "rulerViewClass"); + } + + void setRulersVisible (bool flag) + { + return invokeObjcSelf!(void, "setRulersVisible:", bool)(flag); + } + + bool rulersVisible () + { + return invokeObjcSelf!(bool, "rulersVisible"); + } + + void setHasHorizontalRuler (bool flag) + { + return invokeObjcSelf!(void, "setHasHorizontalRuler:", bool)(flag); + } + + bool hasHorizontalRuler () + { + return invokeObjcSelf!(bool, "hasHorizontalRuler"); + } + + void setHasVerticalRuler (bool flag) + { + return invokeObjcSelf!(void, "setHasVerticalRuler:", bool)(flag); + } + + bool hasVerticalRuler () + { + return invokeObjcSelf!(bool, "hasVerticalRuler"); + } + + void setHorizontalRulerView (NSRulerView ruler) + { + return invokeObjcSelf!(void, "setHorizontalRulerView:", NSRulerView)(ruler); + } + + NSRulerView horizontalRulerView () + { + return invokeObjcSelf!(NSRulerView, "horizontalRulerView"); + } + + void setVerticalRulerView (NSRulerView ruler) + { + return invokeObjcSelf!(void, "setVerticalRulerView:", NSRulerView)(ruler); + } + + NSRulerView verticalRulerView () + { + return invokeObjcSelf!(NSRulerView, "verticalRulerView"); + } + + //mixin ObjcBindClassMethod!(setRulerViewClass, "setRulerViewClass:"); + //mixin ObjcBindClassMethod!(rulerViewClass, "rulerViewClass"); + //mixin ObjcBindMethod!(setRulersVisible, "setRulersVisible:"); + //mixin ObjcBindMethod!(rulersVisible, "rulersVisible"); + //mixin ObjcBindMethod!(setHasHorizontalRuler, "setHasHorizontalRuler:"); + //mixin ObjcBindMethod!(hasHorizontalRuler, "hasHorizontalRuler"); + //mixin ObjcBindMethod!(setHasVerticalRuler, "setHasVerticalRuler:"); + //mixin ObjcBindMethod!(hasVerticalRuler, "hasVerticalRuler"); + //mixin ObjcBindMethod!(setHorizontalRulerView, "setHorizontalRulerView:"); + //mixin ObjcBindMethod!(horizontalRulerView, "horizontalRulerView"); + //mixin ObjcBindMethod!(setVerticalRulerView, "setVerticalRulerView:"); + //mixin ObjcBindMethod!(verticalRulerView, "verticalRulerView"); + +`; + +class NSScrollView : NSView +{ + mixin (ObjcWrap); + + static NSSize frameSizeForContentSize (NSSize cSize, bool hFlag, bool vFlag, uint aType) + { + return invokeObjcSelfClass!(NSSize, "frameSizeForContentSize:hasHorizontalScroller:hasVerticalScroller:borderType:", NSSize, bool, bool, uint)(cSize, hFlag, vFlag, aType); + } + + static NSSize contentSizeForFrameSize (NSSize fSize, bool hFlag, bool vFlag, uint aType) + { + return invokeObjcSelfClass!(NSSize, "contentSizeForFrameSize:hasHorizontalScroller:hasVerticalScroller:borderType:", NSSize, bool, bool, uint)(fSize, hFlag, vFlag, aType); + } + + NSRect documentVisibleRect () + { + return invokeObjcSelf!(NSRect, "documentVisibleRect"); + } + + NSSize contentSize () + { + return invokeObjcSelf!(NSSize, "contentSize"); + } + + void setDocumentView (NSView aView) + { + return invokeObjcSelf!(void, "setDocumentView:", NSView)(aView); + } + + Object documentView () + { + return invokeObjcSelf!(Object, "documentView"); + } + + void setContentView (NSClipView contentView) + { + return invokeObjcSelf!(void, "setContentView:", NSClipView)(contentView); + } + + NSClipView contentView () + { + return invokeObjcSelf!(NSClipView, "contentView"); + } + + void setDocumentCursor (NSCursor anObj) + { + return invokeObjcSelf!(void, "setDocumentCursor:", NSCursor)(anObj); + } + + NSCursor documentCursor () + { + return invokeObjcSelf!(NSCursor, "documentCursor"); + } + + void setBorderType (uint aType) + { + return invokeObjcSelf!(void, "setBorderType:", uint)(aType); + } + + uint borderType () + { + return invokeObjcSelf!(uint, "borderType"); + } + + void setBackgroundColor (NSColor color) + { + return invokeObjcSelf!(void, "setBackgroundColor:", NSColor)(color); + } + + NSColor backgroundColor () + { + return invokeObjcSelf!(NSColor, "backgroundColor"); + } + + void setDrawsBackground (bool flag) + { + return invokeObjcSelf!(void, "setDrawsBackground:", bool)(flag); + } + + bool drawsBackground () + { + return invokeObjcSelf!(bool, "drawsBackground"); + } + + void setHasVerticalScroller (bool flag) + { + return invokeObjcSelf!(void, "setHasVerticalScroller:", bool)(flag); + } + + bool hasVerticalScroller () + { + return invokeObjcSelf!(bool, "hasVerticalScroller"); + } + + void setHasHorizontalScroller (bool flag) + { + return invokeObjcSelf!(void, "setHasHorizontalScroller:", bool)(flag); + } + + bool hasHorizontalScroller () + { + return invokeObjcSelf!(bool, "hasHorizontalScroller"); + } + + void setVerticalScroller (NSScroller anObject) + { + return invokeObjcSelf!(void, "setVerticalScroller:", NSScroller)(anObject); + } + + NSScroller verticalScroller () + { + return invokeObjcSelf!(NSScroller, "verticalScroller"); + } + + void setHorizontalScroller (NSScroller anObject) + { + return invokeObjcSelf!(void, "setHorizontalScroller:", NSScroller)(anObject); + } + + NSScroller horizontalScroller () + { + return invokeObjcSelf!(NSScroller, "horizontalScroller"); + } + + bool autohidesScrollers () + { + return invokeObjcSelf!(bool, "autohidesScrollers"); + } + + void setAutohidesScrollers (bool flag) + { + return invokeObjcSelf!(void, "setAutohidesScrollers:", bool)(flag); + } + + void setHorizontalLineScroll (CGFloat value) + { + return invokeObjcSelf!(void, "setHorizontalLineScroll:", CGFloat)(value); + } + + void setVerticalLineScroll (CGFloat value) + { + return invokeObjcSelf!(void, "setVerticalLineScroll:", CGFloat)(value); + } + + void setLineScroll (CGFloat value) + { + return invokeObjcSelf!(void, "setLineScroll:", CGFloat)(value); + } + + CGFloat horizontalLineScroll () + { + return invokeObjcSelf!(CGFloat, "horizontalLineScroll"); + } + + CGFloat verticalLineScroll () + { + return invokeObjcSelf!(CGFloat, "verticalLineScroll"); + } + + CGFloat lineScroll () + { + return invokeObjcSelf!(CGFloat, "lineScroll"); + } + + void setHorizontalPageScroll (CGFloat value) + { + return invokeObjcSelf!(void, "setHorizontalPageScroll:", CGFloat)(value); + } + + void setVerticalPageScroll (CGFloat value) + { + return invokeObjcSelf!(void, "setVerticalPageScroll:", CGFloat)(value); + } + + void setPageScroll (CGFloat value) + { + return invokeObjcSelf!(void, "setPageScroll:", CGFloat)(value); + } + + CGFloat horizontalPageScroll () + { + return invokeObjcSelf!(CGFloat, "horizontalPageScroll"); + } + + CGFloat verticalPageScroll () + { + return invokeObjcSelf!(CGFloat, "verticalPageScroll"); + } + + CGFloat pageScroll () + { + return invokeObjcSelf!(CGFloat, "pageScroll"); + } + + void setScrollsDynamically (bool flag) + { + return invokeObjcSelf!(void, "setScrollsDynamically:", bool)(flag); + } + + bool scrollsDynamically () + { + return invokeObjcSelf!(bool, "scrollsDynamically"); + } + + void tile () + { + return invokeObjcSelf!(void, "tile"); + } + + void reflectScrolledClipView (NSClipView cView) + { + return invokeObjcSelf!(void, "reflectScrolledClipView:", NSClipView)(cView); + } + + void scrollWheel (NSEvent theEvent) + { + return invokeObjcSelf!(void, "scrollWheel:", NSEvent)(theEvent); + } + + // NSRulerSupport + static void setRulerViewClass (Class rulerViewClass) + { + return invokeObjcSelfClass!(void, "setRulerViewClass:", Class)(rulerViewClass); + } + + static Class rulerViewClass () + { + return invokeObjcSelfClass!(Class, "rulerViewClass"); + } + + void setRulersVisible (bool flag) + { + return invokeObjcSelf!(void, "setRulersVisible:", bool)(flag); + } + + bool rulersVisible () + { + return invokeObjcSelf!(bool, "rulersVisible"); + } + + void setHasHorizontalRuler (bool flag) + { + return invokeObjcSelf!(void, "setHasHorizontalRuler:", bool)(flag); + } + + bool hasHorizontalRuler () + { + return invokeObjcSelf!(bool, "hasHorizontalRuler"); + } + + void setHasVerticalRuler (bool flag) + { + return invokeObjcSelf!(void, "setHasVerticalRuler:", bool)(flag); + } + + bool hasVerticalRuler () + { + return invokeObjcSelf!(bool, "hasVerticalRuler"); + } + + void setHorizontalRulerView (NSRulerView ruler) + { + return invokeObjcSelf!(void, "setHorizontalRulerView:", NSRulerView)(ruler); + } + + NSRulerView horizontalRulerView () + { + return invokeObjcSelf!(NSRulerView, "horizontalRulerView"); + } + + void setVerticalRulerView (NSRulerView ruler) + { + return invokeObjcSelf!(void, "setVerticalRulerView:", NSRulerView)(ruler); + } + + NSRulerView verticalRulerView () + { + return invokeObjcSelf!(NSRulerView, "verticalRulerView"); + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSScroller.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSScroller.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,169 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSScroller; + +import dstep.appkit.NSCell; +import dstep.appkit.NSControl; +import dstep.appkit.NSEvent; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +alias NSUInteger NSScrollArrowPosition; +alias NSUInteger NSUsableScrollerParts; +alias NSUInteger NSScrollerPart; +alias NSUInteger NSScrollerArrow; + +enum +{ + NSScrollerArrowsMaxEnd = 0, + NSScrollerArrowsMinEnd = 1, + NSScrollerArrowsDefaultSetting = 0, + NSScrollerArrowsNone = 2 +} + +enum +{ + NSNoScrollerParts = 0, + NSOnlyScrollerArrows = 1, + NSAllScrollerParts = 2 +} + +enum +{ + NSScrollerNoPart = 0, + NSScrollerDecrementPage = 1, + NSScrollerKnob = 2, + NSScrollerIncrementPage = 3, + NSScrollerDecrementLine = 4, + NSScrollerIncrementLine = 5, + NSScrollerKnobSlot = 6 +} + +enum +{ + NSScrollerIncrementArrow = 0, + NSScrollerDecrementArrow = 1 +} + +class NSScroller : NSControl +{ + mixin (ObjcWrap); + + static CGFloat scrollerWidth () + { + return invokeObjcSelfClass!(CGFloat, "scrollerWidth"); + } + + static CGFloat scrollerWidthForControlSize (uint controlSize) + { + return invokeObjcSelfClass!(CGFloat, "scrollerWidthForControlSize:", uint)(controlSize); + } + + void drawParts () + { + return invokeObjcSelf!(void, "drawParts"); + } + + NSRect rectForPart (uint partCode) + { + return invokeObjcSelf!(NSRect, "rectForPart:", uint)(partCode); + } + + void checkSpaceForParts () + { + return invokeObjcSelf!(void, "checkSpaceForParts"); + } + + uint usableParts () + { + return invokeObjcSelf!(uint, "usableParts"); + } + + void setArrowsPosition (uint where) + { + return invokeObjcSelf!(void, "setArrowsPosition:", uint)(where); + } + + uint arrowsPosition () + { + return invokeObjcSelf!(uint, "arrowsPosition"); + } + + void setControlTint (uint controlTint) + { + return invokeObjcSelf!(void, "setControlTint:", uint)(controlTint); + } + + uint controlTint () + { + return invokeObjcSelf!(uint, "controlTint"); + } + + void setControlSize (uint controlSize) + { + return invokeObjcSelf!(void, "setControlSize:", uint)(controlSize); + } + + uint controlSize () + { + return invokeObjcSelf!(uint, "controlSize"); + } + + void drawArrow (uint whichArrow, bool flag) + { + return invokeObjcSelf!(void, "drawArrow:highlight:", uint, bool)(whichArrow, flag); + } + + void drawKnob () + { + return invokeObjcSelf!(void, "drawKnob"); + } + + void drawKnobSlotInRect (NSRect slotRect, bool flag) + { + return invokeObjcSelf!(void, "drawKnobSlotInRect:highlight:", NSRect, bool)(slotRect, flag); + } + + void highlight (bool flag) + { + return invokeObjcSelf!(void, "highlight:", bool)(flag); + } + + uint testPart (NSPoint thePoint) + { + return invokeObjcSelf!(uint, "testPart:", NSPoint)(thePoint); + } + + void trackKnob (NSEvent theEvent) + { + return invokeObjcSelf!(void, "trackKnob:", NSEvent)(theEvent); + } + + void trackScrollButtons (NSEvent theEvent) + { + return invokeObjcSelf!(void, "trackScrollButtons:", NSEvent)(theEvent); + } + + uint hitPart () + { + return invokeObjcSelf!(uint, "hitPart"); + } + + CGFloat knobProportion () + { + return invokeObjcSelf!(CGFloat, "knobProportion"); + } + + void setKnobProportion (CGFloat proportion) + { + return invokeObjcSelf!(void, "setKnobProportion:", CGFloat)(proportion); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSSearchField.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSSearchField.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,39 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSSearchField; + +import dstep.appkit.NSTextField; +import dstep.foundation.NSArray; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSSearchField : NSTextField +{ + mixin (ObjcWrap); + + void setRecentSearches (NSArray searches) + { + return invokeObjcSelf!(void, "setRecentSearches:", NSArray)(searches); + } + + NSArray recentSearches () + { + return invokeObjcSelf!(NSArray, "recentSearches"); + } + + void setRecentsAutosaveName (NSString string) + { + return invokeObjcSelf!(void, "setRecentsAutosaveName:", NSString)(string); + } + + NSString recentsAutosaveName () + { + return invokeObjcSelf!(NSString, "recentsAutosaveName"); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSSearchFieldCell.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSSearchFieldCell.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,129 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSSearchFieldCell; + +import dstep.appkit.NSButtonCell; +import dstep.appkit.NSMenu; +import dstep.appkit.NSTextFieldCell; +import dstep.foundation.NSArray; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSString; +import dstep.foundation.NSTimer; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSSearchFieldCell : NSTextFieldCell +{ + mixin (ObjcWrap); + + NSButtonCell searchButtonCell () + { + return invokeObjcSelf!(NSButtonCell, "searchButtonCell"); + } + + void setSearchButtonCell (NSButtonCell cell) + { + return invokeObjcSelf!(void, "setSearchButtonCell:", NSButtonCell)(cell); + } + + NSButtonCell cancelButtonCell () + { + return invokeObjcSelf!(NSButtonCell, "cancelButtonCell"); + } + + void setCancelButtonCell (NSButtonCell cell) + { + return invokeObjcSelf!(void, "setCancelButtonCell:", NSButtonCell)(cell); + } + + void resetSearchButtonCell () + { + return invokeObjcSelf!(void, "resetSearchButtonCell"); + } + + void resetCancelButtonCell () + { + return invokeObjcSelf!(void, "resetCancelButtonCell"); + } + + NSRect searchTextRectForBounds (NSRect rect) + { + return invokeObjcSelf!(NSRect, "searchTextRectForBounds:", NSRect)(rect); + } + + NSRect searchButtonRectForBounds (NSRect rect) + { + return invokeObjcSelf!(NSRect, "searchButtonRectForBounds:", NSRect)(rect); + } + + NSRect cancelButtonRectForBounds (NSRect rect) + { + return invokeObjcSelf!(NSRect, "cancelButtonRectForBounds:", NSRect)(rect); + } + + void setSearchMenuTemplate (NSMenu menu) + { + return invokeObjcSelf!(void, "setSearchMenuTemplate:", NSMenu)(menu); + } + + NSMenu searchMenuTemplate () + { + return invokeObjcSelf!(NSMenu, "searchMenuTemplate"); + } + + void setSendsWholeSearchString (bool flag) + { + return invokeObjcSelf!(void, "setSendsWholeSearchString:", bool)(flag); + } + + bool sendsWholeSearchString () + { + return invokeObjcSelf!(bool, "sendsWholeSearchString"); + } + + void setMaximumRecents (NSInteger maxRecents) + { + return invokeObjcSelf!(void, "setMaximumRecents:", NSInteger)(maxRecents); + } + + NSInteger maximumRecents () + { + return invokeObjcSelf!(NSInteger, "maximumRecents"); + } + + void setRecentSearches (NSArray searches) + { + return invokeObjcSelf!(void, "setRecentSearches:", NSArray)(searches); + } + + NSArray recentSearches () + { + return invokeObjcSelf!(NSArray, "recentSearches"); + } + + void setRecentsAutosaveName (NSString string) + { + return invokeObjcSelf!(void, "setRecentsAutosaveName:", NSString)(string); + } + + NSString recentsAutosaveName () + { + return invokeObjcSelf!(NSString, "recentsAutosaveName"); + } + + bool sendsSearchStringImmediately () + { + return invokeObjcSelf!(bool, "sendsSearchStringImmediately"); + } + + void setSendsSearchStringImmediately (bool flag) + { + return invokeObjcSelf!(void, "setSendsSearchStringImmediately:", bool)(flag); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSSecureTextField.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSSecureTextField.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,28 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSSecureTextField; + +import dstep.appkit.NSTextField; +import dstep.appkit.NSTextFieldCell; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSSecureTextFieldCell : NSTextFieldCell +{ + mixin (ObjcWrap); + + void setEchosBullets (bool flag) + { + return invokeObjcSelf!(void, "setEchosBullets:", bool)(flag); + } + + bool echosBullets () + { + return invokeObjcSelf!(bool, "echosBullets"); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSSegmentedCell.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSSegmentedCell.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,201 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSSegmentedCell; + +import dstep.appkit.NSActionCell; +import dstep.appkit.NSImage; +import dstep.appkit.NSMenu; +import dstep.appkit.NSSegmentedControl; +import dstep.appkit.NSView; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSArray; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +typedef NSUInteger NSSegmentSwitchTracking; + +enum : NSUInteger +{ + NSSegmentSwitchTrackingSelectOne = 0, + NSSegmentSwitchTrackingSelectAny = 1, + NSSegmentSwitchTrackingMomentary = 2 +} + +const TNSSegmentBackgroundStyle = ` + + int interiorBackgroundStyleForSegment (NSInteger segment) + { + return invokeObjcSelf!(int, "interiorBackgroundStyleForSegment:", NSInteger)(segment); + } + + //mixin ObjcBindMethod!(interiorBackgroundStyleForSegment, "interiorBackgroundStyleForSegment:"); + +`; + +class NSSegmentedCell : NSActionCell +{ + mixin (ObjcWrap); + + void setSegmentCount (NSInteger count) + { + return invokeObjcSelf!(void, "setSegmentCount:", NSInteger)(count); + } + + NSInteger segmentCount () + { + return invokeObjcSelf!(NSInteger, "segmentCount"); + } + + void setSelectedSegment (NSInteger selectedSegment) + { + return invokeObjcSelf!(void, "setSelectedSegment:", NSInteger)(selectedSegment); + } + + NSInteger selectedSegment () + { + return invokeObjcSelf!(NSInteger, "selectedSegment"); + } + + bool selectSegmentWithTag (NSInteger tag) + { + return invokeObjcSelf!(bool, "selectSegmentWithTag:", NSInteger)(tag); + } + + void makeNextSegmentKey () + { + return invokeObjcSelf!(void, "makeNextSegmentKey"); + } + + void makePreviousSegmentKey () + { + return invokeObjcSelf!(void, "makePreviousSegmentKey"); + } + + void setTrackingMode (uint trackingMode) + { + return invokeObjcSelf!(void, "setTrackingMode:", uint)(trackingMode); + } + + uint trackingMode () + { + return invokeObjcSelf!(uint, "trackingMode"); + } + + void setWidth (CGFloat width, NSInteger segment) + { + return invokeObjcSelf!(void, "setWidth:forSegment:", CGFloat, NSInteger)(width, segment); + } + + CGFloat widthForSegment (NSInteger segment) + { + return invokeObjcSelf!(CGFloat, "widthForSegment:", NSInteger)(segment); + } + + void setImage (NSImage image, NSInteger segment) + { + return invokeObjcSelf!(void, "setImage:forSegment:", NSImage, NSInteger)(image, segment); + } + + NSImage imageForSegment (NSInteger segment) + { + return invokeObjcSelf!(NSImage, "imageForSegment:", NSInteger)(segment); + } + + void setImageScaling (uint scaling, NSInteger segment) + { + return invokeObjcSelf!(void, "setImageScaling:forSegment:", uint, NSInteger)(scaling, segment); + } + + uint imageScalingForSegment (NSInteger segment) + { + return invokeObjcSelf!(uint, "imageScalingForSegment:", NSInteger)(segment); + } + + void setLabel (NSString label, NSInteger segment) + { + return invokeObjcSelf!(void, "setLabel:forSegment:", NSString, NSInteger)(label, segment); + } + + NSString labelForSegment (NSInteger segment) + { + return invokeObjcSelf!(NSString, "labelForSegment:", NSInteger)(segment); + } + + void setSelected (bool selected, NSInteger segment) + { + return invokeObjcSelf!(void, "setSelected:forSegment:", bool, NSInteger)(selected, segment); + } + + bool isSelectedForSegment (NSInteger segment) + { + return invokeObjcSelf!(bool, "isSelectedForSegment:", NSInteger)(segment); + } + + void setEnabled (bool enabled, NSInteger segment) + { + return invokeObjcSelf!(void, "setEnabled:forSegment:", bool, NSInteger)(enabled, segment); + } + + bool isEnabledForSegment (NSInteger segment) + { + return invokeObjcSelf!(bool, "isEnabledForSegment:", NSInteger)(segment); + } + + void setMenu (NSMenu menu, NSInteger segment) + { + return invokeObjcSelf!(void, "setMenu:forSegment:", NSMenu, NSInteger)(menu, segment); + } + + NSMenu menuForSegment (NSInteger segment) + { + return invokeObjcSelf!(NSMenu, "menuForSegment:", NSInteger)(segment); + } + + void setToolTip (NSString toolTip, NSInteger segment) + { + return invokeObjcSelf!(void, "setToolTip:forSegment:", NSString, NSInteger)(toolTip, segment); + } + + NSString toolTipForSegment (NSInteger segment) + { + return invokeObjcSelf!(NSString, "toolTipForSegment:", NSInteger)(segment); + } + + void setTag (NSInteger tag, NSInteger segment) + { + return invokeObjcSelf!(void, "setTag:forSegment:", NSInteger, NSInteger)(tag, segment); + } + + NSInteger tagForSegment (NSInteger segment) + { + return invokeObjcSelf!(NSInteger, "tagForSegment:", NSInteger)(segment); + } + + void setSegmentStyle (int segmentStyle) + { + return invokeObjcSelf!(void, "setSegmentStyle:", int)(segmentStyle); + } + + int segmentStyle () + { + return invokeObjcSelf!(int, "segmentStyle"); + } + + void drawSegment (NSInteger segment, NSRect frame, NSView controlView) + { + return invokeObjcSelf!(void, "drawSegment:inFrame:withView:", NSInteger, NSRect, NSView)(segment, frame, controlView); + } + + // NSSegmentBackgroundStyle + int interiorBackgroundStyleForSegment (NSInteger segment) + { + return invokeObjcSelf!(int, "interiorBackgroundStyleForSegment:", NSInteger)(segment); + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSSegmentedControl.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSSegmentedControl.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,141 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSSegmentedControl; + +import dstep.appkit.NSCell; +import dstep.appkit.NSControl; +import dstep.appkit.NSImage; +import dstep.appkit.NSMenu; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +typedef NSInteger NSSegmentStyle; + +enum : NSInteger +{ + NSSegmentStyleAutomatic = 0, + NSSegmentStyleRounded = 1, + NSSegmentStyleTexturedRounded = 2, + NSSegmentStyleRoundRect = 3, + NSSegmentStyleTexturedSquare = 4, + NSSegmentStyleCapsule = 5, + NSSegmentStyleSmallSquare = 6 +} + +class NSSegmentedControl : NSControl +{ + mixin (ObjcWrap); + + void setSegmentCount (NSInteger count) + { + return invokeObjcSelf!(void, "setSegmentCount:", NSInteger)(count); + } + + NSInteger segmentCount () + { + return invokeObjcSelf!(NSInteger, "segmentCount"); + } + + void setSelectedSegment (NSInteger selectedSegment) + { + return invokeObjcSelf!(void, "setSelectedSegment:", NSInteger)(selectedSegment); + } + + NSInteger selectedSegment () + { + return invokeObjcSelf!(NSInteger, "selectedSegment"); + } + + bool selectSegmentWithTag (NSInteger tag) + { + return invokeObjcSelf!(bool, "selectSegmentWithTag:", NSInteger)(tag); + } + + void setWidth (CGFloat width, NSInteger segment) + { + return invokeObjcSelf!(void, "setWidth:forSegment:", CGFloat, NSInteger)(width, segment); + } + + CGFloat widthForSegment (NSInteger segment) + { + return invokeObjcSelf!(CGFloat, "widthForSegment:", NSInteger)(segment); + } + + void setImage (NSImage image, NSInteger segment) + { + return invokeObjcSelf!(void, "setImage:forSegment:", NSImage, NSInteger)(image, segment); + } + + NSImage imageForSegment (NSInteger segment) + { + return invokeObjcSelf!(NSImage, "imageForSegment:", NSInteger)(segment); + } + + void setImageScaling (uint scaling, NSInteger segment) + { + return invokeObjcSelf!(void, "setImageScaling:forSegment:", uint, NSInteger)(scaling, segment); + } + + uint imageScalingForSegment (NSInteger segment) + { + return invokeObjcSelf!(uint, "imageScalingForSegment:", NSInteger)(segment); + } + + void setLabel (NSString label, NSInteger segment) + { + return invokeObjcSelf!(void, "setLabel:forSegment:", NSString, NSInteger)(label, segment); + } + + NSString labelForSegment (NSInteger segment) + { + return invokeObjcSelf!(NSString, "labelForSegment:", NSInteger)(segment); + } + + void setMenu (NSMenu menu, NSInteger segment) + { + return invokeObjcSelf!(void, "setMenu:forSegment:", NSMenu, NSInteger)(menu, segment); + } + + NSMenu menuForSegment (NSInteger segment) + { + return invokeObjcSelf!(NSMenu, "menuForSegment:", NSInteger)(segment); + } + + void setSelected (bool selected, NSInteger segment) + { + return invokeObjcSelf!(void, "setSelected:forSegment:", bool, NSInteger)(selected, segment); + } + + bool isSelectedForSegment (NSInteger segment) + { + return invokeObjcSelf!(bool, "isSelectedForSegment:", NSInteger)(segment); + } + + void setEnabled (bool enabled, NSInteger segment) + { + return invokeObjcSelf!(void, "setEnabled:forSegment:", bool, NSInteger)(enabled, segment); + } + + bool isEnabledForSegment (NSInteger segment) + { + return invokeObjcSelf!(bool, "isEnabledForSegment:", NSInteger)(segment); + } + + void setSegmentStyle (int segmentStyle) + { + return invokeObjcSelf!(void, "setSegmentStyle:", int)(segmentStyle); + } + + int segmentStyle () + { + return invokeObjcSelf!(int, "segmentStyle"); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSShadow.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSShadow.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,89 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSShadow; + +import dstep.appkit.NSColor; +import dstep.foundation.NSCoder; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObject; +import dstep.foundation.NSZone; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSShadow : NSObject, INSCopying, INSCoding +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + typeof(this) copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); + } + + NSShadow init () + { + id result = invokeObjcSelf!(id, "init"); + return result is this.objcObject ? this : (result !is null ? new NSShadow(result) : null); + } + + this () + { + super(NSShadow.alloc.init.objcObject); + } + + NSSize shadowOffset () + { + return invokeObjcSelf!(NSSize, "shadowOffset"); + } + + void setShadowOffset (NSSize offset) + { + return invokeObjcSelf!(void, "setShadowOffset:", NSSize)(offset); + } + + CGFloat shadowBlurRadius () + { + return invokeObjcSelf!(CGFloat, "shadowBlurRadius"); + } + + void setShadowBlurRadius (CGFloat val) + { + return invokeObjcSelf!(void, "setShadowBlurRadius:", CGFloat)(val); + } + + NSColor shadowColor () + { + return invokeObjcSelf!(NSColor, "shadowColor"); + } + + void setShadowColor (NSColor color) + { + return invokeObjcSelf!(void, "setShadowColor:", NSColor)(color); + } + + void set () + { + return invokeObjcSelf!(void, "set"); + } + +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSSimpleHorizontalTypesetter.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSSimpleHorizontalTypesetter.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,227 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSSimpleHorizontalTypesetter; + +import dstep.appkit.NSFont; +import dstep.appkit.NSLayoutManager; +import dstep.appkit.NSParagraphStyle; +import dstep.appkit.NSTextContainer; +import dstep.appkit.NSTextStorage; +import dstep.appkit.NSTypesetter; +import dstep.internal.Version; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSRange; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +version (D_LP64) +{ + pragma(msg, "warning: NSSimpleHorizontalTypesetter is deprecated starting from Mac OS X 10.4 Tiger."); + pragma(msg, "warning: Developers are recommended to adopt NSATSTypesetter, the default concrete subclass from Mac OS X 10.3 Panther."); +} + +else: + +typedef int NSLayoutStatus; + +enum +{ + NSLayoutNotDone = 0, + NSLayoutDone, + NSLayoutCantFit, + NSLayoutOutOfGlyphs +} + +typedef int NSGlyphLayoutMode; + +enum +{ + NSGlyphLayoutAtAPoint = 0, + NSGlyphLayoutAgainstAPoint, + NSGlyphLayoutWithPrevious +} + +typedef int NSLayoutDirection; + +enum +{ + NSLayoutLeftToRight = 0, + NSLayoutRightToLeft +} + +const NSBaselineNotSet = -1.0; +const NumGlyphsToGetEachTime = 20; + +alias extern (C) NSPoint function (id obj, SEL sel, NSGlyph cur, NSGlyph prev, bool isNominal) _NSPositionOfGlyphMethod; + +struct NSTypesetterGlyphInfo +{ + NSPoint curLocation; + float extent; + float belowBaseline; + float aboveBaseline; + uint glyphCharacterIndex; + id font; + NSSize attachmentSize; + + struct + { + uint defaultPositioning; //:1 + uint dontShow; //:1 + uint isAttachment; //:1 + } +} + +const TNSTypesetterSubclassExtensions = ` + + void typesetterLaidOneGlyph (NSTypesetterGlyphInfo* gl) + { + return invokeObjcSelf!(void, "typesetterLaidOneGlyph:", NSTypesetterGlyphInfo*)(gl); + } + + void willSetLineFragmentRect (NSRect* aRect, NSRange aRange, NSRect* bRect) + { + return invokeObjcSelf!(void, "willSetLineFragmentRect:forGlyphRange:usedRect:", NSRect*, NSRange, NSRect*)(aRect, aRange, bRect); + } +`; + +class NSSimpleHorizontalTypesetter : NSTypesetter +{ + mixin (ObjcWrap); + + static NSSimpleHorizontalTypesetter sharedInstance () + { + return invokeObjcSelfClass!(NSSimpleHorizontalTypesetter, "sharedInstance"); + } + + NSLayoutManager currentLayoutManager () + { + return invokeObjcSelf!(NSLayoutManager, "currentLayoutManager"); + } + + NSTextContainer currentContainer () + { + return invokeObjcSelf!(NSTextContainer, "currentContainer"); + } + + NSParagraphStyle currentParagraphStyle () + { + return invokeObjcSelf!(NSParagraphStyle, "currentParagraphStyle"); + } + + NSTextStorage currentTextStorage () + { + return invokeObjcSelf!(NSTextStorage, "currentTextStorage"); + } + + NSTypesetterGlyphInfo baseOfTypesetterGlyphInfo () + { + return invokeObjcSelf!(NSTypesetterGlyphInfo, "baseOfTypesetterGlyphInfo"); + } + + NSUInteger sizeOfTypesetterGlyphInfo () + { + return invokeObjcSelf!(NSUInteger, "sizeOfTypesetterGlyphInfo"); + } + + NSUInteger capacityOfTypesetterGlyphInfo () + { + return invokeObjcSelf!(NSUInteger, "capacityOfTypesetterGlyphInfo"); + } + + NSUInteger firstGlyphIndexOfCurrentLineFragment () + { + return invokeObjcSelf!(NSUInteger, "firstGlyphIndexOfCurrentLineFragment"); + } + + void layoutGlyphsInLayoutManager (NSLayoutManager layoutManager, NSUInteger startGlyphIndex, NSUInteger maxNumLines, out NSUInteger nextGlyphIndex) + { + return invokeObjcSelf!(void, "layoutGlyphsInLayoutManager:startingAtGlyphIndex:maxNumberOfLineFragments:nextGlyphIndex:", NSLayoutManager, NSUInteger, NSUInteger, NSUInteger*)(layoutManager, startGlyphIndex, maxNumLines, &nextGlyphIndex); + } + + NSLayoutStatus layoutGlyphsInHorizontalLineFragment (NSRect* lineFragmentRect, float* baseline) + { + return invokeObjcSelf!(NSLayoutStatus, "layoutGlyphsInHorizontalLineFragment:baseline:", NSRect*, float*)(lineFragmentRect, baseline); + } + + void clearGlyphCache () + { + return invokeObjcSelf!(void, "clearGlyphCache"); + } + + void fillAttributesCache () + { + return invokeObjcSelf!(void, "fillAttributesCache"); + } + + void clearAttributesCache () + { + return invokeObjcSelf!(void, "clearAttributesCache"); + } + + NSUInteger growGlyphCaches (NSUInteger desiredCapacity, bool fillGlyphInfo) + { + return invokeObjcSelf!(NSUInteger, "growGlyphCaches:fillGlyphInfo:", NSUInteger, bool)(desiredCapacity, fillGlyphInfo); + } + + void updateCurGlyphOffset () + { + return invokeObjcSelf!(void, "updateCurGlyphOffset"); + } + + void insertGlyph (NSGlyph glyph, NSUInteger glyphIndex, NSUInteger charIndex) + { + return invokeObjcSelf!(void, "insertGlyph:atGlyphIndex:characterIndex:", NSGlyph, NSUInteger, NSUInteger)(glyph, glyphIndex, charIndex); + } + + NSLayoutStatus layoutControlGlyphForLineFragment (NSRect lineFrag) + { + return invokeObjcSelf!(NSLayoutStatus, "layoutControlGlyphForLineFragment:", NSRect)(lineFrag); + } + + void layoutTab () + { + return invokeObjcSelf!(void, "layoutTab"); + } + + void breakLineAtIndex (NSUInteger location) + { + return invokeObjcSelf!(void, "breakLineAtIndex:", NSUInteger)(location); + } + + NSUInteger glyphIndexToBreakLineByHyphenatingWordAtIndex (NSUInteger charIndex) + { + return invokeObjcSelf!(NSUInteger, "glyphIndexToBreakLineByHyphenatingWordAtIndex:", NSUInteger)(charIndex); + } + + NSUInteger glyphIndexToBreakLineByWordWrappingAtIndex (NSUInteger charIndex) + { + return invokeObjcSelf!(NSUInteger, "glyphIndexToBreakLineByWordWrappingAtIndex:", NSUInteger)(charIndex); + } + + NSLayoutStatus layoutControlGlyphForLineFragment (NSRect lineFrag) + { + return invokeObjcSelf!(NSLayoutStatus, "layoutControlGlyphForLineFragment:", NSRect)(lineFrag); + } + + void fullJustifyLineAtGlyphIndex (NSUInteger glyphIndexForLineBreak) + { + return invokeObjcSelf!(void, "fullJustifyLineAtGlyphIndex:", NSUInteger)(glyphIndexForLineBreak); + } + + // NSTypesetterSubclassExtensions + void typesetterLaidOneGlyph (NSTypesetterGlyphInfo* gl) + { + return invokeObjcSelf!(void, "typesetterLaidOneGlyph:", NSTypesetterGlyphInfo*)(gl); + } + + void willSetLineFragmentRect (NSRect* aRect, NSRange aRange, NSRect* bRect) + { + return invokeObjcSelf!(void, "willSetLineFragmentRect:forGlyphRange:usedRect:", NSRect*, NSRange, NSRect*)(aRect, aRange, bRect); + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSSlider.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSSlider.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,126 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSSlider; + +import dstep.appkit.NSColor; +import dstep.appkit.NSControl; +import dstep.appkit.NSCell; +import dstep.appkit.NSEvent; +import dstep.appkit.NSFont; +import dstep.appkit.NSImage; +import dstep.appkit.NSSliderCell; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSSlider : NSControl +{ + mixin (ObjcWrap); + + double minValue () + { + return invokeObjcSelf!(double, "minValue"); + } + + void setMinValue (double aDouble) + { + return invokeObjcSelf!(void, "setMinValue:", double)(aDouble); + } + + double maxValue () + { + return invokeObjcSelf!(double, "maxValue"); + } + + void setMaxValue (double aDouble) + { + return invokeObjcSelf!(void, "setMaxValue:", double)(aDouble); + } + + void setAltIncrementValue (double incValue) + { + return invokeObjcSelf!(void, "setAltIncrementValue:", double)(incValue); + } + + double altIncrementValue () + { + return invokeObjcSelf!(double, "altIncrementValue"); + } + + void setTitleCell (NSCell aCell) + { + return invokeObjcSelf!(void, "setTitleCell:", NSCell)(aCell); + } + + Object titleCell () + { + return invokeObjcSelf!(Object, "titleCell"); + } + + void setTitleColor (NSColor newColor) + { + return invokeObjcSelf!(void, "setTitleColor:", NSColor)(newColor); + } + + NSColor titleColor () + { + return invokeObjcSelf!(NSColor, "titleColor"); + } + + void setTitleFont (NSFont fontObj) + { + return invokeObjcSelf!(void, "setTitleFont:", NSFont)(fontObj); + } + + NSFont titleFont () + { + return invokeObjcSelf!(NSFont, "titleFont"); + } + + NSString title () + { + return invokeObjcSelf!(NSString, "title"); + } + + void setTitle (NSString aString) + { + return invokeObjcSelf!(void, "setTitle:", NSString)(aString); + } + + void setKnobThickness (CGFloat aFloat) + { + return invokeObjcSelf!(void, "setKnobThickness:", CGFloat)(aFloat); + } + + CGFloat knobThickness () + { + return invokeObjcSelf!(CGFloat, "knobThickness"); + } + + void setImage (NSImage backgroundImage) + { + return invokeObjcSelf!(void, "setImage:", NSImage)(backgroundImage); + } + + NSImage image () + { + return invokeObjcSelf!(NSImage, "image"); + } + + NSInteger isVertical () + { + return invokeObjcSelf!(NSInteger, "isVertical"); + } + + bool acceptsFirstMouse (NSEvent theEvent) + { + return invokeObjcSelf!(bool, "acceptsFirstMouse:", NSEvent)(theEvent); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSSliderCell.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSSliderCell.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,280 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSSliderCell; + +import dstep.appkit.NSActionCell; +import dstep.appkit.NSColor; +import dstep.appkit.NSCell; +import dstep.appkit.NSFont; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +alias NSUInteger NSTickMarkPosition; +alias NSUInteger NSSliderType; + +enum +{ + NSTickMarkBelow = 0, + NSTickMarkAbove = 1, + NSTickMarkLeft = NSTickMarkAbove, + NSTickMarkRight = NSTickMarkBelow +} + +enum +{ + NSLinearSlider = 0, + NSCircularSlider = 1 +} + +const TNSTickMarkSupport = ` + + void setNumberOfTickMarks (NSInteger count) + { + return invokeObjcSelf!(void, "setNumberOfTickMarks:", NSInteger)(count); + } + + NSInteger numberOfTickMarks () + { + return invokeObjcSelf!(NSInteger, "numberOfTickMarks"); + } + + void setTickMarkPosition (uint position) + { + return invokeObjcSelf!(void, "setTickMarkPosition:", uint)(position); + } + + uint tickMarkPosition () + { + return invokeObjcSelf!(uint, "tickMarkPosition"); + } + + void setAllowsTickMarkValuesOnly (bool yorn) + { + return invokeObjcSelf!(void, "setAllowsTickMarkValuesOnly:", bool)(yorn); + } + + bool allowsTickMarkValuesOnly () + { + return invokeObjcSelf!(bool, "allowsTickMarkValuesOnly"); + } + + double tickMarkValueAtIndex (NSInteger index) + { + return invokeObjcSelf!(double, "tickMarkValueAtIndex:", NSInteger)(index); + } + + NSRect rectOfTickMarkAtIndex (NSInteger index) + { + return invokeObjcSelf!(NSRect, "rectOfTickMarkAtIndex:", NSInteger)(index); + } + + NSInteger indexOfTickMarkAtPoint (NSPoint point) + { + return invokeObjcSelf!(NSInteger, "indexOfTickMarkAtPoint:", NSPoint)(point); + } + + double closestTickMarkValueToValue (double value) + { + return invokeObjcSelf!(double, "closestTickMarkValueToValue:", double)(value); + } + + //mixin ObjcBindMethod!(setNumberOfTickMarks, "setNumberOfTickMarks:"); + //mixin ObjcBindMethod!(numberOfTickMarks, "numberOfTickMarks"); + //mixin ObjcBindMethod!(setTickMarkPosition, "setTickMarkPosition:"); + //mixin ObjcBindMethod!(tickMarkPosition, "tickMarkPosition"); + //mixin ObjcBindMethod!(setAllowsTickMarkValuesOnly, "setAllowsTickMarkValuesOnly:"); + //mixin ObjcBindMethod!(allowsTickMarkValuesOnly, "allowsTickMarkValuesOnly"); + //mixin ObjcBindMethod!(tickMarkValueAtIndex, "tickMarkValueAtIndex:"); + //mixin ObjcBindMethod!(rectOfTickMarkAtIndex, "rectOfTickMarkAtIndex:"); + //mixin ObjcBindMethod!(indexOfTickMarkAtPoint, "indexOfTickMarkAtPoint:"); + //mixin ObjcBindMethod!(closestTickMarkValueToValue, "closestTickMarkValueToValue:"); +`; + +class NSSliderCell : NSActionCell +{ + mixin (ObjcWrap); + + static bool prefersTrackingUntilMouseUp () + { + return invokeObjcSelfClass!(bool, "prefersTrackingUntilMouseUp"); + } + + double minValue () + { + return invokeObjcSelf!(double, "minValue"); + } + + void setMinValue (double aDouble) + { + return invokeObjcSelf!(void, "setMinValue:", double)(aDouble); + } + + double maxValue () + { + return invokeObjcSelf!(double, "maxValue"); + } + + void setMaxValue (double aDouble) + { + return invokeObjcSelf!(void, "setMaxValue:", double)(aDouble); + } + + void setAltIncrementValue (double incValue) + { + return invokeObjcSelf!(void, "setAltIncrementValue:", double)(incValue); + } + + double altIncrementValue () + { + return invokeObjcSelf!(double, "altIncrementValue"); + } + + NSInteger isVertical () + { + return invokeObjcSelf!(NSInteger, "isVertical"); + } + + void setTitleColor (NSColor newColor) + { + return invokeObjcSelf!(void, "setTitleColor:", NSColor)(newColor); + } + + NSColor titleColor () + { + return invokeObjcSelf!(NSColor, "titleColor"); + } + + void setTitleFont (NSFont fontObj) + { + return invokeObjcSelf!(void, "setTitleFont:", NSFont)(fontObj); + } + + NSFont titleFont () + { + return invokeObjcSelf!(NSFont, "titleFont"); + } + + NSString title () + { + return invokeObjcSelf!(NSString, "title"); + } + + void setTitle (NSString aString) + { + return invokeObjcSelf!(void, "setTitle:", NSString)(aString); + } + + void setTitleCell (NSCell aCell) + { + return invokeObjcSelf!(void, "setTitleCell:", NSCell)(aCell); + } + + Object titleCell () + { + return invokeObjcSelf!(Object, "titleCell"); + } + + void setKnobThickness (CGFloat aFloat) + { + return invokeObjcSelf!(void, "setKnobThickness:", CGFloat)(aFloat); + } + + CGFloat knobThickness () + { + return invokeObjcSelf!(CGFloat, "knobThickness"); + } + + NSRect knobRectFlipped (bool flipped) + { + return invokeObjcSelf!(NSRect, "knobRectFlipped:", bool)(flipped); + } + + void drawKnob (NSRect knobRect) + { + return invokeObjcSelf!(void, "drawKnob:", NSRect)(knobRect); + } + + void drawKnob () + { + return invokeObjcSelf!(void, "drawKnob"); + } + + void drawBarInside (NSRect aRect, bool flipped) + { + return invokeObjcSelf!(void, "drawBarInside:flipped:", NSRect, bool)(aRect, flipped); + } + + NSRect trackRect () + { + return invokeObjcSelf!(NSRect, "trackRect"); + } + + void setSliderType (uint sliderType) + { + return invokeObjcSelf!(void, "setSliderType:", uint)(sliderType); + } + + uint sliderType () + { + return invokeObjcSelf!(uint, "sliderType"); + } + + // NSTickMarkSupport + void setNumberOfTickMarks (NSInteger count) + { + return invokeObjcSelf!(void, "setNumberOfTickMarks:", NSInteger)(count); + } + + NSInteger numberOfTickMarks () + { + return invokeObjcSelf!(NSInteger, "numberOfTickMarks"); + } + + void setTickMarkPosition (uint position) + { + return invokeObjcSelf!(void, "setTickMarkPosition:", uint)(position); + } + + uint tickMarkPosition () + { + return invokeObjcSelf!(uint, "tickMarkPosition"); + } + + void setAllowsTickMarkValuesOnly (bool yorn) + { + return invokeObjcSelf!(void, "setAllowsTickMarkValuesOnly:", bool)(yorn); + } + + bool allowsTickMarkValuesOnly () + { + return invokeObjcSelf!(bool, "allowsTickMarkValuesOnly"); + } + + double tickMarkValueAtIndex (NSInteger index) + { + return invokeObjcSelf!(double, "tickMarkValueAtIndex:", NSInteger)(index); + } + + NSRect rectOfTickMarkAtIndex (NSInteger index) + { + return invokeObjcSelf!(NSRect, "rectOfTickMarkAtIndex:", NSInteger)(index); + } + + NSInteger indexOfTickMarkAtPoint (NSPoint point) + { + return invokeObjcSelf!(NSInteger, "indexOfTickMarkAtPoint:", NSPoint)(point); + } + + double closestTickMarkValueToValue (double value) + { + return invokeObjcSelf!(double, "closestTickMarkValueToValue:", double)(value); + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSSound.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSSound.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,249 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSSound; + +import dstep.appkit.AppKitDefines; +import dstep.appkit.NSPasteboard; +import dstep.foundation.NSArray; +import dstep.foundation.NSBundle; +import dstep.foundation.NSCoder; +import dstep.foundation.NSData; +import dstep.foundation.NSDate; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSURL; +import dstep.foundation.NSZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.appkit.NSSound_bindings; + +private +{ + NSString NSSoundPboardType_; +} + +NSString NSSoundPboardType () +{ + if (NSSoundPboardType_) + return NSSoundPboardType_; + + return NSSoundPboardType_ = new NSString(bindings.NSSoundPboardType); +} + +class NSSound : NSObject, INSCopying, INSCoding +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + typeof(this) copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); + } + + static Object soundNamed (NSString name) + { + return invokeObjcSelfClass!(Object, "soundNamed:", NSString)(name); + } + + NSSound initWithContentsOfURL (NSURL url, bool byRef) + { + id result = invokeObjcSelf!(id, "initWithContentsOfURL:byReference:", NSURL, bool)(url, byRef); + return result is this.objcObject ? this : (result !is null ? new NSSound(result) : null); + } + + this (NSURL url, bool byRef) + { + super(NSSound.alloc.initWithContentsOfURL(url, byRef).objcObject); + } + + NSSound initWithContentsOfFile (NSString path, bool byRef) + { + id result = invokeObjcSelf!(id, "initWithContentsOfFile:byReference:", NSString, bool)(path, byRef); + return result is this.objcObject ? this : (result !is null ? new NSSound(result) : null); + } + + this (NSString path, bool byRef) + { + super(NSSound.alloc.initWithContentsOfFile(path, byRef).objcObject); + } + + NSSound initWithData (NSData data) + { + id result = invokeObjcSelf!(id, "initWithData:", NSData)(data); + return result is this.objcObject ? this : (result !is null ? new NSSound(result) : null); + } + + this (NSData data) + { + super(NSSound.alloc.initWithData(data).objcObject); + } + + bool setName (NSString string) + { + return invokeObjcSelf!(bool, "setName:", NSString)(string); + } + + NSString name () + { + return invokeObjcSelf!(NSString, "name"); + } + + static bool canInitWithPasteboard (NSPasteboard pasteboard) + { + return invokeObjcSelfClass!(bool, "canInitWithPasteboard:", NSPasteboard)(pasteboard); + } + + static NSArray soundUnfilteredTypes () + { + return invokeObjcSelfClass!(NSArray, "soundUnfilteredTypes"); + } + + NSSound initWithPasteboard (NSPasteboard pasteboard) + { + id result = invokeObjcSelf!(id, "initWithPasteboard:", NSPasteboard)(pasteboard); + return result is this.objcObject ? this : (result !is null ? new NSSound(result) : null); + } + + this (NSPasteboard pasteboard) + { + super(NSSound.alloc.initWithPasteboard(pasteboard).objcObject); + } + + void writeToPasteboard (NSPasteboard pasteboard) + { + return invokeObjcSelf!(void, "writeToPasteboard:", NSPasteboard)(pasteboard); + } + + bool play () + { + return invokeObjcSelf!(bool, "play"); + } + + bool pause () + { + return invokeObjcSelf!(bool, "pause"); + } + + bool resume () + { + return invokeObjcSelf!(bool, "resume"); + } + + bool stop () + { + return invokeObjcSelf!(bool, "stop"); + } + + bool isPlaying () + { + return invokeObjcSelf!(bool, "isPlaying"); + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + void setDelegate (Object aDelegate) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(aDelegate); + } + + double duration () + { + return invokeObjcSelf!(double, "duration"); + } + + void setVolume (float volume) + { + return invokeObjcSelf!(void, "setVolume:", float)(volume); + } + + float volume () + { + return invokeObjcSelf!(float, "volume"); + } + + double currentTime () + { + return invokeObjcSelf!(double, "currentTime"); + } + + void setCurrentTime (double seconds) + { + return invokeObjcSelf!(void, "setCurrentTime:", double)(seconds); + } + + void setLoops (bool val) + { + return invokeObjcSelf!(void, "setLoops:", bool)(val); + } + + bool loops () + { + return invokeObjcSelf!(bool, "loops"); + } + + void setPlaybackDeviceIdentifier (NSString deviceUID) + { + return invokeObjcSelf!(void, "setPlaybackDeviceIdentifier:", NSString)(deviceUID); + } + + NSString playbackDeviceIdentifier () + { + return invokeObjcSelf!(NSString, "playbackDeviceIdentifier"); + } + + void setChannelMapping (NSArray channelMapping) + { + return invokeObjcSelf!(void, "setChannelMapping:", NSArray)(channelMapping); + } + + NSArray channelMapping () + { + return invokeObjcSelf!(NSArray, "channelMapping"); + } + +} + +const TNSBundleSoundExtensions = ` + + NSString pathForSoundResource (NSString name) + { + return invokeObjcSelf!(NSString, "pathForSoundResource:", NSString)(name); + } + + //mixin ObjcBindMethod!(pathForSoundResource, "pathForSoundResource:"); + +`; + +const TNSSoundDelegateMethods = ` + + void sound (NSSound sound, bool aBool) + { + return invokeObjcSelf!(void, "sound:didFinishPlaying:", NSSound, bool)(sound, aBool); + } + + //mixin ObjcBindMethod!(sound, "sound:didFinishPlaying:"); + +`; + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSSound_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSSound_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,26 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSSound_bindings; + +import dstep.appkit.AppKitDefines; +import dstep.appkit.NSPasteboard; +import dstep.foundation.NSBundle; +import dstep.foundation.NSData; +import dstep.foundation.NSDate; +import dstep.foundation.NSURL; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + + +extern (C) +{ + extern + { + package const id NSSoundPboardType; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSSpeechRecognizer.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSSpeechRecognizer.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,102 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSSpeechRecognizer; + +import dstep.appkit.AppKitDefines; +import dstep.foundation.NSArray; +import dstep.foundation.NSString; +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSSpeechRecognizer : NSObject +{ + mixin (ObjcWrap); + + NSSpeechRecognizer init () + { + id result = invokeObjcSelf!(id, "init"); + return result is this.objcObject ? this : (result !is null ? new NSSpeechRecognizer(result) : null); + } + + this () + { + super(NSSpeechRecognizer.alloc.init.objcObject); + } + + void startListening () + { + return invokeObjcSelf!(void, "startListening"); + } + + void stopListening () + { + return invokeObjcSelf!(void, "stopListening"); + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + void setDelegate (Object anObject) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(anObject); + } + + NSArray commands () + { + return invokeObjcSelf!(NSArray, "commands"); + } + + void setCommands (NSArray commands) + { + return invokeObjcSelf!(void, "setCommands:", NSArray)(commands); + } + + NSString displayedCommandsTitle () + { + return invokeObjcSelf!(NSString, "displayedCommandsTitle"); + } + + void setDisplayedCommandsTitle (NSString title) + { + return invokeObjcSelf!(void, "setDisplayedCommandsTitle:", NSString)(title); + } + + bool listensInForegroundOnly () + { + return invokeObjcSelf!(bool, "listensInForegroundOnly"); + } + + void setListensInForegroundOnly (bool flag) + { + return invokeObjcSelf!(void, "setListensInForegroundOnly:", bool)(flag); + } + + bool blocksOtherRecognizers () + { + return invokeObjcSelf!(bool, "blocksOtherRecognizers"); + } + + void setBlocksOtherRecognizers (bool flag) + { + return invokeObjcSelf!(void, "setBlocksOtherRecognizers:", bool)(flag); + } +} + +const TNSSpeechRecognizerDelegate = ` + + void speechRecognizer (NSSpeechRecognizer sender, Object command) + { + return invokeObjcSelf!(void, "speechRecognizer:didRecognizeCommand:", NSSpeechRecognizer, Object)(sender, command); + } + + //mixin ObjcBindMethod!(speechRecognizer, "speechRecognizer:didRecognizeCommand:"); + +`; + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSSpeechSynthesizer.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSSpeechSynthesizer.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,720 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSSpeechSynthesizer; + +import dstep.appkit.AppKitDefines; +import dstep.foundation.NSArray; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSError; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSRange; +import dstep.foundation.NSString; +import dstep.foundation.NSURL; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.appkit.NSSpeechSynthesizer_bindings; + +alias NSUInteger NSSpeechBoundary; + +private +{ + NSString NSVoiceName_; + NSString NSVoiceIdentifier_; + NSString NSVoiceAge_; + NSString NSVoiceGender_; + NSString NSVoiceDemoText_; + NSString NSVoiceLocaleIdentifier_; + NSString NSVoiceSupportedCharacters_; + NSString NSVoiceIndividuallySpokenCharacters_; + NSString NSVoiceGenderNeuter_; + NSString NSVoiceGenderMale_; + NSString NSVoiceGenderFemale_; + NSString NSSpeechStatusProperty_; + NSString NSSpeechErrorsProperty_; + NSString NSSpeechInputModeProperty_; + NSString NSSpeechCharacterModeProperty_; + NSString NSSpeechNumberModeProperty_; + NSString NSSpeechRateProperty_; + NSString NSSpeechPitchBaseProperty_; + NSString NSSpeechPitchModProperty_; + NSString NSSpeechVolumeProperty_; + NSString NSSpeechSynthesizerInfoProperty_; + NSString NSSpeechRecentSyncProperty_; + NSString NSSpeechPhonemeSymbolsProperty_; + NSString NSSpeechCurrentVoiceProperty_; + NSString NSSpeechCommandDelimiterProperty_; + NSString NSSpeechResetProperty_; + NSString NSSpeechOutputToFileURLProperty_; + NSString NSSpeechModeText_; + NSString NSSpeechModePhoneme_; + NSString NSSpeechModeNormal_; + NSString NSSpeechModeLiteral_; + NSString NSSpeechStatusOutputBusy_; + NSString NSSpeechStatusOutputPaused_; + NSString NSSpeechStatusNumberOfCharactersLeft_; + NSString NSSpeechStatusPhonemeCode_; + NSString NSSpeechErrorCount_; + NSString NSSpeechErrorOldestCode_; + NSString NSSpeechErrorOldestCharacterOffset_; + NSString NSSpeechErrorNewestCode_; + NSString NSSpeechErrorNewestCharacterOffset_; + NSString NSSpeechSynthesizerInfoIdentifier_; + NSString NSSpeechSynthesizerInfoVersion_; + NSString NSSpeechPhonemeInfoOpcode_; + NSString NSSpeechPhonemeInfoSymbol_; + NSString NSSpeechPhonemeInfoExample_; + NSString NSSpeechPhonemeInfoHiliteStart_; + NSString NSSpeechPhonemeInfoHiliteEnd_; + NSString NSSpeechCommandPrefix_; + NSString NSSpeechCommandSuffix_; + NSString NSSpeechDictionaryLocaleIdentifier_; + NSString NSSpeechDictionaryModificationDate_; + NSString NSSpeechDictionaryPronunciations_; + NSString NSSpeechDictionaryAbbreviations_; + NSString NSSpeechDictionaryEntrySpelling_; + NSString NSSpeechDictionaryEntryPhonemes_; +} + +NSString NSVoiceName () +{ + if (NSVoiceName_) + return NSVoiceName_; + + return NSVoiceName_ = new NSString(bindings.NSVoiceName); +} + +NSString NSVoiceIdentifier () +{ + if (NSVoiceIdentifier_) + return NSVoiceIdentifier_; + + return NSVoiceIdentifier_ = new NSString(bindings.NSVoiceIdentifier); +} + +NSString NSVoiceAge () +{ + if (NSVoiceAge_) + return NSVoiceAge_; + + return NSVoiceAge_ = new NSString(bindings.NSVoiceAge); +} + +NSString NSVoiceGender () +{ + if (NSVoiceGender_) + return NSVoiceGender_; + + return NSVoiceGender_ = new NSString(bindings.NSVoiceGender); +} + +NSString NSVoiceDemoText () +{ + if (NSVoiceDemoText_) + return NSVoiceDemoText_; + + return NSVoiceDemoText_ = new NSString(bindings.NSVoiceDemoText); +} + +NSString NSVoiceLocaleIdentifier () +{ + if (NSVoiceLocaleIdentifier_) + return NSVoiceLocaleIdentifier_; + + return NSVoiceLocaleIdentifier_ = new NSString(bindings.NSVoiceLocaleIdentifier); +} + +NSString NSVoiceSupportedCharacters () +{ + if (NSVoiceSupportedCharacters_) + return NSVoiceSupportedCharacters_; + + return NSVoiceSupportedCharacters_ = new NSString(bindings.NSVoiceSupportedCharacters); +} + +NSString NSVoiceIndividuallySpokenCharacters () +{ + if (NSVoiceIndividuallySpokenCharacters_) + return NSVoiceIndividuallySpokenCharacters_; + + return NSVoiceIndividuallySpokenCharacters_ = new NSString(bindings.NSVoiceIndividuallySpokenCharacters); +} + +NSString NSVoiceGenderNeuter () +{ + if (NSVoiceGenderNeuter_) + return NSVoiceGenderNeuter_; + + return NSVoiceGenderNeuter_ = new NSString(bindings.NSVoiceGenderNeuter); +} + +NSString NSVoiceGenderMale () +{ + if (NSVoiceGenderMale_) + return NSVoiceGenderMale_; + + return NSVoiceGenderMale_ = new NSString(bindings.NSVoiceGenderMale); +} + +NSString NSVoiceGenderFemale () +{ + if (NSVoiceGenderFemale_) + return NSVoiceGenderFemale_; + + return NSVoiceGenderFemale_ = new NSString(bindings.NSVoiceGenderFemale); +} + +NSString NSSpeechStatusProperty () +{ + if (NSSpeechStatusProperty_) + return NSSpeechStatusProperty_; + + return NSSpeechStatusProperty_ = new NSString(bindings.NSSpeechStatusProperty); +} + +NSString NSSpeechErrorsProperty () +{ + if (NSSpeechErrorsProperty_) + return NSSpeechErrorsProperty_; + + return NSSpeechErrorsProperty_ = new NSString(bindings.NSSpeechErrorsProperty); +} + +NSString NSSpeechInputModeProperty () +{ + if (NSSpeechInputModeProperty_) + return NSSpeechInputModeProperty_; + + return NSSpeechInputModeProperty_ = new NSString(bindings.NSSpeechInputModeProperty); +} + +NSString NSSpeechCharacterModeProperty () +{ + if (NSSpeechCharacterModeProperty_) + return NSSpeechCharacterModeProperty_; + + return NSSpeechCharacterModeProperty_ = new NSString(bindings.NSSpeechCharacterModeProperty); +} + +NSString NSSpeechNumberModeProperty () +{ + if (NSSpeechNumberModeProperty_) + return NSSpeechNumberModeProperty_; + + return NSSpeechNumberModeProperty_ = new NSString(bindings.NSSpeechNumberModeProperty); +} + +NSString NSSpeechRateProperty () +{ + if (NSSpeechRateProperty_) + return NSSpeechRateProperty_; + + return NSSpeechRateProperty_ = new NSString(bindings.NSSpeechRateProperty); +} + +NSString NSSpeechPitchBaseProperty () +{ + if (NSSpeechPitchBaseProperty_) + return NSSpeechPitchBaseProperty_; + + return NSSpeechPitchBaseProperty_ = new NSString(bindings.NSSpeechPitchBaseProperty); +} + +NSString NSSpeechPitchModProperty () +{ + if (NSSpeechPitchModProperty_) + return NSSpeechPitchModProperty_; + + return NSSpeechPitchModProperty_ = new NSString(bindings.NSSpeechPitchModProperty); +} + +NSString NSSpeechVolumeProperty () +{ + if (NSSpeechVolumeProperty_) + return NSSpeechVolumeProperty_; + + return NSSpeechVolumeProperty_ = new NSString(bindings.NSSpeechVolumeProperty); +} + +NSString NSSpeechSynthesizerInfoProperty () +{ + if (NSSpeechSynthesizerInfoProperty_) + return NSSpeechSynthesizerInfoProperty_; + + return NSSpeechSynthesizerInfoProperty_ = new NSString(bindings.NSSpeechSynthesizerInfoProperty); +} + +NSString NSSpeechRecentSyncProperty () +{ + if (NSSpeechRecentSyncProperty_) + return NSSpeechRecentSyncProperty_; + + return NSSpeechRecentSyncProperty_ = new NSString(bindings.NSSpeechRecentSyncProperty); +} + +NSString NSSpeechPhonemeSymbolsProperty () +{ + if (NSSpeechPhonemeSymbolsProperty_) + return NSSpeechPhonemeSymbolsProperty_; + + return NSSpeechPhonemeSymbolsProperty_ = new NSString(bindings.NSSpeechPhonemeSymbolsProperty); +} + +NSString NSSpeechCurrentVoiceProperty () +{ + if (NSSpeechCurrentVoiceProperty_) + return NSSpeechCurrentVoiceProperty_; + + return NSSpeechCurrentVoiceProperty_ = new NSString(bindings.NSSpeechCurrentVoiceProperty); +} + +NSString NSSpeechCommandDelimiterProperty () +{ + if (NSSpeechCommandDelimiterProperty_) + return NSSpeechCommandDelimiterProperty_; + + return NSSpeechCommandDelimiterProperty_ = new NSString(bindings.NSSpeechCommandDelimiterProperty); +} + +NSString NSSpeechResetProperty () +{ + if (NSSpeechResetProperty_) + return NSSpeechResetProperty_; + + return NSSpeechResetProperty_ = new NSString(bindings.NSSpeechResetProperty); +} + +NSString NSSpeechOutputToFileURLProperty () +{ + if (NSSpeechOutputToFileURLProperty_) + return NSSpeechOutputToFileURLProperty_; + + return NSSpeechOutputToFileURLProperty_ = new NSString(bindings.NSSpeechOutputToFileURLProperty); +} + +NSString NSSpeechModeText () +{ + if (NSSpeechModeText_) + return NSSpeechModeText_; + + return NSSpeechModeText_ = new NSString(bindings.NSSpeechModeText); +} + +NSString NSSpeechModePhoneme () +{ + if (NSSpeechModePhoneme_) + return NSSpeechModePhoneme_; + + return NSSpeechModePhoneme_ = new NSString(bindings.NSSpeechModePhoneme); +} + +NSString NSSpeechModeNormal () +{ + if (NSSpeechModeNormal_) + return NSSpeechModeNormal_; + + return NSSpeechModeNormal_ = new NSString(bindings.NSSpeechModeNormal); +} + +NSString NSSpeechModeLiteral () +{ + if (NSSpeechModeLiteral_) + return NSSpeechModeLiteral_; + + return NSSpeechModeLiteral_ = new NSString(bindings.NSSpeechModeLiteral); +} + +NSString NSSpeechStatusOutputBusy () +{ + if (NSSpeechStatusOutputBusy_) + return NSSpeechStatusOutputBusy_; + + return NSSpeechStatusOutputBusy_ = new NSString(bindings.NSSpeechStatusOutputBusy); +} + +NSString NSSpeechStatusOutputPaused () +{ + if (NSSpeechStatusOutputPaused_) + return NSSpeechStatusOutputPaused_; + + return NSSpeechStatusOutputPaused_ = new NSString(bindings.NSSpeechStatusOutputPaused); +} + +NSString NSSpeechStatusNumberOfCharactersLeft () +{ + if (NSSpeechStatusNumberOfCharactersLeft_) + return NSSpeechStatusNumberOfCharactersLeft_; + + return NSSpeechStatusNumberOfCharactersLeft_ = new NSString(bindings.NSSpeechStatusNumberOfCharactersLeft); +} + +NSString NSSpeechStatusPhonemeCode () +{ + if (NSSpeechStatusPhonemeCode_) + return NSSpeechStatusPhonemeCode_; + + return NSSpeechStatusPhonemeCode_ = new NSString(bindings.NSSpeechStatusPhonemeCode); +} + +NSString NSSpeechErrorCount () +{ + if (NSSpeechErrorCount_) + return NSSpeechErrorCount_; + + return NSSpeechErrorCount_ = new NSString(bindings.NSSpeechErrorCount); +} + +NSString NSSpeechErrorOldestCode () +{ + if (NSSpeechErrorOldestCode_) + return NSSpeechErrorOldestCode_; + + return NSSpeechErrorOldestCode_ = new NSString(bindings.NSSpeechErrorOldestCode); +} + +NSString NSSpeechErrorOldestCharacterOffset () +{ + if (NSSpeechErrorOldestCharacterOffset_) + return NSSpeechErrorOldestCharacterOffset_; + + return NSSpeechErrorOldestCharacterOffset_ = new NSString(bindings.NSSpeechErrorOldestCharacterOffset); +} + +NSString NSSpeechErrorNewestCode () +{ + if (NSSpeechErrorNewestCode_) + return NSSpeechErrorNewestCode_; + + return NSSpeechErrorNewestCode_ = new NSString(bindings.NSSpeechErrorNewestCode); +} + +NSString NSSpeechErrorNewestCharacterOffset () +{ + if (NSSpeechErrorNewestCharacterOffset_) + return NSSpeechErrorNewestCharacterOffset_; + + return NSSpeechErrorNewestCharacterOffset_ = new NSString(bindings.NSSpeechErrorNewestCharacterOffset); +} + +NSString NSSpeechSynthesizerInfoIdentifier () +{ + if (NSSpeechSynthesizerInfoIdentifier_) + return NSSpeechSynthesizerInfoIdentifier_; + + return NSSpeechSynthesizerInfoIdentifier_ = new NSString(bindings.NSSpeechSynthesizerInfoIdentifier); +} + +NSString NSSpeechSynthesizerInfoVersion () +{ + if (NSSpeechSynthesizerInfoVersion_) + return NSSpeechSynthesizerInfoVersion_; + + return NSSpeechSynthesizerInfoVersion_ = new NSString(bindings.NSSpeechSynthesizerInfoVersion); +} + +NSString NSSpeechPhonemeInfoOpcode () +{ + if (NSSpeechPhonemeInfoOpcode_) + return NSSpeechPhonemeInfoOpcode_; + + return NSSpeechPhonemeInfoOpcode_ = new NSString(bindings.NSSpeechPhonemeInfoOpcode); +} + +NSString NSSpeechPhonemeInfoSymbol () +{ + if (NSSpeechPhonemeInfoSymbol_) + return NSSpeechPhonemeInfoSymbol_; + + return NSSpeechPhonemeInfoSymbol_ = new NSString(bindings.NSSpeechPhonemeInfoSymbol); +} + +NSString NSSpeechPhonemeInfoExample () +{ + if (NSSpeechPhonemeInfoExample_) + return NSSpeechPhonemeInfoExample_; + + return NSSpeechPhonemeInfoExample_ = new NSString(bindings.NSSpeechPhonemeInfoExample); +} + +NSString NSSpeechPhonemeInfoHiliteStart () +{ + if (NSSpeechPhonemeInfoHiliteStart_) + return NSSpeechPhonemeInfoHiliteStart_; + + return NSSpeechPhonemeInfoHiliteStart_ = new NSString(bindings.NSSpeechPhonemeInfoHiliteStart); +} + +NSString NSSpeechPhonemeInfoHiliteEnd () +{ + if (NSSpeechPhonemeInfoHiliteEnd_) + return NSSpeechPhonemeInfoHiliteEnd_; + + return NSSpeechPhonemeInfoHiliteEnd_ = new NSString(bindings.NSSpeechPhonemeInfoHiliteEnd); +} + +NSString NSSpeechCommandPrefix () +{ + if (NSSpeechCommandPrefix_) + return NSSpeechCommandPrefix_; + + return NSSpeechCommandPrefix_ = new NSString(bindings.NSSpeechCommandPrefix); +} + +NSString NSSpeechCommandSuffix () +{ + if (NSSpeechCommandSuffix_) + return NSSpeechCommandSuffix_; + + return NSSpeechCommandSuffix_ = new NSString(bindings.NSSpeechCommandSuffix); +} + +NSString NSSpeechDictionaryLocaleIdentifier () +{ + if (NSSpeechDictionaryLocaleIdentifier_) + return NSSpeechDictionaryLocaleIdentifier_; + + return NSSpeechDictionaryLocaleIdentifier_ = new NSString(bindings.NSSpeechDictionaryLocaleIdentifier); +} + +NSString NSSpeechDictionaryModificationDate () +{ + if (NSSpeechDictionaryModificationDate_) + return NSSpeechDictionaryModificationDate_; + + return NSSpeechDictionaryModificationDate_ = new NSString(bindings.NSSpeechDictionaryModificationDate); +} + +NSString NSSpeechDictionaryPronunciations () +{ + if (NSSpeechDictionaryPronunciations_) + return NSSpeechDictionaryPronunciations_; + + return NSSpeechDictionaryPronunciations_ = new NSString(bindings.NSSpeechDictionaryPronunciations); +} + +NSString NSSpeechDictionaryAbbreviations () +{ + if (NSSpeechDictionaryAbbreviations_) + return NSSpeechDictionaryAbbreviations_; + + return NSSpeechDictionaryAbbreviations_ = new NSString(bindings.NSSpeechDictionaryAbbreviations); +} + +NSString NSSpeechDictionaryEntrySpelling () +{ + if (NSSpeechDictionaryEntrySpelling_) + return NSSpeechDictionaryEntrySpelling_; + + return NSSpeechDictionaryEntrySpelling_ = new NSString(bindings.NSSpeechDictionaryEntrySpelling); +} + +NSString NSSpeechDictionaryEntryPhonemes () +{ + if (NSSpeechDictionaryEntryPhonemes_) + return NSSpeechDictionaryEntryPhonemes_; + + return NSSpeechDictionaryEntryPhonemes_ = new NSString(bindings.NSSpeechDictionaryEntryPhonemes); +} + +enum +{ + NSSpeechImmediateBoundary = 0, + NSSpeechWordBoundary, + NSSpeechSentenceBoundary +} + +class NSSpeechSynthesizer : NSObject +{ + mixin (ObjcWrap); + + NSSpeechSynthesizer initWithVoice (NSString voice) + { + id result = invokeObjcSelf!(id, "initWithVoice:", NSString)(voice); + return result is this.objcObject ? this : (result !is null ? new NSSpeechSynthesizer(result) : null); + } + + this (NSString voice) + { + super(NSSpeechSynthesizer.alloc.initWithVoice(voice).objcObject); + } + + bool startSpeakingString (NSString string) + { + return invokeObjcSelf!(bool, "startSpeakingString:", NSString)(string); + } + + bool startSpeakingString (NSString string, NSURL url) + { + return invokeObjcSelf!(bool, "startSpeakingString:toURL:", NSString, NSURL)(string, url); + } + + bool isSpeaking () + { + return invokeObjcSelf!(bool, "isSpeaking"); + } + + void stopSpeaking () + { + return invokeObjcSelf!(void, "stopSpeaking"); + } + + void stopSpeakingAtBoundary (uint boundary) + { + return invokeObjcSelf!(void, "stopSpeakingAtBoundary:", uint)(boundary); + } + + void pauseSpeakingAtBoundary (uint boundary) + { + return invokeObjcSelf!(void, "pauseSpeakingAtBoundary:", uint)(boundary); + } + + void continueSpeaking () + { + return invokeObjcSelf!(void, "continueSpeaking"); + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + void setDelegate (Object anObject) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(anObject); + } + + NSString voice () + { + return invokeObjcSelf!(NSString, "voice"); + } + + bool setVoice (NSString voice) + { + return invokeObjcSelf!(bool, "setVoice:", NSString)(voice); + } + + float rate () + { + return invokeObjcSelf!(float, "rate"); + } + + void setRate (float rate) + { + return invokeObjcSelf!(void, "setRate:", float)(rate); + } + + float volume () + { + return invokeObjcSelf!(float, "volume"); + } + + void setVolume (float volume) + { + return invokeObjcSelf!(void, "setVolume:", float)(volume); + } + + bool usesFeedbackWindow () + { + return invokeObjcSelf!(bool, "usesFeedbackWindow"); + } + + void setUsesFeedbackWindow (bool flag) + { + return invokeObjcSelf!(void, "setUsesFeedbackWindow:", bool)(flag); + } + + void addSpeechDictionary (NSDictionary speechDictionary) + { + return invokeObjcSelf!(void, "addSpeechDictionary:", NSDictionary)(speechDictionary); + } + + NSString phonemesFromText (NSString text) + { + return invokeObjcSelf!(NSString, "phonemesFromText:", NSString)(text); + } + + Object objectForProperty (NSString property, out NSError outError) + { + id error; + + Object result = invokeObjcSelf!(Object, "objectForProperty:error:", NSString, id*)(property, &error); + + if (error) + outError = new NSError(error); + + return result; + } + + bool setObject (Object object, NSString property, ref NSError outError) + { + id error; + + bool result = invokeObjcSelf!(bool, "setObject:forProperty:error:", Object, NSString, id*)(object, property, &error); + + if (error) + outError = new NSError(error); + + return result; + } + + static bool isAnyApplicationSpeaking () + { + return invokeObjcSelfClass!(bool, "isAnyApplicationSpeaking"); + } + + static NSString defaultVoice () + { + return invokeObjcSelfClass!(NSString, "defaultVoice"); + } + + static NSArray availableVoices () + { + return invokeObjcSelfClass!(NSArray, "availableVoices"); + } + + static NSDictionary attributesForVoice (NSString voice) + { + return invokeObjcSelfClass!(NSDictionary, "attributesForVoice:", NSString)(voice); + } +} + +const TNSSpeechSynthesizerDelegate = ` + + void speechSynthesizer (NSSpeechSynthesizer sender, bool finishedSpeaking) + { + return invokeObjcSelf!(void, "speechSynthesizer:didFinishSpeaking:", NSSpeechSynthesizer, bool)(sender, finishedSpeaking); + } + + void speechSynthesizer (NSSpeechSynthesizer sender, NSRange characterRange, NSString string) + { + return invokeObjcSelf!(void, "speechSynthesizer:willSpeakWord:ofString:", NSSpeechSynthesizer, NSRange, NSString)(sender, characterRange, string); + } + + void speechSynthesizer (NSSpeechSynthesizer sender, short phonemeOpcode) + { + return invokeObjcSelf!(void, "speechSynthesizer:willSpeakPhoneme:", NSSpeechSynthesizer, short)(sender, phonemeOpcode); + } + + void speechSynthesizer (NSSpeechSynthesizer sender, NSUInteger characterIndex, NSString string, NSString message) + { + return invokeObjcSelf!(void, "speechSynthesizer:didEncounterErrorAtIndex:ofString:message:", NSSpeechSynthesizer, NSUInteger, NSString, NSString)(sender, characterIndex, string, message); + } + + void speechSynthesizer (NSSpeechSynthesizer sender, NSString message) + { + return invokeObjcSelf!(void, "speechSynthesizer:didEncounterSyncMessage:", NSSpeechSynthesizer, NSString)(sender, message); + } + + //mixin ObjcBindMethod!(speechSynthesizer, "speechSynthesizer:didFinishSpeaking:"); + //mixin ObjcBindMethod!(speechSynthesizer, "speechSynthesizer:willSpeakWord:ofString:"); + //mixin ObjcBindMethod!(speechSynthesizer, "speechSynthesizer:willSpeakPhoneme:"); + //mixin ObjcBindMethod!(speechSynthesizer, "speechSynthesizer:didEncounterErrorAtIndex:ofString:message:"); + //mixin ObjcBindMethod!(speechSynthesizer, "speechSynthesizer:didEncounterSyncMessage:"); + +`; + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSSpeechSynthesizer_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSSpeechSynthesizer_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,71 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSSpeechSynthesizer_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package const id NSVoiceName; + package const id NSVoiceIdentifier; + package const id NSVoiceAge; + package const id NSVoiceGender; + package const id NSVoiceDemoText; + package const id NSVoiceLocaleIdentifier; + package const id NSVoiceSupportedCharacters; + package const id NSVoiceIndividuallySpokenCharacters; + package const id NSVoiceGenderNeuter; + package const id NSVoiceGenderMale; + package const id NSVoiceGenderFemale; + package const id NSSpeechStatusProperty; + package const id NSSpeechErrorsProperty; + package const id NSSpeechInputModeProperty; + package const id NSSpeechCharacterModeProperty; + package const id NSSpeechNumberModeProperty; + package const id NSSpeechRateProperty; + package const id NSSpeechPitchBaseProperty; + package const id NSSpeechPitchModProperty; + package const id NSSpeechVolumeProperty; + package const id NSSpeechSynthesizerInfoProperty; + package const id NSSpeechRecentSyncProperty; + package const id NSSpeechPhonemeSymbolsProperty; + package const id NSSpeechCurrentVoiceProperty; + package const id NSSpeechCommandDelimiterProperty; + package const id NSSpeechResetProperty; + package const id NSSpeechOutputToFileURLProperty; + package const id NSSpeechModeText; + package const id NSSpeechModePhoneme; + package const id NSSpeechModeNormal; + package const id NSSpeechModeLiteral; + package const id NSSpeechStatusOutputBusy; + package const id NSSpeechStatusOutputPaused; + package const id NSSpeechStatusNumberOfCharactersLeft; + package const id NSSpeechStatusPhonemeCode; + package const id NSSpeechErrorCount; + package const id NSSpeechErrorOldestCode; + package const id NSSpeechErrorOldestCharacterOffset; + package const id NSSpeechErrorNewestCode; + package const id NSSpeechErrorNewestCharacterOffset; + package const id NSSpeechSynthesizerInfoIdentifier; + package const id NSSpeechSynthesizerInfoVersion; + package const id NSSpeechPhonemeInfoOpcode; + package const id NSSpeechPhonemeInfoSymbol; + package const id NSSpeechPhonemeInfoExample; + package const id NSSpeechPhonemeInfoHiliteStart; + package const id NSSpeechPhonemeInfoHiliteEnd; + package const id NSSpeechCommandPrefix; + package const id NSSpeechCommandSuffix; + package const id NSSpeechDictionaryLocaleIdentifier; + package const id NSSpeechDictionaryModificationDate; + package const id NSSpeechDictionaryPronunciations; + package const id NSSpeechDictionaryAbbreviations; + package const id NSSpeechDictionaryEntrySpelling; + package const id NSSpeechDictionaryEntryPhonemes; + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSSpellChecker.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSSpellChecker.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,149 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSSpellChecker; + +import dstep.foundation.NSArray; +import dstep.appkit.NSPanel; +import dstep.appkit.NSView; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSRange; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSSpellChecker : NSObject +{ + mixin (ObjcWrap); + + static NSSpellChecker sharedSpellChecker () + { + return invokeObjcSelfClass!(NSSpellChecker, "sharedSpellChecker"); + } + + static bool sharedSpellCheckerExists () + { + return invokeObjcSelfClass!(bool, "sharedSpellCheckerExists"); + } + + static NSInteger uniqueSpellDocumentTag () + { + return invokeObjcSelfClass!(NSInteger, "uniqueSpellDocumentTag"); + } + + NSRange checkSpellingOfString (NSString stringToCheck, NSInteger startingOffset, NSString language, bool wrapFlag, NSInteger tag, NSInteger* wordCount) + { + return invokeObjcSelf!(NSRange, "checkSpellingOfString:startingAt:language:wrap:inSpellDocumentWithTag:wordCount:", NSString, NSInteger, NSString, bool, NSInteger, NSInteger*)(stringToCheck, startingOffset, language, wrapFlag, tag, wordCount); + } + + NSRange checkSpellingOfString (NSString stringToCheck, NSInteger startingOffset) + { + return invokeObjcSelf!(NSRange, "checkSpellingOfString:startingAt:", NSString, NSInteger)(stringToCheck, startingOffset); + } + + NSInteger countWordsInString (NSString stringToCount, NSString language) + { + return invokeObjcSelf!(NSInteger, "countWordsInString:language:", NSString, NSString)(stringToCount, language); + } + + NSRange checkGrammarOfString (NSString stringToCheck, NSInteger startingOffset, NSString language, bool wrapFlag, NSInteger tag, NSArray** details) + { + return invokeObjcSelf!(NSRange, "checkGrammarOfString:startingAt:language:wrap:inSpellDocumentWithTag:details:", NSString, NSInteger, NSString, bool, NSInteger, NSArray**)(stringToCheck, startingOffset, language, wrapFlag, tag, details); + } + + void updateSpellingPanelWithMisspelledWord (NSString word) + { + return invokeObjcSelf!(void, "updateSpellingPanelWithMisspelledWord:", NSString)(word); + } + + void updateSpellingPanelWithGrammarString (NSString string, NSDictionary detail) + { + return invokeObjcSelf!(void, "updateSpellingPanelWithGrammarString:detail:", NSString, NSDictionary)(string, detail); + } + + NSPanel spellingPanel () + { + return invokeObjcSelf!(NSPanel, "spellingPanel"); + } + + NSView accessoryView () + { + return invokeObjcSelf!(NSView, "accessoryView"); + } + + void setAccessoryView (NSView aView) + { + return invokeObjcSelf!(void, "setAccessoryView:", NSView)(aView); + } + + void ignoreWord (NSString wordToIgnore, NSInteger tag) + { + return invokeObjcSelf!(void, "ignoreWord:inSpellDocumentWithTag:", NSString, NSInteger)(wordToIgnore, tag); + } + + NSArray ignoredWordsInSpellDocumentWithTag (NSInteger tag) + { + return invokeObjcSelf!(NSArray, "ignoredWordsInSpellDocumentWithTag:", NSInteger)(tag); + } + + void setIgnoredWords (NSArray words, NSInteger tag) + { + return invokeObjcSelf!(void, "setIgnoredWords:inSpellDocumentWithTag:", NSArray, NSInteger)(words, tag); + } + + NSArray guessesForWord (NSString word) + { + return invokeObjcSelf!(NSArray, "guessesForWord:", NSString)(word); + } + + NSArray completionsForPartialWordRange (NSRange range, NSString string, NSString language, NSInteger tag) + { + return invokeObjcSelf!(NSArray, "completionsForPartialWordRange:inString:language:inSpellDocumentWithTag:", NSRange, NSString, NSString, NSInteger)(range, string, language, tag); + } + + void closeSpellDocumentWithTag (NSInteger tag) + { + return invokeObjcSelf!(void, "closeSpellDocumentWithTag:", NSInteger)(tag); + } + + NSString language () + { + return invokeObjcSelf!(NSString, "language"); + } + + bool setLanguage (NSString language) + { + return invokeObjcSelf!(bool, "setLanguage:", NSString)(language); + } + + NSArray availableLanguages () + { + return invokeObjcSelf!(NSArray, "availableLanguages"); + } + + void setWordFieldStringValue (NSString aString) + { + return invokeObjcSelf!(void, "setWordFieldStringValue:", NSString)(aString); + } + + void learnWord (NSString word) + { + return invokeObjcSelf!(void, "learnWord:", NSString)(word); + } + + bool hasLearnedWord (NSString word) + { + return invokeObjcSelf!(bool, "hasLearnedWord:", NSString)(word); + } + + void unlearnWord (NSString word) + { + return invokeObjcSelf!(void, "unlearnWord:", NSString)(word); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSSpellProtocol.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSSpellProtocol.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,22 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSSpellProtocol; + +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +interface INSIgnoreMisspelledWords +{ + void ignoreSpelling (Object sender); +} + +interface INSChangeSpelling +{ + void changeSpelling (Object sender); +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSSpellServer.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSSpellServer.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,9 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSSpellServer; + +pragma(msg, "warning: NSSpellServer class has moved to the Foundation framework. Please adjust your import."); \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSSplitView.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSSplitView.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,216 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSSplitView; + +import dstep.appkit.NSColor; +import dstep.appkit.NSView; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSNotification; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.appkit.NSSplitView_bindings; + +alias NSInteger NSSplitViewDividerStyle; + +private +{ + NSString NSSplitViewWillResizeSubviewsNotification_; + NSString NSSplitViewDidResizeSubviewsNotification_; +} + +NSString NSSplitViewWillResizeSubviewsNotification () +{ + if (NSSplitViewWillResizeSubviewsNotification_) + return NSSplitViewWillResizeSubviewsNotification_; + + return NSSplitViewWillResizeSubviewsNotification_ = new NSString(bindings.NSSplitViewWillResizeSubviewsNotification); +} + +NSString NSSplitViewDidResizeSubviewsNotification () +{ + if (NSSplitViewDidResizeSubviewsNotification_) + return NSSplitViewDidResizeSubviewsNotification_; + + return NSSplitViewDidResizeSubviewsNotification_ = new NSString(bindings.NSSplitViewDidResizeSubviewsNotification); +} + +enum +{ + NSSplitViewDividerStyleThick = 1, + NSSplitViewDividerStyleThin +} + +class NSSplitView : NSView +{ + mixin (ObjcWrap); + + void setVertical (bool flag) + { + return invokeObjcSelf!(void, "setVertical:", bool)(flag); + } + + bool isVertical () + { + return invokeObjcSelf!(bool, "isVertical"); + } + + void setDividerStyle (int dividerStyle) + { + return invokeObjcSelf!(void, "setDividerStyle:", int)(dividerStyle); + } + + int dividerStyle () + { + return invokeObjcSelf!(int, "dividerStyle"); + } + + void setAutosaveName (NSString autosaveName) + { + return invokeObjcSelf!(void, "setAutosaveName:", NSString)(autosaveName); + } + + NSString autosaveName () + { + return invokeObjcSelf!(NSString, "autosaveName"); + } + + void setDelegate (Object delegate_) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(delegate_); + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + void drawDividerInRect (NSRect rect) + { + return invokeObjcSelf!(void, "drawDividerInRect:", NSRect)(rect); + } + + NSColor dividerColor () + { + return invokeObjcSelf!(NSColor, "dividerColor"); + } + + CGFloat dividerThickness () + { + return invokeObjcSelf!(CGFloat, "dividerThickness"); + } + + void adjustSubviews () + { + return invokeObjcSelf!(void, "adjustSubviews"); + } + + bool isSubviewCollapsed (NSView subview) + { + return invokeObjcSelf!(bool, "isSubviewCollapsed:", NSView)(subview); + } + + CGFloat minPossiblePositionOfDividerAtIndex (NSInteger dividerIndex) + { + return invokeObjcSelf!(CGFloat, "minPossiblePositionOfDividerAtIndex:", NSInteger)(dividerIndex); + } + + CGFloat maxPossiblePositionOfDividerAtIndex (NSInteger dividerIndex) + { + return invokeObjcSelf!(CGFloat, "maxPossiblePositionOfDividerAtIndex:", NSInteger)(dividerIndex); + } + + void setPosition (CGFloat position, NSInteger dividerIndex) + { + return invokeObjcSelf!(void, "setPosition:ofDividerAtIndex:", CGFloat, NSInteger)(position, dividerIndex); + } + + void setIsPaneSplitter (bool flag) + { + return invokeObjcSelf!(void, "setIsPaneSplitter:", bool)(flag); + } + + bool isPaneSplitter () + { + return invokeObjcSelf!(bool, "isPaneSplitter"); + } +} + +const TNSSplitViewDelegate = ` + + bool splitView (NSSplitView splitView, NSView subview) + { + return invokeObjcSelf!(bool, "splitView:canCollapseSubview:", NSSplitView, NSView)(splitView, subview); + } + + bool splitView (NSSplitView splitView, NSView subview, NSInteger dividerIndex) + { + return invokeObjcSelf!(bool, "splitView:shouldCollapseSubview:forDoubleClickOnDividerAtIndex:", NSSplitView, NSView, NSInteger)(splitView, subview, dividerIndex); + } + + CGFloat splitView (NSSplitView splitView, CGFloat proposedMinimumPosition, NSInteger dividerIndex) + { + return invokeObjcSelf!(CGFloat, "splitView:constrainMinCoordinate:ofSubviewAt:", NSSplitView, CGFloat, NSInteger)(splitView, proposedMinimumPosition, dividerIndex); + } + + CGFloat splitView (NSSplitView splitView, CGFloat proposedMaximumPosition, NSInteger dividerIndex) + { + return invokeObjcSelf!(CGFloat, "splitView:constrainMaxCoordinate:ofSubviewAt:", NSSplitView, CGFloat, NSInteger)(splitView, proposedMaximumPosition, dividerIndex); + } + + CGFloat splitView (NSSplitView splitView, CGFloat proposedPosition, NSInteger dividerIndex) + { + return invokeObjcSelf!(CGFloat, "splitView:constrainSplitPosition:ofSubviewAt:", NSSplitView, CGFloat, NSInteger)(splitView, proposedPosition, dividerIndex); + } + + void splitView (NSSplitView splitView, NSSize oldSize) + { + return invokeObjcSelf!(void, "splitView:resizeSubviewsWithOldSize:", NSSplitView, NSSize)(splitView, oldSize); + } + + bool splitView (NSSplitView splitView, NSInteger dividerIndex) + { + return invokeObjcSelf!(bool, "splitView:shouldHideDividerAtIndex:", NSSplitView, NSInteger)(splitView, dividerIndex); + } + + NSRect splitView (NSSplitView splitView, NSRect proposedEffectiveRect, NSRect drawnRect, NSInteger dividerIndex) + { + return invokeObjcSelf!(NSRect, "splitView:effectiveRect:forDrawnRect:ofDividerAtIndex:", NSSplitView, NSRect, NSRect, NSInteger)(splitView, proposedEffectiveRect, drawnRect, dividerIndex); + } + + NSRect splitView (NSSplitView splitView, NSInteger dividerIndex) + { + return invokeObjcSelf!(NSRect, "splitView:additionalEffectiveRectOfDividerAtIndex:", NSSplitView, NSInteger)(splitView, dividerIndex); + } + + void splitViewWillResizeSubviews (NSNotification notification) + { + return invokeObjcSelf!(void, "splitViewWillResizeSubviews:", NSNotification)(notification); + } + + void splitViewDidResizeSubviews (NSNotification notification) + { + return invokeObjcSelf!(void, "splitViewDidResizeSubviews:", NSNotification)(notification); + } + + //mixin ObjcBindMethod!(splitView, "splitView:canCollapseSubview:"); + //mixin ObjcBindMethod!(splitView, "splitView:shouldCollapseSubview:forDoubleClickOnDividerAtIndex:"); + //mixin ObjcBindMethod!(splitView, "splitView:constrainMinCoordinate:ofSubviewAt:"); + //mixin ObjcBindMethod!(splitView, "splitView:constrainMaxCoordinate:ofSubviewAt:"); + //mixin ObjcBindMethod!(splitView, "splitView:constrainSplitPosition:ofSubviewAt:"); + //mixin ObjcBindMethod!(splitView, "splitView:resizeSubviewsWithOldSize:"); + //mixin ObjcBindMethod!(splitView, "splitView:shouldHideDividerAtIndex:"); + //mixin ObjcBindMethod!(splitView, "splitView:effectiveRect:forDrawnRect:ofDividerAtIndex:"); + //mixin ObjcBindMethod!(splitView, "splitView:additionalEffectiveRectOfDividerAtIndex:"); + //mixin ObjcBindMethod!(splitViewWillResizeSubviews, "splitViewWillResizeSubviews:"); + //mixin ObjcBindMethod!(splitViewDidResizeSubviews, "splitViewDidResizeSubviews:"); + +`; + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSSplitView_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSSplitView_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,20 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSSplitView_bindings; + +import dstep.appkit.NSView; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +extern (C) +{ + extern + { + package id NSSplitViewWillResizeSubviewsNotification; + package id NSSplitViewDidResizeSubviewsNotification; + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSStatusBar.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSStatusBar.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,47 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSStatusBar; + +import dstep.appkit.NSColor; +import dstep.appkit.NSFont; +import dstep.appkit.NSStatusItem; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSStatusBar : NSObject +{ + mixin (ObjcWrap); + + static NSStatusBar systemStatusBar () + { + return invokeObjcSelfClass!(NSStatusBar, "systemStatusBar"); + } + + NSStatusItem statusItemWithLength (CGFloat length) + { + return invokeObjcSelf!(NSStatusItem, "statusItemWithLength:", CGFloat)(length); + } + + void removeStatusItem (NSStatusItem item) + { + return invokeObjcSelf!(void, "removeStatusItem:", NSStatusItem)(item); + } + + bool isVertical () + { + return invokeObjcSelf!(bool, "isVertical"); + } + + CGFloat thickness () + { + return invokeObjcSelf!(CGFloat, "thickness"); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSStatusItem.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSStatusItem.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,351 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSStatusItem; + +import dstep.appkit.NSAttributedString; +import dstep.appkit.NSImage; +import dstep.appkit.NSMenu; +import dstep.appkit.NSStatusBar; +import dstep.appkit.NSView; +import dstep.appkit.NSWindow; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSAttributedString; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +const TNSStatusItemView = ` + + NSView view () + { + return invokeObjcSelf!(NSView, "view"); + } + + void setView (NSView view) + { + return invokeObjcSelf!(void, "setView:", NSView)(view); + } + + //mixin ObjcBindMethod!(view, "view"); + //mixin ObjcBindMethod!(setView, "setView:"); + +`; + +const TNSStatusItemCommon = ` + + SEL action () + { + return invokeObjcSelf!(SEL, "action"); + } + + void setAction (SEL action) + { + return invokeObjcSelf!(void, "setAction:", SEL)(action); + } + + SEL doubleAction () + { + return invokeObjcSelf!(SEL, "doubleAction"); + } + + void setDoubleAction (SEL action) + { + return invokeObjcSelf!(void, "setDoubleAction:", SEL)(action); + } + + Object target () + { + return invokeObjcSelf!(Object, "target"); + } + + void setTarget (Object target) + { + return invokeObjcSelf!(void, "setTarget:", Object)(target); + } + + NSString title () + { + return invokeObjcSelf!(NSString, "title"); + } + + void setTitle (NSString title) + { + return invokeObjcSelf!(void, "setTitle:", NSString)(title); + } + + NSAttributedString attributedTitle () + { + return invokeObjcSelf!(NSAttributedString, "attributedTitle"); + } + + void setAttributedTitle (NSAttributedString title) + { + return invokeObjcSelf!(void, "setAttributedTitle:", NSAttributedString)(title); + } + + NSImage image () + { + return invokeObjcSelf!(NSImage, "image"); + } + + void setImage (NSImage image) + { + return invokeObjcSelf!(void, "setImage:", NSImage)(image); + } + + NSImage alternateImage () + { + return invokeObjcSelf!(NSImage, "alternateImage"); + } + + void setAlternateImage (NSImage image) + { + return invokeObjcSelf!(void, "setAlternateImage:", NSImage)(image); + } + + NSMenu menu () + { + return invokeObjcSelf!(NSMenu, "menu"); + } + + void setMenu (NSMenu menu) + { + return invokeObjcSelf!(void, "setMenu:", NSMenu)(menu); + } + + bool isEnabled () + { + return invokeObjcSelf!(bool, "isEnabled"); + } + + void setEnabled (bool enabled) + { + return invokeObjcSelf!(void, "setEnabled:", bool)(enabled); + } + + NSString toolTip () + { + return invokeObjcSelf!(NSString, "toolTip"); + } + + void setToolTip (NSString toolTip) + { + return invokeObjcSelf!(void, "setToolTip:", NSString)(toolTip); + } + + void setHighlightMode (bool highlightMode) + { + return invokeObjcSelf!(void, "setHighlightMode:", bool)(highlightMode); + } + + bool highlightMode () + { + return invokeObjcSelf!(bool, "highlightMode"); + } + + NSInteger sendActionOn (NSInteger mask) + { + return invokeObjcSelf!(NSInteger, "sendActionOn:", NSInteger)(mask); + } + + void popUpStatusItemMenu (NSMenu menu) + { + return invokeObjcSelf!(void, "popUpStatusItemMenu:", NSMenu)(menu); + } + + void drawStatusBarBackgroundInRect (NSRect rect, bool highlight) + { + return invokeObjcSelf!(void, "drawStatusBarBackgroundInRect:withHighlight:", NSRect, bool)(rect, highlight); + } + + //mixin ObjcBindMethod!(action, "action"); + //mixin ObjcBindMethod!(setAction, "setAction:"); + //mixin ObjcBindMethod!(doubleAction, "doubleAction"); + //mixin ObjcBindMethod!(setDoubleAction, "setDoubleAction:"); + //mixin ObjcBindMethod!(target, "target"); + //mixin ObjcBindMethod!(setTarget, "setTarget:"); + //mixin ObjcBindMethod!(title, "title"); + //mixin ObjcBindMethod!(setTitle, "setTitle:"); + //mixin ObjcBindMethod!(attributedTitle, "attributedTitle"); + //mixin ObjcBindMethod!(setAttributedTitle, "setAttributedTitle:"); + //mixin ObjcBindMethod!(image, "image"); + //mixin ObjcBindMethod!(setImage, "setImage:"); + //mixin ObjcBindMethod!(alternateImage, "alternateImage"); + //mixin ObjcBindMethod!(setAlternateImage, "setAlternateImage:"); + //mixin ObjcBindMethod!(menu, "menu"); + //mixin ObjcBindMethod!(setMenu, "setMenu:"); + //mixin ObjcBindMethod!(isEnabled, "isEnabled"); + //mixin ObjcBindMethod!(setEnabled, "setEnabled:"); + //mixin ObjcBindMethod!(toolTip, "toolTip"); + //mixin ObjcBindMethod!(setToolTip, "setToolTip:"); + //mixin ObjcBindMethod!(setHighlightMode, "setHighlightMode:"); + //mixin ObjcBindMethod!(highlightMode, "highlightMode"); + //mixin ObjcBindMethod!(sendActionOn, "sendActionOn:"); + //mixin ObjcBindMethod!(popUpStatusItemMenu, "popUpStatusItemMenu:"); + //mixin ObjcBindMethod!(drawStatusBarBackgroundInRect, "drawStatusBarBackgroundInRect:withHighlight:"); + +`; + +class NSStatusItem : NSObject +{ + mixin (ObjcWrap); + + NSStatusBar statusBar () + { + return invokeObjcSelf!(NSStatusBar, "statusBar"); + } + + CGFloat length () + { + return invokeObjcSelf!(CGFloat, "length"); + } + + void setLength (CGFloat length) + { + return invokeObjcSelf!(void, "setLength:", CGFloat)(length); + } + + // NSStatusItemView + NSView view () + { + return invokeObjcSelf!(NSView, "view"); + } + + void setView (NSView view) + { + return invokeObjcSelf!(void, "setView:", NSView)(view); + } + + // NSStatusItemCommon + SEL action () + { + return invokeObjcSelf!(SEL, "action"); + } + + void setAction (SEL action) + { + return invokeObjcSelf!(void, "setAction:", SEL)(action); + } + + SEL doubleAction () + { + return invokeObjcSelf!(SEL, "doubleAction"); + } + + void setDoubleAction (SEL action) + { + return invokeObjcSelf!(void, "setDoubleAction:", SEL)(action); + } + + Object target () + { + return invokeObjcSelf!(Object, "target"); + } + + void setTarget (Object target) + { + return invokeObjcSelf!(void, "setTarget:", Object)(target); + } + + NSString title () + { + return invokeObjcSelf!(NSString, "title"); + } + + void setTitle (NSString title) + { + return invokeObjcSelf!(void, "setTitle:", NSString)(title); + } + + NSAttributedString attributedTitle () + { + return invokeObjcSelf!(NSAttributedString, "attributedTitle"); + } + + void setAttributedTitle (NSAttributedString title) + { + return invokeObjcSelf!(void, "setAttributedTitle:", NSAttributedString)(title); + } + + NSImage image () + { + return invokeObjcSelf!(NSImage, "image"); + } + + void setImage (NSImage image) + { + return invokeObjcSelf!(void, "setImage:", NSImage)(image); + } + + NSImage alternateImage () + { + return invokeObjcSelf!(NSImage, "alternateImage"); + } + + void setAlternateImage (NSImage image) + { + return invokeObjcSelf!(void, "setAlternateImage:", NSImage)(image); + } + + NSMenu menu () + { + return invokeObjcSelf!(NSMenu, "menu"); + } + + void setMenu (NSMenu menu) + { + return invokeObjcSelf!(void, "setMenu:", NSMenu)(menu); + } + + bool isEnabled () + { + return invokeObjcSelf!(bool, "isEnabled"); + } + + void setEnabled (bool enabled) + { + return invokeObjcSelf!(void, "setEnabled:", bool)(enabled); + } + + NSString toolTip () + { + return invokeObjcSelf!(NSString, "toolTip"); + } + + void setToolTip (NSString toolTip) + { + return invokeObjcSelf!(void, "setToolTip:", NSString)(toolTip); + } + + void setHighlightMode (bool highlightMode) + { + return invokeObjcSelf!(void, "setHighlightMode:", bool)(highlightMode); + } + + bool highlightMode () + { + return invokeObjcSelf!(bool, "highlightMode"); + } + + NSInteger sendActionOn (NSInteger mask) + { + return invokeObjcSelf!(NSInteger, "sendActionOn:", NSInteger)(mask); + } + + void popUpStatusItemMenu (NSMenu menu) + { + return invokeObjcSelf!(void, "popUpStatusItemMenu:", NSMenu)(menu); + } + + void drawStatusBarBackgroundInRect (NSRect rect, bool highlight) + { + return invokeObjcSelf!(void, "drawStatusBarBackgroundInRect:withHighlight:", NSRect, bool)(rect, highlight); + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSStepper.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSStepper.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,67 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSStepper; + +import dstep.appkit.NSControl; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSStepper : NSControl +{ + mixin (ObjcWrap); + + double minValue () + { + return invokeObjcSelf!(double, "minValue"); + } + + void setMinValue (double minValue) + { + return invokeObjcSelf!(void, "setMinValue:", double)(minValue); + } + + double maxValue () + { + return invokeObjcSelf!(double, "maxValue"); + } + + void setMaxValue (double maxValue) + { + return invokeObjcSelf!(void, "setMaxValue:", double)(maxValue); + } + + double increment () + { + return invokeObjcSelf!(double, "increment"); + } + + void setIncrement (double increment) + { + return invokeObjcSelf!(void, "setIncrement:", double)(increment); + } + + bool valueWraps () + { + return invokeObjcSelf!(bool, "valueWraps"); + } + + void setValueWraps (bool valueWraps) + { + return invokeObjcSelf!(void, "setValueWraps:", bool)(valueWraps); + } + + bool autorepeat () + { + return invokeObjcSelf!(bool, "autorepeat"); + } + + void setAutorepeat (bool autorepeat) + { + return invokeObjcSelf!(void, "setAutorepeat:", bool)(autorepeat); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSStepperCell.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSStepperCell.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,67 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSStepperCell; + +import dstep.appkit.NSActionCell; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSStepperCell : NSActionCell +{ + mixin (ObjcWrap); + + double minValue () + { + return invokeObjcSelf!(double, "minValue"); + } + + void setMinValue (double minValue) + { + return invokeObjcSelf!(void, "setMinValue:", double)(minValue); + } + + double maxValue () + { + return invokeObjcSelf!(double, "maxValue"); + } + + void setMaxValue (double maxValue) + { + return invokeObjcSelf!(void, "setMaxValue:", double)(maxValue); + } + + double increment () + { + return invokeObjcSelf!(double, "increment"); + } + + void setIncrement (double increment) + { + return invokeObjcSelf!(void, "setIncrement:", double)(increment); + } + + bool valueWraps () + { + return invokeObjcSelf!(bool, "valueWraps"); + } + + void setValueWraps (bool valueWraps) + { + return invokeObjcSelf!(void, "setValueWraps:", bool)(valueWraps); + } + + bool autorepeat () + { + return invokeObjcSelf!(bool, "autorepeat"); + } + + void setAutorepeat (bool autorepeat) + { + return invokeObjcSelf!(void, "setAutorepeat:", bool)(autorepeat); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSStringDrawing.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSStringDrawing.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,66 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSStringDrawing; + +import dstep.appkit.NSAttributedString; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +typedef NSInteger NSStringDrawingOptions; + +enum : NSInteger +{ + NSStringDrawingTruncatesLastVisibleLine = (1 << 5), + NSStringDrawingUsesLineFragmentOrigin = (1 << 0), + NSStringDrawingUsesFontLeading = (1 << 1), + NSStringDrawingDisableScreenFontSubstitution = (1 << 2), + NSStringDrawingUsesDeviceMetrics = (1 << 3), + NSStringDrawingOneShot = (1 << 4) +} + +const TNSStringDrawing = ` + + NSSize size () + { + return invokeObjcSelf!(NSSize, "size"); + } + + void drawAtPoint (NSPoint point) + { + return invokeObjcSelf!(void, "drawAtPoint:", NSPoint)(point); + } + + void drawInRect (NSRect rect) + { + return invokeObjcSelf!(void, "drawInRect:", NSRect)(rect); + } + + //mixin ObjcBindMethod!(size, "size"); + //mixin ObjcBindMethod!(drawAtPoint, "drawAtPoint:"); + //mixin ObjcBindMethod!(drawInRect, "drawInRect:"); + +`; + +const TNSExtendedStringDrawing = ` + + void drawWithRect (NSRect rect, int options, NSDictionary attributes) + { + return invokeObjcSelf!(void, "drawWithRect:options:attributes:", NSRect, int, NSDictionary)(rect, options, attributes); + } + + NSRect boundingRectWithSize (NSSize size, int options, NSDictionary attributes) + { + return invokeObjcSelf!(NSRect, "boundingRectWithSize:options:attributes:", NSSize, int, NSDictionary)(size, options, attributes); + } + + //mixin ObjcBindMethod!(drawWithRect, "drawWithRect:options:attributes:"); + //mixin ObjcBindMethod!(boundingRectWithSize, "boundingRectWithSize:options:attributes:"); + +`; + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSTabView.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSTabView.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,235 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSTabView; + +import dstep.foundation.NSArray; +import dstep.appkit.NSCell; +import dstep.appkit.NSFont; +import dstep.appkit.NSTabViewItem; +import dstep.appkit.NSView; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +typedef NSUInteger NSTabViewType; + +enum : NSUInteger +{ + NSTopTabsBezelBorder = 0, + NSLeftTabsBezelBorder = 1, + NSBottomTabsBezelBorder = 2, + NSRightTabsBezelBorder = 3, + NSNoTabsBezelBorder = 4, + NSNoTabsLineBorder = 5, + NSNoTabsNoBorder = 6 +} + +class NSTabView : NSView +{ + mixin (ObjcWrap); + + void selectTabViewItem (NSTabViewItem tabViewItem) + { + return invokeObjcSelf!(void, "selectTabViewItem:", NSTabViewItem)(tabViewItem); + } + + void selectTabViewItemAtIndex (NSInteger index) + { + return invokeObjcSelf!(void, "selectTabViewItemAtIndex:", NSInteger)(index); + } + + void selectTabViewItemWithIdentifier (Object identifier) + { + return invokeObjcSelf!(void, "selectTabViewItemWithIdentifier:", Object)(identifier); + } + + void takeSelectedTabViewItemFromSender (Object sender) + { + return invokeObjcSelf!(void, "takeSelectedTabViewItemFromSender:", Object)(sender); + } + + void selectFirstTabViewItem (Object sender) + { + return invokeObjcSelf!(void, "selectFirstTabViewItem:", Object)(sender); + } + + void selectLastTabViewItem (Object sender) + { + return invokeObjcSelf!(void, "selectLastTabViewItem:", Object)(sender); + } + + void selectNextTabViewItem (Object sender) + { + return invokeObjcSelf!(void, "selectNextTabViewItem:", Object)(sender); + } + + void selectPreviousTabViewItem (Object sender) + { + return invokeObjcSelf!(void, "selectPreviousTabViewItem:", Object)(sender); + } + + NSTabViewItem selectedTabViewItem () + { + return invokeObjcSelf!(NSTabViewItem, "selectedTabViewItem"); + } + + NSFont font () + { + return invokeObjcSelf!(NSFont, "font"); + } + + uint tabViewType () + { + return invokeObjcSelf!(uint, "tabViewType"); + } + + NSArray tabViewItems () + { + return invokeObjcSelf!(NSArray, "tabViewItems"); + } + + bool allowsTruncatedLabels () + { + return invokeObjcSelf!(bool, "allowsTruncatedLabels"); + } + + NSSize minimumSize () + { + return invokeObjcSelf!(NSSize, "minimumSize"); + } + + bool drawsBackground () + { + return invokeObjcSelf!(bool, "drawsBackground"); + } + + uint controlTint () + { + return invokeObjcSelf!(uint, "controlTint"); + } + + uint controlSize () + { + return invokeObjcSelf!(uint, "controlSize"); + } + + void setFont (NSFont font) + { + return invokeObjcSelf!(void, "setFont:", NSFont)(font); + } + + void setTabViewType (uint tabViewType) + { + return invokeObjcSelf!(void, "setTabViewType:", uint)(tabViewType); + } + + void setAllowsTruncatedLabels (bool allowTruncatedLabels) + { + return invokeObjcSelf!(void, "setAllowsTruncatedLabels:", bool)(allowTruncatedLabels); + } + + void setDrawsBackground (bool flag) + { + return invokeObjcSelf!(void, "setDrawsBackground:", bool)(flag); + } + + void setControlTint (uint controlTint) + { + return invokeObjcSelf!(void, "setControlTint:", uint)(controlTint); + } + + void setControlSize (uint controlSize) + { + return invokeObjcSelf!(void, "setControlSize:", uint)(controlSize); + } + + void addTabViewItem (NSTabViewItem tabViewItem) + { + return invokeObjcSelf!(void, "addTabViewItem:", NSTabViewItem)(tabViewItem); + } + + void insertTabViewItem (NSTabViewItem tabViewItem, NSInteger index) + { + return invokeObjcSelf!(void, "insertTabViewItem:atIndex:", NSTabViewItem, NSInteger)(tabViewItem, index); + } + + void removeTabViewItem (NSTabViewItem tabViewItem) + { + return invokeObjcSelf!(void, "removeTabViewItem:", NSTabViewItem)(tabViewItem); + } + + void setDelegate (Object anObject) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(anObject); + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + NSTabViewItem tabViewItemAtPoint (NSPoint point) + { + return invokeObjcSelf!(NSTabViewItem, "tabViewItemAtPoint:", NSPoint)(point); + } + + NSRect contentRect () + { + return invokeObjcSelf!(NSRect, "contentRect"); + } + + NSInteger numberOfTabViewItems () + { + return invokeObjcSelf!(NSInteger, "numberOfTabViewItems"); + } + + NSInteger indexOfTabViewItem (NSTabViewItem tabViewItem) + { + return invokeObjcSelf!(NSInteger, "indexOfTabViewItem:", NSTabViewItem)(tabViewItem); + } + + NSTabViewItem tabViewItemAtIndex (NSInteger index) + { + return invokeObjcSelf!(NSTabViewItem, "tabViewItemAtIndex:", NSInteger)(index); + } + + NSInteger indexOfTabViewItemWithIdentifier (Object identifier) + { + return invokeObjcSelf!(NSInteger, "indexOfTabViewItemWithIdentifier:", Object)(identifier); + } +} + +const TNSTabViewDelegate = ` + + bool tabView (NSTabView tabView, NSTabViewItem tabViewItem) + { + return invokeObjcSelf!(bool, "tabView:shouldSelectTabViewItem:", NSTabView, NSTabViewItem)(tabView, tabViewItem); + } + + void tabView (NSTabView tabView, NSTabViewItem tabViewItem) + { + return invokeObjcSelf!(void, "tabView:willSelectTabViewItem:", NSTabView, NSTabViewItem)(tabView, tabViewItem); + } + + void tabView (NSTabView tabView, NSTabViewItem tabViewItem) + { + return invokeObjcSelf!(void, "tabView:didSelectTabViewItem:", NSTabView, NSTabViewItem)(tabView, tabViewItem); + } + + void tabViewDidChangeNumberOfTabViewItems (NSTabView TabView) + { + return invokeObjcSelf!(void, "tabViewDidChangeNumberOfTabViewItems:", NSTabView)(TabView); + } + + //mixin ObjcBindMethod!(tabView, "tabView:shouldSelectTabViewItem:"); + //mixin ObjcBindMethod!(tabView, "tabView:willSelectTabViewItem:"); + //mixin ObjcBindMethod!(tabView, "tabView:didSelectTabViewItem:"); + //mixin ObjcBindMethod!(tabViewDidChangeNumberOfTabViewItems, "tabViewDidChangeNumberOfTabViewItems:"); + +`; + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSTabViewItem.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSTabViewItem.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,136 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSTabViewItem; + +import dstep.appkit.NSColor; +import dstep.appkit.NSTabView; +import dstep.appkit.NSView; +import dstep.foundation.NSCoder; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +typedef NSUInteger NSTabState; + +enum : NSUInteger +{ + NSSelectedTab = 0, + NSBackgroundTab = 1, + NSPressedTab = 2 +} + +class NSTabViewItem : NSObject, INSCoding +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + NSTabViewItem initWithIdentifier (Object identifier) + { + id result = invokeObjcSelf!(id, "initWithIdentifier:", Object)(identifier); + return result is this.objcObject ? this : (result !is null ? new NSTabViewItem(result) : null); + } + + this (Object identifier) + { + super(NSTabViewItem.alloc.initWithIdentifier(identifier).objcObject); + } + + Object identifier () + { + return invokeObjcSelf!(Object, "identifier"); + } + + Object view () + { + return invokeObjcSelf!(Object, "view"); + } + + NSTabViewItem initialFirstResponder () + { + id result = invokeObjcSelf!(id, "initialFirstResponder"); + return result is this.objcObject ? this : (result !is null ? new NSTabViewItem(result) : null); + } + + this () + { + super(NSTabViewItem.alloc.initialFirstResponder.objcObject); + } + + NSString label () + { + return invokeObjcSelf!(NSString, "label"); + } + + NSColor color () + { + return invokeObjcSelf!(NSColor, "color"); + } + + uint tabState () + { + return invokeObjcSelf!(uint, "tabState"); + } + + NSTabView tabView () + { + return invokeObjcSelf!(NSTabView, "tabView"); + } + + void setIdentifier (Object identifier) + { + return invokeObjcSelf!(void, "setIdentifier:", Object)(identifier); + } + + void setLabel (NSString label) + { + return invokeObjcSelf!(void, "setLabel:", NSString)(label); + } + + void setColor (NSColor color) + { + return invokeObjcSelf!(void, "setColor:", NSColor)(color); + } + + void setView (NSView view) + { + return invokeObjcSelf!(void, "setView:", NSView)(view); + } + + void setInitialFirstResponder (NSView view) + { + return invokeObjcSelf!(void, "setInitialFirstResponder:", NSView)(view); + } + + void drawLabel (bool shouldTruncateLabel, NSRect labelRect) + { + return invokeObjcSelf!(void, "drawLabel:inRect:", bool, NSRect)(shouldTruncateLabel, labelRect); + } + + NSSize sizeOfLabel (bool computeMin) + { + return invokeObjcSelf!(NSSize, "sizeOfLabel:", bool)(computeMin); + } + +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSTableColumn.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSTableColumn.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,201 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSTableColumn; + +import dstep.appkit.NSCell; +import dstep.appkit.NSImage; +import dstep.appkit.NSTableView; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSCoder; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSSortDescriptor; +import dstep.foundation.NSString; +import dstep.foundation.NSZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +enum +{ + NSTableColumnNoResizing = 0, + NSTableColumnAutoresizingMask = ( 1 << 0 ), + NSTableColumnUserResizingMask = ( 1 << 1 ) +} + +class NSTableColumn : NSObject, INSCoding +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + NSTableColumn initWithIdentifier (Object identifier) + { + id result = invokeObjcSelf!(id, "initWithIdentifier:", Object)(identifier); + return result is this.objcObject ? this : (result !is null ? new NSTableColumn(result) : null); + } + + this (Object identifier) + { + super(NSTableColumn.alloc.initWithIdentifier(identifier).objcObject); + } + + void setIdentifier (Object identifier) + { + return invokeObjcSelf!(void, "setIdentifier:", Object)(identifier); + } + + Object identifier () + { + return invokeObjcSelf!(Object, "identifier"); + } + + void setTableView (NSTableView tableView) + { + return invokeObjcSelf!(void, "setTableView:", NSTableView)(tableView); + } + + NSTableView tableView () + { + return invokeObjcSelf!(NSTableView, "tableView"); + } + + void setWidth (CGFloat width) + { + return invokeObjcSelf!(void, "setWidth:", CGFloat)(width); + } + + CGFloat width () + { + return invokeObjcSelf!(CGFloat, "width"); + } + + void setMinWidth (CGFloat minWidth) + { + return invokeObjcSelf!(void, "setMinWidth:", CGFloat)(minWidth); + } + + CGFloat minWidth () + { + return invokeObjcSelf!(CGFloat, "minWidth"); + } + + void setMaxWidth (CGFloat maxWidth) + { + return invokeObjcSelf!(void, "setMaxWidth:", CGFloat)(maxWidth); + } + + CGFloat maxWidth () + { + return invokeObjcSelf!(CGFloat, "maxWidth"); + } + + void setHeaderCell (NSCell cell) + { + return invokeObjcSelf!(void, "setHeaderCell:", NSCell)(cell); + } + + Object headerCell () + { + return invokeObjcSelf!(Object, "headerCell"); + } + + void setDataCell (NSCell cell) + { + return invokeObjcSelf!(void, "setDataCell:", NSCell)(cell); + } + + Object dataCell () + { + return invokeObjcSelf!(Object, "dataCell"); + } + + Object dataCellForRow (NSInteger row) + { + return invokeObjcSelf!(Object, "dataCellForRow:", NSInteger)(row); + } + + void setEditable (bool flag) + { + return invokeObjcSelf!(void, "setEditable:", bool)(flag); + } + + bool isEditable () + { + return invokeObjcSelf!(bool, "isEditable"); + } + + void sizeToFit () + { + return invokeObjcSelf!(void, "sizeToFit"); + } + + void setSortDescriptorPrototype (NSSortDescriptor sortDescriptor) + { + return invokeObjcSelf!(void, "setSortDescriptorPrototype:", NSSortDescriptor)(sortDescriptor); + } + + NSSortDescriptor sortDescriptorPrototype () + { + return invokeObjcSelf!(NSSortDescriptor, "sortDescriptorPrototype"); + } + + void setResizingMask (NSUInteger resizingMask) + { + return invokeObjcSelf!(void, "setResizingMask:", NSUInteger)(resizingMask); + } + + NSUInteger resizingMask () + { + return invokeObjcSelf!(NSUInteger, "resizingMask"); + } + + void setHeaderToolTip (NSString string) + { + return invokeObjcSelf!(void, "setHeaderToolTip:", NSString)(string); + } + + NSString headerToolTip () + { + return invokeObjcSelf!(NSString, "headerToolTip"); + } + + bool isHidden () + { + return invokeObjcSelf!(bool, "isHidden"); + } + + void setHidden (bool hidden) + { + return invokeObjcSelf!(void, "setHidden:", bool)(hidden); + } + + void setResizable (bool flag) + { + return invokeObjcSelf!(void, "setResizable:", bool)(flag); + } + + bool isResizable () + { + return invokeObjcSelf!(bool, "isResizable"); + } + +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSTableHeaderCell.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSTableHeaderCell.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,30 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSTableHeaderCell; + +import dstep.appkit.NSTextFieldCell; +import dstep.appkit.NSView; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSTableHeaderCell : NSTextFieldCell +{ + mixin (ObjcWrap); + + void drawSortIndicatorWithFrame (NSRect cellFrame, NSView controlView, bool ascending, NSInteger priority) + { + return invokeObjcSelf!(void, "drawSortIndicatorWithFrame:inView:ascending:priority:", NSRect, NSView, bool, NSInteger)(cellFrame, controlView, ascending, priority); + } + + NSRect sortIndicatorRectForBounds (NSRect theRect) + { + return invokeObjcSelf!(NSRect, "sortIndicatorRectForBounds:", NSRect)(theRect); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSTableHeaderView.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSTableHeaderView.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,59 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSTableHeaderView; + +import dstep.appkit.NSColor; +import dstep.appkit.NSCursor; +import dstep.appkit.NSImage; +import dstep.appkit.NSTableView; +import dstep.appkit.NSView; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSTableHeaderView : NSView +{ + mixin (ObjcWrap); + + void setTableView (NSTableView tableView) + { + return invokeObjcSelf!(void, "setTableView:", NSTableView)(tableView); + } + + NSTableView tableView () + { + return invokeObjcSelf!(NSTableView, "tableView"); + } + + NSInteger draggedColumn () + { + return invokeObjcSelf!(NSInteger, "draggedColumn"); + } + + CGFloat draggedDistance () + { + return invokeObjcSelf!(CGFloat, "draggedDistance"); + } + + NSInteger resizedColumn () + { + return invokeObjcSelf!(NSInteger, "resizedColumn"); + } + + NSRect headerRectOfColumn (NSInteger column) + { + return invokeObjcSelf!(NSRect, "headerRectOfColumn:", NSInteger)(column); + } + + NSInteger columnAtPoint (NSPoint point) + { + return invokeObjcSelf!(NSInteger, "columnAtPoint:", NSPoint)(point); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSTableView.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSTableView.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,870 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSTableView; + +import dstep.appkit.AppKitDefines; +import dstep.appkit.NSCell; +import dstep.appkit.NSColor; +import dstep.appkit.NSControl; +import dstep.appkit.NSDragging; +import dstep.appkit.NSEvent; +import dstep.appkit.NSImage; +import dstep.appkit.NSTableColumn; +import dstep.appkit.NSTableHeaderView; +import dstep.appkit.NSText; +import dstep.appkit.NSUserInterfaceValidation; +import dstep.appkit.NSView; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSArray; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSIndexSet; +import dstep.foundation.NSNotification; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSRange; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.appkit.NSTableView_bindings; + +typedef NSUInteger NSTableViewDropOperation; +typedef NSUInteger NSTableViewColumnAutoresizingStyle; +typedef NSInteger NSTableViewSelectionHighlightStyle; + +private +{ + NSString NSTableViewSelectionDidChangeNotification_; + NSString NSTableViewColumnDidMoveNotification_; + NSString NSTableViewColumnDidResizeNotification_; + NSString NSTableViewSelectionIsChangingNotification_; +} + +NSString NSTableViewSelectionDidChangeNotification () +{ + if (NSTableViewSelectionDidChangeNotification_) + return NSTableViewSelectionDidChangeNotification_; + + return NSTableViewSelectionDidChangeNotification_ = new NSString(bindings.NSTableViewSelectionDidChangeNotification); +} + +NSString NSTableViewColumnDidMoveNotification () +{ + if (NSTableViewColumnDidMoveNotification_) + return NSTableViewColumnDidMoveNotification_; + + return NSTableViewColumnDidMoveNotification_ = new NSString(bindings.NSTableViewColumnDidMoveNotification); +} + +NSString NSTableViewColumnDidResizeNotification () +{ + if (NSTableViewColumnDidResizeNotification_) + return NSTableViewColumnDidResizeNotification_; + + return NSTableViewColumnDidResizeNotification_ = new NSString(bindings.NSTableViewColumnDidResizeNotification); +} + +NSString NSTableViewSelectionIsChangingNotification () +{ + if (NSTableViewSelectionIsChangingNotification_) + return NSTableViewSelectionIsChangingNotification_; + + return NSTableViewSelectionIsChangingNotification_ = new NSString(bindings.NSTableViewSelectionIsChangingNotification); +} + +enum : NSUInteger +{ + NSTableViewDropOn, + NSTableViewDropAbove +} + +enum : NSUInteger +{ + NSTableViewNoColumnAutoresizing = 0, + NSTableViewUniformColumnAutoresizingStyle, + NSTableViewSequentialColumnAutoresizingStyle, + NSTableViewReverseSequentialColumnAutoresizingStyle, + NSTableViewLastColumnOnlyAutoresizingStyle, + NSTableViewFirstColumnOnlyAutoresizingStyle +} + +enum +{ + NSTableViewGridNone = 0, + NSTableViewSolidVerticalGridLineMask = 1 << 0, + NSTableViewSolidHorizontalGridLineMask = 1 << 1 +} + +enum : NSInteger +{ + NSTableViewSelectionHighlightStyleRegular = 0, + NSTableViewSelectionHighlightStyleSourceList = 1 +} + +struct _TvFlags +{ + uint refusesFirstResponder; + uint movedPostingDisableCount; + uint selectionPostingDisableCount; + uint dataSourceSetObjectValue; + uint oldAutoresizesAllColumnsToFit; + uint delegateSelectionShouldChangeInTableView; + uint delegateShouldSelectTableColumn; + uint delegateShouldSelectRow; + uint delegateShouldEditTableColumn; + uint delegateWillDisplayCell; + uint compareWidthWithSuperview; + uint changingLayout; + uint selectionType; + uint allowsColumnSelection; + uint allowsMultipleSelection; + uint allowsEmptySelection; + uint oldDrawsGridFlag; + uint allowsColumnResizing; + uint allowsColumnReordering; +} + +class NSTableView : NSControl, INSUserInterfaceValidations +{ + mixin (ObjcWrap); + + void setDataSource (Object aSource) + { + return invokeObjcSelf!(void, "setDataSource:", Object)(aSource); + } + + Object dataSource () + { + return invokeObjcSelf!(Object, "dataSource"); + } + + void setDelegate (Object delegate_) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(delegate_); + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + void setHeaderView (NSTableHeaderView headerView) + { + return invokeObjcSelf!(void, "setHeaderView:", NSTableHeaderView)(headerView); + } + + NSTableHeaderView headerView () + { + return invokeObjcSelf!(NSTableHeaderView, "headerView"); + } + + void setCornerView (NSView cornerView) + { + return invokeObjcSelf!(void, "setCornerView:", NSView)(cornerView); + } + + NSView cornerView () + { + return invokeObjcSelf!(NSView, "cornerView"); + } + + void setAllowsColumnReordering (bool flag) + { + return invokeObjcSelf!(void, "setAllowsColumnReordering:", bool)(flag); + } + + bool allowsColumnReordering () + { + return invokeObjcSelf!(bool, "allowsColumnReordering"); + } + + void setAllowsColumnResizing (bool flag) + { + return invokeObjcSelf!(void, "setAllowsColumnResizing:", bool)(flag); + } + + bool allowsColumnResizing () + { + return invokeObjcSelf!(bool, "allowsColumnResizing"); + } + + void setColumnAutoresizingStyle (uint style) + { + return invokeObjcSelf!(void, "setColumnAutoresizingStyle:", uint)(style); + } + + uint columnAutoresizingStyle () + { + return invokeObjcSelf!(uint, "columnAutoresizingStyle"); + } + + void setGridStyleMask (NSUInteger gridType) + { + return invokeObjcSelf!(void, "setGridStyleMask:", NSUInteger)(gridType); + } + + NSUInteger gridStyleMask () + { + return invokeObjcSelf!(NSUInteger, "gridStyleMask"); + } + + void setIntercellSpacing (NSSize aSize) + { + return invokeObjcSelf!(void, "setIntercellSpacing:", NSSize)(aSize); + } + + NSSize intercellSpacing () + { + return invokeObjcSelf!(NSSize, "intercellSpacing"); + } + + void setUsesAlternatingRowBackgroundColors (bool useAlternatingRowColors) + { + return invokeObjcSelf!(void, "setUsesAlternatingRowBackgroundColors:", bool)(useAlternatingRowColors); + } + + bool usesAlternatingRowBackgroundColors () + { + return invokeObjcSelf!(bool, "usesAlternatingRowBackgroundColors"); + } + + void setBackgroundColor (NSColor color) + { + return invokeObjcSelf!(void, "setBackgroundColor:", NSColor)(color); + } + + NSColor backgroundColor () + { + return invokeObjcSelf!(NSColor, "backgroundColor"); + } + + void setGridColor (NSColor color) + { + return invokeObjcSelf!(void, "setGridColor:", NSColor)(color); + } + + NSColor gridColor () + { + return invokeObjcSelf!(NSColor, "gridColor"); + } + + void setRowHeight (CGFloat rowHeight) + { + return invokeObjcSelf!(void, "setRowHeight:", CGFloat)(rowHeight); + } + + CGFloat rowHeight () + { + return invokeObjcSelf!(CGFloat, "rowHeight"); + } + + void noteHeightOfRowsWithIndexesChanged (NSIndexSet indexSet) + { + return invokeObjcSelf!(void, "noteHeightOfRowsWithIndexesChanged:", NSIndexSet)(indexSet); + } + + NSArray tableColumns () + { + return invokeObjcSelf!(NSArray, "tableColumns"); + } + + NSInteger numberOfColumns () + { + return invokeObjcSelf!(NSInteger, "numberOfColumns"); + } + + NSInteger numberOfRows () + { + return invokeObjcSelf!(NSInteger, "numberOfRows"); + } + + void addTableColumn (NSTableColumn column) + { + return invokeObjcSelf!(void, "addTableColumn:", NSTableColumn)(column); + } + + void removeTableColumn (NSTableColumn column) + { + return invokeObjcSelf!(void, "removeTableColumn:", NSTableColumn)(column); + } + + NSInteger columnWithIdentifier (Object identifier) + { + return invokeObjcSelf!(NSInteger, "columnWithIdentifier:", Object)(identifier); + } + + NSTableColumn tableColumnWithIdentifier (Object identifier) + { + return invokeObjcSelf!(NSTableColumn, "tableColumnWithIdentifier:", Object)(identifier); + } + + void tile () + { + return invokeObjcSelf!(void, "tile"); + } + + void sizeToFit () + { + return invokeObjcSelf!(void, "sizeToFit"); + } + + void sizeLastColumnToFit () + { + return invokeObjcSelf!(void, "sizeLastColumnToFit"); + } + + void scrollRowToVisible (NSInteger row) + { + return invokeObjcSelf!(void, "scrollRowToVisible:", NSInteger)(row); + } + + void scrollColumnToVisible (NSInteger column) + { + return invokeObjcSelf!(void, "scrollColumnToVisible:", NSInteger)(column); + } + + void moveColumn (NSInteger column, NSInteger newIndex) + { + return invokeObjcSelf!(void, "moveColumn:toColumn:", NSInteger, NSInteger)(column, newIndex); + } + + void reloadData () + { + return invokeObjcSelf!(void, "reloadData"); + } + + void noteNumberOfRowsChanged () + { + return invokeObjcSelf!(void, "noteNumberOfRowsChanged"); + } + + NSInteger editedColumn () + { + return invokeObjcSelf!(NSInteger, "editedColumn"); + } + + NSInteger editedRow () + { + return invokeObjcSelf!(NSInteger, "editedRow"); + } + + NSInteger clickedColumn () + { + return invokeObjcSelf!(NSInteger, "clickedColumn"); + } + + NSInteger clickedRow () + { + return invokeObjcSelf!(NSInteger, "clickedRow"); + } + + void setDoubleAction (SEL aSelector) + { + return invokeObjcSelf!(void, "setDoubleAction:", SEL)(aSelector); + } + + SEL doubleAction () + { + return invokeObjcSelf!(SEL, "doubleAction"); + } + + void setSortDescriptors (NSArray array) + { + return invokeObjcSelf!(void, "setSortDescriptors:", NSArray)(array); + } + + NSArray sortDescriptors () + { + return invokeObjcSelf!(NSArray, "sortDescriptors"); + } + + void setIndicatorImage (NSImage anImage, NSTableColumn tc) + { + return invokeObjcSelf!(void, "setIndicatorImage:inTableColumn:", NSImage, NSTableColumn)(anImage, tc); + } + + NSImage indicatorImageInTableColumn (NSTableColumn tc) + { + return invokeObjcSelf!(NSImage, "indicatorImageInTableColumn:", NSTableColumn)(tc); + } + + void setHighlightedTableColumn (NSTableColumn tc) + { + return invokeObjcSelf!(void, "setHighlightedTableColumn:", NSTableColumn)(tc); + } + + NSTableColumn highlightedTableColumn () + { + return invokeObjcSelf!(NSTableColumn, "highlightedTableColumn"); + } + + void setVerticalMotionCanBeginDrag (bool flag) + { + return invokeObjcSelf!(void, "setVerticalMotionCanBeginDrag:", bool)(flag); + } + + bool verticalMotionCanBeginDrag () + { + return invokeObjcSelf!(bool, "verticalMotionCanBeginDrag"); + } + + bool canDragRowsWithIndexes (NSIndexSet rowIndexes, NSPoint mouseDownPoint) + { + return invokeObjcSelf!(bool, "canDragRowsWithIndexes:atPoint:", NSIndexSet, NSPoint)(rowIndexes, mouseDownPoint); + } + + NSImage dragImageForRowsWithIndexes (NSIndexSet dragRows, NSArray tableColumns, NSEvent dragEvent, NSPointPointer dragImageOffset) + { + return invokeObjcSelf!(NSImage, "dragImageForRowsWithIndexes:tableColumns:event:offset:", NSIndexSet, NSArray, NSEvent, NSPointPointer)(dragRows, tableColumns, dragEvent, dragImageOffset); + } + + void setDraggingSourceOperationMask (uint mask, bool isLocal) + { + return invokeObjcSelf!(void, "setDraggingSourceOperationMask:forLocal:", uint, bool)(mask, isLocal); + } + + void setDropRow (NSInteger row, uint op) + { + return invokeObjcSelf!(void, "setDropRow:dropOperation:", NSInteger, uint)(row, op); + } + + void setAllowsMultipleSelection (bool flag) + { + return invokeObjcSelf!(void, "setAllowsMultipleSelection:", bool)(flag); + } + + bool allowsMultipleSelection () + { + return invokeObjcSelf!(bool, "allowsMultipleSelection"); + } + + void setAllowsEmptySelection (bool flag) + { + return invokeObjcSelf!(void, "setAllowsEmptySelection:", bool)(flag); + } + + bool allowsEmptySelection () + { + return invokeObjcSelf!(bool, "allowsEmptySelection"); + } + + void setAllowsColumnSelection (bool flag) + { + return invokeObjcSelf!(void, "setAllowsColumnSelection:", bool)(flag); + } + + bool allowsColumnSelection () + { + return invokeObjcSelf!(bool, "allowsColumnSelection"); + } + + void selectAll (Object sender) + { + return invokeObjcSelf!(void, "selectAll:", Object)(sender); + } + + void deselectAll (Object sender) + { + return invokeObjcSelf!(void, "deselectAll:", Object)(sender); + } + + void selectColumnIndexes (NSIndexSet indexes, bool extend) + { + return invokeObjcSelf!(void, "selectColumnIndexes:byExtendingSelection:", NSIndexSet, bool)(indexes, extend); + } + + void selectRowIndexes (NSIndexSet indexes, bool extend) + { + return invokeObjcSelf!(void, "selectRowIndexes:byExtendingSelection:", NSIndexSet, bool)(indexes, extend); + } + + NSIndexSet selectedColumnIndexes () + { + return invokeObjcSelf!(NSIndexSet, "selectedColumnIndexes"); + } + + NSIndexSet selectedRowIndexes () + { + return invokeObjcSelf!(NSIndexSet, "selectedRowIndexes"); + } + + void deselectColumn (NSInteger column) + { + return invokeObjcSelf!(void, "deselectColumn:", NSInteger)(column); + } + + void deselectRow (NSInteger row) + { + return invokeObjcSelf!(void, "deselectRow:", NSInteger)(row); + } + + NSInteger selectedColumn () + { + return invokeObjcSelf!(NSInteger, "selectedColumn"); + } + + NSInteger selectedRow () + { + return invokeObjcSelf!(NSInteger, "selectedRow"); + } + + bool isColumnSelected (NSInteger column) + { + return invokeObjcSelf!(bool, "isColumnSelected:", NSInteger)(column); + } + + bool isRowSelected (NSInteger row) + { + return invokeObjcSelf!(bool, "isRowSelected:", NSInteger)(row); + } + + NSInteger numberOfSelectedColumns () + { + return invokeObjcSelf!(NSInteger, "numberOfSelectedColumns"); + } + + NSInteger numberOfSelectedRows () + { + return invokeObjcSelf!(NSInteger, "numberOfSelectedRows"); + } + + bool allowsTypeSelect () + { + return invokeObjcSelf!(bool, "allowsTypeSelect"); + } + + void setAllowsTypeSelect (bool value) + { + return invokeObjcSelf!(void, "setAllowsTypeSelect:", bool)(value); + } + + int selectionHighlightStyle () + { + return invokeObjcSelf!(int, "selectionHighlightStyle"); + } + + void setSelectionHighlightStyle (int selectionHighlightStyle) + { + return invokeObjcSelf!(void, "setSelectionHighlightStyle:", int)(selectionHighlightStyle); + } + + NSRect rectOfColumn (NSInteger column) + { + return invokeObjcSelf!(NSRect, "rectOfColumn:", NSInteger)(column); + } + + NSRect rectOfRow (NSInteger row) + { + return invokeObjcSelf!(NSRect, "rectOfRow:", NSInteger)(row); + } + + NSIndexSet columnIndexesInRect (NSRect rect) + { + return invokeObjcSelf!(NSIndexSet, "columnIndexesInRect:", NSRect)(rect); + } + + NSRange rowsInRect (NSRect rect) + { + return invokeObjcSelf!(NSRange, "rowsInRect:", NSRect)(rect); + } + + NSInteger columnAtPoint (NSPoint point) + { + return invokeObjcSelf!(NSInteger, "columnAtPoint:", NSPoint)(point); + } + + NSInteger rowAtPoint (NSPoint point) + { + return invokeObjcSelf!(NSInteger, "rowAtPoint:", NSPoint)(point); + } + + NSRect frameOfCellAtColumn (NSInteger column, NSInteger row) + { + return invokeObjcSelf!(NSRect, "frameOfCellAtColumn:row:", NSInteger, NSInteger)(column, row); + } + + NSCell preparedCellAtColumn (NSInteger column, NSInteger row) + { + return invokeObjcSelf!(NSCell, "preparedCellAtColumn:row:", NSInteger, NSInteger)(column, row); + } + + bool textShouldBeginEditing (NSText textObject) + { + return invokeObjcSelf!(bool, "textShouldBeginEditing:", NSText)(textObject); + } + + bool textShouldEndEditing (NSText textObject) + { + return invokeObjcSelf!(bool, "textShouldEndEditing:", NSText)(textObject); + } + + void textDidBeginEditing (NSNotification notification) + { + return invokeObjcSelf!(void, "textDidBeginEditing:", NSNotification)(notification); + } + + void textDidEndEditing (NSNotification notification) + { + return invokeObjcSelf!(void, "textDidEndEditing:", NSNotification)(notification); + } + + void textDidChange (NSNotification notification) + { + return invokeObjcSelf!(void, "textDidChange:", NSNotification)(notification); + } + + void setAutosaveName (NSString name) + { + return invokeObjcSelf!(void, "setAutosaveName:", NSString)(name); + } + + NSString autosaveName () + { + return invokeObjcSelf!(NSString, "autosaveName"); + } + + void setAutosaveTableColumns (bool save) + { + return invokeObjcSelf!(void, "setAutosaveTableColumns:", bool)(save); + } + + bool autosaveTableColumns () + { + return invokeObjcSelf!(bool, "autosaveTableColumns"); + } + + void editColumn (NSInteger column, NSInteger row, NSEvent theEvent, bool select) + { + return invokeObjcSelf!(void, "editColumn:row:withEvent:select:", NSInteger, NSInteger, NSEvent, bool)(column, row, theEvent, select); + } + + void drawRow (NSInteger row, NSRect clipRect) + { + return invokeObjcSelf!(void, "drawRow:clipRect:", NSInteger, NSRect)(row, clipRect); + } + + void highlightSelectionInClipRect (NSRect clipRect) + { + return invokeObjcSelf!(void, "highlightSelectionInClipRect:", NSRect)(clipRect); + } + + void drawGridInClipRect (NSRect clipRect) + { + return invokeObjcSelf!(void, "drawGridInClipRect:", NSRect)(clipRect); + } + + void drawBackgroundInClipRect (NSRect clipRect) + { + return invokeObjcSelf!(void, "drawBackgroundInClipRect:", NSRect)(clipRect); + } + + bool validateUserInterfaceItem (INSValidatedUserInterfaceItem anItem) + { + return invokeObjcSelf!(bool, "validateUserInterfaceItem:", INSValidatedUserInterfaceItem)(anItem); + } +} + +const TNSTableViewNotifications = ` + + void tableViewSelectionDidChange (NSNotification notification) + { + return invokeObjcSelf!(void, "tableViewSelectionDidChange:", NSNotification)(notification); + } + + void tableViewColumnDidMove (NSNotification notification) + { + return invokeObjcSelf!(void, "tableViewColumnDidMove:", NSNotification)(notification); + } + + void tableViewColumnDidResize (NSNotification notification) + { + return invokeObjcSelf!(void, "tableViewColumnDidResize:", NSNotification)(notification); + } + + void tableViewSelectionIsChanging (NSNotification notification) + { + return invokeObjcSelf!(void, "tableViewSelectionIsChanging:", NSNotification)(notification); + } + + //mixin ObjcBindMethod!(tableViewSelectionDidChange, "tableViewSelectionDidChange:"); + //mixin ObjcBindMethod!(tableViewColumnDidMove, "tableViewColumnDidMove:"); + //mixin ObjcBindMethod!(tableViewColumnDidResize, "tableViewColumnDidResize:"); + //mixin ObjcBindMethod!(tableViewSelectionIsChanging, "tableViewSelectionIsChanging:"); + +`; + +const TNSTableDataSource = ` + + NSInteger numberOfRowsInTableView (NSTableView tableView) + { + return invokeObjcSelf!(NSInteger, "numberOfRowsInTableView:", NSTableView)(tableView); + } + + Object tableView (NSTableView tableView, NSTableColumn tableColumn, NSInteger row) + { + return invokeObjcSelf!(Object, "tableView:objectValueForTableColumn:row:", NSTableView, NSTableColumn, NSInteger)(tableView, tableColumn, row); + } + + void tableView (NSTableView tableView, Object object, NSTableColumn tableColumn, NSInteger row) + { + return invokeObjcSelf!(void, "tableView:setObjectValue:forTableColumn:row:", NSTableView, Object, NSTableColumn, NSInteger)(tableView, object, tableColumn, row); + } + + void tableView (NSTableView tableView, NSArray oldDescriptors) + { + return invokeObjcSelf!(void, "tableView:sortDescriptorsDidChange:", NSTableView, NSArray)(tableView, oldDescriptors); + } + + bool tableView (NSTableView tableView, NSIndexSet rowIndexes, NSPasteboard pboard) + { + return invokeObjcSelf!(bool, "tableView:writeRowsWithIndexes:toPasteboard:", NSTableView, NSIndexSet, NSPasteboard)(tableView, rowIndexes, pboard); + } + + uint tableView (NSTableView tableView, INSDraggingInfo info, NSInteger row, uint dropOperation) + { + return invokeObjcSelf!(uint, "tableView:validateDrop:proposedRow:proposedDropOperation:", NSTableView, INSDraggingInfo, NSInteger, uint)(tableView, info, row, dropOperation); + } + + bool tableView (NSTableView tableView, INSDraggingInfo info, NSInteger row, uint dropOperation) + { + return invokeObjcSelf!(bool, "tableView:acceptDrop:row:dropOperation:", NSTableView, INSDraggingInfo, NSInteger, uint)(tableView, info, row, dropOperation); + } + + NSArray tableView (NSTableView tableView, NSURL dropDestination, NSIndexSet indexSet) + { + return invokeObjcSelf!(NSArray, "tableView:namesOfPromisedFilesDroppedAtDestination:forDraggedRowsWithIndexes:", NSTableView, NSURL, NSIndexSet)(tableView, dropDestination, indexSet); + } + + bool tableView (NSTableView tableView, NSArray rows, NSPasteboard pboard) + { + return invokeObjcSelf!(bool, "tableView:writeRows:toPasteboard:", NSTableView, NSArray, NSPasteboard)(tableView, rows, pboard); + } + + //mixin ObjcBindMethod!(numberOfRowsInTableView, "numberOfRowsInTableView:"); + //mixin ObjcBindMethod!(tableView, "tableView:objectValueForTableColumn:row:"); + //mixin ObjcBindMethod!(tableView, "tableView:setObjectValue:forTableColumn:row:"); + //mixin ObjcBindMethod!(tableView, "tableView:sortDescriptorsDidChange:"); + //mixin ObjcBindMethod!(tableView, "tableView:writeRowsWithIndexes:toPasteboard:"); + //mixin ObjcBindMethod!(tableView, "tableView:validateDrop:proposedRow:proposedDropOperation:"); + //mixin ObjcBindMethod!(tableView, "tableView:acceptDrop:row:dropOperation:"); + //mixin ObjcBindMethod!(tableView, "tableView:namesOfPromisedFilesDroppedAtDestination:forDraggedRowsWithIndexes:"); + //mixin ObjcBindMethod!(tableView, "tableView:writeRows:toPasteboard:"); + +`; + +const TNSTableViewDelegate = ` + + void tableView (NSTableView tableView, Object cell, NSTableColumn tableColumn, NSInteger row) + { + return invokeObjcSelf!(void, "tableView:willDisplayCell:forTableColumn:row:", NSTableView, Object, NSTableColumn, NSInteger)(tableView, cell, tableColumn, row); + } + + bool tableView (NSTableView tableView, NSTableColumn tableColumn, NSInteger row) + { + return invokeObjcSelf!(bool, "tableView:shouldEditTableColumn:row:", NSTableView, NSTableColumn, NSInteger)(tableView, tableColumn, row); + } + + bool selectionShouldChangeInTableView (NSTableView tableView) + { + return invokeObjcSelf!(bool, "selectionShouldChangeInTableView:", NSTableView)(tableView); + } + + bool tableView (NSTableView tableView, NSInteger row) + { + return invokeObjcSelf!(bool, "tableView:shouldSelectRow:", NSTableView, NSInteger)(tableView, row); + } + + NSIndexSet tableView (NSTableView tableView, NSIndexSet proposedSelectionIndexes) + { + return invokeObjcSelf!(NSIndexSet, "tableView:selectionIndexesForProposedSelection:", NSTableView, NSIndexSet)(tableView, proposedSelectionIndexes); + } + + bool tableView (NSTableView tableView, NSTableColumn tableColumn) + { + return invokeObjcSelf!(bool, "tableView:shouldSelectTableColumn:", NSTableView, NSTableColumn)(tableView, tableColumn); + } + + void tableView (NSTableView tableView, NSTableColumn tableColumn) + { + return invokeObjcSelf!(void, "tableView:mouseDownInHeaderOfTableColumn:", NSTableView, NSTableColumn)(tableView, tableColumn); + } + + void tableView (NSTableView tableView, NSTableColumn tableColumn) + { + return invokeObjcSelf!(void, "tableView:didClickTableColumn:", NSTableView, NSTableColumn)(tableView, tableColumn); + } + + void tableView (NSTableView tableView, NSTableColumn tableColumn) + { + return invokeObjcSelf!(void, "tableView:didDragTableColumn:", NSTableView, NSTableColumn)(tableView, tableColumn); + } + + NSString tableView (NSTableView tableView, NSCell cell, NSRectPointer rect, NSTableColumn tableColumn, NSInteger row, NSPoint mouseLocation) + { + return invokeObjcSelf!(NSString, "tableView:toolTipForCell:rect:tableColumn:row:mouseLocation:", NSTableView, NSCell, NSRectPointer, NSTableColumn, NSInteger, NSPoint)(tableView, cell, rect, tableColumn, row, mouseLocation); + } + + CGFloat tableView (NSTableView tableView, NSInteger row) + { + return invokeObjcSelf!(CGFloat, "tableView:heightOfRow:", NSTableView, NSInteger)(tableView, row); + } + + NSString tableView (NSTableView tableView, NSTableColumn tableColumn, NSInteger row) + { + return invokeObjcSelf!(NSString, "tableView:typeSelectStringForTableColumn:row:", NSTableView, NSTableColumn, NSInteger)(tableView, tableColumn, row); + } + + NSInteger tableView (NSTableView tableView, NSInteger startRow, NSInteger endRow, NSString searchString) + { + return invokeObjcSelf!(NSInteger, "tableView:nextTypeSelectMatchFromRow:toRow:forString:", NSTableView, NSInteger, NSInteger, NSString)(tableView, startRow, endRow, searchString); + } + + bool tableView (NSTableView tableView, NSEvent event, NSString searchString) + { + return invokeObjcSelf!(bool, "tableView:shouldTypeSelectForEvent:withCurrentSearchString:", NSTableView, NSEvent, NSString)(tableView, event, searchString); + } + + bool tableView (NSTableView tableView, NSTableColumn tableColumn, NSInteger row) + { + return invokeObjcSelf!(bool, "tableView:shouldShowCellExpansionForTableColumn:row:", NSTableView, NSTableColumn, NSInteger)(tableView, tableColumn, row); + } + + bool tableView (NSTableView tableView, NSCell cell, NSTableColumn tableColumn, NSInteger row) + { + return invokeObjcSelf!(bool, "tableView:shouldTrackCell:forTableColumn:row:", NSTableView, NSCell, NSTableColumn, NSInteger)(tableView, cell, tableColumn, row); + } + + NSCell tableView (NSTableView tableView, NSTableColumn tableColumn, NSInteger row) + { + return invokeObjcSelf!(NSCell, "tableView:dataCellForTableColumn:row:", NSTableView, NSTableColumn, NSInteger)(tableView, tableColumn, row); + } + + bool tableView (NSTableView tableView, NSInteger row) + { + return invokeObjcSelf!(bool, "tableView:isGroupRow:", NSTableView, NSInteger)(tableView, row); + } + + //mixin ObjcBindMethod!(tableView, "tableView:willDisplayCell:forTableColumn:row:"); + //mixin ObjcBindMethod!(tableView, "tableView:shouldEditTableColumn:row:"); + //mixin ObjcBindMethod!(selectionShouldChangeInTableView, "selectionShouldChangeInTableView:"); + //mixin ObjcBindMethod!(tableView, "tableView:shouldSelectRow:"); + //mixin ObjcBindMethod!(tableView, "tableView:selectionIndexesForProposedSelection:"); + //mixin ObjcBindMethod!(tableView, "tableView:shouldSelectTableColumn:"); + //mixin ObjcBindMethod!(tableView, "tableView:mouseDownInHeaderOfTableColumn:"); + //mixin ObjcBindMethod!(tableView, "tableView:didClickTableColumn:"); + //mixin ObjcBindMethod!(tableView, "tableView:didDragTableColumn:"); + //mixin ObjcBindMethod!(tableView, "tableView:toolTipForCell:rect:tableColumn:row:mouseLocation:"); + //mixin ObjcBindMethod!(tableView, "tableView:heightOfRow:"); + //mixin ObjcBindMethod!(tableView, "tableView:typeSelectStringForTableColumn:row:"); + //mixin ObjcBindMethod!(tableView, "tableView:nextTypeSelectMatchFromRow:toRow:forString:"); + //mixin ObjcBindMethod!(tableView, "tableView:shouldTypeSelectForEvent:withCurrentSearchString:"); + //mixin ObjcBindMethod!(tableView, "tableView:shouldShowCellExpansionForTableColumn:row:"); + //mixin ObjcBindMethod!(tableView, "tableView:shouldTrackCell:forTableColumn:row:"); + //mixin ObjcBindMethod!(tableView, "tableView:dataCellForTableColumn:row:"); + //mixin ObjcBindMethod!(tableView, "tableView:isGroupRow:"); + +`; + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSTableView_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSTableView_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,21 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSTableView_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package id NSTableViewSelectionDidChangeNotification; + package id NSTableViewColumnDidMoveNotification; + package id NSTableViewColumnDidResizeNotification; + package id NSTableViewSelectionIsChangingNotification; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSText.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSText.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,501 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSText; + +import dstep.appkit.NSColor; +import dstep.appkit.NSFont; +import dstep.appkit.NSSpellProtocol; +import dstep.appkit.NSView; +import dstep.foundation.NSData; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSNotification; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSRange; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.appkit.NSText_bindings; + +typedef NSUInteger NSTextAlignment; +typedef NSInteger NSWritingDirection; + +private +{ + NSString NSTextDidBeginEditingNotification_; + NSString NSTextDidEndEditingNotification_; + NSString NSTextDidChangeNotification_; +} + +NSString NSTextDidBeginEditingNotification () +{ + if (NSTextDidBeginEditingNotification_) + return NSTextDidBeginEditingNotification_; + + return NSTextDidBeginEditingNotification_ = new NSString(bindings.NSTextDidBeginEditingNotification); +} + +NSString NSTextDidEndEditingNotification () +{ + if (NSTextDidEndEditingNotification_) + return NSTextDidEndEditingNotification_; + + return NSTextDidEndEditingNotification_ = new NSString(bindings.NSTextDidEndEditingNotification); +} + +NSString NSTextDidChangeNotification () +{ + if (NSTextDidChangeNotification_) + return NSTextDidChangeNotification_; + + return NSTextDidChangeNotification_ = new NSString(bindings.NSTextDidChangeNotification); +} + +enum +{ + NSEnterCharacter = 0x0003, + NSBackspaceCharacter = 0x0008, + NSTabCharacter = 0x0009, + NSNewlineCharacter = 0x000a, + NSFormFeedCharacter = 0x000c, + NSCarriageReturnCharacter = 0x000d, + NSBackTabCharacter = 0x0019, + NSDeleteCharacter = 0x007f, + NSLineSeparatorCharacter = 0x2028, + NSParagraphSeparatorCharacter = 0x2029 +} + +enum : NSUInteger +{ + NSLeftTextAlignment = 0, + NSRightTextAlignment = 1, + NSCenterTextAlignment = 2, + NSJustifiedTextAlignment = 3, + NSNaturalTextAlignment = 4 +} + +enum : NSInteger +{ + NSWritingDirectionNatural = -1, + NSWritingDirectionLeftToRight = 0, + NSWritingDirectionRightToLeft = 1 +} + +enum +{ + NSIllegalTextMovement = 0, + NSReturnTextMovement = 0x10, + NSTabTextMovement = 0x11, + NSBacktabTextMovement = 0x12, + NSLeftTextMovement = 0x13, + NSRightTextMovement = 0x14, + NSUpTextMovement = 0x15, + NSDownTextMovement = 0x16, + NSCancelTextMovement = 0x17, + NSOtherTextMovement = 0 +} + +class NSText : NSView, INSChangeSpelling, INSIgnoreMisspelledWords +{ + mixin (ObjcWrap); + + NSString string () + { + return invokeObjcSelf!(NSString, "string"); + } + + void setString (NSString string) + { + return invokeObjcSelf!(void, "setString:", NSString)(string); + } + + void replaceCharactersInRange (NSRange range, NSString aString) + { + return invokeObjcSelf!(void, "replaceCharactersInRange:withString:", NSRange, NSString)(range, aString); + } + + void replaceCharactersInRange (NSRange range, NSData rtfData) + { + return invokeObjcSelf!(void, "replaceCharactersInRange:withRTF:", NSRange, NSData)(range, rtfData); + } + + void replaceCharactersInRange_withRTFD (NSRange range, NSData rtfdData) + { + return invokeObjcSelf!(void, "replaceCharactersInRange:withRTFD:", NSRange, NSData)(range, rtfdData); + } + + NSData RTFFromRange (NSRange range) + { + return invokeObjcSelf!(NSData, "RTFFromRange:", NSRange)(range); + } + + NSData RTFDFromRange (NSRange range) + { + return invokeObjcSelf!(NSData, "RTFDFromRange:", NSRange)(range); + } + + bool writeRTFDToFile (NSString path, bool flag) + { + return invokeObjcSelf!(bool, "writeRTFDToFile:atomically:", NSString, bool)(path, flag); + } + + bool readRTFDFromFile (NSString path) + { + return invokeObjcSelf!(bool, "readRTFDFromFile:", NSString)(path); + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + void setDelegate (Object anObject) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(anObject); + } + + bool isEditable () + { + return invokeObjcSelf!(bool, "isEditable"); + } + + void setEditable (bool flag) + { + return invokeObjcSelf!(void, "setEditable:", bool)(flag); + } + + bool isSelectable () + { + return invokeObjcSelf!(bool, "isSelectable"); + } + + void setSelectable (bool flag) + { + return invokeObjcSelf!(void, "setSelectable:", bool)(flag); + } + + bool isRichText () + { + return invokeObjcSelf!(bool, "isRichText"); + } + + void setRichText (bool flag) + { + return invokeObjcSelf!(void, "setRichText:", bool)(flag); + } + + bool importsGraphics () + { + return invokeObjcSelf!(bool, "importsGraphics"); + } + + void setImportsGraphics (bool flag) + { + return invokeObjcSelf!(void, "setImportsGraphics:", bool)(flag); + } + + bool isFieldEditor () + { + return invokeObjcSelf!(bool, "isFieldEditor"); + } + + void setFieldEditor (bool flag) + { + return invokeObjcSelf!(void, "setFieldEditor:", bool)(flag); + } + + bool usesFontPanel () + { + return invokeObjcSelf!(bool, "usesFontPanel"); + } + + void setUsesFontPanel (bool flag) + { + return invokeObjcSelf!(void, "setUsesFontPanel:", bool)(flag); + } + + bool drawsBackground () + { + return invokeObjcSelf!(bool, "drawsBackground"); + } + + void setDrawsBackground (bool flag) + { + return invokeObjcSelf!(void, "setDrawsBackground:", bool)(flag); + } + + NSColor backgroundColor () + { + return invokeObjcSelf!(NSColor, "backgroundColor"); + } + + void setBackgroundColor (NSColor color) + { + return invokeObjcSelf!(void, "setBackgroundColor:", NSColor)(color); + } + + bool isRulerVisible () + { + return invokeObjcSelf!(bool, "isRulerVisible"); + } + + NSRange selectedRange () + { + return invokeObjcSelf!(NSRange, "selectedRange"); + } + + void setSelectedRange (NSRange range) + { + return invokeObjcSelf!(void, "setSelectedRange:", NSRange)(range); + } + + void scrollRangeToVisible (NSRange range) + { + return invokeObjcSelf!(void, "scrollRangeToVisible:", NSRange)(range); + } + + void setFont (NSFont obj) + { + return invokeObjcSelf!(void, "setFont:", NSFont)(obj); + } + + NSFont font () + { + return invokeObjcSelf!(NSFont, "font"); + } + + void setTextColor (NSColor color) + { + return invokeObjcSelf!(void, "setTextColor:", NSColor)(color); + } + + NSColor textColor () + { + return invokeObjcSelf!(NSColor, "textColor"); + } + + uint alignment () + { + return invokeObjcSelf!(uint, "alignment"); + } + + void setAlignment (uint mode) + { + return invokeObjcSelf!(void, "setAlignment:", uint)(mode); + } + + int baseWritingDirection () + { + return invokeObjcSelf!(int, "baseWritingDirection"); + } + + void setBaseWritingDirection (int writingDirection) + { + return invokeObjcSelf!(void, "setBaseWritingDirection:", int)(writingDirection); + } + + void setTextColor (NSColor color, NSRange range) + { + return invokeObjcSelf!(void, "setTextColor:range:", NSColor, NSRange)(color, range); + } + + void setFont (NSFont font, NSRange range) + { + return invokeObjcSelf!(void, "setFont:range:", NSFont, NSRange)(font, range); + } + + NSSize maxSize () + { + return invokeObjcSelf!(NSSize, "maxSize"); + } + + void setMaxSize (NSSize newMaxSize) + { + return invokeObjcSelf!(void, "setMaxSize:", NSSize)(newMaxSize); + } + + NSSize minSize () + { + return invokeObjcSelf!(NSSize, "minSize"); + } + + void setMinSize (NSSize newMinSize) + { + return invokeObjcSelf!(void, "setMinSize:", NSSize)(newMinSize); + } + + bool isHorizontallyResizable () + { + return invokeObjcSelf!(bool, "isHorizontallyResizable"); + } + + void setHorizontallyResizable (bool flag) + { + return invokeObjcSelf!(void, "setHorizontallyResizable:", bool)(flag); + } + + bool isVerticallyResizable () + { + return invokeObjcSelf!(bool, "isVerticallyResizable"); + } + + void setVerticallyResizable (bool flag) + { + return invokeObjcSelf!(void, "setVerticallyResizable:", bool)(flag); + } + + void sizeToFit () + { + return invokeObjcSelf!(void, "sizeToFit"); + } + + void copy (Object sender) + { + return invokeObjcSelf!(void, "copy:", Object)(sender); + } + + void copyFont (Object sender) + { + return invokeObjcSelf!(void, "copyFont:", Object)(sender); + } + + void copyRuler (Object sender) + { + return invokeObjcSelf!(void, "copyRuler:", Object)(sender); + } + + void cut (Object sender) + { + return invokeObjcSelf!(void, "cut:", Object)(sender); + } + + void delete_ (Object sender) + { + return invokeObjcSelf!(void, "delete:", Object)(sender); + } + + void paste (Object sender) + { + return invokeObjcSelf!(void, "paste:", Object)(sender); + } + + void pasteFont (Object sender) + { + return invokeObjcSelf!(void, "pasteFont:", Object)(sender); + } + + void pasteRuler (Object sender) + { + return invokeObjcSelf!(void, "pasteRuler:", Object)(sender); + } + + void selectAll (Object sender) + { + return invokeObjcSelf!(void, "selectAll:", Object)(sender); + } + + void changeFont (Object sender) + { + return invokeObjcSelf!(void, "changeFont:", Object)(sender); + } + + void alignLeft (Object sender) + { + return invokeObjcSelf!(void, "alignLeft:", Object)(sender); + } + + void alignRight (Object sender) + { + return invokeObjcSelf!(void, "alignRight:", Object)(sender); + } + + void alignCenter (Object sender) + { + return invokeObjcSelf!(void, "alignCenter:", Object)(sender); + } + + void subscript (Object sender) + { + return invokeObjcSelf!(void, "subscript:", Object)(sender); + } + + void superscript (Object sender) + { + return invokeObjcSelf!(void, "superscript:", Object)(sender); + } + + void underline (Object sender) + { + return invokeObjcSelf!(void, "underline:", Object)(sender); + } + + void unscript (Object sender) + { + return invokeObjcSelf!(void, "unscript:", Object)(sender); + } + + void showGuessPanel (Object sender) + { + return invokeObjcSelf!(void, "showGuessPanel:", Object)(sender); + } + + void checkSpelling (Object sender) + { + return invokeObjcSelf!(void, "checkSpelling:", Object)(sender); + } + + void toggleRuler (Object sender) + { + return invokeObjcSelf!(void, "toggleRuler:", Object)(sender); + } + + void changeSpelling (Object sender) + { + return invokeObjcSelf!(void, "changeSpelling:", Object)(sender); + } + + void ignoreSpelling (Object sender) + { + return invokeObjcSelf!(void, "ignoreSpelling:", Object)(sender); + } +} + +const TNSTextDelegate = ` + + bool textShouldBeginEditing (NSText textObject) + { + return invokeObjcSelf!(bool, "textShouldBeginEditing:", NSText)(textObject); + } + + bool textShouldEndEditing (NSText textObject) + { + return invokeObjcSelf!(bool, "textShouldEndEditing:", NSText)(textObject); + } + + void textDidBeginEditing (NSNotification notification) + { + return invokeObjcSelf!(void, "textDidBeginEditing:", NSNotification)(notification); + } + + void textDidEndEditing (NSNotification notification) + { + return invokeObjcSelf!(void, "textDidEndEditing:", NSNotification)(notification); + } + + void textDidChange (NSNotification notification) + { + return invokeObjcSelf!(void, "textDidChange:", NSNotification)(notification); + } + + //mixin ObjcBindMethod!(textShouldBeginEditing, "textShouldBeginEditing:"); + //mixin ObjcBindMethod!(textShouldEndEditing, "textShouldEndEditing:"); + //mixin ObjcBindMethod!(textDidBeginEditing, "textDidBeginEditing:"); + //mixin ObjcBindMethod!(textDidEndEditing, "textDidEndEditing:"); + //mixin ObjcBindMethod!(textDidChange, "textDidChange:"); + +`; + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSTextAttachment.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSTextAttachment.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,118 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSTextAttachment; + +import dstep.appkit.NSAttributedString; +import dstep.appkit.NSCell; +import dstep.appkit.NSEvent; +import dstep.appkit.NSFileWrapper; +import dstep.appkit.NSLayoutManager; +import dstep.appkit.NSTextContainer; +import dstep.appkit.NSView; +import dstep.foundation.NSCoder; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +enum +{ + NSAttachmentCharacter = 0xfffc +} + +class NSTextAttachment : NSObject, INSCoding +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + NSTextAttachment initWithFileWrapper (NSFileWrapper fileWrapper) + { + id result = invokeObjcSelf!(id, "initWithFileWrapper:", NSFileWrapper)(fileWrapper); + return result is this.objcObject ? this : (result !is null ? new NSTextAttachment(result) : null); + } + + this (NSFileWrapper fileWrapper) + { + super(NSTextAttachment.alloc.initWithFileWrapper(fileWrapper).objcObject); + } + + void setFileWrapper (NSFileWrapper fileWrapper) + { + return invokeObjcSelf!(void, "setFileWrapper:", NSFileWrapper)(fileWrapper); + } + + NSFileWrapper fileWrapper () + { + return invokeObjcSelf!(NSFileWrapper, "fileWrapper"); + } + + INSTextAttachmentCell attachmentCell () + { + return invokeObjcSelf!(INSTextAttachmentCell, "attachmentCell"); + } + + void setAttachmentCell (INSTextAttachmentCell cell) + { + return invokeObjcSelf!(void, "setAttachmentCell:", INSTextAttachmentCell)(cell); + } + +} + +interface INSTextAttachmentCell : INSObject +{ + void drawWithFrame (NSRect cellFrame, NSView controlView); + bool wantsToTrackMouse (); + void highlight (bool flag, NSRect cellFrame, NSView controlView); + bool trackMouse (NSEvent theEvent, NSRect cellFrame, NSView controlView, bool flag); + NSSize cellSize (); + NSPoint cellBaselineOffset (); + void setAttachment (NSTextAttachment anObject); + NSTextAttachment attachment (); + void drawWithFrame (NSRect cellFrame, NSView controlView, NSUInteger charIndex); + void drawWithFrame (NSRect cellFrame, NSView controlView, NSUInteger charIndex, NSLayoutManager layoutManager); + bool wantsToTrackMouseForEvent (NSEvent theEvent, NSRect cellFrame, NSView controlView, NSUInteger charIndex); + bool trackMouse (NSEvent theEvent, NSRect cellFrame, NSView controlView, NSUInteger charIndex, bool flag); + NSRect cellFrameForTextContainer (NSTextContainer textContainer, NSRect lineFrag, NSPoint position, NSUInteger charIndex); +} + +const TNSMutableAttributedStringAttachmentConveniences = ` + + void updateAttachmentsFromPath (NSString path) + { + return invokeObjcSelf!(void, "updateAttachmentsFromPath:", NSString)(path); + } + + //mixin ObjcBindMethod!(updateAttachmentsFromPath, "updateAttachmentsFromPath:"); + +`; + +const TNSAttributedStringAttachmentConveniences = ` + + static NSAttributedString attributedStringWithAttachment (NSTextAttachment attachment) + { + return invokeObjcSelfClass!(NSAttributedString, "attributedStringWithAttachment:", NSTextAttachment)(attachment); + } + + //mixin ObjcBindClassMethod!(attributedStringWithAttachment, "attributedStringWithAttachment:"); + +`; + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSTextContainer.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSTextContainer.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,156 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSTextContainer; + +import dstep.appkit.NSLayoutManager; +import dstep.appkit.NSTextView; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSCoder; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +typedef NSUInteger NSLineSweepDirection; +typedef NSUInteger NSLineMovementDirection; + +enum : NSUInteger +{ + NSLineSweepLeft = 0, + NSLineSweepRight = 1, + NSLineSweepDown = 2, + NSLineSweepUp = 3 +} + +enum : NSUInteger +{ + NSLineDoesntMove = 0, + NSLineMovesLeft = 1, + NSLineMovesRight = 2, + NSLineMovesDown = 3, + NSLineMovesUp = 4 +} + +class NSTextContainer : NSObject, INSCoding +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + typeof(this) copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); + } + + NSTextContainer initWithContainerSize (NSSize size) + { + id result = invokeObjcSelf!(id, "initWithContainerSize:", NSSize)(size); + return result is this.objcObject ? this : (result !is null ? new NSTextContainer(result) : null); + } + + this (NSSize size) + { + super(NSTextContainer.alloc.initWithContainerSize(size).objcObject); + } + + NSLayoutManager layoutManager () + { + return invokeObjcSelf!(NSLayoutManager, "layoutManager"); + } + + void setLayoutManager (NSLayoutManager layoutManager) + { + return invokeObjcSelf!(void, "setLayoutManager:", NSLayoutManager)(layoutManager); + } + + void replaceLayoutManager (NSLayoutManager newLayoutManager) + { + return invokeObjcSelf!(void, "replaceLayoutManager:", NSLayoutManager)(newLayoutManager); + } + + NSTextView textView () + { + return invokeObjcSelf!(NSTextView, "textView"); + } + + void setTextView (NSTextView textView) + { + return invokeObjcSelf!(void, "setTextView:", NSTextView)(textView); + } + + void setWidthTracksTextView (bool flag) + { + return invokeObjcSelf!(void, "setWidthTracksTextView:", bool)(flag); + } + + bool widthTracksTextView () + { + return invokeObjcSelf!(bool, "widthTracksTextView"); + } + + void setHeightTracksTextView (bool flag) + { + return invokeObjcSelf!(void, "setHeightTracksTextView:", bool)(flag); + } + + bool heightTracksTextView () + { + return invokeObjcSelf!(bool, "heightTracksTextView"); + } + + void setContainerSize (NSSize size) + { + return invokeObjcSelf!(void, "setContainerSize:", NSSize)(size); + } + + NSSize containerSize () + { + return invokeObjcSelf!(NSSize, "containerSize"); + } + + void setLineFragmentPadding (CGFloat pad) + { + return invokeObjcSelf!(void, "setLineFragmentPadding:", CGFloat)(pad); + } + + CGFloat lineFragmentPadding () + { + return invokeObjcSelf!(CGFloat, "lineFragmentPadding"); + } + + NSRect lineFragmentRectForProposedRect (NSRect proposedRect, uint sweepDirection, uint movementDirection, NSRectPointer remainingRect) + { + return invokeObjcSelf!(NSRect, "lineFragmentRectForProposedRect:sweepDirection:movementDirection:remainingRect:", NSRect, uint, uint, NSRectPointer)(proposedRect, sweepDirection, movementDirection, remainingRect); + } + + bool isSimpleRectangularTextContainer () + { + return invokeObjcSelf!(bool, "isSimpleRectangularTextContainer"); + } + + bool containsPoint (NSPoint point) + { + return invokeObjcSelf!(bool, "containsPoint:", NSPoint)(point); + } + +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSTextField.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSTextField.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,201 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSTextField; + +import dstep.appkit.NSColor; +import dstep.appkit.NSControl; +import dstep.appkit.NSText; +import dstep.appkit.NSTextFieldCell; +import dstep.appkit.NSUserInterfaceValidation; +import dstep.foundation.NSNotification; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +const TNSTextFieldAttributedStringMethods = ` + + bool allowsEditingTextAttributes () + { + return invokeObjcSelf!(bool, "allowsEditingTextAttributes"); + } + + void setAllowsEditingTextAttributes (bool flag) + { + return invokeObjcSelf!(void, "setAllowsEditingTextAttributes:", bool)(flag); + } + + bool importsGraphics () + { + return invokeObjcSelf!(bool, "importsGraphics"); + } + + void setImportsGraphics (bool flag) + { + return invokeObjcSelf!(void, "setImportsGraphics:", bool)(flag); + } + + //mixin ObjcBindMethod!(allowsEditingTextAttributes, "allowsEditingTextAttributes"); + //mixin ObjcBindMethod!(setAllowsEditingTextAttributes, "setAllowsEditingTextAttributes:"); + //mixin ObjcBindMethod!(importsGraphics, "importsGraphics"); + //mixin ObjcBindMethod!(setImportsGraphics, "setImportsGraphics:"); + +`; + +class NSTextField : NSControl, INSUserInterfaceValidations +{ + mixin (ObjcWrap); + + void setBackgroundColor (NSColor color) + { + return invokeObjcSelf!(void, "setBackgroundColor:", NSColor)(color); + } + + NSColor backgroundColor () + { + return invokeObjcSelf!(NSColor, "backgroundColor"); + } + + void setDrawsBackground (bool flag) + { + return invokeObjcSelf!(void, "setDrawsBackground:", bool)(flag); + } + + bool drawsBackground () + { + return invokeObjcSelf!(bool, "drawsBackground"); + } + + void setTextColor (NSColor color) + { + return invokeObjcSelf!(void, "setTextColor:", NSColor)(color); + } + + NSColor textColor () + { + return invokeObjcSelf!(NSColor, "textColor"); + } + + bool isBordered () + { + return invokeObjcSelf!(bool, "isBordered"); + } + + void setBordered (bool flag) + { + return invokeObjcSelf!(void, "setBordered:", bool)(flag); + } + + bool isBezeled () + { + return invokeObjcSelf!(bool, "isBezeled"); + } + + void setBezeled (bool flag) + { + return invokeObjcSelf!(void, "setBezeled:", bool)(flag); + } + + bool isEditable () + { + return invokeObjcSelf!(bool, "isEditable"); + } + + void setEditable (bool flag) + { + return invokeObjcSelf!(void, "setEditable:", bool)(flag); + } + + bool isSelectable () + { + return invokeObjcSelf!(bool, "isSelectable"); + } + + void setSelectable (bool flag) + { + return invokeObjcSelf!(void, "setSelectable:", bool)(flag); + } + + void selectText (Object sender) + { + return invokeObjcSelf!(void, "selectText:", Object)(sender); + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + void setDelegate (Object anObject) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(anObject); + } + + bool textShouldBeginEditing (NSText textObject) + { + return invokeObjcSelf!(bool, "textShouldBeginEditing:", NSText)(textObject); + } + + bool textShouldEndEditing (NSText textObject) + { + return invokeObjcSelf!(bool, "textShouldEndEditing:", NSText)(textObject); + } + + void textDidBeginEditing (NSNotification notification) + { + return invokeObjcSelf!(void, "textDidBeginEditing:", NSNotification)(notification); + } + + void textDidEndEditing (NSNotification notification) + { + return invokeObjcSelf!(void, "textDidEndEditing:", NSNotification)(notification); + } + + void textDidChange (NSNotification notification) + { + return invokeObjcSelf!(void, "textDidChange:", NSNotification)(notification); + } + + bool acceptsFirstResponder () + { + return invokeObjcSelf!(bool, "acceptsFirstResponder"); + } + + void setBezelStyle (uint style) + { + return invokeObjcSelf!(void, "setBezelStyle:", uint)(style); + } + + uint bezelStyle () + { + return invokeObjcSelf!(uint, "bezelStyle"); + } + + bool validateUserInterfaceItem (INSValidatedUserInterfaceItem anItem) + { + return invokeObjcSelf!(bool, "validateUserInterfaceItem:", INSValidatedUserInterfaceItem)(anItem); + } + + // NSTextFieldAttributedStringMethods + bool allowsEditingTextAttributes () + { + return invokeObjcSelf!(bool, "allowsEditingTextAttributes"); + } + + void setAllowsEditingTextAttributes (bool flag) + { + return invokeObjcSelf!(void, "setAllowsEditingTextAttributes:", bool)(flag); + } + + bool importsGraphics () + { + return invokeObjcSelf!(bool, "importsGraphics"); + } + + void setImportsGraphics (bool flag) + { + return invokeObjcSelf!(void, "setImportsGraphics:", bool)(flag); + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSTextFieldCell.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSTextFieldCell.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,111 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSTextFieldCell; + +import dstep.appkit.NSActionCell; +import dstep.appkit.NSColor; +import dstep.appkit.NSText; +import dstep.foundation.NSArray; +import dstep.foundation.NSAttributedString; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +typedef NSUInteger NSTextFieldBezelStyle; + +enum +{ + NSTextFieldSquareBezel = 0, + NSTextFieldRoundedBezel = 1 +} + +class NSTextFieldCell : NSActionCell +{ + mixin (ObjcWrap); + + void setBackgroundColor (NSColor color) + { + return invokeObjcSelf!(void, "setBackgroundColor:", NSColor)(color); + } + + NSColor backgroundColor () + { + return invokeObjcSelf!(NSColor, "backgroundColor"); + } + + void setDrawsBackground (bool flag) + { + return invokeObjcSelf!(void, "setDrawsBackground:", bool)(flag); + } + + bool drawsBackground () + { + return invokeObjcSelf!(bool, "drawsBackground"); + } + + void setTextColor (NSColor color) + { + return invokeObjcSelf!(void, "setTextColor:", NSColor)(color); + } + + NSColor textColor () + { + return invokeObjcSelf!(NSColor, "textColor"); + } + + NSText setUpFieldEditorAttributes (NSText textObj) + { + return invokeObjcSelf!(NSText, "setUpFieldEditorAttributes:", NSText)(textObj); + } + + void setBezelStyle (uint style) + { + return invokeObjcSelf!(void, "setBezelStyle:", uint)(style); + } + + uint bezelStyle () + { + return invokeObjcSelf!(uint, "bezelStyle"); + } + + void setPlaceholderString (NSString string) + { + return invokeObjcSelf!(void, "setPlaceholderString:", NSString)(string); + } + + NSString placeholderString () + { + return invokeObjcSelf!(NSString, "placeholderString"); + } + + void setPlaceholderAttributedString (NSAttributedString string) + { + return invokeObjcSelf!(void, "setPlaceholderAttributedString:", NSAttributedString)(string); + } + + NSAttributedString placeholderAttributedString () + { + return invokeObjcSelf!(NSAttributedString, "placeholderAttributedString"); + } + + void setWantsNotificationForMarkedText (bool flag) + { + return invokeObjcSelf!(void, "setWantsNotificationForMarkedText:", bool)(flag); + } + + NSArray allowedInputSourceLocales () + { + return invokeObjcSelf!(NSArray, "allowedInputSourceLocales"); + } + + void setAllowedInputSourceLocales (NSArray localeIdentifiers) + { + return invokeObjcSelf!(void, "setAllowedInputSourceLocales:", NSArray)(localeIdentifiers); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSTextInputClient.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSTextInputClient.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,37 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSTextInputClient; + +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSArray; +import dstep.foundation.NSAttributedString; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSRange; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +interface INSTextInputClient +{ + void insertText (Object aString, NSRange replacementRange); + void doCommandBySelector (SEL aSelector); + void setMarkedText (Object aString, NSRange selectedRange, NSRange replacementRange); + void unmarkText (); + NSRange selectedRange (); + NSRange markedRange (); + bool hasMarkedText (); + NSAttributedString attributedSubstringForProposedRange (NSRange aRange, NSRangePointer actualRange); + NSArray validAttributesForMarkedText (); + NSRect firstRectForCharacterRange (NSRange aRange, NSRangePointer actualRange); + NSUInteger characterIndexForPoint (NSPoint aPoint); + NSAttributedString attributedString (); + CGFloat fractionOfDistanceThroughGlyphForPoint (NSPoint aPoint); + CGFloat baselineDeltaForCharacterAtIndex (NSUInteger anIndex); + NSInteger windowLevel (); +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSTextList.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSTextList.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,73 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSTextList; + +import dstep.foundation.NSCoder; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +enum +{ + NSTextListPrependEnclosingMarker = (1 << 0) +} + +class NSTextList : NSObject, INSCoding, INSCopying +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + typeof(this) copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); + } + + NSTextList initWithMarkerFormat (NSString format, NSUInteger mask) + { + id result = invokeObjcSelf!(id, "initWithMarkerFormat:options:", NSString, NSUInteger)(format, mask); + return result is this.objcObject ? this : (result !is null ? new NSTextList(result) : null); + } + + this (NSString format, NSUInteger mask) + { + super(NSTextList.alloc.initWithMarkerFormat(format, mask).objcObject); + } + + NSString markerFormat () + { + return invokeObjcSelf!(NSString, "markerFormat"); + } + + NSUInteger listOptions () + { + return invokeObjcSelf!(NSUInteger, "listOptions"); + } + + NSString markerForItemNumber (NSInteger itemNum) + { + return invokeObjcSelf!(NSString, "markerForItemNumber:", NSInteger)(itemNum); + } + +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSTextStorage.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSTextStorage.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,199 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSTextStorage; + +import dstep.appkit.NSAttributedString; +import dstep.appkit.NSColor; +import dstep.appkit.NSFont; +import dstep.appkit.NSLayoutManager; +import dstep.appkit.NSTextStorageScripting; +import dstep.foundation.NSArray; +import dstep.foundation.NSAttributedString; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSRange; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.appkit.NSTextStorage_bindings; + +private +{ + NSString NSTextStorageWillProcessEditingNotification_; + NSString NSTextStorageDidProcessEditingNotification_; +} + +NSString NSTextStorageWillProcessEditingNotification () +{ + if (NSTextStorageWillProcessEditingNotification_) + return NSTextStorageWillProcessEditingNotification_; + + return NSTextStorageWillProcessEditingNotification_ = new NSString(bindings.NSTextStorageWillProcessEditingNotification); +} + +NSString NSTextStorageDidProcessEditingNotification () +{ + if (NSTextStorageDidProcessEditingNotification_) + return NSTextStorageDidProcessEditingNotification_; + + return NSTextStorageDidProcessEditingNotification_ = new NSString(bindings.NSTextStorageDidProcessEditingNotification); +} + +enum +{ + NSTextStorageEditedAttributes = 1, + NSTextStorageEditedCharacters = 2 +} + +const TNSTextStorageDelegate = ` + + void textStorageWillProcessEditing (NSNotification notification) + { + return invokeObjcSelf!(void, "textStorageWillProcessEditing:", NSNotification)(notification); + } + + void textStorageDidProcessEditing (NSNotification notification) + { + return invokeObjcSelf!(void, "textStorageDidProcessEditing:", NSNotification)(notification); + } + + //mixin ObjcBindMethod!(textStorageWillProcessEditing, "textStorageWillProcessEditing:"); + //mixin ObjcBindMethod!(textStorageDidProcessEditing, "textStorageDidProcessEditing:"); + +`; + +class NSTextStorage : NSMutableAttributedString +{ + mixin (ObjcWrap); + + void addLayoutManager (NSLayoutManager obj) + { + return invokeObjcSelf!(void, "addLayoutManager:", NSLayoutManager)(obj); + } + + void removeLayoutManager (NSLayoutManager obj) + { + return invokeObjcSelf!(void, "removeLayoutManager:", NSLayoutManager)(obj); + } + + NSArray layoutManagers () + { + return invokeObjcSelf!(NSArray, "layoutManagers"); + } + + void edited (NSUInteger editedMask, NSRange range, NSInteger delta) + { + return invokeObjcSelf!(void, "edited:range:changeInLength:", NSUInteger, NSRange, NSInteger)(editedMask, range, delta); + } + + void processEditing () + { + return invokeObjcSelf!(void, "processEditing"); + } + + void invalidateAttributesInRange (NSRange range) + { + return invokeObjcSelf!(void, "invalidateAttributesInRange:", NSRange)(range); + } + + void ensureAttributesAreFixedInRange (NSRange range) + { + return invokeObjcSelf!(void, "ensureAttributesAreFixedInRange:", NSRange)(range); + } + + bool fixesAttributesLazily () + { + return invokeObjcSelf!(bool, "fixesAttributesLazily"); + } + + NSUInteger editedMask () + { + return invokeObjcSelf!(NSUInteger, "editedMask"); + } + + NSRange editedRange () + { + return invokeObjcSelf!(NSRange, "editedRange"); + } + + NSInteger changeInLength () + { + return invokeObjcSelf!(NSInteger, "changeInLength"); + } + + void setDelegate (Object delegate_) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(delegate_); + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + // Scripting + NSArray attributeRuns () + { + return invokeObjcSelf!(NSArray, "attributeRuns"); + } + + void setAttributeRuns (NSArray attributeRuns) + { + return invokeObjcSelf!(void, "setAttributeRuns:", NSArray)(attributeRuns); + } + + NSArray paragraphs () + { + return invokeObjcSelf!(NSArray, "paragraphs"); + } + + void setParagraphs (NSArray paragraphs) + { + return invokeObjcSelf!(void, "setParagraphs:", NSArray)(paragraphs); + } + + NSArray words () + { + return invokeObjcSelf!(NSArray, "words"); + } + + void setWords (NSArray words) + { + return invokeObjcSelf!(void, "setWords:", NSArray)(words); + } + + NSArray characters () + { + return invokeObjcSelf!(NSArray, "characters"); + } + + void setCharacters (NSArray characters) + { + return invokeObjcSelf!(void, "setCharacters:", NSArray)(characters); + } + + NSFont font () + { + return invokeObjcSelf!(NSFont, "font"); + } + + void setFont (NSFont font) + { + return invokeObjcSelf!(void, "setFont:", NSFont)(font); + } + + NSColor foregroundColor () + { + return invokeObjcSelf!(NSColor, "foregroundColor"); + } + + void setForegroundColor (NSColor color) + { + return invokeObjcSelf!(void, "setForegroundColor:", NSColor)(color); + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSTextStorageScripting.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSTextStorageScripting.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,89 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSTextStorageScripting; + +import dstep.appkit.NSTextStorage; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +const TScripting = ` + + NSArray attributeRuns () + { + return invokeObjcSelf!(NSArray, "attributeRuns"); + } + + void setAttributeRuns (NSArray attributeRuns) + { + return invokeObjcSelf!(void, "setAttributeRuns:", NSArray)(attributeRuns); + } + + NSArray paragraphs () + { + return invokeObjcSelf!(NSArray, "paragraphs"); + } + + void setParagraphs (NSArray paragraphs) + { + return invokeObjcSelf!(void, "setParagraphs:", NSArray)(paragraphs); + } + + NSArray words () + { + return invokeObjcSelf!(NSArray, "words"); + } + + void setWords (NSArray words) + { + return invokeObjcSelf!(void, "setWords:", NSArray)(words); + } + + NSArray characters () + { + return invokeObjcSelf!(NSArray, "characters"); + } + + void setCharacters (NSArray characters) + { + return invokeObjcSelf!(void, "setCharacters:", NSArray)(characters); + } + + NSFont font () + { + return invokeObjcSelf!(NSFont, "font"); + } + + void setFont (NSFont font) + { + return invokeObjcSelf!(void, "setFont:", NSFont)(font); + } + + NSColor foregroundColor () + { + return invokeObjcSelf!(NSColor, "foregroundColor"); + } + + void setForegroundColor (NSColor color) + { + return invokeObjcSelf!(void, "setForegroundColor:", NSColor)(color); + } + + //mixin ObjcBindMethod!(attributeRuns, "attributeRuns"); + //mixin ObjcBindMethod!(setAttributeRuns, "setAttributeRuns:"); + //mixin ObjcBindMethod!(paragraphs, "paragraphs"); + //mixin ObjcBindMethod!(setParagraphs, "setParagraphs:"); + //mixin ObjcBindMethod!(words, "words"); + //mixin ObjcBindMethod!(setWords, "setWords:"); + //mixin ObjcBindMethod!(characters, "characters"); + //mixin ObjcBindMethod!(setCharacters, "setCharacters:"); + //mixin ObjcBindMethod!(font, "font"); + //mixin ObjcBindMethod!(setFont, "setFont:"); + //mixin ObjcBindMethod!(foregroundColor, "foregroundColor"); + //mixin ObjcBindMethod!(setForegroundColor, "setForegroundColor:"); + +`; + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSTextStorage_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSTextStorage_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,20 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSTextStorage_bindings; + + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package id NSTextStorageWillProcessEditingNotification; + package id NSTextStorageDidProcessEditingNotification; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSTextTable.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSTextTable.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,304 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSTextTable; + +import dstep.appkit.NSColor; +import dstep.appkit.NSLayoutManager; +import dstep.appkit.NSText; +import dstep.appkit.NSTextContainer; +import dstep.appkit.NSView; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSCoder; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSRange; +import dstep.foundation.NSZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +typedef NSUInteger NSTextBlockValueType; +typedef NSUInteger NSTextBlockDimension; +typedef NSInteger NSTextBlockLayer; +typedef NSUInteger NSTextBlockVerticalAlignment; +typedef NSUInteger NSTextTableLayoutAlgorithm; + +enum : NSUInteger +{ + NSTextBlockAbsoluteValueType = 0, + NSTextBlockPercentageValueType = 1 +} + +enum : NSUInteger +{ + NSTextBlockWidth = 0, + NSTextBlockMinimumWidth = 1, + NSTextBlockMaximumWidth = 2, + NSTextBlockHeight = 4, + NSTextBlockMinimumHeight = 5, + NSTextBlockMaximumHeight = 6 +} + +enum : NSInteger +{ + NSTextBlockPadding = -1, + NSTextBlockBorder = 0, + NSTextBlockMargin = 1 +} + +enum : NSUInteger +{ + NSTextBlockTopAlignment = 0, + NSTextBlockMiddleAlignment = 1, + NSTextBlockBottomAlignment = 2, + NSTextBlockBaselineAlignment = 3 +} + +enum : NSUInteger +{ + NSTextTableAutomaticLayoutAlgorithm = 0, + NSTextTableFixedLayoutAlgorithm = 1 +} + +class NSTextTable : NSTextBlock +{ + mixin (ObjcWrap); + + NSUInteger numberOfColumns () + { + return invokeObjcSelf!(NSUInteger, "numberOfColumns"); + } + + void setNumberOfColumns (NSUInteger numCols) + { + return invokeObjcSelf!(void, "setNumberOfColumns:", NSUInteger)(numCols); + } + + uint layoutAlgorithm () + { + return invokeObjcSelf!(uint, "layoutAlgorithm"); + } + + void setLayoutAlgorithm (uint algorithm) + { + return invokeObjcSelf!(void, "setLayoutAlgorithm:", uint)(algorithm); + } + + bool collapsesBorders () + { + return invokeObjcSelf!(bool, "collapsesBorders"); + } + + void setCollapsesBorders (bool flag) + { + return invokeObjcSelf!(void, "setCollapsesBorders:", bool)(flag); + } + + bool hidesEmptyCells () + { + return invokeObjcSelf!(bool, "hidesEmptyCells"); + } + + void setHidesEmptyCells (bool flag) + { + return invokeObjcSelf!(void, "setHidesEmptyCells:", bool)(flag); + } + + NSRect rectForBlock (NSTextTableBlock block, NSPoint startingPoint, NSRect rect, NSTextContainer textContainer, NSRange charRange) + { + return invokeObjcSelf!(NSRect, "rectForBlock:layoutAtPoint:inRect:textContainer:characterRange:", NSTextTableBlock, NSPoint, NSRect, NSTextContainer, NSRange)(block, startingPoint, rect, textContainer, charRange); + } + + NSRect boundsRectForBlock (NSTextTableBlock block, NSRect contentRect, NSRect rect, NSTextContainer textContainer, NSRange charRange) + { + return invokeObjcSelf!(NSRect, "boundsRectForBlock:contentRect:inRect:textContainer:characterRange:", NSTextTableBlock, NSRect, NSRect, NSTextContainer, NSRange)(block, contentRect, rect, textContainer, charRange); + } + + void drawBackgroundForBlock (NSTextTableBlock block, NSRect frameRect, NSView controlView, NSRange charRange, NSLayoutManager layoutManager) + { + return invokeObjcSelf!(void, "drawBackgroundForBlock:withFrame:inView:characterRange:layoutManager:", NSTextTableBlock, NSRect, NSView, NSRange, NSLayoutManager)(block, frameRect, controlView, charRange, layoutManager); + } +} + +class NSTextBlock : NSObject, INSCoding, INSCopying +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + typeof(this) copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); + } + + NSTextBlock init () + { + id result = invokeObjcSelf!(id, "init"); + return result is this.objcObject ? this : (result !is null ? new NSTextBlock(result) : null); + } + + this () + { + super(NSTextBlock.alloc.init.objcObject); + } + + void setValue (CGFloat val, uint type, uint dimension) + { + return invokeObjcSelf!(void, "setValue:type:forDimension:", CGFloat, uint, uint)(val, type, dimension); + } + + CGFloat valueForDimension (uint dimension) + { + return invokeObjcSelf!(CGFloat, "valueForDimension:", uint)(dimension); + } + + uint valueTypeForDimension (uint dimension) + { + return invokeObjcSelf!(uint, "valueTypeForDimension:", uint)(dimension); + } + + void setContentWidth (CGFloat val, uint type) + { + return invokeObjcSelf!(void, "setContentWidth:type:", CGFloat, uint)(val, type); + } + + CGFloat contentWidth () + { + return invokeObjcSelf!(CGFloat, "contentWidth"); + } + + uint contentWidthValueType () + { + return invokeObjcSelf!(uint, "contentWidthValueType"); + } + + void setWidth (CGFloat val, uint type, int layer, int edge) + { + return invokeObjcSelf!(void, "setWidth:type:forLayer:edge:", CGFloat, uint, int, int)(val, type, layer, edge); + } + + void setWidth (CGFloat val, uint type, int layer) + { + return invokeObjcSelf!(void, "setWidth:type:forLayer:", CGFloat, uint, int)(val, type, layer); + } + + CGFloat widthForLayer (int layer, int edge) + { + return invokeObjcSelf!(CGFloat, "widthForLayer:edge:", int, int)(layer, edge); + } + + uint widthValueTypeForLayer (int layer, int edge) + { + return invokeObjcSelf!(uint, "widthValueTypeForLayer:edge:", int, int)(layer, edge); + } + + void setVerticalAlignment (uint alignment) + { + return invokeObjcSelf!(void, "setVerticalAlignment:", uint)(alignment); + } + + uint verticalAlignment () + { + return invokeObjcSelf!(uint, "verticalAlignment"); + } + + void setBackgroundColor (NSColor color) + { + return invokeObjcSelf!(void, "setBackgroundColor:", NSColor)(color); + } + + NSColor backgroundColor () + { + return invokeObjcSelf!(NSColor, "backgroundColor"); + } + + void setBorderColor (NSColor color, int edge) + { + return invokeObjcSelf!(void, "setBorderColor:forEdge:", NSColor, int)(color, edge); + } + + void setBorderColor (NSColor color) + { + return invokeObjcSelf!(void, "setBorderColor:", NSColor)(color); + } + + NSColor borderColorForEdge (int edge) + { + return invokeObjcSelf!(NSColor, "borderColorForEdge:", int)(edge); + } + + NSRect rectForLayoutAtPoint (NSPoint startingPoint, NSRect rect, NSTextContainer textContainer, NSRange charRange) + { + return invokeObjcSelf!(NSRect, "rectForLayoutAtPoint:inRect:textContainer:characterRange:", NSPoint, NSRect, NSTextContainer, NSRange)(startingPoint, rect, textContainer, charRange); + } + + NSRect boundsRectForContentRect (NSRect contentRect, NSRect rect, NSTextContainer textContainer, NSRange charRange) + { + return invokeObjcSelf!(NSRect, "boundsRectForContentRect:inRect:textContainer:characterRange:", NSRect, NSRect, NSTextContainer, NSRange)(contentRect, rect, textContainer, charRange); + } + + void drawBackgroundWithFrame (NSRect frameRect, NSView controlView, NSRange charRange, NSLayoutManager layoutManager) + { + return invokeObjcSelf!(void, "drawBackgroundWithFrame:inView:characterRange:layoutManager:", NSRect, NSView, NSRange, NSLayoutManager)(frameRect, controlView, charRange, layoutManager); + } + +} + +class NSTextTableBlock : NSTextBlock +{ + mixin (ObjcWrap); + + NSTextTableBlock initWithTable (NSTextTable table, NSInteger row, NSInteger rowSpan, NSInteger col, NSInteger colSpan) + { + id result = invokeObjcSelf!(id, "initWithTable:startingRow:rowSpan:startingColumn:columnSpan:", NSTextTable, NSInteger, NSInteger, NSInteger, NSInteger)(table, row, rowSpan, col, colSpan); + return result is this.objcObject ? this : (result !is null ? new NSTextTableBlock(result) : null); + } + + this (NSTextTable table, NSInteger row, NSInteger rowSpan, NSInteger col, NSInteger colSpan) + { + super(NSTextTableBlock.alloc.initWithTable(table, row, rowSpan, col, colSpan).objcObject); + } + + NSTextTable table () + { + return invokeObjcSelf!(NSTextTable, "table"); + } + + NSInteger startingRow () + { + return invokeObjcSelf!(NSInteger, "startingRow"); + } + + NSInteger rowSpan () + { + return invokeObjcSelf!(NSInteger, "rowSpan"); + } + + NSInteger startingColumn () + { + return invokeObjcSelf!(NSInteger, "startingColumn"); + } + + NSInteger columnSpan () + { + return invokeObjcSelf!(NSInteger, "columnSpan"); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSTextView.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSTextView.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,2032 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSTextView; + +import dstep.appkit.AppKitDefines; +import dstep.appkit.NSColor; +import dstep.appkit.NSDragging; +import dstep.appkit.NSEvent; +import dstep.appkit.NSImage; +import dstep.appkit.NSInputManager; +import dstep.appkit.NSLayoutManager; +import dstep.appkit.NSMenu; +import dstep.appkit.NSParagraphStyle; +import dstep.appkit.NSPasteboard; +import dstep.appkit.NSRulerMarker; +import dstep.appkit.NSRulerView; +import dstep.appkit.NSText; +import dstep.appkit.NSTextAttachment; +import dstep.appkit.NSTextContainer; +import dstep.appkit.NSTextInputClient; +import dstep.appkit.NSTextStorage; +import dstep.appkit.NSUserInterfaceValidation; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSArray; +import dstep.foundation.NSAttributedString; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSNotification; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSRange; +import dstep.foundation.NSUndoManager; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.appkit.NSTextView_bindings; + +typedef NSUInteger NSSelectionGranularity; +typedef NSUInteger NSSelectionAffinity; +typedef NSUInteger NSFindPanelAction; +typedef NSUInteger NSFindPanelSubstringMatchType; + +private +{ + NSString NSFindPanelSearchOptionsPboardType_; + NSString NSFindPanelCaseInsensitiveSearch_; + NSString NSFindPanelSubstringMatch_; + NSString NSAllRomanInputSourcesLocaleIdentifier_; + NSString NSTextViewWillChangeNotifyingTextViewNotification_; + NSString NSTextViewDidChangeSelectionNotification_; + NSString NSTextViewDidChangeTypingAttributesNotification_; +} + +NSString NSFindPanelSearchOptionsPboardType () +{ + if (NSFindPanelSearchOptionsPboardType_) + return NSFindPanelSearchOptionsPboardType_; + + return NSFindPanelSearchOptionsPboardType_ = new NSString(bindings.NSFindPanelSearchOptionsPboardType); +} + +NSString NSFindPanelCaseInsensitiveSearch () +{ + if (NSFindPanelCaseInsensitiveSearch_) + return NSFindPanelCaseInsensitiveSearch_; + + return NSFindPanelCaseInsensitiveSearch_ = new NSString(bindings.NSFindPanelCaseInsensitiveSearch); +} + +NSString NSFindPanelSubstringMatch () +{ + if (NSFindPanelSubstringMatch_) + return NSFindPanelSubstringMatch_; + + return NSFindPanelSubstringMatch_ = new NSString(bindings.NSFindPanelSubstringMatch); +} + +NSString NSAllRomanInputSourcesLocaleIdentifier () +{ + if (NSAllRomanInputSourcesLocaleIdentifier_) + return NSAllRomanInputSourcesLocaleIdentifier_; + + return NSAllRomanInputSourcesLocaleIdentifier_ = new NSString(bindings.NSAllRomanInputSourcesLocaleIdentifier); +} + +NSString NSTextViewWillChangeNotifyingTextViewNotification () +{ + if (NSTextViewWillChangeNotifyingTextViewNotification_) + return NSTextViewWillChangeNotifyingTextViewNotification_; + + return NSTextViewWillChangeNotifyingTextViewNotification_ = new NSString(bindings.NSTextViewWillChangeNotifyingTextViewNotification); +} + +NSString NSTextViewDidChangeSelectionNotification () +{ + if (NSTextViewDidChangeSelectionNotification_) + return NSTextViewDidChangeSelectionNotification_; + + return NSTextViewDidChangeSelectionNotification_ = new NSString(bindings.NSTextViewDidChangeSelectionNotification); +} + +NSString NSTextViewDidChangeTypingAttributesNotification () +{ + if (NSTextViewDidChangeTypingAttributesNotification_) + return NSTextViewDidChangeTypingAttributesNotification_; + + return NSTextViewDidChangeTypingAttributesNotification_ = new NSString(bindings.NSTextViewDidChangeTypingAttributesNotification); +} + +enum : NSUInteger +{ + NSSelectByCharacter = 0, + NSSelectByWord = 1, + NSSelectByParagraph = 2 +} + +enum : NSUInteger +{ + NSSelectionAffinityUpstream = 0, + NSSelectionAffinityDownstream = 1 +} + +enum : NSUInteger +{ + NSFindPanelActionShowFindPanel = 1, + NSFindPanelActionNext = 2, + NSFindPanelActionPrevious = 3, + NSFindPanelActionReplaceAll = 4, + NSFindPanelActionReplace = 5, + NSFindPanelActionReplaceAndFind = 6, + NSFindPanelActionSetFindString = 7, + NSFindPanelActionReplaceAllInSelection = 8, + NSFindPanelActionSelectAll = 9, + NSFindPanelActionSelectAllInSelection = 10 +} + +enum : NSUInteger +{ + NSFindPanelSubstringMatchTypeContains = 0, + NSFindPanelSubstringMatchTypeStartsWith = 1, + NSFindPanelSubstringMatchTypeFullWord = 2, + NSFindPanelSubstringMatchTypeEndsWith = 3 +} + +const TNSDragging = ` + + bool dragSelectionWithEvent (NSEvent event, NSSize mouseOffset, bool slideBack) + { + return invokeObjcSelf!(bool, "dragSelectionWithEvent:offset:slideBack:", NSEvent, NSSize, bool)(event, mouseOffset, slideBack); + } + + NSImage dragImageForSelectionWithEvent (NSEvent event, NSPointPointer origin) + { + return invokeObjcSelf!(NSImage, "dragImageForSelectionWithEvent:origin:", NSEvent, NSPointPointer)(event, origin); + } + + NSArray acceptableDragTypes () + { + return invokeObjcSelf!(NSArray, "acceptableDragTypes"); + } + + uint dragOperationForDraggingInfo (INSDraggingInfo dragInfo, NSString type) + { + return invokeObjcSelf!(uint, "dragOperationForDraggingInfo:type:", INSDraggingInfo, NSString)(dragInfo, type); + } + + void cleanUpAfterDragOperation () + { + return invokeObjcSelf!(void, "cleanUpAfterDragOperation"); + } + + //mixin ObjcBindMethod!(dragSelectionWithEvent, "dragSelectionWithEvent:offset:slideBack:"); + //mixin ObjcBindMethod!(dragImageForSelectionWithEvent, "dragImageForSelectionWithEvent:origin:"); + //mixin ObjcBindMethod!(acceptableDragTypes, "acceptableDragTypes"); + //mixin ObjcBindMethod!(dragOperationForDraggingInfo, "dragOperationForDraggingInfo:type:"); + //mixin ObjcBindMethod!(cleanUpAfterDragOperation, "cleanUpAfterDragOperation"); + +`; + +const TNSCompletion = ` + + void complete (Object sender) + { + return invokeObjcSelf!(void, "complete:", Object)(sender); + } + + NSRange rangeForUserCompletion () + { + return invokeObjcSelf!(NSRange, "rangeForUserCompletion"); + } + + NSArray completionsForPartialWordRange (NSRange charRange, NSInteger* index) + { + return invokeObjcSelf!(NSArray, "completionsForPartialWordRange:indexOfSelectedItem:", NSRange, NSInteger*)(charRange, index); + } + + void insertCompletion (NSString word, NSRange charRange, NSInteger movement, bool flag) + { + return invokeObjcSelf!(void, "insertCompletion:forPartialWordRange:movement:isFinal:", NSString, NSRange, NSInteger, bool)(word, charRange, movement, flag); + } + + //mixin ObjcBindMethod!(complete, "complete:"); + //mixin ObjcBindMethod!(rangeForUserCompletion, "rangeForUserCompletion"); + //mixin ObjcBindMethod!(completionsForPartialWordRange, "completionsForPartialWordRange:indexOfSelectedItem:"); + //mixin ObjcBindMethod!(insertCompletion, "insertCompletion:forPartialWordRange:movement:isFinal:"); + +`; + +const TNSSharing = ` + + NSArray selectedRanges () + { + return invokeObjcSelf!(NSArray, "selectedRanges"); + } + + void setSelectedRanges (NSArray ranges, uint affinity, bool stillSelectingFlag) + { + return invokeObjcSelf!(void, "setSelectedRanges:affinity:stillSelecting:", NSArray, uint, bool)(ranges, affinity, stillSelectingFlag); + } + + void setSelectedRanges (NSArray ranges) + { + return invokeObjcSelf!(void, "setSelectedRanges:", NSArray)(ranges); + } + + void setSelectedRange (NSRange charRange, uint affinity, bool stillSelectingFlag) + { + return invokeObjcSelf!(void, "setSelectedRange:affinity:stillSelecting:", NSRange, uint, bool)(charRange, affinity, stillSelectingFlag); + } + + uint selectionAffinity () + { + return invokeObjcSelf!(uint, "selectionAffinity"); + } + + uint selectionGranularity () + { + return invokeObjcSelf!(uint, "selectionGranularity"); + } + + void setSelectionGranularity (uint granularity) + { + return invokeObjcSelf!(void, "setSelectionGranularity:", uint)(granularity); + } + + void setSelectedTextAttributes (NSDictionary attributeDictionary) + { + return invokeObjcSelf!(void, "setSelectedTextAttributes:", NSDictionary)(attributeDictionary); + } + + NSDictionary selectedTextAttributes () + { + return invokeObjcSelf!(NSDictionary, "selectedTextAttributes"); + } + + void setInsertionPointColor (NSColor color) + { + return invokeObjcSelf!(void, "setInsertionPointColor:", NSColor)(color); + } + + NSColor insertionPointColor () + { + return invokeObjcSelf!(NSColor, "insertionPointColor"); + } + + void updateInsertionPointStateAndRestartTimer (bool restartFlag) + { + return invokeObjcSelf!(void, "updateInsertionPointStateAndRestartTimer:", bool)(restartFlag); + } + + void setMarkedTextAttributes (NSDictionary attributeDictionary) + { + return invokeObjcSelf!(void, "setMarkedTextAttributes:", NSDictionary)(attributeDictionary); + } + + NSDictionary markedTextAttributes () + { + return invokeObjcSelf!(NSDictionary, "markedTextAttributes"); + } + + void setLinkTextAttributes (NSDictionary attributeDictionary) + { + return invokeObjcSelf!(void, "setLinkTextAttributes:", NSDictionary)(attributeDictionary); + } + + NSDictionary linkTextAttributes () + { + return invokeObjcSelf!(NSDictionary, "linkTextAttributes"); + } + + bool displaysLinkToolTips () + { + return invokeObjcSelf!(bool, "displaysLinkToolTips"); + } + + void setDisplaysLinkToolTips (bool flag) + { + return invokeObjcSelf!(void, "setDisplaysLinkToolTips:", bool)(flag); + } + + bool acceptsGlyphInfo () + { + return invokeObjcSelf!(bool, "acceptsGlyphInfo"); + } + + void setAcceptsGlyphInfo (bool flag) + { + return invokeObjcSelf!(void, "setAcceptsGlyphInfo:", bool)(flag); + } + + void setRulerVisible (bool flag) + { + return invokeObjcSelf!(void, "setRulerVisible:", bool)(flag); + } + + bool usesRuler () + { + return invokeObjcSelf!(bool, "usesRuler"); + } + + void setUsesRuler (bool flag) + { + return invokeObjcSelf!(void, "setUsesRuler:", bool)(flag); + } + + void setContinuousSpellCheckingEnabled (bool flag) + { + return invokeObjcSelf!(void, "setContinuousSpellCheckingEnabled:", bool)(flag); + } + + bool isContinuousSpellCheckingEnabled () + { + return invokeObjcSelf!(bool, "isContinuousSpellCheckingEnabled"); + } + + void toggleContinuousSpellChecking (Object sender) + { + return invokeObjcSelf!(void, "toggleContinuousSpellChecking:", Object)(sender); + } + + NSInteger spellCheckerDocumentTag () + { + return invokeObjcSelf!(NSInteger, "spellCheckerDocumentTag"); + } + + void setGrammarCheckingEnabled (bool flag) + { + return invokeObjcSelf!(void, "setGrammarCheckingEnabled:", bool)(flag); + } + + bool isGrammarCheckingEnabled () + { + return invokeObjcSelf!(bool, "isGrammarCheckingEnabled"); + } + + void toggleGrammarChecking (Object sender) + { + return invokeObjcSelf!(void, "toggleGrammarChecking:", Object)(sender); + } + + void setSpellingState (NSInteger value, NSRange charRange) + { + return invokeObjcSelf!(void, "setSpellingState:range:", NSInteger, NSRange)(value, charRange); + } + + NSDictionary typingAttributes () + { + return invokeObjcSelf!(NSDictionary, "typingAttributes"); + } + + void setTypingAttributes (NSDictionary attrs) + { + return invokeObjcSelf!(void, "setTypingAttributes:", NSDictionary)(attrs); + } + + bool shouldChangeTextInRanges (NSArray affectedRanges, NSArray replacementStrings) + { + return invokeObjcSelf!(bool, "shouldChangeTextInRanges:replacementStrings:", NSArray, NSArray)(affectedRanges, replacementStrings); + } + + NSArray rangesForUserTextChange () + { + return invokeObjcSelf!(NSArray, "rangesForUserTextChange"); + } + + NSArray rangesForUserCharacterAttributeChange () + { + return invokeObjcSelf!(NSArray, "rangesForUserCharacterAttributeChange"); + } + + NSArray rangesForUserParagraphAttributeChange () + { + return invokeObjcSelf!(NSArray, "rangesForUserParagraphAttributeChange"); + } + + bool shouldChangeTextInRange (NSRange affectedCharRange, NSString replacementString) + { + return invokeObjcSelf!(bool, "shouldChangeTextInRange:replacementString:", NSRange, NSString)(affectedCharRange, replacementString); + } + + void didChangeText () + { + return invokeObjcSelf!(void, "didChangeText"); + } + + NSRange rangeForUserTextChange () + { + return invokeObjcSelf!(NSRange, "rangeForUserTextChange"); + } + + NSRange rangeForUserCharacterAttributeChange () + { + return invokeObjcSelf!(NSRange, "rangeForUserCharacterAttributeChange"); + } + + NSRange rangeForUserParagraphAttributeChange () + { + return invokeObjcSelf!(NSRange, "rangeForUserParagraphAttributeChange"); + } + + void setUsesFindPanel (bool flag) + { + return invokeObjcSelf!(void, "setUsesFindPanel:", bool)(flag); + } + + bool usesFindPanel () + { + return invokeObjcSelf!(bool, "usesFindPanel"); + } + + void setAllowsDocumentBackgroundColorChange (bool flag) + { + return invokeObjcSelf!(void, "setAllowsDocumentBackgroundColorChange:", bool)(flag); + } + + bool allowsDocumentBackgroundColorChange () + { + return invokeObjcSelf!(bool, "allowsDocumentBackgroundColorChange"); + } + + void setDefaultParagraphStyle (NSParagraphStyle paragraphStyle) + { + return invokeObjcSelf!(void, "setDefaultParagraphStyle:", NSParagraphStyle)(paragraphStyle); + } + + NSParagraphStyle defaultParagraphStyle () + { + return invokeObjcSelf!(NSParagraphStyle, "defaultParagraphStyle"); + } + + void setAllowsUndo (bool flag) + { + return invokeObjcSelf!(void, "setAllowsUndo:", bool)(flag); + } + + bool allowsUndo () + { + return invokeObjcSelf!(bool, "allowsUndo"); + } + + void breakUndoCoalescing () + { + return invokeObjcSelf!(void, "breakUndoCoalescing"); + } + + bool allowsImageEditing () + { + return invokeObjcSelf!(bool, "allowsImageEditing"); + } + + void setAllowsImageEditing (bool flag) + { + return invokeObjcSelf!(void, "setAllowsImageEditing:", bool)(flag); + } + + void showFindIndicatorForRange (NSRange charRange) + { + return invokeObjcSelf!(void, "showFindIndicatorForRange:", NSRange)(charRange); + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + void setDelegate (Object anObject) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(anObject); + } + + bool isEditable () + { + return invokeObjcSelf!(bool, "isEditable"); + } + + void setEditable (bool flag) + { + return invokeObjcSelf!(void, "setEditable:", bool)(flag); + } + + bool isSelectable () + { + return invokeObjcSelf!(bool, "isSelectable"); + } + + void setSelectable (bool flag) + { + return invokeObjcSelf!(void, "setSelectable:", bool)(flag); + } + + bool isRichText () + { + return invokeObjcSelf!(bool, "isRichText"); + } + + void setRichText (bool flag) + { + return invokeObjcSelf!(void, "setRichText:", bool)(flag); + } + + bool importsGraphics () + { + return invokeObjcSelf!(bool, "importsGraphics"); + } + + void setImportsGraphics (bool flag) + { + return invokeObjcSelf!(void, "setImportsGraphics:", bool)(flag); + } + + bool drawsBackground () + { + return invokeObjcSelf!(bool, "drawsBackground"); + } + + void setDrawsBackground (bool flag) + { + return invokeObjcSelf!(void, "setDrawsBackground:", bool)(flag); + } + + NSColor backgroundColor () + { + return invokeObjcSelf!(NSColor, "backgroundColor"); + } + + void setBackgroundColor (NSColor color) + { + return invokeObjcSelf!(void, "setBackgroundColor:", NSColor)(color); + } + + bool isFieldEditor () + { + return invokeObjcSelf!(bool, "isFieldEditor"); + } + + void setFieldEditor (bool flag) + { + return invokeObjcSelf!(void, "setFieldEditor:", bool)(flag); + } + + bool usesFontPanel () + { + return invokeObjcSelf!(bool, "usesFontPanel"); + } + + void setUsesFontPanel (bool flag) + { + return invokeObjcSelf!(void, "setUsesFontPanel:", bool)(flag); + } + + bool isRulerVisible () + { + return invokeObjcSelf!(bool, "isRulerVisible"); + } + + void setSelectedRange (NSRange charRange) + { + return invokeObjcSelf!(void, "setSelectedRange:", NSRange)(charRange); + } + + bool smartInsertDeleteEnabled () + { + return invokeObjcSelf!(bool, "smartInsertDeleteEnabled"); + } + + void setSmartInsertDeleteEnabled (bool flag) + { + return invokeObjcSelf!(void, "setSmartInsertDeleteEnabled:", bool)(flag); + } + + NSRange smartDeleteRangeForProposedRange (NSRange proposedCharRange) + { + return invokeObjcSelf!(NSRange, "smartDeleteRangeForProposedRange:", NSRange)(proposedCharRange); + } + + void toggleSmartInsertDelete (Object sender) + { + return invokeObjcSelf!(void, "toggleSmartInsertDelete:", Object)(sender); + } + + void smartInsertForString (NSString pasteString, NSRange charRangeToReplace, NSString** beforeString, NSString** afterString) + { + return invokeObjcSelf!(void, "smartInsertForString:replacingRange:beforeString:afterString:", NSString, NSRange, NSString**, NSString**)(pasteString, charRangeToReplace, beforeString, afterString); + } + + NSString smartInsertBeforeStringForString (NSString pasteString, NSRange charRangeToReplace) + { + return invokeObjcSelf!(NSString, "smartInsertBeforeStringForString:replacingRange:", NSString, NSRange)(pasteString, charRangeToReplace); + } + + NSString smartInsertAfterStringForString (NSString pasteString, NSRange charRangeToReplace) + { + return invokeObjcSelf!(NSString, "smartInsertAfterStringForString:replacingRange:", NSString, NSRange)(pasteString, charRangeToReplace); + } + + void setAutomaticQuoteSubstitutionEnabled (bool flag) + { + return invokeObjcSelf!(void, "setAutomaticQuoteSubstitutionEnabled:", bool)(flag); + } + + bool isAutomaticQuoteSubstitutionEnabled () + { + return invokeObjcSelf!(bool, "isAutomaticQuoteSubstitutionEnabled"); + } + + void toggleAutomaticQuoteSubstitution (Object sender) + { + return invokeObjcSelf!(void, "toggleAutomaticQuoteSubstitution:", Object)(sender); + } + + void setAutomaticLinkDetectionEnabled (bool flag) + { + return invokeObjcSelf!(void, "setAutomaticLinkDetectionEnabled:", bool)(flag); + } + + bool isAutomaticLinkDetectionEnabled () + { + return invokeObjcSelf!(bool, "isAutomaticLinkDetectionEnabled"); + } + + void toggleAutomaticLinkDetection (Object sender) + { + return invokeObjcSelf!(void, "toggleAutomaticLinkDetection:", Object)(sender); + } + + NSArray allowedInputSourceLocales () + { + return invokeObjcSelf!(NSArray, "allowedInputSourceLocales"); + } + + void setAllowedInputSourceLocales (NSArray localeIdentifiers) + { + return invokeObjcSelf!(void, "setAllowedInputSourceLocales:", NSArray)(localeIdentifiers); + } + + //mixin ObjcBindMethod!(selectedRanges, "selectedRanges"); + //mixin ObjcBindMethod!(setSelectedRanges, "setSelectedRanges:affinity:stillSelecting:"); + //mixin ObjcBindMethod!(setSelectedRanges, "setSelectedRanges:"); + //mixin ObjcBindMethod!(setSelectedRange, "setSelectedRange:affinity:stillSelecting:"); + //mixin ObjcBindMethod!(selectionAffinity, "selectionAffinity"); + //mixin ObjcBindMethod!(selectionGranularity, "selectionGranularity"); + //mixin ObjcBindMethod!(setSelectionGranularity, "setSelectionGranularity:"); + //mixin ObjcBindMethod!(setSelectedTextAttributes, "setSelectedTextAttributes:"); + //mixin ObjcBindMethod!(selectedTextAttributes, "selectedTextAttributes"); + //mixin ObjcBindMethod!(setInsertionPointColor, "setInsertionPointColor:"); + //mixin ObjcBindMethod!(insertionPointColor, "insertionPointColor"); + //mixin ObjcBindMethod!(updateInsertionPointStateAndRestartTimer, "updateInsertionPointStateAndRestartTimer:"); + //mixin ObjcBindMethod!(setMarkedTextAttributes, "setMarkedTextAttributes:"); + //mixin ObjcBindMethod!(markedTextAttributes, "markedTextAttributes"); + //mixin ObjcBindMethod!(setLinkTextAttributes, "setLinkTextAttributes:"); + //mixin ObjcBindMethod!(linkTextAttributes, "linkTextAttributes"); + //mixin ObjcBindMethod!(displaysLinkToolTips, "displaysLinkToolTips"); + //mixin ObjcBindMethod!(setDisplaysLinkToolTips, "setDisplaysLinkToolTips:"); + //mixin ObjcBindMethod!(acceptsGlyphInfo, "acceptsGlyphInfo"); + //mixin ObjcBindMethod!(setAcceptsGlyphInfo, "setAcceptsGlyphInfo:"); + //mixin ObjcBindMethod!(setRulerVisible, "setRulerVisible:"); + //mixin ObjcBindMethod!(usesRuler, "usesRuler"); + //mixin ObjcBindMethod!(setUsesRuler, "setUsesRuler:"); + //mixin ObjcBindMethod!(setContinuousSpellCheckingEnabled, "setContinuousSpellCheckingEnabled:"); + //mixin ObjcBindMethod!(isContinuousSpellCheckingEnabled, "isContinuousSpellCheckingEnabled"); + //mixin ObjcBindMethod!(toggleContinuousSpellChecking, "toggleContinuousSpellChecking:"); + //mixin ObjcBindMethod!(spellCheckerDocumentTag, "spellCheckerDocumentTag"); + //mixin ObjcBindMethod!(setGrammarCheckingEnabled, "setGrammarCheckingEnabled:"); + //mixin ObjcBindMethod!(isGrammarCheckingEnabled, "isGrammarCheckingEnabled"); + //mixin ObjcBindMethod!(toggleGrammarChecking, "toggleGrammarChecking:"); + //mixin ObjcBindMethod!(setSpellingState, "setSpellingState:range:"); + //mixin ObjcBindMethod!(typingAttributes, "typingAttributes"); + //mixin ObjcBindMethod!(setTypingAttributes, "setTypingAttributes:"); + //mixin ObjcBindMethod!(shouldChangeTextInRanges, "shouldChangeTextInRanges:replacementStrings:"); + //mixin ObjcBindMethod!(rangesForUserTextChange, "rangesForUserTextChange"); + //mixin ObjcBindMethod!(rangesForUserCharacterAttributeChange, "rangesForUserCharacterAttributeChange"); + //mixin ObjcBindMethod!(rangesForUserParagraphAttributeChange, "rangesForUserParagraphAttributeChange"); + //mixin ObjcBindMethod!(shouldChangeTextInRange, "shouldChangeTextInRange:replacementString:"); + //mixin ObjcBindMethod!(didChangeText, "didChangeText"); + //mixin ObjcBindMethod!(rangeForUserTextChange, "rangeForUserTextChange"); + //mixin ObjcBindMethod!(rangeForUserCharacterAttributeChange, "rangeForUserCharacterAttributeChange"); + //mixin ObjcBindMethod!(rangeForUserParagraphAttributeChange, "rangeForUserParagraphAttributeChange"); + //mixin ObjcBindMethod!(setUsesFindPanel, "setUsesFindPanel:"); + //mixin ObjcBindMethod!(usesFindPanel, "usesFindPanel"); + //mixin ObjcBindMethod!(setAllowsDocumentBackgroundColorChange, "setAllowsDocumentBackgroundColorChange:"); + //mixin ObjcBindMethod!(allowsDocumentBackgroundColorChange, "allowsDocumentBackgroundColorChange"); + //mixin ObjcBindMethod!(setDefaultParagraphStyle, "setDefaultParagraphStyle:"); + //mixin ObjcBindMethod!(defaultParagraphStyle, "defaultParagraphStyle"); + //mixin ObjcBindMethod!(setAllowsUndo, "setAllowsUndo:"); + //mixin ObjcBindMethod!(allowsUndo, "allowsUndo"); + //mixin ObjcBindMethod!(breakUndoCoalescing, "breakUndoCoalescing"); + //mixin ObjcBindMethod!(allowsImageEditing, "allowsImageEditing"); + //mixin ObjcBindMethod!(setAllowsImageEditing, "setAllowsImageEditing:"); + //mixin ObjcBindMethod!(showFindIndicatorForRange, "showFindIndicatorForRange:"); + //mixin ObjcBindMethod!(delegate_, "delegate"); + //mixin ObjcBindMethod!(setDelegate, "setDelegate:"); + //mixin ObjcBindMethod!(isEditable, "isEditable"); + //mixin ObjcBindMethod!(setEditable, "setEditable:"); + //mixin ObjcBindMethod!(isSelectable, "isSelectable"); + //mixin ObjcBindMethod!(setSelectable, "setSelectable:"); + //mixin ObjcBindMethod!(isRichText, "isRichText"); + //mixin ObjcBindMethod!(setRichText, "setRichText:"); + //mixin ObjcBindMethod!(importsGraphics, "importsGraphics"); + //mixin ObjcBindMethod!(setImportsGraphics, "setImportsGraphics:"); + //mixin ObjcBindMethod!(drawsBackground, "drawsBackground"); + //mixin ObjcBindMethod!(setDrawsBackground, "setDrawsBackground:"); + //mixin ObjcBindMethod!(backgroundColor, "backgroundColor"); + //mixin ObjcBindMethod!(setBackgroundColor, "setBackgroundColor:"); + //mixin ObjcBindMethod!(isFieldEditor, "isFieldEditor"); + //mixin ObjcBindMethod!(setFieldEditor, "setFieldEditor:"); + //mixin ObjcBindMethod!(usesFontPanel, "usesFontPanel"); + //mixin ObjcBindMethod!(setUsesFontPanel, "setUsesFontPanel:"); + //mixin ObjcBindMethod!(isRulerVisible, "isRulerVisible"); + //mixin ObjcBindMethod!(setSelectedRange, "setSelectedRange:"); + //mixin ObjcBindMethod!(smartInsertDeleteEnabled, "smartInsertDeleteEnabled"); + //mixin ObjcBindMethod!(setSmartInsertDeleteEnabled, "setSmartInsertDeleteEnabled:"); + //mixin ObjcBindMethod!(smartDeleteRangeForProposedRange, "smartDeleteRangeForProposedRange:"); + //mixin ObjcBindMethod!(toggleSmartInsertDelete, "toggleSmartInsertDelete:"); + //mixin ObjcBindMethod!(smartInsertForString, "smartInsertForString:replacingRange:beforeString:afterString:"); + //mixin ObjcBindMethod!(smartInsertBeforeStringForString, "smartInsertBeforeStringForString:replacingRange:"); + //mixin ObjcBindMethod!(smartInsertAfterStringForString, "smartInsertAfterStringForString:replacingRange:"); + //mixin ObjcBindMethod!(setAutomaticQuoteSubstitutionEnabled, "setAutomaticQuoteSubstitutionEnabled:"); + //mixin ObjcBindMethod!(isAutomaticQuoteSubstitutionEnabled, "isAutomaticQuoteSubstitutionEnabled"); + //mixin ObjcBindMethod!(toggleAutomaticQuoteSubstitution, "toggleAutomaticQuoteSubstitution:"); + //mixin ObjcBindMethod!(setAutomaticLinkDetectionEnabled, "setAutomaticLinkDetectionEnabled:"); + //mixin ObjcBindMethod!(isAutomaticLinkDetectionEnabled, "isAutomaticLinkDetectionEnabled"); + //mixin ObjcBindMethod!(toggleAutomaticLinkDetection, "toggleAutomaticLinkDetection:"); + //mixin ObjcBindMethod!(allowedInputSourceLocales, "allowedInputSourceLocales"); + //mixin ObjcBindMethod!(setAllowedInputSourceLocales, "setAllowedInputSourceLocales:"); + +`; + +const TNSPasteboard = ` + + NSArray writablePasteboardTypes () + { + return invokeObjcSelf!(NSArray, "writablePasteboardTypes"); + } + + bool writeSelectionToPasteboard (NSPasteboard pboard, NSString type) + { + return invokeObjcSelf!(bool, "writeSelectionToPasteboard:type:", NSPasteboard, NSString)(pboard, type); + } + + bool writeSelectionToPasteboard (NSPasteboard pboard, NSArray types) + { + return invokeObjcSelf!(bool, "writeSelectionToPasteboard:types:", NSPasteboard, NSArray)(pboard, types); + } + + NSArray readablePasteboardTypes () + { + return invokeObjcSelf!(NSArray, "readablePasteboardTypes"); + } + + NSString preferredPasteboardTypeFromArray (NSArray availableTypes, NSArray allowedTypes) + { + return invokeObjcSelf!(NSString, "preferredPasteboardTypeFromArray:restrictedToTypesFromArray:", NSArray, NSArray)(availableTypes, allowedTypes); + } + + bool readSelectionFromPasteboard (NSPasteboard pboard, NSString type) + { + return invokeObjcSelf!(bool, "readSelectionFromPasteboard:type:", NSPasteboard, NSString)(pboard, type); + } + + bool readSelectionFromPasteboard (NSPasteboard pboard) + { + return invokeObjcSelf!(bool, "readSelectionFromPasteboard:", NSPasteboard)(pboard); + } + + static void registerForServices () + { + return invokeObjcSelfClass!(void, "registerForServices"); + } + + Object validRequestorForSendType (NSString sendType, NSString returnType) + { + return invokeObjcSelf!(Object, "validRequestorForSendType:returnType:", NSString, NSString)(sendType, returnType); + } + + void pasteAsPlainText (Object sender) + { + return invokeObjcSelf!(void, "pasteAsPlainText:", Object)(sender); + } + + void pasteAsRichText (Object sender) + { + return invokeObjcSelf!(void, "pasteAsRichText:", Object)(sender); + } + + //mixin ObjcBindMethod!(writablePasteboardTypes, "writablePasteboardTypes"); + //mixin ObjcBindMethod!(writeSelectionToPasteboard, "writeSelectionToPasteboard:type:"); + //mixin ObjcBindMethod!(writeSelectionToPasteboard, "writeSelectionToPasteboard:types:"); + //mixin ObjcBindMethod!(readablePasteboardTypes, "readablePasteboardTypes"); + //mixin ObjcBindMethod!(preferredPasteboardTypeFromArray, "preferredPasteboardTypeFromArray:restrictedToTypesFromArray:"); + //mixin ObjcBindMethod!(readSelectionFromPasteboard, "readSelectionFromPasteboard:type:"); + //mixin ObjcBindMethod!(readSelectionFromPasteboard, "readSelectionFromPasteboard:"); + //mixin ObjcBindClassMethod!(registerForServices, "registerForServices"); + //mixin ObjcBindMethod!(validRequestorForSendType, "validRequestorForSendType:returnType:"); + //mixin ObjcBindMethod!(pasteAsPlainText, "pasteAsPlainText:"); + //mixin ObjcBindMethod!(pasteAsRichText, "pasteAsRichText:"); + +`; + +const TNSTextViewDelegate = ` + + bool textView (NSTextView textView, Object link, NSUInteger charIndex) + { + return invokeObjcSelf!(bool, "textView:clickedOnLink:atIndex:", NSTextView, Object, NSUInteger)(textView, link, charIndex); + } + + void textView (NSTextView textView, INSTextAttachmentCell cell, NSRect cellFrame, NSUInteger charIndex) + { + return invokeObjcSelf!(void, "textView:clickedOnCell:inRect:atIndex:", NSTextView, INSTextAttachmentCell, NSRect, NSUInteger)(textView, cell, cellFrame, charIndex); + } + + void textView (NSTextView textView, INSTextAttachmentCell cell, NSRect cellFrame, NSUInteger charIndex) + { + return invokeObjcSelf!(void, "textView:doubleClickedOnCell:inRect:atIndex:", NSTextView, INSTextAttachmentCell, NSRect, NSUInteger)(textView, cell, cellFrame, charIndex); + } + + void textView (NSTextView view, INSTextAttachmentCell cell, NSRect rect, NSEvent event, NSUInteger charIndex) + { + return invokeObjcSelf!(void, "textView:draggedCell:inRect:event:atIndex:", NSTextView, INSTextAttachmentCell, NSRect, NSEvent, NSUInteger)(view, cell, rect, event, charIndex); + } + + NSArray textView (NSTextView view, INSTextAttachmentCell cell, NSUInteger charIndex) + { + return invokeObjcSelf!(NSArray, "textView:writablePasteboardTypesForCell:atIndex:", NSTextView, INSTextAttachmentCell, NSUInteger)(view, cell, charIndex); + } + + bool textView (NSTextView view, INSTextAttachmentCell cell, NSUInteger charIndex, NSPasteboard pboard, NSString type) + { + return invokeObjcSelf!(bool, "textView:writeCell:atIndex:toPasteboard:type:", NSTextView, INSTextAttachmentCell, NSUInteger, NSPasteboard, NSString)(view, cell, charIndex, pboard, type); + } + + NSRange textView (NSTextView textView, NSRange oldSelectedCharRange, NSRange newSelectedCharRange) + { + return invokeObjcSelf!(NSRange, "textView:willChangeSelectionFromCharacterRange:toCharacterRange:", NSTextView, NSRange, NSRange)(textView, oldSelectedCharRange, newSelectedCharRange); + } + + NSArray textView (NSTextView textView, NSArray oldSelectedCharRanges, NSArray newSelectedCharRanges) + { + return invokeObjcSelf!(NSArray, "textView:willChangeSelectionFromCharacterRanges:toCharacterRanges:", NSTextView, NSArray, NSArray)(textView, oldSelectedCharRanges, newSelectedCharRanges); + } + + bool textView (NSTextView textView, NSArray affectedRanges, NSArray replacementStrings) + { + return invokeObjcSelf!(bool, "textView:shouldChangeTextInRanges:replacementStrings:", NSTextView, NSArray, NSArray)(textView, affectedRanges, replacementStrings); + } + + NSDictionary textView (NSTextView textView, NSDictionary oldTypingAttributes, NSDictionary newTypingAttributes) + { + return invokeObjcSelf!(NSDictionary, "textView:shouldChangeTypingAttributes:toAttributes:", NSTextView, NSDictionary, NSDictionary)(textView, oldTypingAttributes, newTypingAttributes); + } + + void textViewDidChangeSelection (NSNotification notification) + { + return invokeObjcSelf!(void, "textViewDidChangeSelection:", NSNotification)(notification); + } + + void textViewDidChangeTypingAttributes (NSNotification notification) + { + return invokeObjcSelf!(void, "textViewDidChangeTypingAttributes:", NSNotification)(notification); + } + + NSString textView (NSTextView textView, NSString tooltip, NSUInteger characterIndex) + { + return invokeObjcSelf!(NSString, "textView:willDisplayToolTip:forCharacterAtIndex:", NSTextView, NSString, NSUInteger)(textView, tooltip, characterIndex); + } + + NSArray textView (NSTextView textView, NSArray words, NSRange charRange, NSInteger* index) + { + return invokeObjcSelf!(NSArray, "textView:completions:forPartialWordRange:indexOfSelectedItem:", NSTextView, NSArray, NSRange, NSInteger*)(textView, words, charRange, index); + } + + bool textView (NSTextView textView, NSRange affectedCharRange, NSString replacementString) + { + return invokeObjcSelf!(bool, "textView:shouldChangeTextInRange:replacementString:", NSTextView, NSRange, NSString)(textView, affectedCharRange, replacementString); + } + + bool textView (NSTextView textView, SEL commandSelector) + { + return invokeObjcSelf!(bool, "textView:doCommandBySelector:", NSTextView, SEL)(textView, commandSelector); + } + + NSInteger textView (NSTextView textView, NSInteger value, NSRange affectedCharRange) + { + return invokeObjcSelf!(NSInteger, "textView:shouldSetSpellingState:range:", NSTextView, NSInteger, NSRange)(textView, value, affectedCharRange); + } + + NSMenu textView (NSTextView view, NSMenu menu, NSEvent event, NSUInteger charIndex) + { + return invokeObjcSelf!(NSMenu, "textView:menu:forEvent:atIndex:", NSTextView, NSMenu, NSEvent, NSUInteger)(view, menu, event, charIndex); + } + + bool textView (NSTextView textView, Object link) + { + return invokeObjcSelf!(bool, "textView:clickedOnLink:", NSTextView, Object)(textView, link); + } + + void textView (NSTextView textView, INSTextAttachmentCell cell, NSRect cellFrame) + { + return invokeObjcSelf!(void, "textView:clickedOnCell:inRect:", NSTextView, INSTextAttachmentCell, NSRect)(textView, cell, cellFrame); + } + + void textView (NSTextView textView, INSTextAttachmentCell cell, NSRect cellFrame) + { + return invokeObjcSelf!(void, "textView:doubleClickedOnCell:inRect:", NSTextView, INSTextAttachmentCell, NSRect)(textView, cell, cellFrame); + } + + void textView (NSTextView view, INSTextAttachmentCell cell, NSRect rect, NSEvent event) + { + return invokeObjcSelf!(void, "textView:draggedCell:inRect:event:", NSTextView, INSTextAttachmentCell, NSRect, NSEvent)(view, cell, rect, event); + } + + NSUndoManager undoManagerForTextView (NSTextView view) + { + return invokeObjcSelf!(NSUndoManager, "undoManagerForTextView:", NSTextView)(view); + } + + //mixin ObjcBindMethod!(textView, "textView:clickedOnLink:atIndex:"); + //mixin ObjcBindMethod!(textView, "textView:clickedOnCell:inRect:atIndex:"); + //mixin ObjcBindMethod!(textView, "textView:doubleClickedOnCell:inRect:atIndex:"); + //mixin ObjcBindMethod!(textView, "textView:draggedCell:inRect:event:atIndex:"); + //mixin ObjcBindMethod!(textView, "textView:writablePasteboardTypesForCell:atIndex:"); + //mixin ObjcBindMethod!(textView, "textView:writeCell:atIndex:toPasteboard:type:"); + //mixin ObjcBindMethod!(textView, "textView:willChangeSelectionFromCharacterRange:toCharacterRange:"); + //mixin ObjcBindMethod!(textView, "textView:willChangeSelectionFromCharacterRanges:toCharacterRanges:"); + //mixin ObjcBindMethod!(textView, "textView:shouldChangeTextInRanges:replacementStrings:"); + //mixin ObjcBindMethod!(textView, "textView:shouldChangeTypingAttributes:toAttributes:"); + //mixin ObjcBindMethod!(textViewDidChangeSelection, "textViewDidChangeSelection:"); + //mixin ObjcBindMethod!(textViewDidChangeTypingAttributes, "textViewDidChangeTypingAttributes:"); + //mixin ObjcBindMethod!(textView, "textView:willDisplayToolTip:forCharacterAtIndex:"); + //mixin ObjcBindMethod!(textView, "textView:completions:forPartialWordRange:indexOfSelectedItem:"); + //mixin ObjcBindMethod!(textView, "textView:shouldChangeTextInRange:replacementString:"); + //mixin ObjcBindMethod!(textView, "textView:doCommandBySelector:"); + //mixin ObjcBindMethod!(textView, "textView:shouldSetSpellingState:range:"); + //mixin ObjcBindMethod!(textView, "textView:menu:forEvent:atIndex:"); + //mixin ObjcBindMethod!(textView, "textView:clickedOnLink:"); + //mixin ObjcBindMethod!(textView, "textView:clickedOnCell:inRect:"); + //mixin ObjcBindMethod!(textView, "textView:doubleClickedOnCell:inRect:"); + //mixin ObjcBindMethod!(textView, "textView:draggedCell:inRect:event:"); + //mixin ObjcBindMethod!(undoManagerForTextView, "undoManagerForTextView:"); + +`; + +class NSTextViewDelegate : NSObject +{ + bool textView (NSTextView textView, Object link, NSUInteger charIndex) + { + return invokeObjcSelf!(bool, "textView:clickedOnLink:atIndex:", NSTextView, Object, NSUInteger)(textView, link, charIndex); + } + + void textView (NSTextView textView, INSTextAttachmentCell cell, NSRect cellFrame, NSUInteger charIndex) + { + return invokeObjcSelf!(void, "textView:clickedOnCell:inRect:atIndex:", NSTextView, INSTextAttachmentCell, NSRect, NSUInteger)(textView, cell, cellFrame, charIndex); + } + + void textView (NSTextView textView, INSTextAttachmentCell cell, NSRect cellFrame, NSUInteger charIndex) + { + return invokeObjcSelf!(void, "textView:doubleClickedOnCell:inRect:atIndex:", NSTextView, INSTextAttachmentCell, NSRect, NSUInteger)(textView, cell, cellFrame, charIndex); + } + + void textView (NSTextView view, INSTextAttachmentCell cell, NSRect rect, NSEvent event, NSUInteger charIndex) + { + return invokeObjcSelf!(void, "textView:draggedCell:inRect:event:atIndex:", NSTextView, INSTextAttachmentCell, NSRect, NSEvent, NSUInteger)(view, cell, rect, event, charIndex); + } + + NSArray textView (NSTextView view, INSTextAttachmentCell cell, NSUInteger charIndex) + { + return invokeObjcSelf!(NSArray, "textView:writablePasteboardTypesForCell:atIndex:", NSTextView, INSTextAttachmentCell, NSUInteger)(view, cell, charIndex); + } + + bool textView (NSTextView view, INSTextAttachmentCell cell, NSUInteger charIndex, NSPasteboard pboard, NSString type) + { + return invokeObjcSelf!(bool, "textView:writeCell:atIndex:toPasteboard:type:", NSTextView, INSTextAttachmentCell, NSUInteger, NSPasteboard, NSString)(view, cell, charIndex, pboard, type); + } + + NSRange textView (NSTextView textView, NSRange oldSelectedCharRange, NSRange newSelectedCharRange) + { + return invokeObjcSelf!(NSRange, "textView:willChangeSelectionFromCharacterRange:toCharacterRange:", NSTextView, NSRange, NSRange)(textView, oldSelectedCharRange, newSelectedCharRange); + } + + NSArray textView (NSTextView textView, NSArray oldSelectedCharRanges, NSArray newSelectedCharRanges) + { + return invokeObjcSelf!(NSArray, "textView:willChangeSelectionFromCharacterRanges:toCharacterRanges:", NSTextView, NSArray, NSArray)(textView, oldSelectedCharRanges, newSelectedCharRanges); + } + + bool textView (NSTextView textView, NSArray affectedRanges, NSArray replacementStrings) + { + return invokeObjcSelf!(bool, "textView:shouldChangeTextInRanges:replacementStrings:", NSTextView, NSArray, NSArray)(textView, affectedRanges, replacementStrings); + } + + NSDictionary textView (NSTextView textView, NSDictionary oldTypingAttributes, NSDictionary newTypingAttributes) + { + return invokeObjcSelf!(NSDictionary, "textView:shouldChangeTypingAttributes:toAttributes:", NSTextView, NSDictionary, NSDictionary)(textView, oldTypingAttributes, newTypingAttributes); + } + + void textViewDidChangeSelection (NSNotification notification) + { + return invokeObjcSelf!(void, "textViewDidChangeSelection:", NSNotification)(notification); + } + + void textViewDidChangeTypingAttributes (NSNotification notification) + { + return invokeObjcSelf!(void, "textViewDidChangeTypingAttributes:", NSNotification)(notification); + } + + NSString textView (NSTextView textView, NSString tooltip, NSUInteger characterIndex) + { + return invokeObjcSelf!(NSString, "textView:willDisplayToolTip:forCharacterAtIndex:", NSTextView, NSString, NSUInteger)(textView, tooltip, characterIndex); + } + + NSArray textView (NSTextView textView, NSArray words, NSRange charRange, NSInteger* index) + { + return invokeObjcSelf!(NSArray, "textView:completions:forPartialWordRange:indexOfSelectedItem:", NSTextView, NSArray, NSRange, NSInteger*)(textView, words, charRange, index); + } + + bool textView (NSTextView textView, NSRange affectedCharRange, NSString replacementString) + { + return invokeObjcSelf!(bool, "textView:shouldChangeTextInRange:replacementString:", NSTextView, NSRange, NSString)(textView, affectedCharRange, replacementString); + } + + bool textView (NSTextView textView, SEL commandSelector) + { + return invokeObjcSelf!(bool, "textView:doCommandBySelector:", NSTextView, SEL)(textView, commandSelector); + } + + NSInteger textView (NSTextView textView, NSInteger value, NSRange affectedCharRange) + { + return invokeObjcSelf!(NSInteger, "textView:shouldSetSpellingState:range:", NSTextView, NSInteger, NSRange)(textView, value, affectedCharRange); + } + + NSMenu textView (NSTextView view, NSMenu menu, NSEvent event, NSUInteger charIndex) + { + return invokeObjcSelf!(NSMenu, "textView:menu:forEvent:atIndex:", NSTextView, NSMenu, NSEvent, NSUInteger)(view, menu, event, charIndex); + } + + bool textView (NSTextView textView, Object link) + { + return invokeObjcSelf!(bool, "textView:clickedOnLink:", NSTextView, Object)(textView, link); + } + + void textView (NSTextView textView, INSTextAttachmentCell cell, NSRect cellFrame) + { + return invokeObjcSelf!(void, "textView:clickedOnCell:inRect:", NSTextView, INSTextAttachmentCell, NSRect)(textView, cell, cellFrame); + } + + void textView (NSTextView textView, INSTextAttachmentCell cell, NSRect cellFrame) + { + return invokeObjcSelf!(void, "textView:doubleClickedOnCell:inRect:", NSTextView, INSTextAttachmentCell, NSRect)(textView, cell, cellFrame); + } + + void textView (NSTextView view, INSTextAttachmentCell cell, NSRect rect, NSEvent event) + { + return invokeObjcSelf!(void, "textView:draggedCell:inRect:event:", NSTextView, INSTextAttachmentCell, NSRect, NSEvent)(view, cell, rect, event); + } + + NSUndoManager undoManagerForTextView (NSTextView view) + { + return invokeObjcSelf!(NSUndoManager, "undoManagerForTextView:", NSTextView)(view); + } +} + +class NSTextView : NSText, INSTextInput, INSUserInterfaceValidations, INSTextInputClient +{ + mixin (ObjcWrap); + + NSRect firstRectForCharacterRange (NSRange theRange) + { + return invokeObjcSelf!(NSRect, "firstRectForCharacterRange:", NSRange)(theRange); + } + + void setMarkedText (Object aString, NSRange selRange) + { + return invokeObjcSelf!(void, "setMarkedText:selectedRange:", Object, NSRange)(aString, selRange); + } + + NSInteger conversationIdentifier () + { + return invokeObjcSelf!(NSInteger, "conversationIdentifier"); + } + + NSAttributedString attributedSubstringFromRange (NSRange theRange) + { + return invokeObjcSelf!(NSAttributedString, "attributedSubstringFromRange:", NSRange)(theRange); + } + + bool validateUserInterfaceItem (INSValidatedUserInterfaceItem anItem) + { + return invokeObjcSelf!(bool, "validateUserInterfaceItem:", INSValidatedUserInterfaceItem)(anItem); + } + + void insertText (Object aString, NSRange replacementRange) + { + return invokeObjcSelf!(void, "insertText:replacementRange:", Object, NSRange)(aString, replacementRange); + } + + void doCommandBySelector (SEL aSelector) + { + return invokeObjcSelf!(void, "doCommandBySelector:", SEL)(aSelector); + } + + void setMarkedText (Object aString, NSRange selectedRange, NSRange replacementRange) + { + return invokeObjcSelf!(void, "setMarkedText:selectedRange:replacementRange:", Object, NSRange, NSRange)(aString, selectedRange, replacementRange); + } + + void unmarkText () + { + return invokeObjcSelf!(void, "unmarkText"); + } + + NSRange selectedRange () + { + return invokeObjcSelf!(NSRange, "selectedRange"); + } + + NSRange markedRange () + { + return invokeObjcSelf!(NSRange, "markedRange"); + } + + bool hasMarkedText () + { + return invokeObjcSelf!(bool, "hasMarkedText"); + } + + NSAttributedString attributedSubstringForProposedRange (NSRange aRange, NSRangePointer actualRange) + { + return invokeObjcSelf!(NSAttributedString, "attributedSubstringForProposedRange:actualRange:", NSRange, NSRangePointer)(aRange, actualRange); + } + + NSArray validAttributesForMarkedText () + { + return invokeObjcSelf!(NSArray, "validAttributesForMarkedText"); + } + + NSRect firstRectForCharacterRange (NSRange aRange, NSRangePointer actualRange) + { + return invokeObjcSelf!(NSRect, "firstRectForCharacterRange:actualRange:", NSRange, NSRangePointer)(aRange, actualRange); + } + + NSUInteger characterIndexForPoint (NSPoint aPoint) + { + return invokeObjcSelf!(NSUInteger, "characterIndexForPoint:", NSPoint)(aPoint); + } + + NSAttributedString attributedString () + { + return invokeObjcSelf!(NSAttributedString, "attributedString"); + } + + CGFloat fractionOfDistanceThroughGlyphForPoint (NSPoint aPoint) + { + return invokeObjcSelf!(CGFloat, "fractionOfDistanceThroughGlyphForPoint:", NSPoint)(aPoint); + } + + CGFloat baselineDeltaForCharacterAtIndex (NSUInteger anIndex) + { + return invokeObjcSelf!(CGFloat, "baselineDeltaForCharacterAtIndex:", NSUInteger)(anIndex); + } + + NSInteger windowLevel () + { + return invokeObjcSelf!(NSInteger, "windowLevel"); + } + + NSTextView initWithFrame (NSRect frameRect, NSTextContainer container) + { + return invokeObjcSelf!(NSTextView, "initWithFrame:textContainer:", NSRect, NSTextContainer)(frameRect, container); + } + + this (NSRect frameRect, NSTextContainer container) + { + super(NSTextView.alloc.initWithFrame(frameRect, container).objcObject); + } + + NSTextView initWithFrame (NSRect frameRect) + { + return invokeObjcSelf!(NSTextView, "initWithFrame:", NSRect)(frameRect); + } + + this (NSRect frameRect) + { + super(NSTextView.alloc.initWithFrame(frameRect).objcObject); + } + + NSTextContainer textContainer () + { + return invokeObjcSelf!(NSTextContainer, "textContainer"); + } + + void setTextContainer (NSTextContainer container) + { + return invokeObjcSelf!(void, "setTextContainer:", NSTextContainer)(container); + } + + void replaceTextContainer (NSTextContainer newContainer) + { + return invokeObjcSelf!(void, "replaceTextContainer:", NSTextContainer)(newContainer); + } + + void setTextContainerInset (NSSize inset) + { + return invokeObjcSelf!(void, "setTextContainerInset:", NSSize)(inset); + } + + NSSize textContainerInset () + { + return invokeObjcSelf!(NSSize, "textContainerInset"); + } + + NSPoint textContainerOrigin () + { + return invokeObjcSelf!(NSPoint, "textContainerOrigin"); + } + + void invalidateTextContainerOrigin () + { + return invokeObjcSelf!(void, "invalidateTextContainerOrigin"); + } + + NSLayoutManager layoutManager () + { + return invokeObjcSelf!(NSLayoutManager, "layoutManager"); + } + + NSTextStorage textStorage () + { + return invokeObjcSelf!(NSTextStorage, "textStorage"); + } + + void insertText (Object insertString) + { + return invokeObjcSelf!(void, "insertText:", Object)(insertString); + } + + void setConstrainedFrameSize (NSSize desiredSize) + { + return invokeObjcSelf!(void, "setConstrainedFrameSize:", NSSize)(desiredSize); + } + + void setAlignment (NSTextAlignment alignment) + { + return invokeObjcSelf!(void, "setAlignment:", NSTextAlignment)(alignment); + } + + void setBaseWritingDirection (NSWritingDirection writingDirection, NSRange range) + { + return invokeObjcSelf!(void, "setBaseWritingDirection:range:", NSWritingDirection, NSRange)(writingDirection, range); + } + + void turnOffKerning (Object sender) + { + return invokeObjcSelf!(void, "turnOffKerning:", Object)(sender); + } + + void tightenKerning (Object sender) + { + return invokeObjcSelf!(void, "tightenKerning:", Object)(sender); + } + + void loosenKerning (Object sender) + { + return invokeObjcSelf!(void, "loosenKerning:", Object)(sender); + } + + void useStandardKerning (Object sender) + { + return invokeObjcSelf!(void, "useStandardKerning:", Object)(sender); + } + + void turnOffLigatures (Object sender) + { + return invokeObjcSelf!(void, "turnOffLigatures:", Object)(sender); + } + + void useStandardLigatures (Object sender) + { + return invokeObjcSelf!(void, "useStandardLigatures:", Object)(sender); + } + + void useAllLigatures (Object sender) + { + return invokeObjcSelf!(void, "useAllLigatures:", Object)(sender); + } + + void raiseBaseline (Object sender) + { + return invokeObjcSelf!(void, "raiseBaseline:", Object)(sender); + } + + void lowerBaseline (Object sender) + { + return invokeObjcSelf!(void, "lowerBaseline:", Object)(sender); + } + + void toggleTraditionalCharacterShape (Object sender) + { + return invokeObjcSelf!(void, "toggleTraditionalCharacterShape:", Object)(sender); + } + + void outline (Object sender) + { + return invokeObjcSelf!(void, "outline:", Object)(sender); + } + + void performFindPanelAction (Object sender) + { + return invokeObjcSelf!(void, "performFindPanelAction:", Object)(sender); + } + + void alignJustified (Object sender) + { + return invokeObjcSelf!(void, "alignJustified:", Object)(sender); + } + + void changeColor (Object sender) + { + return invokeObjcSelf!(void, "changeColor:", Object)(sender); + } + + void changeAttributes (Object sender) + { + return invokeObjcSelf!(void, "changeAttributes:", Object)(sender); + } + + void changeDocumentBackgroundColor (Object sender) + { + return invokeObjcSelf!(void, "changeDocumentBackgroundColor:", Object)(sender); + } + + void toggleBaseWritingDirection (Object sender) + { + return invokeObjcSelf!(void, "toggleBaseWritingDirection:", Object)(sender); + } + + void orderFrontSpacingPanel (Object sender) + { + return invokeObjcSelf!(void, "orderFrontSpacingPanel:", Object)(sender); + } + + void orderFrontLinkPanel (Object sender) + { + return invokeObjcSelf!(void, "orderFrontLinkPanel:", Object)(sender); + } + + void orderFrontListPanel (Object sender) + { + return invokeObjcSelf!(void, "orderFrontListPanel:", Object)(sender); + } + + void orderFrontTablePanel (Object sender) + { + return invokeObjcSelf!(void, "orderFrontTablePanel:", Object)(sender); + } + + bool rulerView_shouldMoveMarker (NSRulerView ruler, NSRulerMarker marker) + { + return invokeObjcSelf!(bool, "rulerView:shouldMoveMarker:", NSRulerView, NSRulerMarker)(ruler, marker); + } + + CGFloat rulerView (NSRulerView ruler, NSRulerMarker marker, CGFloat location) + { + return invokeObjcSelf!(CGFloat, "rulerView:willMoveMarker:toLocation:", NSRulerView, NSRulerMarker, CGFloat)(ruler, marker, location); + } + + void rulerView (NSRulerView ruler, NSRulerMarker marker) + { + return invokeObjcSelf!(void, "rulerView:didMoveMarker:", NSRulerView, NSRulerMarker)(ruler, marker); + } + + void rulerView_shouldRemoveMarker (NSRulerView ruler, NSRulerMarker marker) + { + return invokeObjcSelf!(void, "rulerView:shouldRemoveMarker:", NSRulerView, NSRulerMarker)(ruler, marker); + } + + void rulerView_didRemoveMarker (NSRulerView ruler, NSRulerMarker marker) + { + return invokeObjcSelf!(void, "rulerView:didRemoveMarker:", NSRulerView, NSRulerMarker)(ruler, marker); + } + + bool rulerView_shouldAddMarker (NSRulerView ruler, NSRulerMarker marker) + { + return invokeObjcSelf!(bool, "rulerView:shouldAddMarker:", NSRulerView, NSRulerMarker)(ruler, marker); + } + + CGFloat rulerView_willAddMarker_atLocation (NSRulerView ruler, NSRulerMarker marker, CGFloat location) + { + return invokeObjcSelf!(CGFloat, "rulerView:willAddMarker:atLocation:", NSRulerView, NSRulerMarker, CGFloat)(ruler, marker, location); + } + + void rulerView_didAddMarker (NSRulerView ruler, NSRulerMarker marker) + { + return invokeObjcSelf!(void, "rulerView:didAddMarker:", NSRulerView, NSRulerMarker)(ruler, marker); + } + + void rulerView (NSRulerView ruler, NSEvent event) + { + return invokeObjcSelf!(void, "rulerView:handleMouseDown:", NSRulerView, NSEvent)(ruler, event); + } + + void setNeedsDisplayInRect (NSRect rect, bool flag) + { + return invokeObjcSelf!(void, "setNeedsDisplayInRect:avoidAdditionalLayout:", NSRect, bool)(rect, flag); + } + + bool shouldDrawInsertionPoint () + { + return invokeObjcSelf!(bool, "shouldDrawInsertionPoint"); + } + + void drawInsertionPointInRect (NSRect rect, NSColor color, bool flag) + { + return invokeObjcSelf!(void, "drawInsertionPointInRect:color:turnedOn:", NSRect, NSColor, bool)(rect, color, flag); + } + + void drawViewBackgroundInRect (NSRect rect) + { + return invokeObjcSelf!(void, "drawViewBackgroundInRect:", NSRect)(rect); + } + + void updateRuler () + { + return invokeObjcSelf!(void, "updateRuler"); + } + + void updateFontPanel () + { + return invokeObjcSelf!(void, "updateFontPanel"); + } + + void updateDragTypeRegistration () + { + return invokeObjcSelf!(void, "updateDragTypeRegistration"); + } + + NSRange selectionRangeForProposedRange (NSRange proposedCharRange, NSSelectionGranularity granularity) + { + return invokeObjcSelf!(NSRange, "selectionRangeForProposedRange:granularity:", NSRange, NSSelectionGranularity)(proposedCharRange, granularity); + } + + void clickedOnCell (Object link, NSUInteger charIndex) + { + return invokeObjcSelf!(void, "clickedOnCell:atIndex:", Object, NSUInteger)(link, charIndex); + } + + void startSpeaking (Object sender) + { + return invokeObjcSelf!(void, "startSpeaking:", Object)(sender); + } + + void stopSpeaking (Object sender) + { + return invokeObjcSelf!(void, "stopSpeaking:", Object)(sender); + } + + NSUInteger characterIndexForInsertionAtPoint (NSPoint point) + { + return invokeObjcSelf!(NSUInteger, "characterIndexForInsertionAtPoint:", NSPoint)(point); + } + + // NSDragging + bool dragSelectionWithEvent (NSEvent event, NSSize mouseOffset, bool slideBack) + { + return invokeObjcSelf!(bool, "dragSelectionWithEvent:offset:slideBack:", NSEvent, NSSize, bool)(event, mouseOffset, slideBack); + } + + NSImage dragImageForSelectionWithEvent (NSEvent event, NSPointPointer origin) + { + return invokeObjcSelf!(NSImage, "dragImageForSelectionWithEvent:origin:", NSEvent, NSPointPointer)(event, origin); + } + + NSArray acceptableDragTypes () + { + return invokeObjcSelf!(NSArray, "acceptableDragTypes"); + } + + uint dragOperationForDraggingInfo (INSDraggingInfo dragInfo, NSString type) + { + return invokeObjcSelf!(uint, "dragOperationForDraggingInfo:type:", INSDraggingInfo, NSString)(dragInfo, type); + } + + void cleanUpAfterDragOperation () + { + return invokeObjcSelf!(void, "cleanUpAfterDragOperation"); + } + + // NSCompletion + void complete (Object sender) + { + return invokeObjcSelf!(void, "complete:", Object)(sender); + } + + NSRange rangeForUserCompletion () + { + return invokeObjcSelf!(NSRange, "rangeForUserCompletion"); + } + + NSArray completionsForPartialWordRange (NSRange charRange, NSInteger* index) + { + return invokeObjcSelf!(NSArray, "completionsForPartialWordRange:indexOfSelectedItem:", NSRange, NSInteger*)(charRange, index); + } + + void insertCompletion (NSString word, NSRange charRange, NSInteger movement, bool flag) + { + return invokeObjcSelf!(void, "insertCompletion:forPartialWordRange:movement:isFinal:", NSString, NSRange, NSInteger, bool)(word, charRange, movement, flag); + } + + // NSSharing + NSArray selectedRanges () + { + return invokeObjcSelf!(NSArray, "selectedRanges"); + } + + void setSelectedRanges (NSArray ranges, uint affinity, bool stillSelectingFlag) + { + return invokeObjcSelf!(void, "setSelectedRanges:affinity:stillSelecting:", NSArray, uint, bool)(ranges, affinity, stillSelectingFlag); + } + + void setSelectedRanges (NSArray ranges) + { + return invokeObjcSelf!(void, "setSelectedRanges:", NSArray)(ranges); + } + + void setSelectedRange (NSRange charRange, uint affinity, bool stillSelectingFlag) + { + return invokeObjcSelf!(void, "setSelectedRange:affinity:stillSelecting:", NSRange, uint, bool)(charRange, affinity, stillSelectingFlag); + } + + uint selectionAffinity () + { + return invokeObjcSelf!(uint, "selectionAffinity"); + } + + uint selectionGranularity () + { + return invokeObjcSelf!(uint, "selectionGranularity"); + } + + void setSelectionGranularity (uint granularity) + { + return invokeObjcSelf!(void, "setSelectionGranularity:", uint)(granularity); + } + + void setSelectedTextAttributes (NSDictionary attributeDictionary) + { + return invokeObjcSelf!(void, "setSelectedTextAttributes:", NSDictionary)(attributeDictionary); + } + + NSDictionary selectedTextAttributes () + { + return invokeObjcSelf!(NSDictionary, "selectedTextAttributes"); + } + + void setInsertionPointColor (NSColor color) + { + return invokeObjcSelf!(void, "setInsertionPointColor:", NSColor)(color); + } + + NSColor insertionPointColor () + { + return invokeObjcSelf!(NSColor, "insertionPointColor"); + } + + void updateInsertionPointStateAndRestartTimer (bool restartFlag) + { + return invokeObjcSelf!(void, "updateInsertionPointStateAndRestartTimer:", bool)(restartFlag); + } + + void setMarkedTextAttributes (NSDictionary attributeDictionary) + { + return invokeObjcSelf!(void, "setMarkedTextAttributes:", NSDictionary)(attributeDictionary); + } + + NSDictionary markedTextAttributes () + { + return invokeObjcSelf!(NSDictionary, "markedTextAttributes"); + } + + void setLinkTextAttributes (NSDictionary attributeDictionary) + { + return invokeObjcSelf!(void, "setLinkTextAttributes:", NSDictionary)(attributeDictionary); + } + + NSDictionary linkTextAttributes () + { + return invokeObjcSelf!(NSDictionary, "linkTextAttributes"); + } + + bool displaysLinkToolTips () + { + return invokeObjcSelf!(bool, "displaysLinkToolTips"); + } + + void setDisplaysLinkToolTips (bool flag) + { + return invokeObjcSelf!(void, "setDisplaysLinkToolTips:", bool)(flag); + } + + bool acceptsGlyphInfo () + { + return invokeObjcSelf!(bool, "acceptsGlyphInfo"); + } + + void setAcceptsGlyphInfo (bool flag) + { + return invokeObjcSelf!(void, "setAcceptsGlyphInfo:", bool)(flag); + } + + void setRulerVisible (bool flag) + { + return invokeObjcSelf!(void, "setRulerVisible:", bool)(flag); + } + + bool usesRuler () + { + return invokeObjcSelf!(bool, "usesRuler"); + } + + void setUsesRuler (bool flag) + { + return invokeObjcSelf!(void, "setUsesRuler:", bool)(flag); + } + + void setContinuousSpellCheckingEnabled (bool flag) + { + return invokeObjcSelf!(void, "setContinuousSpellCheckingEnabled:", bool)(flag); + } + + bool isContinuousSpellCheckingEnabled () + { + return invokeObjcSelf!(bool, "isContinuousSpellCheckingEnabled"); + } + + void toggleContinuousSpellChecking (Object sender) + { + return invokeObjcSelf!(void, "toggleContinuousSpellChecking:", Object)(sender); + } + + NSInteger spellCheckerDocumentTag () + { + return invokeObjcSelf!(NSInteger, "spellCheckerDocumentTag"); + } + + void setGrammarCheckingEnabled (bool flag) + { + return invokeObjcSelf!(void, "setGrammarCheckingEnabled:", bool)(flag); + } + + bool isGrammarCheckingEnabled () + { + return invokeObjcSelf!(bool, "isGrammarCheckingEnabled"); + } + + void toggleGrammarChecking (Object sender) + { + return invokeObjcSelf!(void, "toggleGrammarChecking:", Object)(sender); + } + + void setSpellingState (NSInteger value, NSRange charRange) + { + return invokeObjcSelf!(void, "setSpellingState:range:", NSInteger, NSRange)(value, charRange); + } + + NSDictionary typingAttributes () + { + return invokeObjcSelf!(NSDictionary, "typingAttributes"); + } + + void setTypingAttributes (NSDictionary attrs) + { + return invokeObjcSelf!(void, "setTypingAttributes:", NSDictionary)(attrs); + } + + bool shouldChangeTextInRanges (NSArray affectedRanges, NSArray replacementStrings) + { + return invokeObjcSelf!(bool, "shouldChangeTextInRanges:replacementStrings:", NSArray, NSArray)(affectedRanges, replacementStrings); + } + + NSArray rangesForUserTextChange () + { + return invokeObjcSelf!(NSArray, "rangesForUserTextChange"); + } + + NSArray rangesForUserCharacterAttributeChange () + { + return invokeObjcSelf!(NSArray, "rangesForUserCharacterAttributeChange"); + } + + NSArray rangesForUserParagraphAttributeChange () + { + return invokeObjcSelf!(NSArray, "rangesForUserParagraphAttributeChange"); + } + + bool shouldChangeTextInRange (NSRange affectedCharRange, NSString replacementString) + { + return invokeObjcSelf!(bool, "shouldChangeTextInRange:replacementString:", NSRange, NSString)(affectedCharRange, replacementString); + } + + void didChangeText () + { + return invokeObjcSelf!(void, "didChangeText"); + } + + NSRange rangeForUserTextChange () + { + return invokeObjcSelf!(NSRange, "rangeForUserTextChange"); + } + + NSRange rangeForUserCharacterAttributeChange () + { + return invokeObjcSelf!(NSRange, "rangeForUserCharacterAttributeChange"); + } + + NSRange rangeForUserParagraphAttributeChange () + { + return invokeObjcSelf!(NSRange, "rangeForUserParagraphAttributeChange"); + } + + void setUsesFindPanel (bool flag) + { + return invokeObjcSelf!(void, "setUsesFindPanel:", bool)(flag); + } + + bool usesFindPanel () + { + return invokeObjcSelf!(bool, "usesFindPanel"); + } + + void setAllowsDocumentBackgroundColorChange (bool flag) + { + return invokeObjcSelf!(void, "setAllowsDocumentBackgroundColorChange:", bool)(flag); + } + + bool allowsDocumentBackgroundColorChange () + { + return invokeObjcSelf!(bool, "allowsDocumentBackgroundColorChange"); + } + + void setDefaultParagraphStyle (NSParagraphStyle paragraphStyle) + { + return invokeObjcSelf!(void, "setDefaultParagraphStyle:", NSParagraphStyle)(paragraphStyle); + } + + NSParagraphStyle defaultParagraphStyle () + { + return invokeObjcSelf!(NSParagraphStyle, "defaultParagraphStyle"); + } + + void setAllowsUndo (bool flag) + { + return invokeObjcSelf!(void, "setAllowsUndo:", bool)(flag); + } + + bool allowsUndo () + { + return invokeObjcSelf!(bool, "allowsUndo"); + } + + void breakUndoCoalescing () + { + return invokeObjcSelf!(void, "breakUndoCoalescing"); + } + + bool allowsImageEditing () + { + return invokeObjcSelf!(bool, "allowsImageEditing"); + } + + void setAllowsImageEditing (bool flag) + { + return invokeObjcSelf!(void, "setAllowsImageEditing:", bool)(flag); + } + + void showFindIndicatorForRange (NSRange charRange) + { + return invokeObjcSelf!(void, "showFindIndicatorForRange:", NSRange)(charRange); + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + void setDelegate (Object anObject) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(anObject); + } + + bool isEditable () + { + return invokeObjcSelf!(bool, "isEditable"); + } + + void setEditable (bool flag) + { + return invokeObjcSelf!(void, "setEditable:", bool)(flag); + } + + bool isSelectable () + { + return invokeObjcSelf!(bool, "isSelectable"); + } + + void setSelectable (bool flag) + { + return invokeObjcSelf!(void, "setSelectable:", bool)(flag); + } + + bool isRichText () + { + return invokeObjcSelf!(bool, "isRichText"); + } + + void setRichText (bool flag) + { + return invokeObjcSelf!(void, "setRichText:", bool)(flag); + } + + bool importsGraphics () + { + return invokeObjcSelf!(bool, "importsGraphics"); + } + + void setImportsGraphics (bool flag) + { + return invokeObjcSelf!(void, "setImportsGraphics:", bool)(flag); + } + + bool drawsBackground () + { + return invokeObjcSelf!(bool, "drawsBackground"); + } + + void setDrawsBackground (bool flag) + { + return invokeObjcSelf!(void, "setDrawsBackground:", bool)(flag); + } + + NSColor backgroundColor () + { + return invokeObjcSelf!(NSColor, "backgroundColor"); + } + + void setBackgroundColor (NSColor color) + { + return invokeObjcSelf!(void, "setBackgroundColor:", NSColor)(color); + } + + bool isFieldEditor () + { + return invokeObjcSelf!(bool, "isFieldEditor"); + } + + void setFieldEditor (bool flag) + { + return invokeObjcSelf!(void, "setFieldEditor:", bool)(flag); + } + + bool usesFontPanel () + { + return invokeObjcSelf!(bool, "usesFontPanel"); + } + + void setUsesFontPanel (bool flag) + { + return invokeObjcSelf!(void, "setUsesFontPanel:", bool)(flag); + } + + bool isRulerVisible () + { + return invokeObjcSelf!(bool, "isRulerVisible"); + } + + void setSelectedRange (NSRange charRange) + { + return invokeObjcSelf!(void, "setSelectedRange:", NSRange)(charRange); + } + + bool smartInsertDeleteEnabled () + { + return invokeObjcSelf!(bool, "smartInsertDeleteEnabled"); + } + + void setSmartInsertDeleteEnabled (bool flag) + { + return invokeObjcSelf!(void, "setSmartInsertDeleteEnabled:", bool)(flag); + } + + NSRange smartDeleteRangeForProposedRange (NSRange proposedCharRange) + { + return invokeObjcSelf!(NSRange, "smartDeleteRangeForProposedRange:", NSRange)(proposedCharRange); + } + + void toggleSmartInsertDelete (Object sender) + { + return invokeObjcSelf!(void, "toggleSmartInsertDelete:", Object)(sender); + } + + void smartInsertForString (NSString pasteString, NSRange charRangeToReplace, NSString** beforeString, NSString** afterString) + { + return invokeObjcSelf!(void, "smartInsertForString:replacingRange:beforeString:afterString:", NSString, NSRange, NSString**, NSString**)(pasteString, charRangeToReplace, beforeString, afterString); + } + + NSString smartInsertBeforeStringForString (NSString pasteString, NSRange charRangeToReplace) + { + return invokeObjcSelf!(NSString, "smartInsertBeforeStringForString:replacingRange:", NSString, NSRange)(pasteString, charRangeToReplace); + } + + NSString smartInsertAfterStringForString (NSString pasteString, NSRange charRangeToReplace) + { + return invokeObjcSelf!(NSString, "smartInsertAfterStringForString:replacingRange:", NSString, NSRange)(pasteString, charRangeToReplace); + } + + void setAutomaticQuoteSubstitutionEnabled (bool flag) + { + return invokeObjcSelf!(void, "setAutomaticQuoteSubstitutionEnabled:", bool)(flag); + } + + bool isAutomaticQuoteSubstitutionEnabled () + { + return invokeObjcSelf!(bool, "isAutomaticQuoteSubstitutionEnabled"); + } + + void toggleAutomaticQuoteSubstitution (Object sender) + { + return invokeObjcSelf!(void, "toggleAutomaticQuoteSubstitution:", Object)(sender); + } + + void setAutomaticLinkDetectionEnabled (bool flag) + { + return invokeObjcSelf!(void, "setAutomaticLinkDetectionEnabled:", bool)(flag); + } + + bool isAutomaticLinkDetectionEnabled () + { + return invokeObjcSelf!(bool, "isAutomaticLinkDetectionEnabled"); + } + + void toggleAutomaticLinkDetection (Object sender) + { + return invokeObjcSelf!(void, "toggleAutomaticLinkDetection:", Object)(sender); + } + + NSArray allowedInputSourceLocales () + { + return invokeObjcSelf!(NSArray, "allowedInputSourceLocales"); + } + + void setAllowedInputSourceLocales (NSArray localeIdentifiers) + { + return invokeObjcSelf!(void, "setAllowedInputSourceLocales:", NSArray)(localeIdentifiers); + } + + // NSPasteboard + NSArray writablePasteboardTypes () + { + return invokeObjcSelf!(NSArray, "writablePasteboardTypes"); + } + + bool writeSelectionToPasteboard (NSPasteboard pboard, NSString type) + { + return invokeObjcSelf!(bool, "writeSelectionToPasteboard:type:", NSPasteboard, NSString)(pboard, type); + } + + bool writeSelectionToPasteboard (NSPasteboard pboard, NSArray types) + { + return invokeObjcSelf!(bool, "writeSelectionToPasteboard:types:", NSPasteboard, NSArray)(pboard, types); + } + + NSArray readablePasteboardTypes () + { + return invokeObjcSelf!(NSArray, "readablePasteboardTypes"); + } + + NSString preferredPasteboardTypeFromArray (NSArray availableTypes, NSArray allowedTypes) + { + return invokeObjcSelf!(NSString, "preferredPasteboardTypeFromArray:restrictedToTypesFromArray:", NSArray, NSArray)(availableTypes, allowedTypes); + } + + bool readSelectionFromPasteboard (NSPasteboard pboard, NSString type) + { + return invokeObjcSelf!(bool, "readSelectionFromPasteboard:type:", NSPasteboard, NSString)(pboard, type); + } + + bool readSelectionFromPasteboard (NSPasteboard pboard) + { + return invokeObjcSelf!(bool, "readSelectionFromPasteboard:", NSPasteboard)(pboard); + } + + static void registerForServices () + { + return invokeObjcSelfClass!(void, "registerForServices"); + } + + Object validRequestorForSendType (NSString sendType, NSString returnType) + { + return invokeObjcSelf!(Object, "validRequestorForSendType:returnType:", NSString, NSString)(sendType, returnType); + } + + void pasteAsPlainText (Object sender) + { + return invokeObjcSelf!(void, "pasteAsPlainText:", Object)(sender); + } + + void pasteAsRichText (Object sender) + { + return invokeObjcSelf!(void, "pasteAsRichText:", Object)(sender); + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSTextView_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSTextView_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,24 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSTextView_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package id NSFindPanelSearchOptionsPboardType; + package id NSFindPanelCaseInsensitiveSearch; + package id NSFindPanelSubstringMatch; + package id NSAllRomanInputSourcesLocaleIdentifier; + package id NSTextViewWillChangeNotifyingTextViewNotification; + package id NSTextViewDidChangeSelectionNotification; + package id NSTextViewDidChangeTypingAttributesNotification; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSText_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSText_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,20 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSText_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package id NSTextDidBeginEditingNotification; + package id NSTextDidEndEditingNotification; + package id NSTextDidChangeNotification; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSTokenField.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSTokenField.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,125 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSTokenField; + +import dstep.appkit.NSTextContainer; +import dstep.appkit.NSTextField; +import dstep.appkit.NSTokenFieldCell; +import dstep.foundation.Foundation; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSTokenField : NSTextField +{ + mixin (ObjcWrap); + + void setTokenStyle (uint style) + { + return invokeObjcSelf!(void, "setTokenStyle:", uint)(style); + } + + uint tokenStyle () + { + return invokeObjcSelf!(uint, "tokenStyle"); + } + + void setCompletionDelay (double delay) + { + return invokeObjcSelf!(void, "setCompletionDelay:", double)(delay); + } + + double completionDelay () + { + return invokeObjcSelf!(double, "completionDelay"); + } + + static double defaultCompletionDelay () + { + return invokeObjcSelfClass!(double, "defaultCompletionDelay"); + } + + void setTokenizingCharacterSet (NSCharacterSet characterSet) + { + return invokeObjcSelf!(void, "setTokenizingCharacterSet:", NSCharacterSet)(characterSet); + } + + NSCharacterSet tokenizingCharacterSet () + { + return invokeObjcSelf!(NSCharacterSet, "tokenizingCharacterSet"); + } + + static NSCharacterSet defaultTokenizingCharacterSet () + { + return invokeObjcSelfClass!(NSCharacterSet, "defaultTokenizingCharacterSet"); + } +} + +const TNSTokenFieldDelegate = ` + + NSArray tokenField (NSTokenField tokenField, NSString substring, NSInteger tokenIndex, NSInteger* selectedIndex) + { + return invokeObjcSelf!(NSArray, "tokenField:completionsForSubstring:indexOfToken:indexOfSelectedItem:", NSTokenField, NSString, NSInteger, NSInteger*)(tokenField, substring, tokenIndex, selectedIndex); + } + + NSArray tokenField (NSTokenField tokenField, NSArray tokens, NSUInteger index) + { + return invokeObjcSelf!(NSArray, "tokenField:shouldAddObjects:atIndex:", NSTokenField, NSArray, NSUInteger)(tokenField, tokens, index); + } + + NSString tokenField (NSTokenField tokenField, Object representedObject) + { + return invokeObjcSelf!(NSString, "tokenField:displayStringForRepresentedObject:", NSTokenField, Object)(tokenField, representedObject); + } + + NSString tokenField (NSTokenField tokenField, Object representedObject) + { + return invokeObjcSelf!(NSString, "tokenField:editingStringForRepresentedObject:", NSTokenField, Object)(tokenField, representedObject); + } + + Object tokenField (NSTokenField tokenField, NSString editingString) + { + return invokeObjcSelf!(Object, "tokenField:representedObjectForEditingString:", NSTokenField, NSString)(tokenField, editingString); + } + + bool tokenField (NSTokenField tokenField, NSArray objects, NSPasteboard pboard) + { + return invokeObjcSelf!(bool, "tokenField:writeRepresentedObjects:toPasteboard:", NSTokenField, NSArray, NSPasteboard)(tokenField, objects, pboard); + } + + NSArray tokenField (NSTokenField tokenField, NSPasteboard pboard) + { + return invokeObjcSelf!(NSArray, "tokenField:readFromPasteboard:", NSTokenField, NSPasteboard)(tokenField, pboard); + } + + NSMenu tokenField (NSTokenField tokenField, Object representedObject) + { + return invokeObjcSelf!(NSMenu, "tokenField:menuForRepresentedObject:", NSTokenField, Object)(tokenField, representedObject); + } + + bool tokenField (NSTokenField tokenField, Object representedObject) + { + return invokeObjcSelf!(bool, "tokenField:hasMenuForRepresentedObject:", NSTokenField, Object)(tokenField, representedObject); + } + + uint tokenField (NSTokenField tokenField, Object representedObject) + { + return invokeObjcSelf!(uint, "tokenField:styleForRepresentedObject:", NSTokenField, Object)(tokenField, representedObject); + } + + //mixin ObjcBindMethod!(tokenField, "tokenField:completionsForSubstring:indexOfToken:indexOfSelectedItem:"); + //mixin ObjcBindMethod!(tokenField, "tokenField:shouldAddObjects:atIndex:"); + //mixin ObjcBindMethod!(tokenField, "tokenField:displayStringForRepresentedObject:"); + //mixin ObjcBindMethod!(tokenField, "tokenField:editingStringForRepresentedObject:"); + //mixin ObjcBindMethod!(tokenField, "tokenField:representedObjectForEditingString:"); + //mixin ObjcBindMethod!(tokenField, "tokenField:writeRepresentedObjects:toPasteboard:"); + //mixin ObjcBindMethod!(tokenField, "tokenField:readFromPasteboard:"); + //mixin ObjcBindMethod!(tokenField, "tokenField:menuForRepresentedObject:"); + //mixin ObjcBindMethod!(tokenField, "tokenField:hasMenuForRepresentedObject:"); + //mixin ObjcBindMethod!(tokenField, "tokenField:styleForRepresentedObject:"); + +`; + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSTokenFieldCell.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSTokenFieldCell.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,143 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSTokenFieldCell; + +import dstep.appkit.NSTextContainer; +import dstep.appkit.NSTextFieldCell; +import dstep.foundation.Foundation; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +alias NSUInteger NSTokenStyle; + +enum +{ + NSDefaultTokenStyle, + NSPlainTextTokenStyle, + NSRoundedTokenStyle +} + +class NSTokenFieldCell : NSTextFieldCell +{ + mixin (ObjcWrap); + + void setTokenStyle (uint style) + { + return invokeObjcSelf!(void, "setTokenStyle:", uint)(style); + } + + uint tokenStyle () + { + return invokeObjcSelf!(uint, "tokenStyle"); + } + + void setCompletionDelay (double delay) + { + return invokeObjcSelf!(void, "setCompletionDelay:", double)(delay); + } + + double completionDelay () + { + return invokeObjcSelf!(double, "completionDelay"); + } + + static double defaultCompletionDelay () + { + return invokeObjcSelfClass!(double, "defaultCompletionDelay"); + } + + void setTokenizingCharacterSet (NSCharacterSet characterSet) + { + return invokeObjcSelf!(void, "setTokenizingCharacterSet:", NSCharacterSet)(characterSet); + } + + NSCharacterSet tokenizingCharacterSet () + { + return invokeObjcSelf!(NSCharacterSet, "tokenizingCharacterSet"); + } + + static NSCharacterSet defaultTokenizingCharacterSet () + { + return invokeObjcSelfClass!(NSCharacterSet, "defaultTokenizingCharacterSet"); + } + + void setDelegate (Object anObject) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(anObject); + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } +} + +const TNSTokenFieldCellDelegate = ` + + NSArray tokenFieldCell (NSTokenFieldCell tokenFieldCell, NSString substring, NSInteger tokenIndex, NSInteger* selectedIndex) + { + return invokeObjcSelf!(NSArray, "tokenFieldCell:completionsForSubstring:indexOfToken:indexOfSelectedItem:", NSTokenFieldCell, NSString, NSInteger, NSInteger*)(tokenFieldCell, substring, tokenIndex, selectedIndex); + } + + NSArray tokenFieldCell (NSTokenFieldCell tokenFieldCell, NSArray tokens, NSUInteger index) + { + return invokeObjcSelf!(NSArray, "tokenFieldCell:shouldAddObjects:atIndex:", NSTokenFieldCell, NSArray, NSUInteger)(tokenFieldCell, tokens, index); + } + + NSString tokenFieldCell (NSTokenFieldCell tokenFieldCell, Object representedObject) + { + return invokeObjcSelf!(NSString, "tokenFieldCell:displayStringForRepresentedObject:", NSTokenFieldCell, Object)(tokenFieldCell, representedObject); + } + + NSString tokenFieldCell (NSTokenFieldCell tokenFieldCell, Object representedObject) + { + return invokeObjcSelf!(NSString, "tokenFieldCell:editingStringForRepresentedObject:", NSTokenFieldCell, Object)(tokenFieldCell, representedObject); + } + + Object tokenFieldCell (NSTokenFieldCell tokenFieldCell, NSString editingString) + { + return invokeObjcSelf!(Object, "tokenFieldCell:representedObjectForEditingString:", NSTokenFieldCell, NSString)(tokenFieldCell, editingString); + } + + bool tokenFieldCell (NSTokenFieldCell tokenFieldCell, NSArray objects, NSPasteboard pboard) + { + return invokeObjcSelf!(bool, "tokenFieldCell:writeRepresentedObjects:toPasteboard:", NSTokenFieldCell, NSArray, NSPasteboard)(tokenFieldCell, objects, pboard); + } + + NSArray tokenFieldCell (NSTokenFieldCell tokenFieldCell, NSPasteboard pboard) + { + return invokeObjcSelf!(NSArray, "tokenFieldCell:readFromPasteboard:", NSTokenFieldCell, NSPasteboard)(tokenFieldCell, pboard); + } + + NSMenu tokenFieldCell (NSTokenFieldCell tokenFieldCell, Object representedObject) + { + return invokeObjcSelf!(NSMenu, "tokenFieldCell:menuForRepresentedObject:", NSTokenFieldCell, Object)(tokenFieldCell, representedObject); + } + + bool tokenFieldCell (NSTokenFieldCell tokenFieldCell, Object representedObject) + { + return invokeObjcSelf!(bool, "tokenFieldCell:hasMenuForRepresentedObject:", NSTokenFieldCell, Object)(tokenFieldCell, representedObject); + } + + uint tokenFieldCell (NSTokenFieldCell tokenFieldCell, Object representedObject) + { + return invokeObjcSelf!(uint, "tokenFieldCell:styleForRepresentedObject:", NSTokenFieldCell, Object)(tokenFieldCell, representedObject); + } + + //mixin ObjcBindMethod!(tokenFieldCell, "tokenFieldCell:completionsForSubstring:indexOfToken:indexOfSelectedItem:"); + //mixin ObjcBindMethod!(tokenFieldCell, "tokenFieldCell:shouldAddObjects:atIndex:"); + //mixin ObjcBindMethod!(tokenFieldCell, "tokenFieldCell:displayStringForRepresentedObject:"); + //mixin ObjcBindMethod!(tokenFieldCell, "tokenFieldCell:editingStringForRepresentedObject:"); + //mixin ObjcBindMethod!(tokenFieldCell, "tokenFieldCell:representedObjectForEditingString:"); + //mixin ObjcBindMethod!(tokenFieldCell, "tokenFieldCell:writeRepresentedObjects:toPasteboard:"); + //mixin ObjcBindMethod!(tokenFieldCell, "tokenFieldCell:readFromPasteboard:"); + //mixin ObjcBindMethod!(tokenFieldCell, "tokenFieldCell:menuForRepresentedObject:"); + //mixin ObjcBindMethod!(tokenFieldCell, "tokenFieldCell:hasMenuForRepresentedObject:"); + //mixin ObjcBindMethod!(tokenFieldCell, "tokenFieldCell:styleForRepresentedObject:"); + +`; + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSToolbar.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSToolbar.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,254 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSToolbar; + +import dstep.appkit.AppKitDefines; +import dstep.appkit.NSToolbarItem; +import dstep.appkit.NSWindow; +import dstep.foundation.NSArray; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSNotification; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.appkit.NSToolbar_bindings; + +typedef NSUInteger NSToolbarDisplayMode; +typedef NSUInteger NSToolbarSizeMode; + +private +{ + NSString NSToolbarWillAddItemNotification_; + NSString NSToolbarDidRemoveItemNotification_; +} + +NSString NSToolbarWillAddItemNotification () +{ + if (NSToolbarWillAddItemNotification_) + return NSToolbarWillAddItemNotification_; + + return NSToolbarWillAddItemNotification_ = new NSString(bindings.NSToolbarWillAddItemNotification); +} + +NSString NSToolbarDidRemoveItemNotification () +{ + if (NSToolbarDidRemoveItemNotification_) + return NSToolbarDidRemoveItemNotification_; + + return NSToolbarDidRemoveItemNotification_ = new NSString(bindings.NSToolbarDidRemoveItemNotification); +} + +enum : NSUInteger +{ + NSToolbarDisplayModeDefault, + NSToolbarDisplayModeIconAndLabel, + NSToolbarDisplayModeIconOnly, + NSToolbarDisplayModeLabelOnly +} + +enum : NSUInteger +{ + NSToolbarSizeModeDefault, + NSToolbarSizeModeRegular, + NSToolbarSizeModeSmall +} + +class NSToolbar : NSObject +{ + mixin (ObjcWrap); + + NSToolbar initWithIdentifier (NSString identifier) + { + id result = invokeObjcSelf!(id, "initWithIdentifier:", NSString)(identifier); + return result is this.objcObject ? this : (result !is null ? new NSToolbar(result) : null); + } + + this (NSString identifier) + { + super(NSToolbar.alloc.initWithIdentifier(identifier).objcObject); + } + + void insertItemWithItemIdentifier (NSString itemIdentifier, NSInteger index) + { + return invokeObjcSelf!(void, "insertItemWithItemIdentifier:atIndex:", NSString, NSInteger)(itemIdentifier, index); + } + + void removeItemAtIndex (NSInteger index) + { + return invokeObjcSelf!(void, "removeItemAtIndex:", NSInteger)(index); + } + + void setDelegate (Object delegate_) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(delegate_); + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + void setVisible (bool shown) + { + return invokeObjcSelf!(void, "setVisible:", bool)(shown); + } + + bool isVisible () + { + return invokeObjcSelf!(bool, "isVisible"); + } + + void runCustomizationPalette (Object sender) + { + return invokeObjcSelf!(void, "runCustomizationPalette:", Object)(sender); + } + + bool customizationPaletteIsRunning () + { + return invokeObjcSelf!(bool, "customizationPaletteIsRunning"); + } + + void setDisplayMode (uint displayMode) + { + return invokeObjcSelf!(void, "setDisplayMode:", uint)(displayMode); + } + + uint displayMode () + { + return invokeObjcSelf!(uint, "displayMode"); + } + + void setSelectedItemIdentifier (NSString itemIdentifier) + { + return invokeObjcSelf!(void, "setSelectedItemIdentifier:", NSString)(itemIdentifier); + } + + NSString selectedItemIdentifier () + { + return invokeObjcSelf!(NSString, "selectedItemIdentifier"); + } + + void setSizeMode (uint sizeMode) + { + return invokeObjcSelf!(void, "setSizeMode:", uint)(sizeMode); + } + + uint sizeMode () + { + return invokeObjcSelf!(uint, "sizeMode"); + } + + void setShowsBaselineSeparator (bool flag) + { + return invokeObjcSelf!(void, "setShowsBaselineSeparator:", bool)(flag); + } + + bool showsBaselineSeparator () + { + return invokeObjcSelf!(bool, "showsBaselineSeparator"); + } + + void setAllowsUserCustomization (bool allowCustomization) + { + return invokeObjcSelf!(void, "setAllowsUserCustomization:", bool)(allowCustomization); + } + + bool allowsUserCustomization () + { + return invokeObjcSelf!(bool, "allowsUserCustomization"); + } + + NSString identifier () + { + return invokeObjcSelf!(NSString, "identifier"); + } + + NSArray items () + { + return invokeObjcSelf!(NSArray, "items"); + } + + NSArray visibleItems () + { + return invokeObjcSelf!(NSArray, "visibleItems"); + } + + void setAutosavesConfiguration (bool flag) + { + return invokeObjcSelf!(void, "setAutosavesConfiguration:", bool)(flag); + } + + bool autosavesConfiguration () + { + return invokeObjcSelf!(bool, "autosavesConfiguration"); + } + + void setConfigurationFromDictionary (NSDictionary configDict) + { + return invokeObjcSelf!(void, "setConfigurationFromDictionary:", NSDictionary)(configDict); + } + + NSDictionary configurationDictionary () + { + return invokeObjcSelf!(NSDictionary, "configurationDictionary"); + } + + void validateVisibleItems () + { + return invokeObjcSelf!(void, "validateVisibleItems"); + } +} + +const TNSToolbarDelegate = ` + + NSToolbarItem toolbar (NSToolbar toolbar, NSString itemIdentifier, bool flag) + { + return invokeObjcSelf!(NSToolbarItem, "toolbar:itemForItemIdentifier:willBeInsertedIntoToolbar:", NSToolbar, NSString, bool)(toolbar, itemIdentifier, flag); + } + + NSArray toolbarDefaultItemIdentifiers (NSToolbar toolbar) + { + return invokeObjcSelf!(NSArray, "toolbarDefaultItemIdentifiers:", NSToolbar)(toolbar); + } + + NSArray toolbarAllowedItemIdentifiers (NSToolbar toolbar) + { + return invokeObjcSelf!(NSArray, "toolbarAllowedItemIdentifiers:", NSToolbar)(toolbar); + } + + NSArray toolbarSelectableItemIdentifiers (NSToolbar toolbar) + { + return invokeObjcSelf!(NSArray, "toolbarSelectableItemIdentifiers:", NSToolbar)(toolbar); + } + + //mixin ObjcBindMethod!(toolbar, "toolbar:itemForItemIdentifier:willBeInsertedIntoToolbar:"); + //mixin ObjcBindMethod!(toolbarDefaultItemIdentifiers, "toolbarDefaultItemIdentifiers:"); + //mixin ObjcBindMethod!(toolbarAllowedItemIdentifiers, "toolbarAllowedItemIdentifiers:"); + //mixin ObjcBindMethod!(toolbarSelectableItemIdentifiers, "toolbarSelectableItemIdentifiers:"); + +`; + +const TNSToolbarNotifications = ` + + void toolbarWillAddItem (NSNotification notification) + { + return invokeObjcSelf!(void, "toolbarWillAddItem:", NSNotification)(notification); + } + + void toolbarDidRemoveItem (NSNotification notification) + { + return invokeObjcSelf!(void, "toolbarDidRemoveItem:", NSNotification)(notification); + } + + //mixin ObjcBindMethod!(toolbarWillAddItem, "toolbarWillAddItem:"); + //mixin ObjcBindMethod!(toolbarDidRemoveItem, "toolbarDidRemoveItem:"); + +`; + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSToolbarItem.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSToolbarItem.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,291 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSToolbarItem; + +import dstep.appkit.NSImage; +import dstep.appkit.NSMenuItem; +import dstep.appkit.NSText; +import dstep.appkit.NSToolbar; +import dstep.appkit.NSUserInterfaceValidation; +import dstep.appkit.NSView; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.appkit.NSToolbarItem_bindings; + +private +{ + NSString NSToolbarSeparatorItemIdentifier_; + NSString NSToolbarSpaceItemIdentifier_; + NSString NSToolbarFlexibleSpaceItemIdentifier_; + NSString NSToolbarShowColorsItemIdentifier_; + NSString NSToolbarShowFontsItemIdentifier_; + NSString NSToolbarCustomizeToolbarItemIdentifier_; + NSString NSToolbarPrintItemIdentifier_; +} + +NSString NSToolbarSeparatorItemIdentifier () +{ + if (NSToolbarSeparatorItemIdentifier_) + return NSToolbarSeparatorItemIdentifier_; + + return NSToolbarSeparatorItemIdentifier_ = new NSString(bindings.NSToolbarSeparatorItemIdentifier); +} + +NSString NSToolbarSpaceItemIdentifier () +{ + if (NSToolbarSpaceItemIdentifier_) + return NSToolbarSpaceItemIdentifier_; + + return NSToolbarSpaceItemIdentifier_ = new NSString(bindings.NSToolbarSpaceItemIdentifier); +} + +NSString NSToolbarFlexibleSpaceItemIdentifier () +{ + if (NSToolbarFlexibleSpaceItemIdentifier_) + return NSToolbarFlexibleSpaceItemIdentifier_; + + return NSToolbarFlexibleSpaceItemIdentifier_ = new NSString(bindings.NSToolbarFlexibleSpaceItemIdentifier); +} + +NSString NSToolbarShowColorsItemIdentifier () +{ + if (NSToolbarShowColorsItemIdentifier_) + return NSToolbarShowColorsItemIdentifier_; + + return NSToolbarShowColorsItemIdentifier_ = new NSString(bindings.NSToolbarShowColorsItemIdentifier); +} + +NSString NSToolbarShowFontsItemIdentifier () +{ + if (NSToolbarShowFontsItemIdentifier_) + return NSToolbarShowFontsItemIdentifier_; + + return NSToolbarShowFontsItemIdentifier_ = new NSString(bindings.NSToolbarShowFontsItemIdentifier); +} + +NSString NSToolbarCustomizeToolbarItemIdentifier () +{ + if (NSToolbarCustomizeToolbarItemIdentifier_) + return NSToolbarCustomizeToolbarItemIdentifier_; + + return NSToolbarCustomizeToolbarItemIdentifier_ = new NSString(bindings.NSToolbarCustomizeToolbarItemIdentifier); +} + +NSString NSToolbarPrintItemIdentifier () +{ + if (NSToolbarPrintItemIdentifier_) + return NSToolbarPrintItemIdentifier_; + + return NSToolbarPrintItemIdentifier_ = new NSString(bindings.NSToolbarPrintItemIdentifier); +} + +enum +{ + NSToolbarItemVisibilityPriorityStandard = 0, + NSToolbarItemVisibilityPriorityLow = -1000, + NSToolbarItemVisibilityPriorityHigh = 1000, + NSToolbarItemVisibilityPriorityUser = 2000 +} + +class NSToolbarItem : NSObject, INSCopying, INSValidatedUserInterfaceItem +{ + mixin (ObjcWrap); + + typeof(this) copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); + } + + NSToolbarItem initWithItemIdentifier (NSString itemIdentifier) + { + id result = invokeObjcSelf!(id, "initWithItemIdentifier:", NSString)(itemIdentifier); + return result is this.objcObject ? this : (result !is null ? new NSToolbarItem(result) : null); + } + + this (NSString itemIdentifier) + { + super(NSToolbarItem.alloc.initWithItemIdentifier(itemIdentifier).objcObject); + } + + NSString itemIdentifier () + { + return invokeObjcSelf!(NSString, "itemIdentifier"); + } + + NSToolbar toolbar () + { + return invokeObjcSelf!(NSToolbar, "toolbar"); + } + + void setLabel (NSString label) + { + return invokeObjcSelf!(void, "setLabel:", NSString)(label); + } + + NSString label () + { + return invokeObjcSelf!(NSString, "label"); + } + + void setPaletteLabel (NSString paletteLabel) + { + return invokeObjcSelf!(void, "setPaletteLabel:", NSString)(paletteLabel); + } + + NSString paletteLabel () + { + return invokeObjcSelf!(NSString, "paletteLabel"); + } + + void setToolTip (NSString toolTip) + { + return invokeObjcSelf!(void, "setToolTip:", NSString)(toolTip); + } + + NSString toolTip () + { + return invokeObjcSelf!(NSString, "toolTip"); + } + + void setMenuFormRepresentation (NSMenuItem menuItem) + { + return invokeObjcSelf!(void, "setMenuFormRepresentation:", NSMenuItem)(menuItem); + } + + NSMenuItem menuFormRepresentation () + { + return invokeObjcSelf!(NSMenuItem, "menuFormRepresentation"); + } + + void setTag (NSInteger tag) + { + return invokeObjcSelf!(void, "setTag:", NSInteger)(tag); + } + + NSInteger tag () + { + return invokeObjcSelf!(NSInteger, "tag"); + } + + void setTarget (Object target) + { + return invokeObjcSelf!(void, "setTarget:", Object)(target); + } + + Object target () + { + return invokeObjcSelf!(Object, "target"); + } + + void setAction (SEL action) + { + return invokeObjcSelf!(void, "setAction:", SEL)(action); + } + + SEL action () + { + return invokeObjcSelf!(SEL, "action"); + } + + void setEnabled (bool enabled) + { + return invokeObjcSelf!(void, "setEnabled:", bool)(enabled); + } + + bool isEnabled () + { + return invokeObjcSelf!(bool, "isEnabled"); + } + + void setImage (NSImage image) + { + return invokeObjcSelf!(void, "setImage:", NSImage)(image); + } + + NSImage image () + { + return invokeObjcSelf!(NSImage, "image"); + } + + void setView (NSView view) + { + return invokeObjcSelf!(void, "setView:", NSView)(view); + } + + NSView view () + { + return invokeObjcSelf!(NSView, "view"); + } + + void setMinSize (NSSize size) + { + return invokeObjcSelf!(void, "setMinSize:", NSSize)(size); + } + + NSSize minSize () + { + return invokeObjcSelf!(NSSize, "minSize"); + } + + void setMaxSize (NSSize size) + { + return invokeObjcSelf!(void, "setMaxSize:", NSSize)(size); + } + + NSSize maxSize () + { + return invokeObjcSelf!(NSSize, "maxSize"); + } + + void setVisibilityPriority (NSInteger visibilityPriority) + { + return invokeObjcSelf!(void, "setVisibilityPriority:", NSInteger)(visibilityPriority); + } + + NSInteger visibilityPriority () + { + return invokeObjcSelf!(NSInteger, "visibilityPriority"); + } + + void validate () + { + return invokeObjcSelf!(void, "validate"); + } + + void setAutovalidates (bool resistance) + { + return invokeObjcSelf!(void, "setAutovalidates:", bool)(resistance); + } + + bool autovalidates () + { + return invokeObjcSelf!(bool, "autovalidates"); + } + + bool allowsDuplicatesInToolbar () + { + return invokeObjcSelf!(bool, "allowsDuplicatesInToolbar"); + } +} + +const TNSToolbarItemValidation = ` + + bool validateToolbarItem (NSToolbarItem theItem) + { + return invokeObjcSelf!(bool, "validateToolbarItem:", NSToolbarItem)(theItem); + } + + //mixin ObjcBindMethod!(validateToolbarItem, "validateToolbarItem:"); + +`; + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSToolbarItemGroup.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSToolbarItemGroup.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,29 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSToolbarItemGroup; + +import dstep.appkit.AppKit; +import dstep.appkit.NSToolbarItem; +import dstep.foundation.Foundation; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSToolbarItemGroup : NSToolbarItem +{ + mixin (ObjcWrap); + + void setSubitems (NSArray subitems) + { + return invokeObjcSelf!(void, "setSubitems:", NSArray)(subitems); + } + + NSArray subitems () + { + return invokeObjcSelf!(NSArray, "subitems"); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSToolbarItem_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSToolbarItem_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,24 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSToolbarItem_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package id NSToolbarSeparatorItemIdentifier; + package id NSToolbarSpaceItemIdentifier; + package id NSToolbarFlexibleSpaceItemIdentifier; + package id NSToolbarShowColorsItemIdentifier; + package id NSToolbarShowFontsItemIdentifier; + package id NSToolbarCustomizeToolbarItemIdentifier; + package id NSToolbarPrintItemIdentifier; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSToolbar_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSToolbar_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,19 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSToolbar_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package id NSToolbarWillAddItemNotification; + package id NSToolbarDidRemoveItemNotification; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSTrackingArea.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSTrackingArea.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,98 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSTrackingArea; + +import dstep.foundation.NSCoder; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +alias NSUInteger NSTrackingAreaOptions; + +enum +{ + NSTrackingMouseEnteredAndExited = 0x01, + NSTrackingMouseMoved = 0x02, + NSTrackingCursorUpdate = 0x04 +} + +enum +{ + NSTrackingActiveWhenFirstResponder = 0x10, + NSTrackingActiveInKeyWindow = 0x20, + NSTrackingActiveInActiveApp = 0x40, + NSTrackingActiveAlways = 0x80 +} + +enum +{ + NSTrackingAssumeInside = 0x100, + NSTrackingInVisibleRect = 0x200, + NSTrackingEnabledDuringMouseDrag = 0x400 +} + +class NSTrackingArea : NSObject, INSCopying, INSCoding +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + typeof(this) copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); + } + + NSTrackingArea initWithRect (NSRect rect, uint options, Object owner, NSDictionary userInfo) + { + id result = invokeObjcSelf!(id, "initWithRect:options:owner:userInfo:", NSRect, uint, Object, NSDictionary)(rect, options, owner, userInfo); + return result is this.objcObject ? this : (result !is null ? new NSTrackingArea(result) : null); + } + + this (NSRect rect, uint options, Object owner, NSDictionary userInfo) + { + super(NSTrackingArea.alloc.initWithRect(rect, options, owner, userInfo).objcObject); + } + + NSRect rect () + { + return invokeObjcSelf!(NSRect, "rect"); + } + + uint options () + { + return invokeObjcSelf!(uint, "options"); + } + + Object owner () + { + return invokeObjcSelf!(Object, "owner"); + } + + NSDictionary userInfo () + { + return invokeObjcSelf!(NSDictionary, "userInfo"); + } + +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSTreeController.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSTreeController.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,246 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSTreeController; + +import dstep.appkit.NSObjectController; +import dstep.appkit.NSTreeNode; +import dstep.foundation.NSArray; +import dstep.foundation.NSIndexPath; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSTreeController : NSObjectController +{ + mixin (ObjcWrap); + + void rearrangeObjects () + { + return invokeObjcSelf!(void, "rearrangeObjects"); + } + + Object arrangedObjects () + { + return invokeObjcSelf!(Object, "arrangedObjects"); + } + + void setChildrenKeyPath (NSString keyPath) + { + return invokeObjcSelf!(void, "setChildrenKeyPath:", NSString)(keyPath); + } + + NSString childrenKeyPath () + { + return invokeObjcSelf!(NSString, "childrenKeyPath"); + } + + void setCountKeyPath (NSString keyPath) + { + return invokeObjcSelf!(void, "setCountKeyPath:", NSString)(keyPath); + } + + NSString countKeyPath () + { + return invokeObjcSelf!(NSString, "countKeyPath"); + } + + void setLeafKeyPath (NSString keyPath) + { + return invokeObjcSelf!(void, "setLeafKeyPath:", NSString)(keyPath); + } + + NSString leafKeyPath () + { + return invokeObjcSelf!(NSString, "leafKeyPath"); + } + + void setSortDescriptors (NSArray sortDescriptors) + { + return invokeObjcSelf!(void, "setSortDescriptors:", NSArray)(sortDescriptors); + } + + NSArray sortDescriptors () + { + return invokeObjcSelf!(NSArray, "sortDescriptors"); + } + + Object content () + { + return invokeObjcSelf!(Object, "content"); + } + + void setContent (Object content) + { + return invokeObjcSelf!(void, "setContent:", Object)(content); + } + + void add (Object sender) + { + return invokeObjcSelf!(void, "add:", Object)(sender); + } + + void remove (Object sender) + { + return invokeObjcSelf!(void, "remove:", Object)(sender); + } + + void addChild (Object sender) + { + return invokeObjcSelf!(void, "addChild:", Object)(sender); + } + + void insert (Object sender) + { + return invokeObjcSelf!(void, "insert:", Object)(sender); + } + + void insertChild (Object sender) + { + return invokeObjcSelf!(void, "insertChild:", Object)(sender); + } + + bool canInsert () + { + return invokeObjcSelf!(bool, "canInsert"); + } + + bool canInsertChild () + { + return invokeObjcSelf!(bool, "canInsertChild"); + } + + bool canAddChild () + { + return invokeObjcSelf!(bool, "canAddChild"); + } + + void insertObject (Object object, NSIndexPath indexPath) + { + return invokeObjcSelf!(void, "insertObject:atArrangedObjectIndexPath:", Object, NSIndexPath)(object, indexPath); + } + + void insertObjects (NSArray objects, NSArray indexPaths) + { + return invokeObjcSelf!(void, "insertObjects:atArrangedObjectIndexPaths:", NSArray, NSArray)(objects, indexPaths); + } + + void removeObjectAtArrangedObjectIndexPath (NSIndexPath indexPath) + { + return invokeObjcSelf!(void, "removeObjectAtArrangedObjectIndexPath:", NSIndexPath)(indexPath); + } + + void removeObjectsAtArrangedObjectIndexPaths (NSArray indexPaths) + { + return invokeObjcSelf!(void, "removeObjectsAtArrangedObjectIndexPaths:", NSArray)(indexPaths); + } + + void setAvoidsEmptySelection (bool flag) + { + return invokeObjcSelf!(void, "setAvoidsEmptySelection:", bool)(flag); + } + + bool avoidsEmptySelection () + { + return invokeObjcSelf!(bool, "avoidsEmptySelection"); + } + + void setPreservesSelection (bool flag) + { + return invokeObjcSelf!(void, "setPreservesSelection:", bool)(flag); + } + + bool preservesSelection () + { + return invokeObjcSelf!(bool, "preservesSelection"); + } + + void setSelectsInsertedObjects (bool flag) + { + return invokeObjcSelf!(void, "setSelectsInsertedObjects:", bool)(flag); + } + + bool selectsInsertedObjects () + { + return invokeObjcSelf!(bool, "selectsInsertedObjects"); + } + + void setAlwaysUsesMultipleValuesMarker (bool flag) + { + return invokeObjcSelf!(void, "setAlwaysUsesMultipleValuesMarker:", bool)(flag); + } + + bool alwaysUsesMultipleValuesMarker () + { + return invokeObjcSelf!(bool, "alwaysUsesMultipleValuesMarker"); + } + + NSArray selectedObjects () + { + return invokeObjcSelf!(NSArray, "selectedObjects"); + } + + bool setSelectionIndexPaths (NSArray indexPaths) + { + return invokeObjcSelf!(bool, "setSelectionIndexPaths:", NSArray)(indexPaths); + } + + NSArray selectionIndexPaths () + { + return invokeObjcSelf!(NSArray, "selectionIndexPaths"); + } + + bool setSelectionIndexPath (NSIndexPath indexPath) + { + return invokeObjcSelf!(bool, "setSelectionIndexPath:", NSIndexPath)(indexPath); + } + + NSIndexPath selectionIndexPath () + { + return invokeObjcSelf!(NSIndexPath, "selectionIndexPath"); + } + + bool addSelectionIndexPaths (NSArray indexPaths) + { + return invokeObjcSelf!(bool, "addSelectionIndexPaths:", NSArray)(indexPaths); + } + + bool removeSelectionIndexPaths (NSArray indexPaths) + { + return invokeObjcSelf!(bool, "removeSelectionIndexPaths:", NSArray)(indexPaths); + } + + NSArray selectedNodes () + { + return invokeObjcSelf!(NSArray, "selectedNodes"); + } + + void moveNode (NSTreeNode node, NSIndexPath indexPath) + { + return invokeObjcSelf!(void, "moveNode:toIndexPath:", NSTreeNode, NSIndexPath)(node, indexPath); + } + + void moveNodes (NSArray nodes, NSIndexPath startingIndexPath) + { + return invokeObjcSelf!(void, "moveNodes:toIndexPath:", NSArray, NSIndexPath)(nodes, startingIndexPath); + } + + NSString childrenKeyPathForNode (NSTreeNode node) + { + return invokeObjcSelf!(NSString, "childrenKeyPathForNode:", NSTreeNode)(node); + } + + NSString countKeyPathForNode (NSTreeNode node) + { + return invokeObjcSelf!(NSString, "countKeyPathForNode:", NSTreeNode)(node); + } + + NSString leafKeyPathForNode (NSTreeNode node) + { + return invokeObjcSelf!(NSString, "leafKeyPathForNode:", NSTreeNode)(node); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSTreeNode.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSTreeNode.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,78 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSTreeNode; + +import dstep.foundation.NSArray; +import dstep.appkit.NSTreeController; +import dstep.foundation.NSIndexPath; +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSTreeNode : NSObject +{ + mixin (ObjcWrap); + + static Object treeNodeWithRepresentedObject (Object modelObject) + { + return invokeObjcSelfClass!(Object, "treeNodeWithRepresentedObject:", Object)(modelObject); + } + + NSTreeNode initWithRepresentedObject (Object modelObject) + { + id result = invokeObjcSelf!(id, "initWithRepresentedObject:", Object)(modelObject); + return result is this.objcObject ? this : (result !is null ? new NSTreeNode(result) : null); + } + + this (Object modelObject) + { + super(NSTreeNode.alloc.initWithRepresentedObject(modelObject).objcObject); + } + + Object representedObject () + { + return invokeObjcSelf!(Object, "representedObject"); + } + + NSIndexPath indexPath () + { + return invokeObjcSelf!(NSIndexPath, "indexPath"); + } + + bool isLeaf () + { + return invokeObjcSelf!(bool, "isLeaf"); + } + + NSArray childNodes () + { + return invokeObjcSelf!(NSArray, "childNodes"); + } + + NSMutableArray mutableChildNodes () + { + return invokeObjcSelf!(NSMutableArray, "mutableChildNodes"); + } + + NSTreeNode descendantNodeAtIndexPath (NSIndexPath indexPath) + { + id result = invokeObjcSelf!(id, "descendantNodeAtIndexPath:", NSIndexPath)(indexPath); + return result is this.objcObject ? this : (result !is null ? new NSTreeNode(result) : null); + } + + NSTreeNode parentNode () + { + id result = invokeObjcSelf!(id, "parentNode"); + return result is this.objcObject ? this : (result !is null ? new NSTreeNode(result) : null); + } + + void sortWithSortDescriptors (NSArray sortDescriptors, bool recursively) + { + return invokeObjcSelf!(void, "sortWithSortDescriptors:recursively:", NSArray, bool)(sortDescriptors, recursively); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSTypesetter.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSTypesetter.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,472 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSTypesetter; + +import dstep.appkit.NSFont; +import dstep.appkit.NSLayoutManager; +import dstep.appkit.NSParagraphStyle; +import dstep.appkit.NSSimpleHorizontalTypesetter; +import dstep.appkit.NSTextContainer; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.corefoundation.CFCharacterSet; +import dstep.foundation.NSArray; +import dstep.foundation.NSAttributedString; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSRange; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +typedef NSUInteger NSTypesetterControlCharacterAction; + +enum : NSUInteger +{ + NSTypesetterZeroAdvancementAction = (1 << 0), + NSTypesetterWhitespaceAction = (1 << 1), + NSTypesetterHorizontalTabAction = (1 << 2), + NSTypesetterLineBreakAction = (1 << 3), + NSTypesetterParagraphBreakAction = (1 << 4), + NSTypesetterContainerBreakAction = (1 << 5) +} + +const TNSLayoutPhaseInterface = ` + + void willSetLineFragmentRect (NSRectPointer lineRect, NSRange glyphRange, NSRectPointer usedRect, CGFloat* baselineOffset) + { + return invokeObjcSelf!(void, "willSetLineFragmentRect:forGlyphRange:usedRect:baselineOffset:", NSRectPointer, NSRange, NSRectPointer, CGFloat*)(lineRect, glyphRange, usedRect, baselineOffset); + } + + bool shouldBreakLineByWordBeforeCharacterAtIndex (NSUInteger charIndex) + { + return invokeObjcSelf!(bool, "shouldBreakLineByWordBeforeCharacterAtIndex:", NSUInteger)(charIndex); + } + + bool shouldBreakLineByHyphenatingBeforeCharacterAtIndex (NSUInteger charIndex) + { + return invokeObjcSelf!(bool, "shouldBreakLineByHyphenatingBeforeCharacterAtIndex:", NSUInteger)(charIndex); + } + + float hyphenationFactorForGlyphAtIndex (NSUInteger glyphIndex) + { + return invokeObjcSelf!(float, "hyphenationFactorForGlyphAtIndex:", NSUInteger)(glyphIndex); + } + + uint hyphenCharacterForGlyphAtIndex (NSUInteger glyphIndex) + { + return invokeObjcSelf!(uint, "hyphenCharacterForGlyphAtIndex:", NSUInteger)(glyphIndex); + } + + NSRect boundingBoxForControlGlyphAtIndex (NSUInteger glyphIndex, NSTextContainer textContainer, NSRect proposedRect, NSPoint glyphPosition, NSUInteger charIndex) + { + return invokeObjcSelf!(NSRect, "boundingBoxForControlGlyphAtIndex:forTextContainer:proposedLineFragment:glyphPosition:characterIndex:", NSUInteger, NSTextContainer, NSRect, NSPoint, NSUInteger)(glyphIndex, textContainer, proposedRect, glyphPosition, charIndex); + } + + //mixin ObjcBindMethod!(willSetLineFragmentRect, "willSetLineFragmentRect:forGlyphRange:usedRect:baselineOffset:"); + //mixin ObjcBindMethod!(shouldBreakLineByWordBeforeCharacterAtIndex, "shouldBreakLineByWordBeforeCharacterAtIndex:"); + //mixin ObjcBindMethod!(shouldBreakLineByHyphenatingBeforeCharacterAtIndex, "shouldBreakLineByHyphenatingBeforeCharacterAtIndex:"); + //mixin ObjcBindMethod!(hyphenationFactorForGlyphAtIndex, "hyphenationFactorForGlyphAtIndex:"); + //mixin ObjcBindMethod!(hyphenCharacterForGlyphAtIndex, "hyphenCharacterForGlyphAtIndex:"); + //mixin ObjcBindMethod!(boundingBoxForControlGlyphAtIndex, "boundingBoxForControlGlyphAtIndex:forTextContainer:proposedLineFragment:glyphPosition:characterIndex:"); + +`; + +const TNSGlyphStorageInterface = ` + + NSRange characterRangeForGlyphRange (NSRange glyphRange, NSRangePointer actualGlyphRange) + { + return invokeObjcSelf!(NSRange, "characterRangeForGlyphRange:actualGlyphRange:", NSRange, NSRangePointer)(glyphRange, actualGlyphRange); + } + + NSRange glyphRangeForCharacterRange (NSRange charRange, NSRangePointer actualCharRange) + { + return invokeObjcSelf!(NSRange, "glyphRangeForCharacterRange:actualCharacterRange:", NSRange, NSRangePointer)(charRange, actualCharRange); + } + + NSUInteger getGlyphsInRange (NSRange glyphsRange, NSGlyph* glyphBuffer, NSUInteger* charIndexBuffer, NSGlyphInscription* inscribeBuffer, bool* elasticBuffer, char* bidiLevelBuffer) + { + return invokeObjcSelf!(NSUInteger, "getGlyphsInRange:glyphs:characterIndexes:glyphInscriptions:elasticBits:bidiLevels:", NSRange, NSGlyph*, NSUInteger*, NSGlyphInscription*, bool*, char*)(glyphsRange, glyphBuffer, charIndexBuffer, inscribeBuffer, elasticBuffer, bidiLevelBuffer); + } + + void getLineFragmentRect (NSRectPointer lineFragmentRect, NSRectPointer lineFragmentUsedRect, NSRectPointer remainingRect, NSUInteger startingGlyphIndex, NSRect proposedRect, CGFloat lineSpacing, CGFloat paragraphSpacingBefore, CGFloat paragraphSpacingAfter) + { + return invokeObjcSelf!(void, "getLineFragmentRect:usedRect:remainingRect:forStartingGlyphAtIndex:proposedRect:lineSpacing:paragraphSpacingBefore:paragraphSpacingAfter:", NSRectPointer, NSRectPointer, NSRectPointer, NSUInteger, NSRect, CGFloat, CGFloat, CGFloat)(lineFragmentRect, lineFragmentUsedRect, remainingRect, startingGlyphIndex, proposedRect, lineSpacing, paragraphSpacingBefore, paragraphSpacingAfter); + } + + void setLineFragmentRect (NSRect fragmentRect, NSRange glyphRange, NSRect usedRect, CGFloat baselineOffset) + { + return invokeObjcSelf!(void, "setLineFragmentRect:forGlyphRange:usedRect:baselineOffset:", NSRect, NSRange, NSRect, CGFloat)(fragmentRect, glyphRange, usedRect, baselineOffset); + } + + void substituteGlyphsInRange (NSRange glyphRange, NSGlyph* glyphs) + { + return invokeObjcSelf!(void, "substituteGlyphsInRange:withGlyphs:", NSRange, NSGlyph*)(glyphRange, glyphs); + } + + void insertGlyph (uint glyph, NSUInteger glyphIndex, NSUInteger characterIndex) + { + return invokeObjcSelf!(void, "insertGlyph:atGlyphIndex:characterIndex:", uint, NSUInteger, NSUInteger)(glyph, glyphIndex, characterIndex); + } + + void deleteGlyphsInRange (NSRange glyphRange) + { + return invokeObjcSelf!(void, "deleteGlyphsInRange:", NSRange)(glyphRange); + } + + void setNotShownAttribute (bool flag, NSRange glyphRange) + { + return invokeObjcSelf!(void, "setNotShownAttribute:forGlyphRange:", bool, NSRange)(flag, glyphRange); + } + + void setDrawsOutsideLineFragment (bool flag, NSRange glyphRange) + { + return invokeObjcSelf!(void, "setDrawsOutsideLineFragment:forGlyphRange:", bool, NSRange)(flag, glyphRange); + } + + void setLocation (NSPoint location, CGFloat* advancements, NSRange glyphRange) + { + return invokeObjcSelf!(void, "setLocation:withAdvancements:forStartOfGlyphRange:", NSPoint, CGFloat*, NSRange)(location, advancements, glyphRange); + } + + void setAttachmentSize (NSSize attachmentSize, NSRange glyphRange) + { + return invokeObjcSelf!(void, "setAttachmentSize:forGlyphRange:", NSSize, NSRange)(attachmentSize, glyphRange); + } + + void setBidiLevels (char* levels, NSRange glyphRange) + { + return invokeObjcSelf!(void, "setBidiLevels:forGlyphRange:", char*, NSRange)(levels, glyphRange); + } + + //mixin ObjcBindMethod!(characterRangeForGlyphRange, "characterRangeForGlyphRange:actualGlyphRange:"); + //mixin ObjcBindMethod!(glyphRangeForCharacterRange, "glyphRangeForCharacterRange:actualCharacterRange:"); + //mixin ObjcBindMethod!(getGlyphsInRange, "getGlyphsInRange:glyphs:characterIndexes:glyphInscriptions:elasticBits:bidiLevels:"); + //mixin ObjcBindMethod!(getLineFragmentRect, "getLineFragmentRect:usedRect:remainingRect:forStartingGlyphAtIndex:proposedRect:lineSpacing:paragraphSpacingBefore:paragraphSpacingAfter:"); + //mixin ObjcBindMethod!(setLineFragmentRect, "setLineFragmentRect:forGlyphRange:usedRect:baselineOffset:"); + //mixin ObjcBindMethod!(substituteGlyphsInRange, "substituteGlyphsInRange:withGlyphs:"); + //mixin ObjcBindMethod!(insertGlyph, "insertGlyph:atGlyphIndex:characterIndex:"); + //mixin ObjcBindMethod!(deleteGlyphsInRange, "deleteGlyphsInRange:"); + //mixin ObjcBindMethod!(setNotShownAttribute, "setNotShownAttribute:forGlyphRange:"); + //mixin ObjcBindMethod!(setDrawsOutsideLineFragment, "setDrawsOutsideLineFragment:forGlyphRange:"); + //mixin ObjcBindMethod!(setLocation, "setLocation:withAdvancements:forStartOfGlyphRange:"); + //mixin ObjcBindMethod!(setAttachmentSize, "setAttachmentSize:forGlyphRange:"); + //mixin ObjcBindMethod!(setBidiLevels, "setBidiLevels:forGlyphRange:"); + +`; + +class NSTypesetter : NSObject +{ + mixin (ObjcWrap); + + void getLineFragmentRect (NSRectPointer lineFragmentRect, NSRectPointer lineFragmentUsedRect, NSRange paragraphSeparatorGlyphRange, NSPoint lineOrigin) + { + return invokeObjcSelf!(void, "getLineFragmentRect:usedRect:forParagraphSeparatorGlyphRange:atProposedOrigin:", NSRectPointer, NSRectPointer, NSRange, NSPoint)(lineFragmentRect, lineFragmentUsedRect, paragraphSeparatorGlyphRange, lineOrigin); + } + + bool usesFontLeading () + { + return invokeObjcSelf!(bool, "usesFontLeading"); + } + + void setUsesFontLeading (bool flag) + { + return invokeObjcSelf!(void, "setUsesFontLeading:", bool)(flag); + } + + int typesetterBehavior () + { + return invokeObjcSelf!(int, "typesetterBehavior"); + } + + void setTypesetterBehavior (int behavior) + { + return invokeObjcSelf!(void, "setTypesetterBehavior:", int)(behavior); + } + + float hyphenationFactor () + { + return invokeObjcSelf!(float, "hyphenationFactor"); + } + + void setHyphenationFactor (float factor) + { + return invokeObjcSelf!(void, "setHyphenationFactor:", float)(factor); + } + + CGFloat lineFragmentPadding () + { + return invokeObjcSelf!(CGFloat, "lineFragmentPadding"); + } + + void setLineFragmentPadding (CGFloat padding) + { + return invokeObjcSelf!(void, "setLineFragmentPadding:", CGFloat)(padding); + } + + NSFont substituteFontForFont (NSFont originalFont) + { + return invokeObjcSelf!(NSFont, "substituteFontForFont:", NSFont)(originalFont); + } + + NSTextTab textTabForGlyphLocation (CGFloat glyphLocation, int direction, CGFloat maxLocation) + { + return invokeObjcSelf!(NSTextTab, "textTabForGlyphLocation:writingDirection:maxLocation:", CGFloat, int, CGFloat)(glyphLocation, direction, maxLocation); + } + + bool bidiProcessingEnabled () + { + return invokeObjcSelf!(bool, "bidiProcessingEnabled"); + } + + void setBidiProcessingEnabled (bool flag) + { + return invokeObjcSelf!(void, "setBidiProcessingEnabled:", bool)(flag); + } + + void setAttributedString (NSAttributedString attrString) + { + return invokeObjcSelf!(void, "setAttributedString:", NSAttributedString)(attrString); + } + + NSAttributedString attributedString () + { + return invokeObjcSelf!(NSAttributedString, "attributedString"); + } + + void setParagraphGlyphRange (NSRange paragraphRange, NSRange paragraphSeparatorRange) + { + return invokeObjcSelf!(void, "setParagraphGlyphRange:separatorGlyphRange:", NSRange, NSRange)(paragraphRange, paragraphSeparatorRange); + } + + NSRange paragraphGlyphRange () + { + return invokeObjcSelf!(NSRange, "paragraphGlyphRange"); + } + + NSRange paragraphSeparatorGlyphRange () + { + return invokeObjcSelf!(NSRange, "paragraphSeparatorGlyphRange"); + } + + NSRange paragraphCharacterRange () + { + return invokeObjcSelf!(NSRange, "paragraphCharacterRange"); + } + + NSRange paragraphSeparatorCharacterRange () + { + return invokeObjcSelf!(NSRange, "paragraphSeparatorCharacterRange"); + } + + NSUInteger layoutParagraphAtPoint (NSPointPointer lineFragmentOrigin) + { + return invokeObjcSelf!(NSUInteger, "layoutParagraphAtPoint:", NSPointPointer)(lineFragmentOrigin); + } + + void beginParagraph () + { + return invokeObjcSelf!(void, "beginParagraph"); + } + + void endParagraph () + { + return invokeObjcSelf!(void, "endParagraph"); + } + + void beginLineWithGlyphAtIndex (NSUInteger glyphIndex) + { + return invokeObjcSelf!(void, "beginLineWithGlyphAtIndex:", NSUInteger)(glyphIndex); + } + + void endLineWithGlyphRange (NSRange lineGlyphRange) + { + return invokeObjcSelf!(void, "endLineWithGlyphRange:", NSRange)(lineGlyphRange); + } + + CGFloat lineSpacingAfterGlyphAtIndex (NSUInteger glyphIndex, NSRect rect) + { + return invokeObjcSelf!(CGFloat, "lineSpacingAfterGlyphAtIndex:withProposedLineFragmentRect:", NSUInteger, NSRect)(glyphIndex, rect); + } + + CGFloat paragraphSpacingBeforeGlyphAtIndex (NSUInteger glyphIndex, NSRect rect) + { + return invokeObjcSelf!(CGFloat, "paragraphSpacingBeforeGlyphAtIndex:withProposedLineFragmentRect:", NSUInteger, NSRect)(glyphIndex, rect); + } + + CGFloat paragraphSpacingAfterGlyphAtIndex (NSUInteger glyphIndex, NSRect rect) + { + return invokeObjcSelf!(CGFloat, "paragraphSpacingAfterGlyphAtIndex:withProposedLineFragmentRect:", NSUInteger, NSRect)(glyphIndex, rect); + } + + NSDictionary attributesForExtraLineFragment () + { + return invokeObjcSelf!(NSDictionary, "attributesForExtraLineFragment"); + } + + uint actionForControlCharacterAtIndex (NSUInteger charIndex) + { + return invokeObjcSelf!(uint, "actionForControlCharacterAtIndex:", NSUInteger)(charIndex); + } + + NSLayoutManager layoutManager () + { + return invokeObjcSelf!(NSLayoutManager, "layoutManager"); + } + + NSArray textContainers () + { + return invokeObjcSelf!(NSArray, "textContainers"); + } + + NSTextContainer currentTextContainer () + { + return invokeObjcSelf!(NSTextContainer, "currentTextContainer"); + } + + NSParagraphStyle currentParagraphStyle () + { + return invokeObjcSelf!(NSParagraphStyle, "currentParagraphStyle"); + } + + void setHardInvalidation (bool flag, NSRange glyphRange) + { + return invokeObjcSelf!(void, "setHardInvalidation:forGlyphRange:", bool, NSRange)(flag, glyphRange); + } + + void layoutGlyphsInLayoutManager (NSLayoutManager layoutManager, NSUInteger startGlyphIndex, NSUInteger maxNumLines, NSUInteger* nextGlyph) + { + return invokeObjcSelf!(void, "layoutGlyphsInLayoutManager:startingAtGlyphIndex:maxNumberOfLineFragments:nextGlyphIndex:", NSLayoutManager, NSUInteger, NSUInteger, NSUInteger*)(layoutManager, startGlyphIndex, maxNumLines, nextGlyph); + } + + NSRange layoutCharactersInRange (NSRange characterRange, NSLayoutManager layoutManager, NSUInteger maxNumLines) + { + return invokeObjcSelf!(NSRange, "layoutCharactersInRange:forLayoutManager:maximumNumberOfLineFragments:", NSRange, NSLayoutManager, NSUInteger)(characterRange, layoutManager, maxNumLines); + } + + static NSSize printingAdjustmentInLayoutManager (NSLayoutManager layoutMgr, NSRange nominallySpacedGlyphsRange, char* packedGlyphs, NSUInteger packedGlyphsCount) + { + return invokeObjcSelfClass!(NSSize, "printingAdjustmentInLayoutManager:forNominallySpacedGlyphRange:packedGlyphs:count:", NSLayoutManager, NSRange, char*, NSUInteger)(layoutMgr, nominallySpacedGlyphsRange, packedGlyphs, packedGlyphsCount); + } + + CGFloat baselineOffsetInLayoutManager (NSLayoutManager layoutMgr, NSUInteger glyphIndex) + { + return invokeObjcSelf!(CGFloat, "baselineOffsetInLayoutManager:glyphIndex:", NSLayoutManager, NSUInteger)(layoutMgr, glyphIndex); + } + + static Object sharedSystemTypesetter () + { + return invokeObjcSelfClass!(Object, "sharedSystemTypesetter"); + } + + static Object sharedSystemTypesetterForBehavior (int theBehavior) + { + return invokeObjcSelfClass!(Object, "sharedSystemTypesetterForBehavior:", int)(theBehavior); + } + + static int defaultTypesetterBehavior () + { + return invokeObjcSelfClass!(int, "defaultTypesetterBehavior"); + } + + // NSLayoutPhaseInterface + void willSetLineFragmentRect (NSRectPointer lineRect, NSRange glyphRange, NSRectPointer usedRect, CGFloat* baselineOffset) + { + return invokeObjcSelf!(void, "willSetLineFragmentRect:forGlyphRange:usedRect:baselineOffset:", NSRectPointer, NSRange, NSRectPointer, CGFloat*)(lineRect, glyphRange, usedRect, baselineOffset); + } + + bool shouldBreakLineByWordBeforeCharacterAtIndex (NSUInteger charIndex) + { + return invokeObjcSelf!(bool, "shouldBreakLineByWordBeforeCharacterAtIndex:", NSUInteger)(charIndex); + } + + bool shouldBreakLineByHyphenatingBeforeCharacterAtIndex (NSUInteger charIndex) + { + return invokeObjcSelf!(bool, "shouldBreakLineByHyphenatingBeforeCharacterAtIndex:", NSUInteger)(charIndex); + } + + float hyphenationFactorForGlyphAtIndex (NSUInteger glyphIndex) + { + return invokeObjcSelf!(float, "hyphenationFactorForGlyphAtIndex:", NSUInteger)(glyphIndex); + } + + uint hyphenCharacterForGlyphAtIndex (NSUInteger glyphIndex) + { + return invokeObjcSelf!(uint, "hyphenCharacterForGlyphAtIndex:", NSUInteger)(glyphIndex); + } + + NSRect boundingBoxForControlGlyphAtIndex (NSUInteger glyphIndex, NSTextContainer textContainer, NSRect proposedRect, NSPoint glyphPosition, NSUInteger charIndex) + { + return invokeObjcSelf!(NSRect, "boundingBoxForControlGlyphAtIndex:forTextContainer:proposedLineFragment:glyphPosition:characterIndex:", NSUInteger, NSTextContainer, NSRect, NSPoint, NSUInteger)(glyphIndex, textContainer, proposedRect, glyphPosition, charIndex); + } + + // NSGlyphStorageInterface + NSRange characterRangeForGlyphRange (NSRange glyphRange, NSRangePointer actualGlyphRange) + { + return invokeObjcSelf!(NSRange, "characterRangeForGlyphRange:actualGlyphRange:", NSRange, NSRangePointer)(glyphRange, actualGlyphRange); + } + + NSRange glyphRangeForCharacterRange (NSRange charRange, NSRangePointer actualCharRange) + { + return invokeObjcSelf!(NSRange, "glyphRangeForCharacterRange:actualCharacterRange:", NSRange, NSRangePointer)(charRange, actualCharRange); + } + + NSUInteger getGlyphsInRange (NSRange glyphsRange, NSGlyph* glyphBuffer, NSUInteger* charIndexBuffer, NSGlyphInscription* inscribeBuffer, bool* elasticBuffer, char* bidiLevelBuffer) + { + return invokeObjcSelf!(NSUInteger, "getGlyphsInRange:glyphs:characterIndexes:glyphInscriptions:elasticBits:bidiLevels:", NSRange, NSGlyph*, NSUInteger*, NSGlyphInscription*, bool*, char*)(glyphsRange, glyphBuffer, charIndexBuffer, inscribeBuffer, elasticBuffer, bidiLevelBuffer); + } + + void getLineFragmentRect (NSRectPointer lineFragmentRect, NSRectPointer lineFragmentUsedRect, NSRectPointer remainingRect, NSUInteger startingGlyphIndex, NSRect proposedRect, CGFloat lineSpacing, CGFloat paragraphSpacingBefore, CGFloat paragraphSpacingAfter) + { + return invokeObjcSelf!(void, "getLineFragmentRect:usedRect:remainingRect:forStartingGlyphAtIndex:proposedRect:lineSpacing:paragraphSpacingBefore:paragraphSpacingAfter:", NSRectPointer, NSRectPointer, NSRectPointer, NSUInteger, NSRect, CGFloat, CGFloat, CGFloat)(lineFragmentRect, lineFragmentUsedRect, remainingRect, startingGlyphIndex, proposedRect, lineSpacing, paragraphSpacingBefore, paragraphSpacingAfter); + } + + void setLineFragmentRect (NSRect fragmentRect, NSRange glyphRange, NSRect usedRect, CGFloat baselineOffset) + { + return invokeObjcSelf!(void, "setLineFragmentRect:forGlyphRange:usedRect:baselineOffset:", NSRect, NSRange, NSRect, CGFloat)(fragmentRect, glyphRange, usedRect, baselineOffset); + } + + void substituteGlyphsInRange (NSRange glyphRange, NSGlyph* glyphs) + { + return invokeObjcSelf!(void, "substituteGlyphsInRange:withGlyphs:", NSRange, NSGlyph*)(glyphRange, glyphs); + } + + void insertGlyph (uint glyph, NSUInteger glyphIndex, NSUInteger characterIndex) + { + return invokeObjcSelf!(void, "insertGlyph:atGlyphIndex:characterIndex:", uint, NSUInteger, NSUInteger)(glyph, glyphIndex, characterIndex); + } + + void deleteGlyphsInRange (NSRange glyphRange) + { + return invokeObjcSelf!(void, "deleteGlyphsInRange:", NSRange)(glyphRange); + } + + void setNotShownAttribute (bool flag, NSRange glyphRange) + { + return invokeObjcSelf!(void, "setNotShownAttribute:forGlyphRange:", bool, NSRange)(flag, glyphRange); + } + + void setDrawsOutsideLineFragment (bool flag, NSRange glyphRange) + { + return invokeObjcSelf!(void, "setDrawsOutsideLineFragment:forGlyphRange:", bool, NSRange)(flag, glyphRange); + } + + void setLocation (NSPoint location, CGFloat* advancements, NSRange glyphRange) + { + return invokeObjcSelf!(void, "setLocation:withAdvancements:forStartOfGlyphRange:", NSPoint, CGFloat*, NSRange)(location, advancements, glyphRange); + } + + void setAttachmentSize (NSSize attachmentSize, NSRange glyphRange) + { + return invokeObjcSelf!(void, "setAttachmentSize:forGlyphRange:", NSSize, NSRange)(attachmentSize, glyphRange); + } + + void setBidiLevels (char* levels, NSRange glyphRange) + { + return invokeObjcSelf!(void, "setBidiLevels:forGlyphRange:", char*, NSRange)(levels, glyphRange); + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSUserDefaultsController.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSUserDefaultsController.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,91 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSUserDefaultsController; + +import dstep.appkit.NSController; +import dstep.foundation.NSUserDefaults; +import dstep.foundation.NSDictionary; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSUserDefaultsController : NSController +{ + mixin (ObjcWrap); + + static Object sharedUserDefaultsController () + { + return invokeObjcSelfClass!(Object, "sharedUserDefaultsController"); + } + + NSUserDefaultsController initWithDefaults (NSUserDefaults defaults, NSDictionary initialValues) + { + id result = invokeObjcSelf!(id, "initWithDefaults:initialValues:", NSUserDefaults, NSDictionary)(defaults, initialValues); + return result is this.objcObject ? this : (result !is null ? new NSUserDefaultsController(result) : null); + } + + this (NSUserDefaults defaults, NSDictionary initialValues) + { + super(NSUserDefaultsController.alloc.initWithDefaults(defaults, initialValues).objcObject); + } + + NSUserDefaults defaults () + { + return invokeObjcSelf!(NSUserDefaults, "defaults"); + } + + void setInitialValues (NSDictionary initialValues) + { + return invokeObjcSelf!(void, "setInitialValues:", NSDictionary)(initialValues); + } + + NSUserDefaultsController initialValues () + { + id result = invokeObjcSelf!(id, "initialValues"); + return result is this.objcObject ? this : (result !is null ? new NSUserDefaultsController(result) : null); + } + + this () + { + super(NSUserDefaultsController.alloc.initialValues.objcObject); + } + + void setAppliesImmediately (bool flag) + { + return invokeObjcSelf!(void, "setAppliesImmediately:", bool)(flag); + } + + bool appliesImmediately () + { + return invokeObjcSelf!(bool, "appliesImmediately"); + } + + bool hasUnappliedChanges () + { + return invokeObjcSelf!(bool, "hasUnappliedChanges"); + } + + Object values () + { + return invokeObjcSelf!(Object, "values"); + } + + void revert (Object sender) + { + return invokeObjcSelf!(void, "revert:", Object)(sender); + } + + void save (Object sender) + { + return invokeObjcSelf!(void, "save:", Object)(sender); + } + + void revertToInitialValues (Object sender) + { + return invokeObjcSelf!(void, "revertToInitialValues:", Object)(sender); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSUserInterfaceValidation.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSUserInterfaceValidation.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,25 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSUserInterfaceValidation; + +import dstep.appkit.AppKitDefines; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +interface INSValidatedUserInterfaceItem +{ + SEL action (); + NSInteger tag (); +} + +interface INSUserInterfaceValidations +{ + bool validateUserInterfaceItem (INSValidatedUserInterfaceItem anItem); +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSView.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSView.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,1373 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSView; + +import dstep.appkit.AppKitDefines; +import dstep.appkit.NSAnimation; +import dstep.appkit.NSAttributedString; +import dstep.appkit.NSBitmapImageRep; +import dstep.appkit.NSClipView; +import dstep.appkit.NSCursor; +import dstep.appkit.NSEvent; +import dstep.appkit.NSGraphics; +import dstep.appkit.NSGraphicsContext; +import dstep.appkit.NSImage; +import dstep.appkit.NSMenu; +import dstep.appkit.NSMenuItem; +import dstep.appkit.NSPasteboard; +import dstep.appkit.NSResponder; +import dstep.appkit.NSRulerMarker; +import dstep.appkit.NSRulerView; +import dstep.appkit.NSScreen; +import dstep.appkit.NSScrollView; +import dstep.appkit.NSShadow; +import dstep.appkit.NSTrackingArea; +import dstep.appkit.NSWindow; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSArray; +import dstep.foundation.NSAttributedString; +import dstep.foundation.NSData; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSRange; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.quartzcore.CALayer; +import dstep.quartzcore.CIFilter; + +import bindings = dstep.appkit.NSView_bindings; + +typedef NSUInteger NSBorderType; +typedef NSInteger NSTrackingRectTag; +typedef NSInteger NSToolTipTag; + +alias extern (C) NSComparisonResult function (id, id, void*) Compare; + +private +{ + NSString NSFullScreenModeAllScreens_; + NSString NSFullScreenModeSetting_; + NSString NSFullScreenModeWindowLevel_; + NSString NSViewFrameDidChangeNotification_; + NSString NSViewFocusDidChangeNotification_; + NSString NSViewBoundsDidChangeNotification_; + NSString NSViewGlobalFrameDidChangeNotification_; + NSString NSViewDidUpdateTrackingAreasNotification_; +} + +NSString NSFullScreenModeAllScreens () +{ + if (NSFullScreenModeAllScreens_) + return NSFullScreenModeAllScreens_; + + return NSFullScreenModeAllScreens_ = new NSString(bindings.NSFullScreenModeAllScreens); +} + +NSString NSFullScreenModeSetting () +{ + if (NSFullScreenModeSetting_) + return NSFullScreenModeSetting_; + + return NSFullScreenModeSetting_ = new NSString(bindings.NSFullScreenModeSetting); +} + +NSString NSFullScreenModeWindowLevel () +{ + if (NSFullScreenModeWindowLevel_) + return NSFullScreenModeWindowLevel_; + + return NSFullScreenModeWindowLevel_ = new NSString(bindings.NSFullScreenModeWindowLevel); +} + +NSString NSViewFrameDidChangeNotification () +{ + if (NSViewFrameDidChangeNotification_) + return NSViewFrameDidChangeNotification_; + + return NSViewFrameDidChangeNotification_ = new NSString(bindings.NSViewFrameDidChangeNotification); +} + +NSString NSViewFocusDidChangeNotification () +{ + if (NSViewFocusDidChangeNotification_) + return NSViewFocusDidChangeNotification_; + + return NSViewFocusDidChangeNotification_ = new NSString(bindings.NSViewFocusDidChangeNotification); +} + +NSString NSViewBoundsDidChangeNotification () +{ + if (NSViewBoundsDidChangeNotification_) + return NSViewBoundsDidChangeNotification_; + + return NSViewBoundsDidChangeNotification_ = new NSString(bindings.NSViewBoundsDidChangeNotification); +} + +NSString NSViewGlobalFrameDidChangeNotification () +{ + if (NSViewGlobalFrameDidChangeNotification_) + return NSViewGlobalFrameDidChangeNotification_; + + return NSViewGlobalFrameDidChangeNotification_ = new NSString(bindings.NSViewGlobalFrameDidChangeNotification); +} + +NSString NSViewDidUpdateTrackingAreasNotification () +{ + if (NSViewDidUpdateTrackingAreasNotification_) + return NSViewDidUpdateTrackingAreasNotification_; + + return NSViewDidUpdateTrackingAreasNotification_ = new NSString(bindings.NSViewDidUpdateTrackingAreasNotification); +} + +enum +{ + NSViewNotSizable = 0, + NSViewMinXMargin = 1, + NSViewWidthSizable = 2, + NSViewMaxXMargin = 4, + NSViewMinYMargin = 8, + NSViewHeightSizable = 16, + NSViewMaxYMargin = 32 +} + +enum : NSUInteger +{ + NSNoBorder = 0, + NSLineBorder = 1, + NSBezelBorder = 2, + NSGrooveBorder = 3 +} + +struct _VFlags +{ + uint aboutToResize; + uint retainCountOverMax; + uint retainCount; + uint interfaceStyle1; + uint specialArchiving; + uint needsDisplayForBounds; + uint interfaceStyle0; + uint removingWithoutInvalidation; + uint needsBoundsChangeNote; + uint boundsChangeNotesSuspended; + uint focusChangeNotesSuspended; + uint needsFrameChangeNote; + uint frameChangeNotesSuspended; + uint noVerticalAutosizing; + uint newGState; + uint validGState; + uint needsDisplay; + uint wantsGState; + uint autoresizeSubviews; + uint autosizing; + uint rotatedOrScaledFromBase; + uint rotatedFromBase; +} + +const TNSDrag = ` + + void dragImage (NSImage anImage, NSPoint viewLocation, NSSize initialOffset, NSEvent event, NSPasteboard pboard, Object sourceObj, bool slideFlag) + { + return invokeObjcSelf!(void, "dragImage:at:offset:event:pasteboard:source:slideBack:", NSImage, NSPoint, NSSize, NSEvent, NSPasteboard, Object, bool)(anImage, viewLocation, initialOffset, event, pboard, sourceObj, slideFlag); + } + + NSArray registeredDraggedTypes () + { + return invokeObjcSelf!(NSArray, "registeredDraggedTypes"); + } + + void registerForDraggedTypes (NSArray newTypes) + { + return invokeObjcSelf!(void, "registerForDraggedTypes:", NSArray)(newTypes); + } + + void unregisterDraggedTypes () + { + return invokeObjcSelf!(void, "unregisterDraggedTypes"); + } + + bool dragFile (NSString filename, NSRect rect, bool aFlag, NSEvent event) + { + return invokeObjcSelf!(bool, "dragFile:fromRect:slideBack:event:", NSString, NSRect, bool, NSEvent)(filename, rect, aFlag, event); + } + + bool dragPromisedFilesOfTypes (NSArray typeArray, NSRect rect, Object sourceObject, bool aFlag, NSEvent event) + { + return invokeObjcSelf!(bool, "dragPromisedFilesOfTypes:fromRect:source:slideBack:event:", NSArray, NSRect, Object, bool, NSEvent)(typeArray, rect, sourceObject, aFlag, event); + } + + //mixin ObjcBindMethod!(dragImage, "dragImage:at:offset:event:pasteboard:source:slideBack:"); + //mixin ObjcBindMethod!(registeredDraggedTypes, "registeredDraggedTypes"); + //mixin ObjcBindMethod!(registerForDraggedTypes, "registerForDraggedTypes:"); + //mixin ObjcBindMethod!(unregisterDraggedTypes, "unregisterDraggedTypes"); + //mixin ObjcBindMethod!(dragFile, "dragFile:fromRect:slideBack:event:"); + //mixin ObjcBindMethod!(dragPromisedFilesOfTypes, "dragPromisedFilesOfTypes:fromRect:source:slideBack:event:"); + +`; + +const TNSFullScreenMode = ` + + bool enterFullScreenMode (NSScreen screen, NSDictionary options) + { + return invokeObjcSelf!(bool, "enterFullScreenMode:withOptions:", NSScreen, NSDictionary)(screen, options); + } + + void exitFullScreenModeWithOptions (NSDictionary options) + { + return invokeObjcSelf!(void, "exitFullScreenModeWithOptions:", NSDictionary)(options); + } + + bool isInFullScreenMode () + { + return invokeObjcSelf!(bool, "isInFullScreenMode"); + } + + //mixin ObjcBindMethod!(enterFullScreenMode, "enterFullScreenMode:withOptions:"); + //mixin ObjcBindMethod!(exitFullScreenModeWithOptions, "exitFullScreenModeWithOptions:"); + //mixin ObjcBindMethod!(isInFullScreenMode, "isInFullScreenMode"); + +`; + +const TNSToolTipOwner = ` + + NSString view (NSView view, int tag, NSPoint point, void* data) + { + return invokeObjcSelf!(NSString, "view:stringForToolTip:point:userData:", NSView, int, NSPoint, void*)(view, tag, point, data); + } + + //mixin ObjcBindMethod!(view, "view:stringForToolTip:point:userData:"); + +`; + +const TNSPrinting = ` + + void writeEPSInsideRect (NSRect rect, NSPasteboard pasteboard) + { + return invokeObjcSelf!(void, "writeEPSInsideRect:toPasteboard:", NSRect, NSPasteboard)(rect, pasteboard); + } + + NSData dataWithEPSInsideRect (NSRect rect) + { + return invokeObjcSelf!(NSData, "dataWithEPSInsideRect:", NSRect)(rect); + } + + void writePDFInsideRect (NSRect rect, NSPasteboard pasteboard) + { + return invokeObjcSelf!(void, "writePDFInsideRect:toPasteboard:", NSRect, NSPasteboard)(rect, pasteboard); + } + + NSData dataWithPDFInsideRect (NSRect rect) + { + return invokeObjcSelf!(NSData, "dataWithPDFInsideRect:", NSRect)(rect); + } + + void print (Object sender) + { + return invokeObjcSelf!(void, "print:", Object)(sender); + } + + bool knowsPageRange (NSRangePointer range) + { + return invokeObjcSelf!(bool, "knowsPageRange:", NSRangePointer)(range); + } + + CGFloat heightAdjustLimit () + { + return invokeObjcSelf!(CGFloat, "heightAdjustLimit"); + } + + CGFloat widthAdjustLimit () + { + return invokeObjcSelf!(CGFloat, "widthAdjustLimit"); + } + + void adjustPageWidthNew (CGFloat* newRight, CGFloat oldLeft, CGFloat oldRight, CGFloat rightLimit) + { + return invokeObjcSelf!(void, "adjustPageWidthNew:left:right:limit:", CGFloat*, CGFloat, CGFloat, CGFloat)(newRight, oldLeft, oldRight, rightLimit); + } + + void adjustPageHeightNew (CGFloat* newBottom, CGFloat oldTop, CGFloat oldBottom, CGFloat bottomLimit) + { + return invokeObjcSelf!(void, "adjustPageHeightNew:top:bottom:limit:", CGFloat*, CGFloat, CGFloat, CGFloat)(newBottom, oldTop, oldBottom, bottomLimit); + } + + NSRect rectForPage (NSInteger page) + { + return invokeObjcSelf!(NSRect, "rectForPage:", NSInteger)(page); + } + + NSPoint locationOfPrintRect (NSRect aRect) + { + return invokeObjcSelf!(NSPoint, "locationOfPrintRect:", NSRect)(aRect); + } + + void drawPageBorderWithSize (NSSize borderSize) + { + return invokeObjcSelf!(void, "drawPageBorderWithSize:", NSSize)(borderSize); + } + + NSAttributedString pageHeader () + { + return invokeObjcSelf!(NSAttributedString, "pageHeader"); + } + + NSAttributedString pageFooter () + { + return invokeObjcSelf!(NSAttributedString, "pageFooter"); + } + + void drawSheetBorderWithSize (NSSize borderSize) + { + return invokeObjcSelf!(void, "drawSheetBorderWithSize:", NSSize)(borderSize); + } + + NSString printJobTitle () + { + return invokeObjcSelf!(NSString, "printJobTitle"); + } + + void beginDocument () + { + return invokeObjcSelf!(void, "beginDocument"); + } + + void endDocument () + { + return invokeObjcSelf!(void, "endDocument"); + } + + void beginPageInRect (NSRect aRect, NSPoint location) + { + return invokeObjcSelf!(void, "beginPageInRect:atPlacement:", NSRect, NSPoint)(aRect, location); + } + + void endPage () + { + return invokeObjcSelf!(void, "endPage"); + } + + //mixin ObjcBindMethod!(writeEPSInsideRect, "writeEPSInsideRect:toPasteboard:"); + //mixin ObjcBindMethod!(dataWithEPSInsideRect, "dataWithEPSInsideRect:"); + //mixin ObjcBindMethod!(writePDFInsideRect, "writePDFInsideRect:toPasteboard:"); + //mixin ObjcBindMethod!(dataWithPDFInsideRect, "dataWithPDFInsideRect:"); + //mixin ObjcBindMethod!(print, "print:"); + //mixin ObjcBindMethod!(knowsPageRange, "knowsPageRange:"); + //mixin ObjcBindMethod!(heightAdjustLimit, "heightAdjustLimit"); + //mixin ObjcBindMethod!(widthAdjustLimit, "widthAdjustLimit"); + //mixin ObjcBindMethod!(adjustPageWidthNew, "adjustPageWidthNew:left:right:limit:"); + //mixin ObjcBindMethod!(adjustPageHeightNew, "adjustPageHeightNew:top:bottom:limit:"); + //mixin ObjcBindMethod!(rectForPage, "rectForPage:"); + //mixin ObjcBindMethod!(locationOfPrintRect, "locationOfPrintRect:"); + //mixin ObjcBindMethod!(drawPageBorderWithSize, "drawPageBorderWithSize:"); + //mixin ObjcBindMethod!(pageHeader, "pageHeader"); + //mixin ObjcBindMethod!(pageFooter, "pageFooter"); + //mixin ObjcBindMethod!(drawSheetBorderWithSize, "drawSheetBorderWithSize:"); + //mixin ObjcBindMethod!(printJobTitle, "printJobTitle"); + //mixin ObjcBindMethod!(beginDocument, "beginDocument"); + //mixin ObjcBindMethod!(endDocument, "endDocument"); + //mixin ObjcBindMethod!(beginPageInRect, "beginPageInRect:atPlacement:"); + //mixin ObjcBindMethod!(endPage, "endPage"); + +`; + +class NSView : NSResponder +{ + mixin (ObjcWrap); + + NSView initWithFrame (NSRect frameRect) + { + id result = invokeObjcSelf!(id, "initWithFrame:", NSRect)(frameRect); + return result is this.objcObject ? this : (result !is null ? new NSView(result) : null); + } + + this (NSRect frameRect) + { + super(NSView.alloc.initWithFrame(frameRect).objcObject); + } + + NSWindow window () + { + return invokeObjcSelf!(NSWindow, "window"); + } + + NSView superview () + { + id result = invokeObjcSelf!(id, "superview"); + return result is this.objcObject ? this : (result !is null ? new NSView(result) : null); + } + + NSArray subviews () + { + return invokeObjcSelf!(NSArray, "subviews"); + } + + bool isDescendantOf (NSView aView) + { + return invokeObjcSelf!(bool, "isDescendantOf:", NSView)(aView); + } + + NSView ancestorSharedWithView (NSView aView) + { + id result = invokeObjcSelf!(id, "ancestorSharedWithView:", NSView)(aView); + return result is this.objcObject ? this : (result !is null ? new NSView(result) : null); + } + + NSView opaqueAncestor () + { + id result = invokeObjcSelf!(id, "opaqueAncestor"); + return result is this.objcObject ? this : (result !is null ? new NSView(result) : null); + } + + void setHidden (bool flag) + { + return invokeObjcSelf!(void, "setHidden:", bool)(flag); + } + + bool isHidden () + { + return invokeObjcSelf!(bool, "isHidden"); + } + + bool isHiddenOrHasHiddenAncestor () + { + return invokeObjcSelf!(bool, "isHiddenOrHasHiddenAncestor"); + } + + void getRectsBeingDrawn (out NSRect* rects, out NSInteger count) + { + return invokeObjcSelf!(void, "getRectsBeingDrawn:count:", NSRect**, NSInteger*)(&rects, &count); + } + + bool needsToDrawRect (NSRect aRect) + { + return invokeObjcSelf!(bool, "needsToDrawRect:", NSRect)(aRect); + } + + bool wantsDefaultClipping () + { + return invokeObjcSelf!(bool, "wantsDefaultClipping"); + } + + void viewDidHide () + { + return invokeObjcSelf!(void, "viewDidHide"); + } + + void viewDidUnhide () + { + return invokeObjcSelf!(void, "viewDidUnhide"); + } + + void setSubviews (NSArray newSubviews) + { + return invokeObjcSelf!(void, "setSubviews:", NSArray)(newSubviews); + } + + void addSubview (NSView aView) + { + return invokeObjcSelf!(void, "addSubview:", NSView)(aView); + } + + void addSubview (NSView aView, int place, NSView otherView) + { + return invokeObjcSelf!(void, "addSubview:positioned:relativeTo:", NSView, int, NSView)(aView, place, otherView); + } + + void sortSubviewsUsingFunction (Compare compare, void* context) + { + return invokeObjcSelf!(void, "sortSubviewsUsingFunction:context:", Compare, void*)(compare, context); + } + + void viewWillMoveToWindow (NSWindow newWindow) + { + return invokeObjcSelf!(void, "viewWillMoveToWindow:", NSWindow)(newWindow); + } + + void viewDidMoveToWindow () + { + return invokeObjcSelf!(void, "viewDidMoveToWindow"); + } + + void viewWillMoveToSuperview (NSView newSuperview) + { + return invokeObjcSelf!(void, "viewWillMoveToSuperview:", NSView)(newSuperview); + } + + void viewDidMoveToSuperview () + { + return invokeObjcSelf!(void, "viewDidMoveToSuperview"); + } + + void didAddSubview (NSView subview) + { + return invokeObjcSelf!(void, "didAddSubview:", NSView)(subview); + } + + void willRemoveSubview (NSView subview) + { + return invokeObjcSelf!(void, "willRemoveSubview:", NSView)(subview); + } + + void removeFromSuperview () + { + return invokeObjcSelf!(void, "removeFromSuperview"); + } + + void replaceSubview (NSView oldView, NSView newView) + { + return invokeObjcSelf!(void, "replaceSubview:with:", NSView, NSView)(oldView, newView); + } + + void removeFromSuperviewWithoutNeedingDisplay () + { + return invokeObjcSelf!(void, "removeFromSuperviewWithoutNeedingDisplay"); + } + + void setPostsFrameChangedNotifications (bool flag) + { + return invokeObjcSelf!(void, "setPostsFrameChangedNotifications:", bool)(flag); + } + + bool postsFrameChangedNotifications () + { + return invokeObjcSelf!(bool, "postsFrameChangedNotifications"); + } + + void resizeSubviewsWithOldSize (NSSize oldSize) + { + return invokeObjcSelf!(void, "resizeSubviewsWithOldSize:", NSSize)(oldSize); + } + + void resizeWithOldSuperviewSize (NSSize oldSize) + { + return invokeObjcSelf!(void, "resizeWithOldSuperviewSize:", NSSize)(oldSize); + } + + void setAutoresizesSubviews (bool flag) + { + return invokeObjcSelf!(void, "setAutoresizesSubviews:", bool)(flag); + } + + bool autoresizesSubviews () + { + return invokeObjcSelf!(bool, "autoresizesSubviews"); + } + + void setAutoresizingMask (NSUInteger mask) + { + return invokeObjcSelf!(void, "setAutoresizingMask:", NSUInteger)(mask); + } + + NSUInteger autoresizingMask () + { + return invokeObjcSelf!(NSUInteger, "autoresizingMask"); + } + + void setFrameOrigin (NSPoint newOrigin) + { + return invokeObjcSelf!(void, "setFrameOrigin:", NSPoint)(newOrigin); + } + + void setFrameSize (NSSize newSize) + { + return invokeObjcSelf!(void, "setFrameSize:", NSSize)(newSize); + } + + void setFrame (NSRect frameRect) + { + return invokeObjcSelf!(void, "setFrame:", NSRect)(frameRect); + } + + NSRect frame () + { + return invokeObjcSelf!(NSRect, "frame"); + } + + void setFrameRotation (CGFloat angle) + { + return invokeObjcSelf!(void, "setFrameRotation:", CGFloat)(angle); + } + + CGFloat frameRotation () + { + return invokeObjcSelf!(CGFloat, "frameRotation"); + } + + void setFrameCenterRotation (CGFloat angle) + { + return invokeObjcSelf!(void, "setFrameCenterRotation:", CGFloat)(angle); + } + + CGFloat frameCenterRotation () + { + return invokeObjcSelf!(CGFloat, "frameCenterRotation"); + } + + void setBoundsOrigin (NSPoint newOrigin) + { + return invokeObjcSelf!(void, "setBoundsOrigin:", NSPoint)(newOrigin); + } + + void setBoundsSize (NSSize newSize) + { + return invokeObjcSelf!(void, "setBoundsSize:", NSSize)(newSize); + } + + void setBoundsRotation (CGFloat angle) + { + return invokeObjcSelf!(void, "setBoundsRotation:", CGFloat)(angle); + } + + CGFloat boundsRotation () + { + return invokeObjcSelf!(CGFloat, "boundsRotation"); + } + + void translateOriginToPoint (NSPoint translation) + { + return invokeObjcSelf!(void, "translateOriginToPoint:", NSPoint)(translation); + } + + void scaleUnitSquareToSize (NSSize newUnitSize) + { + return invokeObjcSelf!(void, "scaleUnitSquareToSize:", NSSize)(newUnitSize); + } + + void rotateByAngle (CGFloat angle) + { + return invokeObjcSelf!(void, "rotateByAngle:", CGFloat)(angle); + } + + void setBounds (NSRect aRect) + { + return invokeObjcSelf!(void, "setBounds:", NSRect)(aRect); + } + + NSRect bounds () + { + return invokeObjcSelf!(NSRect, "bounds"); + } + + bool isFlipped () + { + return invokeObjcSelf!(bool, "isFlipped"); + } + + bool isRotatedFromBase () + { + return invokeObjcSelf!(bool, "isRotatedFromBase"); + } + + bool isRotatedOrScaledFromBase () + { + return invokeObjcSelf!(bool, "isRotatedOrScaledFromBase"); + } + + bool isOpaque () + { + return invokeObjcSelf!(bool, "isOpaque"); + } + + NSPoint convertPoint (NSPoint aPoint, NSView aView) + { + return invokeObjcSelf!(NSPoint, "convertPoint:fromView:", NSPoint, NSView)(aPoint, aView); + } + + NSPoint convertPoint (NSPoint aPoint, NSView aView) + { + return invokeObjcSelf!(NSPoint, "convertPoint:toView:", NSPoint, NSView)(aPoint, aView); + } + + NSSize convertSize (NSSize aSize, NSView aView) + { + return invokeObjcSelf!(NSSize, "convertSize:fromView:", NSSize, NSView)(aSize, aView); + } + + NSSize convertSize (NSSize aSize, NSView aView) + { + return invokeObjcSelf!(NSSize, "convertSize:toView:", NSSize, NSView)(aSize, aView); + } + + NSRect convertRect (NSRect aRect, NSView aView) + { + return invokeObjcSelf!(NSRect, "convertRect:fromView:", NSRect, NSView)(aRect, aView); + } + + NSRect convertRect (NSRect aRect, NSView aView) + { + return invokeObjcSelf!(NSRect, "convertRect:toView:", NSRect, NSView)(aRect, aView); + } + + NSRect centerScanRect (NSRect aRect) + { + return invokeObjcSelf!(NSRect, "centerScanRect:", NSRect)(aRect); + } + + NSPoint convertPointToBase (NSPoint aPoint) + { + return invokeObjcSelf!(NSPoint, "convertPointToBase:", NSPoint)(aPoint); + } + + NSPoint convertPointFromBase (NSPoint aPoint) + { + return invokeObjcSelf!(NSPoint, "convertPointFromBase:", NSPoint)(aPoint); + } + + NSSize convertSizeToBase (NSSize aSize) + { + return invokeObjcSelf!(NSSize, "convertSizeToBase:", NSSize)(aSize); + } + + NSSize convertSizeFromBase (NSSize aSize) + { + return invokeObjcSelf!(NSSize, "convertSizeFromBase:", NSSize)(aSize); + } + + NSRect convertRectToBase (NSRect aRect) + { + return invokeObjcSelf!(NSRect, "convertRectToBase:", NSRect)(aRect); + } + + NSRect convertRectFromBase (NSRect aRect) + { + return invokeObjcSelf!(NSRect, "convertRectFromBase:", NSRect)(aRect); + } + + bool canDraw () + { + return invokeObjcSelf!(bool, "canDraw"); + } + + void setNeedsDisplay (bool flag) + { + return invokeObjcSelf!(void, "setNeedsDisplay:", bool)(flag); + } + + void setNeedsDisplayInRect (NSRect invalidRect) + { + return invokeObjcSelf!(void, "setNeedsDisplayInRect:", NSRect)(invalidRect); + } + + bool needsDisplay () + { + return invokeObjcSelf!(bool, "needsDisplay"); + } + + void lockFocus () + { + return invokeObjcSelf!(void, "lockFocus"); + } + + void unlockFocus () + { + return invokeObjcSelf!(void, "unlockFocus"); + } + + bool lockFocusIfCanDraw () + { + return invokeObjcSelf!(bool, "lockFocusIfCanDraw"); + } + + bool lockFocusIfCanDrawInContext (NSGraphicsContext context) + { + return invokeObjcSelf!(bool, "lockFocusIfCanDrawInContext:", NSGraphicsContext)(context); + } + + static NSView focusView () + { + return invokeObjcSelfClass!(NSView, "focusView"); + } + + NSRect visibleRect () + { + return invokeObjcSelf!(NSRect, "visibleRect"); + } + + void display () + { + return invokeObjcSelf!(void, "display"); + } + + void displayIfNeeded () + { + return invokeObjcSelf!(void, "displayIfNeeded"); + } + + void displayIfNeededIgnoringOpacity () + { + return invokeObjcSelf!(void, "displayIfNeededIgnoringOpacity"); + } + + void displayRect (NSRect rect) + { + return invokeObjcSelf!(void, "displayRect:", NSRect)(rect); + } + + void displayIfNeededInRect (NSRect rect) + { + return invokeObjcSelf!(void, "displayIfNeededInRect:", NSRect)(rect); + } + + void displayRectIgnoringOpacity (NSRect rect) + { + return invokeObjcSelf!(void, "displayRectIgnoringOpacity:", NSRect)(rect); + } + + void displayIfNeededInRectIgnoringOpacity (NSRect rect) + { + return invokeObjcSelf!(void, "displayIfNeededInRectIgnoringOpacity:", NSRect)(rect); + } + + void drawRect (NSRect rect) + { + return invokeObjcSelf!(void, "drawRect:", NSRect)(rect); + } + + void displayRectIgnoringOpacity (NSRect aRect, NSGraphicsContext context) + { + return invokeObjcSelf!(void, "displayRectIgnoringOpacity:inContext:", NSRect, NSGraphicsContext)(aRect, context); + } + + NSBitmapImageRep bitmapImageRepForCachingDisplayInRect (NSRect rect) + { + return invokeObjcSelf!(NSBitmapImageRep, "bitmapImageRepForCachingDisplayInRect:", NSRect)(rect); + } + + void cacheDisplayInRect (NSRect rect, NSBitmapImageRep bitmapImageRep) + { + return invokeObjcSelf!(void, "cacheDisplayInRect:toBitmapImageRep:", NSRect, NSBitmapImageRep)(rect, bitmapImageRep); + } + + void viewWillDraw () + { + return invokeObjcSelf!(void, "viewWillDraw"); + } + + NSInteger gState () + { + return invokeObjcSelf!(NSInteger, "gState"); + } + + void releaseGState () + { + return invokeObjcSelf!(void, "releaseGState"); + } + + void setUpGState () + { + return invokeObjcSelf!(void, "setUpGState"); + } + + void renewGState () + { + return invokeObjcSelf!(void, "renewGState"); + } + + void scrollPoint (NSPoint aPoint) + { + return invokeObjcSelf!(void, "scrollPoint:", NSPoint)(aPoint); + } + + bool scrollRectToVisible (NSRect aRect) + { + return invokeObjcSelf!(bool, "scrollRectToVisible:", NSRect)(aRect); + } + + bool autoscroll (NSEvent theEvent) + { + return invokeObjcSelf!(bool, "autoscroll:", NSEvent)(theEvent); + } + + NSRect adjustScroll (NSRect newVisible) + { + return invokeObjcSelf!(NSRect, "adjustScroll:", NSRect)(newVisible); + } + + void scrollRect (NSRect aRect, NSSize delta) + { + return invokeObjcSelf!(void, "scrollRect:by:", NSRect, NSSize)(aRect, delta); + } + + void translateRectsNeedingDisplayInRect (NSRect clipRect, NSSize delta) + { + return invokeObjcSelf!(void, "translateRectsNeedingDisplayInRect:by:", NSRect, NSSize)(clipRect, delta); + } + + NSView hitTest (NSPoint aPoint) + { + id result = invokeObjcSelf!(id, "hitTest:", NSPoint)(aPoint); + return result is this.objcObject ? this : (result !is null ? new NSView(result) : null); + } + + bool mouse (NSPoint aPoint, NSRect aRect) + { + return invokeObjcSelf!(bool, "mouse:inRect:", NSPoint, NSRect)(aPoint, aRect); + } + + Object viewWithTag (NSInteger aTag) + { + return invokeObjcSelf!(Object, "viewWithTag:", NSInteger)(aTag); + } + + NSInteger tag () + { + return invokeObjcSelf!(NSInteger, "tag"); + } + + bool performKeyEquivalent (NSEvent theEvent) + { + return invokeObjcSelf!(bool, "performKeyEquivalent:", NSEvent)(theEvent); + } + + bool acceptsFirstMouse (NSEvent theEvent) + { + return invokeObjcSelf!(bool, "acceptsFirstMouse:", NSEvent)(theEvent); + } + + bool shouldDelayWindowOrderingForEvent (NSEvent theEvent) + { + return invokeObjcSelf!(bool, "shouldDelayWindowOrderingForEvent:", NSEvent)(theEvent); + } + + bool needsPanelToBecomeKey () + { + return invokeObjcSelf!(bool, "needsPanelToBecomeKey"); + } + + bool mouseDownCanMoveWindow () + { + return invokeObjcSelf!(bool, "mouseDownCanMoveWindow"); + } + + void addCursorRect (NSRect aRect, NSCursor anObj) + { + return invokeObjcSelf!(void, "addCursorRect:cursor:", NSRect, NSCursor)(aRect, anObj); + } + + void removeCursorRect (NSRect aRect, NSCursor anObj) + { + return invokeObjcSelf!(void, "removeCursorRect:cursor:", NSRect, NSCursor)(aRect, anObj); + } + + void discardCursorRects () + { + return invokeObjcSelf!(void, "discardCursorRects"); + } + + void resetCursorRects () + { + return invokeObjcSelf!(void, "resetCursorRects"); + } + + int addTrackingRect (NSRect aRect, Object anObject, void* data, bool flag) + { + return invokeObjcSelf!(int, "addTrackingRect:owner:userData:assumeInside:", NSRect, Object, void*, bool)(aRect, anObject, data, flag); + } + + void removeTrackingRect (int tag) + { + return invokeObjcSelf!(void, "removeTrackingRect:", int)(tag); + } + + void setWantsLayer (bool flag) + { + return invokeObjcSelf!(void, "setWantsLayer:", bool)(flag); + } + + bool wantsLayer () + { + return invokeObjcSelf!(bool, "wantsLayer"); + } + + void setLayer (CALayer newLayer) + { + return invokeObjcSelf!(void, "setLayer:", CALayer)(newLayer); + } + + CALayer layer () + { + return invokeObjcSelf!(CALayer, "layer"); + } + + void setAlphaValue (CGFloat viewAlpha) + { + return invokeObjcSelf!(void, "setAlphaValue:", CGFloat)(viewAlpha); + } + + CGFloat alphaValue () + { + return invokeObjcSelf!(CGFloat, "alphaValue"); + } + + void setBackgroundFilters (NSArray filters) + { + return invokeObjcSelf!(void, "setBackgroundFilters:", NSArray)(filters); + } + + NSArray backgroundFilters () + { + return invokeObjcSelf!(NSArray, "backgroundFilters"); + } + + void setCompositingFilter (CIFilter filter) + { + return invokeObjcSelf!(void, "setCompositingFilter:", CIFilter)(filter); + } + + CIFilter compositingFilter () + { + return invokeObjcSelf!(CIFilter, "compositingFilter"); + } + + void setContentFilters (NSArray filters) + { + return invokeObjcSelf!(void, "setContentFilters:", NSArray)(filters); + } + + NSArray contentFilters () + { + return invokeObjcSelf!(NSArray, "contentFilters"); + } + + void setShadow (NSShadow shadow) + { + return invokeObjcSelf!(void, "setShadow:", NSShadow)(shadow); + } + + NSShadow shadow () + { + return invokeObjcSelf!(NSShadow, "shadow"); + } + + void addTrackingArea (NSTrackingArea trackingArea) + { + return invokeObjcSelf!(void, "addTrackingArea:", NSTrackingArea)(trackingArea); + } + + void removeTrackingArea (NSTrackingArea trackingArea) + { + return invokeObjcSelf!(void, "removeTrackingArea:", NSTrackingArea)(trackingArea); + } + + NSArray trackingAreas () + { + return invokeObjcSelf!(NSArray, "trackingAreas"); + } + + void updateTrackingAreas () + { + return invokeObjcSelf!(void, "updateTrackingAreas"); + } + + bool shouldDrawColor () + { + return invokeObjcSelf!(bool, "shouldDrawColor"); + } + + void setPostsBoundsChangedNotifications (bool flag) + { + return invokeObjcSelf!(void, "setPostsBoundsChangedNotifications:", bool)(flag); + } + + bool postsBoundsChangedNotifications () + { + return invokeObjcSelf!(bool, "postsBoundsChangedNotifications"); + } + + NSScrollView enclosingScrollView () + { + return invokeObjcSelf!(NSScrollView, "enclosingScrollView"); + } + + NSMenu menuForEvent (NSEvent event) + { + return invokeObjcSelf!(NSMenu, "menuForEvent:", NSEvent)(event); + } + + static NSMenu defaultMenu () + { + return invokeObjcSelfClass!(NSMenu, "defaultMenu"); + } + + void setToolTip (NSString string) + { + return invokeObjcSelf!(void, "setToolTip:", NSString)(string); + } + + NSString toolTip () + { + return invokeObjcSelf!(NSString, "toolTip"); + } + + int addToolTipRect (NSRect aRect, Object anObject, void* data) + { + return invokeObjcSelf!(int, "addToolTipRect:owner:userData:", NSRect, Object, void*)(aRect, anObject, data); + } + + void removeToolTip (int tag) + { + return invokeObjcSelf!(void, "removeToolTip:", int)(tag); + } + + void removeAllToolTips () + { + return invokeObjcSelf!(void, "removeAllToolTips"); + } + + void viewWillStartLiveResize () + { + return invokeObjcSelf!(void, "viewWillStartLiveResize"); + } + + void viewDidEndLiveResize () + { + return invokeObjcSelf!(void, "viewDidEndLiveResize"); + } + + bool inLiveResize () + { + return invokeObjcSelf!(bool, "inLiveResize"); + } + + bool preservesContentDuringLiveResize () + { + return invokeObjcSelf!(bool, "preservesContentDuringLiveResize"); + } + + NSRect rectPreservedDuringLiveResize () + { + return invokeObjcSelf!(NSRect, "rectPreservedDuringLiveResize"); + } + + void getRectsExposedDuringLiveResize (NSRect* exposedRects, NSInteger* count) + { + return invokeObjcSelf!(void, "getRectsExposedDuringLiveResize:count:", NSRect*, NSInteger*)(exposedRects, count); + } + + // NSDrag + void dragImage (NSImage anImage, NSPoint viewLocation, NSSize initialOffset, NSEvent event, NSPasteboard pboard, Object sourceObj, bool slideFlag) + { + return invokeObjcSelf!(void, "dragImage:at:offset:event:pasteboard:source:slideBack:", NSImage, NSPoint, NSSize, NSEvent, NSPasteboard, Object, bool)(anImage, viewLocation, initialOffset, event, pboard, sourceObj, slideFlag); + } + + NSArray registeredDraggedTypes () + { + return invokeObjcSelf!(NSArray, "registeredDraggedTypes"); + } + + void registerForDraggedTypes (NSArray newTypes) + { + return invokeObjcSelf!(void, "registerForDraggedTypes:", NSArray)(newTypes); + } + + void unregisterDraggedTypes () + { + return invokeObjcSelf!(void, "unregisterDraggedTypes"); + } + + bool dragFile (NSString filename, NSRect rect, bool aFlag, NSEvent event) + { + return invokeObjcSelf!(bool, "dragFile:fromRect:slideBack:event:", NSString, NSRect, bool, NSEvent)(filename, rect, aFlag, event); + } + + bool dragPromisedFilesOfTypes (NSArray typeArray, NSRect rect, Object sourceObject, bool aFlag, NSEvent event) + { + return invokeObjcSelf!(bool, "dragPromisedFilesOfTypes:fromRect:source:slideBack:event:", NSArray, NSRect, Object, bool, NSEvent)(typeArray, rect, sourceObject, aFlag, event); + } + + // NSFullScreenMode + bool enterFullScreenMode (NSScreen screen, NSDictionary options) + { + return invokeObjcSelf!(bool, "enterFullScreenMode:withOptions:", NSScreen, NSDictionary)(screen, options); + } + + void exitFullScreenModeWithOptions (NSDictionary options) + { + return invokeObjcSelf!(void, "exitFullScreenModeWithOptions:", NSDictionary)(options); + } + + bool isInFullScreenMode () + { + return invokeObjcSelf!(bool, "isInFullScreenMode"); + } + + // NSPrinting + void writeEPSInsideRect (NSRect rect, NSPasteboard pasteboard) + { + return invokeObjcSelf!(void, "writeEPSInsideRect:toPasteboard:", NSRect, NSPasteboard)(rect, pasteboard); + } + + NSData dataWithEPSInsideRect (NSRect rect) + { + return invokeObjcSelf!(NSData, "dataWithEPSInsideRect:", NSRect)(rect); + } + + void writePDFInsideRect (NSRect rect, NSPasteboard pasteboard) + { + return invokeObjcSelf!(void, "writePDFInsideRect:toPasteboard:", NSRect, NSPasteboard)(rect, pasteboard); + } + + NSData dataWithPDFInsideRect (NSRect rect) + { + return invokeObjcSelf!(NSData, "dataWithPDFInsideRect:", NSRect)(rect); + } + + void print (Object sender) + { + return invokeObjcSelf!(void, "print:", Object)(sender); + } + + bool knowsPageRange (NSRangePointer range) + { + return invokeObjcSelf!(bool, "knowsPageRange:", NSRangePointer)(range); + } + + CGFloat heightAdjustLimit () + { + return invokeObjcSelf!(CGFloat, "heightAdjustLimit"); + } + + CGFloat widthAdjustLimit () + { + return invokeObjcSelf!(CGFloat, "widthAdjustLimit"); + } + + void adjustPageWidthNew (CGFloat* newRight, CGFloat oldLeft, CGFloat oldRight, CGFloat rightLimit) + { + return invokeObjcSelf!(void, "adjustPageWidthNew:left:right:limit:", CGFloat*, CGFloat, CGFloat, CGFloat)(newRight, oldLeft, oldRight, rightLimit); + } + + void adjustPageHeightNew (CGFloat* newBottom, CGFloat oldTop, CGFloat oldBottom, CGFloat bottomLimit) + { + return invokeObjcSelf!(void, "adjustPageHeightNew:top:bottom:limit:", CGFloat*, CGFloat, CGFloat, CGFloat)(newBottom, oldTop, oldBottom, bottomLimit); + } + + NSRect rectForPage (NSInteger page) + { + return invokeObjcSelf!(NSRect, "rectForPage:", NSInteger)(page); + } + + NSPoint locationOfPrintRect (NSRect aRect) + { + return invokeObjcSelf!(NSPoint, "locationOfPrintRect:", NSRect)(aRect); + } + + void drawPageBorderWithSize (NSSize borderSize) + { + return invokeObjcSelf!(void, "drawPageBorderWithSize:", NSSize)(borderSize); + } + + NSAttributedString pageHeader () + { + return invokeObjcSelf!(NSAttributedString, "pageHeader"); + } + + NSAttributedString pageFooter () + { + return invokeObjcSelf!(NSAttributedString, "pageFooter"); + } + + void drawSheetBorderWithSize (NSSize borderSize) + { + return invokeObjcSelf!(void, "drawSheetBorderWithSize:", NSSize)(borderSize); + } + + NSString printJobTitle () + { + return invokeObjcSelf!(NSString, "printJobTitle"); + } + + void beginDocument () + { + return invokeObjcSelf!(void, "beginDocument"); + } + + void endDocument () + { + return invokeObjcSelf!(void, "endDocument"); + } + + void beginPageInRect (NSRect aRect, NSPoint location) + { + return invokeObjcSelf!(void, "beginPageInRect:atPlacement:", NSRect, NSPoint)(aRect, location); + } + + void endPage () + { + return invokeObjcSelf!(void, "endPage"); + } + + // NSViewEnclosingMenuItem + NSMenuItem enclosingMenuItem () + { + return invokeObjcSelf!(NSMenuItem, "enclosingMenuItem"); + } + + // NSRulerMarkerClientViewDelegation + bool rulerView_shouldMoveMarker (NSRulerView ruler, NSRulerMarker marker) + { + return invokeObjcSelf!(bool, "rulerView:shouldMoveMarker:", NSRulerView, NSRulerMarker)(ruler, marker); + } + + CGFloat rulerView (NSRulerView ruler, NSRulerMarker marker, CGFloat location) + { + return invokeObjcSelf!(CGFloat, "rulerView:willMoveMarker:toLocation:", NSRulerView, NSRulerMarker, CGFloat)(ruler, marker, location); + } + + void rulerView (NSRulerView ruler, NSRulerMarker marker) + { + return invokeObjcSelf!(void, "rulerView:didMoveMarker:", NSRulerView, NSRulerMarker)(ruler, marker); + } + + void rulerView_shouldRemoveMarker (NSRulerView ruler, NSRulerMarker marker) + { + return invokeObjcSelf!(void, "rulerView:shouldRemoveMarker:", NSRulerView, NSRulerMarker)(ruler, marker); + } + + void rulerView_didRemoveMarker (NSRulerView ruler, NSRulerMarker marker) + { + return invokeObjcSelf!(void, "rulerView:didRemoveMarker:", NSRulerView, NSRulerMarker)(ruler, marker); + } + + bool rulerView_shouldAddMarker (NSRulerView ruler, NSRulerMarker marker) + { + return invokeObjcSelf!(bool, "rulerView:shouldAddMarker:", NSRulerView, NSRulerMarker)(ruler, marker); + } + + CGFloat rulerView_willAddMarker_atLocation (NSRulerView ruler, NSRulerMarker marker, CGFloat location) + { + return invokeObjcSelf!(CGFloat, "rulerView:willAddMarker:atLocation:", NSRulerView, NSRulerMarker, CGFloat)(ruler, marker, location); + } + + void rulerView_didAddMarker (NSRulerView ruler, NSRulerMarker marker) + { + return invokeObjcSelf!(void, "rulerView:didAddMarker:", NSRulerView, NSRulerMarker)(ruler, marker); + } + + void rulerView (NSRulerView ruler, NSEvent event) + { + return invokeObjcSelf!(void, "rulerView:handleMouseDown:", NSRulerView, NSEvent)(ruler, event); + } + + CGFloat rulerView (NSRulerView ruler, NSView newClient) + { + return invokeObjcSelf!(CGFloat, "rulerView:willSetClientView:", NSRulerView, NSView)(ruler, newClient); + } + + // NSClipViewSuperview + void reflectScrolledClipView (NSClipView aClipView) + { + return invokeObjcSelf!(void, "reflectScrolledClipView:", NSClipView)(aClipView); + } + + void scrollClipView (NSClipView aClipView, NSPoint aPoint) + { + return invokeObjcSelf!(void, "scrollClipView:toPoint:", NSClipView, NSPoint)(aClipView, aPoint); + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSViewController.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSViewController.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,93 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSViewController; + +import dstep.appkit.NSNibDeclarations; +import dstep.appkit.NSResponder; +import dstep.appkit.NSView; +import dstep.foundation.NSArray; +import dstep.foundation.NSBundle; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSViewController : NSResponder +{ + mixin (ObjcWrap); + + NSViewController initWithNibName (NSString nibNameOrNil, NSBundle nibBundleOrNil) + { + id result = invokeObjcSelf!(id, "initWithNibName:bundle:", NSString, NSBundle)(nibNameOrNil, nibBundleOrNil); + return result is this.objcObject ? this : (result !is null ? new NSViewController(result) : null); + } + + this (NSString nibNameOrNil, NSBundle nibBundleOrNil) + { + super(NSViewController.alloc.initWithNibName(nibNameOrNil, nibBundleOrNil).objcObject); + } + + void setRepresentedObject (Object representedObject) + { + return invokeObjcSelf!(void, "setRepresentedObject:", Object)(representedObject); + } + + Object representedObject () + { + return invokeObjcSelf!(Object, "representedObject"); + } + + void setTitle (NSString title) + { + return invokeObjcSelf!(void, "setTitle:", NSString)(title); + } + + NSString title () + { + return invokeObjcSelf!(NSString, "title"); + } + + NSView view () + { + return invokeObjcSelf!(NSView, "view"); + } + + void loadView () + { + return invokeObjcSelf!(void, "loadView"); + } + + NSString nibName () + { + return invokeObjcSelf!(NSString, "nibName"); + } + + NSBundle nibBundle () + { + return invokeObjcSelf!(NSBundle, "nibBundle"); + } + + void setView (NSView view) + { + return invokeObjcSelf!(void, "setView:", NSView)(view); + } + + void commitEditingWithDelegate (Object delegate_, SEL didCommitSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "commitEditingWithDelegate:didCommitSelector:contextInfo:", Object, SEL, void*)(delegate_, didCommitSelector, contextInfo); + } + + bool commitEditing () + { + return invokeObjcSelf!(bool, "commitEditing"); + } + + void discardEditing () + { + return invokeObjcSelf!(void, "discardEditing"); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSView_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSView_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,25 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSView_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package const id NSFullScreenModeAllScreens; + package const id NSFullScreenModeSetting; + package const id NSFullScreenModeWindowLevel; + package id NSViewFrameDidChangeNotification; + package id NSViewFocusDidChangeNotification; + package id NSViewBoundsDidChangeNotification; + package id NSViewGlobalFrameDidChangeNotification; + package id NSViewDidUpdateTrackingAreasNotification; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSWindow.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSWindow.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,1690 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSWindow; + +import dstep.appkit.AppKitDefines; +import dstep.appkit.NSAnimation; +import dstep.appkit.NSButton; +import dstep.appkit.NSButtonCell; +import dstep.appkit.NSColor; +import dstep.appkit.NSDockTile; +import dstep.appkit.NSDrawer; +import dstep.appkit.NSEvent; +import dstep.appkit.NSGraphics; +import dstep.appkit.NSGraphicsContext; +import dstep.appkit.NSImage; +import dstep.appkit.NSMenu; +import dstep.appkit.NSPasteboard; +import dstep.appkit.NSResponder; +import dstep.appkit.NSScreen; +import dstep.appkit.NSText; +import dstep.appkit.NSToolbar; +import dstep.appkit.NSUserInterfaceValidation; +import dstep.appkit.NSView; +import dstep.appkit.NSWindowController; +import dstep.appkit.NSWindowScripting; +import dstep.applicationservices.ApplicationServices; +import dstep.foundation.NSArray; +import dstep.foundation.NSData; +import dstep.foundation.NSDate; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSNotification; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSScriptCommand; +import dstep.foundation.NSScriptStandardSuiteCommands; +import dstep.foundation.NSSet; +import dstep.foundation.NSString; +import dstep.foundation.NSURL; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.appkit.NSWindow_bindings; + +typedef NSUInteger NSWindowSharingType; +typedef NSUInteger NSWindowBackingLocation; +typedef NSUInteger NSWindowCollectionBehavior; +typedef NSUInteger NSSelectionDirection; +typedef NSUInteger NSWindowButton; + +private +{ + NSString NSWindowDidBecomeKeyNotification_; + NSString NSWindowDidBecomeMainNotification_; + NSString NSWindowDidChangeScreenNotification_; + NSString NSWindowDidDeminiaturizeNotification_; + NSString NSWindowDidExposeNotification_; + NSString NSWindowDidMiniaturizeNotification_; + NSString NSWindowDidMoveNotification_; + NSString NSWindowDidResignKeyNotification_; + NSString NSWindowDidResignMainNotification_; + NSString NSWindowDidResizeNotification_; + NSString NSWindowDidUpdateNotification_; + NSString NSWindowWillCloseNotification_; + NSString NSWindowWillMiniaturizeNotification_; + NSString NSWindowWillMoveNotification_; + NSString NSWindowWillBeginSheetNotification_; + NSString NSWindowDidEndSheetNotification_; + NSString NSWindowDidChangeScreenProfileNotification_; +} + +NSString NSWindowDidBecomeKeyNotification () +{ + if (NSWindowDidBecomeKeyNotification_) + return NSWindowDidBecomeKeyNotification_; + + return NSWindowDidBecomeKeyNotification_ = new NSString(bindings.NSWindowDidBecomeKeyNotification); +} + +NSString NSWindowDidBecomeMainNotification () +{ + if (NSWindowDidBecomeMainNotification_) + return NSWindowDidBecomeMainNotification_; + + return NSWindowDidBecomeMainNotification_ = new NSString(bindings.NSWindowDidBecomeMainNotification); +} + +NSString NSWindowDidChangeScreenNotification () +{ + if (NSWindowDidChangeScreenNotification_) + return NSWindowDidChangeScreenNotification_; + + return NSWindowDidChangeScreenNotification_ = new NSString(bindings.NSWindowDidChangeScreenNotification); +} + +NSString NSWindowDidDeminiaturizeNotification () +{ + if (NSWindowDidDeminiaturizeNotification_) + return NSWindowDidDeminiaturizeNotification_; + + return NSWindowDidDeminiaturizeNotification_ = new NSString(bindings.NSWindowDidDeminiaturizeNotification); +} + +NSString NSWindowDidExposeNotification () +{ + if (NSWindowDidExposeNotification_) + return NSWindowDidExposeNotification_; + + return NSWindowDidExposeNotification_ = new NSString(bindings.NSWindowDidExposeNotification); +} + +NSString NSWindowDidMiniaturizeNotification () +{ + if (NSWindowDidMiniaturizeNotification_) + return NSWindowDidMiniaturizeNotification_; + + return NSWindowDidMiniaturizeNotification_ = new NSString(bindings.NSWindowDidMiniaturizeNotification); +} + +NSString NSWindowDidMoveNotification () +{ + if (NSWindowDidMoveNotification_) + return NSWindowDidMoveNotification_; + + return NSWindowDidMoveNotification_ = new NSString(bindings.NSWindowDidMoveNotification); +} + +NSString NSWindowDidResignKeyNotification () +{ + if (NSWindowDidResignKeyNotification_) + return NSWindowDidResignKeyNotification_; + + return NSWindowDidResignKeyNotification_ = new NSString(bindings.NSWindowDidResignKeyNotification); +} + +NSString NSWindowDidResignMainNotification () +{ + if (NSWindowDidResignMainNotification_) + return NSWindowDidResignMainNotification_; + + return NSWindowDidResignMainNotification_ = new NSString(bindings.NSWindowDidResignMainNotification); +} + +NSString NSWindowDidResizeNotification () +{ + if (NSWindowDidResizeNotification_) + return NSWindowDidResizeNotification_; + + return NSWindowDidResizeNotification_ = new NSString(bindings.NSWindowDidResizeNotification); +} + +NSString NSWindowDidUpdateNotification () +{ + if (NSWindowDidUpdateNotification_) + return NSWindowDidUpdateNotification_; + + return NSWindowDidUpdateNotification_ = new NSString(bindings.NSWindowDidUpdateNotification); +} + +NSString NSWindowWillCloseNotification () +{ + if (NSWindowWillCloseNotification_) + return NSWindowWillCloseNotification_; + + return NSWindowWillCloseNotification_ = new NSString(bindings.NSWindowWillCloseNotification); +} + +NSString NSWindowWillMiniaturizeNotification () +{ + if (NSWindowWillMiniaturizeNotification_) + return NSWindowWillMiniaturizeNotification_; + + return NSWindowWillMiniaturizeNotification_ = new NSString(bindings.NSWindowWillMiniaturizeNotification); +} + +NSString NSWindowWillMoveNotification () +{ + if (NSWindowWillMoveNotification_) + return NSWindowWillMoveNotification_; + + return NSWindowWillMoveNotification_ = new NSString(bindings.NSWindowWillMoveNotification); +} + +NSString NSWindowWillBeginSheetNotification () +{ + if (NSWindowWillBeginSheetNotification_) + return NSWindowWillBeginSheetNotification_; + + return NSWindowWillBeginSheetNotification_ = new NSString(bindings.NSWindowWillBeginSheetNotification); +} + +NSString NSWindowDidEndSheetNotification () +{ + if (NSWindowDidEndSheetNotification_) + return NSWindowDidEndSheetNotification_; + + return NSWindowDidEndSheetNotification_ = new NSString(bindings.NSWindowDidEndSheetNotification); +} + +NSString NSWindowDidChangeScreenProfileNotification () +{ + if (NSWindowDidChangeScreenProfileNotification_) + return NSWindowDidChangeScreenProfileNotification_; + + return NSWindowDidChangeScreenProfileNotification_ = new NSString(bindings.NSWindowDidChangeScreenProfileNotification); +} + +enum +{ + NSBorderlessWindowMask = 0, + NSTitledWindowMask = 1 << 0, + NSClosableWindowMask = 1 << 1, + NSMiniaturizableWindowMask = 1 << 2, + NSResizableWindowMask = 1 << 3 +} + +enum +{ + NSTexturedBackgroundWindowMask = 1 << 8 +} + +enum +{ + NSUnscaledWindowMask = 1 << 11 +} + +enum +{ + NSUnifiedTitleAndToolbarWindowMask = 1 << 12 +} + +enum +{ + NSDisplayWindowRunLoopOrdering = 600000, + NSResetCursorRectsRunLoopOrdering = 700000 +} + +enum : NSUInteger +{ + NSWindowSharingNone = 0, + NSWindowSharingReadOnly = 1, + NSWindowSharingReadWrite = 2 +} + +enum : NSUInteger +{ + NSWindowBackingLocationDefault = 0, + NSWindowBackingLocationVideoMemory = 1, + NSWindowBackingLocationMainMemory = 2 +} + +enum : NSUInteger +{ + NSWindowCollectionBehaviorDefault = 0, + NSWindowCollectionBehaviorCanJoinAllSpaces = 1 << 0, + NSWindowCollectionBehaviorMoveToActiveSpace = 1 << 1 +} + +enum : NSUInteger +{ + NSDirectSelection = 0, + NSSelectingNext, + NSSelectingPrevious +} + +enum : NSUInteger +{ + NSWindowCloseButton, + NSWindowMiniaturizeButton, + NSWindowZoomButton, + NSWindowToolbarButton, + NSWindowDocumentIconButton +} + +const TNSWindowDelegate = ` + + bool windowShouldClose (Object sender) + { + return invokeObjcSelf!(bool, "windowShouldClose:", Object)(sender); + } + + Object windowWillReturnFieldEditor (NSWindow sender, Object client) + { + return invokeObjcSelf!(Object, "windowWillReturnFieldEditor:toObject:", NSWindow, Object)(sender, client); + } + + NSSize windowWillResize (NSWindow sender, NSSize frameSize) + { + return invokeObjcSelf!(NSSize, "windowWillResize:toSize:", NSWindow, NSSize)(sender, frameSize); + } + + NSRect windowWillUseStandardFrame (NSWindow window, NSRect newFrame) + { + return invokeObjcSelf!(NSRect, "windowWillUseStandardFrame:defaultFrame:", NSWindow, NSRect)(window, newFrame); + } + + bool windowShouldZoom (NSWindow window, NSRect newFrame) + { + return invokeObjcSelf!(bool, "windowShouldZoom:toFrame:", NSWindow, NSRect)(window, newFrame); + } + + NSUndoManager windowWillReturnUndoManager (NSWindow window) + { + return invokeObjcSelf!(NSUndoManager, "windowWillReturnUndoManager:", NSWindow)(window); + } + + NSRect window (NSWindow window, NSWindow sheet, NSRect rect) + { + return invokeObjcSelf!(NSRect, "window:willPositionSheet:usingRect:", NSWindow, NSWindow, NSRect)(window, sheet, rect); + } + + bool window (NSWindow window, NSMenu menu) + { + return invokeObjcSelf!(bool, "window:shouldPopUpDocumentPathMenu:", NSWindow, NSMenu)(window, menu); + } + + bool window (NSWindow window, NSEvent event, NSPoint dragImageLocation, NSPasteboard pasteboard) + { + return invokeObjcSelf!(bool, "window:shouldDragDocumentWithEvent:from:withPasteboard:", NSWindow, NSEvent, NSPoint, NSPasteboard)(window, event, dragImageLocation, pasteboard); + } + + //mixin ObjcBindMethod!(windowShouldClose, "windowShouldClose:"); + //mixin ObjcBindMethod!(windowWillReturnFieldEditor, "windowWillReturnFieldEditor:toObject:"); + //mixin ObjcBindMethod!(windowWillResize, "windowWillResize:toSize:"); + //mixin ObjcBindMethod!(windowWillUseStandardFrame, "windowWillUseStandardFrame:defaultFrame:"); + //mixin ObjcBindMethod!(windowShouldZoom, "windowShouldZoom:toFrame:"); + //mixin ObjcBindMethod!(windowWillReturnUndoManager, "windowWillReturnUndoManager:"); + //mixin ObjcBindMethod!(window, "window:willPositionSheet:usingRect:"); + //mixin ObjcBindMethod!(window, "window:shouldPopUpDocumentPathMenu:"); + //mixin ObjcBindMethod!(window, "window:shouldDragDocumentWithEvent:from:withPasteboard:"); + +`; + +const TNSCarbonExtensions = ` + + typeof(this) initWithWindowRef (void* windowRef) + { + id result = invokeObjcSelf!(id, "initWithWindowRef:", void*)(windowRef); + return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); + } + + this (void* windowRef) + { + super(typeof(this).alloc.initWithWindowRef(windowRef).objcObject); + } + + void* windowRef () + { + return invokeObjcSelf!(void*, "windowRef"); + } + + //mixin ObjcBindMethod!(initWithWindowRef, "initWithWindowRef:"); + //mixin ObjcBindMethod!(windowRef, "windowRef"); + +`; + +const TNSWindowNotifications = ` + + void windowDidResize (NSNotification notification) + { + return invokeObjcSelf!(void, "windowDidResize:", NSNotification)(notification); + } + + void windowDidExpose (NSNotification notification) + { + return invokeObjcSelf!(void, "windowDidExpose:", NSNotification)(notification); + } + + void windowWillMove (NSNotification notification) + { + return invokeObjcSelf!(void, "windowWillMove:", NSNotification)(notification); + } + + void windowDidMove (NSNotification notification) + { + return invokeObjcSelf!(void, "windowDidMove:", NSNotification)(notification); + } + + void windowDidBecomeKey (NSNotification notification) + { + return invokeObjcSelf!(void, "windowDidBecomeKey:", NSNotification)(notification); + } + + void windowDidResignKey (NSNotification notification) + { + return invokeObjcSelf!(void, "windowDidResignKey:", NSNotification)(notification); + } + + void windowDidBecomeMain (NSNotification notification) + { + return invokeObjcSelf!(void, "windowDidBecomeMain:", NSNotification)(notification); + } + + void windowDidResignMain (NSNotification notification) + { + return invokeObjcSelf!(void, "windowDidResignMain:", NSNotification)(notification); + } + + void windowWillClose (NSNotification notification) + { + return invokeObjcSelf!(void, "windowWillClose:", NSNotification)(notification); + } + + void windowWillMiniaturize (NSNotification notification) + { + return invokeObjcSelf!(void, "windowWillMiniaturize:", NSNotification)(notification); + } + + void windowDidMiniaturize (NSNotification notification) + { + return invokeObjcSelf!(void, "windowDidMiniaturize:", NSNotification)(notification); + } + + void windowDidDeminiaturize (NSNotification notification) + { + return invokeObjcSelf!(void, "windowDidDeminiaturize:", NSNotification)(notification); + } + + void windowDidUpdate (NSNotification notification) + { + return invokeObjcSelf!(void, "windowDidUpdate:", NSNotification)(notification); + } + + void windowDidChangeScreen (NSNotification notification) + { + return invokeObjcSelf!(void, "windowDidChangeScreen:", NSNotification)(notification); + } + + void windowDidChangeScreenProfile (NSNotification notification) + { + return invokeObjcSelf!(void, "windowDidChangeScreenProfile:", NSNotification)(notification); + } + + void windowWillBeginSheet (NSNotification notification) + { + return invokeObjcSelf!(void, "windowWillBeginSheet:", NSNotification)(notification); + } + + void windowDidEndSheet (NSNotification notification) + { + return invokeObjcSelf!(void, "windowDidEndSheet:", NSNotification)(notification); + } + + //mixin ObjcBindMethod!(windowDidResize, "windowDidResize:"); + //mixin ObjcBindMethod!(windowDidExpose, "windowDidExpose:"); + //mixin ObjcBindMethod!(windowWillMove, "windowWillMove:"); + //mixin ObjcBindMethod!(windowDidMove, "windowDidMove:"); + //mixin ObjcBindMethod!(windowDidBecomeKey, "windowDidBecomeKey:"); + //mixin ObjcBindMethod!(windowDidResignKey, "windowDidResignKey:"); + //mixin ObjcBindMethod!(windowDidBecomeMain, "windowDidBecomeMain:"); + //mixin ObjcBindMethod!(windowDidResignMain, "windowDidResignMain:"); + //mixin ObjcBindMethod!(windowWillClose, "windowWillClose:"); + //mixin ObjcBindMethod!(windowWillMiniaturize, "windowWillMiniaturize:"); + //mixin ObjcBindMethod!(windowDidMiniaturize, "windowDidMiniaturize:"); + //mixin ObjcBindMethod!(windowDidDeminiaturize, "windowDidDeminiaturize:"); + //mixin ObjcBindMethod!(windowDidUpdate, "windowDidUpdate:"); + //mixin ObjcBindMethod!(windowDidChangeScreen, "windowDidChangeScreen:"); + //mixin ObjcBindMethod!(windowDidChangeScreenProfile, "windowDidChangeScreenProfile:"); + //mixin ObjcBindMethod!(windowWillBeginSheet, "windowWillBeginSheet:"); + //mixin ObjcBindMethod!(windowDidEndSheet, "windowDidEndSheet:"); + +`; + +const TNSToolbarSupport = ` + + void setToolbar (NSToolbar toolbar) + { + return invokeObjcSelf!(void, "setToolbar:", NSToolbar)(toolbar); + } + + NSToolbar toolbar () + { + return invokeObjcSelf!(NSToolbar, "toolbar"); + } + + void toggleToolbarShown (Object sender) + { + return invokeObjcSelf!(void, "toggleToolbarShown:", Object)(sender); + } + + void runToolbarCustomizationPalette (Object sender) + { + return invokeObjcSelf!(void, "runToolbarCustomizationPalette:", Object)(sender); + } + + void setShowsToolbarButton (bool show) + { + return invokeObjcSelf!(void, "setShowsToolbarButton:", bool)(show); + } + + bool showsToolbarButton () + { + return invokeObjcSelf!(bool, "showsToolbarButton"); + } + + //mixin ObjcBindMethod!(setToolbar, "setToolbar:"); + //mixin ObjcBindMethod!(toolbar, "toolbar"); + //mixin ObjcBindMethod!(toggleToolbarShown, "toggleToolbarShown:"); + //mixin ObjcBindMethod!(runToolbarCustomizationPalette, "runToolbarCustomizationPalette:"); + //mixin ObjcBindMethod!(setShowsToolbarButton, "setShowsToolbarButton:"); + //mixin ObjcBindMethod!(showsToolbarButton, "showsToolbarButton"); + +`; + +class NSWindow : NSResponder +{ + mixin (ObjcWrap); + + static NSRect frameRectForContentRect (NSRect cRect, NSUInteger aStyle) + { + return invokeObjcSelfClass!(NSRect, "frameRectForContentRect:styleMask:", NSRect, NSUInteger)(cRect, aStyle); + } + + static NSRect contentRectForFrameRect (NSRect fRect, NSUInteger aStyle) + { + return invokeObjcSelfClass!(NSRect, "contentRectForFrameRect:styleMask:", NSRect, NSUInteger)(fRect, aStyle); + } + + static CGFloat minFrameWidthWithTitle (NSString aTitle, NSUInteger aStyle) + { + return invokeObjcSelfClass!(CGFloat, "minFrameWidthWithTitle:styleMask:", NSString, NSUInteger)(aTitle, aStyle); + } + + static int defaultDepthLimit () + { + return invokeObjcSelfClass!(int, "defaultDepthLimit"); + } + + NSRect frameRectForContentRect (NSRect contentRect) + { + return invokeObjcSelf!(NSRect, "frameRectForContentRect:", NSRect)(contentRect); + } + + NSRect contentRectForFrameRect (NSRect frameRect) + { + return invokeObjcSelf!(NSRect, "contentRectForFrameRect:", NSRect)(frameRect); + } + + NSWindow initWithContentRect (NSRect contentRect, NSUInteger aStyle, uint bufferingType, bool flag) + { + id result = invokeObjcSelf!(id, "initWithContentRect:styleMask:backing:defer:", NSRect, NSUInteger, uint, bool)(contentRect, aStyle, bufferingType, flag); + return result is this.objcObject ? this : (result !is null ? new NSWindow(result) : null); + } + + this (NSRect contentRect, NSUInteger aStyle, uint bufferingType, bool flag) + { + super(NSWindow.alloc.initWithContentRect(contentRect, aStyle, bufferingType, flag).objcObject); + } + + NSWindow initWithContentRect (NSRect contentRect, NSUInteger aStyle, uint bufferingType, bool flag, NSScreen screen) + { + id result = invokeObjcSelf!(id, "initWithContentRect:styleMask:backing:defer:screen:", NSRect, NSUInteger, uint, bool, NSScreen)(contentRect, aStyle, bufferingType, flag, screen); + return result is this.objcObject ? this : (result !is null ? new NSWindow(result) : null); + } + + this (NSRect contentRect, NSUInteger aStyle, uint bufferingType, bool flag, NSScreen screen) + { + super(NSWindow.alloc.initWithContentRect(contentRect, aStyle, bufferingType, flag, screen).objcObject); + } + + NSString title () + { + return invokeObjcSelf!(NSString, "title"); + } + + void setTitle (NSString aString) + { + return invokeObjcSelf!(void, "setTitle:", NSString)(aString); + } + + void setRepresentedURL (NSURL url) + { + return invokeObjcSelf!(void, "setRepresentedURL:", NSURL)(url); + } + + NSURL representedURL () + { + return invokeObjcSelf!(NSURL, "representedURL"); + } + + NSString representedFilename () + { + return invokeObjcSelf!(NSString, "representedFilename"); + } + + void setRepresentedFilename (NSString aString) + { + return invokeObjcSelf!(void, "setRepresentedFilename:", NSString)(aString); + } + + void setTitleWithRepresentedFilename (NSString filename) + { + return invokeObjcSelf!(void, "setTitleWithRepresentedFilename:", NSString)(filename); + } + + void setExcludedFromWindowsMenu (bool flag) + { + return invokeObjcSelf!(void, "setExcludedFromWindowsMenu:", bool)(flag); + } + + bool isExcludedFromWindowsMenu () + { + return invokeObjcSelf!(bool, "isExcludedFromWindowsMenu"); + } + + void setContentView (NSView aView) + { + return invokeObjcSelf!(void, "setContentView:", NSView)(aView); + } + + Object contentView () + { + return invokeObjcSelf!(Object, "contentView"); + } + + void setDelegate (Object anObject) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(anObject); + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + NSInteger windowNumber () + { + return invokeObjcSelf!(NSInteger, "windowNumber"); + } + + NSUInteger styleMask () + { + return invokeObjcSelf!(NSUInteger, "styleMask"); + } + + NSText fieldEditor (bool createFlag, Object anObject) + { + return invokeObjcSelf!(NSText, "fieldEditor:forObject:", bool, Object)(createFlag, anObject); + } + + void endEditingFor (Object anObject) + { + return invokeObjcSelf!(void, "endEditingFor:", Object)(anObject); + } + + NSRect constrainFrameRect (NSRect frameRect, NSScreen screen) + { + return invokeObjcSelf!(NSRect, "constrainFrameRect:toScreen:", NSRect, NSScreen)(frameRect, screen); + } + + void setFrame (NSRect frameRect, bool flag) + { + return invokeObjcSelf!(void, "setFrame:display:", NSRect, bool)(frameRect, flag); + } + + void setContentSize (NSSize aSize) + { + return invokeObjcSelf!(void, "setContentSize:", NSSize)(aSize); + } + + void setFrameOrigin (NSPoint aPoint) + { + return invokeObjcSelf!(void, "setFrameOrigin:", NSPoint)(aPoint); + } + + void setFrameTopLeftPoint (NSPoint aPoint) + { + return invokeObjcSelf!(void, "setFrameTopLeftPoint:", NSPoint)(aPoint); + } + + NSPoint cascadeTopLeftFromPoint (NSPoint topLeftPoint) + { + return invokeObjcSelf!(NSPoint, "cascadeTopLeftFromPoint:", NSPoint)(topLeftPoint); + } + + NSRect frame () + { + return invokeObjcSelf!(NSRect, "frame"); + } + + double animationResizeTime (NSRect newFrame) + { + return invokeObjcSelf!(double, "animationResizeTime:", NSRect)(newFrame); + } + + void setFrame (NSRect frameRect, bool displayFlag, bool animateFlag) + { + return invokeObjcSelf!(void, "setFrame:display:animate:", NSRect, bool, bool)(frameRect, displayFlag, animateFlag); + } + + void setShowsResizeIndicator (bool show) + { + return invokeObjcSelf!(void, "setShowsResizeIndicator:", bool)(show); + } + + bool showsResizeIndicator () + { + return invokeObjcSelf!(bool, "showsResizeIndicator"); + } + + void setResizeIncrements (NSSize increments) + { + return invokeObjcSelf!(void, "setResizeIncrements:", NSSize)(increments); + } + + NSSize resizeIncrements () + { + return invokeObjcSelf!(NSSize, "resizeIncrements"); + } + + void setAspectRatio (NSSize ratio) + { + return invokeObjcSelf!(void, "setAspectRatio:", NSSize)(ratio); + } + + NSSize aspectRatio () + { + return invokeObjcSelf!(NSSize, "aspectRatio"); + } + + void setContentResizeIncrements (NSSize increments) + { + return invokeObjcSelf!(void, "setContentResizeIncrements:", NSSize)(increments); + } + + NSSize contentResizeIncrements () + { + return invokeObjcSelf!(NSSize, "contentResizeIncrements"); + } + + void setContentAspectRatio (NSSize ratio) + { + return invokeObjcSelf!(void, "setContentAspectRatio:", NSSize)(ratio); + } + + NSSize contentAspectRatio () + { + return invokeObjcSelf!(NSSize, "contentAspectRatio"); + } + + void useOptimizedDrawing (bool flag) + { + return invokeObjcSelf!(void, "useOptimizedDrawing:", bool)(flag); + } + + void disableFlushWindow () + { + return invokeObjcSelf!(void, "disableFlushWindow"); + } + + void enableFlushWindow () + { + return invokeObjcSelf!(void, "enableFlushWindow"); + } + + bool isFlushWindowDisabled () + { + return invokeObjcSelf!(bool, "isFlushWindowDisabled"); + } + + void flushWindow () + { + return invokeObjcSelf!(void, "flushWindow"); + } + + void flushWindowIfNeeded () + { + return invokeObjcSelf!(void, "flushWindowIfNeeded"); + } + + void setViewsNeedDisplay (bool flag) + { + return invokeObjcSelf!(void, "setViewsNeedDisplay:", bool)(flag); + } + + bool viewsNeedDisplay () + { + return invokeObjcSelf!(bool, "viewsNeedDisplay"); + } + + void displayIfNeeded () + { + return invokeObjcSelf!(void, "displayIfNeeded"); + } + + void display () + { + return invokeObjcSelf!(void, "display"); + } + + void setAutodisplay (bool flag) + { + return invokeObjcSelf!(void, "setAutodisplay:", bool)(flag); + } + + bool isAutodisplay () + { + return invokeObjcSelf!(bool, "isAutodisplay"); + } + + bool preservesContentDuringLiveResize () + { + return invokeObjcSelf!(bool, "preservesContentDuringLiveResize"); + } + + void setPreservesContentDuringLiveResize (bool flag) + { + return invokeObjcSelf!(void, "setPreservesContentDuringLiveResize:", bool)(flag); + } + + void update () + { + return invokeObjcSelf!(void, "update"); + } + + bool makeFirstResponder (NSResponder aResponder) + { + return invokeObjcSelf!(bool, "makeFirstResponder:", NSResponder)(aResponder); + } + + NSResponder firstResponder () + { + return invokeObjcSelf!(NSResponder, "firstResponder"); + } + + NSInteger resizeFlags () + { + return invokeObjcSelf!(NSInteger, "resizeFlags"); + } + + void keyDown (NSEvent theEvent) + { + return invokeObjcSelf!(void, "keyDown:", NSEvent)(theEvent); + } + + void close () + { + return invokeObjcSelf!(void, "close"); + } + + void setReleasedWhenClosed (bool flag) + { + return invokeObjcSelf!(void, "setReleasedWhenClosed:", bool)(flag); + } + + bool isReleasedWhenClosed () + { + return invokeObjcSelf!(bool, "isReleasedWhenClosed"); + } + + void miniaturize (Object sender) + { + return invokeObjcSelf!(void, "miniaturize:", Object)(sender); + } + + void deminiaturize (Object sender) + { + return invokeObjcSelf!(void, "deminiaturize:", Object)(sender); + } + + bool isZoomed () + { + return invokeObjcSelf!(bool, "isZoomed"); + } + + void zoom (Object sender) + { + return invokeObjcSelf!(void, "zoom:", Object)(sender); + } + + bool isMiniaturized () + { + return invokeObjcSelf!(bool, "isMiniaturized"); + } + + bool tryToPerform (SEL anAction, Object anObject) + { + return invokeObjcSelf!(bool, "tryToPerform:with:", SEL, Object)(anAction, anObject); + } + + Object validRequestorForSendType (NSString sendType, NSString returnType) + { + return invokeObjcSelf!(Object, "validRequestorForSendType:returnType:", NSString, NSString)(sendType, returnType); + } + + void setBackgroundColor (NSColor color) + { + return invokeObjcSelf!(void, "setBackgroundColor:", NSColor)(color); + } + + NSColor backgroundColor () + { + return invokeObjcSelf!(NSColor, "backgroundColor"); + } + + void setContentBorderThickness (CGFloat thickness, int edge) + { + return invokeObjcSelf!(void, "setContentBorderThickness:forEdge:", CGFloat, int)(thickness, edge); + } + + CGFloat contentBorderThicknessForEdge (int edge) + { + return invokeObjcSelf!(CGFloat, "contentBorderThicknessForEdge:", int)(edge); + } + + void setAutorecalculatesContentBorderThickness (bool flag, int edge) + { + return invokeObjcSelf!(void, "setAutorecalculatesContentBorderThickness:forEdge:", bool, int)(flag, edge); + } + + bool autorecalculatesContentBorderThicknessForEdge (int edge) + { + return invokeObjcSelf!(bool, "autorecalculatesContentBorderThicknessForEdge:", int)(edge); + } + + void setMovableByWindowBackground (bool flag) + { + return invokeObjcSelf!(void, "setMovableByWindowBackground:", bool)(flag); + } + + bool isMovableByWindowBackground () + { + return invokeObjcSelf!(bool, "isMovableByWindowBackground"); + } + + void setHidesOnDeactivate (bool flag) + { + return invokeObjcSelf!(void, "setHidesOnDeactivate:", bool)(flag); + } + + bool hidesOnDeactivate () + { + return invokeObjcSelf!(bool, "hidesOnDeactivate"); + } + + void setCanHide (bool flag) + { + return invokeObjcSelf!(void, "setCanHide:", bool)(flag); + } + + bool canHide () + { + return invokeObjcSelf!(bool, "canHide"); + } + + void center () + { + return invokeObjcSelf!(void, "center"); + } + + void makeKeyAndOrderFront (Object sender) + { + return invokeObjcSelf!(void, "makeKeyAndOrderFront:", Object)(sender); + } + + void orderFront (Object sender) + { + return invokeObjcSelf!(void, "orderFront:", Object)(sender); + } + + void orderBack (Object sender) + { + return invokeObjcSelf!(void, "orderBack:", Object)(sender); + } + + void orderOut (Object sender) + { + return invokeObjcSelf!(void, "orderOut:", Object)(sender); + } + + void orderWindow (int place, NSInteger otherWin) + { + return invokeObjcSelf!(void, "orderWindow:relativeTo:", int, NSInteger)(place, otherWin); + } + + void orderFrontRegardless () + { + return invokeObjcSelf!(void, "orderFrontRegardless"); + } + + void setMiniwindowImage (NSImage image) + { + return invokeObjcSelf!(void, "setMiniwindowImage:", NSImage)(image); + } + + void setMiniwindowTitle (NSString title) + { + return invokeObjcSelf!(void, "setMiniwindowTitle:", NSString)(title); + } + + NSImage miniwindowImage () + { + return invokeObjcSelf!(NSImage, "miniwindowImage"); + } + + NSString miniwindowTitle () + { + return invokeObjcSelf!(NSString, "miniwindowTitle"); + } + + NSDockTile dockTile () + { + return invokeObjcSelf!(NSDockTile, "dockTile"); + } + + void setDocumentEdited (bool flag) + { + return invokeObjcSelf!(void, "setDocumentEdited:", bool)(flag); + } + + bool isDocumentEdited () + { + return invokeObjcSelf!(bool, "isDocumentEdited"); + } + + bool isVisible () + { + return invokeObjcSelf!(bool, "isVisible"); + } + + bool isKeyWindow () + { + return invokeObjcSelf!(bool, "isKeyWindow"); + } + + bool isMainWindow () + { + return invokeObjcSelf!(bool, "isMainWindow"); + } + + bool canBecomeKeyWindow () + { + return invokeObjcSelf!(bool, "canBecomeKeyWindow"); + } + + bool canBecomeMainWindow () + { + return invokeObjcSelf!(bool, "canBecomeMainWindow"); + } + + void makeKeyWindow () + { + return invokeObjcSelf!(void, "makeKeyWindow"); + } + + void makeMainWindow () + { + return invokeObjcSelf!(void, "makeMainWindow"); + } + + void becomeKeyWindow () + { + return invokeObjcSelf!(void, "becomeKeyWindow"); + } + + void resignKeyWindow () + { + return invokeObjcSelf!(void, "resignKeyWindow"); + } + + void becomeMainWindow () + { + return invokeObjcSelf!(void, "becomeMainWindow"); + } + + void resignMainWindow () + { + return invokeObjcSelf!(void, "resignMainWindow"); + } + + bool worksWhenModal () + { + return invokeObjcSelf!(bool, "worksWhenModal"); + } + + NSPoint convertBaseToScreen (NSPoint aPoint) + { + return invokeObjcSelf!(NSPoint, "convertBaseToScreen:", NSPoint)(aPoint); + } + + NSPoint convertScreenToBase (NSPoint aPoint) + { + return invokeObjcSelf!(NSPoint, "convertScreenToBase:", NSPoint)(aPoint); + } + + void performClose (Object sender) + { + return invokeObjcSelf!(void, "performClose:", Object)(sender); + } + + void performMiniaturize (Object sender) + { + return invokeObjcSelf!(void, "performMiniaturize:", Object)(sender); + } + + void performZoom (Object sender) + { + return invokeObjcSelf!(void, "performZoom:", Object)(sender); + } + + NSInteger gState () + { + return invokeObjcSelf!(NSInteger, "gState"); + } + + void setOneShot (bool flag) + { + return invokeObjcSelf!(void, "setOneShot:", bool)(flag); + } + + bool isOneShot () + { + return invokeObjcSelf!(bool, "isOneShot"); + } + + NSData dataWithEPSInsideRect (NSRect rect) + { + return invokeObjcSelf!(NSData, "dataWithEPSInsideRect:", NSRect)(rect); + } + + NSData dataWithPDFInsideRect (NSRect rect) + { + return invokeObjcSelf!(NSData, "dataWithPDFInsideRect:", NSRect)(rect); + } + + void print (Object sender) + { + return invokeObjcSelf!(void, "print:", Object)(sender); + } + + void disableCursorRects () + { + return invokeObjcSelf!(void, "disableCursorRects"); + } + + void enableCursorRects () + { + return invokeObjcSelf!(void, "enableCursorRects"); + } + + void discardCursorRects () + { + return invokeObjcSelf!(void, "discardCursorRects"); + } + + bool areCursorRectsEnabled () + { + return invokeObjcSelf!(bool, "areCursorRectsEnabled"); + } + + void invalidateCursorRectsForView (NSView aView) + { + return invokeObjcSelf!(void, "invalidateCursorRectsForView:", NSView)(aView); + } + + void resetCursorRects () + { + return invokeObjcSelf!(void, "resetCursorRects"); + } + + void setAllowsToolTipsWhenApplicationIsInactive (bool allowWhenInactive) + { + return invokeObjcSelf!(void, "setAllowsToolTipsWhenApplicationIsInactive:", bool)(allowWhenInactive); + } + + bool allowsToolTipsWhenApplicationIsInactive () + { + return invokeObjcSelf!(bool, "allowsToolTipsWhenApplicationIsInactive"); + } + + void setBackingType (uint bufferingType) + { + return invokeObjcSelf!(void, "setBackingType:", uint)(bufferingType); + } + + uint backingType () + { + return invokeObjcSelf!(uint, "backingType"); + } + + void setLevel (NSInteger newLevel) + { + return invokeObjcSelf!(void, "setLevel:", NSInteger)(newLevel); + } + + NSInteger level () + { + return invokeObjcSelf!(NSInteger, "level"); + } + + void setDepthLimit (int limit) + { + return invokeObjcSelf!(void, "setDepthLimit:", int)(limit); + } + + int depthLimit () + { + return invokeObjcSelf!(int, "depthLimit"); + } + + void setDynamicDepthLimit (bool flag) + { + return invokeObjcSelf!(void, "setDynamicDepthLimit:", bool)(flag); + } + + bool hasDynamicDepthLimit () + { + return invokeObjcSelf!(bool, "hasDynamicDepthLimit"); + } + + NSScreen screen () + { + return invokeObjcSelf!(NSScreen, "screen"); + } + + NSScreen deepestScreen () + { + return invokeObjcSelf!(NSScreen, "deepestScreen"); + } + + bool canStoreColor () + { + return invokeObjcSelf!(bool, "canStoreColor"); + } + + void setHasShadow (bool hasShadow) + { + return invokeObjcSelf!(void, "setHasShadow:", bool)(hasShadow); + } + + bool hasShadow () + { + return invokeObjcSelf!(bool, "hasShadow"); + } + + void invalidateShadow () + { + return invokeObjcSelf!(void, "invalidateShadow"); + } + + void setAlphaValue (CGFloat windowAlpha) + { + return invokeObjcSelf!(void, "setAlphaValue:", CGFloat)(windowAlpha); + } + + CGFloat alphaValue () + { + return invokeObjcSelf!(CGFloat, "alphaValue"); + } + + void setOpaque (bool isOpaque) + { + return invokeObjcSelf!(void, "setOpaque:", bool)(isOpaque); + } + + bool isOpaque () + { + return invokeObjcSelf!(bool, "isOpaque"); + } + + void setSharingType (uint type) + { + return invokeObjcSelf!(void, "setSharingType:", uint)(type); + } + + uint sharingType () + { + return invokeObjcSelf!(uint, "sharingType"); + } + + void setPreferredBackingLocation (uint backingLocation) + { + return invokeObjcSelf!(void, "setPreferredBackingLocation:", uint)(backingLocation); + } + + uint preferredBackingLocation () + { + return invokeObjcSelf!(uint, "preferredBackingLocation"); + } + + uint backingLocation () + { + return invokeObjcSelf!(uint, "backingLocation"); + } + + bool displaysWhenScreenProfileChanges () + { + return invokeObjcSelf!(bool, "displaysWhenScreenProfileChanges"); + } + + void setDisplaysWhenScreenProfileChanges (bool flag) + { + return invokeObjcSelf!(void, "setDisplaysWhenScreenProfileChanges:", bool)(flag); + } + + void disableScreenUpdatesUntilFlush () + { + return invokeObjcSelf!(void, "disableScreenUpdatesUntilFlush"); + } + + bool canBecomeVisibleWithoutLogin () + { + return invokeObjcSelf!(bool, "canBecomeVisibleWithoutLogin"); + } + + void setCanBecomeVisibleWithoutLogin (bool flag) + { + return invokeObjcSelf!(void, "setCanBecomeVisibleWithoutLogin:", bool)(flag); + } + + void setCollectionBehavior (uint behavior) + { + return invokeObjcSelf!(void, "setCollectionBehavior:", uint)(behavior); + } + + uint collectionBehavior () + { + return invokeObjcSelf!(uint, "collectionBehavior"); + } + + bool canBeVisibleOnAllSpaces () + { + return invokeObjcSelf!(bool, "canBeVisibleOnAllSpaces"); + } + + void setCanBeVisibleOnAllSpaces (bool flag) + { + return invokeObjcSelf!(void, "setCanBeVisibleOnAllSpaces:", bool)(flag); + } + + NSString stringWithSavedFrame () + { + return invokeObjcSelf!(NSString, "stringWithSavedFrame"); + } + + void setFrameFromString (NSString string) + { + return invokeObjcSelf!(void, "setFrameFromString:", NSString)(string); + } + + void saveFrameUsingName (NSString name) + { + return invokeObjcSelf!(void, "saveFrameUsingName:", NSString)(name); + } + + bool setFrameUsingName (NSString name, bool force) + { + return invokeObjcSelf!(bool, "setFrameUsingName:force:", NSString, bool)(name, force); + } + + bool setFrameUsingName (NSString name) + { + return invokeObjcSelf!(bool, "setFrameUsingName:", NSString)(name); + } + + bool setFrameAutosaveName (NSString name) + { + return invokeObjcSelf!(bool, "setFrameAutosaveName:", NSString)(name); + } + + NSString frameAutosaveName () + { + return invokeObjcSelf!(NSString, "frameAutosaveName"); + } + + static void removeFrameUsingName (NSString name) + { + return invokeObjcSelfClass!(void, "removeFrameUsingName:", NSString)(name); + } + + void cacheImageInRect (NSRect aRect) + { + return invokeObjcSelf!(void, "cacheImageInRect:", NSRect)(aRect); + } + + void restoreCachedImage () + { + return invokeObjcSelf!(void, "restoreCachedImage"); + } + + void discardCachedImage () + { + return invokeObjcSelf!(void, "discardCachedImage"); + } + + NSSize minSize () + { + return invokeObjcSelf!(NSSize, "minSize"); + } + + NSSize maxSize () + { + return invokeObjcSelf!(NSSize, "maxSize"); + } + + void setMinSize (NSSize size) + { + return invokeObjcSelf!(void, "setMinSize:", NSSize)(size); + } + + void setMaxSize (NSSize size) + { + return invokeObjcSelf!(void, "setMaxSize:", NSSize)(size); + } + + NSSize contentMinSize () + { + return invokeObjcSelf!(NSSize, "contentMinSize"); + } + + NSSize contentMaxSize () + { + return invokeObjcSelf!(NSSize, "contentMaxSize"); + } + + void setContentMinSize (NSSize size) + { + return invokeObjcSelf!(void, "setContentMinSize:", NSSize)(size); + } + + void setContentMaxSize (NSSize size) + { + return invokeObjcSelf!(void, "setContentMaxSize:", NSSize)(size); + } + + NSEvent nextEventMatchingMask (NSUInteger mask) + { + return invokeObjcSelf!(NSEvent, "nextEventMatchingMask:", NSUInteger)(mask); + } + + NSEvent nextEventMatchingMask (NSUInteger mask, NSDate expiration, NSString mode, bool deqFlag) + { + return invokeObjcSelf!(NSEvent, "nextEventMatchingMask:untilDate:inMode:dequeue:", NSUInteger, NSDate, NSString, bool)(mask, expiration, mode, deqFlag); + } + + void discardEventsMatchingMask (NSUInteger mask, NSEvent lastEvent) + { + return invokeObjcSelf!(void, "discardEventsMatchingMask:beforeEvent:", NSUInteger, NSEvent)(mask, lastEvent); + } + + void postEvent (NSEvent event, bool flag) + { + return invokeObjcSelf!(void, "postEvent:atStart:", NSEvent, bool)(event, flag); + } + + NSEvent currentEvent () + { + return invokeObjcSelf!(NSEvent, "currentEvent"); + } + + void setAcceptsMouseMovedEvents (bool flag) + { + return invokeObjcSelf!(void, "setAcceptsMouseMovedEvents:", bool)(flag); + } + + bool acceptsMouseMovedEvents () + { + return invokeObjcSelf!(bool, "acceptsMouseMovedEvents"); + } + + void setIgnoresMouseEvents (bool flag) + { + return invokeObjcSelf!(void, "setIgnoresMouseEvents:", bool)(flag); + } + + bool ignoresMouseEvents () + { + return invokeObjcSelf!(bool, "ignoresMouseEvents"); + } + + NSDictionary deviceDescription () + { + return invokeObjcSelf!(NSDictionary, "deviceDescription"); + } + + void sendEvent (NSEvent theEvent) + { + return invokeObjcSelf!(void, "sendEvent:", NSEvent)(theEvent); + } + + NSPoint mouseLocationOutsideOfEventStream () + { + return invokeObjcSelf!(NSPoint, "mouseLocationOutsideOfEventStream"); + } + + static void menuChanged (NSMenu menu) + { + return invokeObjcSelfClass!(void, "menuChanged:", NSMenu)(menu); + } + + Object windowController () + { + return invokeObjcSelf!(Object, "windowController"); + } + + void setWindowController (NSWindowController windowController) + { + return invokeObjcSelf!(void, "setWindowController:", NSWindowController)(windowController); + } + + bool isSheet () + { + return invokeObjcSelf!(bool, "isSheet"); + } + + NSWindow attachedSheet () + { + id result = invokeObjcSelf!(id, "attachedSheet"); + return result is this.objcObject ? this : (result !is null ? new NSWindow(result) : null); + } + + static NSButton standardWindowButton (uint b, NSUInteger styleMask) + { + return invokeObjcSelfClass!(NSButton, "standardWindowButton:forStyleMask:", uint, NSUInteger)(b, styleMask); + } + + NSButton standardWindowButton (uint b) + { + return invokeObjcSelf!(NSButton, "standardWindowButton:", uint)(b); + } + + void addChildWindow (NSWindow childWin, int place) + { + return invokeObjcSelf!(void, "addChildWindow:ordered:", NSWindow, int)(childWin, place); + } + + void removeChildWindow (NSWindow childWin) + { + return invokeObjcSelf!(void, "removeChildWindow:", NSWindow)(childWin); + } + + NSArray childWindows () + { + return invokeObjcSelf!(NSArray, "childWindows"); + } + + NSWindow parentWindow () + { + id result = invokeObjcSelf!(id, "parentWindow"); + return result is this.objcObject ? this : (result !is null ? new NSWindow(result) : null); + } + + void setParentWindow (NSWindow window) + { + return invokeObjcSelf!(void, "setParentWindow:", NSWindow)(window); + } + + NSGraphicsContext graphicsContext () + { + return invokeObjcSelf!(NSGraphicsContext, "graphicsContext"); + } + + CGFloat userSpaceScaleFactor () + { + return invokeObjcSelf!(CGFloat, "userSpaceScaleFactor"); + } + + // Drawers + NSArray drawers () + { + return invokeObjcSelf!(NSArray, "drawers"); + } + + // NSScripting + bool hasCloseBox () + { + return invokeObjcSelf!(bool, "hasCloseBox"); + } + + bool hasTitleBar () + { + return invokeObjcSelf!(bool, "hasTitleBar"); + } + + bool isFloatingPanel () + { + return invokeObjcSelf!(bool, "isFloatingPanel"); + } + + bool isMiniaturizable () + { + return invokeObjcSelf!(bool, "isMiniaturizable"); + } + + bool isModalPanel () + { + return invokeObjcSelf!(bool, "isModalPanel"); + } + + bool isResizable () + { + return invokeObjcSelf!(bool, "isResizable"); + } + + bool isZoomable () + { + return invokeObjcSelf!(bool, "isZoomable"); + } + + NSInteger orderedIndex () + { + return invokeObjcSelf!(NSInteger, "orderedIndex"); + } + + void setIsMiniaturized (bool flag) + { + return invokeObjcSelf!(void, "setIsMiniaturized:", bool)(flag); + } + + void setIsVisible (bool flag) + { + return invokeObjcSelf!(void, "setIsVisible:", bool)(flag); + } + + void setIsZoomed (bool flag) + { + return invokeObjcSelf!(void, "setIsZoomed:", bool)(flag); + } + + void setOrderedIndex (NSInteger index) + { + return invokeObjcSelf!(void, "setOrderedIndex:", NSInteger)(index); + } + + Object handleCloseScriptCommand (NSCloseCommand command) + { + return invokeObjcSelf!(Object, "handleCloseScriptCommand:", NSCloseCommand)(command); + } + + Object handlePrintScriptCommand (NSScriptCommand command) + { + return invokeObjcSelf!(Object, "handlePrintScriptCommand:", NSScriptCommand)(command); + } + + Object handleSaveScriptCommand (NSScriptCommand command) + { + return invokeObjcSelf!(Object, "handleSaveScriptCommand:", NSScriptCommand)(command); + } + + // NSCarbonExtensions + typeof(this) initWithWindowRef (void* windowRef) + { + id result = invokeObjcSelf!(id, "initWithWindowRef:", void*)(windowRef); + return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); + } + + this (void* windowRef) + { + super(typeof(this).alloc.initWithWindowRef(windowRef).objcObject); + } + + void* windowRef () + { + return invokeObjcSelf!(void*, "windowRef"); + } + + // NSToolbarSupport + void setToolbar (NSToolbar toolbar) + { + return invokeObjcSelf!(void, "setToolbar:", NSToolbar)(toolbar); + } + + NSToolbar toolbar () + { + return invokeObjcSelf!(NSToolbar, "toolbar"); + } + + void toggleToolbarShown (Object sender) + { + return invokeObjcSelf!(void, "toggleToolbarShown:", Object)(sender); + } + + void runToolbarCustomizationPalette (Object sender) + { + return invokeObjcSelf!(void, "runToolbarCustomizationPalette:", Object)(sender); + } + + void setShowsToolbarButton (bool show) + { + return invokeObjcSelf!(void, "setShowsToolbarButton:", bool)(show); + } + + bool showsToolbarButton () + { + return invokeObjcSelf!(bool, "showsToolbarButton"); + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSWindowController.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSWindowController.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,194 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSWindowController; + +import dstep.appkit.NSDocument; +import dstep.appkit.NSNibDeclarations; +import dstep.appkit.NSResponder; +import dstep.appkit.NSWindow; +import dstep.foundation.NSArray; +import dstep.foundation.NSCoder; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSWindowController : NSResponder, INSCoding +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + NSWindowController initWithWindow (NSWindow window) + { + id result = invokeObjcSelf!(id, "initWithWindow:", NSWindow)(window); + return result is this.objcObject ? this : (result !is null ? new NSWindowController(result) : null); + } + + this (NSWindow window) + { + super(NSWindowController.alloc.initWithWindow(window).objcObject); + } + + NSWindowController initWithWindowNibName (NSString windowNibName) + { + id result = invokeObjcSelf!(id, "initWithWindowNibName:", NSString)(windowNibName); + return result is this.objcObject ? this : (result !is null ? new NSWindowController(result) : null); + } + + this (NSString windowNibName) + { + super(NSWindowController.alloc.initWithWindowNibName(windowNibName).objcObject); + } + + NSWindowController initWithWindowNibName (NSString windowNibName, Object owner) + { + id result = invokeObjcSelf!(id, "initWithWindowNibName:owner:", NSString, Object)(windowNibName, owner); + return result is this.objcObject ? this : (result !is null ? new NSWindowController(result) : null); + } + + this (NSString windowNibName, Object owner) + { + super(NSWindowController.alloc.initWithWindowNibName(windowNibName, owner).objcObject); + } + + NSWindowController initWithWindowNibPath (NSString windowNibPath, Object owner) + { + id result = invokeObjcSelf!(id, "initWithWindowNibPath:owner:", NSString, Object)(windowNibPath, owner); + return result is this.objcObject ? this : (result !is null ? new NSWindowController(result) : null); + } + + this (NSString windowNibPath, Object owner) + { + super(NSWindowController.alloc.initWithWindowNibPath(windowNibPath, owner).objcObject); + } + + NSString windowNibName () + { + return invokeObjcSelf!(NSString, "windowNibName"); + } + + NSString windowNibPath () + { + return invokeObjcSelf!(NSString, "windowNibPath"); + } + + Object owner () + { + return invokeObjcSelf!(Object, "owner"); + } + + void setWindowFrameAutosaveName (NSString name) + { + return invokeObjcSelf!(void, "setWindowFrameAutosaveName:", NSString)(name); + } + + NSString windowFrameAutosaveName () + { + return invokeObjcSelf!(NSString, "windowFrameAutosaveName"); + } + + void setShouldCascadeWindows (bool flag) + { + return invokeObjcSelf!(void, "setShouldCascadeWindows:", bool)(flag); + } + + bool shouldCascadeWindows () + { + return invokeObjcSelf!(bool, "shouldCascadeWindows"); + } + + Object document () + { + return invokeObjcSelf!(Object, "document"); + } + + void setDocument (NSDocument document) + { + return invokeObjcSelf!(void, "setDocument:", NSDocument)(document); + } + + void setDocumentEdited (bool dirtyFlag) + { + return invokeObjcSelf!(void, "setDocumentEdited:", bool)(dirtyFlag); + } + + void setShouldCloseDocument (bool flag) + { + return invokeObjcSelf!(void, "setShouldCloseDocument:", bool)(flag); + } + + bool shouldCloseDocument () + { + return invokeObjcSelf!(bool, "shouldCloseDocument"); + } + + void setWindow (NSWindow window) + { + return invokeObjcSelf!(void, "setWindow:", NSWindow)(window); + } + + NSWindow window () + { + return invokeObjcSelf!(NSWindow, "window"); + } + + void synchronizeWindowTitleWithDocumentName () + { + return invokeObjcSelf!(void, "synchronizeWindowTitleWithDocumentName"); + } + + NSString windowTitleForDocumentDisplayName (NSString displayName) + { + return invokeObjcSelf!(NSString, "windowTitleForDocumentDisplayName:", NSString)(displayName); + } + + void close () + { + return invokeObjcSelf!(void, "close"); + } + + void showWindow (Object sender) + { + return invokeObjcSelf!(void, "showWindow:", Object)(sender); + } + + bool isWindowLoaded () + { + return invokeObjcSelf!(bool, "isWindowLoaded"); + } + + void windowWillLoad () + { + return invokeObjcSelf!(void, "windowWillLoad"); + } + + void windowDidLoad () + { + return invokeObjcSelf!(void, "windowDidLoad"); + } + + void loadWindow () + { + return invokeObjcSelf!(void, "loadWindow"); + } + +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSWindowScripting.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSWindowScripting.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,107 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSWindowScripting; + +import dstep.appkit.NSWindow; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +const TNSScripting = ` + + bool hasCloseBox () + { + return invokeObjcSelf!(bool, "hasCloseBox"); + } + + bool hasTitleBar () + { + return invokeObjcSelf!(bool, "hasTitleBar"); + } + + bool isFloatingPanel () + { + return invokeObjcSelf!(bool, "isFloatingPanel"); + } + + bool isMiniaturizable () + { + return invokeObjcSelf!(bool, "isMiniaturizable"); + } + + bool isModalPanel () + { + return invokeObjcSelf!(bool, "isModalPanel"); + } + + bool isResizable () + { + return invokeObjcSelf!(bool, "isResizable"); + } + + bool isZoomable () + { + return invokeObjcSelf!(bool, "isZoomable"); + } + + NSInteger orderedIndex () + { + return invokeObjcSelf!(NSInteger, "orderedIndex"); + } + + void setIsMiniaturized (bool flag) + { + return invokeObjcSelf!(void, "setIsMiniaturized:", bool)(flag); + } + + void setIsVisible (bool flag) + { + return invokeObjcSelf!(void, "setIsVisible:", bool)(flag); + } + + void setIsZoomed (bool flag) + { + return invokeObjcSelf!(void, "setIsZoomed:", bool)(flag); + } + + void setOrderedIndex (NSInteger index) + { + return invokeObjcSelf!(void, "setOrderedIndex:", NSInteger)(index); + } + + Object handleCloseScriptCommand (NSCloseCommand command) + { + return invokeObjcSelf!(Object, "handleCloseScriptCommand:", NSCloseCommand)(command); + } + + Object handlePrintScriptCommand (NSScriptCommand command) + { + return invokeObjcSelf!(Object, "handlePrintScriptCommand:", NSScriptCommand)(command); + } + + Object handleSaveScriptCommand (NSScriptCommand command) + { + return invokeObjcSelf!(Object, "handleSaveScriptCommand:", NSScriptCommand)(command); + } + + //mixin ObjcBindMethod!(hasCloseBox, "hasCloseBox"); + //mixin ObjcBindMethod!(hasTitleBar, "hasTitleBar"); + //mixin ObjcBindMethod!(isFloatingPanel, "isFloatingPanel"); + //mixin ObjcBindMethod!(isMiniaturizable, "isMiniaturizable"); + //mixin ObjcBindMethod!(isModalPanel, "isModalPanel"); + //mixin ObjcBindMethod!(isResizable, "isResizable"); + //mixin ObjcBindMethod!(isZoomable, "isZoomable"); + //mixin ObjcBindMethod!(orderedIndex, "orderedIndex"); + //mixin ObjcBindMethod!(setIsMiniaturized, "setIsMiniaturized:"); + //mixin ObjcBindMethod!(setIsVisible, "setIsVisible:"); + //mixin ObjcBindMethod!(setIsZoomed, "setIsZoomed:"); + //mixin ObjcBindMethod!(setOrderedIndex, "setOrderedIndex:"); + //mixin ObjcBindMethod!(handleCloseScriptCommand, "handleCloseScriptCommand:"); + //mixin ObjcBindMethod!(handlePrintScriptCommand, "handlePrintScriptCommand:"); + //mixin ObjcBindMethod!(handleSaveScriptCommand, "handleSaveScriptCommand:"); + +`; + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSWindow_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSWindow_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,34 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSWindow_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package id NSWindowDidBecomeKeyNotification; + package id NSWindowDidBecomeMainNotification; + package id NSWindowDidChangeScreenNotification; + package id NSWindowDidDeminiaturizeNotification; + package id NSWindowDidExposeNotification; + package id NSWindowDidMiniaturizeNotification; + package id NSWindowDidMoveNotification; + package id NSWindowDidResignKeyNotification; + package id NSWindowDidResignMainNotification; + package id NSWindowDidResizeNotification; + package id NSWindowDidUpdateNotification; + package id NSWindowWillCloseNotification; + package id NSWindowWillMiniaturizeNotification; + package id NSWindowWillMoveNotification; + package id NSWindowWillBeginSheetNotification; + package id NSWindowDidEndSheetNotification; + package id NSWindowDidChangeScreenProfileNotification; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSWorkspace.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSWorkspace.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,582 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSWorkspace; + +import dstep.appkit.AppKitDefines; +import dstep.foundation.NSArray; +import dstep.appkit.NSImage; +import dstep.appkit.NSView; +import dstep.foundation.NSAppleEventDescriptor; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSError; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSNotification; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSURL; +import dstep.foundation.NSValue; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.appkit.NSWorkspace_bindings; + +typedef NSUInteger NSWorkspaceLaunchOptions; +typedef NSUInteger NSWorkspaceIconCreationOptions; + +private +{ + NSString NSWorkspaceDidLaunchApplicationNotification_; + NSString NSWorkspaceDidMountNotification_; + NSString NSWorkspaceDidPerformFileOperationNotification_; + NSString NSWorkspaceDidTerminateApplicationNotification_; + NSString NSWorkspaceDidUnmountNotification_; + NSString NSWorkspaceWillLaunchApplicationNotification_; + NSString NSWorkspaceWillPowerOffNotification_; + NSString NSWorkspaceWillUnmountNotification_; + NSString NSWorkspaceWillSleepNotification_; + NSString NSWorkspaceDidWakeNotification_; + NSString NSWorkspaceSessionDidBecomeActiveNotification_; + NSString NSWorkspaceSessionDidResignActiveNotification_; + NSString NSPlainFileType_; + NSString NSDirectoryFileType_; + NSString NSApplicationFileType_; + NSString NSFilesystemFileType_; + NSString NSShellCommandFileType_; + NSString NSWorkspaceMoveOperation_; + NSString NSWorkspaceCopyOperation_; + NSString NSWorkspaceLinkOperation_; + NSString NSWorkspaceCompressOperation_; + NSString NSWorkspaceDecompressOperation_; + NSString NSWorkspaceEncryptOperation_; + NSString NSWorkspaceDecryptOperation_; + NSString NSWorkspaceDestroyOperation_; + NSString NSWorkspaceRecycleOperation_; + NSString NSWorkspaceDuplicateOperation_; +} + +NSString NSWorkspaceDidLaunchApplicationNotification () +{ + if (NSWorkspaceDidLaunchApplicationNotification_) + return NSWorkspaceDidLaunchApplicationNotification_; + + return NSWorkspaceDidLaunchApplicationNotification_ = new NSString(bindings.NSWorkspaceDidLaunchApplicationNotification); +} + +NSString NSWorkspaceDidMountNotification () +{ + if (NSWorkspaceDidMountNotification_) + return NSWorkspaceDidMountNotification_; + + return NSWorkspaceDidMountNotification_ = new NSString(bindings.NSWorkspaceDidMountNotification); +} + +NSString NSWorkspaceDidPerformFileOperationNotification () +{ + if (NSWorkspaceDidPerformFileOperationNotification_) + return NSWorkspaceDidPerformFileOperationNotification_; + + return NSWorkspaceDidPerformFileOperationNotification_ = new NSString(bindings.NSWorkspaceDidPerformFileOperationNotification); +} + +NSString NSWorkspaceDidTerminateApplicationNotification () +{ + if (NSWorkspaceDidTerminateApplicationNotification_) + return NSWorkspaceDidTerminateApplicationNotification_; + + return NSWorkspaceDidTerminateApplicationNotification_ = new NSString(bindings.NSWorkspaceDidTerminateApplicationNotification); +} + +NSString NSWorkspaceDidUnmountNotification () +{ + if (NSWorkspaceDidUnmountNotification_) + return NSWorkspaceDidUnmountNotification_; + + return NSWorkspaceDidUnmountNotification_ = new NSString(bindings.NSWorkspaceDidUnmountNotification); +} + +NSString NSWorkspaceWillLaunchApplicationNotification () +{ + if (NSWorkspaceWillLaunchApplicationNotification_) + return NSWorkspaceWillLaunchApplicationNotification_; + + return NSWorkspaceWillLaunchApplicationNotification_ = new NSString(bindings.NSWorkspaceWillLaunchApplicationNotification); +} + +NSString NSWorkspaceWillPowerOffNotification () +{ + if (NSWorkspaceWillPowerOffNotification_) + return NSWorkspaceWillPowerOffNotification_; + + return NSWorkspaceWillPowerOffNotification_ = new NSString(bindings.NSWorkspaceWillPowerOffNotification); +} + +NSString NSWorkspaceWillUnmountNotification () +{ + if (NSWorkspaceWillUnmountNotification_) + return NSWorkspaceWillUnmountNotification_; + + return NSWorkspaceWillUnmountNotification_ = new NSString(bindings.NSWorkspaceWillUnmountNotification); +} + +NSString NSWorkspaceWillSleepNotification () +{ + if (NSWorkspaceWillSleepNotification_) + return NSWorkspaceWillSleepNotification_; + + return NSWorkspaceWillSleepNotification_ = new NSString(bindings.NSWorkspaceWillSleepNotification); +} + +NSString NSWorkspaceDidWakeNotification () +{ + if (NSWorkspaceDidWakeNotification_) + return NSWorkspaceDidWakeNotification_; + + return NSWorkspaceDidWakeNotification_ = new NSString(bindings.NSWorkspaceDidWakeNotification); +} + +NSString NSWorkspaceSessionDidBecomeActiveNotification () +{ + if (NSWorkspaceSessionDidBecomeActiveNotification_) + return NSWorkspaceSessionDidBecomeActiveNotification_; + + return NSWorkspaceSessionDidBecomeActiveNotification_ = new NSString(bindings.NSWorkspaceSessionDidBecomeActiveNotification); +} + +NSString NSWorkspaceSessionDidResignActiveNotification () +{ + if (NSWorkspaceSessionDidResignActiveNotification_) + return NSWorkspaceSessionDidResignActiveNotification_; + + return NSWorkspaceSessionDidResignActiveNotification_ = new NSString(bindings.NSWorkspaceSessionDidResignActiveNotification); +} + +NSString NSPlainFileType () +{ + if (NSPlainFileType_) + return NSPlainFileType_; + + return NSPlainFileType_ = new NSString(bindings.NSPlainFileType); +} + +NSString NSDirectoryFileType () +{ + if (NSDirectoryFileType_) + return NSDirectoryFileType_; + + return NSDirectoryFileType_ = new NSString(bindings.NSDirectoryFileType); +} + +NSString NSApplicationFileType () +{ + if (NSApplicationFileType_) + return NSApplicationFileType_; + + return NSApplicationFileType_ = new NSString(bindings.NSApplicationFileType); +} + +NSString NSFilesystemFileType () +{ + if (NSFilesystemFileType_) + return NSFilesystemFileType_; + + return NSFilesystemFileType_ = new NSString(bindings.NSFilesystemFileType); +} + +NSString NSShellCommandFileType () +{ + if (NSShellCommandFileType_) + return NSShellCommandFileType_; + + return NSShellCommandFileType_ = new NSString(bindings.NSShellCommandFileType); +} + +NSString NSWorkspaceMoveOperation () +{ + if (NSWorkspaceMoveOperation_) + return NSWorkspaceMoveOperation_; + + return NSWorkspaceMoveOperation_ = new NSString(bindings.NSWorkspaceMoveOperation); +} + +NSString NSWorkspaceCopyOperation () +{ + if (NSWorkspaceCopyOperation_) + return NSWorkspaceCopyOperation_; + + return NSWorkspaceCopyOperation_ = new NSString(bindings.NSWorkspaceCopyOperation); +} + +NSString NSWorkspaceLinkOperation () +{ + if (NSWorkspaceLinkOperation_) + return NSWorkspaceLinkOperation_; + + return NSWorkspaceLinkOperation_ = new NSString(bindings.NSWorkspaceLinkOperation); +} + +NSString NSWorkspaceCompressOperation () +{ + if (NSWorkspaceCompressOperation_) + return NSWorkspaceCompressOperation_; + + return NSWorkspaceCompressOperation_ = new NSString(bindings.NSWorkspaceCompressOperation); +} + +NSString NSWorkspaceDecompressOperation () +{ + if (NSWorkspaceDecompressOperation_) + return NSWorkspaceDecompressOperation_; + + return NSWorkspaceDecompressOperation_ = new NSString(bindings.NSWorkspaceDecompressOperation); +} + +NSString NSWorkspaceEncryptOperation () +{ + if (NSWorkspaceEncryptOperation_) + return NSWorkspaceEncryptOperation_; + + return NSWorkspaceEncryptOperation_ = new NSString(bindings.NSWorkspaceEncryptOperation); +} + +NSString NSWorkspaceDecryptOperation () +{ + if (NSWorkspaceDecryptOperation_) + return NSWorkspaceDecryptOperation_; + + return NSWorkspaceDecryptOperation_ = new NSString(bindings.NSWorkspaceDecryptOperation); +} + +NSString NSWorkspaceDestroyOperation () +{ + if (NSWorkspaceDestroyOperation_) + return NSWorkspaceDestroyOperation_; + + return NSWorkspaceDestroyOperation_ = new NSString(bindings.NSWorkspaceDestroyOperation); +} + +NSString NSWorkspaceRecycleOperation () +{ + if (NSWorkspaceRecycleOperation_) + return NSWorkspaceRecycleOperation_; + + return NSWorkspaceRecycleOperation_ = new NSString(bindings.NSWorkspaceRecycleOperation); +} + +NSString NSWorkspaceDuplicateOperation () +{ + if (NSWorkspaceDuplicateOperation_) + return NSWorkspaceDuplicateOperation_; + + return NSWorkspaceDuplicateOperation_ = new NSString(bindings.NSWorkspaceDuplicateOperation); +} + +enum +{ + NSWorkspaceLaunchAndPrint = 0x00000002, + NSWorkspaceLaunchInhibitingBackgroundOnly = 0x00000080, + NSWorkspaceLaunchWithoutAddingToRecents = 0x00000100, + NSWorkspaceLaunchWithoutActivation = 0x00000200, + NSWorkspaceLaunchAsync = 0x00010000, + NSWorkspaceLaunchAllowingClassicStartup = 0x00020000, + NSWorkspaceLaunchPreferringClassic = 0x00040000, + NSWorkspaceLaunchNewInstance = 0x00080000, + NSWorkspaceLaunchAndHide = 0x00100000, + NSWorkspaceLaunchAndHideOthers = 0x00200000, + NSWorkspaceLaunchDefault = NSWorkspaceLaunchAsync | +NSWorkspaceLaunchAllowingClassicStartup +} + +enum +{ + NSExcludeQuickDrawElementsIconCreationOption = 1 << 1, + NSExclude10_4ElementsIconCreationOption = 1 << 2 +} + +class NSWorkspace : NSObject +{ + mixin (ObjcWrap); + + static NSWorkspace sharedWorkspace () + { + return invokeObjcSelfClass!(NSWorkspace, "sharedWorkspace"); + } + + NSNotificationCenter notificationCenter () + { + return invokeObjcSelf!(NSNotificationCenter, "notificationCenter"); + } + + bool openFile (NSString fullPath) + { + return invokeObjcSelf!(bool, "openFile:", NSString)(fullPath); + } + + bool openFile (NSString fullPath, NSString appName) + { + return invokeObjcSelf!(bool, "openFile:withApplication:", NSString, NSString)(fullPath, appName); + } + + bool openFile (NSString fullPath, NSString appName, bool flag) + { + return invokeObjcSelf!(bool, "openFile:withApplication:andDeactivate:", NSString, NSString, bool)(fullPath, appName, flag); + } + + bool openTempFile (NSString fullPath) + { + return invokeObjcSelf!(bool, "openTempFile:", NSString)(fullPath); + } + + bool openFile (NSString fullPath, NSImage anImage, NSPoint point, NSView aView) + { + return invokeObjcSelf!(bool, "openFile:fromImage:at:inView:", NSString, NSImage, NSPoint, NSView)(fullPath, anImage, point, aView); + } + + bool openURL (NSURL url) + { + return invokeObjcSelf!(bool, "openURL:", NSURL)(url); + } + + bool launchApplication (NSString appName) + { + return invokeObjcSelf!(bool, "launchApplication:", NSString)(appName); + } + + bool launchApplication (NSString appName, bool showIcon, bool autolaunch) + { + return invokeObjcSelf!(bool, "launchApplication:showIcon:autolaunch:", NSString, bool, bool)(appName, showIcon, autolaunch); + } + + NSString fullPathForApplication (NSString appName) + { + return invokeObjcSelf!(NSString, "fullPathForApplication:", NSString)(appName); + } + + bool selectFile (NSString fullPath, NSString rootFullpath) + { + return invokeObjcSelf!(bool, "selectFile:inFileViewerRootedAtPath:", NSString, NSString)(fullPath, rootFullpath); + } + + void findApplications () + { + return invokeObjcSelf!(void, "findApplications"); + } + + void noteFileSystemChanged () + { + return invokeObjcSelf!(void, "noteFileSystemChanged"); + } + + void noteFileSystemChanged (NSString path) + { + return invokeObjcSelf!(void, "noteFileSystemChanged:", NSString)(path); + } + + bool fileSystemChanged () + { + return invokeObjcSelf!(bool, "fileSystemChanged"); + } + + void noteUserDefaultsChanged () + { + return invokeObjcSelf!(void, "noteUserDefaultsChanged"); + } + + bool userDefaultsChanged () + { + return invokeObjcSelf!(bool, "userDefaultsChanged"); + } + + bool getInfoForFile (NSString fullPath, out NSString appName, ref NSString type) + { + id app; + id t; + + if (type) + t = type.objcObject; + + bool result = invokeObjcSelf!(bool, "getInfoForFile:application:type:", NSString, id*, id*)(fullPath, &app, &t); + + if (app) + appName = new NSString(app); + + if (t) + type = new NSString(t); + + return result; + } + + bool isFilePackageAtPath (NSString fullPath) + { + return invokeObjcSelf!(bool, "isFilePackageAtPath:", NSString)(fullPath); + } + + NSImage iconForFile (NSString fullPath) + { + return invokeObjcSelf!(NSImage, "iconForFile:", NSString)(fullPath); + } + + NSImage iconForFiles (NSArray fullPaths) + { + return invokeObjcSelf!(NSImage, "iconForFiles:", NSArray)(fullPaths); + } + + NSImage iconForFileType (NSString fileType) + { + return invokeObjcSelf!(NSImage, "iconForFileType:", NSString)(fileType); + } + + bool setIcon (NSImage image, NSString fullPath, uint options) + { + return invokeObjcSelf!(bool, "setIcon:forFile:options:", NSImage, NSString, uint)(image, fullPath, options); + } + + bool getFileSystemInfoForPath (NSString fullPath, bool* removableFlag, bool* writableFlag, bool* unmountableFlag, ref NSString description, ref NSString fileSystemType) + { + id desc; + id fileSysType; + + if (description) + desc = description.objcObject; + + if (fileSysType) + fileSysType = fileSystemType.objcObject; + + bool result = invokeObjcSelf!(bool, "getFileSystemInfoForPath:isRemovable:isWritable:isUnmountable:description:type:", NSString, bool*, bool*, bool*, id*, id*)(fullPath, removableFlag, writableFlag, unmountableFlag, &desc, &fileSysType); + + if (desc) + description = new NSString(desc); + + if (fileSysType) + fileSystemType = new NSString(fileSysType); + + return result; + } + + bool performFileOperation (NSString operation, NSString source, NSString destination, NSArray files, NSInteger* tag) + { + return invokeObjcSelf!(bool, "performFileOperation:source:destination:files:tag:", NSString, NSString, NSString, NSArray, NSInteger*)(operation, source, destination, files, tag); + } + + bool unmountAndEjectDeviceAtPath (NSString path) + { + return invokeObjcSelf!(bool, "unmountAndEjectDeviceAtPath:", NSString)(path); + } + + NSInteger extendPowerOffBy (NSInteger requested) + { + return invokeObjcSelf!(NSInteger, "extendPowerOffBy:", NSInteger)(requested); + } + + void slideImage (NSImage image, NSPoint fromPoint, NSPoint toPoint) + { + return invokeObjcSelf!(void, "slideImage:from:to:", NSImage, NSPoint, NSPoint)(image, fromPoint, toPoint); + } + + void hideOtherApplications () + { + return invokeObjcSelf!(void, "hideOtherApplications"); + } + + NSArray mountedLocalVolumePaths () + { + return invokeObjcSelf!(NSArray, "mountedLocalVolumePaths"); + } + + NSArray mountedRemovableMedia () + { + return invokeObjcSelf!(NSArray, "mountedRemovableMedia"); + } + + NSArray mountNewRemovableMedia () + { + return invokeObjcSelf!(NSArray, "mountNewRemovableMedia"); + } + + void checkForRemovableMedia () + { + return invokeObjcSelf!(void, "checkForRemovableMedia"); + } + + NSString absolutePathForAppBundleWithIdentifier (NSString bundleIdentifier) + { + return invokeObjcSelf!(NSString, "absolutePathForAppBundleWithIdentifier:", NSString)(bundleIdentifier); + } + + bool launchAppWithBundleIdentifier (NSString bundleIdentifier, uint options, NSAppleEventDescriptor descriptor, ref NSNumber identifier) + { + id ident; + + if (identifier) + ident = identifier.objcObject; + + bool result = invokeObjcSelf!(bool, "launchAppWithBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifier:", NSString, uint, NSAppleEventDescriptor, id*)(bundleIdentifier, options, descriptor, &ident); + + if (ident) + identifier = new NSNumber(ident); + + return result; + } + + bool openURLs (NSArray urls, NSString bundleIdentifier, uint options, NSAppleEventDescriptor descriptor, ref NSArray identifiers) + { + id ident; + + if (identifiers) + ident = identifiers.objcObject; + + bool result = invokeObjcSelf!(bool, "openURLs:withAppBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifiers:", NSArray, NSString, uint, NSAppleEventDescriptor, id*)(urls, bundleIdentifier, options, descriptor, &ident); + + if (ident) + identifiers = new NSArray(ident); + + return result; + } + + NSArray launchedApplications () + { + return invokeObjcSelf!(NSArray, "launchedApplications"); + } + + NSDictionary activeApplication () + { + return invokeObjcSelf!(NSDictionary, "activeApplication"); + } + + NSString typeOfFile (NSString absoluteFilePath, out NSError outError) + { + id error; + + NSString result = invokeObjcSelf!(NSString, "typeOfFile:error:", NSString, id*)(absoluteFilePath, &error); + + if (error) + outError = new NSError(error); + + return result; + } + + NSString localizedDescriptionForType (NSString typeName) + { + return invokeObjcSelf!(NSString, "localizedDescriptionForType:", NSString)(typeName); + } + + NSString preferredFilenameExtensionForType (NSString typeName) + { + return invokeObjcSelf!(NSString, "preferredFilenameExtensionForType:", NSString)(typeName); + } + + bool filenameExtension (NSString filenameExtension, NSString typeName) + { + return invokeObjcSelf!(bool, "filenameExtension:isValidForType:", NSString, NSString)(filenameExtension, typeName); + } + + bool type (NSString firstTypeName, NSString secondTypeName) + { + return invokeObjcSelf!(bool, "type:conformsToType:", NSString, NSString)(firstTypeName, secondTypeName); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/appkit/NSWorkspace_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSWorkspace_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,43 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSWorkspace_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package id NSWorkspaceDidLaunchApplicationNotification; + package id NSWorkspaceDidMountNotification; + package id NSWorkspaceDidPerformFileOperationNotification; + package id NSWorkspaceDidTerminateApplicationNotification; + package id NSWorkspaceDidUnmountNotification; + package id NSWorkspaceWillLaunchApplicationNotification; + package id NSWorkspaceWillPowerOffNotification; + package id NSWorkspaceWillUnmountNotification; + package id NSWorkspaceWillSleepNotification; + package id NSWorkspaceDidWakeNotification; + package id NSWorkspaceSessionDidBecomeActiveNotification; + package id NSWorkspaceSessionDidResignActiveNotification; + package id NSPlainFileType; + package id NSDirectoryFileType; + package id NSApplicationFileType; + package id NSFilesystemFileType; + package id NSShellCommandFileType; + package id NSWorkspaceMoveOperation; + package id NSWorkspaceCopyOperation; + package id NSWorkspaceLinkOperation; + package id NSWorkspaceCompressOperation; + package id NSWorkspaceDecompressOperation; + package id NSWorkspaceEncryptOperation; + package id NSWorkspaceDecryptOperation; + package id NSWorkspaceDestroyOperation; + package id NSWorkspaceRecycleOperation; + package id NSWorkspaceDuplicateOperation; + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/applicationservices/ApplicationServices.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/applicationservices/ApplicationServices.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,13 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.applicationservices.ApplicationServices; + +public: + +import dstep.applicationservices.ats.ATS; +import dstep.applicationservices.colorsync.ColorSync; +import dstep.applicationservices.coregraphics.CoreGraphics; \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/cocoa/Cocoa.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/cocoa/Cocoa.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,13 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 28, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.cocoa.Cocoa; + +public: + +import dstep.appkit.AppKit; +import dstep.foundation.Foundation; +import dstep.coredata.CoreData; \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/coreaudio/AudioDriverPlugIn.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/coreaudio/AudioDriverPlugIn.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,40 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 30, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.coreaudio.AudioDriverPlugIn; + +import dstep.coreaudio.AudioHardware; +import dstep.coreaudio.CoreAudioTypes; +import dstep.coreservices.ae.AEMach; + +private alias mach_port_t io_object_t; + +extern (C) +{ + alias int function (AudioDeviceID inDevice, uint inChannel, bool isInput, AudioDevicePropertyID inPropertyID) AudioDriverPlugInDevicePropertyChangedProc; + alias int function (AudioDeviceID inDevice, io_object_t inIOAudioStream, uint inChannel, AudioDevicePropertyID inPropertyID) AudioDriverPlugInStreamPropertyChangedProc; +} + +struct AudioDriverPlugInHostInfo +{ + uint mDeviceID; + uint mIOAudioDevice; + uint mIOAudioEngine; + AudioDriverPlugInDevicePropertyChangedProc mDevicePropertyChangedProc; + AudioDriverPlugInStreamPropertyChangedProc mStreamPropertyChangedProc; +} + +extern (C) +{ + int AudioDriverPlugInOpen (AudioDriverPlugInHostInfo* inHostInfo); + int AudioDriverPlugInClose (uint inDevice); + int AudioDriverPlugInDeviceGetPropertyInfo (uint inDevice, uint inChannel, ubyte isInput, uint inPropertyID, uint* outSize, char* outWritable); + int AudioDriverPlugInDeviceGetProperty (uint inDevice, uint inChannel, ubyte isInput, uint inPropertyID, uint* ioPropertyDataSize, void* outPropertyData); + int AudioDriverPlugInDeviceSetProperty (uint inDevice, AudioTimeStamp* inWhen, uint inChannel, ubyte isInput, uint inPropertyID, uint inPropertyDataSize, void* inPropertyData); + int AudioDriverPlugInStreamGetPropertyInfo (uint inDevice, uint inIOAudioStream, uint inChannel, uint inPropertyID, uint* outSize, char* outWritable); + int AudioDriverPlugInStreamGetProperty (uint inDevice, uint inIOAudioStream, uint inChannel, uint inPropertyID, uint* ioPropertyDataSize, void* outPropertyData); + int AudioDriverPlugInStreamSetProperty (uint inDevice, uint inIOAudioStream, AudioTimeStamp* inWhen, uint inChannel, uint inPropertyID, uint inPropertyDataSize, void* inPropertyData); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/coreaudio/AudioHardware.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/coreaudio/AudioHardware.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,678 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 30, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.coreaudio.AudioHardware; + +import dstep.coreaudio.CoreAudioTypes; +import dstep.corefoundation.CoreFoundation; +import dstep.internal.Version; +import dstep.objc.bridge.TypeEncoding; + +alias uint AudioObjectPropertySelector; +alias uint AudioObjectPropertyScope; +alias uint AudioObjectPropertyElement; +alias uint AudioClassID; +alias uint AudioObjectID; +alias uint AudioHardwarePropertyID; +alias uint AudioDeviceID; +alias uint AudioDevicePropertyID; +alias AudioDeviceIOProc AudioDeviceIOProcID; +alias uint AudioStreamID; + +extern (C) +{ + alias int function (AudioDeviceID inDevice, uint inChannel, bool isInput, AudioDevicePropertyID inPropertyID) AudioDevicePropertyListenerProc; + alias int function (AudioDevicePropertyID inPropertyID, void* inClientData) AudioHardwarePropertyListenerProc; + alias int function (AudioDeviceID inDevice, AudioTimeStamp* inNow, AudioBufferList* inInputData, AudioTimeStamp* inInputTime, AudioBufferList* outOutputData, AudioTimeStamp* inOutputTime, void* inClientData) AudioDeviceIOProc; + alias int function (AudioStreamID inStream, uint inChannel, AudioDevicePropertyID inPropertyID, void* inClientData) AudioStreamPropertyListenerProc; + alias int function (AudioObjectID inObjectID, uint inNumberAddresses, AudioObjectPropertyAddress* inAddresses, void* inClientData) AudioObjectPropertyListenerProc; +} + +// This is needed otherwise the enums will fail compiling with gdc +version (GNU) +{ + private + { + const __kAudioHardwareNotRunningError = getOSType!("stop"); + const __kAudioHardwareUnspecifiedError = getOSType!("what"); + const __kAudioHardwareUnknownPropertyError = getOSType!("who?"); + const __kAudioHardwareBadPropertySizeError = getOSType!("!siz"); + const __kAudioHardwareIllegalOperationError = getOSType!("nope"); + const __kAudioHardwareBadObjectError = getOSType!("!obj"); + const __kAudioHardwareBadDeviceError = getOSType!("!dev"); + const __kAudioHardwareBadStreamError = getOSType!("!str"); + const __kAudioHardwareUnsupportedOperationError = getOSType!("unop"); + const __kAudioDeviceUnsupportedFormatError = getOSType!("!dat"); + const __kAudioDevicePermissionsError = getOSType!("!hog"); + const __kAudioObjectPropertySelectorWildcard = getOSType!("****"); + const __kAudioObjectPropertyScopeWildcard = getOSType!("****"); + const __kAudioObjectPropertyScopeGlobal = getOSType!("glob"); + const __kAudioObjectClassID = getOSType!("aobj"); + const __kAudioObjectClassIDWildcard = getOSType!("****"); + const __kAudioObjectPropertyClass = getOSType!("clas"); + const __kAudioObjectPropertyOwner = getOSType!("stdv"); + const __kAudioObjectPropertyCreator = getOSType!("oplg"); + const __kAudioObjectPropertyName = getOSType!("lnam"); + const __kAudioObjectPropertyManufacturer = getOSType!("lmak"); + const __kAudioObjectPropertyElementName = getOSType!("lchn"); + const __kAudioObjectPropertyElementCategoryName = getOSType!("lccn"); + const __kAudioObjectPropertyElementNumberName = getOSType!("lcnn"); + const __kAudioObjectPropertyOwnedObjects = getOSType!("ownd"); + const __kAudioObjectPropertyListenerAdded = getOSType!("lisa"); + const __kAudioObjectPropertyListenerRemoved = getOSType!("lisr"); + const __kAudioControlClassID = getOSType!("actl"); + const __kAudioLevelControlClassID = getOSType!("levl"); + const __kAudioBooleanControlClassID = getOSType!("togl"); + const __kAudioSelectorControlClassID = getOSType!("slct"); + const __kAudioStereoPanControlClassID = getOSType!("span"); + const __kAudioVolumeControlClassID = getOSType!("vlme"); + const __kAudioLFEVolumeControlClassID = getOSType!("subv"); + const __kAudioBootChimeVolumeControlClassID = getOSType!("pram"); + const __kAudioMuteControlClassID = getOSType!("mute"); + const __kAudioSoloControlClassID = getOSType!("solo"); + const __kAudioJackControlClassID = getOSType!("jack"); + const __kAudioLFEMuteControlClassID = getOSType!("subm"); + const __kAudioISubOwnerControlClassID = getOSType!("atch"); + const __kAudioDataSourceControlClassID = getOSType!("dsrc"); + const __kAudioDataDestinationControlClassID = getOSType!("dest"); + const __kAudioClockSourceControlClassID = getOSType!("clck"); + const __kAudioLineLevelControlClassID = getOSType!("nlvl"); + const __kAudioControlPropertyScope = getOSType!("cscp"); + const __kAudioControlPropertyElement = getOSType!("celm"); + const __kAudioControlPropertyVariant = getOSType!("cvar"); + const __kAudioLevelControlPropertyScalarValue = getOSType!("lcsv"); + const __kAudioLevelControlPropertyDecibelValue = getOSType!("lcdv"); + const __kAudioLevelControlPropertyDecibelRange = getOSType!("lcdr"); + const __kAudioLevelControlPropertyConvertScalarToDecibels = getOSType!("lcsd"); + const __kAudioLevelControlPropertyConvertDecibelsToScalar = getOSType!("lcds"); + const __kAudioLevelControlPropertyDecibelsToScalarTransferFunction = getOSType!("lctf"); + const __kAudioBooleanControlPropertyValue = getOSType!("bcvl"); + const __kAudioSelectorControlPropertyCurrentItem = getOSType!("scci"); + const __kAudioSelectorControlPropertyAvailableItems = getOSType!("scai"); + const __kAudioSelectorControlPropertyItemName = getOSType!("scin"); + const __kAudioClockSourceControlPropertyItemKind = getOSType!("clkk"); + const __kAudioStereoPanControlPropertyValue = getOSType!("spcv"); + const __kAudioStereoPanControlPropertyPanningChannels = getOSType!("spcc"); + const __kAudioSystemObjectClassID = getOSType!("asys"); + const __kAudioHardwarePropertyProcessIsMaster = getOSType!("mast"); + const __kAudioHardwarePropertyIsInitingOrExiting = getOSType!("inot"); + const __kAudioHardwarePropertyDevices = getOSType!("dev#"); + const __kAudioHardwarePropertyDefaultInputDevice = getOSType!("dIn "); + const __kAudioHardwarePropertyDefaultOutputDevice = getOSType!("dOut"); + const __kAudioHardwarePropertyDefaultSystemOutputDevice = getOSType!("sOut"); + const __kAudioHardwarePropertyDeviceForUID = getOSType!("duid"); + const __kAudioHardwarePropertyProcessIsAudible = getOSType!("pmut"); + const __kAudioHardwarePropertySleepingIsAllowed = getOSType!("slep"); + const __kAudioHardwarePropertyUnloadingIsAllowed = getOSType!("unld"); + const __kAudioHardwarePropertyHogModeIsAllowed = getOSType!("hogr"); + const __kAudioHardwarePropertyRunLoop = getOSType!("rnlp"); + const __kAudioHardwarePropertyPlugInForBundleID = getOSType!("pibi"); + const __kAudioHardwarePropertyUserSessionIsActiveOrHeadless = getOSType!("user"); + const __kAudioHardwarePropertyBootChimeVolumeScalar = getOSType!("bbvs"); + const __kAudioHardwarePropertyBootChimeVolumeDecibels = getOSType!("bbvd"); + const __kAudioHardwarePropertyBootChimeVolumeRangeDecibels = getOSType!("bbd#"); + const __kAudioHardwarePropertyBootChimeVolumeScalarToDecibels = getOSType!("bv2d"); + const __kAudioHardwarePropertyBootChimeVolumeDecibelsToScalar = getOSType!("bd2v"); + const __kAudioHardwarePropertyBootChimeVolumeDecibelsToScalarTransferFunction = getOSType!("bvtf"); + const __kAudioPlugInClassID = getOSType!("aplg"); + const __kAudioPlugInPropertyBundleID = getOSType!("piid"); + const __kAudioPlugInCreateAggregateDevice = getOSType!("cagg"); + const __kAudioPlugInDestroyAggregateDevice = getOSType!("dagg"); + const __kAudioDevicePropertyScopeInput = getOSType!("inpt"); + const __kAudioDevicePropertyScopeOutput = getOSType!("outp"); + const __kAudioDevicePropertyScopePlayThrough = getOSType!("ptru"); + const __kAudioDeviceClassID = getOSType!("adev"); + const __kAudioDevicePropertyPlugIn = getOSType!("plug"); + const __kAudioDevicePropertyConfigurationApplication = getOSType!("capp"); + const __kAudioDevicePropertyDeviceUID = getOSType!("uid "); + const __kAudioDevicePropertyModelUID = getOSType!("muid"); + const __kAudioDevicePropertyTransportType = getOSType!("tran"); + const __kAudioDevicePropertyRelatedDevices = getOSType!("akin"); + const __kAudioDevicePropertyClockDomain = getOSType!("clkd"); + const __kAudioDevicePropertyDeviceIsAlive = getOSType!("livn"); + const __kAudioDevicePropertyDeviceHasChanged = getOSType!("diff"); + const __kAudioDevicePropertyDeviceIsRunning = getOSType!("goin"); + const __kAudioDevicePropertyDeviceIsRunningSomewhere = getOSType!("gone"); + const __kAudioDevicePropertyDeviceCanBeDefaultDevice = getOSType!("dflt"); + const __kAudioDevicePropertyDeviceCanBeDefaultSystemDevice = getOSType!("sflt"); + const __kAudioDeviceProcessorOverload = getOSType!("over"); + const __kAudioDevicePropertyHogMode = getOSType!("oink"); + const __kAudioDevicePropertyLatency = getOSType!("ltnc"); + const __kAudioDevicePropertyBufferFrameSize = getOSType!("fsiz"); + const __kAudioDevicePropertyBufferFrameSizeRange = getOSType!("fsz#"); + const __kAudioDevicePropertyUsesVariableBufferFrameSizes = getOSType!("vfsz"); + const __kAudioDevicePropertyStreams = getOSType!("stm#"); + const __kAudioDevicePropertySafetyOffset = getOSType!("saft"); + const __kAudioDevicePropertyIOCycleUsage = getOSType!("ncyc"); + const __kAudioDevicePropertyStreamConfiguration = getOSType!("slay"); + const __kAudioDevicePropertyIOProcStreamUsage = getOSType!("suse"); + const __kAudioDevicePropertyPreferredChannelsForStereo = getOSType!("dch2"); + const __kAudioDevicePropertyPreferredChannelLayout = getOSType!("srnd"); + const __kAudioDevicePropertyNominalSampleRate = getOSType!("nsrt"); + const __kAudioDevicePropertyAvailableNominalSampleRates = getOSType!("nsr#"); + const __kAudioDevicePropertyActualSampleRate = getOSType!("asrt"); + const __kAudioDevicePropertyIcon = getOSType!("icon"); + const __kAudioDevicePropertyIsHidden = getOSType!("hidn"); + const __kAudioDevicePropertyJackIsConnected = getOSType!("jack"); + const __kAudioDevicePropertyVolumeScalar = getOSType!("volm"); + const __kAudioDevicePropertyVolumeDecibels = getOSType!("vold"); + const __kAudioDevicePropertyVolumeRangeDecibels = getOSType!("vdb#"); + const __kAudioDevicePropertyVolumeScalarToDecibels = getOSType!("v2db"); + const __kAudioDevicePropertyVolumeDecibelsToScalar = getOSType!("db2v"); + const __kAudioDevicePropertyVolumeDecibelsToScalarTransferFunction = getOSType!("vctf"); + const __kAudioDevicePropertyStereoPan = getOSType!("span"); + const __kAudioDevicePropertyStereoPanChannels = getOSType!("spn#"); + const __kAudioDevicePropertyMute = getOSType!("mute"); + const __kAudioDevicePropertySolo = getOSType!("solo"); + const __kAudioDevicePropertyDataSource = getOSType!("ssrc"); + const __kAudioDevicePropertyDataSources = getOSType!("ssc#"); + const __kAudioDevicePropertyDataSourceNameForIDCFString = getOSType!("lscn"); + const __kAudioDevicePropertyClockSource = getOSType!("csrc"); + const __kAudioDevicePropertyClockSources = getOSType!("csc#"); + const __kAudioDevicePropertyClockSourceNameForIDCFString = getOSType!("lcsn"); + const __kAudioDevicePropertyClockSourceKindForID = getOSType!("csck"); + const __kAudioDevicePropertyPlayThru = getOSType!("thru"); + const __kAudioDevicePropertyPlayThruSolo = getOSType!("thrs"); + const __kAudioDevicePropertyPlayThruVolumeScalar = getOSType!("mvsc"); + const __kAudioDevicePropertyPlayThruVolumeDecibels = getOSType!("mvdb"); + const __kAudioDevicePropertyPlayThruVolumeRangeDecibels = getOSType!("mvd#"); + const __kAudioDevicePropertyPlayThruVolumeScalarToDecibels = getOSType!("mv2d"); + const __kAudioDevicePropertyPlayThruVolumeDecibelsToScalar = getOSType!("mv2s"); + const __kAudioDevicePropertyPlayThruVolumeDecibelsToScalarTransferFunction = getOSType!("mvtf"); + const __kAudioDevicePropertyPlayThruStereoPan = getOSType!("mspn"); + const __kAudioDevicePropertyPlayThruStereoPanChannels = getOSType!("msp#"); + const __kAudioDevicePropertyPlayThruDestination = getOSType!("mdds"); + const __kAudioDevicePropertyPlayThruDestinations = getOSType!("mdd#"); + const __kAudioDevicePropertyPlayThruDestinationNameForIDCFString = getOSType!("mddc"); + const __kAudioDevicePropertyChannelNominalLineLevel = getOSType!("nlvl"); + const __kAudioDevicePropertyChannelNominalLineLevels = getOSType!("nlv#"); + const __kAudioDevicePropertyChannelNominalLineLevelNameForIDCFString = getOSType!("lcnl"); + const __kAudioDevicePropertyDriverShouldOwniSub = getOSType!("isub"); + const __kAudioDevicePropertySubVolumeScalar = getOSType!("svlm"); + const __kAudioDevicePropertySubVolumeDecibels = getOSType!("svld"); + const __kAudioDevicePropertySubVolumeRangeDecibels = getOSType!("svd#"); + const __kAudioDevicePropertySubVolumeScalarToDecibels = getOSType!("sv2d"); + const __kAudioDevicePropertySubVolumeDecibelsToScalar = getOSType!("sd2v"); + const __kAudioDevicePropertySubVolumeDecibelsToScalarTransferFunction = getOSType!("svtf"); + const __kAudioDevicePropertySubMute = getOSType!("smut"); + const __kAudioDevicePropertyDeviceName = getOSType!("name"); + const __kAudioDevicePropertyDeviceManufacturer = getOSType!("makr"); + const __kAudioDevicePropertyRegisterBufferList = getOSType!("rbuf"); + const __kAudioDevicePropertyBufferSize = getOSType!("bsiz"); + const __kAudioDevicePropertyBufferSizeRange = getOSType!("bsz#"); + const __kAudioDevicePropertyChannelName = getOSType!("chnm"); + const __kAudioDevicePropertyChannelCategoryName = getOSType!("ccnm"); + const __kAudioDevicePropertyChannelNumberName = getOSType!("cnnm"); + const __kAudioDevicePropertySupportsMixing = getOSType!("mix?"); + const __kAudioDevicePropertyStreamFormat = getOSType!("sfmt"); + const __kAudioDevicePropertyStreamFormats = getOSType!("sfm#"); + const __kAudioDevicePropertyStreamFormatSupported = getOSType!("sfm?"); + const __kAudioDevicePropertyStreamFormatMatch = getOSType!("sfmm"); + const __kAudioDevicePropertyDataSourceNameForID = getOSType!("sscn"); + const __kAudioDevicePropertyClockSourceNameForID = getOSType!("cscn"); + const __kAudioDevicePropertyPlayThruDestinationNameForID = getOSType!("mddn"); + const __kAudioDevicePropertyChannelNominalLineLevelNameForID = getOSType!("cnlv"); + const __kAudioStreamClassID = getOSType!("astr"); + const __kAudioStreamPropertyDirection = getOSType!("sdir"); + const __kAudioStreamPropertyTerminalType = getOSType!("term"); + const __kAudioStreamPropertyStartingChannel = getOSType!("schn"); + const __kAudioStreamPropertyVirtualFormat = getOSType!("sfmt"); + const __kAudioStreamPropertyAvailableVirtualFormats = getOSType!("sfma"); + const __kAudioStreamPropertyPhysicalFormat = getOSType!("pft "); + const __kAudioStreamPropertyAvailablePhysicalFormats = getOSType!("pfta"); + const __kAudioStreamPropertyPhysicalFormats = getOSType!("pft#"); + const __kAudioStreamPropertyPhysicalFormatSupported = getOSType!("pft?"); + const __kAudioStreamPropertyPhysicalFormatMatch = getOSType!("pftm"); + const __kAudioAggregateDeviceClassID = getOSType!("aagg"); + const __kAudioDeviceTransportTypeAggregate = getOSType!("grup"); + const __kAudioDeviceTransportTypeAutoAggregate = getOSType!("fgrp"); + const __kAudioAggregateDevicePropertyFullSubDeviceList = getOSType!("grup"); + const __kAudioAggregateDevicePropertyActiveSubDeviceList = getOSType!("agrp"); + const __kAudioAggregateDevicePropertyComposition = getOSType!("acom"); + const __kAudioAggregateDevicePropertyMasterSubDevice = getOSType!("amst"); + const __kAudioSubDeviceClassID = getOSType!("asub"); + const __kAudioSubDevicePropertyExtraLatency = getOSType!("xltc"); + const __kAudioSubDevicePropertyDriftCompensation = getOSType!("drft"); + const __kAudioSubDevicePropertyDriftCompensationQuality = getOSType!("drfq"); + } +} + +enum +{ + kAudioHardwareNoError = 0, + kAudioHardwareNotRunningError = getOSType!("stop"), + kAudioHardwareUnspecifiedError = getOSType!("what"), + kAudioHardwareUnknownPropertyError = getOSType!("who?"), + kAudioHardwareBadPropertySizeError = getOSType!("!siz"), + kAudioHardwareIllegalOperationError = getOSType!("nope"), + kAudioHardwareBadObjectError = getOSType!("!obj"), + kAudioHardwareBadDeviceError = getOSType!("!dev"), + kAudioHardwareBadStreamError = getOSType!("!str"), + kAudioHardwareUnsupportedOperationError = getOSType!("unop"), + kAudioDeviceUnsupportedFormatError = getOSType!("!dat"), + kAudioDevicePermissionsError = getOSType!("!hog") +} + +version (D_LP64) +{ + enum : ulong + { + kAudioObjectPropertySelectorWildcard = getOSType!("****"), + kAudioObjectPropertyScopeWildcard = getOSType!("****"), + kAudioObjectPropertyElementWildcard = 0xFFFFFFFFUL, + kAudioPropertyWildcardPropertyID = kAudioObjectPropertySelectorWildcard, + kAudioPropertyWildcardSection = 0xFF, + kAudioPropertyWildcardChannel = kAudioObjectPropertyElementWildcard + } +} + +else +{ + enum + { + kAudioObjectPropertySelectorWildcard = getOSType!("****"), + kAudioObjectPropertyScopeWildcard = getOSType!("****"), + kAudioObjectPropertyElementWildcard = 0xFFFFFFFFU, + kAudioPropertyWildcardPropertyID = kAudioObjectPropertySelectorWildcard, + kAudioPropertyWildcardSection = 0xFF, + kAudioPropertyWildcardChannel = kAudioObjectPropertyElementWildcard + } +} + +enum +{ + kAudioObjectPropertyScopeGlobal = getOSType!("glob"), + kAudioObjectPropertyElementMaster = 0UL, + kAudioObjectClassID = getOSType!("aobj"), + kAudioObjectClassIDWildcard = getOSType!("****"), + kAudioObjectUnknown = 0UL +} + +enum +{ + kAudioObjectPropertyClass = getOSType!("clas"), + kAudioObjectPropertyOwner = getOSType!("stdv"), + kAudioObjectPropertyCreator = getOSType!("oplg"), + kAudioObjectPropertyName = getOSType!("lnam"), + kAudioObjectPropertyManufacturer = getOSType!("lmak"), + kAudioObjectPropertyElementName = getOSType!("lchn"), + kAudioObjectPropertyElementCategoryName = getOSType!("lccn"), + kAudioObjectPropertyElementNumberName = getOSType!("lcnn"), + kAudioObjectPropertyOwnedObjects = getOSType!("ownd"), + kAudioObjectPropertyListenerAdded = getOSType!("lisa"), + kAudioObjectPropertyListenerRemoved = getOSType!("lisr") +} + +enum +{ + kAudioControlClassID = getOSType!("actl"), + kAudioLevelControlClassID = getOSType!("levl"), + kAudioBooleanControlClassID = getOSType!("togl"), + kAudioSelectorControlClassID = getOSType!("slct"), + kAudioStereoPanControlClassID = getOSType!("span") +} + +enum +{ + kAudioVolumeControlClassID = getOSType!("vlme"), + kAudioLFEVolumeControlClassID = getOSType!("subv"), + kAudioBootChimeVolumeControlClassID = getOSType!("pram") +} + +enum +{ + kAudioMuteControlClassID = getOSType!("mute"), + kAudioSoloControlClassID = getOSType!("solo"), + kAudioJackControlClassID = getOSType!("jack"), + kAudioLFEMuteControlClassID = getOSType!("subm"), + kAudioISubOwnerControlClassID = getOSType!("atch") +} + +enum +{ + kAudioDataSourceControlClassID = getOSType!("dsrc"), + kAudioDataDestinationControlClassID = getOSType!("dest"), + kAudioClockSourceControlClassID = getOSType!("clck"), + kAudioLineLevelControlClassID = getOSType!("nlvl") +} + +enum +{ + kAudioControlPropertyScope = getOSType!("cscp"), + kAudioControlPropertyElement = getOSType!("celm"), + kAudioControlPropertyVariant = getOSType!("cvar") +} + +enum +{ + kAudioLevelControlPropertyScalarValue = getOSType!("lcsv"), + kAudioLevelControlPropertyDecibelValue = getOSType!("lcdv"), + kAudioLevelControlPropertyDecibelRange = getOSType!("lcdr"), + kAudioLevelControlPropertyConvertScalarToDecibels = getOSType!("lcsd"), + kAudioLevelControlPropertyConvertDecibelsToScalar = getOSType!("lcds"), + kAudioLevelControlPropertyDecibelsToScalarTransferFunction = getOSType!("lctf") +} + +enum +{ + kAudioBooleanControlPropertyValue = getOSType!("bcvl") +} + +enum +{ + kAudioSelectorControlPropertyCurrentItem = getOSType!("scci"), + kAudioSelectorControlPropertyAvailableItems = getOSType!("scai"), + kAudioSelectorControlPropertyItemName = getOSType!("scin") +} + +enum +{ + kAudioClockSourceControlPropertyItemKind = getOSType!("clkk") +} + +enum +{ + kAudioStereoPanControlPropertyValue = getOSType!("spcv"), + kAudioStereoPanControlPropertyPanningChannels = getOSType!("spcc") +} + +enum +{ + kAudioSystemObjectClassID = getOSType!("asys"), + kAudioObjectSystemObject = 1UL +} + +enum +{ + kAudioHardwarePropertyProcessIsMaster = getOSType!("mast"), + kAudioHardwarePropertyIsInitingOrExiting = getOSType!("inot"), + kAudioHardwarePropertyDevices = getOSType!("dev#"), + kAudioHardwarePropertyDefaultInputDevice = getOSType!("dIn "), + kAudioHardwarePropertyDefaultOutputDevice = getOSType!("dOut"), + kAudioHardwarePropertyDefaultSystemOutputDevice = getOSType!("sOut"), + kAudioHardwarePropertyDeviceForUID = getOSType!("duid"), + kAudioHardwarePropertyProcessIsAudible = getOSType!("pmut"), + kAudioHardwarePropertySleepingIsAllowed = getOSType!("slep"), + kAudioHardwarePropertyUnloadingIsAllowed = getOSType!("unld"), + kAudioHardwarePropertyHogModeIsAllowed = getOSType!("hogr"), + kAudioHardwarePropertyRunLoop = getOSType!("rnlp"), + kAudioHardwarePropertyPlugInForBundleID = getOSType!("pibi"), + kAudioHardwarePropertyUserSessionIsActiveOrHeadless = getOSType!("user") +} + +enum +{ + kAudioHardwarePropertyBootChimeVolumeScalar = getOSType!("bbvs"), + kAudioHardwarePropertyBootChimeVolumeDecibels = getOSType!("bbvd"), + kAudioHardwarePropertyBootChimeVolumeRangeDecibels = getOSType!("bbd#"), + kAudioHardwarePropertyBootChimeVolumeScalarToDecibels = getOSType!("bv2d"), + kAudioHardwarePropertyBootChimeVolumeDecibelsToScalar = getOSType!("bd2v"), + kAudioHardwarePropertyBootChimeVolumeDecibelsToScalarTransferFunction = getOSType!("bvtf") +} + +enum +{ + kAudioPlugInClassID = getOSType!("aplg") +} + +enum +{ + kAudioPlugInPropertyBundleID = getOSType!("piid"), + kAudioPlugInCreateAggregateDevice = getOSType!("cagg"), + kAudioPlugInDestroyAggregateDevice = getOSType!("dagg") +} + +enum +{ + kAudioDevicePropertyScopeInput = getOSType!("inpt"), + kAudioDevicePropertyScopeOutput = getOSType!("outp"), + kAudioDevicePropertyScopePlayThrough = getOSType!("ptru"), + kAudioDeviceClassID = getOSType!("adev"), + kAudioDeviceUnknown = kAudioObjectUnknown +} + +enum +{ + kAudioDeviceStartTimeIsInputFlag = (1L << 0), + kAudioDeviceStartTimeDontConsultDeviceFlag = (1L << 1), + kAudioDeviceStartTimeDontConsultHALFlag = (1L << 2) +} + +enum +{ + kAudioDevicePropertyPlugIn = getOSType!("plug"), + kAudioDevicePropertyConfigurationApplication = getOSType!("capp"), + kAudioDevicePropertyDeviceUID = getOSType!("uid "), + kAudioDevicePropertyModelUID = getOSType!("muid"), + kAudioDevicePropertyTransportType = getOSType!("tran"), + kAudioDevicePropertyRelatedDevices = getOSType!("akin"), + kAudioDevicePropertyClockDomain = getOSType!("clkd"), + kAudioDevicePropertyDeviceIsAlive = getOSType!("livn"), + kAudioDevicePropertyDeviceHasChanged = getOSType!("diff"), + kAudioDevicePropertyDeviceIsRunning = getOSType!("goin"), + kAudioDevicePropertyDeviceIsRunningSomewhere = getOSType!("gone"), + kAudioDevicePropertyDeviceCanBeDefaultDevice = getOSType!("dflt"), + kAudioDevicePropertyDeviceCanBeDefaultSystemDevice = getOSType!("sflt"), + kAudioDeviceProcessorOverload = getOSType!("over"), + kAudioDevicePropertyHogMode = getOSType!("oink"), + kAudioDevicePropertyLatency = getOSType!("ltnc"), + kAudioDevicePropertyBufferFrameSize = getOSType!("fsiz"), + kAudioDevicePropertyBufferFrameSizeRange = getOSType!("fsz#"), + kAudioDevicePropertyUsesVariableBufferFrameSizes = getOSType!("vfsz"), + kAudioDevicePropertyStreams = getOSType!("stm#"), + kAudioDevicePropertySafetyOffset = getOSType!("saft"), + kAudioDevicePropertyIOCycleUsage = getOSType!("ncyc"), + kAudioDevicePropertyStreamConfiguration = getOSType!("slay"), + kAudioDevicePropertyIOProcStreamUsage = getOSType!("suse"), + kAudioDevicePropertyPreferredChannelsForStereo = getOSType!("dch2"), + kAudioDevicePropertyPreferredChannelLayout = getOSType!("srnd"), + kAudioDevicePropertyNominalSampleRate = getOSType!("nsrt"), + kAudioDevicePropertyAvailableNominalSampleRates = getOSType!("nsr#"), + kAudioDevicePropertyActualSampleRate = getOSType!("asrt"), + kAudioDevicePropertyIcon = getOSType!("icon"), + kAudioDevicePropertyIsHidden = getOSType!("hidn") +} + +enum +{ + kAudioDevicePropertyJackIsConnected = getOSType!("jack"), + kAudioDevicePropertyVolumeScalar = getOSType!("volm"), + kAudioDevicePropertyVolumeDecibels = getOSType!("vold"), + kAudioDevicePropertyVolumeRangeDecibels = getOSType!("vdb#"), + kAudioDevicePropertyVolumeScalarToDecibels = getOSType!("v2db"), + kAudioDevicePropertyVolumeDecibelsToScalar = getOSType!("db2v"), + kAudioDevicePropertyVolumeDecibelsToScalarTransferFunction = getOSType!("vctf"), + kAudioDevicePropertyStereoPan = getOSType!("span"), + kAudioDevicePropertyStereoPanChannels = getOSType!("spn#"), + kAudioDevicePropertyMute = getOSType!("mute"), + kAudioDevicePropertySolo = getOSType!("solo"), + kAudioDevicePropertyDataSource = getOSType!("ssrc"), + kAudioDevicePropertyDataSources = getOSType!("ssc#"), + kAudioDevicePropertyDataSourceNameForIDCFString = getOSType!("lscn"), + kAudioDevicePropertyClockSource = getOSType!("csrc"), + kAudioDevicePropertyClockSources = getOSType!("csc#"), + kAudioDevicePropertyClockSourceNameForIDCFString = getOSType!("lcsn"), + kAudioDevicePropertyClockSourceKindForID = getOSType!("csck"), + kAudioDevicePropertyPlayThru = getOSType!("thru"), + kAudioDevicePropertyPlayThruSolo = getOSType!("thrs"), + kAudioDevicePropertyPlayThruVolumeScalar = getOSType!("mvsc"), + kAudioDevicePropertyPlayThruVolumeDecibels = getOSType!("mvdb"), + kAudioDevicePropertyPlayThruVolumeRangeDecibels = getOSType!("mvd#"), + kAudioDevicePropertyPlayThruVolumeScalarToDecibels = getOSType!("mv2d"), + kAudioDevicePropertyPlayThruVolumeDecibelsToScalar = getOSType!("mv2s"), + kAudioDevicePropertyPlayThruVolumeDecibelsToScalarTransferFunction = getOSType!("mvtf"), + kAudioDevicePropertyPlayThruStereoPan = getOSType!("mspn"), + kAudioDevicePropertyPlayThruStereoPanChannels = getOSType!("msp#"), + kAudioDevicePropertyPlayThruDestination = getOSType!("mdds"), + kAudioDevicePropertyPlayThruDestinations = getOSType!("mdd#"), + kAudioDevicePropertyPlayThruDestinationNameForIDCFString = getOSType!("mddc"), + kAudioDevicePropertyChannelNominalLineLevel = getOSType!("nlvl"), + kAudioDevicePropertyChannelNominalLineLevels = getOSType!("nlv#"), + kAudioDevicePropertyChannelNominalLineLevelNameForIDCFString = getOSType!("lcnl"), + kAudioDevicePropertyDriverShouldOwniSub = getOSType!("isub"), + kAudioDevicePropertySubVolumeScalar = getOSType!("svlm"), + kAudioDevicePropertySubVolumeDecibels = getOSType!("svld"), + kAudioDevicePropertySubVolumeRangeDecibels = getOSType!("svd#"), + kAudioDevicePropertySubVolumeScalarToDecibels = getOSType!("sv2d"), + kAudioDevicePropertySubVolumeDecibelsToScalar = getOSType!("sd2v"), + kAudioDevicePropertySubVolumeDecibelsToScalarTransferFunction = getOSType!("svtf"), + kAudioDevicePropertySubMute = getOSType!("smut") +} + +enum +{ + kAudioDevicePropertyDeviceName = getOSType!("name"), + kAudioDevicePropertyDeviceNameCFString = kAudioObjectPropertyName, + kAudioDevicePropertyDeviceManufacturer = getOSType!("makr"), + kAudioDevicePropertyDeviceManufacturerCFString = kAudioObjectPropertyManufacturer, + kAudioDevicePropertyRegisterBufferList = getOSType!("rbuf"), + kAudioDevicePropertyBufferSize = getOSType!("bsiz"), + kAudioDevicePropertyBufferSizeRange = getOSType!("bsz#"), + kAudioDevicePropertyChannelName = getOSType!("chnm"), + kAudioDevicePropertyChannelNameCFString = kAudioObjectPropertyElementName, + kAudioDevicePropertyChannelCategoryName = getOSType!("ccnm"), + kAudioDevicePropertyChannelCategoryNameCFString = kAudioObjectPropertyElementCategoryName, + kAudioDevicePropertyChannelNumberName = getOSType!("cnnm"), + kAudioDevicePropertyChannelNumberNameCFString = kAudioObjectPropertyElementNumberName, + kAudioDevicePropertySupportsMixing = getOSType!("mix?"), + kAudioDevicePropertyStreamFormat = getOSType!("sfmt"), + kAudioDevicePropertyStreamFormats = getOSType!("sfm#"), + kAudioDevicePropertyStreamFormatSupported = getOSType!("sfm?"), + kAudioDevicePropertyStreamFormatMatch = getOSType!("sfmm"), + kAudioDevicePropertyDataSourceNameForID = getOSType!("sscn"), + kAudioDevicePropertyClockSourceNameForID = getOSType!("cscn"), + kAudioDevicePropertyPlayThruDestinationNameForID = getOSType!("mddn"), + kAudioDevicePropertyChannelNominalLineLevelNameForID = getOSType!("cnlv") +} + +enum +{ + kAudioStreamClassID = getOSType!("astr"), + kAudioStreamUnknown = kAudioObjectUnknown +} + +enum +{ + kAudioStreamPropertyDirection = getOSType!("sdir"), + kAudioStreamPropertyTerminalType = getOSType!("term"), + kAudioStreamPropertyStartingChannel = getOSType!("schn"), + kAudioStreamPropertyLatency = kAudioDevicePropertyLatency, + kAudioStreamPropertyVirtualFormat = getOSType!("sfmt"), + kAudioStreamPropertyAvailableVirtualFormats = getOSType!("sfma"), + kAudioStreamPropertyPhysicalFormat = getOSType!("pft "), + kAudioStreamPropertyAvailablePhysicalFormats = getOSType!("pfta") +} + +enum +{ + kAudioStreamPropertyOwningDevice = kAudioObjectPropertyOwner, + kAudioStreamPropertyPhysicalFormats = getOSType!("pft#"), + kAudioStreamPropertyPhysicalFormatSupported = getOSType!("pft?"), + kAudioStreamPropertyPhysicalFormatMatch = getOSType!("pftm") +} + +enum +{ + kAudioAggregateDeviceClassID = getOSType!("aagg"), + kAudioDeviceTransportTypeAggregate = getOSType!("grup"), + kAudioDeviceTransportTypeAutoAggregate = getOSType!("fgrp") +} + +enum +{ + kAudioAggregateDevicePropertyFullSubDeviceList = getOSType!("grup"), + kAudioAggregateDevicePropertyActiveSubDeviceList = getOSType!("agrp"), + kAudioAggregateDevicePropertyComposition = getOSType!("acom") +} + +enum +{ + kAudioAggregateDevicePropertyMasterSubDevice = getOSType!("amst") +} + +enum +{ + kAudioSubDeviceClassID = getOSType!("asub") +} + +enum +{ + kAudioSubDeviceDriftCompensationMinQuality = 0, + kAudioSubDeviceDriftCompensationLowQuality = 0x20, + kAudioSubDeviceDriftCompensationMediumQuality = 0x40, + kAudioSubDeviceDriftCompensationHighQuality = 0x60, + kAudioSubDeviceDriftCompensationMaxQuality = 0x7F +} + +enum +{ + kAudioSubDevicePropertyExtraLatency = getOSType!("xltc"), + kAudioSubDevicePropertyDriftCompensation = getOSType!("drft"), + kAudioSubDevicePropertyDriftCompensationQuality = getOSType!("drfq") +} + +struct AudioObjectPropertyAddress +{ + uint mSelector; + uint mScope; + uint mElement; +} + + +struct AudioHardwareIOProcStreamUsage +{ + void* mIOProc; + uint mNumberStreams; + uint* mStreamIsOn; +} + + +struct AudioStreamRangedDescription +{ + AudioStreamBasicDescription mFormat; + AudioValueRange mSampleRateRange; +} + +extern (C) +{ + void AudioObjectShow (uint inObjectID); + ubyte AudioObjectHasProperty (uint inObjectID, AudioObjectPropertyAddress* inAddress); + int AudioObjectIsPropertySettable (uint inObjectID, AudioObjectPropertyAddress* inAddress, char* outIsSettable); + int AudioObjectGetPropertyDataSize (uint inObjectID, AudioObjectPropertyAddress* inAddress, uint inQualifierDataSize, void* inQualifierData, uint* outDataSize); + int AudioObjectGetPropertyData (uint inObjectID, AudioObjectPropertyAddress* inAddress, uint inQualifierDataSize, void* inQualifierData, uint* ioDataSize, void* outData); + int AudioObjectSetPropertyData (uint inObjectID, AudioObjectPropertyAddress* inAddress, uint inQualifierDataSize, void* inQualifierData, uint inDataSize, void* inData); + int AudioObjectAddPropertyListener (uint inObjectID, AudioObjectPropertyAddress* inAddress, AudioObjectPropertyListenerProc inListener, void* inClientData); + int AudioObjectRemovePropertyListener (uint inObjectID, AudioObjectPropertyAddress* inAddress, AudioObjectPropertyListenerProc inListener, void* inClientData); + int AudioHardwareAddRunLoopSource (CFRunLoopSourceRef inRunLoopSource); + int AudioHardwareRemoveRunLoopSource (CFRunLoopSourceRef inRunLoopSource); + int AudioHardwareUnload (); + int AudioHardwareGetPropertyInfo (uint inPropertyID, uint* outSize, char* outWritable); + int AudioHardwareGetProperty (uint inPropertyID, uint* ioPropertyDataSize, void* outPropertyData); + int AudioHardwareSetProperty (uint inPropertyID, uint inPropertyDataSize, void* inPropertyData); + int AudioHardwareAddPropertyListener (uint inPropertyID, AudioHardwarePropertyListenerProc inProc, void* inClientData); + int AudioHardwareRemovePropertyListener (uint inPropertyID, AudioHardwarePropertyListenerProc inProc); + int AudioDeviceCreateIOProcID (uint inDevice, AudioDeviceIOProc inProc, void* inClientData, AudioDeviceIOProcID* outIOProcID); + int AudioDeviceDestroyIOProcID (uint inDevice, AudioDeviceIOProcID inIOProcID); + int AudioDeviceAddIOProc (uint inDevice, AudioDeviceIOProc inProc, void* inClientData); + int AudioDeviceRemoveIOProc (uint inDevice, AudioDeviceIOProc inProc); + int AudioDeviceStart (uint inDevice, AudioDeviceIOProcID inProcID); + int AudioDeviceStartAtTime (uint inDevice, AudioDeviceIOProcID inProcID, AudioTimeStamp* ioRequestedStartTime, uint inFlags); + int AudioDeviceStop (uint inDevice, AudioDeviceIOProcID inProcID); + int AudioDeviceRead (uint inDevice, AudioTimeStamp* inStartTime, AudioBufferList* outData); + int AudioDeviceGetCurrentTime (uint inDevice, AudioTimeStamp* outTime); + int AudioDeviceTranslateTime (uint inDevice, AudioTimeStamp* inTime, AudioTimeStamp* outTime); + int AudioDeviceGetNearestStartTime (uint inDevice, AudioTimeStamp* ioRequestedStartTime, uint inFlags); + int AudioDeviceGetPropertyInfo (uint inDevice, uint inChannel, ubyte isInput, uint inPropertyID, uint* outSize, char* outWritable); + int AudioDeviceGetProperty (uint inDevice, uint inChannel, ubyte isInput, uint inPropertyID, uint* ioPropertyDataSize, void* outPropertyData); + int AudioDeviceSetProperty (uint inDevice, AudioTimeStamp* inWhen, uint inChannel, ubyte isInput, uint inPropertyID, uint inPropertyDataSize, void* inPropertyData); + int AudioDeviceAddPropertyListener (uint inDevice, uint inChannel, ubyte isInput, uint inPropertyID, AudioDevicePropertyListenerProc inProc, void* inClientData); + int AudioDeviceRemovePropertyListener (uint inDevice, uint inChannel, ubyte isInput, uint inPropertyID, AudioDevicePropertyListenerProc inProc); + int AudioStreamGetPropertyInfo (uint inStream, uint inChannel, uint inPropertyID, uint* outSize, char* outWritable); + int AudioStreamGetProperty (uint inStream, uint inChannel, uint inPropertyID, uint* ioPropertyDataSize, void* outPropertyData); + int AudioStreamSetProperty (uint inStream, AudioTimeStamp* inWhen, uint inChannel, uint inPropertyID, uint inPropertyDataSize, void* inPropertyData); + int AudioStreamAddPropertyListener (uint inStream, uint inChannel, uint inPropertyID, AudioStreamPropertyListenerProc inProc, void* inClientData); + int AudioStreamRemovePropertyListener (uint inStream, uint inChannel, uint inPropertyID, AudioStreamPropertyListenerProc inProc); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/coreaudio/AudioHardwarePlugIn.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/coreaudio/AudioHardwarePlugIn.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,68 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 30, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.coreaudio.AudioHardwarePlugIn; + +import dstep.coreaudio.AudioHardware; +import dstep.coreaudio.CoreAudioTypes; +import dstep.corefoundation.CFPlugInCOM; +import dstep.corefoundation.CoreFoundation; +import dstep.coreservices.carboncore.MacTypes; + +alias AudioHardwarePlugInInterface** AudioHardwarePlugInRef; + +struct AudioHardwarePlugInInterface +{ + void* _reserved; + + extern (C) + { + HRESULT function (void* inSelf, REFIID inUUID, LPVOID* outInterface) QueryInterface; + ULONG function (void* inSelf) AddRef; + ULONG function (void* inSelf) Release; + OSStatus function (AudioHardwarePlugInRef inSelf) Initialize; + OSStatus function (AudioHardwarePlugInRef inSelf) Teardown; + OSStatus function (AudioHardwarePlugInRef inSelf, AudioDeviceID inDevice, AudioDeviceIOProc inProc, void* inClientData) DeviceAddIOProc; + OSStatus function (AudioHardwarePlugInRef inSelf, AudioDeviceID inDevice, AudioDeviceIOProc inProc) DeviceRemoveIOProc; + OSStatus function (AudioHardwarePlugInRef inSelf, AudioDeviceID inDevice, AudioDeviceIOProcID inProc) DeviceStart; + OSStatus function (AudioHardwarePlugInRef inSelf, AudioDeviceID inDevice, AudioDeviceIOProcID inProc) DeviceStop; + OSStatus function (AudioHardwarePlugInRef inSelf, AudioDeviceID inDevice, AudioTimeStamp inStartTime, AudioBufferList* outData) DeviceRead; + OSStatus function (AudioHardwarePlugInRef inSelf, AudioDeviceID inDevice, AudioTimeStamp* outTime) DeviceGetCurrentTime; + OSStatus function (AudioHardwarePlugInRef inSelf, AudioDeviceID inDevice, AudioTimeStamp* inTime, AudioTimeStamp* outTime) DeviceTranslateTime; + OSStatus function (AudioHardwarePlugInRef inSelf, AudioDeviceID inDevice, uint inChannel, bool isInput, AudioDevicePropertyID inPropertyID, uint* outSize, bool* outWritable) DeviceGetPropertyInfo; + OSStatus function (AudioHardwarePlugInRef inSelf, AudioDeviceID inDevice, uint inChannel, bool isInput, AudioDevicePropertyID inPropertyID, uint* ioPropertyDataSize, void* outPropertyData) DeviceGetProperty; + OSStatus function (AudioHardwarePlugInRef inSelf, AudioDeviceID inDevice, uint inChannel, bool isInput, AudioDevicePropertyID inPropertyID, uint inPropertyDataSize, void* inPropertyData) DeviceSetProperty; + OSStatus function (AudioHardwarePlugInRef inSelf, AudioStreamID inStream, uint inChannel, AudioDevicePropertyID inPropertyID, uint outSize, bool* outWritable) StreamGetPropertyInfo; + OSStatus function (AudioHardwarePlugInRef inSelf, AudioStreamID inStream, uint inChannel, AudioDevicePropertyID inPropertyID, uint* inPropertyDataSize, void* outPropertyData) StreamGetProperty; + OSStatus function (AudioHardwarePlugInRef inSelf, AudioStreamID inStream, uint inChannel, AudioDevicePropertyID inPropertyID, uint inPropertyDataSize, void* inPropertyData) StreamSetProperty; + OSStatus function (AudioHardwarePlugInRef inSelf, AudioDeviceID inDevice, AudioDeviceIOProc inProc, AudioTimeStamp* ioRequestedStartTime, uint inFlags) DeviceStartAtTime; + OSStatus function (AudioHardwarePlugInRef inSelf, AudioDeviceID inDevice, AudioTimeStamp* ioRequestedStartTime, uint inFlags) DeviceGetNearestStartTime; + OSStatus function (AudioHardwarePlugInRef inSelf, AudioObjectID inObjectID) InitializeWithObjectID; + void function (AudioHardwarePlugInRef inSelf, AudioObjectID inObjectID) ObjectShow; + bool function (AudioHardwarePlugInRef inSelf, AudioObjectID inObjectID, AudioObjectPropertyAddress* inAddress) ObjectHasProperty; + OSStatus function (AudioHardwarePlugInRef inSelf, AudioObjectID inObjectID, AudioObjectPropertyAddress* inAddress, bool* outIsSettable) ObjectIsPropertySettable; + OSStatus function (AudioHardwarePlugInRef inSelf, AudioObjectID inObjectID, AudioObjectPropertyAddress* inAddress, uint inQualifierDataSize, void* inQualifierData, uint* outDataSize) ObjectGetPropertyDataSize; + OSStatus function (AudioHardwarePlugInRef inSelf, AudioObjectID inObjectID, AudioObjectPropertyAddress* inAddress, uint inQualifierDataSize, void* inQualifierData, uint* ioDataSize, void* outData) ObjectGetPropertyData; + OSStatus function (AudioHardwarePlugInRef inSelf, AudioObjectID inObjectID, AudioObjectPropertyAddress* inAddress, uint inQualifierDataSize, void* inQualifierData, uint inDataSize, void* inData) ObjectSetPropertyData; + OSStatus function (AudioHardwarePlugInRef inSelf, AudioDeviceID inDevice, AudioDeviceIOProc inProc, void* inClientData, AudioDeviceIOProcID* outIOProcID) DeviceCreateIOProcID; + OSStatus function (AudioHardwarePlugInRef inSelf, AudioDeviceID inDevice, AudioDeviceIOProcID inIOProcID) DeviceDestroyIOProcID; + } +} + +extern (C) +{ + int AudioObjectCreate (AudioHardwarePlugInRef inOwningPlugIn, uint inOwningObjectID, uint inClassID, AudioObjectID* outAudioObjectID); + int AudioObjectsPublishedAndDied (AudioHardwarePlugInRef inOwningPlugIn, uint inOwningObjectID, uint inNumberPublishedAudioObjects, AudioObjectID* inPublishedAudioObjects, uint inNumberDeadAudioObjects, AudioObjectID* inDeadAudioObjects); + int AudioObjectPropertiesChanged (AudioHardwarePlugInRef inOwningPlugIn, uint inObjectID, uint inNumberAddresses, AudioObjectPropertyAddress* inAddresses); + int AudioHardwareClaimAudioDeviceID (AudioHardwarePlugInRef inOwner, AudioDeviceID* outAudioDeviceID); + int AudioHardwareDevicesCreated (AudioHardwarePlugInRef inOwner, uint inNumberDevices, AudioDeviceID* inAudioDeviceIDs); + int AudioHardwareDevicesDied (AudioHardwarePlugInRef inOwner, uint inNumberDevices, AudioDeviceID* inAudioDeviceIDs); + int AudioHardwareDevicePropertyChanged (AudioHardwarePlugInRef inOwner, uint inDeviceID, uint inChannel, ubyte isInput, uint inPropertyID); + int AudioHardwareClaimAudioStreamID (AudioHardwarePlugInRef inOwner, uint inOwningDeviceID, AudioStreamID* outAudioStreamID); + int AudioHardwareStreamsCreated (AudioHardwarePlugInRef inOwner, uint inOwningDeviceID, uint inNumberStreams, AudioStreamID* inAudioStreamIDs); + int AudioHardwareStreamsDied (AudioHardwarePlugInRef inOwner, uint inOwningDeviceID, uint inNumberStreams, AudioStreamID* inAudioStreamIDs); + int AudioHardwareStreamPropertyChanged (AudioHardwarePlugInRef inOwner, uint inOwningDeviceID, uint inStreamID, uint inChannel, uint inPropertyID); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/coreaudio/CoreAudio.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/coreaudio/CoreAudio.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,13 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 30, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.coreaudio.CoreAudio; + +public: + +import dstep.coreaudio.AudioHardware; +import dstep.coreaudio.CoreAudioTypes; +import dstep.coreaudio.HostTime; \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/coreaudio/CoreAudioTypes.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/coreaudio/CoreAudioTypes.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,510 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 30, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.coreaudio.CoreAudioTypes; + +import dstep.coreservices.carboncore.MacTypes; +import dstep.internal.Version; +import dstep.objc.bridge.TypeEncoding; + +alias float AudioSampleType; +alias uint AudioChannelLabel; +alias uint AudioChannelLayoutTag; + +// This is needed otherwise the enums will fail compiling with gdc +version (GNU) +{ + private + { + const __kAudioFormatLinearPCM = getOSType!("lpcm"); + const __kAudioFormatAC3 = getOSType!("ac-3"); + const __kAudioFormat60958AC3 = getOSType!("cac3"); + const __kAudioFormatAppleIMA4 = getOSType!("ima4"); + const __kAudioFormatMPEG4AAC = getOSType!("aac "); + const __kAudioFormatMPEG4CELP = getOSType!("celp"); + const __kAudioFormatMPEG4HVXC = getOSType!("hvxc"); + const __kAudioFormatMPEG4TwinVQ = getOSType!("twvq"); + const __kAudioFormatMACE3 = getOSType!("MAC3"); + const __kAudioFormatMACE6 = getOSType!("MAC6"); + const __kAudioFormatULaw = getOSType!("ulaw"); + const __kAudioFormatALaw = getOSType!("alaw"); + const __kAudioFormatQDesign = getOSType!("QDMC"); + const __kAudioFormatQDesign2 = getOSType!("QDM2"); + const __kAudioFormatQUALCOMM = getOSType!("Qclp"); + const __kAudioFormatMPEGLayer1 = getOSType!(".mp1"); + const __kAudioFormatMPEGLayer2 = getOSType!(".mp2"); + const __kAudioFormatMPEGLayer3 = getOSType!(".mp3"); + const __kAudioFormatTimeCode = getOSType!("time"); + const __kAudioFormatMIDIStream = getOSType!("midi"); + const __kAudioFormatParameterValueStream = getOSType!("apvs"); + const __kAudioFormatAppleLossless = getOSType!("alac"); + const __kAudioFormatMPEG4AAC_HE = getOSType!("aach"); + const __kAudioFormatMPEG4AAC_LD = getOSType!("aacl"); + const __kAudioFormatMPEG4AAC_HE_V2 = getOSType!("aacp"); + const __kAudioFormatMPEG4AAC_Spatial = getOSType!("aacs"); + const __kAudioFormatAMR = getOSType!("samr"); + } +} + +enum +{ + kAudioStreamAnyRate = 0 +} + +enum +{ + kAudioFormatLinearPCM = getOSType!("lpcm"), + kAudioFormatAC3 = getOSType!("ac-3"), + kAudioFormat60958AC3 = getOSType!("cac3"), + kAudioFormatAppleIMA4 = getOSType!("ima4"), + kAudioFormatMPEG4AAC = getOSType!("aac "), + kAudioFormatMPEG4CELP = getOSType!("celp"), + kAudioFormatMPEG4HVXC = getOSType!("hvxc"), + kAudioFormatMPEG4TwinVQ = getOSType!("twvq"), + kAudioFormatMACE3 = getOSType!("MAC3"), + kAudioFormatMACE6 = getOSType!("MAC6"), + kAudioFormatULaw = getOSType!("ulaw"), + kAudioFormatALaw = getOSType!("alaw"), + kAudioFormatQDesign = getOSType!("QDMC"), + kAudioFormatQDesign2 = getOSType!("QDM2"), + kAudioFormatQUALCOMM = getOSType!("Qclp"), + kAudioFormatMPEGLayer1 = getOSType!(".mp1"), + kAudioFormatMPEGLayer2 = getOSType!(".mp2"), + kAudioFormatMPEGLayer3 = getOSType!(".mp3"), + kAudioFormatTimeCode = getOSType!("time"), + kAudioFormatMIDIStream = getOSType!("midi"), + kAudioFormatParameterValueStream = getOSType!("apvs"), + kAudioFormatAppleLossless = getOSType!("alac"), + kAudioFormatMPEG4AAC_HE = getOSType!("aach"), + kAudioFormatMPEG4AAC_LD = getOSType!("aacl"), + kAudioFormatMPEG4AAC_HE_V2 = getOSType!("aacp"), + kAudioFormatMPEG4AAC_Spatial = getOSType!("aacs"), + kAudioFormatAMR = getOSType!("samr") +} + +version (D_LP64) +{ + enum : long + { + kAudioFormatFlagIsFloat = (1L << 0), + kAudioFormatFlagIsBigEndian = (1L << 1), + kAudioFormatFlagIsSignedInteger = (1L << 2), + kAudioFormatFlagIsPacked = (1L << 3), + kAudioFormatFlagIsAlignedHigh = (1L << 4), + kAudioFormatFlagIsNonInterleaved = (1L << 5), + kAudioFormatFlagIsNonMixable = (1L << 6), + kAudioFormatFlagsAreAllClear = (1L << 31), + kLinearPCMFormatFlagIsFloat = kAudioFormatFlagIsFloat, + kLinearPCMFormatFlagIsBigEndian = kAudioFormatFlagIsBigEndian, + kLinearPCMFormatFlagIsSignedInteger = kAudioFormatFlagIsSignedInteger, + kLinearPCMFormatFlagIsPacked = kAudioFormatFlagIsPacked, + kLinearPCMFormatFlagIsAlignedHigh = kAudioFormatFlagIsAlignedHigh, + kLinearPCMFormatFlagIsNonInterleaved = kAudioFormatFlagIsNonInterleaved, + kLinearPCMFormatFlagIsNonMixable = kAudioFormatFlagIsNonMixable, + kLinearPCMFormatFlagsAreAllClear = kAudioFormatFlagsAreAllClear, + kAppleLosslessFormatFlag_16BitSourceData = 1, + kAppleLosslessFormatFlag_20BitSourceData = 2, + kAppleLosslessFormatFlag_24BitSourceData = 3, + kAppleLosslessFormatFlag_32BitSourceData = 4 + } +} + +else +{ + enum + { + kAudioFormatFlagIsFloat = (1L << 0), + kAudioFormatFlagIsBigEndian = (1L << 1), + kAudioFormatFlagIsSignedInteger = (1L << 2), + kAudioFormatFlagIsPacked = (1L << 3), + kAudioFormatFlagIsAlignedHigh = (1L << 4), + kAudioFormatFlagIsNonInterleaved = (1L << 5), + kAudioFormatFlagIsNonMixable = (1L << 6), + kAudioFormatFlagsAreAllClear = (1 << 31), + kLinearPCMFormatFlagIsFloat = kAudioFormatFlagIsFloat, + kLinearPCMFormatFlagIsBigEndian = kAudioFormatFlagIsBigEndian, + kLinearPCMFormatFlagIsSignedInteger = kAudioFormatFlagIsSignedInteger, + kLinearPCMFormatFlagIsPacked = kAudioFormatFlagIsPacked, + kLinearPCMFormatFlagIsAlignedHigh = kAudioFormatFlagIsAlignedHigh, + kLinearPCMFormatFlagIsNonInterleaved = kAudioFormatFlagIsNonInterleaved, + kLinearPCMFormatFlagIsNonMixable = kAudioFormatFlagIsNonMixable, + kLinearPCMFormatFlagsAreAllClear = kAudioFormatFlagsAreAllClear, + kAppleLosslessFormatFlag_16BitSourceData = 1, + kAppleLosslessFormatFlag_20BitSourceData = 2, + kAppleLosslessFormatFlag_24BitSourceData = 3, + kAppleLosslessFormatFlag_32BitSourceData = 4 + } +} + + + +enum +{ + kAudioFormatFlagsNativeEndian = 0, + kAudioFormatFlagsCanonical = kAudioFormatFlagIsFloat | kAudioFormatFlagsNativeEndian | kAudioFormatFlagIsPacked, + kAudioFormatFlagsNativeFloatPacked = kAudioFormatFlagIsFloat | kAudioFormatFlagsNativeEndian | kAudioFormatFlagIsPacked +} + +enum +{ + kSMPTETimeType24 = 0, + kSMPTETimeType25 = 1, + kSMPTETimeType30Drop = 2, + kSMPTETimeType30 = 3, + kSMPTETimeType2997 = 4, + kSMPTETimeType2997Drop = 5, + kSMPTETimeType60 = 6, + kSMPTETimeType5994 = 7, + kSMPTETimeType60Drop = 8, + kSMPTETimeType5994Drop = 9, + kSMPTETimeType50 = 10, + kSMPTETimeType2398 = 11 +} + +enum +{ + kSMPTETimeValid = (1L << 0), + kSMPTETimeRunning = (1L << 1) +} + +enum +{ + kAudioTimeStampSampleTimeValid = (1L << 0), + kAudioTimeStampHostTimeValid = (1L << 1), + kAudioTimeStampRateScalarValid = (1L << 2), + kAudioTimeStampWordClockTimeValid = (1L << 3), + kAudioTimeStampSMPTETimeValid = (1L << 4) +} + +enum +{ + kAudioTimeStampSampleHostTimeValid = (kAudioTimeStampSampleTimeValid | kAudioTimeStampHostTimeValid) +} + +enum +{ + kAudioChannelLabel_Unknown = 0xFFFFFFFF, + kAudioChannelLabel_Unused = 0, + kAudioChannelLabel_UseCoordinates = 100, + kAudioChannelLabel_Left = 1, + kAudioChannelLabel_Right = 2, + kAudioChannelLabel_Center = 3, + kAudioChannelLabel_LFEScreen = 4, + kAudioChannelLabel_LeftSurround = 5, + kAudioChannelLabel_RightSurround = 6, + kAudioChannelLabel_LeftCenter = 7, + kAudioChannelLabel_RightCenter = 8, + kAudioChannelLabel_CenterSurround = 9, + kAudioChannelLabel_LeftSurroundDirect = 10, + kAudioChannelLabel_RightSurroundDirect = 11, + kAudioChannelLabel_TopCenterSurround = 12, + kAudioChannelLabel_VerticalHeightLeft = 13, + kAudioChannelLabel_VerticalHeightCenter = 14, + kAudioChannelLabel_VerticalHeightRight = 15, + kAudioChannelLabel_TopBackLeft = 16, + kAudioChannelLabel_TopBackCenter = 17, + kAudioChannelLabel_TopBackRight = 18, + kAudioChannelLabel_RearSurroundLeft = 33, + kAudioChannelLabel_RearSurroundRight = 34, + kAudioChannelLabel_LeftWide = 35, + kAudioChannelLabel_RightWide = 36, + kAudioChannelLabel_LFE2 = 37, + kAudioChannelLabel_LeftTotal = 38, + kAudioChannelLabel_RightTotal = 39, + kAudioChannelLabel_HearingImpaired = 40, + kAudioChannelLabel_Narration = 41, + kAudioChannelLabel_Mono = 42, + kAudioChannelLabel_DialogCentricMix = 43, + kAudioChannelLabel_CenterSurroundDirect = 44, + kAudioChannelLabel_Haptic = 45, + kAudioChannelLabel_Ambisonic_W = 200, + kAudioChannelLabel_Ambisonic_X = 201, + kAudioChannelLabel_Ambisonic_Y = 202, + kAudioChannelLabel_Ambisonic_Z = 203, + kAudioChannelLabel_MS_Mid = 204, + kAudioChannelLabel_MS_Side = 205, + kAudioChannelLabel_XY_X = 206, + kAudioChannelLabel_XY_Y = 207, + kAudioChannelLabel_HeadphonesLeft = 301, + kAudioChannelLabel_HeadphonesRight = 302, + kAudioChannelLabel_ClickTrack = 304, + kAudioChannelLabel_ForeignLanguage = 305, + kAudioChannelLabel_Discrete = 400, + kAudioChannelLabel_Discrete_0 = (1L<<16) | 0, + kAudioChannelLabel_Discrete_1 = (1L<<16) | 1, + kAudioChannelLabel_Discrete_2 = (1L<<16) | 2, + kAudioChannelLabel_Discrete_3 = (1L<<16) | 3, + kAudioChannelLabel_Discrete_4 = (1L<<16) | 4, + kAudioChannelLabel_Discrete_5 = (1L<<16) | 5, + kAudioChannelLabel_Discrete_6 = (1L<<16) | 6, + kAudioChannelLabel_Discrete_7 = (1L<<16) | 7, + kAudioChannelLabel_Discrete_8 = (1L<<16) | 8, + kAudioChannelLabel_Discrete_9 = (1L<<16) | 9, + kAudioChannelLabel_Discrete_10 = (1L<<16) | 10, + kAudioChannelLabel_Discrete_11 = (1L<<16) | 11, + kAudioChannelLabel_Discrete_12 = (1L<<16) | 12, + kAudioChannelLabel_Discrete_13 = (1L<<16) | 13, + kAudioChannelLabel_Discrete_14 = (1L<<16) | 14, + kAudioChannelLabel_Discrete_15 = (1L<<16) | 15, + kAudioChannelLabel_Discrete_65535 = (1L<<16) | 65535 +} + +enum +{ + kAudioChannelBit_Left = (1L<<0), + kAudioChannelBit_Right = (1L<<1), + kAudioChannelBit_Center = (1L<<2), + kAudioChannelBit_LFEScreen = (1L<<3), + kAudioChannelBit_LeftSurround = (1L<<4), + kAudioChannelBit_RightSurround = (1L<<5), + kAudioChannelBit_LeftCenter = (1L<<6), + kAudioChannelBit_RightCenter = (1L<<7), + kAudioChannelBit_CenterSurround = (1L<<8), + kAudioChannelBit_LeftSurroundDirect = (1L<<9), + kAudioChannelBit_RightSurroundDirect = (1L<<10), + kAudioChannelBit_TopCenterSurround = (1L<<11), + kAudioChannelBit_VerticalHeightLeft = (1L<<12), + kAudioChannelBit_VerticalHeightCenter = (1L<<13), + kAudioChannelBit_VerticalHeightRight = (1L<<14), + kAudioChannelBit_TopBackLeft = (1L<<15), + kAudioChannelBit_TopBackCenter = (1L<<16), + kAudioChannelBit_TopBackRight = (1L<<17) +} + +enum +{ + kAudioChannelFlags_AllOff = 0, + kAudioChannelFlags_RectangularCoordinates = (1L<<0), + kAudioChannelFlags_SphericalCoordinates = (1L<<1), + kAudioChannelFlags_Meters = (1L<<2) +} + +enum +{ + kAudioChannelCoordinates_LeftRight = 0, + kAudioChannelCoordinates_BackFront = 1, + kAudioChannelCoordinates_DownUp = 2, + kAudioChannelCoordinates_Azimuth = 0, + kAudioChannelCoordinates_Elevation = 1, + kAudioChannelCoordinates_Distance = 2 +} + +enum +{ + kAudioChannelLayoutTag_UseChannelDescriptions = (0L<<16) | 0, + kAudioChannelLayoutTag_UseChannelBitmap = (1L<<16) | 0, + kAudioChannelLayoutTag_Mono = (100L<<16) | 1, + kAudioChannelLayoutTag_Stereo = (101L<<16) | 2, + kAudioChannelLayoutTag_StereoHeadphones = (102L<<16) | 2, + kAudioChannelLayoutTag_MatrixStereo = (103L<<16) | 2, + kAudioChannelLayoutTag_MidSide = (104L<<16) | 2, + kAudioChannelLayoutTag_XY = (105L<<16) | 2, + kAudioChannelLayoutTag_Binaural = (106L<<16) | 2, + kAudioChannelLayoutTag_Ambisonic_B_Format = (107L<<16) | 4, + kAudioChannelLayoutTag_Quadraphonic = (108L<<16) | 4, + kAudioChannelLayoutTag_Pentagonal = (109L<<16) | 5, + kAudioChannelLayoutTag_Hexagonal = (110L<<16) | 6, + kAudioChannelLayoutTag_Octagonal = (111L<<16) | 8, + kAudioChannelLayoutTag_Cube = (112L<<16) | 8, + kAudioChannelLayoutTag_MPEG_1_0 = kAudioChannelLayoutTag_Mono, + kAudioChannelLayoutTag_MPEG_2_0 = kAudioChannelLayoutTag_Stereo, + kAudioChannelLayoutTag_MPEG_3_0_A = (113L<<16) | 3, + kAudioChannelLayoutTag_MPEG_3_0_B = (114L<<16) | 3, + kAudioChannelLayoutTag_MPEG_4_0_A = (115L<<16) | 4, + kAudioChannelLayoutTag_MPEG_4_0_B = (116L<<16) | 4, + kAudioChannelLayoutTag_MPEG_5_0_A = (117L<<16) | 5, + kAudioChannelLayoutTag_MPEG_5_0_B = (118L<<16) | 5, + kAudioChannelLayoutTag_MPEG_5_0_C = (119L<<16) | 5, + kAudioChannelLayoutTag_MPEG_5_0_D = (120L<<16) | 5, + kAudioChannelLayoutTag_MPEG_5_1_A = (121L<<16) | 6, + kAudioChannelLayoutTag_MPEG_5_1_B = (122L<<16) | 6, + kAudioChannelLayoutTag_MPEG_5_1_C = (123L<<16) | 6, + kAudioChannelLayoutTag_MPEG_5_1_D = (124L<<16) | 6, + kAudioChannelLayoutTag_MPEG_6_1_A = (125L<<16) | 7, + kAudioChannelLayoutTag_MPEG_7_1_A = (126L<<16) | 8, + kAudioChannelLayoutTag_MPEG_7_1_B = (127L<<16) | 8, + kAudioChannelLayoutTag_MPEG_7_1_C = (128L<<16) | 8, + kAudioChannelLayoutTag_Emagic_Default_7_1 = (129L<<16) | 8, + kAudioChannelLayoutTag_SMPTE_DTV = (130L<<16) | 8, + kAudioChannelLayoutTag_ITU_1_0 = kAudioChannelLayoutTag_Mono, + kAudioChannelLayoutTag_ITU_2_0 = kAudioChannelLayoutTag_Stereo, + kAudioChannelLayoutTag_ITU_2_1 = (131L<<16) | 3, + kAudioChannelLayoutTag_ITU_2_2 = (132L<<16) | 4, + kAudioChannelLayoutTag_ITU_3_0 = kAudioChannelLayoutTag_MPEG_3_0_A, + kAudioChannelLayoutTag_ITU_3_1 = kAudioChannelLayoutTag_MPEG_4_0_A, + kAudioChannelLayoutTag_ITU_3_2 = kAudioChannelLayoutTag_MPEG_5_0_A, + kAudioChannelLayoutTag_ITU_3_2_1 = kAudioChannelLayoutTag_MPEG_5_1_A, + kAudioChannelLayoutTag_ITU_3_4_1 = kAudioChannelLayoutTag_MPEG_7_1_C, + kAudioChannelLayoutTag_DVD_0 = kAudioChannelLayoutTag_Mono, + kAudioChannelLayoutTag_DVD_1 = kAudioChannelLayoutTag_Stereo, + kAudioChannelLayoutTag_DVD_2 = kAudioChannelLayoutTag_ITU_2_1, + kAudioChannelLayoutTag_DVD_3 = kAudioChannelLayoutTag_ITU_2_2, + kAudioChannelLayoutTag_DVD_4 = (133L<<16) | 3, + kAudioChannelLayoutTag_DVD_5 = (134L<<16) | 4, + kAudioChannelLayoutTag_DVD_6 = (135L<<16) | 5, + kAudioChannelLayoutTag_DVD_7 = kAudioChannelLayoutTag_MPEG_3_0_A, + kAudioChannelLayoutTag_DVD_8 = kAudioChannelLayoutTag_MPEG_4_0_A, + kAudioChannelLayoutTag_DVD_9 = kAudioChannelLayoutTag_MPEG_5_0_A, + kAudioChannelLayoutTag_DVD_10 = (136L<<16) | 4, + kAudioChannelLayoutTag_DVD_11 = (137L<<16) | 5, + kAudioChannelLayoutTag_DVD_12 = kAudioChannelLayoutTag_MPEG_5_1_A, + kAudioChannelLayoutTag_DVD_13 = kAudioChannelLayoutTag_DVD_8, + kAudioChannelLayoutTag_DVD_14 = kAudioChannelLayoutTag_DVD_9, + kAudioChannelLayoutTag_DVD_15 = kAudioChannelLayoutTag_DVD_10, + kAudioChannelLayoutTag_DVD_16 = kAudioChannelLayoutTag_DVD_11, + kAudioChannelLayoutTag_DVD_17 = kAudioChannelLayoutTag_DVD_12, + kAudioChannelLayoutTag_DVD_18 = (138L<<16) | 5, + kAudioChannelLayoutTag_DVD_19 = kAudioChannelLayoutTag_MPEG_5_0_B, + kAudioChannelLayoutTag_DVD_20 = kAudioChannelLayoutTag_MPEG_5_1_B, + kAudioChannelLayoutTag_AudioUnit_4 = kAudioChannelLayoutTag_Quadraphonic, + kAudioChannelLayoutTag_AudioUnit_5 = kAudioChannelLayoutTag_Pentagonal, + kAudioChannelLayoutTag_AudioUnit_6 = kAudioChannelLayoutTag_Hexagonal, + kAudioChannelLayoutTag_AudioUnit_8 = kAudioChannelLayoutTag_Octagonal, + kAudioChannelLayoutTag_AudioUnit_5_0 = kAudioChannelLayoutTag_MPEG_5_0_B, + kAudioChannelLayoutTag_AudioUnit_6_0 = (139L<<16) | 6, + kAudioChannelLayoutTag_AudioUnit_7_0 = (140L<<16) | 7, + kAudioChannelLayoutTag_AudioUnit_7_0_Front = (148L<<16) | 7, + kAudioChannelLayoutTag_AudioUnit_5_1 = kAudioChannelLayoutTag_MPEG_5_1_A, + kAudioChannelLayoutTag_AudioUnit_6_1 = kAudioChannelLayoutTag_MPEG_6_1_A, + kAudioChannelLayoutTag_AudioUnit_7_1 = kAudioChannelLayoutTag_MPEG_7_1_C, + kAudioChannelLayoutTag_AudioUnit_7_1_Front = kAudioChannelLayoutTag_MPEG_7_1_A, + kAudioChannelLayoutTag_AAC_3_0 = kAudioChannelLayoutTag_MPEG_3_0_B, + kAudioChannelLayoutTag_AAC_Quadraphonic = kAudioChannelLayoutTag_Quadraphonic, + kAudioChannelLayoutTag_AAC_4_0 = kAudioChannelLayoutTag_MPEG_4_0_B, + kAudioChannelLayoutTag_AAC_5_0 = kAudioChannelLayoutTag_MPEG_5_0_D, + kAudioChannelLayoutTag_AAC_5_1 = kAudioChannelLayoutTag_MPEG_5_1_D, + kAudioChannelLayoutTag_AAC_6_0 = (141L<<16) | 6, + kAudioChannelLayoutTag_AAC_6_1 = (142L<<16) | 7, + kAudioChannelLayoutTag_AAC_7_0 = (143L<<16) | 7, + kAudioChannelLayoutTag_AAC_7_1 = kAudioChannelLayoutTag_MPEG_7_1_B, + kAudioChannelLayoutTag_AAC_Octagonal = (144L<<16) | 8, + kAudioChannelLayoutTag_TMH_10_2_std = (145L<<16) | 16, + kAudioChannelLayoutTag_TMH_10_2_full = (146L<<16) | 21, + kAudioChannelLayoutTag_AC3_1_0_1 = (149L<<16) | 2, + kAudioChannelLayoutTag_AC3_3_0 = (150L<<16) | 3, + kAudioChannelLayoutTag_AC3_3_1 = (151L<<16) | 4, + kAudioChannelLayoutTag_AC3_3_0_1 = (152L<<16) | 4, + kAudioChannelLayoutTag_AC3_2_1_1 = (153L<<16) | 4, + kAudioChannelLayoutTag_AC3_3_1_1 = (154L<<16) | 5, + kAudioChannelLayoutTag_DiscreteInOrder = (147L<<16) | 0, + kAudioChannelLayoutTag_Unknown = 0xFFFF0000 +} + +enum +{ + kMPEG4Object_AAC_Main = 1, + kMPEG4Object_AAC_LC = 2, + kMPEG4Object_AAC_SSR = 3, + kMPEG4Object_AAC_LTP = 4, + kMPEG4Object_AAC_SBR = 5, + kMPEG4Object_AAC_Scalable = 6, + kMPEG4Object_TwinVQ = 7, + kMPEG4Object_CELP = 8, + kMPEG4Object_HVXC = 9 +} + +struct AudioValueRange +{ + double mMinimum; + double mMaximum; +} + + +struct AudioValueTranslation +{ + void* mInputData; + uint mInputDataSize; + void* mOutputData; + uint mOutputDataSize; +} + + +struct AudioBuffer +{ + uint mNumberChannels; + uint mDataByteSize; + void* mData; +} + + +struct AudioBufferList +{ + uint mNumberBuffers; + AudioBuffer* mBuffers; +} + + +struct AudioStreamBasicDescription +{ + double mSampleRate; + uint mFormatID; + uint mFormatFlags; + uint mBytesPerPacket; + uint mFramesPerPacket; + uint mBytesPerFrame; + uint mChannelsPerFrame; + uint mBitsPerChannel; + uint mReserved; +} + + +struct AudioStreamPacketDescription +{ + long mStartOffset; + uint mVariableFramesInPacket; + uint mDataByteSize; +} + + +struct SMPTETime +{ + short mSubframes; + short mSubframeDivisor; + uint mCounter; + uint mType; + uint mFlags; + short mHours; + short mMinutes; + short mSeconds; + short mFrames; +} + + +struct AudioTimeStamp +{ + double mSampleTime; + ulong mHostTime; + double mRateScalar; + ulong mWordClockTime; + SMPTETime mSMPTETime; + uint mFlags; + uint mReserved; +} + + +struct AudioClassDescription +{ + uint mType; + uint mSubType; + uint mManufacturer; +} + + +struct AudioChannelDescription +{ + uint mChannelLabel; + uint mChannelFlags; + Float32* mCoordinates; +} + + +struct AudioChannelLayout +{ + uint mChannelLayoutTag; + uint mChannelBitmap; + uint mNumberChannelDescriptions; + AudioChannelDescription* mChannelDescriptions; +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/coreaudio/HostTime.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/coreaudio/HostTime.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,18 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 30, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.coreaudio.HostTime; + +import dstep.coreaudio.CoreAudioTypes; + +extern (C) +{ + ulong AudioGetCurrentHostTime (); + double AudioGetHostClockFrequency (); + uint AudioGetHostClockMinimumTimeDelta (); + ulong AudioConvertHostTimeToNanos (ulong inHostTime); + ulong AudioConvertNanosToHostTime (ulong inNanos); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/coredata/CoreData.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/coredata/CoreData.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,36 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 25, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.coredata.CoreData; + +public: + +import dstep.coredata.CoreDataDefines; +import dstep.coredata.CoreDataErrors; +import dstep.coredata.NSAtomicStore; +import dstep.coredata.NSAtomicStoreCacheNode; +import dstep.coredata.NSAttributeDescription; +import dstep.coredata.NSEntityDescription; +import dstep.coredata.NSEntityMapping; +import dstep.coredata.NSEntityMigrationPolicy; +import dstep.coredata.NSFetchRequest; +import dstep.coredata.NSFetchRequestExpression; +import dstep.coredata.NSFetchedPropertyDescription; +import dstep.coredata.NSManagedObject; +import dstep.coredata.NSManagedObjectContext; +import dstep.coredata.NSManagedObjectID; +import dstep.coredata.NSManagedObjectModel; +import dstep.coredata.NSMappingModel; +import dstep.coredata.NSMigrationManager; +import dstep.coredata.NSPersistentStore; +import dstep.coredata.NSPersistentStoreCoordinator; +import dstep.coredata.NSPropertyDescription; +import dstep.coredata.NSPropertyMapping; +import dstep.coredata.NSRelationshipDescription; +import dstep.foundation.Foundation; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + diff -r 7ff919f595d5 -r 19885b43130e dstep/coredata/CoreDataDefines.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/coredata/CoreDataDefines.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,19 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 25, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.coredata.CoreDataDefines; + +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +extern (C) +{ + extern + { + double NSCoreDataVersionNumber; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/coredata/CoreDataErrors.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/coredata/CoreDataErrors.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,133 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 25, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.coredata.CoreDataErrors; + +import dstep.coredata.CoreDataDefines; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.coredata.CoreDataErrors_bindings; + +private +{ + NSString NSDetailedErrorsKey_; + NSString NSValidationObjectErrorKey_; + NSString NSValidationKeyErrorKey_; + NSString NSValidationPredicateErrorKey_; + NSString NSValidationValueErrorKey_; + NSString NSAffectedStoresErrorKey_; + NSString NSAffectedObjectsErrorKey_; + NSString NSSQLiteErrorDomain_; +} + +NSString NSDetailedErrorsKey () +{ + if (NSDetailedErrorsKey_) + return NSDetailedErrorsKey_; + + return NSDetailedErrorsKey_ = new NSString(bindings.NSDetailedErrorsKey); +} + +NSString NSValidationObjectErrorKey () +{ + if (NSValidationObjectErrorKey_) + return NSValidationObjectErrorKey_; + + return NSValidationObjectErrorKey_ = new NSString(bindings.NSValidationObjectErrorKey); +} + +NSString NSValidationKeyErrorKey () +{ + if (NSValidationKeyErrorKey_) + return NSValidationKeyErrorKey_; + + return NSValidationKeyErrorKey_ = new NSString(bindings.NSValidationKeyErrorKey); +} + +NSString NSValidationPredicateErrorKey () +{ + if (NSValidationPredicateErrorKey_) + return NSValidationPredicateErrorKey_; + + return NSValidationPredicateErrorKey_ = new NSString(bindings.NSValidationPredicateErrorKey); +} + +NSString NSValidationValueErrorKey () +{ + if (NSValidationValueErrorKey_) + return NSValidationValueErrorKey_; + + return NSValidationValueErrorKey_ = new NSString(bindings.NSValidationValueErrorKey); +} + +NSString NSAffectedStoresErrorKey () +{ + if (NSAffectedStoresErrorKey_) + return NSAffectedStoresErrorKey_; + + return NSAffectedStoresErrorKey_ = new NSString(bindings.NSAffectedStoresErrorKey); +} + +NSString NSAffectedObjectsErrorKey () +{ + if (NSAffectedObjectsErrorKey_) + return NSAffectedObjectsErrorKey_; + + return NSAffectedObjectsErrorKey_ = new NSString(bindings.NSAffectedObjectsErrorKey); +} + +NSString NSSQLiteErrorDomain () +{ + if (NSSQLiteErrorDomain_) + return NSSQLiteErrorDomain_; + + return NSSQLiteErrorDomain_ = new NSString(bindings.NSSQLiteErrorDomain); +} + +enum +{ + NSManagedObjectValidationError = 1550, + NSValidationMultipleErrorsError = 1560, + NSValidationMissingMandatoryPropertyError = 1570, + NSValidationRelationshipLacksMinimumCountError = 1580, + NSValidationRelationshipExceedsMaximumCountError = 1590, + NSValidationRelationshipDeniedDeleteError = 1600, + NSValidationNumberTooLargeError = 1610, + NSValidationNumberTooSmallError = 1620, + NSValidationDateTooLateError = 1630, + NSValidationDateTooSoonError = 1640, + NSValidationInvalidDateError = 1650, + NSValidationStringTooLongError = 1660, + NSValidationStringTooShortError = 1670, + NSValidationStringPatternMatchingError = 1680, + NSManagedObjectContextLockingError = 132000, + NSPersistentStoreCoordinatorLockingError = 132010, + NSManagedObjectReferentialIntegrityError = 133000, + NSManagedObjectExternalRelationshipError = 133010, + NSManagedObjectMergeError = 133020, + NSPersistentStoreInvalidTypeError = 134000, + NSPersistentStoreTypeMismatchError = 134010, + NSPersistentStoreIncompatibleSchemaError = 134020, + NSPersistentStoreSaveError = 134030, + NSPersistentStoreIncompleteSaveError = 134040, + NSCoreDataError = 134060, + NSPersistentStoreOperationError = 134070, + NSPersistentStoreOpenError = 134080, + NSPersistentStoreTimeoutError = 134090, + NSPersistentStoreIncompatibleVersionHashError = 134100, + NSMigrationError = 134110, + NSMigrationCancelledError = 134120, + NSMigrationMissingSourceModelError = 134130, + NSMigrationMissingMappingModelError = 134140, + NSMigrationManagerSourceStoreError = 134150, + NSMigrationManagerDestinationStoreError = 134160, + NSEntityMigrationPolicyError = 134170, + NSSQLiteError = 134180 +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/coredata/CoreDataErrors_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/coredata/CoreDataErrors_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,29 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 25, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.coredata.CoreDataErrors_bindings; + +import dstep.coredata.CoreDataDefines; +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + + +extern (C) +{ + extern + { + package const id NSDetailedErrorsKey; + package const id NSValidationObjectErrorKey; + package const id NSValidationKeyErrorKey; + package const id NSValidationPredicateErrorKey; + package const id NSValidationValueErrorKey; + package const id NSAffectedStoresErrorKey; + package const id NSAffectedObjectsErrorKey; + package const id NSSQLiteErrorDomain; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/coredata/NSAtomicStore.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/coredata/NSAtomicStore.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,109 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 25, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.coredata.NSAtomicStore; + +import dstep.coredata.NSAtomicStoreCacheNode; +import dstep.coredata.NSEntityDescription; +import dstep.coredata.NSManagedObject; +import dstep.coredata.NSManagedObjectID; +import dstep.coredata.NSPersistentStore; +import dstep.coredata.NSPersistentStoreCoordinator; +import dstep.foundation.Foundation; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSAtomicStore : NSPersistentStore +{ + mixin (ObjcWrap); + + NSAtomicStore initWithPersistentStoreCoordinator (NSPersistentStoreCoordinator coordinator, NSString configurationName, NSURL url, NSDictionary options) + { + id result = invokeObjcSelf!(id, "initWithPersistentStoreCoordinator:configurationName:URL:options:", NSPersistentStoreCoordinator, NSString, NSURL, NSDictionary)(coordinator, configurationName, url, options); + return result is this.objcObject ? this : (result !is null ? new NSAtomicStore(result) : null); + } + + this (NSPersistentStoreCoordinator coordinator, NSString configurationName, NSURL url, NSDictionary options) + { + super(NSAtomicStore.alloc.initWithPersistentStoreCoordinator(coordinator, configurationName, url, options).objcObject); + } + + bool load (ref NSError error) + { + id __arg0; + + if (error) + __arg0 = error.objcObject; + + bool result = invokeObjcSelf!(bool, "load:", id*)(&__arg0); + + if (__arg0) + error = new NSError(__arg0); + + return result; + } + + bool save (ref NSError error) + { + id __arg0; + + if (error) + __arg0 = error.objcObject; + + bool result = invokeObjcSelf!(bool, "save:", id*)(&__arg0); + + if (__arg0) + error = new NSError(__arg0); + + return result; + } + + NSAtomicStoreCacheNode newCacheNodeForManagedObject (NSManagedObject managedObject) + { + return invokeObjcSelf!(NSAtomicStoreCacheNode, "newCacheNodeForManagedObject:", NSManagedObject)(managedObject); + } + + void updateCacheNode (NSAtomicStoreCacheNode node, NSManagedObject managedObject) + { + return invokeObjcSelf!(void, "updateCacheNode:fromManagedObject:", NSAtomicStoreCacheNode, NSManagedObject)(node, managedObject); + } + + NSSet cacheNodes () + { + return invokeObjcSelf!(NSSet, "cacheNodes"); + } + + void addCacheNodes (NSSet cacheNodes) + { + return invokeObjcSelf!(void, "addCacheNodes:", NSSet)(cacheNodes); + } + + void willRemoveCacheNodes (NSSet cacheNodes) + { + return invokeObjcSelf!(void, "willRemoveCacheNodes:", NSSet)(cacheNodes); + } + + NSAtomicStoreCacheNode cacheNodeForObjectID (NSManagedObjectID objectID) + { + return invokeObjcSelf!(NSAtomicStoreCacheNode, "cacheNodeForObjectID:", NSManagedObjectID)(objectID); + } + + NSManagedObjectID objectIDForEntity (NSEntityDescription entity, Object data) + { + return invokeObjcSelf!(NSManagedObjectID, "objectIDForEntity:referenceObject:", NSEntityDescription, Object)(entity, data); + } + + Object newReferenceObjectForManagedObject (NSManagedObject managedObject) + { + return invokeObjcSelf!(Object, "newReferenceObjectForManagedObject:", NSManagedObject)(managedObject); + } + + Object referenceObjectForObjectID (NSManagedObjectID objectID) + { + return invokeObjcSelf!(Object, "referenceObjectForObjectID:", NSManagedObjectID)(objectID); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/coredata/NSAtomicStoreCacheNode.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/coredata/NSAtomicStoreCacheNode.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,56 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 25, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.coredata.NSAtomicStoreCacheNode; + +import dstep.coredata.NSEntityDescription; +import dstep.coredata.NSManagedObject; +import dstep.coredata.NSManagedObjectID; +import dstep.foundation.Foundation; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSAtomicStoreCacheNode : NSObject +{ + mixin (ObjcWrap); + + NSAtomicStoreCacheNode initWithObjectID (NSManagedObjectID moid) + { + id result = invokeObjcSelf!(id, "initWithObjectID:", NSManagedObjectID)(moid); + return result is this.objcObject ? this : (result !is null ? new NSAtomicStoreCacheNode(result) : null); + } + + this (NSManagedObjectID moid) + { + super(NSAtomicStoreCacheNode.alloc.initWithObjectID(moid).objcObject); + } + + NSManagedObjectID objectID () + { + return invokeObjcSelf!(NSManagedObjectID, "objectID"); + } + + NSMutableDictionary propertyCache () + { + return invokeObjcSelf!(NSMutableDictionary, "propertyCache"); + } + + void setPropertyCache (NSMutableDictionary propertyCache) + { + return invokeObjcSelf!(void, "setPropertyCache:", NSMutableDictionary)(propertyCache); + } + + Object valueForKey (NSString key) + { + return invokeObjcSelf!(Object, "valueForKey:", NSString)(key); + } + + void setValue (Object value, NSString key) + { + return invokeObjcSelf!(void, "setValue:forKey:", Object, NSString)(value, key); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/coredata/NSAttributeDescription.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/coredata/NSAttributeDescription.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,84 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 25, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.coredata.NSAttributeDescription; + +import dstep.coredata.NSEntityDescription; +import dstep.coredata.NSPropertyDescription; +import dstep.foundation.NSData; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +alias NSUInteger NSAttributeType; + +enum +{ + NSUndefinedAttributeType = 0, + NSInteger16AttributeType = 100, + NSInteger32AttributeType = 200, + NSInteger64AttributeType = 300, + NSDecimalAttributeType = 400, + NSDoubleAttributeType = 500, + NSFloatAttributeType = 600, + NSStringAttributeType = 700, + NSBooleanAttributeType = 800, + NSDateAttributeType = 900, + NSBinaryDataAttributeType = 1000, + NSTransformableAttributeType = 1800 +} + +class NSAttributeDescription : NSPropertyDescription +{ + mixin (ObjcWrap); + + uint attributeType () + { + return invokeObjcSelf!(uint, "attributeType"); + } + + void setAttributeType (uint type) + { + return invokeObjcSelf!(void, "setAttributeType:", uint)(type); + } + + NSString attributeValueClassName () + { + return invokeObjcSelf!(NSString, "attributeValueClassName"); + } + + Object defaultValue () + { + return invokeObjcSelf!(Object, "defaultValue"); + } + + void setDefaultValue (Object value) + { + return invokeObjcSelf!(void, "setDefaultValue:", Object)(value); + } + + void setAttributeValueClassName (NSString className) + { + return invokeObjcSelf!(void, "setAttributeValueClassName:", NSString)(className); + } + + NSData versionHash () + { + return invokeObjcSelf!(NSData, "versionHash"); + } + + NSString valueTransformerName () + { + return invokeObjcSelf!(NSString, "valueTransformerName"); + } + + void setValueTransformerName (NSString string) + { + return invokeObjcSelf!(void, "setValueTransformerName:", NSString)(string); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/coredata/NSEntityDescription.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/coredata/NSEntityDescription.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,176 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 25, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.coredata.NSEntityDescription; + +import dstep.coredata.NSManagedObject; +import dstep.coredata.NSManagedObjectContext; +import dstep.coredata.NSManagedObjectModel; +import dstep.foundation.NSArray; +import dstep.foundation.NSCoder; +import dstep.foundation.NSData; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSEnumerator; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSRange; +import dstep.foundation.NSString; +import dstep.foundation.NSZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSEntityDescription : NSObject, INSCoding, INSCopying, INSFastEnumeration +{ + mixin (ObjcWrap); + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + NSEntityDescription initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(NSEntityDescription, "initWithCoder:", NSCoder)(aDecoder); + } + + NSObject copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(NSObject, "copyWithZone:", NSZone*)(zone); + } + + NSUInteger countByEnumeratingWithState (NSFastEnumerationState* state, id* stackbuf, NSUInteger len) + { + return invokeObjcSelf!(NSUInteger, "countByEnumeratingWithState:objects:count:", NSFastEnumerationState*, id*, NSUInteger)(state, stackbuf, len); + } + + static NSEntityDescription entityForName (NSString entityName, NSManagedObjectContext context) + { + return invokeObjcSelfClass!(NSEntityDescription, "entityForName:inManagedObjectContext:", NSString, NSManagedObjectContext)(entityName, context); + } + + static Object insertNewObjectForEntityForName (NSString entityName, NSManagedObjectContext context) + { + return invokeObjcSelfClass!(Object, "insertNewObjectForEntityForName:inManagedObjectContext:", NSString, NSManagedObjectContext)(entityName, context); + } + + NSManagedObjectModel managedObjectModel () + { + return invokeObjcSelf!(NSManagedObjectModel, "managedObjectModel"); + } + + NSString managedObjectClassName () + { + return invokeObjcSelf!(NSString, "managedObjectClassName"); + } + + void setManagedObjectClassName (NSString name) + { + return invokeObjcSelf!(void, "setManagedObjectClassName:", NSString)(name); + } + + NSString name () + { + return invokeObjcSelf!(NSString, "name"); + } + + void setName (NSString name) + { + return invokeObjcSelf!(void, "setName:", NSString)(name); + } + + bool isAbstract () + { + return invokeObjcSelf!(bool, "isAbstract"); + } + + void setAbstract (bool flag) + { + return invokeObjcSelf!(void, "setAbstract:", bool)(flag); + } + + NSDictionary subentitiesByName () + { + return invokeObjcSelf!(NSDictionary, "subentitiesByName"); + } + + NSArray subentities () + { + return invokeObjcSelf!(NSArray, "subentities"); + } + + void setSubentities (NSArray array) + { + return invokeObjcSelf!(void, "setSubentities:", NSArray)(array); + } + + NSEntityDescription superentity () + { + id result = invokeObjcSelf!(id, "superentity"); + return result is this.objcObject ? this : (result !is null ? new NSEntityDescription(result) : null); + } + + NSDictionary propertiesByName () + { + return invokeObjcSelf!(NSDictionary, "propertiesByName"); + } + + NSArray properties () + { + return invokeObjcSelf!(NSArray, "properties"); + } + + void setProperties (NSArray properties) + { + return invokeObjcSelf!(void, "setProperties:", NSArray)(properties); + } + + NSDictionary userInfo () + { + return invokeObjcSelf!(NSDictionary, "userInfo"); + } + + void setUserInfo (NSDictionary dictionary) + { + return invokeObjcSelf!(void, "setUserInfo:", NSDictionary)(dictionary); + } + + NSDictionary attributesByName () + { + return invokeObjcSelf!(NSDictionary, "attributesByName"); + } + + NSDictionary relationshipsByName () + { + return invokeObjcSelf!(NSDictionary, "relationshipsByName"); + } + + NSArray relationshipsWithDestinationEntity (NSEntityDescription entity) + { + return invokeObjcSelf!(NSArray, "relationshipsWithDestinationEntity:", NSEntityDescription)(entity); + } + + bool isKindOfEntity (NSEntityDescription entity) + { + return invokeObjcSelf!(bool, "isKindOfEntity:", NSEntityDescription)(entity); + } + + NSData versionHash () + { + return invokeObjcSelf!(NSData, "versionHash"); + } + + NSString versionHashModifier () + { + return invokeObjcSelf!(NSString, "versionHashModifier"); + } + + void setVersionHashModifier (NSString modifierString) + { + return invokeObjcSelf!(void, "setVersionHashModifier:", NSString)(modifierString); + } + +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/coredata/NSEntityMapping.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/coredata/NSEntityMapping.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,146 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 25, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.coredata.NSEntityMapping; + +import dstep.coredata.NSEntityDescription; +import dstep.foundation.NSArray; +import dstep.foundation.NSData; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSExpression; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +alias NSUInteger NSEntityMappingType; + +enum +{ + NSUndefinedEntityMappingType = 0x00, + NSCustomEntityMappingType = 0x01, + NSAddEntityMappingType = 0x02, + NSRemoveEntityMappingType = 0x03, + NSCopyEntityMappingType = 0x04, + NSTransformEntityMappingType = 0x05 +} + +class NSEntityMapping : NSObject +{ + mixin (ObjcWrap); + + NSString name () + { + return invokeObjcSelf!(NSString, "name"); + } + + void setName (NSString name) + { + return invokeObjcSelf!(void, "setName:", NSString)(name); + } + + uint mappingType () + { + return invokeObjcSelf!(uint, "mappingType"); + } + + void setMappingType (uint type) + { + return invokeObjcSelf!(void, "setMappingType:", uint)(type); + } + + NSString sourceEntityName () + { + return invokeObjcSelf!(NSString, "sourceEntityName"); + } + + void setSourceEntityName (NSString name) + { + return invokeObjcSelf!(void, "setSourceEntityName:", NSString)(name); + } + + NSData sourceEntityVersionHash () + { + return invokeObjcSelf!(NSData, "sourceEntityVersionHash"); + } + + void setSourceEntityVersionHash (NSData vhash) + { + return invokeObjcSelf!(void, "setSourceEntityVersionHash:", NSData)(vhash); + } + + NSString destinationEntityName () + { + return invokeObjcSelf!(NSString, "destinationEntityName"); + } + + void setDestinationEntityName (NSString name) + { + return invokeObjcSelf!(void, "setDestinationEntityName:", NSString)(name); + } + + NSData destinationEntityVersionHash () + { + return invokeObjcSelf!(NSData, "destinationEntityVersionHash"); + } + + void setDestinationEntityVersionHash (NSData vhash) + { + return invokeObjcSelf!(void, "setDestinationEntityVersionHash:", NSData)(vhash); + } + + NSArray attributeMappings () + { + return invokeObjcSelf!(NSArray, "attributeMappings"); + } + + void setAttributeMappings (NSArray mappings) + { + return invokeObjcSelf!(void, "setAttributeMappings:", NSArray)(mappings); + } + + NSArray relationshipMappings () + { + return invokeObjcSelf!(NSArray, "relationshipMappings"); + } + + void setRelationshipMappings (NSArray mappings) + { + return invokeObjcSelf!(void, "setRelationshipMappings:", NSArray)(mappings); + } + + NSExpression sourceExpression () + { + return invokeObjcSelf!(NSExpression, "sourceExpression"); + } + + void setSourceExpression (NSExpression source) + { + return invokeObjcSelf!(void, "setSourceExpression:", NSExpression)(source); + } + + NSDictionary userInfo () + { + return invokeObjcSelf!(NSDictionary, "userInfo"); + } + + void setUserInfo (NSDictionary dict) + { + return invokeObjcSelf!(void, "setUserInfo:", NSDictionary)(dict); + } + + NSString entityMigrationPolicyClassName () + { + return invokeObjcSelf!(NSString, "entityMigrationPolicyClassName"); + } + + void setEntityMigrationPolicyClassName (NSString name) + { + return invokeObjcSelf!(void, "setEntityMigrationPolicyClassName:", NSString)(name); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/coredata/NSEntityMigrationPolicy.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/coredata/NSEntityMigrationPolicy.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,180 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 25, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.coredata.NSEntityMigrationPolicy; + +import dstep.coredata.CoreDataDefines; +import dstep.coredata.NSEntityMapping; +import dstep.coredata.NSManagedObject; +import dstep.coredata.NSMigrationManager; +import dstep.foundation.NSArray; +import dstep.foundation.NSError; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.coredata.NSEntityMigrationPolicy_bindings; + +private +{ + NSString NSMigrationManagerKey_; + NSString NSMigrationSourceObjectKey_; + NSString NSMigrationDestinationObjectKey_; + NSString NSMigrationEntityMappingKey_; + NSString NSMigrationPropertyMappingKey_; +} + +NSString NSMigrationManagerKey () +{ + if (NSMigrationManagerKey_) + return NSMigrationManagerKey_; + + return NSMigrationManagerKey_ = new NSString(bindings.NSMigrationManagerKey); +} + +NSString NSMigrationSourceObjectKey () +{ + if (NSMigrationSourceObjectKey_) + return NSMigrationSourceObjectKey_; + + return NSMigrationSourceObjectKey_ = new NSString(bindings.NSMigrationSourceObjectKey); +} + +NSString NSMigrationDestinationObjectKey () +{ + if (NSMigrationDestinationObjectKey_) + return NSMigrationDestinationObjectKey_; + + return NSMigrationDestinationObjectKey_ = new NSString(bindings.NSMigrationDestinationObjectKey); +} + +NSString NSMigrationEntityMappingKey () +{ + if (NSMigrationEntityMappingKey_) + return NSMigrationEntityMappingKey_; + + return NSMigrationEntityMappingKey_ = new NSString(bindings.NSMigrationEntityMappingKey); +} + +NSString NSMigrationPropertyMappingKey () +{ + if (NSMigrationPropertyMappingKey_) + return NSMigrationPropertyMappingKey_; + + return NSMigrationPropertyMappingKey_ = new NSString(bindings.NSMigrationPropertyMappingKey); +} + +class NSEntityMigrationPolicy : NSObject +{ + mixin (ObjcWrap); + + bool beginEntityMapping (NSEntityMapping mapping, NSMigrationManager manager, ref NSError error) + { + id __arg2; + + if (error) + __arg2 = error.objcObject; + + bool result = invokeObjcSelf!(bool, "beginEntityMapping:manager:error:", NSEntityMapping, NSMigrationManager, id*)(mapping, manager, &__arg2); + + if (__arg2) + error = new NSError(__arg2); + + return result; + } + + bool createDestinationInstancesForSourceInstance (NSManagedObject sInstance, NSEntityMapping mapping, NSMigrationManager manager, ref NSError error) + { + id __arg3; + + if (error) + __arg3 = error.objcObject; + + bool result = invokeObjcSelf!(bool, "createDestinationInstancesForSourceInstance:entityMapping:manager:error:", NSManagedObject, NSEntityMapping, NSMigrationManager, id*)(sInstance, mapping, manager, &__arg3); + + if (__arg3) + error = new NSError(__arg3); + + return result; + } + + bool endInstanceCreationForEntityMapping (NSEntityMapping mapping, NSMigrationManager manager, ref NSError error) + { + id __arg2; + + if (error) + __arg2 = error.objcObject; + + bool result = invokeObjcSelf!(bool, "endInstanceCreationForEntityMapping:manager:error:", NSEntityMapping, NSMigrationManager, id*)(mapping, manager, &__arg2); + + if (__arg2) + error = new NSError(__arg2); + + return result; + } + + bool createRelationshipsForDestinationInstance (NSManagedObject dInstance, NSEntityMapping mapping, NSMigrationManager manager, ref NSError error) + { + id __arg3; + + if (error) + __arg3 = error.objcObject; + + bool result = invokeObjcSelf!(bool, "createRelationshipsForDestinationInstance:entityMapping:manager:error:", NSManagedObject, NSEntityMapping, NSMigrationManager, id*)(dInstance, mapping, manager, &__arg3); + + if (__arg3) + error = new NSError(__arg3); + + return result; + } + + bool endRelationshipCreationForEntityMapping (NSEntityMapping mapping, NSMigrationManager manager, ref NSError error) + { + id __arg2; + + if (error) + __arg2 = error.objcObject; + + bool result = invokeObjcSelf!(bool, "endRelationshipCreationForEntityMapping:manager:error:", NSEntityMapping, NSMigrationManager, id*)(mapping, manager, &__arg2); + + if (__arg2) + error = new NSError(__arg2); + + return result; + } + + bool performCustomValidationForEntityMapping (NSEntityMapping mapping, NSMigrationManager manager, ref NSError error) + { + id __arg2; + + if (error) + __arg2 = error.objcObject; + + bool result = invokeObjcSelf!(bool, "performCustomValidationForEntityMapping:manager:error:", NSEntityMapping, NSMigrationManager, id*)(mapping, manager, &__arg2); + + if (__arg2) + error = new NSError(__arg2); + + return result; + } + + bool endEntityMapping (NSEntityMapping mapping, NSMigrationManager manager, ref NSError error) + { + id __arg2; + + if (error) + __arg2 = error.objcObject; + + bool result = invokeObjcSelf!(bool, "endEntityMapping:manager:error:", NSEntityMapping, NSMigrationManager, id*)(mapping, manager, &__arg2); + + if (__arg2) + error = new NSError(__arg2); + + return result; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/coredata/NSEntityMigrationPolicy_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/coredata/NSEntityMigrationPolicy_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,31 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 25, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.coredata.NSEntityMigrationPolicy_bindings; + +import dstep.coredata.CoreDataDefines; +import dstep.coredata.NSEntityMapping; +import dstep.coredata.NSManagedObject; +import dstep.coredata.NSMigrationManager; +import dstep.foundation.NSArray; +import dstep.foundation.NSError; +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + + +extern (C) +{ + extern + { + package const id NSMigrationManagerKey; + package const id NSMigrationSourceObjectKey; + package const id NSMigrationDestinationObjectKey; + package const id NSMigrationEntityMappingKey; + package const id NSMigrationPropertyMappingKey; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/coredata/NSFetchRequest.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/coredata/NSFetchRequest.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,148 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 25, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.coredata.NSFetchRequest; + +import dstep.coredata.NSEntityDescription; +import dstep.coredata.NSManagedObjectModel; +import dstep.foundation.NSArray; +import dstep.foundation.NSCoder; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSPredicate; +import dstep.foundation.NSString; +import dstep.foundation.NSZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +alias NSUInteger NSFetchRequestResultType; + +enum +{ + NSManagedObjectResultType = 0x00, + NSManagedObjectIDResultType = 0x01 +} + +class NSFetchRequest : NSObject, INSCoding, INSCopying +{ + mixin (ObjcWrap); + + NSEntityDescription entity () + { + return invokeObjcSelf!(NSEntityDescription, "entity"); + } + + void setEntity (NSEntityDescription entity) + { + return invokeObjcSelf!(void, "setEntity:", NSEntityDescription)(entity); + } + + NSPredicate predicate () + { + return invokeObjcSelf!(NSPredicate, "predicate"); + } + + void setPredicate (NSPredicate predicate) + { + return invokeObjcSelf!(void, "setPredicate:", NSPredicate)(predicate); + } + + NSArray sortDescriptors () + { + return invokeObjcSelf!(NSArray, "sortDescriptors"); + } + + void setSortDescriptors (NSArray sortDescriptors) + { + return invokeObjcSelf!(void, "setSortDescriptors:", NSArray)(sortDescriptors); + } + + NSUInteger fetchLimit () + { + return invokeObjcSelf!(NSUInteger, "fetchLimit"); + } + + void setFetchLimit (NSUInteger limit) + { + return invokeObjcSelf!(void, "setFetchLimit:", NSUInteger)(limit); + } + + NSArray affectedStores () + { + return invokeObjcSelf!(NSArray, "affectedStores"); + } + + void setAffectedStores (NSArray stores) + { + return invokeObjcSelf!(void, "setAffectedStores:", NSArray)(stores); + } + + uint resultType () + { + return invokeObjcSelf!(uint, "resultType"); + } + + void setResultType (uint type) + { + return invokeObjcSelf!(void, "setResultType:", uint)(type); + } + + bool includesSubentities () + { + return invokeObjcSelf!(bool, "includesSubentities"); + } + + void setIncludesSubentities (bool yesNo) + { + return invokeObjcSelf!(void, "setIncludesSubentities:", bool)(yesNo); + } + + bool includesPropertyValues () + { + return invokeObjcSelf!(bool, "includesPropertyValues"); + } + + void setIncludesPropertyValues (bool yesNo) + { + return invokeObjcSelf!(void, "setIncludesPropertyValues:", bool)(yesNo); + } + + bool returnsObjectsAsFaults () + { + return invokeObjcSelf!(bool, "returnsObjectsAsFaults"); + } + + void setReturnsObjectsAsFaults (bool yesNo) + { + return invokeObjcSelf!(void, "setReturnsObjectsAsFaults:", bool)(yesNo); + } + + NSArray relationshipKeyPathsForPrefetching () + { + return invokeObjcSelf!(NSArray, "relationshipKeyPathsForPrefetching"); + } + + void setRelationshipKeyPathsForPrefetching (NSArray keys) + { + return invokeObjcSelf!(void, "setRelationshipKeyPathsForPrefetching:", NSArray)(keys); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + typeof(this) copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/coredata/NSFetchRequestExpression.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/coredata/NSFetchRequestExpression.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,42 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 25, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.coredata.NSFetchRequestExpression; + +import dstep.foundation.NSExpression; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +enum +{ + NSFetchRequestExpressionType = 50 +} + +class NSFetchRequestExpression : NSExpression +{ + mixin (ObjcWrap); + + static NSExpression expressionForFetch (NSExpression fetch, NSExpression context, bool countFlag) + { + return invokeObjcSelfClass!(NSExpression, "expressionForFetch:context:countOnly:", NSExpression, NSExpression, bool)(fetch, context, countFlag); + } + + NSExpression requestExpression () + { + return invokeObjcSelf!(NSExpression, "requestExpression"); + } + + NSExpression contextExpression () + { + return invokeObjcSelf!(NSExpression, "contextExpression"); + } + + bool isCountOnlyRequest () + { + return invokeObjcSelf!(bool, "isCountOnlyRequest"); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/coredata/NSFetchedPropertyDescription.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/coredata/NSFetchedPropertyDescription.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,28 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 25, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.coredata.NSFetchedPropertyDescription; + +import dstep.coredata.NSFetchRequest; +import dstep.coredata.NSPropertyDescription; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSFetchedPropertyDescription : NSPropertyDescription +{ + mixin (ObjcWrap); + + NSFetchRequest fetchRequest () + { + return invokeObjcSelf!(NSFetchRequest, "fetchRequest"); + } + + void setFetchRequest (NSFetchRequest fetchRequest) + { + return invokeObjcSelf!(void, "setFetchRequest:", NSFetchRequest)(fetchRequest); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/coredata/NSManagedObject.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/coredata/NSManagedObject.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,238 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 25, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.coredata.NSManagedObject; + +import dstep.coredata.NSEntityDescription; + +import dstep.coredata.NSManagedObjectContext; +import dstep.coredata.NSManagedObjectID; +import dstep.foundation.NSArray; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSError; +import dstep.foundation.NSKeyValueObserving; +import dstep.foundation.NSObject; +import dstep.foundation.NSSet; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSManagedObject : NSObject +{ + mixin (ObjcWrap); + + NSManagedObject initWithEntity (NSEntityDescription entity, NSManagedObjectContext context) + { + id result = invokeObjcSelf!(id, "initWithEntity:insertIntoManagedObjectContext:", NSEntityDescription, NSManagedObjectContext)(entity, context); + return result is this.objcObject ? this : (result !is null ? new NSManagedObject(result) : null); + } + + this (NSEntityDescription entity, NSManagedObjectContext context) + { + super(NSManagedObject.alloc.initWithEntity(entity, context).objcObject); + } + + NSManagedObjectContext managedObjectContext () + { + return invokeObjcSelf!(NSManagedObjectContext, "managedObjectContext"); + } + + NSEntityDescription entity () + { + return invokeObjcSelf!(NSEntityDescription, "entity"); + } + + NSManagedObjectID objectID () + { + return invokeObjcSelf!(NSManagedObjectID, "objectID"); + } + + bool isInserted () + { + return invokeObjcSelf!(bool, "isInserted"); + } + + bool isUpdated () + { + return invokeObjcSelf!(bool, "isUpdated"); + } + + bool isDeleted () + { + return invokeObjcSelf!(bool, "isDeleted"); + } + + bool isFault () + { + return invokeObjcSelf!(bool, "isFault"); + } + + bool hasFaultForRelationshipNamed (NSString key) + { + return invokeObjcSelf!(bool, "hasFaultForRelationshipNamed:", NSString)(key); + } + + void willAccessValueForKey (NSString key) + { + return invokeObjcSelf!(void, "willAccessValueForKey:", NSString)(key); + } + + void didAccessValueForKey (NSString key) + { + return invokeObjcSelf!(void, "didAccessValueForKey:", NSString)(key); + } + + void willChangeValueForKey (NSString key) + { + return invokeObjcSelf!(void, "willChangeValueForKey:", NSString)(key); + } + + void didChangeValueForKey (NSString key) + { + return invokeObjcSelf!(void, "didChangeValueForKey:", NSString)(key); + } + + void willChangeValueForKey (NSString inKey, uint inMutationKind, NSSet inObjects) + { + return invokeObjcSelf!(void, "willChangeValueForKey:withSetMutation:usingObjects:", NSString, uint, NSSet)(inKey, inMutationKind, inObjects); + } + + void didChangeValueForKey (NSString inKey, uint inMutationKind, NSSet inObjects) + { + return invokeObjcSelf!(void, "didChangeValueForKey:withSetMutation:usingObjects:", NSString, uint, NSSet)(inKey, inMutationKind, inObjects); + } + + void setObservationInfo (void* inObservationInfo) + { + return invokeObjcSelf!(void, "setObservationInfo:", void*)(inObservationInfo); + } + + void* observationInfo () + { + return invokeObjcSelf!(void*, "observationInfo"); + } + + void awakeFromFetch () + { + return invokeObjcSelf!(void, "awakeFromFetch"); + } + + void awakeFromInsert () + { + return invokeObjcSelf!(void, "awakeFromInsert"); + } + + void willSave () + { + return invokeObjcSelf!(void, "willSave"); + } + + void didSave () + { + return invokeObjcSelf!(void, "didSave"); + } + + void willTurnIntoFault () + { + return invokeObjcSelf!(void, "willTurnIntoFault"); + } + + void didTurnIntoFault () + { + return invokeObjcSelf!(void, "didTurnIntoFault"); + } + + Object valueForKey (NSString key) + { + return invokeObjcSelf!(Object, "valueForKey:", NSString)(key); + } + + void setValue (Object value, NSString key) + { + return invokeObjcSelf!(void, "setValue:forKey:", Object, NSString)(value, key); + } + + Object primitiveValueForKey (NSString key) + { + return invokeObjcSelf!(Object, "primitiveValueForKey:", NSString)(key); + } + + void setPrimitiveValue (Object value, NSString key) + { + return invokeObjcSelf!(void, "setPrimitiveValue:forKey:", Object, NSString)(value, key); + } + + NSDictionary committedValuesForKeys (NSArray keys) + { + return invokeObjcSelf!(NSDictionary, "committedValuesForKeys:", NSArray)(keys); + } + + NSDictionary changedValues () + { + return invokeObjcSelf!(NSDictionary, "changedValues"); + } + + bool validateValue (id* value, NSString key, ref NSError error) + { + id __arg2; + + if (error) + __arg2 = error.objcObject; + + bool result = invokeObjcSelf!(bool, "validateValue:forKey:error:", id*, NSString, id*)(value, key, &__arg2); + + if (__arg2) + error = new NSError(__arg2); + + return result; + } + + bool validateForDelete (ref NSError error) + { + id __arg0; + + if (error) + __arg0 = error.objcObject; + + bool result = invokeObjcSelf!(bool, "validateForDelete:", id*)(&__arg0); + + if (__arg0) + error = new NSError(__arg0); + + return result; + } + + bool validateForInsert (ref NSError error) + { + id __arg0; + + if (error) + __arg0 = error.objcObject; + + bool result = invokeObjcSelf!(bool, "validateForInsert:", id*)(&__arg0); + + if (__arg0) + error = new NSError(__arg0); + + return result; + } + + bool validateForUpdate (ref NSError error) + { + id __arg0; + + if (error) + __arg0 = error.objcObject; + + bool result = invokeObjcSelf!(bool, "validateForUpdate:", id*)(&__arg0); + + if (__arg0) + error = new NSError(__arg0); + + return result; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/coredata/NSManagedObjectContext.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/coredata/NSManagedObjectContext.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,400 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 25, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.coredata.NSManagedObjectContext; + +import dstep.coredata.CoreDataDefines; + +import dstep.coredata.NSFetchRequest; +import dstep.coredata.NSManagedObject; +import dstep.coredata.NSManagedObjectID; +import dstep.coredata.NSPersistentStore; +import dstep.coredata.NSPersistentStoreCoordinator; +import dstep.corefoundation.CFArray; +import dstep.corefoundation.CFDictionary; +import dstep.foundation.NSArray; +import dstep.foundation.NSCoder; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSDate; +import dstep.foundation.NSError; +import dstep.foundation.NSLock; +import dstep.foundation.NSNotification; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSUndoManager; +import dstep.foundation.NSSet; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.coredata.NSManagedObjectContext_bindings; + +private +{ + NSString NSManagedObjectContextDidSaveNotification_; + NSString NSManagedObjectContextObjectsDidChangeNotification_; + NSString NSInsertedObjectsKey_; + NSString NSUpdatedObjectsKey_; + NSString NSDeletedObjectsKey_; + NSString NSRefreshedObjectsKey_; + NSString NSInvalidatedObjectsKey_; + NSString NSInvalidatedAllObjectsKey_; + NSObject NSErrorMergePolicy_; + NSObject NSMergeByPropertyStoreTrumpMergePolicy_; + NSObject NSMergeByPropertyObjectTrumpMergePolicy_; + NSObject NSOverwriteMergePolicy_; + NSObject NSRollbackMergePolicy_; +} + +NSString NSManagedObjectContextDidSaveNotification () +{ + if (NSManagedObjectContextDidSaveNotification_) + return NSManagedObjectContextDidSaveNotification_; + + return NSManagedObjectContextDidSaveNotification_ = new NSString(bindings.NSManagedObjectContextDidSaveNotification); +} + +NSString NSManagedObjectContextObjectsDidChangeNotification () +{ + if (NSManagedObjectContextObjectsDidChangeNotification_) + return NSManagedObjectContextObjectsDidChangeNotification_; + + return NSManagedObjectContextObjectsDidChangeNotification_ = new NSString(bindings.NSManagedObjectContextObjectsDidChangeNotification); +} + +NSString NSInsertedObjectsKey () +{ + if (NSInsertedObjectsKey_) + return NSInsertedObjectsKey_; + + return NSInsertedObjectsKey_ = new NSString(bindings.NSInsertedObjectsKey); +} + +NSString NSUpdatedObjectsKey () +{ + if (NSUpdatedObjectsKey_) + return NSUpdatedObjectsKey_; + + return NSUpdatedObjectsKey_ = new NSString(bindings.NSUpdatedObjectsKey); +} + +NSString NSDeletedObjectsKey () +{ + if (NSDeletedObjectsKey_) + return NSDeletedObjectsKey_; + + return NSDeletedObjectsKey_ = new NSString(bindings.NSDeletedObjectsKey); +} + +NSString NSRefreshedObjectsKey () +{ + if (NSRefreshedObjectsKey_) + return NSRefreshedObjectsKey_; + + return NSRefreshedObjectsKey_ = new NSString(bindings.NSRefreshedObjectsKey); +} + +NSString NSInvalidatedObjectsKey () +{ + if (NSInvalidatedObjectsKey_) + return NSInvalidatedObjectsKey_; + + return NSInvalidatedObjectsKey_ = new NSString(bindings.NSInvalidatedObjectsKey); +} + +NSString NSInvalidatedAllObjectsKey () +{ + if (NSInvalidatedAllObjectsKey_) + return NSInvalidatedAllObjectsKey_; + + return NSInvalidatedAllObjectsKey_ = new NSString(bindings.NSInvalidatedAllObjectsKey); +} + +NSObject NSErrorMergePolicy () +{ + if (NSErrorMergePolicy_) + return NSErrorMergePolicy_; + + return NSErrorMergePolicy_ = new NSObject(bindings.NSErrorMergePolicy); +} + +NSObject NSMergeByPropertyStoreTrumpMergePolicy () +{ + if (NSMergeByPropertyStoreTrumpMergePolicy_) + return NSMergeByPropertyStoreTrumpMergePolicy_; + + return NSMergeByPropertyStoreTrumpMergePolicy_ = new NSObject(bindings.NSMergeByPropertyStoreTrumpMergePolicy); +} + +NSObject NSMergeByPropertyObjectTrumpMergePolicy () +{ + if (NSMergeByPropertyObjectTrumpMergePolicy_) + return NSMergeByPropertyObjectTrumpMergePolicy_; + + return NSMergeByPropertyObjectTrumpMergePolicy_ = new NSObject(bindings.NSMergeByPropertyObjectTrumpMergePolicy); +} + +NSObject NSOverwriteMergePolicy () +{ + if (NSOverwriteMergePolicy_) + return NSOverwriteMergePolicy_; + + return NSOverwriteMergePolicy_ = new NSObject(bindings.NSOverwriteMergePolicy); +} + +NSObject NSRollbackMergePolicy () +{ + if (NSRollbackMergePolicy_) + return NSRollbackMergePolicy_; + + return NSRollbackMergePolicy_ = new NSObject(bindings.NSRollbackMergePolicy); +} + +class NSManagedObjectContext : NSObject, INSCoding, INSLocking +{ + mixin (ObjcWrap); + + void setPersistentStoreCoordinator (NSPersistentStoreCoordinator coordinator) + { + return invokeObjcSelf!(void, "setPersistentStoreCoordinator:", NSPersistentStoreCoordinator)(coordinator); + } + + NSPersistentStoreCoordinator persistentStoreCoordinator () + { + return invokeObjcSelf!(NSPersistentStoreCoordinator, "persistentStoreCoordinator"); + } + + void setUndoManager (NSUndoManager undoManager) + { + return invokeObjcSelf!(void, "setUndoManager:", NSUndoManager)(undoManager); + } + + NSUndoManager undoManager () + { + return invokeObjcSelf!(NSUndoManager, "undoManager"); + } + + bool hasChanges () + { + return invokeObjcSelf!(bool, "hasChanges"); + } + + NSManagedObject objectRegisteredForID (NSManagedObjectID objectID) + { + return invokeObjcSelf!(NSManagedObject, "objectRegisteredForID:", NSManagedObjectID)(objectID); + } + + NSManagedObject objectWithID (NSManagedObjectID objectID) + { + return invokeObjcSelf!(NSManagedObject, "objectWithID:", NSManagedObjectID)(objectID); + } + + NSArray executeFetchRequest (NSFetchRequest request, ref NSError error) + { + id __arg1; + + if (error) + __arg1 = error.objcObject; + + NSArray result = invokeObjcSelf!(NSArray, "executeFetchRequest:error:", NSFetchRequest, id*)(request, &__arg1); + + if (__arg1) + error = new NSError(__arg1); + + return result; + } + + NSUInteger countForFetchRequest (NSFetchRequest request, ref NSError error) + { + id __arg1; + + if (error) + __arg1 = error.objcObject; + + NSUInteger result = invokeObjcSelf!(NSUInteger, "countForFetchRequest:error:", NSFetchRequest, id*)(request, &__arg1); + + if (__arg1) + error = new NSError(__arg1); + + return result; + } + + void insertObject (NSManagedObject object) + { + return invokeObjcSelf!(void, "insertObject:", NSManagedObject)(object); + } + + void deleteObject (NSManagedObject object) + { + return invokeObjcSelf!(void, "deleteObject:", NSManagedObject)(object); + } + + void refreshObject (NSManagedObject object, bool flag) + { + return invokeObjcSelf!(void, "refreshObject:mergeChanges:", NSManagedObject, bool)(object, flag); + } + + void detectConflictsForObject (NSManagedObject object) + { + return invokeObjcSelf!(void, "detectConflictsForObject:", NSManagedObject)(object); + } + + void observeValueForKeyPath (NSString keyPath, Object object, NSDictionary change, void* context) + { + return invokeObjcSelf!(void, "observeValueForKeyPath:ofObject:change:context:", NSString, Object, NSDictionary, void*)(keyPath, object, change, context); + } + + void processPendingChanges () + { + return invokeObjcSelf!(void, "processPendingChanges"); + } + + void assignObject (Object object, NSPersistentStore store) + { + return invokeObjcSelf!(void, "assignObject:toPersistentStore:", Object, NSPersistentStore)(object, store); + } + + NSSet insertedObjects () + { + return invokeObjcSelf!(NSSet, "insertedObjects"); + } + + NSSet updatedObjects () + { + return invokeObjcSelf!(NSSet, "updatedObjects"); + } + + NSSet deletedObjects () + { + return invokeObjcSelf!(NSSet, "deletedObjects"); + } + + NSSet registeredObjects () + { + return invokeObjcSelf!(NSSet, "registeredObjects"); + } + + void undo () + { + return invokeObjcSelf!(void, "undo"); + } + + void redo () + { + return invokeObjcSelf!(void, "redo"); + } + + void reset () + { + return invokeObjcSelf!(void, "reset"); + } + + void rollback () + { + return invokeObjcSelf!(void, "rollback"); + } + + bool save (ref NSError error) + { + id __arg0; + + if (error) + __arg0 = error.objcObject; + + bool result = invokeObjcSelf!(bool, "save:", id*)(&__arg0); + + if (__arg0) + error = new NSError(__arg0); + + return result; + } + + void lock () + { + return invokeObjcSelf!(void, "lock"); + } + + void unlock () + { + return invokeObjcSelf!(void, "unlock"); + } + + bool tryLock () + { + return invokeObjcSelf!(bool, "tryLock"); + } + + bool propagatesDeletesAtEndOfEvent () + { + return invokeObjcSelf!(bool, "propagatesDeletesAtEndOfEvent"); + } + + void setPropagatesDeletesAtEndOfEvent (bool flag) + { + return invokeObjcSelf!(void, "setPropagatesDeletesAtEndOfEvent:", bool)(flag); + } + + bool retainsRegisteredObjects () + { + return invokeObjcSelf!(bool, "retainsRegisteredObjects"); + } + + void setRetainsRegisteredObjects (bool flag) + { + return invokeObjcSelf!(void, "setRetainsRegisteredObjects:", bool)(flag); + } + + double stalenessInterval () + { + return invokeObjcSelf!(double, "stalenessInterval"); + } + + void setStalenessInterval (double expiration) + { + return invokeObjcSelf!(void, "setStalenessInterval:", double)(expiration); + } + + void setMergePolicy (Object mergePolicy) + { + return invokeObjcSelf!(void, "setMergePolicy:", Object)(mergePolicy); + } + + Object mergePolicy () + { + return invokeObjcSelf!(Object, "mergePolicy"); + } + + bool obtainPermanentIDsForObjects (NSArray objects, ref NSError error) + { + id __arg1; + + if (error) + __arg1 = error.objcObject; + + bool result = invokeObjcSelf!(bool, "obtainPermanentIDsForObjects:error:", NSArray, id*)(objects, &__arg1); + + if (__arg1) + error = new NSError(__arg1); + + return result; + } + + void mergeChangesFromContextDidSaveNotification (NSNotification notification) + { + return invokeObjcSelf!(void, "mergeChangesFromContextDidSaveNotification:", NSNotification)(notification); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/coredata/NSManagedObjectContext_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/coredata/NSManagedObjectContext_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,30 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 25, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.coredata.NSManagedObjectContext_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package const id NSManagedObjectContextDidSaveNotification; + package const id NSManagedObjectContextObjectsDidChangeNotification; + package const id NSInsertedObjectsKey; + package const id NSUpdatedObjectsKey; + package const id NSDeletedObjectsKey; + package const id NSRefreshedObjectsKey; + package const id NSInvalidatedObjectsKey; + package const id NSInvalidatedAllObjectsKey; + package id NSErrorMergePolicy; + package id NSMergeByPropertyStoreTrumpMergePolicy; + package id NSMergeByPropertyObjectTrumpMergePolicy; + package id NSOverwriteMergePolicy; + package id NSRollbackMergePolicy; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/coredata/NSManagedObjectID.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/coredata/NSManagedObjectID.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,46 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 25, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.coredata.NSManagedObjectID; + +import dstep.coredata.NSEntityDescription; +import dstep.coredata.NSPersistentStore; +import dstep.foundation.NSObject; +import dstep.foundation.NSURL; +import dstep.foundation.NSZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSManagedObjectID : NSObject, INSCopying +{ + mixin (ObjcWrap); + + NSEntityDescription entity () + { + return invokeObjcSelf!(NSEntityDescription, "entity"); + } + + NSPersistentStore persistentStore () + { + return invokeObjcSelf!(NSPersistentStore, "persistentStore"); + } + + bool isTemporaryID () + { + return invokeObjcSelf!(bool, "isTemporaryID"); + } + + NSURL URIRepresentation () + { + return invokeObjcSelf!(NSURL, "URIRepresentation"); + } + + typeof(this) copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/coredata/NSManagedObjectModel.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/coredata/NSManagedObjectModel.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,170 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 25, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.coredata.NSManagedObjectModel; + +import dstep.coredata.NSEntityDescription; +import dstep.coredata.NSFetchRequest; +import dstep.foundation.NSArray; +import dstep.foundation.NSCoder; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSEnumerator; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSSet; +import dstep.foundation.NSString; +import dstep.foundation.NSURL; +import dstep.foundation.NSZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSManagedObjectModel : NSObject, INSCoding, INSCopying, INSFastEnumeration +{ + mixin (ObjcWrap); + + static NSManagedObjectModel mergedModelFromBundles (NSArray bundles) + { + return invokeObjcSelfClass!(NSManagedObjectModel, "mergedModelFromBundles:", NSArray)(bundles); + } + + static NSManagedObjectModel modelByMergingModels (NSArray models) + { + return invokeObjcSelfClass!(NSManagedObjectModel, "modelByMergingModels:", NSArray)(models); + } + + NSManagedObjectModel init () + { + id result = invokeObjcSelf!(id, "init"); + return result is this.objcObject ? this : (result !is null ? new NSManagedObjectModel(result) : null); + } + + this () + { + super(NSManagedObjectModel.alloc.init.objcObject); + } + + NSManagedObjectModel initWithContentsOfURL (NSURL url) + { + id result = invokeObjcSelf!(id, "initWithContentsOfURL:", NSURL)(url); + return result is this.objcObject ? this : (result !is null ? new NSManagedObjectModel(result) : null); + } + + this (NSURL url) + { + super(NSManagedObjectModel.alloc.initWithContentsOfURL(url).objcObject); + } + + NSDictionary entitiesByName () + { + return invokeObjcSelf!(NSDictionary, "entitiesByName"); + } + + NSArray entities () + { + return invokeObjcSelf!(NSArray, "entities"); + } + + void setEntities (NSArray entities) + { + return invokeObjcSelf!(void, "setEntities:", NSArray)(entities); + } + + NSArray configurations () + { + return invokeObjcSelf!(NSArray, "configurations"); + } + + NSArray entitiesForConfiguration (NSString configuration) + { + return invokeObjcSelf!(NSArray, "entitiesForConfiguration:", NSString)(configuration); + } + + void setEntities (NSArray entities, NSString configuration) + { + return invokeObjcSelf!(void, "setEntities:forConfiguration:", NSArray, NSString)(entities, configuration); + } + + void setFetchRequestTemplate (NSFetchRequest fetchRequestTemplate, NSString name) + { + return invokeObjcSelf!(void, "setFetchRequestTemplate:forName:", NSFetchRequest, NSString)(fetchRequestTemplate, name); + } + + NSFetchRequest fetchRequestTemplateForName (NSString name) + { + return invokeObjcSelf!(NSFetchRequest, "fetchRequestTemplateForName:", NSString)(name); + } + + NSFetchRequest fetchRequestFromTemplateWithName (NSString name, NSDictionary variables) + { + return invokeObjcSelf!(NSFetchRequest, "fetchRequestFromTemplateWithName:substitutionVariables:", NSString, NSDictionary)(name, variables); + } + + NSDictionary localizationDictionary () + { + return invokeObjcSelf!(NSDictionary, "localizationDictionary"); + } + + void setLocalizationDictionary (NSDictionary localizationDictionary) + { + return invokeObjcSelf!(void, "setLocalizationDictionary:", NSDictionary)(localizationDictionary); + } + + static NSManagedObjectModel mergedModelFromBundles (NSArray bundles, NSDictionary metadata) + { + return invokeObjcSelfClass!(NSManagedObjectModel, "mergedModelFromBundles:forStoreMetadata:", NSArray, NSDictionary)(bundles, metadata); + } + + static NSManagedObjectModel modelByMergingModels (NSArray models, NSDictionary metadata) + { + return invokeObjcSelfClass!(NSManagedObjectModel, "modelByMergingModels:forStoreMetadata:", NSArray, NSDictionary)(models, metadata); + } + + NSDictionary fetchRequestTemplatesByName () + { + return invokeObjcSelf!(NSDictionary, "fetchRequestTemplatesByName"); + } + + NSSet versionIdentifiers () + { + return invokeObjcSelf!(NSSet, "versionIdentifiers"); + } + + void setVersionIdentifiers (NSSet identifiers) + { + return invokeObjcSelf!(void, "setVersionIdentifiers:", NSSet)(identifiers); + } + + bool isConfiguration (NSString configuration, NSDictionary metadata) + { + return invokeObjcSelf!(bool, "isConfiguration:compatibleWithStoreMetadata:", NSString, NSDictionary)(configuration, metadata); + } + + NSDictionary entityVersionHashesByName () + { + return invokeObjcSelf!(NSDictionary, "entityVersionHashesByName"); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + typeof(this) copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); + } + + NSUInteger countByEnumeratingWithState (NSFastEnumerationState* state, id* stackbuf, NSUInteger len) + { + return invokeObjcSelf!(NSUInteger, "countByEnumeratingWithState:objects:count:", NSFastEnumerationState*, id*, NSUInteger)(state, stackbuf, len); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/coredata/NSMappingModel.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/coredata/NSMappingModel.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,52 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 25, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.coredata.NSMappingModel; + +import dstep.coredata.NSManagedObjectModel; +import dstep.foundation.NSArray; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSObject; +import dstep.foundation.NSURL; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSMappingModel : NSObject +{ + mixin (ObjcWrap); + + static NSMappingModel mappingModelFromBundles (NSArray bundles, NSManagedObjectModel sourceModel, NSManagedObjectModel destinationModel) + { + return invokeObjcSelfClass!(NSMappingModel, "mappingModelFromBundles:forSourceModel:destinationModel:", NSArray, NSManagedObjectModel, NSManagedObjectModel)(bundles, sourceModel, destinationModel); + } + + NSMappingModel initWithContentsOfURL (NSURL url) + { + id result = invokeObjcSelf!(id, "initWithContentsOfURL:", NSURL)(url); + return result is this.objcObject ? this : (result !is null ? new NSMappingModel(result) : null); + } + + this (NSURL url) + { + super(NSMappingModel.alloc.initWithContentsOfURL(url).objcObject); + } + + NSArray entityMappings () + { + return invokeObjcSelf!(NSArray, "entityMappings"); + } + + void setEntityMappings (NSArray mappings) + { + return invokeObjcSelf!(void, "setEntityMappings:", NSArray)(mappings); + } + + NSDictionary entityMappingsByName () + { + return invokeObjcSelf!(NSDictionary, "entityMappingsByName"); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/coredata/NSMigrationManager.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/coredata/NSMigrationManager.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,134 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 25, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.coredata.NSMigrationManager; + +import dstep.coredata.NSEntityDescription; +import dstep.coredata.NSEntityMapping; +import dstep.coredata.NSManagedObject; +import dstep.coredata.NSManagedObjectContext; +import dstep.coredata.NSManagedObjectModel; +import dstep.coredata.NSMappingModel; +import dstep.foundation.NSArray; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSError; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSURL; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSMigrationManager : NSObject +{ + mixin (ObjcWrap); + + NSMigrationManager initWithSourceModel (NSManagedObjectModel sourceModel, NSManagedObjectModel destinationModel) + { + id result = invokeObjcSelf!(id, "initWithSourceModel:destinationModel:", NSManagedObjectModel, NSManagedObjectModel)(sourceModel, destinationModel); + return result is this.objcObject ? this : (result !is null ? new NSMigrationManager(result) : null); + } + + this (NSManagedObjectModel sourceModel, NSManagedObjectModel destinationModel) + { + super(NSMigrationManager.alloc.initWithSourceModel(sourceModel, destinationModel).objcObject); + } + + bool migrateStoreFromURL (NSURL sourceURL, NSString sStoreType, NSDictionary sOptions, NSMappingModel mappings, NSURL dURL, NSString dStoreType, NSDictionary dOptions, ref NSError error) + { + id __arg7; + + if (error) + __arg7 = error.objcObject; + + bool result = invokeObjcSelf!(bool, "migrateStoreFromURL:type:options:withMappingModel:toDestinationURL:destinationType:destinationOptions:error:", NSURL, NSString, NSDictionary, NSMappingModel, NSURL, NSString, NSDictionary, id*)(sourceURL, sStoreType, sOptions, mappings, dURL, dStoreType, dOptions, &__arg7); + + if (__arg7) + error = new NSError(__arg7); + + return result; + } + + void reset () + { + return invokeObjcSelf!(void, "reset"); + } + + NSMappingModel mappingModel () + { + return invokeObjcSelf!(NSMappingModel, "mappingModel"); + } + + NSManagedObjectModel sourceModel () + { + return invokeObjcSelf!(NSManagedObjectModel, "sourceModel"); + } + + NSManagedObjectModel destinationModel () + { + return invokeObjcSelf!(NSManagedObjectModel, "destinationModel"); + } + + NSManagedObjectContext sourceContext () + { + return invokeObjcSelf!(NSManagedObjectContext, "sourceContext"); + } + + NSManagedObjectContext destinationContext () + { + return invokeObjcSelf!(NSManagedObjectContext, "destinationContext"); + } + + NSEntityDescription sourceEntityForEntityMapping (NSEntityMapping mEntity) + { + return invokeObjcSelf!(NSEntityDescription, "sourceEntityForEntityMapping:", NSEntityMapping)(mEntity); + } + + NSEntityDescription destinationEntityForEntityMapping (NSEntityMapping mEntity) + { + return invokeObjcSelf!(NSEntityDescription, "destinationEntityForEntityMapping:", NSEntityMapping)(mEntity); + } + + void associateSourceInstance (NSManagedObject sourceInstance, NSManagedObject destinationInstance, NSEntityMapping entityMapping) + { + return invokeObjcSelf!(void, "associateSourceInstance:withDestinationInstance:forEntityMapping:", NSManagedObject, NSManagedObject, NSEntityMapping)(sourceInstance, destinationInstance, entityMapping); + } + + NSArray destinationInstancesForEntityMappingNamed (NSString mappingName, NSArray sourceInstances) + { + return invokeObjcSelf!(NSArray, "destinationInstancesForEntityMappingNamed:sourceInstances:", NSString, NSArray)(mappingName, sourceInstances); + } + + NSArray sourceInstancesForEntityMappingNamed (NSString mappingName, NSArray destinationInstances) + { + return invokeObjcSelf!(NSArray, "sourceInstancesForEntityMappingNamed:destinationInstances:", NSString, NSArray)(mappingName, destinationInstances); + } + + NSEntityMapping currentEntityMapping () + { + return invokeObjcSelf!(NSEntityMapping, "currentEntityMapping"); + } + + float migrationProgress () + { + return invokeObjcSelf!(float, "migrationProgress"); + } + + NSDictionary userInfo () + { + return invokeObjcSelf!(NSDictionary, "userInfo"); + } + + void setUserInfo (NSDictionary dict) + { + return invokeObjcSelf!(void, "setUserInfo:", NSDictionary)(dict); + } + + void cancelMigrationWithError (NSError error) + { + return invokeObjcSelf!(void, "cancelMigrationWithError:", NSError)(error); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/coredata/NSPersistentStore.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/coredata/NSPersistentStore.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,133 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 25, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.coredata.NSPersistentStore; + +import dstep.coredata.NSPersistentStoreCoordinator; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSError; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSURL; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSPersistentStore : NSObject +{ + mixin (ObjcWrap); + + static NSDictionary metadataForPersistentStoreWithURL (NSURL url, ref NSError error) + { + id __arg1; + + if (error) + __arg1 = error.objcObject; + + NSDictionary result = invokeObjcSuperClass!(NSDictionary, "metadataForPersistentStoreWithURL:error:", NSURL, id*)(url, &__arg1); + + if (__arg1) + error = new NSError(__arg1); + + return result; + } + + static bool setMetadata (NSDictionary metadata, NSURL url, ref NSError error) + { + id __arg2; + + if (error) + __arg2 = error.objcObject; + + bool result = invokeObjcSuperClass!(bool, "setMetadata:forPersistentStoreWithURL:error:", NSDictionary, NSURL, id*)(metadata, url, &__arg2); + + if (__arg2) + error = new NSError(__arg2); + + return result; + } + + NSPersistentStore initWithPersistentStoreCoordinator (NSPersistentStoreCoordinator root, NSString name, NSURL url, NSDictionary options) + { + id result = invokeObjcSelf!(id, "initWithPersistentStoreCoordinator:configurationName:URL:options:", NSPersistentStoreCoordinator, NSString, NSURL, NSDictionary)(root, name, url, options); + return result is this.objcObject ? this : (result !is null ? new NSPersistentStore(result) : null); + } + + this (NSPersistentStoreCoordinator root, NSString name, NSURL url, NSDictionary options) + { + super(NSPersistentStore.alloc.initWithPersistentStoreCoordinator(root, name, url, options).objcObject); + } + + NSPersistentStoreCoordinator persistentStoreCoordinator () + { + return invokeObjcSelf!(NSPersistentStoreCoordinator, "persistentStoreCoordinator"); + } + + NSString configurationName () + { + return invokeObjcSelf!(NSString, "configurationName"); + } + + NSDictionary options () + { + return invokeObjcSelf!(NSDictionary, "options"); + } + + NSURL URL () + { + return invokeObjcSelf!(NSURL, "URL"); + } + + void setURL (NSURL url) + { + return invokeObjcSelf!(void, "setURL:", NSURL)(url); + } + + NSString identifier () + { + return invokeObjcSelf!(NSString, "identifier"); + } + + void setIdentifier (NSString identifier) + { + return invokeObjcSelf!(void, "setIdentifier:", NSString)(identifier); + } + + NSString type () + { + return invokeObjcSelf!(NSString, "type"); + } + + bool isReadOnly () + { + return invokeObjcSelf!(bool, "isReadOnly"); + } + + void setReadOnly (bool flag) + { + return invokeObjcSelf!(void, "setReadOnly:", bool)(flag); + } + + NSDictionary metadata () + { + return invokeObjcSelf!(NSDictionary, "metadata"); + } + + void setMetadata (NSDictionary storeMetadata) + { + return invokeObjcSelf!(void, "setMetadata:", NSDictionary)(storeMetadata); + } + + void didAddToPersistentStoreCoordinator (NSPersistentStoreCoordinator coordinator) + { + return invokeObjcSelf!(void, "didAddToPersistentStoreCoordinator:", NSPersistentStoreCoordinator)(coordinator); + } + + void willRemoveFromPersistentStoreCoordinator (NSPersistentStoreCoordinator coordinator) + { + return invokeObjcSelf!(void, "willRemoveFromPersistentStoreCoordinator:", NSPersistentStoreCoordinator)(coordinator); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/coredata/NSPersistentStoreCoordinator.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/coredata/NSPersistentStoreCoordinator.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,371 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 25, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.coredata.NSPersistentStoreCoordinator; + +import dstep.coredata.CoreDataDefines; +import dstep.coredata.NSManagedObjectID; +import dstep.coredata.NSManagedObjectModel; +import dstep.coredata.NSPersistentStore; +import dstep.foundation.NSArray; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSError; +import dstep.foundation.NSLock; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSURL; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.coredata.NSPersistentStoreCoordinator_bindings; + +private +{ + NSString NSSQLiteStoreType_; + NSString NSXMLStoreType_; + NSString NSBinaryStoreType_; + NSString NSInMemoryStoreType_; + NSString NSStoreTypeKey_; + NSString NSStoreUUIDKey_; + NSString NSPersistentStoreCoordinatorStoresDidChangeNotification_; + NSString NSAddedPersistentStoresKey_; + NSString NSRemovedPersistentStoresKey_; + NSString NSUUIDChangedPersistentStoresKey_; + NSString NSReadOnlyPersistentStoreOption_; + NSString NSValidateXMLStoreOption_; + NSString NSPersistentStoreTimeoutOption_; + NSString NSSQLitePragmasOption_; + NSString NSIgnorePersistentStoreVersioningOption_; + NSString NSMigratePersistentStoresAutomaticallyOption_; + NSString NSStoreModelVersionHashesKey_; + NSString NSStoreModelVersionIdentifiersKey_; + NSString NSPersistentStoreOSCompatibility_; +} + +NSString NSSQLiteStoreType () +{ + if (NSSQLiteStoreType_) + return NSSQLiteStoreType_; + + return NSSQLiteStoreType_ = new NSString(bindings.NSSQLiteStoreType); +} + +NSString NSXMLStoreType () +{ + if (NSXMLStoreType_) + return NSXMLStoreType_; + + return NSXMLStoreType_ = new NSString(bindings.NSXMLStoreType); +} + +NSString NSBinaryStoreType () +{ + if (NSBinaryStoreType_) + return NSBinaryStoreType_; + + return NSBinaryStoreType_ = new NSString(bindings.NSBinaryStoreType); +} + +NSString NSInMemoryStoreType () +{ + if (NSInMemoryStoreType_) + return NSInMemoryStoreType_; + + return NSInMemoryStoreType_ = new NSString(bindings.NSInMemoryStoreType); +} + +NSString NSStoreTypeKey () +{ + if (NSStoreTypeKey_) + return NSStoreTypeKey_; + + return NSStoreTypeKey_ = new NSString(bindings.NSStoreTypeKey); +} + +NSString NSStoreUUIDKey () +{ + if (NSStoreUUIDKey_) + return NSStoreUUIDKey_; + + return NSStoreUUIDKey_ = new NSString(bindings.NSStoreUUIDKey); +} + +NSString NSPersistentStoreCoordinatorStoresDidChangeNotification () +{ + if (NSPersistentStoreCoordinatorStoresDidChangeNotification_) + return NSPersistentStoreCoordinatorStoresDidChangeNotification_; + + return NSPersistentStoreCoordinatorStoresDidChangeNotification_ = new NSString(bindings.NSPersistentStoreCoordinatorStoresDidChangeNotification); +} + +NSString NSAddedPersistentStoresKey () +{ + if (NSAddedPersistentStoresKey_) + return NSAddedPersistentStoresKey_; + + return NSAddedPersistentStoresKey_ = new NSString(bindings.NSAddedPersistentStoresKey); +} + +NSString NSRemovedPersistentStoresKey () +{ + if (NSRemovedPersistentStoresKey_) + return NSRemovedPersistentStoresKey_; + + return NSRemovedPersistentStoresKey_ = new NSString(bindings.NSRemovedPersistentStoresKey); +} + +NSString NSUUIDChangedPersistentStoresKey () +{ + if (NSUUIDChangedPersistentStoresKey_) + return NSUUIDChangedPersistentStoresKey_; + + return NSUUIDChangedPersistentStoresKey_ = new NSString(bindings.NSUUIDChangedPersistentStoresKey); +} + +NSString NSReadOnlyPersistentStoreOption () +{ + if (NSReadOnlyPersistentStoreOption_) + return NSReadOnlyPersistentStoreOption_; + + return NSReadOnlyPersistentStoreOption_ = new NSString(bindings.NSReadOnlyPersistentStoreOption); +} + +NSString NSValidateXMLStoreOption () +{ + if (NSValidateXMLStoreOption_) + return NSValidateXMLStoreOption_; + + return NSValidateXMLStoreOption_ = new NSString(bindings.NSValidateXMLStoreOption); +} + +NSString NSPersistentStoreTimeoutOption () +{ + if (NSPersistentStoreTimeoutOption_) + return NSPersistentStoreTimeoutOption_; + + return NSPersistentStoreTimeoutOption_ = new NSString(bindings.NSPersistentStoreTimeoutOption); +} + +NSString NSSQLitePragmasOption () +{ + if (NSSQLitePragmasOption_) + return NSSQLitePragmasOption_; + + return NSSQLitePragmasOption_ = new NSString(bindings.NSSQLitePragmasOption); +} + +NSString NSIgnorePersistentStoreVersioningOption () +{ + if (NSIgnorePersistentStoreVersioningOption_) + return NSIgnorePersistentStoreVersioningOption_; + + return NSIgnorePersistentStoreVersioningOption_ = new NSString(bindings.NSIgnorePersistentStoreVersioningOption); +} + +NSString NSMigratePersistentStoresAutomaticallyOption () +{ + if (NSMigratePersistentStoresAutomaticallyOption_) + return NSMigratePersistentStoresAutomaticallyOption_; + + return NSMigratePersistentStoresAutomaticallyOption_ = new NSString(bindings.NSMigratePersistentStoresAutomaticallyOption); +} + +NSString NSStoreModelVersionHashesKey () +{ + if (NSStoreModelVersionHashesKey_) + return NSStoreModelVersionHashesKey_; + + return NSStoreModelVersionHashesKey_ = new NSString(bindings.NSStoreModelVersionHashesKey); +} + +NSString NSStoreModelVersionIdentifiersKey () +{ + if (NSStoreModelVersionIdentifiersKey_) + return NSStoreModelVersionIdentifiersKey_; + + return NSStoreModelVersionIdentifiersKey_ = new NSString(bindings.NSStoreModelVersionIdentifiersKey); +} + +NSString NSPersistentStoreOSCompatibility () +{ + if (NSPersistentStoreOSCompatibility_) + return NSPersistentStoreOSCompatibility_; + + return NSPersistentStoreOSCompatibility_ = new NSString(bindings.NSPersistentStoreOSCompatibility); +} + +class NSPersistentStoreCoordinator : NSObject, INSLocking +{ + mixin (ObjcWrap); + + static NSDictionary registeredStoreTypes () + { + return invokeObjcSelfClass!(NSDictionary, "registeredStoreTypes"); + } + + static void registerStoreClass (Class storeClass, NSString storeType) + { + return invokeObjcSelfClass!(void, "registerStoreClass:forStoreType:", Class, NSString)(storeClass, storeType); + } + + static NSDictionary metadataForPersistentStoreOfType (NSString storeType, NSURL url, ref NSError error) + { + id __arg2; + + if (error) + __arg2 = error.objcObject; + + NSDictionary result = invokeObjcSelfClass!(NSDictionary, "metadataForPersistentStoreOfType:URL:error:", NSString, NSURL, id*)(storeType, url, &__arg2); + + if (__arg2) + error = new NSError(__arg2); + + return result; + } + + static bool setMetadata (NSDictionary metadata, NSString storeType, NSURL url, ref NSError error) + { + id __arg3; + + if (error) + __arg3 = error.objcObject; + + bool result = invokeObjcSelfClass!(bool, "setMetadata:forPersistentStoreOfType:URL:error:", NSDictionary, NSString, NSURL, id*)(metadata, storeType, url, &__arg3); + + if (__arg3) + error = new NSError(__arg3); + + return result; + } + + void setMetadata (NSDictionary metadata, NSPersistentStore store) + { + return invokeObjcSelf!(void, "setMetadata:forPersistentStore:", NSDictionary, NSPersistentStore)(metadata, store); + } + + NSDictionary metadataForPersistentStore (NSPersistentStore store) + { + return invokeObjcSelf!(NSDictionary, "metadataForPersistentStore:", NSPersistentStore)(store); + } + + NSPersistentStoreCoordinator initWithManagedObjectModel (NSManagedObjectModel model) + { + id result = invokeObjcSelf!(id, "initWithManagedObjectModel:", NSManagedObjectModel)(model); + return result is this.objcObject ? this : (result !is null ? new NSPersistentStoreCoordinator(result) : null); + } + + this (NSManagedObjectModel model) + { + super(NSPersistentStoreCoordinator.alloc.initWithManagedObjectModel(model).objcObject); + } + + NSManagedObjectModel managedObjectModel () + { + return invokeObjcSelf!(NSManagedObjectModel, "managedObjectModel"); + } + + NSArray persistentStores () + { + return invokeObjcSelf!(NSArray, "persistentStores"); + } + + NSPersistentStore persistentStoreForURL (NSURL URL) + { + return invokeObjcSelf!(NSPersistentStore, "persistentStoreForURL:", NSURL)(URL); + } + + NSURL URLForPersistentStore (NSPersistentStore store) + { + return invokeObjcSelf!(NSURL, "URLForPersistentStore:", NSPersistentStore)(store); + } + + bool setURL (NSURL url, NSPersistentStore store) + { + return invokeObjcSelf!(bool, "setURL:forPersistentStore:", NSURL, NSPersistentStore)(url, store); + } + + NSPersistentStore addPersistentStoreWithType (NSString storeType, NSString configuration, NSURL storeURL, NSDictionary options, ref NSError error) + { + id __arg4; + + if (error) + __arg4 = error.objcObject; + + NSPersistentStore result = invokeObjcSelf!(NSPersistentStore, "addPersistentStoreWithType:configuration:URL:options:error:", NSString, NSString, NSURL, NSDictionary, id*)(storeType, configuration, storeURL, options, &__arg4); + + if (__arg4) + error = new NSError(__arg4); + + return result; + } + + bool removePersistentStore (NSPersistentStore store, ref NSError error) + { + id __arg1; + + if (error) + __arg1 = error.objcObject; + + bool result = invokeObjcSelf!(bool, "removePersistentStore:error:", NSPersistentStore, id*)(store, &__arg1); + + if (__arg1) + error = new NSError(__arg1); + + return result; + } + + NSPersistentStore migratePersistentStore (NSPersistentStore store, NSURL URL, NSDictionary options, NSString storeType, ref NSError error) + { + id __arg4; + + if (error) + __arg4 = error.objcObject; + + NSPersistentStore result = invokeObjcSelf!(NSPersistentStore, "migratePersistentStore:toURL:options:withType:error:", NSPersistentStore, NSURL, NSDictionary, NSString, id*)(store, URL, options, storeType, &__arg4); + + if (__arg4) + error = new NSError(__arg4); + + return result; + } + + NSManagedObjectID managedObjectIDForURIRepresentation (NSURL url) + { + return invokeObjcSelf!(NSManagedObjectID, "managedObjectIDForURIRepresentation:", NSURL)(url); + } + + void lock () + { + return invokeObjcSelf!(void, "lock"); + } + + void unlock () + { + return invokeObjcSelf!(void, "unlock"); + } + + bool tryLock () + { + return invokeObjcSelf!(bool, "tryLock"); + } + + static NSDictionary metadataForPersistentStoreWithURL (NSURL url, ref NSError error) + { + id __arg1; + + if (error) + __arg1 = error.objcObject; + + NSDictionary result = invokeObjcSelfClass!(NSDictionary, "metadataForPersistentStoreWithURL:error:", NSURL, id*)(url, &__arg1); + + if (__arg1) + error = new NSError(__arg1); + + return result; + } + +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/coredata/NSPersistentStoreCoordinator_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/coredata/NSPersistentStoreCoordinator_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,36 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 25, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.coredata.NSPersistentStoreCoordinator_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package const id NSSQLiteStoreType; + package const id NSXMLStoreType; + package const id NSBinaryStoreType; + package const id NSInMemoryStoreType; + package const id NSStoreTypeKey; + package const id NSStoreUUIDKey; + package const id NSPersistentStoreCoordinatorStoresDidChangeNotification; + package const id NSAddedPersistentStoresKey; + package const id NSRemovedPersistentStoresKey; + package const id NSUUIDChangedPersistentStoresKey; + package const id NSReadOnlyPersistentStoreOption; + package const id NSValidateXMLStoreOption; + package const id NSPersistentStoreTimeoutOption; + package const id NSSQLitePragmasOption; + package const id NSIgnorePersistentStoreVersioningOption; + package const id NSMigratePersistentStoresAutomaticallyOption; + package const id NSStoreModelVersionHashesKey; + package const id NSStoreModelVersionIdentifiersKey; + package const id NSPersistentStoreOSCompatibility; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/coredata/NSPropertyDescription.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/coredata/NSPropertyDescription.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,124 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 25, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.coredata.NSPropertyDescription; + +import dstep.coredata.NSEntityDescription; +import dstep.foundation.NSArray; +import dstep.foundation.NSCoder; +import dstep.foundation.NSData; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSPropertyDescription : NSObject, INSCoding, INSCopying +{ + mixin (ObjcWrap); + + NSEntityDescription entity () + { + return invokeObjcSelf!(NSEntityDescription, "entity"); + } + + NSString name () + { + return invokeObjcSelf!(NSString, "name"); + } + + void setName (NSString name) + { + return invokeObjcSelf!(void, "setName:", NSString)(name); + } + + bool isOptional () + { + return invokeObjcSelf!(bool, "isOptional"); + } + + void setOptional (bool flag) + { + return invokeObjcSelf!(void, "setOptional:", bool)(flag); + } + + bool isTransient () + { + return invokeObjcSelf!(bool, "isTransient"); + } + + void setTransient (bool flag) + { + return invokeObjcSelf!(void, "setTransient:", bool)(flag); + } + + NSArray validationPredicates () + { + return invokeObjcSelf!(NSArray, "validationPredicates"); + } + + NSArray validationWarnings () + { + return invokeObjcSelf!(NSArray, "validationWarnings"); + } + + void setValidationPredicates (NSArray validationPredicates, NSArray validationWarnings) + { + return invokeObjcSelf!(void, "setValidationPredicates:withValidationWarnings:", NSArray, NSArray)(validationPredicates, validationWarnings); + } + + NSDictionary userInfo () + { + return invokeObjcSelf!(NSDictionary, "userInfo"); + } + + void setUserInfo (NSDictionary dictionary) + { + return invokeObjcSelf!(void, "setUserInfo:", NSDictionary)(dictionary); + } + + bool isIndexed () + { + return invokeObjcSelf!(bool, "isIndexed"); + } + + void setIndexed (bool flag) + { + return invokeObjcSelf!(void, "setIndexed:", bool)(flag); + } + + NSData versionHash () + { + return invokeObjcSelf!(NSData, "versionHash"); + } + + NSString versionHashModifier () + { + return invokeObjcSelf!(NSString, "versionHashModifier"); + } + + void setVersionHashModifier (NSString modifierString) + { + return invokeObjcSelf!(void, "setVersionHashModifier:", NSString)(modifierString); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + typeof(this) copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/coredata/NSPropertyMapping.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/coredata/NSPropertyMapping.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,50 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 25, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.coredata.NSPropertyMapping; + +import dstep.foundation.NSDictionary; +import dstep.foundation.NSExpression; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSPropertyMapping : NSObject +{ + mixin (ObjcWrap); + + NSString name () + { + return invokeObjcSelf!(NSString, "name"); + } + + void setName (NSString name) + { + return invokeObjcSelf!(void, "setName:", NSString)(name); + } + + NSExpression valueExpression () + { + return invokeObjcSelf!(NSExpression, "valueExpression"); + } + + void setValueExpression (NSExpression expression) + { + return invokeObjcSelf!(void, "setValueExpression:", NSExpression)(expression); + } + + NSDictionary userInfo () + { + return invokeObjcSelf!(NSDictionary, "userInfo"); + } + + void setUserInfo (NSDictionary userInfo) + { + return invokeObjcSelf!(void, "setUserInfo:", NSDictionary)(userInfo); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/coredata/NSRelationshipDescription.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/coredata/NSRelationshipDescription.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,91 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 25, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.coredata.NSRelationshipDescription; + +import dstep.coredata.NSEntityDescription; +import dstep.coredata.NSPropertyDescription; +import dstep.foundation.NSData; +import dstep.foundation.NSObjCRuntime; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +alias NSUInteger NSDeleteRule; + +enum +{ + NSNoActionDeleteRule, + NSNullifyDeleteRule, + NSCascadeDeleteRule, + NSDenyDeleteRule +} + +class NSRelationshipDescription : NSPropertyDescription +{ + mixin (ObjcWrap); + + NSEntityDescription destinationEntity () + { + return invokeObjcSelf!(NSEntityDescription, "destinationEntity"); + } + + void setDestinationEntity (NSEntityDescription entity) + { + return invokeObjcSelf!(void, "setDestinationEntity:", NSEntityDescription)(entity); + } + + NSRelationshipDescription inverseRelationship () + { + id result = invokeObjcSelf!(id, "inverseRelationship"); + return result is this.objcObject ? this : (result !is null ? new NSRelationshipDescription(result) : null); + } + + void setInverseRelationship (NSRelationshipDescription relationship) + { + return invokeObjcSelf!(void, "setInverseRelationship:", NSRelationshipDescription)(relationship); + } + + NSUInteger maxCount () + { + return invokeObjcSelf!(NSUInteger, "maxCount"); + } + + void setMaxCount (NSUInteger maxCount) + { + return invokeObjcSelf!(void, "setMaxCount:", NSUInteger)(maxCount); + } + + NSUInteger minCount () + { + return invokeObjcSelf!(NSUInteger, "minCount"); + } + + void setMinCount (NSUInteger minCount) + { + return invokeObjcSelf!(void, "setMinCount:", NSUInteger)(minCount); + } + + uint deleteRule () + { + return invokeObjcSelf!(uint, "deleteRule"); + } + + void setDeleteRule (uint rule) + { + return invokeObjcSelf!(void, "setDeleteRule:", uint)(rule); + } + + bool isToMany () + { + return invokeObjcSelf!(bool, "isToMany"); + } + + NSData versionHash () + { + return invokeObjcSelf!(NSData, "versionHash"); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/corefoundation/CFByteOrder.d --- a/dstep/corefoundation/CFByteOrder.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/corefoundation/CFByteOrder.d Sun Jan 03 22:06:11 2010 +0100 @@ -11,7 +11,9 @@ import dstep.objc.bridge.Bridge; import dstep.objc.objc : id; -enum __CFByteOrder +alias CFIndex CFByteOrder; + +enum /*__CFByteOrder*/ { CFByteOrderUnknown, CFByteOrderLittleEndian, diff -r 7ff919f595d5 -r 19885b43130e dstep/coreservices/ae/AERegistry.d --- a/dstep/coreservices/ae/AERegistry.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/coreservices/ae/AERegistry.d Sun Jan 03 22:06:11 2010 +0100 @@ -7,6 +7,7 @@ module dstep.coreservices.ae.AERegistry; //import dstep.AvailabilityMacros; +import dstep.coreservices.ae.AEDataModel; import dstep.coreservices.ae.AppleEvents; import dstep.coreservices.carboncore.CarbonCore; import dstep.objc.bridge.TypeEncoding; @@ -805,8 +806,6 @@ const __typeLowLevelEventRecord = getOSType!("evtr"); const __typeGlyphInfoArray = getOSType!("glia"); const __typeEventRef = getOSType!("evrf"); - const __typeText = getOSType!("ypeCha"); - } } @@ -894,8 +893,6 @@ private { const __kAEInternetSuite = getOSType!("gurl"); - const __kAEISWebStarSuite = getOSType!("x575757B"); - } } @@ -1113,37 +1110,6 @@ const __eShiftDown = getOSType!("Ksft"); const __eCapsLockDown = getOSType!("Kclk"); const __eKeyKind = getOSType!("ekst"); - const __eEscapeKey = getOSType!("x6B73350"); - const __eDeleteKey = getOSType!("x6B73330"); - const __eTabKey = getOSType!("x6B73300"); - const __eReturnKey = getOSType!("x6B73240"); - const __eClearKey = getOSType!("x6B73470"); - const __eEnterKey = getOSType!("x6B734C0"); - const __eUpArrowKey = getOSType!("x6B737E0"); - const __eDownArrowKey = getOSType!("x6B737D0"); - const __eLeftArrowKey = getOSType!("x6B737B0"); - const __eRightArrowKey = getOSType!("x6B737C0"); - const __eHelpKey = getOSType!("x6B73720"); - const __eHomeKey = getOSType!("x6B73730"); - const __ePageUpKey = getOSType!("x6B73740"); - const __ePageDownKey = getOSType!("x6B73790"); - const __eForwardDelKey = getOSType!("x6B73750"); - const __eEndKey = getOSType!("x6B73770"); - const __eF1Key = getOSType!("x6B737A0"); - const __eF2Key = getOSType!("x6B73780"); - const __eF3Key = getOSType!("x6B73630"); - const __eF4Key = getOSType!("x6B73760"); - const __eF5Key = getOSType!("x6B73600"); - const __eF6Key = getOSType!("x6B73610"); - const __eF7Key = getOSType!("x6B73620"); - const __eF8Key = getOSType!("x6B73640"); - const __eF9Key = getOSType!("x6B73650"); - const __eF10Key = getOSType!("x6B736D0"); - const __eF11Key = getOSType!("x6B73670"); - const __eF12Key = getOSType!("x6B736F0"); - const __eF13Key = getOSType!("x6B73690"); - const __eF14Key = getOSType!("x6B736B0"); - const __eF15Key = getOSType!("x6B73710"); } } @@ -1819,7 +1785,7 @@ typeLowLevelEventRecord = getOSType!("evtr"), typeGlyphInfoArray = getOSType!("glia"), typeEventRef = getOSType!("evrf"), - typeText = getOSType!("ypeCha") + typeText = typeChar } enum @@ -1914,7 +1880,7 @@ enum { kAEInternetSuite = getOSType!("gurl"), - kAEISWebStarSuite = getOSType!("x575757B") + kAEISWebStarSuite = 0x575757BD } enum @@ -2098,37 +2064,37 @@ eShiftDown = getOSType!("Ksft"), eCapsLockDown = getOSType!("Kclk"), eKeyKind = getOSType!("ekst"), - eEscapeKey = getOSType!("x6B73350"), - eDeleteKey = getOSType!("x6B73330"), - eTabKey = getOSType!("x6B73300"), - eReturnKey = getOSType!("x6B73240"), - eClearKey = getOSType!("x6B73470"), - eEnterKey = getOSType!("x6B734C0"), - eUpArrowKey = getOSType!("x6B737E0"), - eDownArrowKey = getOSType!("x6B737D0"), - eLeftArrowKey = getOSType!("x6B737B0"), - eRightArrowKey = getOSType!("x6B737C0"), - eHelpKey = getOSType!("x6B73720"), - eHomeKey = getOSType!("x6B73730"), - ePageUpKey = getOSType!("x6B73740"), - ePageDownKey = getOSType!("x6B73790"), - eForwardDelKey = getOSType!("x6B73750"), - eEndKey = getOSType!("x6B73770"), - eF1Key = getOSType!("x6B737A0"), - eF2Key = getOSType!("x6B73780"), - eF3Key = getOSType!("x6B73630"), - eF4Key = getOSType!("x6B73760"), - eF5Key = getOSType!("x6B73600"), - eF6Key = getOSType!("x6B73610"), - eF7Key = getOSType!("x6B73620"), - eF8Key = getOSType!("x6B73640"), - eF9Key = getOSType!("x6B73650"), - eF10Key = getOSType!("x6B736D0"), - eF11Key = getOSType!("x6B73670"), - eF12Key = getOSType!("x6B736F0"), - eF13Key = getOSType!("x6B73690"), - eF14Key = getOSType!("x6B736B0"), - eF15Key = getOSType!("x6B73710") + eEscapeKey = 0x6B733500, + eDeleteKey = 0x6B733300, + eTabKey = 0x6B733000, + eReturnKey = 0x6B732400, + eClearKey = 0x6B734700, + eEnterKey = 0x6B734C00, + eUpArrowKey = 0x6B737E00, + eDownArrowKey = 0x6B737D00, + eLeftArrowKey = 0x6B737B00, + eRightArrowKey = 0x6B737C00, + eHelpKey = 0x6B737200, + eHomeKey = 0x6B737300, + ePageUpKey = 0x6B737400, + ePageDownKey = 0x6B737900, + eForwardDelKey = 0x6B737500, + eEndKey = 0x6B737700, + eF1Key = 0x6B737A00, + eF2Key = 0x6B737800, + eF3Key = 0x6B736300, + eF4Key = 0x6B737600, + eF5Key = 0x6B736000, + eF6Key = 0x6B736100, + eF7Key = 0x6B736200, + eF8Key = 0x6B736400, + eF9Key = 0x6B736500, + eF10Key = 0x6B736D00, + eF11Key = 0x6B736700, + eF12Key = 0x6B736F00, + eF13Key = 0x6B736900, + eF14Key = 0x6B736B00, + eF15Key = 0x6B737100 } enum diff -r 7ff919f595d5 -r 19885b43130e dstep/coreservices/carboncore/Finder.d --- a/dstep/coreservices/carboncore/Finder.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/coreservices/carboncore/Finder.d Sun Jan 03 22:06:11 2010 +0100 @@ -54,9 +54,6 @@ private { const __kCustomBadgeResourceType = getOSType!("badg"); - const __kCustomBadgeResourceID = getOSType!("CustomIconResourc"); - const __kCustomBadgeResourceVersion = getOSType!(""); - } } @@ -66,8 +63,6 @@ private { const __kRoutingResourceType = getOSType!("rout"); - const __kRoutingResourceID = getOSType!(""); - } } diff -r 7ff919f595d5 -r 19885b43130e dstep/coreservices/carboncore/Folders.d --- a/dstep/coreservices/carboncore/Folders.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/coreservices/carboncore/Folders.d Sun Jan 03 22:06:11 2010 +0100 @@ -59,7 +59,6 @@ const __kDocumentsFolderType = getOSType!("docs"); const __kPictureDocumentsFolderType = getOSType!("pdoc"); const __kMovieDocumentsFolderType = getOSType!("mdoc"); - const __kMusicDocumentsFolderType = getOSType!("xB5646F6"); const __kInternetSitesFolderType = getOSType!("site"); const __kPublicFolderType = getOSType!("pubb"); @@ -72,12 +71,10 @@ private { const __kVoicesFolderType = getOSType!("fvoc"); - const __kUtilitiesFolderType = getOSType!("x757469C"); const __kThemesFolderType = getOSType!("thme"); const __kFavoritesFolderType = getOSType!("favs"); const __kInternetSearchSitesFolderType = getOSType!("issf"); const __kInstallerLogsFolderType = getOSType!("ilgf"); - const __kScriptsFolderType = getOSType!("x736372C"); const __kFolderActionsFolderType = getOSType!("fasf"); const __kSpeakableItemsFolderType = getOSType!("spki"); const __kKeychainFolderType = getOSType!("kchn"); @@ -155,11 +152,7 @@ { const __kColorSyncProfilesFolderType = getOSType!("prof"); const __kApplicationSupportFolderType = getOSType!("asup"); - const __kTextEncodingsFolderType = getOSType!("xC474657"); const __kPrinterDescriptionFolderType = getOSType!("ppdf"); - const __kPrinterDriverFolderType = getOSType!("xC470726"); - const __kScriptingAdditionsFolderType = getOSType!("xC473637"); - } } @@ -185,9 +178,7 @@ const __kALMModulesFolderType = getOSType!("walk"); const __kALMPreferencesFolderType = getOSType!("trip"); const __kALMLocationsFolderType = getOSType!("fall"); - const __kAppleExtrasFolderType = getOSType!("x616578C"); const __kContextualMenuItemsFolderType = getOSType!("cmnu"); - const __kMacOSReadMesFolderType = getOSType!("x6D6F72C"); const __kStartupFolderType = getOSType!("strt"); const __kShutdownFolderType = getOSType!("shdf"); const __kAppleMenuFolderType = getOSType!("amnu"); @@ -199,22 +190,14 @@ const __kSystemExtensionDisabledFolderType = getOSType!("macD"); const __kStartupItemsDisabledFolderType = getOSType!("strD"); const __kShutdownItemsDisabledFolderType = getOSType!("shdD"); - const __kAssistantsFolderType = getOSType!("x617374C"); const __kStationeryFolderType = getOSType!("odst"); const __kOpenDocFolderType = getOSType!("odod"); const __kOpenDocShellPlugInsFolderType = getOSType!("odsp"); const __kEditorsFolderType = getOSType!("oded"); - const __kOpenDocEditorsFolderType = getOSType!("xC46F646"); const __kOpenDocLibrariesFolderType = getOSType!("odlb"); - const __kGenEditorsFolderType = getOSType!("xC465646"); - const __kHelpFolderType = getOSType!("xC4686C7"); - const __kInternetPlugInFolderType = getOSType!("xC46E657"); - const __kModemScriptsFolderType = getOSType!("xC46D6F6"); const __kControlStripModulesFolderType = getOSType!("sdev"); - const __kInternetFolderType = getOSType!("x696E74C"); const __kAppearanceFolderType = getOSType!("appr"); const __kSoundSetsFolderType = getOSType!("snds"); - const __kDesktopPicturesFolderType = getOSType!("x647470C"); const __kFindSupportFolderType = getOSType!("fnds"); const __kRecentApplicationsFolderType = getOSType!("rapp"); const __kRecentDocumentsFolderType = getOSType!("rdoc"); @@ -224,18 +207,7 @@ const __kDisplayExtensionsFolderType = getOSType!("dspl"); const __kMultiprocessingFolderType = getOSType!("mpxf"); const __kPrintingPlugInsFolderType = getOSType!("pplg"); - const __kAppleshareAutomountServerAliasesFolderType = getOSType!("x737276C"); const __kVolumeSettingsFolderType = getOSType!("vsfd"); - const __kPreMacOS91ApplicationsFolderType = getOSType!("x8C70707"); - const __kPreMacOS91InstallerLogsFolderType = getOSType!("x946C676"); - const __kPreMacOS91AssistantsFolderType = getOSType!("x8C7374C"); - const __kPreMacOS91UtilitiesFolderType = getOSType!("x9F7469C"); - const __kPreMacOS91AppleExtrasFolderType = getOSType!("x8C6578C"); - const __kPreMacOS91MacOSReadMesFolderType = getOSType!("xB56F72C"); - const __kPreMacOS91InternetFolderType = getOSType!("x946E74C"); - const __kPreMacOS91AutomountedServersFolderType = getOSType!("xA77276C"); - const __kPreMacOS91StationeryFolderType = getOSType!("xBF64737"); - const __kLocalesFolderType = getOSType!("xC46C6F6"); const __kFindByContentPluginsFolderType = getOSType!("fbcp"); const __kFindByContentFolderType = getOSType!("fbcf"); @@ -372,7 +344,7 @@ kDocumentsFolderType = getOSType!("docs"), kPictureDocumentsFolderType = getOSType!("pdoc"), kMovieDocumentsFolderType = getOSType!("mdoc"), - kMusicDocumentsFolderType = getOSType!("xB5646F6"), + kMusicDocumentsFolderType = 0xB5646F63, kInternetSitesFolderType = getOSType!("site"), kPublicFolderType = getOSType!("pubb") } @@ -381,12 +353,12 @@ { kSharedLibrariesFolderType = 0xC46C6962, kVoicesFolderType = getOSType!("fvoc"), - kUtilitiesFolderType = getOSType!("x757469C"), + kUtilitiesFolderType = 0x757469C4, kThemesFolderType = getOSType!("thme"), kFavoritesFolderType = getOSType!("favs"), kInternetSearchSitesFolderType = getOSType!("issf"), kInstallerLogsFolderType = getOSType!("ilgf"), - kScriptsFolderType = getOSType!("x736372C"), + kScriptsFolderType = 0x736372C4, kFolderActionsFolderType = getOSType!("fasf"), kSpeakableItemsFolderType = getOSType!("spki"), kKeychainFolderType = getOSType!("kchn") @@ -454,10 +426,10 @@ { kColorSyncProfilesFolderType = getOSType!("prof"), kApplicationSupportFolderType = getOSType!("asup"), - kTextEncodingsFolderType = getOSType!("xC474657"), + kTextEncodingsFolderType = 0xC4746578, kPrinterDescriptionFolderType = getOSType!("ppdf"), - kPrinterDriverFolderType = getOSType!("xC470726"), - kScriptingAdditionsFolderType = getOSType!("xC473637") + kPrinterDriverFolderType = 0xC4707264, + kScriptingAdditionsFolderType = 0xC4736372 } enum @@ -474,9 +446,9 @@ kALMModulesFolderType = getOSType!("walk"), kALMPreferencesFolderType = getOSType!("trip"), kALMLocationsFolderType = getOSType!("fall"), - kAppleExtrasFolderType = getOSType!("x616578C"), + kAppleExtrasFolderType = 0x616578C4, kContextualMenuItemsFolderType = getOSType!("cmnu"), - kMacOSReadMesFolderType = getOSType!("x6D6F72C"), + kMacOSReadMesFolderType = 0x6D6F72C4, kStartupFolderType = getOSType!("strt"), kShutdownFolderType = getOSType!("shdf"), kAppleMenuFolderType = getOSType!("amnu"), @@ -488,22 +460,22 @@ kSystemExtensionDisabledFolderType = getOSType!("macD"), kStartupItemsDisabledFolderType = getOSType!("strD"), kShutdownItemsDisabledFolderType = getOSType!("shdD"), - kAssistantsFolderType = getOSType!("x617374C"), + kAssistantsFolderType = 0x617374C4, kStationeryFolderType = getOSType!("odst"), kOpenDocFolderType = getOSType!("odod"), kOpenDocShellPlugInsFolderType = getOSType!("odsp"), kEditorsFolderType = getOSType!("oded"), - kOpenDocEditorsFolderType = getOSType!("xC46F646"), + kOpenDocEditorsFolderType = 0xC46F6466, kOpenDocLibrariesFolderType = getOSType!("odlb"), - kGenEditorsFolderType = getOSType!("xC465646"), - kHelpFolderType = getOSType!("xC4686C7"), - kInternetPlugInFolderType = getOSType!("xC46E657"), - kModemScriptsFolderType = getOSType!("xC46D6F6"), + kGenEditorsFolderType = 0xC4656469, + kHelpFolderType = 0xC4686C70, + kInternetPlugInFolderType = 0xC46E6574, + kModemScriptsFolderType = 0xC46D6F64, kControlStripModulesFolderType = getOSType!("sdev"), - kInternetFolderType = getOSType!("x696E74C"), + kInternetFolderType = 0x696E74C4, kAppearanceFolderType = getOSType!("appr"), kSoundSetsFolderType = getOSType!("snds"), - kDesktopPicturesFolderType = getOSType!("x647470C"), + kDesktopPicturesFolderType = 0x647470C4, kFindSupportFolderType = getOSType!("fnds"), kRecentApplicationsFolderType = getOSType!("rapp"), kRecentDocumentsFolderType = getOSType!("rdoc"), @@ -513,18 +485,18 @@ kDisplayExtensionsFolderType = getOSType!("dspl"), kMultiprocessingFolderType = getOSType!("mpxf"), kPrintingPlugInsFolderType = getOSType!("pplg"), - kAppleshareAutomountServerAliasesFolderType = getOSType!("x737276C"), + kAppleshareAutomountServerAliasesFolderType = 0x737276C4, kVolumeSettingsFolderType = getOSType!("vsfd"), - kPreMacOS91ApplicationsFolderType = getOSType!("x8C70707"), - kPreMacOS91InstallerLogsFolderType = getOSType!("x946C676"), - kPreMacOS91AssistantsFolderType = getOSType!("x8C7374C"), - kPreMacOS91UtilitiesFolderType = getOSType!("x9F7469C"), - kPreMacOS91AppleExtrasFolderType = getOSType!("x8C6578C"), - kPreMacOS91MacOSReadMesFolderType = getOSType!("xB56F72C"), - kPreMacOS91InternetFolderType = getOSType!("x946E74C"), - kPreMacOS91AutomountedServersFolderType = getOSType!("xA77276C"), - kPreMacOS91StationeryFolderType = getOSType!("xBF64737"), - kLocalesFolderType = getOSType!("xC46C6F6"), + kPreMacOS91ApplicationsFolderType = 0x8C707073, + kPreMacOS91InstallerLogsFolderType = 0x946C6766, + kPreMacOS91AssistantsFolderType = 0x8C7374C4, + kPreMacOS91UtilitiesFolderType = 0x9F7469C4, + kPreMacOS91AppleExtrasFolderType = 0x8C6578C4, + kPreMacOS91MacOSReadMesFolderType = 0xB56F72C4, + kPreMacOS91InternetFolderType = 0x946E74C4, + kPreMacOS91AutomountedServersFolderType = 0xA77276C4, + kPreMacOS91StationeryFolderType = 0xBF647374, + kLocalesFolderType = 0xC46C6F63, kFindByContentPluginsFolderType = getOSType!("fbcp"), kFindByContentFolderType = getOSType!("fbcf") } diff -r 7ff919f595d5 -r 19885b43130e dstep/coreservices/carboncore/PEFBinaryFormat.d --- a/dstep/coreservices/carboncore/PEFBinaryFormat.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/coreservices/carboncore/PEFBinaryFormat.d Sun Jan 03 22:06:11 2010 +0100 @@ -37,8 +37,6 @@ { const __kPEFTag1 = getOSType!("Joy!"); const __kPEFTag2 = getOSType!("peff"); - const __kPEFVersion = getOSType!("x0000000"); - } } @@ -49,8 +47,6 @@ { const __kVLibTag2 = getOSType!("VLib"); const __kBLibTag2 = getOSType!("BLib"); - const __kXLibVersion = getOSType!("x0000000"); - } } diff -r 7ff919f595d5 -r 19885b43130e dstep/coreservices/osservices/OpenTransportProviders.d --- a/dstep/coreservices/osservices/OpenTransportProviders.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/coreservices/osservices/OpenTransportProviders.d Sun Jan 03 22:06:11 2010 +0100 @@ -37,7 +37,6 @@ const __LNK_TPI = getOSType!("LTPI"); const __COM_SERIAL = getOSType!("SERL"); const __COM_ISDN = getOSType!("ISDN"); - const __MIOC_ISDN = getOSType!("U"); const __COM_PPP = getOSType!("PPPC"); } } diff -r 7ff919f595d5 -r 19885b43130e dstep/corevideo/CVBase.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/corevideo/CVBase.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,96 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.corevideo.CVBase; + +import dstep.corefoundation.CFBase; + +alias ulong CVOptionFlags; + +extern (C) +{ + extern + { + const CVTime kCVZeroTime; + const CVTime kCVIndefiniteTime; + } +} + +enum +{ + kCVSMPTETimeType24 = 0, + kCVSMPTETimeType25 = 1, + kCVSMPTETimeType30Drop = 2, + kCVSMPTETimeType30 = 3, + kCVSMPTETimeType2997 = 4, + kCVSMPTETimeType2997Drop = 5, + kCVSMPTETimeType60 = 6, + kCVSMPTETimeType5994 = 7 +} + +enum +{ + kCVSMPTETimeValid = (1L << 0), + kCVSMPTETimeRunning = (1L << 1) +} + +enum +{ + kCVTimeIsIndefinite = 1 << 0 +} + +enum +{ + kCVTimeStampVideoTimeValid = (1L << 0), + kCVTimeStampHostTimeValid = (1L << 1), + kCVTimeStampSMPTETimeValid = (1L << 2), + kCVTimeStampVideoRefreshPeriodValid = (1L << 3), + kCVTimeStampRateScalarValid = (1L << 4), + kCVTimeStampTopField = (1L << 16), + kCVTimeStampBottomField = (1L << 17) +} + +enum +{ + kCVTimeStampVideoHostTimeValid = (kCVTimeStampVideoTimeValid | kCVTimeStampHostTimeValid), + kCVTimeStampIsInterlaced = (kCVTimeStampTopField | kCVTimeStampBottomField) +} + +struct CVTime +{ + long timeValue; + int timeScale; + int flags; +} + + +struct CVTimeStamp +{ + uint version_; + int videoTimeScale; + long videoTime; + ulong hostTime; + double rateScalar; + long videoRefreshPeriod; + CVSMPTETime smpteTime; + ulong flags; + ulong reserved; +} + + +struct CVSMPTETime +{ + short subframes; + short subframeDivisor; + uint counter; + uint type; + uint flags; + short hours; + short minutes; + short seconds; + short frames; +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/corevideo/CVBuffer.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/corevideo/CVBuffer.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,48 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.corevideo.CVBuffer; + +import dstep.corefoundation.CFBase; +import dstep.corefoundation.CFDictionary; +import dstep.corevideo.CVBase; +import dstep.corevideo.CVReturn; + +struct __CVBuffer; + +alias uint CVAttachmentMode; +alias __CVBuffer* CVBufferRef; + +extern (C) +{ + extern + { + const CFStringRef kCVBufferPropagatedAttachmentsKey; + const CFStringRef kCVBufferNonPropagatedAttachmentsKey; + const CFStringRef kCVBufferMovieTimeKey; + const CFStringRef kCVBufferTimeValueKey; + const CFStringRef kCVBufferTimeScaleKey; + } +} + +enum +{ + kCVAttachmentMode_ShouldNotPropagate = 0, + kCVAttachmentMode_ShouldPropagate = 1 +} + +extern (C) +{ + CVBufferRef CVBufferRetain (CVBufferRef buffer); + void CVBufferRelease (CVBufferRef buffer); + void CVBufferSetAttachment (CVBufferRef buffer, CFStringRef key, CFTypeRef value, uint attachmentMode); + CFTypeRef CVBufferGetAttachment (CVBufferRef buffer, CFStringRef key, CVAttachmentMode* attachmentMode); + void CVBufferRemoveAttachment (CVBufferRef buffer, CFStringRef key); + void CVBufferRemoveAllAttachments (CVBufferRef buffer); + CFDictionaryRef CVBufferGetAttachments (CVBufferRef buffer, uint attachmentMode); + void CVBufferSetAttachments (CVBufferRef buffer, CFDictionaryRef theAttachments, uint attachmentMode); + void CVBufferPropagateAttachments (CVBufferRef sourceBuffer, CVBufferRef destinationBuffer); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/corevideo/CVDisplayLink.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/corevideo/CVDisplayLink.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,44 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.corevideo.CVDisplayLink; + +import dstep.applicationservices.ApplicationServices; +import dstep.corevideo.CVBase; +import dstep.corevideo.CVReturn; +import dstep.opengl.OpenGL; + +struct __CVDisplayLink; + +alias __CVDisplayLink* CVDisplayLinkRef; + +extern (C) +{ + alias int function (CVDisplayLinkRef, CVTimeStamp*, CVTimeStamp*, ulong, CVOptionFlags*, void*) CVDisplayLinkOutputCallback; +} + +extern (C) +{ + uint CVDisplayLinkGetTypeID (); + int CVDisplayLinkCreateWithCGDisplays (CGDirectDisplayID* displayArray, int count, CVDisplayLinkRef* displayLinkOut); + int CVDisplayLinkCreateWithOpenGLDisplayMask (uint mask, CVDisplayLinkRef* displayLinkOut); + int CVDisplayLinkCreateWithCGDisplay (uint displayID, CVDisplayLinkRef* displayLinkOut); + int CVDisplayLinkCreateWithActiveCGDisplays (CVDisplayLinkRef* displayLinkOut); + int CVDisplayLinkSetCurrentCGDisplay (CVDisplayLinkRef displayLink, uint displayID); + int CVDisplayLinkSetCurrentCGDisplayFromOpenGLContext (CVDisplayLinkRef displayLink, CGLContextObj cglContext, CGLPixelFormatObj cglPixelFormat); + uint CVDisplayLinkGetCurrentCGDisplay (CVDisplayLinkRef displayLink); + int CVDisplayLinkSetOutputCallback (CVDisplayLinkRef displayLink, CVDisplayLinkOutputCallback callback, void* userInfo); + int CVDisplayLinkStart (CVDisplayLinkRef displayLink); + int CVDisplayLinkStop (CVDisplayLinkRef displayLink); + CVTime CVDisplayLinkGetNominalOutputVideoRefreshPeriod (CVDisplayLinkRef displayLink); + CVTime CVDisplayLinkGetOutputVideoLatency (CVDisplayLinkRef displayLink); + double CVDisplayLinkGetActualOutputVideoRefreshPeriod (CVDisplayLinkRef displayLink); + ubyte CVDisplayLinkIsRunning (CVDisplayLinkRef displayLink); + int CVDisplayLinkGetCurrentTime (CVDisplayLinkRef displayLink, CVTimeStamp* outTime); + int CVDisplayLinkTranslateTime (CVDisplayLinkRef displayLink, CVTimeStamp* inTime, CVTimeStamp* outTime); + CVDisplayLinkRef CVDisplayLinkRetain (CVDisplayLinkRef displayLink); + void CVDisplayLinkRelease (CVDisplayLinkRef displayLink); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/corevideo/CVHostTime.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/corevideo/CVHostTime.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,16 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.corevideo.CVHostTime; + +import dstep.corevideo.CVBase; + +extern (C) +{ + ulong CVGetCurrentHostTime (); + double CVGetHostClockFrequency (); + uint CVGetHostClockMinimumTimeDelta (); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/corevideo/CVImageBuffer.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/corevideo/CVImageBuffer.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,72 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.corevideo.CVImageBuffer; + +import dstep.applicationservices.ApplicationServices; +import dstep.corevideo.CVBuffer; + +alias CVBufferRef CVImageBufferRef; + +extern (C) +{ + extern + { + const CFStringRef kCVImageBufferCGColorSpaceKey; + const CFStringRef kCVImageBufferCleanApertureKey; + const CFStringRef kCVImageBufferCleanApertureWidthKey; + const CFStringRef kCVImageBufferCleanApertureHeightKey; + const CFStringRef kCVImageBufferCleanApertureHorizontalOffsetKey; + const CFStringRef kCVImageBufferCleanApertureVerticalOffsetKey; + const CFStringRef kCVImageBufferPreferredCleanApertureKey; + const CFStringRef kCVImageBufferFieldCountKey; + const CFStringRef kCVImageBufferFieldDetailKey; + const CFStringRef kCVImageBufferFieldDetailTemporalTopFirst; + const CFStringRef kCVImageBufferFieldDetailTemporalBottomFirst; + const CFStringRef kCVImageBufferFieldDetailSpatialFirstLineEarly; + const CFStringRef kCVImageBufferFieldDetailSpatialFirstLineLate; + const CFStringRef kCVImageBufferPixelAspectRatioKey; + const CFStringRef kCVImageBufferPixelAspectRatioHorizontalSpacingKey; + const CFStringRef kCVImageBufferPixelAspectRatioVerticalSpacingKey; + const CFStringRef kCVImageBufferDisplayDimensionsKey; + const CFStringRef kCVImageBufferDisplayWidthKey; + const CFStringRef kCVImageBufferDisplayHeightKey; + const CFStringRef kCVImageBufferGammaLevelKey; + const CFStringRef kCVImageBufferYCbCrMatrixKey; + const CFStringRef kCVImageBufferYCbCrMatrix_ITU_R_709_2; + const CFStringRef kCVImageBufferYCbCrMatrix_ITU_R_601_4; + const CFStringRef kCVImageBufferYCbCrMatrix_SMPTE_240M_1995; + const CFStringRef kCVImageBufferColorPrimariesKey; + const CFStringRef kCVImageBufferColorPrimaries_ITU_R_709_2; + const CFStringRef kCVImageBufferColorPrimaries_EBU_3213; + const CFStringRef kCVImageBufferColorPrimaries_SMPTE_C; + const CFStringRef kCVImageBufferTransferFunctionKey; + const CFStringRef kCVImageBufferTransferFunction_ITU_R_709_2; + const CFStringRef kCVImageBufferTransferFunction_EBU_3213; + const CFStringRef kCVImageBufferTransferFunction_SMPTE_C; + const CFStringRef kCVImageBufferChromaLocationTopFieldKey; + const CFStringRef kCVImageBufferChromaLocationBottomFieldKey; + const CFStringRef kCVImageBufferChromaLocation_Left; + const CFStringRef kCVImageBufferChromaLocation_Center; + const CFStringRef kCVImageBufferChromaLocation_TopLeft; + const CFStringRef kCVImageBufferChromaLocation_Top; + const CFStringRef kCVImageBufferChromaLocation_BottomLeft; + const CFStringRef kCVImageBufferChromaLocation_Bottom; + const CFStringRef kCVImageBufferChromaLocation_DV420; + const CFStringRef kCVImageBufferChromaSubsamplingKey; + const CFStringRef kCVImageBufferChromaSubsampling_420; + const CFStringRef kCVImageBufferChromaSubsampling_422; + const CFStringRef kCVImageBufferChromaSubsampling_411; + } +} + +extern (C) +{ + CGSize CVImageBufferGetEncodedSize (CVImageBufferRef imageBuffer); + CGSize CVImageBufferGetDisplaySize (CVImageBufferRef imageBuffer); + CGRect CVImageBufferGetCleanRect (CVImageBufferRef imageBuffer); + CGColorSpaceRef CVImageBufferGetColorSpace (CVImageBufferRef imageBuffer); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/corevideo/CVOpenGLBuffer.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/corevideo/CVOpenGLBuffer.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,37 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.corevideo.CVOpenGLBuffer; + +import dstep.corefoundation.CFBase; +import dstep.corefoundation.CFDictionary; +import dstep.corevideo.CVImageBuffer; +import dstep.opengl.OpenGL; +import dstep.opengl.gl; + +alias CVImageBufferRef CVOpenGLBufferRef; + +extern (C) +{ + extern + { + const CFStringRef kCVOpenGLBufferWidth; + const CFStringRef kCVOpenGLBufferHeight; + const CFStringRef kCVOpenGLBufferTarget; + const CFStringRef kCVOpenGLBufferInternalFormat; + const CFStringRef kCVOpenGLBufferMaximumMipmapLevel; + } +} + +extern (C) +{ + uint CVOpenGLBufferGetTypeID (); + CVOpenGLBufferRef CVOpenGLBufferRetain (CVOpenGLBufferRef buffer); + void CVOpenGLBufferRelease (CVOpenGLBufferRef buffer); + int CVOpenGLBufferCreate (CFAllocatorRef allocator, size_t width, size_t height, CFDictionaryRef attributes, CVOpenGLBufferRef* bufferOut); + CFDictionaryRef CVOpenGLBufferGetAttributes (CVOpenGLBufferRef openGLBuffer); + int CVOpenGLBufferAttach (CVOpenGLBufferRef openGLBuffer, CGLContextObj cglContext, uint face, int level, int screen); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/corevideo/CVOpenGLBufferPool.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/corevideo/CVOpenGLBufferPool.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,37 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.corevideo.CVOpenGLBufferPool; + +import dstep.corefoundation.CFBase; +import dstep.corefoundation.CFDictionary; +import dstep.corevideo.CVBase; +import dstep.corevideo.CVOpenGLBuffer; +import dstep.corevideo.CVReturn; + +struct __CVOpenGLBufferPool; + +alias __CVOpenGLBufferPool* CVOpenGLBufferPoolRef; + +extern (C) +{ + extern + { + const CFStringRef kCVOpenGLBufferPoolMinimumBufferCountKey; + const CFStringRef kCVOpenGLBufferPoolMaximumBufferAgeKey; + } +} + +extern (C) +{ + uint CVOpenGLBufferPoolGetTypeID (); + CVOpenGLBufferPoolRef CVOpenGLBufferPoolRetain (CVOpenGLBufferPoolRef openGLBufferPool); + void CVOpenGLBufferPoolRelease (CVOpenGLBufferPoolRef openGLBufferPool); + int CVOpenGLBufferPoolCreate (CFAllocatorRef allocator, CFDictionaryRef poolAttributes, CFDictionaryRef openGLBufferAttributes, CVOpenGLBufferPoolRef* poolOut); + CFDictionaryRef CVOpenGLBufferPoolGetAttributes (CVOpenGLBufferPoolRef pool); + CFDictionaryRef CVOpenGLBufferPoolGetOpenGLBufferAttributes (CVOpenGLBufferPoolRef pool); + int CVOpenGLBufferPoolCreateOpenGLBuffer (CFAllocatorRef allocator, CVOpenGLBufferPoolRef openGLBufferPool, CVOpenGLBufferRef* openGLBufferOut); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/corevideo/CVOpenGLTexture.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/corevideo/CVOpenGLTexture.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,27 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.corevideo.CVOpenGLTexture; + +import dstep.applicationservices.ApplicationServices; +import dstep.corevideo.CVBase; +import dstep.corevideo.CVImageBuffer; +import dstep.corevideo.CVReturn; +import dstep.opengl.OpenGL; +import dstep.opengl.gl; + +alias CVImageBufferRef CVOpenGLTextureRef; + +extern (C) +{ + uint CVOpenGLTextureGetTypeID (); + CVOpenGLTextureRef CVOpenGLTextureRetain (CVOpenGLTextureRef texture); + void CVOpenGLTextureRelease (CVOpenGLTextureRef texture); + uint CVOpenGLTextureGetTarget (CVOpenGLTextureRef image); + uint CVOpenGLTextureGetName (CVOpenGLTextureRef image); + ubyte CVOpenGLTextureIsFlipped (CVOpenGLTextureRef image); + void CVOpenGLTextureGetCleanTexCoords (CVOpenGLTextureRef image, float[2] lowerLeft, float[2] lowerRight, float[2] upperRight, float[2] upperLeft); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/corevideo/CVOpenGLTextureCache.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/corevideo/CVOpenGLTextureCache.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,41 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.corevideo.CVOpenGLTextureCache; + +import dstep.corefoundation.CFBase; +import dstep.corefoundation.CFDictionary; +import dstep.corevideo.CVBase; +import dstep.corevideo.CVBuffer; +import dstep.corevideo.CVImageBuffer; +import dstep.corevideo.CVOpenGLTexture; +import dstep.corevideo.CVReturn; +import dstep.opengl.OpenGL; + +struct __CVOpenGLTextureCache; + +alias __CVOpenGLTextureCache* CVOpenGLTextureCacheRef; + +extern (C) +{ + extern + { + const CFStringRef kCVOpenGLTextureCacheChromaSamplingModeKey; + const CFStringRef kCVOpenGLTextureCacheChromaSamplingModeAutomatic; + const CFStringRef kCVOpenGLTextureCacheChromaSamplingModeHighestQuality; + const CFStringRef kCVOpenGLTextureCacheChromaSamplingModeBestPerformance; + } +} + +extern (C) +{ + uint CVOpenGLTextureCacheGetTypeID (); + CVOpenGLTextureCacheRef CVOpenGLTextureCacheRetain (CVOpenGLTextureCacheRef textureCache); + void CVOpenGLTextureCacheRelease (CVOpenGLTextureCacheRef textureCache); + int CVOpenGLTextureCacheCreate (CFAllocatorRef allocator, CFDictionaryRef cacheAttributes, CGLContextObj cglContext, CGLPixelFormatObj cglPixelFormat, CFDictionaryRef textureAttributes, CVOpenGLTextureCacheRef* cacheOut); + int CVOpenGLTextureCacheCreateTextureFromImage (CFAllocatorRef allocator, CVOpenGLTextureCacheRef textureCache, CVImageBufferRef sourceImage, CFDictionaryRef attributes, CVOpenGLTextureRef* textureOut); + void CVOpenGLTextureCacheFlush (CVOpenGLTextureCacheRef textureCache, ulong options); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/corevideo/CVPixelBuffer.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/corevideo/CVPixelBuffer.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,150 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.corevideo.CVPixelBuffer; + +import dstep.corefoundation.CFArray; +import dstep.corefoundation.CFBase; +import dstep.corefoundation.CFDictionary; +import dstep.corevideo.CVImageBuffer; +import dstep.objc.bridge.TypeEncoding; + +alias CVImageBufferRef CVPixelBufferRef; + +extern (C) +{ + alias void function (void*, void*, size_t, size_t, void**) CVPixelBufferReleasePlanarBytesCallback; + alias void function (void*, void*) CVPixelBufferReleaseBytesCallback; +} + +extern (C) +{ + extern + { + const CFStringRef kCVPixelBufferPixelFormatTypeKey; + const CFStringRef kCVPixelBufferMemoryAllocatorKey; + const CFStringRef kCVPixelBufferWidthKey; + const CFStringRef kCVPixelBufferHeightKey; + const CFStringRef kCVPixelBufferExtendedPixelsLeftKey; + const CFStringRef kCVPixelBufferExtendedPixelsTopKey; + const CFStringRef kCVPixelBufferExtendedPixelsRightKey; + const CFStringRef kCVPixelBufferExtendedPixelsBottomKey; + const CFStringRef kCVPixelBufferBytesPerRowAlignmentKey; + const CFStringRef kCVPixelBufferCGBitmapContextCompatibilityKey; + const CFStringRef kCVPixelBufferCGImageCompatibilityKey; + const CFStringRef kCVPixelBufferOpenGLCompatibilityKey; + } +} + +// This is needed otherwise the enums will fail compiling with gdc +version (GNU) +{ + private + { + const __kCVPixelFormatType_16LE555 = getOSType!("L555"); + const __kCVPixelFormatType_16LE5551 = getOSType!("5551"); + const __kCVPixelFormatType_16BE565 = getOSType!("B565"); + const __kCVPixelFormatType_16LE565 = getOSType!("L565"); + const __kCVPixelFormatType_24BGR = getOSType!("24BG"); + const __kCVPixelFormatType_32BGRA = getOSType!("BGRA"); + const __kCVPixelFormatType_32ABGR = getOSType!("ABGR"); + const __kCVPixelFormatType_32RGBA = getOSType!("RGBA"); + const __kCVPixelFormatType_64ARGB = getOSType!("b64a"); + const __kCVPixelFormatType_48RGB = getOSType!("b48r"); + const __kCVPixelFormatType_32AlphaGray = getOSType!("b32a"); + const __kCVPixelFormatType_16Gray = getOSType!("b16g"); + const __kCVPixelFormatType_422YpCbCr8 = getOSType!("2vuy"); + const __kCVPixelFormatType_4444YpCbCrA8 = getOSType!("v408"); + const __kCVPixelFormatType_4444YpCbCrA8R = getOSType!("r408"); + const __kCVPixelFormatType_444YpCbCr8 = getOSType!("v308"); + const __kCVPixelFormatType_422YpCbCr16 = getOSType!("v216"); + const __kCVPixelFormatType_422YpCbCr10 = getOSType!("v210"); + const __kCVPixelFormatType_444YpCbCr10 = getOSType!("v410"); + const __kCVPixelFormatType_420YpCbCr8Planar = getOSType!("y420"); + } +} + +enum +{ + kCVPixelFormatType_1Monochrome = 0x00000001, + kCVPixelFormatType_2Indexed = 0x00000002, + kCVPixelFormatType_4Indexed = 0x00000004, + kCVPixelFormatType_8Indexed = 0x00000008, + kCVPixelFormatType_1IndexedGray_WhiteIsZero = 0x00000021, + kCVPixelFormatType_2IndexedGray_WhiteIsZero = 0x00000022, + kCVPixelFormatType_4IndexedGray_WhiteIsZero = 0x00000024, + kCVPixelFormatType_8IndexedGray_WhiteIsZero = 0x00000028, + kCVPixelFormatType_16BE555 = 0x00000010, + kCVPixelFormatType_16LE555 = getOSType!("L555"), + kCVPixelFormatType_16LE5551 = getOSType!("5551"), + kCVPixelFormatType_16BE565 = getOSType!("B565"), + kCVPixelFormatType_16LE565 = getOSType!("L565"), + kCVPixelFormatType_24RGB = 0x00000018, + kCVPixelFormatType_24BGR = getOSType!("24BG"), + kCVPixelFormatType_32ARGB = 0x00000020, + kCVPixelFormatType_32BGRA = getOSType!("BGRA"), + kCVPixelFormatType_32ABGR = getOSType!("ABGR"), + kCVPixelFormatType_32RGBA = getOSType!("RGBA"), + kCVPixelFormatType_64ARGB = getOSType!("b64a"), + kCVPixelFormatType_48RGB = getOSType!("b48r"), + kCVPixelFormatType_32AlphaGray = getOSType!("b32a"), + kCVPixelFormatType_16Gray = getOSType!("b16g"), + kCVPixelFormatType_422YpCbCr8 = getOSType!("2vuy"), + kCVPixelFormatType_4444YpCbCrA8 = getOSType!("v408"), + kCVPixelFormatType_4444YpCbCrA8R = getOSType!("r408"), + kCVPixelFormatType_444YpCbCr8 = getOSType!("v308"), + kCVPixelFormatType_422YpCbCr16 = getOSType!("v216"), + kCVPixelFormatType_422YpCbCr10 = getOSType!("v210"), + kCVPixelFormatType_444YpCbCr10 = getOSType!("v410"), + kCVPixelFormatType_420YpCbCr8Planar = getOSType!("y420") +} + +struct CVPlanarComponentInfo +{ + int offset; + uint rowBytes; +} + + +struct CVPlanarPixelBufferInfo +{ + CVPlanarComponentInfo* componentInfo; +} + + +struct CVPlanarPixelBufferInfo_YCbCrPlanar +{ + CVPlanarComponentInfo componentInfoY; + CVPlanarComponentInfo componentInfoCb; + CVPlanarComponentInfo componentInfoCr; +} + +extern (C) +{ + uint CVPixelBufferGetTypeID (); + CVPixelBufferRef CVPixelBufferRetain (CVPixelBufferRef texture); + void CVPixelBufferRelease (CVPixelBufferRef texture); + int CVPixelBufferCreateResolvedAttributesDictionary (CFAllocatorRef allocator, CFArrayRef attributes, CFDictionaryRef* resolvedDictionaryOut); + int CVPixelBufferCreate (CFAllocatorRef allocator, size_t width, size_t height, uint pixelFormatType, CFDictionaryRef pixelBufferAttributes, CVPixelBufferRef* pixelBufferOut); + int CVPixelBufferCreateWithBytes (CFAllocatorRef allocator, size_t width, size_t height, uint pixelFormatType, void* baseAddress, size_t bytesPerRow, CVPixelBufferReleaseBytesCallback releaseCallback, void* releaseRefCon, CFDictionaryRef pixelBufferAttributes, CVPixelBufferRef* pixelBufferOut); + int CVPixelBufferCreateWithPlanarBytes (CFAllocatorRef allocator, size_t width, size_t height, uint pixelFormatType, void* dataPtr, size_t dataSize, size_t numberOfPlanes, void** planeBaseAddress, size_t* planeWidth, size_t* planeHeight, size_t* planeBytesPerRow, CVPixelBufferReleasePlanarBytesCallback releaseCallback, void* releaseRefCon, CFDictionaryRef pixelBufferAttributes, CVPixelBufferRef* pixelBufferOut); + int CVPixelBufferLockBaseAddress (CVPixelBufferRef pixelBuffer, ulong lockFlags); + int CVPixelBufferUnlockBaseAddress (CVPixelBufferRef pixelBuffer, ulong unlockFlags); + size_t CVPixelBufferGetWidth (CVPixelBufferRef pixelBuffer); + size_t CVPixelBufferGetHeight (CVPixelBufferRef pixelBuffer); + uint CVPixelBufferGetPixelFormatType (CVPixelBufferRef pixelBuffer); + void* CVPixelBufferGetBaseAddress (CVPixelBufferRef pixelBuffer); + size_t CVPixelBufferGetBytesPerRow (CVPixelBufferRef pixelBuffer); + size_t CVPixelBufferGetDataSize (CVPixelBufferRef pixelBuffer); + ubyte CVPixelBufferIsPlanar (CVPixelBufferRef pixelBuffer); + size_t CVPixelBufferGetPlaneCount (CVPixelBufferRef pixelBuffer); + size_t CVPixelBufferGetWidthOfPlane (CVPixelBufferRef pixelBuffer, size_t planeIndex); + size_t CVPixelBufferGetHeightOfPlane (CVPixelBufferRef pixelBuffer, size_t planeIndex); + void* CVPixelBufferGetBaseAddressOfPlane (CVPixelBufferRef pixelBuffer, size_t planeIndex); + size_t CVPixelBufferGetBytesPerRowOfPlane (CVPixelBufferRef pixelBuffer, size_t planeIndex); + void CVPixelBufferGetExtendedPixels (CVPixelBufferRef pixelBuffer, size_t* extraColumnsOnLeft, size_t* extraColumnsOnRight, size_t* extraRowsOnTop, size_t* extraRowsOnBottom); + int CVPixelBufferFillExtendedPixels (CVPixelBufferRef pixelBuffer); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/corevideo/CVPixelBufferPool.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/corevideo/CVPixelBufferPool.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,37 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.corevideo.CVPixelBufferPool; + +import dstep.corefoundation.CFBase; +import dstep.corefoundation.CFDictionary; +import dstep.corevideo.CVBase; +import dstep.corevideo.CVPixelBuffer; +import dstep.corevideo.CVReturn; + +struct __CVPixelBufferPool; + +alias __CVPixelBufferPool* CVPixelBufferPoolRef; + +extern (C) +{ + extern + { + const CFStringRef kCVPixelBufferPoolMinimumBufferCountKey; + const CFStringRef kCVPixelBufferPoolMaximumBufferAgeKey; + } +} + +extern (C) +{ + uint CVPixelBufferPoolGetTypeID (); + CVPixelBufferPoolRef CVPixelBufferPoolRetain (CVPixelBufferPoolRef pixelBufferPool); + void CVPixelBufferPoolRelease (CVPixelBufferPoolRef pixelBufferPool); + int CVPixelBufferPoolCreate (CFAllocatorRef allocator, CFDictionaryRef poolAttributes, CFDictionaryRef pixelBufferAttributes, CVPixelBufferPoolRef* poolOut); + CFDictionaryRef CVPixelBufferPoolGetAttributes (CVPixelBufferPoolRef pool); + CFDictionaryRef CVPixelBufferPoolGetPixelBufferAttributes (CVPixelBufferPoolRef pool); + int CVPixelBufferPoolCreatePixelBuffer (CFAllocatorRef allocator, CVPixelBufferPoolRef pixelBufferPool, CVPixelBufferRef* pixelBufferOut); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/corevideo/CVPixelFormatDescription.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/corevideo/CVPixelFormatDescription.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,59 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.corevideo.CVPixelFormatDescription; + +import dstep.corefoundation.CFArray; +import dstep.corefoundation.CFBase; +import dstep.corefoundation.CFDictionary; +import dstep.corevideo.CoreVideo; + +extern (C) +{ + alias ubyte function (CVPixelBufferRef, void*) CVFillExtendedPixelsCallBack; +} + +extern (C) +{ + extern + { + const CFStringRef kCVPixelFormatName; + const CFStringRef kCVPixelFormatConstant; + const CFStringRef kCVPixelFormatCodecType; + const CFStringRef kCVPixelFormatFourCC; + const CFStringRef kCVPixelFormatPlanes; + const CFStringRef kCVPixelFormatBlockWidth; + const CFStringRef kCVPixelFormatBlockHeight; + const CFStringRef kCVPixelFormatBitsPerBlock; + const CFStringRef kCVPixelFormatBlockHorizontalAlignment; + const CFStringRef kCVPixelFormatBlockVerticalAlignment; + const CFStringRef kCVPixelFormatHorizontalSubsampling; + const CFStringRef kCVPixelFormatVerticalSubsampling; + const CFStringRef kCVPixelFormatOpenGLFormat; + const CFStringRef kCVPixelFormatOpenGLType; + const CFStringRef kCVPixelFormatOpenGLInternalFormat; + const CFStringRef kCVPixelFormatCGBitmapInfo; + const CFStringRef kCVPixelFormatQDCompatibility; + const CFStringRef kCVPixelFormatCGBitmapContextCompatibility; + const CFStringRef kCVPixelFormatCGImageCompatibility; + const CFStringRef kCVPixelFormatOpenGLCompatibility; + const CFStringRef kCVPixelFormatFillExtendedPixelsCallback; + } +} + +struct CVFillExtendedPixelsCallBackData +{ + int version_; + CVFillExtendedPixelsCallBack fillCallBack; + void* refCon; +} + +extern (C) +{ + CFDictionaryRef CVPixelFormatDescriptionCreateWithPixelFormatType (CFAllocatorRef allocator, uint pixelFormat); + CFArrayRef CVPixelFormatDescriptionArrayCreateWithAllPixelFormatTypes (CFAllocatorRef allocator); + void CVPixelFormatDescriptionRegisterDescriptionWithPixelFormatType (CFDictionaryRef description, uint pixelFormat); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/corevideo/CVReturn.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/corevideo/CVReturn.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,33 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.corevideo.CVReturn; + +import dstep.corevideo.CVBase; + +alias int CVReturn; + +enum _CVReturn + +{ + kCVReturnSuccess = 0, + kCVReturnFirst = -6660, + kCVReturnError = kCVReturnFirst, + kCVReturnInvalidArgument = -6661, + kCVReturnAllocationFailed = -6662, + kCVReturnInvalidDisplay = -6670, + kCVReturnDisplayLinkAlreadyRunning = -6671, + kCVReturnDisplayLinkNotRunning = -6672, + kCVReturnDisplayLinkCallbacksNotSet = -6673, + kCVReturnInvalidPixelFormat = -6680, + kCVReturnInvalidSize = -6681, + kCVReturnInvalidPixelBufferAttributes = -6682, + kCVReturnPixelBufferNotOpenGLCompatible = -6683, + kCVReturnPoolAllocationFailed = -6690, + kCVReturnInvalidPoolAttributes = -6691, + kCVReturnLast = -6699 +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/corevideo/CoreVideo.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/corevideo/CoreVideo.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,23 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.corevideo.CoreVideo; + +public: + +import dstep.corevideo.CVBase; +import dstep.corevideo.CVBuffer; +import dstep.corevideo.CVDisplayLink; +import dstep.corevideo.CVHostTime; +import dstep.corevideo.CVOpenGLBuffer; +import dstep.corevideo.CVOpenGLBufferPool; +import dstep.corevideo.CVOpenGLTexture; +import dstep.corevideo.CVOpenGLTextureCache; +import dstep.corevideo.CVPixelBuffer; +import dstep.corevideo.CVPixelBufferPool; +import dstep.corevideo.CVPixelFormatDescription; +import dstep.corevideo.CVReturn; + diff -r 7ff919f595d5 -r 19885b43130e dstep/diskarbitration/DADisk.d --- a/dstep/diskarbitration/DADisk.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/diskarbitration/DADisk.d Sun Jan 03 22:06:11 2010 +0100 @@ -7,6 +7,7 @@ module dstep.diskarbitration.DADisk; import dstep.corefoundation.CoreFoundation; +import dstep.corefoundation.CFDictionary; import dstep.diskarbitration.DASession; //import dstep.iokit.IOKitLib; diff -r 7ff919f595d5 -r 19885b43130e dstep/diskarbitration/DASession.d --- a/dstep/diskarbitration/DASession.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/diskarbitration/DASession.d Sun Jan 03 22:06:11 2010 +0100 @@ -7,6 +7,7 @@ module dstep.diskarbitration.DASession; import dstep.corefoundation.CoreFoundation; +import dstep.corefoundation.CFRunLoop; struct __DASession; struct __DAApprovalSession; diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/Foundation.d --- a/dstep/foundation/Foundation.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/Foundation.d Sun Jan 03 22:06:11 2010 +0100 @@ -8,7 +8,6 @@ public: -import dstep.AvailabilityMacros; import dstep.corefoundation.CoreFoundation; import dstep.foundation.FoundationErrors; import dstep.foundation.NSAffineTransform; @@ -131,9 +130,4 @@ import dstep.foundation.NSXMLNode; import dstep.foundation.NSXMLNodeOptions; import dstep.foundation.NSXMLParser; -import dstep.foundation.NSZone; -import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; -import dstep.objc.objc-auto; -import dstep.objc.objc; - +import dstep.foundation.NSZone; \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/FoundationErrors.d --- a/dstep/foundation/FoundationErrors.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/FoundationErrors.d Sun Jan 03 22:06:11 2010 +0100 @@ -8,7 +8,9 @@ import dstep.foundation.NSObject; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + enum { diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSAffineTransform.d --- a/dstep/foundation/NSAffineTransform.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSAffineTransform.d Sun Jan 03 22:06:11 2010 +0100 @@ -7,10 +7,13 @@ module dstep.foundation.NSAffineTransform; import dstep.applicationservices.coregraphics.CGAffineTransform; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSCoder; import dstep.foundation.NSGeometry; import dstep.foundation.NSObject; +import dstep.foundation.NSZone; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; struct NSAffineTransformStruct { @@ -24,11 +27,21 @@ class NSAffineTransform : NSObject, INSCopying, INSCoding { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static NSAffineTransform transform () { - return invokeObjcSelfClass!(NSAffineTransform, "transform"); + return invokeObjcSuperClass!(NSAffineTransform, "transform"); } Object initWithTransform (NSAffineTransform transform) @@ -38,13 +51,7 @@ this (NSAffineTransform transform) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithTransform:", NSAffineTransform)(objcObject, transform); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithTransform(transform); } void translateXBy (CGFloat deltaX, CGFloat deltaY) @@ -124,13 +131,7 @@ this (NSCoder aDecoder) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithCoder(aDecoder); } } diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSAppleEventDescriptor.d --- a/dstep/foundation/NSAppleEventDescriptor.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSAppleEventDescriptor.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,69 +6,83 @@ */ module dstep.foundation.NSAppleEventDescriptor; -import dstep.applicationservices.ApplicationServices; +//import dstep.applicationservices.ApplicationServices; +import dstep.coreservices.ae.AEDataModel; import dstep.foundation.NSData; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSZone; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; class NSAppleEventDescriptor : NSObject, INSCopying { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static NSAppleEventDescriptor nullDescriptor () { - return invokeObjcSelfClass!(NSAppleEventDescriptor, "nullDescriptor"); + return invokeObjcSuperClass!(NSAppleEventDescriptor, "nullDescriptor"); } static NSAppleEventDescriptor descriptorWithDescriptorType (uint descriptorType, void* bytes, NSUInteger byteCount) { - return invokeObjcSelfClass!(NSAppleEventDescriptor, "descriptorWithDescriptorType:bytes:length:", uint, void*, NSUInteger)(descriptorType, bytes, byteCount); + return invokeObjcSuperClass!(NSAppleEventDescriptor, "descriptorWithDescriptorType:bytes:length:", uint, void*, NSUInteger)(descriptorType, bytes, byteCount); } static NSAppleEventDescriptor descriptorWithDescriptorType (uint descriptorType, NSData data) { - return invokeObjcSelfClass!(NSAppleEventDescriptor, "descriptorWithDescriptorType:data:", uint, NSData)(descriptorType, data); + return invokeObjcSuperClass!(NSAppleEventDescriptor, "descriptorWithDescriptorType:data:", uint, NSData)(descriptorType, data); } static NSAppleEventDescriptor descriptorWithBoolean (ubyte boolean) { - return invokeObjcSelfClass!(NSAppleEventDescriptor, "descriptorWithBoolean:", ubyte)(boolean); + return invokeObjcSuperClass!(NSAppleEventDescriptor, "descriptorWithBoolean:", ubyte)(boolean); } static NSAppleEventDescriptor descriptorWithEnumCode (uint enumerator) { - return invokeObjcSelfClass!(NSAppleEventDescriptor, "descriptorWithEnumCode:", uint)(enumerator); + return invokeObjcSuperClass!(NSAppleEventDescriptor, "descriptorWithEnumCode:", uint)(enumerator); } static NSAppleEventDescriptor descriptorWithInt32 (int signedInt) { - return invokeObjcSelfClass!(NSAppleEventDescriptor, "descriptorWithInt32:", int)(signedInt); + return invokeObjcSuperClass!(NSAppleEventDescriptor, "descriptorWithInt32:", int)(signedInt); } static NSAppleEventDescriptor descriptorWithTypeCode (uint typeCode) { - return invokeObjcSelfClass!(NSAppleEventDescriptor, "descriptorWithTypeCode:", uint)(typeCode); + return invokeObjcSuperClass!(NSAppleEventDescriptor, "descriptorWithTypeCode:", uint)(typeCode); } static NSAppleEventDescriptor descriptorWithString (NSString string) { - return invokeObjcSelfClass!(NSAppleEventDescriptor, "descriptorWithString:", NSString)(string); + return invokeObjcSuperClass!(NSAppleEventDescriptor, "descriptorWithString:", NSString)(string); } static NSAppleEventDescriptor appleEventWithEventClass (uint eventClass, uint eventID, NSAppleEventDescriptor targetDescriptor, short returnID, int transactionID) { - return invokeObjcSelfClass!(NSAppleEventDescriptor, "appleEventWithEventClass:eventID:targetDescriptor:returnID:transactionID:", uint, uint, NSAppleEventDescriptor, short, int)(eventClass, eventID, targetDescriptor, returnID, transactionID); + return invokeObjcSuperClass!(NSAppleEventDescriptor, "appleEventWithEventClass:eventID:targetDescriptor:returnID:transactionID:", uint, uint, NSAppleEventDescriptor, short, int)(eventClass, eventID, targetDescriptor, returnID, transactionID); } static NSAppleEventDescriptor listDescriptor () { - return invokeObjcSelfClass!(NSAppleEventDescriptor, "listDescriptor"); + return invokeObjcSuperClass!(NSAppleEventDescriptor, "listDescriptor"); } static NSAppleEventDescriptor recordDescriptor () { - return invokeObjcSelfClass!(NSAppleEventDescriptor, "recordDescriptor"); + return invokeObjcSuperClass!(NSAppleEventDescriptor, "recordDescriptor"); } Object initWithAEDescNoCopy (AEDesc* aeDesc) @@ -78,13 +92,7 @@ this (AEDesc* aeDesc) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithAEDescNoCopy:", AEDesc*)(objcObject, aeDesc); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithAEDescNoCopy(aeDesc); } Object initWithDescriptorType (uint descriptorType, void* bytes, NSUInteger byteCount) @@ -93,14 +101,8 @@ } this (uint descriptorType, void* bytes, NSUInteger byteCount) - { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithDescriptorType:bytes:length:", uint, void*, NSUInteger)(objcObject, descriptorType, bytes, byteCount); - - if (result) - objcObject = ret; - - dObject = this; + { + typeof(this).alloc.initWithDescriptorType(descriptorType, bytes, byteCount); } Object initWithDescriptorType (uint descriptorType, NSData data) @@ -110,13 +112,7 @@ this (uint descriptorType, NSData data) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithDescriptorType:data:", uint, NSData)(objcObject, descriptorType, data); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithDescriptorType(descriptorType, data); } Object initWithEventClass (uint eventClass, uint eventID, NSAppleEventDescriptor targetDescriptor, short returnID, int transactionID) @@ -126,13 +122,7 @@ this (uint eventClass, uint eventID, NSAppleEventDescriptor targetDescriptor, short returnID, int transactionID) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithEventClass:eventID:targetDescriptor:returnID:transactionID:", uint, uint, NSAppleEventDescriptor, short, int)(objcObject, eventClass, eventID, targetDescriptor, returnID, transactionID); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithEventClass(eventClass, eventID, targetDescriptor, returnID, transactionID); } Object initListDescriptor () @@ -140,33 +130,11 @@ return invokeObjcSelf!(Object, "initListDescriptor"); } - this () - { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initListDescriptor")(objcObject); - - if (result) - objcObject = ret; - - dObject = this; - } - Object initRecordDescriptor () { return invokeObjcSelf!(Object, "initRecordDescriptor"); } - this () - { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initRecordDescriptor")(objcObject); - - if (result) - objcObject = ret; - - dObject = this; - } - AEDesc* aeDesc () { return invokeObjcSelf!(AEDesc*, "aeDesc"); diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSAppleEventManager.d --- a/dstep/foundation/NSAppleEventManager.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSAppleEventManager.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,39 +6,58 @@ */ module dstep.foundation.NSAppleEventManager; -import dstep.applicationservices.ApplicationServices; +//import dstep.applicationservices.ApplicationServices; +import dstep.coreservices.ae.AEDataModel; import dstep.foundation.NSAppleEventDescriptor; import dstep.foundation.NSObject; +import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + import bindings = dstep.foundation.NSAppleEventManager_bindings; +struct __NSAppleEventManagerSuspension; + alias __NSAppleEventManagerSuspension* NSAppleEventManagerSuspensionID; extern (C) { extern { - const double NSAppleEventTimeOutDefault; - const double NSAppleEventTimeOutNone; + double NSAppleEventTimeOutDefault; + double NSAppleEventTimeOutNone; } } -NSString NSAppleEventManagerWillProcessFirstEventNotification; +private NSString NSAppleEventManagerWillProcessFirstEventNotification_; -static this () +NSString NSAppleEventManagerWillProcessFirstEventNotification () { - NSAppleEventManagerWillProcessFirstEventNotification = new NSString(bindings.NSAppleEventManagerWillProcessFirstEventNotification); + if (NSAppleEventManagerWillProcessFirstEventNotification_) + return NSAppleEventManagerWillProcessFirstEventNotification_; + + return NSAppleEventManagerWillProcessFirstEventNotification_ = new NSString(bindings.NSAppleEventManagerWillProcessFirstEventNotification); } class NSAppleEventManager : NSObject { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static NSAppleEventManager sharedAppleEventManager () { - return invokeObjcSelfClass!(NSAppleEventManager, "sharedAppleEventManager"); + return invokeObjcSuperClass!(NSAppleEventManager, "sharedAppleEventManager"); } void setEventHandler (Object handler, SEL handleEventSelector, uint eventClass, uint eventID) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSAppleEventManager_bindings.d --- a/dstep/foundation/NSAppleEventManager_bindings.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSAppleEventManager_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -1,10 +1,7 @@ module dstep.foundation.NSAppleEventManager_bindings; -import dstep.applicationservices.ApplicationServices; -import dstep.foundation.NSAppleEventDescriptor; -import dstep.foundation.NSObject; -import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + extern (C) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSAppleScript.d --- a/dstep/foundation/NSAppleScript.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSAppleScript.d Sun Jan 03 22:06:11 2010 +0100 @@ -11,44 +11,95 @@ import dstep.foundation.NSObject; import dstep.foundation.NSString; import dstep.foundation.NSURL; +import dstep.foundation.NSZone; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + import bindings = dstep.foundation.NSAppleScript_bindings; -const NSString NSAppleScriptErrorMessage; -const NSString NSAppleScriptErrorNumber; -const NSString NSAppleScriptErrorAppName; -const NSString NSAppleScriptErrorBriefMessage; -const NSString NSAppleScriptErrorRange; +private +{ + NSString NSAppleScriptErrorMessage_; + NSString NSAppleScriptErrorNumber_; + NSString NSAppleScriptErrorAppName_; + NSString NSAppleScriptErrorBriefMessage_; + NSString NSAppleScriptErrorRange_; +} + +NSString NSAppleScriptErrorMessage () +{ + if (NSAppleScriptErrorMessage_) + return NSAppleScriptErrorMessage_; + + return NSAppleScriptErrorMessage_ = new NSString(bindings.NSAppleScriptErrorMessage); +} -static this () +NSString NSAppleScriptErrorNumber () +{ + if (NSAppleScriptErrorNumber_) + return NSAppleScriptErrorNumber_; + + return NSAppleScriptErrorNumber_ = new NSString(bindings.NSAppleScriptErrorNumber); +} + +NSString NSAppleScriptErrorAppName () { - NSAppleScriptErrorMessage = new NSString(bindings.NSAppleScriptErrorMessage); - NSAppleScriptErrorNumber = new NSString(bindings.NSAppleScriptErrorNumber); - NSAppleScriptErrorAppName = new NSString(bindings.NSAppleScriptErrorAppName); - NSAppleScriptErrorBriefMessage = new NSString(bindings.NSAppleScriptErrorBriefMessage); - NSAppleScriptErrorRange = new NSString(bindings.NSAppleScriptErrorRange); + if (NSAppleScriptErrorAppName_) + return NSAppleScriptErrorAppName_; + + return NSAppleScriptErrorAppName_ = new NSString(bindings.NSAppleScriptErrorAppName); +} + +NSString NSAppleScriptErrorBriefMessage () +{ + if (NSAppleScriptErrorBriefMessage_) + return NSAppleScriptErrorBriefMessage_; + + return NSAppleScriptErrorBriefMessage_ = new NSString(bindings.NSAppleScriptErrorBriefMessage); +} + +NSString NSAppleScriptErrorRange () +{ + if (NSAppleScriptErrorRange_) + return NSAppleScriptErrorRange_; + + return NSAppleScriptErrorRange_ = new NSString(bindings.NSAppleScriptErrorRange); } class NSAppleScript : NSObject, INSCopying { - mixin ObjcWrap; - - Object initWithContentsOfURL (NSURL url, NSDictionary** errorInfo) + mixin (ObjcWrap); + + this () { - return invokeObjcSelf!(Object, "initWithContentsOfURL:error:", NSURL, NSDictionary**)(url, errorInfo); + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); } - this (NSURL url, NSDictionary** errorInfo) + Object initWithContentsOfURL (NSURL url, ref NSDictionary errorInfo) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithContentsOfURL:error:", NSURL, NSDictionary**)(objcObject, url, errorInfo); + id error; + + if (errorInfo) + error = new objc_object; + + Object result = invokeObjcSelf!(Object, "initWithContentsOfURL:error:", NSURL, id*)(url, &error); + + if (error) + errorInfo = new NSDictionary(error); + + return result; + } - if (result) - objcObject = ret; - - dObject = this; + this (NSURL url, ref NSDictionary errorInfo) + { + typeof(this).alloc.initWithContentsOfURL(url, errorInfo); } Object initWithSource (NSString source) @@ -58,13 +109,7 @@ this (NSString source) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithSource:", NSString)(objcObject, source); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithSource(source); } NSString source () @@ -77,19 +122,49 @@ return invokeObjcSelf!(bool, "isCompiled"); } - bool compileAndReturnError (NSDictionary** errorInfo) + bool compileAndReturnError (ref NSDictionary errorInfo) { - return invokeObjcSelf!(bool, "compileAndReturnError:", NSDictionary**)(errorInfo); + id error; + + if (errorInfo) + error = new objc_object; + + bool result = invokeObjcSelf!(bool, "compileAndReturnError:", id*)(&error); + + if (error) + errorInfo = new NSDictionary(error); + + return result; } - NSAppleEventDescriptor executeAndReturnError (NSDictionary** errorInfo) + NSAppleEventDescriptor executeAndReturnError (ref NSDictionary errorInfo) { - return invokeObjcSelf!(NSAppleEventDescriptor, "executeAndReturnError:", NSDictionary**)(errorInfo); + id error; + + if (errorInfo) + error = new objc_object; + + NSAppleEventDescriptor result = invokeObjcSelf!(NSAppleEventDescriptor, "executeAndReturnError:", id*)(&error); + + if (error) + errorInfo = new NSDictionary(error); + + return result; } - NSAppleEventDescriptor executeAppleEvent (NSAppleEventDescriptor event, NSDictionary** errorInfo) + NSAppleEventDescriptor executeAppleEvent (NSAppleEventDescriptor event, ref NSDictionary errorInfo) { - return invokeObjcSelf!(NSAppleEventDescriptor, "executeAppleEvent:error:", NSAppleEventDescriptor, NSDictionary**)(event, errorInfo); + id error; + + if (errorInfo) + error = new objc_object; + + NSAppleEventDescriptor result = invokeObjcSelf!(NSAppleEventDescriptor, "executeAppleEvent:error:", NSAppleEventDescriptor, id*)(event, &error); + + if (error) + errorInfo = new NSDictionary(error); + + return result; } Object copyWithZone (NSZone* zone) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSAppleScript_bindings.d --- a/dstep/foundation/NSAppleScript_bindings.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSAppleScript_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,7 +6,9 @@ import dstep.foundation.NSString; import dstep.foundation.NSURL; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + extern (C) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSArchiver.d --- a/dstep/foundation/NSArchiver.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSArchiver.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,27 +6,58 @@ */ module dstep.foundation.NSArchiver; +import dstep.foundation.NSArray; import dstep.foundation.NSCoder; import dstep.foundation.NSData; -import dstep.foundation.NSMutableArray; -import dstep.foundation.NSMutableData; -import dstep.foundation.NSMutableDictionary; +import dstep.foundation.NSDictionary; import dstep.foundation.NSString; +import dstep.foundation.NSZone; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + import bindings = dstep.foundation.NSArchiver_bindings; -const NSString NSInconsistentArchiveException; +private NSString NSInconsistentArchiveException_; + +NSString NSInconsistentArchiveException () +{ + if (NSInconsistentArchiveException_) + return NSInconsistentArchiveException_; + + return NSInconsistentArchiveException_ = new NSString(bindings.NSInconsistentArchiveException); +} + +const TNSArchiverCallback = ` -static this () -{ - NSInconsistentArchiveException = new NSString(bindings.NSInconsistentArchiveException); -} + Class classForArchiver () + { + return invokeObjcSelf!(Class, "classForArchiver"); + } + + Object replacementObjectForArchiver (NSArchiver archiver) + { + return invokeObjcSelf!(Object, "replacementObjectForArchiver:", NSArchiver)(archiver); + } + + //mixin ObjcBindMethod!(classForArchiver, "classForArchiver"); + //mixin ObjcBindMethod!(replacementObjectForArchiver, "replacementObjectForArchiver:"); +`; class NSArchiver : NSCoder { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } Object initForWritingWithMutableData (NSMutableData mdata) { @@ -35,13 +66,7 @@ this (NSMutableData mdata) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initForWritingWithMutableData:", NSMutableData)(objcObject, mdata); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initForWritingWithMutableData(mdata); } NSMutableData archiverData () @@ -61,12 +86,12 @@ static NSData archivedDataWithRootObject (Object rootObject) { - return invokeObjcSelfClass!(NSData, "archivedDataWithRootObject:", Object)(rootObject); + return invokeObjcSuperClass!(NSData, "archivedDataWithRootObject:", Object)(rootObject); } static bool archiveRootObject (Object rootObject, NSString path) { - return invokeObjcSelfClass!(bool, "archiveRootObject:toFile:", Object, NSString)(rootObject, path); + return invokeObjcSuperClass!(bool, "archiveRootObject:toFile:", Object, NSString)(rootObject, path); } void encodeClassName (NSString trueName, NSString inArchiveName) @@ -87,7 +112,17 @@ class NSUnarchiver : NSCoder { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } Object initForReadingWithData (NSData data) { @@ -96,13 +131,7 @@ this (NSData data) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initForReadingWithData:", NSData)(objcObject, data); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initForReadingWithData(data); } void setObjectZone (NSZone* zone) @@ -127,17 +156,17 @@ static Object unarchiveObjectWithData (NSData data) { - return invokeObjcSelfClass!(Object, "unarchiveObjectWithData:", NSData)(data); + return invokeObjcSuperClass!(Object, "unarchiveObjectWithData:", NSData)(data); } static Object unarchiveObjectWithFile (NSString path) { - return invokeObjcSelfClass!(Object, "unarchiveObjectWithFile:", NSString)(path); + return invokeObjcSuperClass!(Object, "unarchiveObjectWithFile:", NSString)(path); } static void decodeClassName (NSString inArchiveName, NSString trueName) { - return invokeObjcSelfClass!(void, "decodeClassName:asClassName:", NSString, NSString)(inArchiveName, trueName); + return invokeObjcSuperClass!(void, "decodeClassName:asClassName:", NSString, NSString)(inArchiveName, trueName); } void decodeClassName (NSString inArchiveName, NSString trueName) @@ -147,7 +176,7 @@ static NSString classNameDecodedForArchiveClassName (NSString inArchiveName) { - return invokeObjcSelfClass!(NSString, "classNameDecodedForArchiveClassName:", NSString)(inArchiveName); + return invokeObjcSuperClass!(NSString, "classNameDecodedForArchiveClassName:", NSString)(inArchiveName); } NSString classNameDecodedForArchiveClassName (NSString inArchiveName) @@ -159,11 +188,4 @@ { return invokeObjcSelf!(void, "replaceObject:withObject:", Object, Object)(object, newObject); } -} - -template TNSArchiverCallback () -{ - Class classForArchiver (); - Object replacementObjectForArchiver (NSArchiver archiver); -} - +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSArchiver_bindings.d --- a/dstep/foundation/NSArchiver_bindings.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSArchiver_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -1,13 +1,7 @@ module dstep.foundation.NSArchiver_bindings; -import dstep.foundation.NSCoder; -import dstep.foundation.NSData; -import dstep.foundation.NSMutableArray; -import dstep.foundation.NSMutableData; -import dstep.foundation.NSMutableDictionary; -import dstep.foundation.NSString; -import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + extern (C) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSArray.d --- a/dstep/foundation/NSArray.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSArray.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,128 +6,48 @@ */ module dstep.foundation.NSArray; +import dstep.foundation.NSCoder; import dstep.foundation.NSData; import dstep.foundation.NSEnumerator; import dstep.foundation.NSIndexSet; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; +import dstep.foundation.NSPathUtilities; import dstep.foundation.NSRange; +import dstep.foundation.NSSortDescriptor; import dstep.foundation.NSString; import dstep.foundation.NSURL; +import dstep.foundation.NSZone; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; - -class NSMutableArray : NSArray -{ - mixin ObjcWrap; - mixin TNSExtendedMutableArray; - mixin TNSMutableArrayCreation; - - void addObject (Object anObject) - { - return invokeObjcSelf!(void, "addObject:", Object)(anObject); - } - - void insertObject (Object anObject, NSUInteger index) - { - return invokeObjcSelf!(void, "insertObject:atIndex:", Object, NSUInteger)(anObject, index); - } - - void removeLastObject () - { - return invokeObjcSelf!(void, "removeLastObject"); - } - - void removeObjectAtIndex (NSUInteger index) - { - return invokeObjcSelf!(void, "removeObjectAtIndex:", NSUInteger)(index); - } - - void replaceObjectAtIndex (NSUInteger index, Object anObject) - { - return invokeObjcSelf!(void, "replaceObjectAtIndex:withObject:", NSUInteger, Object)(index, anObject); - } -} - -class NSArray : NSObject, INSCopying, INSMutableCopying, INSCoding, INSFastEnumeration -{ - mixin ObjcWrap; - mixin TNSArrayCreation; - mixin TNSExtendedArray; - mixin TNSSortDescriptorSorting; - mixin TNSArrayPathExtensions; +import dstep.objc.objc; - NSUInteger count () - { - return invokeObjcSelf!(NSUInteger, "count"); - } - - Object objectAtIndex (NSUInteger index) - { - return invokeObjcSelf!(Object, "objectAtIndex:", NSUInteger)(index); - } - - Object copyWithZone (NSZone* zone) - { - return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); - } - - Object mutableCopyWithZone (NSZone* zone) - { - return invokeObjcSelf!(Object, "mutableCopyWithZone:", NSZone*)(zone); - } - - void encodeWithCoder (NSCoder aCoder) - { - return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); - } +alias extern (C) NSInteger function (id, id, void*) CompareFunc; - Object initWithCoder (NSCoder aDecoder) - { - return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); - } - - this (NSCoder aDecoder) - { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); +const TNSArrayCreation = ` - if (result) - objcObject = ret; - - dObject = this; - } - - NSUInteger countByEnumeratingWithState (NSFastEnumerationState* state, id* stackbuf, NSUInteger len) - { - return invokeObjcSelf!(NSUInteger, "countByEnumeratingWithState:objects:count:", NSFastEnumerationState*, id*, NSUInteger)(state, stackbuf, len); - } -} - -template TNSArrayCreation () -{ static Object array () { - return invokeObjcSelfClass!(Object, "array"); + return invokeObjcSuperClass!(Object, "array"); } static Object arrayWithObject (Object anObject) { - return invokeObjcSelfClass!(Object, "arrayWithObject:", Object)(anObject); + return invokeObjcSuperClass!(Object, "arrayWithObject:", Object)(anObject); } static Object arrayWithObjects (id* objects, NSUInteger cnt) { - return invokeObjcSelfClass!(Object, "arrayWithObjects:count:", id*, NSUInteger)(objects, cnt); + return invokeObjcSuperClass!(Object, "arrayWithObjects:count:", id*, NSUInteger)(objects, cnt); } static Object arrayWithObjects (Object arrayWithObjects, ...) { - return invokeObjcSelfClass!(Object, "arrayWithObjects:", Object)(arrayWithObjects); + return invokeObjcSuperClass!(Object, "arrayWithObjects:", Object)(arrayWithObjects); } static Object arrayWithArray (NSArray array) { - return invokeObjcSelfClass!(Object, "arrayWithArray:", NSArray)(array); + return invokeObjcSuperClass!(Object, "arrayWithArray:", NSArray)(array); } Object initWithObjects (id* objects, NSUInteger cnt) @@ -137,13 +57,7 @@ this (id* objects, NSUInteger cnt) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithObjects:count:", id*, NSUInteger)(objcObject, objects, cnt); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithObjects(objects, cnt); } Object initWithObjects (Object initWithObjects, ...) @@ -153,13 +67,7 @@ this (Object initWithObjects, ...) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithObjects:", Object)(objcObject, initWithObjects); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithObjects(initWithObjects); } Object initWithArray (NSArray array) @@ -169,13 +77,7 @@ this (NSArray array) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithArray:", NSArray)(objcObject, array); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithArray(array); } Object initWithArray (NSArray array, bool flag) @@ -185,23 +87,17 @@ this (NSArray array, bool flag) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithArray:copyItems:", NSArray, bool)(objcObject, array, flag); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithArray(array, flag); } static Object arrayWithContentsOfFile (NSString path) { - return invokeObjcSelfClass!(Object, "arrayWithContentsOfFile:", NSString)(path); + return invokeObjcSuperClass!(Object, "arrayWithContentsOfFile:", NSString)(path); } static Object arrayWithContentsOfURL (NSURL url) { - return invokeObjcSelfClass!(Object, "arrayWithContentsOfURL:", NSURL)(url); + return invokeObjcSuperClass!(Object, "arrayWithContentsOfURL:", NSURL)(url); } Object initWithContentsOfFile (NSString path) @@ -211,13 +107,7 @@ this (NSString path) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithContentsOfFile:", NSString)(objcObject, path); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithContentsOfFile(path); } Object initWithContentsOfURL (NSURL url) @@ -227,18 +117,12 @@ this (NSURL url) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithContentsOfURL:", NSURL)(objcObject, url); - - if (result) - objcObject = ret; + typeof(this).alloc.initWithContentsOfURL(url); + } +`; - dObject = this; - } -} +const TNSExtendedArray = ` -template TNSExtendedArray () -{ NSArray arrayByAddingObject (Object anObject) { return invokeObjcSelf!(NSArray, "arrayByAddingObject:", Object)(anObject); @@ -334,14 +218,14 @@ return invokeObjcSelf!(NSData, "sortedArrayHint"); } - NSArray sortedArrayUsingFunction (NSInteger *id, id, void* comparator, void* context) + NSArray sortedArrayUsingFunction (CompareFunc comparator, void* context) { - return invokeObjcSelf!(NSArray, "sortedArrayUsingFunction:context:", NSInteger *id, id, void*, void*)(comparator, context); + return invokeObjcSelf!(NSArray, "sortedArrayUsingFunction:context:", CompareFunc, void*)(comparator, context); } - NSArray sortedArrayUsingFunction (NSInteger *id, id, void* comparator, void* context, NSData hint) + NSArray sortedArrayUsingFunction (CompareFunc comparator, void* context, NSData hint) { - return invokeObjcSelf!(NSArray, "sortedArrayUsingFunction:context:hint:", NSInteger *id, id, void*, void*, NSData)(comparator, context, hint); + return invokeObjcSelf!(NSArray, "sortedArrayUsingFunction:context:hint:", CompareFunc, void*, NSData)(comparator, context, hint); } NSArray sortedArrayUsingSelector (SEL comparator) @@ -378,10 +262,10 @@ { return invokeObjcSelf!(NSArray, "objectsAtIndexes:", NSIndexSet)(indexes); } -} +`; -template TNSExtendedMutableArray () -{ +const TNSExtendedMutableArray = ` + void addObjectsFromArray (NSArray otherArray) { return invokeObjcSelf!(void, "addObjectsFromArray:", NSArray)(otherArray); @@ -447,9 +331,9 @@ return invokeObjcSelf!(void, "setArray:", NSArray)(otherArray); } - void sortUsingFunction (NSInteger *id, id, void* compare, void* context) + void sortUsingFunction (CompareFunc compare, void* context) { - return invokeObjcSelf!(void, "sortUsingFunction:context:", NSInteger *id, id, void*, void*)(compare, context); + return invokeObjcSelf!(void, "sortUsingFunction:context:", CompareFunc, void*)(compare, context); } void sortUsingSelector (SEL comparator) @@ -471,13 +355,13 @@ { return invokeObjcSelf!(void, "replaceObjectsAtIndexes:withObjects:", NSIndexSet, NSArray)(indexes, objects); } -} +`; -template TNSMutableArrayCreation () -{ +const TNSMutableArrayCreation = ` + static Object arrayWithCapacity (NSUInteger numItems) { - return invokeObjcSelfClass!(Object, "arrayWithCapacity:", NSUInteger)(numItems); + return invokeObjcSuperClass!(Object, "arrayWithCapacity:", NSUInteger)(numItems); } Object initWithCapacity (NSUInteger numItems) @@ -487,13 +371,458 @@ this (NSUInteger numItems) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCapacity:", NSUInteger)(objcObject, numItems); + typeof(this).alloc.initWithCapacity(numItems); + } +`; + +class NSMutableArray : NSArray +{ + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } + + void addObject (Object anObject) + { + return invokeObjcSelf!(void, "addObject:", Object)(anObject); + } + + void insertObject (Object anObject, NSUInteger index) + { + return invokeObjcSelf!(void, "insertObject:atIndex:", Object, NSUInteger)(anObject, index); + } + + void removeLastObject () + { + return invokeObjcSelf!(void, "removeLastObject"); + } + + void removeObjectAtIndex (NSUInteger index) + { + return invokeObjcSelf!(void, "removeObjectAtIndex:", NSUInteger)(index); + } - if (result) - objcObject = ret; - - dObject = this; + void replaceObjectAtIndex (NSUInteger index, Object anObject) + { + return invokeObjcSelf!(void, "replaceObjectAtIndex:withObject:", NSUInteger, Object)(index, anObject); + } + + // NSExtendedMutableArray + void addObjectsFromArray (NSArray otherArray) + { + return invokeObjcSelf!(void, "addObjectsFromArray:", NSArray)(otherArray); + } + + void exchangeObjectAtIndex (NSUInteger idx1, NSUInteger idx2) + { + return invokeObjcSelf!(void, "exchangeObjectAtIndex:withObjectAtIndex:", NSUInteger, NSUInteger)(idx1, idx2); + } + + void removeAllObjects () + { + return invokeObjcSelf!(void, "removeAllObjects"); + } + + void removeObject (Object anObject, NSRange range) + { + return invokeObjcSelf!(void, "removeObject:inRange:", Object, NSRange)(anObject, range); + } + + void removeObject (Object anObject) + { + return invokeObjcSelf!(void, "removeObject:", Object)(anObject); + } + + void removeObjectIdenticalTo (Object anObject, NSRange range) + { + return invokeObjcSelf!(void, "removeObjectIdenticalTo:inRange:", Object, NSRange)(anObject, range); + } + + void removeObjectIdenticalTo (Object anObject) + { + return invokeObjcSelf!(void, "removeObjectIdenticalTo:", Object)(anObject); + } + + void removeObjectsFromIndices (NSUInteger* indices, NSUInteger cnt) + { + return invokeObjcSelf!(void, "removeObjectsFromIndices:numIndices:", NSUInteger*, NSUInteger)(indices, cnt); + } + + void removeObjectsInArray (NSArray otherArray) + { + return invokeObjcSelf!(void, "removeObjectsInArray:", NSArray)(otherArray); + } + + void removeObjectsInRange (NSRange range) + { + return invokeObjcSelf!(void, "removeObjectsInRange:", NSRange)(range); + } + + void replaceObjectsInRange (NSRange range, NSArray otherArray, NSRange otherRange) + { + return invokeObjcSelf!(void, "replaceObjectsInRange:withObjectsFromArray:range:", NSRange, NSArray, NSRange)(range, otherArray, otherRange); + } + + void replaceObjectsInRange (NSRange range, NSArray otherArray) + { + return invokeObjcSelf!(void, "replaceObjectsInRange:withObjectsFromArray:", NSRange, NSArray)(range, otherArray); + } + + void setArray (NSArray otherArray) + { + return invokeObjcSelf!(void, "setArray:", NSArray)(otherArray); + } + + void sortUsingFunction (CompareFunc compare, void* context) + { + return invokeObjcSelf!(void, "sortUsingFunction:context:", CompareFunc, void*)(compare, context); + } + + void sortUsingSelector (SEL comparator) + { + return invokeObjcSelf!(void, "sortUsingSelector:", SEL)(comparator); + } + + void insertObjects (NSArray objects, NSIndexSet indexes) + { + return invokeObjcSelf!(void, "insertObjects:atIndexes:", NSArray, NSIndexSet)(objects, indexes); + } + + void removeObjectsAtIndexes (NSIndexSet indexes) + { + return invokeObjcSelf!(void, "removeObjectsAtIndexes:", NSIndexSet)(indexes); + } + + void replaceObjectsAtIndexes (NSIndexSet indexes, NSArray objects) + { + return invokeObjcSelf!(void, "replaceObjectsAtIndexes:withObjects:", NSIndexSet, NSArray)(indexes, objects); + } + + + // NSMutableArrayCreation + static Object arrayWithCapacity (NSUInteger numItems) + { + return invokeObjcSuperClass!(Object, "arrayWithCapacity:", NSUInteger)(numItems); + } + + Object initWithCapacity (NSUInteger numItems) + { + return invokeObjcSelf!(Object, "initWithCapacity:", NSUInteger)(numItems); + } + + this (NSUInteger numItems) + { + typeof(this).alloc.initWithCapacity(numItems); } } +class NSArray : NSObject, INSCopying, INSMutableCopying, INSCoding, INSFastEnumeration +{ + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } + + NSUInteger count () + { + return invokeObjcSelf!(NSUInteger, "count"); + } + + Object objectAtIndex (NSUInteger index) + { + return invokeObjcSelf!(Object, "objectAtIndex:", NSUInteger)(index); + } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } + + Object mutableCopyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "mutableCopyWithZone:", NSZone*)(zone); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + Object initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); + } + + this (NSCoder aDecoder) + { + typeof(this).alloc.initWithCoder(aDecoder); + } + + NSUInteger countByEnumeratingWithState (NSFastEnumerationState* state, id* stackbuf, NSUInteger len) + { + return invokeObjcSelf!(NSUInteger, "countByEnumeratingWithState:objects:count:", NSFastEnumerationState*, id*, NSUInteger)(state, stackbuf, len); + } + + // NSArrayCreation + static Object array () + { + return invokeObjcSuperClass!(Object, "array"); + } + + static Object arrayWithObject (Object anObject) + { + return invokeObjcSuperClass!(Object, "arrayWithObject:", Object)(anObject); + } + + static Object arrayWithObjects (id* objects, NSUInteger cnt) + { + return invokeObjcSuperClass!(Object, "arrayWithObjects:count:", id*, NSUInteger)(objects, cnt); + } + + static Object arrayWithObjects (Object arrayWithObjects, ...) + { + return invokeObjcSuperClass!(Object, "arrayWithObjects:", Object)(arrayWithObjects); + } + + static Object arrayWithArray (NSArray array) + { + return invokeObjcSuperClass!(Object, "arrayWithArray:", NSArray)(array); + } + + Object initWithObjects (id* objects, NSUInteger cnt) + { + return invokeObjcSelf!(Object, "initWithObjects:count:", id*, NSUInteger)(objects, cnt); + } + + this (id* objects, NSUInteger cnt) + { + typeof(this).alloc.initWithObjects(objects, cnt); + } + + Object initWithObjects (Object initWithObjects, ...) + { + return invokeObjcSelf!(Object, "initWithObjects:", Object)(initWithObjects); + } + + this (Object initWithObjects, ...) + { + typeof(this).alloc.initWithObjects(initWithObjects); + } + + Object initWithArray (NSArray array) + { + return invokeObjcSelf!(Object, "initWithArray:", NSArray)(array); + } + + this (NSArray array) + { + typeof(this).alloc.initWithArray(array); + } + + Object initWithArray (NSArray array, bool flag) + { + return invokeObjcSelf!(Object, "initWithArray:copyItems:", NSArray, bool)(array, flag); + } + + this (NSArray array, bool flag) + { + typeof(this).alloc.initWithArray(array, flag); + } + + static Object arrayWithContentsOfFile (NSString path) + { + return invokeObjcSuperClass!(Object, "arrayWithContentsOfFile:", NSString)(path); + } + + static Object arrayWithContentsOfURL (NSURL url) + { + return invokeObjcSuperClass!(Object, "arrayWithContentsOfURL:", NSURL)(url); + } + + Object initWithContentsOfFile (NSString path) + { + return invokeObjcSelf!(Object, "initWithContentsOfFile:", NSString)(path); + } + + this (NSString path) + { + typeof(this).alloc.initWithContentsOfFile(path); + } + + Object initWithContentsOfURL (NSURL url) + { + return invokeObjcSelf!(Object, "initWithContentsOfURL:", NSURL)(url); + } + + this (NSURL url) + { + typeof(this).alloc.initWithContentsOfURL(url); + } + + // NSExtendedArray + NSArray arrayByAddingObject (Object anObject) + { + return invokeObjcSelf!(NSArray, "arrayByAddingObject:", Object)(anObject); + } + + NSArray arrayByAddingObjectsFromArray (NSArray otherArray) + { + return invokeObjcSelf!(NSArray, "arrayByAddingObjectsFromArray:", NSArray)(otherArray); + } + + NSString componentsJoinedByString (NSString separator) + { + return invokeObjcSelf!(NSString, "componentsJoinedByString:", NSString)(separator); + } + + bool containsObject (Object anObject) + { + return invokeObjcSelf!(bool, "containsObject:", Object)(anObject); + } + + NSString description () + { + return invokeObjcSelf!(NSString, "description"); + } + + NSString descriptionWithLocale (Object locale) + { + return invokeObjcSelf!(NSString, "descriptionWithLocale:", Object)(locale); + } + + NSString descriptionWithLocale (Object locale, NSUInteger level) + { + return invokeObjcSelf!(NSString, "descriptionWithLocale:indent:", Object, NSUInteger)(locale, level); + } + + Object firstObjectCommonWithArray (NSArray otherArray) + { + return invokeObjcSelf!(Object, "firstObjectCommonWithArray:", NSArray)(otherArray); + } + + void getObjects (id* objects) + { + return invokeObjcSelf!(void, "getObjects:", id*)(objects); + } + + void getObjects (id* objects, NSRange range) + { + return invokeObjcSelf!(void, "getObjects:range:", id*, NSRange)(objects, range); + } + + NSUInteger indexOfObject (Object anObject) + { + return invokeObjcSelf!(NSUInteger, "indexOfObject:", Object)(anObject); + } + + NSUInteger indexOfObject (Object anObject, NSRange range) + { + return invokeObjcSelf!(NSUInteger, "indexOfObject:inRange:", Object, NSRange)(anObject, range); + } + + NSUInteger indexOfObjectIdenticalTo (Object anObject) + { + return invokeObjcSelf!(NSUInteger, "indexOfObjectIdenticalTo:", Object)(anObject); + } + + NSUInteger indexOfObjectIdenticalTo (Object anObject, NSRange range) + { + return invokeObjcSelf!(NSUInteger, "indexOfObjectIdenticalTo:inRange:", Object, NSRange)(anObject, range); + } + + bool isEqualToArray (NSArray otherArray) + { + return invokeObjcSelf!(bool, "isEqualToArray:", NSArray)(otherArray); + } + + Object lastObject () + { + return invokeObjcSelf!(Object, "lastObject"); + } + + NSEnumerator objectEnumerator () + { + return invokeObjcSelf!(NSEnumerator, "objectEnumerator"); + } + + NSEnumerator reverseObjectEnumerator () + { + return invokeObjcSelf!(NSEnumerator, "reverseObjectEnumerator"); + } + + NSData sortedArrayHint () + { + return invokeObjcSelf!(NSData, "sortedArrayHint"); + } + + NSArray sortedArrayUsingFunction (CompareFunc comparator, void* context) + { + return invokeObjcSelf!(NSArray, "sortedArrayUsingFunction:context:", CompareFunc, void*)(comparator, context); + } + + NSArray sortedArrayUsingFunction (CompareFunc comparator, void* context, NSData hint) + { + return invokeObjcSelf!(NSArray, "sortedArrayUsingFunction:context:hint:", CompareFunc, void*, NSData)(comparator, context, hint); + } + + NSArray sortedArrayUsingSelector (SEL comparator) + { + return invokeObjcSelf!(NSArray, "sortedArrayUsingSelector:", SEL)(comparator); + } + + NSArray subarrayWithRange (NSRange range) + { + return invokeObjcSelf!(NSArray, "subarrayWithRange:", NSRange)(range); + } + + bool writeToFile (NSString path, bool useAuxiliaryFile) + { + return invokeObjcSelf!(bool, "writeToFile:atomically:", NSString, bool)(path, useAuxiliaryFile); + } + + bool writeToURL (NSURL url, bool atomically) + { + return invokeObjcSelf!(bool, "writeToURL:atomically:", NSURL, bool)(url, atomically); + } + + void makeObjectsPerformSelector (SEL aSelector) + { + return invokeObjcSelf!(void, "makeObjectsPerformSelector:", SEL)(aSelector); + } + + void makeObjectsPerformSelector (SEL aSelector, Object argument) + { + return invokeObjcSelf!(void, "makeObjectsPerformSelector:withObject:", SEL, Object)(aSelector, argument); + } + + NSArray objectsAtIndexes (NSIndexSet indexes) + { + return invokeObjcSelf!(NSArray, "objectsAtIndexes:", NSIndexSet)(indexes); + } + + // NSSortDescriptorSorting + NSArray sortedArrayUsingDescriptors (NSArray sortDescriptors) + { + return invokeObjcSelf!(NSArray, "sortedArrayUsingDescriptors:", NSArray)(sortDescriptors); + } + + // NSArrayPathExtensions + NSArray pathsMatchingExtensions (NSArray filterTypes) + { + return invokeObjcSelf!(NSArray, "pathsMatchingExtensions:", NSArray)(filterTypes); + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSAttributedString.d --- a/dstep/foundation/NSAttributedString.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSAttributedString.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,76 +6,28 @@ */ module dstep.foundation.NSAttributedString; +/*import dstep.appkit.NSFileWrapper; +import dstep.appkit.NSStringDrawing; +import dstep.appkit.NSTextAttachment; +import dstep.appkit.NSTextList; +import dstep.appkit.NSTextTable;*/ +import dstep.foundation.NSArray; +import dstep.foundation.NSCoder; +import dstep.foundation.NSData; +import dstep.foundation.NSError; import dstep.foundation.NSDictionary; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSRange; import dstep.foundation.NSString; +import dstep.foundation.NSURL; +import dstep.foundation.NSZone; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; - -class NSMutableAttributedString : NSAttributedString -{ - mixin ObjcWrap; - mixin TNSExtendedMutableAttributedString; - - void replaceCharactersInRange (NSRange range, NSString str) - { - return invokeObjcSelf!(void, "replaceCharactersInRange:withString:", NSRange, NSString)(range, str); - } - - void setAttributes (NSDictionary attrs, NSRange range) - { - return invokeObjcSelf!(void, "setAttributes:range:", NSDictionary, NSRange)(attrs, range); - } -} - -class NSAttributedString : NSObject, INSCopying, INSMutableCopying, INSCoding -{ - mixin ObjcWrap; - mixin TNSExtendedAttributedString; - - NSString string () - { - return invokeObjcSelf!(NSString, "string"); - } +import dstep.objc.objc; - NSDictionary attributesAtIndex (NSUInteger location, NSRangePointer range) - { - return invokeObjcSelf!(NSDictionary, "attributesAtIndex:effectiveRange:", NSUInteger, NSRangePointer)(location, range); - } - - Object copyWithZone (NSZone* zone) - { - return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); - } - - Object mutableCopyWithZone (NSZone* zone) - { - return invokeObjcSelf!(Object, "mutableCopyWithZone:", NSZone*)(zone); - } - - void encodeWithCoder (NSCoder aCoder) - { - return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); - } +const TNSExtendedAttributedString = ` - Object initWithCoder (NSCoder aDecoder) - { - return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); - } - - this (NSCoder aDecoder) - { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); - - if (result) - objcObject = ret; - - dObject = this; - } -} - -template TNSExtendedAttributedString () -{ NSUInteger length () { return invokeObjcSelf!(NSUInteger, "length"); @@ -113,13 +65,7 @@ this (NSString str) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithString:", NSString)(objcObject, str); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithString(str); } Object initWithString (NSString str, NSDictionary attrs) @@ -129,13 +75,7 @@ this (NSString str, NSDictionary attrs) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithString:attributes:", NSString, NSDictionary)(objcObject, str, attrs); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithString(str, attrs); } Object initWithAttributedString (NSAttributedString attrStr) @@ -145,18 +85,12 @@ this (NSAttributedString attrStr) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithAttributedString:", NSAttributedString)(objcObject, attrStr); - - if (result) - objcObject = ret; + typeof(this).alloc.initWithAttributedString(attrStr); + } +`; - dObject = this; - } -} +const TNSExtendedMutableAttributedString = ` -template TNSExtendedMutableAttributedString () -{ NSMutableString mutableString () { return invokeObjcSelf!(NSMutableString, "mutableString"); @@ -211,5 +145,272 @@ { return invokeObjcSelf!(void, "endEditing"); } +`; + +class NSMutableAttributedString : NSAttributedString +{ + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } + + void replaceCharactersInRange (NSRange range, NSString str) + { + return invokeObjcSelf!(void, "replaceCharactersInRange:withString:", NSRange, NSString)(range, str); + } + + void setAttributes (NSDictionary attrs, NSRange range) + { + return invokeObjcSelf!(void, "setAttributes:range:", NSDictionary, NSRange)(attrs, range); + } + + // NSExtendedMutableAttributedString + /*NSMutableString mutableString () + { + return invokeObjcSelf!(NSMutableString, "mutableString"); + }*/ + + void addAttribute (NSString name, Object value, NSRange range) + { + return invokeObjcSelf!(void, "addAttribute:value:range:", NSString, Object, NSRange)(name, value, range); + } + + void addAttributes (NSDictionary attrs, NSRange range) + { + return invokeObjcSelf!(void, "addAttributes:range:", NSDictionary, NSRange)(attrs, range); + } + + void removeAttribute (NSString name, NSRange range) + { + return invokeObjcSelf!(void, "removeAttribute:range:", NSString, NSRange)(name, range); + } + + void replaceCharactersInRange (NSRange range, NSAttributedString attrString) + { + return invokeObjcSelf!(void, "replaceCharactersInRange:withAttributedString:", NSRange, NSAttributedString)(range, attrString); + } + + void insertAttributedString (NSAttributedString attrString, NSUInteger loc) + { + return invokeObjcSelf!(void, "insertAttributedString:atIndex:", NSAttributedString, NSUInteger)(attrString, loc); + } + + void appendAttributedString (NSAttributedString attrString) + { + return invokeObjcSelf!(void, "appendAttributedString:", NSAttributedString)(attrString); + } + + void deleteCharactersInRange (NSRange range) + { + return invokeObjcSelf!(void, "deleteCharactersInRange:", NSRange)(range); + } + + void setAttributedString (NSAttributedString attrString) + { + return invokeObjcSelf!(void, "setAttributedString:", NSAttributedString)(attrString); + } + + /*void beginEditing () + { + return invokeObjcSelf!(void, "beginEditing"); + } + + void endEditing () + { + return invokeObjcSelf!(void, "endEditing"); + }*/ + + // NSMutableAttributedStringKitAdditions + bool readFromURL (NSURL url, NSDictionary opts, ref NSDictionary dict, ref NSError error) + { + id __arg2; + id __arg3; + + if (dict) + __arg2 = dict.objcObject; + + if (error) + __arg3 = error.objcObject; + + bool result = invokeObjcSelf!(bool, "readFromURL:options:documentAttributes:error:", NSURL, NSDictionary, id*, id*)(url, opts, &__arg2, &__arg3); + + if (__arg2) + dict = new NSDictionary(__arg2); + if (__arg3) + error = new NSError(__arg3); + + return result; + } + + bool readFromData (NSData data, NSDictionary opts, ref NSDictionary dict, ref NSError error) + { + id __arg2; + id __arg3; + + if (dict) + __arg2 = dict.objcObject; + + if (error) + __arg3 = error.objcObject; + + bool result = invokeObjcSelf!(bool, "readFromData:options:documentAttributes:error:", NSData, NSDictionary, id*, id*)(data, opts, &__arg2, &__arg3); + + if (__arg2) + dict = new NSDictionary(__arg2); + if (__arg3) + error = new NSError(__arg3); + + return result; + } + + bool readFromURL (NSURL url, NSDictionary options, ref NSDictionary dict) + { + id __arg2; + + if (dict) + __arg2 = dict.objcObject; + + bool result = invokeObjcSelf!(bool, "readFromURL:options:documentAttributes:", NSURL, NSDictionary, id*)(url, options, &__arg2); + + if (__arg2) + dict = new NSDictionary(__arg2); + + return result; + } + + bool readFromData (NSData data, NSDictionary options, ref NSDictionary dict) + { + id __arg2; + + if (dict) + __arg2 = dict.objcObject; + + bool result = invokeObjcSelf!(bool, "readFromData:options:documentAttributes:", NSData, NSDictionary, id*)(data, options, &__arg2); + + if (__arg2) + dict = new NSDictionary(__arg2); + + return result; + } + + void superscriptRange (NSRange range) + { + return invokeObjcSelf!(void, "superscriptRange:", NSRange)(range); + } + + void subscriptRange (NSRange range) + { + return invokeObjcSelf!(void, "subscriptRange:", NSRange)(range); + } + + void unscriptRange (NSRange range) + { + return invokeObjcSelf!(void, "unscriptRange:", NSRange)(range); + } + + void applyFontTraits (uint traitMask, NSRange range) + { + return invokeObjcSelf!(void, "applyFontTraits:range:", uint, NSRange)(traitMask, range); + } + + void setAlignment (uint alignment, NSRange range) + { + return invokeObjcSelf!(void, "setAlignment:range:", uint, NSRange)(alignment, range); + } + + void setBaseWritingDirection (int writingDirection, NSRange range) + { + return invokeObjcSelf!(void, "setBaseWritingDirection:range:", int, NSRange)(writingDirection, range); + } + + void fixAttributesInRange (NSRange range) + { + return invokeObjcSelf!(void, "fixAttributesInRange:", NSRange)(range); + } + + void fixFontAttributeInRange (NSRange range) + { + return invokeObjcSelf!(void, "fixFontAttributeInRange:", NSRange)(range); + } + + void fixParagraphStyleAttributeInRange (NSRange range) + { + return invokeObjcSelf!(void, "fixParagraphStyleAttributeInRange:", NSRange)(range); + } + + void fixAttachmentAttributeInRange (NSRange range) + { + return invokeObjcSelf!(void, "fixAttachmentAttributeInRange:", NSRange)(range); + } + + // NSMutableAttributedStringAttachmentConveniences + void updateAttachmentsFromPath (NSString path) + { + return invokeObjcSelf!(void, "updateAttachmentsFromPath:", NSString)(path); + } } +class NSAttributedString : NSObject, INSCopying, INSMutableCopying, INSCoding +{ + mixin (ObjcWrap); + + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } + + NSString string () + { + return invokeObjcSelf!(NSString, "string"); + } + + NSDictionary attributesAtIndex (NSUInteger location, NSRangePointer range) + { + return invokeObjcSelf!(NSDictionary, "attributesAtIndex:effectiveRange:", NSUInteger, NSRangePointer)(location, range); + } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } + + Object mutableCopyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "mutableCopyWithZone:", NSZone*)(zone); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + Object initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); + } + + this (NSCoder aDecoder) + { + typeof(this).alloc.initWithCoder(aDecoder); + } + + mixin (TNSExtendedAttributedString); + //mixin (TNSAttributedStringAttachmentConveniences); + //mixin (dstep.appkit.NSAttributedString.TNSExtendedAttributedString); + //mixin (dstep.appkit.NSAttributedString.TNSDeprecatedKitAdditions); + //mixin (TNSStringDrawing); + //mixin (dstep.appkit.NSAttributedString.TNSAttributedStringKitAdditions); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSAutoreleasePool.d --- a/dstep/foundation/NSAutoreleasePool.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSAutoreleasePool.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,18 +6,29 @@ */ module dstep.foundation.NSAutoreleasePool; +import dstep.foundation.NSDebug; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; class NSAutoreleasePool : NSObject { - mixin ObjcWrap; - mixin TNSAutoreleasePoolDebugging; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static void addObject (Object anObject) { - return invokeObjcSelfClass!(void, "addObject:", Object)(anObject); + return invokeObjcSuperClass!(void, "addObject:", Object)(anObject); } void addObject (Object anObject) @@ -29,5 +40,61 @@ { return invokeObjcSelf!(void, "drain"); } + + // NSAutoreleasePoolDebugging + static void enableRelease (bool enable) + { + return invokeObjcSuperClass!(void, "enableRelease:", bool)(enable); + } + + static void showPools () + { + return invokeObjcSuperClass!(void, "showPools"); + } + + static void resetTotalAutoreleasedObjects () + { + return invokeObjcSuperClass!(void, "resetTotalAutoreleasedObjects"); + } + + static NSUInteger totalAutoreleasedObjects () + { + return invokeObjcSuperClass!(NSUInteger, "totalAutoreleasedObjects"); + } + + static void enableFreedObjectCheck (bool enable) + { + return invokeObjcSuperClass!(void, "enableFreedObjectCheck:", bool)(enable); + } + + static NSUInteger autoreleasedObjectCount () + { + return invokeObjcSuperClass!(NSUInteger, "autoreleasedObjectCount"); + } + + static NSUInteger topAutoreleasePoolCount () + { + return invokeObjcSuperClass!(NSUInteger, "topAutoreleasePoolCount"); + } + + static NSUInteger poolCountHighWaterMark () + { + return invokeObjcSuperClass!(NSUInteger, "poolCountHighWaterMark"); + } + + static void setPoolCountHighWaterMark (NSUInteger count) + { + return invokeObjcSuperClass!(void, "setPoolCountHighWaterMark:", NSUInteger)(count); + } + + static NSUInteger poolCountHighWaterResolution () + { + return invokeObjcSuperClass!(NSUInteger, "poolCountHighWaterResolution"); + } + + static void setPoolCountHighWaterResolution (NSUInteger res) + { + return invokeObjcSuperClass!(void, "setPoolCountHighWaterResolution:", NSUInteger)(res); + } } diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSBundle.d --- a/dstep/foundation/NSBundle.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSBundle.d Sun Jan 03 22:06:11 2010 +0100 @@ -12,12 +12,33 @@ import dstep.foundation.NSObject; import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + import bindings = dstep.foundation.NSBundle_bindings; -const NSString NSBundleDidLoadNotification; -const NSString NSLoadedClasses; +private +{ + NSString NSBundleDidLoadNotification_; + NSString NSLoadedClasses_; +} + +NSString NSBundleDidLoadNotification () +{ + if (NSBundleDidLoadNotification_) + return NSBundleDidLoadNotification_; + + return NSBundleDidLoadNotification_ = new NSString(bindings.NSBundleDidLoadNotification); +} + +NSString NSLoadedClasses () +{ + if (NSLoadedClasses_) + return NSLoadedClasses_; + + return NSLoadedClasses_ = new NSString(bindings.NSLoadedClasses); +} enum { @@ -27,24 +48,28 @@ NSBundleExecutableArchitecturePPC64 = 0x01000012 } -static this () -{ - NSBundleDidLoadNotification = new NSString(bindings.NSBundleDidLoadNotification); - NSLoadedClasses = new NSString(bindings.NSLoadedClasses); -} - class NSBundle : NSObject { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static NSBundle mainBundle () { - return invokeObjcSelfClass!(NSBundle, "mainBundle"); + return invokeObjcSuperClass!(NSBundle, "mainBundle"); } static NSBundle bundleWithPath (NSString path) { - return invokeObjcSelfClass!(NSBundle, "bundleWithPath:", NSString)(path); + return invokeObjcSuperClass!(NSBundle, "bundleWithPath:", NSString)(path); } Object initWithPath (NSString path) @@ -54,33 +79,27 @@ this (NSString path) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithPath:", NSString)(objcObject, path); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithPath(path); } static NSBundle bundleForClass (Class aClass) { - return invokeObjcSelfClass!(NSBundle, "bundleForClass:", Class)(aClass); + return invokeObjcSuperClass!(NSBundle, "bundleForClass:", Class)(aClass); } static NSBundle bundleWithIdentifier (NSString identifier) { - return invokeObjcSelfClass!(NSBundle, "bundleWithIdentifier:", NSString)(identifier); + return invokeObjcSuperClass!(NSBundle, "bundleWithIdentifier:", NSString)(identifier); } static NSArray allBundles () { - return invokeObjcSelfClass!(NSArray, "allBundles"); + return invokeObjcSuperClass!(NSArray, "allBundles"); } static NSArray allFrameworks () { - return invokeObjcSelfClass!(NSArray, "allFrameworks"); + return invokeObjcSuperClass!(NSArray, "allFrameworks"); } bool load () @@ -98,14 +117,34 @@ return invokeObjcSelf!(bool, "unload"); } - bool preflightAndReturnError (NSError** error) + bool preflightAndReturnError (ref NSError error) { - return invokeObjcSelf!(bool, "preflightAndReturnError:", NSError**)(error); + id err; + + if (error) + err = new objc_object; + + bool result = invokeObjcSelf!(bool, "preflightAndReturnError:", id*)(&err); + + if (err) + error = new NSError(err); + + return result; } - bool loadAndReturnError (NSError** error) + bool loadAndReturnError (ref NSError error) { - return invokeObjcSelf!(bool, "loadAndReturnError:", NSError**)(error); + id err; + + if (error) + err = new objc_object; + + bool result = invokeObjcSelf!(bool, "loadAndReturnError:", id*)(&err); + + if (err) + error = new NSError(err); + + return result; } NSString bundlePath () @@ -165,7 +204,7 @@ static NSString pathForResource (NSString name, NSString ext, NSString bundlePath) { - return invokeObjcSelfClass!(NSString, "pathForResource:ofType:inDirectory:", NSString, NSString, NSString)(name, ext, bundlePath); + return invokeObjcSuperClass!(NSString, "pathForResource:ofType:inDirectory:", NSString, NSString, NSString)(name, ext, bundlePath); } NSString pathForResource (NSString name, NSString ext) @@ -185,7 +224,7 @@ static NSArray pathsForResourcesOfType (NSString ext, NSString bundlePath) { - return invokeObjcSelfClass!(NSArray, "pathsForResourcesOfType:inDirectory:", NSString, NSString)(ext, bundlePath); + return invokeObjcSuperClass!(NSArray, "pathsForResourcesOfType:inDirectory:", NSString, NSString)(ext, bundlePath); } NSArray pathsForResourcesOfType (NSString ext, NSString subpath) @@ -235,12 +274,12 @@ static NSArray preferredLocalizationsFromArray (NSArray localizationsArray) { - return invokeObjcSelfClass!(NSArray, "preferredLocalizationsFromArray:", NSArray)(localizationsArray); + return invokeObjcSuperClass!(NSArray, "preferredLocalizationsFromArray:", NSArray)(localizationsArray); } static NSArray preferredLocalizationsFromArray (NSArray localizationsArray, NSArray preferencesArray) { - return invokeObjcSelfClass!(NSArray, "preferredLocalizationsFromArray:forPreferences:", NSArray, NSArray)(localizationsArray, preferencesArray); + return invokeObjcSuperClass!(NSArray, "preferredLocalizationsFromArray:forPreferences:", NSArray, NSArray)(localizationsArray, preferencesArray); } NSArray executableArchitectures () diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSBundle_bindings.d --- a/dstep/foundation/NSBundle_bindings.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSBundle_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,7 +6,9 @@ import dstep.foundation.NSObject; import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + extern (C) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSByteOrder.d --- a/dstep/foundation/NSByteOrder.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSByteOrder.d Sun Jan 03 22:06:11 2010 +0100 @@ -9,10 +9,7 @@ import dstep.corefoundation.CFByteOrder; import dstep.foundation.NSObjCRuntime; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; - -alias {unsigned int v;} NSSwappedFloat; -alias {unsigned long long v;} NSSwappedDouble; +import dstep.objc.objc; enum { @@ -26,3 +23,7 @@ uint v; } +struct NSSwappedDouble +{ + ulong v; +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSCalendar.d --- a/dstep/foundation/NSCalendar.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSCalendar.d Sun Jan 03 22:06:11 2010 +0100 @@ -7,15 +7,17 @@ module dstep.foundation.NSCalendar; import dstep.corefoundation.CFCalendar; +import dstep.foundation.NSCoder; import dstep.foundation.NSDate; -import dstep.foundation.NSDateComponents; import dstep.foundation.NSLocale; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; import dstep.foundation.NSRange; import dstep.foundation.NSString; import dstep.foundation.NSTimeZone; +import dstep.foundation.NSZone; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; alias NSUInteger NSCalendarUnit; @@ -45,7 +47,17 @@ class NSDateComponents : NSObject, INSCopying, INSCoding { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } NSInteger era () { @@ -164,28 +176,32 @@ this (NSCoder aDecoder) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithCoder(aDecoder); } } class NSCalendar : NSObject, INSCopying, INSCoding { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static Object currentCalendar () { - return invokeObjcSelfClass!(Object, "currentCalendar"); + return invokeObjcSuperClass!(Object, "currentCalendar"); } static Object autoupdatingCurrentCalendar () { - return invokeObjcSelfClass!(Object, "autoupdatingCurrentCalendar"); + return invokeObjcSuperClass!(Object, "autoupdatingCurrentCalendar"); } Object initWithCalendarIdentifier (NSString ident) @@ -195,13 +211,7 @@ this (NSString ident) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCalendarIdentifier:", NSString)(objcObject, ident); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithCalendarIdentifier(ident); } NSString calendarIdentifier () @@ -269,9 +279,15 @@ return invokeObjcSelf!(NSUInteger, "ordinalityOfUnit:inUnit:forDate:", uint, uint, NSDate)(smaller, larger, date); } - bool rangeOfUnit (uint unit, NSDate** datep, NSTimeInterval* tip, NSDate date) + bool rangeOfUnit (uint unit, out NSDate datep, NSTimeInterval* tip, NSDate date) { - return invokeObjcSelf!(bool, "rangeOfUnit:startDate:interval:forDate:", uint, NSDate**, NSTimeInterval*, NSDate)(unit, datep, tip, date); + id d = new objc_object; + bool result = invokeObjcSelf!(bool, "rangeOfUnit:startDate:interval:forDate:", uint, id*, NSTimeInterval*, NSDate)(unit, &d, tip, date); + + if (d) + datep = new NSDate(d); + + return result; } NSDate dateFromComponents (NSDateComponents comps) @@ -311,13 +327,7 @@ this (NSCoder aDecoder) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithCoder(aDecoder); } } diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSCalendarDate.d --- a/dstep/foundation/NSCalendarDate.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSCalendarDate.d Sun Jan 03 22:06:11 2010 +0100 @@ -8,33 +8,90 @@ import dstep.foundation.NSArray; import dstep.foundation.NSDate; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSString; import dstep.foundation.NSTimeZone; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + +const TNSNaturalLangage = ` + + static Object dateWithNaturalLanguageString (NSString string) + { + return invokeObjcSuperClass!(Object, "dateWithNaturalLanguageString:", NSString)(string); + } + + static Object dateWithNaturalLanguageString (NSString string, Object locale) + { + return invokeObjcSuperClass!(Object, "dateWithNaturalLanguageString:locale:", NSString, Object)(string, locale); + } +`; + +const TNSCalendarDateExtras = ` + + static Object dateWithString (NSString aString) + { + return invokeObjcSuperClass!(Object, "dateWithString:", NSString)(aString); + } + + Object initWithString (NSString description) + { + return invokeObjcSelf!(Object, "initWithString:", NSString)(description); + } + + this (NSString description) + { + typeof(this).alloc.initWithString(description); + } + + NSCalendarDate dateWithCalendarFormat (NSString format, NSTimeZone aTimeZone) + { + return invokeObjcSelf!(NSCalendarDate, "dateWithCalendarFormat:timeZone:", NSString, NSTimeZone)(format, aTimeZone); + } + + NSString descriptionWithLocale (Object locale) + { + return invokeObjcSelf!(NSString, "descriptionWithLocale:", Object)(locale); + } + + NSString descriptionWithCalendarFormat (NSString format, NSTimeZone aTimeZone, Object locale) + { + return invokeObjcSelf!(NSString, "descriptionWithCalendarFormat:timeZone:locale:", NSString, NSTimeZone, Object)(format, aTimeZone, locale); + } +`; class NSCalendarDate : NSDate { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static Object dateWithYear (NSInteger year, NSUInteger month, NSUInteger day, NSUInteger hour, NSUInteger minute, NSUInteger second, NSTimeZone aTimeZone) { - return invokeObjcSelfClass!(Object, "dateWithYear:month:day:hour:minute:second:timeZone:", NSInteger, NSUInteger, NSUInteger, NSUInteger, NSUInteger, NSUInteger, NSTimeZone)(year, month, day, hour, minute, second, aTimeZone); + return invokeObjcSuperClass!(Object, "dateWithYear:month:day:hour:minute:second:timeZone:", NSInteger, NSUInteger, NSUInteger, NSUInteger, NSUInteger, NSUInteger, NSTimeZone)(year, month, day, hour, minute, second, aTimeZone); } static Object dateWithString (NSString description, NSString format) { - return invokeObjcSelfClass!(Object, "dateWithString:calendarFormat:", NSString, NSString)(description, format); + return invokeObjcSuperClass!(Object, "dateWithString:calendarFormat:", NSString, NSString)(description, format); } static Object dateWithString (NSString description, NSString format, Object locale) { - return invokeObjcSelfClass!(Object, "dateWithString:calendarFormat:locale:", NSString, NSString, Object)(description, format, locale); + return invokeObjcSuperClass!(Object, "dateWithString:calendarFormat:locale:", NSString, NSString, Object)(description, format, locale); } static Object calendarDate () { - return invokeObjcSelfClass!(Object, "calendarDate"); + return invokeObjcSuperClass!(Object, "calendarDate"); } Object initWithYear (NSInteger year, NSUInteger month, NSUInteger day, NSUInteger hour, NSUInteger minute, NSUInteger second, NSTimeZone aTimeZone) @@ -44,13 +101,7 @@ this (NSInteger year, NSUInteger month, NSUInteger day, NSUInteger hour, NSUInteger minute, NSUInteger second, NSTimeZone aTimeZone) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithYear:month:day:hour:minute:second:timeZone:", NSInteger, NSUInteger, NSUInteger, NSUInteger, NSUInteger, NSUInteger, NSTimeZone)(objcObject, year, month, day, hour, minute, second, aTimeZone); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithYear(year, month, day, hour, minute, second, aTimeZone); } Object initWithString (NSString description) @@ -60,13 +111,7 @@ this (NSString description) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithString:", NSString)(objcObject, description); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithString(description); } Object initWithString (NSString description, NSString format) @@ -76,13 +121,7 @@ this (NSString description, NSString format) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithString:calendarFormat:", NSString, NSString)(objcObject, description, format); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithString(description, format); } Object initWithString (NSString description, NSString format, Object locale) @@ -92,13 +131,7 @@ this (NSString description, NSString format, Object locale) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithString:calendarFormat:locale:", NSString, NSString, Object)(objcObject, description, format, locale); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithString(description, format, locale); } NSTimeZone timeZone () @@ -196,57 +229,4 @@ { return invokeObjcSelf!(NSString, "descriptionWithCalendarFormat:locale:", NSString, Object)(format, locale); } -} - -template TNSNaturalLangage () -{ - static Object dateWithNaturalLanguageString (NSString string) - { - return invokeObjcSelfClass!(Object, "dateWithNaturalLanguageString:", NSString)(string); - } - - static Object dateWithNaturalLanguageString (NSString string, Object locale) - { - return invokeObjcSelfClass!(Object, "dateWithNaturalLanguageString:locale:", NSString, Object)(string, locale); - } -} - -template TNSCalendarDateExtras () -{ - static Object dateWithString (NSString aString) - { - return invokeObjcSelfClass!(Object, "dateWithString:", NSString)(aString); - } - - Object initWithString (NSString description) - { - return invokeObjcSelf!(Object, "initWithString:", NSString)(description); - } - - this (NSString description) - { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithString:", NSString)(objcObject, description); - - if (result) - objcObject = ret; - - dObject = this; - } - - NSCalendarDate dateWithCalendarFormat (NSString format, NSTimeZone aTimeZone) - { - return invokeObjcSelf!(NSCalendarDate, "dateWithCalendarFormat:timeZone:", NSString, NSTimeZone)(format, aTimeZone); - } - - NSString descriptionWithLocale (Object locale) - { - return invokeObjcSelf!(NSString, "descriptionWithLocale:", Object)(locale); - } - - NSString descriptionWithCalendarFormat (NSString format, NSTimeZone aTimeZone, Object locale) - { - return invokeObjcSelf!(NSString, "descriptionWithCalendarFormat:timeZone:locale:", NSString, NSTimeZone, Object)(format, aTimeZone, locale); - } -} - +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSCharacterSet.d --- a/dstep/foundation/NSCharacterSet.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSCharacterSet.d Sun Jan 03 22:06:11 2010 +0100 @@ -7,12 +7,14 @@ module dstep.foundation.NSCharacterSet; import dstep.corefoundation.CFCharacterSet; +import dstep.foundation.NSCoder; import dstep.foundation.NSData; import dstep.foundation.NSObject; import dstep.foundation.NSRange; import dstep.foundation.NSString; +import dstep.foundation.NSZone; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; enum { @@ -21,101 +23,111 @@ class NSCharacterSet : NSObject, INSCopying, INSMutableCopying, INSCoding { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static Object controlCharacterSet () { - return invokeObjcSelfClass!(Object, "controlCharacterSet"); + return invokeObjcSuperClass!(Object, "controlCharacterSet"); } static Object whitespaceCharacterSet () { - return invokeObjcSelfClass!(Object, "whitespaceCharacterSet"); + return invokeObjcSuperClass!(Object, "whitespaceCharacterSet"); } static Object whitespaceAndNewlineCharacterSet () { - return invokeObjcSelfClass!(Object, "whitespaceAndNewlineCharacterSet"); + return invokeObjcSuperClass!(Object, "whitespaceAndNewlineCharacterSet"); } static Object decimalDigitCharacterSet () { - return invokeObjcSelfClass!(Object, "decimalDigitCharacterSet"); + return invokeObjcSuperClass!(Object, "decimalDigitCharacterSet"); } static Object letterCharacterSet () { - return invokeObjcSelfClass!(Object, "letterCharacterSet"); + return invokeObjcSuperClass!(Object, "letterCharacterSet"); } static Object lowercaseLetterCharacterSet () { - return invokeObjcSelfClass!(Object, "lowercaseLetterCharacterSet"); + return invokeObjcSuperClass!(Object, "lowercaseLetterCharacterSet"); } static Object uppercaseLetterCharacterSet () { - return invokeObjcSelfClass!(Object, "uppercaseLetterCharacterSet"); + return invokeObjcSuperClass!(Object, "uppercaseLetterCharacterSet"); } static Object nonBaseCharacterSet () { - return invokeObjcSelfClass!(Object, "nonBaseCharacterSet"); + return invokeObjcSuperClass!(Object, "nonBaseCharacterSet"); } static Object alphanumericCharacterSet () { - return invokeObjcSelfClass!(Object, "alphanumericCharacterSet"); + return invokeObjcSuperClass!(Object, "alphanumericCharacterSet"); } static Object decomposableCharacterSet () { - return invokeObjcSelfClass!(Object, "decomposableCharacterSet"); + return invokeObjcSuperClass!(Object, "decomposableCharacterSet"); } static Object illegalCharacterSet () { - return invokeObjcSelfClass!(Object, "illegalCharacterSet"); + return invokeObjcSuperClass!(Object, "illegalCharacterSet"); } static Object punctuationCharacterSet () { - return invokeObjcSelfClass!(Object, "punctuationCharacterSet"); + return invokeObjcSuperClass!(Object, "punctuationCharacterSet"); } static Object capitalizedLetterCharacterSet () { - return invokeObjcSelfClass!(Object, "capitalizedLetterCharacterSet"); + return invokeObjcSuperClass!(Object, "capitalizedLetterCharacterSet"); } static Object symbolCharacterSet () { - return invokeObjcSelfClass!(Object, "symbolCharacterSet"); + return invokeObjcSuperClass!(Object, "symbolCharacterSet"); } static Object newlineCharacterSet () { - return invokeObjcSelfClass!(Object, "newlineCharacterSet"); + return invokeObjcSuperClass!(Object, "newlineCharacterSet"); } static Object characterSetWithRange (NSRange aRange) { - return invokeObjcSelfClass!(Object, "characterSetWithRange:", NSRange)(aRange); + return invokeObjcSuperClass!(Object, "characterSetWithRange:", NSRange)(aRange); } static Object characterSetWithCharactersInString (NSString aString) { - return invokeObjcSelfClass!(Object, "characterSetWithCharactersInString:", NSString)(aString); + return invokeObjcSuperClass!(Object, "characterSetWithCharactersInString:", NSString)(aString); } static Object characterSetWithBitmapRepresentation (NSData data) { - return invokeObjcSelfClass!(Object, "characterSetWithBitmapRepresentation:", NSData)(data); + return invokeObjcSuperClass!(Object, "characterSetWithBitmapRepresentation:", NSData)(data); } static Object characterSetWithContentsOfFile (NSString fName) { - return invokeObjcSelfClass!(Object, "characterSetWithContentsOfFile:", NSString)(fName); + return invokeObjcSuperClass!(Object, "characterSetWithContentsOfFile:", NSString)(fName); } bool characterIsMember (ushort aCharacter) @@ -171,19 +183,23 @@ this (NSCoder aDecoder) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithCoder(aDecoder); } } class NSMutableCharacterSet : NSCharacterSet, INSCopying, INSMutableCopying { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } void addCharactersInRange (NSRange aRange) { diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSClassDescription.d --- a/dstep/foundation/NSClassDescription.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSClassDescription.d Sun Jan 03 22:06:11 2010 +0100 @@ -12,34 +12,83 @@ import dstep.foundation.NSObject; import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + import bindings = dstep.foundation.NSClassDescription_bindings; -NSString NSClassDescriptionNeededForClassNotification; +private NSString NSClassDescriptionNeededForClassNotification_; + +NSString NSClassDescriptionNeededForClassNotification () +{ + if (NSClassDescriptionNeededForClassNotification_) + return NSClassDescriptionNeededForClassNotification_; + + return NSClassDescriptionNeededForClassNotification_ = new NSString(bindings.NSClassDescriptionNeededForClassNotification); +} + +const TNSClassDescriptionPrimitives = ` -static this () -{ - NSClassDescriptionNeededForClassNotification = new NSString(bindings.NSClassDescriptionNeededForClassNotification); -} + NSClassDescription classDescription () + { + return invokeObjcSelf!(NSClassDescription, "classDescription"); + } + + NSArray attributeKeys () + { + return invokeObjcSelf!(NSArray, "attributeKeys"); + } + + NSArray toOneRelationshipKeys () + { + return invokeObjcSelf!(NSArray, "toOneRelationshipKeys"); + } + + NSArray toManyRelationshipKeys () + { + return invokeObjcSelf!(NSArray, "toManyRelationshipKeys"); + } + + NSString inverseForRelationshipKey (NSString relationshipKey) + { + return invokeObjcSelf!(NSString, "inverseForRelationshipKey:", NSString)(relationshipKey); + } + + //mixin ObjcBindMethod!(classDescription, "classDescription"); + //mixin ObjcBindMethod!(attributeKeys, "attributeKeys"); + //mixin ObjcBindMethod!(toOneRelationshipKeys, "toOneRelationshipKeys"); + //mixin ObjcBindMethod!(toManyRelationshipKeys, "toManyRelationshipKeys"); + //mixin ObjcBindMethod!(inverseForRelationshipKey, "inverseForRelationshipKey:"); +`; class NSClassDescription : NSObject { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static void registerClassDescription (NSClassDescription description, Class aClass) { - return invokeObjcSelfClass!(void, "registerClassDescription:forClass:", NSClassDescription, Class)(description, aClass); + return invokeObjcSuperClass!(void, "registerClassDescription:forClass:", NSClassDescription, Class)(description, aClass); } static void invalidateClassDescriptionCache () { - return invokeObjcSelfClass!(void, "invalidateClassDescriptionCache"); + return invokeObjcSuperClass!(void, "invalidateClassDescriptionCache"); } static NSClassDescription classDescriptionForClass (Class aClass) { - return invokeObjcSelfClass!(NSClassDescription, "classDescriptionForClass:", Class)(aClass); + return invokeObjcSuperClass!(NSClassDescription, "classDescriptionForClass:", Class)(aClass); } NSArray attributeKeys () @@ -61,14 +110,4 @@ { return invokeObjcSelf!(NSString, "inverseForRelationshipKey:", NSString)(relationshipKey); } -} - -template TNSClassDescriptionPrimitives () -{ - NSClassDescription classDescription (); - NSArray attributeKeys (); - NSArray toOneRelationshipKeys (); - NSArray toManyRelationshipKeys (); - NSString inverseForRelationshipKey (NSString relationshipKey); -} - +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSClassDescription_bindings.d --- a/dstep/foundation/NSClassDescription_bindings.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSClassDescription_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,7 +6,9 @@ import dstep.foundation.NSObject; import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + extern (C) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSCoder.d --- a/dstep/foundation/NSCoder.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSCoder.d Sun Jan 03 22:06:11 2010 +0100 @@ -7,47 +7,19 @@ module dstep.foundation.NSCoder; import dstep.foundation.NSData; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSKeyedArchiver; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; import dstep.foundation.NSString; +import dstep.foundation.NSZone; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; - -class NSCoder : NSObject -{ - mixin ObjcWrap; - mixin TNSGeometryCoding; - mixin TNSExtendedCoder; - mixin TNSTypedstreamCompatibility; - mixin TNSGeometryKeyedCoding; - - void encodeValueOfObjCType (char* type, void* addr) - { - return invokeObjcSelf!(void, "encodeValueOfObjCType:at:", char*, void*)(type, addr); - } +import dstep.objc.objc; - void encodeDataObject (NSData data) - { - return invokeObjcSelf!(void, "encodeDataObject:", NSData)(data); - } - - void decodeValueOfObjCType (char* type, void* data) - { - return invokeObjcSelf!(void, "decodeValueOfObjCType:at:", char*, void*)(type, data); - } +import bindings = dstep.foundation.NSCoder_bindings; - NSData decodeDataObject () - { - return invokeObjcSelf!(NSData, "decodeDataObject"); - } +const TNSExtendedCoder = ` - NSInteger versionForClassName (NSString className) - { - return invokeObjcSelf!(NSInteger, "versionForClassName:", NSString)(className); - } -} - -template TNSExtendedCoder () -{ void encodeObject (Object object) { return invokeObjcSelf!(void, "encodeObject:", Object)(object); @@ -237,10 +209,10 @@ { return invokeObjcSelf!(NSInteger, "decodeIntegerForKey:", NSString)(key); } -} +`; -template TNSTypedstreamCompatibility () -{ +const TNSTypedstreamCompatibility = ` + void encodeNXObject (Object object) { return invokeObjcSelf!(void, "encodeNXObject:", Object)(object); @@ -250,10 +222,286 @@ { return invokeObjcSelf!(Object, "decodeNXObject"); } +`; + +class NSCoder : NSObject +{ + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + NSCoder init () + { + return invokeObjcSelf!(NSCoder, "init"); + } + + void encodeValueOfObjCType (char* type, void* addr) + { + return invokeObjcSelf!(void, "encodeValueOfObjCType:at:", char*, void*)(type, addr); + } + + void encodeDataObject (NSData data) + { + return invokeObjcSelf!(void, "encodeDataObject:", NSData)(data); + } + + void decodeValueOfObjCType (char* type, void* data) + { + return invokeObjcSelf!(void, "decodeValueOfObjCType:at:", char*, void*)(type, data); + } + + NSData decodeDataObject () + { + return invokeObjcSelf!(NSData, "decodeDataObject"); + } + + NSInteger versionForClassName (NSString className) + { + return invokeObjcSelf!(NSInteger, "versionForClassName:", NSString)(className); + } + + + // TNSGeometryCoding + void encodePoint (NSPoint point) + { + return invokeObjcSelf!(void, "encodePoint:", NSPoint)(point); + } + + NSPoint decodePoint () + { + return invokeObjcSelf!(NSPoint, "decodePoint"); + } + + void encodeSize (NSSize size) + { + return invokeObjcSelf!(void, "encodeSize:", NSSize)(size); + } + + NSSize decodeSize () + { + return invokeObjcSelf!(NSSize, "decodeSize"); + } + + void encodeRect (NSRect rect) + { + return invokeObjcSelf!(void, "encodeRect:", NSRect)(rect); + } + + NSRect decodeRect () + { + return invokeObjcSelf!(NSRect, "decodeRect"); + } + + // TNSExtendedCoder + void encodeObject (Object object) + { + return invokeObjcSelf!(void, "encodeObject:", Object)(object); + } + + void encodePropertyList (Object aPropertyList) + { + return invokeObjcSelf!(void, "encodePropertyList:", Object)(aPropertyList); + } + + void encodeRootObject (Object rootObject) + { + return invokeObjcSelf!(void, "encodeRootObject:", Object)(rootObject); + } + + void encodeBycopyObject (Object anObject) + { + return invokeObjcSelf!(void, "encodeBycopyObject:", Object)(anObject); + } + + void encodeByrefObject (Object anObject) + { + return invokeObjcSelf!(void, "encodeByrefObject:", Object)(anObject); + } + + void encodeConditionalObject (Object object) + { + return invokeObjcSelf!(void, "encodeConditionalObject:", Object)(object); + } + + void encodeValuesOfObjCTypes (char* encodeValuesOfObjCTypes, ...) + { + return invokeObjcSelf!(void, "encodeValuesOfObjCTypes:", char*)(encodeValuesOfObjCTypes); + } + + void encodeArrayOfObjCType (char* type, NSUInteger count, void* array) + { + return invokeObjcSelf!(void, "encodeArrayOfObjCType:count:at:", char*, NSUInteger, void*)(type, count, array); + } + + void encodeBytes (void* byteaddr, NSUInteger length) + { + return invokeObjcSelf!(void, "encodeBytes:length:", void*, NSUInteger)(byteaddr, length); + } + + Object decodeObject () + { + return invokeObjcSelf!(Object, "decodeObject"); + } + + Object decodePropertyList () + { + return invokeObjcSelf!(Object, "decodePropertyList"); + } + + void decodeValuesOfObjCTypes (char* decodeValuesOfObjCTypes, ...) + { + return invokeObjcSelf!(void, "decodeValuesOfObjCTypes:", char*)(decodeValuesOfObjCTypes); + } + + void decodeArrayOfObjCType (char* itemType, NSUInteger count, void* array) + { + return invokeObjcSelf!(void, "decodeArrayOfObjCType:count:at:", char*, NSUInteger, void*)(itemType, count, array); + } + + void* decodeBytesWithReturnedLength (NSUInteger* lengthp) + { + return invokeObjcSelf!(void*, "decodeBytesWithReturnedLength:", NSUInteger*)(lengthp); + } + + void setObjectZone (NSZone* zone) + { + return invokeObjcSelf!(void, "setObjectZone:", NSZone*)(zone); + } + + NSZone* objectZone () + { + return invokeObjcSelf!(NSZone*, "objectZone"); + } + + uint systemVersion () + { + return invokeObjcSelf!(uint, "systemVersion"); + } + + bool allowsKeyedCoding () + { + return invokeObjcSelf!(bool, "allowsKeyedCoding"); + } + + void encodeObject (Object objv, NSString key) + { + return invokeObjcSelf!(void, "encodeObject:forKey:", Object, NSString)(objv, key); + } + + void encodeConditionalObject (Object objv, NSString key) + { + return invokeObjcSelf!(void, "encodeConditionalObject:forKey:", Object, NSString)(objv, key); + } + + void encodeBool (bool boolv, NSString key) + { + return invokeObjcSelf!(void, "encodeBool:forKey:", bool, NSString)(boolv, key); + } + + void encodeInt (int intv, NSString key) + { + return invokeObjcSelf!(void, "encodeInt:forKey:", int, NSString)(intv, key); + } + + void encodeInt32 (int intv, NSString key) + { + return invokeObjcSelf!(void, "encodeInt32:forKey:", int, NSString)(intv, key); + } + + void encodeInt64 (long intv, NSString key) + { + return invokeObjcSelf!(void, "encodeInt64:forKey:", long, NSString)(intv, key); + } + + void encodeFloat (float realv, NSString key) + { + return invokeObjcSelf!(void, "encodeFloat:forKey:", float, NSString)(realv, key); + } + + void encodeDouble (double realv, NSString key) + { + return invokeObjcSelf!(void, "encodeDouble:forKey:", double, NSString)(realv, key); + } + + void encodeBytes (char* bytesp, NSUInteger lenv, NSString key) + { + return invokeObjcSelf!(void, "encodeBytes:length:forKey:", char*, NSUInteger, NSString)(bytesp, lenv, key); + } + + bool containsValueForKey (NSString key) + { + return invokeObjcSelf!(bool, "containsValueForKey:", NSString)(key); + } + + Object decodeObjectForKey (NSString key) + { + return invokeObjcSelf!(Object, "decodeObjectForKey:", NSString)(key); + } + + bool decodeBoolForKey (NSString key) + { + return invokeObjcSelf!(bool, "decodeBoolForKey:", NSString)(key); + } + + int decodeIntForKey (NSString key) + { + return invokeObjcSelf!(int, "decodeIntForKey:", NSString)(key); + } + + int decodeInt32ForKey (NSString key) + { + return invokeObjcSelf!(int, "decodeInt32ForKey:", NSString)(key); + } + + long decodeInt64ForKey (NSString key) + { + return invokeObjcSelf!(long, "decodeInt64ForKey:", NSString)(key); + } + + float decodeFloatForKey (NSString key) + { + return invokeObjcSelf!(float, "decodeFloatForKey:", NSString)(key); + } + + double decodeDoubleForKey (NSString key) + { + return invokeObjcSelf!(double, "decodeDoubleForKey:", NSString)(key); + } + + char* decodeBytesForKey (NSString key, NSUInteger* lengthp) + { + return invokeObjcSelf!(char*, "decodeBytesForKey:returnedLength:", NSString, NSUInteger*)(key, lengthp); + } + + void encodeInteger (NSInteger intv, NSString key) + { + return invokeObjcSelf!(void, "encodeInteger:forKey:", NSInteger, NSString)(intv, key); + } + + NSInteger decodeIntegerForKey (NSString key) + { + return invokeObjcSelf!(NSInteger, "decodeIntegerForKey:", NSString)(key); + } + + // TNSTypedstreamCompatibility + void encodeNXObject (Object object) + { + return invokeObjcSelf!(void, "encodeNXObject:", Object)(object); + } + + Object decodeNXObject () + { + return invokeObjcSelf!(Object, "decodeNXObject"); + } } NSObject NXReadNSObjectFromCoder (NSCoder decoder) { - return Bridge.invokeObjcFunction!(NSObject, bindings.NXReadNSObjectFromCoder, NSCoder)(decoder); -} - + //return Bridge.invokeObjcFunction!(NSObject, bindings.NXReadNSObjectFromCoder, NSCoder)(decoder); + + id result = bindings.NXReadNSObjectFromCoder(decoder ? decoder.objcObject : null); + return result ? new NSObject(result) : null; +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSCoder_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSCoder_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,14 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Aug 13, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.foundation.NSCoder_bindings; + +import dstep.objc.objc; + +extern (C): +public: + +id NXReadNSObjectFromCoder (id decoder); \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSComparisonPredicate.d --- a/dstep/foundation/NSComparisonPredicate.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSComparisonPredicate.d Sun Jan 03 22:06:11 2010 +0100 @@ -7,10 +7,10 @@ module dstep.foundation.NSComparisonPredicate; import dstep.foundation.NSExpression; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSPredicate; -import dstep.foundation.NSPredicateOperator; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; alias NSUInteger NSComparisonPredicateModifier; alias NSUInteger NSPredicateOperatorType; @@ -48,16 +48,26 @@ class NSComparisonPredicate : NSPredicate { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static NSPredicate predicateWithLeftExpression (NSExpression lhs, NSExpression rhs, uint modifier, uint type, NSUInteger options) { - return invokeObjcSelfClass!(NSPredicate, "predicateWithLeftExpression:rightExpression:modifier:type:options:", NSExpression, NSExpression, uint, uint, NSUInteger)(lhs, rhs, modifier, type, options); + return invokeObjcSuperClass!(NSPredicate, "predicateWithLeftExpression:rightExpression:modifier:type:options:", NSExpression, NSExpression, uint, uint, NSUInteger)(lhs, rhs, modifier, type, options); } static NSPredicate predicateWithLeftExpression (NSExpression lhs, NSExpression rhs, SEL selector) { - return invokeObjcSelfClass!(NSPredicate, "predicateWithLeftExpression:rightExpression:customSelector:", NSExpression, NSExpression, SEL)(lhs, rhs, selector); + return invokeObjcSuperClass!(NSPredicate, "predicateWithLeftExpression:rightExpression:customSelector:", NSExpression, NSExpression, SEL)(lhs, rhs, selector); } Object initWithLeftExpression (NSExpression lhs, NSExpression rhs, uint modifier, uint type, NSUInteger options) @@ -67,13 +77,7 @@ this (NSExpression lhs, NSExpression rhs, uint modifier, uint type, NSUInteger options) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithLeftExpression:rightExpression:modifier:type:options:", NSExpression, NSExpression, uint, uint, NSUInteger)(objcObject, lhs, rhs, modifier, type, options); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithLeftExpression(lhs, rhs, modifier, type, options); } Object initWithLeftExpression (NSExpression lhs, NSExpression rhs, SEL selector) @@ -83,13 +87,7 @@ this (NSExpression lhs, NSExpression rhs, SEL selector) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithLeftExpression:rightExpression:customSelector:", NSExpression, NSExpression, SEL)(objcObject, lhs, rhs, selector); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithLeftExpression(lhs, rhs, selector); } uint predicateOperatorType () diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSCompoundPredicate.d --- a/dstep/foundation/NSCompoundPredicate.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSCompoundPredicate.d Sun Jan 03 22:06:11 2010 +0100 @@ -7,9 +7,10 @@ module dstep.foundation.NSCompoundPredicate; import dstep.foundation.NSArray; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSPredicate; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; alias NSUInteger NSCompoundPredicateType; @@ -22,7 +23,17 @@ class NSCompoundPredicate : NSPredicate { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } Object initWithType (uint type, NSArray subpredicates) { @@ -31,13 +42,7 @@ this (uint type, NSArray subpredicates) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithType:subpredicates:", uint, NSArray)(objcObject, type, subpredicates); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithType(type, subpredicates); } uint compoundPredicateType () @@ -52,17 +57,17 @@ static NSPredicate andPredicateWithSubpredicates (NSArray subpredicates) { - return invokeObjcSelfClass!(NSPredicate, "andPredicateWithSubpredicates:", NSArray)(subpredicates); + return invokeObjcSuperClass!(NSPredicate, "andPredicateWithSubpredicates:", NSArray)(subpredicates); } static NSPredicate orPredicateWithSubpredicates (NSArray subpredicates) { - return invokeObjcSelfClass!(NSPredicate, "orPredicateWithSubpredicates:", NSArray)(subpredicates); + return invokeObjcSuperClass!(NSPredicate, "orPredicateWithSubpredicates:", NSArray)(subpredicates); } static NSPredicate notPredicateWithSubpredicate (NSPredicate predicate) { - return invokeObjcSelfClass!(NSPredicate, "notPredicateWithSubpredicate:", NSPredicate)(predicate); + return invokeObjcSuperClass!(NSPredicate, "notPredicateWithSubpredicate:", NSPredicate)(predicate); } } diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSConnection.d --- a/dstep/foundation/NSConnection.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSConnection.d Sun Jan 03 22:06:11 2010 +0100 @@ -12,32 +12,114 @@ import dstep.foundation.NSDictionary; import dstep.foundation.NSDistantObject; import dstep.foundation.NSException; -import dstep.foundation.NSMutableData; +import dstep.foundation.NSInvocation; import dstep.foundation.NSObject; import dstep.foundation.NSPort; import dstep.foundation.NSPortNameServer; import dstep.foundation.NSRunLoop; +import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; import bindings = dstep.foundation.NSConnection_bindings; -const NSString NSConnectionReplyMode; -const NSString NSConnectionDidDieNotification; -const NSString NSFailedAuthenticationException; -const NSString NSConnectionDidInitializeNotification; +private +{ + NSString NSConnectionReplyMode_; + NSString NSConnectionDidDieNotification_; + NSString NSFailedAuthenticationException_; + NSString NSConnectionDidInitializeNotification_; +} + +NSString NSConnectionReplyMode () +{ + if (NSConnectionReplyMode_) + return NSConnectionReplyMode_; + + return NSConnectionReplyMode_ = new NSString(bindings.NSConnectionReplyMode); +} + +NSString NSConnectionDidDieNotification () +{ + if (NSConnectionDidDieNotification_) + return NSConnectionDidDieNotification_; + + return NSConnectionDidDieNotification_ = new NSString(bindings.NSConnectionDidDieNotification); +} + +NSString NSFailedAuthenticationException () +{ + if (NSFailedAuthenticationException_) + return NSFailedAuthenticationException_; + + return NSFailedAuthenticationException_ = new NSString(bindings.NSFailedAuthenticationException); +} + +NSString NSConnectionDidInitializeNotification () +{ + if (NSConnectionDidInitializeNotification_) + return NSConnectionDidInitializeNotification_; + + return NSConnectionDidInitializeNotification_ = new NSString(bindings.NSConnectionDidInitializeNotification); +} + +const TNSDistantObjectRequestMethods = ` -static this () -{ - NSConnectionReplyMode = new NSString(bindings.NSConnectionReplyMode); - NSConnectionDidDieNotification = new NSString(bindings.NSConnectionDidDieNotification); - NSFailedAuthenticationException = new NSString(bindings.NSFailedAuthenticationException); - NSConnectionDidInitializeNotification = new NSString(bindings.NSConnectionDidInitializeNotification); -} + bool connection (NSConnection connection, NSDistantObjectRequest doreq) + { + return invokeObjcSelf!(bool, "connection:handleRequest:", NSConnection, NSDistantObjectRequest)(connection, doreq); + } + + //mixin ObjcBindMethod!(connection, "connection:handleRequest:"); +`; + +const TNSConnectionDelegateMethods = ` + + bool makeNewConnection (NSConnection conn, NSConnection ancestor) + { + return invokeObjcSelf!(bool, "makeNewConnection:sender:")(conn, ancestor); + } + + bool connection (NSConnection ancestor, NSConnection conn) + { + return invokeObjcSelf!(bool, "connection:shouldMakeNewConnection:", NSConnection, NSConnection)(ancestor, conn); + } + + NSData authenticationDataForComponents (NSArray components) + { + return invokeObjcSelf!(NSData, "authenticationDataForComponents:", NSArray)(components); + } + + bool authenticateComponents (NSArray components, NSData signature) + { + return invokeObjcSelf!(bool, "authenticateComponents:withData:")(components, signature); + } + + Object createConversationForConnection (NSConnection conn) + { + return invokeObjcSelf!(Object, "createConversationForConnection:")(conn); + } + + //mixin ObjcBindMethod!(makeNewConnection, "makeNewConnection:sender:"); + //mixin ObjcBindMethod!(connection, "connection:shouldMakeNewConnection:"); + //mixin ObjcBindMethod!(authenticationDataForComponents, "authenticationDataForComponents:"); + //mixin ObjcBindMethod!(authenticateComponents, "authenticateComponents:withData:"); + //mixin ObjcBindMethod!(createConversationForConnection, "createConversationForConnection:"); +`; class NSDistantObjectRequest : NSObject { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } NSInvocation invocation () { @@ -62,7 +144,17 @@ class NSConnection : NSObject { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } NSDictionary statistics () { @@ -71,42 +163,42 @@ static NSArray allConnections () { - return invokeObjcSelfClass!(NSArray, "allConnections"); + return invokeObjcSuperClass!(NSArray, "allConnections"); } static NSConnection defaultConnection () { - return invokeObjcSelfClass!(NSConnection, "defaultConnection"); + return invokeObjcSuperClass!(NSConnection, "defaultConnection"); } static Object connectionWithRegisteredName (NSString name, NSString hostName) { - return invokeObjcSelfClass!(Object, "connectionWithRegisteredName:host:", NSString, NSString)(name, hostName); + return invokeObjcSuperClass!(Object, "connectionWithRegisteredName:host:", NSString, NSString)(name, hostName); } static Object connectionWithRegisteredName (NSString name, NSString hostName, NSPortNameServer server) { - return invokeObjcSelfClass!(Object, "connectionWithRegisteredName:host:usingNameServer:", NSString, NSString, NSPortNameServer)(name, hostName, server); + return invokeObjcSuperClass!(Object, "connectionWithRegisteredName:host:usingNameServer:", NSString, NSString, NSPortNameServer)(name, hostName, server); } static NSDistantObject rootProxyForConnectionWithRegisteredName (NSString name, NSString hostName) { - return invokeObjcSelfClass!(NSDistantObject, "rootProxyForConnectionWithRegisteredName:host:", NSString, NSString)(name, hostName); + return invokeObjcSuperClass!(NSDistantObject, "rootProxyForConnectionWithRegisteredName:host:", NSString, NSString)(name, hostName); } static NSDistantObject rootProxyForConnectionWithRegisteredName (NSString name, NSString hostName, NSPortNameServer server) { - return invokeObjcSelfClass!(NSDistantObject, "rootProxyForConnectionWithRegisteredName:host:usingNameServer:", NSString, NSString, NSPortNameServer)(name, hostName, server); + return invokeObjcSuperClass!(NSDistantObject, "rootProxyForConnectionWithRegisteredName:host:usingNameServer:", NSString, NSString, NSPortNameServer)(name, hostName, server); } static Object serviceConnectionWithName (NSString name, Object root, NSPortNameServer server) { - return invokeObjcSelfClass!(Object, "serviceConnectionWithName:rootObject:usingNameServer:", NSString, Object, NSPortNameServer)(name, root, server); + return invokeObjcSuperClass!(Object, "serviceConnectionWithName:rootObject:usingNameServer:", NSString, Object, NSPortNameServer)(name, root, server); } static Object serviceConnectionWithName (NSString name, Object root) { - return invokeObjcSelfClass!(Object, "serviceConnectionWithName:rootObject:", NSString, Object)(name, root); + return invokeObjcSuperClass!(Object, "serviceConnectionWithName:rootObject:", NSString, Object)(name, root); } void setRequestTimeout (double ti) @@ -201,12 +293,12 @@ static Object connectionWithReceivePort (NSPort receivePort, NSPort sendPort) { - return invokeObjcSelfClass!(Object, "connectionWithReceivePort:sendPort:", NSPort, NSPort)(receivePort, sendPort); + return invokeObjcSuperClass!(Object, "connectionWithReceivePort:sendPort:", NSPort, NSPort)(receivePort, sendPort); } static Object currentConversation () { - return invokeObjcSelfClass!(Object, "currentConversation"); + return invokeObjcSuperClass!(Object, "currentConversation"); } Object initWithReceivePort (NSPort receivePort, NSPort sendPort) @@ -216,13 +308,7 @@ this (NSPort receivePort, NSPort sendPort) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithReceivePort:sendPort:", NSPort, NSPort)(objcObject, receivePort, sendPort); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithReceivePort(receivePort, sendPort); } NSPort sendPort () @@ -269,19 +355,4 @@ { return invokeObjcSelf!(NSArray, "localObjects"); } -} - -template TNSDistantObjectRequestMethods () -{ - bool connection (NSConnection connection, NSDistantObjectRequest doreq); -} - -template TNSConnectionDelegateMethods () -{ - bool makeNewConnection (NSConnection conn, NSConnection ancestor); - bool connection (NSConnection ancestor, NSConnection conn); - NSData authenticationDataForComponents (NSArray components); - bool authenticateComponents (NSArray components, NSData signature); - Object createConversationForConnection (NSConnection conn); -} - +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSConnection_bindings.d --- a/dstep/foundation/NSConnection_bindings.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSConnection_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -1,18 +1,8 @@ module dstep.foundation.NSConnection_bindings; -import dstep.foundation.NSArray; -import dstep.foundation.NSData; -import dstep.foundation.NSDate; -import dstep.foundation.NSDictionary; -import dstep.foundation.NSDistantObject; -import dstep.foundation.NSException; -import dstep.foundation.NSMutableData; -import dstep.foundation.NSObject; -import dstep.foundation.NSPort; -import dstep.foundation.NSPortNameServer; -import dstep.foundation.NSRunLoop; -import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + extern (C) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSData.d --- a/dstep/foundation/NSData.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSData.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,13 +6,16 @@ */ module dstep.foundation.NSData; +import dstep.foundation.NSCoder; import dstep.foundation.NSError; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; import dstep.foundation.NSRange; import dstep.foundation.NSString; import dstep.foundation.NSURL; +import dstep.foundation.NSZone; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; enum { @@ -25,116 +28,71 @@ NSAtomicWrite = 1 } -class NSData : NSObject, INSCopying, INSMutableCopying, INSCoding -{ - mixin ObjcWrap; - mixin TNSDataCreation; - mixin TNSExtendedData; - - NSUInteger length () - { - return invokeObjcSelf!(NSUInteger, "length"); - } - - void* bytes () - { - return invokeObjcSelf!(void*, "bytes"); - } - - Object copyWithZone (NSZone* zone) - { - return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); - } - - Object mutableCopyWithZone (NSZone* zone) - { - return invokeObjcSelf!(Object, "mutableCopyWithZone:", NSZone*)(zone); - } - - void encodeWithCoder (NSCoder aCoder) - { - return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); - } +const TNSDataCreation = ` - Object initWithCoder (NSCoder aDecoder) - { - return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); - } - - this (NSCoder aDecoder) - { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); - - if (result) - objcObject = ret; - - dObject = this; - } -} - -class NSMutableData : NSData -{ - mixin ObjcWrap; - mixin TNSMutableDataCreation; - mixin TNSExtendedMutableData; - - void* mutableBytes () - { - return invokeObjcSelf!(void*, "mutableBytes"); - } - - void setLength (NSUInteger length) - { - return invokeObjcSelf!(void, "setLength:", NSUInteger)(length); - } -} - -template TNSDataCreation () -{ static Object data () { - return invokeObjcSelfClass!(Object, "data"); + return invokeObjcSuperClass!(Object, "data"); } static Object dataWithBytes (void* bytes, NSUInteger length) { - return invokeObjcSelfClass!(Object, "dataWithBytes:length:", void*, NSUInteger)(bytes, length); + return invokeObjcSuperClass!(Object, "dataWithBytes:length:", void*, NSUInteger)(bytes, length); } static Object dataWithBytesNoCopy (void* bytes, NSUInteger length) { - return invokeObjcSelfClass!(Object, "dataWithBytesNoCopy:length:", void*, NSUInteger)(bytes, length); + return invokeObjcSuperClass!(Object, "dataWithBytesNoCopy:length:", void*, NSUInteger)(bytes, length); } static Object dataWithBytesNoCopy (void* bytes, NSUInteger length, bool b) { - return invokeObjcSelfClass!(Object, "dataWithBytesNoCopy:length:freeWhenDone:", void*, NSUInteger, bool)(bytes, length, b); + return invokeObjcSuperClass!(Object, "dataWithBytesNoCopy:length:freeWhenDone:", void*, NSUInteger, bool)(bytes, length, b); } - static Object dataWithContentsOfFile (NSString path, NSUInteger readOptionsMask, NSError** errorPtr) + static Object dataWithContentsOfFile (NSString path, NSUInteger readOptionsMask, ref NSError errorPtr) { - return invokeObjcSelfClass!(Object, "dataWithContentsOfFile:options:error:", NSString, NSUInteger, NSError**)(path, readOptionsMask, errorPtr); + id error; + + if (errorPtr) + error = new objc_object; + + Object result = invokeObjcSuperClass!(Object, "dataWithContentsOfFile:options:error:", NSString, NSUInteger, id*)(path, readOptionsMask, &error); + + if (error) + errorPtr = new NSError(error); + + return result; } - static Object dataWithContentsOfURL (NSURL url, NSUInteger readOptionsMask, NSError** errorPtr) + static Object dataWithContentsOfURL (NSURL url, NSUInteger readOptionsMask, ref NSError errorPtr) { - return invokeObjcSelfClass!(Object, "dataWithContentsOfURL:options:error:", NSURL, NSUInteger, NSError**)(url, readOptionsMask, errorPtr); + id error; + + if (errorPtr) + error = new objc_object; + + Object result = invokeObjcSuperClass!(Object, "dataWithContentsOfURL:options:error:", NSURL, NSUInteger, id*)(url, readOptionsMask, &error); + + if (error) + errorPtr = new NSError(error); + + return result; } static Object dataWithContentsOfFile (NSString path) { - return invokeObjcSelfClass!(Object, "dataWithContentsOfFile:", NSString)(path); + return invokeObjcSuperClass!(Object, "dataWithContentsOfFile:", NSString)(path); } static Object dataWithContentsOfURL (NSURL url) { - return invokeObjcSelfClass!(Object, "dataWithContentsOfURL:", NSURL)(url); + return invokeObjcSuperClass!(Object, "dataWithContentsOfURL:", NSURL)(url); } static Object dataWithContentsOfMappedFile (NSString path) { - return invokeObjcSelfClass!(Object, "dataWithContentsOfMappedFile:", NSString)(path); + return invokeObjcSuperClass!(Object, "dataWithContentsOfMappedFile:", NSString)(path); } Object initWithBytes (void* bytes, NSUInteger length) @@ -144,13 +102,7 @@ this (void* bytes, NSUInteger length) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithBytes:length:", void*, NSUInteger)(objcObject, bytes, length); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithBytes(bytes, length); } Object initWithBytesNoCopy (void* bytes, NSUInteger length) @@ -160,13 +112,7 @@ this (void* bytes, NSUInteger length) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithBytesNoCopy:length:", void*, NSUInteger)(objcObject, bytes, length); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithBytesNoCopy(bytes, length); } Object initWithBytesNoCopy (void* bytes, NSUInteger length, bool b) @@ -176,45 +122,47 @@ this (void* bytes, NSUInteger length, bool b) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithBytesNoCopy:length:freeWhenDone:", void*, NSUInteger, bool)(objcObject, bytes, length, b); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithBytesNoCopy(bytes, length, b); } - Object initWithContentsOfFile (NSString path, NSUInteger readOptionsMask, NSError** errorPtr) + Object initWithContentsOfFile (NSString path, NSUInteger readOptionsMask, ref NSError errorPtr) { - return invokeObjcSelf!(Object, "initWithContentsOfFile:options:error:", NSString, NSUInteger, NSError**)(path, readOptionsMask, errorPtr); + id error; + + if (errorPtr) + error = new objc_object; + + Object result = invokeObjcSelf!(Object, "initWithContentsOfFile:options:error:", NSString, NSUInteger, id*)(path, readOptionsMask, &error); + + if (error) + errorPtr = new NSError(error); + + return result; } - this (NSString path, NSUInteger readOptionsMask, NSError** errorPtr) + this (NSString path, NSUInteger readOptionsMask, ref NSError errorPtr) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithContentsOfFile:options:error:", NSString, NSUInteger, NSError**)(objcObject, path, readOptionsMask, errorPtr); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithContentsOfFile(path, readOptionsMask, errorPtr); } - Object initWithContentsOfURL (NSURL url, NSUInteger readOptionsMask, NSError** errorPtr) + Object initWithContentsOfURL (NSURL url, NSUInteger readOptionsMask, ref NSError errorPtr) { - return invokeObjcSelf!(Object, "initWithContentsOfURL:options:error:", NSURL, NSUInteger, NSError**)(url, readOptionsMask, errorPtr); + id error; + + if (errorPtr) + error = new objc_object; + + Object result = invokeObjcSelf!(Object, "initWithContentsOfURL:options:error:", NSURL, NSUInteger, id*)(url, readOptionsMask, &error); + + if (error) + errorPtr = new NSError(error); + + return result; } - this (NSURL url, NSUInteger readOptionsMask, NSError** errorPtr) + this (NSURL url, NSUInteger readOptionsMask, ref NSError errorPtr) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithContentsOfURL:options:error:", NSURL, NSUInteger, NSError**)(objcObject, url, readOptionsMask, errorPtr); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithContentsOfURL(url, readOptionsMask, errorPtr); } Object initWithContentsOfFile (NSString path) @@ -224,13 +172,7 @@ this (NSString path) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithContentsOfFile:", NSString)(objcObject, path); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithContentsOfFile(path); } Object initWithContentsOfURL (NSURL url) @@ -240,13 +182,7 @@ this (NSURL url) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithContentsOfURL:", NSURL)(objcObject, url); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithContentsOfURL(url); } Object initWithContentsOfMappedFile (NSString path) @@ -256,13 +192,7 @@ this (NSString path) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithContentsOfMappedFile:", NSString)(objcObject, path); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithContentsOfMappedFile(path); } Object initWithData (NSData data) @@ -272,31 +202,25 @@ this (NSData data) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithData:", NSData)(objcObject, data); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithData(data); } static Object dataWithData (NSData data) { - return invokeObjcSelfClass!(Object, "dataWithData:", NSData)(data); + return invokeObjcSuperClass!(Object, "dataWithData:", NSData)(data); } -} +`; -template TNSMutableDataCreation () -{ +const TNSMutableDataCreation = ` + static Object dataWithCapacity (NSUInteger aNumItems) { - return invokeObjcSelfClass!(Object, "dataWithCapacity:", NSUInteger)(aNumItems); + return invokeObjcSuperClass!(Object, "dataWithCapacity:", NSUInteger)(aNumItems); } static Object dataWithLength (NSUInteger length) { - return invokeObjcSelfClass!(Object, "dataWithLength:", NSUInteger)(length); + return invokeObjcSuperClass!(Object, "dataWithLength:", NSUInteger)(length); } Object initWithCapacity (NSUInteger capacity) @@ -306,13 +230,7 @@ this (NSUInteger capacity) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCapacity:", NSUInteger)(objcObject, capacity); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithCapacity(capacity); } Object initWithLength (NSUInteger length) @@ -322,18 +240,12 @@ this (NSUInteger length) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithLength:", NSUInteger)(objcObject, length); - - if (result) - objcObject = ret; + typeof(this).alloc.initWithLength(length); + } +`; - dObject = this; - } -} +const TNSExtendedMutableData = ` -template TNSExtendedMutableData () -{ void appendBytes (void* bytes, NSUInteger length) { return invokeObjcSelf!(void, "appendBytes:length:", void*, NSUInteger)(bytes, length); @@ -368,10 +280,10 @@ { return invokeObjcSelf!(void, "replaceBytesInRange:withBytes:length:", NSRange, void*, NSUInteger)(range, replacementBytes, replacementLength); } -} +`; -template TNSExtendedData () -{ +const TNSExtendedData = ` + NSString description () { return invokeObjcSelf!(NSString, "description"); @@ -421,5 +333,363 @@ { return invokeObjcSelf!(bool, "writeToURL:options:error:", NSURL, NSUInteger, NSError**)(url, writeOptionsMask, errorPtr); } +`; + +class NSData : NSObject, INSCopying, INSMutableCopying, INSCoding +{ + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } + + NSUInteger length () + { + return invokeObjcSelf!(NSUInteger, "length"); + } + + void* bytes () + { + return invokeObjcSelf!(void*, "bytes"); + } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } + + Object mutableCopyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "mutableCopyWithZone:", NSZone*)(zone); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + Object initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); + } + + this (NSCoder aDecoder) + { + typeof(this).alloc.initWithCoder(aDecoder); + } + + // TNSDataCreation + static Object data () + { + return invokeObjcSuperClass!(Object, "data"); + } + + static Object dataWithBytes (void* bytes, NSUInteger length) + { + return invokeObjcSuperClass!(Object, "dataWithBytes:length:", void*, NSUInteger)(bytes, length); + } + + static Object dataWithBytesNoCopy (void* bytes, NSUInteger length) + { + return invokeObjcSuperClass!(Object, "dataWithBytesNoCopy:length:", void*, NSUInteger)(bytes, length); + } + + static Object dataWithBytesNoCopy (void* bytes, NSUInteger length, bool b) + { + return invokeObjcSuperClass!(Object, "dataWithBytesNoCopy:length:freeWhenDone:", void*, NSUInteger, bool)(bytes, length, b); + } + + static Object dataWithContentsOfFile (NSString path, NSUInteger readOptionsMask, ref NSError errorPtr) + { + id error; + + if (errorPtr) + error = new objc_object; + + Object result = invokeObjcSuperClass!(Object, "dataWithContentsOfFile:options:error:", NSString, NSUInteger, id*)(path, readOptionsMask, &error); + + if (error) + errorPtr = new NSError(error); + + return result; + } + + static Object dataWithContentsOfURL (NSURL url, NSUInteger readOptionsMask, ref NSError errorPtr) + { + id error; + + if (errorPtr) + error = new objc_object; + + Object result = invokeObjcSuperClass!(Object, "dataWithContentsOfURL:options:error:", NSURL, NSUInteger, id*)(url, readOptionsMask, &error); + + if (error) + errorPtr = new NSError(error); + + return result; + } + + static Object dataWithContentsOfFile (NSString path) + { + return invokeObjcSuperClass!(Object, "dataWithContentsOfFile:", NSString)(path); + } + + static Object dataWithContentsOfURL (NSURL url) + { + return invokeObjcSuperClass!(Object, "dataWithContentsOfURL:", NSURL)(url); + } + + static Object dataWithContentsOfMappedFile (NSString path) + { + return invokeObjcSuperClass!(Object, "dataWithContentsOfMappedFile:", NSString)(path); + } + + Object initWithBytes (void* bytes, NSUInteger length) + { + return invokeObjcSelf!(Object, "initWithBytes:length:", void*, NSUInteger)(bytes, length); + } + + this (void* bytes, NSUInteger length) + { + typeof(this).alloc.initWithBytes(bytes, length); + } + + Object initWithBytesNoCopy (void* bytes, NSUInteger length) + { + return invokeObjcSelf!(Object, "initWithBytesNoCopy:length:", void*, NSUInteger)(bytes, length); + } + + Object initWithBytesNoCopy (void* bytes, NSUInteger length, bool b) + { + return invokeObjcSelf!(Object, "initWithBytesNoCopy:length:freeWhenDone:", void*, NSUInteger, bool)(bytes, length, b); + } + + this (void* bytes, NSUInteger length, bool b) + { + typeof(this).alloc.initWithBytesNoCopy(bytes, length, b); + } + + Object initWithContentsOfFile (NSString path, NSUInteger readOptionsMask, ref NSError errorPtr) + { + id error; + + if (errorPtr) + error = new objc_object; + + Object result = invokeObjcSelf!(Object, "initWithContentsOfFile:options:error:", NSString, NSUInteger, id*)(path, readOptionsMask, &error); + + if (error) + errorPtr = new NSError(error); + + return result; + } + + this (NSString path, NSUInteger readOptionsMask, ref NSError errorPtr) + { + typeof(this).alloc.initWithContentsOfFile(path, readOptionsMask, errorPtr); + } + + Object initWithContentsOfURL (NSURL url, NSUInteger readOptionsMask, ref NSError errorPtr) + { + id error; + + if (errorPtr) + error = new objc_object; + + Object result = invokeObjcSelf!(Object, "initWithContentsOfURL:options:error:", NSURL, NSUInteger, id*)(url, readOptionsMask, &error); + + if (error) + errorPtr = new NSError(error); + + return result; + } + + this (NSURL url, NSUInteger readOptionsMask, ref NSError errorPtr) + { + typeof(this).alloc.initWithContentsOfURL(url, readOptionsMask, errorPtr); + } + + Object initWithContentsOfFile (NSString path) + { + return invokeObjcSelf!(Object, "initWithContentsOfFile:", NSString)(path); + } + + this (NSString path) + { + typeof(this).alloc.initWithContentsOfFile(path); + } + + Object initWithContentsOfURL (NSURL url) + { + return invokeObjcSelf!(Object, "initWithContentsOfURL:", NSURL)(url); + } + + this (NSURL url) + { + typeof(this).alloc.initWithContentsOfURL(url); + } + + Object initWithContentsOfMappedFile (NSString path) + { + return invokeObjcSelf!(Object, "initWithContentsOfMappedFile:", NSString)(path); + } + + Object initWithData (NSData data) + { + return invokeObjcSelf!(Object, "initWithData:", NSData)(data); + } + + this (NSData data) + { + typeof(this).alloc.initWithData(data); + } + + static Object dataWithData (NSData data) + { + return invokeObjcSuperClass!(Object, "dataWithData:", NSData)(data); + } + + // TNSExtendedData + NSString description () + { + return invokeObjcSelf!(NSString, "description"); + } + + void getBytes (void* buffer) + { + return invokeObjcSelf!(void, "getBytes:", void*)(buffer); + } + + void getBytes (void* buffer, NSUInteger length) + { + return invokeObjcSelf!(void, "getBytes:length:", void*, NSUInteger)(buffer, length); + } + + void getBytes (void* buffer, NSRange range) + { + return invokeObjcSelf!(void, "getBytes:range:", void*, NSRange)(buffer, range); + } + + bool isEqualToData (NSData other) + { + return invokeObjcSelf!(bool, "isEqualToData:", NSData)(other); + } + + NSData subdataWithRange (NSRange range) + { + return invokeObjcSelf!(NSData, "subdataWithRange:", NSRange)(range); + } + + bool writeToFile (NSString path, bool useAuxiliaryFile) + { + return invokeObjcSelf!(bool, "writeToFile:atomically:", NSString, bool)(path, useAuxiliaryFile); + } + + bool writeToURL (NSURL url, bool atomically) + { + return invokeObjcSelf!(bool, "writeToURL:atomically:", NSURL, bool)(url, atomically); + } + + bool writeToFile (NSString path, NSUInteger writeOptionsMask, NSError** errorPtr) + { + return invokeObjcSelf!(bool, "writeToFile:options:error:", NSString, NSUInteger, NSError**)(path, writeOptionsMask, errorPtr); + } + + bool writeToURL (NSURL url, NSUInteger writeOptionsMask, NSError** errorPtr) + { + return invokeObjcSelf!(bool, "writeToURL:options:error:", NSURL, NSUInteger, NSError**)(url, writeOptionsMask, errorPtr); + } } +class NSMutableData : NSData +{ + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } + + void* mutableBytes () + { + return invokeObjcSelf!(void*, "mutableBytes"); + } + + void setLength (NSUInteger length) + { + return invokeObjcSelf!(void, "setLength:", NSUInteger)(length); + } + + // TNSMutableDataCreation + static Object dataWithCapacity (NSUInteger aNumItems) + { + return invokeObjcSuperClass!(Object, "dataWithCapacity:", NSUInteger)(aNumItems); + } + + static Object dataWithLength (NSUInteger length) + { + return invokeObjcSuperClass!(Object, "dataWithLength:", NSUInteger)(length); + } + + Object initWithCapacity (NSUInteger capacity) + { + return invokeObjcSelf!(Object, "initWithCapacity:", NSUInteger)(capacity); + } + + Object initWithLength (NSUInteger length) + { + return invokeObjcSelf!(Object, "initWithLength:", NSUInteger)(length); + } + + this (NSUInteger length) + { + typeof(this).alloc.initWithLength(length); + } + + // TNSExtendedMutableData + void appendBytes (void* bytes, NSUInteger length) + { + return invokeObjcSelf!(void, "appendBytes:length:", void*, NSUInteger)(bytes, length); + } + + void appendData (NSData other) + { + return invokeObjcSelf!(void, "appendData:", NSData)(other); + } + + void increaseLengthBy (NSUInteger extraLength) + { + return invokeObjcSelf!(void, "increaseLengthBy:", NSUInteger)(extraLength); + } + + void replaceBytesInRange (NSRange range, void* bytes) + { + return invokeObjcSelf!(void, "replaceBytesInRange:withBytes:", NSRange, void*)(range, bytes); + } + + void resetBytesInRange (NSRange range) + { + return invokeObjcSelf!(void, "resetBytesInRange:", NSRange)(range); + } + + void setData (NSData data) + { + return invokeObjcSelf!(void, "setData:", NSData)(data); + } + + void replaceBytesInRange (NSRange range, void* replacementBytes, NSUInteger replacementLength) + { + return invokeObjcSelf!(void, "replaceBytesInRange:withBytes:length:", NSRange, void*, NSUInteger)(range, replacementBytes, replacementLength); + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSDate.d --- a/dstep/foundation/NSDate.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSDate.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,55 +6,19 @@ */ module dstep.foundation.NSDate; +import dstep.foundation.NSCalendarDate; +import dstep.foundation.NSCoder; import dstep.foundation.NSObject; import dstep.foundation.NSString; +import dstep.foundation.NSTimeZone; +import dstep.foundation.NSZone; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; alias double NSTimeInterval; -class NSDate : NSObject, INSCopying, INSCoding -{ - mixin ObjcWrap; - mixin TNSExtendedDate; - mixin TNSDateCreation; - mixin TNSNaturalLangage; - mixin TNSCalendarDateExtras; - - double timeIntervalSinceReferenceDate () - { - return invokeObjcSelf!(double, "timeIntervalSinceReferenceDate"); - } - - Object copyWithZone (NSZone* zone) - { - return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); - } +const TNSExtendedDate = ` - void encodeWithCoder (NSCoder aCoder) - { - return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); - } - - Object initWithCoder (NSCoder aDecoder) - { - return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); - } - - this (NSCoder aDecoder) - { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); - - if (result) - objcObject = ret; - - dObject = this; - } -} - -template TNSExtendedDate () -{ double timeIntervalSinceDate (NSDate anotherDate) { return invokeObjcSelf!(double, "timeIntervalSinceDate:", NSDate)(anotherDate); @@ -100,58 +64,42 @@ return invokeObjcSelf!(bool, "isEqualToDate:", NSDate)(otherDate); } - static double timeIntervalSinceReferenceDate () + static double timeIntervalSinceReferenceDate_static () { - return invokeObjcSelfClass!(double, "timeIntervalSinceReferenceDate"); + return invokeObjcSuperClass!(double, "timeIntervalSinceReferenceDate"); } -} +`; -template TNSDateCreation () -{ +const TNSDateCreation = ` + static Object date () { - return invokeObjcSelfClass!(Object, "date"); + return invokeObjcSuperClass!(Object, "date"); } static Object dateWithTimeIntervalSinceNow (double secs) { - return invokeObjcSelfClass!(Object, "dateWithTimeIntervalSinceNow:", double)(secs); + return invokeObjcSuperClass!(Object, "dateWithTimeIntervalSinceNow:", double)(secs); } static Object dateWithTimeIntervalSinceReferenceDate (double secs) { - return invokeObjcSelfClass!(Object, "dateWithTimeIntervalSinceReferenceDate:", double)(secs); + return invokeObjcSuperClass!(Object, "dateWithTimeIntervalSinceReferenceDate:", double)(secs); } static Object dateWithTimeIntervalSince1970 (double secs) { - return invokeObjcSelfClass!(Object, "dateWithTimeIntervalSince1970:", double)(secs); + return invokeObjcSuperClass!(Object, "dateWithTimeIntervalSince1970:", double)(secs); } static Object distantFuture () { - return invokeObjcSelfClass!(Object, "distantFuture"); + return invokeObjcSuperClass!(Object, "distantFuture"); } static Object distantPast () { - return invokeObjcSelfClass!(Object, "distantPast"); - } - - Object init () - { - return invokeObjcSelf!(Object, "init"); - } - - this () - { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "init")(objcObject); - - if (result) - objcObject = ret; - - dObject = this; + return invokeObjcSuperClass!(Object, "distantPast"); } Object initWithTimeIntervalSinceReferenceDate (double secsToBeAdded) @@ -161,13 +109,7 @@ this (double secsToBeAdded) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithTimeIntervalSinceReferenceDate:", double)(objcObject, secsToBeAdded); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithTimeIntervalSinceReferenceDate(secsToBeAdded); } Object initWithTimeInterval (double secsToBeAdded, NSDate anotherDate) @@ -177,13 +119,7 @@ this (double secsToBeAdded, NSDate anotherDate) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithTimeInterval:sinceDate:", double, NSDate)(objcObject, secsToBeAdded, anotherDate); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithTimeInterval(secsToBeAdded, anotherDate); } Object initWithTimeIntervalSinceNow (double secsToBeAddedToNow) @@ -193,13 +129,195 @@ this (double secsToBeAddedToNow) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithTimeIntervalSinceNow:", double)(objcObject, secsToBeAddedToNow); + typeof(this).alloc.initWithTimeIntervalSinceNow(secsToBeAddedToNow); + } +`; + +class NSDate : NSObject, INSCopying, INSCoding +{ + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } + + double timeIntervalSinceReferenceDate () + { + return invokeObjcSelf!(double, "timeIntervalSinceReferenceDate"); + } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + NSDate initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(NSDate, "initWithCoder:", NSCoder)(aDecoder); + } - if (result) - objcObject = ret; - - dObject = this; + this (NSCoder aDecoder) + { + typeof(this).alloc.initWithCoder(aDecoder); + } + + // TNSExtendedDate + double timeIntervalSinceDate (NSDate anotherDate) + { + return invokeObjcSelf!(double, "timeIntervalSinceDate:", NSDate)(anotherDate); + } + + double timeIntervalSinceNow () + { + return invokeObjcSelf!(double, "timeIntervalSinceNow"); + } + + double timeIntervalSince1970 () + { + return invokeObjcSelf!(double, "timeIntervalSince1970"); + } + + Object addTimeInterval (double seconds) + { + return invokeObjcSelf!(Object, "addTimeInterval:", double)(seconds); + } + + NSDate earlierDate (NSDate anotherDate) + { + return invokeObjcSelf!(NSDate, "earlierDate:", NSDate)(anotherDate); + } + + NSDate laterDate (NSDate anotherDate) + { + return invokeObjcSelf!(NSDate, "laterDate:", NSDate)(anotherDate); + } + + int compare (NSDate other) + { + return invokeObjcSelf!(int, "compare:", NSDate)(other); + } + + NSString description () + { + return invokeObjcSelf!(NSString, "description"); + } + + bool isEqualToDate (NSDate otherDate) + { + return invokeObjcSelf!(bool, "isEqualToDate:", NSDate)(otherDate); + } + + static double timeIntervalSinceReferenceDate_static () + { + return invokeObjcSuperClass!(double, "timeIntervalSinceReferenceDate"); + } + + // TNSDateCreation + static Object date () + { + return invokeObjcSuperClass!(Object, "date"); + } + + static Object dateWithTimeIntervalSinceNow (double secs) + { + return invokeObjcSuperClass!(Object, "dateWithTimeIntervalSinceNow:", double)(secs); + } + + static Object dateWithTimeIntervalSinceReferenceDate (double secs) + { + return invokeObjcSuperClass!(Object, "dateWithTimeIntervalSinceReferenceDate:", double)(secs); + } + + static Object dateWithTimeIntervalSince1970 (double secs) + { + return invokeObjcSuperClass!(Object, "dateWithTimeIntervalSince1970:", double)(secs); } -} - + + static Object distantFuture () + { + return invokeObjcSuperClass!(Object, "distantFuture"); + } + + static Object distantPast () + { + return invokeObjcSuperClass!(Object, "distantPast"); + } + + Object initWithTimeIntervalSinceReferenceDate (double secsToBeAdded) + { + return invokeObjcSelf!(Object, "initWithTimeIntervalSinceReferenceDate:", double)(secsToBeAdded); + } + + this (double secsToBeAdded) + { + typeof(this).alloc.initWithTimeIntervalSinceReferenceDate(secsToBeAdded); + } + + Object initWithTimeInterval (double secsToBeAdded, NSDate anotherDate) + { + return invokeObjcSelf!(Object, "initWithTimeInterval:sinceDate:", double, NSDate)(secsToBeAdded, anotherDate); + } + + this (double secsToBeAdded, NSDate anotherDate) + { + typeof(this).alloc.initWithTimeInterval(secsToBeAdded, anotherDate); + } + + Object initWithTimeIntervalSinceNow (double secsToBeAddedToNow) + { + return invokeObjcSelf!(Object, "initWithTimeIntervalSinceNow:", double)(secsToBeAddedToNow); + } + + // TNSNaturalLangage + static Object dateWithNaturalLanguageString (NSString string) + { + return invokeObjcSuperClass!(Object, "dateWithNaturalLanguageString:", NSString)(string); + } + + static Object dateWithNaturalLanguageString (NSString string, Object locale) + { + return invokeObjcSuperClass!(Object, "dateWithNaturalLanguageString:locale:", NSString, Object)(string, locale); + } + + // TNSCalendarDateExtras + static Object dateWithString (NSString aString) + { + return invokeObjcSuperClass!(Object, "dateWithString:", NSString)(aString); + } + + Object initWithString (NSString description) + { + return invokeObjcSelf!(Object, "initWithString:", NSString)(description); + } + + this (NSString description) + { + typeof(this).alloc.initWithString(description); + } + + NSCalendarDate dateWithCalendarFormat (NSString format, NSTimeZone aTimeZone) + { + return invokeObjcSelf!(NSCalendarDate, "dateWithCalendarFormat:timeZone:", NSString, NSTimeZone)(format, aTimeZone); + } + + NSString descriptionWithLocale (Object locale) + { + return invokeObjcSelf!(NSString, "descriptionWithLocale:", Object)(locale); + } + + NSString descriptionWithCalendarFormat (NSString format, NSTimeZone aTimeZone, Object locale) + { + return invokeObjcSelf!(NSString, "descriptionWithCalendarFormat:timeZone:locale:", NSString, NSTimeZone, Object)(format, aTimeZone, locale); + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSDateFormatter.d --- a/dstep/foundation/NSDateFormatter.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSDateFormatter.d Sun Jan 03 22:06:11 2010 +0100 @@ -10,13 +10,16 @@ import dstep.foundation.NSArray; import dstep.foundation.NSCalendar; import dstep.foundation.NSDate; +import dstep.foundation.NSDictionary; import dstep.foundation.NSError; import dstep.foundation.NSFormatter; import dstep.foundation.NSLocale; -import dstep.foundation.NSMutableDictionary; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSRange; +import dstep.foundation.NSString; import dstep.foundation.NSTimeZone; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; alias NSUInteger NSDateFormatterStyle; alias NSUInteger NSDateFormatterBehavior; @@ -37,25 +40,36 @@ NSDateFormatterBehavior10_4 = 1040 } -class NSDateFormatter : NSFormatter -{ - mixin ObjcWrap; - mixin TNSDateFormatterCompatibility; +const TNSDateFormatterCompatibility = ` - Object init () + Object initWithDateFormat (NSString format, bool flag) { - return invokeObjcSelf!(Object, "init"); + return invokeObjcSelf!(Object, "initWithDateFormat:allowNaturalLanguage:", NSString, bool)(format, flag); + } + + this (NSString format, bool flag) + { + typeof(this).alloc.initWithDateFormat(format, flag); } + bool allowsNaturalLanguage () + { + return invokeObjcSelf!(bool, "allowsNaturalLanguage"); + } +`; + +class NSDateFormatter : NSFormatter +{ + mixin (ObjcWrap); + this () { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "init")(objcObject); - - if (result) - objcObject = ret; - - dObject = this; + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); } bool getObjectValue (id* obj, NSString string, NSRange* rangep, NSError** error) @@ -130,12 +144,12 @@ static uint defaultFormatterBehavior () { - return invokeObjcSelfClass!(uint, "defaultFormatterBehavior"); + return invokeObjcSuperClass!(uint, "defaultFormatterBehavior"); } static void setDefaultFormatterBehavior (uint behavior) { - return invokeObjcSelfClass!(void, "setDefaultFormatterBehavior:", uint)(behavior); + return invokeObjcSuperClass!(void, "setDefaultFormatterBehavior:", uint)(behavior); } void setDateFormat (NSString string) @@ -402,29 +416,20 @@ { return invokeObjcSelf!(void, "setGregorianStartDate:", NSDate)(date); } -} - -template TNSDateFormatterCompatibility () -{ + + // TNSDateFormatterCompatibility Object initWithDateFormat (NSString format, bool flag) { return invokeObjcSelf!(Object, "initWithDateFormat:allowNaturalLanguage:", NSString, bool)(format, flag); } - + this (NSString format, bool flag) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithDateFormat:allowNaturalLanguage:", NSString, bool)(objcObject, format, flag); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithDateFormat(format, flag); } - + bool allowsNaturalLanguage () { return invokeObjcSelf!(bool, "allowsNaturalLanguage"); } -} - +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSDebug.d --- a/dstep/foundation/NSDebug.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSDebug.d Sun Jan 03 22:06:11 2010 +0100 @@ -8,10 +8,11 @@ import dstep.foundation.NSAutoreleasePool; import dstep.foundation.NSDate; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; import dstep.foundation.NSPort; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; import bindings = dstep.foundation.NSDebug_bindings; @@ -27,63 +28,63 @@ } } -template TNSAutoreleasePoolDebugging () -{ +const TNSAutoreleasePoolDebugging = ` + static void enableRelease (bool enable) { - return invokeObjcSelfClass!(void, "enableRelease:", bool)(enable); + return invokeObjcSuperClass!(void, "enableRelease:", bool)(enable); } static void showPools () { - return invokeObjcSelfClass!(void, "showPools"); + return invokeObjcSuperClass!(void, "showPools"); } static void resetTotalAutoreleasedObjects () { - return invokeObjcSelfClass!(void, "resetTotalAutoreleasedObjects"); + return invokeObjcSuperClass!(void, "resetTotalAutoreleasedObjects"); } static NSUInteger totalAutoreleasedObjects () { - return invokeObjcSelfClass!(NSUInteger, "totalAutoreleasedObjects"); + return invokeObjcSuperClass!(NSUInteger, "totalAutoreleasedObjects"); } static void enableFreedObjectCheck (bool enable) { - return invokeObjcSelfClass!(void, "enableFreedObjectCheck:", bool)(enable); + return invokeObjcSuperClass!(void, "enableFreedObjectCheck:", bool)(enable); } static NSUInteger autoreleasedObjectCount () { - return invokeObjcSelfClass!(NSUInteger, "autoreleasedObjectCount"); + return invokeObjcSuperClass!(NSUInteger, "autoreleasedObjectCount"); } static NSUInteger topAutoreleasePoolCount () { - return invokeObjcSelfClass!(NSUInteger, "topAutoreleasePoolCount"); + return invokeObjcSuperClass!(NSUInteger, "topAutoreleasePoolCount"); } static NSUInteger poolCountHighWaterMark () { - return invokeObjcSelfClass!(NSUInteger, "poolCountHighWaterMark"); + return invokeObjcSuperClass!(NSUInteger, "poolCountHighWaterMark"); } static void setPoolCountHighWaterMark (NSUInteger count) { - return invokeObjcSelfClass!(void, "setPoolCountHighWaterMark:", NSUInteger)(count); + return invokeObjcSuperClass!(void, "setPoolCountHighWaterMark:", NSUInteger)(count); } static NSUInteger poolCountHighWaterResolution () { - return invokeObjcSelfClass!(NSUInteger, "poolCountHighWaterResolution"); + return invokeObjcSuperClass!(NSUInteger, "poolCountHighWaterResolution"); } static void setPoolCountHighWaterResolution (NSUInteger res) { - return invokeObjcSelfClass!(void, "setPoolCountHighWaterResolution:", NSUInteger)(res); + return invokeObjcSuperClass!(void, "setPoolCountHighWaterResolution:", NSUInteger)(res); } -} +`; bool NSIsFreedObject (Object anObject) { diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSDebug_bindings.d --- a/dstep/foundation/NSDebug_bindings.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSDebug_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -5,7 +5,9 @@ import dstep.foundation.NSObject; import dstep.foundation.NSPort; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + extern (C) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSDecimal.d --- a/dstep/foundation/NSDecimal.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSDecimal.d Sun Jan 03 22:06:11 2010 +0100 @@ -8,9 +8,13 @@ import dstep.foundation.NSDictionary; import dstep.foundation.NSObjCRuntime; -import dstep.limits; +import dstep.foundation.NSString; +import dstep.internal.Version; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.bridge.Capsule; +import dstep.objc.objc; + +import bindings = dstep.foundation.NSDecimal_bindings; alias NSUInteger NSRoundingMode; alias NSUInteger NSCalculationError; @@ -39,7 +43,7 @@ uint _isNegative; uint _isCompact; uint _reserved; - unsigned short* _mantissa; + ushort* _mantissa; } NSString NSDecimalString (NSDecimal* dcm, Object locale) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSDecimalNumber.d --- a/dstep/foundation/NSDecimalNumber.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSDecimalNumber.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,94 +6,127 @@ */ module dstep.foundation.NSDecimalNumber; +import dstep.foundation.NSCoder; import dstep.foundation.NSDecimal; import dstep.foundation.NSDictionary; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; import dstep.foundation.NSScanner; +import dstep.foundation.NSString; import dstep.foundation.NSValue; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; import bindings = dstep.foundation.NSDecimalNumber_bindings; -const NSString NSDecimalNumberExactnessException; -const NSString NSDecimalNumberOverflowException; -const NSString NSDecimalNumberUnderflowException; -const NSString NSDecimalNumberDivideByZeroException; +private +{ + NSString NSDecimalNumberExactnessException_; + NSString NSDecimalNumberOverflowException_; + NSString NSDecimalNumberUnderflowException_; + NSString NSDecimalNumberDivideByZeroException_; +} + +NSString NSDecimalNumberExactnessException () +{ + if (NSDecimalNumberExactnessException_) + return NSDecimalNumberExactnessException_; + + return NSDecimalNumberExactnessException_ = new NSString(bindings.NSDecimalNumberExactnessException); +} + +NSString NSDecimalNumberOverflowException () +{ + if (NSDecimalNumberOverflowException_) + return NSDecimalNumberOverflowException_; + + return NSDecimalNumberOverflowException_ = new NSString(bindings.NSDecimalNumberOverflowException); +} -static this () +NSString NSDecimalNumberUnderflowException () +{ + if (NSDecimalNumberUnderflowException_) + return NSDecimalNumberUnderflowException_; + + return NSDecimalNumberUnderflowException_ = new NSString(bindings.NSDecimalNumberUnderflowException); +} + +NSString NSDecimalNumberDivideByZeroException () { - NSDecimalNumberExactnessException = new NSString(bindings.NSDecimalNumberExactnessException); - NSDecimalNumberOverflowException = new NSString(bindings.NSDecimalNumberOverflowException); - NSDecimalNumberUnderflowException = new NSString(bindings.NSDecimalNumberUnderflowException); - NSDecimalNumberDivideByZeroException = new NSString(bindings.NSDecimalNumberDivideByZeroException); + if (NSDecimalNumberDivideByZeroException_) + return NSDecimalNumberDivideByZeroException_; + + return NSDecimalNumberDivideByZeroException_ = new NSString(bindings.NSDecimalNumberDivideByZeroException); } +const TNSDecimalNumberExtensions = ` + + NSDecimal decimalValue () + { + return invokeObjcSelf!(NSDecimal, "decimalValue"); + } +`; + +const TNSDecimalNumberScanning = ` + + bool scanDecimal (NSDecimal* dcm) + { + return invokeObjcSelf!(bool, "scanDecimal:", NSDecimal*)(dcm); + } +`; + class NSDecimalNumber : NSNumber { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } - Object initWithMantissa (ulong mantissa, short exponent, bool flag) + NSDecimalNumber initWithMantissa (ulong mantissa, short exponent, bool flag) { - return invokeObjcSelf!(Object, "initWithMantissa:exponent:isNegative:", ulong, short, bool)(mantissa, exponent, flag); + return invokeObjcSelf!(NSDecimalNumber, "initWithMantissa:exponent:isNegative:", ulong, short, bool)(mantissa, exponent, flag); } this (ulong mantissa, short exponent, bool flag) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithMantissa:exponent:isNegative:", ulong, short, bool)(objcObject, mantissa, exponent, flag); - - if (result) - objcObject = ret; - - dObject = this; + super(typeof(this).alloc.initWithMantissa(mantissa, exponent, flag).objcObject); } - Object initWithDecimal (NSDecimal dcm) + NSDecimalNumber initWithDecimal (NSDecimal dcm) { - return invokeObjcSelf!(Object, "initWithDecimal:", NSDecimal)(dcm); + return invokeObjcSelf!(NSDecimalNumber, "initWithDecimal:", NSDecimal)(dcm); } this (NSDecimal dcm) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithDecimal:", NSDecimal)(objcObject, dcm); - - if (result) - objcObject = ret; - - dObject = this; + super(typeof(this).alloc.initWithDecimal(dcm).objcObject); } - Object initWithString (NSString numberValue) + NSDecimalNumber initWithString (NSString numberValue) { - return invokeObjcSelf!(Object, "initWithString:", NSString)(numberValue); + return invokeObjcSelf!(NSDecimalNumber, "initWithString:", NSString)(numberValue); } this (NSString numberValue) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithString:", NSString)(objcObject, numberValue); - - if (result) - objcObject = ret; - - dObject = this; + super(typeof(this).alloc.initWithString(numberValue).objcObject); } - Object initWithString (NSString numberValue, Object locale) + NSDecimalNumber initWithString (NSString numberValue, Object locale) { - return invokeObjcSelf!(Object, "initWithString:locale:", NSString, Object)(numberValue, locale); + return invokeObjcSelf!(NSDecimalNumber, "initWithString:locale:", NSString, Object)(numberValue, locale); } this (NSString numberValue, Object locale) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithString:locale:", NSString, Object)(objcObject, numberValue, locale); - - if (result) - objcObject = ret; - - dObject = this; + super(typeof(this).alloc.initWithString(numberValue, locale).objcObject); } NSString descriptionWithLocale (Object locale) @@ -108,47 +141,47 @@ static NSDecimalNumber decimalNumberWithMantissa (ulong mantissa, short exponent, bool flag) { - return invokeObjcSelfClass!(NSDecimalNumber, "decimalNumberWithMantissa:exponent:isNegative:", ulong, short, bool)(mantissa, exponent, flag); + return invokeObjcSuperClass!(NSDecimalNumber, "decimalNumberWithMantissa:exponent:isNegative:", ulong, short, bool)(mantissa, exponent, flag); } static NSDecimalNumber decimalNumberWithDecimal (NSDecimal dcm) { - return invokeObjcSelfClass!(NSDecimalNumber, "decimalNumberWithDecimal:", NSDecimal)(dcm); + return invokeObjcSuperClass!(NSDecimalNumber, "decimalNumberWithDecimal:", NSDecimal)(dcm); } static NSDecimalNumber decimalNumberWithString (NSString numberValue) { - return invokeObjcSelfClass!(NSDecimalNumber, "decimalNumberWithString:", NSString)(numberValue); + return invokeObjcSuperClass!(NSDecimalNumber, "decimalNumberWithString:", NSString)(numberValue); } static NSDecimalNumber decimalNumberWithString (NSString numberValue, Object locale) { - return invokeObjcSelfClass!(NSDecimalNumber, "decimalNumberWithString:locale:", NSString, Object)(numberValue, locale); + return invokeObjcSuperClass!(NSDecimalNumber, "decimalNumberWithString:locale:", NSString, Object)(numberValue, locale); } static NSDecimalNumber zero () { - return invokeObjcSelfClass!(NSDecimalNumber, "zero"); + return invokeObjcSuperClass!(NSDecimalNumber, "zero"); } static NSDecimalNumber one () { - return invokeObjcSelfClass!(NSDecimalNumber, "one"); + return invokeObjcSuperClass!(NSDecimalNumber, "one"); } static NSDecimalNumber minimumDecimalNumber () { - return invokeObjcSelfClass!(NSDecimalNumber, "minimumDecimalNumber"); + return invokeObjcSuperClass!(NSDecimalNumber, "minimumDecimalNumber"); } static NSDecimalNumber maximumDecimalNumber () { - return invokeObjcSelfClass!(NSDecimalNumber, "maximumDecimalNumber"); + return invokeObjcSuperClass!(NSDecimalNumber, "maximumDecimalNumber"); } static NSDecimalNumber notANumber () { - return invokeObjcSelfClass!(NSDecimalNumber, "notANumber"); + return invokeObjcSuperClass!(NSDecimalNumber, "notANumber"); } NSDecimalNumber decimalNumberByAdding (NSDecimalNumber decimalNumber) @@ -236,12 +269,12 @@ static void setDefaultBehavior (INSDecimalNumberBehaviors behavior) { - return invokeObjcSelfClass!(void, "setDefaultBehavior:", INSDecimalNumberBehaviors)(behavior); + return invokeObjcSuperClass!(void, "setDefaultBehavior:", INSDecimalNumberBehaviors)(behavior); } static INSDecimalNumberBehaviors defaultBehavior () { - return invokeObjcSelfClass!(INSDecimalNumberBehaviors, "defaultBehavior"); + return invokeObjcSuperClass!(INSDecimalNumberBehaviors, "defaultBehavior"); } char* objCType () @@ -257,11 +290,21 @@ class NSDecimalNumberHandler : NSObject, INSDecimalNumberBehaviors, INSCoding { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static Object defaultDecimalNumberHandler () { - return invokeObjcSelfClass!(Object, "defaultDecimalNumberHandler"); + return invokeObjcSuperClass!(Object, "defaultDecimalNumberHandler"); } Object initWithRoundingMode (uint roundingMode, short scale, bool exact, bool overflow, bool underflow, bool divideByZero) @@ -271,18 +314,12 @@ this (uint roundingMode, short scale, bool exact, bool overflow, bool underflow, bool divideByZero) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithRoundingMode:scale:raiseOnExactness:raiseOnOverflow:raiseOnUnderflow:raiseOnDivideByZero:", uint, short, bool, bool, bool, bool)(objcObject, roundingMode, scale, exact, overflow, underflow, divideByZero); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithRoundingMode(roundingMode, scale, exact, overflow, underflow, divideByZero); } static Object decimalNumberHandlerWithRoundingMode (uint roundingMode, short scale, bool exact, bool overflow, bool underflow, bool divideByZero) { - return invokeObjcSelfClass!(Object, "decimalNumberHandlerWithRoundingMode:scale:raiseOnExactness:raiseOnOverflow:raiseOnUnderflow:raiseOnDivideByZero:", uint, short, bool, bool, bool, bool)(roundingMode, scale, exact, overflow, underflow, divideByZero); + return invokeObjcSuperClass!(Object, "decimalNumberHandlerWithRoundingMode:scale:raiseOnExactness:raiseOnOverflow:raiseOnUnderflow:raiseOnDivideByZero:", uint, short, bool, bool, bool, bool)(roundingMode, scale, exact, overflow, underflow, divideByZero); } uint roundingMode () @@ -312,13 +349,7 @@ this (NSCoder aDecoder) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithCoder(aDecoder); } } @@ -327,21 +358,4 @@ uint roundingMode (); short scale (); NSDecimalNumber exceptionDuringOperation (SEL operation, uint error, NSDecimalNumber leftOperand, NSDecimalNumber rightOperand); -} - -template TNSDecimalNumberExtensions () -{ - NSDecimal decimalValue () - { - return invokeObjcSelf!(NSDecimal, "decimalValue"); - } -} - -template TNSDecimalNumberScanning () -{ - bool scanDecimal (NSDecimal* dcm) - { - return invokeObjcSelf!(bool, "scanDecimal:", NSDecimal*)(dcm); - } -} - +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSDecimalNumber_bindings.d --- a/dstep/foundation/NSDecimalNumber_bindings.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSDecimalNumber_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -5,8 +5,7 @@ import dstep.foundation.NSScanner; import dstep.foundation.NSValue; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; - +import dstep.objc.objc; extern (C) { diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSDecimal_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSDecimal_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,15 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Aug 14, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.foundation.NSDecimal_bindings; + +import dstep.objc.objc; +import dstep.foundation.NSDecimal; + +extern (C): +package: + +id NSDecimalString (NSDecimal* dcm, id locale); \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSDictionary.d --- a/dstep/foundation/NSDictionary.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSDictionary.d Sun Jan 03 22:06:11 2010 +0100 @@ -7,119 +7,49 @@ module dstep.foundation.NSDictionary; import dstep.foundation.NSArray; +import dstep.foundation.NSCoder; +import dstep.foundation.NSDate; import dstep.foundation.NSEnumerator; +import dstep.foundation.NSFileManager; +import dstep.foundation.NSValue; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; import dstep.foundation.NSString; import dstep.foundation.NSURL; +import dstep.foundation.NSZone; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; - -class NSMutableDictionary : NSDictionary -{ - mixin ObjcWrap; - mixin TNSMutableDictionaryCreation; - mixin TNSExtendedMutableDictionary; - - void removeObjectForKey (Object aKey) - { - return invokeObjcSelf!(void, "removeObjectForKey:", Object)(aKey); - } - - void setObject (Object anObject, Object aKey) - { - return invokeObjcSelf!(void, "setObject:forKey:", Object, Object)(anObject, aKey); - } -} - -class NSDictionary : NSObject, INSCopying, INSMutableCopying, INSCoding, INSFastEnumeration -{ - mixin ObjcWrap; - mixin TNSDictionaryCreation; - mixin TNSFileAttributes; - mixin TNSExtendedDictionary; - - NSUInteger count () - { - return invokeObjcSelf!(NSUInteger, "count"); - } - - Object objectForKey (Object aKey) - { - return invokeObjcSelf!(Object, "objectForKey:", Object)(aKey); - } +import dstep.objc.objc; - NSEnumerator keyEnumerator () - { - return invokeObjcSelf!(NSEnumerator, "keyEnumerator"); - } - - Object copyWithZone (NSZone* zone) - { - return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); - } - - Object mutableCopyWithZone (NSZone* zone) - { - return invokeObjcSelf!(Object, "mutableCopyWithZone:", NSZone*)(zone); - } - - void encodeWithCoder (NSCoder aCoder) - { - return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); - } +const TNSDictionaryCreation = ` - Object initWithCoder (NSCoder aDecoder) - { - return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); - } - - this (NSCoder aDecoder) - { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); - - if (result) - objcObject = ret; - - dObject = this; - } - - NSUInteger countByEnumeratingWithState (NSFastEnumerationState* state, id* stackbuf, NSUInteger len) - { - return invokeObjcSelf!(NSUInteger, "countByEnumeratingWithState:objects:count:", NSFastEnumerationState*, id*, NSUInteger)(state, stackbuf, len); - } -} - -template TNSDictionaryCreation () -{ static Object dictionary () { - return invokeObjcSelfClass!(Object, "dictionary"); + return invokeObjcSuperClass!(Object, "dictionary"); } static Object dictionaryWithObject (Object object, Object key) { - return invokeObjcSelfClass!(Object, "dictionaryWithObject:forKey:", Object, Object)(object, key); + return invokeObjcSuperClass!(Object, "dictionaryWithObject:forKey:", Object, Object)(object, key); } static Object dictionaryWithObjects (id* objects, id* keys, NSUInteger cnt) { - return invokeObjcSelfClass!(Object, "dictionaryWithObjects:forKeys:count:", id*, id*, NSUInteger)(objects, keys, cnt); + return invokeObjcSuperClass!(Object, "dictionaryWithObjects:forKeys:count:", id*, id*, NSUInteger)(objects, keys, cnt); } static Object dictionaryWithObjectsAndKeys (Object dictionaryWithObjectsAndKeys, ...) { - return invokeObjcSelfClass!(Object, "dictionaryWithObjectsAndKeys:", Object)(dictionaryWithObjectsAndKeys); + return invokeObjcSuperClass!(Object, "dictionaryWithObjectsAndKeys:", Object)(dictionaryWithObjectsAndKeys); } static Object dictionaryWithDictionary (NSDictionary dict) { - return invokeObjcSelfClass!(Object, "dictionaryWithDictionary:", NSDictionary)(dict); + return invokeObjcSuperClass!(Object, "dictionaryWithDictionary:", NSDictionary)(dict); } static Object dictionaryWithObjects (NSArray objects, NSArray keys) { - return invokeObjcSelfClass!(Object, "dictionaryWithObjects:forKeys:", NSArray, NSArray)(objects, keys); + return invokeObjcSuperClass!(Object, "dictionaryWithObjects:forKeys:", NSArray, NSArray)(objects, keys); } Object initWithObjects (id* objects, id* keys, NSUInteger cnt) @@ -129,13 +59,7 @@ this (id* objects, id* keys, NSUInteger cnt) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithObjects:forKeys:count:", id*, id*, NSUInteger)(objcObject, objects, keys, cnt); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithObjects(objects, keys, cnt); } Object initWithObjectsAndKeys (Object initWithObjectsAndKeys, ...) @@ -145,13 +69,7 @@ this (Object initWithObjectsAndKeys, ...) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithObjectsAndKeys:", Object)(objcObject, initWithObjectsAndKeys); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithObjectsAndKeys(initWithObjectsAndKeys); } Object initWithDictionary (NSDictionary otherDictionary) @@ -161,13 +79,7 @@ this (NSDictionary otherDictionary) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithDictionary:", NSDictionary)(objcObject, otherDictionary); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithDictionary(otherDictionary); } Object initWithDictionary (NSDictionary otherDictionary, bool flag) @@ -177,13 +89,7 @@ this (NSDictionary otherDictionary, bool flag) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithDictionary:copyItems:", NSDictionary, bool)(objcObject, otherDictionary, flag); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithDictionary(otherDictionary, flag); } Object initWithObjects (NSArray objects, NSArray keys) @@ -193,23 +99,17 @@ this (NSArray objects, NSArray keys) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithObjects:forKeys:", NSArray, NSArray)(objcObject, objects, keys); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithObjects(objects, keys); } static Object dictionaryWithContentsOfFile (NSString path) { - return invokeObjcSelfClass!(Object, "dictionaryWithContentsOfFile:", NSString)(path); + return invokeObjcSuperClass!(Object, "dictionaryWithContentsOfFile:", NSString)(path); } static Object dictionaryWithContentsOfURL (NSURL url) { - return invokeObjcSelfClass!(Object, "dictionaryWithContentsOfURL:", NSURL)(url); + return invokeObjcSuperClass!(Object, "dictionaryWithContentsOfURL:", NSURL)(url); } Object initWithContentsOfFile (NSString path) @@ -219,13 +119,7 @@ this (NSString path) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithContentsOfFile:", NSString)(objcObject, path); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithContentsOfFile(path); } Object initWithContentsOfURL (NSURL url) @@ -235,21 +129,15 @@ this (NSURL url) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithContentsOfURL:", NSURL)(objcObject, url); - - if (result) - objcObject = ret; + typeof(this).alloc.initWithContentsOfURL(url); + } +`; - dObject = this; - } -} +const TNSMutableDictionaryCreation = ` -template TNSMutableDictionaryCreation () -{ static Object dictionaryWithCapacity (NSUInteger numItems) { - return invokeObjcSelfClass!(Object, "dictionaryWithCapacity:", NSUInteger)(numItems); + return invokeObjcSuperClass!(Object, "dictionaryWithCapacity:", NSUInteger)(numItems); } Object initWithCapacity (NSUInteger numItems) @@ -259,18 +147,12 @@ this (NSUInteger numItems) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCapacity:", NSUInteger)(objcObject, numItems); - - if (result) - objcObject = ret; + typeof(this).alloc.initWithCapacity(numItems); + } +`; - dObject = this; - } -} +const TNSExtendedMutableDictionary = ` -template TNSExtendedMutableDictionary () -{ void addEntriesFromDictionary (NSDictionary otherDictionary) { return invokeObjcSelf!(void, "addEntriesFromDictionary:", NSDictionary)(otherDictionary); @@ -290,10 +172,10 @@ { return invokeObjcSelf!(void, "setDictionary:", NSDictionary)(otherDictionary); } -} +`; -template TNSExtendedDictionary () -{ +const TNSExtendedDictionary = ` + NSArray allKeys () { return invokeObjcSelf!(NSArray, "allKeys"); @@ -363,5 +245,389 @@ { return invokeObjcSelf!(void, "getObjects:andKeys:", id*, id*)(objects, keys); } +`; + +class NSMutableDictionary : NSDictionary +{ + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } + + void removeObjectForKey (Object aKey) + { + return invokeObjcSelf!(void, "removeObjectForKey:", Object)(aKey); + } + + void setObject (Object anObject, Object aKey) + { + return invokeObjcSelf!(void, "setObject:forKey:", Object, Object)(anObject, aKey); + } + + // TNSMutableDictionaryCreation + static Object dictionaryWithCapacity (NSUInteger numItems) + { + return invokeObjcSuperClass!(Object, "dictionaryWithCapacity:", NSUInteger)(numItems); + } + + Object initWithCapacity (NSUInteger numItems) + { + return invokeObjcSelf!(Object, "initWithCapacity:", NSUInteger)(numItems); + } + + this (NSUInteger numItems) + { + typeof(this).alloc.initWithCapacity(numItems); + } + + // TNSExtendedMutableDictionary + void addEntriesFromDictionary (NSDictionary otherDictionary) + { + return invokeObjcSelf!(void, "addEntriesFromDictionary:", NSDictionary)(otherDictionary); + } + + void removeAllObjects () + { + return invokeObjcSelf!(void, "removeAllObjects"); + } + + void removeObjectsForKeys (NSArray keyArray) + { + return invokeObjcSelf!(void, "removeObjectsForKeys:", NSArray)(keyArray); + } + + void setDictionary (NSDictionary otherDictionary) + { + return invokeObjcSelf!(void, "setDictionary:", NSDictionary)(otherDictionary); + } } +class NSDictionary : NSObject, INSCopying, INSMutableCopying, INSCoding, INSFastEnumeration +{ + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } + + NSUInteger count () + { + return invokeObjcSelf!(NSUInteger, "count"); + } + + Object objectForKey (Object aKey) + { + return invokeObjcSelf!(Object, "objectForKey:", Object)(aKey); + } + + NSEnumerator keyEnumerator () + { + return invokeObjcSelf!(NSEnumerator, "keyEnumerator"); + } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } + + Object mutableCopyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "mutableCopyWithZone:", NSZone*)(zone); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + Object initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); + } + + this (NSCoder aDecoder) + { + typeof(this).alloc.initWithCoder(aDecoder); + } + + NSUInteger countByEnumeratingWithState (NSFastEnumerationState* state, id* stackbuf, NSUInteger len) + { + return invokeObjcSelf!(NSUInteger, "countByEnumeratingWithState:objects:count:", NSFastEnumerationState*, id*, NSUInteger)(state, stackbuf, len); + } + + // TNSDictionaryCreation + static Object dictionary () + { + return invokeObjcSuperClass!(Object, "dictionary"); + } + + static Object dictionaryWithObject (Object object, Object key) + { + return invokeObjcSuperClass!(Object, "dictionaryWithObject:forKey:", Object, Object)(object, key); + } + + static Object dictionaryWithObjects (id* objects, id* keys, NSUInteger cnt) + { + return invokeObjcSuperClass!(Object, "dictionaryWithObjects:forKeys:count:", id*, id*, NSUInteger)(objects, keys, cnt); + } + + static Object dictionaryWithObjectsAndKeys (Object dictionaryWithObjectsAndKeys, ...) + { + return invokeObjcSuperClass!(Object, "dictionaryWithObjectsAndKeys:", Object)(dictionaryWithObjectsAndKeys); + } + + static Object dictionaryWithDictionary (NSDictionary dict) + { + return invokeObjcSuperClass!(Object, "dictionaryWithDictionary:", NSDictionary)(dict); + } + + static Object dictionaryWithObjects (NSArray objects, NSArray keys) + { + return invokeObjcSuperClass!(Object, "dictionaryWithObjects:forKeys:", NSArray, NSArray)(objects, keys); + } + + Object initWithObjects (id* objects, id* keys, NSUInteger cnt) + { + return invokeObjcSelf!(Object, "initWithObjects:forKeys:count:", id*, id*, NSUInteger)(objects, keys, cnt); + } + + this (id* objects, id* keys, NSUInteger cnt) + { + typeof(this).alloc.initWithObjects(objects, keys, cnt); + } + + Object initWithObjectsAndKeys (Object initWithObjectsAndKeys, ...) + { + return invokeObjcSelf!(Object, "initWithObjectsAndKeys:", Object)(initWithObjectsAndKeys); + } + + this (Object initWithObjectsAndKeys, ...) + { + typeof(this).alloc.initWithObjectsAndKeys(initWithObjectsAndKeys); + } + + Object initWithDictionary (NSDictionary otherDictionary) + { + return invokeObjcSelf!(Object, "initWithDictionary:", NSDictionary)(otherDictionary); + } + + this (NSDictionary otherDictionary) + { + typeof(this).alloc.initWithDictionary(otherDictionary); + } + + Object initWithDictionary (NSDictionary otherDictionary, bool flag) + { + return invokeObjcSelf!(Object, "initWithDictionary:copyItems:", NSDictionary, bool)(otherDictionary, flag); + } + + this (NSDictionary otherDictionary, bool flag) + { + typeof(this).alloc.initWithDictionary(otherDictionary, flag); + } + + Object initWithObjects (NSArray objects, NSArray keys) + { + return invokeObjcSelf!(Object, "initWithObjects:forKeys:", NSArray, NSArray)(objects, keys); + } + + this (NSArray objects, NSArray keys) + { + typeof(this).alloc.initWithObjects(objects, keys); + } + + static Object dictionaryWithContentsOfFile (NSString path) + { + return invokeObjcSuperClass!(Object, "dictionaryWithContentsOfFile:", NSString)(path); + } + + static Object dictionaryWithContentsOfURL (NSURL url) + { + return invokeObjcSuperClass!(Object, "dictionaryWithContentsOfURL:", NSURL)(url); + } + + Object initWithContentsOfFile (NSString path) + { + return invokeObjcSelf!(Object, "initWithContentsOfFile:", NSString)(path); + } + + this (NSString path) + { + typeof(this).alloc.initWithContentsOfFile(path); + } + + Object initWithContentsOfURL (NSURL url) + { + return invokeObjcSelf!(Object, "initWithContentsOfURL:", NSURL)(url); + } + + this (NSURL url) + { + typeof(this).alloc.initWithContentsOfURL(url); + } + + // TNSFileAttributes + ulong fileSize () + { + return invokeObjcSelf!(ulong, "fileSize"); + } + + NSDate fileModificationDate () + { + return invokeObjcSelf!(NSDate, "fileModificationDate"); + } + + NSString fileType () + { + return invokeObjcSelf!(NSString, "fileType"); + } + + NSUInteger filePosixPermissions () + { + return invokeObjcSelf!(NSUInteger, "filePosixPermissions"); + } + + NSString fileOwnerAccountName () + { + return invokeObjcSelf!(NSString, "fileOwnerAccountName"); + } + + NSString fileGroupOwnerAccountName () + { + return invokeObjcSelf!(NSString, "fileGroupOwnerAccountName"); + } + + NSInteger fileSystemNumber () + { + return invokeObjcSelf!(NSInteger, "fileSystemNumber"); + } + + NSUInteger fileSystemFileNumber () + { + return invokeObjcSelf!(NSUInteger, "fileSystemFileNumber"); + } + + bool fileExtensionHidden () + { + return invokeObjcSelf!(bool, "fileExtensionHidden"); + } + + uint fileHFSCreatorCode () + { + return invokeObjcSelf!(uint, "fileHFSCreatorCode"); + } + + uint fileHFSTypeCode () + { + return invokeObjcSelf!(uint, "fileHFSTypeCode"); + } + + bool fileIsImmutable () + { + return invokeObjcSelf!(bool, "fileIsImmutable"); + } + + bool fileIsAppendOnly () + { + return invokeObjcSelf!(bool, "fileIsAppendOnly"); + } + + NSDate fileCreationDate () + { + return invokeObjcSelf!(NSDate, "fileCreationDate"); + } + + NSNumber fileOwnerAccountID () + { + return invokeObjcSelf!(NSNumber, "fileOwnerAccountID"); + } + + NSNumber fileGroupOwnerAccountID () + { + return invokeObjcSelf!(NSNumber, "fileGroupOwnerAccountID"); + } + + // TNSExtendedDictionary + NSArray allKeys () + { + return invokeObjcSelf!(NSArray, "allKeys"); + } + + NSArray allKeysForObject (Object anObject) + { + return invokeObjcSelf!(NSArray, "allKeysForObject:", Object)(anObject); + } + + NSArray allValues () + { + return invokeObjcSelf!(NSArray, "allValues"); + } + + NSString description () + { + return invokeObjcSelf!(NSString, "description"); + } + + NSString descriptionInStringsFileFormat () + { + return invokeObjcSelf!(NSString, "descriptionInStringsFileFormat"); + } + + NSString descriptionWithLocale (Object locale) + { + return invokeObjcSelf!(NSString, "descriptionWithLocale:", Object)(locale); + } + + NSString descriptionWithLocale (Object locale, NSUInteger level) + { + return invokeObjcSelf!(NSString, "descriptionWithLocale:indent:", Object, NSUInteger)(locale, level); + } + + bool isEqualToDictionary (NSDictionary otherDictionary) + { + return invokeObjcSelf!(bool, "isEqualToDictionary:", NSDictionary)(otherDictionary); + } + + NSEnumerator objectEnumerator () + { + return invokeObjcSelf!(NSEnumerator, "objectEnumerator"); + } + + NSArray objectsForKeys (NSArray keys, Object marker) + { + return invokeObjcSelf!(NSArray, "objectsForKeys:notFoundMarker:", NSArray, Object)(keys, marker); + } + + bool writeToFile (NSString path, bool useAuxiliaryFile) + { + return invokeObjcSelf!(bool, "writeToFile:atomically:", NSString, bool)(path, useAuxiliaryFile); + } + + bool writeToURL (NSURL url, bool atomically) + { + return invokeObjcSelf!(bool, "writeToURL:atomically:", NSURL, bool)(url, atomically); + } + + NSArray keysSortedByValueUsingSelector (SEL comparator) + { + return invokeObjcSelf!(NSArray, "keysSortedByValueUsingSelector:", SEL)(comparator); + } + + void getObjects (id* objects, id* keys) + { + return invokeObjcSelf!(void, "getObjects:andKeys:", id*, id*)(objects, keys); + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSDistantObject.d --- a/dstep/foundation/NSDistantObject.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSDistantObject.d Sun Jan 03 22:06:11 2010 +0100 @@ -8,18 +8,29 @@ import dstep.foundation.NSCoder; import dstep.foundation.NSConnection; +import dstep.foundation.NSObject; import dstep.foundation.NSProxy; -import dstep.foundation.Protocol; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; +import dstep.objc.runtime; class NSDistantObject : NSProxy, INSCoding { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static NSDistantObject proxyWithTarget (Object target, NSConnection connection) { - return invokeObjcSelfClass!(NSDistantObject, "proxyWithTarget:connection:", Object, NSConnection)(target, connection); + return invokeObjcSuperClass!(NSDistantObject, "proxyWithTarget:connection:", Object, NSConnection)(target, connection); } Object initWithTarget (Object target, NSConnection connection) @@ -29,36 +40,19 @@ this (Object target, NSConnection connection) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithTarget:connection:", Object, NSConnection)(objcObject, target, connection); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithTarget(target, connection); } static NSDistantObject proxyWithLocal (Object target, NSConnection connection) { - return invokeObjcSelfClass!(NSDistantObject, "proxyWithLocal:connection:", Object, NSConnection)(target, connection); + return invokeObjcSuperClass!(NSDistantObject, "proxyWithLocal:connection:", Object, NSConnection)(target, connection); } Object initWithLocal (Object target, NSConnection connection) { return invokeObjcSelf!(Object, "initWithLocal:connection:", Object, NSConnection)(target, connection); } - - this (Object target, NSConnection connection) - { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithLocal:connection:", Object, NSConnection)(objcObject, target, connection); - - if (result) - objcObject = ret; - - dObject = this; - } - + void setProtocolForProxy (Protocol proto) { return invokeObjcSelf!(void, "setProtocolForProxy:", Protocol)(proto); @@ -81,13 +75,7 @@ this (NSCoder aDecoder) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithCoder(aDecoder); } } diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSDistributedLock.d --- a/dstep/foundation/NSDistributedLock.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSDistributedLock.d Sun Jan 03 22:06:11 2010 +0100 @@ -8,16 +8,27 @@ import dstep.foundation.NSDate; import dstep.foundation.NSObject; +import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; class NSDistributedLock : NSObject { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static NSDistributedLock lockWithPath (NSString path) { - return invokeObjcSelfClass!(NSDistributedLock, "lockWithPath:", NSString)(path); + return invokeObjcSuperClass!(NSDistributedLock, "lockWithPath:", NSString)(path); } Object initWithPath (NSString path) @@ -27,13 +38,7 @@ this (NSString path) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithPath:", NSString)(objcObject, path); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithPath(path); } bool tryLock () diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSDistributedNotificationCenter.d --- a/dstep/foundation/NSDistributedNotificationCenter.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSDistributedNotificationCenter.d Sun Jan 03 22:06:11 2010 +0100 @@ -8,15 +8,26 @@ import dstep.foundation.NSDictionary; import dstep.foundation.NSNotification; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + import bindings = dstep.foundation.NSDistributedNotificationCenter_bindings; alias NSUInteger NSNotificationSuspensionBehavior; -const NSString NSLocalNotificationCenterType; +private NSString NSLocalNotificationCenterType_; + +NSString NSLocalNotificationCenterType () +{ + if (NSLocalNotificationCenterType_) + return NSLocalNotificationCenterType_; + + return NSLocalNotificationCenterType_ = new NSString(bindings.NSLocalNotificationCenterType); +} enum { @@ -32,23 +43,28 @@ NSNotificationPostToAllSessions = (1 << 1) } -static this () -{ - NSLocalNotificationCenterType = new NSString(bindings.NSLocalNotificationCenterType); -} - class NSDistributedNotificationCenter : NSNotificationCenter { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static NSDistributedNotificationCenter notificationCenterForType (NSString notificationCenterType) { - return invokeObjcSelfClass!(NSDistributedNotificationCenter, "notificationCenterForType:", NSString)(notificationCenterType); + return invokeObjcSuperClass!(NSDistributedNotificationCenter, "notificationCenterForType:", NSString)(notificationCenterType); } static Object defaultCenter () { - return invokeObjcSelfClass!(Object, "defaultCenter"); + return invokeObjcSuperClass!(Object, "defaultCenter"); } void addObserver (Object observer, SEL selector, NSString name, NSString object, uint suspensionBehavior) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSDistributedNotificationCenter_bindings.d --- a/dstep/foundation/NSDistributedNotificationCenter_bindings.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSDistributedNotificationCenter_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -4,7 +4,9 @@ import dstep.foundation.NSNotification; import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + extern (C) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSEnumerator.d --- a/dstep/foundation/NSEnumerator.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSEnumerator.d Sun Jan 03 22:06:11 2010 +0100 @@ -7,22 +7,40 @@ module dstep.foundation.NSEnumerator; import dstep.foundation.NSArray; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; struct NSFastEnumerationState { uint state; id* itemsPtr; - unsigned long* mutationsPtr; - unsigned long* extra; + ulong* mutationsPtr; + ulong* extra; } +const TNSExtendedEnumerator = ` + + NSArray allObjects () + { + return invokeObjcSelf!(NSArray, "allObjects"); + } +`; + class NSEnumerator : NSObject, INSFastEnumeration { - mixin ObjcWrap; - mixin TNSExtendedEnumerator; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } Object nextObject () { @@ -33,18 +51,15 @@ { return invokeObjcSelf!(NSUInteger, "countByEnumeratingWithState:objects:count:", NSFastEnumerationState*, id*, NSUInteger)(state, stackbuf, len); } -} - -interface INSFastEnumeration -{ - NSUInteger countByEnumeratingWithState (NSFastEnumerationState* state, id* stackbuf, NSUInteger len); -} - -template TNSExtendedEnumerator () -{ + + // TNSExtendedEnumerator NSArray allObjects () { return invokeObjcSelf!(NSArray, "allObjects"); } } +interface INSFastEnumeration +{ + NSUInteger countByEnumeratingWithState (NSFastEnumerationState* state, id* stackbuf, NSUInteger len); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSError.d --- a/dstep/foundation/NSError.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSError.d Sun Jan 03 22:06:11 2010 +0100 @@ -7,47 +7,169 @@ module dstep.foundation.NSError; import dstep.foundation.NSArray; +import dstep.foundation.NSCoder; import dstep.foundation.NSDictionary; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSZone; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + import bindings = dstep.foundation.NSError_bindings; -const NSString NSCocoaErrorDomain; -const NSString NSPOSIXErrorDomain; -const NSString NSOSStatusErrorDomain; -const NSString NSMachErrorDomain; -const NSString NSUnderlyingErrorKey; -const NSString NSLocalizedDescriptionKey; -const NSString NSLocalizedFailureReasonErrorKey; -const NSString NSLocalizedRecoverySuggestionErrorKey; -const NSString NSLocalizedRecoveryOptionsErrorKey; -const NSString NSRecoveryAttempterErrorKey; -const NSString NSStringEncodingErrorKey; -const NSString NSURLErrorKey; -const NSString NSFilePathErrorKey; +private +{ + NSString NSCocoaErrorDomain_; + NSString NSPOSIXErrorDomain_; + NSString NSOSStatusErrorDomain_; + NSString NSMachErrorDomain_; + NSString NSUnderlyingErrorKey_; + NSString NSLocalizedDescriptionKey_; + NSString NSLocalizedFailureReasonErrorKey_; + NSString NSLocalizedRecoverySuggestionErrorKey_; + NSString NSLocalizedRecoveryOptionsErrorKey_; + NSString NSRecoveryAttempterErrorKey_; + NSString NSStringEncodingErrorKey_; + NSString NSURLErrorKey_; + NSString NSFilePathErrorKey_; +} + +NSString NSCocoaErrorDomain () +{ + if (NSCocoaErrorDomain_) + return NSCocoaErrorDomain_; + + return NSCocoaErrorDomain_ = new NSString(bindings.NSCocoaErrorDomain); +} + +NSString NSPOSIXErrorDomain () +{ + if (NSPOSIXErrorDomain_) + return NSPOSIXErrorDomain_; + + return NSPOSIXErrorDomain_ = new NSString(bindings.NSPOSIXErrorDomain); +} + +NSString NSOSStatusErrorDomain () +{ + if (NSOSStatusErrorDomain_) + return NSOSStatusErrorDomain_; + + return NSOSStatusErrorDomain_ = new NSString(bindings.NSOSStatusErrorDomain); +} + +NSString NSMachErrorDomain () +{ + if (NSMachErrorDomain_) + return NSMachErrorDomain_; + + return NSMachErrorDomain_ = new NSString(bindings.NSMachErrorDomain); +} + +NSString NSUnderlyingErrorKey () +{ + if (NSUnderlyingErrorKey_) + return NSUnderlyingErrorKey_; + + return NSUnderlyingErrorKey_ = new NSString(bindings.NSUnderlyingErrorKey); +} + +NSString NSLocalizedDescriptionKey () +{ + if (NSLocalizedDescriptionKey_) + return NSLocalizedDescriptionKey_; + + return NSLocalizedDescriptionKey_ = new NSString(bindings.NSLocalizedDescriptionKey); +} -static this () +NSString NSLocalizedFailureReasonErrorKey () +{ + if (NSLocalizedFailureReasonErrorKey_) + return NSLocalizedFailureReasonErrorKey_; + + return NSLocalizedFailureReasonErrorKey_ = new NSString(bindings.NSLocalizedFailureReasonErrorKey); +} + +NSString NSLocalizedRecoverySuggestionErrorKey () +{ + if (NSLocalizedRecoverySuggestionErrorKey_) + return NSLocalizedRecoverySuggestionErrorKey_; + + return NSLocalizedRecoverySuggestionErrorKey_ = new NSString(bindings.NSLocalizedRecoverySuggestionErrorKey); +} + +NSString NSLocalizedRecoveryOptionsErrorKey () +{ + if (NSLocalizedRecoveryOptionsErrorKey_) + return NSLocalizedRecoveryOptionsErrorKey_; + + return NSLocalizedRecoveryOptionsErrorKey_ = new NSString(bindings.NSLocalizedRecoveryOptionsErrorKey); +} + +NSString NSRecoveryAttempterErrorKey () +{ + if (NSRecoveryAttempterErrorKey_) + return NSRecoveryAttempterErrorKey_; + + return NSRecoveryAttempterErrorKey_ = new NSString(bindings.NSRecoveryAttempterErrorKey); +} + +NSString NSStringEncodingErrorKey () { - NSCocoaErrorDomain = new NSString(bindings.NSCocoaErrorDomain); - NSPOSIXErrorDomain = new NSString(bindings.NSPOSIXErrorDomain); - NSOSStatusErrorDomain = new NSString(bindings.NSOSStatusErrorDomain); - NSMachErrorDomain = new NSString(bindings.NSMachErrorDomain); - NSUnderlyingErrorKey = new NSString(bindings.NSUnderlyingErrorKey); - NSLocalizedDescriptionKey = new NSString(bindings.NSLocalizedDescriptionKey); - NSLocalizedFailureReasonErrorKey = new NSString(bindings.NSLocalizedFailureReasonErrorKey); - NSLocalizedRecoverySuggestionErrorKey = new NSString(bindings.NSLocalizedRecoverySuggestionErrorKey); - NSLocalizedRecoveryOptionsErrorKey = new NSString(bindings.NSLocalizedRecoveryOptionsErrorKey); - NSRecoveryAttempterErrorKey = new NSString(bindings.NSRecoveryAttempterErrorKey); - NSStringEncodingErrorKey = new NSString(bindings.NSStringEncodingErrorKey); - NSURLErrorKey = new NSString(bindings.NSURLErrorKey); - NSFilePathErrorKey = new NSString(bindings.NSFilePathErrorKey); + if (NSStringEncodingErrorKey_) + return NSStringEncodingErrorKey_; + + return NSStringEncodingErrorKey_ = new NSString(bindings.NSStringEncodingErrorKey); +} + +NSString NSURLErrorKey () +{ + if (NSURLErrorKey_) + return NSURLErrorKey_; + + return NSURLErrorKey_ = new NSString(bindings.NSURLErrorKey); } +NSString NSFilePathErrorKey () +{ + if (NSFilePathErrorKey_) + return NSFilePathErrorKey_; + + return NSFilePathErrorKey_ = new NSString(bindings.NSFilePathErrorKey); +} + +const TNSErrorRecoveryAttempting = ` + + void attemptRecoveryFromError (NSError error, NSUInteger recoveryOptionIndex, Object delegate_, SEL didRecoverSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "attemptRecoveryFromError:optionIndexdelegate:didRecoverSelector:contextInfo:", NSError, NSUInteger, Object, SEL, void*)(error, recoveryOptionIndex, delegate_, didRecoverSelector, contextInfo); + } + + bool attemptRecoveryFromError (NSError error, NSUInteger recoveryOptionIndex) + { + return invokeObjcSelf!(bool, "attemptRecoveryFromError:optionIndex:", NSError, NSUInteger)(error, recoveryOptionIndex); + } + + //mixin ObjcBindMethod!(attemptRecoveryFromError, void, "attemptRecoveryFromError:optionIndexdelegate:didRecoverSelector:contextInfo:", NSError, NSUInteger, Object, SEL, void*); + //mixin ObjcBindMethod!(attemptRecoveryFromError, bool, "attemptRecoveryFromError:optionIndex:", NSError, NSUInteger); +`; + class NSError : NSObject, INSCopying, INSCoding { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } Object initWithDomain (NSString domain, NSInteger code, NSDictionary dict) { @@ -56,18 +178,12 @@ this (NSString domain, NSInteger code, NSDictionary dict) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithDomain:code:userInfo:", NSString, NSInteger, NSDictionary)(objcObject, domain, code, dict); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithDomain(domain, code, dict); } static Object errorWithDomain (NSString domain, NSInteger code, NSDictionary dict) { - return invokeObjcSelfClass!(Object, "errorWithDomain:code:userInfo:", NSString, NSInteger, NSDictionary)(domain, code, dict); + return invokeObjcSuperClass!(Object, "errorWithDomain:code:userInfo:", NSString, NSInteger, NSDictionary)(domain, code, dict); } NSString domain () @@ -127,19 +243,6 @@ this (NSCoder aDecoder) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithCoder(aDecoder); } -} - -template TNSErrorRecoveryAttempting () -{ - void attemptRecoveryFromError (NSError error, NSUInteger recoveryOptionIndex, Object delegate_, SEL didRecoverSelector, void* contextInfo); - bool attemptRecoveryFromError (NSError error, NSUInteger recoveryOptionIndex); -} - +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSError_bindings.d --- a/dstep/foundation/NSError_bindings.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSError_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -4,7 +4,9 @@ import dstep.foundation.NSDictionary; import dstep.foundation.NSObject; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + extern (C) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSException.d --- a/dstep/foundation/NSException.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSException.d Sun Jan 03 22:06:11 2010 +0100 @@ -7,62 +7,184 @@ module dstep.foundation.NSException; import dstep.foundation.NSArray; -import dstep.foundation.NSAssertionHandler; +import dstep.foundation.NSCoder; import dstep.foundation.NSDictionary; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; import dstep.foundation.NSString; +import dstep.foundation.NSZone; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; -import dstep.setjmp; -import dstep.stdarg; +import dstep.objc.objc; + + import bindings = dstep.foundation.NSException_bindings; extern (C) { - alias void function (id) NSUncaughtExceptionHandler *; + alias void function (id) NSUncaughtExceptionHandler; +} + +private +{ + NSString NSGenericException_; + NSString NSRangeException_; + NSString NSInvalidArgumentException_; + NSString NSInternalInconsistencyException_; + NSString NSMallocException_; + NSString NSObjectInaccessibleException_; + NSString NSObjectNotAvailableException_; + NSString NSDestinationInvalidException_; + NSString NSPortTimeoutException_; + NSString NSInvalidSendPortException_; + NSString NSInvalidReceivePortException_; + NSString NSPortSendException_; + NSString NSPortReceiveException_; + NSString NSOldStyleException_; +} + +NSString NSGenericException () +{ + if (NSGenericException_) + return NSGenericException_; + + return NSGenericException_ = new NSString(bindings.NSGenericException); +} + +NSString NSRangeException () +{ + if (NSRangeException_) + return NSRangeException_; + + return NSRangeException_ = new NSString(bindings.NSRangeException); +} + +NSString NSInvalidArgumentException () +{ + if (NSInvalidArgumentException_) + return NSInvalidArgumentException_; + + return NSInvalidArgumentException_ = new NSString(bindings.NSInvalidArgumentException); +} + +NSString NSInternalInconsistencyException () +{ + if (NSInternalInconsistencyException_) + return NSInternalInconsistencyException_; + + return NSInternalInconsistencyException_ = new NSString(bindings.NSInternalInconsistencyException); +} + +NSString NSMallocException () +{ + if (NSMallocException_) + return NSMallocException_; + + return NSMallocException_ = new NSString(bindings.NSMallocException); +} + +NSString NSObjectInaccessibleException () +{ + if (NSObjectInaccessibleException_) + return NSObjectInaccessibleException_; + + return NSObjectInaccessibleException_ = new NSString(bindings.NSObjectInaccessibleException); } -const NSString NSGenericException; -const NSString NSRangeException; -const NSString NSInvalidArgumentException; -const NSString NSInternalInconsistencyException; -const NSString NSMallocException; -const NSString NSObjectInaccessibleException; -const NSString NSObjectNotAvailableException; -const NSString NSDestinationInvalidException; -const NSString NSPortTimeoutException; -const NSString NSInvalidSendPortException; -const NSString NSInvalidReceivePortException; -const NSString NSPortSendException; -const NSString NSPortReceiveException; -const NSString NSOldStyleException; +NSString NSObjectNotAvailableException () +{ + if (NSObjectNotAvailableException_) + return NSObjectNotAvailableException_; + + return NSObjectNotAvailableException_ = new NSString(bindings.NSObjectNotAvailableException); +} + +NSString NSDestinationInvalidException () +{ + if (NSDestinationInvalidException_) + return NSDestinationInvalidException_; + + return NSDestinationInvalidException_ = new NSString(bindings.NSDestinationInvalidException); +} + +NSString NSPortTimeoutException () +{ + if (NSPortTimeoutException_) + return NSPortTimeoutException_; + + return NSPortTimeoutException_ = new NSString(bindings.NSPortTimeoutException); +} + +NSString NSInvalidSendPortException () +{ + if (NSInvalidSendPortException_) + return NSInvalidSendPortException_; + + return NSInvalidSendPortException_ = new NSString(bindings.NSInvalidSendPortException); +} -static this () +NSString NSInvalidReceivePortException () +{ + if (NSInvalidReceivePortException_) + return NSInvalidReceivePortException_; + + return NSInvalidReceivePortException_ = new NSString(bindings.NSInvalidReceivePortException); +} + +NSString NSPortSendException () +{ + if (NSPortSendException_) + return NSPortSendException_; + + return NSPortSendException_ = new NSString(bindings.NSPortSendException); +} + +NSString NSPortReceiveException () { - NSGenericException = new NSString(bindings.NSGenericException); - NSRangeException = new NSString(bindings.NSRangeException); - NSInvalidArgumentException = new NSString(bindings.NSInvalidArgumentException); - NSInternalInconsistencyException = new NSString(bindings.NSInternalInconsistencyException); - NSMallocException = new NSString(bindings.NSMallocException); - NSObjectInaccessibleException = new NSString(bindings.NSObjectInaccessibleException); - NSObjectNotAvailableException = new NSString(bindings.NSObjectNotAvailableException); - NSDestinationInvalidException = new NSString(bindings.NSDestinationInvalidException); - NSPortTimeoutException = new NSString(bindings.NSPortTimeoutException); - NSInvalidSendPortException = new NSString(bindings.NSInvalidSendPortException); - NSInvalidReceivePortException = new NSString(bindings.NSInvalidReceivePortException); - NSPortSendException = new NSString(bindings.NSPortSendException); - NSPortReceiveException = new NSString(bindings.NSPortReceiveException); - NSOldStyleException = new NSString(bindings.NSOldStyleException); + if (NSPortReceiveException_) + return NSPortReceiveException_; + + return NSPortReceiveException_ = new NSString(bindings.NSPortReceiveException); +} + +NSString NSOldStyleException () +{ + if (NSOldStyleException_) + return NSOldStyleException_; + + return NSOldStyleException_ = new NSString(bindings.NSOldStyleException); } +const TNSExceptionRaisingConveniences = ` + + static void raise (NSString name, NSString format, ...) + { + return invokeObjcSuperClass!(void, "raise:format:", NSString, NSString)(name, format); + } + + static void raise (NSString name, NSString format, char* argList) + { + return invokeObjcSuperClass!(void, "raise:format:arguments:", NSString, NSString, char*)(name, format, argList); + } +`; + class NSAssertionHandler : NSObject { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static NSAssertionHandler currentHandler () { - return invokeObjcSelfClass!(NSAssertionHandler, "currentHandler"); + return invokeObjcSuperClass!(NSAssertionHandler, "currentHandler"); } void handleFailureInMethod (SEL selector, Object object, NSString fileName, NSInteger line, NSString description, ...) @@ -78,12 +200,21 @@ class NSException : NSObject, INSCopying, INSCoding { - mixin ObjcWrap; - mixin TNSExceptionRaisingConveniences; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static NSException exceptionWithName (NSString name, NSString reason, NSDictionary userInfo) { - return invokeObjcSelfClass!(NSException, "exceptionWithName:reason:userInfo:", NSString, NSString, NSDictionary)(name, reason, userInfo); + return invokeObjcSuperClass!(NSException, "exceptionWithName:reason:userInfo:", NSString, NSString, NSDictionary)(name, reason, userInfo); } Object initWithName (NSString aName, NSString aReason, NSDictionary aUserInfo) @@ -93,13 +224,7 @@ this (NSString aName, NSString aReason, NSDictionary aUserInfo) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithName:reason:userInfo:", NSString, NSString, NSDictionary)(objcObject, aName, aReason, aUserInfo); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithName(aName, aReason, aUserInfo); } NSString name () @@ -144,26 +269,18 @@ this (NSCoder aDecoder) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithCoder(aDecoder); } -} - -template TNSExceptionRaisingConveniences () -{ + + // TNSExceptionRaisingConveniences static void raise (NSString name, NSString format, ...) { - return invokeObjcSelfClass!(void, "raise:format:", NSString, NSString)(name, format); + return invokeObjcSuperClass!(void, "raise:format:", NSString, NSString)(name, format); } - + static void raise (NSString name, NSString format, char* argList) { - return invokeObjcSelfClass!(void, "raise:format:arguments:", NSString, NSString, char*)(name, format, argList); + return invokeObjcSuperClass!(void, "raise:format:arguments:", NSString, NSString, char*)(name, format, argList); } } diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSException_bindings.d --- a/dstep/foundation/NSException_bindings.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSException_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -1,14 +1,8 @@ module dstep.foundation.NSException_bindings; -import dstep.foundation.NSArray; -import dstep.foundation.NSAssertionHandler; -import dstep.foundation.NSDictionary; -import dstep.foundation.NSObject; -import dstep.foundation.NSString; -import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; -import dstep.setjmp; -import dstep.stdarg; +import dstep.objc.objc; + + extern (C) @@ -30,8 +24,4 @@ package const id NSPortReceiveException; package const id NSOldStyleException; } -} - -extern (C) -{ } \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSExpression.d --- a/dstep/foundation/NSExpression.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSExpression.d Sun Jan 03 22:06:11 2010 +0100 @@ -7,12 +7,15 @@ module dstep.foundation.NSExpression; import dstep.foundation.NSArray; -import dstep.foundation.NSMutableDictionary; +import dstep.foundation.NSCoder; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; import dstep.foundation.NSPredicate; import dstep.foundation.NSString; +import dstep.foundation.NSZone; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; alias NSUInteger NSExpressionType; @@ -32,61 +35,71 @@ class NSExpression : NSObject, INSCoding, INSCopying { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static NSExpression expressionForConstantValue (Object obj) { - return invokeObjcSelfClass!(NSExpression, "expressionForConstantValue:", Object)(obj); + return invokeObjcSuperClass!(NSExpression, "expressionForConstantValue:", Object)(obj); } static NSExpression expressionForEvaluatedObject () { - return invokeObjcSelfClass!(NSExpression, "expressionForEvaluatedObject"); + return invokeObjcSuperClass!(NSExpression, "expressionForEvaluatedObject"); } static NSExpression expressionForVariable (NSString string) { - return invokeObjcSelfClass!(NSExpression, "expressionForVariable:", NSString)(string); + return invokeObjcSuperClass!(NSExpression, "expressionForVariable:", NSString)(string); } static NSExpression expressionForKeyPath (NSString keyPath) { - return invokeObjcSelfClass!(NSExpression, "expressionForKeyPath:", NSString)(keyPath); + return invokeObjcSuperClass!(NSExpression, "expressionForKeyPath:", NSString)(keyPath); } static NSExpression expressionForFunction (NSString name, NSArray parameters) { - return invokeObjcSelfClass!(NSExpression, "expressionForFunction:arguments:", NSString, NSArray)(name, parameters); + return invokeObjcSuperClass!(NSExpression, "expressionForFunction:arguments:", NSString, NSArray)(name, parameters); } static NSExpression expressionForAggregate (NSArray subexpressions) { - return invokeObjcSelfClass!(NSExpression, "expressionForAggregate:", NSArray)(subexpressions); + return invokeObjcSuperClass!(NSExpression, "expressionForAggregate:", NSArray)(subexpressions); } static NSExpression expressionForUnionSet (NSExpression left, NSExpression right) { - return invokeObjcSelfClass!(NSExpression, "expressionForUnionSet:with:", NSExpression, NSExpression)(left, right); + return invokeObjcSuperClass!(NSExpression, "expressionForUnionSet:with:", NSExpression, NSExpression)(left, right); } static NSExpression expressionForIntersectSet (NSExpression left, NSExpression right) { - return invokeObjcSelfClass!(NSExpression, "expressionForIntersectSet:with:", NSExpression, NSExpression)(left, right); + return invokeObjcSuperClass!(NSExpression, "expressionForIntersectSet:with:", NSExpression, NSExpression)(left, right); } static NSExpression expressionForMinusSet (NSExpression left, NSExpression right) { - return invokeObjcSelfClass!(NSExpression, "expressionForMinusSet:with:", NSExpression, NSExpression)(left, right); + return invokeObjcSuperClass!(NSExpression, "expressionForMinusSet:with:", NSExpression, NSExpression)(left, right); } static NSExpression expressionForSubquery (NSExpression expression, NSString variable, Object predicate) { - return invokeObjcSelfClass!(NSExpression, "expressionForSubquery:usingIteratorVariable:predicate:", NSExpression, NSString, Object)(expression, variable, predicate); + return invokeObjcSuperClass!(NSExpression, "expressionForSubquery:usingIteratorVariable:predicate:", NSExpression, NSString, Object)(expression, variable, predicate); } static NSExpression expressionForFunction (NSExpression target, NSString name, NSArray parameters) { - return invokeObjcSelfClass!(NSExpression, "expressionForFunction:selectorName:arguments:", NSExpression, NSString, NSArray)(target, name, parameters); + return invokeObjcSuperClass!(NSExpression, "expressionForFunction:selectorName:arguments:", NSExpression, NSString, NSArray)(target, name, parameters); } Object initWithExpressionType (uint type) @@ -96,13 +109,7 @@ this (uint type) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithExpressionType:", uint)(objcObject, type); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithExpressionType(type); } uint expressionType () @@ -180,13 +187,7 @@ this (NSCoder aDecoder) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithCoder(aDecoder); } Object copyWithZone (NSZone* zone) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSFileHandle.d --- a/dstep/foundation/NSFileHandle.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSFileHandle.d Sun Jan 03 22:06:11 2010 +0100 @@ -8,38 +8,213 @@ import dstep.foundation.NSArray; import dstep.foundation.NSData; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; import dstep.foundation.NSRange; import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; import bindings = dstep.foundation.NSFileHandle_bindings; -const NSString NSFileHandleOperationException; -const NSString NSFileHandleReadCompletionNotification; -const NSString NSFileHandleReadToEndOfFileCompletionNotification; -const NSString NSFileHandleConnectionAcceptedNotification; -const NSString NSFileHandleDataAvailableNotification; -const NSString NSFileHandleNotificationDataItem; -const NSString NSFileHandleNotificationFileHandleItem; -const NSString NSFileHandleNotificationMonitorModes; +private +{ + NSString NSFileHandleOperationException_; + NSString NSFileHandleReadCompletionNotification_; + NSString NSFileHandleReadToEndOfFileCompletionNotification_; + NSString NSFileHandleConnectionAcceptedNotification_; + NSString NSFileHandleDataAvailableNotification_; + NSString NSFileHandleNotificationDataItem_; + NSString NSFileHandleNotificationFileHandleItem_; + NSString NSFileHandleNotificationMonitorModes_; +} + +NSString NSFileHandleOperationException () +{ + if (NSFileHandleOperationException_) + return NSFileHandleOperationException_; + + return NSFileHandleOperationException_ = new NSString(bindings.NSFileHandleOperationException); +} + +NSString NSFileHandleReadCompletionNotification () +{ + if (NSFileHandleReadCompletionNotification_) + return NSFileHandleReadCompletionNotification_; + + return NSFileHandleReadCompletionNotification_ = new NSString(bindings.NSFileHandleReadCompletionNotification); +} + +NSString NSFileHandleReadToEndOfFileCompletionNotification () +{ + if (NSFileHandleReadToEndOfFileCompletionNotification_) + return NSFileHandleReadToEndOfFileCompletionNotification_; + + return NSFileHandleReadToEndOfFileCompletionNotification_ = new NSString(bindings.NSFileHandleReadToEndOfFileCompletionNotification); +} + +NSString NSFileHandleConnectionAcceptedNotification () +{ + if (NSFileHandleConnectionAcceptedNotification_) + return NSFileHandleConnectionAcceptedNotification_; + + return NSFileHandleConnectionAcceptedNotification_ = new NSString(bindings.NSFileHandleConnectionAcceptedNotification); +} + +NSString NSFileHandleDataAvailableNotification () +{ + if (NSFileHandleDataAvailableNotification_) + return NSFileHandleDataAvailableNotification_; + + return NSFileHandleDataAvailableNotification_ = new NSString(bindings.NSFileHandleDataAvailableNotification); +} + +NSString NSFileHandleNotificationDataItem () +{ + if (NSFileHandleNotificationDataItem_) + return NSFileHandleNotificationDataItem_; + + return NSFileHandleNotificationDataItem_ = new NSString(bindings.NSFileHandleNotificationDataItem); +} + +NSString NSFileHandleNotificationFileHandleItem () +{ + if (NSFileHandleNotificationFileHandleItem_) + return NSFileHandleNotificationFileHandleItem_; + + return NSFileHandleNotificationFileHandleItem_ = new NSString(bindings.NSFileHandleNotificationFileHandleItem); +} + +NSString NSFileHandleNotificationMonitorModes () +{ + if (NSFileHandleNotificationMonitorModes_) + return NSFileHandleNotificationMonitorModes_; + + return NSFileHandleNotificationMonitorModes_ = new NSString(bindings.NSFileHandleNotificationMonitorModes); +} + +const TNSFileHandleAsynchronousAccess = ` + + void readInBackgroundAndNotifyForModes (NSArray modes) + { + return invokeObjcSelf!(void, "readInBackgroundAndNotifyForModes:", NSArray)(modes); + } + + void readInBackgroundAndNotify () + { + return invokeObjcSelf!(void, "readInBackgroundAndNotify"); + } -static this () -{ - NSFileHandleOperationException = new NSString(bindings.NSFileHandleOperationException); - NSFileHandleReadCompletionNotification = new NSString(bindings.NSFileHandleReadCompletionNotification); - NSFileHandleReadToEndOfFileCompletionNotification = new NSString(bindings.NSFileHandleReadToEndOfFileCompletionNotification); - NSFileHandleConnectionAcceptedNotification = new NSString(bindings.NSFileHandleConnectionAcceptedNotification); - NSFileHandleDataAvailableNotification = new NSString(bindings.NSFileHandleDataAvailableNotification); - NSFileHandleNotificationDataItem = new NSString(bindings.NSFileHandleNotificationDataItem); - NSFileHandleNotificationFileHandleItem = new NSString(bindings.NSFileHandleNotificationFileHandleItem); - NSFileHandleNotificationMonitorModes = new NSString(bindings.NSFileHandleNotificationMonitorModes); -} + void readToEndOfFileInBackgroundAndNotifyForModes (NSArray modes) + { + return invokeObjcSelf!(void, "readToEndOfFileInBackgroundAndNotifyForModes:", NSArray)(modes); + } + + void readToEndOfFileInBackgroundAndNotify () + { + return invokeObjcSelf!(void, "readToEndOfFileInBackgroundAndNotify"); + } + + void acceptConnectionInBackgroundAndNotifyForModes (NSArray modes) + { + return invokeObjcSelf!(void, "acceptConnectionInBackgroundAndNotifyForModes:", NSArray)(modes); + } + + void acceptConnectionInBackgroundAndNotify () + { + return invokeObjcSelf!(void, "acceptConnectionInBackgroundAndNotify"); + } + + void waitForDataInBackgroundAndNotifyForModes (NSArray modes) + { + return invokeObjcSelf!(void, "waitForDataInBackgroundAndNotifyForModes:", NSArray)(modes); + } + + void waitForDataInBackgroundAndNotify () + { + return invokeObjcSelf!(void, "waitForDataInBackgroundAndNotify"); + } +`; + +const TNSFileHandleCreation = ` + + static Object fileHandleWithStandardInput () + { + return invokeObjcSuperClass!(Object, "fileHandleWithStandardInput"); + } + + static Object fileHandleWithStandardOutput () + { + return invokeObjcSuperClass!(Object, "fileHandleWithStandardOutput"); + } + + static Object fileHandleWithStandardError () + { + return invokeObjcSuperClass!(Object, "fileHandleWithStandardError"); + } + + static Object fileHandleWithNullDevice () + { + return invokeObjcSuperClass!(Object, "fileHandleWithNullDevice"); + } + + static Object fileHandleForReadingAtPath (NSString path) + { + return invokeObjcSuperClass!(Object, "fileHandleForReadingAtPath:", NSString)(path); + } + + static Object fileHandleForWritingAtPath (NSString path) + { + return invokeObjcSuperClass!(Object, "fileHandleForWritingAtPath:", NSString)(path); + } + + static Object fileHandleForUpdatingAtPath (NSString path) + { + return invokeObjcSuperClass!(Object, "fileHandleForUpdatingAtPath:", NSString)(path); + } +`; + +const TNSFileHandlePlatformSpecific = ` + + Object initWithFileDescriptor (int fd, bool closeopt) + { + return invokeObjcSelf!(Object, "initWithFileDescriptor:closeOnDealloc:", int, bool)(fd, closeopt); + } + + this (int fd, bool closeopt) + { + typeof(this).alloc.initWithFileDescriptor(fd, closeopt); + } + + Object initWithFileDescriptor (int fd) + { + return invokeObjcSelf!(Object, "initWithFileDescriptor:", int)(fd); + } + + this (int fd) + { + typeof(this).alloc.initWithFileDescriptor(fd); + } + + int fileDescriptor () + { + return invokeObjcSelf!(int, "fileDescriptor"); + } +`; class NSPipe : NSObject { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } NSFileHandle fileHandleForReading () { @@ -51,34 +226,25 @@ return invokeObjcSelf!(NSFileHandle, "fileHandleForWriting"); } - Object init () - { - return invokeObjcSelf!(Object, "init"); - } - - this () - { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "init")(objcObject); - - if (result) - objcObject = ret; - - dObject = this; - } - static Object pipe () { - return invokeObjcSelfClass!(Object, "pipe"); + return invokeObjcSuperClass!(Object, "pipe"); } } class NSFileHandle : NSObject { - mixin ObjcWrap; - mixin TNSFileHandleAsynchronousAccess; - mixin TNSFileHandleCreation; - mixin TNSFileHandlePlatformSpecific; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } NSData availableData () { @@ -129,126 +295,107 @@ { return invokeObjcSelf!(void, "closeFile"); } -} - -template TNSFileHandleAsynchronousAccess () -{ + + // TNSFileHandleAsynchronousAccess void readInBackgroundAndNotifyForModes (NSArray modes) { return invokeObjcSelf!(void, "readInBackgroundAndNotifyForModes:", NSArray)(modes); } - + void readInBackgroundAndNotify () { return invokeObjcSelf!(void, "readInBackgroundAndNotify"); } - + void readToEndOfFileInBackgroundAndNotifyForModes (NSArray modes) { return invokeObjcSelf!(void, "readToEndOfFileInBackgroundAndNotifyForModes:", NSArray)(modes); } - + void readToEndOfFileInBackgroundAndNotify () { return invokeObjcSelf!(void, "readToEndOfFileInBackgroundAndNotify"); } - + void acceptConnectionInBackgroundAndNotifyForModes (NSArray modes) { return invokeObjcSelf!(void, "acceptConnectionInBackgroundAndNotifyForModes:", NSArray)(modes); } - + void acceptConnectionInBackgroundAndNotify () { return invokeObjcSelf!(void, "acceptConnectionInBackgroundAndNotify"); } - + void waitForDataInBackgroundAndNotifyForModes (NSArray modes) { return invokeObjcSelf!(void, "waitForDataInBackgroundAndNotifyForModes:", NSArray)(modes); } - + void waitForDataInBackgroundAndNotify () { return invokeObjcSelf!(void, "waitForDataInBackgroundAndNotify"); } -} - -template TNSFileHandleCreation () -{ + + // TNSFileHandleCreation static Object fileHandleWithStandardInput () { - return invokeObjcSelfClass!(Object, "fileHandleWithStandardInput"); + return invokeObjcSuperClass!(Object, "fileHandleWithStandardInput"); } - + static Object fileHandleWithStandardOutput () { - return invokeObjcSelfClass!(Object, "fileHandleWithStandardOutput"); + return invokeObjcSuperClass!(Object, "fileHandleWithStandardOutput"); } - + static Object fileHandleWithStandardError () { - return invokeObjcSelfClass!(Object, "fileHandleWithStandardError"); + return invokeObjcSuperClass!(Object, "fileHandleWithStandardError"); } - + static Object fileHandleWithNullDevice () { - return invokeObjcSelfClass!(Object, "fileHandleWithNullDevice"); + return invokeObjcSuperClass!(Object, "fileHandleWithNullDevice"); } - + static Object fileHandleForReadingAtPath (NSString path) { - return invokeObjcSelfClass!(Object, "fileHandleForReadingAtPath:", NSString)(path); + return invokeObjcSuperClass!(Object, "fileHandleForReadingAtPath:", NSString)(path); } - + static Object fileHandleForWritingAtPath (NSString path) { - return invokeObjcSelfClass!(Object, "fileHandleForWritingAtPath:", NSString)(path); + return invokeObjcSuperClass!(Object, "fileHandleForWritingAtPath:", NSString)(path); } - + static Object fileHandleForUpdatingAtPath (NSString path) { - return invokeObjcSelfClass!(Object, "fileHandleForUpdatingAtPath:", NSString)(path); + return invokeObjcSuperClass!(Object, "fileHandleForUpdatingAtPath:", NSString)(path); } -} - -template TNSFileHandlePlatformSpecific () -{ + + // TNSFileHandlePlatformSpecific Object initWithFileDescriptor (int fd, bool closeopt) { return invokeObjcSelf!(Object, "initWithFileDescriptor:closeOnDealloc:", int, bool)(fd, closeopt); } - + this (int fd, bool closeopt) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithFileDescriptor:closeOnDealloc:", int, bool)(objcObject, fd, closeopt); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithFileDescriptor(fd, closeopt); } - + Object initWithFileDescriptor (int fd) { return invokeObjcSelf!(Object, "initWithFileDescriptor:", int)(fd); } - + this (int fd) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithFileDescriptor:", int)(objcObject, fd); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithFileDescriptor(fd); } - + int fileDescriptor () { return invokeObjcSelf!(int, "fileDescriptor"); } -} - +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSFileHandle_bindings.d --- a/dstep/foundation/NSFileHandle_bindings.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSFileHandle_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,7 +6,9 @@ import dstep.foundation.NSRange; import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + extern (C) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSFileManager.d --- a/dstep/foundation/NSFileManager.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSFileManager.d Sun Jan 03 22:06:11 2010 +0100 @@ -11,341 +11,361 @@ import dstep.foundation.NSData; import dstep.foundation.NSDate; import dstep.foundation.NSDictionary; -import dstep.foundation.NSDirectoryEnumerator; import dstep.foundation.NSEnumerator; import dstep.foundation.NSError; -import dstep.foundation.NSNumber; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSValue; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; import bindings = dstep.foundation.NSFileManager_bindings; -const NSString NSFileType; -const NSString NSFileTypeDirectory; -const NSString NSFileTypeRegular; -const NSString NSFileTypeSymbolicLink; -const NSString NSFileTypeSocket; -const NSString NSFileTypeCharacterSpecial; -const NSString NSFileTypeBlockSpecial; -const NSString NSFileTypeUnknown; -const NSString NSFileSize; -const NSString NSFileModificationDate; -const NSString NSFileReferenceCount; -const NSString NSFileDeviceIdentifier; -const NSString NSFileOwnerAccountName; -const NSString NSFileGroupOwnerAccountName; -const NSString NSFilePosixPermissions; -const NSString NSFileSystemNumber; -const NSString NSFileSystemFileNumber; -const NSString NSFileExtensionHidden; -const NSString NSFileHFSCreatorCode; -const NSString NSFileHFSTypeCode; -const NSString NSFileImmutable; -const NSString NSFileAppendOnly; -const NSString NSFileCreationDate; -const NSString NSFileOwnerAccountID; -const NSString NSFileGroupOwnerAccountID; -const NSString NSFileBusy; -const NSString NSFileSystemSize; -const NSString NSFileSystemFreeSize; -const NSString NSFileSystemNodes; -const NSString NSFileSystemFreeNodes; +private +{ + NSString NSFileType_; + NSString NSFileTypeDirectory_; + NSString NSFileTypeRegular_; + NSString NSFileTypeSymbolicLink_; + NSString NSFileTypeSocket_; + NSString NSFileTypeCharacterSpecial_; + NSString NSFileTypeBlockSpecial_; + NSString NSFileTypeUnknown_; + NSString NSFileSize_; + NSString NSFileModificationDate_; + NSString NSFileReferenceCount_; + NSString NSFileDeviceIdentifier_; + NSString NSFileOwnerAccountName_; + NSString NSFileGroupOwnerAccountName_; + NSString NSFilePosixPermissions_; + NSString NSFileSystemNumber_; + NSString NSFileSystemFileNumber_; + NSString NSFileExtensionHidden_; + NSString NSFileHFSCreatorCode_; + NSString NSFileHFSTypeCode_; + NSString NSFileImmutable_; + NSString NSFileAppendOnly_; + NSString NSFileCreationDate_; + NSString NSFileOwnerAccountID_; + NSString NSFileGroupOwnerAccountID_; + NSString NSFileBusy_; + NSString NSFileSystemSize_; + NSString NSFileSystemFreeSize_; + NSString NSFileSystemNodes_; + NSString NSFileSystemFreeNodes_; +} + +NSString NSFileType () +{ + if (NSFileType_) + return NSFileType_; + + return NSFileType_ = new NSString(bindings.NSFileType); +} + +NSString NSFileTypeDirectory () +{ + if (NSFileTypeDirectory_) + return NSFileTypeDirectory_; + + return NSFileTypeDirectory_ = new NSString(bindings.NSFileTypeDirectory); +} + +NSString NSFileTypeRegular () +{ + if (NSFileTypeRegular_) + return NSFileTypeRegular_; + + return NSFileTypeRegular_ = new NSString(bindings.NSFileTypeRegular); +} + +NSString NSFileTypeSymbolicLink () +{ + if (NSFileTypeSymbolicLink_) + return NSFileTypeSymbolicLink_; + + return NSFileTypeSymbolicLink_ = new NSString(bindings.NSFileTypeSymbolicLink); +} + +NSString NSFileTypeSocket () +{ + if (NSFileTypeSocket_) + return NSFileTypeSocket_; + + return NSFileTypeSocket_ = new NSString(bindings.NSFileTypeSocket); +} + +NSString NSFileTypeCharacterSpecial () +{ + if (NSFileTypeCharacterSpecial_) + return NSFileTypeCharacterSpecial_; + + return NSFileTypeCharacterSpecial_ = new NSString(bindings.NSFileTypeCharacterSpecial); +} -static this () +NSString NSFileTypeBlockSpecial () +{ + if (NSFileTypeBlockSpecial_) + return NSFileTypeBlockSpecial_; + + return NSFileTypeBlockSpecial_ = new NSString(bindings.NSFileTypeBlockSpecial); +} + +NSString NSFileTypeUnknown () +{ + if (NSFileTypeUnknown_) + return NSFileTypeUnknown_; + + return NSFileTypeUnknown_ = new NSString(bindings.NSFileTypeUnknown); +} + +NSString NSFileSize () +{ + if (NSFileSize_) + return NSFileSize_; + + return NSFileSize_ = new NSString(bindings.NSFileSize); +} + +NSString NSFileModificationDate () +{ + if (NSFileModificationDate_) + return NSFileModificationDate_; + + return NSFileModificationDate_ = new NSString(bindings.NSFileModificationDate); +} + +NSString NSFileReferenceCount () +{ + if (NSFileReferenceCount_) + return NSFileReferenceCount_; + + return NSFileReferenceCount_ = new NSString(bindings.NSFileReferenceCount); +} + +NSString NSFileDeviceIdentifier () { - NSFileType = new NSString(bindings.NSFileType); - NSFileTypeDirectory = new NSString(bindings.NSFileTypeDirectory); - NSFileTypeRegular = new NSString(bindings.NSFileTypeRegular); - NSFileTypeSymbolicLink = new NSString(bindings.NSFileTypeSymbolicLink); - NSFileTypeSocket = new NSString(bindings.NSFileTypeSocket); - NSFileTypeCharacterSpecial = new NSString(bindings.NSFileTypeCharacterSpecial); - NSFileTypeBlockSpecial = new NSString(bindings.NSFileTypeBlockSpecial); - NSFileTypeUnknown = new NSString(bindings.NSFileTypeUnknown); - NSFileSize = new NSString(bindings.NSFileSize); - NSFileModificationDate = new NSString(bindings.NSFileModificationDate); - NSFileReferenceCount = new NSString(bindings.NSFileReferenceCount); - NSFileDeviceIdentifier = new NSString(bindings.NSFileDeviceIdentifier); - NSFileOwnerAccountName = new NSString(bindings.NSFileOwnerAccountName); - NSFileGroupOwnerAccountName = new NSString(bindings.NSFileGroupOwnerAccountName); - NSFilePosixPermissions = new NSString(bindings.NSFilePosixPermissions); - NSFileSystemNumber = new NSString(bindings.NSFileSystemNumber); - NSFileSystemFileNumber = new NSString(bindings.NSFileSystemFileNumber); - NSFileExtensionHidden = new NSString(bindings.NSFileExtensionHidden); - NSFileHFSCreatorCode = new NSString(bindings.NSFileHFSCreatorCode); - NSFileHFSTypeCode = new NSString(bindings.NSFileHFSTypeCode); - NSFileImmutable = new NSString(bindings.NSFileImmutable); - NSFileAppendOnly = new NSString(bindings.NSFileAppendOnly); - NSFileCreationDate = new NSString(bindings.NSFileCreationDate); - NSFileOwnerAccountID = new NSString(bindings.NSFileOwnerAccountID); - NSFileGroupOwnerAccountID = new NSString(bindings.NSFileGroupOwnerAccountID); - NSFileBusy = new NSString(bindings.NSFileBusy); - NSFileSystemSize = new NSString(bindings.NSFileSystemSize); - NSFileSystemFreeSize = new NSString(bindings.NSFileSystemFreeSize); - NSFileSystemNodes = new NSString(bindings.NSFileSystemNodes); - NSFileSystemFreeNodes = new NSString(bindings.NSFileSystemFreeNodes); + if (NSFileDeviceIdentifier_) + return NSFileDeviceIdentifier_; + + return NSFileDeviceIdentifier_ = new NSString(bindings.NSFileDeviceIdentifier); +} + +NSString NSFileOwnerAccountName () +{ + if (NSFileOwnerAccountName_) + return NSFileOwnerAccountName_; + + return NSFileOwnerAccountName_ = new NSString(bindings.NSFileOwnerAccountName); +} + +NSString NSFileGroupOwnerAccountName () +{ + if (NSFileGroupOwnerAccountName_) + return NSFileGroupOwnerAccountName_; + + return NSFileGroupOwnerAccountName_ = new NSString(bindings.NSFileGroupOwnerAccountName); +} + +NSString NSFilePosixPermissions () +{ + if (NSFilePosixPermissions_) + return NSFilePosixPermissions_; + + return NSFilePosixPermissions_ = new NSString(bindings.NSFilePosixPermissions); +} + +NSString NSFileSystemNumber () +{ + if (NSFileSystemNumber_) + return NSFileSystemNumber_; + + return NSFileSystemNumber_ = new NSString(bindings.NSFileSystemNumber); +} + +NSString NSFileSystemFileNumber () +{ + if (NSFileSystemFileNumber_) + return NSFileSystemFileNumber_; + + return NSFileSystemFileNumber_ = new NSString(bindings.NSFileSystemFileNumber); } -class NSFileManager : NSObject +NSString NSFileExtensionHidden () { - mixin ObjcWrap; - - static NSFileManager defaultManager () - { - return invokeObjcSelfClass!(NSFileManager, "defaultManager"); - } - - void setDelegate (Object delegate_) - { - return invokeObjcSelf!(void, "setDelegate:", Object)(delegate_); - } - - Object delegate_ () - { - return invokeObjcSelf!(Object, "delegate"); - } - - bool setAttributes (NSDictionary attributes, NSString path, NSError** error) - { - return invokeObjcSelf!(bool, "setAttributes:ofItemAtPath:error:", NSDictionary, NSString, NSError**)(attributes, path, error); - } + if (NSFileExtensionHidden_) + return NSFileExtensionHidden_; + + return NSFileExtensionHidden_ = new NSString(bindings.NSFileExtensionHidden); +} - bool createDirectoryAtPath (NSString path, bool createIntermediates, NSDictionary attributes, NSError** error) - { - return invokeObjcSelf!(bool, "createDirectoryAtPath:withIntermediateDirectories:attributes:error:", NSString, bool, NSDictionary, NSError**)(path, createIntermediates, attributes, error); - } - - NSArray contentsOfDirectoryAtPath (NSString path, NSError** error) - { - return invokeObjcSelf!(NSArray, "contentsOfDirectoryAtPath:error:", NSString, NSError**)(path, error); - } - - NSArray subpathsOfDirectoryAtPath (NSString path, NSError** error) - { - return invokeObjcSelf!(NSArray, "subpathsOfDirectoryAtPath:error:", NSString, NSError**)(path, error); - } - - NSDictionary attributesOfItemAtPath (NSString path, NSError** error) - { - return invokeObjcSelf!(NSDictionary, "attributesOfItemAtPath:error:", NSString, NSError**)(path, error); - } - - NSDictionary attributesOfFileSystemForPath (NSString path, NSError** error) - { - return invokeObjcSelf!(NSDictionary, "attributesOfFileSystemForPath:error:", NSString, NSError**)(path, error); - } - - bool createSymbolicLinkAtPath (NSString path, NSString destPath, NSError** error) - { - return invokeObjcSelf!(bool, "createSymbolicLinkAtPath:withDestinationPath:error:", NSString, NSString, NSError**)(path, destPath, error); - } +NSString NSFileHFSCreatorCode () +{ + if (NSFileHFSCreatorCode_) + return NSFileHFSCreatorCode_; + + return NSFileHFSCreatorCode_ = new NSString(bindings.NSFileHFSCreatorCode); +} - NSString destinationOfSymbolicLinkAtPath (NSString path, NSError** error) - { - return invokeObjcSelf!(NSString, "destinationOfSymbolicLinkAtPath:error:", NSString, NSError**)(path, error); - } - - bool copyItemAtPath (NSString srcPath, NSString dstPath, NSError** error) - { - return invokeObjcSelf!(bool, "copyItemAtPath:toPath:error:", NSString, NSString, NSError**)(srcPath, dstPath, error); - } - - bool moveItemAtPath (NSString srcPath, NSString dstPath, NSError** error) - { - return invokeObjcSelf!(bool, "moveItemAtPath:toPath:error:", NSString, NSString, NSError**)(srcPath, dstPath, error); - } - - bool linkItemAtPath (NSString srcPath, NSString dstPath, NSError** error) - { - return invokeObjcSelf!(bool, "linkItemAtPath:toPath:error:", NSString, NSString, NSError**)(srcPath, dstPath, error); - } - - bool removeItemAtPath (NSString path, NSError** error) - { - return invokeObjcSelf!(bool, "removeItemAtPath:error:", NSString, NSError**)(path, error); - } +NSString NSFileHFSTypeCode () +{ + if (NSFileHFSTypeCode_) + return NSFileHFSTypeCode_; + + return NSFileHFSTypeCode_ = new NSString(bindings.NSFileHFSTypeCode); +} - NSDictionary fileAttributesAtPath (NSString path, bool yorn) - { - return invokeObjcSelf!(NSDictionary, "fileAttributesAtPath:traverseLink:", NSString, bool)(path, yorn); - } - - bool changeFileAttributes (NSDictionary attributes, NSString path) - { - return invokeObjcSelf!(bool, "changeFileAttributes:atPath:", NSDictionary, NSString)(attributes, path); - } - - NSArray directoryContentsAtPath (NSString path) - { - return invokeObjcSelf!(NSArray, "directoryContentsAtPath:", NSString)(path); - } - - NSDictionary fileSystemAttributesAtPath (NSString path) - { - return invokeObjcSelf!(NSDictionary, "fileSystemAttributesAtPath:", NSString)(path); - } - - NSString pathContentOfSymbolicLinkAtPath (NSString path) - { - return invokeObjcSelf!(NSString, "pathContentOfSymbolicLinkAtPath:", NSString)(path); - } - - bool createSymbolicLinkAtPath (NSString path, NSString otherpath) - { - return invokeObjcSelf!(bool, "createSymbolicLinkAtPath:pathContent:", NSString, NSString)(path, otherpath); - } +NSString NSFileImmutable () +{ + if (NSFileImmutable_) + return NSFileImmutable_; + + return NSFileImmutable_ = new NSString(bindings.NSFileImmutable); +} - bool createDirectoryAtPath (NSString path, NSDictionary attributes) - { - return invokeObjcSelf!(bool, "createDirectoryAtPath:attributes:", NSString, NSDictionary)(path, attributes); - } - - bool linkPath (NSString src, NSString dest, Object handler) - { - return invokeObjcSelf!(bool, "linkPath:toPath:handler:", NSString, NSString, Object)(src, dest, handler); - } - - bool copyPath (NSString src, NSString dest, Object handler) - { - return invokeObjcSelf!(bool, "copyPath:toPath:handler:", NSString, NSString, Object)(src, dest, handler); - } - - bool movePath (NSString src, NSString dest, Object handler) - { - return invokeObjcSelf!(bool, "movePath:toPath:handler:", NSString, NSString, Object)(src, dest, handler); - } - - bool removeFileAtPath (NSString path, Object handler) - { - return invokeObjcSelf!(bool, "removeFileAtPath:handler:", NSString, Object)(path, handler); - } +NSString NSFileAppendOnly () +{ + if (NSFileAppendOnly_) + return NSFileAppendOnly_; + + return NSFileAppendOnly_ = new NSString(bindings.NSFileAppendOnly); +} - NSString currentDirectoryPath () - { - return invokeObjcSelf!(NSString, "currentDirectoryPath"); - } - - bool changeCurrentDirectoryPath (NSString path) - { - return invokeObjcSelf!(bool, "changeCurrentDirectoryPath:", NSString)(path); - } - - bool fileExistsAtPath (NSString path) - { - return invokeObjcSelf!(bool, "fileExistsAtPath:", NSString)(path); - } - - bool fileExistsAtPath (NSString path, bool* isDirectory) - { - return invokeObjcSelf!(bool, "fileExistsAtPath:isDirectory:", NSString, bool*)(path, isDirectory); - } - - bool isReadableFileAtPath (NSString path) - { - return invokeObjcSelf!(bool, "isReadableFileAtPath:", NSString)(path); - } - - bool isWritableFileAtPath (NSString path) - { - return invokeObjcSelf!(bool, "isWritableFileAtPath:", NSString)(path); - } +NSString NSFileCreationDate () +{ + if (NSFileCreationDate_) + return NSFileCreationDate_; + + return NSFileCreationDate_ = new NSString(bindings.NSFileCreationDate); +} - bool isExecutableFileAtPath (NSString path) - { - return invokeObjcSelf!(bool, "isExecutableFileAtPath:", NSString)(path); - } - - bool isDeletableFileAtPath (NSString path) - { - return invokeObjcSelf!(bool, "isDeletableFileAtPath:", NSString)(path); - } - - bool contentsEqualAtPath (NSString path1, NSString path2) - { - return invokeObjcSelf!(bool, "contentsEqualAtPath:andPath:", NSString, NSString)(path1, path2); - } - - NSString displayNameAtPath (NSString path) - { - return invokeObjcSelf!(NSString, "displayNameAtPath:", NSString)(path); - } - - NSArray componentsToDisplayForPath (NSString path) - { - return invokeObjcSelf!(NSArray, "componentsToDisplayForPath:", NSString)(path); - } +NSString NSFileOwnerAccountID () +{ + if (NSFileOwnerAccountID_) + return NSFileOwnerAccountID_; + + return NSFileOwnerAccountID_ = new NSString(bindings.NSFileOwnerAccountID); +} - NSDirectoryEnumerator enumeratorAtPath (NSString path) - { - return invokeObjcSelf!(NSDirectoryEnumerator, "enumeratorAtPath:", NSString)(path); - } - - NSArray subpathsAtPath (NSString path) - { - return invokeObjcSelf!(NSArray, "subpathsAtPath:", NSString)(path); - } - - NSData contentsAtPath (NSString path) - { - return invokeObjcSelf!(NSData, "contentsAtPath:", NSString)(path); - } +NSString NSFileGroupOwnerAccountID () +{ + if (NSFileGroupOwnerAccountID_) + return NSFileGroupOwnerAccountID_; + + return NSFileGroupOwnerAccountID_ = new NSString(bindings.NSFileGroupOwnerAccountID); +} - bool createFileAtPath (NSString path, NSData data, NSDictionary attr) - { - return invokeObjcSelf!(bool, "createFileAtPath:contents:attributes:", NSString, NSData, NSDictionary)(path, data, attr); - } +NSString NSFileBusy () +{ + if (NSFileBusy_) + return NSFileBusy_; + + return NSFileBusy_ = new NSString(bindings.NSFileBusy); +} - char* fileSystemRepresentationWithPath (NSString path) - { - return invokeObjcSelf!(char*, "fileSystemRepresentationWithPath:", NSString)(path); - } - - NSString stringWithFileSystemRepresentation (char* str, NSUInteger len) - { - return invokeObjcSelf!(NSString, "stringWithFileSystemRepresentation:length:", char*, NSUInteger)(str, len); - } +NSString NSFileSystemSize () +{ + if (NSFileSystemSize_) + return NSFileSystemSize_; + + return NSFileSystemSize_ = new NSString(bindings.NSFileSystemSize); } -class NSDirectoryEnumerator : NSEnumerator +NSString NSFileSystemFreeSize () { - mixin ObjcWrap; - - NSDictionary fileAttributes () - { - return invokeObjcSelf!(NSDictionary, "fileAttributes"); - } + if (NSFileSystemFreeSize_) + return NSFileSystemFreeSize_; + + return NSFileSystemFreeSize_ = new NSString(bindings.NSFileSystemFreeSize); +} - NSDictionary directoryAttributes () - { - return invokeObjcSelf!(NSDictionary, "directoryAttributes"); - } +NSString NSFileSystemNodes () +{ + if (NSFileSystemNodes_) + return NSFileSystemNodes_; + + return NSFileSystemNodes_ = new NSString(bindings.NSFileSystemNodes); +} - void skipDescendents () - { - return invokeObjcSelf!(void, "skipDescendents"); - } +NSString NSFileSystemFreeNodes () +{ + if (NSFileSystemFreeNodes_) + return NSFileSystemFreeNodes_; + + return NSFileSystemFreeNodes_ = new NSString(bindings.NSFileSystemFreeNodes); } -template TNSFileManagerFileOperationAdditions () -{ - bool fileManager (NSFileManager fileManager, NSString srcPath, NSString dstPath); - bool fileManager (NSFileManager fileManager, NSError error, NSString srcPath, NSString dstPath); - bool fileManager (NSFileManager fileManager, NSString srcPath, NSString dstPath); - bool fileManager (NSFileManager fileManager, NSError error, NSString srcPath, NSString dstPath); - bool fileManager (NSFileManager fileManager, NSString srcPath, NSString dstPath); - bool fileManager (NSFileManager fileManager, NSError error, NSString srcPath, NSString dstPath); - bool fileManager (NSFileManager fileManager, NSString path); - bool fileManager (NSFileManager fileManager, NSError error, NSString path); -} +const TNSFileManagerFileOperationAdditions = ` -template TNSCopyLinkMoveHandler () -{ - bool fileManager (NSFileManager fm, NSDictionary errorInfo); - void fileManager (NSFileManager fm, NSString path); -} + bool fileManager (NSFileManager fileManager, NSString srcPath, NSString dstPath) + { + return invokeObjcSelf!(bool, "fileManager:shouldCopyItemAtPath:toPath:dstPath:", NSFileManager, NSString, NSString); + } + + bool fileManager (NSFileManager fileManager, NSError error, NSString srcPath, NSString dstPath) + { + return invokeObjcSelf!(bool, "fileManager:shouldProceedAfterError:copyingItemAtPath:toPath:", NSFileManager, NSError, NSString, NSString)(fileManager, error, srcPath, dstPath); + } + + bool fileManager (NSFileManager fileManager, NSString srcPath, NSString dstPath) + { + return invokeObjcSelf!(bool, "fileManager:shouldMoveItemAtPath:toPath:", NSFileManager, NSString, NSString)(fileManager, srcPath, dstPath); + } + + bool fileManager (NSFileManager fileManager, NSError error, NSString srcPath, NSString dstPath) + { + return invokeObjcSelf!(bool, "fileManager:shouldProceedAfterError:movingItemAtPath:toPath:", NSFileManager, NSError, NSString, NSString)(fileManager, error, srcPath, dstPath); + } + + bool fileManager (NSFileManager fileManager, NSString srcPath, NSString dstPath) + { + return invokeObjcSelf!(bool, "fileManager:shouldLinkItemAtPath:toPath:", NSFileManager, NSString, NSString)(fileManager, srcPath, dstPath); + } + + bool fileManager (NSFileManager fileManager, NSError error, NSString srcPath, NSString dstPath) + { + return invokeObjcSelf!(bool, "fileManager:shouldProceedAfterError:linkingItemAtPath:toPath", NSFileManager, NSError, NSString, NSString)(fileManager, error, srcPath, dstPath); + } + + bool fileManager (NSFileManager fileManager, NSString path) + { + return invokeObjcSelf!(bool, "fileManager:shouldRemoveItemAtPath:", NSFileManager, NSString)(fileManager, path); + } + + bool fileManager (NSFileManager fileManager, NSError error, NSString path) + { + return invokeObjcSelf!(bool, "fileManager:shouldProceedAfterError:removingItemAtPath:", NSFileManager, NSError, NSString)(fileManager, error, path); + } + + //mixin ObjcBindMethod!(fileManager, bool, "fileManager:shouldCopyItemAtPath:toPath:dstPath:", NSFileManager, NSString, NSString); + //mixin ObjcBindMethod!(fileManager, bool, "fileManager:shouldProceedAfterError:copyingItemAtPath:toPath:", NSFileManager, NSError, NSString, NSString); + //mixin ObjcBindMethod!(fileManager, bool, "fileManager:shouldMoveItemAtPath:toPath:", NSFileManager, NSString, NSString); + //mixin ObjcBindMethod!(fileManager, bool, "fileManager:shouldProceedAfterError:movingItemAtPath:toPath:", NSFileManager, NSError, NSString, NSString); + //mixin ObjcBindMethod!(fileManager, bool, "fileManager:shouldLinkItemAtPath:toPath:", NSFileManager, NSString, NSString); + //mixin ObjcBindMethod!(fileManager, bool, "fileManager:shouldProceedAfterError:linkingItemAtPath:toPath", NSFileManager, NSError, NSString, NSString); + //mixin ObjcBindMethod!(fileManager, bool, "fileManager:shouldRemoveItemAtPath:", NSFileManager, NSString); + //mixin ObjcBindMethod!(fileManager, bool, "fileManager:shouldProceedAfterError:removingItemAtPath:", NSFileManager, NSError, NSString); +`; -template TNSFileAttributes () -{ +const TNSCopyLinkMoveHandler = ` + + bool fileManager (NSFileManager fm, NSDictionary errorInfo) + { + return invokeObjcSelf!(bool, "fileManager:shouldProceedAfterError:", NSFileManager, NSDictionary)(fm, errorInfo); + } + + void fileManager (NSFileManager fm, NSString path) + { + return invokeObjcSelf!(void, "fileManager:willProcessPath:", NSFileManager, NSString)(fm, path); + } + + //mixin ObjcBindMethod!(fileManager, "fileManager:shouldProceedAfterError:"); + //mixin ObjcBindMethod!(fileManager, "fileManager:willProcessPath:"); +`; + +const TNSFileAttributes = ` + ulong fileSize () { return invokeObjcSelf!(ulong, "fileSize"); @@ -425,5 +445,384 @@ { return invokeObjcSelf!(NSNumber, "fileGroupOwnerAccountID"); } +`; + +class NSFileManager : NSObject +{ + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } + + static NSFileManager defaultManager () + { + return invokeObjcSuperClass!(NSFileManager, "defaultManager"); + } + + void setDelegate (Object delegate_) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(delegate_); + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + bool setAttributes (NSDictionary attributes, NSString path, ref NSError error) + { + id err; + + if (error) + err = new objc_object; + + bool result = invokeObjcSelf!(bool, "setAttributes:ofItemAtPath:error:", NSDictionary, NSString, id*)(attributes, path, &err); + + if (err) + error = new NSError(err); + + return result; + } + + bool createDirectoryAtPath (NSString path, bool createIntermediates, NSDictionary attributes, ref NSError error) + { + id err; + + if (error) + err = new objc_object; + + bool result = invokeObjcSelf!(bool, "createDirectoryAtPath:withIntermediateDirectories:attributes:error:", NSString, bool, NSDictionary, id*)(path, createIntermediates, attributes, &err); + + if (err) + error = new NSError(err); + + return result; + } + + NSArray contentsOfDirectoryAtPath (NSString path, ref NSError error) + { + id err; + + if (error) + err = new objc_object; + + NSArray result = invokeObjcSelf!(NSArray, "contentsOfDirectoryAtPath:error:", NSString, id*)(path, &err); + + if (err) + error = new NSError(err); + + return result; + } + + NSArray subpathsOfDirectoryAtPath (NSString path, ref NSError error) + { + id err; + + if (error) + err = new objc_object; + + NSArray result = invokeObjcSelf!(NSArray, "subpathsOfDirectoryAtPath:error:", NSString, id*)(path, &err); + + if (err) + error = new NSError(err); + + return result; + } + + NSDictionary attributesOfItemAtPath (NSString path, ref NSError error) + { + id err; + + if (error) + err = new objc_object; + + NSDictionary result = invokeObjcSelf!(NSDictionary, "attributesOfItemAtPath:error:", NSString, id*)(path, &err); + + if (err) + error = new NSError(err); + + return result; + } + + NSDictionary attributesOfFileSystemForPath (NSString path, ref NSError error) + { + id err; + + if (error) + err = new objc_object; + + NSDictionary result = invokeObjcSelf!(NSDictionary, "attributesOfFileSystemForPath:error:", NSString, id*)(path, &err); + + if (err) + error = new NSError(err); + + return result; + } + + bool createSymbolicLinkAtPath (NSString path, NSString destPath, ref NSError error) + { + id err; + + if (error) + err = new objc_object; + + bool result = invokeObjcSelf!(bool, "createSymbolicLinkAtPath:withDestinationPath:error:", NSString, NSString, id*)(path, destPath, &err); + + if (err) + error = new NSError(err); + + return result; + } + + NSString destinationOfSymbolicLinkAtPath (NSString path, ref NSError error) + { + id err; + + if (error) + err = new objc_object; + + NSString result = invokeObjcSelf!(NSString, "destinationOfSymbolicLinkAtPath:error:", NSString, id*)(path, &err); + + if (err) + error = new NSError(err); + + return result; + } + + bool copyItemAtPath (NSString srcPath, NSString dstPath, ref NSError error) + { + id err; + + if (error) + err = new objc_object; + + bool result = invokeObjcSelf!(bool, "copyItemAtPath:toPath:error:", NSString, NSString, id*)(srcPath, dstPath, &err); + + if (err) + error = new NSError(err); + + return result; + } + + bool moveItemAtPath (NSString srcPath, NSString dstPath, ref NSError error) + { + id err; + + if (error) + err = new objc_object; + + bool result = invokeObjcSelf!(bool, "moveItemAtPath:toPath:error:", NSString, NSString, id*)(srcPath, dstPath, &err); + + if (err) + error = new NSError(err); + + return result; + } + + bool linkItemAtPath (NSString srcPath, NSString dstPath, ref NSError error) + { + id err; + + if (error) + err = new objc_object; + + bool result = invokeObjcSelf!(bool, "linkItemAtPath:toPath:error:", NSString, NSString, id*)(srcPath, dstPath, &err); + + if (err) + error = new NSError(err); + + return result; + } + + bool removeItemAtPath (NSString path, ref NSError error) + { + id err; + + if (error) + err = new objc_object; + + bool result = invokeObjcSelf!(bool, "removeItemAtPath:error:", NSString, id*)(path, &err); + + if (err) + error = new NSError(err); + + return result; + } + + NSDictionary fileAttributesAtPath (NSString path, bool yorn) + { + return invokeObjcSelf!(NSDictionary, "fileAttributesAtPath:traverseLink:", NSString, bool)(path, yorn); + } + + bool changeFileAttributes (NSDictionary attributes, NSString path) + { + return invokeObjcSelf!(bool, "changeFileAttributes:atPath:", NSDictionary, NSString)(attributes, path); + } + + NSArray directoryContentsAtPath (NSString path) + { + return invokeObjcSelf!(NSArray, "directoryContentsAtPath:", NSString)(path); + } + + NSDictionary fileSystemAttributesAtPath (NSString path) + { + return invokeObjcSelf!(NSDictionary, "fileSystemAttributesAtPath:", NSString)(path); + } + + NSString pathContentOfSymbolicLinkAtPath (NSString path) + { + return invokeObjcSelf!(NSString, "pathContentOfSymbolicLinkAtPath:", NSString)(path); + } + + bool createSymbolicLinkAtPath (NSString path, NSString otherpath) + { + return invokeObjcSelf!(bool, "createSymbolicLinkAtPath:pathContent:", NSString, NSString)(path, otherpath); + } + + bool createDirectoryAtPath (NSString path, NSDictionary attributes) + { + return invokeObjcSelf!(bool, "createDirectoryAtPath:attributes:", NSString, NSDictionary)(path, attributes); + } + + bool linkPath (NSString src, NSString dest, Object handler) + { + return invokeObjcSelf!(bool, "linkPath:toPath:handler:", NSString, NSString, Object)(src, dest, handler); + } + + bool copyPath (NSString src, NSString dest, Object handler) + { + return invokeObjcSelf!(bool, "copyPath:toPath:handler:", NSString, NSString, Object)(src, dest, handler); + } + + bool movePath (NSString src, NSString dest, Object handler) + { + return invokeObjcSelf!(bool, "movePath:toPath:handler:", NSString, NSString, Object)(src, dest, handler); + } + + bool removeFileAtPath (NSString path, Object handler) + { + return invokeObjcSelf!(bool, "removeFileAtPath:handler:", NSString, Object)(path, handler); + } + + NSString currentDirectoryPath () + { + return invokeObjcSelf!(NSString, "currentDirectoryPath"); + } + + bool changeCurrentDirectoryPath (NSString path) + { + return invokeObjcSelf!(bool, "changeCurrentDirectoryPath:", NSString)(path); + } + + bool fileExistsAtPath (NSString path) + { + return invokeObjcSelf!(bool, "fileExistsAtPath:", NSString)(path); + } + + bool fileExistsAtPath (NSString path, out bool isDirectory) + { + return invokeObjcSelf!(bool, "fileExistsAtPath:isDirectory:", NSString, bool*)(path, &isDirectory); + } + + bool isReadableFileAtPath (NSString path) + { + return invokeObjcSelf!(bool, "isReadableFileAtPath:", NSString)(path); + } + + bool isWritableFileAtPath (NSString path) + { + return invokeObjcSelf!(bool, "isWritableFileAtPath:", NSString)(path); + } + + bool isExecutableFileAtPath (NSString path) + { + return invokeObjcSelf!(bool, "isExecutableFileAtPath:", NSString)(path); + } + + bool isDeletableFileAtPath (NSString path) + { + return invokeObjcSelf!(bool, "isDeletableFileAtPath:", NSString)(path); + } + + bool contentsEqualAtPath (NSString path1, NSString path2) + { + return invokeObjcSelf!(bool, "contentsEqualAtPath:andPath:", NSString, NSString)(path1, path2); + } + + NSString displayNameAtPath (NSString path) + { + return invokeObjcSelf!(NSString, "displayNameAtPath:", NSString)(path); + } + + NSArray componentsToDisplayForPath (NSString path) + { + return invokeObjcSelf!(NSArray, "componentsToDisplayForPath:", NSString)(path); + } + + NSDirectoryEnumerator enumeratorAtPath (NSString path) + { + return invokeObjcSelf!(NSDirectoryEnumerator, "enumeratorAtPath:", NSString)(path); + } + + NSArray subpathsAtPath (NSString path) + { + return invokeObjcSelf!(NSArray, "subpathsAtPath:", NSString)(path); + } + + NSData contentsAtPath (NSString path) + { + return invokeObjcSelf!(NSData, "contentsAtPath:", NSString)(path); + } + + bool createFileAtPath (NSString path, NSData data, NSDictionary attr) + { + return invokeObjcSelf!(bool, "createFileAtPath:contents:attributes:", NSString, NSData, NSDictionary)(path, data, attr); + } + + char* fileSystemRepresentationWithPath (NSString path) + { + return invokeObjcSelf!(char*, "fileSystemRepresentationWithPath:", NSString)(path); + } + + NSString stringWithFileSystemRepresentation (char* str, NSUInteger len) + { + return invokeObjcSelf!(NSString, "stringWithFileSystemRepresentation:length:", char*, NSUInteger)(str, len); + } } +class NSDirectoryEnumerator : NSEnumerator +{ + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } + + NSDictionary fileAttributes () + { + return invokeObjcSelf!(NSDictionary, "fileAttributes"); + } + + NSDictionary directoryAttributes () + { + return invokeObjcSelf!(NSDictionary, "directoryAttributes"); + } + + void skipDescendents () + { + return invokeObjcSelf!(void, "skipDescendents"); + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSFileManager_bindings.d --- a/dstep/foundation/NSFileManager_bindings.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSFileManager_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -1,17 +1,8 @@ module dstep.foundation.NSFileManager_bindings; -import dstep.corefoundation.CFBase; -import dstep.foundation.NSArray; -import dstep.foundation.NSData; -import dstep.foundation.NSDate; -import dstep.foundation.NSDictionary; -import dstep.foundation.NSDirectoryEnumerator; -import dstep.foundation.NSEnumerator; -import dstep.foundation.NSError; -import dstep.foundation.NSNumber; -import dstep.foundation.NSObject; -import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + extern (C) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSFormatter.d --- a/dstep/foundation/NSFormatter.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSFormatter.d Sun Jan 03 22:06:11 2010 +0100 @@ -7,16 +7,28 @@ module dstep.foundation.NSFormatter; import dstep.foundation.NSAttributedString; +import dstep.foundation.NSCoder; import dstep.foundation.NSDictionary; import dstep.foundation.NSObject; import dstep.foundation.NSRange; import dstep.foundation.NSString; +import dstep.foundation.NSZone; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; class NSFormatter : NSObject, INSCopying, INSCoding { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } NSString stringForObjectValue (Object obj) { @@ -33,19 +45,61 @@ return invokeObjcSelf!(NSString, "editingStringForObjectValue:", Object)(obj); } - bool getObjectValue (id* obj, NSString string, NSString** error) + bool getObjectValue (out NSObject obj, NSString string, ref NSString error) { - return invokeObjcSelf!(bool, "getObjectValue:forString:errorDescription:", id*, NSString, NSString**)(obj, string, error); + id err; + id object; + + if (error) + err = new objc_object; + + bool result = invokeObjcSelf!(bool, "getObjectValue:forString:errorDescription:", id*, NSString, id*)(&object, string, &err); + + if (err) + error = new NSString(err); + + if (object) + obj = new NSObject(object); + + return result; } - bool isPartialStringValid (NSString partialString, NSString** newString, NSString** error) + bool isPartialStringValid (NSString partialString, out NSString newString, ref NSString error) { - return invokeObjcSelf!(bool, "isPartialStringValid:newEditingString:errorDescription:", NSString, NSString**, NSString**)(partialString, newString, error); + id err; + id newStr = new objc_object; + + if (error) + err = new objc_object; + + bool result = invokeObjcSelf!(bool, "isPartialStringValid:newEditingString:errorDescription:", NSString, id*, id*)(partialString, &newStr, &err); + + if (err) + error = new NSString(err); + + if (newStr) + newString = new NSString(newStr); + + return result; } - bool isPartialStringValid (NSString** partialStringPtr, NSRangePointer proposedSelRangePtr, NSString origString, NSRange origSelRange, NSString** error) + bool isPartialStringValid (ref NSString partialStringPtr, NSRangePointer proposedSelRangePtr, NSString origString, NSRange origSelRange, ref NSString error) { - return invokeObjcSelf!(bool, "isPartialStringValid:proposedSelectedRange:originalString:originalSelectedRange:errorDescription:", NSString**, NSRangePointer, NSString, NSRange, NSString**)(partialStringPtr, proposedSelRangePtr, origString, origSelRange, error); + id partialString = new objc_object; + id err; + + if (error) + err = new objc_object; + + bool result = invokeObjcSelf!(bool, "isPartialStringValid:proposedSelectedRange:originalString:originalSelectedRange:errorDescription:", id*, NSRangePointer, NSString, NSRange, id*)(&partialString, proposedSelRangePtr, origString, origSelRange, &err); + + if (err) + error = new NSString(err); + + if (partialString) + partialStringPtr = new NSString(partialString); + + return result; } Object copyWithZone (NSZone* zone) @@ -65,13 +119,7 @@ this (NSCoder aDecoder) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithCoder(aDecoder); } } diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSGarbageCollector.d --- a/dstep/foundation/NSGarbageCollector.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSGarbageCollector.d Sun Jan 03 22:06:11 2010 +0100 @@ -7,16 +7,27 @@ module dstep.foundation.NSGarbageCollector; import dstep.foundation.NSObject; +import dstep.foundation.NSZone; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; class NSGarbageCollector : NSObject { - mixin ObjcWrap; + mixin (ObjcWrap); - static Object defaultCollector () + this () + { + super(NSGarbageCollector.alloc.init.objcObject); + } + + NSGarbageCollector init () { - return invokeObjcSelfClass!(Object, "defaultCollector"); + return invokeObjcSelf!(NSGarbageCollector, "init"); + } + + static NSGarbageCollector defaultCollector () + { + return invokeObjcSuperClass!(NSGarbageCollector, "defaultCollector"); } bool isCollecting () diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSGeometry.d --- a/dstep/foundation/NSGeometry.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSGeometry.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,24 +6,25 @@ */ module dstep.foundation.NSGeometry; -import dstep.AvailabilityMacros; import dstep.applicationservices.coregraphics.CGBase; import dstep.applicationservices.coregraphics.CGGeometry; import dstep.foundation.NSCoder; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSString; import dstep.foundation.NSValue; +import dstep.internal.Version; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; import bindings = dstep.foundation.NSGeometry_bindings; -alias CGPoint NSPoint; +alias dstep.applicationservices.coregraphics.CGGeometry.CGPoint NSPoint; alias NSPoint* NSPointPointer; alias NSPoint* NSPointArray; -alias CGSize NSSize; +alias dstep.applicationservices.coregraphics.CGGeometry.CGSize NSSize; alias NSSize* NSSizePointer; alias NSSize* NSSizeArray; -alias CGRect NSRect; +alias dstep.applicationservices.coregraphics.CGGeometry.CGRect NSRect; alias NSRect* NSRectPointer; alias NSRect* NSRectArray; alias NSUInteger NSRectEdge; @@ -38,8 +39,8 @@ } } -template TNSGeometryCoding () -{ +const TNSGeometryCoding = ` + void encodePoint (NSPoint point) { return invokeObjcSelf!(void, "encodePoint:", NSPoint)(point); @@ -69,23 +70,23 @@ { return invokeObjcSelf!(NSRect, "decodeRect"); } -} +`; -template TNSValueGeometryExtensions () -{ +const TNSValueGeometryExtensions = ` + static NSValue valueWithPoint (NSPoint point) { - return invokeObjcSelfClass!(NSValue, "valueWithPoint:", NSPoint)(point); + return invokeObjcSuperClass!(NSValue, "valueWithPoint:", NSPoint)(point); } static NSValue valueWithSize (NSSize size) { - return invokeObjcSelfClass!(NSValue, "valueWithSize:", NSSize)(size); + return invokeObjcSuperClass!(NSValue, "valueWithSize:", NSSize)(size); } static NSValue valueWithRect (NSRect rect) { - return invokeObjcSelfClass!(NSValue, "valueWithRect:", NSRect)(rect); + return invokeObjcSuperClass!(NSValue, "valueWithRect:", NSRect)(rect); } NSPoint pointValue () @@ -102,7 +103,7 @@ { return invokeObjcSelf!(NSRect, "rectValue"); } -} +`; NSString NSStringFromPoint (NSPoint aPoint) { diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSGeometry_bindings.d --- a/dstep/foundation/NSGeometry_bindings.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSGeometry_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -1,28 +1,15 @@ module dstep.foundation.NSGeometry_bindings; -import dstep.AvailabilityMacros; -import dstep.applicationservices.coregraphics.CGBase; import dstep.applicationservices.coregraphics.CGGeometry; -import dstep.foundation.NSCoder; -import dstep.foundation.NSString; -import dstep.foundation.NSValue; -import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; - +import dstep.foundation.NSGeometry; +import dstep.objc.objc; extern (C) { - extern - { - } -} - -extern (C) -{ - private id NSStringFromPoint (NSPoint aPoint); - private id NSStringFromSize (NSSize aSize); - private id NSStringFromRect (NSRect aRect); - private NSPoint NSPointFromString (id aString); - private NSSize NSSizeFromString (id aString); - private NSRect NSRectFromString (id aString); + package id NSStringFromPoint (NSPoint aPoint); + package id NSStringFromSize (NSSize aSize); + package id NSStringFromRect (NSRect aRect); + package NSPoint NSPointFromString (id aString); + package NSSize NSSizeFromString (id aString); + package NSRect NSRectFromString (id aString); } \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSHFSFileTypes.d --- a/dstep/foundation/NSHFSFileTypes.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSHFSFileTypes.d Sun Jan 03 22:06:11 2010 +0100 @@ -10,7 +10,11 @@ import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + + +import bindings = dstep.foundation.NSHFSFileTypes_bindings; NSString NSFileTypeForHFSTypeCode (uint hfsFileTypeCode) { diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSHFSFileTypes_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSHFSFileTypes_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,18 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Aug 5, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.foundation.NSHFSFileTypes_bindings; + +import dstep.objc.objc; + + + +extern (C): +package: + +id NSFileTypeForHFSTypeCode (uint hfsFileTypeCode); +uint NSHFSTypeCodeFromFileType (id fileTypeString); +id NSHFSTypeOfFile (id fullFilePath); \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSHTTPCookie.d --- a/dstep/foundation/NSHTTPCookie.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSHTTPCookie.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,53 +6,154 @@ */ module dstep.foundation.NSHTTPCookie; -import dstep.AvailabilityMacros; import dstep.foundation.NSArray; import dstep.foundation.NSDate; import dstep.foundation.NSDictionary; -import dstep.foundation.NSHTTPCookieInternal; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; import dstep.foundation.NSString; import dstep.foundation.NSURL; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + import bindings = dstep.foundation.NSHTTPCookie_bindings; -const NSString NSHTTPCookieName; -const NSString NSHTTPCookieValue; -const NSString NSHTTPCookieOriginURL; -const NSString NSHTTPCookieVersion; -const NSString NSHTTPCookieDomain; -const NSString NSHTTPCookiePath; -const NSString NSHTTPCookieSecure; -const NSString NSHTTPCookieExpires; -const NSString NSHTTPCookieComment; -const NSString NSHTTPCookieCommentURL; -const NSString NSHTTPCookieDiscard; -const NSString NSHTTPCookieMaximumAge; -const NSString NSHTTPCookiePort; +private +{ + NSString NSHTTPCookieName_; + NSString NSHTTPCookieValue_; + NSString NSHTTPCookieOriginURL_; + NSString NSHTTPCookieVersion_; + NSString NSHTTPCookieDomain_; + NSString NSHTTPCookiePath_; + NSString NSHTTPCookieSecure_; + NSString NSHTTPCookieExpires_; + NSString NSHTTPCookieComment_; + NSString NSHTTPCookieCommentURL_; + NSString NSHTTPCookieDiscard_; + NSString NSHTTPCookieMaximumAge_; + NSString NSHTTPCookiePort_; +} + +NSString NSHTTPCookieName () +{ + if (NSHTTPCookieName_) + return NSHTTPCookieName_; + + return NSHTTPCookieName_ = new NSString(bindings.NSHTTPCookieName); +} + +NSString NSHTTPCookieValue () +{ + if (NSHTTPCookieValue_) + return NSHTTPCookieValue_; + + return NSHTTPCookieValue_ = new NSString(bindings.NSHTTPCookieValue); +} + +NSString NSHTTPCookieOriginURL () +{ + if (NSHTTPCookieOriginURL_) + return NSHTTPCookieOriginURL_; + + return NSHTTPCookieOriginURL_ = new NSString(bindings.NSHTTPCookieOriginURL); +} + +NSString NSHTTPCookieVersion () +{ + if (NSHTTPCookieVersion_) + return NSHTTPCookieVersion_; + + return NSHTTPCookieVersion_ = new NSString(bindings.NSHTTPCookieVersion); +} + +NSString NSHTTPCookieDomain () +{ + if (NSHTTPCookieDomain_) + return NSHTTPCookieDomain_; + + return NSHTTPCookieDomain_ = new NSString(bindings.NSHTTPCookieDomain); +} -static this () +NSString NSHTTPCookiePath () +{ + if (NSHTTPCookiePath_) + return NSHTTPCookiePath_; + + return NSHTTPCookiePath_ = new NSString(bindings.NSHTTPCookiePath); +} + +NSString NSHTTPCookieSecure () +{ + if (NSHTTPCookieSecure_) + return NSHTTPCookieSecure_; + + return NSHTTPCookieSecure_ = new NSString(bindings.NSHTTPCookieSecure); +} + +NSString NSHTTPCookieExpires () +{ + if (NSHTTPCookieExpires_) + return NSHTTPCookieExpires_; + + return NSHTTPCookieExpires_ = new NSString(bindings.NSHTTPCookieExpires); +} + +NSString NSHTTPCookieComment () { - NSHTTPCookieName = new NSString(bindings.NSHTTPCookieName); - NSHTTPCookieValue = new NSString(bindings.NSHTTPCookieValue); - NSHTTPCookieOriginURL = new NSString(bindings.NSHTTPCookieOriginURL); - NSHTTPCookieVersion = new NSString(bindings.NSHTTPCookieVersion); - NSHTTPCookieDomain = new NSString(bindings.NSHTTPCookieDomain); - NSHTTPCookiePath = new NSString(bindings.NSHTTPCookiePath); - NSHTTPCookieSecure = new NSString(bindings.NSHTTPCookieSecure); - NSHTTPCookieExpires = new NSString(bindings.NSHTTPCookieExpires); - NSHTTPCookieComment = new NSString(bindings.NSHTTPCookieComment); - NSHTTPCookieCommentURL = new NSString(bindings.NSHTTPCookieCommentURL); - NSHTTPCookieDiscard = new NSString(bindings.NSHTTPCookieDiscard); - NSHTTPCookieMaximumAge = new NSString(bindings.NSHTTPCookieMaximumAge); - NSHTTPCookiePort = new NSString(bindings.NSHTTPCookiePort); + if (NSHTTPCookieComment_) + return NSHTTPCookieComment_; + + return NSHTTPCookieComment_ = new NSString(bindings.NSHTTPCookieComment); +} + +NSString NSHTTPCookieCommentURL () +{ + if (NSHTTPCookieCommentURL_) + return NSHTTPCookieCommentURL_; + + return NSHTTPCookieCommentURL_ = new NSString(bindings.NSHTTPCookieCommentURL); +} + +NSString NSHTTPCookieDiscard () +{ + if (NSHTTPCookieDiscard_) + return NSHTTPCookieDiscard_; + + return NSHTTPCookieDiscard_ = new NSString(bindings.NSHTTPCookieDiscard); +} + +NSString NSHTTPCookieMaximumAge () +{ + if (NSHTTPCookieMaximumAge_) + return NSHTTPCookieMaximumAge_; + + return NSHTTPCookieMaximumAge_ = new NSString(bindings.NSHTTPCookieMaximumAge); +} + +NSString NSHTTPCookiePort () +{ + if (NSHTTPCookiePort_) + return NSHTTPCookiePort_; + + return NSHTTPCookiePort_ = new NSString(bindings.NSHTTPCookiePort); } class NSHTTPCookie : NSObject { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } Object initWithProperties (NSDictionary properties) { @@ -61,28 +162,22 @@ this (NSDictionary properties) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithProperties:", NSDictionary)(objcObject, properties); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithProperties(properties); } static Object cookieWithProperties (NSDictionary properties) { - return invokeObjcSelfClass!(Object, "cookieWithProperties:", NSDictionary)(properties); + return invokeObjcSuperClass!(Object, "cookieWithProperties:", NSDictionary)(properties); } static NSDictionary requestHeaderFieldsWithCookies (NSArray cookies) { - return invokeObjcSelfClass!(NSDictionary, "requestHeaderFieldsWithCookies:", NSArray)(cookies); + return invokeObjcSuperClass!(NSDictionary, "requestHeaderFieldsWithCookies:", NSArray)(cookies); } static NSArray cookiesWithResponseHeaderFields (NSDictionary headerFields, NSURL URL) { - return invokeObjcSelfClass!(NSArray, "cookiesWithResponseHeaderFields:forURL:", NSDictionary, NSURL)(headerFields, URL); + return invokeObjcSuperClass!(NSArray, "cookiesWithResponseHeaderFields:forURL:", NSDictionary, NSURL)(headerFields, URL); } NSDictionary properties () diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSHTTPCookieStorage.d --- a/dstep/foundation/NSHTTPCookieStorage.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSHTTPCookieStorage.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,21 +6,24 @@ */ module dstep.foundation.NSHTTPCookieStorage; -import dstep.AvailabilityMacros; import dstep.foundation.NSArray; import dstep.foundation.NSHTTPCookie; -import dstep.foundation.NSHTTPCookieStorageInternal; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; +import dstep.foundation.NSString; import dstep.foundation.NSURL; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; import bindings = dstep.foundation.NSHTTPCookieStorage_bindings; alias NSUInteger NSHTTPCookieAcceptPolicy; -const NSString NSHTTPCookieManagerAcceptPolicyChangedNotification; -const NSString NSHTTPCookieManagerCookiesChangedNotification; +private +{ + NSString NSHTTPCookieManagerAcceptPolicyChangedNotification_; + NSString NSHTTPCookieManagerCookiesChangedNotification_; +} enum { @@ -29,19 +32,39 @@ NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain } -static this () +NSString NSHTTPCookieManagerAcceptPolicyChangedNotification () { - NSHTTPCookieManagerAcceptPolicyChangedNotification = new NSString(bindings.NSHTTPCookieManagerAcceptPolicyChangedNotification); - NSHTTPCookieManagerCookiesChangedNotification = new NSString(bindings.NSHTTPCookieManagerCookiesChangedNotification); + if (NSHTTPCookieManagerAcceptPolicyChangedNotification_) + return NSHTTPCookieManagerAcceptPolicyChangedNotification_; + + return NSHTTPCookieManagerAcceptPolicyChangedNotification_ = new NSString(bindings.NSHTTPCookieManagerAcceptPolicyChangedNotification); +} + +NSString NSHTTPCookieManagerCookiesChangedNotification () +{ + if (NSHTTPCookieManagerCookiesChangedNotification_) + return NSHTTPCookieManagerCookiesChangedNotification_; + + return NSHTTPCookieManagerCookiesChangedNotification_ = new NSString(bindings.NSHTTPCookieManagerCookiesChangedNotification); } class NSHTTPCookieStorage : NSObject { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static NSHTTPCookieStorage sharedHTTPCookieStorage () { - return invokeObjcSelfClass!(NSHTTPCookieStorage, "sharedHTTPCookieStorage"); + return invokeObjcSuperClass!(NSHTTPCookieStorage, "sharedHTTPCookieStorage"); } NSArray cookies () diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSHTTPCookieStorage_bindings.d --- a/dstep/foundation/NSHTTPCookieStorage_bindings.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSHTTPCookieStorage_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -1,13 +1,8 @@ module dstep.foundation.NSHTTPCookieStorage_bindings; -import dstep.AvailabilityMacros; -import dstep.foundation.NSArray; -import dstep.foundation.NSHTTPCookie; -import dstep.foundation.NSHTTPCookieStorageInternal; -import dstep.foundation.NSObject; -import dstep.foundation.NSURL; -import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + extern (C) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSHTTPCookie_bindings.d --- a/dstep/foundation/NSHTTPCookie_bindings.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSHTTPCookie_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -1,15 +1,7 @@ module dstep.foundation.NSHTTPCookie_bindings; -import dstep.AvailabilityMacros; -import dstep.foundation.NSArray; -import dstep.foundation.NSDate; -import dstep.foundation.NSDictionary; -import dstep.foundation.NSHTTPCookieInternal; -import dstep.foundation.NSObject; -import dstep.foundation.NSString; -import dstep.foundation.NSURL; -import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + extern (C) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSHashTable.d --- a/dstep/foundation/NSHashTable.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSHashTable.d Sun Jan 03 22:06:11 2010 +0100 @@ -7,18 +7,23 @@ module dstep.foundation.NSHashTable; import dstep.foundation.NSArray; +import dstep.foundation.NSCoder; import dstep.foundation.NSEnumerator; import dstep.foundation.NSHashTable; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; import dstep.foundation.NSPointerFunctions; import dstep.foundation.NSSet; import dstep.foundation.NSString; +import dstep.foundation.NSZone; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + import bindings = dstep.foundation.NSHashTable_bindings; alias NSUInteger NSHashTableOptions; -alias {NSUInteger _pi; NSUInteger _si; void*_bs;} NSHashEnumerator; extern (C) { @@ -52,11 +57,26 @@ struct NSHashTableCallBacks { + extern (C) uint function (id table, /*const*/ void*) hash; + extern (C) bool function (id table, /*const*/ void*, /*const*/ void*) isEqual; + extern (C) void function (id table, /*const*/ void*) retain; + extern (C) uint function (id table, void*) release; + extern (C) id function (id table, /*const*/ void*) describe; } class NSHashTable : NSObject, INSCopying, INSCoding, INSFastEnumeration { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } Object initWithOptions (uint options, NSUInteger initialCapacity) { @@ -65,13 +85,7 @@ this (uint options, NSUInteger initialCapacity) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithOptions:capacity:", uint, NSUInteger)(objcObject, options, initialCapacity); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithOptions(options, initialCapacity); } Object initWithPointerFunctions (NSPointerFunctions functions, NSUInteger initialCapacity) @@ -81,23 +95,17 @@ this (NSPointerFunctions functions, NSUInteger initialCapacity) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithPointerFunctions:capacity:", NSPointerFunctions, NSUInteger)(objcObject, functions, initialCapacity); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithPointerFunctions(functions, initialCapacity); } static Object hashTableWithOptions (uint options) { - return invokeObjcSelfClass!(Object, "hashTableWithOptions:", uint)(options); + return invokeObjcSuperClass!(Object, "hashTableWithOptions:", uint)(options); } static Object hashTableWithWeakObjects () { - return invokeObjcSelfClass!(Object, "hashTableWithWeakObjects"); + return invokeObjcSuperClass!(Object, "hashTableWithWeakObjects"); } NSPointerFunctions pointerFunctions () @@ -202,13 +210,7 @@ this (NSCoder aDecoder) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithCoder(aDecoder); } NSUInteger countByEnumeratingWithState (NSFastEnumerationState* state, id* stackbuf, NSUInteger len) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSHashTable_bindings.d --- a/dstep/foundation/NSHashTable_bindings.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSHashTable_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -1,37 +1,25 @@ module dstep.foundation.NSHashTable_bindings; -import dstep.foundation.NSArray; -import dstep.foundation.NSEnumerator; import dstep.foundation.NSHashTable; -import dstep.foundation.NSPointerFunctions; -import dstep.foundation.NSSet; -import dstep.foundation.NSString; -import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; - +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSZone; +import dstep.objc.objc; extern (C) { - extern - { - } -} - -extern (C) -{ - private void NSFreeHashTable (id table); - private void NSResetHashTable (id table); - private bool NSCompareHashTables (id table1, id table2); - private id NSCopyHashTableWithZone (id table, NSZone* zone); - private void* NSHashGet (id table, void* pointer); - private void NSHashInsert (id table, void* pointer); - private void NSHashInsertKnownAbsent (id table, void* pointer); - private void* NSHashInsertIfAbsent (id table, void* pointer); - private void NSHashRemove (id table, void* pointer); - private NSHashEnumerator NSEnumerateHashTable (id table); - private NSUInteger NSCountHashTable (id table); - private id NSStringFromHashTable (id table); - private id NSAllHashTableObjects (id table); - private id NSCreateHashTableWithZone (NSHashTableCallBacks callBacks, NSUInteger capacity, NSZone* zone); - private id NSCreateHashTable (NSHashTableCallBacks callBacks, NSUInteger capacity); + package void NSFreeHashTable (id table); + package void NSResetHashTable (id table); + package bool NSCompareHashTables (id table1, id table2); + package id NSCopyHashTableWithZone (id table, NSZone* zone); + package void* NSHashGet (id table, void* pointer); + package void NSHashInsert (id table, void* pointer); + package void NSHashInsertKnownAbsent (id table, void* pointer); + package void* NSHashInsertIfAbsent (id table, void* pointer); + package void NSHashRemove (id table, void* pointer); + package NSHashEnumerator NSEnumerateHashTable (id table); + package NSUInteger NSCountHashTable (id table); + package id NSStringFromHashTable (id table); + package id NSAllHashTableObjects (id table); + package id NSCreateHashTableWithZone (NSHashTableCallBacks callBacks, NSUInteger capacity, NSZone* zone); + package id NSCreateHashTable (NSHashTableCallBacks callBacks, NSUInteger capacity); } \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSHost.d --- a/dstep/foundation/NSHost.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSHost.d Sun Jan 03 22:06:11 2010 +0100 @@ -7,44 +7,53 @@ module dstep.foundation.NSHost; import dstep.foundation.NSArray; -import dstep.foundation.NSMutableArray; import dstep.foundation.NSObject; import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; class NSHost : NSObject { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static NSHost currentHost () { - return invokeObjcSelfClass!(NSHost, "currentHost"); + return invokeObjcSuperClass!(NSHost, "currentHost"); } static NSHost hostWithName (NSString name) { - return invokeObjcSelfClass!(NSHost, "hostWithName:", NSString)(name); + return invokeObjcSuperClass!(NSHost, "hostWithName:", NSString)(name); } static NSHost hostWithAddress (NSString address) { - return invokeObjcSelfClass!(NSHost, "hostWithAddress:", NSString)(address); + return invokeObjcSuperClass!(NSHost, "hostWithAddress:", NSString)(address); } static void setHostCacheEnabled (bool flag) { - return invokeObjcSelfClass!(void, "setHostCacheEnabled:", bool)(flag); + return invokeObjcSuperClass!(void, "setHostCacheEnabled:", bool)(flag); } static bool isHostCacheEnabled () { - return invokeObjcSelfClass!(bool, "isHostCacheEnabled"); + return invokeObjcSuperClass!(bool, "isHostCacheEnabled"); } static void flushHostCache () { - return invokeObjcSelfClass!(void, "flushHostCache"); + return invokeObjcSuperClass!(void, "flushHostCache"); } bool isEqualToHost (NSHost aHost) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSIndexPath.d --- a/dstep/foundation/NSIndexPath.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSIndexPath.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,22 +6,35 @@ */ module dstep.foundation.NSIndexPath; +import dstep.foundation.NSCoder; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; +import dstep.foundation.NSZone; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; class NSIndexPath : NSObject, INSCopying, INSCoding { - mixin ObjcWrap; - + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } + static Object indexPathWithIndex (NSUInteger index) { - return invokeObjcSelfClass!(Object, "indexPathWithIndex:", NSUInteger)(index); + return invokeObjcSuperClass!(Object, "indexPathWithIndex:", NSUInteger)(index); } static Object indexPathWithIndexes (NSUInteger* indexes, NSUInteger length) { - return invokeObjcSelfClass!(Object, "indexPathWithIndexes:length:", NSUInteger*, NSUInteger)(indexes, length); + return invokeObjcSuperClass!(Object, "indexPathWithIndexes:length:", NSUInteger*, NSUInteger)(indexes, length); } Object initWithIndex (NSUInteger index) @@ -31,13 +44,7 @@ this (NSUInteger index) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithIndex:", NSUInteger)(objcObject, index); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithIndex(index); } Object initWithIndexes (NSUInteger* indexes, NSUInteger length) @@ -47,13 +54,7 @@ this (NSUInteger* indexes, NSUInteger length) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithIndexes:length:", NSUInteger*, NSUInteger)(objcObject, indexes, length); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithIndexes(indexes, length); } NSIndexPath indexPathByAddingIndex (NSUInteger index) @@ -105,13 +106,7 @@ this (NSCoder aDecoder) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithCoder(aDecoder); } } diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSIndexSet.d --- a/dstep/foundation/NSIndexSet.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSIndexSet.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,14 +6,27 @@ */ module dstep.foundation.NSIndexSet; +import dstep.foundation.NSCoder; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; import dstep.foundation.NSRange; +import dstep.foundation.NSZone; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; class NSMutableIndexSet : NSIndexSet { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + typeof(this).alloc.init; + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } void addIndexes (NSIndexSet indexSet) { @@ -58,37 +71,31 @@ class NSIndexSet : NSObject, INSCopying, INSMutableCopying, INSCoding { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + typeof(this).alloc.init; + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static Object indexSet () { - return invokeObjcSelfClass!(Object, "indexSet"); + return invokeObjcSuperClass!(Object, "indexSet"); } static Object indexSetWithIndex (NSUInteger value) { - return invokeObjcSelfClass!(Object, "indexSetWithIndex:", NSUInteger)(value); + return invokeObjcSuperClass!(Object, "indexSetWithIndex:", NSUInteger)(value); } static Object indexSetWithIndexesInRange (NSRange range) { - return invokeObjcSelfClass!(Object, "indexSetWithIndexesInRange:", NSRange)(range); - } - - Object init () - { - return invokeObjcSelf!(Object, "init"); - } - - this () - { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "init")(objcObject); - - if (result) - objcObject = ret; - - dObject = this; + return invokeObjcSuperClass!(Object, "indexSetWithIndexesInRange:", NSRange)(range); } Object initWithIndex (NSUInteger value) @@ -98,13 +105,7 @@ this (NSUInteger value) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithIndex:", NSUInteger)(objcObject, value); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithIndex(value); } Object initWithIndexesInRange (NSRange range) @@ -114,13 +115,7 @@ this (NSRange range) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithIndexesInRange:", NSRange)(objcObject, range); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithIndexesInRange(range); } Object initWithIndexSet (NSIndexSet indexSet) @@ -130,13 +125,7 @@ this (NSIndexSet indexSet) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithIndexSet:", NSIndexSet)(objcObject, indexSet); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithIndexSet(indexSet); } bool isEqualToIndexSet (NSIndexSet indexSet) @@ -231,13 +220,7 @@ this (NSCoder aDecoder) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithCoder(aDecoder); } } diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSInvocation.d --- a/dstep/foundation/NSInvocation.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSInvocation.d Sun Jan 03 22:06:11 2010 +0100 @@ -7,18 +7,28 @@ module dstep.foundation.NSInvocation; import dstep.foundation.NSMethodSignature; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; -import dstep.stdbool; +import dstep.objc.objc; class NSInvocation : NSObject { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static NSInvocation invocationWithMethodSignature (NSMethodSignature sig) { - return invokeObjcSelfClass!(NSInvocation, "invocationWithMethodSignature:", NSMethodSignature)(sig); + return invokeObjcSuperClass!(NSInvocation, "invocationWithMethodSignature:", NSMethodSignature)(sig); } NSMethodSignature methodSignature () diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSJavaSetup.d --- a/dstep/foundation/NSJavaSetup.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSJavaSetup.d Sun Jan 03 22:06:11 2010 +0100 @@ -12,7 +12,8 @@ import dstep.foundation.NSObject; import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; +import bindings = dstep.foundation.NSJavaSetup_bindings; bool NSJavaNeedsVirtualMachine (NSDictionary plist) { diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSJavaSetup_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSJavaSetup_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,23 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Aug 19, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.foundation.NSJavaSetup_bindings; + +import dstep.objc.objc; + +extern (C): +package: + +bool NSJavaNeedsVirtualMachine (id plist); +bool NSJavaProvidesClasses (id plist); +bool NSJavaNeedsToLoadClasses (id plist); +id NSJavaSetup (id plist); +id NSJavaSetupVirtualMachine (); +id NSJavaObjectNamedInPath (id name, id path); +id NSJavaClassesFromPath (id path, id wanted, bool usesyscl, id* vm); +id NSJavaClassesForBundle (id bundle, bool usesyscl, id* vm); +id NSJavaBundleSetup (id bundle, id plist); +void NSJavaBundleCleanup (id bundle, id plist); \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSKeyValueCoding.d --- a/dstep/foundation/NSKeyValueCoding.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSKeyValueCoding.d Sun Jan 03 22:06:11 2010 +0100 @@ -12,70 +12,303 @@ import dstep.foundation.NSSet; import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + import bindings = dstep.foundation.NSKeyValueCoding_bindings; -const NSString NSUndefinedKeyException; -const NSString NSAverageKeyValueOperator; -const NSString NSCountKeyValueOperator; -const NSString NSDistinctUnionOfArraysKeyValueOperator; -const NSString NSDistinctUnionOfObjectsKeyValueOperator; -const NSString NSDistinctUnionOfSetsKeyValueOperator; -const NSString NSMaximumKeyValueOperator; -const NSString NSMinimumKeyValueOperator; -const NSString NSSumKeyValueOperator; -const NSString NSUnionOfArraysKeyValueOperator; -const NSString NSUnionOfObjectsKeyValueOperator; -const NSString NSUnionOfSetsKeyValueOperator; +private +{ + NSString NSUndefinedKeyException_; + NSString NSAverageKeyValueOperator_; + NSString NSCountKeyValueOperator_; + NSString NSDistinctUnionOfArraysKeyValueOperator_; + NSString NSDistinctUnionOfObjectsKeyValueOperator_; + NSString NSDistinctUnionOfSetsKeyValueOperator_; + NSString NSMaximumKeyValueOperator_; + NSString NSMinimumKeyValueOperator_; + NSString NSSumKeyValueOperator_; + NSString NSUnionOfArraysKeyValueOperator_; + NSString NSUnionOfObjectsKeyValueOperator_; + NSString NSUnionOfSetsKeyValueOperator_; +} + +NSString NSUndefinedKeyException () +{ + if (NSUndefinedKeyException_) + return NSUndefinedKeyException_; + + return NSUndefinedKeyException_ = new NSString(bindings.NSUndefinedKeyException); +} + +NSString NSAverageKeyValueOperator () +{ + if (NSAverageKeyValueOperator_) + return NSAverageKeyValueOperator_; + + return NSAverageKeyValueOperator_ = new NSString(bindings.NSAverageKeyValueOperator); +} + +NSString NSCountKeyValueOperator () +{ + if (NSCountKeyValueOperator_) + return NSCountKeyValueOperator_; + + return NSCountKeyValueOperator_ = new NSString(bindings.NSCountKeyValueOperator); +} + +NSString NSDistinctUnionOfArraysKeyValueOperator () +{ + if (NSDistinctUnionOfArraysKeyValueOperator_) + return NSDistinctUnionOfArraysKeyValueOperator_; + + return NSDistinctUnionOfArraysKeyValueOperator_ = new NSString(bindings.NSDistinctUnionOfArraysKeyValueOperator); +} -static this () +NSString NSDistinctUnionOfObjectsKeyValueOperator () +{ + if (NSDistinctUnionOfObjectsKeyValueOperator_) + return NSDistinctUnionOfObjectsKeyValueOperator_; + + return NSDistinctUnionOfObjectsKeyValueOperator_ = new NSString(bindings.NSDistinctUnionOfObjectsKeyValueOperator); +} + +NSString NSDistinctUnionOfSetsKeyValueOperator () +{ + if (NSDistinctUnionOfSetsKeyValueOperator_) + return NSDistinctUnionOfSetsKeyValueOperator_; + + return NSDistinctUnionOfSetsKeyValueOperator_ = new NSString(bindings.NSDistinctUnionOfSetsKeyValueOperator); +} + +NSString NSMaximumKeyValueOperator () +{ + if (NSMaximumKeyValueOperator_) + return NSMaximumKeyValueOperator_; + + return NSMaximumKeyValueOperator_ = new NSString(bindings.NSMaximumKeyValueOperator); +} + +NSString NSMinimumKeyValueOperator () { - NSUndefinedKeyException = new NSString(bindings.NSUndefinedKeyException); - NSAverageKeyValueOperator = new NSString(bindings.NSAverageKeyValueOperator); - NSCountKeyValueOperator = new NSString(bindings.NSCountKeyValueOperator); - NSDistinctUnionOfArraysKeyValueOperator = new NSString(bindings.NSDistinctUnionOfArraysKeyValueOperator); - NSDistinctUnionOfObjectsKeyValueOperator = new NSString(bindings.NSDistinctUnionOfObjectsKeyValueOperator); - NSDistinctUnionOfSetsKeyValueOperator = new NSString(bindings.NSDistinctUnionOfSetsKeyValueOperator); - NSMaximumKeyValueOperator = new NSString(bindings.NSMaximumKeyValueOperator); - NSMinimumKeyValueOperator = new NSString(bindings.NSMinimumKeyValueOperator); - NSSumKeyValueOperator = new NSString(bindings.NSSumKeyValueOperator); - NSUnionOfArraysKeyValueOperator = new NSString(bindings.NSUnionOfArraysKeyValueOperator); - NSUnionOfObjectsKeyValueOperator = new NSString(bindings.NSUnionOfObjectsKeyValueOperator); - NSUnionOfSetsKeyValueOperator = new NSString(bindings.NSUnionOfSetsKeyValueOperator); + if (NSMinimumKeyValueOperator_) + return NSMinimumKeyValueOperator_; + + return NSMinimumKeyValueOperator_ = new NSString(bindings.NSMinimumKeyValueOperator); +} + +NSString NSSumKeyValueOperator () +{ + if (NSSumKeyValueOperator_) + return NSSumKeyValueOperator_; + + return NSSumKeyValueOperator_ = new NSString(bindings.NSSumKeyValueOperator); +} + +NSString NSUnionOfArraysKeyValueOperator () +{ + if (NSUnionOfArraysKeyValueOperator_) + return NSUnionOfArraysKeyValueOperator_; + + return NSUnionOfArraysKeyValueOperator_ = new NSString(bindings.NSUnionOfArraysKeyValueOperator); +} + +NSString NSUnionOfObjectsKeyValueOperator () +{ + if (NSUnionOfObjectsKeyValueOperator_) + return NSUnionOfObjectsKeyValueOperator_; + + return NSUnionOfObjectsKeyValueOperator_ = new NSString(bindings.NSUnionOfObjectsKeyValueOperator); +} + +NSString NSUnionOfSetsKeyValueOperator () +{ + if (NSUnionOfSetsKeyValueOperator_) + return NSUnionOfSetsKeyValueOperator_; + + return NSUnionOfSetsKeyValueOperator_ = new NSString(bindings.NSUnionOfSetsKeyValueOperator); } -template TNSDeprecatedKeyValueCoding () -{ - static bool useStoredAccessor (); - Object storedValueForKey (NSString key); - void takeStoredValue (Object value, NSString key); - void takeValue (Object value, NSString key); - void takeValue (Object value, NSString keyPath); - Object handleQueryWithUnboundKey (NSString key); - void handleTakeValue (Object value, NSString key); - void unableToSetNilForKey (NSString key); - NSDictionary valuesForKeys (NSArray keys); - void takeValuesFromDictionary (NSDictionary properties); -} +const TNSDeprecatedKeyValueCoding = ` + + static bool useStoredAccessor () + { + return invokeObjcSelfClass!(bool, "useStoredAccessor"); + } + + Object storedValueForKey (NSString key) + { + return invokeObjcSelf!(Object, "storedValueForKey:", NSString)(key); + } + + void takeStoredValue (Object value, NSString key) + { + return invokeObjcSelf!(void, "takeStoredValue:forKey:", Object, NSString)(value, key); + } + + void takeValue (Object value, NSString key) + { + return invokeObjcSelf!(void, "takeValue:forKey:", Object, NSString)(value, key); + } + + void takeValue_forKeyPath (Object value, NSString keyPath) + { + return invokeObjcSelf!(void, "takeValue:forKeyPath:", Object, NSString)(value, keyPath); + } + + Object handleQueryWithUnboundKey (NSString key) + { + return invokeObjcSelf!(Object, "handleQueryWithUnboundKey:", NSString)(key); + } + + void handleTakeValue (Object value, NSString key) + { + return invokeObjcSelf!(void, "handleTakeValue:forUnboundKey:", Object, NSString)(value, key); + } + + void unableToSetNilForKey (NSString key) + { + return invokeObjcSelf!(void, "unableToSetNilForKey:", NSString)(key); + } + + NSDictionary valuesForKeys (NSArray keys) + { + return invokeObjcSelf!(NSDictionary, "valuesForKeys:", NSArray)(keys); + } + + void takeValuesFromDictionary (NSDictionary properties) + { + return invokeObjcSelf!(void, "takeValuesFromDictionary:", NSDictionary)(properties); + } + + //mixin ObjcBindClassMethod!(useStoredAccessor, "useStoredAccessor"); + //mixin ObjcBindMethod!(storedValueForKey, "storedValueForKey:"); + //mixin ObjcBindMethod!(takeStoredValue, "takeStoredValue:forKey:"); + //mixin ObjcBindMethod!(takeValue, "takeValue:forKey"); + //mixin ObjcBindMethod!(takeValue_forKeyPath, "takeValue:forKeyPath:"); + //mixin ObjcBindMethod!(handleQueryWithUnboundKey, "handleQueryWithUnboundKey:"); + //mixin ObjcBindMethod!(handleTakeValue, "handleTakeValue:forUnboundKey:"); + //mixin ObjcBindMethod!(unableToSetNilForKey, "unableToSetNilForKey:"); + //mixin ObjcBindMethod!(valuesForKeys, "valuesForKeys:"); + //mixin ObjcBindMethod!(takeValuesFromDictionary, "takeValuesFromDictionary:"); +`; + +const TNSKeyValueCoding = ` -template TNSKeyValueCoding () -{ - static bool accessInstanceVariablesDirectly (); - Object valueForKey (NSString key); - void setValue (Object value, NSString key); - bool validateValue (id* ioValue, NSString inKey, NSError** outError); - NSMutableArray mutableArrayValueForKey (NSString key); - NSMutableSet mutableSetValueForKey (NSString key); - Object valueForKeyPath (NSString keyPath); - void setValue (Object value, NSString keyPath); - bool validateValue (id* ioValue, NSString inKeyPath, NSError** outError); - NSMutableArray mutableArrayValueForKeyPath (NSString keyPath); - NSMutableSet mutableSetValueForKeyPath (NSString keyPath); - Object valueForUndefinedKey (NSString key); - void setValue (Object value, NSString key); - void setNilValueForKey (NSString key); - NSDictionary dictionaryWithValuesForKeys (NSArray keys); - void setValuesForKeysWithDictionary (NSDictionary keyedValues); -} - + static bool accessInstanceVariablesDirectly () + { + return invokeObjcSelfClass!(bool, "accessInstanceVariablesDirectly"); + } + + Object valueForKey (NSString key) + { + return invokeObjcSelf!(Object, "valueForKey:", NSString)(key); + } + + void setValue (Object value, NSString key) + { + return invokeObjcSelf!(void, "setValue:forKey:", Object, NSString)(value, key); + } + + bool validateValue (id* ioValue, NSString inKey, ref NSError outError) + { + id error; + + if (outError) + error = new objc_object; + + bool result = invokeObjcSelf!(bool, "validateValue:forKey:error:", id*, NSString, id*)(ioValue, inKey, &error); + + if (error) + outError = new NSError(error); + + return result; + } + + NSMutableArray mutableArrayValueForKey (NSString key) + { + return invokeObjcSelf!(NSMutableArray, "mutableArrayValueForKey:", NSString)(key); + } + + NSMutableSet mutableSetValueForKey (NSString key) + { + return invokeObjcSelf!(NSMutableSet, "mutableSetValueForKey:", NSString)(key); + } + + Object valueForKeyPath (NSString keyPath) + { + return invokeObjcSelf!(Object, "valueForKeyPath:", NSString)(keyPath); + } + + void setValue_forKeyPath (Object value, NSString keyPath) + { + return invokeObjcSelf!(void, "setValue:forKeyPath:", Object, NSString)(value, keyPath); + } + + bool validateValue_forKeyPath_error (id* ioValue, NSString inKeyPath, ref NSError outError) + { + id error; + + if (outError) + error = new objc_object; + + bool result = invokeObjcSelf!(bool, "validateValue:forKeyPath:error:", id*, NSString, id*)(ioValue, inKeyPath, &error); + + if (error) + outError = new NSError(error); + + return result; + } + + NSMutableArray mutableArrayValueForKeyPath (NSString keyPath) + { + return invokeObjcSelf!(NSMutableArray, "mutableArrayValueForKeyPath:", NSString)(keyPath); + } + + NSMutableSet mutableSetValueForKeyPath (NSString keyPath) + { + return invokeObjcSelf!(NSMutableSet, "mutableSetValueForKeyPath:", NSString)(keyPath); + } + + Object valueForUndefinedKey (NSString key) + { + return invokeObjcSelf!(Object, "valueForUndefinedKey:", NSString)(key); + } + + void setValue_forUndefinedKey (Object value, NSString key) + { + return invokeObjcSelf!(void, "setValue:forUndefinedKey:", Object, NSString)(value, key); + } + + void setNilValueForKey (NSString key) + { + return invokeObjcSelf!(void, "setNilValueForKey:", NSString)(key); + } + + NSDictionary dictionaryWithValuesForKeys (NSArray keys) + { + return invokeObjcSelf!(NSDictionary, "dictionaryWithValuesForKeys:", NSArray)(keys); + } + + void setValuesForKeysWithDictionary (NSDictionary keyedValues) + { + return invokeObjcSelf!(void, "setValuesForKeysWithDictionary:", NSDictionary)(keyedValues); + } + + //mixin ObjcBindClassMethod!(accessInstanceVariablesDirectly, bool, "accessInstanceVariablesDirectly"); + //mixin ObjcBindMethod!(setValue, void, "setValue:forKey:", Object, NSString); + ////mixin ObjcBindMethod!(validateValue, bool, "validateValue:forKey:error:", id*, NSString, NSError*); + //mixin ObjcBindMethod!(mutableArrayValueForKey, NSMutableArray, "mutableArrayValueForKey:", NSString); + //mixin ObjcBindMethod!(mutableSetValueForKey, NSMutableSet, "mutableSetValueForKey:", NSString); + //mixin ObjcBindMethod!(valueForKeyPath, Object, "valueForKeyPath:", NSString); + //mixin ObjcBindMethod!(setValue_forKeyPath, void, "setValue:forKeyPath:", Object, NSString); + ////mixin ObjcBindMethod!(validateValue_forKeyPath_error, "validateValue:forKeyPath:error:"); + //mixin ObjcBindMethod!(mutableArrayValueForKeyPath, NSMutableArray, "mutableArrayValueForKeyPath:", NSString); + //mixin ObjcBindMethod!(mutableSetValueForKeyPath, NSMutableSet, "mutableSetValueForKeyPath:", NSString); + //mixin ObjcBindMethod!(valueForUndefinedKey, Object, "valueForUndefinedKey:", NSString); + //mixin ObjcBindMethod!(setValue_forUndefinedKey, void, "setValue:forUndefinedKey:", Object, NSString); + //mixin ObjcBindMethod!(setNilValueForKey, void, "setNilValueForKey:", NSString); + //mixin ObjcBindMethod!(dictionaryWithValuesForKeys, NSDictionary, "dictionaryWithValuesForKeys:", NSArray); + //mixin ObjcBindMethod!(setValuesForKeysWithDictionary, void, "setValuesForKeysWithDictionary:", NSDictionary); +`; \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSKeyValueCoding_bindings.d --- a/dstep/foundation/NSKeyValueCoding_bindings.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSKeyValueCoding_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,7 +6,9 @@ import dstep.foundation.NSSet; import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + extern (C) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSKeyValueObserving.d --- a/dstep/foundation/NSKeyValueObserving.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSKeyValueObserving.d Sun Jan 03 22:06:11 2010 +0100 @@ -8,10 +8,13 @@ import dstep.foundation.NSArray; import dstep.foundation.NSIndexSet; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSSet; import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + import bindings = dstep.foundation.NSKeyValueObserving_bindings; @@ -19,11 +22,54 @@ alias NSUInteger NSKeyValueChange; alias NSUInteger NSKeyValueSetMutationKind; -const NSString NSKeyValueChangeKindKey; -const NSString NSKeyValueChangeNewKey; -const NSString NSKeyValueChangeOldKey; -const NSString NSKeyValueChangeIndexesKey; -const NSString NSKeyValueChangeNotificationIsPriorKey; +private +{ + NSString NSKeyValueChangeKindKey_; + NSString NSKeyValueChangeNewKey_; + NSString NSKeyValueChangeOldKey_; + NSString NSKeyValueChangeIndexesKey_; + NSString NSKeyValueChangeNotificationIsPriorKey_; +} + +NSString NSKeyValueChangeKindKey () +{ + if (NSKeyValueChangeKindKey_) + return NSKeyValueChangeKindKey_; + + return NSKeyValueChangeKindKey_ = new NSString(bindings.NSKeyValueChangeKindKey); +} + +NSString NSKeyValueChangeNewKey () +{ + if (NSKeyValueChangeNewKey_) + return NSKeyValueChangeNewKey_; + + return NSKeyValueChangeNewKey_ = new NSString(bindings.NSKeyValueChangeNewKey); +} + +NSString NSKeyValueChangeOldKey () +{ + if (NSKeyValueChangeOldKey_) + return NSKeyValueChangeOldKey_; + + return NSKeyValueChangeOldKey_ = new NSString(bindings.NSKeyValueChangeOldKey); +} + +NSString NSKeyValueChangeIndexesKey () +{ + if (NSKeyValueChangeIndexesKey_) + return NSKeyValueChangeIndexesKey_; + + return NSKeyValueChangeIndexesKey_ = new NSString(bindings.NSKeyValueChangeIndexesKey); +} + +NSString NSKeyValueChangeNotificationIsPriorKey () +{ + if (NSKeyValueChangeNotificationIsPriorKey_) + return NSKeyValueChangeNotificationIsPriorKey_; + + return NSKeyValueChangeNotificationIsPriorKey_ = new NSString(bindings.NSKeyValueChangeNotificationIsPriorKey); +} enum { @@ -49,35 +95,76 @@ NSKeyValueSetSetMutation = 4 } -static this () -{ - NSKeyValueChangeKindKey = new NSString(bindings.NSKeyValueChangeKindKey); - NSKeyValueChangeNewKey = new NSString(bindings.NSKeyValueChangeNewKey); - NSKeyValueChangeOldKey = new NSString(bindings.NSKeyValueChangeOldKey); - NSKeyValueChangeIndexesKey = new NSString(bindings.NSKeyValueChangeIndexesKey); - NSKeyValueChangeNotificationIsPriorKey = new NSString(bindings.NSKeyValueChangeNotificationIsPriorKey); -} +const TNSKeyValueObserverNotification = ` -template TNSKeyValueObserverNotification () -{ - void willChangeValueForKey (NSString key); - void didChangeValueForKey (NSString key); - void willChange (uint changeKind, NSIndexSet indexes, NSString key); - void didChange (uint changeKind, NSIndexSet indexes, NSString key); - void willChangeValueForKey (NSString key, uint mutationKind, NSSet objects); - void didChangeValueForKey (NSString key, uint mutationKind, NSSet objects); -} + void willChangeValueForKey (NSString key) + { + return invokeObjcSelf!(void, "willChangeValueForKey:", NSString)(key); + } + + void didChangeValueForKey (NSString key) + { + return invokeObjcSelf!(void, "didChangeValueForKey:", NSString)(key); + } + + void willChange (NSKeyValueChange changeKind, NSIndexSet indexes, NSString key) + { + return invokeObjcSelf!(void, "willChange:valuesAtIndexes:forKey:", NSKeyValueChange, NSIndexSet, NSString)(changeKind, indexes, key); + } + + void didChange (NSKeyValueChange changeKind, NSIndexSet indexes, NSString key) + { + return invokeObjcSelf!(void, "didChange:valuesAtIndexes:forKey:", NSKeyValueChange, NSIndexSet, NSString)(changeKind, indexes, key); + } + + void willChangeValueForKey (NSString key, NSKeyValueSetMutationKind mutationKind, NSSet objects) + { + return invokeObjcSelf!(void, "willChangeValueForKey:withSetMutation:usingObjects:", NSString, NSKeyValueSetMutationKind, NSSet)(key, mutationKind, objects); + } + + void didChangeValueForKey (NSString key, NSKeyValueSetMutationKind mutationKind, NSSet objects) + { + return invokeObjcSelf!(void, "didChangeValueForKey::withSetMutation:usingObjects:", NSString, NSKeyValueSetMutationKind, NSSet)(key, mutationKind, objects); + } + + //mixin ObjcBindMethod!(willChangeValueForKey, void, "willChangeValueForKey:", NSString); + //mixin ObjcBindMethod!(didChangeValueForKey, void, "didChangeValueForKey:", NSString); + //mixin ObjcBindMethod!(willChange, void, "willChange:valuesAtIndexes:forKey:", NSKeyValueChange, NSIndexSet, NSString); + //mixin ObjcBindMethod!(didChange, void, "didChange:valuesAtIndexes:forKey:", NSKeyValueChange, NSIndexSet, NSString); + //mixin ObjcBindMethod!(willChangeValueForKey, void, "willChangeValueForKey:withSetMutation:usingObjects:", NSString, NSKeyValueSetMutationKind, NSSet); + //mixin ObjcBindMethod!(didChangeValueForKey, void, "didChangeValueForKey:withSetMutation:usingObjects:", NSString, NSKeyValueSetMutationKind, NSSet); +`; -template TNSKeyValueObservingCustomization () -{ - static NSSet keyPathsForValuesAffectingValueForKey (NSString key); - static bool automaticallyNotifiesObserversForKey (NSString key); - void setObservationInfo (void* observationInfo); - void* observationInfo (); -} +const TNSKeyValueObservingCustomization = ` -template TNSKeyValueObserverRegistration () -{ + static NSSet keyPathsForValuesAffectingValueForKey (NSString key) + { + return invokeObjcSelfClass!(NSSet, "keyPathsForValuesAffectingValueForKey:", NSString)(key); + } + + static bool automaticallyNotifiesObserversForKey (NSString key) + { + return invokeObjcSelfClass!(bool, "automaticallyNotifiesObserversForKey:", NSString)(key); + } + + void setObservationInfo (void* observationInfo) + { + return invokeObjcSelf!(void, "setObservationInfo:", void*)(observationInfo); + } + + void* observationInfo () + { + return invokeObjcSelf!(void*, "observationInfo"); + } + + //mixin ObjcBindClassMethod!(keyPathsForValuesAffectingValueForKey, "keyPathsForValuesAffectingValueForKey:"); + //mixin ObjcBindClassMethod!(automaticallyNotifiesObserversForKey, "automaticallyNotifiesObserversForKey:"); + //mixin ObjcBindMethod!(setObservationInfo, "setObservationInfo:"); + //mixin ObjcBindMethod!(observationInfo, "observationInfo"); +`; + +const TNSKeyValueObserverRegistration = ` + void addObserver (NSObject observer, NSString keyPath, uint options, void* context) { return invokeObjcSelf!(void, "addObserver:forKeyPath:options:context:", NSObject, NSString, uint, void*)(observer, keyPath, options, context); @@ -87,15 +174,24 @@ { return invokeObjcSelf!(void, "removeObserver:forKeyPath:", NSObject, NSString)(observer, keyPath); } -} +`; + +const TNSDeprecatedKeyValueObservingCustomization = ` -template TNSDeprecatedKeyValueObservingCustomization () -{ - static void setKeys (NSArray keys, NSString dependentKey); -} + static void setKeys (NSArray keys, NSString dependentKey) + { + return invokeObjcSelfClass!(void, "setKeys:triggerChangeNotificationsForDependentKey:", NSArray, NSString)(keys, dependentKey); + } + + //mixin ObjcBindClassMethod!(setKeys, "setKeys:triggerChangeNotificationsForDependentKey:"); +`; -template TNSKeyValueObserving () -{ - void observeValueForKeyPath (NSString keyPath, Object object, NSDictionary change, void* context); -} +const TNSKeyValueObserving = ` + void observeValueForKeyPath (NSString keyPath, Object object, NSDictionary change, void* context) + { + return invokeObjcSelf!(void, "observeValueForKeyPath:ofObject:change:context:", NSString, Object, NSDictionary, void*)(keyPath, object, change, context); + } + + //mixin ObjcBindMethod!(observeValueForKeyPath, "observeValueForKeyPath:ofObject:change:context:"); +`; \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSKeyValueObserving_bindings.d --- a/dstep/foundation/NSKeyValueObserving_bindings.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSKeyValueObserving_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -5,7 +5,9 @@ import dstep.foundation.NSSet; import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + extern (C) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSKeyedArchiver.d --- a/dstep/foundation/NSKeyedArchiver.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSKeyedArchiver.d Sun Jan 03 22:06:11 2010 +0100 @@ -10,34 +10,190 @@ import dstep.foundation.NSCoder; import dstep.foundation.NSData; import dstep.foundation.NSGeometry; -import dstep.foundation.NSMutableData; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSPropertyList; +import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; - +import dstep.objc.objc; import bindings = dstep.foundation.NSKeyedArchiver_bindings; -const NSString NSInvalidArchiveOperationException; -const NSString NSInvalidUnarchiveOperationException; +private +{ + NSString NSInvalidArchiveOperationException_; + NSString NSInvalidUnarchiveOperationException_; +} + +NSString NSInvalidArchiveOperationException () +{ + if (NSInvalidArchiveOperationException_) + return NSInvalidArchiveOperationException_; + + return NSInvalidArchiveOperationException_ = new NSString(bindings.NSInvalidArchiveOperationException); +} + +NSString NSInvalidUnarchiveOperationException () +{ + if (NSInvalidUnarchiveOperationException_) + return NSInvalidUnarchiveOperationException_; + + return NSInvalidUnarchiveOperationException_ = new NSString(bindings.NSInvalidUnarchiveOperationException); +} + +const TNSKeyedArchiverObjectSubstitution = ` + + Class classForKeyedArchiver () + { + return invokeObjcSelf!(Class, "classForKeyedArchiver"); + } + + Object replacementObjectForKeyedArchiver (NSKeyedArchiver archiver) + { + return invokeObjcSelf!(Object, "replacementObjectForKeyedArchiver:", NSKeyedArchiver)(archiver); + } + + static NSArray classFallbacksForKeyedArchiver () + { + return invokeObjcSelfClass!(NSArray, "classFallbacksForKeyedArchiver"); + } + + //mixin ObjcBindMethod!(classForKeyedArchiver, "classForKeyedArchiver"); + //mixin ObjcBindMethod!(replacementObjectForKeyedArchiver, "replacementObjectForKeyedArchiver:"); + //mixin ObjcBindClassMethod!(classFallbacksForKeyedArchiver, "classFallbacksForKeyedArchiver"); +`; + +const TNSKeyedUnarchiverObjectSubstitution = ` + + static Class classForKeyedUnarchiver () + { + return invokeObjcSelfClass!(Class, "classForKeyedUnarchiver"); + } + + //mixin ObjcBindClassMethod!(classForKeyedUnarchiver, "classForKeyedUnarchiver"); +`; + +const TNSKeyedUnarchiverDelegate = ` -static this () -{ - NSInvalidArchiveOperationException = new NSString(bindings.NSInvalidArchiveOperationException); - NSInvalidUnarchiveOperationException = new NSString(bindings.NSInvalidUnarchiveOperationException); -} + Class unarchiver (NSKeyedUnarchiver unarchiver, NSString name, NSArray classNames) + { + return invokeObjcSelf!(Class, "unarchiver:cannotDecodeObjectOfClassName:originalClasses:", NSKeyedUnarchiver, NSString, NSArray)(unarchiver, name, classNames); + } + + Object unarchiver (NSKeyedUnarchiver unarchiver, Object object) + { + return invokeObjcSelf!(Object, "unarchiver:didDecodeObject:", NSKeyedUnarchiver, Object)(unarchiver, object); + } + + void unarchiver (NSKeyedUnarchiver unarchiver, Object object, Object newObject) + { + return invokeObjcSelf!(void, "unarchiver:willReplaceObject:withObject:", NSKeyedUnarchiver, Object, Object)(unarchiver, object, newObject); + } + + void unarchiverWillFinish (NSKeyedUnarchiver unarchiver) + { + return invokeObjcSelf!(void, "unarchiverWillFinish:", NSKeyedUnarchiver)(unarchiver); + } + + void unarchiverDidFinish (NSKeyedUnarchiver unarchiver) + { + return invokeObjcSelf!(void, "unarchiverDidFinish:", NSKeyedUnarchiver)(unarchiver); + } + + //mixin ObjcBindMethod!(unarchiver, "unarchiver:cannotDecodeObjectOfClassName:originalClasses:"); + //mixin ObjcBindMethod!(unarchiver, "unarchiver:didDecodeObject:"); + //mixin ObjcBindMethod!(unarchiver, "unarchiver:willReplaceObject:withObject:"); + //mixin ObjcBindMethod!(unarchiverWillFinish, "unarchiverWillFinish:"); + //mixin ObjcBindMethod!(unarchiverDidFinish, "unarchiverDidFinish:"); +`; + +const TNSKeyedArchiverDelegate = ` + + Object archiver (NSKeyedArchiver archiver, Object object) + { + return invokeObjcSelf!(Object, "archiver:willEncodeObject:", NSKeyedArchiver, Object)(archiver, object); + } + + void archiver_didEncodeObject (NSKeyedArchiver archiver, Object object) + { + return invokeObjcSelf!(void, "archiver:didEncodeObject:", NSKeyedArchiver, Object)(archiver, object); + } + + void archiver (NSKeyedArchiver archiver, Object object, Object newObject) + { + return invokeObjcSelf!(void, "archiver:willReplaceObject:withObject:", NSKeyedArchiver, Object, Object)(archiver, object, newObject); + } + + void archiverWillFinish (NSKeyedArchiver archiver) + { + return invokeObjcSelf!(void, "archiverWillFinish:", NSKeyedArchiver)(archiver); + } + + void archiverDidFinish (NSKeyedArchiver archiver) + { + return invokeObjcSelf!(void, "archiverDidFinish:", NSKeyedArchiver)(archiver); + } + + //mixin ObjcBindMethod!(archiver, "archiver:willEncodeObject:"); + //mixin ObjcBindMethod!(archiver_didEncodeObject, "archiver:didEncodeObject:"); + //mixin ObjcBindMethod!(archiver, "archiver:willReplaceObject:withObject::"); + //mixin ObjcBindMethod!(archiverWillFinish, "archiverWillFinish:"); + //mixin ObjcBindMethod!(archiverDidFinish, "archiverDidFinish:"); +`; + +const TNSGeometryKeyedCoding = ` + + void encodePoint (NSPoint point, NSString key) + { + return invokeObjcSelf!(void, "encodePoint:forKey:", NSPoint, NSString)(point, key); + } + + void encodeSize (NSSize size, NSString key) + { + return invokeObjcSelf!(void, "encodeSize:forKey:", NSSize, NSString)(size, key); + } + + void encodeRect (NSRect rect, NSString key) + { + return invokeObjcSelf!(void, "encodeRect:forKey:", NSRect, NSString)(rect, key); + } + + NSPoint decodePointForKey (NSString key) + { + return invokeObjcSelf!(NSPoint, "decodePointForKey:", NSString)(key); + } + + NSSize decodeSizeForKey (NSString key) + { + return invokeObjcSelf!(NSSize, "decodeSizeForKey:", NSString)(key); + } + + NSRect decodeRectForKey (NSString key) + { + return invokeObjcSelf!(NSRect, "decodeRectForKey:", NSString)(key); + } +`; class NSKeyedArchiver : NSCoder { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static NSData archivedDataWithRootObject (Object rootObject) { - return invokeObjcSelfClass!(NSData, "archivedDataWithRootObject:", Object)(rootObject); + return invokeObjcSuperClass!(NSData, "archivedDataWithRootObject:", Object)(rootObject); } static bool archiveRootObject (Object rootObject, NSString path) { - return invokeObjcSelfClass!(bool, "archiveRootObject:toFile:", Object, NSString)(rootObject, path); + return invokeObjcSuperClass!(bool, "archiveRootObject:toFile:", Object, NSString)(rootObject, path); } Object initForWritingWithMutableData (NSMutableData data) @@ -47,13 +203,7 @@ this (NSMutableData data) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initForWritingWithMutableData:", NSMutableData)(objcObject, data); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initForWritingWithMutableData(data); } void setDelegate (Object delegate_) @@ -83,7 +233,7 @@ static void setClassName (NSString codedName, Class cls) { - return invokeObjcSelfClass!(void, "setClassName:forClass:", NSString, Class)(codedName, cls); + return invokeObjcSuperClass!(void, "setClassName:forClass:", NSString, Class)(codedName, cls); } void setClassName (NSString codedName, Class cls) @@ -93,7 +243,7 @@ static NSString classNameForClass (Class cls) { - return invokeObjcSelfClass!(NSString, "classNameForClass:", Class)(cls); + return invokeObjcSuperClass!(NSString, "classNameForClass:", Class)(cls); } NSString classNameForClass (Class cls) @@ -149,16 +299,26 @@ class NSKeyedUnarchiver : NSCoder { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static Object unarchiveObjectWithData (NSData data) { - return invokeObjcSelfClass!(Object, "unarchiveObjectWithData:", NSData)(data); + return invokeObjcSuperClass!(Object, "unarchiveObjectWithData:", NSData)(data); } static Object unarchiveObjectWithFile (NSString path) { - return invokeObjcSelfClass!(Object, "unarchiveObjectWithFile:", NSString)(path); + return invokeObjcSuperClass!(Object, "unarchiveObjectWithFile:", NSString)(path); } Object initForReadingWithData (NSData data) @@ -168,13 +328,7 @@ this (NSData data) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initForReadingWithData:", NSData)(objcObject, data); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initForReadingWithData(data); } void setDelegate (Object delegate_) @@ -194,7 +348,7 @@ static void setClass (Class cls, NSString codedName) { - return invokeObjcSelfClass!(void, "setClass:forClassName:", Class, NSString)(cls, codedName); + return invokeObjcSuperClass!(void, "setClass:forClassName:", Class, NSString)(cls, codedName); } void setClass (Class cls, NSString codedName) @@ -204,7 +358,7 @@ static Class classForClassName (NSString codedName) { - return invokeObjcSelfClass!(Class, "classForClassName:", NSString)(codedName); + return invokeObjcSuperClass!(Class, "classForClassName:", NSString)(codedName); } Class classForClassName (NSString codedName) @@ -256,68 +410,4 @@ { return invokeObjcSelf!(char*, "decodeBytesForKey:returnedLength:", NSString, NSUInteger*)(key, lengthp); } -} - -template TNSKeyedArchiverObjectSubstitution () -{ - Class classForKeyedArchiver (); - Object replacementObjectForKeyedArchiver (NSKeyedArchiver archiver); - static NSArray classFallbacksForKeyedArchiver (); -} - -template TNSKeyedUnarchiverObjectSubstitution () -{ - static Class classForKeyedUnarchiver (); -} - -template TNSKeyedUnarchiverDelegate () -{ - Class unarchiver (NSKeyedUnarchiver unarchiver, NSString name, NSArray classNames); - Object unarchiver (NSKeyedUnarchiver unarchiver, Object object); - void unarchiver (NSKeyedUnarchiver unarchiver, Object object, Object newObject); - void unarchiverWillFinish (NSKeyedUnarchiver unarchiver); - void unarchiverDidFinish (NSKeyedUnarchiver unarchiver); -} - -template TNSKeyedArchiverDelegate () -{ - Object archiver (NSKeyedArchiver archiver, Object object); - void archiver (NSKeyedArchiver archiver, Object object); - void archiver (NSKeyedArchiver archiver, Object object, Object newObject); - void archiverWillFinish (NSKeyedArchiver archiver); - void archiverDidFinish (NSKeyedArchiver archiver); -} - -template TNSGeometryKeyedCoding () -{ - void encodePoint (NSPoint point, NSString key) - { - return invokeObjcSelf!(void, "encodePoint:forKey:", NSPoint, NSString)(point, key); - } - - void encodeSize (NSSize size, NSString key) - { - return invokeObjcSelf!(void, "encodeSize:forKey:", NSSize, NSString)(size, key); - } - - void encodeRect (NSRect rect, NSString key) - { - return invokeObjcSelf!(void, "encodeRect:forKey:", NSRect, NSString)(rect, key); - } - - NSPoint decodePointForKey (NSString key) - { - return invokeObjcSelf!(NSPoint, "decodePointForKey:", NSString)(key); - } - - NSSize decodeSizeForKey (NSString key) - { - return invokeObjcSelf!(NSSize, "decodeSizeForKey:", NSString)(key); - } - - NSRect decodeRectForKey (NSString key) - { - return invokeObjcSelf!(NSRect, "decodeRectForKey:", NSString)(key); - } -} - +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSKeyedArchiver_bindings.d --- a/dstep/foundation/NSKeyedArchiver_bindings.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSKeyedArchiver_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -1,13 +1,8 @@ module dstep.foundation.NSKeyedArchiver_bindings; -import dstep.foundation.NSArray; -import dstep.foundation.NSCoder; -import dstep.foundation.NSData; -import dstep.foundation.NSGeometry; -import dstep.foundation.NSMutableData; -import dstep.foundation.NSPropertyList; -import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + extern (C) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSLocale.d --- a/dstep/foundation/NSLocale.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSLocale.d Sun Jan 03 22:06:11 2010 +0100 @@ -7,69 +7,317 @@ module dstep.foundation.NSLocale; import dstep.foundation.NSArray; +import dstep.foundation.NSCoder; import dstep.foundation.NSDictionary; import dstep.foundation.NSObject; import dstep.foundation.NSString; +import dstep.foundation.NSZone; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + import bindings = dstep.foundation.NSLocale_bindings; -const NSString NSCurrentLocaleDidChangeNotification; -const NSString NSLocaleIdentifier; -const NSString NSLocaleLanguageCode; -const NSString NSLocaleCountryCode; -const NSString NSLocaleScriptCode; -const NSString NSLocaleVariantCode; -const NSString NSLocaleExemplarCharacterSet; -const NSString NSLocaleCalendar; -const NSString NSLocaleCollationIdentifier; -const NSString NSLocaleUsesMetricSystem; -const NSString NSLocaleMeasurementSystem; -const NSString NSLocaleDecimalSeparator; -const NSString NSLocaleGroupingSeparator; -const NSString NSLocaleCurrencySymbol; -const NSString NSLocaleCurrencyCode; -const NSString NSGregorianCalendar; -const NSString NSBuddhistCalendar; -const NSString NSChineseCalendar; -const NSString NSHebrewCalendar; -const NSString NSIslamicCalendar; -const NSString NSIslamicCivilCalendar; -const NSString NSJapaneseCalendar; +private +{ + NSString NSCurrentLocaleDidChangeNotification_; + NSString NSLocaleIdentifier_; + NSString NSLocaleLanguageCode_; + NSString NSLocaleCountryCode_; + NSString NSLocaleScriptCode_; + NSString NSLocaleVariantCode_; + NSString NSLocaleExemplarCharacterSet_; + NSString NSLocaleCalendar_; + NSString NSLocaleCollationIdentifier_; + NSString NSLocaleUsesMetricSystem_; + NSString NSLocaleMeasurementSystem_; + NSString NSLocaleDecimalSeparator_; + NSString NSLocaleGroupingSeparator_; + NSString NSLocaleCurrencySymbol_; + NSString NSLocaleCurrencyCode_; + NSString NSGregorianCalendar_; + NSString NSBuddhistCalendar_; + NSString NSChineseCalendar_; + NSString NSHebrewCalendar_; + NSString NSIslamicCalendar_; + NSString NSIslamicCivilCalendar_; + NSString NSJapaneseCalendar_; +} + +NSString NSCurrentLocaleDidChangeNotification () +{ + if (NSCurrentLocaleDidChangeNotification_) + return NSCurrentLocaleDidChangeNotification_; + + return NSCurrentLocaleDidChangeNotification_ = new NSString(bindings.NSCurrentLocaleDidChangeNotification); +} + +NSString NSLocaleIdentifier () +{ + if (NSLocaleIdentifier_) + return NSLocaleIdentifier_; + + return NSLocaleIdentifier_ = new NSString(bindings.NSLocaleIdentifier); +} + +NSString NSLocaleLanguageCode () +{ + if (NSLocaleLanguageCode_) + return NSLocaleLanguageCode_; + + return NSLocaleLanguageCode_ = new NSString(bindings.NSLocaleLanguageCode); +} + +NSString NSLocaleCountryCode () +{ + if (NSLocaleCountryCode_) + return NSLocaleCountryCode_; + + return NSLocaleCountryCode_ = new NSString(bindings.NSLocaleCountryCode); +} + +NSString NSLocaleScriptCode () +{ + if (NSLocaleScriptCode_) + return NSLocaleScriptCode_; + + return NSLocaleScriptCode_ = new NSString(bindings.NSLocaleScriptCode); +} + +NSString NSLocaleVariantCode () +{ + if (NSLocaleVariantCode_) + return NSLocaleVariantCode_; + + return NSLocaleVariantCode_ = new NSString(bindings.NSLocaleVariantCode); +} + +NSString NSLocaleExemplarCharacterSet () +{ + if (NSLocaleExemplarCharacterSet_) + return NSLocaleExemplarCharacterSet_; + + return NSLocaleExemplarCharacterSet_ = new NSString(bindings.NSLocaleExemplarCharacterSet); +} + +NSString NSLocaleCalendar () +{ + if (NSLocaleCalendar_) + return NSLocaleCalendar_; + + return NSLocaleCalendar_ = new NSString(bindings.NSLocaleCalendar); +} + +NSString NSLocaleCollationIdentifier () +{ + if (NSLocaleCollationIdentifier_) + return NSLocaleCollationIdentifier_; + + return NSLocaleCollationIdentifier_ = new NSString(bindings.NSLocaleCollationIdentifier); +} + +NSString NSLocaleUsesMetricSystem () +{ + if (NSLocaleUsesMetricSystem_) + return NSLocaleUsesMetricSystem_; + + return NSLocaleUsesMetricSystem_ = new NSString(bindings.NSLocaleUsesMetricSystem); +} + +NSString NSLocaleMeasurementSystem () +{ + if (NSLocaleMeasurementSystem_) + return NSLocaleMeasurementSystem_; + + return NSLocaleMeasurementSystem_ = new NSString(bindings.NSLocaleMeasurementSystem); +} + +NSString NSLocaleDecimalSeparator () +{ + if (NSLocaleDecimalSeparator_) + return NSLocaleDecimalSeparator_; + + return NSLocaleDecimalSeparator_ = new NSString(bindings.NSLocaleDecimalSeparator); +} + +NSString NSLocaleGroupingSeparator () +{ + if (NSLocaleGroupingSeparator_) + return NSLocaleGroupingSeparator_; + + return NSLocaleGroupingSeparator_ = new NSString(bindings.NSLocaleGroupingSeparator); +} + +NSString NSLocaleCurrencySymbol () +{ + if (NSLocaleCurrencySymbol_) + return NSLocaleCurrencySymbol_; + + return NSLocaleCurrencySymbol_ = new NSString(bindings.NSLocaleCurrencySymbol); +} -static this () +NSString NSLocaleCurrencyCode () +{ + if (NSLocaleCurrencyCode_) + return NSLocaleCurrencyCode_; + + return NSLocaleCurrencyCode_ = new NSString(bindings.NSLocaleCurrencyCode); +} + +NSString NSGregorianCalendar () +{ + if (NSGregorianCalendar_) + return NSGregorianCalendar_; + + return NSGregorianCalendar_ = new NSString(bindings.NSGregorianCalendar); +} + +NSString NSBuddhistCalendar () +{ + if (NSBuddhistCalendar_) + return NSBuddhistCalendar_; + + return NSBuddhistCalendar_ = new NSString(bindings.NSBuddhistCalendar); +} + +NSString NSChineseCalendar () +{ + if (NSChineseCalendar_) + return NSChineseCalendar_; + + return NSChineseCalendar_ = new NSString(bindings.NSChineseCalendar); +} + +NSString NSHebrewCalendar () +{ + if (NSHebrewCalendar_) + return NSHebrewCalendar_; + + return NSHebrewCalendar_ = new NSString(bindings.NSHebrewCalendar); +} + +NSString NSIslamicCalendar () +{ + if (NSIslamicCalendar_) + return NSIslamicCalendar_; + + return NSIslamicCalendar_ = new NSString(bindings.NSIslamicCalendar); +} + +NSString NSIslamicCivilCalendar () +{ + if (NSIslamicCivilCalendar_) + return NSIslamicCivilCalendar_; + + return NSIslamicCivilCalendar_ = new NSString(bindings.NSIslamicCivilCalendar); +} + +NSString NSJapaneseCalendar () { - NSCurrentLocaleDidChangeNotification = new NSString(bindings.NSCurrentLocaleDidChangeNotification); - NSLocaleIdentifier = new NSString(bindings.NSLocaleIdentifier); - NSLocaleLanguageCode = new NSString(bindings.NSLocaleLanguageCode); - NSLocaleCountryCode = new NSString(bindings.NSLocaleCountryCode); - NSLocaleScriptCode = new NSString(bindings.NSLocaleScriptCode); - NSLocaleVariantCode = new NSString(bindings.NSLocaleVariantCode); - NSLocaleExemplarCharacterSet = new NSString(bindings.NSLocaleExemplarCharacterSet); - NSLocaleCalendar = new NSString(bindings.NSLocaleCalendar); - NSLocaleCollationIdentifier = new NSString(bindings.NSLocaleCollationIdentifier); - NSLocaleUsesMetricSystem = new NSString(bindings.NSLocaleUsesMetricSystem); - NSLocaleMeasurementSystem = new NSString(bindings.NSLocaleMeasurementSystem); - NSLocaleDecimalSeparator = new NSString(bindings.NSLocaleDecimalSeparator); - NSLocaleGroupingSeparator = new NSString(bindings.NSLocaleGroupingSeparator); - NSLocaleCurrencySymbol = new NSString(bindings.NSLocaleCurrencySymbol); - NSLocaleCurrencyCode = new NSString(bindings.NSLocaleCurrencyCode); - NSGregorianCalendar = new NSString(bindings.NSGregorianCalendar); - NSBuddhistCalendar = new NSString(bindings.NSBuddhistCalendar); - NSChineseCalendar = new NSString(bindings.NSChineseCalendar); - NSHebrewCalendar = new NSString(bindings.NSHebrewCalendar); - NSIslamicCalendar = new NSString(bindings.NSIslamicCalendar); - NSIslamicCivilCalendar = new NSString(bindings.NSIslamicCivilCalendar); - NSJapaneseCalendar = new NSString(bindings.NSJapaneseCalendar); + if (NSJapaneseCalendar_) + return NSJapaneseCalendar_; + + return NSJapaneseCalendar_ = new NSString(bindings.NSJapaneseCalendar); } +const TNSLocaleCreation = ` + + static Object systemLocale () + { + return invokeObjcSuperClass!(Object, "systemLocale"); + } + + static Object currentLocale () + { + return invokeObjcSuperClass!(Object, "currentLocale"); + } + + static Object autoupdatingCurrentLocale () + { + return invokeObjcSuperClass!(Object, "autoupdatingCurrentLocale"); + } + + Object initWithLocaleIdentifier (NSString string) + { + return invokeObjcSelf!(Object, "initWithLocaleIdentifier:", NSString)(string); + } + + this (NSString string) + { + typeof(this).alloc.initWithLocaleIdentifier(string); + } +`; + +const TNSLocaleGeneralInfo = ` + + static NSArray availableLocaleIdentifiers () + { + return invokeObjcSuperClass!(NSArray, "availableLocaleIdentifiers"); + } + + static NSArray ISOLanguageCodes () + { + return invokeObjcSuperClass!(NSArray, "ISOLanguageCodes"); + } + + static NSArray ISOCountryCodes () + { + return invokeObjcSuperClass!(NSArray, "ISOCountryCodes"); + } + + static NSArray ISOCurrencyCodes () + { + return invokeObjcSuperClass!(NSArray, "ISOCurrencyCodes"); + } + + static NSArray commonISOCurrencyCodes () + { + return invokeObjcSuperClass!(NSArray, "commonISOCurrencyCodes"); + } + + static NSArray preferredLanguages () + { + return invokeObjcSuperClass!(NSArray, "preferredLanguages"); + } + + static NSDictionary componentsFromLocaleIdentifier (NSString string) + { + return invokeObjcSuperClass!(NSDictionary, "componentsFromLocaleIdentifier:", NSString)(string); + } + + static NSString localeIdentifierFromComponents (NSDictionary dict) + { + return invokeObjcSuperClass!(NSString, "localeIdentifierFromComponents:", NSDictionary)(dict); + } + + static NSString canonicalLocaleIdentifierFromString (NSString string) + { + return invokeObjcSuperClass!(NSString, "canonicalLocaleIdentifierFromString:", NSString)(string); + } +`; + +const TNSExtendedLocale = ` + + NSString localeIdentifier () + { + return invokeObjcSelf!(NSString, "localeIdentifier"); + } +`; + class NSLocale : NSObject, INSCopying, INSCoding { - mixin ObjcWrap; - mixin TNSLocaleCreation; - mixin TNSLocaleGeneralInfo; - mixin TNSExtendedLocale; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } Object objectForKey (Object key) { @@ -98,103 +346,84 @@ this (NSCoder aDecoder) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithCoder(aDecoder); } -} - -template TNSLocaleCreation () -{ + + // TNSLocaleCreation static Object systemLocale () { - return invokeObjcSelfClass!(Object, "systemLocale"); + return invokeObjcSuperClass!(Object, "systemLocale"); } - + static Object currentLocale () { - return invokeObjcSelfClass!(Object, "currentLocale"); + return invokeObjcSuperClass!(Object, "currentLocale"); } - + static Object autoupdatingCurrentLocale () { - return invokeObjcSelfClass!(Object, "autoupdatingCurrentLocale"); + return invokeObjcSuperClass!(Object, "autoupdatingCurrentLocale"); } - + Object initWithLocaleIdentifier (NSString string) { return invokeObjcSelf!(Object, "initWithLocaleIdentifier:", NSString)(string); } - + this (NSString string) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithLocaleIdentifier:", NSString)(objcObject, string); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithLocaleIdentifier(string); } -} - -template TNSLocaleGeneralInfo () -{ + + // TNSLocaleGeneralInfo static NSArray availableLocaleIdentifiers () { - return invokeObjcSelfClass!(NSArray, "availableLocaleIdentifiers"); + return invokeObjcSuperClass!(NSArray, "availableLocaleIdentifiers"); } - + static NSArray ISOLanguageCodes () { - return invokeObjcSelfClass!(NSArray, "ISOLanguageCodes"); + return invokeObjcSuperClass!(NSArray, "ISOLanguageCodes"); } - + static NSArray ISOCountryCodes () { - return invokeObjcSelfClass!(NSArray, "ISOCountryCodes"); + return invokeObjcSuperClass!(NSArray, "ISOCountryCodes"); } - + static NSArray ISOCurrencyCodes () { - return invokeObjcSelfClass!(NSArray, "ISOCurrencyCodes"); + return invokeObjcSuperClass!(NSArray, "ISOCurrencyCodes"); } - + static NSArray commonISOCurrencyCodes () { - return invokeObjcSelfClass!(NSArray, "commonISOCurrencyCodes"); + return invokeObjcSuperClass!(NSArray, "commonISOCurrencyCodes"); } - + static NSArray preferredLanguages () { - return invokeObjcSelfClass!(NSArray, "preferredLanguages"); + return invokeObjcSuperClass!(NSArray, "preferredLanguages"); } - + static NSDictionary componentsFromLocaleIdentifier (NSString string) { - return invokeObjcSelfClass!(NSDictionary, "componentsFromLocaleIdentifier:", NSString)(string); + return invokeObjcSuperClass!(NSDictionary, "componentsFromLocaleIdentifier:", NSString)(string); } - + static NSString localeIdentifierFromComponents (NSDictionary dict) { - return invokeObjcSelfClass!(NSString, "localeIdentifierFromComponents:", NSDictionary)(dict); + return invokeObjcSuperClass!(NSString, "localeIdentifierFromComponents:", NSDictionary)(dict); } - + static NSString canonicalLocaleIdentifierFromString (NSString string) { - return invokeObjcSelfClass!(NSString, "canonicalLocaleIdentifierFromString:", NSString)(string); + return invokeObjcSuperClass!(NSString, "canonicalLocaleIdentifierFromString:", NSString)(string); } -} - -template TNSExtendedLocale () -{ + + // TNSExtendedLocale NSString localeIdentifier () { return invokeObjcSelf!(NSString, "localeIdentifier"); } -} - +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSLocale_bindings.d --- a/dstep/foundation/NSLocale_bindings.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSLocale_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -5,7 +5,9 @@ import dstep.foundation.NSObject; import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + extern (C) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSLock.d --- a/dstep/foundation/NSLock.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSLock.d Sun Jan 03 22:06:11 2010 +0100 @@ -7,13 +7,25 @@ module dstep.foundation.NSLock; import dstep.foundation.NSDate; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; +import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; class NSLock : NSObject, INSLocking { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } bool tryLock () { @@ -48,7 +60,17 @@ class NSCondition : NSObject, INSLocking { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } void wait () { @@ -93,7 +115,17 @@ class NSConditionLock : NSObject, INSLocking { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } Object initWithCondition (NSInteger condition) { @@ -102,13 +134,7 @@ this (NSInteger condition) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCondition:", NSInteger)(objcObject, condition); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithCondition(condition); } NSInteger condition () @@ -169,7 +195,17 @@ class NSRecursiveLock : NSObject, INSLocking { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } bool tryLock () { diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSMapTable.d --- a/dstep/foundation/NSMapTable.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSMapTable.d Sun Jan 03 22:06:11 2010 +0100 @@ -7,18 +7,21 @@ module dstep.foundation.NSMapTable; import dstep.foundation.NSArray; +import dstep.foundation.NSCoder; import dstep.foundation.NSDictionary; import dstep.foundation.NSEnumerator; import dstep.foundation.NSMapTable; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; import dstep.foundation.NSPointerFunctions; import dstep.foundation.NSString; +import dstep.foundation.NSZone; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; import bindings = dstep.foundation.NSMapTable_bindings; alias NSUInteger NSMapTableOptions; -alias {NSUInteger _pi; NSUInteger _si; void*_bs;} NSMapEnumerator; extern (C) { @@ -56,17 +59,35 @@ struct NSMapTableKeyCallBacks { - void* notAKeyMarker; + extern (C) uint function (id table, /*const*/ void*) hash; + extern (C) bool function (id table, /*const*/ void*, /*const*/ void*) isEqual; + extern (C) void function (id table, /*const*/ void*) retain; + extern (C) void function (id table, void*) release; + extern (C) id function (id table, /*const*/ void*) describe; + + /*const*/ void* notAKeyMarker; } - struct NSMapTableValueCallBacks { + extern (C) void function (id table, /*const*/ void*) retain; + extern (C) void function (id table, /*const*/ void*) release; + extern (C) id function (id table, /*const*/ void*) describe; } class NSMapTable : NSObject, INSCopying, INSCoding, INSFastEnumeration { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } Object initWithKeyOptions (uint keyOptions, uint valueOptions, NSUInteger initialCapacity) { @@ -75,13 +96,7 @@ this (uint keyOptions, uint valueOptions, NSUInteger initialCapacity) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithKeyOptions:valueOptions:capacity:", uint, uint, NSUInteger)(objcObject, keyOptions, valueOptions, initialCapacity); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithKeyOptions(keyOptions, valueOptions, initialCapacity); } Object initWithKeyPointerFunctions (NSPointerFunctions keyFunctions, NSPointerFunctions valueFunctions, NSUInteger initialCapacity) @@ -91,38 +106,32 @@ this (NSPointerFunctions keyFunctions, NSPointerFunctions valueFunctions, NSUInteger initialCapacity) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithKeyPointerFunctions:valuePointerFunctions:capacity:", NSPointerFunctions, NSPointerFunctions, NSUInteger)(objcObject, keyFunctions, valueFunctions, initialCapacity); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithKeyPointerFunctions(keyFunctions, valueFunctions, initialCapacity); } static Object mapTableWithKeyOptions (uint keyOptions, uint valueOptions) { - return invokeObjcSelfClass!(Object, "mapTableWithKeyOptions:valueOptions:", uint, uint)(keyOptions, valueOptions); + return invokeObjcSuperClass!(Object, "mapTableWithKeyOptions:valueOptions:", uint, uint)(keyOptions, valueOptions); } static Object mapTableWithStrongToStrongObjects () { - return invokeObjcSelfClass!(Object, "mapTableWithStrongToStrongObjects"); + return invokeObjcSuperClass!(Object, "mapTableWithStrongToStrongObjects"); } static Object mapTableWithWeakToStrongObjects () { - return invokeObjcSelfClass!(Object, "mapTableWithWeakToStrongObjects"); + return invokeObjcSuperClass!(Object, "mapTableWithWeakToStrongObjects"); } static Object mapTableWithStrongToWeakObjects () { - return invokeObjcSelfClass!(Object, "mapTableWithStrongToWeakObjects"); + return invokeObjcSuperClass!(Object, "mapTableWithStrongToWeakObjects"); } static Object mapTableWithWeakToWeakObjects () { - return invokeObjcSelfClass!(Object, "mapTableWithWeakToWeakObjects"); + return invokeObjcSuperClass!(Object, "mapTableWithWeakToWeakObjects"); } NSPointerFunctions keyPointerFunctions () @@ -192,13 +201,7 @@ this (NSCoder aDecoder) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithCoder(aDecoder); } NSUInteger countByEnumeratingWithState (NSFastEnumerationState* state, id* stackbuf, NSUInteger len) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSMapTable_bindings.d --- a/dstep/foundation/NSMapTable_bindings.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSMapTable_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -1,39 +1,28 @@ module dstep.foundation.NSMapTable_bindings; -import dstep.foundation.NSArray; -import dstep.foundation.NSDictionary; -import dstep.foundation.NSEnumerator; import dstep.foundation.NSMapTable; -import dstep.foundation.NSPointerFunctions; -import dstep.foundation.NSString; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSZone; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; - +import dstep.objc.objc; extern (C) { - extern - { - } -} - -extern (C) -{ - private void NSFreeMapTable (id table); - private void NSResetMapTable (id table); - private bool NSCompareMapTables (id table1, id table2); - private id NSCopyMapTableWithZone (id table, NSZone* zone); - private bool NSMapMember (id table, void* key, void** originalKey, void** value); - private void* NSMapGet (id table, void* key); - private void NSMapInsert (id table, void* key, void* value); - private void NSMapInsertKnownAbsent (id table, void* key, void* value); - private void* NSMapInsertIfAbsent (id table, void* key, void* value); - private void NSMapRemove (id table, void* key); - private NSMapEnumerator NSEnumerateMapTable (id table); - private NSUInteger NSCountMapTable (id table); - private id NSStringFromMapTable (id table); - private id NSAllMapTableKeys (id table); - private id NSAllMapTableValues (id table); - private id NSCreateMapTableWithZone (NSMapTableKeyCallBacks keyCallBacks, NSMapTableValueCallBacks valueCallBacks, NSUInteger capacity, NSZone* zone); - private id NSCreateMapTable (NSMapTableKeyCallBacks keyCallBacks, NSMapTableValueCallBacks valueCallBacks, NSUInteger capacity); + package void NSFreeMapTable (id table); + package void NSResetMapTable (id table); + package bool NSCompareMapTables (id table1, id table2); + package id NSCopyMapTableWithZone (id table, NSZone* zone); + package bool NSMapMember (id table, void* key, void** originalKey, void** value); + package void* NSMapGet (id table, void* key); + package void NSMapInsert (id table, void* key, void* value); + package void NSMapInsertKnownAbsent (id table, void* key, void* value); + package void* NSMapInsertIfAbsent (id table, void* key, void* value); + package void NSMapRemove (id table, void* key); + package NSMapEnumerator NSEnumerateMapTable (id table); + package NSUInteger NSCountMapTable (id table); + package id NSStringFromMapTable (id table); + package id NSAllMapTableKeys (id table); + package id NSAllMapTableValues (id table); + package id NSCreateMapTableWithZone (NSMapTableKeyCallBacks keyCallBacks, NSMapTableValueCallBacks valueCallBacks, NSUInteger capacity, NSZone* zone); + package id NSCreateMapTable (NSMapTableKeyCallBacks keyCallBacks, NSMapTableValueCallBacks valueCallBacks, NSUInteger capacity); } \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSMetadata.d --- a/dstep/foundation/NSMetadata.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSMetadata.d Sun Jan 03 22:06:11 2010 +0100 @@ -9,41 +9,122 @@ import dstep.foundation.NSArray; import dstep.foundation.NSDate; import dstep.foundation.NSDictionary; -import dstep.foundation.NSMetadataItem; -import dstep.foundation.NSMetadataQueryAttributeValueTuple; -import dstep.foundation.NSMetadataQueryResultGroup; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; import dstep.foundation.NSPredicate; import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + import bindings = dstep.foundation.NSMetadata_bindings; -const NSString NSMetadataQueryDidStartGatheringNotification; -const NSString NSMetadataQueryGatheringProgressNotification; -const NSString NSMetadataQueryDidFinishGatheringNotification; -const NSString NSMetadataQueryDidUpdateNotification; -const NSString NSMetadataQueryResultContentRelevanceAttribute; -const NSString NSMetadataQueryUserHomeScope; -const NSString NSMetadataQueryLocalComputerScope; -const NSString NSMetadataQueryNetworkScope; +private +{ + NSString NSMetadataQueryDidStartGatheringNotification_; + NSString NSMetadataQueryGatheringProgressNotification_; + NSString NSMetadataQueryDidFinishGatheringNotification_; + NSString NSMetadataQueryDidUpdateNotification_; + NSString NSMetadataQueryResultContentRelevanceAttribute_; + NSString NSMetadataQueryUserHomeScope_; + NSString NSMetadataQueryLocalComputerScope_; + NSString NSMetadataQueryNetworkScope_; +} + +NSString NSMetadataQueryDidStartGatheringNotification () +{ + if (NSMetadataQueryDidStartGatheringNotification_) + return NSMetadataQueryDidStartGatheringNotification_; + + return NSMetadataQueryDidStartGatheringNotification_ = new NSString(bindings.NSMetadataQueryDidStartGatheringNotification); +} + +NSString NSMetadataQueryGatheringProgressNotification () +{ + if (NSMetadataQueryGatheringProgressNotification_) + return NSMetadataQueryGatheringProgressNotification_; + + return NSMetadataQueryGatheringProgressNotification_ = new NSString(bindings.NSMetadataQueryGatheringProgressNotification); +} + +NSString NSMetadataQueryDidFinishGatheringNotification () +{ + if (NSMetadataQueryDidFinishGatheringNotification_) + return NSMetadataQueryDidFinishGatheringNotification_; + + return NSMetadataQueryDidFinishGatheringNotification_ = new NSString(bindings.NSMetadataQueryDidFinishGatheringNotification); +} + +NSString NSMetadataQueryDidUpdateNotification () +{ + if (NSMetadataQueryDidUpdateNotification_) + return NSMetadataQueryDidUpdateNotification_; + + return NSMetadataQueryDidUpdateNotification_ = new NSString(bindings.NSMetadataQueryDidUpdateNotification); +} -static this () +NSString NSMetadataQueryResultContentRelevanceAttribute () +{ + if (NSMetadataQueryResultContentRelevanceAttribute_) + return NSMetadataQueryResultContentRelevanceAttribute_; + + return NSMetadataQueryResultContentRelevanceAttribute_ = new NSString(bindings.NSMetadataQueryResultContentRelevanceAttribute); +} + +NSString NSMetadataQueryUserHomeScope () +{ + if (NSMetadataQueryUserHomeScope_) + return NSMetadataQueryUserHomeScope_; + + return NSMetadataQueryUserHomeScope_ = new NSString(bindings.NSMetadataQueryUserHomeScope); +} + +NSString NSMetadataQueryLocalComputerScope () { - NSMetadataQueryDidStartGatheringNotification = new NSString(bindings.NSMetadataQueryDidStartGatheringNotification); - NSMetadataQueryGatheringProgressNotification = new NSString(bindings.NSMetadataQueryGatheringProgressNotification); - NSMetadataQueryDidFinishGatheringNotification = new NSString(bindings.NSMetadataQueryDidFinishGatheringNotification); - NSMetadataQueryDidUpdateNotification = new NSString(bindings.NSMetadataQueryDidUpdateNotification); - NSMetadataQueryResultContentRelevanceAttribute = new NSString(bindings.NSMetadataQueryResultContentRelevanceAttribute); - NSMetadataQueryUserHomeScope = new NSString(bindings.NSMetadataQueryUserHomeScope); - NSMetadataQueryLocalComputerScope = new NSString(bindings.NSMetadataQueryLocalComputerScope); - NSMetadataQueryNetworkScope = new NSString(bindings.NSMetadataQueryNetworkScope); + if (NSMetadataQueryLocalComputerScope_) + return NSMetadataQueryLocalComputerScope_; + + return NSMetadataQueryLocalComputerScope_ = new NSString(bindings.NSMetadataQueryLocalComputerScope); +} + +NSString NSMetadataQueryNetworkScope () +{ + if (NSMetadataQueryNetworkScope_) + return NSMetadataQueryNetworkScope_; + + return NSMetadataQueryNetworkScope_ = new NSString(bindings.NSMetadataQueryNetworkScope); } +const TNSMetadataQueryDelegate = ` + + Object metadataQuery (NSMetadataQuery query, NSMetadataItem result) + { + return invokeObjcSelf!(Object, "metadataQuery:replacementObjectForResultObject:", NSMetadataQuery, NSMetadataItem)(query, result); + } + + Object metadataQuery (NSMetadataQuery query, NSString attrName, Object attrValue) + { + return invokeObjcSelf!(Object, "metadataQuery:replacementValueForAttribute:value:", NSMetadataQuery, NSString, Object)(query, attrName, attrValue); + } + + //mixin ObjcBindMethod!(metadataQuery, "metadataQuery:replacementObjectForResultObject:"); + //mixin ObjcBindMethod!(metadataQuery, "metadataQuery:replacementValueForAttribute:value:"); +`; + class NSMetadataQueryResultGroup : NSObject { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } NSString attribute () { @@ -78,7 +159,17 @@ class NSMetadataItem : NSObject { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } Object valueForAttribute (NSString key) { @@ -98,22 +189,16 @@ class NSMetadataQuery : NSObject { - mixin ObjcWrap; - - Object init () - { - return invokeObjcSelf!(Object, "init"); - } - + mixin (ObjcWrap); + this () { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "init")(objcObject); - - if (result) - objcObject = ret; - - dObject = this; + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); } Object delegate_ () @@ -259,7 +344,17 @@ class NSMetadataQueryAttributeValueTuple : NSObject { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } NSString attribute () { @@ -275,11 +370,4 @@ { return invokeObjcSelf!(NSUInteger, "count"); } -} - -template TNSMetadataQueryDelegate () -{ - Object metadataQuery (NSMetadataQuery query, NSMetadataItem result); - Object metadataQuery (NSMetadataQuery query, NSString attrName, Object attrValue); -} - +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSMetadata_bindings.d --- a/dstep/foundation/NSMetadata_bindings.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSMetadata_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -1,16 +1,8 @@ module dstep.foundation.NSMetadata_bindings; -import dstep.foundation.NSArray; -import dstep.foundation.NSDate; -import dstep.foundation.NSDictionary; -import dstep.foundation.NSMetadataItem; -import dstep.foundation.NSMetadataQueryAttributeValueTuple; -import dstep.foundation.NSMetadataQueryResultGroup; -import dstep.foundation.NSObject; -import dstep.foundation.NSPredicate; -import dstep.foundation.NSString; -import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + extern (C) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSMethodSignature.d --- a/dstep/foundation/NSMethodSignature.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSMethodSignature.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,17 +6,28 @@ */ module dstep.foundation.NSMethodSignature; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; class NSMethodSignature : NSObject { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static NSMethodSignature signatureWithObjCTypes (char* types) { - return invokeObjcSelfClass!(NSMethodSignature, "signatureWithObjCTypes:", char*)(types); + return invokeObjcSuperClass!(NSMethodSignature, "signatureWithObjCTypes:", char*)(types); } NSUInteger numberOfArguments () diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSNetServices.d --- a/dstep/foundation/NSNetServices.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSNetServices.d Sun Jan 03 22:06:11 2010 +0100 @@ -10,21 +10,42 @@ import dstep.foundation.NSData; import dstep.foundation.NSDate; import dstep.foundation.NSDictionary; -import dstep.foundation.NSInputStream; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; -import dstep.foundation.NSOutputStream; import dstep.foundation.NSRunLoop; +import dstep.foundation.NSStream; import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + import bindings = dstep.foundation.NSNetServices_bindings; alias NSInteger NSNetServicesError; alias NSUInteger NSNetServiceOptions; -const NSString NSNetServicesErrorCode; -const NSString NSNetServicesErrorDomain; +private +{ + NSString NSNetServicesErrorCode_; + NSString NSNetServicesErrorDomain_; +} + +NSString NSNetServicesErrorCode () +{ + if (NSNetServicesErrorCode_) + return NSNetServicesErrorCode_; + + return NSNetServicesErrorCode_ = new NSString(bindings.NSNetServicesErrorCode); +} + +NSString NSNetServicesErrorDomain () +{ + if (NSNetServicesErrorDomain_) + return NSNetServicesErrorDomain_; + + return NSNetServicesErrorDomain_ = new NSString(bindings.NSNetServicesErrorDomain); +} enum { @@ -43,15 +64,125 @@ NSNetServiceNoAutoRename = 1 << 0 } -static this () -{ - NSNetServicesErrorCode = new NSString(bindings.NSNetServicesErrorCode); - NSNetServicesErrorDomain = new NSString(bindings.NSNetServicesErrorDomain); -} +const TNSDeprecated = ` + + void searchForAllDomains () + { + return invokeObjcSelf!(void, "searchForAllDomains"); + } +`; + +const TNSNetServiceDelegateMethods = ` + + void netServiceWillPublish (NSNetService sender) + { + return invokeObjcSelf!(void, "netServiceWillPublish:", NSNetService)(sender); + } + + void netServiceDidPublish (NSNetService sender) + { + return invokeObjcSelf!(void, "netServiceDidPublish:", NSNetService)(sender); + } + + void netService (NSNetService sender, NSDictionary errorDict) + { + return invokeObjcSelf!(void, "netService:didNotPublish:", NSNetService, NSDictionary)(sender, errorDict); + } + + void netServiceWillResolve (NSNetService sender) + { + return invokeObjcSelf!(void, "netServiceWillResolve:", NSNetService)(sender); + } + + void netServiceDidResolveAddress (NSNetService sender) + { + return invokeObjcSelf!(void, "netServiceDidResolveAddress:", NSNetService)(sender); + } + + void netService_didNotPublish (NSNetService sender, NSDictionary errorDict) + { + return invokeObjcSelf!(void, "netService:didNotPublish:", NSNetService, NSDictionary)(sender, errorDict); + } + + void netServiceDidStop (NSNetService sender) + { + return invokeObjcSelf!(void, "netServiceDidStop:", NSNetService)(sender); + } + + void netService (NSNetService sender, NSData data) + { + return invokeObjcSelf!(void, "netService:didUpdateTXTRecordData:", NSNetService, NSData)(sender, data); + } + + //mixin ObjcBindMethod!(netServiceWillPublish, "netServiceWillPublish:"); + //mixin ObjcBindMethod!(netServiceDidPublish, "netServiceDidPublish:"); + //mixin ObjcBindMethod!(netService, "netService:didNotPublish:"); + //mixin ObjcBindMethod!(netServiceWillResolve, "netServiceWillResolve:"); + //mixin ObjcBindMethod!(netServiceDidResolveAddress, "netServiceDidResolveAddress:"); + //mixin ObjcBindMethod!(netService_didNotPublish, "netService:didNotPublish:"); + //mixin ObjcBindMethod!(netServiceDidStop, "netServiceDidStop:"); + //mixin ObjcBindMethod!(netService, "netService:didUpdateTXTRecordData:"); +`; + +const TNSNetServiceBrowserDelegateMethods = ` + + void netServiceBrowserWillSearch (NSNetServiceBrowser aNetServiceBrowser) + { + return invokeObjcSelf!(void, "netServiceBrowserWillSearch:", NSNetServiceBrowser)(aNetServiceBrowser); + } + + void netServiceBrowserDidStopSearch (NSNetServiceBrowser aNetServiceBrowser) + { + return invokeObjcSelf!(void, "netServiceBrowserDidStopSearch:", NSNetServiceBrowser)(aNetServiceBrowser); + } + + void netServiceBrowser (NSNetServiceBrowser aNetServiceBrowser, NSDictionary errorDict) + { + return invokeObjcSelf!(void, "netServiceBrowser:didNotSearch:", NSNetServiceBrowser, NSDictionary)(aNetServiceBrowser, errorDict); + } + + void netServiceBrowser (NSNetServiceBrowser aNetServiceBrowser, NSString domainString, bool moreComing) + { + return invokeObjcSelf!(void, "netServiceBrowser:didFindDomain:moreComing:", NSNetServiceBrowser, NSString, bool)(aNetServiceBrowser, domainString, moreComing); + } + + void netServiceBrowser (NSNetServiceBrowser aNetServiceBrowser, NSNetService aNetService, bool moreComing) + { + return invokeObjcSelf!(void, "netServiceBrowser:didFindService:moreComing:", NSNetServiceBrowser, NSNetService, bool)(aNetServiceBrowser, aNetService, moreComing); + } + + void netServiceBrowser (NSNetServiceBrowser aNetServiceBrowser, NSString domainString, bool moreComing) + { + return invokeObjcSelf!(void, "netServiceBrowser:didRemoveDomain:moreComing:", NSNetServiceBrowser, NSString, bool)(aNetServiceBrowser, domainString, moreComing); + } + + void netServiceBrowser (NSNetServiceBrowser aNetServiceBrowser, NSNetService aNetService, bool moreComing) + { + return invokeObjcSelf!(void, "netServiceBrowser:didRemoveService:moreComing:", NSNetServiceBrowser, NSNetService, bool)(aNetServiceBrowser, aNetService, moreComing); + } + + //mixin ObjcBindMethod!(netServiceBrowserWillSearch, "netServiceBrowserWillSearch:"); + //mixin ObjcBindMethod!(netServiceBrowserDidStopSearch, "netServiceBrowserDidStopSearch:"); + //mixin ObjcBindMethod!(netServiceBrowser, "netServiceBrowser:didNotSearch:"); + //mixin ObjcBindMethod!(netServiceBrowser, "netServiceBrowser:didFindDomain:moreComing:"); + //mixin ObjcBindMethod!(netServiceBrowser, "netServiceBrowser:didFindService:moreComing:"); + //mixin ObjcBindMethod!(netServiceBrowser, "netServiceBrowser:didRemoveDomain:moreComing:"); + //mixin ObjcBindMethod!(netServiceBrowser, "netServiceBrowser:didRemoveService:moreComing:"); +`; class NSNetService : NSObject { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } Object initWithDomain (NSString domain, NSString type, NSString name, int port) { @@ -60,13 +191,7 @@ this (NSString domain, NSString type, NSString name, int port) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithDomain:type:name:port:", NSString, NSString, NSString, int)(objcObject, domain, type, name, port); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithDomain(domain, type, name, port); } Object initWithDomain (NSString domain, NSString type, NSString name) @@ -76,13 +201,7 @@ this (NSString domain, NSString type, NSString name) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithDomain:type:name:", NSString, NSString, NSString)(objcObject, domain, type, name); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithDomain(domain, type, name); } Object delegate_ () @@ -152,12 +271,12 @@ static NSDictionary dictionaryFromTXTRecordData (NSData txtData) { - return invokeObjcSelfClass!(NSDictionary, "dictionaryFromTXTRecordData:", NSData)(txtData); + return invokeObjcSuperClass!(NSDictionary, "dictionaryFromTXTRecordData:", NSData)(txtData); } static NSData dataFromTXTRecordDictionary (NSDictionary txtDictionary) { - return invokeObjcSelfClass!(NSData, "dataFromTXTRecordDictionary:", NSDictionary)(txtDictionary); + return invokeObjcSuperClass!(NSData, "dataFromTXTRecordDictionary:", NSDictionary)(txtDictionary); } NSString hostName () @@ -170,9 +289,20 @@ return invokeObjcSelf!(void, "resolveWithTimeout:", double)(timeout); } - bool getInputStream (NSInputStream** inputStream, NSOutputStream** outputStream) + bool getInputStream (out NSInputStream inputStream, out NSOutputStream outputStream) { - return invokeObjcSelf!(bool, "getInputStream:outputStream:", NSInputStream**, NSOutputStream**)(inputStream, outputStream); + id input; + id output; + + bool result = invokeObjcSelf!(bool, "getInputStream:outputStream:", id*, id*)(&input, &output); + + if (input) + inputStream = new NSInputStream(input); + + if (output) + outputStream = new NSOutputStream(output); + + return result; } bool setTXTRecordData (NSData recordData) @@ -198,23 +328,16 @@ class NSNetServiceBrowser : NSObject { - mixin ObjcWrap; - mixin TNSDeprecated; - - Object init () - { - return invokeObjcSelf!(Object, "init"); - } - + mixin (ObjcWrap); + this () { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "init")(objcObject); - - if (result) - objcObject = ret; - - dObject = this; + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); } Object delegate_ () @@ -256,36 +379,10 @@ { return invokeObjcSelf!(void, "stop"); } -} - -template TNSDeprecated () -{ + + // TNSDeprecated void searchForAllDomains () { return invokeObjcSelf!(void, "searchForAllDomains"); } -} - -template TNSNetServiceDelegateMethods () -{ - void netServiceWillPublish (NSNetService sender); - void netServiceDidPublish (NSNetService sender); - void netService (NSNetService sender, NSDictionary errorDict); - void netServiceWillResolve (NSNetService sender); - void netServiceDidResolveAddress (NSNetService sender); - void netService (NSNetService sender, NSDictionary errorDict); - void netServiceDidStop (NSNetService sender); - void netService (NSNetService sender, NSData data); -} - -template TNSNetServiceBrowserDelegateMethods () -{ - void netServiceBrowserWillSearch (NSNetServiceBrowser aNetServiceBrowser); - void netServiceBrowserDidStopSearch (NSNetServiceBrowser aNetServiceBrowser); - void netServiceBrowser (NSNetServiceBrowser aNetServiceBrowser, NSDictionary errorDict); - void netServiceBrowser (NSNetServiceBrowser aNetServiceBrowser, NSString domainString, bool moreComing); - void netServiceBrowser (NSNetServiceBrowser aNetServiceBrowser, NSNetService aNetService, bool moreComing); - void netServiceBrowser (NSNetServiceBrowser aNetServiceBrowser, NSString domainString, bool moreComing); - void netServiceBrowser (NSNetServiceBrowser aNetServiceBrowser, NSNetService aNetService, bool moreComing); -} - +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSNetServices_bindings.d --- a/dstep/foundation/NSNetServices_bindings.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSNetServices_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -1,16 +1,9 @@ module dstep.foundation.NSNetServices_bindings; -import dstep.foundation.NSArray; -import dstep.foundation.NSData; -import dstep.foundation.NSDate; -import dstep.foundation.NSDictionary; -import dstep.foundation.NSInputStream; -import dstep.foundation.NSObject; -import dstep.foundation.NSOutputStream; -import dstep.foundation.NSRunLoop; -import dstep.foundation.NSString; -import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; + +import dstep.objc.objc; + + extern (C) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSNotification.d --- a/dstep/foundation/NSNotification.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSNotification.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,16 +6,40 @@ */ module dstep.foundation.NSNotification; +import dstep.foundation.NSCoder; import dstep.foundation.NSDictionary; import dstep.foundation.NSObject; import dstep.foundation.NSString; +import dstep.foundation.NSZone; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + +const TNSNotificationCreation = ` + + static Object notificationWithName (NSString aName, Object anObject) + { + return invokeObjcSuperClass!(Object, "notificationWithName:object:", NSString, Object)(aName, anObject); + } + + static Object notificationWithName (NSString aName, Object anObject, NSDictionary aUserInfo) + { + return invokeObjcSuperClass!(Object, "notificationWithName:object:userInfo:", NSString, Object, NSDictionary)(aName, anObject, aUserInfo); + } +`; class NSNotification : NSObject, INSCopying, INSCoding { - mixin ObjcWrap; - mixin TNSNotificationCreation; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } NSString name () { @@ -49,23 +73,38 @@ this (NSCoder aDecoder) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithCoder(aDecoder); + } + + // TNSNotificationCreation + static Object notificationWithName (NSString aName, Object anObject) + { + return invokeObjcSuperClass!(Object, "notificationWithName:object:", NSString, Object)(aName, anObject); + } + + static Object notificationWithName (NSString aName, Object anObject, NSDictionary aUserInfo) + { + return invokeObjcSuperClass!(Object, "notificationWithName:object:userInfo:", NSString, Object, NSDictionary)(aName, anObject, aUserInfo); } } class NSNotificationCenter : NSObject { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static Object defaultCenter () { - return invokeObjcSelfClass!(Object, "defaultCenter"); + return invokeObjcSuperClass!(Object, "defaultCenter"); } void addObserver (Object observer, SEL aSelector, NSString aName, Object anObject) @@ -97,18 +136,4 @@ { return invokeObjcSelf!(void, "removeObserver:name:object:", Object, NSString, Object)(observer, aName, anObject); } -} - -template TNSNotificationCreation () -{ - static Object notificationWithName (NSString aName, Object anObject) - { - return invokeObjcSelfClass!(Object, "notificationWithName:object:", NSString, Object)(aName, anObject); - } - - static Object notificationWithName (NSString aName, Object anObject, NSDictionary aUserInfo) - { - return invokeObjcSelfClass!(Object, "notificationWithName:object:userInfo:", NSString, Object, NSDictionary)(aName, anObject, aUserInfo); - } -} - +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSNotificationQueue.d --- a/dstep/foundation/NSNotificationQueue.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSNotificationQueue.d Sun Jan 03 22:06:11 2010 +0100 @@ -8,10 +8,10 @@ import dstep.foundation.NSArray; import dstep.foundation.NSNotification; -import dstep.foundation.NSNotificationCenter; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; alias NSUInteger NSPostingStyle; alias NSUInteger NSNotificationCoalescing; @@ -32,11 +32,21 @@ class NSNotificationQueue : NSObject { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static Object defaultQueue () { - return invokeObjcSelfClass!(Object, "defaultQueue"); + return invokeObjcSuperClass!(Object, "defaultQueue"); } Object initWithNotificationCenter (NSNotificationCenter notificationCenter) @@ -46,13 +56,7 @@ this (NSNotificationCenter notificationCenter) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithNotificationCenter:", NSNotificationCenter)(objcObject, notificationCenter); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithNotificationCenter(notificationCenter); } void enqueueNotification (NSNotification notification, uint postingStyle) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSNull.d --- a/dstep/foundation/NSNull.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSNull.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,17 +6,29 @@ */ module dstep.foundation.NSNull; +import dstep.foundation.NSCoder; import dstep.foundation.NSObject; +import dstep.foundation.NSZone; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; class NSNull : NSObject, INSCopying, INSCoding { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static NSNull null_ () { - return invokeObjcSelfClass!(NSNull, "null"); + return invokeObjcSuperClass!(NSNull, "null"); } Object copyWithZone (NSZone* zone) @@ -36,13 +48,7 @@ this (NSCoder aDecoder) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithCoder(aDecoder); } } diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSNumberFormatter.d --- a/dstep/foundation/NSNumberFormatter.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSNumberFormatter.d Sun Jan 03 22:06:11 2010 +0100 @@ -7,13 +7,19 @@ module dstep.foundation.NSNumberFormatter; import dstep.corefoundation.CFNumberFormatter; -import dstep.foundation.NSDecimalNumberHandler; + +import dstep.foundation.NSAttributedString; +import dstep.foundation.NSDecimalNumber; +import dstep.foundation.NSDictionary; import dstep.foundation.NSError; import dstep.foundation.NSFormatter; import dstep.foundation.NSLocale; -import dstep.foundation.NSMutableDictionary; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSRange; +import dstep.foundation.NSString; +import dstep.foundation.NSValue; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; alias NSUInteger NSNumberFormatterStyle; alias NSUInteger NSNumberFormatterBehavior; @@ -56,30 +62,116 @@ NSNumberFormatterRoundHalfUp = kCFNumberFormatterRoundHalfUp } +const TNSNumberFormatterCompatibility = ` + + bool hasThousandSeparators () + { + return invokeObjcSelf!(bool, "hasThousandSeparators"); + } + + void setHasThousandSeparators (bool flag) + { + return invokeObjcSelf!(void, "setHasThousandSeparators:", bool)(flag); + } + + NSString thousandSeparator () + { + return invokeObjcSelf!(NSString, "thousandSeparator"); + } + + void setThousandSeparator (NSString newSeparator) + { + return invokeObjcSelf!(void, "setThousandSeparator:", NSString)(newSeparator); + } + + bool localizesFormat () + { + return invokeObjcSelf!(bool, "localizesFormat"); + } + + void setLocalizesFormat (bool flag) + { + return invokeObjcSelf!(void, "setLocalizesFormat:", bool)(flag); + } + + NSString format () + { + return invokeObjcSelf!(NSString, "format"); + } + + void setFormat (NSString string) + { + return invokeObjcSelf!(void, "setFormat:", NSString)(string); + } + + NSAttributedString attributedStringForZero () + { + return invokeObjcSelf!(NSAttributedString, "attributedStringForZero"); + } + + void setAttributedStringForZero (NSAttributedString newAttributedString) + { + return invokeObjcSelf!(void, "setAttributedStringForZero:", NSAttributedString)(newAttributedString); + } + + NSAttributedString attributedStringForNil () + { + return invokeObjcSelf!(NSAttributedString, "attributedStringForNil"); + } + + void setAttributedStringForNil (NSAttributedString newAttributedString) + { + return invokeObjcSelf!(void, "setAttributedStringForNil:", NSAttributedString)(newAttributedString); + } + + NSAttributedString attributedStringForNotANumber () + { + return invokeObjcSelf!(NSAttributedString, "attributedStringForNotANumber"); + } + + void setAttributedStringForNotANumber (NSAttributedString newAttributedString) + { + return invokeObjcSelf!(void, "setAttributedStringForNotANumber:", NSAttributedString)(newAttributedString); + } + + NSDecimalNumberHandler roundingBehavior () + { + return invokeObjcSelf!(NSDecimalNumberHandler, "roundingBehavior"); + } + + void setRoundingBehavior (NSDecimalNumberHandler newRoundingBehavior) + { + return invokeObjcSelf!(void, "setRoundingBehavior:", NSDecimalNumberHandler)(newRoundingBehavior); + } +`; + class NSNumberFormatter : NSFormatter { - mixin ObjcWrap; - mixin TNSNumberFormatterCompatibility; - - Object init () - { - return invokeObjcSelf!(Object, "init"); - } - + mixin (ObjcWrap); + this () { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "init")(objcObject); - - if (result) - objcObject = ret; - - dObject = this; + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); } - bool getObjectValue (id* obj, NSString string, NSRange* rangep, NSError** error) + bool getObjectValue (id* obj, NSString string, NSRange* rangep, ref NSError error) { - return invokeObjcSelf!(bool, "getObjectValue:forString:range:error:", id*, NSString, NSRange*, NSError**)(obj, string, rangep, error); + id err; + + if (error) + err = new objc_object; + + bool result = invokeObjcSelf!(bool, "getObjectValue:forString:range:error:", id*, NSString, NSRange*, id*)(obj, string, rangep, &err); + + if (err) + error = new NSError(err); + + return result; } NSString stringFromNumber (NSNumber number) @@ -134,12 +226,12 @@ static uint defaultFormatterBehavior () { - return invokeObjcSelfClass!(uint, "defaultFormatterBehavior"); + return invokeObjcSuperClass!(uint, "defaultFormatterBehavior"); } static void setDefaultFormatterBehavior (uint behavior) { - return invokeObjcSelfClass!(void, "setDefaultFormatterBehavior:", uint)(behavior); + return invokeObjcSuperClass!(void, "setDefaultFormatterBehavior:", uint)(behavior); } NSString negativeFormat () @@ -661,88 +753,85 @@ { return invokeObjcSelf!(void, "setPartialStringValidationEnabled:", bool)(b); } -} - -template TNSNumberFormatterCompatibility () -{ + + // TNSNumberFormatterCompatibility bool hasThousandSeparators () { return invokeObjcSelf!(bool, "hasThousandSeparators"); } - + void setHasThousandSeparators (bool flag) { return invokeObjcSelf!(void, "setHasThousandSeparators:", bool)(flag); } - + NSString thousandSeparator () { return invokeObjcSelf!(NSString, "thousandSeparator"); } - + void setThousandSeparator (NSString newSeparator) { return invokeObjcSelf!(void, "setThousandSeparator:", NSString)(newSeparator); } - + bool localizesFormat () { return invokeObjcSelf!(bool, "localizesFormat"); } - + void setLocalizesFormat (bool flag) { return invokeObjcSelf!(void, "setLocalizesFormat:", bool)(flag); } - + NSString format () { return invokeObjcSelf!(NSString, "format"); } - + void setFormat (NSString string) { return invokeObjcSelf!(void, "setFormat:", NSString)(string); } - + NSAttributedString attributedStringForZero () { return invokeObjcSelf!(NSAttributedString, "attributedStringForZero"); } - + void setAttributedStringForZero (NSAttributedString newAttributedString) { return invokeObjcSelf!(void, "setAttributedStringForZero:", NSAttributedString)(newAttributedString); } - + NSAttributedString attributedStringForNil () { return invokeObjcSelf!(NSAttributedString, "attributedStringForNil"); } - + void setAttributedStringForNil (NSAttributedString newAttributedString) { return invokeObjcSelf!(void, "setAttributedStringForNil:", NSAttributedString)(newAttributedString); } - + NSAttributedString attributedStringForNotANumber () { return invokeObjcSelf!(NSAttributedString, "attributedStringForNotANumber"); } - + void setAttributedStringForNotANumber (NSAttributedString newAttributedString) { return invokeObjcSelf!(void, "setAttributedStringForNotANumber:", NSAttributedString)(newAttributedString); } - + NSDecimalNumberHandler roundingBehavior () { return invokeObjcSelf!(NSDecimalNumberHandler, "roundingBehavior"); } - + void setRoundingBehavior (NSDecimalNumberHandler newRoundingBehavior) { return invokeObjcSelf!(void, "setRoundingBehavior:", NSDecimalNumberHandler)(newRoundingBehavior); } -} - +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSObjCRuntime.d --- a/dstep/foundation/NSObjCRuntime.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSObjCRuntime.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,20 +6,29 @@ */ module dstep.foundation.NSObjCRuntime; -import dstep.AvailabilityMacros; import dstep.foundation.NSString; -import dstep.foundation.Protocol; -import dstep.limits; +import dstep.foundation.NSZone; +import dstep.internal.Version; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; import dstep.objc.objc; -import dstep.stdarg; -import dstep.stdint; + + +import dstep.objc.runtime; import bindings = dstep.foundation.NSObjCRuntime_bindings; -alias int NSInteger; -alias uint NSUInteger; +version (D_LP64) +{ + alias long NSInteger; + alias ulong NSUInteger; +} + +else +{ + alias int NSInteger; + alias uint NSUInteger; +} + alias NSInteger NSComparisonResult; extern (C) @@ -62,19 +71,19 @@ return Bridge.invokeObjcFunction!(Class, bindings.NSClassFromString, NSString)(aClassName); } -NSString NSStringFromProtocol (Protocol proto) +NSString NSStringFromProtocol (Protocol* proto) { - return Bridge.invokeObjcFunction!(NSString, bindings.NSStringFromProtocol, Protocol)(proto); + return Bridge.invokeObjcFunction!(NSString, bindings.NSStringFromProtocol, Protocol*)(proto); } -Protocol NSProtocolFromString (NSString namestr) +Protocol* NSProtocolFromString (NSString namestr) { - return Bridge.invokeObjcFunction!(Protocol, bindings.NSProtocolFromString, NSString)(namestr); + return Bridge.invokeObjcFunction!(Protocol*, bindings.NSProtocolFromString, NSString)(namestr); } -void NSLog (NSString format, ...) +void NSLog (ARGS...) (NSString format, ARGS args) { - return Bridge.invokeObjcFunction!(void, bindings.NSLog, NSString)(format); + return Bridge.invokeObjcFunction!(void, bindings.NSLog, NSString, ARGS)(format, args); } void NSLogv (NSString format, char* args) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSObjCRuntime_bindings.d --- a/dstep/foundation/NSObjCRuntime_bindings.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSObjCRuntime_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -1,14 +1,7 @@ module dstep.foundation.NSObjCRuntime_bindings; -import dstep.AvailabilityMacros; -import dstep.foundation.NSString; -import dstep.foundation.Protocol; -import dstep.limits; -import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; import dstep.objc.objc; -import dstep.stdarg; -import dstep.stdint; + extern (C) @@ -20,12 +13,12 @@ extern (C) { - private id NSStringFromSelector (SEL aSelector); - private SEL NSSelectorFromString (id aSelectorName); - private id NSStringFromClass (Class aClass); - private Class NSClassFromString (id aClassName); - private id NSStringFromProtocol (id proto); - private id NSProtocolFromString (id namestr); - private void NSLog (id format, ...); - private void NSLogv (id format, char* args); + package id NSStringFromSelector (SEL aSelector); + package SEL NSSelectorFromString (id aSelectorName); + package id NSStringFromClass (Class aClass); + package Class NSClassFromString (id aClassName); + package id NSStringFromProtocol (id proto); + package id NSProtocolFromString (id namestr); + package void NSLog (id format, ...); + package void NSLogv (id format, char* args); } \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSObject.d --- a/dstep/foundation/NSObject.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSObject.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,99 +6,175 @@ */ module dstep.foundation.NSObject; +import dstep.foundation.NSArchiver; +import dstep.foundation.NSArray; +import dstep.foundation.NSClassDescription; import dstep.foundation.NSCoder; +import dstep.foundation.NSConnection; +import dstep.foundation.NSData; +import dstep.foundation.NSDictionary; import dstep.foundation.NSEnumerator; +import dstep.foundation.NSError; +import dstep.foundation.NSFileManager; +import dstep.foundation.NSIndexSet; import dstep.foundation.NSInvocation; +import dstep.foundation.NSKeyedArchiver; +import dstep.foundation.NSKeyValueCoding; +import dstep.foundation.NSKeyValueObserving; +import dstep.foundation.NSMetadata; import dstep.foundation.NSMethodSignature; +import dstep.foundation.NSNetServices; import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObjectScripting; +import dstep.foundation.NSPort; +import dstep.foundation.NSPortCoder; +import dstep.foundation.NSPortMessage; +import dstep.foundation.NSRange; +import dstep.foundation.NSRunLoop; +import dstep.foundation.NSScriptClassDescription; +import dstep.foundation.NSScriptKeyValueCoding; +import dstep.foundation.NSScriptObjectSpecifiers; +import dstep.foundation.NSScriptWhoseTests; +import dstep.foundation.NSSet; +import dstep.foundation.NSSpellServer; +import dstep.foundation.NSStream; import dstep.foundation.NSString; +import dstep.foundation.NSThread; +import dstep.foundation.NSURL; +import dstep.foundation.NSURLAuthenticationChallenge; +import dstep.foundation.NSURLCache; +import dstep.foundation.NSURLConnection; +import dstep.foundation.NSURLDownload; +import dstep.foundation.NSURLRequest; +import dstep.foundation.NSURLResponse; +import dstep.foundation.NSXMLParser; import dstep.foundation.NSZone; -import dstep.foundation.Protocol; +import dstep.internal.Version; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.bridge.Wrapper; +import dstep.objc.message; +import dstep.objc.objc; + + +import bindings = dstep.foundation.NSObject_bindings; -class NSObject : INSObject +import dstep.objc.runtime; + +interface INSCopying +{ + Object copyWithZone (NSZone* zone); +} + +interface INSObject { - mixin ObjcWrap; - mixin TNSURLConnectionDelegate; - mixin TNSFileManagerFileOperationAdditions; - mixin TNSDeprecatedKeyValueCoding; - mixin TNSDistributedObjects; - mixin TNSArchiverCallback; - mixin TNSKeyValueObserverNotification; - mixin TNSMetadataQueryDelegate; - mixin TNSKeyValueObservingCustomization; - mixin TNSKeyedArchiverObjectSubstitution; - mixin TNSScriptClassDescription; - mixin TNSDelayedPerforming; - mixin TNSStreamDelegateEventExtensions; - mixin TNSCopyLinkMoveHandler; - mixin TNSMachPortDelegateMethods; - mixin TNSComparisonMethods; - mixin TNSSpellServerDelegate; - mixin TNSScriptKeyValueCoding; - mixin TNSDistantObjectRequestMethods; - mixin TNSClassDescriptionPrimitives; - mixin TNSKeyedUnarchiverObjectSubstitution; - mixin TNSScriptObjectSpecifiers; - mixin TNSNetServiceDelegateMethods; - mixin TNSConnectionDelegateMethods; - mixin TNSXMLParserDelegateEventAdditions; - mixin TNSErrorRecoveryAttempting; - mixin TNSDeprecatedMethods; - mixin TNSPortDelegateMethods; - mixin TNSURLClient; - mixin TNSScriptingComparisonMethods; - mixin TNSNetServiceBrowserDelegateMethods; - mixin TNSCoderMethods; - mixin TNSDeprecatedKeyValueObservingCustomization; - mixin TNSKeyedUnarchiverDelegate; - mixin TNSScripting; - mixin TNSURLDownloadDelegate; - mixin TNSKeyValueCoding; - mixin TNSKeyedArchiverDelegate; - mixin TNSThreadPerformAdditions; - mixin TNSKeyValueObserving; + bool isEqual (Object object); + NSUInteger hash (); + Class superclass (); + Class class_ (); + Object self (); + NSZone* zone (); + Object performSelector (SEL aSelector); + Object performSelector (SEL aSelector, Object object); + Object performSelector (SEL aSelector, Object object1, Object object2); + bool isProxy (); + bool isKindOfClass (Class aClass); + bool isMemberOfClass (Class aClass); + bool conformsToProtocol (Protocol aProtocol); + bool respondsToSelector (SEL aSelector); + Object retain (); + void release (); + Object autorelease (); + NSUInteger retainCount (); + NSString description (); +} + +interface INSMutableCopying +{ + Object mutableCopyWithZone (NSZone* zone); +} + +interface INSCoding +{ + void encodeWithCoder (NSCoder aCoder); + Object initWithCoder (NSCoder aDecoder); +} + +const TNSDeprecatedMethods = ` + + static void poseAsClass (Class aClass) + { + return invokeObjcSelfClass!(void, "poseAsClass:", Class)(aClass); + } + + //mixin ObjcBindClassMethod!(poseAsClass, "poseAsClass:"); +`; + +const TNSCoderMethods = ` + + static NSInteger version_ () + { + return invokeObjcSelfClass!(NSInteger, "version"); + } + + static void setVersion (NSInteger aVersion) + { + return invokeObjcSelfClass!(NSInteger, "setVersion"); + } + + Class classForCoder () + { + return invokeObjcSelf!(Class, "classForCoder"); + } + + Object replacementObjectForCoder (NSCoder aCoder) + { + return invokeObjcSelf!(Object, "replacementObjectForCoder:", NSCoder)(aCoder); + } + + Object awakeAfterUsingCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(Object, "awakeAfterUsingCoder:", NSCoder)(aDecoder); + } + + //mixin ObjcBindClassMethod!(version_, "version"); + //mixin ObjcBindClassMethod!(setVersion, "setVersion"); + //mixin ObjcBindMethod!(classForCoder, "classForCoder"); + //mixin ObjcBindMethod!(replacementObjectForCoder, "replacementObjectForCoder:"); + //mixin ObjcBindMethod!(awakeAfterUsingCoder, "awakeAfterUsingCoder:"); +`; + +class NSObject : ObjcWrapper, INSObject +{ + mixin (ObjcWrap); + + this () + { + super(NSObject.alloc.init.objcObject); + } + + NSObject init () + { + return invokeObjcSelf!(NSObject, "init"); + } static void load () { - return invokeObjcSelfClass!(void, "load"); + return invokeObjcSuperClass!(void, "load"); } static void initialize () { - return invokeObjcSelfClass!(void, "initialize"); - } - - Object init () - { - return invokeObjcSelf!(Object, "init"); - } - - this () - { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "init")(objcObject); - - if (result) - objcObject = ret; - - dObject = this; + return invokeObjcSuperClass!(void, "initialize"); } static Object new_ () { - return invokeObjcSelfClass!(Object, "new"); + return invokeObjcSuperClass!(Object, "new"); } static Object allocWithZone (NSZone* zone) { - return invokeObjcSelfClass!(Object, "allocWithZone:", NSZone*)(zone); - } - - static Object alloc () - { - return invokeObjcSelfClass!(Object, "alloc"); + return invokeObjcSuperClass!(Object, "allocWithZone:", NSZone*)(zone); } void dealloc () @@ -123,32 +199,32 @@ static Object copyWithZone (NSZone* zone) { - return invokeObjcSelfClass!(Object, "copyWithZone:", NSZone*)(zone); + return invokeObjcSuperClass!(Object, "copyWithZone:", NSZone*)(zone); } static Object mutableCopyWithZone (NSZone* zone) { - return invokeObjcSelfClass!(Object, "mutableCopyWithZone:", NSZone*)(zone); + return invokeObjcSuperClass!(Object, "mutableCopyWithZone:", NSZone*)(zone); } - static Class superclass () + static Class superclass_static () { - return invokeObjcSelfClass!(Class, "superclass"); + return invokeObjcSuperClass!(Class, "superclass"); } - static Class class_ () + static Class class_static () { - return invokeObjcSelfClass!(Class, "class"); + return invokeObjcSuperClass!(Class, "class"); } static bool instancesRespondToSelector (SEL aSelector) { - return invokeObjcSelfClass!(bool, "instancesRespondToSelector:", SEL)(aSelector); + return invokeObjcSuperClass!(bool, "instancesRespondToSelector:", SEL)(aSelector); } static bool conformsToProtocol (Protocol protocol) { - return invokeObjcSelfClass!(bool, "conformsToProtocol:", Protocol)(protocol); + return invokeObjcSuperClass!(bool, "conformsToProtocol:", Protocol)(protocol); } IMP methodForSelector (SEL aSelector) @@ -158,7 +234,7 @@ static IMP instanceMethodForSelector (SEL aSelector) { - return invokeObjcSelfClass!(IMP, "instanceMethodForSelector:", SEL)(aSelector); + return invokeObjcSuperClass!(IMP, "instanceMethodForSelector:", SEL)(aSelector); } void doesNotRecognizeSelector (SEL aSelector) @@ -178,27 +254,27 @@ static NSMethodSignature instanceMethodSignatureForSelector (SEL aSelector) { - return invokeObjcSelfClass!(NSMethodSignature, "instanceMethodSignatureForSelector:", SEL)(aSelector); + return invokeObjcSuperClass!(NSMethodSignature, "instanceMethodSignatureForSelector:", SEL)(aSelector); } - static NSString description () + static NSString description_static () { - return invokeObjcSelfClass!(NSString, "description"); + return invokeObjcSuperClass!(NSString, "description"); } static bool isSubclassOfClass (Class aClass) { - return invokeObjcSelfClass!(bool, "isSubclassOfClass:", Class)(aClass); + return invokeObjcSuperClass!(bool, "isSubclassOfClass:", Class)(aClass); } static bool resolveClassMethod (SEL sel) { - return invokeObjcSelfClass!(bool, "resolveClassMethod:", SEL)(sel); + return invokeObjcSuperClass!(bool, "resolveClassMethod:", SEL)(sel); } static bool resolveInstanceMethod (SEL sel) { - return invokeObjcSelfClass!(bool, "resolveInstanceMethod:", SEL)(sel); + return invokeObjcSuperClass!(bool, "resolveInstanceMethod:", SEL)(sel); } bool isEqual (Object object) @@ -295,59 +371,1066 @@ { return invokeObjcSelf!(NSString, "description"); } -} - -interface INSCopying -{ - Object copyWithZone (NSZone* zone); -} - -interface INSObject -{ - bool isEqual (Object object); - NSUInteger hash (); - Class superclass (); - Class class_ (); - Object self (); - NSZone* zone (); - Object performSelector (SEL aSelector); - Object performSelector (SEL aSelector, Object object); - Object performSelector (SEL aSelector, Object object1, Object object2); - bool isProxy (); - bool isKindOfClass (Class aClass); - bool isMemberOfClass (Class aClass); - bool conformsToProtocol (Protocol aProtocol); - bool respondsToSelector (SEL aSelector); - Object retain (); - void release (); - Object autorelease (); - NSUInteger retainCount (); - NSString description (); -} - -interface INSMutableCopying -{ - Object mutableCopyWithZone (NSZone* zone); -} - -interface INSCoding -{ - void encodeWithCoder (NSCoder aCoder); - Object initWithCoder (NSCoder aDecoder); -} - -template TNSDeprecatedMethods () -{ - static void poseAsClass (Class aClass); -} - -template TNSCoderMethods () -{ - static NSInteger version_ (); - static void setVersion (NSInteger aVersion); - Class classForCoder (); - Object replacementObjectForCoder (NSCoder aCoder); - Object awakeAfterUsingCoder (NSCoder aDecoder); + + // NSArchiverCallback + Class classForArchiver () + { + return invokeObjcSelf!(Class, "classForArchiver"); + } + + Object replacementObjectForArchiver (NSArchiver archiver) + { + return invokeObjcSelf!(Object, "replacementObjectForArchiver:", NSArchiver)(archiver); + } + + // NSClassDescriptionPrimitives + NSClassDescription classDescription () + { + return invokeObjcSelf!(NSClassDescription, "classDescription"); + } + + NSArray attributeKeys () + { + return invokeObjcSelf!(NSArray, "attributeKeys"); + } + + NSArray toOneRelationshipKeys () + { + return invokeObjcSelf!(NSArray, "toOneRelationshipKeys"); + } + + NSArray toManyRelationshipKeys () + { + return invokeObjcSelf!(NSArray, "toManyRelationshipKeys"); + } + + NSString inverseForRelationshipKey (NSString relationshipKey) + { + return invokeObjcSelf!(NSString, "inverseForRelationshipKey:", NSString)(relationshipKey); + } + + // NSCoderMethods + static NSInteger version_ () + { + return invokeObjcSelfClass!(NSInteger, "version"); + } + + static void setVersion (NSInteger aVersion) + { + return invokeObjcSelfClass!(NSInteger, "setVersion"); + } + + Class classForCoder () + { + return invokeObjcSelf!(Class, "classForCoder"); + } + + Object replacementObjectForCoder (NSCoder aCoder) + { + return invokeObjcSelf!(Object, "replacementObjectForCoder:", NSCoder)(aCoder); + } + + Object awakeAfterUsingCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(Object, "awakeAfterUsingCoder:", NSCoder)(aDecoder); + } + + // NSComparisonMethods + bool isEqualTo (Object object) + { + return invokeObjcSelf!(bool, "isEqualTo:", Object)(object); + } + + bool isLessThanOrEqualTo (Object object) + { + return invokeObjcSelf!(bool, "isLessThanOrEqualTo:", Object)(object); + } + + bool isLessThan (Object object) + { + return invokeObjcSelf!(bool, "isLessThan:", Object)(object); + } + + bool isGreaterThanOrEqualTo (Object object) + { + return invokeObjcSelf!(bool, "isGreaterThanOrEqualTo:", Object)(object); + } + + bool isGreaterThan (Object object) + { + return invokeObjcSelf!(bool, "isGreaterThan:", Object)(object); + } + + bool isNotEqualTo (Object object) + { + return invokeObjcSelf!(bool, "isNotEqualTo:", Object)(object); + } + + bool doesContain (Object object) + { + return invokeObjcSelf!(bool, "doesContain:", Object)(object); + } + + bool isLike (NSString object) + { + return invokeObjcSelf!(bool, "isLike:", NSString)(object); + } + + bool isCaseInsensitiveLike (NSString object) + { + return invokeObjcSelf!(bool, "isCaseInsensitiveLike:", NSString)(object); + } + + // NSConnectionDelegateMethods + bool makeNewConnection (NSConnection conn, NSConnection ancestor) + { + return invokeObjcSelf!(bool, "makeNewConnection:sender:")(conn, ancestor); + } + + bool connection (NSConnection ancestor, NSConnection conn) + { + return invokeObjcSelf!(bool, "connection:shouldMakeNewConnection:", NSConnection, NSConnection)(ancestor, conn); + } + + NSData authenticationDataForComponents (NSArray components) + { + return invokeObjcSelf!(NSData, "authenticationDataForComponents:", NSArray)(components); + } + + bool authenticateComponents (NSArray components, NSData signature) + { + return invokeObjcSelf!(bool, "authenticateComponents:withData:")(components, signature); + } + + Object createConversationForConnection (NSConnection conn) + { + return invokeObjcSelf!(Object, "createConversationForConnection:")(conn); + } + + // NSCopyLinkMoveHandler + bool fileManager (NSFileManager fm, NSDictionary errorInfo) + { + return invokeObjcSelf!(bool, "fileManager:shouldProceedAfterError:", NSFileManager, NSDictionary)(fm, errorInfo); + } + + void fileManager (NSFileManager fm, NSString path) + { + return invokeObjcSelf!(void, "fileManager:willProcessPath:", NSFileManager, NSString)(fm, path); + } + + // NSDelayedPerforming + void performSelector (SEL aSelector, Object anArgument, double delay, NSArray modes) + { + return invokeObjcSelf!(void, "performSelector:withObject:afterDelay:inModes:", SEL, Object, double, NSArray)(aSelector, anArgument, delay, modes); + } + + void performSelector (SEL aSelector, Object anArgument, double delay) + { + return invokeObjcSelf!(void, "performSelector:withObject:afterDelay:", SEL, Object, double)(aSelector, anArgument, delay); + } + + static void cancelPreviousPerformRequestsWithTarget (Object aTarget, SEL aSelector, Object anArgument) + { + return invokeObjcSelfClass!(void, "cancelPreviousPerformRequestsWithTarget:selector:object:", Object, SEL, Object)(aTarget, aSelector, anArgument); + } + + static void cancelPreviousPerformRequestsWithTarget (Object aTarget) + { + return invokeObjcSelfClass!(void, "cancelPreviousPerformRequestsWithTarget:", Object)(aTarget); + } + + // NSDeprecatedKeyValueCoding + static bool useStoredAccessor () + { + return invokeObjcSelfClass!(bool, "useStoredAccessor"); + } + + Object storedValueForKey (NSString key) + { + return invokeObjcSelf!(Object, "storedValueForKey:", NSString)(key); + } + + void takeStoredValue (Object value, NSString key) + { + return invokeObjcSelf!(void, "takeStoredValue:forKey:", Object, NSString)(value, key); + } + + void takeValue (Object value, NSString key) + { + return invokeObjcSelf!(void, "takeValue:forKey:", Object, NSString)(value, key); + } + + void takeValue_forKeyPath (Object value, NSString keyPath) + { + return invokeObjcSelf!(void, "takeValue:forKeyPath:", Object, NSString)(value, keyPath); + } + + Object handleQueryWithUnboundKey (NSString key) + { + return invokeObjcSelf!(Object, "handleQueryWithUnboundKey:", NSString)(key); + } + + void handleTakeValue (Object value, NSString key) + { + return invokeObjcSelf!(void, "handleTakeValue:forUnboundKey:", Object, NSString)(value, key); + } + + void unableToSetNilForKey (NSString key) + { + return invokeObjcSelf!(void, "unableToSetNilForKey:", NSString)(key); + } + + NSDictionary valuesForKeys (NSArray keys) + { + return invokeObjcSelf!(NSDictionary, "valuesForKeys:", NSArray)(keys); + } + + void takeValuesFromDictionary (NSDictionary properties) + { + return invokeObjcSelf!(void, "takeValuesFromDictionary:", NSDictionary)(properties); + } + + // NSDeprecatedKeyValueObservingCustomization + static void setKeys (NSArray keys, NSString dependentKey) + { + return invokeObjcSelfClass!(void, "setKeys:triggerChangeNotificationsForDependentKey:", NSArray, NSString)(keys, dependentKey); + } + + // NSDeprecatedMethods + static void poseAsClass (Class aClass) + { + return invokeObjcSelfClass!(void, "poseAsClass:", Class)(aClass); + } + + // NSDistantObjectRequestMethods + bool connection (NSConnection connection, NSDistantObjectRequest doreq) + { + return invokeObjcSelf!(bool, "connection:handleRequest:", NSConnection, NSDistantObjectRequest)(connection, doreq); + } + + // NSDistributedObjects + Class classForPortCoder () + { + return invokeObjcSelf!(Class, "classForPortCoder"); + } + + Object replacementObjectForPortCoder (NSPortCoder coder) + { + return invokeObjcSelf!(Object, "replacementObjectForPortCoder:", NSPortCoder)(coder); + } + + // NSErrorRecoveryAttempting + /*void attemptRecoveryFromError (NSError error, NSUInteger recoveryOptionIndex, Object delegate_, SEL didRecoverSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "attemptRecoveryFromError:optionIndexdelegate:didRecoverSelector:contextInfo:", NSError, NSUInteger, Object, SEL, void*)(error, recoveryOptionIndex, delegate_, didRecoverSelector, contextInfo); + } + + bool attemptRecoveryFromError (NSError error, NSUInteger recoveryOptionIndex) + { + return invokeObjcSelf!(bool, "attemptRecoveryFromError:optionIndex:", NSError, NSUInteger)(error, recoveryOptionIndex); + } + + // NSFileManagerFileOperationAdditions + bool fileManager_shouldCopyItemAtPath_toPath_dstPath (NSFileManager fileManager, NSString srcPath, NSString dstPath) + { + return invokeObjcSelf!(bool, "fileManager:shouldCopyItemAtPath:toPath:dstPath:", NSFileManager, NSString, NSString); + }*/ + + bool fileManager (NSFileManager fileManager, NSError error, NSString srcPath, NSString dstPath) + { + return invokeObjcSelf!(bool, "fileManager:shouldProceedAfterError:copyingItemAtPath:toPath:", NSFileManager, NSError, NSString, NSString)(fileManager, error, srcPath, dstPath); + } + + bool fileManager (NSFileManager fileManager, NSString srcPath, NSString dstPath) + { + return invokeObjcSelf!(bool, "fileManager:shouldMoveItemAtPath:toPath:", NSFileManager, NSString, NSString)(fileManager, srcPath, dstPath); + } + + bool fileManager_shouldProceedAfterError_movingItemAtPath_toPath (NSFileManager fileManager, NSError error, NSString srcPath, NSString dstPath) + { + return invokeObjcSelf!(bool, "fileManager:shouldProceedAfterError:movingItemAtPath:toPath:", NSFileManager, NSError, NSString, NSString)(fileManager, error, srcPath, dstPath); + } + + bool fileManager (NSFileManager fileManager, NSString srcPath, NSString dstPath) + { + return invokeObjcSelf!(bool, "fileManager:shouldLinkItemAtPath:toPath:", NSFileManager, NSString, NSString)(fileManager, srcPath, dstPath); + } + + bool fileManager_shouldProceedAfterError_linkingItemAtPath_toPath (NSFileManager fileManager, NSError error, NSString srcPath, NSString dstPath) + { + return invokeObjcSelf!(bool, "fileManager:shouldProceedAfterError:linkingItemAtPath:toPath:", NSFileManager, NSError, NSString, NSString)(fileManager, error, srcPath, dstPath); + } + + bool fileManager_shouldRemoveItemAtPath (NSFileManager fileManager, NSString path) + { + return invokeObjcSelf!(bool, "fileManager:shouldRemoveItemAtPath:", NSFileManager, NSString)(fileManager, path); + } + + bool fileManager (NSFileManager fileManager, NSError error, NSString path) + { + return invokeObjcSelf!(bool, "fileManager:shouldProceedAfterError:removingItemAtPath:", NSFileManager, NSError, NSString)(fileManager, error, path); + } + + // NSKeyedArchiverDelegate + Object archiver (NSKeyedArchiver archiver, Object object) + { + return invokeObjcSelf!(Object, "archiver:willEncodeObject:", NSKeyedArchiver, Object)(archiver, object); + } + + void archiver_didEncodeObject (NSKeyedArchiver archiver, Object object) + { + return invokeObjcSelf!(void, "archiver:didEncodeObject:", NSKeyedArchiver, Object)(archiver, object); + } + + void archiver (NSKeyedArchiver archiver, Object object, Object newObject) + { + return invokeObjcSelf!(void, "archiver:willReplaceObject:withObject:", NSKeyedArchiver, Object, Object)(archiver, object, newObject); + } + + void archiverWillFinish (NSKeyedArchiver archiver) + { + return invokeObjcSelf!(void, "archiverWillFinish:", NSKeyedArchiver)(archiver); + } + + void archiverDidFinish (NSKeyedArchiver archiver) + { + return invokeObjcSelf!(void, "archiverDidFinish:", NSKeyedArchiver)(archiver); + } + + // NSKeyedArchiverObjectSubstitution + Class classForKeyedArchiver () + { + return invokeObjcSelf!(Class, "classForKeyedArchiver"); + } + + Object replacementObjectForKeyedArchiver (NSKeyedArchiver archiver) + { + return invokeObjcSelf!(Object, "replacementObjectForKeyedArchiver:", NSKeyedArchiver)(archiver); + } + + static NSArray classFallbacksForKeyedArchiver () + { + return invokeObjcSelfClass!(NSArray, "classFallbacksForKeyedArchiver"); + } + + // NSKeyedUnarchiverDelegate + Class unarchiver (NSKeyedUnarchiver unarchiver, NSString name, NSArray classNames) + { + return invokeObjcSelf!(Class, "unarchiver:cannotDecodeObjectOfClassName:originalClasses:", NSKeyedUnarchiver, NSString, NSArray)(unarchiver, name, classNames); + } + + Object unarchiver (NSKeyedUnarchiver unarchiver, Object object) + { + return invokeObjcSelf!(Object, "unarchiver:didDecodeObject:", NSKeyedUnarchiver, Object)(unarchiver, object); + } + + void unarchiver (NSKeyedUnarchiver unarchiver, Object object, Object newObject) + { + return invokeObjcSelf!(void, "unarchiver:willReplaceObject:withObject:", NSKeyedUnarchiver, Object, Object)(unarchiver, object, newObject); + } + + void unarchiverWillFinish (NSKeyedUnarchiver unarchiver) + { + return invokeObjcSelf!(void, "unarchiverWillFinish:", NSKeyedUnarchiver)(unarchiver); + } + + void unarchiverDidFinish (NSKeyedUnarchiver unarchiver) + { + return invokeObjcSelf!(void, "unarchiverDidFinish:", NSKeyedUnarchiver)(unarchiver); + } + + // NSKeyedUnarchiverObjectSubstitution + static Class classForKeyedUnarchiver () + { + return invokeObjcSelfClass!(Class, "classForKeyedUnarchiver"); + } + + // NSKeyValueCoding + static bool accessInstanceVariablesDirectly () + { + return invokeObjcSelfClass!(bool, "accessInstanceVariablesDirectly"); + } + + Object valueForKey (NSString key) + { + return invokeObjcSelf!(Object, "valueForKey:", NSString)(key); + } + + void setValue (Object value, NSString key) + { + return invokeObjcSelf!(void, "setValue:forKey:", Object, NSString)(value, key); + } + + bool validateValue (id* ioValue, NSString inKey, ref NSError outError) + { + id error; + + if (outError) + error = new objc_object; + + bool result = invokeObjcSelf!(bool, "validateValue:forKey:error:", id*, NSString, id*)(ioValue, inKey, &error); + + if (error) + outError = new NSError(error); + + return result; + } + + NSMutableArray mutableArrayValueForKey (NSString key) + { + return invokeObjcSelf!(NSMutableArray, "mutableArrayValueForKey:", NSString)(key); + } + + NSMutableSet mutableSetValueForKey (NSString key) + { + return invokeObjcSelf!(NSMutableSet, "mutableSetValueForKey:", NSString)(key); + } + + Object valueForKeyPath (NSString keyPath) + { + return invokeObjcSelf!(Object, "valueForKeyPath:", NSString)(keyPath); + } + + void setValue_forKeyPath (Object value, NSString keyPath) + { + return invokeObjcSelf!(void, "setValue:forKeyPath:", Object, NSString)(value, keyPath); + } + + bool validateValue_forKeyPath_error (id* ioValue, NSString inKeyPath, ref NSError outError) + { + id error; + + if (outError) + error = new objc_object; + + bool result = invokeObjcSelf!(bool, "validateValue:forKeyPath:error:", id*, NSString, id*)(ioValue, inKeyPath, &error); + + if (error) + outError = new NSError(error); + + return result; + } + + NSMutableArray mutableArrayValueForKeyPath (NSString keyPath) + { + return invokeObjcSelf!(NSMutableArray, "mutableArrayValueForKeyPath:", NSString)(keyPath); + } + + NSMutableSet mutableSetValueForKeyPath (NSString keyPath) + { + return invokeObjcSelf!(NSMutableSet, "mutableSetValueForKeyPath:", NSString)(keyPath); + } + + Object valueForUndefinedKey (NSString key) + { + return invokeObjcSelf!(Object, "valueForUndefinedKey:", NSString)(key); + } + + void setValue_forUndefinedKey (Object value, NSString key) + { + return invokeObjcSelf!(void, "setValue:forUndefinedKey:", Object, NSString)(value, key); + } + + void setNilValueForKey (NSString key) + { + return invokeObjcSelf!(void, "setNilValueForKey:", NSString)(key); + } + + NSDictionary dictionaryWithValuesForKeys (NSArray keys) + { + return invokeObjcSelf!(NSDictionary, "dictionaryWithValuesForKeys:", NSArray)(keys); + } + + void setValuesForKeysWithDictionary (NSDictionary keyedValues) + { + return invokeObjcSelf!(void, "setValuesForKeysWithDictionary:", NSDictionary)(keyedValues); + } + + // NSKeyValueObserverNotification + void willChangeValueForKey (NSString key) + { + return invokeObjcSelf!(void, "willChangeValueForKey:", NSString)(key); + } + + void didChangeValueForKey (NSString key) + { + return invokeObjcSelf!(void, "didChangeValueForKey:", NSString)(key); + } + + void willChange (NSKeyValueChange changeKind, NSIndexSet indexes, NSString key) + { + return invokeObjcSelf!(void, "willChange:valuesAtIndexes:forKey:", NSKeyValueChange, NSIndexSet, NSString)(changeKind, indexes, key); + } + + void didChange (NSKeyValueChange changeKind, NSIndexSet indexes, NSString key) + { + return invokeObjcSelf!(void, "didChange:valuesAtIndexes:forKey:", NSKeyValueChange, NSIndexSet, NSString)(changeKind, indexes, key); + } + + void willChangeValueForKey (NSString key, NSKeyValueSetMutationKind mutationKind, NSSet objects) + { + return invokeObjcSelf!(void, "willChangeValueForKey:withSetMutation:usingObjects:", NSString, NSKeyValueSetMutationKind, NSSet)(key, mutationKind, objects); + } + + void didChangeValueForKey (NSString key, NSKeyValueSetMutationKind mutationKind, NSSet objects) + { + return invokeObjcSelf!(void, "didChangeValueForKey:withSetMutation:usingObjects:", NSString, NSKeyValueSetMutationKind, NSSet)(key, mutationKind, objects); + } + + // NSKeyValueObserving + void observeValueForKeyPath (NSString keyPath, Object object, NSDictionary change, void* context) + { + return invokeObjcSelf!(void, "observeValueForKeyPath:ofObject:change:context:", NSString, Object, NSDictionary, void*)(keyPath, object, change, context); + } + + // NSKeyValueObservingCustomization + static NSSet keyPathsForValuesAffectingValueForKey (NSString key) + { + return invokeObjcSelfClass!(NSSet, "keyPathsForValuesAffectingValueForKey:", NSString)(key); + } + + static bool automaticallyNotifiesObserversForKey (NSString key) + { + return invokeObjcSelfClass!(bool, "automaticallyNotifiesObserversForKey:", NSString)(key); + } + + void setObservationInfo (void* observationInfo) + { + return invokeObjcSelf!(void, "setObservationInfo:", void*)(observationInfo); + } + + void* observationInfo () + { + return invokeObjcSelf!(void*, "observationInfo"); + } + + // NSMachPortDelegateMethods + void handleMachMessage (void* msg) + { + return invokeObjcSelf!(void, "handleMachMessage:", void*)(msg); + } + + // NSMetadataQueryDelegate + Object metadataQuery (NSMetadataQuery query, NSMetadataItem result) + { + return invokeObjcSelf!(Object, "metadataQuery:replacementObjectForResultObject:", NSMetadataQuery, NSMetadataItem)(query, result); + } + + Object metadataQuery (NSMetadataQuery query, NSString attrName, Object attrValue) + { + return invokeObjcSelf!(Object, "metadataQuery:replacementValueForAttribute:value:", NSMetadataQuery, NSString, Object)(query, attrName, attrValue); + } + + // NSNetServiceBrowserDelegateMethods + void netServiceBrowserWillSearch (NSNetServiceBrowser aNetServiceBrowser) + { + return invokeObjcSelf!(void, "netServiceBrowserWillSearch:", NSNetServiceBrowser)(aNetServiceBrowser); + } + + void netServiceBrowserDidStopSearch (NSNetServiceBrowser aNetServiceBrowser) + { + return invokeObjcSelf!(void, "netServiceBrowserDidStopSearch:", NSNetServiceBrowser)(aNetServiceBrowser); + } + + void netServiceBrowser (NSNetServiceBrowser aNetServiceBrowser, NSDictionary errorDict) + { + return invokeObjcSelf!(void, "netServiceBrowser:didNotSearch:", NSNetServiceBrowser, NSDictionary)(aNetServiceBrowser, errorDict); + } + + void netServiceBrowser (NSNetServiceBrowser aNetServiceBrowser, NSString domainString, bool moreComing) + { + return invokeObjcSelf!(void, "netServiceBrowser:didFindDomain:moreComing:", NSNetServiceBrowser, NSString, bool)(aNetServiceBrowser, domainString, moreComing); + } + + void netServiceBrowser (NSNetServiceBrowser aNetServiceBrowser, NSNetService aNetService, bool moreComing) + { + return invokeObjcSelf!(void, "netServiceBrowser:didFindService:moreComing:", NSNetServiceBrowser, NSNetService, bool)(aNetServiceBrowser, aNetService, moreComing); + } + + void netServiceBrowser_didRemoveDomain_moreComing (NSNetServiceBrowser aNetServiceBrowser, NSString domainString, bool moreComing) + { + return invokeObjcSelf!(void, "netServiceBrowser:didRemoveDomain:moreComing:", NSNetServiceBrowser, NSString, bool)(aNetServiceBrowser, domainString, moreComing); + } + + void netServiceBrowser_didRemoveService_moreComing (NSNetServiceBrowser aNetServiceBrowser, NSNetService aNetService, bool moreComing) + { + return invokeObjcSelf!(void, "netServiceBrowser:didRemoveService:moreComing:", NSNetServiceBrowser, NSNetService, bool)(aNetServiceBrowser, aNetService, moreComing); + } + + // NSNetServiceDelegateMethods + void netServiceWillPublish (NSNetService sender) + { + return invokeObjcSelf!(void, "netServiceWillPublish:", NSNetService)(sender); + } + + void netServiceDidPublish (NSNetService sender) + { + return invokeObjcSelf!(void, "netServiceDidPublish:", NSNetService)(sender); + } + + void netService (NSNetService sender, NSDictionary errorDict) + { + return invokeObjcSelf!(void, "netService:didNotPublish:", NSNetService, NSDictionary)(sender, errorDict); + } + + void netServiceWillResolve (NSNetService sender) + { + return invokeObjcSelf!(void, "netServiceWillResolve:", NSNetService)(sender); + } + + void netServiceDidResolveAddress (NSNetService sender) + { + return invokeObjcSelf!(void, "netServiceDidResolveAddress:", NSNetService)(sender); + } + + void netService_didNotPublish (NSNetService sender, NSDictionary errorDict) + { + return invokeObjcSelf!(void, "netService:didNotPublish:", NSNetService, NSDictionary)(sender, errorDict); + } + + void netServiceDidStop (NSNetService sender) + { + return invokeObjcSelf!(void, "netServiceDidStop:", NSNetService)(sender); + } + + void netService (NSNetService sender, NSData data) + { + return invokeObjcSelf!(void, "netService:didUpdateTXTRecordData:", NSNetService, NSData)(sender, data); + } + + // NSPortDelegateMethods + void handlePortMessage (NSPortMessage message) + { + return invokeObjcSelf!(void, "handlePortMessage:", NSPortMessage)(message); + } + + // NSScriptingComparisonMethods + uint classCode () + { + return invokeObjcSelf!(uint, "classCode"); + } + + NSString className () + { + return invokeObjcSelf!(NSString, "className"); + } + + // NSScriptKeyValueCoding + Object scriptingValueForSpecifier (NSScriptObjectSpecifier objectSpecifier) + { + return invokeObjcSelf!(Object, "scriptingValueForSpecifier:", NSScriptObjectSpecifier)(objectSpecifier); + } + + NSDictionary scriptingProperties () + { + return invokeObjcSelf!(NSDictionary, "scriptingProperties"); + } + + void setScriptingProperties (NSDictionary properties) + { + return invokeObjcSelf!(void, "setScriptingProperties:", NSDictionary)(properties); + } + + Object copyScriptingValue (Object value, NSString key, NSDictionary properties) + { + return invokeObjcSelf!(Object, "copyScriptingValue:forKey:withProperties:", Object, NSString, NSDictionary)(value, key, properties); + } + + Object newScriptingObjectOfClass (Class objectClass, NSString key, Object contentsValue, NSDictionary properties) + { + return invokeObjcSelf!(Object, "newScriptingObjectOfClass:forValueForKey:withContentsValue:properties:", Class, NSString, Object, NSDictionary)(objectClass, key, contentsValue, properties); + } + + Object scriptingValueForSpecifier (NSScriptObjectSpecifier objectSpecifier) + { + return invokeObjcSelf!(Object, "scriptingValueForSpecifier:", NSScriptObjectSpecifier)(objectSpecifier); + } + + bool scriptingIsEqualTo (Object object) + { + return invokeObjcSelf!(bool, "scriptingIsEqualTo:", Object)(object); + } + + bool scriptingIsLessThanOrEqualTo (Object object) + { + return invokeObjcSelf!(bool, "scriptingIsLessThanOrEqualTo:", Object)(object); + } + + bool scriptingIsLessThan (Object object) + { + return invokeObjcSelf!(bool, "scriptingIsLessThan:", Object)(object); + } + + bool scriptingIsGreaterThanOrEqualTo (Object object) + { + return invokeObjcSelf!(bool, "scriptingIsGreaterThanOrEqualTo:", Object)(object); + } + + bool scriptingIsGreaterThan (Object object) + { + return invokeObjcSelf!(bool, "scriptingIsGreaterThan:", Object)(object); + } + + bool scriptingBeginsWith (Object object) + { + return invokeObjcSelf!(bool, "scriptingBeginsWith:", Object)(object); + } + + bool scriptingEndsWith (Object object) + { + return invokeObjcSelf!(bool, "scriptingEndsWith:", Object)(object); + } + + bool scriptingContains (Object object) + { + return invokeObjcSelf!(bool, "scriptingContains:", Object)(object); + } + + Object valueAtIndex (NSUInteger index, NSString key) + { + return invokeObjcSelf!(Object, "valueAtIndex:inPropertyWithKey:", NSUInteger, NSString)(index, key); + } + + Object valueWithName (NSString name, NSString key) + { + return invokeObjcSelf!(Object, "valueWithName:inPropertyWithKey:", NSString, NSString)(name, key); + } + + Object valueWithUniqueID (Object uniqueID, NSString key) + { + return invokeObjcSelf!(Object, "valueWithUniqueID:inPropertyWithKey:", Object, NSString)(uniqueID, key); + } + + void insertValue (Object value, NSUInteger index, NSString key) + { + return invokeObjcSelf!(void, "insertValue:atIndex:inPropertyWithKey:", Object, NSUInteger, NSString)(value, index, key); + } + + void removeValueAtIndex (NSUInteger index, NSString key) + { + return invokeObjcSelf!(void, "removeValueAtIndex:fromPropertyWithKey:", NSUInteger, NSString)(index, key); + } + + void replaceValueAtIndex (NSUInteger index, NSString key, Object value) + { + return invokeObjcSelf!(void, "replaceValueAtIndex:inPropertyWithKey:withValue:", NSUInteger, NSString, Object)(index, key, value); + } + + void insertValue (Object value, NSString key) + { + return invokeObjcSelf!(void, "insertValue:inPropertyWithKey:", Object, NSString)(value, key); + } + + Object coerceValue (Object value, NSString key) + { + return invokeObjcSelf!(Object, "coerceValue:forKey:", Object, NSString)(value, key); + } + + NSScriptObjectSpecifier objectSpecifier () + { + return invokeObjcSelf!(NSScriptObjectSpecifier, "objectSpecifier"); + } + + NSArray indicesOfObjectsByEvaluatingObjectSpecifier (NSScriptObjectSpecifier specifier) + { + return invokeObjcSelf!(NSArray, "indicesOfObjectsByEvaluatingObjectSpecifier:", NSScriptObjectSpecifier)(specifier); + } + + NSRange spellServer (NSSpellServer sender, NSString stringToCheck, NSString language, NSInteger* wordCount, bool countOnly) + { + return invokeObjcSelf!(NSRange, "spellServer:findMisspelledWordInString:language:wordCount:countOnly:", NSSpellServer, NSString, NSString, NSInteger*, bool)(sender, stringToCheck, language, wordCount, countOnly); + } + + NSArray spellServer (NSSpellServer sender, NSString word, NSString language) + { + return invokeObjcSelf!(NSArray, "spellServer:suggestGuessesForWord:inLanguage:", NSSpellServer, NSString, NSString)(sender, word, language); + } + + void spellServer_didLearnWord_inLanguage (NSSpellServer sender, NSString word, NSString language) + { + return invokeObjcSelf!(void, "spellServer:didLearnWord:inLanguage:", NSSpellServer, NSString, NSString)(sender, word, language); + } + + void spellServer (NSSpellServer sender, NSString word, NSString language) + { + return invokeObjcSelf!(void, "spellServer:didForgetWord:inLanguage:", NSSpellServer, NSString, NSString)(sender, word, language); + } + + NSArray spellServer (NSSpellServer sender, NSRange range, NSString string, NSString language) + { + return invokeObjcSelf!(NSArray, "spellServer:suggestCompletionsForPartialWordRange:inString:language:", NSSpellServer, NSRange, NSString, NSString)(sender, range, string, language); + } + + NSRange spellServer (NSSpellServer sender, NSString stringToCheck, NSString language, out NSArray details) + { + id det = new objc_object; + + NSRange result = invokeObjcSelf!(NSRange, "spellServer:checkGrammarInString:language:details:", NSSpellServer, NSString, NSString, id*)(sender, stringToCheck, language, &det); + + if (det) + details = new NSArray(det); + + return result; + } + + void stream (NSStream aStream, NSStreamEvent eventCode) + { + return invokeObjcSelf!(void, "stream:handleEvent:", NSStream, NSStreamEvent)(aStream, eventCode); + } + + void performSelectorOnMainThread (SEL aSelector, Object arg, bool wait, NSArray array) + { + return invokeObjcSelf!(void, "performSelectorOnMainThread:withObject:waitUntilDone:modes:", SEL, Object, bool, NSArray)(aSelector, arg, wait, array); + } + + void performSelectorOnMainThread (SEL aSelector, Object arg, bool wait) + { + return invokeObjcSelf!(void, "performSelectorOnMainThread:withObject:waitUntilDone:", SEL, Object, bool)(aSelector, arg, wait); + } + + void performSelector (SEL aSelector, NSThread thr, Object arg, bool wait, NSArray array) + { + return invokeObjcSelf!(void, "performSelector:onThread:withObject:waitUntilDone:modes:", SEL, NSThread, Object, bool, NSArray)(aSelector, thr, arg, wait, array); + } + + void performSelector (SEL aSelector, NSThread thr, Object arg, bool wait) + { + return invokeObjcSelf!(void, "performSelector:onThread:withObject:waitUntilDone:", SEL, NSThread, Object, bool)(aSelector, thr, arg, wait); + } + + void performSelectorInBackground (SEL aSelector, Object arg) + { + return invokeObjcSelf!(void, "performSelectorInBackground:withObject:", SEL, Object)(aSelector, arg); + } + + void URL (NSURL sender, NSData newBytes) + { + return invokeObjcSelf!(void, "URL:resourceDataDidBecomeAvailable:", NSURL, NSData)(sender, newBytes); + } + + void URLResourceDidFinishLoading (NSURL sender) + { + return invokeObjcSelf!(void, "URLResourceDidFinishLoading:", NSURL)(sender); + } + + void URLResourceDidCancelLoading (NSURL sender) + { + return invokeObjcSelf!(void, "URLResourceDidCancelLoading:", NSURL)(sender); + } + + void URL (NSURL sender, NSString reason) + { + return invokeObjcSelf!(void, "URL:resourceDidFailLoadingWithReason:", NSURL, NSString)(sender, reason); + } + + NSURLRequest connection (NSURLConnection connection, NSURLRequest request, NSURLResponse response) + { + return invokeObjcSelf!(NSURLRequest, "connection:willSendRequest:redirectResponse:", NSURLConnection, NSURLRequest, NSURLResponse)(connection, request, response); + } + + void connection (NSURLConnection connection, NSURLAuthenticationChallenge challenge) + { + return invokeObjcSelf!(void, "connection:didReceiveAuthenticationChallenge:", NSURLConnection, NSURLAuthenticationChallenge)(connection, challenge); + } + + void connection_didCancelAuthenticationChallenge (NSURLConnection connection, NSURLAuthenticationChallenge challenge) + { + return invokeObjcSelf!(void, "connection:didCancelAuthenticationChallenge:", NSURLConnection, NSURLAuthenticationChallenge)(connection, challenge); + } + + void connection (NSURLConnection connection, NSURLResponse response) + { + return invokeObjcSelf!(void, "connection:didReceiveResponse:", NSURLConnection, NSURLResponse)(connection, response); + } + + void connection (NSURLConnection connection, NSData data) + { + return invokeObjcSelf!(void, "connection:didReceiveData:", NSURLConnection, NSData)(connection, data); + } + + void connectionDidFinishLoading (NSURLConnection connection) + { + return invokeObjcSelf!(void, "connectionDidFinishLoading:", NSURLConnection)(connection); + } + + void connection (NSURLConnection connection, NSError error) + { + return invokeObjcSelf!(void, "connection:didFailWithError:", NSURLConnection, NSError)(connection, error); + } + + NSCachedURLResponse connection (NSURLConnection connection, NSCachedURLResponse cachedResponse) + { + return invokeObjcSelf!(NSCachedURLResponse, "connection:willCacheResponse:", NSURLConnection, NSCachedURLResponse)(connection, cachedResponse); + } + + void downloadDidBegin (NSURLDownload download) + { + return invokeObjcSelf!(void, "downloadDidBegin:", NSURLDownload)(download); + } + + NSURLRequest download (NSURLDownload download, NSURLRequest request, NSURLResponse redirectResponse) + { + return invokeObjcSelf!(NSURLRequest, "download:willSendRequest:redirectResponse:", NSURLDownload, NSURLRequest, NSURLResponse)(download, request, redirectResponse); + } + + void download (NSURLDownload download, NSURLAuthenticationChallenge challenge) + { + return invokeObjcSelf!(void, "download:didReceiveAuthenticationChallenge:", NSURLDownload, NSURLAuthenticationChallenge)(download, challenge); + } + + void download_didCancelAuthenticationChallenge (NSURLDownload download, NSURLAuthenticationChallenge challenge) + { + return invokeObjcSelf!(void, "download:didCancelAuthenticationChallenge:", NSURLDownload, NSURLAuthenticationChallenge)(download, challenge); + } + + void download (NSURLDownload download, NSURLResponse response) + { + return invokeObjcSelf!(void, "download:didReceiveResponse:", NSURLDownload, NSURLResponse)(download, response); + } + + void download (NSURLDownload download, NSURLResponse response, long startingByte) + { + return invokeObjcSelf!(void, "download:willResumeWithResponse:fromByte:", NSURLDownload, NSURLResponse, long)(download, response, startingByte); + } + + void download (NSURLDownload download, NSUInteger length) + { + return invokeObjcSelf!(void, "download:didReceiveDataOfLength:", NSURLDownload, NSUInteger)(download, length); + } + + bool download (NSURLDownload download, NSString encodingType) + { + return invokeObjcSelf!(bool, "download:shouldDecodeSourceDataOfMIMEType:", NSURLDownload, NSString)(download, encodingType); + } + + void download_decideDestinationWithSuggestedFilename (NSURLDownload download, NSString filename) + { + return invokeObjcSelf!(void, "download:decideDestinationWithSuggestedFilename:", NSURLDownload, NSString)(download, filename); + } + + void download_didCreateDestination (NSURLDownload download, NSString path) + { + return invokeObjcSelf!(void, "download:didCreateDestination:", NSURLDownload, NSString)(download, path); + } + + void downloadDidFinish (NSURLDownload download) + { + return invokeObjcSelf!(void, "downloadDidFinish:", NSURLDownload)(download); + } + + void download (NSURLDownload download, NSError error) + { + return invokeObjcSelf!(void, "download:didFailWithError:", NSURLDownload, NSError)(download, error); + } + + void parserDidStartDocument (NSXMLParser parser) + { + return invokeObjcSelf!(void, "parserDidStartDocument:", NSXMLParser)(parser); + } + + void parserDidEndDocument (NSXMLParser parser) + { + return invokeObjcSelf!(void, "parserDidEndDocument:", NSXMLParser)(parser); + } + + void parser (NSXMLParser parser, NSString name, NSString publicID, NSString systemID) + { + return invokeObjcSelf!(void, "parser:foundNotationDeclarationWithName:publicID:systemID:", NSXMLParser, NSString, NSString, NSString)(parser, name, publicID, systemID); + } + + void parser (NSXMLParser parser, NSString name, NSString publicID, NSString systemID, NSString notationName) + { + return invokeObjcSelf!(void, "parser:foundUnparsedEntityDeclarationWithName:publicID:systemID:notationName:", NSXMLParser, NSString, NSString, NSString, NSString)(parser, name, publicID, systemID, notationName); + } + + void parser_foundAttributeDeclarationWithName_forElement_type_defaultValue (NSXMLParser parser, NSString attributeName, NSString elementName, NSString type, NSString defaultValue) + { + return invokeObjcSelf!(void, "parser:foundAttributeDeclarationWithName:forElement:type:defaultValue:", NSXMLParser, NSString, NSString, NSString, NSString)(parser, attributeName, elementName, type, defaultValue); + } + + void parser (NSXMLParser parser, NSString elementName, NSString model) + { + return invokeObjcSelf!(void, "parser:foundElementDeclarationWithName:model:", NSXMLParser, NSString, NSString)(parser, elementName, model); + } + + void parser_foundInternalEntityDeclarationWithName_value (NSXMLParser parser, NSString name, NSString value) + { + return invokeObjcSelf!(void, "parser:foundInternalEntityDeclarationWithName:value:", NSXMLParser, NSString, NSString)(parser, name, value); + } + + void parser_foundExternalEntityDeclarationWithName_publicID_systemID (NSXMLParser parser, NSString name, NSString publicID, NSString systemID) + { + return invokeObjcSelf!(void, "parser:foundExternalEntityDeclarationWithName:publicID:systemID:", NSXMLParser, NSString, NSString, NSString)(parser, name, publicID, systemID); + } + + void parser (NSXMLParser parser, NSString elementName, NSString namespaceURI, NSString qName, NSDictionary attributeDict) + { + return invokeObjcSelf!(void, "parser:didStartElement:namespaceURI:qualifiedName:attributes:", NSXMLParser, NSString, NSString, NSString, NSDictionary)(parser, elementName, namespaceURI, qName, attributeDict); + } + + void parser_didEndElement_namespaceURI_qualifiedName (NSXMLParser parser, NSString elementName, NSString namespaceURI, NSString qName) + { + return invokeObjcSelf!(void, "parser:didEndElement:namespaceURI:qualifiedName:", NSXMLParser, NSString, NSString, NSString)(parser, elementName, namespaceURI, qName); + } + + void parser_didStartMappingPrefix_toURI (NSXMLParser parser, NSString prefix, NSString namespaceURI) + { + return invokeObjcSelf!(void, "parser:didStartMappingPrefix:toURI:", NSXMLParser, NSString, NSString)(parser, prefix, namespaceURI); + } + + void parser (NSXMLParser parser, NSString prefix) + { + return invokeObjcSelf!(void, "parser:didEndMappingPrefix:", NSXMLParser, NSString)(parser, prefix); + } + + void parser_foundCharacter (NSXMLParser parser, NSString string) + { + return invokeObjcSelf!(void, "parser:foundCharacters:", NSXMLParser, NSString)(parser, string); + } + + void parser_foundIgnorableWhitespace (NSXMLParser parser, NSString whitespaceString) + { + return invokeObjcSelf!(void, "parser:foundIgnorableWhitespace:", NSXMLParser, NSString)(parser, whitespaceString); + } + + void parser_foundProcessingInstructionWithTarget_data (NSXMLParser parser, NSString target, NSString data) + { + return invokeObjcSelf!(void, "parser:foundProcessingInstructionWithTarget:data:", NSXMLParser, NSString, NSString)(parser, target, data); + } + + void parser_foundComment (NSXMLParser parser, NSString comment) + { + return invokeObjcSelf!(void, "parser:foundComment:", NSXMLParser, NSString)(parser, comment); + } + + void parser (NSXMLParser parser, NSData CDATABlock) + { + return invokeObjcSelf!(void, "parser:foundCDATA:", NSXMLParser, NSData)(parser, CDATABlock); + } + + NSData parser_resolveExternalEntityName_systemID (NSXMLParser parser, NSString name, NSString systemID) + { + return invokeObjcSelf!(NSData, "parser:resolveExternalEntityName:systemID:", NSXMLParser, NSString, NSString)(parser, name, systemID); + } + + void parser (NSXMLParser parser, NSError parseError) + { + return invokeObjcSelf!(void, "parser:parseErrorOccurred:", NSXMLParser, NSError)(parser, parseError); + } + + void parser_validationErrorOccurred (NSXMLParser parser, NSError validationError) + { + return invokeObjcSelf!(void, "parser:validationErrorOccurred:", NSXMLParser, NSError)(parser, validationError); + } + + // D extensions + equals_t opEqual (Object object) + { + if (auto str = cast(NSObject) object) + return isEqual(str); + + return false; + } } Object NSAllocateObject (Class aClass, NSUInteger extraBytes, NSZone* zone) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSObjectScripting.d --- a/dstep/foundation/NSObjectScripting.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSObjectScripting.d Sun Jan 03 22:06:11 2010 +0100 @@ -8,16 +8,39 @@ import dstep.foundation.NSDictionary; import dstep.foundation.NSObject; -import dstep.foundation.NSScriptObjectSpecifier; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + +const TNSScripting = ` -template TNSScripting () -{ - Object scriptingValueForSpecifier (NSScriptObjectSpecifier objectSpecifier); - NSDictionary scriptingProperties (); - void setScriptingProperties (NSDictionary properties); - Object copyScriptingValue (Object value, NSString key, NSDictionary properties); - Object newScriptingObjectOfClass (Class objectClass, NSString key, Object contentsValue, NSDictionary properties); -} - + Object scriptingValueForSpecifier (NSScriptObjectSpecifier objectSpecifier) + { + return invokeObjcSelf!(Object, "scriptingValueForSpecifier:", NSScriptObjectSpecifier)(objectSpecifier); + } + + NSDictionary scriptingProperties () + { + return invokeObjcSelf!(NSDictionary, "scriptingProperties"); + } + + void setScriptingProperties (NSDictionary properties) + { + return invokeObjcSelf!(void, "setScriptingProperties:", NSDictionary)(properties); + } + + Object copyScriptingValue (Object value, NSString key, NSDictionary properties) + { + return invokeObjcSelf!(Object, "copyScriptingValue:forKey:withProperties:", Object, NSString, NSDictionary)(value, key, properties); + } + + Object newScriptingObjectOfClass (Class objectClass, NSString key, Object contentsValue, NSDictionary properties) + { + return invokeObjcSelf!(Object, "newScriptingObjectOfClass:forValueForKey:withContentsValue:properties:", Class, NSString, Object, NSDictionary)(objectClass, key, contentsValue, properties); + } + + //mixin ObjcBindMethod!(scriptingValueForSpecifier, "scriptingValueForSpecifier:"); + //mixin ObjcBindMethod!(scriptingProperties, "scriptingProperties"); + //mixin ObjcBindMethod!(setScriptingProperties, "setScriptingProperties:"); + //mixin ObjcBindMethod!(copyScriptingValue, "copyScriptingValue:forKey:withProperties:"); + //mixin ObjcBindMethod!(newScriptingObjectOfClass, "newScriptingObjectOfClass:forValueForKey:withContentsValue:properties:"); +`; \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSObject_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSObject_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,22 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Aug 13, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.foundation.NSObject_bindings; + +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSZone; +import dstep.objc.objc; + +extern (C): +package: + +id NSAllocateObject (Class aClass, NSUInteger extraBytes, NSZone* zone); +void NSDeallocateObject (id object); +id NSCopyObject (id object, NSUInteger extraBytes, NSZone* zone); +bool NSShouldRetainWithZone (id anObject, NSZone* requestedZone); +void NSIncrementExtraRefCount (id object); +bool NSDecrementExtraRefCountWasZero (id object); +NSUInteger NSExtraRefCount (id object); \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSOperation.d --- a/dstep/foundation/NSOperation.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSOperation.d Sun Jan 03 22:06:11 2010 +0100 @@ -7,17 +7,41 @@ module dstep.foundation.NSOperation; import dstep.foundation.NSArray; +import dstep.foundation.NSInvocation; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; import dstep.foundation.NSSet; +import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + import bindings = dstep.foundation.NSOperation_bindings; alias NSInteger NSOperationQueuePriority; -const NSString NSInvocationOperationVoidResultException; -const NSString NSInvocationOperationCancelledException; +private +{ + NSString NSInvocationOperationVoidResultException_; + NSString NSInvocationOperationCancelledException_; +} + +NSString NSInvocationOperationVoidResultException () +{ + if (NSInvocationOperationVoidResultException_) + return NSInvocationOperationVoidResultException_; + + return NSInvocationOperationVoidResultException_ = new NSString(bindings.NSInvocationOperationVoidResultException); +} + +NSString NSInvocationOperationCancelledException () +{ + if (NSInvocationOperationCancelledException_) + return NSInvocationOperationCancelledException_; + + return NSInvocationOperationCancelledException_ = new NSString(bindings.NSInvocationOperationCancelledException); +} enum { @@ -33,30 +57,18 @@ NSOperationQueueDefaultMaxConcurrentOperationCount = -1 } -static this () -{ - NSInvocationOperationVoidResultException = new NSString(bindings.NSInvocationOperationVoidResultException); - NSInvocationOperationCancelledException = new NSString(bindings.NSInvocationOperationCancelledException); -} - class NSOperation : NSObject { - mixin ObjcWrap; - - Object init () - { - return invokeObjcSelf!(Object, "init"); - } - + mixin (ObjcWrap); + this () { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "init")(objcObject); - - if (result) - objcObject = ret; - - dObject = this; + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); } void start () @@ -127,7 +139,17 @@ class NSOperationQueue : NSObject { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } void addOperation (NSOperation op) { @@ -172,7 +194,17 @@ class NSInvocationOperation : NSOperation { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } Object initWithTarget (Object target, SEL sel, Object arg) { @@ -181,13 +213,7 @@ this (Object target, SEL sel, Object arg) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithTarget:selector:object:", Object, SEL, Object)(objcObject, target, sel, arg); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithTarget(target, sel, arg); } Object initWithInvocation (NSInvocation inv) @@ -197,13 +223,7 @@ this (NSInvocation inv) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithInvocation:", NSInvocation)(objcObject, inv); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithInvocation(inv); } NSInvocation invocation () diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSOperation_bindings.d --- a/dstep/foundation/NSOperation_bindings.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSOperation_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -4,7 +4,9 @@ import dstep.foundation.NSObject; import dstep.foundation.NSSet; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + extern (C) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSPathUtilities.d --- a/dstep/foundation/NSPathUtilities.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSPathUtilities.d Sun Jan 03 22:06:11 2010 +0100 @@ -7,9 +7,12 @@ module dstep.foundation.NSPathUtilities; import dstep.foundation.NSArray; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + +import bindings = dstep.foundation.NSPathUtilities_bindings; alias NSUInteger NSSearchPathDirectory; alias NSUInteger NSSearchPathDomainMask; @@ -43,11 +46,11 @@ NSAllDomainsMask = 0x0ffff } -template TNSStringPathExtensions () -{ +const TNSStringPathExtensions = ` + static NSString pathWithComponents (NSArray components) { - return invokeObjcSelfClass!(NSString, "pathWithComponents:", NSArray)(components); + return invokeObjcSuperClass!(NSString, "pathWithComponents:", NSArray)(components); } NSArray pathComponents () @@ -129,15 +132,15 @@ { return invokeObjcSelf!(bool, "getFileSystemRepresentation:maxLength:", char*, NSUInteger)(cname, max); } -} +`; -template TNSArrayPathExtensions () -{ +const TNSArrayPathExtensions = ` + NSArray pathsMatchingExtensions (NSArray filterTypes) { return invokeObjcSelf!(NSArray, "pathsMatchingExtensions:", NSArray)(filterTypes); } -} +`; NSString NSUserName () { diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSPathUtilities_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSPathUtilities_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,22 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Aug 5, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.foundation.NSPathUtilities_bindings; + +import dstep.objc.objc; + + + +extern (C): +package: + +id NSUserName (); +id NSFullUserName (); +id NSHomeDirectory (); +id NSHomeDirectoryForUser (id userName); +id NSTemporaryDirectory (); +id NSOpenStepRootDirectory (); +id NSSearchPathForDirectoriesInDomains (uint directory, uint domainMask, bool expandTilde); \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSPointerArray.d --- a/dstep/foundation/NSPointerArray.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSPointerArray.d Sun Jan 03 22:06:11 2010 +0100 @@ -7,15 +7,46 @@ module dstep.foundation.NSPointerArray; import dstep.foundation.NSArray; +import dstep.foundation.NSCoder; +import dstep.foundation.NSEnumerator; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; import dstep.foundation.NSPointerFunctions; +import dstep.foundation.NSZone; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + +const TNSArrayConveniences = ` + + static Object pointerArrayWithStrongObjects () + { + return invokeObjcSuperClass!(Object, "pointerArrayWithStrongObjects"); + } + + static Object pointerArrayWithWeakObjects () + { + return invokeObjcSuperClass!(Object, "pointerArrayWithWeakObjects"); + } + + NSArray allObjects () + { + return invokeObjcSelf!(NSArray, "allObjects"); + } +`; class NSPointerArray : NSObject, INSFastEnumeration, INSCopying, INSCoding { - mixin ObjcWrap; - mixin TNSArrayConveniences; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } Object initWithOptions (uint options) { @@ -24,13 +55,7 @@ this (uint options) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithOptions:", uint)(objcObject, options); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithOptions(options); } Object initWithPointerFunctions (NSPointerFunctions functions) @@ -40,23 +65,17 @@ this (NSPointerFunctions functions) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithPointerFunctions:", NSPointerFunctions)(objcObject, functions); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithPointerFunctions(functions); } static Object pointerArrayWithOptions (uint options) { - return invokeObjcSelfClass!(Object, "pointerArrayWithOptions:", uint)(options); + return invokeObjcSuperClass!(Object, "pointerArrayWithOptions:", uint)(options); } static Object pointerArrayWithPointerFunctions (NSPointerFunctions functions) { - return invokeObjcSelfClass!(Object, "pointerArrayWithPointerFunctions:", NSPointerFunctions)(functions); + return invokeObjcSuperClass!(Object, "pointerArrayWithPointerFunctions:", NSPointerFunctions)(functions); } NSPointerFunctions pointerFunctions () @@ -126,31 +145,22 @@ this (NSCoder aDecoder) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithCoder(aDecoder); } -} - -template TNSArrayConveniences () -{ + + // TNSArrayConveniences static Object pointerArrayWithStrongObjects () { - return invokeObjcSelfClass!(Object, "pointerArrayWithStrongObjects"); + return invokeObjcSuperClass!(Object, "pointerArrayWithStrongObjects"); } - + static Object pointerArrayWithWeakObjects () { - return invokeObjcSelfClass!(Object, "pointerArrayWithWeakObjects"); + return invokeObjcSuperClass!(Object, "pointerArrayWithWeakObjects"); } - + NSArray allObjects () { return invokeObjcSelf!(NSArray, "allObjects"); } -} - +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSPointerFunctions.d --- a/dstep/foundation/NSPointerFunctions.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSPointerFunctions.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,9 +6,11 @@ */ module dstep.foundation.NSPointerFunctions; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; +import dstep.foundation.NSZone; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; alias NSUInteger NSPointerFunctionsOptions; @@ -30,8 +32,18 @@ class NSPointerFunctions : NSObject, INSCopying { - mixin ObjcWrap; + mixin (ObjcWrap); + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } + Object initWithOptions (uint options) { return invokeObjcSelf!(Object, "initWithOptions:", uint)(options); @@ -43,14 +55,14 @@ id result = Bridge.invokeObjcMethod!(id, "initWithOptions:", uint)(objcObject, options); if (result) - objcObject = ret; + objcObject = result; dObject = this; } static Object pointerFunctionsWithOptions (uint options) { - return invokeObjcSelfClass!(Object, "pointerFunctionsWithOptions:", uint)(options); + return invokeObjcSuperClass!(Object, "pointerFunctionsWithOptions:", uint)(options); } bool usesStrongWriteBarrier () @@ -58,9 +70,9 @@ return invokeObjcSelf!(bool, "usesStrongWriteBarrier"); } - void setUsesStrongWriteBarrier (bool ) + void setUsesStrongWriteBarrier (bool arg) { - return invokeObjcSelf!(void, "setUsesStrongWriteBarrier:", bool)(); + return invokeObjcSelf!(void, "setUsesStrongWriteBarrier:", bool)(arg); } bool usesWeakReadAndWriteBarriers () @@ -68,9 +80,9 @@ return invokeObjcSelf!(bool, "usesWeakReadAndWriteBarriers"); } - void setUsesWeakReadAndWriteBarriers (bool ) + void setUsesWeakReadAndWriteBarriers (bool arg) { - return invokeObjcSelf!(void, "setUsesWeakReadAndWriteBarriers:", bool)(); + return invokeObjcSelf!(void, "setUsesWeakReadAndWriteBarriers:", bool)(arg); } Object copyWithZone (NSZone* zone) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSPort.d --- a/dstep/foundation/NSPort.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSPort.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,21 +6,32 @@ */ module dstep.foundation.NSPort; +import dstep.foundation.NSArray; +import dstep.foundation.NSCoder; import dstep.foundation.NSConnection; import dstep.foundation.NSData; import dstep.foundation.NSDate; -import dstep.foundation.NSMutableArray; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; import dstep.foundation.NSPortMessage; import dstep.foundation.NSRunLoop; +import dstep.foundation.NSString; +import dstep.foundation.NSZone; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; - +import dstep.objc.objc; import bindings = dstep.foundation.NSPort_bindings; alias int NSSocketNativeHandle; -const NSString NSPortDidBecomeInvalidNotification; +private NSString NSPortDidBecomeInvalidNotification_; + +NSString NSPortDidBecomeInvalidNotification () +{ + if (NSPortDidBecomeInvalidNotification_) + return NSPortDidBecomeInvalidNotification_; + + return NSPortDidBecomeInvalidNotification_ = new NSString(bindings.NSPortDidBecomeInvalidNotification); +} enum { @@ -29,23 +40,48 @@ NSMachPortDeallocateReceiveRight = (1 << 1) } -static this () -{ - NSPortDidBecomeInvalidNotification = new NSString(bindings.NSPortDidBecomeInvalidNotification); -} +const TNSMachPortDelegateMethods = ` + + void handleMachMessage (void* msg) + { + return invokeObjcSelf!(void, "handleMachMessage:", void*)(msg); + } + + //mixin ObjcBindMethod!(handleMachMessage, "handleMachMessage:"); +`; + +const TNSPortDelegateMethods = ` + + void handlePortMessage (NSPortMessage message) + { + return invokeObjcSelf!(void, "handlePortMessage:", NSPortMessage)(message); + } + + //mixin ObjcBindMethod!(handlePortMessage, "handlePortMessage:"); +`; class NSPort : NSObject, INSCopying, INSCoding { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static Object allocWithZone (NSZone* zone) { - return invokeObjcSelfClass!(Object, "allocWithZone:", NSZone*)(zone); + return invokeObjcSuperClass!(Object, "allocWithZone:", NSZone*)(zone); } static NSPort port () { - return invokeObjcSelfClass!(NSPort, "port"); + return invokeObjcSuperClass!(NSPort, "port"); } void invalidate () @@ -120,34 +156,22 @@ this (NSCoder aDecoder) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithCoder(aDecoder); } } class NSSocketPort : NSPort { - mixin ObjcWrap; - - Object init () - { - return invokeObjcSelf!(Object, "init"); - } - + mixin (ObjcWrap); + this () { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "init")(objcObject); - - if (result) - objcObject = ret; - - dObject = this; + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); } Object initWithTCPPort (ushort port) @@ -157,13 +181,7 @@ this (ushort port) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithTCPPort:", ushort)(objcObject, port); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithTCPPort(port); } Object initWithProtocolFamily (int family, int type, int protocol, NSData address) @@ -173,13 +191,7 @@ this (int family, int type, int protocol, NSData address) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithProtocolFamily:socketType:protocol:address:", int, int, int, NSData)(objcObject, family, type, protocol, address); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithProtocolFamily(family, type, protocol, address); } Object initWithProtocolFamily (int family, int type, int protocol, int sock) @@ -189,13 +201,7 @@ this (int family, int type, int protocol, int sock) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithProtocolFamily:socketType:protocol:socket:", int, int, int, int)(objcObject, family, type, protocol, sock); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithProtocolFamily(family, type, protocol, sock); } Object initRemoteWithTCPPort (ushort port, NSString hostName) @@ -205,13 +211,7 @@ this (ushort port, NSString hostName) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initRemoteWithTCPPort:host:", ushort, NSString)(objcObject, port, hostName); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initRemoteWithTCPPort(port, hostName); } Object initRemoteWithProtocolFamily (int family, int type, int protocol, NSData address) @@ -219,17 +219,6 @@ return invokeObjcSelf!(Object, "initRemoteWithProtocolFamily:socketType:protocol:address:", int, int, int, NSData)(family, type, protocol, address); } - this (int family, int type, int protocol, NSData address) - { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initRemoteWithProtocolFamily:socketType:protocol:address:", int, int, int, NSData)(objcObject, family, type, protocol, address); - - if (result) - objcObject = ret; - - dObject = this; - } - int protocolFamily () { return invokeObjcSelf!(int, "protocolFamily"); @@ -258,11 +247,21 @@ class NSMachPort : NSPort { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static NSPort portWithMachPort (uint machPort) { - return invokeObjcSelfClass!(NSPort, "portWithMachPort:", uint)(machPort); + return invokeObjcSuperClass!(NSPort, "portWithMachPort:", uint)(machPort); } Object initWithMachPort (uint machPort) @@ -272,18 +271,12 @@ this (uint machPort) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithMachPort:", uint)(objcObject, machPort); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithMachPort(machPort); } static NSPort portWithMachPort (uint machPort, NSUInteger f) { - return invokeObjcSelfClass!(NSPort, "portWithMachPort:options:", uint, NSUInteger)(machPort, f); + return invokeObjcSuperClass!(NSPort, "portWithMachPort:options:", uint, NSUInteger)(machPort, f); } Object initWithMachPort (uint machPort, NSUInteger f) @@ -293,13 +286,7 @@ this (uint machPort, NSUInteger f) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithMachPort:options:", uint, NSUInteger)(objcObject, machPort, f); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithMachPort(machPort, f); } uint machPort () @@ -316,15 +303,4 @@ { return invokeObjcSelf!(void, "removeFromRunLoop:forMode:", NSRunLoop, NSString)(runLoop, mode); } -} - -template TNSMachPortDelegateMethods () -{ - void handleMachMessage (void* msg); -} - -template TNSPortDelegateMethods () -{ - void handlePortMessage (NSPortMessage message); -} - +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSPortCoder.d --- a/dstep/foundation/NSPortCoder.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSPortCoder.d Sun Jan 03 22:06:11 2010 +0100 @@ -11,11 +11,37 @@ import dstep.foundation.NSConnection; import dstep.foundation.NSPort; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + +const TNSDistributedObjects = ` + + Class classForPortCoder () + { + return invokeObjcSelf!(Class, "classForPortCoder"); + } + + Object replacementObjectForPortCoder (NSPortCoder coder) + { + return invokeObjcSelf!(Object, "replacementObjectForPortCoder:", NSPortCoder)(coder); + } + + //mixin ObjcBindMethod!(classForPortCoder, "classForPortCoder"); + //mixin ObjcBindMethod!(replacementObjectForPortCoder, "replacementObjectForPortCoder:"); +`; class NSPortCoder : NSCoder { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } bool isBycopy () { @@ -44,7 +70,7 @@ static Object portCoderWithReceivePort (NSPort rcvPort, NSPort sndPort, NSArray comps) { - return invokeObjcSelfClass!(Object, "portCoderWithReceivePort:sendPort:components:", NSPort, NSPort, NSArray)(rcvPort, sndPort, comps); + return invokeObjcSuperClass!(Object, "portCoderWithReceivePort:sendPort:components:", NSPort, NSPort, NSArray)(rcvPort, sndPort, comps); } Object initWithReceivePort (NSPort rcvPort, NSPort sndPort, NSArray comps) @@ -54,24 +80,11 @@ this (NSPort rcvPort, NSPort sndPort, NSArray comps) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithReceivePort:sendPort:components:", NSPort, NSPort, NSArray)(objcObject, rcvPort, sndPort, comps); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithReceivePort(rcvPort, sndPort, comps); } void dispatch () { return invokeObjcSelf!(void, "dispatch"); } -} - -template TNSDistributedObjects () -{ - Class classForPortCoder (); - Object replacementObjectForPortCoder (NSPortCoder coder); -} - +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSPortMessage.d --- a/dstep/foundation/NSPortMessage.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSPortMessage.d Sun Jan 03 22:06:11 2010 +0100 @@ -8,15 +8,24 @@ import dstep.foundation.NSArray; import dstep.foundation.NSDate; -import dstep.foundation.NSMutableArray; import dstep.foundation.NSObject; import dstep.foundation.NSPort; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; class NSPortMessage : NSObject { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } Object initWithSendPort (NSPort sendPort, NSPort replyPort, NSArray components) { @@ -25,13 +34,7 @@ this (NSPort sendPort, NSPort replyPort, NSArray components) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithSendPort:receivePort:components:", NSPort, NSPort, NSArray)(objcObject, sendPort, replyPort, components); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithSendPort(sendPort, replyPort, components); } NSArray components () diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSPortNameServer.d --- a/dstep/foundation/NSPortNameServer.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSPortNameServer.d Sun Jan 03 22:06:11 2010 +0100 @@ -10,15 +10,25 @@ import dstep.foundation.NSPort; import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; class NSPortNameServer : NSObject { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static NSPortNameServer systemDefaultPortNameServer () { - return invokeObjcSelfClass!(NSPortNameServer, "systemDefaultPortNameServer"); + return invokeObjcSuperClass!(NSPortNameServer, "systemDefaultPortNameServer"); } NSPort portForName (NSString name) @@ -44,11 +54,21 @@ class NSMachBootstrapServer : NSPortNameServer { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static Object sharedInstance () { - return invokeObjcSelfClass!(Object, "sharedInstance"); + return invokeObjcSuperClass!(Object, "sharedInstance"); } NSPort portForName (NSString name) @@ -74,11 +94,21 @@ class NSSocketPortNameServer : NSPortNameServer { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static Object sharedInstance () { - return invokeObjcSelfClass!(Object, "sharedInstance"); + return invokeObjcSuperClass!(Object, "sharedInstance"); } NSPort portForName (NSString name) @@ -124,11 +154,21 @@ class NSMessagePortNameServer : NSPortNameServer { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static Object sharedInstance () { - return invokeObjcSelfClass!(Object, "sharedInstance"); + return invokeObjcSuperClass!(Object, "sharedInstance"); } NSPort portForName (NSString name) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSPort_bindings.d --- a/dstep/foundation/NSPort_bindings.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSPort_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -1,14 +1,8 @@ module dstep.foundation.NSPort_bindings; -import dstep.foundation.NSConnection; -import dstep.foundation.NSData; -import dstep.foundation.NSDate; -import dstep.foundation.NSMutableArray; -import dstep.foundation.NSObject; -import dstep.foundation.NSPortMessage; -import dstep.foundation.NSRunLoop; -import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + extern (C) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSPredicate.d --- a/dstep/foundation/NSPredicate.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSPredicate.d Sun Jan 03 22:06:11 2010 +0100 @@ -7,33 +7,56 @@ module dstep.foundation.NSPredicate; import dstep.foundation.NSArray; +import dstep.foundation.NSCoder; +import dstep.foundation.NSDictionary; import dstep.foundation.NSObject; import dstep.foundation.NSSet; +import dstep.foundation.NSString; +import dstep.foundation.NSZone; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + +const TNSPredicateSupport = ` + + void filterUsingPredicate (NSPredicate predicate) + { + return invokeObjcSelf!(void, "filterUsingPredicate:", NSPredicate)(predicate); + } +`; class NSPredicate : NSObject, INSCoding, INSCopying { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static NSPredicate predicateWithFormat (NSString predicateFormat, NSArray arguments) { - return invokeObjcSelfClass!(NSPredicate, "predicateWithFormat:argumentArray:", NSString, NSArray)(predicateFormat, arguments); + return invokeObjcSuperClass!(NSPredicate, "predicateWithFormat:argumentArray:", NSString, NSArray)(predicateFormat, arguments); } static NSPredicate predicateWithFormat (NSString predicateWithFormat, ...) { - return invokeObjcSelfClass!(NSPredicate, "predicateWithFormat:", NSString)(predicateWithFormat); + return invokeObjcSuperClass!(NSPredicate, "predicateWithFormat:", NSString)(predicateWithFormat); } static NSPredicate predicateWithFormat (NSString predicateFormat, char* argList) { - return invokeObjcSelfClass!(NSPredicate, "predicateWithFormat:arguments:", NSString, char*)(predicateFormat, argList); + return invokeObjcSuperClass!(NSPredicate, "predicateWithFormat:arguments:", NSString, char*)(predicateFormat, argList); } static NSPredicate predicateWithValue (bool value) { - return invokeObjcSelfClass!(NSPredicate, "predicateWithValue:", bool)(value); + return invokeObjcSuperClass!(NSPredicate, "predicateWithValue:", bool)(value); } NSString predicateFormat () @@ -69,26 +92,11 @@ this (NSCoder aDecoder) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithCoder(aDecoder); } Object copyWithZone (NSZone* zone) { return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); } -} - -template TNSPredicateSupport () -{ - void filterUsingPredicate (NSPredicate predicate) - { - return invokeObjcSelf!(void, "filterUsingPredicate:", NSPredicate)(predicate); - } -} - +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSProcessInfo.d --- a/dstep/foundation/NSProcessInfo.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSProcessInfo.d Sun Jan 03 22:06:11 2010 +0100 @@ -8,10 +8,11 @@ import dstep.foundation.NSArray; import dstep.foundation.NSDictionary; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; enum { @@ -26,11 +27,21 @@ class NSProcessInfo : NSObject { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static NSProcessInfo processInfo () { - return invokeObjcSelfClass!(NSProcessInfo, "processInfo"); + return invokeObjcSuperClass!(NSProcessInfo, "processInfo"); } NSDictionary environment () diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSPropertyList.d --- a/dstep/foundation/NSPropertyList.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSPropertyList.d Sun Jan 03 22:06:11 2010 +0100 @@ -8,10 +8,11 @@ import dstep.corefoundation.CFPropertyList; import dstep.foundation.NSData; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; alias NSUInteger NSPropertyListMutabilityOptions; alias NSUInteger NSPropertyListFormat; @@ -32,21 +33,31 @@ class NSPropertyListSerialization : NSObject { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static bool propertyList (Object plist, uint format) { - return invokeObjcSelfClass!(bool, "propertyList:isValidForFormat:", Object, uint)(plist, format); + return invokeObjcSuperClass!(bool, "propertyList:isValidForFormat:", Object, uint)(plist, format); } static NSData dataFromPropertyList (Object plist, uint format, NSString** errorString) { - return invokeObjcSelfClass!(NSData, "dataFromPropertyList:format:errorDescription:", Object, uint, NSString**)(plist, format, errorString); + return invokeObjcSuperClass!(NSData, "dataFromPropertyList:format:errorDescription:", Object, uint, NSString**)(plist, format, errorString); } static Object propertyListFromData (NSData data, uint opt, NSPropertyListFormat* format, NSString** errorString) { - return invokeObjcSelfClass!(Object, "propertyListFromData:mutabilityOption:format:errorDescription:", NSData, uint, NSPropertyListFormat*, NSString**)(data, opt, format, errorString); + return invokeObjcSuperClass!(Object, "propertyListFromData:mutabilityOption:format:errorDescription:", NSData, uint, NSPropertyListFormat*, NSString**)(data, opt, format, errorString); } } diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSProtocolChecker.d --- a/dstep/foundation/NSProtocolChecker.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSProtocolChecker.d Sun Jan 03 22:06:11 2010 +0100 @@ -9,12 +9,42 @@ import dstep.foundation.NSObject; import dstep.foundation.NSProxy; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + +import dstep.objc.runtime; + +const TNSProtocolCheckerCreation = ` + + static Object protocolCheckerWithTarget (NSObject anObject, Protocol aProtocol) + { + return invokeObjcSuperClass!(Object, "protocolCheckerWithTarget:protocol:", NSObject, Protocol)(anObject, aProtocol); + } + + Object initWithTarget (NSObject anObject, Protocol aProtocol) + { + return invokeObjcSelf!(Object, "initWithTarget:protocol:", NSObject, Protocol)(anObject, aProtocol); + } + + this (NSObject anObject, Protocol aProtocol) + { + typeof(this).alloc.initWithTarget(anObject, aProtocol); + } +`; class NSProtocolChecker : NSProxy { - mixin ObjcWrap; - mixin TNSProtocolCheckerCreation; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } Protocol protocol () { @@ -25,29 +55,20 @@ { return invokeObjcSelf!(NSObject, "target"); } -} - -template TNSProtocolCheckerCreation () -{ + + // TNSProtocolCheckerCreation static Object protocolCheckerWithTarget (NSObject anObject, Protocol aProtocol) { - return invokeObjcSelfClass!(Object, "protocolCheckerWithTarget:protocol:", NSObject, Protocol)(anObject, aProtocol); + return invokeObjcSuperClass!(Object, "protocolCheckerWithTarget:protocol:", NSObject, Protocol)(anObject, aProtocol); } - + Object initWithTarget (NSObject anObject, Protocol aProtocol) { return invokeObjcSelf!(Object, "initWithTarget:protocol:", NSObject, Protocol)(anObject, aProtocol); } - + this (NSObject anObject, Protocol aProtocol) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithTarget:protocol:", NSObject, Protocol)(objcObject, anObject, aProtocol); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithTarget(anObject, aProtocol); } -} - +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSProxy.d --- a/dstep/foundation/NSProxy.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSProxy.d Sun Jan 03 22:06:11 2010 +0100 @@ -8,27 +8,37 @@ import dstep.foundation.NSInvocation; import dstep.foundation.NSMethodSignature; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSZone; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.bridge.Wrapper; +import dstep.objc.objc; +import dstep.objc.runtime; -class NSProxy : INSObject +class NSProxy : ObjcWrapper, INSObject { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } - static Object alloc () + typeof(this) init () { - return invokeObjcSelfClass!(Object, "alloc"); + return invokeObjcSelf!(typeof(this), "init"); } static Object allocWithZone (NSZone* zone) { - return invokeObjcSelfClass!(Object, "allocWithZone:", NSZone*)(zone); + return invokeObjcSuperClass!(Object, "allocWithZone:", NSZone*)(zone); } - static Class class_ () + static Class class_static () { - return invokeObjcSelfClass!(Class, "class"); + return invokeObjcSuperClass!(Class, "class"); } void forwardInvocation (NSInvocation invocation) @@ -58,7 +68,7 @@ static bool respondsToSelector (SEL aSelector) { - return invokeObjcSelfClass!(bool, "respondsToSelector:", SEL)(aSelector); + return invokeObjcSuperClass!(bool, "respondsToSelector:", SEL)(aSelector); } bool isEqual (Object object) @@ -150,10 +160,5 @@ { return invokeObjcSelf!(NSUInteger, "retainCount"); } - - NSString description () - { - return invokeObjcSelf!(NSString, "description"); - } } diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSRange.d --- a/dstep/foundation/NSRange.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSRange.d Sun Jan 03 22:06:11 2010 +0100 @@ -10,7 +10,8 @@ import dstep.foundation.NSString; import dstep.foundation.NSValue; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; +import bindings = dstep.foundation.NSRange_bindings; alias NSRange* NSRangePointer; @@ -20,18 +21,18 @@ NSUInteger length; } -template TNSValueRangeExtensions () -{ +const TNSValueRangeExtensions = ` + static NSValue valueWithRange (NSRange range) { - return invokeObjcSelfClass!(NSValue, "valueWithRange:", NSRange)(range); + return invokeObjcSuperClass!(NSValue, "valueWithRange:", NSRange)(range); } NSRange rangeValue () { return invokeObjcSelf!(NSRange, "rangeValue"); } -} +`; NSString NSStringFromRange (NSRange range) { diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSRange_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSRange_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,16 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Aug 20, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.foundation.NSRange_bindings; + +import dstep.foundation.NSRange; +import dstep.objc.objc; + +extern (C): +package: + +id NSStringFromRange (NSRange range); +NSRange NSRangeFromString (id aString); \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSRunLoop.d --- a/dstep/foundation/NSRunLoop.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSRunLoop.d Sun Jan 03 22:06:11 2010 +0100 @@ -9,37 +9,129 @@ import dstep.corefoundation.CFRunLoop; import dstep.foundation.NSArray; import dstep.foundation.NSDate; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; import dstep.foundation.NSPort; +import dstep.foundation.NSString; import dstep.foundation.NSTimer; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; import bindings = dstep.foundation.NSRunLoop_bindings; -const NSString NSDefaultRunLoopMode; -const NSString NSRunLoopCommonModes; +private +{ + NSString NSDefaultRunLoopMode_; + NSString NSRunLoopCommonModes_; +} + +NSString NSDefaultRunLoopMode () +{ + if (NSDefaultRunLoopMode_) + return NSDefaultRunLoopMode_; + + return NSDefaultRunLoopMode_ = new NSString(bindings.NSDefaultRunLoopMode); +} + +NSString NSRunLoopCommonModes () +{ + if (NSRunLoopCommonModes_) + return NSRunLoopCommonModes_; + + return NSRunLoopCommonModes_ = new NSString(bindings.NSRunLoopCommonModes); +} + +const TNSOrderedPerform = ` + + void performSelector (SEL aSelector, Object target, Object arg, NSUInteger order, NSArray modes) + { + return invokeObjcSelf!(void, "performSelector:target:argument:order:modes:", SEL, Object, Object, NSUInteger, NSArray)(aSelector, target, arg, order, modes); + } + + void cancelPerformSelector (SEL aSelector, Object target, Object arg) + { + return invokeObjcSelf!(void, "cancelPerformSelector:target:argument:", SEL, Object, Object)(aSelector, target, arg); + } + + void cancelPerformSelectorsWithTarget (Object target) + { + return invokeObjcSelf!(void, "cancelPerformSelectorsWithTarget:", Object)(target); + } +`; + +const TNSDelayedPerforming = ` -static this () -{ - NSDefaultRunLoopMode = new NSString(bindings.NSDefaultRunLoopMode); - NSRunLoopCommonModes = new NSString(bindings.NSRunLoopCommonModes); -} + void performSelector (SEL aSelector, Object anArgument, double delay, NSArray modes) + { + return invokeObjcSelf!(void, "performSelector:withObject:afterDelay:inModes:", SEL, Object, double, NSArray)(aSelector, anArgument, delay, modes); + } + + void performSelector (SEL aSelector, Object anArgument, double delay) + { + return invokeObjcSelf!(void, "performSelector:withObject:afterDelay:", SEL, Object, double)(aSelector, anArgument, delay); + } + + static void cancelPreviousPerformRequestsWithTarget (Object aTarget, SEL aSelector, Object anArgument) + { + return invokeObjcSelfClass!(void, "cancelPreviousPerformRequestsWithTarget:selector:object:", Object, SEL, Object)(aTarget, aSelector, anArgument); + } + + static void cancelPreviousPerformRequestsWithTarget (Object aTarget) + { + return invokeObjcSelfClass!(void, "cancelPreviousPerformRequestsWithTarget:", Object)(aTarget); + } + + //mixin ObjcBindMethod!(performSelector, void, "performSelector:withObject:afterDelay:inModes:", SEL, Object, double, NSArray); + //mixin ObjcBindMethod!(performSelector, void, "performSelector:withObject:afterDelay:", SEL, Object, double); + //mixin ObjcBindClassMethod!(cancelPreviousPerformRequestsWithTarget, "cancelPreviousPerformRequestsWithTarget:selector:object:"); + //mixin ObjcBindClassMethod!(cancelPreviousPerformRequestsWithTarget, "cancelPreviousPerformRequestsWithTarget:"); +`; + +const TNSRunLoopConveniences = ` + + void run () + { + return invokeObjcSelf!(void, "run"); + } + + void runUntilDate (NSDate limitDate) + { + return invokeObjcSelf!(void, "runUntilDate:", NSDate)(limitDate); + } + + bool runMode (NSString mode, NSDate limitDate) + { + return invokeObjcSelf!(bool, "runMode:beforeDate:", NSString, NSDate)(mode, limitDate); + } + + void configureAsServer () + { + return invokeObjcSelf!(void, "configureAsServer"); + } +`; class NSRunLoop : NSObject { - mixin ObjcWrap; - mixin TNSOrderedPerform; - mixin TNSRunLoopConveniences; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static NSRunLoop currentRunLoop () { - return invokeObjcSelfClass!(NSRunLoop, "currentRunLoop"); + return invokeObjcSuperClass!(NSRunLoop, "currentRunLoop"); } static NSRunLoop mainRunLoop () { - return invokeObjcSelfClass!(NSRunLoop, "mainRunLoop"); + return invokeObjcSuperClass!(NSRunLoop, "mainRunLoop"); } NSString currentMode () @@ -76,54 +168,41 @@ { return invokeObjcSelf!(void, "acceptInputForMode:beforeDate:", NSString, NSDate)(mode, limitDate); } -} - -template TNSOrderedPerform () -{ + + // TNSOrderedPerform void performSelector (SEL aSelector, Object target, Object arg, NSUInteger order, NSArray modes) { return invokeObjcSelf!(void, "performSelector:target:argument:order:modes:", SEL, Object, Object, NSUInteger, NSArray)(aSelector, target, arg, order, modes); } - + void cancelPerformSelector (SEL aSelector, Object target, Object arg) { return invokeObjcSelf!(void, "cancelPerformSelector:target:argument:", SEL, Object, Object)(aSelector, target, arg); } - + void cancelPerformSelectorsWithTarget (Object target) { return invokeObjcSelf!(void, "cancelPerformSelectorsWithTarget:", Object)(target); } -} - -template TNSDelayedPerforming () -{ - void performSelector (SEL aSelector, Object anArgument, double delay, NSArray modes); - void performSelector (SEL aSelector, Object anArgument, double delay); - static void cancelPreviousPerformRequestsWithTarget (Object aTarget, SEL aSelector, Object anArgument); - static void cancelPreviousPerformRequestsWithTarget (Object aTarget); -} - -template TNSRunLoopConveniences () -{ + + // TNSRunLoopConveniences void run () { return invokeObjcSelf!(void, "run"); } - + void runUntilDate (NSDate limitDate) { return invokeObjcSelf!(void, "runUntilDate:", NSDate)(limitDate); } - + bool runMode (NSString mode, NSDate limitDate) { return invokeObjcSelf!(bool, "runMode:beforeDate:", NSString, NSDate)(mode, limitDate); } - + void configureAsServer () { return invokeObjcSelf!(void, "configureAsServer"); } -} - +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSRunLoop_bindings.d --- a/dstep/foundation/NSRunLoop_bindings.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSRunLoop_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -7,7 +7,9 @@ import dstep.foundation.NSPort; import dstep.foundation.NSTimer; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + extern (C) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSScanner.d --- a/dstep/foundation/NSScanner.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSScanner.d Sun Jan 03 22:06:11 2010 +0100 @@ -7,17 +7,178 @@ module dstep.foundation.NSScanner; import dstep.foundation.NSCharacterSet; +import dstep.foundation.NSDecimal; +import dstep.foundation.NSDecimalNumber; import dstep.foundation.NSDictionary; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; import dstep.foundation.NSString; +import dstep.foundation.NSZone; +import dstep.internal.Version; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + +const TNSExtendedScanner = ` + + NSCharacterSet charactersToBeSkipped () + { + return invokeObjcSelf!(NSCharacterSet, "charactersToBeSkipped"); + } + + bool caseSensitive () + { + return invokeObjcSelf!(bool, "caseSensitive"); + } + + Object locale () + { + return invokeObjcSelf!(Object, "locale"); + } + + bool scanInt (int* value) + { + return invokeObjcSelf!(bool, "scanInt:", int*)(value); + } + + bool scanInteger (NSInteger* value) + { + return invokeObjcSelf!(bool, "scanInteger:", NSInteger*)(value); + } + + bool scanHexLongLong (ulong* result) + { + return invokeObjcSelf!(bool, "scanHexLongLong:", ulong*)(result); + } + + bool scanHexFloat (float* result) + { + return invokeObjcSelf!(bool, "scanHexFloat:", float*)(result); + } + + bool scanHexDouble (double* result) + { + return invokeObjcSelf!(bool, "scanHexDouble:", double*)(result); + } + + bool scanHexInt (uint* value) + { + return invokeObjcSelf!(bool, "scanHexInt:", uint*)(value); + } + + bool scanLongLong (long* value) + { + return invokeObjcSelf!(bool, "scanLongLong:", long*)(value); + } + + bool scanFloat (float* value) + { + return invokeObjcSelf!(bool, "scanFloat:", float*)(value); + } + + bool scanDouble (double* value) + { + return invokeObjcSelf!(bool, "scanDouble:", double*)(value); + } + + bool scanString (NSString string, ref NSString value) + { + id val; + + if (value) + val = new objc_object; + + bool result = invokeObjcSelf!(bool, "scanString:intoString:", NSString, id*)(string, &val); + + if (val) + value = new NSString(val); + + return result; + } + + bool scanCharactersFromSet (NSCharacterSet set, ref NSString value) + { + id val; + + if (value) + val = new objc_object; + + bool result = invokeObjcSelf!(bool, "scanCharactersFromSet:intoString:", NSCharacterSet, id*)(set, &val); + + if (val) + value = new NSString(val); + + return result; + } + + bool scanUpToString (NSString string, ref NSString value) + { + id val; + + if (value) + val = new objc_object; + + bool result = invokeObjcSelf!(bool, "scanUpToString:intoString:", NSString, id*)(string, &val); + + if (val) + value = new NSString(val); + + return result; + } + + bool scanUpToCharactersFromSet (NSCharacterSet set, ref NSString value) + { + id val; + + if (value) + val = new objc_object; + + bool result = invokeObjcSelf!(bool, "scanUpToCharactersFromSet:intoString:", NSCharacterSet, id*)(set, &val); + + if (val) + value = new NSString(val); + + return result; + } + + bool isAtEnd () + { + return invokeObjcSelf!(bool, "isAtEnd"); + } + + Object initWithString (NSString string) + { + return invokeObjcSelf!(Object, "initWithString:", NSString)(string); + } + + this (NSString string) + { + typeof(this).alloc.initWithString(string); + } + + static Object scannerWithString (NSString string) + { + return invokeObjcSuperClass!(Object, "scannerWithString:", NSString)(string); + } + + static Object localizedScannerWithString (NSString string) + { + return invokeObjcSuperClass!(Object, "localizedScannerWithString:", NSString)(string); + } +`; class NSScanner : NSObject, INSCopying { - mixin ObjcWrap; - mixin TNSDecimalNumberScanning; - mixin TNSExtendedScanner; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } NSString string () { @@ -53,119 +214,156 @@ { return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); } -} - -template TNSExtendedScanner () -{ + + // TNSDecimalNumberScanning + bool scanDecimal (NSDecimal* dcm) + { + return invokeObjcSelf!(bool, "scanDecimal:", NSDecimal*)(dcm); + } + + // TNSExtendedScanner NSCharacterSet charactersToBeSkipped () { return invokeObjcSelf!(NSCharacterSet, "charactersToBeSkipped"); } - + bool caseSensitive () { return invokeObjcSelf!(bool, "caseSensitive"); } - + Object locale () { return invokeObjcSelf!(Object, "locale"); } - + bool scanInt (int* value) { return invokeObjcSelf!(bool, "scanInt:", int*)(value); } - + bool scanInteger (NSInteger* value) { return invokeObjcSelf!(bool, "scanInteger:", NSInteger*)(value); } - - bool scanHexLongLong (unsigned long long* result) + + bool scanHexLongLong (ulong* result) { - return invokeObjcSelf!(bool, "scanHexLongLong:", unsigned long long*)(result); + return invokeObjcSelf!(bool, "scanHexLongLong:", ulong*)(result); } - + bool scanHexFloat (float* result) { return invokeObjcSelf!(bool, "scanHexFloat:", float*)(result); } - + bool scanHexDouble (double* result) { return invokeObjcSelf!(bool, "scanHexDouble:", double*)(result); } - - bool scanHexInt (unsigned* value) + + bool scanHexInt (uint* value) { - return invokeObjcSelf!(bool, "scanHexInt:", unsigned*)(value); + return invokeObjcSelf!(bool, "scanHexInt:", uint*)(value); } - - bool scanLongLong (long long* value) + + bool scanLongLong (long* value) { - return invokeObjcSelf!(bool, "scanLongLong:", long long*)(value); + return invokeObjcSelf!(bool, "scanLongLong:", long*)(value); } - + bool scanFloat (float* value) { return invokeObjcSelf!(bool, "scanFloat:", float*)(value); } - + bool scanDouble (double* value) { return invokeObjcSelf!(bool, "scanDouble:", double*)(value); } - - bool scanString (NSString string, NSString** value) + + bool scanString (NSString string, ref NSString value) { - return invokeObjcSelf!(bool, "scanString:intoString:", NSString, NSString**)(string, value); + id val; + + if (value) + val = new objc_object; + + bool result = invokeObjcSelf!(bool, "scanString:intoString:", NSString, id*)(string, &val); + + if (val) + value = new NSString(val); + + return result; } - - bool scanCharactersFromSet (NSCharacterSet set, NSString** value) + + bool scanCharactersFromSet (NSCharacterSet set, ref NSString value) { - return invokeObjcSelf!(bool, "scanCharactersFromSet:intoString:", NSCharacterSet, NSString**)(set, value); + id val; + + if (value) + val = new objc_object; + + bool result = invokeObjcSelf!(bool, "scanCharactersFromSet:intoString:", NSCharacterSet, id*)(set, &val); + + if (val) + value = new NSString(val); + + return result; } - - bool scanUpToString (NSString string, NSString** value) + + bool scanUpToString (NSString string, ref NSString value) { - return invokeObjcSelf!(bool, "scanUpToString:intoString:", NSString, NSString**)(string, value); + id val; + + if (value) + val = new objc_object; + + bool result = invokeObjcSelf!(bool, "scanUpToString:intoString:", NSString, id*)(string, &val); + + if (val) + value = new NSString(val); + + return result; } - - bool scanUpToCharactersFromSet (NSCharacterSet set, NSString** value) + + bool scanUpToCharactersFromSet (NSCharacterSet set, ref NSString value) { - return invokeObjcSelf!(bool, "scanUpToCharactersFromSet:intoString:", NSCharacterSet, NSString**)(set, value); + id val; + + if (value) + val = new objc_object; + + bool result = invokeObjcSelf!(bool, "scanUpToCharactersFromSet:intoString:", NSCharacterSet, id*)(set, &val); + + if (val) + value = new NSString(val); + + return result; } - + bool isAtEnd () { return invokeObjcSelf!(bool, "isAtEnd"); } - + Object initWithString (NSString string) { return invokeObjcSelf!(Object, "initWithString:", NSString)(string); } - + this (NSString string) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithString:", NSString)(objcObject, string); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithString(string); } - + static Object scannerWithString (NSString string) { - return invokeObjcSelfClass!(Object, "scannerWithString:", NSString)(string); + return invokeObjcSuperClass!(Object, "scannerWithString:", NSString)(string); } - + static Object localizedScannerWithString (NSString string) { - return invokeObjcSelfClass!(Object, "localizedScannerWithString:", NSString)(string); + return invokeObjcSuperClass!(Object, "localizedScannerWithString:", NSString)(string); } -} - +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSScriptClassDescription.d --- a/dstep/foundation/NSScriptClassDescription.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSScriptClassDescription.d Sun Jan 03 22:06:11 2010 +0100 @@ -7,17 +7,29 @@ module dstep.foundation.NSScriptClassDescription; import dstep.foundation.NSClassDescription; +import dstep.foundation.NSDictionary; import dstep.foundation.NSScriptCommandDescription; +import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; class NSScriptClassDescription : NSClassDescription { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static NSScriptClassDescription classDescriptionForClass (Class aClass) { - return invokeObjcSelfClass!(NSScriptClassDescription, "classDescriptionForClass:", Class)(aClass); + return invokeObjcSuperClass!(NSScriptClassDescription, "classDescriptionForClass:", Class)(aClass); } Object initWithSuiteName (NSString suiteName, NSString className, NSDictionary classDeclaration) @@ -27,13 +39,7 @@ this (NSString suiteName, NSString className, NSDictionary classDeclaration) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithSuiteName:className:dictionary:", NSString, NSString, NSDictionary)(objcObject, suiteName, className, classDeclaration); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithSuiteName(suiteName, className, classDeclaration); } NSString suiteName () @@ -129,9 +135,18 @@ } } -template TNSScriptClassDescription () -{ - uint classCode (); - NSString className (); -} +const TNSScriptClassDescription = ` + uint classCode () + { + return invokeObjcSelf!(uint, "classCode"); + } + + NSString className () + { + return invokeObjcSelf!(NSString, "className"); + } + + //mixin ObjcBindMethod!(classCode, "classCode"); + //mixin ObjcBindMethod!(className, "className"); +`; \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSScriptCoercionHandler.d --- a/dstep/foundation/NSScriptCoercionHandler.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSScriptCoercionHandler.d Sun Jan 03 22:06:11 2010 +0100 @@ -8,15 +8,25 @@ import dstep.foundation.NSObject; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; class NSScriptCoercionHandler : NSObject { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static NSScriptCoercionHandler sharedCoercionHandler () { - return invokeObjcSelfClass!(NSScriptCoercionHandler, "sharedCoercionHandler"); + return invokeObjcSuperClass!(NSScriptCoercionHandler, "sharedCoercionHandler"); } Object coerceValue (Object value, Class toClass) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSScriptCommand.d --- a/dstep/foundation/NSScriptCommand.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSScriptCommand.d Sun Jan 03 22:06:11 2010 +0100 @@ -7,14 +7,14 @@ module dstep.foundation.NSScriptCommand; import dstep.foundation.NSAppleEventDescriptor; +import dstep.foundation.NSCoder; import dstep.foundation.NSDictionary; -import dstep.foundation.NSMutableDictionary; import dstep.foundation.NSObject; import dstep.foundation.NSScriptCommandDescription; -import dstep.foundation.NSScriptObjectSpecifier; +import dstep.foundation.NSScriptObjectSpecifiers; import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; enum { @@ -33,7 +33,17 @@ class NSScriptCommand : NSObject, INSCoding { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } Object initWithCommandDescription (NSScriptCommandDescription commandDef) { @@ -42,13 +52,7 @@ this (NSScriptCommandDescription commandDef) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCommandDescription:", NSScriptCommandDescription)(objcObject, commandDef); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithCommandDescription(commandDef); } NSScriptCommandDescription commandDescription () @@ -153,7 +157,7 @@ static NSScriptCommand currentCommand () { - return invokeObjcSelfClass!(NSScriptCommand, "currentCommand"); + return invokeObjcSuperClass!(NSScriptCommand, "currentCommand"); } NSAppleEventDescriptor appleEvent () @@ -183,13 +187,7 @@ this (NSCoder aDecoder) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithCoder(aDecoder); } } diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSScriptCommandDescription.d --- a/dstep/foundation/NSScriptCommandDescription.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSScriptCommandDescription.d Sun Jan 03 22:06:11 2010 +0100 @@ -7,17 +7,29 @@ module dstep.foundation.NSScriptCommandDescription; import dstep.foundation.NSArray; +import dstep.foundation.NSCoder; import dstep.foundation.NSDictionary; import dstep.foundation.NSObject; import dstep.foundation.NSScriptCommand; import dstep.foundation.NSString; +import dstep.foundation.NSZone; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; class NSScriptCommandDescription : NSObject, INSCoding { - mixin ObjcWrap; - + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } + Object initWithSuiteName (NSString suiteName, NSString commandName, NSDictionary commandDeclaration) { return invokeObjcSelf!(Object, "initWithSuiteName:commandName:dictionary:", NSString, NSString, NSDictionary)(suiteName, commandName, commandDeclaration); @@ -25,13 +37,7 @@ this (NSString suiteName, NSString commandName, NSDictionary commandDeclaration) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithSuiteName:commandName:dictionary:", NSString, NSString, NSDictionary)(objcObject, suiteName, commandName, commandDeclaration); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithSuiteName(suiteName, commandName, commandDeclaration); } NSString suiteName () @@ -111,13 +117,7 @@ this (NSCoder aDecoder) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithCoder(aDecoder); } } diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSScriptExecutionContext.d --- a/dstep/foundation/NSScriptExecutionContext.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSScriptExecutionContext.d Sun Jan 03 22:06:11 2010 +0100 @@ -9,15 +9,25 @@ import dstep.foundation.NSConnection; import dstep.foundation.NSObject; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; class NSScriptExecutionContext : NSObject { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static NSScriptExecutionContext sharedScriptExecutionContext () { - return invokeObjcSelfClass!(NSScriptExecutionContext, "sharedScriptExecutionContext"); + return invokeObjcSuperClass!(NSScriptExecutionContext, "sharedScriptExecutionContext"); } Object topLevelObject () diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSScriptKeyValueCoding.d --- a/dstep/foundation/NSScriptKeyValueCoding.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSScriptKeyValueCoding.d Sun Jan 03 22:06:11 2010 +0100 @@ -9,26 +9,70 @@ import dstep.foundation.NSObject; import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + import bindings = dstep.foundation.NSScriptKeyValueCoding_bindings; -NSString NSOperationNotSupportedForKeyException; +private NSString NSOperationNotSupportedForKeyException_; -static this () +NSString NSOperationNotSupportedForKeyException () { - NSOperationNotSupportedForKeyException = new NSString(bindings.NSOperationNotSupportedForKeyException); + if (NSOperationNotSupportedForKeyException_) + return NSOperationNotSupportedForKeyException_; + + return NSOperationNotSupportedForKeyException_ = new NSString(bindings.NSOperationNotSupportedForKeyException); } -template TNSScriptKeyValueCoding () -{ - Object valueAtIndex (NSUInteger index, NSString key); - Object valueWithName (NSString name, NSString key); - Object valueWithUniqueID (Object uniqueID, NSString key); - void insertValue (Object value, NSUInteger index, NSString key); - void removeValueAtIndex (NSUInteger index, NSString key); - void replaceValueAtIndex (NSUInteger index, NSString key, Object value); - void insertValue (Object value, NSString key); - Object coerceValue (Object value, NSString key); -} +const TNSScriptKeyValueCoding = ` + Object valueAtIndex (NSUInteger index, NSString key) + { + return invokeObjcSelf!(Object, "valueAtIndex:inPropertyWithKey:", NSUInteger, NSString)(index, key); + } + + Object valueWithName (NSString name, NSString key) + { + return invokeObjcSelf!(Object, "valueWithName:inPropertyWithKey:", NSString, NSString)(name, key); + } + + Object valueWithUniqueID (Object uniqueID, NSString key) + { + return invokeObjcSelf!(Object, "valueWithUniqueID:inPropertyWithKey:", Object, NSString)(uniqueID, key); + } + + void insertValue (Object value, NSUInteger index, NSString key) + { + return invokeObjcSelf!(void, "insertValue:atIndex:inPropertyWithKey:", Object, NSUInteger, NSString)(value, index, key); + } + + void removeValueAtIndex (NSUInteger index, NSString key) + { + return invokeObjcSelf!(void, "removeValueAtIndex:fromPropertyWithKey:", NSUInteger, NSString)(index, key); + } + + void replaceValueAtIndex (NSUInteger index, NSString key, Object value) + { + return invokeObjcSelf!(void, "replaceValueAtIndex:inPropertyWithKey:withValue:", NSUInteger, NSString, Object)(index, key, value); + } + + void insertValue (Object value, NSString key) + { + return invokeObjcSelf!(void, "insertValue:inPropertyWithKey:", Object, NSString)(value, key); + } + + Object coerceValue (Object value, NSString key) + { + return invokeObjcSelf!(Object, "coerceValue:forKey:", Object, NSString)(value, key); + } + + //mixin ObjcBindMethod!(valueAtIndex, "valueAtIndex:inPropertyWithKey:"); + //mixin ObjcBindMethod!(valueWithName, "valueWithName:inPropertyWithKey:"); + //mixin ObjcBindMethod!(valueWithUniqueID, "valueWithUniqueID:inPropertyWithKey:"); + //mixin ObjcBindMethod!(insertValue, "insertValue:atIndex:inPropertyWithKey:"); + //mixin ObjcBindMethod!(removeValueAtIndex, "removeValueAtIndex:fromPropertyWithKey:"); + //mixin ObjcBindMethod!(replaceValueAtIndex, "replaceValueAtIndex:inPropertyWithKey:withValue:"); + //mixin ObjcBindMethod!(insertValue, "insertValue:inPropertyWithKey:"); + //mixin ObjcBindMethod!(coerceValue, "coerceValue:forKey:"); +`; \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSScriptKeyValueCoding_bindings.d --- a/dstep/foundation/NSScriptKeyValueCoding_bindings.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSScriptKeyValueCoding_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -3,7 +3,9 @@ import dstep.foundation.NSObject; import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + extern (C) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSScriptObjectSpecifiers.d --- a/dstep/foundation/NSScriptObjectSpecifiers.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSScriptObjectSpecifiers.d Sun Jan 03 22:06:11 2010 +0100 @@ -8,12 +8,14 @@ import dstep.foundation.NSAppleEventDescriptor; import dstep.foundation.NSArray; +import dstep.foundation.NSCoder; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; import dstep.foundation.NSScriptClassDescription; -import dstep.foundation.NSScriptWhoseTest; +import dstep.foundation.NSScriptWhoseTests; import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; alias NSUInteger NSInsertionPosition; alias NSUInteger NSRelativePosition; @@ -54,9 +56,35 @@ NSNoSubelement = 4 } +const TNSScriptObjectSpecifiers = ` + + NSScriptObjectSpecifier objectSpecifier () + { + return invokeObjcSelf!(NSScriptObjectSpecifier, "objectSpecifier"); + } + + NSArray indicesOfObjectsByEvaluatingObjectSpecifier (NSScriptObjectSpecifier specifier) + { + return invokeObjcSelf!(NSArray, "indicesOfObjectsByEvaluatingObjectSpecifier:", NSScriptObjectSpecifier)(specifier); + } + + //mixin ObjcBindMethod!(objectSpecifier, "objectSpecifier"); + //mixin ObjcBindMethod!(indicesOfObjectsByEvaluatingObjectSpecifier, "indicesOfObjectsByEvaluatingObjectSpecifier:"); +`; + class NSIndexSpecifier : NSScriptObjectSpecifier { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } Object initWithContainerClassDescription (NSScriptClassDescription classDesc, NSScriptObjectSpecifier container, NSString property, NSInteger index) { @@ -65,13 +93,7 @@ this (NSScriptClassDescription classDesc, NSScriptObjectSpecifier container, NSString property, NSInteger index) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithContainerClassDescription:containerSpecifier:key:index:", NSScriptClassDescription, NSScriptObjectSpecifier, NSString, NSInteger)(objcObject, classDesc, container, property, index); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithContainerClassDescription(classDesc, container, property, index); } NSInteger index () @@ -87,7 +109,17 @@ class NSRangeSpecifier : NSScriptObjectSpecifier { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } Object initWithContainerClassDescription (NSScriptClassDescription classDesc, NSScriptObjectSpecifier container, NSString property, NSScriptObjectSpecifier startSpec, NSScriptObjectSpecifier endSpec) { @@ -96,13 +128,7 @@ this (NSScriptClassDescription classDesc, NSScriptObjectSpecifier container, NSString property, NSScriptObjectSpecifier startSpec, NSScriptObjectSpecifier endSpec) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithContainerClassDescription:containerSpecifier:key:startSpecifier:endSpecifier:", NSScriptClassDescription, NSScriptObjectSpecifier, NSString, NSScriptObjectSpecifier, NSScriptObjectSpecifier)(objcObject, classDesc, container, property, startSpec, endSpec); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithContainerClassDescription(classDesc, container, property, startSpec, endSpec); } NSScriptObjectSpecifier startSpecifier () @@ -128,7 +154,17 @@ class NSUniqueIDSpecifier : NSScriptObjectSpecifier { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } Object initWithContainerClassDescription (NSScriptClassDescription classDesc, NSScriptObjectSpecifier container, NSString property, Object uniqueID) { @@ -137,13 +173,7 @@ this (NSScriptClassDescription classDesc, NSScriptObjectSpecifier container, NSString property, Object uniqueID) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithContainerClassDescription:containerSpecifier:key:uniqueID:", NSScriptClassDescription, NSScriptObjectSpecifier, NSString, Object)(objcObject, classDesc, container, property, uniqueID); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithContainerClassDescription(classDesc, container, property, uniqueID); } Object uniqueID () @@ -159,8 +189,18 @@ class NSRelativeSpecifier : NSScriptObjectSpecifier { - mixin ObjcWrap; - + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } + Object initWithContainerClassDescription (NSScriptClassDescription classDesc, NSScriptObjectSpecifier container, NSString property, uint relPos, NSScriptObjectSpecifier baseSpecifier) { return invokeObjcSelf!(Object, "initWithContainerClassDescription:containerSpecifier:key:relativePosition:baseSpecifier:", NSScriptClassDescription, NSScriptObjectSpecifier, NSString, uint, NSScriptObjectSpecifier)(classDesc, container, property, relPos, baseSpecifier); @@ -168,13 +208,7 @@ this (NSScriptClassDescription classDesc, NSScriptObjectSpecifier container, NSString property, uint relPos, NSScriptObjectSpecifier baseSpecifier) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithContainerClassDescription:containerSpecifier:key:relativePosition:baseSpecifier:", NSScriptClassDescription, NSScriptObjectSpecifier, NSString, uint, NSScriptObjectSpecifier)(objcObject, classDesc, container, property, relPos, baseSpecifier); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithContainerClassDescription(classDesc, container, property, relPos, baseSpecifier); } uint relativePosition () @@ -200,7 +234,17 @@ class NSNameSpecifier : NSScriptObjectSpecifier { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } Object initWithContainerClassDescription (NSScriptClassDescription classDesc, NSScriptObjectSpecifier container, NSString property, NSString name) { @@ -209,13 +253,7 @@ this (NSScriptClassDescription classDesc, NSScriptObjectSpecifier container, NSString property, NSString name) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithContainerClassDescription:containerSpecifier:key:name:", NSScriptClassDescription, NSScriptObjectSpecifier, NSString, NSString)(objcObject, classDesc, container, property, name); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithContainerClassDescription(classDesc, container, property, name); } NSString name () @@ -231,7 +269,17 @@ class NSPositionalSpecifier : NSObject { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } Object initWithPosition (uint position, NSScriptObjectSpecifier specifier) { @@ -240,13 +288,7 @@ this (uint position, NSScriptObjectSpecifier specifier) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithPosition:objectSpecifier:", uint, NSScriptObjectSpecifier)(objcObject, position, specifier); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithPosition(position, specifier); } uint position () @@ -292,11 +334,21 @@ class NSScriptObjectSpecifier : NSObject, INSCoding { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static NSScriptObjectSpecifier objectSpecifierWithDescriptor (NSAppleEventDescriptor descriptor) { - return invokeObjcSelfClass!(NSScriptObjectSpecifier, "objectSpecifierWithDescriptor:", NSAppleEventDescriptor)(descriptor); + return invokeObjcSuperClass!(NSScriptObjectSpecifier, "objectSpecifierWithDescriptor:", NSAppleEventDescriptor)(descriptor); } Object initWithContainerSpecifier (NSScriptObjectSpecifier container, NSString property) @@ -306,13 +358,7 @@ this (NSScriptObjectSpecifier container, NSString property) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithContainerSpecifier:key:", NSScriptObjectSpecifier, NSString)(objcObject, container, property); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithContainerSpecifier(container, property); } Object initWithContainerClassDescription (NSScriptClassDescription classDesc, NSScriptObjectSpecifier container, NSString property) @@ -322,13 +368,7 @@ this (NSScriptClassDescription classDesc, NSScriptObjectSpecifier container, NSString property) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithContainerClassDescription:containerSpecifier:key:", NSScriptClassDescription, NSScriptObjectSpecifier, NSString)(objcObject, classDesc, container, property); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithContainerClassDescription(classDesc, container, property); } NSScriptObjectSpecifier childSpecifier () @@ -446,19 +486,23 @@ this (NSCoder aDecoder) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithCoder(aDecoder); } } class NSWhoseSpecifier : NSScriptObjectSpecifier { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } Object initWithContainerClassDescription (NSScriptClassDescription classDesc, NSScriptObjectSpecifier container, NSString property, NSScriptWhoseTest test) { @@ -467,13 +511,7 @@ this (NSScriptClassDescription classDesc, NSScriptObjectSpecifier container, NSString property, NSScriptWhoseTest test) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithContainerClassDescription:containerSpecifier:key:test:", NSScriptClassDescription, NSScriptObjectSpecifier, NSString, NSScriptWhoseTest)(objcObject, classDesc, container, property, test); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithContainerClassDescription(classDesc, container, property, test); } NSScriptWhoseTest test () @@ -525,11 +563,4 @@ { return invokeObjcSelf!(void, "setEndSubelementIndex:", NSInteger)(index); } -} - -template TNSScriptObjectSpecifiers () -{ - NSScriptObjectSpecifier objectSpecifier (); - NSArray indicesOfObjectsByEvaluatingObjectSpecifier (NSScriptObjectSpecifier specifier); -} - +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSScriptStandardSuiteCommands.d --- a/dstep/foundation/NSScriptStandardSuiteCommands.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSScriptStandardSuiteCommands.d Sun Jan 03 22:06:11 2010 +0100 @@ -7,11 +7,12 @@ module dstep.foundation.NSScriptStandardSuiteCommands; import dstep.foundation.NSDictionary; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSScriptClassDescription; import dstep.foundation.NSScriptCommand; -import dstep.foundation.NSScriptObjectSpecifier; +import dstep.foundation.NSScriptObjectSpecifiers; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; alias NSUInteger NSSaveOptions; @@ -24,7 +25,17 @@ class NSCloneCommand : NSScriptCommand { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } void setReceiversSpecifier (NSScriptObjectSpecifier receiversRef) { @@ -39,8 +50,18 @@ class NSSetCommand : NSScriptCommand { - mixin ObjcWrap; - + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } + void setReceiversSpecifier (NSScriptObjectSpecifier receiversRef) { return invokeObjcSelf!(void, "setReceiversSpecifier:", NSScriptObjectSpecifier)(receiversRef); @@ -54,7 +75,17 @@ class NSCreateCommand : NSScriptCommand { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } NSScriptClassDescription createClassDescription () { @@ -69,7 +100,17 @@ class NSMoveCommand : NSScriptCommand { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } void setReceiversSpecifier (NSScriptObjectSpecifier receiversRef) { @@ -84,7 +125,17 @@ class NSQuitCommand : NSScriptCommand { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } uint saveOptions () { @@ -94,7 +145,17 @@ class NSCloseCommand : NSScriptCommand { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } uint saveOptions () { @@ -104,7 +165,17 @@ class NSDeleteCommand : NSScriptCommand { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } void setReceiversSpecifier (NSScriptObjectSpecifier receiversRef) { diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSScriptSuiteRegistry.d --- a/dstep/foundation/NSScriptSuiteRegistry.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSScriptSuiteRegistry.d Sun Jan 03 22:06:11 2010 +0100 @@ -10,27 +10,36 @@ import dstep.foundation.NSBundle; import dstep.foundation.NSData; import dstep.foundation.NSDictionary; -import dstep.foundation.NSMutableArray; -import dstep.foundation.NSMutableDictionary; -import dstep.foundation.NSMutableSet; import dstep.foundation.NSObject; import dstep.foundation.NSScriptClassDescription; import dstep.foundation.NSScriptCommandDescription; +import dstep.foundation.NSSet; +import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; class NSScriptSuiteRegistry : NSObject { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static NSScriptSuiteRegistry sharedScriptSuiteRegistry () { - return invokeObjcSelfClass!(NSScriptSuiteRegistry, "sharedScriptSuiteRegistry"); + return invokeObjcSuperClass!(NSScriptSuiteRegistry, "sharedScriptSuiteRegistry"); } static void setSharedScriptSuiteRegistry (NSScriptSuiteRegistry registry) { - return invokeObjcSelfClass!(void, "setSharedScriptSuiteRegistry:", NSScriptSuiteRegistry)(registry); + return invokeObjcSuperClass!(void, "setSharedScriptSuiteRegistry:", NSScriptSuiteRegistry)(registry); } void loadSuitesFromBundle (NSBundle bundle) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSScriptWhoseTests.d --- a/dstep/foundation/NSScriptWhoseTests.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSScriptWhoseTests.d Sun Jan 03 22:06:11 2010 +0100 @@ -7,11 +7,13 @@ module dstep.foundation.NSScriptWhoseTests; import dstep.foundation.NSArray; +import dstep.foundation.NSCoder; import dstep.foundation.NSObject; -import dstep.foundation.NSScriptObjectSpecifier; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSScriptObjectSpecifiers; import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; alias NSUInteger NSTestComparisonOperation; @@ -27,9 +29,129 @@ NSContainsComparison } +const TNSComparisonMethods = ` + + bool isEqualTo (Object object) + { + return invokeObjcSelf!(bool, "isEqualTo:", Object)(object); + } + + bool isLessThanOrEqualTo (Object object) + { + return invokeObjcSelf!(bool, "isLessThanOrEqualTo:", Object)(object); + } + + bool isLessThan (Object object) + { + return invokeObjcSelf!(bool, "isLessThan:", Object)(object); + } + + bool isGreaterThanOrEqualTo (Object object) + { + return invokeObjcSelf!(bool, "isGreaterThanOrEqualTo:", Object)(object); + } + + bool isGreaterThan (Object object) + { + return invokeObjcSelf!(bool, "isGreaterThan:", Object)(object); + } + + bool isNotEqualTo (Object object) + { + return invokeObjcSelf!(bool, "isNotEqualTo:", Object)(object); + } + + bool doesContain (Object object) + { + return invokeObjcSelf!(bool, "doesContain:", Object)(object); + } + + bool isLike (NSString object) + { + return invokeObjcSelf!(bool, "isLike:", NSString)(object); + } + + bool isCaseInsensitiveLike (NSString object) + { + return invokeObjcSelf!(bool, "isCaseInsensitiveLike:", NSString)(object); + } + + //mixin ObjcBindMethod!(isEqualTo, "isEqualTo:"); + //mixin ObjcBindMethod!(isLessThanOrEqualTo, "isLessThanOrEqualTo:"); + //mixin ObjcBindMethod!(isLessThan, "isLessThan:"); + //mixin ObjcBindMethod!(isGreaterThanOrEqualTo, "isGreaterThanOrEqualTo:"); + //mixin ObjcBindMethod!(isGreaterThan, "isGreaterThan:"); + //mixin ObjcBindMethod!(isNotEqualTo, "isNotEqualTo:"); + //mixin ObjcBindMethod!(doesContain, "doesContain:"); + //mixin ObjcBindMethod!(isLike, "isLike:"); + //mixin ObjcBindMethod!(isCaseInsensitiveLike, "isCaseInsensitiveLike:"); +`; + +const TNSScriptingComparisonMethods = ` + + bool scriptingIsEqualTo (Object object) + { + return invokeObjcSelf!(bool, "scriptingIsEqualTo:", Object)(object); + } + + bool scriptingIsLessThanOrEqualTo (Object object) + { + return invokeObjcSelf!(bool, "scriptingIsLessThanOrEqualTo:", Object)(object); + } + + bool scriptingIsLessThan (Object object) + { + return invokeObjcSelf!(bool, "scriptingIsLessThan:", Object)(object); + } + + bool scriptingIsGreaterThanOrEqualTo (Object object) + { + return invokeObjcSelf!(bool, "scriptingIsGreaterThanOrEqualTo:", Object)(object); + } + + bool scriptingIsGreaterThan (Object object) + { + return invokeObjcSelf!(bool, "scriptingIsGreaterThan:", Object)(object); + } + + bool scriptingBeginsWith (Object object) + { + return invokeObjcSelf!(bool, "scriptingBeginsWith:", Object)(object); + } + + bool scriptingEndsWith (Object object) + { + return invokeObjcSelf!(bool, "scriptingEndsWith:", Object)(object); + } + + bool scriptingContains (Object object) + { + return invokeObjcSelf!(bool, "scriptingContains:", Object)(object); + } + + //mixin ObjcBindMethod!(scriptingIsEqualTo, "scriptingIsEqualTo:"); + //mixin ObjcBindMethod!(scriptingIsLessThanOrEqualTo, "scriptingIsLessThanOrEqualTo:"); + //mixin ObjcBindMethod!(scriptingIsLessThan, "scriptingIsLessThan:"); + //mixin ObjcBindMethod!(scriptingIsGreaterThanOrEqualTo, "scriptingIsGreaterThanOrEqualTo:"); + //mixin ObjcBindMethod!(scriptingIsGreaterThan, "scriptingIsGreaterThan:"); + //mixin ObjcBindMethod!(scriptingBeginsWith, "scriptingBeginsWith:"); + //mixin ObjcBindMethod!(scriptingEndsWith, "scriptingEndsWith:"); + //mixin ObjcBindMethod!(scriptingContains, "scriptingContains:"); +`; + class NSLogicalTest : NSScriptWhoseTest { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } Object initAndTestWithTests (NSArray subTests) { @@ -38,13 +160,7 @@ this (NSArray subTests) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initAndTestWithTests:", NSArray)(objcObject, subTests); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initAndTestWithTests(subTests); } Object initOrTestWithTests (NSArray subTests) @@ -52,17 +168,6 @@ return invokeObjcSelf!(Object, "initOrTestWithTests:", NSArray)(subTests); } - this (NSArray subTests) - { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initOrTestWithTests:", NSArray)(objcObject, subTests); - - if (result) - objcObject = ret; - - dObject = this; - } - Object initNotTestWithTest (NSScriptWhoseTest subTest) { return invokeObjcSelf!(Object, "initNotTestWithTest:", NSScriptWhoseTest)(subTest); @@ -70,19 +175,23 @@ this (NSScriptWhoseTest subTest) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initNotTestWithTest:", NSScriptWhoseTest)(objcObject, subTest); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initNotTestWithTest(subTest); } } class NSSpecifierTest : NSScriptWhoseTest { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } Object initWithObjectSpecifier (NSScriptObjectSpecifier obj1, uint compOp, Object obj2) { @@ -91,19 +200,23 @@ this (NSScriptObjectSpecifier obj1, uint compOp, Object obj2) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithObjectSpecifier:comparisonOperator:testObject:", NSScriptObjectSpecifier, uint, Object)(objcObject, obj1, compOp, obj2); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithObjectSpecifier(obj1, compOp, obj2); } } class NSScriptWhoseTest : NSObject, INSCoding { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } bool isTrue () { @@ -122,38 +235,6 @@ this (NSCoder aDecoder) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithCoder(aDecoder); } -} - -template TNSComparisonMethods () -{ - bool isEqualTo (Object object); - bool isLessThanOrEqualTo (Object object); - bool isLessThan (Object object); - bool isGreaterThanOrEqualTo (Object object); - bool isGreaterThan (Object object); - bool isNotEqualTo (Object object); - bool doesContain (Object object); - bool isLike (NSString object); - bool isCaseInsensitiveLike (NSString object); -} - -template TNSScriptingComparisonMethods () -{ - bool scriptingIsEqualTo (Object object); - bool scriptingIsLessThanOrEqualTo (Object object); - bool scriptingIsLessThan (Object object); - bool scriptingIsGreaterThanOrEqualTo (Object object); - bool scriptingIsGreaterThan (Object object); - bool scriptingBeginsWith (Object object); - bool scriptingEndsWith (Object object); - bool scriptingContains (Object object); -} - +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSSet.d --- a/dstep/foundation/NSSet.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSSet.d Sun Jan 03 22:06:11 2010 +0100 @@ -7,124 +7,68 @@ module dstep.foundation.NSSet; import dstep.foundation.NSArray; +import dstep.foundation.NSCoder; import dstep.foundation.NSDictionary; import dstep.foundation.NSEnumerator; +import dstep.foundation.NSKeyValueObserving; import dstep.foundation.NSObject; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSPredicate; import dstep.foundation.NSString; +import dstep.foundation.NSZone; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; -class NSSet : NSObject, INSCopying, INSMutableCopying, INSCoding, INSFastEnumeration -{ - mixin ObjcWrap; - mixin TNSSetCreation; - mixin TNSExtendedSet; - mixin TNSKeyValueObserverRegistration; +const TNSSetCreation = ` - NSUInteger count () + static Object set () { - return invokeObjcSelf!(NSUInteger, "count"); - } - - Object member (Object object) - { - return invokeObjcSelf!(Object, "member:", Object)(object); + return invokeObjcSuperClass!(Object, "set"); } - NSEnumerator objectEnumerator () + static Object setWithObject (Object object) { - return invokeObjcSelf!(NSEnumerator, "objectEnumerator"); - } - - Object copyWithZone (NSZone* zone) - { - return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + return invokeObjcSuperClass!(Object, "setWithObject:", Object)(object); } - Object mutableCopyWithZone (NSZone* zone) - { - return invokeObjcSelf!(Object, "mutableCopyWithZone:", NSZone*)(zone); - } - - void encodeWithCoder (NSCoder aCoder) + static Object setWithObjects (id* objects, NSUInteger cnt) { - return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); - } - - Object initWithCoder (NSCoder aDecoder) - { - return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); + return invokeObjcSuperClass!(Object, "setWithObjects:count:", id*, NSUInteger)(objects, cnt); } - this (NSCoder aDecoder) + static Object setWithObjects (Object setWithObjects, ...) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); - - if (result) - objcObject = ret; - - dObject = this; + return invokeObjcSuperClass!(Object, "setWithObjects:", Object)(setWithObjects); } - NSUInteger countByEnumeratingWithState (NSFastEnumerationState* state, id* stackbuf, NSUInteger len) + static Object setWithSet (NSSet set) { - return invokeObjcSelf!(NSUInteger, "countByEnumeratingWithState:objects:count:", NSFastEnumerationState*, id*, NSUInteger)(state, stackbuf, len); + return invokeObjcSuperClass!(Object, "setWithSet:", NSSet)(set); } -} -class NSMutableSet : NSSet -{ - mixin ObjcWrap; - mixin TNSPredicateSupport; - mixin TNSMutableSetCreation; - mixin TNSExtendedMutableSet; - - void addObject (Object object) + static Object setWithArray (NSArray array) { - return invokeObjcSelf!(void, "addObject:", Object)(object); + return invokeObjcSuperClass!(Object, "setWithArray:", NSArray)(array); } - void removeObject (Object object) + Object initWithObjects (id* objects, NSUInteger cnt) { - return invokeObjcSelf!(void, "removeObject:", Object)(object); - } -} - -class NSCountedSet : NSMutableSet -{ - mixin ObjcWrap; - - Object initWithCapacity (NSUInteger numItems) - { - return invokeObjcSelf!(Object, "initWithCapacity:", NSUInteger)(numItems); + return invokeObjcSelf!(Object, "initWithObjects:count:", id*, NSUInteger)(objects, cnt); } - this (NSUInteger numItems) + this (id* objects, NSUInteger cnt) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCapacity:", NSUInteger)(objcObject, numItems); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithObjects(objects, cnt); } - Object initWithArray (NSArray array) + Object initWithObjects (Object initWithObjects, ...) { - return invokeObjcSelf!(Object, "initWithArray:", NSArray)(array); + return invokeObjcSelf!(Object, "initWithObjects:", Object)(initWithObjects); } - this (NSArray array) + this (Object initWithObjects, ...) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithArray:", NSArray)(objcObject, array); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithObjects(initWithObjects); } Object initWithSet (NSSet set) @@ -134,114 +78,7 @@ this (NSSet set) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithSet:", NSSet)(objcObject, set); - - if (result) - objcObject = ret; - - dObject = this; - } - - NSUInteger countForObject (Object object) - { - return invokeObjcSelf!(NSUInteger, "countForObject:", Object)(object); - } - - NSEnumerator objectEnumerator () - { - return invokeObjcSelf!(NSEnumerator, "objectEnumerator"); - } - - void addObject (Object object) - { - return invokeObjcSelf!(void, "addObject:", Object)(object); - } - - void removeObject (Object object) - { - return invokeObjcSelf!(void, "removeObject:", Object)(object); - } -} - -template TNSSetCreation () -{ - static Object set () - { - return invokeObjcSelfClass!(Object, "set"); - } - - static Object setWithObject (Object object) - { - return invokeObjcSelfClass!(Object, "setWithObject:", Object)(object); - } - - static Object setWithObjects (id* objects, NSUInteger cnt) - { - return invokeObjcSelfClass!(Object, "setWithObjects:count:", id*, NSUInteger)(objects, cnt); - } - - static Object setWithObjects (Object setWithObjects, ...) - { - return invokeObjcSelfClass!(Object, "setWithObjects:", Object)(setWithObjects); - } - - static Object setWithSet (NSSet set) - { - return invokeObjcSelfClass!(Object, "setWithSet:", NSSet)(set); - } - - static Object setWithArray (NSArray array) - { - return invokeObjcSelfClass!(Object, "setWithArray:", NSArray)(array); - } - - Object initWithObjects (id* objects, NSUInteger cnt) - { - return invokeObjcSelf!(Object, "initWithObjects:count:", id*, NSUInteger)(objects, cnt); - } - - this (id* objects, NSUInteger cnt) - { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithObjects:count:", id*, NSUInteger)(objcObject, objects, cnt); - - if (result) - objcObject = ret; - - dObject = this; - } - - Object initWithObjects (Object initWithObjects, ...) - { - return invokeObjcSelf!(Object, "initWithObjects:", Object)(initWithObjects); - } - - this (Object initWithObjects, ...) - { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithObjects:", Object)(objcObject, initWithObjects); - - if (result) - objcObject = ret; - - dObject = this; - } - - Object initWithSet (NSSet set) - { - return invokeObjcSelf!(Object, "initWithSet:", NSSet)(set); - } - - this (NSSet set) - { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithSet:", NSSet)(objcObject, set); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithSet(set); } Object initWithSet (NSSet set, bool flag) @@ -251,13 +88,7 @@ this (NSSet set, bool flag) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithSet:copyItems:", NSSet, bool)(objcObject, set, flag); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithSet(set, flag); } Object initWithArray (NSArray array) @@ -267,18 +98,12 @@ this (NSArray array) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithArray:", NSArray)(objcObject, array); - - if (result) - objcObject = ret; + typeof(this).alloc.initWithArray(array); + } +`; - dObject = this; - } -} +const TNSExtendedSet = ` -template TNSExtendedSet () -{ NSArray allObjects () { return invokeObjcSelf!(NSArray, "allObjects"); @@ -343,13 +168,13 @@ { return invokeObjcSelf!(NSSet, "setByAddingObjectsFromArray:", NSArray)(other); } -} +`; -template TNSMutableSetCreation () -{ +const TNSMutableSetCreation = ` + static Object setWithCapacity (NSUInteger numItems) { - return invokeObjcSelfClass!(Object, "setWithCapacity:", NSUInteger)(numItems); + return invokeObjcSuperClass!(Object, "setWithCapacity:", NSUInteger)(numItems); } Object initWithCapacity (NSUInteger numItems) @@ -359,18 +184,12 @@ this (NSUInteger numItems) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCapacity:", NSUInteger)(objcObject, numItems); - - if (result) - objcObject = ret; + typeof(this).alloc.initWithCapacity(numItems); + } +`; - dObject = this; - } -} +const TNSExtendedMutableSet = ` -template TNSExtendedMutableSet () -{ void addObjectsFromArray (NSArray array) { return invokeObjcSelf!(void, "addObjectsFromArray:", NSArray)(array); @@ -400,5 +219,365 @@ { return invokeObjcSelf!(void, "setSet:", NSSet)(otherSet); } +`; + +class NSSet : NSObject, INSCopying, INSMutableCopying, INSCoding, INSFastEnumeration +{ + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } + + NSUInteger count () + { + return invokeObjcSelf!(NSUInteger, "count"); + } + + Object member (Object object) + { + return invokeObjcSelf!(Object, "member:", Object)(object); + } + + NSEnumerator objectEnumerator () + { + return invokeObjcSelf!(NSEnumerator, "objectEnumerator"); + } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } + + Object mutableCopyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "mutableCopyWithZone:", NSZone*)(zone); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + Object initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); + } + + this (NSCoder aDecoder) + { + typeof(this).alloc.initWithCoder(aDecoder); + } + + NSUInteger countByEnumeratingWithState (NSFastEnumerationState* state, id* stackbuf, NSUInteger len) + { + return invokeObjcSelf!(NSUInteger, "countByEnumeratingWithState:objects:count:", NSFastEnumerationState*, id*, NSUInteger)(state, stackbuf, len); + } + + // TNSSetCreation + static Object set () + { + return invokeObjcSuperClass!(Object, "set"); + } + + static Object setWithObject (Object object) + { + return invokeObjcSuperClass!(Object, "setWithObject:", Object)(object); + } + + static Object setWithObjects (id* objects, NSUInteger cnt) + { + return invokeObjcSuperClass!(Object, "setWithObjects:count:", id*, NSUInteger)(objects, cnt); + } + + static Object setWithObjects (Object setWithObjects, ...) + { + return invokeObjcSuperClass!(Object, "setWithObjects:", Object)(setWithObjects); + } + + static Object setWithSet (NSSet set) + { + return invokeObjcSuperClass!(Object, "setWithSet:", NSSet)(set); + } + + static Object setWithArray (NSArray array) + { + return invokeObjcSuperClass!(Object, "setWithArray:", NSArray)(array); + } + + Object initWithObjects (id* objects, NSUInteger cnt) + { + return invokeObjcSelf!(Object, "initWithObjects:count:", id*, NSUInteger)(objects, cnt); + } + + this (id* objects, NSUInteger cnt) + { + typeof(this).alloc.initWithObjects(objects, cnt); + } + + Object initWithObjects (Object initWithObjects, ...) + { + return invokeObjcSelf!(Object, "initWithObjects:", Object)(initWithObjects); + } + + this (Object initWithObjects, ...) + { + typeof(this).alloc.initWithObjects(initWithObjects); + } + + Object initWithSet (NSSet set) + { + return invokeObjcSelf!(Object, "initWithSet:", NSSet)(set); + } + + this (NSSet set) + { + typeof(this).alloc.initWithSet(set); + } + + Object initWithSet (NSSet set, bool flag) + { + return invokeObjcSelf!(Object, "initWithSet:copyItems:", NSSet, bool)(set, flag); + } + + this (NSSet set, bool flag) + { + typeof(this).alloc.initWithSet(set, flag); + } + + Object initWithArray (NSArray array) + { + return invokeObjcSelf!(Object, "initWithArray:", NSArray)(array); + } + + this (NSArray array) + { + typeof(this).alloc.initWithArray(array); + } + + // TNSExtendedSet + NSArray allObjects () + { + return invokeObjcSelf!(NSArray, "allObjects"); + } + + Object anyObject () + { + return invokeObjcSelf!(Object, "anyObject"); + } + + bool containsObject (Object anObject) + { + return invokeObjcSelf!(bool, "containsObject:", Object)(anObject); + } + + NSString description () + { + return invokeObjcSelf!(NSString, "description"); + } + + NSString descriptionWithLocale (Object locale) + { + return invokeObjcSelf!(NSString, "descriptionWithLocale:", Object)(locale); + } + + bool intersectsSet (NSSet otherSet) + { + return invokeObjcSelf!(bool, "intersectsSet:", NSSet)(otherSet); + } + + bool isEqualToSet (NSSet otherSet) + { + return invokeObjcSelf!(bool, "isEqualToSet:", NSSet)(otherSet); + } + + bool isSubsetOfSet (NSSet otherSet) + { + return invokeObjcSelf!(bool, "isSubsetOfSet:", NSSet)(otherSet); + } + + void makeObjectsPerformSelector (SEL aSelector) + { + return invokeObjcSelf!(void, "makeObjectsPerformSelector:", SEL)(aSelector); + } + + void makeObjectsPerformSelector (SEL aSelector, Object argument) + { + return invokeObjcSelf!(void, "makeObjectsPerformSelector:withObject:", SEL, Object)(aSelector, argument); + } + + NSSet setByAddingObject (Object anObject) + { + return invokeObjcSelf!(NSSet, "setByAddingObject:", Object)(anObject); + } + + NSSet setByAddingObjectsFromSet (NSSet other) + { + return invokeObjcSelf!(NSSet, "setByAddingObjectsFromSet:", NSSet)(other); + } + + NSSet setByAddingObjectsFromArray (NSArray other) + { + return invokeObjcSelf!(NSSet, "setByAddingObjectsFromArray:", NSArray)(other); + } + + // TNSKeyValueObserverRegistration + void addObserver (NSObject observer, NSString keyPath, uint options, void* context) + { + return invokeObjcSelf!(void, "addObserver:forKeyPath:options:context:", NSObject, NSString, uint, void*)(observer, keyPath, options, context); + } + + void removeObserver (NSObject observer, NSString keyPath) + { + return invokeObjcSelf!(void, "removeObserver:forKeyPath:", NSObject, NSString)(observer, keyPath); + } } +class NSMutableSet : NSSet +{ + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } + + void addObject (Object object) + { + return invokeObjcSelf!(void, "addObject:", Object)(object); + } + + void removeObject (Object object) + { + return invokeObjcSelf!(void, "removeObject:", Object)(object); + } + + // TNSPredicateSupport + void filterUsingPredicate (NSPredicate predicate) + { + return invokeObjcSelf!(void, "filterUsingPredicate:", NSPredicate)(predicate); + } + + // TNSMutableSetCreation + static Object setWithCapacity (NSUInteger numItems) + { + return invokeObjcSuperClass!(Object, "setWithCapacity:", NSUInteger)(numItems); + } + + Object initWithCapacity (NSUInteger numItems) + { + return invokeObjcSelf!(Object, "initWithCapacity:", NSUInteger)(numItems); + } + + this (NSUInteger numItems) + { + typeof(this).alloc.initWithCapacity(numItems); + } + + // TNSExtendedMutableSet + void addObjectsFromArray (NSArray array) + { + return invokeObjcSelf!(void, "addObjectsFromArray:", NSArray)(array); + } + + void intersectSet (NSSet otherSet) + { + return invokeObjcSelf!(void, "intersectSet:", NSSet)(otherSet); + } + + void minusSet (NSSet otherSet) + { + return invokeObjcSelf!(void, "minusSet:", NSSet)(otherSet); + } + + void removeAllObjects () + { + return invokeObjcSelf!(void, "removeAllObjects"); + } + + void unionSet (NSSet otherSet) + { + return invokeObjcSelf!(void, "unionSet:", NSSet)(otherSet); + } + + void setSet (NSSet otherSet) + { + return invokeObjcSelf!(void, "setSet:", NSSet)(otherSet); + } +} + +class NSCountedSet : NSMutableSet +{ + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } + + Object initWithCapacity (NSUInteger numItems) + { + return invokeObjcSelf!(Object, "initWithCapacity:", NSUInteger)(numItems); + } + + this (NSUInteger numItems) + { + typeof(this).alloc.initWithCapacity(numItems); + } + + Object initWithArray (NSArray array) + { + return invokeObjcSelf!(Object, "initWithArray:", NSArray)(array); + } + + this (NSArray array) + { + typeof(this).alloc.initWithArray(array); + } + + Object initWithSet (NSSet set) + { + return invokeObjcSelf!(Object, "initWithSet:", NSSet)(set); + } + + this (NSSet set) + { + typeof(this).alloc.initWithSet(set); + } + + NSUInteger countForObject (Object object) + { + return invokeObjcSelf!(NSUInteger, "countForObject:", Object)(object); + } + + NSEnumerator objectEnumerator () + { + return invokeObjcSelf!(NSEnumerator, "objectEnumerator"); + } + + void addObject (Object object) + { + return invokeObjcSelf!(void, "addObject:", Object)(object); + } + + void removeObject (Object object) + { + return invokeObjcSelf!(void, "removeObject:", Object)(object); + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSSortDescriptor.d --- a/dstep/foundation/NSSortDescriptor.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSSortDescriptor.d Sun Jan 03 22:06:11 2010 +0100 @@ -7,12 +7,26 @@ module dstep.foundation.NSSortDescriptor; import dstep.foundation.NSArray; +import dstep.foundation.NSCoder; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSZone; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; class NSSortDescriptor : NSObject, INSCoding, INSCopying { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } Object initWithKey (NSString key, bool ascending) { @@ -21,13 +35,7 @@ this (NSString key, bool ascending) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithKey:ascending:", NSString, bool)(objcObject, key, ascending); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithKey(key, ascending); } Object initWithKey (NSString key, bool ascending, SEL selector) @@ -37,13 +45,7 @@ this (NSString key, bool ascending, SEL selector) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithKey:ascending:selector:", NSString, bool, SEL)(objcObject, key, ascending, selector); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithKey(key, ascending, selector); } NSString key () @@ -83,13 +85,7 @@ this (NSCoder aDecoder) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithCoder(aDecoder); } Object copyWithZone (NSZone* zone) @@ -98,11 +94,11 @@ } } -template TNSSortDescriptorSorting () -{ +const TNSSortDescriptorSorting = ` + NSArray sortedArrayUsingDescriptors (NSArray sortDescriptors) { return invokeObjcSelf!(NSArray, "sortedArrayUsingDescriptors:", NSArray)(sortDescriptors); } -} +`; diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSSpellServer.d --- a/dstep/foundation/NSSpellServer.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSSpellServer.d Sun Jan 03 22:06:11 2010 +0100 @@ -9,25 +9,105 @@ import dstep.foundation.NSArray; import dstep.foundation.NSObject; import dstep.foundation.NSRange; +import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + import bindings = dstep.foundation.NSSpellServer_bindings; -const NSString NSGrammarRange; -const NSString NSGrammarUserDescription; -const NSString NSGrammarCorrections; +private +{ + NSString NSGrammarRange_; + NSString NSGrammarUserDescription_; + NSString NSGrammarCorrections_; +} + +NSString NSGrammarRange () +{ + if (NSGrammarRange_) + return NSGrammarRange_; + + return NSGrammarRange_ = new NSString(bindings.NSGrammarRange); +} + +NSString NSGrammarUserDescription () +{ + if (NSGrammarUserDescription_) + return NSGrammarUserDescription_; + + return NSGrammarUserDescription_ = new NSString(bindings.NSGrammarUserDescription); +} + +NSString NSGrammarCorrections () +{ + if (NSGrammarCorrections_) + return NSGrammarCorrections_; + + return NSGrammarCorrections_ = new NSString(bindings.NSGrammarCorrections); +} -static this () -{ - NSGrammarRange = new NSString(bindings.NSGrammarRange); - NSGrammarUserDescription = new NSString(bindings.NSGrammarUserDescription); - NSGrammarCorrections = new NSString(bindings.NSGrammarCorrections); -} +const TNSSpellServerDelegate = ` + + NSRange spellServer (NSSpellServer sender, NSString stringToCheck, NSString language, NSInteger* wordCount, bool countOnly) + { + return invokeObjcSelf!(NSRange, "spellServer:findMisspelledWordInString:language:wordCount:countOnly:", NSSpellServer, NSString, NSString, NSInteger*, bool)(sender, stringToCheck, language, wordCount, countOnly); + } + + NSArray spellServer (NSSpellServer sender, NSString word, NSString language) + { + return invokeObjcSelf!(NSArray, "spellServer:suggestGuessesForWord:inLanguage:", NSSpellServer, NSString, NSString)(sender, word, language); + } + + void spellServer_didLearnWord_inLanguage (NSSpellServer sender, NSString word, NSString language) + { + return invokeObjcSelf!(void, "spellServer:didLearnWord:inLanguage:", NSSpellServer, NSString, NSString)(sender, word, language); + } + + void spellServer (NSSpellServer sender, NSString word, NSString language) + { + return invokeObjcSelf!(void, "spellServer:didForgetWord:inLanguage:", NSSpellServer, NSString, NSString)(sender, word, language); + } + + NSArray spellServer (NSSpellServer sender, NSRange range, NSString string, NSString language) + { + return invokeObjcSelf!(NSArray, "spellServer:suggestCompletionsForPartialWordRange:inString:language:", NSSpellServer, NSRange, NSString, NSString)(sender, range, string, language); + } + + NSRange spellServer (NSSpellServer sender, NSString stringToCheck, NSString language, out NSArray details) + { + id det = new objc_object; + + NSRange result = invokeObjcSelf!(NSRange, "spellServer:checkGrammarInString:language:details:", NSSpellServer, NSString, NSString, id*)(sender, stringToCheck, language, &det); + + if (det) + details = new NSArray(det); + + return result; + } + + //mixin ObjcBindMethod!(spellServer, "spellServer:findMisspelledWordInString:language:wordCount:countOnly:"); + //mixin ObjcBindMethod!(spellServer, "spellServer:suggestGuessesForWord:inLanguage:"); + //mixin ObjcBindMethod!(spellServer, "spellServer:didLearnWord:inLanguage:"); + //mixin ObjcBindMethod!(spellServer, "spellServer:didForgetWord:inLanguage:"); + //mixin ObjcBindMethod!(spellServer, "spellServer:suggestCompletionsForPartialWordRange:inString:language:"); + //mixin ObjcBindMethod!(spellServer, "spellServer:checkGrammarInString:language:details:"); +`; class NSSpellServer : NSObject { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } void setDelegate (Object anObject) { @@ -53,15 +133,4 @@ { return invokeObjcSelf!(void, "run"); } -} - -template TNSSpellServerDelegate () -{ - NSRange spellServer (NSSpellServer sender, NSString stringToCheck, NSString language, NSInteger* wordCount, bool countOnly); - NSArray spellServer (NSSpellServer sender, NSString word, NSString language); - void spellServer (NSSpellServer sender, NSString word, NSString language); - void spellServer (NSSpellServer sender, NSString word, NSString language); - NSArray spellServer (NSSpellServer sender, NSRange range, NSString string, NSString language); - NSRange spellServer (NSSpellServer sender, NSString stringToCheck, NSString language, NSArray** details); -} - +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSSpellServer_bindings.d --- a/dstep/foundation/NSSpellServer_bindings.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSSpellServer_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -4,7 +4,9 @@ import dstep.foundation.NSObject; import dstep.foundation.NSRange; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + extern (C) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSStream.d --- a/dstep/foundation/NSStream.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSStream.d Sun Jan 03 22:06:11 2010 +0100 @@ -10,37 +10,185 @@ import dstep.foundation.NSDictionary; import dstep.foundation.NSError; import dstep.foundation.NSHost; -import dstep.foundation.NSInputStream; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; -import dstep.foundation.NSOutputStream; import dstep.foundation.NSRunLoop; import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + import bindings = dstep.foundation.NSStream_bindings; alias NSUInteger NSStreamStatus; alias NSUInteger NSStreamEvent; -const NSString NSStreamSocketSecurityLevelKey; -const NSString NSStreamSocketSecurityLevelNone; -const NSString NSStreamSocketSecurityLevelSSLv2; -const NSString NSStreamSocketSecurityLevelSSLv3; -const NSString NSStreamSocketSecurityLevelTLSv1; -const NSString NSStreamSocketSecurityLevelNegotiatedSSL; -const NSString NSStreamSOCKSProxyConfigurationKey; -const NSString NSStreamSOCKSProxyHostKey; -const NSString NSStreamSOCKSProxyPortKey; -const NSString NSStreamSOCKSProxyVersionKey; -const NSString NSStreamSOCKSProxyUserKey; -const NSString NSStreamSOCKSProxyPasswordKey; -const NSString NSStreamSOCKSProxyVersion4; -const NSString NSStreamSOCKSProxyVersion5; -const NSString NSStreamDataWrittenToMemoryStreamKey; -const NSString NSStreamFileCurrentOffsetKey; -const NSString NSStreamSocketSSLErrorDomain; -const NSString NSStreamSOCKSErrorDomain; +private +{ + NSString NSStreamSocketSecurityLevelKey_; + NSString NSStreamSocketSecurityLevelNone_; + NSString NSStreamSocketSecurityLevelSSLv2_; + NSString NSStreamSocketSecurityLevelSSLv3_; + NSString NSStreamSocketSecurityLevelTLSv1_; + NSString NSStreamSocketSecurityLevelNegotiatedSSL_; + NSString NSStreamSOCKSProxyConfigurationKey_; + NSString NSStreamSOCKSProxyHostKey_; + NSString NSStreamSOCKSProxyPortKey_; + NSString NSStreamSOCKSProxyVersionKey_; + NSString NSStreamSOCKSProxyUserKey_; + NSString NSStreamSOCKSProxyPasswordKey_; + NSString NSStreamSOCKSProxyVersion4_; + NSString NSStreamSOCKSProxyVersion5_; + NSString NSStreamDataWrittenToMemoryStreamKey_; + NSString NSStreamFileCurrentOffsetKey_; + NSString NSStreamSocketSSLErrorDomain_; + NSString NSStreamSOCKSErrorDomain_; +} + +NSString NSStreamSocketSecurityLevelKey () +{ + if (NSStreamSocketSecurityLevelKey_) + return NSStreamSocketSecurityLevelKey_; + + return NSStreamSocketSecurityLevelKey_ = new NSString(bindings.NSStreamSocketSecurityLevelKey); +} + +NSString NSStreamSocketSecurityLevelNone () +{ + if (NSStreamSocketSecurityLevelNone_) + return NSStreamSocketSecurityLevelNone_; + + return NSStreamSocketSecurityLevelNone_ = new NSString(bindings.NSStreamSocketSecurityLevelNone); +} + +NSString NSStreamSocketSecurityLevelSSLv2 () +{ + if (NSStreamSocketSecurityLevelSSLv2_) + return NSStreamSocketSecurityLevelSSLv2_; + + return NSStreamSocketSecurityLevelSSLv2_ = new NSString(bindings.NSStreamSocketSecurityLevelSSLv2); +} + +NSString NSStreamSocketSecurityLevelSSLv3 () +{ + if (NSStreamSocketSecurityLevelSSLv3_) + return NSStreamSocketSecurityLevelSSLv3_; + + return NSStreamSocketSecurityLevelSSLv3_ = new NSString(bindings.NSStreamSocketSecurityLevelSSLv3); +} + +NSString NSStreamSocketSecurityLevelTLSv1 () +{ + if (NSStreamSocketSecurityLevelTLSv1_) + return NSStreamSocketSecurityLevelTLSv1_; + + return NSStreamSocketSecurityLevelTLSv1_ = new NSString(bindings.NSStreamSocketSecurityLevelTLSv1); +} + +NSString NSStreamSocketSecurityLevelNegotiatedSSL () +{ + if (NSStreamSocketSecurityLevelNegotiatedSSL_) + return NSStreamSocketSecurityLevelNegotiatedSSL_; + + return NSStreamSocketSecurityLevelNegotiatedSSL_ = new NSString(bindings.NSStreamSocketSecurityLevelNegotiatedSSL); +} + +NSString NSStreamSOCKSProxyConfigurationKey () +{ + if (NSStreamSOCKSProxyConfigurationKey_) + return NSStreamSOCKSProxyConfigurationKey_; + + return NSStreamSOCKSProxyConfigurationKey_ = new NSString(bindings.NSStreamSOCKSProxyConfigurationKey); +} + +NSString NSStreamSOCKSProxyHostKey () +{ + if (NSStreamSOCKSProxyHostKey_) + return NSStreamSOCKSProxyHostKey_; + + return NSStreamSOCKSProxyHostKey_ = new NSString(bindings.NSStreamSOCKSProxyHostKey); +} + +NSString NSStreamSOCKSProxyPortKey () +{ + if (NSStreamSOCKSProxyPortKey_) + return NSStreamSOCKSProxyPortKey_; + + return NSStreamSOCKSProxyPortKey_ = new NSString(bindings.NSStreamSOCKSProxyPortKey); +} + +NSString NSStreamSOCKSProxyVersionKey () +{ + if (NSStreamSOCKSProxyVersionKey_) + return NSStreamSOCKSProxyVersionKey_; + + return NSStreamSOCKSProxyVersionKey_ = new NSString(bindings.NSStreamSOCKSProxyVersionKey); +} + +NSString NSStreamSOCKSProxyUserKey () +{ + if (NSStreamSOCKSProxyUserKey_) + return NSStreamSOCKSProxyUserKey_; + + return NSStreamSOCKSProxyUserKey_ = new NSString(bindings.NSStreamSOCKSProxyUserKey); +} + +NSString NSStreamSOCKSProxyPasswordKey () +{ + if (NSStreamSOCKSProxyPasswordKey_) + return NSStreamSOCKSProxyPasswordKey_; + + return NSStreamSOCKSProxyPasswordKey_ = new NSString(bindings.NSStreamSOCKSProxyPasswordKey); +} + +NSString NSStreamSOCKSProxyVersion4 () +{ + if (NSStreamSOCKSProxyVersion4_) + return NSStreamSOCKSProxyVersion4_; + + return NSStreamSOCKSProxyVersion4_ = new NSString(bindings.NSStreamSOCKSProxyVersion4); +} + +NSString NSStreamSOCKSProxyVersion5 () +{ + if (NSStreamSOCKSProxyVersion5_) + return NSStreamSOCKSProxyVersion5_; + + return NSStreamSOCKSProxyVersion5_ = new NSString(bindings.NSStreamSOCKSProxyVersion5); +} + +NSString NSStreamDataWrittenToMemoryStreamKey () +{ + if (NSStreamDataWrittenToMemoryStreamKey_) + return NSStreamDataWrittenToMemoryStreamKey_; + + return NSStreamDataWrittenToMemoryStreamKey_ = new NSString(bindings.NSStreamDataWrittenToMemoryStreamKey); +} + +NSString NSStreamFileCurrentOffsetKey () +{ + if (NSStreamFileCurrentOffsetKey_) + return NSStreamFileCurrentOffsetKey_; + + return NSStreamFileCurrentOffsetKey_ = new NSString(bindings.NSStreamFileCurrentOffsetKey); +} + +NSString NSStreamSocketSSLErrorDomain () +{ + if (NSStreamSocketSSLErrorDomain_) + return NSStreamSocketSSLErrorDomain_; + + return NSStreamSocketSSLErrorDomain_ = new NSString(bindings.NSStreamSocketSSLErrorDomain); +} + +NSString NSStreamSOCKSErrorDomain () +{ + if (NSStreamSOCKSErrorDomain_) + return NSStreamSOCKSErrorDomain_; + + return NSStreamSOCKSErrorDomain_ = new NSString(bindings.NSStreamSOCKSErrorDomain); +} enum { @@ -64,32 +212,118 @@ NSStreamEventEndEncountered = 1 << 4 } -static this () -{ - NSStreamSocketSecurityLevelKey = new NSString(bindings.NSStreamSocketSecurityLevelKey); - NSStreamSocketSecurityLevelNone = new NSString(bindings.NSStreamSocketSecurityLevelNone); - NSStreamSocketSecurityLevelSSLv2 = new NSString(bindings.NSStreamSocketSecurityLevelSSLv2); - NSStreamSocketSecurityLevelSSLv3 = new NSString(bindings.NSStreamSocketSecurityLevelSSLv3); - NSStreamSocketSecurityLevelTLSv1 = new NSString(bindings.NSStreamSocketSecurityLevelTLSv1); - NSStreamSocketSecurityLevelNegotiatedSSL = new NSString(bindings.NSStreamSocketSecurityLevelNegotiatedSSL); - NSStreamSOCKSProxyConfigurationKey = new NSString(bindings.NSStreamSOCKSProxyConfigurationKey); - NSStreamSOCKSProxyHostKey = new NSString(bindings.NSStreamSOCKSProxyHostKey); - NSStreamSOCKSProxyPortKey = new NSString(bindings.NSStreamSOCKSProxyPortKey); - NSStreamSOCKSProxyVersionKey = new NSString(bindings.NSStreamSOCKSProxyVersionKey); - NSStreamSOCKSProxyUserKey = new NSString(bindings.NSStreamSOCKSProxyUserKey); - NSStreamSOCKSProxyPasswordKey = new NSString(bindings.NSStreamSOCKSProxyPasswordKey); - NSStreamSOCKSProxyVersion4 = new NSString(bindings.NSStreamSOCKSProxyVersion4); - NSStreamSOCKSProxyVersion5 = new NSString(bindings.NSStreamSOCKSProxyVersion5); - NSStreamDataWrittenToMemoryStreamKey = new NSString(bindings.NSStreamDataWrittenToMemoryStreamKey); - NSStreamFileCurrentOffsetKey = new NSString(bindings.NSStreamFileCurrentOffsetKey); - NSStreamSocketSSLErrorDomain = new NSString(bindings.NSStreamSocketSSLErrorDomain); - NSStreamSOCKSErrorDomain = new NSString(bindings.NSStreamSOCKSErrorDomain); -} +const TNSStreamDelegateEventExtensions = ` + + void stream (NSStream aStream, NSStreamEvent eventCode) + { + return invokeObjcSelf!(void, "stream:handleEvent:", NSStream, NSStreamEvent)(aStream, eventCode); + } + + //mixin ObjcBindMethod!(stream, "stream:handleEvent:"); +`; + +const TNSOutputStreamExtensions = ` + + Object initToMemory () + { + return invokeObjcSelf!(Object, "initToMemory"); + } + + this () + { + typeof(this).alloc.initToMemory(); + } + + Object initToBuffer (char* buffer, NSUInteger capacity) + { + return invokeObjcSelf!(Object, "initToBuffer:capacity:", char*, NSUInteger)(buffer, capacity); + } + + this (char* buffer, NSUInteger capacity) + { + typeof(this).alloc.initToBuffer(buffer, capacity); + } + + Object initToFileAtPath (NSString path, bool shouldAppend) + { + return invokeObjcSelf!(Object, "initToFileAtPath:append:", NSString, bool)(path, shouldAppend); + } + + this (NSString path, bool shouldAppend) + { + typeof(this).alloc.initToFileAtPath(path, shouldAppend); + } + + static Object outputStreamToMemory () + { + return invokeObjcSuperClass!(Object, "outputStreamToMemory"); + } + + static Object outputStreamToBuffer (char* buffer, NSUInteger capacity) + { + return invokeObjcSuperClass!(Object, "outputStreamToBuffer:capacity:", char*, NSUInteger)(buffer, capacity); + } + + static Object outputStreamToFileAtPath (NSString path, bool shouldAppend) + { + return invokeObjcSuperClass!(Object, "outputStreamToFileAtPath:append:", NSString, bool)(path, shouldAppend); + } +`; + +const TNSSocketStreamCreationExtensions = ` + + static void getStreamsToHost (NSHost host, NSInteger port, NSInputStream** inputStream, NSOutputStream** outputStream) + { + return invokeObjcSuperClass!(void, "getStreamsToHost:port:inputStream:outputStream:", NSHost, NSInteger, NSInputStream**, NSOutputStream**)(host, port, inputStream, outputStream); + } +`; + +const TNSInputStreamExtensions = ` + + Object initWithData (NSData data) + { + return invokeObjcSelf!(Object, "initWithData:", NSData)(data); + } + + this (NSData data) + { + typeof(this).alloc.initWithData(data); + } + + Object initWithFileAtPath (NSString path) + { + return invokeObjcSelf!(Object, "initWithFileAtPath:", NSString)(path); + } + + this (NSString path) + { + typeof(this).alloc.initWithFileAtPath(path); + } + + static Object inputStreamWithData (NSData data) + { + return invokeObjcSuperClass!(Object, "inputStreamWithData:", NSData)(data); + } + + static Object inputStreamWithFileAtPath (NSString path) + { + return invokeObjcSuperClass!(Object, "inputStreamWithFileAtPath:", NSString)(path); + } +`; class NSStream : NSObject { - mixin ObjcWrap; - mixin TNSSocketStreamCreationExtensions; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } void open () { @@ -140,12 +374,27 @@ { return invokeObjcSelf!(NSError, "streamError"); } + + // TNSSocketStreamCreationExtensions + static void getStreamsToHost (NSHost host, NSInteger port, NSInputStream** inputStream, NSOutputStream** outputStream) + { + return invokeObjcSuperClass!(void, "getStreamsToHost:port:inputStream:outputStream:", NSHost, NSInteger, NSInputStream**, NSOutputStream**)(host, port, inputStream, outputStream); + } } class NSOutputStream : NSStream { - mixin ObjcWrap; - mixin TNSOutputStreamExtensions; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } NSInteger write (char* buffer, NSUInteger len) { @@ -156,150 +405,106 @@ { return invokeObjcSelf!(bool, "hasSpaceAvailable"); } + + // TNSOutputStreamExtensions + Object initToMemory () + { + return invokeObjcSelf!(Object, "initToMemory"); + } + + Object initToBuffer (char* buffer, NSUInteger capacity) + { + return invokeObjcSelf!(Object, "initToBuffer:capacity:", char*, NSUInteger)(buffer, capacity); + } + + this (char* buffer, NSUInteger capacity) + { + typeof(this).alloc.initToBuffer(buffer, capacity); + } + + Object initToFileAtPath (NSString path, bool shouldAppend) + { + return invokeObjcSelf!(Object, "initToFileAtPath:append:", NSString, bool)(path, shouldAppend); + } + + this (NSString path, bool shouldAppend) + { + typeof(this).alloc.initToFileAtPath(path, shouldAppend); + } + + static Object outputStreamToMemory () + { + return invokeObjcSuperClass!(Object, "outputStreamToMemory"); + } + + static Object outputStreamToBuffer (char* buffer, NSUInteger capacity) + { + return invokeObjcSuperClass!(Object, "outputStreamToBuffer:capacity:", char*, NSUInteger)(buffer, capacity); + } + + static Object outputStreamToFileAtPath (NSString path, bool shouldAppend) + { + return invokeObjcSuperClass!(Object, "outputStreamToFileAtPath:append:", NSString, bool)(path, shouldAppend); + } } class NSInputStream : NSStream { - mixin ObjcWrap; - mixin TNSInputStreamExtensions; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } NSInteger read (char* buffer, NSUInteger len) { return invokeObjcSelf!(NSInteger, "read:maxLength:", char*, NSUInteger)(buffer, len); } - bool getBuffer (uint8_t** buffer, NSUInteger* len) + bool getBuffer (ubyte** buffer, NSUInteger* len) { - return invokeObjcSelf!(bool, "getBuffer:length:", uint8_t**, NSUInteger*)(buffer, len); + return invokeObjcSelf!(bool, "getBuffer:length:", ubyte**, NSUInteger*)(buffer, len); } bool hasBytesAvailable () { return invokeObjcSelf!(bool, "hasBytesAvailable"); } -} - -template TNSStreamDelegateEventExtensions () -{ - void stream (NSStream aStream, uint eventCode); -} - -template TNSOutputStreamExtensions () -{ - Object initToMemory () - { - return invokeObjcSelf!(Object, "initToMemory"); - } - - this () - { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initToMemory")(objcObject); - - if (result) - objcObject = ret; - - dObject = this; - } - - Object initToBuffer (char* buffer, NSUInteger capacity) - { - return invokeObjcSelf!(Object, "initToBuffer:capacity:", char*, NSUInteger)(buffer, capacity); - } - - this (char* buffer, NSUInteger capacity) - { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initToBuffer:capacity:", char*, NSUInteger)(objcObject, buffer, capacity); - - if (result) - objcObject = ret; - - dObject = this; - } - - Object initToFileAtPath (NSString path, bool shouldAppend) - { - return invokeObjcSelf!(Object, "initToFileAtPath:append:", NSString, bool)(path, shouldAppend); - } - - this (NSString path, bool shouldAppend) - { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initToFileAtPath:append:", NSString, bool)(objcObject, path, shouldAppend); - - if (result) - objcObject = ret; - - dObject = this; - } - - static Object outputStreamToMemory () - { - return invokeObjcSelfClass!(Object, "outputStreamToMemory"); - } - - static Object outputStreamToBuffer (char* buffer, NSUInteger capacity) - { - return invokeObjcSelfClass!(Object, "outputStreamToBuffer:capacity:", char*, NSUInteger)(buffer, capacity); - } - - static Object outputStreamToFileAtPath (NSString path, bool shouldAppend) - { - return invokeObjcSelfClass!(Object, "outputStreamToFileAtPath:append:", NSString, bool)(path, shouldAppend); - } -} - -template TNSSocketStreamCreationExtensions () -{ - static void getStreamsToHost (NSHost host, NSInteger port, NSInputStream** inputStream, NSOutputStream** outputStream) - { - return invokeObjcSelfClass!(void, "getStreamsToHost:port:inputStream:outputStream:", NSHost, NSInteger, NSInputStream**, NSOutputStream**)(host, port, inputStream, outputStream); - } -} - -template TNSInputStreamExtensions () -{ + + // TNSInputStreamExtensions Object initWithData (NSData data) { return invokeObjcSelf!(Object, "initWithData:", NSData)(data); } - + this (NSData data) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithData:", NSData)(objcObject, data); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithData(data); } - + Object initWithFileAtPath (NSString path) { return invokeObjcSelf!(Object, "initWithFileAtPath:", NSString)(path); } - + this (NSString path) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithFileAtPath:", NSString)(objcObject, path); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithFileAtPath(path); } - + static Object inputStreamWithData (NSData data) { - return invokeObjcSelfClass!(Object, "inputStreamWithData:", NSData)(data); + return invokeObjcSuperClass!(Object, "inputStreamWithData:", NSData)(data); } - + static Object inputStreamWithFileAtPath (NSString path) { - return invokeObjcSelfClass!(Object, "inputStreamWithFileAtPath:", NSString)(path); + return invokeObjcSuperClass!(Object, "inputStreamWithFileAtPath:", NSString)(path); } -} - +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSStream_bindings.d --- a/dstep/foundation/NSStream_bindings.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSStream_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -1,16 +1,8 @@ module dstep.foundation.NSStream_bindings; -import dstep.foundation.NSData; -import dstep.foundation.NSDictionary; -import dstep.foundation.NSError; -import dstep.foundation.NSHost; -import dstep.foundation.NSInputStream; -import dstep.foundation.NSObject; -import dstep.foundation.NSOutputStream; -import dstep.foundation.NSRunLoop; -import dstep.foundation.NSString; -import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + extern (C) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSString.d --- a/dstep/foundation/NSString.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSString.d Sun Jan 03 22:06:11 2010 +0100 @@ -8,27 +8,51 @@ import dstep.foundation.NSArray; import dstep.foundation.NSCharacterSet; +import dstep.foundation.NSCoder; import dstep.foundation.NSData; import dstep.foundation.NSDictionary; import dstep.foundation.NSError; import dstep.foundation.NSLocale; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; +import dstep.foundation.NSPathUtilities; import dstep.foundation.NSRange; import dstep.foundation.NSURL; -import dstep.limits; +import dstep.foundation.NSZone; +import dstep.internal.String; +import dstep.internal.Version; +import dstep.objc.bridge.Wrapper; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; -import dstep.stdarg; +import dstep.objc.objc; import bindings = dstep.foundation.NSString_bindings; -alias ushort unichar; +alias wchar unichar; alias NSUInteger NSStringCompareOptions; alias NSUInteger NSStringEncoding; alias NSUInteger NSStringEncodingConversionOptions; -const NSString NSParseErrorException; -const NSString NSCharacterConversionException; +private +{ + NSString NSParseErrorException_; + NSString NSCharacterConversionException_; +} + +NSString NSParseErrorException () +{ + if (NSParseErrorException_) + return NSParseErrorException_; + + return NSParseErrorException_ = new NSString(bindings.NSParseErrorException); +} + +NSString NSCharacterConversionException () +{ + if (NSCharacterConversionException_) + return NSCharacterConversionException_; + + return NSCharacterConversionException_ = new NSString(bindings.NSCharacterConversionException); +} enum { @@ -75,76 +99,8 @@ NSStringEncodingConversionExternalRepresentation = 2 } -static this () -{ - NSParseErrorException = new NSString(bindings.NSParseErrorException); - NSCharacterConversionException = new NSString(bindings.NSCharacterConversionException); -} - -class NSMutableString : NSString -{ - mixin ObjcWrap; - mixin TNSMutableStringExtensionMethods; - - void replaceCharactersInRange (NSRange range, NSString aString) - { - return invokeObjcSelf!(void, "replaceCharactersInRange:withString:", NSRange, NSString)(range, aString); - } -} - -class NSString : NSObject, INSCopying, INSMutableCopying, INSCoding -{ - mixin ObjcWrap; - mixin TNSExtendedStringPropertyListParsing; - mixin TNSStringExtensionMethods; - mixin TNSStringPathExtensions; - mixin TNSURLUtilities; - mixin TNSStringDeprecated; - - NSUInteger length () - { - return invokeObjcSelf!(NSUInteger, "length"); - } +const TNSExtendedStringPropertyListParsing = ` - ushort characterAtIndex (NSUInteger index) - { - return invokeObjcSelf!(ushort, "characterAtIndex:", NSUInteger)(index); - } - - Object copyWithZone (NSZone* zone) - { - return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); - } - - Object mutableCopyWithZone (NSZone* zone) - { - return invokeObjcSelf!(Object, "mutableCopyWithZone:", NSZone*)(zone); - } - - void encodeWithCoder (NSCoder aCoder) - { - return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); - } - - Object initWithCoder (NSCoder aDecoder) - { - return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); - } - - this (NSCoder aDecoder) - { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); - - if (result) - objcObject = ret; - - dObject = this; - } -} - -template TNSExtendedStringPropertyListParsing () -{ Object propertyList () { return invokeObjcSelf!(Object, "propertyList"); @@ -154,10 +110,10 @@ { return invokeObjcSelf!(NSDictionary, "propertyListFromStringsFileFormat"); } -} +`; -template TNSMutableStringExtensionMethods () -{ +const TNSMutableStringExtensionMethods = ` + void insertString (NSString aString, NSUInteger loc) { return invokeObjcSelf!(void, "insertString:atIndex:", NSString, NSUInteger)(aString, loc); @@ -183,35 +139,29 @@ return invokeObjcSelf!(void, "setString:", NSString)(aString); } - Object initWithCapacity (NSUInteger capacity) + NSString initWithCapacity (NSUInteger capacity) { return invokeObjcSelf!(Object, "initWithCapacity:", NSUInteger)(capacity); } - this (NSUInteger capacity) + /*this (NSUInteger capacity) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCapacity:", NSUInteger)(objcObject, capacity); - - if (result) - objcObject = ret; - - dObject = this; - } + typeof(this).alloc.initWithCapacity(capacity); + }*/ static Object stringWithCapacity (NSUInteger capacity) { - return invokeObjcSelfClass!(Object, "stringWithCapacity:", NSUInteger)(capacity); + return invokeObjcSuperClass!(Object, "stringWithCapacity:", NSUInteger)(capacity); } NSUInteger replaceOccurrencesOfString (NSString target, NSString replacement, uint options, NSRange searchRange) { return invokeObjcSelf!(NSUInteger, "replaceOccurrencesOfString:withString:options:range:", NSString, NSString, uint, NSRange)(target, replacement, options, searchRange); } -} +`; -template TNSStringExtensionMethods () -{ +const TNSStringExtensionMethods = ` + void getCharacters (unichar* buffer) { return invokeObjcSelf!(void, "getCharacters:", unichar*)(buffer); @@ -539,359 +489,337 @@ static uint defaultCStringEncoding () { - return invokeObjcSelfClass!(uint, "defaultCStringEncoding"); + return invokeObjcSuperClass!(uint, "defaultCStringEncoding"); } static NSStringEncoding* availableStringEncodings () { - return invokeObjcSelfClass!(NSStringEncoding*, "availableStringEncodings"); + return invokeObjcSuperClass!(NSStringEncoding*, "availableStringEncodings"); } static NSString localizedNameOfStringEncoding (uint encoding) { - return invokeObjcSelfClass!(NSString, "localizedNameOfStringEncoding:", uint)(encoding); - } - - Object init () - { - return invokeObjcSelf!(Object, "init"); + return invokeObjcSuperClass!(NSString, "localizedNameOfStringEncoding:", uint)(encoding); } - this () - { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "init")(objcObject); - - if (result) - objcObject = ret; - - dObject = this; - } - - Object initWithCharactersNoCopy (unichar* characters, NSUInteger length, bool freeBuffer) + NSString initWithCharactersNoCopy (unichar* characters, NSUInteger length, bool freeBuffer) { return invokeObjcSelf!(Object, "initWithCharactersNoCopy:length:freeWhenDone:", unichar*, NSUInteger, bool)(characters, length, freeBuffer); } - this (unichar* characters, NSUInteger length, bool freeBuffer) + /*this (unichar* characters, NSUInteger length, bool freeBuffer) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCharactersNoCopy:length:freeWhenDone:", unichar*, NSUInteger, bool)(objcObject, characters, length, freeBuffer); + typeof(this).alloc.initWithCharactersNoCopy(characters, length, freeBuffer); + }*/ - if (result) - objcObject = ret; - - dObject = this; - } - - Object initWithCharacters (unichar* characters, NSUInteger length) + NSString initWithCharacters (unichar* characters, NSUInteger length) { return invokeObjcSelf!(Object, "initWithCharacters:length:", unichar*, NSUInteger)(characters, length); } - this (unichar* characters, NSUInteger length) + /*this (unichar* characters, NSUInteger length) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCharacters:length:", unichar*, NSUInteger)(objcObject, characters, length); + typeof(this).alloc.initWithCharacters(characters, length); + }*/ - if (result) - objcObject = ret; - - dObject = this; - } - - Object initWithUTF8String (char* nullTerminatedCString) + NSString initWithUTF8String (char* nullTerminatedCString) { return invokeObjcSelf!(Object, "initWithUTF8String:", char*)(nullTerminatedCString); } - this (char* nullTerminatedCString) + /*this (char* nullTerminatedCString) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithUTF8String:", char*)(objcObject, nullTerminatedCString); + typeof(this).alloc.initWithUTF8String(nullTerminatedCString); + }*/ - if (result) - objcObject = ret; - - dObject = this; - } - - Object initWithString (NSString aString) + NSString initWithString (NSString aString) { return invokeObjcSelf!(Object, "initWithString:", NSString)(aString); } - this (NSString aString) + /*this (NSString aString) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithString:", NSString)(objcObject, aString); + typeof(this).alloc.initWithString(aString); + }*/ - if (result) - objcObject = ret; - - dObject = this; - } - - Object initWithFormat (NSString initWithFormat, ...) + NSString initWithFormat (NSString initWithFormat, ...) { return invokeObjcSelf!(Object, "initWithFormat:", NSString)(initWithFormat); } - this (NSString initWithFormat, ...) + /*this (NSString initWithFormat, ...) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithFormat:", NSString)(objcObject, initWithFormat); + typeof(this).alloc.initWithFormat(initWithFormat); + }*/ - if (result) - objcObject = ret; - - dObject = this; - } - - Object initWithFormat (NSString format, char* argList) + NSString initWithFormat (NSString format, char* argList) { return invokeObjcSelf!(Object, "initWithFormat:arguments:", NSString, char*)(format, argList); } - this (NSString format, char* argList) + /*this (NSString format, char* argList) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithFormat:arguments:", NSString, char*)(objcObject, format, argList); + typeof(this).alloc.initWithFormat(format, argList); + }*/ - if (result) - objcObject = ret; - - dObject = this; - } - - Object initWithFormat (NSString format, Object locale, ...) + NSString initWithFormat (NSString format, Object locale, ...) { return invokeObjcSelf!(Object, "initWithFormat:locale:", NSString, Object)(format, locale); } - this (NSString format, Object locale, ...) + /*this (NSString format, Object locale, ...) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithFormat:locale:", NSString, Object)(objcObject, format, locale); + typeof(this).alloc.initWithFormat(format, locale); + }*/ - if (result) - objcObject = ret; - - dObject = this; - } - - Object initWithFormat (NSString format, Object locale, char* argList) + NSString initWithFormat (NSString format, Object locale, char* argList) { return invokeObjcSelf!(Object, "initWithFormat:locale:arguments:", NSString, Object, char*)(format, locale, argList); } - this (NSString format, Object locale, char* argList) + /*this (NSString format, Object locale, char* argList) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithFormat:locale:arguments:", NSString, Object, char*)(objcObject, format, locale, argList); + typeof(this).alloc.initWithFormat(format, locale, argList); + }*/ - if (result) - objcObject = ret; - - dObject = this; - } - - Object initWithData (NSData data, uint encoding) + NSString initWithData (NSData data, uint encoding) { return invokeObjcSelf!(Object, "initWithData:encoding:", NSData, uint)(data, encoding); } - this (NSData data, uint encoding) + /*this (NSData data, uint encoding) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithData:encoding:", NSData, uint)(objcObject, data, encoding); + typeof(this).alloc.initWithData(data, encoding); + }*/ - if (result) - objcObject = ret; - - dObject = this; - } - - Object initWithBytes (void* bytes, NSUInteger len, uint encoding) + NSString initWithBytes (void* bytes, NSUInteger len, uint encoding) { return invokeObjcSelf!(Object, "initWithBytes:length:encoding:", void*, NSUInteger, uint)(bytes, len, encoding); } - this (void* bytes, NSUInteger len, uint encoding) + /*this (void* bytes, NSUInteger len, uint encoding) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithBytes:length:encoding:", void*, NSUInteger, uint)(objcObject, bytes, len, encoding); + typeof(this).alloc.initWithBytes(bytes, len, encoding); + }*/ - if (result) - objcObject = ret; - - dObject = this; + NSString initWithBytesNoCopy (void* bytes, NSUInteger len, NSStringEncoding encoding, bool freeBuffer) + { + return invokeObjcSelf!(Object, "initWithBytesNoCopy:length:encoding:freeWhenDone:", void*, NSUInteger, NSStringEncoding, bool)(bytes, len, encoding, freeBuffer); } - Object initWithBytesNoCopy (void* bytes, NSUInteger len, uint encoding, bool freeBuffer) - { - return invokeObjcSelf!(Object, "initWithBytesNoCopy:length:encoding:freeWhenDone:", void*, NSUInteger, uint, bool)(bytes, len, encoding, freeBuffer); - } - - this (void* bytes, NSUInteger len, uint encoding, bool freeBuffer) + /*this (void* bytes, NSUInteger len, uint encoding, bool freeBuffer) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithBytesNoCopy:length:encoding:freeWhenDone:", void*, NSUInteger, uint, bool)(objcObject, bytes, len, encoding, freeBuffer); - - if (result) - objcObject = ret; - - dObject = this; - } + typeof(this).alloc.initWithBytesNoCopy(bytes, len, encoding, freeBuffer); + }*/ static Object string () { - return invokeObjcSelfClass!(Object, "string"); + return invokeObjcSuperClass!(Object, "string"); } static Object stringWithString (NSString string) { - return invokeObjcSelfClass!(Object, "stringWithString:", NSString)(string); + return invokeObjcSuperClass!(Object, "stringWithString:", NSString)(string); } static Object stringWithCharacters (unichar* characters, NSUInteger length) { - return invokeObjcSelfClass!(Object, "stringWithCharacters:length:", unichar*, NSUInteger)(characters, length); + return invokeObjcSuperClass!(Object, "stringWithCharacters:length:", unichar*, NSUInteger)(characters, length); } - static Object stringWithUTF8String (char* nullTerminatedCString) + static NSString stringWithUTF8String (char* nullTerminatedCString) { - return invokeObjcSelfClass!(Object, "stringWithUTF8String:", char*)(nullTerminatedCString); + return invokeObjcSuperClass!(NSString, "stringWithUTF8String:", char*)(nullTerminatedCString); } static Object stringWithFormat (NSString stringWithFormat, ...) { - return invokeObjcSelfClass!(Object, "stringWithFormat:", NSString)(stringWithFormat); + return invokeObjcSuperClass!(Object, "stringWithFormat:", NSString)(stringWithFormat); } static Object localizedStringWithFormat (NSString localizedStringWithFormat, ...) { - return invokeObjcSelfClass!(Object, "localizedStringWithFormat:", NSString)(localizedStringWithFormat); - } - - Object initWithCString (char* nullTerminatedCString, uint encoding) - { - return invokeObjcSelf!(Object, "initWithCString:encoding:", char*, uint)(nullTerminatedCString, encoding); - } - - this (char* nullTerminatedCString, uint encoding) - { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCString:encoding:", char*, uint)(objcObject, nullTerminatedCString, encoding); - - if (result) - objcObject = ret; - - dObject = this; + return invokeObjcSuperClass!(Object, "localizedStringWithFormat:", NSString)(localizedStringWithFormat); } static Object stringWithCString (char* cString, uint enc) { - return invokeObjcSelfClass!(Object, "stringWithCString:encoding:", char*, uint)(cString, enc); + return invokeObjcSuperClass!(Object, "stringWithCString:encoding:", char*, uint)(cString, enc); } - Object initWithContentsOfURL (NSURL url, uint enc, NSError** error) + NSString initWithContentsOfURL (NSURL url, NSStringEncoding enc, ref NSError error) { - return invokeObjcSelf!(Object, "initWithContentsOfURL:encoding:error:", NSURL, uint, NSError**)(url, enc, error); + id err; + + if (error) + err = new objc_object; + + Object result = invokeObjcSelf!(Object, "initWithContentsOfURL:encoding:error:", NSURL, NSStringEncoding, id*)(url, enc, &err); + + if (err) + error = new NSError(err); + + return result; } - this (NSURL url, uint enc, NSError** error) + /*this (NSURL url, NSStringEncoding enc, ref NSError error) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithContentsOfURL:encoding:error:", NSURL, uint, NSError**)(objcObject, url, enc, error); + typeof(this).alloc.initWithContentsOfURL(url, enc, error); + }*/ - if (result) - objcObject = ret; - - dObject = this; - } - - Object initWithContentsOfFile (NSString path, uint enc, NSError** error) + NSString initWithContentsOfFile (NSString path, NSStringEncoding enc, ref NSError error) { - return invokeObjcSelf!(Object, "initWithContentsOfFile:encoding:error:", NSString, uint, NSError**)(path, enc, error); + id err; + + if (error) + err = new objc_object; + + Object result = invokeObjcSelf!(Object, "initWithContentsOfFile:encoding:error:", NSString, NSStringEncoding, id*)(path, enc, &err); + + if (err) + error = new NSError(err); + + return result; } - this (NSString path, uint enc, NSError** error) + /*this (NSString path, NSStringEncoding enc, ref NSError error) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithContentsOfFile:encoding:error:", NSString, uint, NSError**)(objcObject, path, enc, error); + typeof(this).alloc.initWithContentsOfFile(path, enc, error); + }*/ - if (result) - objcObject = ret; - - dObject = this; + static Object stringWithContentsOfURL (NSURL url, NSStringEncoding enc, ref NSError error) + { + id err; + + if (error) + err = new objc_object; + + Object result = invokeObjcSuperClass!(Object, "stringWithContentsOfURL:encoding:error:", NSURL, NSStringEncoding, id*)(url, enc, &err); + + if (err) + error = new NSError(err); + + return result; } - static Object stringWithContentsOfURL (NSURL url, uint enc, NSError** error) + static Object stringWithContentsOfFile (NSString path, NSStringEncoding enc, ref NSError error) { - return invokeObjcSelfClass!(Object, "stringWithContentsOfURL:encoding:error:", NSURL, uint, NSError**)(url, enc, error); + id err; + + if (error) + err = new objc_object; + + Object result = invokeObjcSuperClass!(Object, "stringWithContentsOfFile:encoding:error:", NSString, NSStringEncoding, id*)(path, enc, &err); + + if (err) + error = new NSError(err); + + return result; } - static Object stringWithContentsOfFile (NSString path, uint enc, NSError** error) + NSString initWithContentsOfURL (NSURL url, NSStringEncoding* enc, ref NSError error) { - return invokeObjcSelfClass!(Object, "stringWithContentsOfFile:encoding:error:", NSString, uint, NSError**)(path, enc, error); - } - - Object initWithContentsOfURL (NSURL url, NSStringEncoding* enc, NSError** error) - { - return invokeObjcSelf!(Object, "initWithContentsOfURL:usedEncoding:error:", NSURL, NSStringEncoding*, NSError**)(url, enc, error); + id err; + + if (error) + err = new objc_object; + + Object result = invokeObjcSelf!(Object, "initWithContentsOfURL:usedEncoding:error:", NSURL, NSStringEncoding*, id*)(url, enc, &err); + + if (err) + error = new NSError(err); + + return result; } - this (NSURL url, NSStringEncoding* enc, NSError** error) + /*this (NSURL url, NSStringEncoding* enc, ref NSError error) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithContentsOfURL:usedEncoding:error:", NSURL, NSStringEncoding*, NSError**)(objcObject, url, enc, error); + typeof(this).alloc.initWithContentsOfURL(url, enc, error); + }*/ - if (result) - objcObject = ret; - - dObject = this; + NSString initWithContentsOfFile (NSString path, NSStringEncoding* enc, ref NSError error) + { + id err; + + if (error) + err = new objc_object; + + Object result = invokeObjcSelf!(Object, "initWithContentsOfFile:usedEncoding:error:", NSString, NSStringEncoding*, id*)(path, enc, &err); + + if (err) + error = new NSError(err); + + return result; } - Object initWithContentsOfFile (NSString path, NSStringEncoding* enc, NSError** error) + /*this (NSString path, NSStringEncoding* enc, ref NSError error) + { + typeof(this).alloc.initWithContentsOfFile(path, enc, error); + }*/ + + static Object stringWithContentsOfURL (NSURL url, NSStringEncoding* enc, ref NSError error) { - return invokeObjcSelf!(Object, "initWithContentsOfFile:usedEncoding:error:", NSString, NSStringEncoding*, NSError**)(path, enc, error); + id err; + + if (error) + err = new objc_object; + + Object result = invokeObjcSuperClass!(Object, "stringWithContentsOfURL:usedEncoding:error:", NSURL, NSStringEncoding*, id*)(url, enc, &err); + + if (err) + error = new NSError(err); + + return result; } - this (NSString path, NSStringEncoding* enc, NSError** error) + static Object stringWithContentsOfFile (NSString path, NSStringEncoding* enc, ref NSError error) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithContentsOfFile:usedEncoding:error:", NSString, NSStringEncoding*, NSError**)(objcObject, path, enc, error); - - if (result) - objcObject = ret; - - dObject = this; - } - - static Object stringWithContentsOfURL (NSURL url, NSStringEncoding* enc, NSError** error) - { - return invokeObjcSelfClass!(Object, "stringWithContentsOfURL:usedEncoding:error:", NSURL, NSStringEncoding*, NSError**)(url, enc, error); + id err; + + if (error) + err = new objc_object; + + Object result = invokeObjcSuperClass!(Object, "stringWithContentsOfFile:usedEncoding:error:", NSString, NSStringEncoding*, id*)(path, enc, &err); + + if (err) + error = new NSError(err); + + return result; } - static Object stringWithContentsOfFile (NSString path, NSStringEncoding* enc, NSError** error) + bool writeToURL (NSURL url, bool useAuxiliaryFile, uint enc, ref NSError error) { - return invokeObjcSelfClass!(Object, "stringWithContentsOfFile:usedEncoding:error:", NSString, NSStringEncoding*, NSError**)(path, enc, error); + id err; + + if (error) + err = new objc_object; + + bool result = invokeObjcSelf!(bool, "writeToURL:atomically:encoding:error:", NSURL, bool, uint, id*)(url, useAuxiliaryFile, enc, &err); + + if (err) + error = new NSError(err); + + return result; } - bool writeToURL (NSURL url, bool useAuxiliaryFile, uint enc, NSError** error) - { - return invokeObjcSelf!(bool, "writeToURL:atomically:encoding:error:", NSURL, bool, uint, NSError**)(url, useAuxiliaryFile, enc, error); - } - - bool writeToFile (NSString path, bool useAuxiliaryFile, uint enc, NSError** error) + bool writeToFile (NSString path, bool useAuxiliaryFile, uint enc, ref NSError error) { - return invokeObjcSelf!(bool, "writeToFile:atomically:encoding:error:", NSString, bool, uint, NSError**)(path, useAuxiliaryFile, enc, error); + id err; + + if (error) + err = new objc_object; + + bool result = invokeObjcSelf!(bool, "writeToFile:atomically:encoding:error:", NSString, bool, uint, id*)(path, useAuxiliaryFile, enc, &err); + + if (err) + error = new NSError(err); + + return result; } -} +`; -template TNSStringDeprecated () -{ +const TNSStringDeprecated = ` + char* cString () { return invokeObjcSelf!(char*, "cString"); @@ -932,104 +860,1105 @@ return invokeObjcSelf!(bool, "writeToURL:atomically:", NSURL, bool)(url, atomically); } - Object initWithContentsOfFile (NSString path) + /*NSString initWithContentsOfFile (NSString path) { return invokeObjcSelf!(Object, "initWithContentsOfFile:", NSString)(path); } this (NSString path) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithContentsOfFile:", NSString)(objcObject, path); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithContentsOfFile(path); } - Object initWithContentsOfURL (NSURL url) + NSString initWithContentsOfURL (NSURL url) { return invokeObjcSelf!(Object, "initWithContentsOfURL:", NSURL)(url); } this (NSURL url) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithContentsOfURL:", NSURL)(objcObject, url); - - if (result) - objcObject = ret; - - dObject = this; - } + typeof(this).alloc.initWithContentsOfURL(url); + }*/ static Object stringWithContentsOfFile (NSString path) { - return invokeObjcSelfClass!(Object, "stringWithContentsOfFile:", NSString)(path); + return invokeObjcSuperClass!(Object, "stringWithContentsOfFile:", NSString)(path); } static Object stringWithContentsOfURL (NSURL url) { - return invokeObjcSelfClass!(Object, "stringWithContentsOfURL:", NSURL)(url); + return invokeObjcSuperClass!(Object, "stringWithContentsOfURL:", NSURL)(url); } - Object initWithCStringNoCopy (char* bytes, NSUInteger length, bool freeBuffer) + NSString initWithCStringNoCopy (char* bytes, NSUInteger length, bool freeBuffer) { return invokeObjcSelf!(Object, "initWithCStringNoCopy:length:freeWhenDone:", char*, NSUInteger, bool)(bytes, length, freeBuffer); } this (char* bytes, NSUInteger length, bool freeBuffer) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCStringNoCopy:length:freeWhenDone:", char*, NSUInteger, bool)(objcObject, bytes, length, freeBuffer); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithCStringNoCopy(bytes, length, freeBuffer); } - Object initWithCString (char* bytes, NSUInteger length) + NSString initWithCString (char* bytes, NSUInteger length) { return invokeObjcSelf!(Object, "initWithCString:length:", char*, NSUInteger)(bytes, length); } this (char* bytes, NSUInteger length) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCString:length:", char*, NSUInteger)(objcObject, bytes, length); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithCString(bytes, length); } - Object initWithCString (char* bytes) + NSString initWithCString (char* bytes) { return invokeObjcSelf!(Object, "initWithCString:", char*)(bytes); } this (char* bytes) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCString:", char*)(objcObject, bytes); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithCString(bytes); } static Object stringWithCString (char* bytes, NSUInteger length) { - return invokeObjcSelfClass!(Object, "stringWithCString:length:", char*, NSUInteger)(bytes, length); + return invokeObjcSuperClass!(Object, "stringWithCString:length:", char*, NSUInteger)(bytes, length); } static Object stringWithCString (char* bytes) { - return invokeObjcSelfClass!(Object, "stringWithCString:", char*)(bytes); + return invokeObjcSuperClass!(Object, "stringWithCString:", char*)(bytes); + } +`; + +class NSMutableString : NSString +{ + mixin (ObjcClusterWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } + + void replaceCharactersInRange (NSRange range, NSString aString) + { + return invokeObjcSelf!(void, "replaceCharactersInRange:withString:", NSRange, NSString)(range, aString); + } + + // TNSMutableStringExtensionMethods + void insertString (NSString aString, NSUInteger loc) + { + return invokeObjcSelf!(void, "insertString:atIndex:", NSString, NSUInteger)(aString, loc); + } + + void deleteCharactersInRange (NSRange range) + { + return invokeObjcSelf!(void, "deleteCharactersInRange:", NSRange)(range); + } + + void appendString (NSString aString) + { + return invokeObjcSelf!(void, "appendString:", NSString)(aString); + } + + void appendFormat (NSString appendFormat, ...) + { + return invokeObjcSelf!(void, "appendFormat:", NSString)(appendFormat); + } + + void setString (NSString aString) + { + return invokeObjcSelf!(void, "setString:", NSString)(aString); + } + + NSMutableString initWithCapacity (NSUInteger capacity) + { + return invokeObjcSelf!(NSMutableString, "initWithCapacity:", NSUInteger)(capacity); + } + + /*this (NSUInteger capacity) + { + typeof(this).alloc.initWithCapacity(capacity); + }*/ + + static NSMutableString stringWithCapacity (NSUInteger capacity) + { + return invokeObjcSuperClass!(NSMutableString, "stringWithCapacity:", NSUInteger)(capacity); + } + + NSUInteger replaceOccurrencesOfString (NSString target, NSString replacement, uint options, NSRange searchRange) + { + return invokeObjcSelf!(NSUInteger, "replaceOccurrencesOfString:withString:options:range:", NSString, NSString, uint, NSRange)(target, replacement, options, searchRange); } } +class NSString : NSObject, INSCopying, INSMutableCopying, INSCoding +{ + mixin (ObjcClusterWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } + + NSUInteger length () + { + return invokeObjcSelf!(NSUInteger, "length"); + } + + unichar characterAtIndex (NSUInteger index) + { + return invokeObjcSelf!(unichar, "characterAtIndex:", NSUInteger)(index); + } + + NSString copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(NSString, "copyWithZone:", NSZone*)(zone); + } + + NSString mutableCopyWithZone (NSZone* zone) + { + return invokeObjcSelf!(NSString, "mutableCopyWithZone:", NSZone*)(zone); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + NSString initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(NSString, "initWithCoder:", NSCoder)(aDecoder); + } + + this (NSCoder aDecoder) + { + typeof(this).alloc.initWithCoder(aDecoder); + } + + // TNSExtendedStringPropertyListParsing + Object propertyList () + { + return invokeObjcSelf!(Object, "propertyList"); + } + + NSDictionary propertyListFromStringsFileFormat () + { + return invokeObjcSelf!(NSDictionary, "propertyListFromStringsFileFormat"); + } + + // TNSStringExtensionMethods + void getCharacters (unichar* buffer) + { + return invokeObjcSelf!(void, "getCharacters:", unichar*)(buffer); + } + + void getCharacters (unichar* buffer, NSRange aRange) + { + return invokeObjcSelf!(void, "getCharacters:range:", unichar*, NSRange)(buffer, aRange); + } + + NSString substringFromIndex (NSUInteger from) + { + return invokeObjcSelf!(NSString, "substringFromIndex:", NSUInteger)(from); + } + + NSString substringToIndex (NSUInteger to) + { + return invokeObjcSelf!(NSString, "substringToIndex:", NSUInteger)(to); + } + + NSString substringWithRange (NSRange range) + { + return invokeObjcSelf!(NSString, "substringWithRange:", NSRange)(range); + } + + int compare (NSString string) + { + return invokeObjcSelf!(int, "compare:", NSString)(string); + } + + int compare (NSString string, uint mask) + { + return invokeObjcSelf!(int, "compare:options:", NSString, uint)(string, mask); + } + + int compare (NSString string, uint mask, NSRange compareRange) + { + return invokeObjcSelf!(int, "compare:options:range:", NSString, uint, NSRange)(string, mask, compareRange); + } + + int compare (NSString string, uint mask, NSRange compareRange, Object locale) + { + return invokeObjcSelf!(int, "compare:options:range:locale:", NSString, uint, NSRange, Object)(string, mask, compareRange, locale); + } + + int caseInsensitiveCompare (NSString string) + { + return invokeObjcSelf!(int, "caseInsensitiveCompare:", NSString)(string); + } + + int localizedCompare (NSString string) + { + return invokeObjcSelf!(int, "localizedCompare:", NSString)(string); + } + + int localizedCaseInsensitiveCompare (NSString string) + { + return invokeObjcSelf!(int, "localizedCaseInsensitiveCompare:", NSString)(string); + } + + bool isEqualToString (NSString aString) + { + return invokeObjcSelf!(bool, "isEqualToString:", NSString)(aString); + } + + bool hasPrefix (NSString aString) + { + return invokeObjcSelf!(bool, "hasPrefix:", NSString)(aString); + } + + bool hasSuffix (NSString aString) + { + return invokeObjcSelf!(bool, "hasSuffix:", NSString)(aString); + } + + NSRange rangeOfString (NSString aString) + { + return invokeObjcSelf!(NSRange, "rangeOfString:", NSString)(aString); + } + + NSRange rangeOfString (NSString aString, uint mask) + { + return invokeObjcSelf!(NSRange, "rangeOfString:options:", NSString, uint)(aString, mask); + } + + NSRange rangeOfString (NSString aString, uint mask, NSRange searchRange) + { + return invokeObjcSelf!(NSRange, "rangeOfString:options:range:", NSString, uint, NSRange)(aString, mask, searchRange); + } + + NSRange rangeOfString (NSString aString, uint mask, NSRange searchRange, NSLocale locale) + { + return invokeObjcSelf!(NSRange, "rangeOfString:options:range:locale:", NSString, uint, NSRange, NSLocale)(aString, mask, searchRange, locale); + } + + NSRange rangeOfCharacterFromSet (NSCharacterSet aSet) + { + return invokeObjcSelf!(NSRange, "rangeOfCharacterFromSet:", NSCharacterSet)(aSet); + } + + NSRange rangeOfCharacterFromSet (NSCharacterSet aSet, uint mask) + { + return invokeObjcSelf!(NSRange, "rangeOfCharacterFromSet:options:", NSCharacterSet, uint)(aSet, mask); + } + + NSRange rangeOfCharacterFromSet (NSCharacterSet aSet, uint mask, NSRange searchRange) + { + return invokeObjcSelf!(NSRange, "rangeOfCharacterFromSet:options:range:", NSCharacterSet, uint, NSRange)(aSet, mask, searchRange); + } + + NSRange rangeOfComposedCharacterSequenceAtIndex (NSUInteger index) + { + return invokeObjcSelf!(NSRange, "rangeOfComposedCharacterSequenceAtIndex:", NSUInteger)(index); + } + + NSRange rangeOfComposedCharacterSequencesForRange (NSRange range) + { + return invokeObjcSelf!(NSRange, "rangeOfComposedCharacterSequencesForRange:", NSRange)(range); + } + + NSString stringByAppendingString (NSString aString) + { + return invokeObjcSelf!(NSString, "stringByAppendingString:", NSString)(aString); + } + + NSString stringByAppendingFormat (NSString stringByAppendingFormat, ...) + { + return invokeObjcSelf!(NSString, "stringByAppendingFormat:", NSString)(stringByAppendingFormat); + } + + double doubleValue () + { + return invokeObjcSelf!(double, "doubleValue"); + } + + float floatValue () + { + return invokeObjcSelf!(float, "floatValue"); + } + + int intValue () + { + return invokeObjcSelf!(int, "intValue"); + } + + NSInteger integerValue () + { + return invokeObjcSelf!(NSInteger, "integerValue"); + } + + long longLongValue () + { + return invokeObjcSelf!(long, "longLongValue"); + } + + bool boolValue () + { + return invokeObjcSelf!(bool, "boolValue"); + } + + NSArray componentsSeparatedByString (NSString separator) + { + return invokeObjcSelf!(NSArray, "componentsSeparatedByString:", NSString)(separator); + } + + NSArray componentsSeparatedByCharactersInSet (NSCharacterSet separator) + { + return invokeObjcSelf!(NSArray, "componentsSeparatedByCharactersInSet:", NSCharacterSet)(separator); + } + + NSString commonPrefixWithString (NSString aString, uint mask) + { + return invokeObjcSelf!(NSString, "commonPrefixWithString:options:", NSString, uint)(aString, mask); + } + + NSString uppercaseString () + { + return invokeObjcSelf!(NSString, "uppercaseString"); + } + + NSString lowercaseString () + { + return invokeObjcSelf!(NSString, "lowercaseString"); + } + + NSString capitalizedString () + { + return invokeObjcSelf!(NSString, "capitalizedString"); + } + + NSString stringByTrimmingCharactersInSet (NSCharacterSet set) + { + return invokeObjcSelf!(NSString, "stringByTrimmingCharactersInSet:", NSCharacterSet)(set); + } + + NSString stringByPaddingToLength (NSUInteger newLength, NSString padString, NSUInteger padIndex) + { + return invokeObjcSelf!(NSString, "stringByPaddingToLength:withString:startingAtIndex:", NSUInteger, NSString, NSUInteger)(newLength, padString, padIndex); + } + + void getLineStart (NSUInteger* startPtr, NSUInteger* lineEndPtr, NSUInteger* contentsEndPtr, NSRange range) + { + return invokeObjcSelf!(void, "getLineStart:end:contentsEnd:forRange:", NSUInteger*, NSUInteger*, NSUInteger*, NSRange)(startPtr, lineEndPtr, contentsEndPtr, range); + } + + NSRange lineRangeForRange (NSRange range) + { + return invokeObjcSelf!(NSRange, "lineRangeForRange:", NSRange)(range); + } + + void getParagraphStart (NSUInteger* startPtr, NSUInteger* parEndPtr, NSUInteger* contentsEndPtr, NSRange range) + { + return invokeObjcSelf!(void, "getParagraphStart:end:contentsEnd:forRange:", NSUInteger*, NSUInteger*, NSUInteger*, NSRange)(startPtr, parEndPtr, contentsEndPtr, range); + } + + NSRange paragraphRangeForRange (NSRange range) + { + return invokeObjcSelf!(NSRange, "paragraphRangeForRange:", NSRange)(range); + } + + NSString description () + { + return invokeObjcSelf!(NSString, "description"); + } + + NSUInteger hash () + { + return invokeObjcSelf!(NSUInteger, "hash"); + } + + uint fastestEncoding () + { + return invokeObjcSelf!(uint, "fastestEncoding"); + } + + uint smallestEncoding () + { + return invokeObjcSelf!(uint, "smallestEncoding"); + } + + NSData dataUsingEncoding (uint encoding, bool lossy) + { + return invokeObjcSelf!(NSData, "dataUsingEncoding:allowLossyConversion:", uint, bool)(encoding, lossy); + } + + NSData dataUsingEncoding (uint encoding) + { + return invokeObjcSelf!(NSData, "dataUsingEncoding:", uint)(encoding); + } + + bool canBeConvertedToEncoding (uint encoding) + { + return invokeObjcSelf!(bool, "canBeConvertedToEncoding:", uint)(encoding); + } + + char* cStringUsingEncoding (uint encoding) + { + return invokeObjcSelf!(char*, "cStringUsingEncoding:", uint)(encoding); + } + + bool getCString (char* buffer, NSUInteger maxBufferCount, uint encoding) + { + return invokeObjcSelf!(bool, "getCString:maxLength:encoding:", char*, NSUInteger, uint)(buffer, maxBufferCount, encoding); + } + + bool getBytes (void* buffer, NSUInteger maxBufferCount, NSUInteger* usedBufferCount, uint encoding, uint options, NSRange range, NSRangePointer leftover) + { + return invokeObjcSelf!(bool, "getBytes:maxLength:usedLength:encoding:options:range:remainingRange:", void*, NSUInteger, NSUInteger*, uint, uint, NSRange, NSRangePointer)(buffer, maxBufferCount, usedBufferCount, encoding, options, range, leftover); + } + + NSUInteger maximumLengthOfBytesUsingEncoding (uint enc) + { + return invokeObjcSelf!(NSUInteger, "maximumLengthOfBytesUsingEncoding:", uint)(enc); + } + + NSUInteger lengthOfBytesUsingEncoding (uint enc) + { + return invokeObjcSelf!(NSUInteger, "lengthOfBytesUsingEncoding:", uint)(enc); + } + + NSString decomposedStringWithCanonicalMapping () + { + return invokeObjcSelf!(NSString, "decomposedStringWithCanonicalMapping"); + } + + NSString precomposedStringWithCanonicalMapping () + { + return invokeObjcSelf!(NSString, "precomposedStringWithCanonicalMapping"); + } + + NSString decomposedStringWithCompatibilityMapping () + { + return invokeObjcSelf!(NSString, "decomposedStringWithCompatibilityMapping"); + } + + NSString precomposedStringWithCompatibilityMapping () + { + return invokeObjcSelf!(NSString, "precomposedStringWithCompatibilityMapping"); + } + + NSString stringByFoldingWithOptions (uint options, NSLocale locale) + { + return invokeObjcSelf!(NSString, "stringByFoldingWithOptions:locale:", uint, NSLocale)(options, locale); + } + + NSString stringByReplacingOccurrencesOfString (NSString target, NSString replacement, uint options, NSRange searchRange) + { + return invokeObjcSelf!(NSString, "stringByReplacingOccurrencesOfString:withString:options:range:", NSString, NSString, uint, NSRange)(target, replacement, options, searchRange); + } + + NSString stringByReplacingOccurrencesOfString (NSString target, NSString replacement) + { + return invokeObjcSelf!(NSString, "stringByReplacingOccurrencesOfString:withString:", NSString, NSString)(target, replacement); + } + + NSString stringByReplacingCharactersInRange (NSRange range, NSString replacement) + { + return invokeObjcSelf!(NSString, "stringByReplacingCharactersInRange:withString:", NSRange, NSString)(range, replacement); + } + + char* UTF8String () + { + return invokeObjcSelf!(char*, "UTF8String"); + } + + static uint defaultCStringEncoding () + { + return invokeObjcSuperClass!(uint, "defaultCStringEncoding"); + } + + static NSStringEncoding* availableStringEncodings () + { + return invokeObjcSuperClass!(NSStringEncoding*, "availableStringEncodings"); + } + + static NSString localizedNameOfStringEncoding (uint encoding) + { + return invokeObjcSuperClass!(NSString, "localizedNameOfStringEncoding:", uint)(encoding); + } + + NSString initWithCharactersNoCopy (unichar* characters, NSUInteger length, bool freeBuffer) + { + return invokeObjcSelf!(NSString, "initWithCharactersNoCopy:length:freeWhenDone:", unichar*, NSUInteger, bool)(characters, length, freeBuffer); + } + + /*this (unichar* characters, NSUInteger length, bool freeBuffer) + { + typeof(this).alloc.initWithCharactersNoCopy(characters, length, freeBuffer); + }*/ + + NSString initWithCharacters (unichar* characters, NSUInteger length) + { + return invokeObjcSelf!(NSString, "initWithCharacters:length:", unichar*, NSUInteger)(characters, length); + } + + /*this (unichar* characters, NSUInteger length) + { + typeof(this).alloc.initWithCharacters(characters, length); + }*/ + + NSString initWithUTF8String (char* nullTerminatedCString) + { + return invokeObjcSelf!(NSString, "initWithUTF8String:", char*)(nullTerminatedCString); + } + + /*this (char* nullTerminatedCString) + { + typeof(this).alloc.initWithUTF8String(nullTerminatedCString); + }*/ + + NSString initWithString (NSString aString) + { + return invokeObjcSelf!(NSString, "initWithString:", NSString)(aString); + } + + /*this (NSString aString) + { + typeof(this).alloc.initWithString(aString); + }*/ + + NSString initWithFormat (NSString initWithFormat, ...) + { + return invokeObjcSelf!(NSString, "initWithFormat:", NSString)(initWithFormat); + } + + /*this (NSString initWithFormat, ...) + { + typeof(this).alloc.initWithFormat(initWithFormat); + }*/ + + NSString initWithFormat (NSString format, char* argList) + { + return invokeObjcSelf!(NSString, "initWithFormat:arguments:", NSString, char*)(format, argList); + } + + /*this (NSString format, char* argList) + { + typeof(this).alloc.initWithFormat(format, argList); + }*/ + + NSString initWithFormat (NSString format, Object locale, ...) + { + return invokeObjcSelf!(NSString, "initWithFormat:locale:", NSString, Object)(format, locale); + } + + /*this (NSString format, Object locale, ...) + { + typeof(this).alloc.initWithFormat(format, locale); + }*/ + + NSString initWithFormat (NSString format, Object locale, char* argList) + { + return invokeObjcSelf!(NSString, "initWithFormat:locale:arguments:", NSString, Object, char*)(format, locale, argList); + } + + /*this (NSString format, Object locale, char* argList) + { + typeof(this).alloc.initWithFormat(format, locale, argList); + }*/ + + NSString initWithData (NSData data, uint encoding) + { + return invokeObjcSelf!(NSString, "initWithData:encoding:", NSData, uint)(data, encoding); + } + + /*this (NSData data, uint encoding) + { + typeof(this).alloc.initWithData(data, encoding); + }*/ + + NSString initWithBytes (void* bytes, NSUInteger len, uint encoding) + { + return invokeObjcSelf!(NSString, "initWithBytes:length:encoding:", void*, NSUInteger, uint)(bytes, len, encoding); + } + + /*this (void* bytes, NSUInteger len, uint encoding) + { + typeof(this).alloc.initWithBytes(bytes, len, encoding); + }*/ + + NSString initWithBytesNoCopy (void* bytes, NSUInteger len, NSStringEncoding encoding, bool freeBuffer) + { + return invokeObjcSelf!(NSString, "initWithBytesNoCopy:length:encoding:freeWhenDone:", void*, NSUInteger, NSStringEncoding, bool)(bytes, len, encoding, freeBuffer); + } + + /*this (void* bytes, NSUInteger len, uint encoding, bool freeBuffer) + { + typeof(this).alloc.initWithBytesNoCopy(bytes, len, encoding, freeBuffer); + }*/ + + static NSString string () + { + return invokeObjcSuperClass!(NSString, "string"); + } + + static NSString stringWithString (NSString string) + { + return invokeObjcSuperClass!(NSString, "stringWithString:", NSString)(string); + } + + static NSString stringWithCharacters (unichar* characters, NSUInteger length) + { + return invokeObjcSuperClass!(NSString, "stringWithCharacters:length:", unichar*, NSUInteger)(characters, length); + } + + static NSString stringWithUTF8String (char* nullTerminatedCString) + { + return invokeObjcSuperClass!(NSString, "stringWithUTF8String:", char*)(nullTerminatedCString); + } + + static NSString stringWithFormat (NSString stringWithFormat, ...) + { + return invokeObjcSuperClass!(NSString, "stringWithFormat:", NSString)(stringWithFormat); + } + + static NSString localizedStringWithFormat (NSString localizedStringWithFormat, ...) + { + return invokeObjcSuperClass!(NSString, "localizedStringWithFormat:", NSString)(localizedStringWithFormat); + } + + static NSString stringWithCString (char* cString, uint enc) + { + return invokeObjcSuperClass!(NSString, "stringWithCString:encoding:", char*, uint)(cString, enc); + } + + NSString initWithContentsOfURL (NSURL url, NSStringEncoding enc, ref NSError error) + { + id err; + + if (error) + err = new objc_object; + + NSString result = invokeObjcSelf!(NSString, "initWithContentsOfURL:encoding:error:", NSURL, NSStringEncoding, id*)(url, enc, &err); + + if (err) + error = new NSError(err); + + return result; + } + + /*this (NSURL url, NSStringEncoding enc, ref NSError error) + { + typeof(this).alloc.initWithContentsOfURL(url, enc, error); + }*/ + + NSString initWithContentsOfFile (NSString path, NSStringEncoding enc, ref NSError error) + { + id err; + + if (error) + err = new objc_object; + + NSString result = invokeObjcSelf!(NSString, "initWithContentsOfFile:encoding:error:", NSString, NSStringEncoding, id*)(path, enc, &err); + + if (err) + error = new NSError(err); + + return result; + } + + /*this (NSString path, NSStringEncoding enc, ref NSError error) + { + typeof(this).alloc.initWithContentsOfFile(path, enc, error); + }*/ + + static NSString stringWithContentsOfURL (NSURL url, NSStringEncoding enc, ref NSError error) + { + id err; + + if (error) + err = new objc_object; + + NSString result = invokeObjcSuperClass!(NSString, "stringWithContentsOfURL:encoding:error:", NSURL, NSStringEncoding, id*)(url, enc, &err); + + if (err) + error = new NSError(err); + + return result; + } + + static NSString stringWithContentsOfFile (NSString path, NSStringEncoding enc, ref NSError error) + { + id err; + + if (error) + err = new objc_object; + + NSString result = invokeObjcSuperClass!(NSString, "stringWithContentsOfFile:encoding:error:", NSString, NSStringEncoding, id*)(path, enc, &err); + + if (err) + error = new NSError(err); + + return result; + } + + NSString initWithContentsOfURL (NSURL url, NSStringEncoding* enc, ref NSError error) + { + id err; + + if (error) + err = new objc_object; + + NSString result = invokeObjcSelf!(NSString, "initWithContentsOfURL:usedEncoding:error:", NSURL, NSStringEncoding*, id*)(url, enc, &err); + + if (err) + error = new NSError(err); + + return result; + } + + /*this (NSURL url, NSStringEncoding* enc, ref NSError error) + { + typeof(this).alloc.initWithContentsOfURL(url, enc, error); + }*/ + + NSString initWithContentsOfFile (NSString path, NSStringEncoding* enc, ref NSError error) + { + id err; + + if (error) + err = new objc_object; + + NSString result = invokeObjcSelf!(NSString, "initWithContentsOfFile:usedEncoding:error:", NSString, NSStringEncoding*, id*)(path, enc, &err); + + if (err) + error = new NSError(err); + + return result; + } + + /*this (NSString path, NSStringEncoding* enc, ref NSError error) + { + typeof(this).alloc.initWithContentsOfFile(path, enc, error); + }*/ + + static NSString stringWithContentsOfURL (NSURL url, NSStringEncoding* enc, ref NSError error) + { + id err; + + if (error) + err = new objc_object; + + NSString result = invokeObjcSuperClass!(NSString, "stringWithContentsOfURL:usedEncoding:error:", NSURL, NSStringEncoding*, id*)(url, enc, &err); + + if (err) + error = new NSError(err); + + return result; + } + + static NSString stringWithContentsOfFile (NSString path, NSStringEncoding* enc, ref NSError error) + { + id err; + + if (error) + err = new objc_object; + + NSString result = invokeObjcSuperClass!(NSString, "stringWithContentsOfFile:usedEncoding:error:", NSString, NSStringEncoding*, id*)(path, enc, &err); + + if (err) + error = new NSError(err); + + return result; + } + + bool writeToURL (NSURL url, bool useAuxiliaryFile, uint enc, ref NSError error) + { + id err; + + if (error) + err = new objc_object; + + bool result = invokeObjcSelf!(bool, "writeToURL:atomically:encoding:error:", NSURL, bool, uint, id*)(url, useAuxiliaryFile, enc, &err); + + if (err) + error = new NSError(err); + + return result; + } + + bool writeToFile (NSString path, bool useAuxiliaryFile, uint enc, ref NSError error) + { + id err; + + if (error) + err = new objc_object; + + bool result = invokeObjcSelf!(bool, "writeToFile:atomically:encoding:error:", NSString, bool, uint, id*)(path, useAuxiliaryFile, enc, &err); + + if (err) + error = new NSError(err); + + return result; + } + + // TNSStringPathExtensions + static NSString pathWithComponents (NSArray components) + { + return invokeObjcSuperClass!(NSString, "pathWithComponents:", NSArray)(components); + } + + NSArray pathComponents () + { + return invokeObjcSelf!(NSArray, "pathComponents"); + } + + bool isAbsolutePath () + { + return invokeObjcSelf!(bool, "isAbsolutePath"); + } + + NSString lastPathComponent () + { + return invokeObjcSelf!(NSString, "lastPathComponent"); + } + + NSString stringByDeletingLastPathComponent () + { + return invokeObjcSelf!(NSString, "stringByDeletingLastPathComponent"); + } + + NSString stringByAppendingPathComponent (NSString str) + { + return invokeObjcSelf!(NSString, "stringByAppendingPathComponent:", NSString)(str); + } + + NSString pathExtension () + { + return invokeObjcSelf!(NSString, "pathExtension"); + } + + NSString stringByDeletingPathExtension () + { + return invokeObjcSelf!(NSString, "stringByDeletingPathExtension"); + } + + NSString stringByAppendingPathExtension (NSString str) + { + return invokeObjcSelf!(NSString, "stringByAppendingPathExtension:", NSString)(str); + } + + NSString stringByAbbreviatingWithTildeInPath () + { + return invokeObjcSelf!(NSString, "stringByAbbreviatingWithTildeInPath"); + } + + NSString stringByExpandingTildeInPath () + { + return invokeObjcSelf!(NSString, "stringByExpandingTildeInPath"); + } + + NSString stringByStandardizingPath () + { + return invokeObjcSelf!(NSString, "stringByStandardizingPath"); + } + + NSString stringByResolvingSymlinksInPath () + { + return invokeObjcSelf!(NSString, "stringByResolvingSymlinksInPath"); + } + + NSArray stringsByAppendingPaths (NSArray paths) + { + return invokeObjcSelf!(NSArray, "stringsByAppendingPaths:", NSArray)(paths); + } + + NSUInteger completePathIntoString (NSString** outputName, bool flag, NSArray** outputArray, NSArray filterTypes) + { + return invokeObjcSelf!(NSUInteger, "completePathIntoString:caseSensitive:matchesIntoArray:filterTypes:", NSString**, bool, NSArray**, NSArray)(outputName, flag, outputArray, filterTypes); + } + + char* fileSystemRepresentation () + { + return invokeObjcSelf!(char*, "fileSystemRepresentation"); + } + + bool getFileSystemRepresentation (char* cname, NSUInteger max) + { + return invokeObjcSelf!(bool, "getFileSystemRepresentation:maxLength:", char*, NSUInteger)(cname, max); + } + + // TNSURLUtilities + NSString stringByAddingPercentEscapesUsingEncoding (uint enc) + { + return invokeObjcSelf!(NSString, "stringByAddingPercentEscapesUsingEncoding:", uint)(enc); + } + + NSString stringByReplacingPercentEscapesUsingEncoding (uint enc) + { + return invokeObjcSelf!(NSString, "stringByReplacingPercentEscapesUsingEncoding:", uint)(enc); + } + + // TNSStringDeprecated + char* cString () + { + return invokeObjcSelf!(char*, "cString"); + } + + char* lossyCString () + { + return invokeObjcSelf!(char*, "lossyCString"); + } + + NSUInteger cStringLength () + { + return invokeObjcSelf!(NSUInteger, "cStringLength"); + } + + void getCString (char* bytes) + { + return invokeObjcSelf!(void, "getCString:", char*)(bytes); + } + + void getCString (char* bytes, NSUInteger maxLength) + { + return invokeObjcSelf!(void, "getCString:maxLength:", char*, NSUInteger)(bytes, maxLength); + } + + void getCString (char* bytes, NSUInteger maxLength, NSRange aRange, NSRangePointer leftoverRange) + { + return invokeObjcSelf!(void, "getCString:maxLength:range:remainingRange:", char*, NSUInteger, NSRange, NSRangePointer)(bytes, maxLength, aRange, leftoverRange); + } + + bool writeToFile (NSString path, bool useAuxiliaryFile) + { + return invokeObjcSelf!(bool, "writeToFile:atomically:", NSString, bool)(path, useAuxiliaryFile); + } + + bool writeToURL (NSURL url, bool atomically) + { + return invokeObjcSelf!(bool, "writeToURL:atomically:", NSURL, bool)(url, atomically); + } + + NSString initWithContentsOfFile (NSString path) + { + return invokeObjcSelf!(NSString, "initWithContentsOfFile:", NSString)(path); + } + + NSString initWithContentsOfURL (NSURL url) + { + return invokeObjcSelf!(NSString, "initWithContentsOfURL:", NSURL)(url); + } + + static NSString stringWithContentsOfFile (NSString path) + { + return invokeObjcSuperClass!(NSString, "stringWithContentsOfFile:", NSString)(path); + } + + static NSString stringWithContentsOfURL (NSURL url) + { + return invokeObjcSuperClass!(NSString, "stringWithContentsOfURL:", NSURL)(url); + } + + NSString initWithCStringNoCopy (char* bytes, NSUInteger length, bool freeBuffer) + { + return invokeObjcSelf!(NSString, "initWithCStringNoCopy:length:freeWhenDone:", char*, NSUInteger, bool)(bytes, length, freeBuffer); + } + + /*this (char* bytes, NSUInteger length, bool freeBuffer) + { + typeof(this).alloc.initWithCStringNoCopy(bytes, length, freeBuffer); + }*/ + + NSString initWithCString (char* bytes, NSUInteger length) + { + return invokeObjcSelf!(NSString, "initWithCString:length:", char*, NSUInteger)(bytes, length); + } + + /*this (char* bytes, NSUInteger length) + { + typeof(this).alloc.initWithCString(bytes, length); + }*/ + + NSString initWithCString (char* bytes) + { + return invokeObjcSelf!(NSString, "initWithCString:", char*)(bytes); + } + + /*this (char* bytes) + { + typeof(this).alloc.initWithCString(bytes); + }*/ + + static NSString stringWithCString_length (char* bytes, NSUInteger length) + { + return invokeObjcSuperClass!(NSString, "stringWithCString:length:", char*, NSUInteger)(bytes, length); + } + + static NSString stringWithCString (char* bytes) + { + return invokeObjcSuperClass!(NSString, "stringWithCString:", char*)(bytes); + } + + // D extensions + static NSString opCall (.string str) + { + return stringWithUTF8String((str ~ '\0').ptr); + } + + equals_t opEquals (Object object) + { + if (auto str = cast(NSString) object) + return isEqual(object); + + return false; + } + + final equals_t opEquals (.string str) + { + return str == cStringUsingEncoding(NSUTF8StringEncoding)[0 .. lengthOfBytesUsingEncoding(NSUTF8StringEncoding)]; + } + + NSString opCatAssign (NSString str) + { + objcObject = stringByAppendingString(str).objcObject; + return this; + } + + NSString opCatAssign (.string str) + { + objcObject = stringByAppendingString(NSString(str)).objcObject; + return this; + } + + NSString opCat (NSString str) + { + return stringByAppendingString(str); + } + + NSString opCat (.string str) + { + return stringByAppendingString(NSString(str)); + } + + .string toString () + { + return cStringUsingEncoding(NSUTF8StringEncoding)[0 .. lengthOfBytesUsingEncoding(NSUTF8StringEncoding)]; + } + + wchar opIndex (size_t index) + { + return characterAtIndex(index); + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSString_bindings.d --- a/dstep/foundation/NSString_bindings.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSString_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -1,18 +1,8 @@ module dstep.foundation.NSString_bindings; -import dstep.foundation.NSArray; -import dstep.foundation.NSCharacterSet; -import dstep.foundation.NSData; -import dstep.foundation.NSDictionary; -import dstep.foundation.NSError; -import dstep.foundation.NSLocale; -import dstep.foundation.NSObject; -import dstep.foundation.NSRange; -import dstep.foundation.NSURL; -import dstep.limits; -import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; -import dstep.stdarg; +import dstep.objc.objc; + + extern (C) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSTask.d --- a/dstep/foundation/NSTask.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSTask.d Sun Jan 03 22:06:11 2010 +0100 @@ -11,36 +11,47 @@ import dstep.foundation.NSObject; import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + import bindings = dstep.foundation.NSTask_bindings; -const NSString NSTaskDidTerminateNotification; +private NSString NSTaskDidTerminateNotification_; + +NSString NSTaskDidTerminateNotification () +{ + if (NSTaskDidTerminateNotification_) + return NSTaskDidTerminateNotification_; + + return NSTaskDidTerminateNotification_ = new NSString(bindings.NSTaskDidTerminateNotification); +} -static this () -{ - NSTaskDidTerminateNotification = new NSString(bindings.NSTaskDidTerminateNotification); -} +const TNSTaskConveniences = ` + + static NSTask launchedTaskWithLaunchPath (NSString path, NSArray arguments) + { + return invokeObjcSuperClass!(NSTask, "launchedTaskWithLaunchPath:arguments:", NSString, NSArray)(path, arguments); + } + + void waitUntilExit () + { + return invokeObjcSelf!(void, "waitUntilExit"); + } +`; class NSTask : NSObject { - mixin ObjcWrap; - mixin TNSTaskConveniences; - - Object init () - { - return invokeObjcSelf!(Object, "init"); - } - + mixin (ObjcWrap); + this () { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "init")(objcObject); - - if (result) - objcObject = ret; - - dObject = this; + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); } void setLaunchPath (NSString path) @@ -152,18 +163,15 @@ { return invokeObjcSelf!(int, "terminationStatus"); } -} - -template TNSTaskConveniences () -{ + + // TNSTaskConveniences static NSTask launchedTaskWithLaunchPath (NSString path, NSArray arguments) { - return invokeObjcSelfClass!(NSTask, "launchedTaskWithLaunchPath:arguments:", NSString, NSArray)(path, arguments); + return invokeObjcSuperClass!(NSTask, "launchedTaskWithLaunchPath:arguments:", NSString, NSArray)(path, arguments); } - + void waitUntilExit () { return invokeObjcSelf!(void, "waitUntilExit"); } -} - +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSTask_bindings.d --- a/dstep/foundation/NSTask_bindings.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSTask_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -5,7 +5,9 @@ import dstep.foundation.NSObject; import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + extern (C) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSThread.d --- a/dstep/foundation/NSThread.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSThread.d Sun Jan 03 22:06:11 2010 +0100 @@ -8,41 +8,109 @@ import dstep.foundation.NSArray; import dstep.foundation.NSDate; -import dstep.foundation.NSMutableDictionary; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; +import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + import bindings = dstep.foundation.NSThread_bindings; -const NSString NSWillBecomeMultiThreadedNotification; -const NSString NSDidBecomeSingleThreadedNotification; -const NSString NSThreadWillExitNotification; +private +{ + NSString NSWillBecomeMultiThreadedNotification_; + NSString NSDidBecomeSingleThreadedNotification_; + NSString NSThreadWillExitNotification_; +} + +NSString NSWillBecomeMultiThreadedNotification () +{ + if (NSWillBecomeMultiThreadedNotification_) + return NSWillBecomeMultiThreadedNotification_; + + return NSWillBecomeMultiThreadedNotification_ = new NSString(bindings.NSWillBecomeMultiThreadedNotification); +} + +NSString NSDidBecomeSingleThreadedNotification () +{ + if (NSDidBecomeSingleThreadedNotification_) + return NSDidBecomeSingleThreadedNotification_; + + return NSDidBecomeSingleThreadedNotification_ = new NSString(bindings.NSDidBecomeSingleThreadedNotification); +} + +NSString NSThreadWillExitNotification () +{ + if (NSThreadWillExitNotification_) + return NSThreadWillExitNotification_; + + return NSThreadWillExitNotification_ = new NSString(bindings.NSThreadWillExitNotification); +} + -static this () -{ - NSWillBecomeMultiThreadedNotification = new NSString(bindings.NSWillBecomeMultiThreadedNotification); - NSDidBecomeSingleThreadedNotification = new NSString(bindings.NSDidBecomeSingleThreadedNotification); - NSThreadWillExitNotification = new NSString(bindings.NSThreadWillExitNotification); -} +const TNSThreadPerformAdditions = ` + + void performSelectorOnMainThread (SEL aSelector, Object arg, bool wait, NSArray array) + { + return invokeObjcSelf!(void, "performSelectorOnMainThread:withObject:waitUntilDone:modes", SEL, Object, bool, NSArray)(aSelector, arg, wait, array); + } + + void performSelectorOnMainThread (SEL aSelector, Object arg, bool wait) + { + return invokeObjcSelf!(void, "performSelectorOnMainThread:withObject:waitUntilDone:", SEL, Object, bool)(aSelector, arg, wait); + } + + void performSelector (SEL aSelector, NSThread thr, Object arg, bool wait, NSArray array) + { + return invokeObjcSelf!(void, "performSelector:onThread:withObject:waitUntilDone:modes:", SEL, NSThread, Object, bool, NSArray)(aSelector, thr, arg, wait, array); + } + + void performSelector (SEL aSelector, NSThread thr, Object arg, bool wait) + { + return invokeObjcSelf!(void, "performSelector:onThread:withObject:waitUntilDone:", SEL, NSThread, Object, bool)(aSelector, thr, arg, wait); + } + + void performSelectorInBackground (SEL aSelector, Object arg) + { + return invokeObjcSelf!(void, "performSelectorInBackground:withObject:", SEL, Object)(aSelector, arg); + } + + //mixin ObjcBindMethod!(performSelectorOnMainThread, void, "performSelectorOnMainThread:withObject:waitUntilDone:modes:", SEL, Object, bool, NSArray); + //mixin ObjcBindMethod!(performSelectorOnMainThread, void, "performSelectorOnMainThread:withObject:waitUntilDone:", SEL, Object, bool); + //mixin ObjcBindMethod!(performSelector, void, "performSelector:onThread:withObject:waitUntilDone:modes:", SEL, NSThread, Object, bool, NSArray); + //mixin ObjcBindMethod!(performSelector, void, "performSelector:onThread:withObject:waitUntilDone:", SEL, NSThread, Object, bool); + //mixin ObjcBindMethod!(performSelectorInBackground, void, "performSelectorInBackground:withObject:", SEL, Object); +`; class NSThread : NSObject { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static NSThread currentThread () { - return invokeObjcSelfClass!(NSThread, "currentThread"); + return invokeObjcSuperClass!(NSThread, "currentThread"); } static void detachNewThreadSelector (SEL selector, Object target, Object argument) { - return invokeObjcSelfClass!(void, "detachNewThreadSelector:toTarget:withObject:", SEL, Object, Object)(selector, target, argument); + return invokeObjcSuperClass!(void, "detachNewThreadSelector:toTarget:withObject:", SEL, Object, Object)(selector, target, argument); } static bool isMultiThreaded () { - return invokeObjcSelfClass!(bool, "isMultiThreaded"); + return invokeObjcSuperClass!(bool, "isMultiThreaded"); } NSMutableDictionary threadDictionary () @@ -52,32 +120,32 @@ static void sleepUntilDate (NSDate date) { - return invokeObjcSelfClass!(void, "sleepUntilDate:", NSDate)(date); + return invokeObjcSuperClass!(void, "sleepUntilDate:", NSDate)(date); } static void sleepForTimeInterval (double ti) { - return invokeObjcSelfClass!(void, "sleepForTimeInterval:", double)(ti); + return invokeObjcSuperClass!(void, "sleepForTimeInterval:", double)(ti); } static void exit () { - return invokeObjcSelfClass!(void, "exit"); + return invokeObjcSuperClass!(void, "exit"); } static double threadPriority () { - return invokeObjcSelfClass!(double, "threadPriority"); + return invokeObjcSuperClass!(double, "threadPriority"); } static bool setThreadPriority (double p) { - return invokeObjcSelfClass!(bool, "setThreadPriority:", double)(p); + return invokeObjcSuperClass!(bool, "setThreadPriority:", double)(p); } static NSArray callStackReturnAddresses () { - return invokeObjcSelfClass!(NSArray, "callStackReturnAddresses"); + return invokeObjcSuperClass!(NSArray, "callStackReturnAddresses"); } void setName (NSString n) @@ -105,30 +173,14 @@ return invokeObjcSelf!(bool, "isMainThread"); } - static bool isMainThread () + static bool isMainThread_static () { - return invokeObjcSelfClass!(bool, "isMainThread"); + return invokeObjcSuperClass!(bool, "isMainThread"); } static NSThread mainThread () { - return invokeObjcSelfClass!(NSThread, "mainThread"); - } - - Object init () - { - return invokeObjcSelf!(Object, "init"); - } - - this () - { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "init")(objcObject); - - if (result) - objcObject = ret; - - dObject = this; + return invokeObjcSuperClass!(NSThread, "mainThread"); } Object initWithTarget (Object target, SEL selector, Object argument) @@ -138,13 +190,7 @@ this (Object target, SEL selector, Object argument) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithTarget:selector:object:", Object, SEL, Object)(objcObject, target, selector, argument); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithTarget(target, selector, argument); } bool isExecuting () @@ -176,14 +222,4 @@ { return invokeObjcSelf!(void, "main"); } -} - -template TNSThreadPerformAdditions () -{ - void performSelectorOnMainThread (SEL aSelector, Object arg, bool wait, NSArray array); - void performSelectorOnMainThread (SEL aSelector, Object arg, bool wait); - void performSelector (SEL aSelector, NSThread thr, Object arg, bool wait, NSArray array); - void performSelector (SEL aSelector, NSThread thr, Object arg, bool wait); - void performSelectorInBackground (SEL aSelector, Object arg); -} - +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSThread_bindings.d --- a/dstep/foundation/NSThread_bindings.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSThread_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -1,11 +1,8 @@ module dstep.foundation.NSThread_bindings; -import dstep.foundation.NSArray; -import dstep.foundation.NSDate; -import dstep.foundation.NSMutableDictionary; -import dstep.foundation.NSObject; -import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + extern (C) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSTimeZone.d --- a/dstep/foundation/NSTimeZone.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSTimeZone.d Sun Jan 03 22:06:11 2010 +0100 @@ -7,20 +7,30 @@ module dstep.foundation.NSTimeZone; import dstep.foundation.NSArray; +import dstep.foundation.NSCoder; import dstep.foundation.NSData; import dstep.foundation.NSDate; import dstep.foundation.NSDictionary; import dstep.foundation.NSLocale; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; import dstep.foundation.NSString; +import dstep.foundation.NSZone; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; - +import dstep.objc.objc; import bindings = dstep.foundation.NSTimeZone_bindings; alias NSInteger NSTimeZoneNameStyle; -const NSString NSSystemTimeZoneDidChangeNotification; +private NSString NSSystemTimeZoneDidChangeNotification_; + +NSString NSSystemTimeZoneDidChangeNotification () +{ + if (NSSystemTimeZoneDidChangeNotification_) + return NSSystemTimeZoneDidChangeNotification_; + + return NSSystemTimeZoneDidChangeNotification_ = new NSString(bindings.NSSystemTimeZoneDidChangeNotification); +} enum { @@ -30,16 +40,140 @@ NSTimeZoneNameStyleShortDaylightSaving } -static this () -{ - NSSystemTimeZoneDidChangeNotification = new NSString(bindings.NSSystemTimeZoneDidChangeNotification); -} +const TNSExtendedTimeZone = ` + + static NSTimeZone systemTimeZone () + { + return invokeObjcSuperClass!(NSTimeZone, "systemTimeZone"); + } + + static void resetSystemTimeZone () + { + return invokeObjcSuperClass!(void, "resetSystemTimeZone"); + } + + static NSTimeZone defaultTimeZone () + { + return invokeObjcSuperClass!(NSTimeZone, "defaultTimeZone"); + } + + static void setDefaultTimeZone (NSTimeZone aTimeZone) + { + return invokeObjcSuperClass!(void, "setDefaultTimeZone:", NSTimeZone)(aTimeZone); + } + + static NSTimeZone localTimeZone () + { + return invokeObjcSuperClass!(NSTimeZone, "localTimeZone"); + } + + static NSArray knownTimeZoneNames () + { + return invokeObjcSuperClass!(NSArray, "knownTimeZoneNames"); + } + + static NSDictionary abbreviationDictionary () + { + return invokeObjcSuperClass!(NSDictionary, "abbreviationDictionary"); + } + + NSInteger secondsFromGMT () + { + return invokeObjcSelf!(NSInteger, "secondsFromGMT"); + } + + NSString abbreviation () + { + return invokeObjcSelf!(NSString, "abbreviation"); + } + + bool isDaylightSavingTime () + { + return invokeObjcSelf!(bool, "isDaylightSavingTime"); + } + + double daylightSavingTimeOffset () + { + return invokeObjcSelf!(double, "daylightSavingTimeOffset"); + } + + NSDate nextDaylightSavingTimeTransition () + { + return invokeObjcSelf!(NSDate, "nextDaylightSavingTimeTransition"); + } + + NSString description () + { + return invokeObjcSelf!(NSString, "description"); + } + + bool isEqualToTimeZone (NSTimeZone aTimeZone) + { + return invokeObjcSelf!(bool, "isEqualToTimeZone:", NSTimeZone)(aTimeZone); + } + + NSString localizedName (int style, NSLocale locale) + { + return invokeObjcSelf!(NSString, "localizedName:locale:", int, NSLocale)(style, locale); + } +`; + +const TNSTimeZoneCreation = ` + + static Object timeZoneWithName (NSString tzName) + { + return invokeObjcSuperClass!(Object, "timeZoneWithName:", NSString)(tzName); + } + + static Object timeZoneWithName (NSString tzName, NSData aData) + { + return invokeObjcSuperClass!(Object, "timeZoneWithName:data:", NSString, NSData)(tzName, aData); + } + + Object initWithName (NSString tzName) + { + return invokeObjcSelf!(Object, "initWithName:", NSString)(tzName); + } + + this (NSString tzName) + { + typeof(this).alloc.initWithName(tzName); + } + + Object initWithName (NSString tzName, NSData aData) + { + return invokeObjcSelf!(Object, "initWithName:data:", NSString, NSData)(tzName, aData); + } + + this (NSString tzName, NSData aData) + { + typeof(this).alloc.initWithName(tzName, aData); + } + + static Object timeZoneForSecondsFromGMT (NSInteger seconds) + { + return invokeObjcSuperClass!(Object, "timeZoneForSecondsFromGMT:", NSInteger)(seconds); + } + + static Object timeZoneWithAbbreviation (NSString abbreviation) + { + return invokeObjcSuperClass!(Object, "timeZoneWithAbbreviation:", NSString)(abbreviation); + } +`; class NSTimeZone : NSObject, INSCopying, INSCoding { - mixin ObjcWrap; - mixin TNSExtendedTimeZone; - mixin TNSTimeZoneCreation; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } NSString name () { @@ -93,146 +227,123 @@ this (NSCoder aDecoder) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithCoder(aDecoder); } -} - -template TNSExtendedTimeZone () -{ + + // TNSExtendedTimeZone static NSTimeZone systemTimeZone () { - return invokeObjcSelfClass!(NSTimeZone, "systemTimeZone"); + return invokeObjcSuperClass!(NSTimeZone, "systemTimeZone"); } - + static void resetSystemTimeZone () { - return invokeObjcSelfClass!(void, "resetSystemTimeZone"); + return invokeObjcSuperClass!(void, "resetSystemTimeZone"); } - + static NSTimeZone defaultTimeZone () { - return invokeObjcSelfClass!(NSTimeZone, "defaultTimeZone"); + return invokeObjcSuperClass!(NSTimeZone, "defaultTimeZone"); } - + static void setDefaultTimeZone (NSTimeZone aTimeZone) { - return invokeObjcSelfClass!(void, "setDefaultTimeZone:", NSTimeZone)(aTimeZone); + return invokeObjcSuperClass!(void, "setDefaultTimeZone:", NSTimeZone)(aTimeZone); } - + static NSTimeZone localTimeZone () { - return invokeObjcSelfClass!(NSTimeZone, "localTimeZone"); + return invokeObjcSuperClass!(NSTimeZone, "localTimeZone"); } - + static NSArray knownTimeZoneNames () { - return invokeObjcSelfClass!(NSArray, "knownTimeZoneNames"); + return invokeObjcSuperClass!(NSArray, "knownTimeZoneNames"); } - + static NSDictionary abbreviationDictionary () { - return invokeObjcSelfClass!(NSDictionary, "abbreviationDictionary"); + return invokeObjcSuperClass!(NSDictionary, "abbreviationDictionary"); } - + NSInteger secondsFromGMT () { return invokeObjcSelf!(NSInteger, "secondsFromGMT"); } - + NSString abbreviation () { return invokeObjcSelf!(NSString, "abbreviation"); } - + bool isDaylightSavingTime () { return invokeObjcSelf!(bool, "isDaylightSavingTime"); } - + double daylightSavingTimeOffset () { return invokeObjcSelf!(double, "daylightSavingTimeOffset"); } - + NSDate nextDaylightSavingTimeTransition () { return invokeObjcSelf!(NSDate, "nextDaylightSavingTimeTransition"); } - + NSString description () { return invokeObjcSelf!(NSString, "description"); } - + bool isEqualToTimeZone (NSTimeZone aTimeZone) { return invokeObjcSelf!(bool, "isEqualToTimeZone:", NSTimeZone)(aTimeZone); } - + NSString localizedName (int style, NSLocale locale) { return invokeObjcSelf!(NSString, "localizedName:locale:", int, NSLocale)(style, locale); } -} - -template TNSTimeZoneCreation () -{ + + // TNSTimeZoneCreation static Object timeZoneWithName (NSString tzName) { - return invokeObjcSelfClass!(Object, "timeZoneWithName:", NSString)(tzName); + return invokeObjcSuperClass!(Object, "timeZoneWithName:", NSString)(tzName); } - + static Object timeZoneWithName (NSString tzName, NSData aData) { - return invokeObjcSelfClass!(Object, "timeZoneWithName:data:", NSString, NSData)(tzName, aData); + return invokeObjcSuperClass!(Object, "timeZoneWithName:data:", NSString, NSData)(tzName, aData); } - + Object initWithName (NSString tzName) { return invokeObjcSelf!(Object, "initWithName:", NSString)(tzName); } - + this (NSString tzName) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithName:", NSString)(objcObject, tzName); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithName(tzName); } - + Object initWithName (NSString tzName, NSData aData) { return invokeObjcSelf!(Object, "initWithName:data:", NSString, NSData)(tzName, aData); } - + this (NSString tzName, NSData aData) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithName:data:", NSString, NSData)(objcObject, tzName, aData); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithName(tzName, aData); } - + static Object timeZoneForSecondsFromGMT (NSInteger seconds) { - return invokeObjcSelfClass!(Object, "timeZoneForSecondsFromGMT:", NSInteger)(seconds); + return invokeObjcSuperClass!(Object, "timeZoneForSecondsFromGMT:", NSInteger)(seconds); } - + static Object timeZoneWithAbbreviation (NSString abbreviation) { - return invokeObjcSelfClass!(Object, "timeZoneWithAbbreviation:", NSString)(abbreviation); + return invokeObjcSuperClass!(Object, "timeZoneWithAbbreviation:", NSString)(abbreviation); } -} - +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSTimeZone_bindings.d --- a/dstep/foundation/NSTimeZone_bindings.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSTimeZone_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -8,7 +8,9 @@ import dstep.foundation.NSObject; import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + extern (C) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSTimer.d --- a/dstep/foundation/NSTimer.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSTimer.d Sun Jan 03 22:06:11 2010 +0100 @@ -7,32 +7,43 @@ module dstep.foundation.NSTimer; import dstep.foundation.NSDate; +import dstep.foundation.NSInvocation; import dstep.foundation.NSObject; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; class NSTimer : NSObject { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static NSTimer timerWithTimeInterval (double ti, NSInvocation invocation, bool yesOrNo) { - return invokeObjcSelfClass!(NSTimer, "timerWithTimeInterval:invocation:repeats:", double, NSInvocation, bool)(ti, invocation, yesOrNo); + return invokeObjcSuperClass!(NSTimer, "timerWithTimeInterval:invocation:repeats:", double, NSInvocation, bool)(ti, invocation, yesOrNo); } static NSTimer scheduledTimerWithTimeInterval (double ti, NSInvocation invocation, bool yesOrNo) { - return invokeObjcSelfClass!(NSTimer, "scheduledTimerWithTimeInterval:invocation:repeats:", double, NSInvocation, bool)(ti, invocation, yesOrNo); + return invokeObjcSuperClass!(NSTimer, "scheduledTimerWithTimeInterval:invocation:repeats:", double, NSInvocation, bool)(ti, invocation, yesOrNo); } static NSTimer timerWithTimeInterval (double ti, Object aTarget, SEL aSelector, Object userInfo, bool yesOrNo) { - return invokeObjcSelfClass!(NSTimer, "timerWithTimeInterval:target:selector:userInfo:repeats:", double, Object, SEL, Object, bool)(ti, aTarget, aSelector, userInfo, yesOrNo); + return invokeObjcSuperClass!(NSTimer, "timerWithTimeInterval:target:selector:userInfo:repeats:", double, Object, SEL, Object, bool)(ti, aTarget, aSelector, userInfo, yesOrNo); } static NSTimer scheduledTimerWithTimeInterval (double ti, Object aTarget, SEL aSelector, Object userInfo, bool yesOrNo) { - return invokeObjcSelfClass!(NSTimer, "scheduledTimerWithTimeInterval:target:selector:userInfo:repeats:", double, Object, SEL, Object, bool)(ti, aTarget, aSelector, userInfo, yesOrNo); + return invokeObjcSuperClass!(NSTimer, "scheduledTimerWithTimeInterval:target:selector:userInfo:repeats:", double, Object, SEL, Object, bool)(ti, aTarget, aSelector, userInfo, yesOrNo); } Object initWithFireDate (NSDate date, double ti, Object t, SEL s, Object ui, bool rep) @@ -42,13 +53,7 @@ this (NSDate date, double ti, Object t, SEL s, Object ui, bool rep) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithFireDate:interval:target:selector:userInfo:repeats:", NSDate, double, Object, SEL, Object, bool)(objcObject, date, ti, t, s, ui, rep); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithFireDate(date, ti, t, s, ui, rep); } void fire () diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSURL.d --- a/dstep/foundation/NSURL.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSURL.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,28 +6,44 @@ */ module dstep.foundation.NSURL; +import dstep.foundation.NSCoder; import dstep.foundation.NSData; import dstep.foundation.NSDictionary; -import dstep.foundation.NSNumber; import dstep.foundation.NSObject; import dstep.foundation.NSString; import dstep.foundation.NSURLHandle; +import dstep.foundation.NSValue; +import dstep.foundation.NSZone; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + import bindings = dstep.foundation.NSURL_bindings; -NSString NSURLFileScheme; +private NSString NSURLFileScheme_; -static this () +NSString NSURLFileScheme () { - NSURLFileScheme = new NSString(bindings.NSURLFileScheme); + if (NSURLFileScheme_) + return NSURLFileScheme_; + + return NSURLFileScheme_ = new NSString(bindings.NSURLFileScheme); } class NSURL : NSObject, INSCoding, INSCopying, INSURLHandleClient { - mixin ObjcWrap; - mixin TNSURLLoading; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } Object initWithScheme (NSString scheme, NSString host, NSString path) { @@ -36,13 +52,7 @@ this (NSString scheme, NSString host, NSString path) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithScheme:host:path:", NSString, NSString, NSString)(objcObject, scheme, host, path); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithScheme(scheme, host, path); } Object initFileURLWithPath (NSString path, bool isDir) @@ -52,13 +62,7 @@ this (NSString path, bool isDir) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initFileURLWithPath:isDirectory:", NSString, bool)(objcObject, path, isDir); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initFileURLWithPath(path, isDir); } Object initFileURLWithPath (NSString path) @@ -66,25 +70,14 @@ return invokeObjcSelf!(Object, "initFileURLWithPath:", NSString)(path); } - this (NSString path) - { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initFileURLWithPath:", NSString)(objcObject, path); - - if (result) - objcObject = ret; - - dObject = this; - } - static Object fileURLWithPath (NSString path, bool isDir) { - return invokeObjcSelfClass!(Object, "fileURLWithPath:isDirectory:", NSString, bool)(path, isDir); + return invokeObjcSuperClass!(Object, "fileURLWithPath:isDirectory:", NSString, bool)(path, isDir); } static Object fileURLWithPath (NSString path) { - return invokeObjcSelfClass!(Object, "fileURLWithPath:", NSString)(path); + return invokeObjcSuperClass!(Object, "fileURLWithPath:", NSString)(path); } Object initWithString (NSString URLString) @@ -94,13 +87,7 @@ this (NSString URLString) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithString:", NSString)(objcObject, URLString); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithString(URLString); } Object initWithString (NSString URLString, NSURL baseURL) @@ -110,23 +97,17 @@ this (NSString URLString, NSURL baseURL) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithString:relativeToURL:", NSString, NSURL)(objcObject, URLString, baseURL); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithString(URLString, baseURL); } static Object URLWithString (NSString URLString) { - return invokeObjcSelfClass!(Object, "URLWithString:", NSString)(URLString); + return invokeObjcSuperClass!(Object, "URLWithString:", NSString)(URLString); } static Object URLWithString (NSString URLString, NSURL baseURL) { - return invokeObjcSelfClass!(Object, "URLWithString:relativeToURL:", NSString, NSURL)(URLString, baseURL); + return invokeObjcSuperClass!(Object, "URLWithString:relativeToURL:", NSString, NSURL)(URLString, baseURL); } NSString absoluteString () @@ -229,13 +210,7 @@ this (NSCoder aDecoder) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithCoder(aDecoder); } Object copyWithZone (NSZone* zone) @@ -267,10 +242,41 @@ { return invokeObjcSelf!(void, "URLHandle:resourceDidFailLoadingWithReason:", NSURLHandle, NSString)(sender, reason); } + + // TNSURLLoading + NSData resourceDataUsingCache (bool shouldUseCache) + { + return invokeObjcSelf!(NSData, "resourceDataUsingCache:", bool)(shouldUseCache); + } + + void loadResourceDataNotifyingClient (Object client, bool shouldUseCache) + { + return invokeObjcSelf!(void, "loadResourceDataNotifyingClient:usingCache:", Object, bool)(client, shouldUseCache); + } + + Object propertyForKey (NSString propertyKey) + { + return invokeObjcSelf!(Object, "propertyForKey:", NSString)(propertyKey); + } + + bool setResourceData (NSData data) + { + return invokeObjcSelf!(bool, "setResourceData:", NSData)(data); + } + + bool setProperty (Object property, NSString propertyKey) + { + return invokeObjcSelf!(bool, "setProperty:forKey:", Object, NSString)(property, propertyKey); + } + + NSURLHandle URLHandleUsingCache (bool shouldUseCache) + { + return invokeObjcSelf!(NSURLHandle, "URLHandleUsingCache:", bool)(shouldUseCache); + } } -template TNSURLLoading () -{ +const TNSURLLoading = ` + NSData resourceDataUsingCache (bool shouldUseCache) { return invokeObjcSelf!(NSData, "resourceDataUsingCache:", bool)(shouldUseCache); @@ -300,18 +306,38 @@ { return invokeObjcSelf!(NSURLHandle, "URLHandleUsingCache:", bool)(shouldUseCache); } -} +`; + +const TNSURLClient = ` -template TNSURLClient () -{ - void URL (NSURL sender, NSData newBytes); - void URLResourceDidFinishLoading (NSURL sender); - void URLResourceDidCancelLoading (NSURL sender); - void URL (NSURL sender, NSString reason); -} + void URL (NSURL sender, NSData newBytes) + { + return invokeObjcSelf!(void, "URL:resourceDataDidBecomeAvailable:", NSURL, NSData)(sender, newBytes); + } + + void URLResourceDidFinishLoading (NSURL sender) + { + return invokeObjcSelf!(void, "URLResourceDidFinishLoading:", NSURL)(sender); + } + + void URLResourceDidCancelLoading (NSURL sender) + { + return invokeObjcSelf!(void, "URLResourceDidCancelLoading:", NSURL)(sender); + } + + void URL (NSURL sender, NSString reason) + { + return invokeObjcSelf!(void, "URL:resourceDidFailLoadingWithReason:", NSURL, NSString)(sender, reason); + } + + //mixin ObjcBindMethod!(URL, "URL:resourceDataDidBecomeAvailable:"); + //mixin ObjcBindMethod!(URLResourceDidFinishLoading, "URLResourceDidFinishLoading:"); + //mixin ObjcBindMethod!(URLResourceDidCancelLoading, "URLResourceDidCancelLoading:"); + //mixin ObjcBindMethod!(URL, "URL:resourceDidFailLoadingWithReason:"); +`; -template TNSURLUtilities () -{ +const TNSURLUtilities = ` + NSString stringByAddingPercentEscapesUsingEncoding (uint enc) { return invokeObjcSelf!(NSString, "stringByAddingPercentEscapesUsingEncoding:", uint)(enc); @@ -321,5 +347,4 @@ { return invokeObjcSelf!(NSString, "stringByReplacingPercentEscapesUsingEncoding:", uint)(enc); } -} - +`; \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSURLAuthenticationChallenge.d --- a/dstep/foundation/NSURLAuthenticationChallenge.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSURLAuthenticationChallenge.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,20 +6,29 @@ */ module dstep.foundation.NSURLAuthenticationChallenge; -import dstep.AvailabilityMacros; import dstep.foundation.NSError; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; -import dstep.foundation.NSURLAuthenticationChallengeInternal; import dstep.foundation.NSURLCredential; import dstep.foundation.NSURLProtectionSpace; import dstep.foundation.NSURLResponse; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; class NSURLAuthenticationChallenge : NSObject { - mixin ObjcWrap; - + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } + Object initWithProtectionSpace (NSURLProtectionSpace space, NSURLCredential credential, NSInteger previousFailureCount, NSURLResponse response, NSError error, INSURLAuthenticationChallengeSender sender) { return invokeObjcSelf!(Object, "initWithProtectionSpace:proposedCredential:previousFailureCount:failureResponse:error:sender:", NSURLProtectionSpace, NSURLCredential, NSInteger, NSURLResponse, NSError, INSURLAuthenticationChallengeSender)(space, credential, previousFailureCount, response, error, sender); @@ -31,7 +40,7 @@ id result = Bridge.invokeObjcMethod!(id, "initWithProtectionSpace:proposedCredential:previousFailureCount:failureResponse:error:sender:", NSURLProtectionSpace, NSURLCredential, NSInteger, NSURLResponse, NSError, INSURLAuthenticationChallengeSender)(objcObject, space, credential, previousFailureCount, response, error, sender); if (result) - objcObject = ret; + objcObject = result; dObject = this; } @@ -47,7 +56,7 @@ id result = Bridge.invokeObjcMethod!(id, "initWithAuthenticationChallenge:sender:", NSURLAuthenticationChallenge, INSURLAuthenticationChallengeSender)(objcObject, challenge, sender); if (result) - objcObject = ret; + objcObject = result; dObject = this; } diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSURLCache.d --- a/dstep/foundation/NSURLCache.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSURLCache.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,16 +6,17 @@ */ module dstep.foundation.NSURLCache; -import dstep.AvailabilityMacros; -import dstep.foundation.NSCachedURLResponseInternal; +import dstep.foundation.NSCoder; import dstep.foundation.NSData; import dstep.foundation.NSDictionary; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; -import dstep.foundation.NSURLCacheInternal; +import dstep.foundation.NSString; import dstep.foundation.NSURLRequest; import dstep.foundation.NSURLResponse; +import dstep.foundation.NSZone; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; alias NSUInteger NSURLCacheStoragePolicy; @@ -28,7 +29,17 @@ class NSCachedURLResponse : NSObject, INSCoding, INSCopying { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } Object initWithResponse (NSURLResponse response, NSData data) { @@ -37,13 +48,7 @@ this (NSURLResponse response, NSData data) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithResponse:data:", NSURLResponse, NSData)(objcObject, response, data); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithResponse(response, data); } Object initWithResponse (NSURLResponse response, NSData data, NSDictionary userInfo, uint storagePolicy) @@ -53,13 +58,7 @@ this (NSURLResponse response, NSData data, NSDictionary userInfo, uint storagePolicy) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithResponse:data:userInfo:storagePolicy:", NSURLResponse, NSData, NSDictionary, uint)(objcObject, response, data, userInfo, storagePolicy); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithResponse(response, data, userInfo, storagePolicy); } NSURLResponse response () @@ -94,13 +93,7 @@ this (NSCoder aDecoder) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithCoder(aDecoder); } Object copyWithZone (NSZone* zone) @@ -111,16 +104,26 @@ class NSURLCache : NSObject { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static NSURLCache sharedURLCache () { - return invokeObjcSelfClass!(NSURLCache, "sharedURLCache"); + return invokeObjcSuperClass!(NSURLCache, "sharedURLCache"); } static void setSharedURLCache (NSURLCache cache) { - return invokeObjcSelfClass!(void, "setSharedURLCache:", NSURLCache)(cache); + return invokeObjcSuperClass!(void, "setSharedURLCache:", NSURLCache)(cache); } Object initWithMemoryCapacity (NSUInteger memoryCapacity, NSUInteger diskCapacity, NSString path) @@ -130,13 +133,7 @@ this (NSUInteger memoryCapacity, NSUInteger diskCapacity, NSString path) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithMemoryCapacity:diskCapacity:diskPath:", NSUInteger, NSUInteger, NSString)(objcObject, memoryCapacity, diskCapacity, path); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithMemoryCapacity(memoryCapacity, diskCapacity, path); } NSCachedURLResponse cachedResponseForRequest (NSURLRequest request) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSURLConnection.d --- a/dstep/foundation/NSURLConnection.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSURLConnection.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,32 +6,100 @@ */ module dstep.foundation.NSURLConnection; -import dstep.AvailabilityMacros; -import dstep.foundation.NSCachedURLResponse; import dstep.foundation.NSData; import dstep.foundation.NSError; import dstep.foundation.NSObject; import dstep.foundation.NSRunLoop; +import dstep.foundation.NSString; import dstep.foundation.NSURLAuthenticationChallenge; -import dstep.foundation.NSURLConnectionInternal; +import dstep.foundation.NSURLCache; import dstep.foundation.NSURLRequest; import dstep.foundation.NSURLResponse; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + +const TNSURLConnectionDelegate = ` + + NSURLRequest connection (NSURLConnection connection, NSURLRequest request, NSURLResponse response) + { + return invokeObjcSelf!(NSURLRequest, "connection:willSendRequest:redirectResponse:", NSURLConnection, NSURLRequest, NSURLResponse)(connection, request, response); + } + + void connection (NSURLConnection connection, NSURLAuthenticationChallenge challenge) + { + return invokeObjcSelf!(void, "connection:didReceiveAuthenticationChallenge:", NSURLConnection, NSURLAuthenticationChallenge)(connection, challenge); + } + + void connection_didCancelAuthenticationChallenge (NSURLConnection connection, NSURLAuthenticationChallenge challenge) + { + return invokeObjcSelf!(void, "connection:didCancelAuthenticationChallenge:", NSURLConnection, NSURLAuthenticationChallenge)(connection, challenge); + } + + void connection (NSURLConnection connection, NSURLResponse response) + { + return invokeObjcSelf!(void, "connection:didReceiveResponse:", NSURLConnection, NSURLResponse)(connection, response); + } + + void connection (NSURLConnection connection, NSData data) + { + return invokeObjcSelf!(void, "connection:didReceiveData:", NSURLConnection, NSData)(connection, data); + } + + void connectionDidFinishLoading (NSURLConnection connection) + { + return invokeObjcSelf!(void, "connectionDidFinishLoading:", NSURLConnection)(connection); + } + + void connection (NSURLConnection connection, NSError error) + { + return invokeObjcSelf!(void, "connection:didFailWithError:", NSURLConnection, NSError)(connection, error); + } + + NSCachedURLResponse connection (NSURLConnection connection, NSCachedURLResponse cachedResponse) + { + return invokeObjcSelf!(NSCachedURLResponse, "connection:willCacheResponse:", NSURLConnection, NSCachedURLResponse)(connection, cachedResponse); + } + + //mixin ObjcBindMethod!(connection, "connection:willSendRequest:redirectResponse:"); + //mixin ObjcBindMethod!(connection, "replacementObjectForArchiver:"); + //mixin ObjcBindMethod!(connection_didCancelAuthenticationChallenge, "connection:didReceiveAuthenticationChallenge:"); + //mixin ObjcBindMethod!(connection, "connection:didReceiveResponse:"); + //mixin ObjcBindMethod!(connection, "connection:didReceiveData:"); + //mixin ObjcBindMethod!(connectionDidFinishLoading, "connectionDidFinishLoading:"); + //mixin ObjcBindMethod!(connection, "connection:didFailWithError:"); + //mixin ObjcBindMethod!(connection, "connection:willCacheResponse:"); +`; + +const TNSURLConnectionSynchronousLoading = ` + + static NSData sendSynchronousRequest (NSURLRequest request, NSURLResponse** response, NSError** error) + { + return invokeObjcSuperClass!(NSData, "sendSynchronousRequest:returningResponse:error:", NSURLRequest, NSURLResponse**, NSError**)(request, response, error); + } +`; class NSURLConnection : NSObject { - mixin ObjcWrap; - mixin TNSURLConnectionSynchronousLoading; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static bool canHandleRequest (NSURLRequest request) { - return invokeObjcSelfClass!(bool, "canHandleRequest:", NSURLRequest)(request); + return invokeObjcSuperClass!(bool, "canHandleRequest:", NSURLRequest)(request); } static NSURLConnection connectionWithRequest (NSURLRequest request, Object delegate_) { - return invokeObjcSelfClass!(NSURLConnection, "connectionWithRequest:delegate:", NSURLRequest, Object)(request, delegate_); + return invokeObjcSuperClass!(NSURLConnection, "connectionWithRequest:delegate:", NSURLRequest, Object)(request, delegate_); } Object initWithRequest (NSURLRequest request, Object delegate_) @@ -41,13 +109,7 @@ this (NSURLRequest request, Object delegate_) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithRequest:delegate:", NSURLRequest, Object)(objcObject, request, delegate_); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithRequest(request, delegate_); } Object initWithRequest (NSURLRequest request, Object delegate_, bool startImmediately) @@ -57,13 +119,7 @@ this (NSURLRequest request, Object delegate_, bool startImmediately) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithRequest:delegate:startImmediately:", NSURLRequest, Object, bool)(objcObject, request, delegate_, startImmediately); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithRequest(request, delegate_, startImmediately); } void start () @@ -85,25 +141,10 @@ { return invokeObjcSelf!(void, "unscheduleFromRunLoop:forMode:", NSRunLoop, NSString)(aRunLoop, mode); } -} - -template TNSURLConnectionDelegate () -{ - NSURLRequest connection (NSURLConnection connection, NSURLRequest request, NSURLResponse response); - void connection (NSURLConnection connection, NSURLAuthenticationChallenge challenge); - void connection (NSURLConnection connection, NSURLAuthenticationChallenge challenge); - void connection (NSURLConnection connection, NSURLResponse response); - void connection (NSURLConnection connection, NSData data); - void connectionDidFinishLoading (NSURLConnection connection); - void connection (NSURLConnection connection, NSError error); - NSCachedURLResponse connection (NSURLConnection connection, NSCachedURLResponse cachedResponse); -} - -template TNSURLConnectionSynchronousLoading () -{ + + // TNSURLConnectionSynchronousLoading static NSData sendSynchronousRequest (NSURLRequest request, NSURLResponse** response, NSError** error) { - return invokeObjcSelfClass!(NSData, "sendSynchronousRequest:returningResponse:error:", NSURLRequest, NSURLResponse**, NSError**)(request, response, error); + return invokeObjcSuperClass!(NSData, "sendSynchronousRequest:returningResponse:error:", NSURLRequest, NSURLResponse**, NSError**)(request, response, error); } -} - +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSURLCredential.d --- a/dstep/foundation/NSURLCredential.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSURLCredential.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,12 +6,12 @@ */ module dstep.foundation.NSURLCredential; -import dstep.AvailabilityMacros; import dstep.foundation.NSObject; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSString; -import dstep.foundation.NSURLCredentialInternal; +import dstep.foundation.NSZone; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; alias NSUInteger NSURLCredentialPersistence; @@ -24,7 +24,17 @@ class NSURLCredential : NSObject, INSCopying { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } Object initWithUser (NSString user, NSString password, uint persistence) { @@ -33,18 +43,12 @@ this (NSString user, NSString password, uint persistence) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithUser:password:persistence:", NSString, NSString, uint)(objcObject, user, password, persistence); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithUser(user, password, persistence); } static NSURLCredential credentialWithUser (NSString user, NSString password, uint persistence) { - return invokeObjcSelfClass!(NSURLCredential, "credentialWithUser:password:persistence:", NSString, NSString, uint)(user, password, persistence); + return invokeObjcSuperClass!(NSURLCredential, "credentialWithUser:password:persistence:", NSString, NSString, uint)(user, password, persistence); } NSString user () diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSURLCredentialStorage.d --- a/dstep/foundation/NSURLCredentialStorage.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSURLCredentialStorage.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,32 +6,45 @@ */ module dstep.foundation.NSURLCredentialStorage; -import dstep.AvailabilityMacros; import dstep.foundation.NSDictionary; import dstep.foundation.NSObject; import dstep.foundation.NSString; import dstep.foundation.NSURLCredential; -import dstep.foundation.NSURLCredentialStorageInternal; import dstep.foundation.NSURLProtectionSpace; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + import bindings = dstep.foundation.NSURLCredentialStorage_bindings; -const NSString NSURLCredentialStorageChangedNotification; +private NSString NSURLCredentialStorageChangedNotification_; -static this () +NSString NSURLCredentialStorageChangedNotification () { - NSURLCredentialStorageChangedNotification = new NSString(bindings.NSURLCredentialStorageChangedNotification); + if (NSURLCredentialStorageChangedNotification_) + return NSURLCredentialStorageChangedNotification_; + + return NSURLCredentialStorageChangedNotification_ = new NSString(bindings.NSURLCredentialStorageChangedNotification); } class NSURLCredentialStorage : NSObject { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static NSURLCredentialStorage sharedCredentialStorage () { - return invokeObjcSelfClass!(NSURLCredentialStorage, "sharedCredentialStorage"); + return invokeObjcSuperClass!(NSURLCredentialStorage, "sharedCredentialStorage"); } NSDictionary credentialsForProtectionSpace (NSURLProtectionSpace space) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSURLCredentialStorage_bindings.d --- a/dstep/foundation/NSURLCredentialStorage_bindings.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSURLCredentialStorage_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -1,14 +1,8 @@ module dstep.foundation.NSURLCredentialStorage_bindings; -import dstep.AvailabilityMacros; -import dstep.foundation.NSDictionary; -import dstep.foundation.NSObject; -import dstep.foundation.NSString; -import dstep.foundation.NSURLCredential; -import dstep.foundation.NSURLCredentialStorageInternal; -import dstep.foundation.NSURLProtectionSpace; -import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + extern (C) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSURLDownload.d --- a/dstep/foundation/NSURLDownload.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSURLDownload.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,25 +6,33 @@ */ module dstep.foundation.NSURLDownload; -import dstep.AvailabilityMacros; import dstep.foundation.NSData; import dstep.foundation.NSError; import dstep.foundation.NSObject; import dstep.foundation.NSString; import dstep.foundation.NSURLAuthenticationChallenge; -import dstep.foundation.NSURLDownloadInternal; import dstep.foundation.NSURLRequest; import dstep.foundation.NSURLResponse; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; class NSURLDownload : NSObject { - mixin ObjcWrap; - + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } + static bool canResumeDownloadDecodedWithEncodingMIMEType (NSString MIMEType) { - return invokeObjcSelfClass!(bool, "canResumeDownloadDecodedWithEncodingMIMEType:", NSString)(MIMEType); + return invokeObjcSuperClass!(bool, "canResumeDownloadDecodedWithEncodingMIMEType:", NSString)(MIMEType); } Object initWithRequest (NSURLRequest request, Object delegate_) @@ -34,13 +42,7 @@ this (NSURLRequest request, Object delegate_) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithRequest:delegate:", NSURLRequest, Object)(objcObject, request, delegate_); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithRequest(request, delegate_); } Object initWithResumeData (NSData resumeData, Object delegate_, NSString path) @@ -50,13 +52,7 @@ this (NSData resumeData, Object delegate_, NSString path) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithResumeData:delegate:path:", NSData, Object, NSString)(objcObject, resumeData, delegate_, path); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithResumeData(resumeData, delegate_, path); } void cancel () @@ -90,19 +86,78 @@ } } -template TNSURLDownloadDelegate () -{ - void downloadDidBegin (NSURLDownload download); - NSURLRequest download (NSURLDownload download, NSURLRequest request, NSURLResponse redirectResponse); - void download (NSURLDownload download, NSURLAuthenticationChallenge challenge); - void download (NSURLDownload download, NSURLAuthenticationChallenge challenge); - void download (NSURLDownload download, NSURLResponse response); - void download (NSURLDownload download, NSURLResponse response, long startingByte); - void download (NSURLDownload download, NSUInteger length); - bool download (NSURLDownload download, NSString encodingType); - void download (NSURLDownload download, NSString filename); - void download (NSURLDownload download, NSString path); - void downloadDidFinish (NSURLDownload download); - void download (NSURLDownload download, NSError error); -} +const TNSURLDownloadDelegate = ` + void downloadDidBegin (NSURLDownload download) + { + return invokeObjcSelf!(void, "downloadDidBegin:", NSURLDownload)(download); + } + + NSURLRequest download (NSURLDownload download, NSURLRequest request, NSURLResponse redirectResponse) + { + return invokeObjcSelf!(NSURLRequest, "download:willSendRequest:redirectResponse:", NSURLDownload, NSURLRequest, NSURLResponse)(download, request, redirectResponse); + } + + void download (NSURLDownload download, NSURLAuthenticationChallenge challenge) + { + return invokeObjcSelf!(void, "download:didReceiveAuthenticationChallenge:", NSURLDownload, NSURLAuthenticationChallenge)(download, challenge); + } + + void download_didCancelAuthenticationChallenge (NSURLDownload download, NSURLAuthenticationChallenge challenge) + { + return invokeObjcSelf!(void, "download:didCancelAuthenticationChallenge:", NSURLDownload, NSURLAuthenticationChallenge)(download, challenge); + } + + void download (NSURLDownload download, NSURLResponse response) + { + return invokeObjcSelf!(void, "download:didReceiveResponse:", NSURLDownload, NSURLResponse)(download, response); + } + + void download (NSURLDownload download, NSURLResponse response, long startingByte) + { + return invokeObjcSelf!(void, "download:willResumeWithResponse:fromByte:", NSURLDownload, NSURLResponse, long)(download, response, startingByte); + } + + void download (NSURLDownload download, NSUInteger length) + { + return invokeObjcSelf!(void, "download:didReceiveDataOfLength:", NSURLDownload, NSUInteger)(download, length); + } + + bool download (NSURLDownload download, NSString encodingType) + { + return invokeObjcSelf!(bool, "download:shouldDecodeSourceDataOfMIMEType:", NSURLDownload, NSString)(download, encodingType); + } + + void download_decideDestinationWithSuggestedFilename (NSURLDownload download, NSString filename) + { + return invokeObjcSelf!(void, "download:decideDestinationWithSuggestedFilename:", NSURLDownload, NSString)(download, filename); + } + + void download_didCreateDestination (NSURLDownload download, NSString path) + { + return invokeObjcSelf!(void, "download:didCreateDestination:", NSURLDownload, NSString)(download, path); + } + + void downloadDidFinish (NSURLDownload download) + { + return invokeObjcSelf!(void, "downloadDidFinish:", NSURLDownload)(download); + } + + void download (NSURLDownload download, NSError error) + { + return invokeObjcSelf!(void, "download:didFailWithError:", NSURLDownload, NSError)(download, error); + } + + //mixin ObjcBindMethod!(downloadDidBegin, "downloadDidBegin:"); + //mixin ObjcBindMethod!(download, "download:willSendRequest:redirectResponse:"); + //mixin ObjcBindMethod!(download, "download:didReceiveAuthenticationChallenge:"); + //mixin ObjcBindMethod!(download_didCancelAuthenticationChallenge, "download:didCancelAuthenticationChallenge:"); + //mixin ObjcBindMethod!(download, "download:didReceiveResponse:"); + //mixin ObjcBindMethod!(download, "download:willResumeWithResponse:fromByte:"); + //mixin ObjcBindMethod!(download, "download:didReceiveDataOfLength:"); + //mixin ObjcBindMethod!(download, "download:shouldDecodeSourceDataOfMIMEType:"); + //mixin ObjcBindMethod!(download_decideDestinationWithSuggestedFilename, "download:decideDestinationWithSuggestedFilename:"); + //mixin ObjcBindMethod!(download_didCreateDestination, "download:didCreateDestination:"); + //mixin ObjcBindMethod!(downloadDidFinish, "downloadDidFinish:"); + //mixin ObjcBindMethod!(download, "download:didFailWithError:"); +`; \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSURLError.d --- a/dstep/foundation/NSURLError.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSURLError.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,15 +6,32 @@ */ module dstep.foundation.NSURLError; -import dstep.AvailabilityMacros; import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; - +import dstep.objc.objc; import bindings = dstep.foundation.NSURLError_bindings; -const NSString NSURLErrorDomain; -const NSString NSErrorFailingURLStringKey; +private +{ + NSString NSURLErrorDomain_; + NSString NSErrorFailingURLStringKey_; +} + +NSString NSURLErrorDomain () +{ + if (NSURLErrorDomain_) + return NSURLErrorDomain_; + + return NSURLErrorDomain_ = new NSString(bindings.NSURLErrorDomain); +} + +NSString NSErrorFailingURLStringKey () +{ + if (NSErrorFailingURLStringKey_) + return NSErrorFailingURLStringKey_; + + return NSErrorFailingURLStringKey_ = new NSString(bindings.NSErrorFailingURLStringKey); +} enum { @@ -57,11 +74,4 @@ NSURLErrorCannotMoveFile = -3005, NSURLErrorDownloadDecodingFailedMidStream = -3006, NSURLErrorDownloadDecodingFailedToComplete = -3007 -} - -static this () -{ - NSURLErrorDomain = new NSString(bindings.NSURLErrorDomain); - NSErrorFailingURLStringKey = new NSString(bindings.NSErrorFailingURLStringKey); -} - +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSURLError_bindings.d --- a/dstep/foundation/NSURLError_bindings.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSURLError_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -1,9 +1,8 @@ module dstep.foundation.NSURLError_bindings; -import dstep.AvailabilityMacros; -import dstep.foundation.NSString; -import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + extern (C) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSURLHandle.d --- a/dstep/foundation/NSURLHandle.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSURLHandle.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,9 +6,14 @@ */ module dstep.foundation.NSURLHandle; +import dstep.foundation.NSData; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSURL; +import dstep.internal.Version; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; alias NSUInteger NSURLHandleStatus; @@ -22,16 +27,26 @@ class NSURLHandle : NSObject { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static void registerURLHandleClass (Class anURLHandleSubclass) { - return invokeObjcSelfClass!(void, "registerURLHandleClass:", Class)(anURLHandleSubclass); + return invokeObjcSuperClass!(void, "registerURLHandleClass:", Class)(anURLHandleSubclass); } static Class URLHandleClassForURL (NSURL anURL) { - return invokeObjcSelfClass!(Class, "URLHandleClassForURL:", NSURL)(anURL); + return invokeObjcSuperClass!(Class, "URLHandleClassForURL:", NSURL)(anURL); } uint status () @@ -96,12 +111,12 @@ static bool canInitWithURL (NSURL anURL) { - return invokeObjcSelfClass!(bool, "canInitWithURL:", NSURL)(anURL); + return invokeObjcSuperClass!(bool, "canInitWithURL:", NSURL)(anURL); } static NSURLHandle cachedHandleForURL (NSURL anURL) { - return invokeObjcSelfClass!(NSURLHandle, "cachedHandleForURL:", NSURL)(anURL); + return invokeObjcSuperClass!(NSURLHandle, "cachedHandleForURL:", NSURL)(anURL); } Object initWithURL (NSURL anURL, bool willCache) @@ -111,13 +126,7 @@ this (NSURL anURL, bool willCache) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithURL:cached:", NSURL, bool)(objcObject, anURL, willCache); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithURL(anURL, willCache); } Object propertyForKey (NSString propertyKey) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSURLProtectionSpace.d --- a/dstep/foundation/NSURLProtectionSpace.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSURLProtectionSpace.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,39 +6,106 @@ */ module dstep.foundation.NSURLProtectionSpace; -import dstep.AvailabilityMacros; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; import dstep.foundation.NSString; -import dstep.foundation.NSURLProtectionSpaceInternal; +import dstep.foundation.NSZone; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + import bindings = dstep.foundation.NSURLProtectionSpace_bindings; -const NSString NSURLProtectionSpaceHTTPProxy; -const NSString NSURLProtectionSpaceHTTPSProxy; -const NSString NSURLProtectionSpaceFTPProxy; -const NSString NSURLProtectionSpaceSOCKSProxy; -const NSString NSURLAuthenticationMethodDefault; -const NSString NSURLAuthenticationMethodHTTPBasic; -const NSString NSURLAuthenticationMethodHTTPDigest; -const NSString NSURLAuthenticationMethodHTMLForm; +private +{ + NSString NSURLProtectionSpaceHTTPProxy_; + NSString NSURLProtectionSpaceHTTPSProxy_; + NSString NSURLProtectionSpaceFTPProxy_; + NSString NSURLProtectionSpaceSOCKSProxy_; + NSString NSURLAuthenticationMethodDefault_; + NSString NSURLAuthenticationMethodHTTPBasic_; + NSString NSURLAuthenticationMethodHTTPDigest_; + NSString NSURLAuthenticationMethodHTMLForm_; +} + +NSString NSURLProtectionSpaceHTTPProxy () +{ + if (NSURLProtectionSpaceHTTPProxy_) + return NSURLProtectionSpaceHTTPProxy_; + + return NSURLProtectionSpaceHTTPProxy_ = new NSString(bindings.NSURLProtectionSpaceHTTPProxy); +} + +NSString NSURLProtectionSpaceHTTPSProxy () +{ + if (NSURLProtectionSpaceHTTPSProxy_) + return NSURLProtectionSpaceHTTPSProxy_; + + return NSURLProtectionSpaceHTTPSProxy_ = new NSString(bindings.NSURLProtectionSpaceHTTPSProxy); +} + +NSString NSURLProtectionSpaceFTPProxy () +{ + if (NSURLProtectionSpaceFTPProxy_) + return NSURLProtectionSpaceFTPProxy_; + + return NSURLProtectionSpaceFTPProxy_ = new NSString(bindings.NSURLProtectionSpaceFTPProxy); +} -static this () +NSString NSURLProtectionSpaceSOCKSProxy () +{ + if (NSURLProtectionSpaceSOCKSProxy_) + return NSURLProtectionSpaceSOCKSProxy_; + + return NSURLProtectionSpaceSOCKSProxy_ = new NSString(bindings.NSURLProtectionSpaceSOCKSProxy); +} + +NSString NSURLAuthenticationMethodDefault () +{ + if (NSURLAuthenticationMethodDefault_) + return NSURLAuthenticationMethodDefault_; + + return NSURLAuthenticationMethodDefault_ = new NSString(bindings.NSURLAuthenticationMethodDefault); +} + +NSString NSURLAuthenticationMethodHTTPBasic () { - NSURLProtectionSpaceHTTPProxy = new NSString(bindings.NSURLProtectionSpaceHTTPProxy); - NSURLProtectionSpaceHTTPSProxy = new NSString(bindings.NSURLProtectionSpaceHTTPSProxy); - NSURLProtectionSpaceFTPProxy = new NSString(bindings.NSURLProtectionSpaceFTPProxy); - NSURLProtectionSpaceSOCKSProxy = new NSString(bindings.NSURLProtectionSpaceSOCKSProxy); - NSURLAuthenticationMethodDefault = new NSString(bindings.NSURLAuthenticationMethodDefault); - NSURLAuthenticationMethodHTTPBasic = new NSString(bindings.NSURLAuthenticationMethodHTTPBasic); - NSURLAuthenticationMethodHTTPDigest = new NSString(bindings.NSURLAuthenticationMethodHTTPDigest); - NSURLAuthenticationMethodHTMLForm = new NSString(bindings.NSURLAuthenticationMethodHTMLForm); + if (NSURLAuthenticationMethodHTTPBasic_) + return NSURLAuthenticationMethodHTTPBasic_; + + return NSURLAuthenticationMethodHTTPBasic_ = new NSString(bindings.NSURLAuthenticationMethodHTTPBasic); +} + +NSString NSURLAuthenticationMethodHTTPDigest () +{ + if (NSURLAuthenticationMethodHTTPDigest_) + return NSURLAuthenticationMethodHTTPDigest_; + + return NSURLAuthenticationMethodHTTPDigest_ = new NSString(bindings.NSURLAuthenticationMethodHTTPDigest); +} + +NSString NSURLAuthenticationMethodHTMLForm () +{ + if (NSURLAuthenticationMethodHTMLForm_) + return NSURLAuthenticationMethodHTMLForm_; + + return NSURLAuthenticationMethodHTMLForm_ = new NSString(bindings.NSURLAuthenticationMethodHTMLForm); } class NSURLProtectionSpace : NSObject, INSCopying { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } Object initWithHost (NSString host, NSInteger port, NSString protocol, NSString realm, NSString authenticationMethod) { @@ -47,13 +114,7 @@ this (NSString host, NSInteger port, NSString protocol, NSString realm, NSString authenticationMethod) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithHost:port:protocol:realm:authenticationMethod:", NSString, NSInteger, NSString, NSString, NSString)(objcObject, host, port, protocol, realm, authenticationMethod); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithHost(host, port, protocol, realm, authenticationMethod); } Object initWithProxyHost (NSString host, NSInteger port, NSString type, NSString realm, NSString authenticationMethod) @@ -61,17 +122,6 @@ return invokeObjcSelf!(Object, "initWithProxyHost:port:type:realm:authenticationMethod:", NSString, NSInteger, NSString, NSString, NSString)(host, port, type, realm, authenticationMethod); } - this (NSString host, NSInteger port, NSString type, NSString realm, NSString authenticationMethod) - { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithProxyHost:port:type:realm:authenticationMethod:", NSString, NSInteger, NSString, NSString, NSString)(objcObject, host, port, type, realm, authenticationMethod); - - if (result) - objcObject = ret; - - dObject = this; - } - NSString realm () { return invokeObjcSelf!(NSString, "realm"); diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSURLProtectionSpace_bindings.d --- a/dstep/foundation/NSURLProtectionSpace_bindings.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSURLProtectionSpace_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -1,11 +1,8 @@ module dstep.foundation.NSURLProtectionSpace_bindings; -import dstep.AvailabilityMacros; -import dstep.foundation.NSObject; -import dstep.foundation.NSString; -import dstep.foundation.NSURLProtectionSpaceInternal; -import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + extern (C) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSURLProtocol.d --- a/dstep/foundation/NSURLProtocol.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSURLProtocol.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,23 +6,31 @@ */ module dstep.foundation.NSURLProtocol; -import dstep.AvailabilityMacros; -import dstep.foundation.NSCachedURLResponse; +import dstep.foundation.NSData; import dstep.foundation.NSError; -import dstep.foundation.NSMutableURLRequest; import dstep.foundation.NSObject; +import dstep.foundation.NSString; import dstep.foundation.NSURLAuthenticationChallenge; import dstep.foundation.NSURLCache; import dstep.foundation.NSURLConnection; -import dstep.foundation.NSURLProtocolInternal; import dstep.foundation.NSURLRequest; import dstep.foundation.NSURLResponse; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; class NSURLProtocol : NSObject { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } Object initWithRequest (NSURLRequest request, NSCachedURLResponse cachedResponse, INSURLProtocolClient client) { @@ -31,13 +39,7 @@ this (NSURLRequest request, NSCachedURLResponse cachedResponse, INSURLProtocolClient client) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithRequest:cachedResponse:client:", NSURLRequest, NSCachedURLResponse, INSURLProtocolClient)(objcObject, request, cachedResponse, client); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithRequest(request, cachedResponse, client); } INSURLProtocolClient client () @@ -57,17 +59,17 @@ static bool canInitWithRequest (NSURLRequest request) { - return invokeObjcSelfClass!(bool, "canInitWithRequest:", NSURLRequest)(request); + return invokeObjcSuperClass!(bool, "canInitWithRequest:", NSURLRequest)(request); } static NSURLRequest canonicalRequestForRequest (NSURLRequest request) { - return invokeObjcSelfClass!(NSURLRequest, "canonicalRequestForRequest:", NSURLRequest)(request); + return invokeObjcSuperClass!(NSURLRequest, "canonicalRequestForRequest:", NSURLRequest)(request); } static bool requestIsCacheEquivalent (NSURLRequest a, NSURLRequest b) { - return invokeObjcSelfClass!(bool, "requestIsCacheEquivalent:toRequest:", NSURLRequest, NSURLRequest)(a, b); + return invokeObjcSuperClass!(bool, "requestIsCacheEquivalent:toRequest:", NSURLRequest, NSURLRequest)(a, b); } void startLoading () @@ -82,27 +84,27 @@ static Object propertyForKey (NSString key, NSURLRequest request) { - return invokeObjcSelfClass!(Object, "propertyForKey:inRequest:", NSString, NSURLRequest)(key, request); + return invokeObjcSuperClass!(Object, "propertyForKey:inRequest:", NSString, NSURLRequest)(key, request); } static void setProperty (Object value, NSString key, NSMutableURLRequest request) { - return invokeObjcSelfClass!(void, "setProperty:forKey:inRequest:", Object, NSString, NSMutableURLRequest)(value, key, request); + return invokeObjcSuperClass!(void, "setProperty:forKey:inRequest:", Object, NSString, NSMutableURLRequest)(value, key, request); } static void removePropertyForKey (NSString key, NSMutableURLRequest request) { - return invokeObjcSelfClass!(void, "removePropertyForKey:inRequest:", NSString, NSMutableURLRequest)(key, request); + return invokeObjcSuperClass!(void, "removePropertyForKey:inRequest:", NSString, NSMutableURLRequest)(key, request); } static bool registerClass (Class protocolClass) { - return invokeObjcSelfClass!(bool, "registerClass:", Class)(protocolClass); + return invokeObjcSuperClass!(bool, "registerClass:", Class)(protocolClass); } static void unregisterClass (Class protocolClass) { - return invokeObjcSelfClass!(void, "unregisterClass:", Class)(protocolClass); + return invokeObjcSuperClass!(void, "unregisterClass:", Class)(protocolClass); } } diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSURLRequest.d --- a/dstep/foundation/NSURLRequest.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSURLRequest.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,17 +6,18 @@ */ module dstep.foundation.NSURLRequest; -import dstep.AvailabilityMacros; +import dstep.foundation.NSCoder; import dstep.foundation.NSData; import dstep.foundation.NSDate; import dstep.foundation.NSDictionary; -import dstep.foundation.NSInputStream; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; +import dstep.foundation.NSStream; import dstep.foundation.NSString; import dstep.foundation.NSURL; -import dstep.foundation.NSURLRequestInternal; +import dstep.foundation.NSZone; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; alias NSUInteger NSURLRequestCachePolicy; @@ -31,19 +32,99 @@ NSURLRequestReloadRevalidatingCacheData = 5 } +const TNSHTTPURLRequest = ` + + NSString HTTPMethod () + { + return invokeObjcSelf!(NSString, "HTTPMethod"); + } + + NSDictionary allHTTPHeaderFields () + { + return invokeObjcSelf!(NSDictionary, "allHTTPHeaderFields"); + } + + NSString valueForHTTPHeaderField (NSString field) + { + return invokeObjcSelf!(NSString, "valueForHTTPHeaderField:", NSString)(field); + } + + NSData HTTPBody () + { + return invokeObjcSelf!(NSData, "HTTPBody"); + } + + NSInputStream HTTPBodyStream () + { + return invokeObjcSelf!(NSInputStream, "HTTPBodyStream"); + } + + bool HTTPShouldHandleCookies () + { + return invokeObjcSelf!(bool, "HTTPShouldHandleCookies"); + } +`; + +const TNSMutableHTTPURLRequest = ` + + void setHTTPMethod (NSString method) + { + return invokeObjcSelf!(void, "setHTTPMethod:", NSString)(method); + } + + void setAllHTTPHeaderFields (NSDictionary headerFields) + { + return invokeObjcSelf!(void, "setAllHTTPHeaderFields:", NSDictionary)(headerFields); + } + + void setValue (NSString value, NSString field) + { + return invokeObjcSelf!(void, "setValue:forHTTPHeaderField:", NSString, NSString)(value, field); + } + + void addValue (NSString value, NSString field) + { + return invokeObjcSelf!(void, "addValue:forHTTPHeaderField:", NSString, NSString)(value, field); + } + + void setHTTPBody (NSData data) + { + return invokeObjcSelf!(void, "setHTTPBody:", NSData)(data); + } + + void setHTTPBodyStream (NSInputStream inputStream) + { + return invokeObjcSelf!(void, "setHTTPBodyStream:", NSInputStream)(inputStream); + } + + void setHTTPShouldHandleCookies (bool should) + { + return invokeObjcSelf!(void, "setHTTPShouldHandleCookies:", bool)(should); + } +`; + class NSURLRequest : NSObject, INSCoding, INSCopying, INSMutableCopying { - mixin ObjcWrap; - mixin TNSHTTPURLRequest; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static Object requestWithURL (NSURL URL) { - return invokeObjcSelfClass!(Object, "requestWithURL:", NSURL)(URL); + return invokeObjcSuperClass!(Object, "requestWithURL:", NSURL)(URL); } static Object requestWithURL (NSURL URL, uint cachePolicy, double timeoutInterval) { - return invokeObjcSelfClass!(Object, "requestWithURL:cachePolicy:timeoutInterval:", NSURL, uint, double)(URL, cachePolicy, timeoutInterval); + return invokeObjcSuperClass!(Object, "requestWithURL:cachePolicy:timeoutInterval:", NSURL, uint, double)(URL, cachePolicy, timeoutInterval); } Object initWithURL (NSURL URL) @@ -53,13 +134,7 @@ this (NSURL URL) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithURL:", NSURL)(objcObject, URL); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithURL(URL); } Object initWithURL (NSURL URL, uint cachePolicy, double timeoutInterval) @@ -69,13 +144,7 @@ this (NSURL URL, uint cachePolicy, double timeoutInterval) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithURL:cachePolicy:timeoutInterval:", NSURL, uint, double)(objcObject, URL, cachePolicy, timeoutInterval); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithURL(URL, cachePolicy, timeoutInterval); } NSURL URL () @@ -110,13 +179,7 @@ this (NSCoder aDecoder) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithCoder(aDecoder); } Object copyWithZone (NSZone* zone) @@ -128,12 +191,52 @@ { return invokeObjcSelf!(Object, "mutableCopyWithZone:", NSZone*)(zone); } + + // TNSHTTPURLRequest + NSString HTTPMethod () + { + return invokeObjcSelf!(NSString, "HTTPMethod"); + } + + NSDictionary allHTTPHeaderFields () + { + return invokeObjcSelf!(NSDictionary, "allHTTPHeaderFields"); + } + + NSString valueForHTTPHeaderField (NSString field) + { + return invokeObjcSelf!(NSString, "valueForHTTPHeaderField:", NSString)(field); + } + + NSData HTTPBody () + { + return invokeObjcSelf!(NSData, "HTTPBody"); + } + + NSInputStream HTTPBodyStream () + { + return invokeObjcSelf!(NSInputStream, "HTTPBodyStream"); + } + + bool HTTPShouldHandleCookies () + { + return invokeObjcSelf!(bool, "HTTPShouldHandleCookies"); + } } class NSMutableURLRequest : NSURLRequest { - mixin ObjcWrap; - mixin TNSMutableHTTPURLRequest; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } void setURL (NSURL URL) { @@ -154,76 +257,40 @@ { return invokeObjcSelf!(void, "setMainDocumentURL:", NSURL)(URL); } -} - -template TNSHTTPURLRequest () -{ - NSString HTTPMethod () - { - return invokeObjcSelf!(NSString, "HTTPMethod"); - } - - NSDictionary allHTTPHeaderFields () - { - return invokeObjcSelf!(NSDictionary, "allHTTPHeaderFields"); - } - - NSString valueForHTTPHeaderField (NSString field) - { - return invokeObjcSelf!(NSString, "valueForHTTPHeaderField:", NSString)(field); - } - - NSData HTTPBody () - { - return invokeObjcSelf!(NSData, "HTTPBody"); - } - - NSInputStream HTTPBodyStream () - { - return invokeObjcSelf!(NSInputStream, "HTTPBodyStream"); - } - - bool HTTPShouldHandleCookies () - { - return invokeObjcSelf!(bool, "HTTPShouldHandleCookies"); - } -} - -template TNSMutableHTTPURLRequest () -{ + + // TNSMutableHTTPURLRequest void setHTTPMethod (NSString method) { return invokeObjcSelf!(void, "setHTTPMethod:", NSString)(method); } - + void setAllHTTPHeaderFields (NSDictionary headerFields) { return invokeObjcSelf!(void, "setAllHTTPHeaderFields:", NSDictionary)(headerFields); } - + void setValue (NSString value, NSString field) { return invokeObjcSelf!(void, "setValue:forHTTPHeaderField:", NSString, NSString)(value, field); } - + void addValue (NSString value, NSString field) { return invokeObjcSelf!(void, "addValue:forHTTPHeaderField:", NSString, NSString)(value, field); } - + void setHTTPBody (NSData data) { return invokeObjcSelf!(void, "setHTTPBody:", NSData)(data); } - + void setHTTPBodyStream (NSInputStream inputStream) { return invokeObjcSelf!(void, "setHTTPBodyStream:", NSInputStream)(inputStream); } - + void setHTTPShouldHandleCookies (bool should) { return invokeObjcSelf!(void, "setHTTPShouldHandleCookies:", bool)(should); } -} - +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSURLResponse.d --- a/dstep/foundation/NSURLResponse.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSURLResponse.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,20 +6,30 @@ */ module dstep.foundation.NSURLResponse; -import dstep.AvailabilityMacros; +import dstep.foundation.NSCoder; import dstep.foundation.NSDictionary; -import dstep.foundation.NSHTTPURLResponseInternal; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; import dstep.foundation.NSString; import dstep.foundation.NSURL; import dstep.foundation.NSURLRequest; -import dstep.foundation.NSURLResponseInternal; +import dstep.foundation.NSZone; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; class NSHTTPURLResponse : NSURLResponse { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } NSInteger statusCode () { @@ -33,13 +43,23 @@ static NSString localizedStringForStatusCode (NSInteger statusCode) { - return invokeObjcSelfClass!(NSString, "localizedStringForStatusCode:", NSInteger)(statusCode); + return invokeObjcSuperClass!(NSString, "localizedStringForStatusCode:", NSInteger)(statusCode); } } class NSURLResponse : NSObject, INSCoding, INSCopying { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } Object initWithURL (NSURL URL, NSString MIMEType, NSInteger length, NSString name) { @@ -48,13 +68,7 @@ this (NSURL URL, NSString MIMEType, NSInteger length, NSString name) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithURL:MIMEType:expectedContentLength:textEncodingName:", NSURL, NSString, NSInteger, NSString)(objcObject, URL, MIMEType, length, name); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithURL(URL, MIMEType, length, name); } NSURL URL () @@ -94,13 +108,7 @@ this (NSCoder aDecoder) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithCoder(aDecoder); } Object copyWithZone (NSZone* zone) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSURL_bindings.d --- a/dstep/foundation/NSURL_bindings.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSURL_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -1,13 +1,8 @@ module dstep.foundation.NSURL_bindings; -import dstep.foundation.NSData; -import dstep.foundation.NSDictionary; -import dstep.foundation.NSNumber; -import dstep.foundation.NSObject; -import dstep.foundation.NSString; -import dstep.foundation.NSURLHandle; -import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + extern (C) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSUndoManager.d --- a/dstep/foundation/NSUndoManager.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSUndoManager.d Sun Jan 03 22:06:11 2010 +0100 @@ -7,41 +7,102 @@ module dstep.foundation.NSUndoManager; import dstep.foundation.NSArray; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + import bindings = dstep.foundation.NSUndoManager_bindings; -const NSString NSUndoManagerCheckpointNotification; -const NSString NSUndoManagerWillUndoChangeNotification; -const NSString NSUndoManagerWillRedoChangeNotification; -const NSString NSUndoManagerDidUndoChangeNotification; -const NSString NSUndoManagerDidRedoChangeNotification; -const NSString NSUndoManagerDidOpenUndoGroupNotification; -const NSString NSUndoManagerWillCloseUndoGroupNotification; +private +{ + NSString NSUndoManagerCheckpointNotification_; + NSString NSUndoManagerWillUndoChangeNotification_; + NSString NSUndoManagerWillRedoChangeNotification_; + NSString NSUndoManagerDidUndoChangeNotification_; + NSString NSUndoManagerDidRedoChangeNotification_; + NSString NSUndoManagerDidOpenUndoGroupNotification_; + NSString NSUndoManagerWillCloseUndoGroupNotification_; +} + +NSString NSUndoManagerCheckpointNotification () +{ + if (NSUndoManagerCheckpointNotification_) + return NSUndoManagerCheckpointNotification_; + + return NSUndoManagerCheckpointNotification_ = new NSString(bindings.NSUndoManagerCheckpointNotification); +} + +NSString NSUndoManagerWillUndoChangeNotification () +{ + if (NSUndoManagerWillUndoChangeNotification_) + return NSUndoManagerWillUndoChangeNotification_; + + return NSUndoManagerWillUndoChangeNotification_ = new NSString(bindings.NSUndoManagerWillUndoChangeNotification); +} + +NSString NSUndoManagerWillRedoChangeNotification () +{ + if (NSUndoManagerWillRedoChangeNotification_) + return NSUndoManagerWillRedoChangeNotification_; + + return NSUndoManagerWillRedoChangeNotification_ = new NSString(bindings.NSUndoManagerWillRedoChangeNotification); +} + +NSString NSUndoManagerDidUndoChangeNotification () +{ + if (NSUndoManagerDidUndoChangeNotification_) + return NSUndoManagerDidUndoChangeNotification_; + + return NSUndoManagerDidUndoChangeNotification_ = new NSString(bindings.NSUndoManagerDidUndoChangeNotification); +} + +NSString NSUndoManagerDidRedoChangeNotification () +{ + if (NSUndoManagerDidRedoChangeNotification_) + return NSUndoManagerDidRedoChangeNotification_; + + return NSUndoManagerDidRedoChangeNotification_ = new NSString(bindings.NSUndoManagerDidRedoChangeNotification); +} + +NSString NSUndoManagerDidOpenUndoGroupNotification () +{ + if (NSUndoManagerDidOpenUndoGroupNotification_) + return NSUndoManagerDidOpenUndoGroupNotification_; + + return NSUndoManagerDidOpenUndoGroupNotification_ = new NSString(bindings.NSUndoManagerDidOpenUndoGroupNotification); +} + +NSString NSUndoManagerWillCloseUndoGroupNotification () +{ + if (NSUndoManagerWillCloseUndoGroupNotification_) + return NSUndoManagerWillCloseUndoGroupNotification_; + + return NSUndoManagerWillCloseUndoGroupNotification_ = new NSString(bindings.NSUndoManagerWillCloseUndoGroupNotification); +} enum { NSUndoCloseGroupingRunLoopOrdering = 350000 } -static this () -{ - NSUndoManagerCheckpointNotification = new NSString(bindings.NSUndoManagerCheckpointNotification); - NSUndoManagerWillUndoChangeNotification = new NSString(bindings.NSUndoManagerWillUndoChangeNotification); - NSUndoManagerWillRedoChangeNotification = new NSString(bindings.NSUndoManagerWillRedoChangeNotification); - NSUndoManagerDidUndoChangeNotification = new NSString(bindings.NSUndoManagerDidUndoChangeNotification); - NSUndoManagerDidRedoChangeNotification = new NSString(bindings.NSUndoManagerDidRedoChangeNotification); - NSUndoManagerDidOpenUndoGroupNotification = new NSString(bindings.NSUndoManagerDidOpenUndoGroupNotification); - NSUndoManagerWillCloseUndoGroupNotification = new NSString(bindings.NSUndoManagerWillCloseUndoGroupNotification); -} - class NSUndoManager : NSObject { - mixin ObjcWrap; - + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } + void beginUndoGrouping () { return invokeObjcSelf!(void, "beginUndoGrouping"); diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSUndoManager_bindings.d --- a/dstep/foundation/NSUndoManager_bindings.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSUndoManager_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -4,7 +4,9 @@ import dstep.foundation.NSObject; import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + extern (C) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSUserDefaults.d --- a/dstep/foundation/NSUserDefaults.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSUserDefaults.d Sun Jan 03 22:06:11 2010 +0100 @@ -9,55 +9,78 @@ import dstep.foundation.NSArray; import dstep.foundation.NSData; import dstep.foundation.NSDictionary; -import dstep.foundation.NSMutableDictionary; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + import bindings = dstep.foundation.NSUserDefaults_bindings; -const NSString NSGlobalDomain; -const NSString NSArgumentDomain; -const NSString NSRegistrationDomain; -const NSString NSUserDefaultsDidChangeNotification; +private +{ + NSString NSGlobalDomain_; + NSString NSArgumentDomain_; + NSString NSRegistrationDomain_; + NSString NSUserDefaultsDidChangeNotification_; +} + +NSString NSGlobalDomain () +{ + if (NSGlobalDomain_) + return NSGlobalDomain_; + + return NSGlobalDomain_ = new NSString(bindings.NSGlobalDomain); +} -static this () +NSString NSArgumentDomain () +{ + if (NSArgumentDomain_) + return NSArgumentDomain_; + + return NSArgumentDomain_ = new NSString(bindings.NSArgumentDomain); +} + +NSString NSRegistrationDomain () { - NSGlobalDomain = new NSString(bindings.NSGlobalDomain); - NSArgumentDomain = new NSString(bindings.NSArgumentDomain); - NSRegistrationDomain = new NSString(bindings.NSRegistrationDomain); - NSUserDefaultsDidChangeNotification = new NSString(bindings.NSUserDefaultsDidChangeNotification); + if (NSRegistrationDomain_) + return NSRegistrationDomain_; + + return NSRegistrationDomain_ = new NSString(bindings.NSRegistrationDomain); +} + +NSString NSUserDefaultsDidChangeNotification () +{ + if (NSUserDefaultsDidChangeNotification_) + return NSUserDefaultsDidChangeNotification_; + + return NSUserDefaultsDidChangeNotification_ = new NSString(bindings.NSUserDefaultsDidChangeNotification); } class NSUserDefaults : NSObject { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } static NSUserDefaults standardUserDefaults () { - return invokeObjcSelfClass!(NSUserDefaults, "standardUserDefaults"); + return invokeObjcSuperClass!(NSUserDefaults, "standardUserDefaults"); } static void resetStandardUserDefaults () { - return invokeObjcSelfClass!(void, "resetStandardUserDefaults"); - } - - Object init () - { - return invokeObjcSelf!(Object, "init"); - } - - this () - { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "init")(objcObject); - - if (result) - objcObject = ret; - - dObject = this; + return invokeObjcSuperClass!(void, "resetStandardUserDefaults"); } Object initWithUser (NSString username) @@ -67,13 +90,7 @@ this (NSString username) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithUser:", NSString)(objcObject, username); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithUser(username); } Object objectForKey (NSString defaultName) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSUserDefaults_bindings.d --- a/dstep/foundation/NSUserDefaults_bindings.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSUserDefaults_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -1,13 +1,8 @@ module dstep.foundation.NSUserDefaults_bindings; -import dstep.foundation.NSArray; -import dstep.foundation.NSData; -import dstep.foundation.NSDictionary; -import dstep.foundation.NSMutableDictionary; -import dstep.foundation.NSObject; -import dstep.foundation.NSString; -import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + extern (C) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSValue.d --- a/dstep/foundation/NSValue.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSValue.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,17 +6,460 @@ */ module dstep.foundation.NSValue; +import dstep.foundation.NSCoder; +import dstep.foundation.NSDecimal; +import dstep.foundation.NSDecimalNumber; import dstep.foundation.NSDictionary; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; +import dstep.foundation.NSRange; import dstep.foundation.NSString; +import dstep.foundation.NSZone; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.applicationservices.coregraphics.CGGeometry; +import dstep.objc.objc; + +private +{ + alias CGPoint NSPoint; + alias NSPoint* NSPointPointer; + alias NSPoint* NSPointArray; + alias CGSize NSSize; + alias NSSize* NSSizePointer; + alias NSSize* NSSizeArray; + alias CGRect NSRect; + alias NSRect* NSRectPointer; + alias NSRect* NSRectArray; + alias NSUInteger NSRectEdge; +} + +const TNSNumberCreation = ` + + Object initWithChar (byte value) + { + return invokeObjcSelf!(Object, "initWithChar:", byte)(value); + } + + this (byte value) + { + typeof(this).alloc.initWithChar(value); + } + + Object initWithUnsignedChar (ubyte value) + { + return invokeObjcSelf!(Object, "initWithUnsignedChar:", ubyte)(value); + } + + this (ubyte value) + { + typeof(this).alloc.initWithUnsignedChar(value); + } + + Object initWithShort (short value) + { + return invokeObjcSelf!(Object, "initWithShort:", short)(value); + } + + this (short value) + { + typeof(this).alloc.initWithShort(value); + } + + Object initWithUnsignedShort (ushort value) + { + return invokeObjcSelf!(Object, "initWithUnsignedShort:", ushort)(value); + } + + this (ushort value) + { + typeof(this).alloc.initWithUnsignedShort(value); + } + + Object initWithInt (int value) + { + return invokeObjcSelf!(Object, "initWithInt:", int)(value); + } + + this (int value) + { + typeof(this).alloc.initWithInt(value); + } + + Object initWithUnsignedInt (uint value) + { + return invokeObjcSelf!(Object, "initWithUnsignedInt:", uint)(value); + } + + this (uint value) + { + typeof(this).alloc.initWithUnsignedInt(value); + } + + Object initWithLong (int value) + { + return invokeObjcSelf!(Object, "initWithLong:", int)(value); + } + + this (int value) + { + typeof(this).alloc.initWithLong(value); + } + + Object initWithUnsignedLong (uint value) + { + return invokeObjcSelf!(Object, "initWithUnsignedLong:", uint)(value); + } + + this (uint value) + { + typeof(this).alloc.initWithUnsignedLong(value); + } + + Object initWithLongLong (long value) + { + return invokeObjcSelf!(Object, "initWithLongLong:", long)(value); + } + + this (long value) + { + typeof(this).alloc.initWithLongLong(value); + } + + Object initWithUnsignedLongLong (ulong value) + { + return invokeObjcSelf!(Object, "initWithUnsignedLongLong:", ulong)(value); + } + + this (ulong value) + { + typeof(this).alloc.initWithUnsignedLongLong(value); + } + + Object initWithFloat (float value) + { + return invokeObjcSelf!(Object, "initWithFloat:", float)(value); + } + + this (float value) + { + typeof(this).alloc.initWithFloat(value); + } + + Object initWithDouble (double value) + { + return invokeObjcSelf!(Object, "initWithDouble:", double)(value); + } + + this (double value) + { + typeof(this).alloc.initWithDouble(value); + } + + Object initWithBool (bool value) + { + return invokeObjcSelf!(Object, "initWithBool:", bool)(value); + } + + this (bool value) + { + typeof(this).alloc.initWithBool(value); + } + + Object initWithInteger (NSInteger value) + { + return invokeObjcSelf!(Object, "initWithInteger:", NSInteger)(value); + } + + this (NSInteger value) + { + typeof(this).alloc.initWithInteger(value); + } + + Object initWithUnsignedInteger (NSUInteger value) + { + return invokeObjcSelf!(Object, "initWithUnsignedInteger:", NSUInteger)(value); + } + + this (NSUInteger value) + { + typeof(this).alloc.initWithUnsignedInteger(value); + } + + static NSNumber numberWithChar (byte value) + { + return invokeObjcSuperClass!(NSNumber, "numberWithChar:", byte)(value); + } + + static NSNumber numberWithUnsignedChar (ubyte value) + { + return invokeObjcSuperClass!(NSNumber, "numberWithUnsignedChar:", ubyte)(value); + } + + static NSNumber numberWithShort (short value) + { + return invokeObjcSuperClass!(NSNumber, "numberWithShort:", short)(value); + } + + static NSNumber numberWithUnsignedShort (ushort value) + { + return invokeObjcSuperClass!(NSNumber, "numberWithUnsignedShort:", ushort)(value); + } + + static NSNumber numberWithInt (int value) + { + return invokeObjcSuperClass!(NSNumber, "numberWithInt:", int)(value); + } + + static NSNumber numberWithUnsignedInt (uint value) + { + return invokeObjcSuperClass!(NSNumber, "numberWithUnsignedInt:", uint)(value); + } + + static NSNumber numberWithLong (int value) + { + return invokeObjcSuperClass!(NSNumber, "numberWithLong:", int)(value); + } + + static NSNumber numberWithUnsignedLong (uint value) + { + return invokeObjcSuperClass!(NSNumber, "numberWithUnsignedLong:", uint)(value); + } + + static NSNumber numberWithLongLong (long value) + { + return invokeObjcSuperClass!(NSNumber, "numberWithLongLong:", long)(value); + } + + static NSNumber numberWithUnsignedLongLong (ulong value) + { + return invokeObjcSuperClass!(NSNumber, "numberWithUnsignedLongLong:", ulong)(value); + } + + static NSNumber numberWithFloat (float value) + { + return invokeObjcSuperClass!(NSNumber, "numberWithFloat:", float)(value); + } + + static NSNumber numberWithDouble (double value) + { + return invokeObjcSuperClass!(NSNumber, "numberWithDouble:", double)(value); + } + + static NSNumber numberWithBool (bool value) + { + return invokeObjcSuperClass!(NSNumber, "numberWithBool:", bool)(value); + } + + static NSNumber numberWithInteger (NSInteger value) + { + return invokeObjcSuperClass!(NSNumber, "numberWithInteger:", NSInteger)(value); + } + + static NSNumber numberWithUnsignedInteger (NSUInteger value) + { + return invokeObjcSuperClass!(NSNumber, "numberWithUnsignedInteger:", NSUInteger)(value); + } +`; + +const TNSValueCreation = ` + + Object initWithBytes (void* value, char* type) + { + return invokeObjcSelf!(Object, "initWithBytes:objCType:", void*, char*)(value, type); + } + + this (void* value, char* type) + { + typeof(this).alloc.initWithBytes(value, type); + } + + static NSValue valueWithBytes (void* value, char* type) + { + return invokeObjcSuperClass!(NSValue, "valueWithBytes:objCType:", void*, char*)(value, type); + } + + static NSValue value (void* value, char* type) + { + return invokeObjcSuperClass!(NSValue, "value:withObjCType:", void*, char*)(value, type); + } +`; + +const TNSValueExtensionMethods = ` + + static NSValue valueWithNonretainedObject (Object anObject) + { + return invokeObjcSuperClass!(NSValue, "valueWithNonretainedObject:", Object)(anObject); + } + + Object nonretainedObjectValue () + { + return invokeObjcSelf!(Object, "nonretainedObjectValue"); + } + + static NSValue valueWithPointer (void* pointer) + { + return invokeObjcSuperClass!(NSValue, "valueWithPointer:", void*)(pointer); + } + + void* pointerValue () + { + return invokeObjcSelf!(void*, "pointerValue"); + } + + bool isEqualToValue (NSValue value) + { + return invokeObjcSelf!(bool, "isEqualToValue:", NSValue)(value); + } +`; + +class NSValue : NSObject, INSCopying, INSCoding +{ + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } + + void getValue (void* value) + { + return invokeObjcSelf!(void, "getValue:", void*)(value); + } + + char* objCType () + { + return invokeObjcSelf!(char*, "objCType"); + } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + Object initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); + } + + this (NSCoder aDecoder) + { + typeof(this).alloc.initWithCoder(aDecoder); + } + + // TNSValueGeometryExtensions + static NSValue valueWithPoint (dstep.applicationservices.coregraphics.CGGeometry.CGPoint point) + { + return invokeObjcSuperClass!(NSValue, "valueWithPoint:", NSPoint)(point); + } + + static NSValue valueWithSize (NSSize size) + { + return invokeObjcSuperClass!(NSValue, "valueWithSize:", NSSize)(size); + } + + static NSValue valueWithRect (NSRect rect) + { + return invokeObjcSuperClass!(NSValue, "valueWithRect:", NSRect)(rect); + } + + NSPoint pointValue () + { + return invokeObjcSelf!(NSPoint, "pointValue"); + } + + NSSize sizeValue () + { + return invokeObjcSelf!(NSSize, "sizeValue"); + } + + NSRect rectValue () + { + return invokeObjcSelf!(NSRect, "rectValue"); + } + + // TNSValueCreation + Object initWithBytes (void* value, char* type) + { + return invokeObjcSelf!(Object, "initWithBytes:objCType:", void*, char*)(value, type); + } + + this (void* value, char* type) + { + typeof(this).alloc.initWithBytes(value, type); + } + + static NSValue valueWithBytes (void* value, char* type) + { + return invokeObjcSuperClass!(NSValue, "valueWithBytes:objCType:", void*, char*)(value, type); + } + + static NSValue value (void* value, char* type) + { + return invokeObjcSuperClass!(NSValue, "value:withObjCType:", void*, char*)(value, type); + } + + // TNSValueRangeExtensions + static NSValue valueWithRange (NSRange range) + { + return invokeObjcSuperClass!(NSValue, "valueWithRange:", NSRange)(range); + } + + NSRange rangeValue () + { + return invokeObjcSelf!(NSRange, "rangeValue"); + } + + // TNSValueExtensionMethods + static NSValue valueWithNonretainedObject (Object anObject) + { + return invokeObjcSuperClass!(NSValue, "valueWithNonretainedObject:", Object)(anObject); + } + + Object nonretainedObjectValue () + { + return invokeObjcSelf!(Object, "nonretainedObjectValue"); + } + + static NSValue valueWithPointer (void* pointer) + { + return invokeObjcSuperClass!(NSValue, "valueWithPointer:", void*)(pointer); + } + + void* pointerValue () + { + return invokeObjcSelf!(void*, "pointerValue"); + } + + bool isEqualToValue (NSValue value) + { + return invokeObjcSelf!(bool, "isEqualToValue:", NSValue)(value); + } +} class NSNumber : NSValue { - mixin ObjcWrap; - mixin TNSDecimalNumberExtensions; - mixin TNSNumberCreation; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } byte charValue () { @@ -112,425 +555,216 @@ { return invokeObjcSelf!(NSString, "descriptionWithLocale:", Object)(locale); } -} - -class NSValue : NSObject, INSCopying, INSCoding -{ - mixin ObjcWrap; - mixin TNSValueGeometryExtensions; - mixin TNSValueCreation; - mixin TNSValueRangeExtensions; - mixin TNSValueExtensionMethods; - - void getValue (void* value) + + // TNSDecimalNumberExtensions + NSDecimal decimalValue () { - return invokeObjcSelf!(void, "getValue:", void*)(value); - } - - char* objCType () - { - return invokeObjcSelf!(char*, "objCType"); - } - - Object copyWithZone (NSZone* zone) - { - return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + return invokeObjcSelf!(NSDecimal, "decimalValue"); } - - void encodeWithCoder (NSCoder aCoder) - { - return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); - } - - Object initWithCoder (NSCoder aDecoder) - { - return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); - } - - this (NSCoder aDecoder) - { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); - - if (result) - objcObject = ret; - - dObject = this; - } -} - -template TNSNumberCreation () -{ + + // TNSNumberCreation Object initWithChar (byte value) { return invokeObjcSelf!(Object, "initWithChar:", byte)(value); } - + this (byte value) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithChar:", byte)(objcObject, value); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithChar(value); } - + Object initWithUnsignedChar (ubyte value) { return invokeObjcSelf!(Object, "initWithUnsignedChar:", ubyte)(value); } - + this (ubyte value) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithUnsignedChar:", ubyte)(objcObject, value); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithUnsignedChar(value); } - + Object initWithShort (short value) { return invokeObjcSelf!(Object, "initWithShort:", short)(value); } - + this (short value) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithShort:", short)(objcObject, value); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithShort(value); } - + Object initWithUnsignedShort (ushort value) { return invokeObjcSelf!(Object, "initWithUnsignedShort:", ushort)(value); } - + this (ushort value) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithUnsignedShort:", ushort)(objcObject, value); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithUnsignedShort(value); } - + Object initWithInt (int value) { return invokeObjcSelf!(Object, "initWithInt:", int)(value); } - + this (int value) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithInt:", int)(objcObject, value); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithInt(value); } - + Object initWithUnsignedInt (uint value) { return invokeObjcSelf!(Object, "initWithUnsignedInt:", uint)(value); } - + this (uint value) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithUnsignedInt:", uint)(objcObject, value); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithUnsignedInt(value); } - + Object initWithLong (int value) { return invokeObjcSelf!(Object, "initWithLong:", int)(value); } - - this (int value) - { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithLong:", int)(objcObject, value); - - if (result) - objcObject = ret; - - dObject = this; - } - + Object initWithUnsignedLong (uint value) { return invokeObjcSelf!(Object, "initWithUnsignedLong:", uint)(value); } - - this (uint value) - { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithUnsignedLong:", uint)(objcObject, value); - - if (result) - objcObject = ret; - - dObject = this; - } - + Object initWithLongLong (long value) { return invokeObjcSelf!(Object, "initWithLongLong:", long)(value); } - + this (long value) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithLongLong:", long)(objcObject, value); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithLongLong(value); } - + Object initWithUnsignedLongLong (ulong value) { return invokeObjcSelf!(Object, "initWithUnsignedLongLong:", ulong)(value); } - + this (ulong value) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithUnsignedLongLong:", ulong)(objcObject, value); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithUnsignedLongLong(value); } - + Object initWithFloat (float value) { return invokeObjcSelf!(Object, "initWithFloat:", float)(value); } - + this (float value) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithFloat:", float)(objcObject, value); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithFloat(value); } - + Object initWithDouble (double value) { return invokeObjcSelf!(Object, "initWithDouble:", double)(value); } - + this (double value) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithDouble:", double)(objcObject, value); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithDouble(value); } - + Object initWithBool (bool value) { return invokeObjcSelf!(Object, "initWithBool:", bool)(value); } - + this (bool value) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithBool:", bool)(objcObject, value); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithBool(value); } - + Object initWithInteger (NSInteger value) { return invokeObjcSelf!(Object, "initWithInteger:", NSInteger)(value); } - - this (NSInteger value) - { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithInteger:", NSInteger)(objcObject, value); - - if (result) - objcObject = ret; - - dObject = this; - } - + Object initWithUnsignedInteger (NSUInteger value) { return invokeObjcSelf!(Object, "initWithUnsignedInteger:", NSUInteger)(value); } - - this (NSUInteger value) - { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithUnsignedInteger:", NSUInteger)(objcObject, value); - - if (result) - objcObject = ret; - - dObject = this; - } - + static NSNumber numberWithChar (byte value) { - return invokeObjcSelfClass!(NSNumber, "numberWithChar:", byte)(value); + return invokeObjcSuperClass!(NSNumber, "numberWithChar:", byte)(value); } - + static NSNumber numberWithUnsignedChar (ubyte value) { - return invokeObjcSelfClass!(NSNumber, "numberWithUnsignedChar:", ubyte)(value); + return invokeObjcSuperClass!(NSNumber, "numberWithUnsignedChar:", ubyte)(value); } - + static NSNumber numberWithShort (short value) { - return invokeObjcSelfClass!(NSNumber, "numberWithShort:", short)(value); + return invokeObjcSuperClass!(NSNumber, "numberWithShort:", short)(value); } - + static NSNumber numberWithUnsignedShort (ushort value) { - return invokeObjcSelfClass!(NSNumber, "numberWithUnsignedShort:", ushort)(value); + return invokeObjcSuperClass!(NSNumber, "numberWithUnsignedShort:", ushort)(value); } - + static NSNumber numberWithInt (int value) { - return invokeObjcSelfClass!(NSNumber, "numberWithInt:", int)(value); + return invokeObjcSuperClass!(NSNumber, "numberWithInt:", int)(value); } - + static NSNumber numberWithUnsignedInt (uint value) { - return invokeObjcSelfClass!(NSNumber, "numberWithUnsignedInt:", uint)(value); + return invokeObjcSuperClass!(NSNumber, "numberWithUnsignedInt:", uint)(value); } - + static NSNumber numberWithLong (int value) { - return invokeObjcSelfClass!(NSNumber, "numberWithLong:", int)(value); + return invokeObjcSuperClass!(NSNumber, "numberWithLong:", int)(value); } - + static NSNumber numberWithUnsignedLong (uint value) { - return invokeObjcSelfClass!(NSNumber, "numberWithUnsignedLong:", uint)(value); + return invokeObjcSuperClass!(NSNumber, "numberWithUnsignedLong:", uint)(value); } - + static NSNumber numberWithLongLong (long value) { - return invokeObjcSelfClass!(NSNumber, "numberWithLongLong:", long)(value); + return invokeObjcSuperClass!(NSNumber, "numberWithLongLong:", long)(value); } - + static NSNumber numberWithUnsignedLongLong (ulong value) { - return invokeObjcSelfClass!(NSNumber, "numberWithUnsignedLongLong:", ulong)(value); + return invokeObjcSuperClass!(NSNumber, "numberWithUnsignedLongLong:", ulong)(value); } - + static NSNumber numberWithFloat (float value) { - return invokeObjcSelfClass!(NSNumber, "numberWithFloat:", float)(value); + return invokeObjcSuperClass!(NSNumber, "numberWithFloat:", float)(value); } - + static NSNumber numberWithDouble (double value) { - return invokeObjcSelfClass!(NSNumber, "numberWithDouble:", double)(value); + return invokeObjcSuperClass!(NSNumber, "numberWithDouble:", double)(value); } - + static NSNumber numberWithBool (bool value) { - return invokeObjcSelfClass!(NSNumber, "numberWithBool:", bool)(value); + return invokeObjcSuperClass!(NSNumber, "numberWithBool:", bool)(value); } - + static NSNumber numberWithInteger (NSInteger value) { - return invokeObjcSelfClass!(NSNumber, "numberWithInteger:", NSInteger)(value); + return invokeObjcSuperClass!(NSNumber, "numberWithInteger:", NSInteger)(value); } - + static NSNumber numberWithUnsignedInteger (NSUInteger value) { - return invokeObjcSelfClass!(NSNumber, "numberWithUnsignedInteger:", NSUInteger)(value); - } -} - -template TNSValueCreation () -{ - Object initWithBytes (void* value, char* type) - { - return invokeObjcSelf!(Object, "initWithBytes:objCType:", void*, char*)(value, type); - } - - this (void* value, char* type) - { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithBytes:objCType:", void*, char*)(objcObject, value, type); - - if (result) - objcObject = ret; - - dObject = this; - } - - static NSValue valueWithBytes (void* value, char* type) - { - return invokeObjcSelfClass!(NSValue, "valueWithBytes:objCType:", void*, char*)(value, type); - } - - static NSValue value (void* value, char* type) - { - return invokeObjcSelfClass!(NSValue, "value:withObjCType:", void*, char*)(value, type); + return invokeObjcSuperClass!(NSNumber, "numberWithUnsignedInteger:", NSUInteger)(value); } -} - -template TNSValueExtensionMethods () -{ - static NSValue valueWithNonretainedObject (Object anObject) - { - return invokeObjcSelfClass!(NSValue, "valueWithNonretainedObject:", Object)(anObject); - } - - Object nonretainedObjectValue () - { - return invokeObjcSelf!(Object, "nonretainedObjectValue"); - } - - static NSValue valueWithPointer (void* pointer) - { - return invokeObjcSelfClass!(NSValue, "valueWithPointer:", void*)(pointer); - } - - void* pointerValue () - { - return invokeObjcSelf!(void*, "pointerValue"); - } - - bool isEqualToValue (NSValue value) - { - return invokeObjcSelf!(bool, "isEqualToValue:", NSValue)(value); - } -} - +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSValueTransformer.d --- a/dstep/foundation/NSValueTransformer.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSValueTransformer.d Sun Jan 03 22:06:11 2010 +0100 @@ -10,52 +10,98 @@ import dstep.foundation.NSObject; import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + import bindings = dstep.foundation.NSValueTransformer_bindings; -const NSString NSNegateBooleanTransformerName; -const NSString NSIsNilTransformerName; -const NSString NSIsNotNilTransformerName; -const NSString NSUnarchiveFromDataTransformerName; -const NSString NSKeyedUnarchiveFromDataTransformerName; +private +{ + NSString NSNegateBooleanTransformerName_; + NSString NSIsNilTransformerName_; + NSString NSIsNotNilTransformerName_; + NSString NSUnarchiveFromDataTransformerName_; + NSString NSKeyedUnarchiveFromDataTransformerName_; +} + +NSString NSNegateBooleanTransformerName () +{ + if (NSNegateBooleanTransformerName_) + return NSNegateBooleanTransformerName_; + + return NSNegateBooleanTransformerName_ = new NSString(bindings.NSNegateBooleanTransformerName); +} -static this () +NSString NSIsNilTransformerName () +{ + if (NSIsNilTransformerName_) + return NSIsNilTransformerName_; + + return NSIsNilTransformerName_ = new NSString(bindings.NSIsNilTransformerName); +} + +NSString NSIsNotNilTransformerName () { - NSNegateBooleanTransformerName = new NSString(bindings.NSNegateBooleanTransformerName); - NSIsNilTransformerName = new NSString(bindings.NSIsNilTransformerName); - NSIsNotNilTransformerName = new NSString(bindings.NSIsNotNilTransformerName); - NSUnarchiveFromDataTransformerName = new NSString(bindings.NSUnarchiveFromDataTransformerName); - NSKeyedUnarchiveFromDataTransformerName = new NSString(bindings.NSKeyedUnarchiveFromDataTransformerName); + if (NSIsNotNilTransformerName_) + return NSIsNotNilTransformerName_; + + return NSIsNotNilTransformerName_ = new NSString(bindings.NSIsNotNilTransformerName); +} + +NSString NSUnarchiveFromDataTransformerName () +{ + if (NSUnarchiveFromDataTransformerName_) + return NSUnarchiveFromDataTransformerName_; + + return NSUnarchiveFromDataTransformerName_ = new NSString(bindings.NSUnarchiveFromDataTransformerName); +} + +NSString NSKeyedUnarchiveFromDataTransformerName () +{ + if (NSKeyedUnarchiveFromDataTransformerName_) + return NSKeyedUnarchiveFromDataTransformerName_; + + return NSKeyedUnarchiveFromDataTransformerName_ = new NSString(bindings.NSKeyedUnarchiveFromDataTransformerName); } class NSValueTransformer : NSObject { - mixin ObjcWrap; - + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } + static void setValueTransformer (NSValueTransformer transformer, NSString name) { - return invokeObjcSelfClass!(void, "setValueTransformer:forName:", NSValueTransformer, NSString)(transformer, name); + return invokeObjcSuperClass!(void, "setValueTransformer:forName:", NSValueTransformer, NSString)(transformer, name); } static NSValueTransformer valueTransformerForName (NSString name) { - return invokeObjcSelfClass!(NSValueTransformer, "valueTransformerForName:", NSString)(name); + return invokeObjcSuperClass!(NSValueTransformer, "valueTransformerForName:", NSString)(name); } static NSArray valueTransformerNames () { - return invokeObjcSelfClass!(NSArray, "valueTransformerNames"); + return invokeObjcSuperClass!(NSArray, "valueTransformerNames"); } static Class transformedValueClass () { - return invokeObjcSelfClass!(Class, "transformedValueClass"); + return invokeObjcSuperClass!(Class, "transformedValueClass"); } static bool allowsReverseTransformation () { - return invokeObjcSelfClass!(bool, "allowsReverseTransformation"); + return invokeObjcSuperClass!(bool, "allowsReverseTransformation"); } Object transformedValue (Object value) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSValueTransformer_bindings.d --- a/dstep/foundation/NSValueTransformer_bindings.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSValueTransformer_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -4,7 +4,9 @@ import dstep.foundation.NSObject; import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + extern (C) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSXMLDTD.d --- a/dstep/foundation/NSXMLDTD.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSXMLDTD.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,47 +6,62 @@ */ module dstep.foundation.NSXMLDTD; +import dstep.foundation.NSArray; import dstep.foundation.NSData; -import dstep.foundation.NSMutableDictionary; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSError; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSString; +import dstep.foundation.NSURL; import dstep.foundation.NSXMLDTDNode; import dstep.foundation.NSXMLNode; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; class NSXMLDTD : NSXMLNode { - mixin ObjcWrap; - - Object initWithContentsOfURL (NSURL url, NSUInteger mask, NSError** error) + mixin (ObjcWrap); + + this () { - return invokeObjcSelf!(Object, "initWithContentsOfURL:options:error:", NSURL, NSUInteger, NSError**)(url, mask, error); + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); } - this (NSURL url, NSUInteger mask, NSError** error) + Object initWithContentsOfURL (NSURL url, NSUInteger mask, ref NSError error) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithContentsOfURL:options:error:", NSURL, NSUInteger, NSError**)(objcObject, url, mask, error); - - if (result) - objcObject = ret; - - dObject = this; + id err = error ? new objc_object : null; + Object result = invokeObjcSelf!(Object, "initWithContentsOfURL:options:error:", NSURL, NSUInteger, id*)(url, mask, &err); + + if (err) + error = new NSError(err); + + return result; } - Object initWithData (NSData data, NSUInteger mask, NSError** error) + this (NSURL url, NSUInteger mask, ref NSError error) { - return invokeObjcSelf!(Object, "initWithData:options:error:", NSData, NSUInteger, NSError**)(data, mask, error); + typeof(this).alloc.initWithContentsOfURL(url, mask, error); } - this (NSData data, NSUInteger mask, NSError** error) + Object initWithData (NSData data, NSUInteger mask, ref NSError error) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithData:options:error:", NSData, NSUInteger, NSError**)(objcObject, data, mask, error); + id err = error ? new objc_object : null; + Object result = invokeObjcSelf!(Object, "initWithData:options:error:", NSData, NSUInteger, id*)(data, mask, &err); + + if (err) + error = new NSError(err); + + return result; + } - if (result) - objcObject = ret; - - dObject = this; + this (NSData data, NSUInteger mask, ref NSError error) + { + typeof(this).alloc.initWithData(data, mask, error); } void setPublicID (NSString publicID) @@ -121,7 +136,7 @@ static NSXMLDTDNode predefinedEntityDeclarationForName (NSString name) { - return invokeObjcSelfClass!(NSXMLDTDNode, "predefinedEntityDeclarationForName:", NSString)(name); + return invokeObjcSuperClass!(NSXMLDTDNode, "predefinedEntityDeclarationForName:", NSString)(name); } } diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSXMLDTDNode.d --- a/dstep/foundation/NSXMLDTDNode.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSXMLDTDNode.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,9 +6,11 @@ */ module dstep.foundation.NSXMLDTDNode; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSString; import dstep.foundation.NSXMLNode; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; alias NSUInteger NSXMLDTDNodeKind; @@ -38,7 +40,17 @@ class NSXMLDTDNode : NSXMLNode { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } Object initWithXMLString (NSString string) { @@ -47,13 +59,7 @@ this (NSString string) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithXMLString:", NSString)(objcObject, string); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithXMLString(string); } void setDTDKind (uint kind) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSXMLDocument.d --- a/dstep/foundation/NSXMLDocument.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSXMLDocument.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,11 +6,18 @@ */ module dstep.foundation.NSXMLDocument; +import dstep.foundation.NSArray; import dstep.foundation.NSData; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSError; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSString; +import dstep.foundation.NSURL; import dstep.foundation.NSXMLDTD; +import dstep.foundation.NSXMLElement; import dstep.foundation.NSXMLNode; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; alias NSUInteger NSXMLDocumentContentKind; @@ -24,54 +31,76 @@ class NSXMLDocument : NSXMLNode { - mixin ObjcWrap; - - Object initWithXMLString (NSString string, NSUInteger mask, NSError** error) + mixin (ObjcWrap); + + this () { - return invokeObjcSelf!(Object, "initWithXMLString:options:error:", NSString, NSUInteger, NSError**)(string, mask, error); + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); } - this (NSString string, NSUInteger mask, NSError** error) + Object initWithXMLString (NSString string, NSUInteger mask, ref NSError error) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithXMLString:options:error:", NSString, NSUInteger, NSError**)(objcObject, string, mask, error); - - if (result) - objcObject = ret; - - dObject = this; + id err; + + if (error) + err = new objc_object; + + Object result = invokeObjcSelf!(Object, "initWithXMLString:options:error:", NSString, NSUInteger, id*)(string, mask, &err); + + if (err) + error = new NSError(err); + + return result; } - Object initWithContentsOfURL (NSURL url, NSUInteger mask, NSError** error) + this (NSString string, NSUInteger mask, ref NSError error) { - return invokeObjcSelf!(Object, "initWithContentsOfURL:options:error:", NSURL, NSUInteger, NSError**)(url, mask, error); + typeof(this).alloc.initWithXMLString(string, mask, error); } - this (NSURL url, NSUInteger mask, NSError** error) + Object initWithContentsOfURL (NSURL url, NSUInteger mask, ref NSError error) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithContentsOfURL:options:error:", NSURL, NSUInteger, NSError**)(objcObject, url, mask, error); - - if (result) - objcObject = ret; - - dObject = this; + id err; + + if (error) + err = new objc_object; + + Object result = invokeObjcSelf!(Object, "initWithContentsOfURL:options:error:", NSURL, NSUInteger, id*)(url, mask, &err); + + if (err) + error = new NSError(err); + + return result; } - Object initWithData (NSData data, NSUInteger mask, NSError** error) + this (NSURL url, NSUInteger mask, ref NSError error) { - return invokeObjcSelf!(Object, "initWithData:options:error:", NSData, NSUInteger, NSError**)(data, mask, error); + typeof(this).alloc.initWithContentsOfURL(url, mask, error); } - this (NSData data, NSUInteger mask, NSError** error) + Object initWithData (NSData data, NSUInteger mask, ref NSError error) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithData:options:error:", NSData, NSUInteger, NSError**)(objcObject, data, mask, error); + id err; + + if (error) + err = new objc_object; + + Object result = invokeObjcSelf!(Object, "initWithData:options:error:", NSData, NSUInteger, id*)(data, mask, &err); + + if (err) + error = new NSError(err); + + return result; + } - if (result) - objcObject = ret; - - dObject = this; + this (NSData data, NSUInteger mask, ref NSError error) + { + typeof(this).alloc.initWithData(data, mask, error); } Object initWithRootElement (NSXMLElement element) @@ -81,18 +110,12 @@ this (NSXMLElement element) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithRootElement:", NSXMLElement)(objcObject, element); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithRootElement(element); } static Class replacementClassForClass (Class cls) { - return invokeObjcSelfClass!(Class, "replacementClassForClass:", Class)(cls); + return invokeObjcSuperClass!(Class, "replacementClassForClass:", Class)(cls); } void setCharacterEncoding (NSString encoding) @@ -205,24 +228,64 @@ return invokeObjcSelf!(NSData, "XMLDataWithOptions:", NSUInteger)(options); } - Object objectByApplyingXSLT (NSData xslt, NSDictionary arguments, NSError** error) + Object objectByApplyingXSLT (NSData xslt, NSDictionary arguments, ref NSError error) { - return invokeObjcSelf!(Object, "objectByApplyingXSLT:arguments:error:", NSData, NSDictionary, NSError**)(xslt, arguments, error); + id err; + + if (error) + err = new objc_object; + + Object result = invokeObjcSelf!(Object, "objectByApplyingXSLT:arguments:error:", NSData, NSDictionary, id*)(xslt, arguments, &err); + + if (err) + error = new NSError(err); + + return result; } - Object objectByApplyingXSLTString (NSString xslt, NSDictionary arguments, NSError** error) + Object objectByApplyingXSLTString (NSString xslt, NSDictionary arguments, ref NSError error) { - return invokeObjcSelf!(Object, "objectByApplyingXSLTString:arguments:error:", NSString, NSDictionary, NSError**)(xslt, arguments, error); + id err; + + if (error) + err = new objc_object; + + Object result = invokeObjcSelf!(Object, "objectByApplyingXSLTString:arguments:error:", NSString, NSDictionary, id*)(xslt, arguments, &err); + + if (err) + error = new NSError(err); + + return result; } - Object objectByApplyingXSLTAtURL (NSURL xsltURL, NSDictionary argument, NSError** error) + Object objectByApplyingXSLTAtURL (NSURL xsltURL, NSDictionary argument, ref NSError error) { - return invokeObjcSelf!(Object, "objectByApplyingXSLTAtURL:arguments:error:", NSURL, NSDictionary, NSError**)(xsltURL, argument, error); + id err; + + if (error) + err = new objc_object; + + Object result = invokeObjcSelf!(Object, "objectByApplyingXSLTAtURL:arguments:error:", NSURL, NSDictionary, id*)(xsltURL, argument, &err); + + if (err) + error = new NSError(err); + + return result; } - bool validateAndReturnError (NSError** error) + bool validateAndReturnError (ref NSError error) { - return invokeObjcSelf!(bool, "validateAndReturnError:", NSError**)(error); + id err; + + if (error) + err = new objc_object; + + bool result = invokeObjcSelf!(bool, "validateAndReturnError:", id*)(&err); + + if (err) + error = new NSError(err); + + return result; } } diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSXMLElement.d --- a/dstep/foundation/NSXMLElement.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSXMLElement.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,16 +6,29 @@ */ module dstep.foundation.NSXMLElement; +import dstep.foundation.NSArray; import dstep.foundation.NSDictionary; +import dstep.foundation.NSError; import dstep.foundation.NSEnumerator; -import dstep.foundation.NSMutableArray; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSString; import dstep.foundation.NSXMLNode; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; class NSXMLElement : NSXMLNode { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } Object initWithName (NSString name) { @@ -24,31 +37,14 @@ this (NSString name) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithName:", NSString)(objcObject, name); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithName(name); } - Object initWithName (NSString name, NSString URI) + Object initWithName_URL (NSString name, NSString URI) { return invokeObjcSelf!(Object, "initWithName:URI:", NSString, NSString)(name, URI); } - this (NSString name, NSString URI) - { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithName:URI:", NSString, NSString)(objcObject, name, URI); - - if (result) - objcObject = ret; - - dObject = this; - } - Object initWithName (NSString name, NSString string) { return invokeObjcSelf!(Object, "initWithName:stringValue:", NSString, NSString)(name, string); @@ -56,29 +52,23 @@ this (NSString name, NSString string) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithName:stringValue:", NSString, NSString)(objcObject, name, string); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithName(name, string); } - Object initWithXMLString (NSString string, NSError** error) + Object initWithXMLString (NSString string, ref NSError error) { - return invokeObjcSelf!(Object, "initWithXMLString:error:", NSString, NSError**)(string, error); + id err = error ? new objc_object : null; + Object result = invokeObjcSelf!(Object, "initWithXMLString:error:", NSString, id*)(string, &err); + + if (err) + error = new NSError(err); + + return result; } - this (NSString string, NSError** error) + this (NSString string, ref NSError error) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithXMLString:error:", NSString, NSError**)(objcObject, string, error); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithXMLString(string, error); } NSArray elementsForName (NSString name) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSXMLNode.d --- a/dstep/foundation/NSXMLNode.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSXMLNode.d Sun Jan 03 22:06:11 2010 +0100 @@ -9,14 +9,16 @@ import dstep.foundation.NSArray; import dstep.foundation.NSDictionary; import dstep.foundation.NSError; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; import dstep.foundation.NSString; import dstep.foundation.NSURL; import dstep.foundation.NSXMLDocument; import dstep.foundation.NSXMLElement; import dstep.foundation.NSXMLNodeOptions; +import dstep.foundation.NSZone; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; alias NSUInteger NSXMLNodeKind; @@ -39,7 +41,17 @@ class NSXMLNode : NSObject, INSCopying { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } Object initWithKind (uint kind) { @@ -48,13 +60,7 @@ this (uint kind) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithKind:", uint)(objcObject, kind); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithKind(kind); } Object initWithKind (uint kind, NSUInteger options) @@ -64,78 +70,72 @@ this (uint kind, NSUInteger options) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithKind:options:", uint, NSUInteger)(objcObject, kind, options); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithKind(kind, options); } static Object document () { - return invokeObjcSelfClass!(Object, "document"); + return invokeObjcSuperClass!(Object, "document"); } static Object documentWithRootElement (NSXMLElement element) { - return invokeObjcSelfClass!(Object, "documentWithRootElement:", NSXMLElement)(element); + return invokeObjcSuperClass!(Object, "documentWithRootElement:", NSXMLElement)(element); } static Object elementWithName (NSString name) { - return invokeObjcSelfClass!(Object, "elementWithName:", NSString)(name); + return invokeObjcSuperClass!(Object, "elementWithName:", NSString)(name); } - static Object elementWithName (NSString name, NSString URI) + static Object elementWithName_URI (NSString name, NSString URI) { - return invokeObjcSelfClass!(Object, "elementWithName:URI:", NSString, NSString)(name, URI); + return invokeObjcSuperClass!(Object, "elementWithName:URI:", NSString, NSString)(name, URI); } static Object elementWithName (NSString name, NSString string) { - return invokeObjcSelfClass!(Object, "elementWithName:stringValue:", NSString, NSString)(name, string); + return invokeObjcSuperClass!(Object, "elementWithName:stringValue:", NSString, NSString)(name, string); } static Object elementWithName (NSString name, NSArray children, NSArray attributes) { - return invokeObjcSelfClass!(Object, "elementWithName:children:attributes:", NSString, NSArray, NSArray)(name, children, attributes); + return invokeObjcSuperClass!(Object, "elementWithName:children:attributes:", NSString, NSArray, NSArray)(name, children, attributes); } static Object attributeWithName (NSString name, NSString stringValue) { - return invokeObjcSelfClass!(Object, "attributeWithName:stringValue:", NSString, NSString)(name, stringValue); + return invokeObjcSuperClass!(Object, "attributeWithName:stringValue:", NSString, NSString)(name, stringValue); } static Object attributeWithName (NSString name, NSString URI, NSString stringValue) { - return invokeObjcSelfClass!(Object, "attributeWithName:URI:stringValue:", NSString, NSString, NSString)(name, URI, stringValue); + return invokeObjcSuperClass!(Object, "attributeWithName:URI:stringValue:", NSString, NSString, NSString)(name, URI, stringValue); } static Object namespaceWithName (NSString name, NSString stringValue) { - return invokeObjcSelfClass!(Object, "namespaceWithName:stringValue:", NSString, NSString)(name, stringValue); + return invokeObjcSuperClass!(Object, "namespaceWithName:stringValue:", NSString, NSString)(name, stringValue); } static Object processingInstructionWithName (NSString name, NSString stringValue) { - return invokeObjcSelfClass!(Object, "processingInstructionWithName:stringValue:", NSString, NSString)(name, stringValue); + return invokeObjcSuperClass!(Object, "processingInstructionWithName:stringValue:", NSString, NSString)(name, stringValue); } static Object commentWithStringValue (NSString stringValue) { - return invokeObjcSelfClass!(Object, "commentWithStringValue:", NSString)(stringValue); + return invokeObjcSuperClass!(Object, "commentWithStringValue:", NSString)(stringValue); } static Object textWithStringValue (NSString stringValue) { - return invokeObjcSelfClass!(Object, "textWithStringValue:", NSString)(stringValue); + return invokeObjcSuperClass!(Object, "textWithStringValue:", NSString)(stringValue); } static Object DTDNodeWithXMLString (NSString string) { - return invokeObjcSelfClass!(Object, "DTDNodeWithXMLString:", NSString)(string); + return invokeObjcSuperClass!(Object, "DTDNodeWithXMLString:", NSString)(string); } uint kind () @@ -271,17 +271,17 @@ static NSString localNameForName (NSString name) { - return invokeObjcSelfClass!(NSString, "localNameForName:", NSString)(name); + return invokeObjcSuperClass!(NSString, "localNameForName:", NSString)(name); } static NSString prefixForName (NSString name) { - return invokeObjcSelfClass!(NSString, "prefixForName:", NSString)(name); + return invokeObjcSuperClass!(NSString, "prefixForName:", NSString)(name); } static NSXMLNode predefinedNamespaceForPrefix (NSString name) { - return invokeObjcSelfClass!(NSXMLNode, "predefinedNamespaceForPrefix:", NSString)(name); + return invokeObjcSuperClass!(NSXMLNode, "predefinedNamespaceForPrefix:", NSString)(name); } NSString description () @@ -304,19 +304,37 @@ return invokeObjcSelf!(NSString, "canonicalXMLStringPreservingComments:", bool)(comments); } - NSArray nodesForXPath (NSString xpath, NSError** error) + NSArray nodesForXPath (NSString xpath, ref NSError error) { - return invokeObjcSelf!(NSArray, "nodesForXPath:error:", NSString, NSError**)(xpath, error); + id err = error ? new objc_object : null; + NSArray result = invokeObjcSelf!(NSArray, "nodesForXPath:error:", NSString, id*)(xpath, &err); + + if (err) + error = new NSError(err); + + return result; } - NSArray objectsForXQuery (NSString xquery, NSDictionary constants, NSError** error) + NSArray objectsForXQuery (NSString xquery, NSDictionary constants, ref NSError error) { - return invokeObjcSelf!(NSArray, "objectsForXQuery:constants:error:", NSString, NSDictionary, NSError**)(xquery, constants, error); + id err = error ? new objc_object : null; + NSArray result = invokeObjcSelf!(NSArray, "objectsForXQuery:constants:error:", NSString, NSDictionary, id*)(xquery, constants, &err); + + if (err) + error = new NSError(err); + + return result; } - NSArray objectsForXQuery (NSString xquery, NSError** error) + NSArray objectsForXQuery (NSString xquery, ref NSError error) { - return invokeObjcSelf!(NSArray, "objectsForXQuery:error:", NSString, NSError**)(xquery, error); + id err = error ? new objc_object : null; + NSArray result = invokeObjcSelf!(NSArray, "objectsForXQuery:error:", NSString, id*)(xquery, &err); + + if (err) + error = new NSError(err); + + return result; } Object copyWithZone (NSZone* zone) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSXMLNodeOptions.d --- a/dstep/foundation/NSXMLNodeOptions.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSXMLNodeOptions.d Sun Jan 03 22:06:11 2010 +0100 @@ -8,7 +8,7 @@ import dstep.foundation.NSObjCRuntime; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; enum { diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSXMLParser.d --- a/dstep/foundation/NSXMLParser.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSXMLParser.d Sun Jan 03 22:06:11 2010 +0100 @@ -9,17 +9,28 @@ import dstep.foundation.NSData; import dstep.foundation.NSDictionary; import dstep.foundation.NSError; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; import dstep.foundation.NSString; import dstep.foundation.NSURL; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + import bindings = dstep.foundation.NSXMLParser_bindings; alias NSInteger NSXMLParserError; -const NSString NSXMLParserErrorDomain; +private NSString NSXMLParserErrorDomain_; + +NSString NSXMLParserErrorDomain () +{ + if (NSXMLParserErrorDomain_) + return NSXMLParserErrorDomain_; + + return NSXMLParserErrorDomain_ = new NSString(bindings.NSXMLParserErrorDomain); +} enum { @@ -118,15 +129,166 @@ NSXMLParserDelegateAbortedParseError = 512 } -static this () -{ - NSXMLParserErrorDomain = new NSString(bindings.NSXMLParserErrorDomain); -} +const TNSXMLParserDelegateEventAdditions = ` + + void parserDidStartDocument (NSXMLParser parser) + { + return invokeObjcSelf!(void, "parserDidStartDocument:", NSXMLParser)(parser); + } + + void parserDidEndDocument (NSXMLParser parser) + { + return invokeObjcSelf!(void, "parserDidEndDocument:", NSXMLParser)(parser); + } + + void parser (NSXMLParser parser, NSString name, NSString publicID, NSString systemID) + { + return invokeObjcSelf!(void, "parser:foundNotationDeclarationWithName:publicID:systemID:", NSXMLParser, NSString, NSString, NSString)(parser, name, publicID, systemID); + } + + void parser (NSXMLParser parser, NSString name, NSString publicID, NSString systemID, NSString notationName) + { + return invokeObjcSelf!(void, "parser:foundUnparsedEntityDeclarationWithName:publicID:systemID:notationName:", NSXMLParser, NSString, NSString, NSString, NSString)(parser, name, publicID, systemID, notationName); + } + + void parser_foundAttributeDeclarationWithName_forElement_type_defaultValue (NSXMLParser parser, NSString attributeName, NSString elementName, NSString type, NSString defaultValue) + { + return invokeObjcSelf!(void, "parser:foundAttributeDeclarationWithName:forElement:type:defaultValue:", NSXMLParser, NSString, NSString, NSString, NSString)(parser, attributeName, elementName, type, defaultValue); + } + + void parser (NSXMLParser parser, NSString elementName, NSString model) + { + return invokeObjcSelf!(void, "parser:foundElementDeclarationWithName:model:", NSXMLParser, NSString, NSString)(parser, elementName, model); + } + + void parser_foundInternalEntityDeclarationWithName_value (NSXMLParser parser, NSString name, NSString value) + { + return invokeObjcSelf!(void, "parser:foundInternalEntityDeclarationWithName:value:", NSXMLParser, NSString, NSString)(parser, name, value); + } + + void parser_foundExternalEntityDeclarationWithName_publicID_systemID (NSXMLParser parser, NSString name, NSString publicID, NSString systemID) + { + return invokeObjcSelf!(void, "parser:foundExternalEntityDeclarationWithName:publicID:systemID:", NSXMLParser, NSString, NSString, NSString)(parser, name, publicID, systemID); + } + + void parser (NSXMLParser parser, NSString elementName, NSString namespaceURI, NSString qName, NSDictionary attributeDict) + { + return invokeObjcSelf!(void, "parser:didStartElement:namespaceURI:qualifiedName:attributes:", NSXMLParser, NSString, NSString, NSString, NSDictionary)(parser, elementName, namespaceURI, qName, attributeDict); + } + + void parser_didEndElement_namespaceURI_qualifiedName (NSXMLParser parser, NSString elementName, NSString namespaceURI, NSString qName) + { + return invokeObjcSelf!(void, "parser:didEndElement:namespaceURI:qualifiedName:", NSXMLParser, NSString, NSString, NSString)(parser, elementName, namespaceURI, qName); + } + + void parser_didStartMappingPrefix_toURI (NSXMLParser parser, NSString prefix, NSString namespaceURI) + { + return invokeObjcSelf!(void, "parser:didStartMappingPrefix:toURI:", NSXMLParser, NSString, NSString)(parser, prefix, namespaceURI); + } + + void parser (NSXMLParser parser, NSString prefix) + { + return invokeObjcSelf!(void, "parser:didEndMappingPrefix:", NSXMLParser, NSString)(parser, prefix); + } + + void parser (NSXMLParser parser, NSString string) + { + return invokeObjcSelf!(void, "parser:foundCharacters:", NSXMLParser, NSString)(parser, string); + } + + void parser (NSXMLParser parser, NSString whitespaceString) + { + return invokeObjcSelf!(void, "parser:foundIgnorableWhitespace:", NSXMLParser, NSString)(parser, whitespaceString); + } + + void parser_foundProcessingInstructionWithTarget_data (NSXMLParser parser, NSString target, NSString data) + { + return invokeObjcSelf!(void, "parser:foundProcessingInstructionWithTarget:data", NSXMLParser, NSString, NSString)(parser, target, data); + } + + void parser (NSXMLParser parser, NSString comment) + { + return invokeObjcSelf!(void, "parser:foundComment:", NSXMLParser, NSString)(parser, comment); + } + + void parser (NSXMLParser parser, NSData CDATABlock) + { + return invokeObjcSelf!(void, "parser:foundCDATA:", NSXMLParser, NSData)(parser, CDATABlock); + } + + NSData parser_resolveExternalEntityName_systemID (NSXMLParser parser, NSString name, NSString systemID) + { + return invokeObjcSelf!(NSData, "parser:resolveExternalEntityName:systemID:", NSXMLParser, NSString, NSString)(parser, name, systemID); + } + + void parser (NSXMLParser parser, NSError parseError) + { + return invokeObjcSelf!(void, "parser:parseErrorOccurred:", NSXMLParser, NSError)(parser, parseError); + } + + void parser_validationErrorOccurred (NSXMLParser parser, NSError validationError) + { + return invokeObjcSelf!(void, "parser:validationErrorOccurred:", NSXMLParser, NSError)(parser, validationError); + } + + //mixin ObjcBindMethod!(parserDidStartDocument, "parserDidStartDocument:"); + //mixin ObjcBindMethod!(parserDidEndDocument, "parserDidEndDocument:"); + //mixin ObjcBindMethod!(parser, "parser:foundNotationDeclarationWithName:publicID:systemID:"); + //mixin ObjcBindMethod!(parser, "parser:foundUnparsedEntityDeclarationWithName:publicID:systemID:notationName:"); + //mixin ObjcBindMethod!(parser_foundAttributeDeclarationWithName_forElement_type_defaultValue, "parser:foundAttributeDeclarationWithName:forElement:type:defaultValue:"); + //mixin ObjcBindMethod!(parser, "parser:foundElementDeclarationWithName:model:"); + //mixin ObjcBindMethod!(parser_foundInternalEntityDeclarationWithName_value, "parser:foundInternalEntityDeclarationWithName:value:"); + //mixin ObjcBindMethod!(parser_foundExternalEntityDeclarationWithName_publicID_systemID, "parser:foundExternalEntityDeclarationWithName:publicID:systemID:"); + //mixin ObjcBindMethod!(parser, "parser:didStartElement:namespaceURI:qualifiedName:attributes:"); + //mixin ObjcBindMethod!(parser_didEndElement_namespaceURI_qualifiedName, "parser:didEndElement:namespaceURI:qualifiedName:"); + //mixin ObjcBindMethod!(parser_didStartMappingPrefix_toURI, "parser:didStartMappingPrefix:toURI:"); + //mixin ObjcBindMethod!(parser, "parser:didEndMappingPrefix:"); + //mixin ObjcBindMethod!(parser, "parser:foundCharacters:"); + //mixin ObjcBindMethod!(parser, "parser:foundIgnorableWhitespace:"); + //mixin ObjcBindMethod!(parser_foundProcessingInstructionWithTarget_data, "parser:foundProcessingInstructionWithTarget:data"); + //mixin ObjcBindMethod!(parser, "parser:foundComment:"); + //mixin ObjcBindMethod!(parser, "parser:foundCDATA:"); + //mixin ObjcBindMethod!(parser_resolveExternalEntityName_systemID, "parser:resolveExternalEntityName:systemID:"); + //mixin ObjcBindMethod!(parser, "parser:parseErrorOccurred:"); + //mixin ObjcBindMethod!(parser, "parser:validationErrorOccurred:"); +`; + +const TNSXMLParserLocatorAdditions = ` + + NSString publicID () + { + return invokeObjcSelf!(NSString, "publicID"); + } + + NSString systemID () + { + return invokeObjcSelf!(NSString, "systemID"); + } + + NSInteger lineNumber () + { + return invokeObjcSelf!(NSInteger, "lineNumber"); + } + + NSInteger columnNumber () + { + return invokeObjcSelf!(NSInteger, "columnNumber"); + } +`; class NSXMLParser : NSObject { - mixin ObjcWrap; - mixin TNSXMLParserLocatorAdditions; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } Object initWithContentsOfURL (NSURL url) { @@ -135,13 +297,7 @@ this (NSURL url) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithContentsOfURL:", NSURL)(objcObject, url); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithContentsOfURL(url); } Object initWithData (NSData data) @@ -151,13 +307,7 @@ this (NSData data) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithData:", NSData)(objcObject, data); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithData(data); } Object delegate_ () @@ -214,52 +364,25 @@ { return invokeObjcSelf!(NSError, "parserError"); } -} - -template TNSXMLParserDelegateEventAdditions () -{ - void parserDidStartDocument (NSXMLParser parser); - void parserDidEndDocument (NSXMLParser parser); - void parser (NSXMLParser parser, NSString name, NSString publicID, NSString systemID); - void parser (NSXMLParser parser, NSString name, NSString publicID, NSString systemID, NSString notationName); - void parser (NSXMLParser parser, NSString attributeName, NSString elementName, NSString type, NSString defaultValue); - void parser (NSXMLParser parser, NSString elementName, NSString model); - void parser (NSXMLParser parser, NSString name, NSString value); - void parser (NSXMLParser parser, NSString name, NSString publicID, NSString systemID); - void parser (NSXMLParser parser, NSString elementName, NSString namespaceURI, NSString qName, NSDictionary attributeDict); - void parser (NSXMLParser parser, NSString elementName, NSString namespaceURI, NSString qName); - void parser (NSXMLParser parser, NSString prefix, NSString namespaceURI); - void parser (NSXMLParser parser, NSString prefix); - void parser (NSXMLParser parser, NSString string); - void parser (NSXMLParser parser, NSString whitespaceString); - void parser (NSXMLParser parser, NSString target, NSString data); - void parser (NSXMLParser parser, NSString comment); - void parser (NSXMLParser parser, NSData CDATABlock); - NSData parser (NSXMLParser parser, NSString name, NSString systemID); - void parser (NSXMLParser parser, NSError parseError); - void parser (NSXMLParser parser, NSError validationError); -} - -template TNSXMLParserLocatorAdditions () -{ + + // TNSXMLParserLocatorAdditions NSString publicID () { return invokeObjcSelf!(NSString, "publicID"); } - + NSString systemID () { return invokeObjcSelf!(NSString, "systemID"); } - + NSInteger lineNumber () { return invokeObjcSelf!(NSInteger, "lineNumber"); } - + NSInteger columnNumber () { return invokeObjcSelf!(NSInteger, "columnNumber"); } -} - +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSXMLParser_bindings.d --- a/dstep/foundation/NSXMLParser_bindings.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSXMLParser_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -7,7 +7,9 @@ import dstep.foundation.NSString; import dstep.foundation.NSURL; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + extern (C) diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSZone.d --- a/dstep/foundation/NSZone.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSZone.d Sun Jan 03 22:06:11 2010 +0100 @@ -10,7 +10,10 @@ import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; +import bindings = dstep.foundation.NSZone_bindings; + +struct _NSZone; alias _NSZone NSZone; diff -r 7ff919f595d5 -r 19885b43130e dstep/foundation/NSZone_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSZone_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,16 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Aug 20, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.foundation.NSZone_bindings; + +import dstep.foundation.NSZone; +import dstep.objc.objc; + +extern (C): +package: + +void NSSetZoneName (NSZone* zone, id name); +id NSZoneName (NSZone* zone); \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/internal/String.d --- a/dstep/internal/String.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/internal/String.d Sun Jan 03 22:06:11 2010 +0100 @@ -7,4 +7,853 @@ module dstep.internal.String; public import dstep.internal.collection.Array; -public import mambo.string; \ No newline at end of file + +version (Tango) +{ + static import tango.stdc.stringz; + import tango.text.Unicode : toFold, isDigit; + import tango.text.convert.Utf; + import tango.text.Util; + + alias tango.stdc.stringz.toStringz toStringz; + alias tango.stdc.stringz.toString16z toString16z; + alias tango.stdc.stringz.toString32z toString32z; + + alias tango.stdc.stringz.fromStringz fromStringz; + alias tango.stdc.stringz.fromString16z fromString16z; + alias tango.stdc.stringz.fromString32z fromString32z; +} + +else +{ + import std.string; + import std.utf; + import std.ctype : isxdigit; + + version = Phobos; + + alias tolower toFold; + alias toUTF16 toString16; + + alias std.string.tolower toFold; + alias std.utf.toUTF16 toString16; + + alias std.string.toStringz toStringz; + alias std.utf.toUTF16z toString16z; + + alias std.string.toString fromStringz; +} + +version (Tango) +{ + /** + * string alias + */ + alias char[] string; + + /** + * wstring alias + */ + alias wchar[] wstring; + + /** + * dstring alias + */ + alias dchar[] dstring; +} + +/** + * Compares the $(D_PSYMBOL string) to another $(D_PSYMBOL string), ignoring case + * considerations. Two strings are considered equal ignoring case if they are of the + * same length and corresponding characters in the two strings are equal ignoring case. + * + * Params: + * str = The $(D_PSYMBOL string) first string to compare to + * anotherString = The $(D_PSYMBOL string) to compare the first $(D_PSYMBOL string) with + * + * Returns: $(D_KEYWORD true) if the arguments is not $(D_KEYWORD null) and it + * represents an equivalent $(D_PSYMBOL string) ignoring case; $(D_KEYWORD false) otherwise + * + * Throws: AssertException if the length of any of the strings is 0 + * + * See_Also: opEquals(Object) + */ +bool equalsIgnoreCase (string str, string anotherString) +in +{ + assert(str.length > 0, "dstep.internal.String.equalsIgnoreCase: The length of the first string was 0"); + assert(anotherString.length > 0, "dstep.internal.String.equalsIgnoreCase: The length of the second string was 0"); +} +body +{ + if (str == anotherString) + return true; + + return toFold(str) == toFold(anotherString); +} + +/** + * Compares the $(D_PSYMBOL wstring) to another $(D_PSYMBOL wstring), ignoring case + * considerations. Two wstrings are considered equal ignoring case if they are of the + * same length and corresponding characters in the two wstrings are equal ignoring case. + * + * Params: + * str = The $(D_PSYMBOL wstring) first string to compre to + * anotherString = The $(D_PSYMBOL wstring) to compare the first $(D_PSYMBOL wstring) against + * + * Returns: $(D_KEYWORD true) if the argument is not $(D_KEYWORD null) and it + * represents an equivalent $(D_PSYMBOL wstring) ignoring case; (D_KEYWORD + * false) otherwise + * + * Throws: AssertException if the length of any of the wstrings is 0 + * + * See_Also: opEquals(Object) + */ +bool equalsIgnoreCase (wstring str, wstring anotherString) +in +{ + assert(str.length > 0, "dstep.internal.String.equalsIgnoreCase: The length of the first string was 0"); + assert(anotherString.length > 0, "dstep.internal.String.equalsIgnoreCase: The length of the second string was 0"); +} +body +{ + if (str == anotherString) + return true; + + version (Tango) + return toFold(str) == toFold(anotherString); + + else + return toFold(toUTF8(str)) == toFold(toUTF8(anotherString)); +} + +/** + * Compares the $(D_PSYMBOL dstring) to another $(D_PSYMBOL dstring), ignoring case + * considerations. Two wstrings are considered equal ignoring case if they are of the + * same length and corresponding characters in the two wstrings are equal ignoring case. + * + * Params: + * str = The $(D_PSYMBOL dstring) first string to compare to + * anotherString = The $(D_PSYMBOL wstring) to compare the first $(D_PSYMBOL dstring) against + * + * Returns: $(D_KEYWORD true) if the argument is not $(D_KEYWORD null) and it + * represents an equivalent $(D_PSYMBOL dstring) ignoring case; $(D_KEYWORD false) otherwise + * + * Throws: AssertException if the length of any of the dstrings are 0 + * + * See_Also: opEquals(Object) + */ +bool equalsIgnoreCase (dstring str, dstring anotherString) +in +{ + assert(str.length > 0, "dstep.internal.String.equalsIgnoreCase: The length of the first string was 0"); + assert(anotherString.length > 0, "dstep.internal.String.equalsIgnoreCase: The length of the second string was 0"); +} +body +{ + if (str == anotherString) + return true; + + version (Tango) + return toFold(str) == toFold(anotherString); + + else + return toFold(toUTF8(str)) == toFold(toUTF8(anotherString)); +} + +/** + * Returns the char value at the specified index. An index ranges from 0 to length - 1. + * The first $(D_KEYWORD char) value of the sequence is at index 0, the next at index 1, + * and so on, as for array indexing. + * + * Params: + * str = the string to get the $(D_KEYWORD char) from + * index = the index of the $(D_KEYWORD char) value. + * + * Returns: the $(D_KEYWORD char) value at the specified index of the string. + * The first $(D_KEYWORD char) value is at index 0. + * + * Throws: AssertException if the length of the string is 0 + * Throws: AssertException if the $(D_CODE index) argument is + * not less than the length of the string. + */ +char charAt (string str, size_t index) +in +{ + assert(str.length > 0, "dstep.internal.String.charAt: The length of the string was 0"); + assert(index <= str.length, "dstep.internal.String.charAt: The index was to greater than the length of the string"); +} +body +{ + return str[index]; +} + +/** + * Returns the $(D_KEYWORD char) value at the specified index. An index ranges from 0 to + * length - 1. The first $(D_KEYWORD char) value of the sequence is at index 0, the next + * at index 1, and so on, as for array indexing. + * + * Params: + * str = the wstring to get the $(D_KEYWORD char) from + * index = the index of the $(D_KEYWORD char) value. + * + * Returns: the $(D_KEYWORD char) value at the specified index of the wstring. + * The first $(D_KEYWORD char) value is at index 0. + * + * Throws: AssertException if the length of the wstring is 0 + * Throws: AssertException if the $(D_CODE index) argument is + * not less than the length of the wstring. + */ +wchar charAt (wstring str, size_t index) +in +{ + assert(str.length > 0, "dstep.internal.String.charAt: The length of the string was 0"); + assert(index <= str.length, "dstep.internal.String.charAt: The index was to greater than the length of the string"); +} +body +{ + return str[index]; +} + +/** + * Returns the $(D_KEYWORD char) value at the specified index. An index ranges from 0 to + * length - 1. The first $(D_KEYWORD char) value of the sequence is at index 0, the next + * at index 1, and so on, as for array indexing. + * + * Params: + * str = the dstring to get the $(D_KEYWORD char) from + * index = the index of the $(D_KEYWORD char) value. + * + * Returns: the $(D_KEYWORD char) value at the specified index of the dstring. + * The first $(D_KEYWORD char) value is at index 0. + * + * Throws: AssertException if the length of the dstring is 0 + * Throws: AssertException if the $(D_CODE index) argument is + * not less than the length of the dstring. + */ +dchar charAt (dstring str, size_t index) +in +{ + assert(str.length > 0, "dstep.internal.String.charAt: The length of the string was 0"); + assert(index <= str.length, "dstep.internal.String.charAt: The index was to greater than the length of the string"); +} +body +{ + return str[index]; +} + +/** + * Returns a new string that is a substring of the specified string. The substring begins + * at the specified $(D_PARAM beginIndex) and extends to the character at index + * $(D_PARAM endIndex) - 1. Thus the length of the substring is $(D_PARAM endIndex - beginIndex). + * + * Examples: + * --- + * "hamburger".substring(4, 8) returns "urge" + * "smiles".substring(1, 5) returns "mile" + * --- + * + * Params: + * str = the string to get the substring from + * beginIndex = the beginning index, inclusive. + * endIndex = the ending index, exclusive. + * + * Returns: the specified substring. + * + * Throws: AssertException if the length of the string is 0 + * Throws: AssertException if the $(D_PARAM beginIndex) is + * larger than $(D_PARAM endIndex). + * Throws: AssertException if $(D_PARAM endIndex) is larger than the + * length of the $(D_PSYMBOL string). + */ +string substring (string str, size_t beginIndex, size_t endIndex) +in +{ + assert(str.length > 0, "dstep.internal.String.substring: The length of the string was 0"); + assert(beginIndex < endIndex, "dstep.internal.String.substring: The first index was greater the second"); + assert(endIndex <= str.length, "dstep.internal.String.substring: The second index was greater then the length of the string"); +} +body +{ + return str[beginIndex .. endIndex].dup; +} + +/** + * Returns a new string that is a substring of the specified string. The substring begins + * at the specified $(D_PARAM beginIndex) and extends to the character at index + * $(D_PARAM endIndex) - 1. Thus the length of the substring is $(D_PARAM endIndex - beginIndex). + * + * Examples: + * --- + * "hamburger".substring(4, 8) returns "urge" + * "smiles".substring(1, 5) returns "mile" + * --- + * + * Params: + * str = the string to get the substring from + * beginIndex = the beginning index, inclusive. + * endIndex = the ending index, exclusive. + * + * Returns: the specified substring. + * + * Throws: AssertException if the length of the string is 0 + * Throws: AssertException if the $(D_PARAM beginIndex) is + * larger than $(D_PARAM endIndex). + * Throws: AssertException if $(D_PARAM endIndex) is larger than the + * length of the $(D_PSYMBOL string). + */ +wstring substring (wstring str, size_t beginIndex, size_t endIndex) +in +{ + assert(str.length > 0, "dstep.internal.String.substring: The length of the string was 0"); + assert(beginIndex < endIndex, "dstep.internal.String.substring: The first index was greater the second"); + assert(endIndex <= str.length, "dstep.internal.String.substring: The second index was greater then the length of the string"); +} +body +{ + return str[beginIndex .. endIndex].dup; +} + +/** + * Returns a new string that is a substring of the specified string. The substring begins + * at the specified $(D_PARAM beginIndex) and extends to the character at index + * $(D_PARAM endIndex) - 1. Thus the length of the substring is $(D_PARAM endIndex - beginIndex). + * + * Examples: + * --- + * "hamburger".substring(4, 8) returns "urge" + * "smiles".substring(1, 5) returns "mile" + * --- + * + * Params: + * str = the string to get the substring from + * beginIndex = the beginning index, inclusive. + * endIndex = the ending index, exclusive. + * + * Returns: the specified substring. + * + * Throws: AssertException if the length of the string is 0 + * Throws: AssertException if the $(D_PARAM beginIndex) is + * larger than $(D_PARAM endIndex). + * Throws: AssertException if $(D_PARAM endIndex) is larger than the + * length of the $(D_PSYMBOL string). + */ +dstring substring (dstring str, size_t beginIndex, size_t endIndex) +in +{ + assert(str.length > 0, "dstep.internal.String.substring: The length of the string was 0"); + assert(beginIndex < endIndex, "dstep.internal.String.substring: The first index was greater the second"); + assert(endIndex <= str.length, "dstep.internal.String.substring: The second index was greater then the length of the string"); +} +body +{ + return str[beginIndex .. endIndex].dup; +} + +/** + * Returns a new string that is a substring of the specified string. The substring begins + * with the character at the specified index and extends to the end of the string. + * + * Examples: + * --- + * "unhappy".substring(2) returns "happy" + * "Harbison".substring(3) returns "bison" + * "emptiness".substring(9) returns "" (an empty string) + * --- + * + * Params: + * str = the string to get the substring from + * beginIndex = the beginning index, inclusive + * + * Returns: the specified substring + * + * Throws: AssertException if the length of the string is 0 + * Throws: AssertException if the $(D_PARAM beginIndex) is + * larger than the length of the string. + */ +string substring (string str, size_t index) +in +{ + assert(str.length > 0, "dstep.internal.String.substring: The length of the string was 0"); + assert(index < str.length, "dstep.internal.String.substring: The index was greater than the length of the string"); +} +body +{ + return str.substring(index, str.length); +} + +/** + * Returns a new string that is a substring of the specified string. The substring begins + * with the character at the specified index and extends to the end of the string. + * + * Examples: + * --- + * "unhappy".substring(2) returns "happy" + * "Harbison".substring(3) returns "bison" + * "emptiness".substring(9) returns "" (an empty string) + * --- + * + * Params: + * str = the string to get the substring from + * beginIndex = the beginning index, inclusive + * + * Returns: the specified substring + * + * Throws: AssertException if the length of the string is 0 + * Throws: AssertException if the $(D_PARAM beginIndex) is + * larger than the length of the string. + */ +wstring substring (wstring str, size_t index) +in +{ + assert(str.length > 0, "dstep.internal.String.substring: The length of the string was 0"); + assert(index < str.length, "dstep.internal.String.substring: The index was greater than the length of the string"); +} +body +{ + return str.substring(index, str.length); +} + +/** + * Returns a new string that is a substring of the specified string. The substring begins + * with the character at the specified index and extends to the end of the string. + * + * Examples: + * --- + * "unhappy".substring(2) returns "happy" + * "Harbison".substring(3) returns "bison" + * "emptiness".substring(9) returns "" (an empty string) + * --- + * + * Params: + * str = the string to get the substring from + * beginIndex = the beginning index, inclusive + * + * Returns: the specified substring + * + * Throws: AssertException if the length of the string is 0 + * Throws: AssertException if the $(D_PARAM beginIndex) is + * larger than the length of the string. + */ +dstring substring (dstring str, size_t index) +in +{ + assert(str.length > 0, "dstep.internal.String.substring: The length of the string was 0"); + assert(index < str.length, "dstep.internal.String.substring: The index was greater than the length of the string"); +} +body +{ + return str.substring(index, str.length); +} + +/** + * Returns a new string that is a substring of the given string. + * + * This substring is the character sequence that starts at character + * position pos and has a length of n characters. + * + * Params: + * str = the string to get the substring from + * pos = position of a character in the current string to be used + * as starting character for the substring. + * n = Length of the substring. If this value would make the + * substring to span past the end of the current string content, + * only those characters until the end of the string are used. + * size_t.max is the greatest possible value for an element of + * type size_t, therefore, when this value is used, all the + * characters between pos and the end of the string are used as + * the initialization substring. + * + * Returns: a string containing a substring of the given string + * + * Throws: AssertException if pos is greater than the length of the string + */ +string substr (string str, size_t pos = 0, size_t n = size_t.max) +in +{ + assert(pos < str.length, "dstep.internal.String.substr: The given position was greater than the length of the string."); +} +body +{ + size_t end; + + if (n == size_t.max) + end = str.length; + + else + { + end = pos + n; + + if (end > str.length) + end = str.length; + } + + return str[pos .. end].dup; +} + +/** + * Returns a new string that is a substring of the given string. + * + * This substring is the character sequence that starts at character + * position pos and has a length of n characters. + * + * Params: + * str = the string to get the substring from + * pos = position of a character in the current string to be used + * as starting character for the substring. + * n = Length of the substring. If this value would make the + * substring to span past the end of the current string content, + * only those characters until the end of the string are used. + * size_t.max is the greatest possible value for an element of + * type size_t, therefore, when this value is used, all the + * characters between pos and the end of the string are used as + * the initialization substring. + * + * Returns: a string containing a substring of the given string + * + * Throws: AssertException if pos is greater than the length of the string + */ +wstring substr (wstring str, size_t pos = 0, size_t n = size_t.max) +in +{ + assert(pos < str.length, "dstep.internal.String.substr: The given position was greater than the length of the string."); +} +body +{ + size_t end; + + if (n == size_t.max) + end = str.length; + + else + { + end = pos + n; + + if (end > str.length) + end = str.length; + } + + return str[pos .. end].dup; +} + +/** + * Returns a new string that is a substring of the given string. + * + * This substring is the character sequence that starts at character + * position pos and has a length of n characters. + * + * Params: + * str = the string to get the substring from + * pos = position of a character in the current string to be used + * as starting character for the substring. + * n = Length of the substring. If this value would make the + * substring to span past the end of the current string content, + * only those characters until the end of the string are used. + * size_t.max is the greatest possible value for an element of + * type size_t, therefore, when this value is used, all the + * characters between pos and the end of the string are used as + * the initialization substring. + * + * Returns: a string containing a substring of the given string + * + * Throws: AssertException if pos is greater than the length of the string + */ +dstring substr (dstring str, size_t pos = 0, size_t n = size_t.max) +in +{ + assert(pos < str.length, "dstep.internal.String.substr: The given position was greater than the length of the string."); +} +body +{ + size_t end; + + if (n == size_t.max) + end = str.length; + + else + { + end = pos + n; + + if (end > str.length) + end = str.length; + } + + return str[pos .. end].dup; +} + +/** + * Finds the first occurence of sub in str + * + * Params: + * str = the string to find in + * sub = the substring to find + * start = where to start finding + * + * Returns: the index of the substring or size_t.max when nothing was found + */ +size_t find (string str, string sub, size_t start = 0) +{ + version (Tango) + { + size_t index = str.locatePattern(sub, start); + + if (index == str.length) + return size_t.max; + + return index; + } + + else + return std.string.find(str, sub, start); +} + +/** + * Finds the first occurence of sub in str + * + * Params: + * str = the string to find in + * sub = the substring to find + * start = where to start finding + * + * Returns: the index of the substring or size_t.max when nothing was found + */ +size_t find (wstring str, wstring sub, size_t start = 0) +{ + version (Tango) + { + size_t index = str.locatePattern(sub, start); + + if (index == str.length) + return size_t.max; + + return index; + } + + else + return std.string.find(str, sub, start); +} + +/** + * Finds the first occurence of sub in str + * + * Params: + * str = the string to find in + * sub = the substring to find + * start = where to start finding + * + * Returns: the index of the substring or size_t.max when nothing was found + */ +size_t find (dstring str, dstring sub, size_t start = 0) +{ + version (Tango) + { + size_t index = str.locatePattern(sub, start); + + if (index == str.length) + return size_t.max; + + return index; + } + + else + return std.string.find(str, sub, start); +} + +/** + * Compares to strings, ignoring case differences. Returns 0 if the content + * matches, less than zero if a is "less" than b, or greater than zero + * where a is "bigger". + * + * Params: + * a = the first array + * b = the second array + * end = the index where the comparision will end + * + * Returns: Returns 0 if the content matches, less than zero if a is + * "less" than b, or greater than zero where a is "bigger". + * + * See_Also: dstep.internal.collection.array.compare + */ +int compareIgnoreCase (U = size_t) (string a, string b, U end = U.max) +{ + return a.toFold().compare(b.toFold(), end); +} + +/** + * Compares to strings, ignoring case differences. Returns 0 if the content + * matches, less than zero if a is "less" than b, or greater than zero + * where a is "bigger". + * + * Params: + * a = the first array + * b = the second array + * end = the index where the comparision will end + * + * Returns: Returns 0 if the content matches, less than zero if a is + * "less" than b, or greater than zero where a is "bigger". + * + * See_Also: dstep.internal.collection.array.compare + */ +int compareIgnoreCase (U = size_t) (wstring a, wstring b, U end = U.max) +{ + return a.toFold().compare(b.toFold(), end); +} + +/** + * Compares to strings, ignoring case differences. Returns 0 if the content + * matches, less than zero if a is "less" than b, or greater than zero + * where a is "bigger". + * + * Params: + * a = the first array + * b = the second array + * end = the index where the comparision will end + * + * Returns: Returns 0 if the content matches, less than zero if a is + * "less" than b, or greater than zero where a is "bigger". + * + * See_Also: dstep.internal.collection.array.compare + */ +int compareIgnoreCase (U = size_t) (dstring a, dstring b, U end = U.max) +{ + return a.toFold().compare(b.toFold(), end); +} + +/** + * Compares to strings, ignoring case differences. Returns 0 if the content + * matches, less than zero if a is "less" than b, or greater than zero + * where a is "bigger". + * + * Params: + * a = the first array + * b = the second array + * end = the index where the comparision will end + * + * Returns: Returns 0 if the content matches, less than zero if a is + * "less" than b, or greater than zero where a is "bigger". + * + * See_Also: dstep.internal.String.compareIgnoreCase + */ +alias compareIgnoreCase icompare; + +/** + * Checks if the given character is a hexdecimal digit character. + * Hexadecimal digits are any of: 0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F + * + * Params: + * ch = the character to be checked + * + * Returns: true if the given character is a hexdecimal digit character otherwise false + */ +bool isHexDigit (dchar ch) +{ + version (Tango) + { + switch (ch) + { + case 'A': return true; + case 'B': return true; + case 'C': return true; + case 'D': return true; + case 'E': return true; + case 'F': return true; + + case 'a': return true; + case 'b': return true; + case 'c': return true; + case 'd': return true; + case 'e': return true; + case 'f': return true; + + default: break; + } + + if (isDigit(ch)) + return true; + } + + else + if (isxdigit(ch) != 0) + return true; + + return false; +} + +version (Phobos) +{ + /** + * Converts the given string to C-style 0 terminated string. + * + * Params: + * str = the string to convert + * + * Returns: the a C-style 0 terminated string. + */ + dchar* toString32z (dstring str) + { + return (str ~ '\0').ptr; + } + + /** + * Converts a C-style 0 terminated string to a wstring + * + * Params: + * str = the C-style 0 terminated string + * + * Returns: the converted wstring + */ + wstring fromString16z (wchar* str) + { + return str[0 .. strlen(str)]; + } + + /** + * Converts a C-style 0 terminated string to a dstring + * Params: + * str = the C-style 0 terminated string + * + * Returns: the converted dstring + */ + dstring fromString32z (dchar* str) + { + return str[0 .. strlen(str)]; + } + + /** + * Gets the length of the given C-style 0 terminated string + * + * Params: + * str = the C-style 0 terminated string to get the length of + * + * Returns: the length of the string + */ + size_t strlen (wchar* str) + { + size_t i = 0; + + if (str) + while(*str++) + ++i; + + return i; + } + + /** + * Gets the length of the given C-style 0 terminated string + * + * Params: + * str = the C-style 0 terminated string to get the length of + * + * Returns: the length of the string + */ + size_t strlen (dchar* str) + { + size_t i = 0; + + if (str) + while(*str++) + ++i; + + return i; + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/internal/Traits.d --- a/dstep/internal/Traits.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/internal/Traits.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,6 +6,9 @@ */ module dstep.internal.Traits; +import dstep.objc.bridge.Bridge; +import dstep.internal.String; + /** * Returns the name of the given function * @@ -36,10 +39,10 @@ const parameterNamesOf = parameterNamesOfImpl!(func); } -private char[][] parameterNamesOfImpl (alias func) () +private string[] parameterNamesOfImpl (alias func) () { - char[] funcStr = typeof(&func).stringof; - + string funcStr = typeof(&func).stringof; + auto start = funcStr.indexOf('('); auto end = funcStr.indexOf(')'); @@ -53,8 +56,8 @@ funcStr ~= secondPattern; - char[] token; - char[][] arr; + string token; + string[] arr; foreach (c ; funcStr) { @@ -70,7 +73,10 @@ } } - char[][] result; + if (arr.length == 1) + return arr; + + string[] result; bool skip = false; foreach (str ; arr) @@ -101,9 +107,78 @@ */ private size_t indexOf (T) (T[] arr, T element) { - foreach (i, e ; arr) - if (e == element) - return i; + static if (is(T == char) || is(T == wchar) || is(T == dchar)) + foreach (i, dchar e ; arr) + if (e == element) + return i; + + else + foreach (i, e ; arr) + if (e == element) + return i; return size_t.max; +} + +/** + * Evaluates to true if $(D_PARAM T) has a instance method with the given name + * + * Params: + * T = the type of the class/struct + * method = the name of the method + */ +template hasInstanceMethod (T, string method) +{ + const hasInstanceMethod = is(typeof({ + T t; + mixin("auto f = &t." ~ method ~ ";"); + })); +} + +/** + * Evaluates to true if $(D_PARAM T) has a class method with the given name + * + * Params: + * T = the type of the class/struct + * method = the name of the method + */ +template hasClassMethod (T, string method) +{ + const hasClassMethod = is(typeof({ + mixin("auto f = &T." ~ method ~ ";"); + })); +} + +/** + * Evaluates to true if $(D_PARAM T) has a either a class method or a instance method + * with the given name. + * + * Params: + * T = the type of the class/struct + * method = the name of the method + */ +template hasMethod (T, string method) +{ + const hasMethod = hasClassMethod!(T, method) || hasInstanceMethod!(T, method); +} + +/** + * Evaluates to true if $(D_PARAM T) has a field with the given name + * + * Params: + * T = the type of the class/struct + * field = the name of the field + */ +template hasField (T, string field) +{ + const hasField = is(typeof({ + T t; + mixin("auto f = t." ~ field ~ ";"); + })); +} + +/// Evaluates to true if $(D_PARAM T) has binded methods +template hasBindedMethods (T) +{ + const bool hasBindedMethods = hasField!(T, Bridge.objcClassMethodDeclarationVar) || hasField!(T, Bridge.objcMethodDeclarationVar); } \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/internal/Tuple.d --- a/dstep/internal/Tuple.d Mon Aug 03 15:31:48 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -/** - * Copyright: Copyright (c) 2009 Jacob Carlborg. - * Authors: Jacob Carlborg - * Version: Initial created: May 10, 2009 - * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) - */ -module dstep.internal.Tuple; - -public import mambo.util.Tuple; \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/internal/Types.d --- a/dstep/internal/Types.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/internal/Types.d Sun Jan 03 22:06:11 2010 +0100 @@ -10,7 +10,10 @@ version (Windows) { + /// alias int c_long; + + /// alias uint c_ulong; } @@ -18,13 +21,19 @@ { static if (D_LP64) { + /// alias long c_long; + + /// alias ulong c_ulong; } else { + /// alias int c_long; + + /// alias uint c_ulong; } } \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/internal/Util.d --- a/dstep/internal/Util.d Mon Aug 03 15:31:48 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -/** - * Copyright: Copyright (c) 2009 Jacob Carlborg. - * Authors: Jacob Carlborg - * Version: Initial created: Feb 1, 2009 - * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) - */ -module dstep.internal.Util; diff -r 7ff919f595d5 -r 19885b43130e dstep/internal/Version.d --- a/dstep/internal/Version.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/internal/Version.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,4 +6,150 @@ */ module dstep.internal.Version; -public import mambo.util.Version; \ No newline at end of file + +template Version (char[] V) +{ + mixin( + "version(" ~ V ~ ") + { + const bool Version = true; + } + else + { + const bool Version = false; + }"); +} + +version (GNU) +{ + version (darwin) + version = OSX; + + static if ((void*).sizeof > int.sizeof) + version = D_LP64; +} + +version (DigitalMars) + version (OSX) + version = darwin; + +//Compiler Vendors +version (DigitalMars) const bool DigitalMars = true; +else const bool DigitalMars = false; + +version (GNU) const bool GNU = true; +else const bool GNU = false; + +version (LDC) const bool LDC = true; +else const bool LDC = false; + +version (LLVM) const bool LLVM = true; +else const bool LLVM = false; + + + +//Processors +version (PPC) const bool PPC = true; +else const bool PPC = false; + +version (PPC64) const bool PPC64 = true; +else const bool PPC64 = false; + +version (SPARC) const bool SPARC = true; +else const bool SPARC = false; + +version (SPARC64) const bool SPARC64 = true; +else const bool SPARC64 = false; + +version (X86) const bool X86 = true; +else const bool X86 = false; + +version (X86_64) const bool X86_64 = true; +else const bool X86_64 = false; + + + +//Operating Systems +version (aix) const bool aix = true; +else const bool aix = false; + +version (cygwin) const bool cygwin = true; +else const bool cygwin = false; + +version (darwin) const bool darwin = true; +else const bool darwin = false; + +version (OSX) const bool OSX = true; +else const bool OSX = false; + +version (freebsd) const bool freebsd = true; +else const bool freebsd = false; + +version (linux) const bool linux = true; +else const bool linux = false; + +version (solaris) const bool solaris = true; +else const bool solaris = false; + +version (Unix) const bool Unix = true; +else const bool Unix = false; + +version (Win32) const bool Win32 = true; +else const bool Win32 = false; + +version (Win64) const bool Win64 = true; +else const bool Win64 = false; + +version (Windows) const bool Windows = true; +else const bool Windows = false; + + + +//Rest +version (BigEndian) const bool BigEndian = true; +else const bool BigEndian = false; + +version (LittleEndian) const bool LittleEndian = true; +else const bool LittleEndian = false; + +version (D_Coverage) const bool D_Coverage = true; +else const bool D_Coverage = false; + +version (D_Ddoc) const bool D_Ddoc = true; +else const bool D_Ddoc = false; + +version (D_InlineAsm_X86) const bool D_InlineAsm_X86 = true; +else const bool D_InlineAsm_X86 = false; + +version (D_InlineAsm_X86_64) const bool D_InlineAsm_X86_64 = true; +else const bool D_InlineAsm_X86_64 = false; + +version (D_LP64) const bool D_LP64 = true; +else const bool D_LP64 = false; + +version (D_PIC) const bool D_PIC = true; +else const bool D_PIC = false; + +version (GNU_BitsPerPointer32) const bool GNU_BitsPerPointer32 = true; +else const bool GNU_BitsPerPointer32 = false; + +version (GNU_BitsPerPointer64) const bool GNU_BitsPerPointer64 = true; +else const bool GNU_BitsPerPointer64 = false; + +version (all) const bool all = true; +else const bool D_InlineAsm_X86_64 = false; + +version (none) const bool D_InlineAsm_X86_64 = true; +else const bool none = false; + +version (Tango) +{ + const bool Tango = true; + const bool Phobos = false; +} + +else +{ + const bool Tango = false; + const bool Phobos = true; +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/internal/collection/Array.d --- a/dstep/internal/collection/Array.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/internal/collection/Array.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,4 +6,592 @@ */ module dstep.internal.collection.Array; -public import mambo.collection.Array; \ No newline at end of file +version (Tango) +{ + static import tango.core.Array; + import tango.stdc.string : memmove; + static import tango.text.Util; +} + +else +{ + version = Phobos; + + import std.c.string : memmove; +} + +/** + * Inserts the specified element at the specified position in the array. Shifts the + * element currently at that position (if any) and any subsequent elements to the right. + * + * Params: + * arr = the array to insert the element into + * index = the index at which the specified element is to be inserted + * element = the element to be inserted + * + * Returns: the modified array + * + * Throws: AssertException if the length of the array is 0 + * Throws: AssertException if the $(D_PARAM index) argument is + * greater than the length of this array. + */ +T[] insert (T, U = size_t) (ref T[] arr, U index, T element) +in +{ + assert(arr.length > 0, "dstep.internal.collection.Array.insert: The length of the array was 0"); + assert(index <= arr.length, "dstep.internal.collection.Array.insert: The index was greater than the length of the array"); +} +body +{ + if (index == arr.length) + { + arr ~= element; + return arr; + } + + else if (index == 0) + arr = element ~ arr; + + else + arr = arr[0 .. index] ~ element ~ arr[index .. $]; + + return arr; +} + +/** + * Inserts the specified elements at the specified position in the array. Shifts the + * element currently at that position (if any) and any subsequent elements to the right. + * + * Params: + * arr = the array to insert the element into + * index = the index at which the specified element is to be inserted + * element = the element to be inserted + * + * Returns: the modified array + * + * Throws: AssertException if the length of the array is 0 + * Throws: AssertException if the $(D_PARAM index) argument is + * not less or equal than the length of this array. + */ +T[] insert (T, U = size_t) (ref T[] arr, U index, T[] element) +in +{ + assert(arr.length > 0, "dstep.internal.collection.Array.insert: The length of the array was 0"); + assert(index <= arr.length, "dstep.internal.collection.Array.insert: The index was greater than the length of the array"); +} +body +{ + if (index == arr.length) + { + arr ~= element; + return arr; + } + + else if (index == 0) + arr = element ~ arr; + + else + arr = arr[0 .. index] ~ element ~ arr[index .. $]; + + return arr; +} + +/** + * Inserts the specified element at the specified position in the array. Shifts the + * element currently at that position (if any) and any subsequent elements to the right. + * + * Params: + * arr = the array to add the element to + * index = the index at which the specified element is to be inserted + * element = the element to be inserted + * + * Returns: the modified array + * + * Throws: AssertException if the length of the array is 0 + * Throws: AssertException if the $(D_PARAM index) argument is + * not less than the length of this array. + */ +T[] add (T, U = size_t) (ref T[] arr, U index, T element) +in +{ + assert(arr.length > 0, "dstep.internal.collection.Array.add: The length of the array was 0"); + assert(index <= arr.length, "dstep.internal.collection.Array.add: The index was greater than the length of the array"); +} +body +{ + return insert(arr, index, element); +} + +/** + * Appends the specified element to the end of the array. + * + * Params: + * arr = the array to add the element to + * element = element to be appended to this list + * + * Returns: the modified array + */ +T[] add (T) (ref T[] arr, T element) +{ + return arr ~= element; +} + +/** + * Removes the element at the specified position in the array if it could find it and + * returns it. Shifts any subsequent elements to the left. + * + * Params: + * arr = the array to remove the element from + * index = the index of the element to be removed + * + * Returns: the element that was removed + * + * Throws: AssertException if the length of the array is 0 + * Throws: AssertException if the $(D_PARAM index) argument is + * not less than the length of this array. + */ +T remove (T, U = size_t) (ref T[] arr, U index) +in +{ + assert(arr.length > 0, "dstep.internal.collection.Array.remove: The length of the array was 0"); + assert(index < arr.length, "dstep.internal.collection.Array.remove: The index was greater than the length of the array"); +} +body +{ + T ret = arr[index]; + + if (index == 0) + arr = arr[1 .. $]; + + else if (index == arr.length - 1) + arr = arr[0 .. $ - 1]; + + else + { + if (index < arr.length - 1) + memmove(&arr[index], &arr[index + 1], T.sizeof * (arr.length - index - 1)); + + arr.length = arr.length - 1; + } + + return ret; +} + +/** + * Removes the specified element from the array if it could find it and returns it. + * Shifts any subsequent elements to the left. + * + * Params: + * arr = the array to remove the element from + * element = the element to be removed + * + * Returns: the element that was removed or T.max + * + * Throws: AssertException if the length of the array is 0 + */ +T remove (T) (ref T[] arr, T element) +in +{ + assert(arr.length > 0, "dstep.internal.collection.Array.remove: The length of the array was 0"); +} +out (result) +{ + assert(result is element); +} +body +{ + size_t index = arr.indexOf(element); + + if (index == size_t.max) + return T.max; + + return arr.remove(index); +} + +/** + * Returns the index of the first occurrence of the specified element in the array, or + * U.max if the array does not contain the element. + * + * Params: + * arr = the array to get the index of the element from + * element = the element to find + * start = the index where to begin the search + * + * Returns: the index of the element or U.max if it's not in the array + * + * Throws: AssertException if the length of the array is 0 + * Throws: AssertException if the return value is greater or + * equal to the length of the array. + */ +U indexOf (T, U = size_t) (T[] arr, T element, U start = 0) +in +{ + assert(arr.length > 0, "dstep.internal.collection.Array.indexOf: The length of the array was 0"); + assert(start >= 0, "dstep.internal.collection.Array.indexOf: The start index was less than 0"); +} +body +{ + version (Tango) + { + U index = tango.text.Util.locate(arr, element, start); + + if (index == arr.length) + index = U.max; + + return index; + } + + else + { + if (start > arr.length) + start = arr.length; + + for (U i = start; i < arr.length; i++) + if (arr[i] == element) + return i; + + return U.max; + } +} + +/** + * Returns $(D_KEYWORD true) if the array contains the specified element. + * + * Params: + * arr = the array to check if it contains the element + * element = the element whose presence in the array is to be tested + * + * Returns: $(D_KEYWORD true) if the array contains the specified element + * + * Throws: AssertException if the length of the array is 0 + */ +bool contains (T) (T[] arr, T element) +in +{ + assert(arr.length > 0, "dstep.internal.collection.Array.contains: The length of the array was 0"); +} +body +{ + return arr.indexOf!(T, size_t)(element) < size_t.max; +} + +/** + * Returns $(D_KEYWORD true) if this array contains no elements. + * + * Params: + * arr = the array to check if it's empty + * + * Returns: $(D_KEYWORD true) if this array contains no elements + */ +bool isEmpty (T) (T[] arr) +{ + return arr.length == 0; +} + +/** + * Returns $(D_KEYWORD true) if this array contains no elements. + * + * Params: + * arr = the array to check if it's empty + * + * Returns: $(D_KEYWORD true) if this array contains no elements + */ +alias isEmpty empty; + +/** + * Removes all of the elements from this array. The array will be empty after this call + * returns. + * + * Params: + * arr = the array to clear + * + * Returns: the cleared array + * + * Throws: AssertException if length of the return array isn't 0 + */ +T[] clear (T) (T[] arr) +out (result) +{ + assert(result.length == 0, "dstep.internal.collection.Array.clear: The length of the resulting array was not 0"); +} +body +{ + return arr.length = 0; +} + +/** + * Returns the element at the specified position in the array. + * + * Params: + * arr = the array to get the element from + * index = index of the element to return + * + * Returns: the element at the specified position in the array + * + * Throws: AssertException if the length of the array is 0 + * Throws: AssertException if the $(D_PARAM index) argument is + * not less than the length of this array. + */ +T get (T, U = size_t) (T[] arr, U index) +in +{ + assert(arr.length > 0, "dstep.internal.collection.Array.get: The length of the array was 0"); + assert(index < arr.length, "dstep.internal.collection.Array.get: The index was greater than the length of the array"); +} +body +{ + return arr[index]; +} + +/** + * Returns the index of the last occurrence of the specifed element + * + * Params: + * arr = the array to get the index of the element from + * element = the element to find the index of + * + * Returns: the index of the last occurrence of the element in the + * specified array, or U.max + * if the element does not occur. + * + * Throws: AssertException if the length of the array is 0 + * Throws: AssertException if the return value is less than -1 or + * greater than the length of the array - 1. + */ +U lastIndexOf (T, U = size_t) (T[] arr, T element) +in +{ + assert(arr.length > 0, "dstep.internal.collection.Array.lastIndexOf: The length of the array was 0"); +} +body +{ + version (Tango) + { + U index = tango.text.Util.locatePrior(arr, element); + + if (index == arr.length) + return U.max; + + return index; + } + + else + { + foreach_reverse (i, e ; arr) + if (e is element) + return i; + + return U.max; + } +} + +/** + * Returns the number of elements in the specified array. + * + * Params: + * arr = the array to get the number of elements from + * + * Returns: the number of elements in this list + */ +U size (T, U = size_t) (T[] arr) +{ + return arr.length; +} + +/** + * Finds the first occurence of element in arr + * + * Params: + * arr = the array to find the element in + * element = the element to find + * start = at which position to start finding + * + * Returns: the index of the first match or U.max if no match was found. + */ +alias indexOf find; + +/** + * Replaces a section of $(D_PARAM arr) with elements starting at $(D_PARAM pos) ending + * $(D_PARAM n) elements after + * + * Params: + * arr = the array to do the replace in + * pos = position within the array of the first element of the section to be replaced + * n = length of the section to be replaced within the array + * elements = the elements to replace with + * + * Throws: + * AssertException if pos is greater than the length of the array + * + * Returns: the array + */ +T[] replace (T, U = size_t) (ref T[] arr, U pos, U n, T[] elements) +in +{ + assert(pos <= arr.length, "dstep.internal.collection.Array.replace: The position was greter than the length of the array"); +} +body +{ + U i; + U nr = n; + + if (nr > arr.length) + nr = arr.length - 1; + + if (nr == elements.length) + { + U eIndex; + + for (i = pos, eIndex = 0; i <= nr; i++, eIndex++) + arr[i] = elements[eIndex]; + + return arr; + } + + else if (elements.length == 0) + { + U index = pos + n; + + if (index >= arr.length) + index = arr.length; + + return arr = arr[0 .. pos] ~ arr[index .. $]; + } + + else + { + U eIndex; + + for (i = pos, eIndex = 0; eIndex < nr && i < arr.length && eIndex < elements.length; i++, eIndex++) + arr[i] = elements[eIndex]; + + // no positions left and elements are left in elements, insert elements + if (eIndex < elements.length) + return arr = arr[0 .. i] ~ elements[eIndex .. $] ~ arr[i .. $]; + + // positions left to replace but no elements, remove those positions + else if (nr > eIndex) + { + U index = pos + nr; + + if (index >= arr.length) + index = arr.length; + + return arr = arr[0 .. pos + eIndex] ~ arr[index .. $]; + } + + } + + return arr; +} + +/** + * Erases a part of the array content, shortening the length of the array. + * + * Params: + * arr = the array to erase elements from + * start = the position within the array of the first element to be erased + * n = amount of elements to be removed. It may remove less elements if the + * end of the array is reached before the n elements have been erased. + * The default value of n indicates that all the elements until the end + * of the array should be erased. + * + * Throws: + * AssertException if pos is greater than the length of the array + * + * Returns: the array + */ +T[] erase (T, U = size_t) (ref T[] arr, U start = 0, U n = U.max) +in +{ + assert(start <= arr.length, "dstep.internal.collection.Array.erase: The start position was greater than the length of the array"); +} +body +{ + U end; + + if (n == U.max) + end = arr.length; + + else + { + end = start + n; + + if (end > arr.length) + end = arr.length; + } + + return arr = arr[0 .. start] ~ arr[end .. $]; +} + +/** + * Compares to arrays. Returns 0 if the content matches, less than zero + * if a is "less" than b, or greater than zero where a is "bigger". + * + * Params: + * a = the first array + * b = the second array + * end = the index where the comparision will end + * + * Returns: Returns 0 if the content matches, less than zero if a is + * "less" than b, or greater than zero where a is "bigger". + */ +int compare (T, U = size_t) (T[] a, T[] b, U end = U.max) +{ + U ia = end; + U ib = end; + + if (ia > a.length) + ia = a.length; + + if (ib > b.length) + ib = b.length; + + return typeid(T[]).compare(&a[0 .. ia], &b[0 .. ib]); +} + +/** + * Compares the content of the given array to the content of a comparing + * array, which is formed according to the arguments passed. + * + * The function returns 0 if all the elements in the compared contents compare + * equal, a negative value if the first element that does not match compares to + * less in the array than in the comparing array, and a positive value in + * the opposite case. + * + * Params: + * a = the first array to compare with + * pos = position of the beginning of the compared slice, i.e. the first element in the array (in a) to be compared against the comparing array. + * n = length of the compared slice. + * b = array with the content to be used as comparing array. + * + * Returns: 0 if the compared array are equal, otherwise a number different from 0 is returned, with its sign indicating whether the array is considered greater than the comparing array passed as parameter (positive sign), or smaller (negative sign). + * + * Throws: AssertException if pos is specified with a position greater than the length of the corresponding array + */ +int compare (T, U = size_t) (T[] a, size_t pos, size_t n, T[] b) +in +{ + assert(pos <= b.length); +} +body +{ + U end = pos + n; + + if (end > b.length) + end = b.length; + + return typeid(T[]).compare(&b[pos .. end], &a[0 .. $]); +} + +/** + * Reserves the given amount of allocated storage for the given array. + * + * Params: + * a = the array to reserve allocated storage for + * capacity = the amount of allocated storage to be reserved + */ +void reserve (T) (ref T[] a, size_t amount = 0) +{ + a = (new T[amount])[0 .. 0]; +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/objc/bindings.d --- a/dstep/objc/bindings.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/objc/bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,10 +6,10 @@ */ module dstep.objc.bindings; +import dstep.internal.Version; import dstep.objc.message; import dstep.objc.objc; import dstep.objc.runtime; -import dstep.internal.Util; extern (C) { diff -r 7ff919f595d5 -r 19885b43130e dstep/objc/bridge/Bridge.d --- a/dstep/objc/bridge/Bridge.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/objc/bridge/Bridge.d Sun Jan 03 22:06:11 2010 +0100 @@ -10,13 +10,11 @@ { import tango.core.Memory; import tango.core.Traits : ParameterTupleOf, ReturnTypeOf; - - alias GC.addRoot addRoot; } else { - import std.gc : addRoot; + import GC = std.gc : addRoot; import std.traits : ParameterTypeTuple, ReturnType; alias ReturnType ReturnTypeOf; @@ -24,10 +22,10 @@ } import dstep.internal.String; -import dstep.internal.Tuple; import dstep.internal.Version; import dstep.objc.bridge.Capsule; import dstep.objc.bridge.ClassInitializer; +import dstep.objc.bridge.Type; import dstep.objc.bridge.TypeEncoding; import dstep.objc.bridge.Wrapper; import dstep.objc.message; @@ -35,282 +33,676 @@ import dstep.objc.runtime; /** - * Builds a string representing a selector out of the given function + * Builds a string representing a selector out of the given method * - * It will build the string like this: + * It will build the string using the parameter names as a part of the selector, + * like this: * + * Examples: * --- - * foo (int x, int y); // foo:y: - * bar (); // bar - * fooBar (int x); // fooBar: + * foo (int x, int y); + * bar (); + * fooBar (int x); + * + * static assert(selectorAsString!(foo) == "foo:y:"); + * static assert(selectorAsString!(bar) == "bar"); + * static assert(selectorAsString!(fooBar) == "fooBar:"); * --- * * Params: - * func = the function alias to build the selector of + * method = the method alias to build the selector of * * Returns: a string representing the selector */ -template selector (alias func) +template selectorAsString (alias method) { - const selector = buildSelector!(func); + const selectorAsString = buildSelector!(method); } -template ObjcWrap () +/** + * Registers a method with the Objective-C runtime system, + * maps the method name to a selector, and returns the selector value. + * + * You must register a method name with the Objective-C runtime system to obtain + * the method’s selector before you can add the method to a class definition. + * If the method name has already been registered, this function simply returns + * the selector. + * + * Examples: + * --- + * SEL sel = selector!("foo:"); + * --- + * + * Params: + * str = the string to register + * + * Returns: a pointer of type SEL specifying the selector for the named method. + */ +SEL selector (string str) () { - mixin ObjcWrap!(this.stringof); + return sel.registerName!(str); +} + +/** + * Registers a method with the Objective-C runtime system, + * maps the method name to a selector, and returns the selector value. + * + * Using selectorAsString to get the string representation of the selector. + * + * You must register a method name with the Objective-C runtime system to obtain + * the method’s selector before you can add the method to a class definition. + * If the method name has already been registered, this function simply returns + * the selector. + * + * Examples: + * --- + * foo (int x); + * SEL sel = selector!(foo); + * --- + * + * Params: + * method = the method to register + * + * Returns: a pointer of type SEL specifying the selector for the named method. + */ +SEL selector (alias method) () +{ + return sel.registerName!(selectorAsString!(method)); } -template ObjcWrap (string name) -{ - private +/** + * All Objective-C wrappers should mix in this string. + * + * Mixes in: + * $(UL + * $(LI $(D_PSYMBOL __objcClass): a class variable representing the Objective-C class) + * $(LI $(D_PSYMBOL __objcSuperClass): a class variable representing the Objective-C super class) + * $(LI A constructor taking an Objective-C instance) + * $(LI $(D_PSYMBOL dstep.objc.bridge.ClassInitializer.ObjcSubclassInitializer)) + * ) + * + * Examples: + * --- + * class AppController : NSObject + * { + * mixin(ObjcWrap); + * } + * --- + */ +const ObjcWrap = "static private dstep.objc.objc.Class __objcClass; + static private dstep.objc.objc.Class __objcSuperClass; + + this (dstep.objc.objc.id object) { - import dstep.objc.bridge.ClassInitializer : ObjcSubclassInitializer, subclassInit; - import dstep.objc.objc : Class, id, IMP, SEL; - - static Class objcClass_; - static Class objcSuperClass_; + super(object); + } + + static typeof(this) alloc () + { + return invokeObjcSelfClass!(typeof(this), \"alloc\"); } - - this () - { - objcObject = invokeObjcSelfClass!(id, "alloc"); - id ret = invokeObjcSelf!(id, "init"); - if (ret) - objcObject = ret; - - dObject = this; - } + mixin dstep.objc.bridge.ClassInitializer.ObjcSubclassInitializer!(this.stringof, super.stringof);"; - this (id object) +/** + * All Objective-C wrappers should mix in this string. + * + * Mixes in: + * $(UL + * $(LI $(D_PSYMBOL __objcClass): a class variable representing the Objective-C class) + * $(LI $(D_PSYMBOL __objcSuperClass): a class variable representing the Objective-C super class) + * $(LI A constructor taking an Objective-C instance) + * $(LI $(D_PSYMBOL dstep.objc.bridge.ClassInitializer.ObjcSubclassInitializer)) + * ) + * + * Examples: + * --- + * class NSString : NSObject + * { + * mixin(ObjcClusterWrap); + * } + * --- + */ +const ObjcClusterWrap = "static private dstep.objc.objc.Class __objcClass; + static private dstep.objc.objc.Class __objcSuperClass; + + this (dstep.objc.objc.id object) { super(object); } - /*static typeof(this) alloc () - { - return invokeObjcSelfClass!(typeof(this), "alloc"); - }*/ - - /*typeof(this) init () + static typeof(this) alloc () { - id ret = invokeObjcSelf!(id, "init"); - - if (!ret) - return null; - - if (ret is objcObject) - { - dObject = this; - return this; - } - - auto object = new typeof(this) (ret); - object.dObject = this; - - return object; - }*/ - - mixin ObjcSubclassInitializer!("D_" ~ name, name); -} + return invokeObjcSuperClass!(typeof(this), \"alloc\"); + } + + mixin dstep.objc.bridge.ClassInitializer.ObjcSubclassInitializer!(this.stringof, super.stringof);"; +/** + * This $(D_KEYWORD struct) represents an Objective-C method declaration. + * + * Examples: + * --- + * class C : NSObject + * { + * void foo (int x) {} + * ObjcMethodDeclaration!(foo, void, "foo", int) objcMethodDecl; + * } + * --- + * + * Params: + * imp = the D method + * R = the return type of the method + * name = the name of the method + * ARGS = the argument types of the method + */ struct ObjcMethodDeclaration (alias imp, R, string name, ARGS...) { - alias imp methodImp; + dstep.objc.objc.IMP methodImp = cast(dstep.objc.objc.IMP) &imp; alias R returnType; const string methodName = name; alias ARGS argsType; } +/** + * Binds a selector to an instance method. + * + * This will create a receiver function which will forward the call to $(D_PARAM method), + * decapsulating arguments and encapsulating the return value as appropriate. + * This $(D_KEYWORD template) will use the buildSelector $(D_KEYWORD template) to build + * the selector. It will automatically infer the return type and the argument types + * of the method. + * + * Mixes in: ObjcBindMethod + * + * Examples: + * --- + * class AppController : NSObject + * { + * void foo () {} + * mixin ObjcBindMethod!(foo); + * } + * --- + * + * Params: + * method = the method to bind + */ template ObjcBindMethod (alias method) { - import dstep.objc.bridge.TypeEncoding : buildSelector, encode; - - mixin ObjcBindMethod!(method, buildSelector!(method)); + mixin ObjcBindMethod!(method, dstep.objc.bridge.TypeEncoding.buildSelector!(method)); } +/** + * Binds a selector to an instance method. + * + * This will create a receiver function which will forward the call to $(D_PARAM method), + * decapsulating arguments and encapsulating the return value as appropriate. + * It will automatically infer the return type and the argument types + * of the method. + * + * Mixes in: ObjcBindMethod + * + * Examples: + * --- + * class AppController : NSObject + * { + * void foo () {} + * mixin ObjcBindMethod!(foo, "foo"); + * } + * --- + * + * Params: + * method = the method to bind + * selector = the selector to bind the method to + */ template ObjcBindMethod (alias method, string selector) { - mixin ObjcBindMethod!(method, ReturnTypeOf!(method), selector, ParameterTupleOf!(method)); + version (Tango) + mixin ObjcBindMethod!(method, tango.core.Traits.ReturnTypeOf!(method), selector, tango.core.Traits.ParameterTupleOf!(method)); + + else + mixin ObjcBindMethod!(method, std.traits.ReturnType!(method), selector, std.traits.ParameterTypeTuple!(method)); } +/** + * Binds a selector to an instance method. + * + * This will create a receiver method which will forward the call to $(D_PARAM method), + * decapsulating arguments and encapsulating the return value as appropriate. + * + * Examples: + * --- + * class AppController : NSObject + * { + * int foo (int x) + * { + * return x; + * } + * + * mixin ObjcBindMethod!(foo, int, "foo:", int); + * } + * --- + * + * Params: + * method = the method to bind + * R = the return type of the method + * selector = the selector to bind the method to + * ARGS = the argument types of the method + */ template ObjcBindMethod (alias method, R, string selector, ARGS...) -{ +{ private - { - import dstep.objc.bridge.Capsule : decapsule, encapsule, isCapsule; - import dstep.objc.bridge.Type : needsEncapsulation, ObjcType; - import dstep.internal.Tuple; - - ObjcMethodDeclaration!(method, R, selector, ARGS) objcMethodDeclaration; - - R delegate (ARGS) resolveVirtualCall () + { + /** + * Resolves the virtual call + * + * Returns: a $(D_KEYWORD delegate) to the binded method + */ + R delegate (ARGS) __resolveVirtualCall () { - return null; + return &method; } - alias ReplaceAllClasses!(id, ARGS) ObjcArgs; + /// A type tuple with all the encapsulated types + alias dstep.objc.bridge.Type.ObjcTypes!(ARGS) __ObjcArgs; - static ObjcType!(R) forwardVirtualCall (id self, SEL cmd, ObjcArgs objcArgs) + /** + * The receiver method, this will be the method called from the Objective-C side + * + * Params: + * self = the Objective-C instance to call the method on + * cmd = the Objective-C selector representing the method to call + * objcArgs = the encapsulated arguments to the binded method + * + * Returns: whatever the binded method returns, encapsulated + */ + extern (C) static dstep.objc.bridge.Type.ObjcType!(R) __forwardVirtualCall (dstep.objc.objc.id self, dstep.objc.objc.SEL cmd, __ObjcArgs objcArgs) in { - assert(isCapsule(self)); + assert(dstep.objc.bridge.Capsule.isCapsule(self)); } body - { - R delegate (ARGS) dg; - dg.funcptr = &method; - dg.ptr = Bridge.getDObject(self); - + { + R delegate (ARGS) delegate () dg; + dg.ptr = cast(void*) dstep.objc.bridge.Capsule.decapsule!(typeof(this))(self); + dg.funcptr = &__resolveVirtualCall; ARGS args; foreach (i, a ; objcArgs) { - alias typeof(args[i]) ArgType; - - args[i] = decapsule!(ArgType)(a); + alias typeof(args[i]) ArgType; + args[i] = dstep.objc.bridge.Capsule.decapsule!(ArgType)(a); } static if (is(R == void)) - dg(args); + dg()(args); else - return encapsule!(R)(dg(args)); + return dstep.objc.bridge.Capsule.encapsule!(R)(dg()(args)); } + + /// The Objective-C method declaration for the binded method + ObjcMethodDeclaration!(__forwardVirtualCall, R, selector, ARGS) __objcMethodDeclaration; } } +/** + * Binds a selector to a class (static) method. + * + * This will create a receiver function which will forward the call to $(D_PARAM method), + * decapsulating arguments and encapsulating the return value as appropriate. + * This $(D_KEYWORD template) will use the buildSelector $(D_KEYWORD template) + * to build the selector. It will automatically infer the return type and the + * argument types of the method. + * + * Mixes in: $(D_PSYMBOL ObjcBindClassMethod) + * + * Examples: + * --- + * class AppController : NSObject + * { + * static void foo () {} + * mixin ObjcBindClassMethod!(foo); + * } + * --- + * + * Params: + * method = the method to bind + */ +template ObjcBindClassMethod (alias method) +{ + mixin ObjcBindClassMethod!(method, dstep.objc.bridge.TypeEncoding.buildSelector!(method)); +} + +/** + * Binds a selector to a class (static) method. + * + * This will create a receiver function which will forward the call to $(D_PARAM method), + * decapsulating arguments and encapsulating the return value as appropriate. + * It will automatically infer the return type and the argument types + * of the method. + * + * Mixes in: $(D_PSYMBOL ObjcBindClassMethod) + * + * Examples: + * --- + * class AppController : NSObject + * { + * static void foo () {} + * mixin ObjcBindClassMethod!(foo, "foo"); + * } + * --- + * + * Params: + * method = the method to bind + * selector = the selector to bind the method to + */ template ObjcBindClassMethod (alias method, string selector) { - mixin ObjcBindClassMethod!(method, ReturnTypeOf!(method), selector, ParameterTupleOf!(method)); + version (Tango) + mixin ObjcBindClassMethod!(method, tango.core.Traits.ReturnTypeOf!(method), selector, tango.core.Traits.ParameterTupleOf!(method)); + + else + mixin ObjcBindClassMethod!(method, std.traits.ReturnType!(method), selector, std.traits.ParameterTypeTuple!(method)); } +/** + * Binds a selector to a class (static) method. + * + * This will create a receiver method which will forward the call to $(D_PARAM method), + * decapsulating arguments and encapsulating the return value as appropriate. + * + * Examples: + * --- + * class AppController : NSObject + * { + * static int foo (int x) + * { + * return x; + * } + * + * mixin ObjcBindClassMethod!(foo, int, "foo:", int); + * } + * --- + * + * Params: + * method = the method to bind + * R = the return type of the method + * selector = the selector to bind the method to + * ARGS = the argument types of the method + */ template ObjcBindClassMethod (alias method, R, string selector, ARGS...) -{ +{ private { - import dstep.objc.bridge.Capsule : decapsule, encapsule, isCapsule, needsEncapsulation, ObjcType; - import dstep.internal.Tuple; + /// A type tuple with all the encapsulated types + alias dstep.objc.bridge.Type.ObjcTypes!(ARGS) __ObjcArgs; - ObjcMethodDeclaration!(method, R, selector, ARGS) objcClassMethodDeclaration; - - alias ReplaceAllClasses!(id, ARGS) ObjcArgs; - - static ObjcType!(R) forwardStaticCall (id self, SEL cmd, ObjcArgs objcArgs) + /** + * The receiver method, this will be the method called from the Objective-C side + * + * Params: + * objcArgs = the encapsulated arguments to the binded method + * + * Returns: whatever the binded method returns, encapsulated + */ + extern (C) static dstep.objc.bridge.Type.ObjcType!(R) __forwardStaticCall (dstep.objc.objc.Class self, dstep.objc.objc.SEL cmd, __ObjcArgs objcArgs) in { - assert(isCapsule(self)); + assert(dstep.objc.bridge.Capsule.isCapsule(self)); } body { - R function (ARGS) dg = &method; - + R function (ARGS) funcPtr = &method; ARGS args; foreach (i, a ; objcArgs) { - alias typeof(args[i]) ArgType; - - args[i] = decapsule!(ArgType)(a); + alias typeof(args[i]) ArgType; + args[i] = dstep.objc.bridge.Capsule.decapsule!(ArgType)(a); } - static if (needsEncapsulation!(R)) - return encapsule!(R)(dg(args)); + static if (is(R == void)) + funcPtr()(args); else - return dg(args); + return dstep.objc.bridge.Capsule.encapsule!(R)(funcPtr()(args)); } + + /// The Objective-C method declaration for the binded method + ObjcMethodDeclaration!(__forwardStaticCall, R, selector, ARGS) __objcClassMethodDeclaration; } } +/** + * Binds a D free function to an Objective-C free function. + * + * This will create a receiver function which will forward the call to the + * binded function, decapsulating arguments and encapsulating the return value + * as appropriate. + * + * Mixes in: $(D_PSYMBOL ObjcBindFunction) + * + * Examples: + * --- + * void foo (); + * mixin ObjcBindFunction!(foo); + * --- + */ template ObjcBindFunction (alias func) { mixin ObjcBindFunction!(func, ReturnTypeOf!(func), ParameterTupleOf!(func)); } +/** + * Binds a D free function to an Objective-C free function. + * + * This will create a receiver function which will forward the call to the + * binded function, decapsulating arguments and encapsulating the return value + * as appropriate. + * + * Examples: + * --- + * char foo (int); + * mixin ObjcBindFunction!(foo, char, int); + * --- + * + * Params: + * func = the function to bind + * R = the return type of the function + * ARGS = the argument types of the function + */ template ObjcBindFunction (alias func, R, ARGS...) { private - { - import dstep.objc.bridge.Capsule : decapsule, encapsule, needsEncapsulation, ObjcType; - import dstep.internal.Tuple; + { + /// A type tuple with all the encapsulated types + alias dstep.objc.bridge.Type.ObjcTypes!(ARGS) __ObjcArgs; - ObjcMethodDeclaration!(method, R, selector, ARGS) objcClassMethodDeclaration; - - alias ReplaceAllClasses!(id, ARGS) ObjcArgs; - - extern (C) ObjcType!(R) forwardFunctionCall (ObjcArgs objcArgs) + /** + * The receiver function, this will be the function called from the Objective-C side + * + * Params: + * objcArgs = the encapsulated arguments to the binded function + * + * Returns: whatever the binded function returns, encapsulated + */ + extern (C) dstep.internal.Types.ObjcType!(R) __forwardFunctionCall (__ObjcArgs objcArgs) { + R function (ARGS) funcPtr = &func; ARGS args; foreach (i, a ; objcArgs) { - alias typeof(args[i]) ArgType; - - args[i] = decapsule!(ArgType)(a); + alias typeof(args[i]) ArgType; + args[i] = dstep.objc.bridge.Capsule.decapsule!(ArgType)(a); } - static if (needsEncapsulation!(R)) - return encapsule!(R)(dg(args)); + static if (is(R == void)) + funcPtr()(args); else - return dg(args); + return dstep.objc.bridge.Capsule.encapsule!(R)(funcPtr()(args)); } } } -struct Bridge +/// This $(D_KEYWORD class) acts like a name space for various methods and functions +class Bridge { + private static Bridge bridgeInstance; + + /// The name of the method declaration variable mixed in in a $(D_KEYWORD class) + const objcMethodDeclarationVar = "__objcMethodDeclaration"; + + /// The name of the class method declaration variable mixed in in a $(D_KEYWORD class) + const objcClassMethodDeclarationVar = "__objcClassMethodDeclaration"; + + /// The name of the variable used on the Objective-C side to store the D object + const dObjectVar = "dObject"; + + /// This alias is used as an internal representation of a D object + //alias Object DObjectType; + alias void* DObjectType; + + /** + * Gets the only instance of this class + * + * Returns: the instance + */ + static Bridge instance () + { + if (bridgeInstance) + return bridgeInstance; + + return bridgeInstance = new Bridge; + } + static: - const objcMethodDeclarationVar = "objcMethodDeclaration"; - const objcClassMethodDeclarationVar = "objcClassMethodDeclaration"; - const dObjectVar = "dObject"; - alias void* DObjectType; - private ClassInfo[string] registeredClasses; - - void registerClass (string className, ClassInfo classInfo) + /** + * Gets the value of an Objective-C instance variable + * + * Examples: + * --- + * id self; + * int x = getObjcIvar!(int, "x")(self); + * --- + * + * Params: + * T = the type of the instance variable + * name = the name of the instance variable + * self = the Objective-C instance + * + * Returns: the value of the Objective-C variable + */ + T getObjcIvar (T, string name) (id self) { - if (className.length > 2 && className[0 .. 2] == "D_") - registeredClasses[className[0 .. 2]] = classInfo; + T value; - else - registeredClasses[className] = classInfo; + self.getInstanceVariable!(T, name)(value); + + return value; } - Object createRegisteredObject (T) (string className) + /** + * Sets the value of an Objective-C instance variable + * + * Examples: + * --- + * id self; + * Bridge.setObjcIvar!(int, "x")(self, 3); + * --- + * + * Params: + * T = the type of the instance variable + * name = the name of the instance + * objcObject = the Objective-C instance + * value = the value to set + */ + void setObjcIvar (T, string name) (id self, T value) { - return null; + GC.addRoot(value); + self.setInstanceVariable!(T, dObjectVar)(value); } - DObjectType getDObject (id self) + /** + * Gets the D object stored in the given Objective-C instance + * + * Examples: + * --- + * NSObject object = new NSObject; + * id self = object.objcObject; + * assert(object == Bridge.getDObject(self)); + * --- + * + * Params: + * self = the Objective-C instance + * + * Returns: the D object or null + */ + package DObjectType getDObject (id self) { - DObjectType dObject; - - self.getInstanceVariable!(DObjectType, dObjectVar)(dObject); - - return dObject; + return getObjcIvar!(DObjectType, dObjectVar)(self); } - id setDObject (Object dObject, id objcObject) + /** + * Stores the given D object in the given Objective-C instance + * + * Examples: + * --- + * NSObject object = new NSObject; + * id self = object.objcObject; + * Bridge.setDObject(object, self); + * --- + * + * Params: + * dObject = the D object to store + * objcObject = the Objective-C instance to store the D object in + * + * Returns: the Objective-C instance + */ + package id setDObject (Object dObject, id objcObject) { - auto o = cast(DObjectType) dObject; - addRoot(o); - - objcObject.setInstanceVariable!(DObjectType, Bridge.dObjectVar)(o); + auto o = cast(DObjectType) dObject; + setObjcIvar!(DObjectType, dObjectVar)(objcObject, o); return objcObject; } - - R invokeObjcMethod (R, string selector, ARGS...) (id self, ARGS args) + + /** + * Deregisters the given Objective-C instance from the bridge + * + * Params: + * objcInstance = the Objective-C instance to deregister + */ + package static void deregisterObjcInstance (id objcInstance) { - static if (!is(R : void)) - R result; + GC.removeRoot(getObjcIvar!(DObjectType, dObjectVar)(objcInstance)); + } + + /** + * This method wraps the family of $(D_PSYMBOL objc_msgSend) methods which is used to send a message + * to an instance of a class. + * + * This method chooses the appropriate $(D_PSYMBOL objc_msgSend) method depending on the return value, + * decapsulating arguments and encapsulating the return value as appropriate. + * + * Params: + * R = the return type + * selector = the selector to call + * ARGS = the argument types + * self = the reciver of the call + * args = the arguments to the method + * + * Returns: whatever the method returns, encapsulaed + */ + R invokeObjcMethod (R, string selector, ARGS...) (id self, ARGS args) + { + static assert (checkSelector!(selector, ARGS), "The selector \"" ~ selector ~ "\" and the arguments " ~ ARGS.stringof ~ " do not match"); SEL sel = sel.registerName!(selector); - - alias ReplaceAllClasses!(id, ARGS) ObjcArgs; - ObjcArgs objcArgs; + ObjcTypes!(ARGS) objcArgs; foreach (i, a ; args) { @@ -321,25 +713,21 @@ static if (is(R == struct)) { + R result; self.msgSend_stret(result, sel, objcArgs); + return result; } else static if (is(R == float) || is(R == double) || is(R == real)) { version (X86) - { - static if (is(R == float)) - return self.msgSend_fpret!(R)(sel, objcArgs); - - else - return self.msgSend_fpret(sel, objcArgs); - } + return self.msgSend_fpret!(R, ObjcTypes!(ARGS))(sel, objcArgs); else version (X86_64) { static if (is(R == real)) - return self.msgSend_fpret(sel, objcArgs); + return self.msgSend_fpret!(R)(sel, objcArgs); else return self.msgSend!(R)(sel, objcArgs); @@ -349,50 +737,56 @@ return self.msgSend!(R)(sel, objcArgs); } - else static if (is(R : ObjcWrapper)) - { - id r = self.msgSend(sel, objcArgs); - - if (!r) - return null; - - if (isCapsule(r)) - { - result = decapsule!(R)(r); - - if (result) - return result; - } - - return new R(r); - } - - else static if (is(R : Object)) - { - id r = self.msgSend(sel, objcArgs); - - if (!r) - return null; - - return decapsule!(R)(r); - } + else static if (needsEncapsulation!(R)) + return decapsule!(R)(self.msgSend(sel, objcArgs)); else - return self.msgSend!(R, ObjcArgs)(sel, objcArgs); + return self.msgSend!(R, ObjcTypes!(ARGS))(sel, objcArgs); } - R invokeObjcClassMethod (R = id, string selector, ARGS...) (Class cls, ARGS args) + /** + * This method wraps the family of $(D_PSYMBOL objc_msgSend) methods which is used to send a message + * to a class. + * + * This method chooses the appropriate $(D_PSYMBOL objc_msgSend) method depending on the return value, + * decapsulating arguments and encapsulating the return value as appropriate. + * + * Params: + * R = the return type + * selector = the selector to call + * ARGS = the argument types + * cls = the reciver of the call + * args = the arguments to the method + * + * Returns: whatever the method returns, encapsulaed + */ + R invokeObjcClassMethod (R, string selector, ARGS...) (Class cls, ARGS args) { return invokeObjcMethod!(R, selector, ARGS)(cast(id) cls, args); } - R invokeObjcSuperMethod (R = id, string selector, ARGS...) (objc_super* self, ARGS args) - { - R result; + /** + * This method wraps the family of $(D_PSYMBOL objc_msgSendSuper) methods which is used to send a message + * to an instance of a superclass. + * + * This method chooses the appropriate $(D_PSYMBOL objc_msgSendSuper) method depending on the return value, + * decapsulating arguments and encapsulating the return value as appropriate. + * + * Params: + * R = the return type + * selector = the selector to call + * ARGS = the argument types + * self = the reciver of the call + * args = the arguments to the method + * + * Returns: whatever the method returns, encapsulaed + */ + R invokeObjcSuperMethod (R, string selector, ARGS...) (objc_super* self, ARGS args) + { + static assert (checkSelector!(selector, ARGS), "The selector \"" ~ selector ~ "\" and the arguments " ~ ARGS.stringof ~ " do not match"); + SEL sel = sel.registerName!(selector); - - alias ReplaceAllClasses!(id, ARGS) ObjcArgs; - ObjcArgs objcArgs; + ObjcTypes!(ARGS) objcArgs; foreach (i, a ; args) { @@ -403,43 +797,35 @@ static if (is(R == struct)) { + R result; self.msgSendSuper_stret(result, sel, objcArgs); - } - - else static if (is(R : ObjcWrapper)) - { - id r = self.msgSendSuper(sel, objcArgs); - if (isCapsule(r)) - { - result = decapsule!(R)(r); - - if (result) - return result; - } - - return r ? new R(r) : null; + return result; } - else static if (is(R : Object)) - { - id r = self.msgSendSuper(sel, objcArgs); - return decapsule!(R)(r); - } + else static if (needsEncapsulation!(R)) + return decapsule!(R)(self.msgSendSuper(sel, objcArgs)); else - return self.msgSend!(R)(sel, objcArgs); + return self.msgSendSuper!(R, ObjcTypes!(ARGS))(sel, objcArgs); } + /** + * This method wraps a call to a regular C free function, decapsulating arguments and + * encapsulating the return value as appropriate. + * + * Params: + * R = the return type + * func = the function to call + * ARGS = the argument types + * args = the arguments to the function + * + * Returns: whatever the method returns, encapsulaed + */ R invokeObjcFunction (R, alias func, ARGS...) (ARGS args) - { - static if (!is(R : void)) - R result; - - auto funcPtr = &func; // use a function pointer instead of the alias because the function can be private. - - alias ReplaceAllClasses!(id, ARGS) ObjcArgs; - ObjcArgs objcArgs; + { + auto funcPtr = &func; // use a function pointer instead of the alias because the function may not be public. + ObjcTypes!(ARGS) objcArgs; foreach (i, a ; args) { @@ -448,35 +834,10 @@ objcArgs[i] = encapsule!(ArgType)(a); } - static if (is(R : ObjcWrapper)) - { - id r = funcPtr(objcArgs); - - if (!r) - return null; - - if (isCapsule(r)) - { - result = decapsule!(R)(r); - - if (result) - return result; - } - - return new R(r); - } - - else static if (is(R : Object)) - { - id r = funcPtr(objcArgs); - - if (!r) - return null; - - return decapsule!(R)(r); - } + static if (is(R == void)) + funcPtr(objcArgs); else - return funcPtr(objcArgs); + return decapsule!(R)(funcPtr(objcArgs)); } } \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/objc/bridge/Capsule.d --- a/dstep/objc/bridge/Capsule.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/objc/bridge/Capsule.d Sun Jan 03 22:06:11 2010 +0100 @@ -11,14 +11,12 @@ import tango.core.Memory; import tango.math.Math : log2; - alias GC.addRoot addRoot; - import tango.core.Traits; } else { - import std.gc : addRoot; + import GC = std.gc : addRoot; import std.math : log2; } @@ -32,8 +30,7 @@ import dstep.objc.runtime; import bindings = dstep.objc.bindings; -import mambo.io; - +/// Returns the capsule class Class capsuleClass () { if (!Capsule.capsuleClass) @@ -92,7 +89,7 @@ Capsule.capsuleClass = objc.allocateClassPair!("D_Object")(superClass, 0); ubyte alignment = cast(ubyte) log2(Bridge.DObjectType.sizeof); - + Capsule.capsuleClass.addIvar!(Bridge.dObjectVar, encode!(Bridge.DObjectType))(Bridge.DObjectType.sizeof, alignment); Capsule.capsuleClass.addMethod!(encodeCallable!(Capsule.description))(sel.registerName!("description"), cast(IMP) &Capsule.description); @@ -102,15 +99,57 @@ objc.registerClassPair(capsuleClass); } -bool isCapsule (id capsule) -{ - if (!capsule) - return false; +/** + * Returns $(D_KEYWORD true) if the given Objective-C instance is a capsule + * + * Params: + * instance = the Objective-C instance + * + * Returns: $(D_KEYWORD true) if the given Objective-C instance is a capsule + */ +bool isCapsule (id instance) +{ + //if (capsule && capsule.isa) + //return capsule.isa.getInstanceVariable!(Bridge.dObjectVar) !is null; - Class cls = capsule.isa; - return cls.getInstanceVariable!(Bridge.dObjectVar) !is null; + if (instance) + { + Class cls = instance.isa; + + while (cls && cls !is capsuleClass) + cls = cls.super_class; + + return cls is capsuleClass; + } + + return false; } +/** + * Returns $(D_KEYWORD true) if the given Objective-C class is a capsule + * + * Params: + * cls = the Objective-C class + * + * Returns: true if the given Objective-C class is a capsule + */ +bool isCapsule (Class cls) +{ + while (cls && cls !is capsuleClass) + cls = cls.super_class; + + return cls is capsuleClass; +} + +/** + * Encapsulate the value of type $(D_PARAM T) to corresponding Objective-C type $(D_PSYMBOL ObjcType!(T)) + * + * Params: + * T = the type of the value + * value = the value to encapsulate + * + * Returns: the encapsulated value + */ ObjcType!(T) encapsule (T) (T value) { static if (needsEncapsulation!(T)) @@ -121,28 +160,38 @@ if (auto wrapper = cast(ObjcWrapper) value) return wrapper.objcObject; - return Capsule.create(value, capsuleClass); + static if (is(T == interface)) + return Capsule.create(cast(Object) value, capsuleClass); + + return Capsule.create(cast(Object) value, capsuleClass); } else return value; } +/** + * Decapsulate the given Objective-C value of type $(D_PSYMBOL ObjcType!(T)) to corresponding D type $(D_PARAM T). + * + * Params: + * T = the type of the decapsulated value + * value = the value to decapsulate + * + * Returns: the decapsulated value + */ T decapsule (T) (ObjcType!(T) value) { static if (needsEncapsulation!(T)) - { - if (isCapsule(value)) - return cast(T) Bridge.getDObject(value); + { + static if (hasIdConstructor!(T)) + { + T instance = cast(T) Bridge.getDObject(value); + + return instance ? instance : new T(value); + } else - { - static if (is(T : ObjcWrapper)) - new T(value); - - else - return null; - } + return cast(T) Bridge.getDObject(value); } else diff -r 7ff919f595d5 -r 19885b43130e dstep/objc/bridge/ClassInitializer.d --- a/dstep/objc/bridge/ClassInitializer.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/objc/bridge/ClassInitializer.d Sun Jan 03 22:06:11 2010 +0100 @@ -13,114 +13,233 @@ import std.math; import dstep.internal.String; +import dstep.internal.Traits; import bindings = dstep.objc.bindings; import dstep.objc.bridge.Bridge; import dstep.objc.bridge.TypeEncoding; import dstep.objc.objc; import dstep.objc.runtime; +/** + * Objective-C subclass initializer template. + * + * Param: + * subclassName = the name of the subclass to create + * superClassName = the name of the Objective-C superclass + */ package template ObjcSubclassInitializer (string subclassName, string superclassName) -{ - import dstep.internal.String : string; - import dstep.objc.bridge.Bridge : ObjcBindMethod; - import dstep.objc.runtime : Method, objc_method, sel, objc; - import dstep.objc.bridge.TypeEncoding : encode; - - static Class objcClass () +{ + /** + * Return a pointer to the created class data structure. If this class hasn't been added + * to the Objective-C runtime, it'll be added. + * + * Returns: a pointer to the created class data structure + */ + static dstep.objc.objc.Class objcClass () { - if (objcClass_) - return objcClass_; + if (__objcClass) + return __objcClass; - Class superClass = cast(Class) objc.getClass!(superclassName); + dstep.objc.objc.Class superClass = objcSuperClass; - while (!superClass) - superClass = super.objcClass; - - return objcClass_ = subclassInit!(subclassName)(superClass, collectObjcInstanceMethods, collectObjcClassMethods); + auto methods = __collectObjcInstanceMethods(); + auto classMethods = __collectObjcClassMethods(); + + static if (dstep.internal.Traits.hasClassMethod!(typeof(super), objcClass.stringof)) + typeof(super).objcClass; + + return __objcClass = dstep.objc.bridge.ClassInitializer.subclassInit!(subclassName)(superClass, methods, classMethods); } - private static Method[] collectObjcInstanceMethods () + /** + * Return a pointer to the superclass data structure. If the superclass hasn't been added + * to the Objective-C runtime, it'll be added. + * + * Returns: a pointer to the superclass data structure + */ + static dstep.objc.objc.Class objcSuperClass () { - Method[] methods; + if (__objcSuperClass) + return __objcSuperClass; + + if (is(typeof(super) == dstep.objc.bridge.Wrapper.ObjcWrapper)) // root class + return __objcSuperClass = dstep.objc.bridge.Capsule.capsuleClass; + + __objcSuperClass = cast(dstep.objc.objc.Class) dstep.objc.objc.objc.getClass!(subclassName); + + while (!__objcSuperClass && !is(typeof(super) == dstep.objc.bridge.Wrapper.ObjcWrapper)) + __objcSuperClass = super.objcClass; - mixin("alias " ~ superclassName ~ " Type;"); + if (!__objcSuperClass) + __objcSuperClass = dstep.objc.bridge.Capsule.capsuleClass; - foreach (i, f; typeof(Type.tupleof)) + return __objcSuperClass; + } + + /** + * Collects all binded methods in the class this template is mixed into. + * + * Returns: an array of methods + */ + private static dstep.objc.runtime.Method[] __collectObjcInstanceMethods () + { + dstep.objc.runtime.Method[] methods; + + mixin("alias " ~ subclassName ~ " Type;"); + + static if (Type.tupleof.length > 0) { - const len = Type.stringof.length; - const fieldName = Type.tupleof[i].stringof[1 + len + 2 .. $]; - - static if (fieldName == Bridge.objcMethodDeclarationVar) + foreach (i, f ; typeof(Type.tupleof)) { - typeof(Type.tupleof[i]) field; + const len = Type.stringof.length; + const fieldName = Type.tupleof[i].stringof[1 + len + 2 .. $]; + + static if (fieldName == dstep.objc.bridge.Bridge.Bridge.objcMethodDeclarationVar) + { + typeof(Type.tupleof[i]) field; - Method m = new objc_method; - m.method_name = sel.registerName!(field.methodName); - m.method_types = encode!(field.returnType, id, SEL, field.argsType).ptr; - m.method_imp = cast(IMP) &Type.ObjcBindMethod!(field.methodImp, field.returnType, field.methodName, field.argsType).forwardVirtualCall; - - methods ~= m; + dstep.objc.runtime.Method m = new dstep.objc.objc.objc_method; + m.method_name = dstep.objc.objc.sel.registerName!(field.methodName); + m.method_types = dstep.objc.bridge.TypeEncoding.encode!(field.returnType, dstep.objc.objc.id, dstep.objc.objc.SEL, field.argsType).ptr; + m.method_imp = cast(dstep.objc.objc.IMP) field.methodImp; + + methods ~= m; + } } } return methods; } - private static Method[] collectObjcClassMethods () + /** + * Collects all binded class methods in the class this template is mixed into. + * + * Returns: + */ + private static dstep.objc.runtime.Method[] __collectObjcClassMethods () { - Method[] methods; + dstep.objc.runtime.Method[] methods; - mixin("alias " ~ superclassName ~ " Type;"); + mixin("alias " ~ subclassName ~ " Type;"); - foreach (i, f; typeof(Type.tupleof)) + static if (Type.tupleof.length > 0) { - const len = Type.stringof.length; - const fieldName = Type.tupleof[i].stringof[1 + len + 2 .. $]; - - static if (fieldName == Bridge.objcClassMethodDeclarationVar) + foreach (i, f ; typeof(Type.tupleof)) { - typeof(Type.tupleof[i]) field; - - Method m = new objc_method; - m.method_name = sel.registerName!(field.methodName); - m.method_types = encode!(field.returnType, field.argsType).ptr; - m.method_imp = cast(IMP) &Type.ObjcBindClassMethod!(field.methodImp, field.returnType, field.methodName, field.argsType).forwardStaticCall; + const len = Type.stringof.length; + const fieldName = Type.tupleof[i].stringof[1 + len + 2 .. $]; - methods ~= m; + static if (fieldName == dstep.objc.bridge.Bridge.Bridge.objcClassMethodDeclarationVar) + { + typeof(Type.tupleof[i]) field; + + dstep.objc.runtime.Method m = new dstep.objc.objc.objc_method; + m.method_name = dstep.objc.objc.sel.registerName!(field.methodName); + m.method_types = dstep.objc.bridge.TypeEncoding.encode!(field.returnType, field.argsType).ptr; + m.method_imp = cast(dstep.objc.objc.IMP) field.methodImp; + + methods ~= m; + } } } return methods; } - - private R invokeObjcSelf (R, string name, ARGS...) (ARGS args) + + /** + * Invoke on the receiver the instance method with the given name, return type + * and arguments. + * + * Params: + * R = the return type + * name = the name (selector) of the method to invoke + * ARGS = the type of the arguments + * args = the arguments to the method + * + * Returns: whatever the method returns + */ + private R invokeObjcSelf (R, dstep.internal.String.string name, ARGS...) (ARGS args) { - return Bridge.invokeObjcMethod!(R, name, ARGS)(objcObject, args); + return dstep.objc.bridge.Bridge.Bridge.invokeObjcMethod!(R, name, ARGS)(this.objcObject, args); } - private R invokeObjcSuper (R, string name, ARGS...) (ARGS args) + /** + * Invoke on the receiver's super part the instance method with the given name, + * return type and arguments. + * + * Params: + * R = the return type + * name = the name (selector) of the method to invoke + * ARGS = the type of the arguments + * args = the arguments to the method + * + * Returns: whatever the method returns + */ + private R invokeObjcSuper (R, dstep.internal.String.string name, ARGS...) (ARGS args) { - return Bridge.invokeObjcMethod!(R, name, ARGS)(objcSuper, args); + return dstep.objc.bridge.Bridge.Bridge.invokeObjcSuperMethod!(R, name, ARGS)(this.objcSuper, args); } - private static R invokeObjcSelfClass (R, string name, ARGS...) (ARGS args) + /** + * Invoke class method with given name, return type and arguments, + * on the receiver's superclass. + * + * Params: + * R = the return type + * name = the name (selector) of the method to invoke + * ARGS = the type of the arguments + * args = the arguments to the method + * + * Returns: whatever the method returns + */ + private static R invokeObjcSelfClass (R, dstep.internal.String.string name, ARGS...) (ARGS args) { - return Bridge.invokeObjcClassMethod!(R, name, ARGS)(objcClass, args); + return dstep.objc.bridge.Bridge.Bridge.invokeObjcClassMethod!(R, name, ARGS)(objcClass, args); } - private static R invokeObjcSuperClass (R, string name, ARGS...) (ARGS args) - { - return Bridge.invokeObjcClassMethod!(R, name, ARGS)(objcSuperClass, args); + /** + * Invoke class method with given name, return type and arguments, + * on the receiver's superclass. + * + * Params: + * R = the return type + * name = the name (selector) of the method to invoke + * ARGS = the type of the arguments + * args = the arguments to the method + * + * Returns: whatever the method returns + */ + private static R invokeObjcSuperClass (R, dstep.internal.String.string name, ARGS...) (ARGS args) + { + return dstep.objc.bridge.Bridge.Bridge.invokeObjcClassMethod!(R, name, ARGS)(objcSuperClass, args); } } +/** + * Creates a new Objective-C subclass, initializes its data and register it with the + * Objective-C runtime. + * + * Params: + * className = the name of the subclass + * superClass = the subclass' superclass + * instanceMethods = the instance methods that should be added to the subclass + * classMethods = the class methods that should be added to the subclass + * + * Returns: the newly created subclass + */ Class subclassInit (string className) (Class superClass, Method[] instanceMethods = null, Method[] classMethods = null) { - Class cls = objc.allocateClassPair!(className)(superClass, 0); + Class cls; + + if (objc.getClass!(className)) + cls = objc.allocateClassPair!("D_" ~ className)(superClass, 0); + + else + cls = objc.allocateClassPair!(className)(superClass, 0); + Class metaClass = (cast(id) cls).getClass; ubyte alignment = cast(ubyte) log2(Bridge.DObjectType.sizeof); - cls.addIvar!(Bridge.dObjectVar, encode!(Bridge.DObjectType))(Bridge.DObjectType.sizeof, alignment); foreach (method ; instanceMethods) diff -r 7ff919f595d5 -r 19885b43130e dstep/objc/bridge/Type.d --- a/dstep/objc/bridge/Type.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/objc/bridge/Type.d Sun Jan 03 22:06:11 2010 +0100 @@ -7,15 +7,24 @@ module dstep.objc.bridge.Type; version (Tango) - import tango.core.Tuple; + import tango.core.Tuple : Tuple; else - import std.typetuple; + import std.typetuple : Tuple; import dstep.objc.objc; +/** + * Evaluates to the Objective-C equivalent type for $(D_PARAM T). + * + * Examples: + * --- + * static assert(is(ObjcType!(Object) == id)); + * static assert(is(ObjcType!(int) == int)); + * --- + */ template ObjcType (T) -{ +{ static if (needsEncapsulation!(T)) alias id ObjcType; @@ -23,32 +32,73 @@ alias T ObjcType; } +/** + * Evaluates to $(D_KEYWORD true) if $(D_PARAM T) needs to be encapsulated. + * + * Examples: + * --- + * static assert(needsEncapsulation!(Object)); + * static assert(!needsEncapsulation!(int)); + * --- + */ template needsEncapsulation (T) { - static if (is(T == class)) + static if (is(T == class) || is (T : Object) || is(T == interface)) const needsEncapsulation = true; else const needsEncapsulation = false; } -template ObjcTypeTuple (TList...) +/** + * Evaluates to a tuple of Objective-C equivalent types. + * + * Examples: + * --- + * static assert(is(typeof(ObjcTypes!(id, Object, id)) == typeof(Tuple!(id, id, id)))); + * static assert(is(typeof(ObjcTypes!(id, id, id)) == typeof(Tuple!(id, id, id)))); + * --- + */ +template ObjcTypes (Types...) { - alias replaceClasses!(TList).types ObjcTypeTuple; -} - -private struct Wrap (TList...) -{ - TList types; + alias EncapsulateTypes!(id, Types) ObjcTypes; } -private Wrap!(TList) replaceClasses (TList...) () +/** + * Evaluates to $(D_KEYWORD true) if $(D_PARAM T) has a constructor that takes one + * argument of the type $(D_PSYMBOL id). + * + * Examples: + * --- + * class NSString : NSObject + * { + * this (id object) + * { + * super(object); + * } + * } + * + * static assert(hasIdConstructor!(NSString)); + * static assert(!hasIdConstructor!(Object)); + * --- + */ +template hasIdConstructor (T) { - alias Tuple!(TList) Types; + const hasIdConstructor = is(typeof( + { + objc_object o; + new T(&o); + })); +} + +private template EncapsulateTypes (U, TList... ) +{ + static if( TList.length == 0 ) + alias TList EncapsulateTypes; - foreach (ref type ; Types) - static if (is(type == class)) - type = id; + else static if(needsEncapsulation!(TList[0])) + alias Tuple!( U, EncapsulateTypes!(U, TList[1 .. $] ) ) EncapsulateTypes; - return Wrap!(Types); + else + alias Tuple!( TList[0], EncapsulateTypes!( U, TList[1 .. $] ) ) EncapsulateTypes; } \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/objc/bridge/TypeEncoding.d --- a/dstep/objc/bridge/TypeEncoding.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/objc/bridge/TypeEncoding.d Sun Jan 03 22:06:11 2010 +0100 @@ -14,6 +14,7 @@ import dstep.internal.String; import dstep.internal.Traits; +import dstep.objc.bridge.Type; import dstep.objc.objc; import dstep.objc.runtime; @@ -32,7 +33,7 @@ foreach (T ; TL) { - static if (is (T == id) || is (T == class)) + static if (is (T == id) || needsEncapsulation!(T)) s ~= _C_ID; else static if (is (T == Class)) @@ -111,6 +112,22 @@ const encodeCallable = encode!(ReturnTypeOf!(typeof(Callable)), id, SEL, ParameterTupleOf!(typeof(Callable))); } +template checkSelector (string selector, ARGS...) +{ + const checkSelector = checkSelectorImpl!(selector, ARGS); +} + +private bool checkSelectorImpl (string selector, ARGS...) () +{ + size_t i = 0; + + foreach (c ; selector) + if (c == ':') + i++; + + return i == ARGS.length; +} + /** * Builds a string representing a selector out of the given function * @@ -154,10 +171,27 @@ return result; } -/** - * Converts the given string representing of a OSType into an integer. - */ +template decimalDigit (int n) // [3] +{ + const string decimalDigit = "0123456789"[n .. n + 1]; +} + +template itoa (long n) +{ + static if (n < 0) + const string itoa = "-" ~ itoa!(-n); + + else static if (n < 10) + const string itoa = decimalDigit!(n); + + else + const string itoa = itoa!(n / 10L) ~ decimalDigit!(n % 10L); +} + + +/// Converts the given string representing an OSType into an integer. template getOSType (string osType) { + static assert(osType.length == 4, `dstep.objc.bridge.TypeEncoding.getOSType: The length of the given string, "` ~ osType ~ `", is not four`); const getOSType = (cast(int)osType[0]) << 24 | (cast(int)osType[1]) << 16 | (cast(int)osType[2]) << 8 | (cast(int)osType[3]); } \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/objc/bridge/Wrapper.d --- a/dstep/objc/bridge/Wrapper.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/objc/bridge/Wrapper.d Sun Jan 03 22:06:11 2010 +0100 @@ -13,37 +13,43 @@ import dstep.objc.objc; import dstep.objc.runtime; -class ObjcWrapper +/// Wrapper class for an Objective-C object. +abstract class ObjcWrapper { - static private Class objcClass_; static private Class objcSuperClass_; private id objcObject_; private objc_super* objcSuper_; - - this () - { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id ret = Bridge.invokeObjcMethod!(id, "init")(objcObject); - if (ret) - objcObject = ret; - - dObject = this; - } - - /// Initialize object from an Objective-C object instance to wrap. + /// Initializes object from an Objective-C object instance to wrap. this (id object) { - objcObject_ = object; + objcObject = object; dObject = this; } + /// Initializes object from another wrapper. + this (ObjcWrapper wrapper) + { + if (wrapper) + this(wrapper.objcObject); + + else + this(cast(id) null); + } + + ~this () + { + Bridge.deregisterObjcInstance(objcObject_); + } + + /// Returns the Objective-C class for this wrapper static Class objcClass () { return capsuleClass; } + /// Returns the Objective-C superclass for this wrapper static Class objcSuperClass () { if (!objcSuperClass_) @@ -52,22 +58,26 @@ return objcSuperClass_; } - id objcObject () + /// Gets the Objective-C object instance pointer. + final id objcObject () { return objcObject_; } - protected id objcObject (id object) + /// Sets the Objective-C object instance pointer. + protected final id objcObject (id object) { return objcObject_ = object; } - protected void dObject (Object dObject) + /// Sets the D object in the receiver's Objective-C instance + protected final void dObject (Object dObject) { - Bridge.setDObject(dObject, objcObject); + Bridge.instance.setDObject(dObject, objcObject); } - objc_super* objcSuper () + /// Gets the objc_super instance of the receiver + protected final objc_super* objcSuper () { if (!objcSuper_) { diff -r 7ff919f595d5 -r 19885b43130e dstep/objc/message.d --- a/dstep/objc/message.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/objc/message.d Sun Jan 03 22:06:11 2010 +0100 @@ -35,7 +35,7 @@ R msgSendSuper (R = id, ARGS...) (SEL op, ARGS args) { - alias extern (C) R function (id, SEL, ARGS) fp; + alias extern (C) R function (objc_super*, SEL, ARGS) fp; return (cast(fp)&bindings.objc_msgSendSuper)(this, op, args); } @@ -43,13 +43,13 @@ { if (T.sizeof > STRUCT_SIZE_LIMIT) { - alias extern (C) void function (T*, id, SEL, ARGS) fp; + alias extern (C) void function (T*, objc_super*, SEL, ARGS) fp; (cast(fp)&bindings.objc_msgSendSuper_stret)(&stretAddr, self, op, args); } else { - alias extern (C) T function (id, SEL, ARGS) fp; + alias extern (C) T function (objc_super*, SEL, ARGS) fp; stretAddr = (*cast(fp)&bindings.objc_msgSendSuper)(self, op, args); } } @@ -99,14 +99,12 @@ R method_invoke (R = id, ARGS...) (id receiver, Method m, ARGS args) { - static assert(receiver !is null); alias extern (C) R function (id, SEL, ARGS) fp; return (cast(fp)&bindings.method_invoke)(receiver, m, args); } void method_invoke_stret (ARGS...) (id receiver, Method m, ARGS args) { - static assert(receiver !is null); alias extern (C) R function (id, SEL, ARGS) fp; return (cast(fp)&bindings.method_invoke_stret)(receiver, m, args); } diff -r 7ff919f595d5 -r 19885b43130e dstep/objc/objc.d --- a/dstep/objc/objc.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/objc/objc.d Sun Jan 03 22:06:11 2010 +0100 @@ -34,8 +34,6 @@ { Class isa; - - // D Extensions: string getClassName () @@ -155,13 +153,13 @@ static if (dstep.internal.Version.X86 || X86_64) { - R msgSend_fpret (R = id, ARGS...) (SEL op, ARGS args) + R msgSend_fpret (R, ARGS...) (SEL op, ARGS args) { version (X86_64) - static assert(!is(R == real), "dstep.objc.objc.objc_object.msgSend_fpret: Only real are legal return value for objc_msgSend_fpret"); + static assert(is(R == real), "dstep.objc.objc.objc_object.msgSend_fpret: Only real are legal return value for objc_msgSend_fpret"); else - static assert(!is(R == double) && !is(R == float), "dstep.objc.objc.objc_object.msgSend_fpret: Only double and float are legal return values for objc_msgSend_fpret"); + static assert(is(R == double) || is(R == float), "dstep.objc.objc.objc_object.msgSend_fpret: Only double and float are legal return values for objc_msgSend_fpret"); alias extern (C) R function (id, SEL, ARGS) fp; return (cast(fp)&bindings.objc_msgSend_fpret)(this, op, args); @@ -235,4 +233,107 @@ { return bindings.sel_isMapped(this); } +} + + +//D Extensions: + +struct objc +{ + static string[] copyImageNames (out uint outCount) + { + string[] ret; + + char** result = bindings.objc_copyImageNames(&outCount); + ret.length = outCount; + + for (size_t i = 0; i < outCount; i++) + ret[i] = fromStringz(result[i]); + + return ret; + } + + alias bindings.objc_enumerationMutation objc_enumerationMutation; + alias bindings.objc_setForwardHandler objc_setForwardHandler; + alias bindings.objc_setMultithreaded objc_setMultithreaded; + + static id getClass (string name) () + { + return bindings.objc_getClass(name.ptr); + } + + static id getMetaClass (string name) () + { + return bindings.objc_getMetaClass(name.ptr); + } + + static id lookUpClass (string name) () + { + return bindings.objc_lookUpClass(name.ptr); + } + + static id getRequiredClass (string name) () + { + return bindings.objc_getRequiredClass(name.ptr); + } + + static Class getFutureClass (string name) () + { + return bindings.objc_getFutureClass(name.ptr); + } + + static string[] objc_copyClassNamesForImage (string image) (out uint outCount) + { + string[] ret; + + char** result = bindings.objc_copyClassNamesForImage(image.ptr, &outCount); + ret.length = outCount; + + for (size_t i = 0; i < outCount; i++) + ret[i] = fromStringz(result[i]); + + return ret; + } + + static Class objc_getOrigClass (string name) () + { + return bindings.objc_getOrigClass(name.ptr); + } + + static Class allocateClassPair (string name) (Class superclass, size_t extraBytes) + { + return bindings.objc_allocateClassPair(superclass, name.ptr, extraBytes); + } + + alias bindings.objc_registerClassPair registerClassPair; + alias bindings.objc_disposeClassPair disposeClassPair; + alias bindings.objc_getClasses getClasses; + alias bindings.objc_addClass addClass; + alias bindings.class_createInstance createInstance; +} + +struct property +{ + static string getName (objc_property_t* property) + { + return fromStringz(bindings.property_getName(property)); + } + + static string getAttributes (objc_property_t* property) + { + return fromStringz(bindings.property_getAttributes(property)); + } +} + +struct sel +{ + static SEL getUid (string str) () + { + return bindings.sel_getUid(str.ptr); + } + + static SEL registerName (string str) () + { + return bindings.sel_registerName(str.ptr); + } } \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/objc/runtime.d --- a/dstep/objc/runtime.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/objc/runtime.d Sun Jan 03 22:06:11 2010 +0100 @@ -15,10 +15,11 @@ import dstep.objc.message; import dstep.objc.objc; +struct objc_property; + alias objc_method* Method; alias objc_ivar* Ivar; alias objc_category* Category; -alias void* objc_property; alias objc_property* objc_property_t; alias objc_object Protocol; alias objc_symtab* Symtab; @@ -784,113 +785,4 @@ alias bindings.method_getSizeOfArguments method_getSizeOfArguments; alias bindings.class_respondsToMethod class_respondsToMethod; alias bindings.class_lookupMethod class_lookupMethod; -alias bindings.class_nextMethodList class_nextMethodList; - - - - - - - - -// D Extensions: - -struct objc -{ - static string[] copyImageNames (out uint outCount) - { - string[] ret; - - char** result = bindings.objc_copyImageNames(&outCount); - ret.length = outCount; - - for (size_t i = 0; i < outCount; i++) - ret[i] = fromStringz(result[i]); - - return ret; - } - - alias bindings.objc_enumerationMutation objc_enumerationMutation; - alias bindings.objc_setForwardHandler objc_setForwardHandler; - alias bindings.objc_setMultithreaded objc_setMultithreaded; - - static id getClass (string name) () - { - return bindings.objc_getClass(name.ptr); - } - - static id getMetaClass (string name) () - { - return bindings.objc_getMetaClass(name.ptr); - } - - static id lookUpClass (string name) () - { - return bindings.objc_lookUpClass(name.ptr); - } - - static id getRequiredClass (string name) () - { - return bindings.objc_getRequiredClass(name.ptr); - } - - static Class getFutureClass (string name) () - { - return bindings.objc_getFutureClass(name.ptr); - } - - static string[] objc_copyClassNamesForImage (string image) (out uint outCount) - { - string[] ret; - - char** result = bindings.objc_copyClassNamesForImage(image.ptr, &outCount); - ret.length = outCount; - - for (size_t i = 0; i < outCount; i++) - ret[i] = fromStringz(result[i]); - - return ret; - } - - static Class objc_getOrigClass (string name) () - { - return bindings.objc_getOrigClass(name.ptr); - } - - static Class allocateClassPair (string name) (Class superclass, size_t extraBytes) - { - return bindings.objc_allocateClassPair(superclass, name.ptr, extraBytes); - } - - alias bindings.objc_registerClassPair registerClassPair; - alias bindings.objc_disposeClassPair disposeClassPair; - alias bindings.objc_getClasses getClasses; - alias bindings.objc_addClass addClass; - alias bindings.class_createInstance createInstance; -} - -struct property -{ - static string property_getName (objc_property_t* property) - { - return fromStringz(bindings.property_getName(property)); - } - - static string property_getAttributes (objc_property_t* property) - { - return fromStringz(bindings.property_getAttributes(property)); - } -} - -struct sel -{ - static SEL getUid (string str) () - { - return bindings.sel_getUid(str.ptr); - } - - static SEL registerName (string str) () - { - return bindings.sel_registerName(str.ptr); - } -} \ No newline at end of file +alias bindings.class_nextMethodList class_nextMethodList; \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/opengl/CGLContext.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/opengl/CGLContext.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,23 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.opengl.CGLContext; + +import dstep.opengl.gliContext; +import dstep.opengl.gliDispatch; + +struct _CGLPrivateObject; + +alias _CGLPrivateObject* CGLPrivateObj; + +struct _CGLContextObject +{ + GLIContext rend; + GLIFunctionDispatch disp; + CGLPrivateObj priv; + void* stak; +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/opengl/CGLCurrent.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/opengl/CGLCurrent.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,15 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.opengl.CGLCurrent; + +import dstep.opengl.CGLTypes; + +extern (C) +{ + int CGLSetCurrentContext (CGLContextObj ctx); + CGLContextObj CGLGetCurrentContext (); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/opengl/CGLMacro.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/opengl/CGLMacro.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,11 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.opengl.CGLMacro; + +import dstep.opengl.CGLContext; +import dstep.opengl.CGLTypes; + diff -r 7ff919f595d5 -r 19885b43130e dstep/opengl/CGLProfiler.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/opengl/CGLProfiler.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,7 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.opengl.CGLProfiler; \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/opengl/CGLProfilerFunctionEnum.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/opengl/CGLProfilerFunctionEnum.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,747 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.opengl.CGLProfilerFunctionEnum;enum +{ + kCGLFECGLChoosePixelFormat = 0, + kCGLFECGLClearDrawable, + kCGLFECGLComment, + kCGLFECGLCopyContext, + kCGLFECGLCreateContext, + kCGLFECGLCreatePBuffer, + kCGLFECGLDescribePBuffer, + kCGLFECGLDescribePixelFormat, + kCGLFECGLDescribeRenderer, + kCGLFECGLDestroyContext, + kCGLFECGLDestroyPBuffer, + kCGLFECGLDestroyPixelFormat, + kCGLFECGLDestroyRendererInfo, + kCGLFECGLDisable, + kCGLFECGLEnable, + kCGLFECGLFlushDrawable, + kCGLFECGLGetCurrentContext, + kCGLFECGLGetFullScreen, + kCGLFECGLGetOffScreen, + kCGLFECGLGetOption, + kCGLFECGLGetParameter, + kCGLFECGLGetPBuffer, + kCGLFECGLGetSurface, + kCGLFECGLGetVersion, + kCGLFECGLGetVirtualScreen, + kCGLFECGLIsEnabled, + kCGLFECGLQueryRendererInfo, + kCGLFECGLSetCurrentContext, + kCGLFECGLSetFullScreen, + kCGLFECGLSetOffScreen, + kCGLFECGLSetOption, + kCGLFECGLSetParameter, + kCGLFECGLSetPBuffer, + kCGLFECGLSetSurface, + kCGLFECGLSetVirtualScreen, + kCGLFECGLTexImagePBuffer, + kCGLFECGLUpdateContext, + kCGLFEglAccum, + kCGLFEglActiveStencilFaceEXT, + kCGLFEglActiveTexture, + kCGLFEglAlphaFunc, + kCGLFEglAreTexturesResident, + kCGLFEglArrayElement, + kCGLFEglAttachObjectARB, + kCGLFEglBegin, + kCGLFEglBeginQuery, + kCGLFEglBindAttribLocationARB, + kCGLFEglBindBuffer, + kCGLFEglBindFramebufferEXT, + kCGLFEglBindProgramARB, + kCGLFEglBindRenderbufferEXT, + kCGLFEglBindTexture, + kCGLFEglBindVertexArrayEXT, + kCGLFEglBitmap, + kCGLFEglBlendColor, + kCGLFEglBlendEquation, + kCGLFEglBlendEquationSeparateEXT, + kCGLFEglBlendFunc, + kCGLFEglBlendFuncSeparate, + kCGLFEglBufferData, + kCGLFEglBufferSubData, + kCGLFEglCallList, + kCGLFEglCallLists, + kCGLFEglCheckFramebufferStatusEXT, + kCGLFEglClear, + kCGLFEglClearAccum, + kCGLFEglClearColor, + kCGLFEglClearDepth, + kCGLFEglClearIndex, + kCGLFEglClearStencil, + kCGLFEglClientActiveTexture, + kCGLFEglClipPlane, + kCGLFEglColor3b, + kCGLFEglColor3bv, + kCGLFEglColor3d, + kCGLFEglColor3dv, + kCGLFEglColor3f, + kCGLFEglColor3fv, + kCGLFEglColor3i, + kCGLFEglColor3iv, + kCGLFEglColor3s, + kCGLFEglColor3sv, + kCGLFEglColor3ub, + kCGLFEglColor3ubv, + kCGLFEglColor3ui, + kCGLFEglColor3uiv, + kCGLFEglColor3us, + kCGLFEglColor3usv, + kCGLFEglColor4b, + kCGLFEglColor4bv, + kCGLFEglColor4d, + kCGLFEglColor4dv, + kCGLFEglColor4f, + kCGLFEglColor4fv, + kCGLFEglColor4i, + kCGLFEglColor4iv, + kCGLFEglColor4s, + kCGLFEglColor4sv, + kCGLFEglColor4ub, + kCGLFEglColor4ubv, + kCGLFEglColor4ui, + kCGLFEglColor4uiv, + kCGLFEglColor4us, + kCGLFEglColor4usv, + kCGLFEglColorMask, + kCGLFEglColorMaterial, + kCGLFEglColorPointer, + kCGLFEglColorSubTable, + kCGLFEglColorTable, + kCGLFEglColorTableParameterfv, + kCGLFEglColorTableParameteriv, + kCGLFEglCombinerInputNV, + kCGLFEglCombinerOutputNV, + kCGLFEglCombinerParameterfNV, + kCGLFEglCombinerParameterfvNV, + kCGLFEglCombinerParameteriNV, + kCGLFEglCombinerParameterivNV, + kCGLFEglCombinerStageParameterfvNV, + kCGLFEglCompileShaderARB, + kCGLFEglCompressedTexImage1D, + kCGLFEglCompressedTexImage2D, + kCGLFEglCompressedTexImage3D, + kCGLFEglCompressedTexSubImage1D, + kCGLFEglCompressedTexSubImage2D, + kCGLFEglCompressedTexSubImage3D, + kCGLFEglConvolutionFilter1D, + kCGLFEglConvolutionFilter2D, + kCGLFEglConvolutionParameterf, + kCGLFEglConvolutionParameterfv, + kCGLFEglConvolutionParameteri, + kCGLFEglConvolutionParameteriv, + kCGLFEglCopyColorSubTable, + kCGLFEglCopyColorTable, + kCGLFEglCopyConvolutionFilter1D, + kCGLFEglCopyConvolutionFilter2D, + kCGLFEglCopyPixels, + kCGLFEglCopyTexImage1D, + kCGLFEglCopyTexImage2D, + kCGLFEglCopyTexSubImage1D, + kCGLFEglCopyTexSubImage2D, + kCGLFEglCopyTexSubImage3D, + kCGLFEglCreateProgramObjectARB, + kCGLFEglCreateShaderObjectARB, + kCGLFEglCullFace, + kCGLFEglDeleteBuffers, + kCGLFEglDeleteFencesAPPLE, + kCGLFEglDeleteFramebuffersEXT, + kCGLFEglDeleteLists, + kCGLFEglDeleteObjectARB, + kCGLFEglDeleteProgramsARB, + kCGLFEglDeleteQueries, + kCGLFEglDeleteRenderbuffersEXT, + kCGLFEglDeleteTextures, + kCGLFEglDeleteVertexArraysEXT, + kCGLFEglDepthBoundsEXT, + kCGLFEglDepthFunc, + kCGLFEglDepthMask, + kCGLFEglDepthRange, + kCGLFEglDetachObjectARB, + kCGLFEglDisable, + kCGLFEglDisableClientState, + kCGLFEglDisableVertexAttribARB, + kCGLFEglDisableVertexAttribArrayARB, + kCGLFEglDrawArrays, + kCGLFEglDrawBuffer, + kCGLFEglDrawBuffersARB, + kCGLFEglDrawElementArrayAPPLE, + kCGLFEglDrawElements, + kCGLFEglDrawPixels, + kCGLFEglDrawRangeElementArrayAPPLE, + kCGLFEglDrawRangeElements, + kCGLFEglEdgeFlag, + kCGLFEglEdgeFlagPointer, + kCGLFEglEdgeFlagv, + kCGLFEglElementPointerAPPLE, + kCGLFEglEnable, + kCGLFEglEnableClientState, + kCGLFEglEnableVertexAttribARB, + kCGLFEglEnableVertexAttribArrayARB, + kCGLFEglEnd, + kCGLFEglEndList, + kCGLFEglEndQuery, + kCGLFEglEvalCoord1d, + kCGLFEglEvalCoord1dv, + kCGLFEglEvalCoord1f, + kCGLFEglEvalCoord1fv, + kCGLFEglEvalCoord2d, + kCGLFEglEvalCoord2dv, + kCGLFEglEvalCoord2f, + kCGLFEglEvalCoord2fv, + kCGLFEglEvalMesh1, + kCGLFEglEvalMesh2, + kCGLFEglEvalPoint1, + kCGLFEglEvalPoint2, + kCGLFEglFeedbackBuffer, + kCGLFEglFinalCombinerInputNV, + kCGLFEglFinish, + kCGLFEglFinishFenceAPPLE, + kCGLFEglFinishObjectAPPLE, + kCGLFEglFinishRenderAPPLE, + kCGLFEglFlush, + kCGLFEglFlushRenderAPPLE, + kCGLFEglFlushVertexArrayRangeEXT, + kCGLFEglFogCoordPointer, + kCGLFEglFogCoordd, + kCGLFEglFogCoorddv, + kCGLFEglFogCoordf, + kCGLFEglFogCoordfv, + kCGLFEglFogf, + kCGLFEglFogfv, + kCGLFEglFogi, + kCGLFEglFogiv, + kCGLFEglFramebufferRenderbufferEXT, + kCGLFEglFramebufferTexture1DEXT, + kCGLFEglFramebufferTexture2DEXT, + kCGLFEglFramebufferTexture3DEXT, + kCGLFEglFrontFace, + kCGLFEglFrustum, + kCGLFEglGenBuffers, + kCGLFEglGenerateMipmapEXT, + kCGLFEglGenFencesAPPLE, + kCGLFEglGenFramebuffersEXT, + kCGLFEglGenLists, + kCGLFEglGenProgramsARB, + kCGLFEglGenQueries, + kCGLFEglGenRenderbuffersEXT, + kCGLFEglGenTextures, + kCGLFEglGenVertexArraysEXT, + kCGLFEglGetActiveAttribARB, + kCGLFEglGetActiveUniformARB, + kCGLFEglGetAttachedObjectsARB, + kCGLFEglGetAttribLocationARB, + kCGLFEglGetBooleanv, + kCGLFEglGetBufferParameteriv, + kCGLFEglGetBufferPointerv, + kCGLFEglGetBufferSubData, + kCGLFEglGetClipPlane, + kCGLFEglGetColorTable, + kCGLFEglGetColorTableParameterfv, + kCGLFEglGetColorTableParameteriv, + kCGLFEglGetCombinerInputParameterfvNV, + kCGLFEglGetCombinerInputParameterivNV, + kCGLFEglGetCombinerOutputParameterfvNV, + kCGLFEglGetCombinerOutputParameterivNV, + kCGLFEglGetCombinerStageParameterfvNV, + kCGLFEglGetCompressedTexImage, + kCGLFEglGetConvolutionFilter, + kCGLFEglGetConvolutionParameterfv, + kCGLFEglGetConvolutionParameteriv, + kCGLFEglGetDoublev, + kCGLFEglGetError, + kCGLFEglGetFinalCombinerInputParameterfvNV, + kCGLFEglGetFinalCombinerInputParameterivNV, + kCGLFEglGetFloatv, + kCGLFEglGetFramebufferAttachmentParameterivEXT, + kCGLFEglGetHandleARB, + kCGLFEglGetHistogram, + kCGLFEglGetHistogramParameterfv, + kCGLFEglGetHistogramParameteriv, + kCGLFEglGetInfoLogARB, + kCGLFEglGetIntegerv, + kCGLFEglGetLightfv, + kCGLFEglGetLightiv, + kCGLFEglGetMapdv, + kCGLFEglGetMapfv, + kCGLFEglGetMapiv, + kCGLFEglGetMaterialfv, + kCGLFEglGetMaterialiv, + kCGLFEglGetMinmax, + kCGLFEglGetMinmaxParameterfv, + kCGLFEglGetMinmaxParameteriv, + kCGLFEglGetObjectParameterfvARB, + kCGLFEglGetObjectParameterivARB, + kCGLFEglGetPixelMapfv, + kCGLFEglGetPixelMapuiv, + kCGLFEglGetPixelMapusv, + kCGLFEglGetPointerv, + kCGLFEglGetPolygonStipple, + kCGLFEglGetProgramEnvParameterdvARB, + kCGLFEglGetProgramEnvParameterfvARB, + kCGLFEglGetProgramInfoLog, + kCGLFEglGetProgramLocalParameterdvARB, + kCGLFEglGetProgramLocalParameterfvARB, + kCGLFEglGetProgramStringARB, + kCGLFEglGetProgramiv, + kCGLFEglGetProgramivARB, + kCGLFEglGetQueryObjectiv, + kCGLFEglGetQueryObjectuiv, + kCGLFEglGetQueryiv, + kCGLFEglGetRenderbufferParameterivEXT, + kCGLFEglGetSeparableFilter, + kCGLFEglGetShaderInfoLog, + kCGLFEglGetShaderSourceARB, + kCGLFEglGetShaderiv, + kCGLFEglGetString, + kCGLFEglGetTexEnvfv, + kCGLFEglGetTexEnviv, + kCGLFEglGetTexGendv, + kCGLFEglGetTexGenfv, + kCGLFEglGetTexGeniv, + kCGLFEglGetTexImage, + kCGLFEglGetTexLevelParameterfv, + kCGLFEglGetTexLevelParameteriv, + kCGLFEglGetTexParameterPointervAPPLE, + kCGLFEglGetTexParameterfv, + kCGLFEglGetTexParameteriv, + kCGLFEglGetUniformLocationARB, + kCGLFEglGetUniformfvARB, + kCGLFEglGetUniformivARB, + kCGLFEglGetVertexAttribPointervARB, + kCGLFEglGetVertexAttribdvARB, + kCGLFEglGetVertexAttribfvARB, + kCGLFEglGetVertexAttribivARB, + kCGLFEglHint, + kCGLFEglHistogram, + kCGLFEglIndexMask, + kCGLFEglIndexPointer, + kCGLFEglIndexd, + kCGLFEglIndexdv, + kCGLFEglIndexf, + kCGLFEglIndexfv, + kCGLFEglIndexi, + kCGLFEglIndexiv, + kCGLFEglIndexs, + kCGLFEglIndexsv, + kCGLFEglIndexub, + kCGLFEglIndexubv, + kCGLFEglInitNames, + kCGLFEglInterleavedArrays, + kCGLFEglIsBuffer, + kCGLFEglIsEnabled, + kCGLFEglIsFenceAPPLE, + kCGLFEglIsFramebufferEXT, + kCGLFEglIsList, + kCGLFEglIsProgram, + kCGLFEglIsProgramARB, + kCGLFEglIsQuery, + kCGLFEglIsRenderbufferEXT, + kCGLFEglIsShader, + kCGLFEglIsTexture, + kCGLFEglIsVertexArrayEXT, + kCGLFEglIsVertexAttribEnabledARB, + kCGLFEglLightModelf, + kCGLFEglLightModelfv, + kCGLFEglLightModeli, + kCGLFEglLightModeliv, + kCGLFEglLightf, + kCGLFEglLightfv, + kCGLFEglLighti, + kCGLFEglLightiv, + kCGLFEglLineStipple, + kCGLFEglLineWidth, + kCGLFEglLinkProgramARB, + kCGLFEglListBase, + kCGLFEglLoadIdentity, + kCGLFEglLoadMatrixd, + kCGLFEglLoadMatrixf, + kCGLFEglLoadName, + kCGLFEglLoadTransposeMatrixd, + kCGLFEglLoadTransposeMatrixf, + kCGLFEglLockArraysEXT, + kCGLFEglLogicOp, + kCGLFEglMap1d, + kCGLFEglMap1f, + kCGLFEglMap2d, + kCGLFEglMap2f, + kCGLFEglMapBuffer, + kCGLFEglMapGrid1d, + kCGLFEglMapGrid1f, + kCGLFEglMapGrid2d, + kCGLFEglMapGrid2f, + kCGLFEglMapVertexAttrib1dARB, + kCGLFEglMapVertexAttrib1fARB, + kCGLFEglMapVertexAttrib2dARB, + kCGLFEglMapVertexAttrib2fARB, + kCGLFEglMaterialf, + kCGLFEglMaterialfv, + kCGLFEglMateriali, + kCGLFEglMaterialiv, + kCGLFEglMatrixMode, + kCGLFEglMinmax, + kCGLFEglMultMatrixd, + kCGLFEglMultMatrixf, + kCGLFEglMultTransposeMatrixd, + kCGLFEglMultTransposeMatrixf, + kCGLFEglMultiDrawArrays, + kCGLFEglMultiDrawElementArrayAPPLE, + kCGLFEglMultiDrawElements, + kCGLFEglMultiDrawRangeElementArrayAPPLE, + kCGLFEglMultiTexCoord1d, + kCGLFEglMultiTexCoord1dv, + kCGLFEglMultiTexCoord1f, + kCGLFEglMultiTexCoord1fv, + kCGLFEglMultiTexCoord1i, + kCGLFEglMultiTexCoord1iv, + kCGLFEglMultiTexCoord1s, + kCGLFEglMultiTexCoord1sv, + kCGLFEglMultiTexCoord2d, + kCGLFEglMultiTexCoord2dv, + kCGLFEglMultiTexCoord2f, + kCGLFEglMultiTexCoord2fv, + kCGLFEglMultiTexCoord2i, + kCGLFEglMultiTexCoord2iv, + kCGLFEglMultiTexCoord2s, + kCGLFEglMultiTexCoord2sv, + kCGLFEglMultiTexCoord3d, + kCGLFEglMultiTexCoord3dv, + kCGLFEglMultiTexCoord3f, + kCGLFEglMultiTexCoord3fv, + kCGLFEglMultiTexCoord3i, + kCGLFEglMultiTexCoord3iv, + kCGLFEglMultiTexCoord3s, + kCGLFEglMultiTexCoord3sv, + kCGLFEglMultiTexCoord4d, + kCGLFEglMultiTexCoord4dv, + kCGLFEglMultiTexCoord4f, + kCGLFEglMultiTexCoord4fv, + kCGLFEglMultiTexCoord4i, + kCGLFEglMultiTexCoord4iv, + kCGLFEglMultiTexCoord4s, + kCGLFEglMultiTexCoord4sv, + kCGLFEglNewList, + kCGLFEglNormal3b, + kCGLFEglNormal3bv, + kCGLFEglNormal3d, + kCGLFEglNormal3dv, + kCGLFEglNormal3f, + kCGLFEglNormal3fv, + kCGLFEglNormal3i, + kCGLFEglNormal3iv, + kCGLFEglNormal3s, + kCGLFEglNormal3sv, + kCGLFEglNormalPointer, + kCGLFEglOrtho, + kCGLFEglPassThrough, + kCGLFEglPixelMapfv, + kCGLFEglPixelMapuiv, + kCGLFEglPixelMapusv, + kCGLFEglPixelStoref, + kCGLFEglPixelStorei, + kCGLFEglPixelTransferf, + kCGLFEglPixelTransferi, + kCGLFEglPixelZoom, + kCGLFEglPnTrianglesfATI, + kCGLFEglPnTrianglesiATI, + kCGLFEglPointParameterf, + kCGLFEglPointParameterfv, + kCGLFEglPointParameteri, + kCGLFEglPointParameteriv, + kCGLFEglPointSize, + kCGLFEglPolygonMode, + kCGLFEglPolygonOffset, + kCGLFEglPolygonStipple, + kCGLFEglPopAttrib, + kCGLFEglPopClientAttrib, + kCGLFEglPopMatrix, + kCGLFEglPopName, + kCGLFEglPrioritizeTextures, + kCGLFEglProgramEnvParameter4dARB, + kCGLFEglProgramEnvParameter4dvARB, + kCGLFEglProgramEnvParameter4fARB, + kCGLFEglProgramEnvParameter4fvARB, + kCGLFEglProgramLocalParameter4dARB, + kCGLFEglProgramLocalParameter4dvARB, + kCGLFEglProgramLocalParameter4fARB, + kCGLFEglProgramLocalParameter4fvARB, + kCGLFEglProgramStringARB, + kCGLFEglPushAttrib, + kCGLFEglPushClientAttrib, + kCGLFEglPushMatrix, + kCGLFEglPushName, + kCGLFEglRasterPos2d, + kCGLFEglRasterPos2dv, + kCGLFEglRasterPos2f, + kCGLFEglRasterPos2fv, + kCGLFEglRasterPos2i, + kCGLFEglRasterPos2iv, + kCGLFEglRasterPos2s, + kCGLFEglRasterPos2sv, + kCGLFEglRasterPos3d, + kCGLFEglRasterPos3dv, + kCGLFEglRasterPos3f, + kCGLFEglRasterPos3fv, + kCGLFEglRasterPos3i, + kCGLFEglRasterPos3iv, + kCGLFEglRasterPos3s, + kCGLFEglRasterPos3sv, + kCGLFEglRasterPos4d, + kCGLFEglRasterPos4dv, + kCGLFEglRasterPos4f, + kCGLFEglRasterPos4fv, + kCGLFEglRasterPos4i, + kCGLFEglRasterPos4iv, + kCGLFEglRasterPos4s, + kCGLFEglRasterPos4sv, + kCGLFEglReadBuffer, + kCGLFEglReadPixels, + kCGLFEglRectd, + kCGLFEglRectdv, + kCGLFEglRectf, + kCGLFEglRectfv, + kCGLFEglRecti, + kCGLFEglRectiv, + kCGLFEglRects, + kCGLFEglRectsv, + kCGLFEglRenderbufferStorageEXT, + kCGLFEglRenderMode, + kCGLFEglResetHistogram, + kCGLFEglResetMinmax, + kCGLFEglRotated, + kCGLFEglRotatef, + kCGLFEglSampleCoverage, + kCGLFEglSamplePass, + kCGLFEglScaled, + kCGLFEglScalef, + kCGLFEglScissor, + kCGLFEglSecondaryColor3b, + kCGLFEglSecondaryColor3bv, + kCGLFEglSecondaryColor3d, + kCGLFEglSecondaryColor3dv, + kCGLFEglSecondaryColor3f, + kCGLFEglSecondaryColor3fv, + kCGLFEglSecondaryColor3i, + kCGLFEglSecondaryColor3iv, + kCGLFEglSecondaryColor3s, + kCGLFEglSecondaryColor3sv, + kCGLFEglSecondaryColor3ub, + kCGLFEglSecondaryColor3ubv, + kCGLFEglSecondaryColor3ui, + kCGLFEglSecondaryColor3uiv, + kCGLFEglSecondaryColor3us, + kCGLFEglSecondaryColor3usv, + kCGLFEglSecondaryColorPointer, + kCGLFEglSelectBuffer, + kCGLFEglSeparableFilter2D, + kCGLFEglSetFenceAPPLE, + kCGLFEglShadeModel, + kCGLFEglShaderSourceARB, + kCGLFEglStencilFunc, + kCGLFEglStencilFuncSeparate, + kCGLFEglStencilFuncSeparateATI, + kCGLFEglStencilMask, + kCGLFEglStencilMaskSeparate, + kCGLFEglStencilOp, + kCGLFEglStencilOpSeparateATI, + kCGLFEglTestFenceAPPLE, + kCGLFEglTestObjectAPPLE, + kCGLFEglTexCoord1d, + kCGLFEglTexCoord1dv, + kCGLFEglTexCoord1f, + kCGLFEglTexCoord1fv, + kCGLFEglTexCoord1i, + kCGLFEglTexCoord1iv, + kCGLFEglTexCoord1s, + kCGLFEglTexCoord1sv, + kCGLFEglTexCoord2d, + kCGLFEglTexCoord2dv, + kCGLFEglTexCoord2f, + kCGLFEglTexCoord2fv, + kCGLFEglTexCoord2i, + kCGLFEglTexCoord2iv, + kCGLFEglTexCoord2s, + kCGLFEglTexCoord2sv, + kCGLFEglTexCoord3d, + kCGLFEglTexCoord3dv, + kCGLFEglTexCoord3f, + kCGLFEglTexCoord3fv, + kCGLFEglTexCoord3i, + kCGLFEglTexCoord3iv, + kCGLFEglTexCoord3s, + kCGLFEglTexCoord3sv, + kCGLFEglTexCoord4d, + kCGLFEglTexCoord4dv, + kCGLFEglTexCoord4f, + kCGLFEglTexCoord4fv, + kCGLFEglTexCoord4i, + kCGLFEglTexCoord4iv, + kCGLFEglTexCoord4s, + kCGLFEglTexCoord4sv, + kCGLFEglTexCoordPointer, + kCGLFEglTexEnvf, + kCGLFEglTexEnvfv, + kCGLFEglTexEnvi, + kCGLFEglTexEnviv, + kCGLFEglTexGend, + kCGLFEglTexGendv, + kCGLFEglTexGenf, + kCGLFEglTexGenfv, + kCGLFEglTexGeni, + kCGLFEglTexGeniv, + kCGLFEglTexImage1D, + kCGLFEglTexImage2D, + kCGLFEglTexImage3D, + kCGLFEglTexParameterf, + kCGLFEglTexParameterfv, + kCGLFEglTexParameteri, + kCGLFEglTexParameteriv, + kCGLFEglTexSubImage1D, + kCGLFEglTexSubImage2D, + kCGLFEglTexSubImage3D, + kCGLFEglTextureRangeAPPLE, + kCGLFEglTranslated, + kCGLFEglTranslatef, + kCGLFEglUniform1fARB, + kCGLFEglUniform1fvARB, + kCGLFEglUniform1iARB, + kCGLFEglUniform1ivARB, + kCGLFEglUniform2fARB, + kCGLFEglUniform2fvARB, + kCGLFEglUniform2iARB, + kCGLFEglUniform2ivARB, + kCGLFEglUniform3fARB, + kCGLFEglUniform3fvARB, + kCGLFEglUniform3iARB, + kCGLFEglUniform3ivARB, + kCGLFEglUniform4fARB, + kCGLFEglUniform4fvARB, + kCGLFEglUniform4iARB, + kCGLFEglUniform4ivARB, + kCGLFEglUniformMatrix2fvARB, + kCGLFEglUniformMatrix3fvARB, + kCGLFEglUniformMatrix4fvARB, + kCGLFEglUnlockArraysEXT, + kCGLFEglUnmapBuffer, + kCGLFEglUseProgramObjectARB, + kCGLFEglValidateProgramARB, + kCGLFEglVertex2d, + kCGLFEglVertex2dv, + kCGLFEglVertex2f, + kCGLFEglVertex2fv, + kCGLFEglVertex2i, + kCGLFEglVertex2iv, + kCGLFEglVertex2s, + kCGLFEglVertex2sv, + kCGLFEglVertex3d, + kCGLFEglVertex3dv, + kCGLFEglVertex3f, + kCGLFEglVertex3fv, + kCGLFEglVertex3i, + kCGLFEglVertex3iv, + kCGLFEglVertex3s, + kCGLFEglVertex3sv, + kCGLFEglVertex4d, + kCGLFEglVertex4dv, + kCGLFEglVertex4f, + kCGLFEglVertex4fv, + kCGLFEglVertex4i, + kCGLFEglVertex4iv, + kCGLFEglVertex4s, + kCGLFEglVertex4sv, + kCGLFEglVertexArrayParameteriEXT, + kCGLFEglVertexArrayRangeEXT, + kCGLFEglVertexAttrib1dARB, + kCGLFEglVertexAttrib1dvARB, + kCGLFEglVertexAttrib1fARB, + kCGLFEglVertexAttrib1fvARB, + kCGLFEglVertexAttrib1sARB, + kCGLFEglVertexAttrib1svARB, + kCGLFEglVertexAttrib2dARB, + kCGLFEglVertexAttrib2dvARB, + kCGLFEglVertexAttrib2fARB, + kCGLFEglVertexAttrib2fvARB, + kCGLFEglVertexAttrib2sARB, + kCGLFEglVertexAttrib2svARB, + kCGLFEglVertexAttrib3dARB, + kCGLFEglVertexAttrib3dvARB, + kCGLFEglVertexAttrib3fARB, + kCGLFEglVertexAttrib3fvARB, + kCGLFEglVertexAttrib3sARB, + kCGLFEglVertexAttrib3svARB, + kCGLFEglVertexAttrib4bvARB, + kCGLFEglVertexAttrib4dARB, + kCGLFEglVertexAttrib4dvARB, + kCGLFEglVertexAttrib4fARB, + kCGLFEglVertexAttrib4fvARB, + kCGLFEglVertexAttrib4ivARB, + kCGLFEglVertexAttrib4nbvARB, + kCGLFEglVertexAttrib4nivARB, + kCGLFEglVertexAttrib4nsvARB, + kCGLFEglVertexAttrib4nubARB, + kCGLFEglVertexAttrib4nubvARB, + kCGLFEglVertexAttrib4nuivARB, + kCGLFEglVertexAttrib4nusvARB, + kCGLFEglVertexAttrib4sARB, + kCGLFEglVertexAttrib4svARB, + kCGLFEglVertexAttrib4ubvARB, + kCGLFEglVertexAttrib4uivARB, + kCGLFEglVertexAttrib4usvARB, + kCGLFEglVertexAttribPointerARB, + kCGLFEglVertexBlendARB, + kCGLFEglVertexPointer, + kCGLFEglViewport, + kCGLFEglWeightPointerARB, + kCGLFEglWeightbvARB, + kCGLFEglWeightdvARB, + kCGLFEglWeightfvARB, + kCGLFEglWeightivARB, + kCGLFEglWeightsvARB, + kCGLFEglWeightubvARB, + kCGLFEglWeightuivARB, + kCGLFEglWeightusvARB, + kCGLFEglWindowPos2d, + kCGLFEglWindowPos2dv, + kCGLFEglWindowPos2f, + kCGLFEglWindowPos2fv, + kCGLFEglWindowPos2i, + kCGLFEglWindowPos2iv, + kCGLFEglWindowPos2s, + kCGLFEglWindowPos2sv, + kCGLFEglWindowPos3d, + kCGLFEglWindowPos3dv, + kCGLFEglWindowPos3f, + kCGLFEglWindowPos3fv, + kCGLFEglWindowPos3i, + kCGLFEglWindowPos3iv, + kCGLFEglWindowPos3s, + kCGLFEglWindowPos3sv, + kCGLFEglBufferParameteriAPPLE, + kCGLFEglFlushMappedBufferRangeAPPLE, + kCGLFEglProgramEnvParameters4fvEXT, + kCGLFEglProgramLocalParameters4fvEXT, + kCGLFEglObjectPurgeableAPPLE, + kCGLFEglObjectUnpurgeableAPPLE, + kCGLFEglGetObjectParameterivAPPLE, + kCGLFEglBlitFramebufferEXT, + kCGLFEglRenderbufferStorageMultisampleEXT, + kCGLFEglUniformMatrix2x3fv, + kCGLFEglUniformMatrix3x2fv, + kCGLFEglUniformMatrix2x4fv, + kCGLFEglUniformMatrix4x2fv, + kCGLFEglUniformMatrix3x4fv, + kCGLFEglUniformMatrix4x3fv, + kCGLFEglShaderBinaryOES, + kCGLFEglGetShaderPrecisionFormatOES, + kCGLFEglReleaseShaderCompilerOES, + kCGLFEglGetRenderbufferStorageFormatOES, + kCGLFENumFunctions +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/opengl/CGLRenderers.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/opengl/CGLRenderers.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,7 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.opengl.CGLRenderers; \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/opengl/CGLTypes.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/opengl/CGLTypes.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,159 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.opengl.CGLTypes; + +struct _CGLContextObject; +struct _CGLPixelFormatObject; +struct _CGLRendererInfoObject; +struct _CGLPBufferObject; + +alias _CGLContextObject* CGLContextObj; +alias _CGLPixelFormatObject* CGLPixelFormatObj; +alias _CGLRendererInfoObject* CGLRendererInfoObj; +alias _CGLPBufferObject* CGLPBufferObj; + +alias int CGLPixelFormatAttribute; +alias int CGLRendererProperty; +alias int CGLContextEnable; +alias int CGLContextParameter; +alias int CGLGlobalOption; +alias int CGLError; + +enum +{ + kCGLPFAAllRenderers = 1, + kCGLPFADoubleBuffer = 5, + kCGLPFAStereo = 6, + kCGLPFAAuxBuffers = 7, + kCGLPFAColorSize = 8, + kCGLPFAAlphaSize = 11, + kCGLPFADepthSize = 12, + kCGLPFAStencilSize = 13, + kCGLPFAAccumSize = 14, + kCGLPFAMinimumPolicy = 51, + kCGLPFAMaximumPolicy = 52, + kCGLPFAOffScreen = 53, + kCGLPFAFullScreen = 54, + kCGLPFASampleBuffers = 55, + kCGLPFASamples = 56, + kCGLPFAAuxDepthStencil = 57, + kCGLPFAColorFloat = 58, + kCGLPFAMultisample = 59, + kCGLPFASupersample = 60, + kCGLPFASampleAlpha = 61, + kCGLPFARendererID = 70, + kCGLPFASingleRenderer = 71, + kCGLPFANoRecovery = 72, + kCGLPFAAccelerated = 73, + kCGLPFAClosestPolicy = 74, + kCGLPFABackingStore = 76, + kCGLPFAWindow = 80, + kCGLPFACompliant = 83, + kCGLPFADisplayMask = 84, + kCGLPFAPBuffer = 90, + kCGLPFARemotePBuffer = 91, + kCGLPFAAllowOfflineRenderers = 96, + kCGLPFAVirtualScreenCount = 128, + kCGLPFARobust = 75, + kCGLPFAMPSafe = 78, + kCGLPFAMultiScreen = 81 +} + +enum +{ + kCGLRPOffScreen = 53, + kCGLRPFullScreen = 54, + kCGLRPRendererID = 70, + kCGLRPAccelerated = 73, + kCGLRPRobust = 75, + kCGLRPBackingStore = 76, + kCGLRPMPSafe = 78, + kCGLRPWindow = 80, + kCGLRPMultiScreen = 81, + kCGLRPCompliant = 83, + kCGLRPDisplayMask = 84, + kCGLRPBufferModes = 100, + kCGLRPColorModes = 103, + kCGLRPAccumModes = 104, + kCGLRPDepthModes = 105, + kCGLRPStencilModes = 106, + kCGLRPMaxAuxBuffers = 107, + kCGLRPMaxSampleBuffers = 108, + kCGLRPMaxSamples = 109, + kCGLRPSampleModes = 110, + kCGLRPSampleAlpha = 111, + kCGLRPVideoMemory = 120, + kCGLRPTextureMemory = 121, + kCGLRPGPUVertProcCapable = 122, + kCGLRPGPUFragProcCapable = 123, + kCGLRPRendererCount = 128, + kCGLRPOnline = 129 +} + +enum +{ + kCGLCESwapRectangle = 201, + kCGLCESwapLimit = 203, + kCGLCERasterization = 221, + kCGLCEStateValidation = 301, + kCGLCESurfaceBackingSize = 305, + kCGLCEDisplayListOptimization = 307, + kCGLCEMPEngine = 313 +} + +enum +{ + kCGLCPSwapRectangle = 200, + kCGLCPSwapInterval = 222, + kCGLCPDispatchTableSize = 224, + kCGLCPClientStorage = 226, + kCGLCPSurfaceTexture = 228, + kCGLCPSurfaceOrder = 235, + kCGLCPSurfaceOpacity = 236, + kCGLCPSurfaceBackingSize = 304, + kCGLCPSurfaceSurfaceVolatile = 306, + kCGLCPReclaimResources = 308, + kCGLCPCurrentRendererID = 309, + kCGLCPGPUVertexProcessing = 310, + kCGLCPGPUFragmentProcessing = 311, + kCGLCPHasDrawable = 314, + kCGLCPMPSwapsInFlight = 315 +} + +enum +{ + kCGLGOFormatCacheSize = 501, + kCGLGOClearFormatCache = 502, + kCGLGORetainRenderers = 503, + kCGLGOResetLibrary = 504, + kCGLGOUseErrorHandler = 505, + kCGLGOUseBuildCache = 506 +} + +enum +{ + kCGLNoError = 0, + kCGLBadAttribute = 10000, + kCGLBadProperty = 10001, + kCGLBadPixelFormat = 10002, + kCGLBadRendererInfo = 10003, + kCGLBadContext = 10004, + kCGLBadDrawable = 10005, + kCGLBadDisplay = 10006, + kCGLBadState = 10007, + kCGLBadValue = 10008, + kCGLBadMatch = 10009, + kCGLBadEnumeration = 10010, + kCGLBadOffScreen = 10011, + kCGLBadFullScreen = 10012, + kCGLBadWindow = 10013, + kCGLBadAddress = 10014, + kCGLBadCodeModule = 10015, + kCGLBadAlloc = 10016, + kCGLBadConnection = 10017 +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/opengl/OpenGL.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/opengl/OpenGL.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,61 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.opengl.OpenGL; + +public: + +//import dstep.AvailabilityMacros; +import dstep.opengl.CGLCurrent; +import dstep.opengl.CGLTypes; +import dstep.opengl.gl; + +extern (C) +{ + int CGLChoosePixelFormat (CGLPixelFormatAttribute* attribs, CGLPixelFormatObj* pix, GLint* npix); + int CGLDestroyPixelFormat (CGLPixelFormatObj pix); + int CGLDescribePixelFormat (CGLPixelFormatObj pix, int pix_num, int attrib, GLint* value); + void CGLReleasePixelFormat (CGLPixelFormatObj pix); + CGLPixelFormatObj CGLRetainPixelFormat (CGLPixelFormatObj pix); + uint CGLGetPixelFormatRetainCount (CGLPixelFormatObj pix); + int CGLQueryRendererInfo (uint display_mask, CGLRendererInfoObj* rend, GLint* nrend); + int CGLDestroyRendererInfo (CGLRendererInfoObj rend); + int CGLDescribeRenderer (CGLRendererInfoObj rend, int rend_num, int prop, GLint* value); + int CGLCreateContext (CGLPixelFormatObj pix, CGLContextObj share, CGLContextObj* ctx); + int CGLDestroyContext (CGLContextObj ctx); + int CGLCopyContext (CGLContextObj src, CGLContextObj dst, uint mask); + CGLContextObj CGLRetainContext (CGLContextObj ctx); + void CGLReleaseContext (CGLContextObj ctx); + uint CGLGetContextRetainCount (CGLContextObj ctx); + CGLPixelFormatObj CGLGetPixelFormat (CGLContextObj ctx); + int CGLCreatePBuffer (int width, int height, uint target, uint internalFormat, int max_level, CGLPBufferObj* pbuffer); + int CGLDestroyPBuffer (CGLPBufferObj pbuffer); + int CGLDescribePBuffer (CGLPBufferObj obj, GLsizei* width, GLsizei* height, GLenum* target, GLenum* internalFormat, GLint* mipmap); + int CGLTexImagePBuffer (CGLContextObj ctx, CGLPBufferObj pbuffer, uint source); + CGLPBufferObj CGLRetainPBuffer (CGLPBufferObj pbuffer); + void CGLReleasePBuffer (CGLPBufferObj pbuffer); + uint CGLGetPBufferRetainCount (CGLPBufferObj pbuffer); + int CGLSetOffScreen (CGLContextObj ctx, int width, int height, int rowbytes, void* baseaddr); + int CGLGetOffScreen (CGLContextObj ctx, GLsizei* width, GLsizei* height, GLint* rowbytes, void** baseaddr); + int CGLSetFullScreen (CGLContextObj ctx); + int CGLSetPBuffer (CGLContextObj ctx, CGLPBufferObj pbuffer, uint face, int level, int screen); + int CGLGetPBuffer (CGLContextObj ctx, CGLPBufferObj* pbuffer, GLenum* face, GLint* level, GLint* screen); + int CGLClearDrawable (CGLContextObj ctx); + int CGLFlushDrawable (CGLContextObj ctx); + int CGLEnable (CGLContextObj ctx, int pname); + int CGLDisable (CGLContextObj ctx, int pname); + int CGLIsEnabled (CGLContextObj ctx, int pname, GLint* enable); + int CGLSetParameter (CGLContextObj ctx, int pname, GLint* params); + int CGLGetParameter (CGLContextObj ctx, int pname, GLint* params); + int CGLSetVirtualScreen (CGLContextObj ctx, int screen); + int CGLGetVirtualScreen (CGLContextObj ctx, GLint* screen); + int CGLSetOption (int pname, int param); + int CGLGetOption (int pname, GLint* param); + int CGLLockContext (CGLContextObj ctx); + int CGLUnlockContext (CGLContextObj ctx); + void CGLGetVersion (GLint* majorvers, GLint* minorvers); + char* CGLErrorString (int error); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/opengl/gl.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/opengl/gl.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,616 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.opengl.gl; + +import dstep.opengl.glext; + +alias uint GLenum; +alias ubyte GLboolean; +alias uint GLbitfield; +alias byte GLbyte; +alias short GLshort; +alias int GLint; +alias int GLsizei; +alias ubyte GLubyte; +alias ushort GLushort; +alias uint GLuint; +alias float GLfloat; +alias float GLclampf; +alias double GLdouble; +alias double GLclampd; +alias void GLvoid; +alias int GLintptr; +alias int GLsizeiptr; +alias byte GLchar; + +extern (C) +{ + void glAccum (uint op, float value); + void glAlphaFunc (uint func, float ref_); + ubyte glAreTexturesResident (int n, GLuint* textures, char* residences); + void glArrayElement (int i); + void glBegin (uint mode); + void glBindTexture (uint target, uint texture); + void glBitmap (int width, int height, float xorig, float yorig, float xmove, float ymove, char* bitmap); + void glBlendColor (float red, float green, float blue, float alpha); + void glBlendEquation (uint mode); + void glBlendEquationSeparate (uint modeRGB, uint modeAlpha); + void glBlendFunc (uint sfactor, uint dfactor); + void glCallList (uint list); + void glCallLists (int n, uint type, GLvoid* lists); + void glClear (uint mask); + void glClearAccum (float red, float green, float blue, float alpha); + void glClearColor (float red, float green, float blue, float alpha); + void glClearDepth (double depth); + void glClearIndex (float c); + void glClearStencil (int s); + void glClipPlane (uint plane, GLdouble* equation); + void glColor3b (byte red, byte green, byte blue); + void glColor3bv (char* v); + void glColor3d (double red, double green, double blue); + void glColor3dv (GLdouble* v); + void glColor3f (float red, float green, float blue); + void glColor3fv (GLfloat* v); + void glColor3i (int red, int green, int blue); + void glColor3iv (GLint* v); + void glColor3s (short red, short green, short blue); + void glColor3sv (GLshort* v); + void glColor3ub (ubyte red, ubyte green, ubyte blue); + void glColor3ubv (char* v); + void glColor3ui (uint red, uint green, uint blue); + void glColor3uiv (GLuint* v); + void glColor3us (ushort red, ushort green, ushort blue); + void glColor3usv (GLushort* v); + void glColor4b (byte red, byte green, byte blue, byte alpha); + void glColor4bv (char* v); + void glColor4d (double red, double green, double blue, double alpha); + void glColor4dv (GLdouble* v); + void glColor4f (float red, float green, float blue, float alpha); + void glColor4fv (GLfloat* v); + void glColor4i (int red, int green, int blue, int alpha); + void glColor4iv (GLint* v); + void glColor4s (short red, short green, short blue, short alpha); + void glColor4sv (GLshort* v); + void glColor4ub (ubyte red, ubyte green, ubyte blue, ubyte alpha); + void glColor4ubv (char* v); + void glColor4ui (uint red, uint green, uint blue, uint alpha); + void glColor4uiv (GLuint* v); + void glColor4us (ushort red, ushort green, ushort blue, ushort alpha); + void glColor4usv (GLushort* v); + void glColorMask (ubyte red, ubyte green, ubyte blue, ubyte alpha); + void glColorMaterial (uint face, uint mode); + void glColorPointer (int size, uint type, int stride, GLvoid* pointer); + void glColorSubTable (uint target, int start, int count, uint format, uint type, GLvoid* data); + void glColorTable (uint target, uint internalformat, int width, uint format, uint type, GLvoid* table); + void glColorTableParameterfv (uint target, uint pname, GLfloat* params); + void glColorTableParameteriv (uint target, uint pname, GLint* params); + void glConvolutionFilter1D (uint target, uint internalformat, int width, uint format, uint type, GLvoid* image); + void glConvolutionFilter2D (uint target, uint internalformat, int width, int height, uint format, uint type, GLvoid* image); + void glConvolutionParameterf (uint target, uint pname, float params); + void glConvolutionParameterfv (uint target, uint pname, GLfloat* params); + void glConvolutionParameteri (uint target, uint pname, int params); + void glConvolutionParameteriv (uint target, uint pname, GLint* params); + void glCopyColorSubTable (uint target, int start, int x, int y, int width); + void glCopyColorTable (uint target, uint internalformat, int x, int y, int width); + void glCopyConvolutionFilter1D (uint target, uint internalformat, int x, int y, int width); + void glCopyConvolutionFilter2D (uint target, uint internalformat, int x, int y, int width, int height); + void glCopyPixels (int x, int y, int width, int height, uint type); + void glCopyTexImage1D (uint target, int level, uint internalformat, int x, int y, int width, int border); + void glCopyTexImage2D (uint target, int level, uint internalformat, int x, int y, int width, int height, int border); + void glCopyTexSubImage1D (uint target, int level, int xoffset, int x, int y, int width); + void glCopyTexSubImage2D (uint target, int level, int xoffset, int yoffset, int x, int y, int width, int height); + void glCopyTexSubImage3D (uint target, int level, int xoffset, int yoffset, int zoffset, int x, int y, int width, int height); + void glCullFace (uint mode); + void glDeleteLists (uint list, int range); + void glDeleteTextures (int n, GLuint* textures); + void glDepthFunc (uint func); + void glDepthMask (ubyte flag); + void glDepthRange (double zNear, double zFar); + void glDisable (uint cap); + void glDisableClientState (uint array); + void glDrawArrays (uint mode, int first, int count); + void glDrawBuffer (uint mode); + void glDrawElements (uint mode, int count, uint type, GLvoid* indices); + void glDrawPixels (int width, int height, uint format, uint type, GLvoid* pixels); + void glDrawRangeElements (uint mode, uint start, uint end, int count, uint type, GLvoid* indices); + void glEdgeFlag (ubyte flag); + void glEdgeFlagPointer (int stride, GLvoid* pointer); + void glEdgeFlagv (char* flag); + void glEnable (uint cap); + void glEnableClientState (uint array); + void glEnd (); + void glEndList (); + void glEvalCoord1d (double u); + void glEvalCoord1dv (GLdouble* u); + void glEvalCoord1f (float u); + void glEvalCoord1fv (GLfloat* u); + void glEvalCoord2d (double u, double v); + void glEvalCoord2dv (GLdouble* u); + void glEvalCoord2f (float u, float v); + void glEvalCoord2fv (GLfloat* u); + void glEvalMesh1 (uint mode, int i1, int i2); + void glEvalMesh2 (uint mode, int i1, int i2, int j1, int j2); + void glEvalPoint1 (int i); + void glEvalPoint2 (int i, int j); + void glFeedbackBuffer (int size, uint type, GLfloat* buffer); + void glFinish (); + void glFlush (); + void glFogf (uint pname, float param); + void glFogfv (uint pname, GLfloat* params); + void glFogi (uint pname, int param); + void glFogiv (uint pname, GLint* params); + void glFrontFace (uint mode); + void glFrustum (double left, double right, double bottom, double top, double zNear, double zFar); + uint glGenLists (int range); + void glGenTextures (int n, GLuint* textures); + void glGetBooleanv (uint pname, char* params); + void glGetClipPlane (uint plane, GLdouble* equation); + void glGetColorTable (uint target, uint format, uint type, GLvoid* table); + void glGetColorTableParameterfv (uint target, uint pname, GLfloat* params); + void glGetColorTableParameteriv (uint target, uint pname, GLint* params); + void glGetConvolutionFilter (uint target, uint format, uint type, GLvoid* image); + void glGetConvolutionParameterfv (uint target, uint pname, GLfloat* params); + void glGetConvolutionParameteriv (uint target, uint pname, GLint* params); + void glGetDoublev (uint pname, GLdouble* params); + uint glGetError (); + void glGetFloatv (uint pname, GLfloat* params); + void glGetHistogram (uint target, ubyte reset, uint format, uint type, GLvoid* values); + void glGetHistogramParameterfv (uint target, uint pname, GLfloat* params); + void glGetHistogramParameteriv (uint target, uint pname, GLint* params); + void glGetIntegerv (uint pname, GLint* params); + void glGetLightfv (uint light, uint pname, GLfloat* params); + void glGetLightiv (uint light, uint pname, GLint* params); + void glGetMapdv (uint target, uint query, GLdouble* v); + void glGetMapfv (uint target, uint query, GLfloat* v); + void glGetMapiv (uint target, uint query, GLint* v); + void glGetMaterialfv (uint face, uint pname, GLfloat* params); + void glGetMaterialiv (uint face, uint pname, GLint* params); + void glGetMinmax (uint target, ubyte reset, uint format, uint type, GLvoid* values); + void glGetMinmaxParameterfv (uint target, uint pname, GLfloat* params); + void glGetMinmaxParameteriv (uint target, uint pname, GLint* params); + void glGetPixelMapfv (uint map, GLfloat* values); + void glGetPixelMapuiv (uint map, GLuint* values); + void glGetPixelMapusv (uint map, GLushort* values); + void glGetPointerv (uint pname, GLvoid** params); + void glGetPolygonStipple (char* mask); + void glGetSeparableFilter (uint target, uint format, uint type, GLvoid* row, GLvoid* column, GLvoid* span); + char* glGetString (uint name); + void glGetTexEnvfv (uint target, uint pname, GLfloat* params); + void glGetTexEnviv (uint target, uint pname, GLint* params); + void glGetTexGendv (uint coord, uint pname, GLdouble* params); + void glGetTexGenfv (uint coord, uint pname, GLfloat* params); + void glGetTexGeniv (uint coord, uint pname, GLint* params); + void glGetTexImage (uint target, int level, uint format, uint type, GLvoid* pixels); + void glGetTexLevelParameterfv (uint target, int level, uint pname, GLfloat* params); + void glGetTexLevelParameteriv (uint target, int level, uint pname, GLint* params); + void glGetTexParameterfv (uint target, uint pname, GLfloat* params); + void glGetTexParameteriv (uint target, uint pname, GLint* params); + void glHint (uint target, uint mode); + void glHistogram (uint target, int width, uint internalformat, ubyte sink); + void glIndexMask (uint mask); + void glIndexPointer (uint type, int stride, GLvoid* pointer); + void glIndexd (double c); + void glIndexdv (GLdouble* c); + void glIndexf (float c); + void glIndexfv (GLfloat* c); + void glIndexi (int c); + void glIndexiv (GLint* c); + void glIndexs (short c); + void glIndexsv (GLshort* c); + void glIndexub (ubyte c); + void glIndexubv (char* c); + void glInitNames (); + void glInterleavedArrays (uint format, int stride, GLvoid* pointer); + ubyte glIsEnabled (uint cap); + ubyte glIsList (uint list); + ubyte glIsTexture (uint texture); + void glLightModelf (uint pname, float param); + void glLightModelfv (uint pname, GLfloat* params); + void glLightModeli (uint pname, int param); + void glLightModeliv (uint pname, GLint* params); + void glLightf (uint light, uint pname, float param); + void glLightfv (uint light, uint pname, GLfloat* params); + void glLighti (uint light, uint pname, int param); + void glLightiv (uint light, uint pname, GLint* params); + void glLineStipple (int factor, ushort pattern); + void glLineWidth (float width); + void glListBase (uint base); + void glLoadIdentity (); + void glLoadMatrixd (GLdouble* m); + void glLoadMatrixf (GLfloat* m); + void glLoadName (uint name); + void glLogicOp (uint opcode); + void glMap1d (uint target, double u1, double u2, int stride, int order, GLdouble* points); + void glMap1f (uint target, float u1, float u2, int stride, int order, GLfloat* points); + void glMap2d (uint target, double u1, double u2, int ustride, int uorder, double v1, double v2, int vstride, int vorder, GLdouble* points); + void glMap2f (uint target, float u1, float u2, int ustride, int uorder, float v1, float v2, int vstride, int vorder, GLfloat* points); + void glMapGrid1d (int un, double u1, double u2); + void glMapGrid1f (int un, float u1, float u2); + void glMapGrid2d (int un, double u1, double u2, int vn, double v1, double v2); + void glMapGrid2f (int un, float u1, float u2, int vn, float v1, float v2); + void glMaterialf (uint face, uint pname, float param); + void glMaterialfv (uint face, uint pname, GLfloat* params); + void glMateriali (uint face, uint pname, int param); + void glMaterialiv (uint face, uint pname, GLint* params); + void glMatrixMode (uint mode); + void glMinmax (uint target, uint internalformat, ubyte sink); + void glMultMatrixd (GLdouble* m); + void glMultMatrixf (GLfloat* m); + void glNewList (uint list, uint mode); + void glNormal3b (byte nx, byte ny, byte nz); + void glNormal3bv (char* v); + void glNormal3d (double nx, double ny, double nz); + void glNormal3dv (GLdouble* v); + void glNormal3f (float nx, float ny, float nz); + void glNormal3fv (GLfloat* v); + void glNormal3i (int nx, int ny, int nz); + void glNormal3iv (GLint* v); + void glNormal3s (short nx, short ny, short nz); + void glNormal3sv (GLshort* v); + void glNormalPointer (uint type, int stride, GLvoid* pointer); + void glOrtho (double left, double right, double bottom, double top, double zNear, double zFar); + void glPassThrough (float token); + void glPixelMapfv (uint map, int mapsize, GLfloat* values); + void glPixelMapuiv (uint map, int mapsize, GLuint* values); + void glPixelMapusv (uint map, int mapsize, GLushort* values); + void glPixelStoref (uint pname, float param); + void glPixelStorei (uint pname, int param); + void glPixelTransferf (uint pname, float param); + void glPixelTransferi (uint pname, int param); + void glPixelZoom (float xfactor, float yfactor); + void glPointSize (float size); + void glPolygonMode (uint face, uint mode); + void glPolygonOffset (float factor, float units); + void glPolygonStipple (char* mask); + void glPopAttrib (); + void glPopClientAttrib (); + void glPopMatrix (); + void glPopName (); + void glPrioritizeTextures (int n, GLuint* textures, GLclampf* priorities); + void glPushAttrib (uint mask); + void glPushClientAttrib (uint mask); + void glPushMatrix (); + void glPushName (uint name); + void glRasterPos2d (double x, double y); + void glRasterPos2dv (GLdouble* v); + void glRasterPos2f (float x, float y); + void glRasterPos2fv (GLfloat* v); + void glRasterPos2i (int x, int y); + void glRasterPos2iv (GLint* v); + void glRasterPos2s (short x, short y); + void glRasterPos2sv (GLshort* v); + void glRasterPos3d (double x, double y, double z); + void glRasterPos3dv (GLdouble* v); + void glRasterPos3f (float x, float y, float z); + void glRasterPos3fv (GLfloat* v); + void glRasterPos3i (int x, int y, int z); + void glRasterPos3iv (GLint* v); + void glRasterPos3s (short x, short y, short z); + void glRasterPos3sv (GLshort* v); + void glRasterPos4d (double x, double y, double z, double w); + void glRasterPos4dv (GLdouble* v); + void glRasterPos4f (float x, float y, float z, float w); + void glRasterPos4fv (GLfloat* v); + void glRasterPos4i (int x, int y, int z, int w); + void glRasterPos4iv (GLint* v); + void glRasterPos4s (short x, short y, short z, short w); + void glRasterPos4sv (GLshort* v); + void glReadBuffer (uint mode); + void glReadPixels (int x, int y, int width, int height, uint format, uint type, GLvoid* pixels); + void glRectd (double x1, double y1, double x2, double y2); + void glRectdv (GLdouble* v1, GLdouble* v2); + void glRectf (float x1, float y1, float x2, float y2); + void glRectfv (GLfloat* v1, GLfloat* v2); + void glRecti (int x1, int y1, int x2, int y2); + void glRectiv (GLint* v1, GLint* v2); + void glRects (short x1, short y1, short x2, short y2); + void glRectsv (GLshort* v1, GLshort* v2); + int glRenderMode (uint mode); + void glResetHistogram (uint target); + void glResetMinmax (uint target); + void glRotated (double angle, double x, double y, double z); + void glRotatef (float angle, float x, float y, float z); + void glScaled (double x, double y, double z); + void glScalef (float x, float y, float z); + void glScissor (int x, int y, int width, int height); + void glSelectBuffer (int size, GLuint* buffer); + void glSeparableFilter2D (uint target, uint internalformat, int width, int height, uint format, uint type, GLvoid* row, GLvoid* column); + void glShadeModel (uint mode); + void glStencilFunc (uint func, int ref_, uint mask); + void glStencilMask (uint mask); + void glStencilOp (uint fail, uint zfail, uint zpass); + void glTexCoord1d (double s); + void glTexCoord1dv (GLdouble* v); + void glTexCoord1f (float s); + void glTexCoord1fv (GLfloat* v); + void glTexCoord1i (int s); + void glTexCoord1iv (GLint* v); + void glTexCoord1s (short s); + void glTexCoord1sv (GLshort* v); + void glTexCoord2d (double s, double t); + void glTexCoord2dv (GLdouble* v); + void glTexCoord2f (float s, float t); + void glTexCoord2fv (GLfloat* v); + void glTexCoord2i (int s, int t); + void glTexCoord2iv (GLint* v); + void glTexCoord2s (short s, short t); + void glTexCoord2sv (GLshort* v); + void glTexCoord3d (double s, double t, double r); + void glTexCoord3dv (GLdouble* v); + void glTexCoord3f (float s, float t, float r); + void glTexCoord3fv (GLfloat* v); + void glTexCoord3i (int s, int t, int r); + void glTexCoord3iv (GLint* v); + void glTexCoord3s (short s, short t, short r); + void glTexCoord3sv (GLshort* v); + void glTexCoord4d (double s, double t, double r, double q); + void glTexCoord4dv (GLdouble* v); + void glTexCoord4f (float s, float t, float r, float q); + void glTexCoord4fv (GLfloat* v); + void glTexCoord4i (int s, int t, int r, int q); + void glTexCoord4iv (GLint* v); + void glTexCoord4s (short s, short t, short r, short q); + void glTexCoord4sv (GLshort* v); + void glTexCoordPointer (int size, uint type, int stride, GLvoid* pointer); + void glTexEnvf (uint target, uint pname, float param); + void glTexEnvfv (uint target, uint pname, GLfloat* params); + void glTexEnvi (uint target, uint pname, int param); + void glTexEnviv (uint target, uint pname, GLint* params); + void glTexGend (uint coord, uint pname, double param); + void glTexGendv (uint coord, uint pname, GLdouble* params); + void glTexGenf (uint coord, uint pname, float param); + void glTexGenfv (uint coord, uint pname, GLfloat* params); + void glTexGeni (uint coord, uint pname, int param); + void glTexGeniv (uint coord, uint pname, GLint* params); + void glTexImage1D (uint target, int level, uint internalformat, int width, int border, uint format, uint type, GLvoid* pixels); + void glTexImage2D (uint target, int level, uint internalformat, int width, int height, int border, uint format, uint type, GLvoid* pixels); + void glTexImage3D (uint target, int level, uint internalformat, int width, int height, int depth, int border, uint format, uint type, GLvoid* pixels); + void glTexParameterf (uint target, uint pname, float param); + void glTexParameterfv (uint target, uint pname, GLfloat* params); + void glTexParameteri (uint target, uint pname, int param); + void glTexParameteriv (uint target, uint pname, GLint* params); + void glTexSubImage1D (uint target, int level, int xoffset, int width, uint format, uint type, GLvoid* pixels); + void glTexSubImage2D (uint target, int level, int xoffset, int yoffset, int width, int height, uint format, uint type, GLvoid* pixels); + void glTexSubImage3D (uint target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, uint format, uint type, GLvoid* pixels); + void glTranslated (double x, double y, double z); + void glTranslatef (float x, float y, float z); + void glVertex2d (double x, double y); + void glVertex2dv (GLdouble* v); + void glVertex2f (float x, float y); + void glVertex2fv (GLfloat* v); + void glVertex2i (int x, int y); + void glVertex2iv (GLint* v); + void glVertex2s (short x, short y); + void glVertex2sv (GLshort* v); + void glVertex3d (double x, double y, double z); + void glVertex3dv (GLdouble* v); + void glVertex3f (float x, float y, float z); + void glVertex3fv (GLfloat* v); + void glVertex3i (int x, int y, int z); + void glVertex3iv (GLint* v); + void glVertex3s (short x, short y, short z); + void glVertex3sv (GLshort* v); + void glVertex4d (double x, double y, double z, double w); + void glVertex4dv (GLdouble* v); + void glVertex4f (float x, float y, float z, float w); + void glVertex4fv (GLfloat* v); + void glVertex4i (int x, int y, int z, int w); + void glVertex4iv (GLint* v); + void glVertex4s (short x, short y, short z, short w); + void glVertex4sv (GLshort* v); + void glVertexPointer (int size, uint type, int stride, GLvoid* pointer); + void glViewport (int x, int y, int width, int height); + void glSampleCoverage (float value, ubyte invert); + void glSamplePass (uint pass); + void glLoadTransposeMatrixf (GLfloat* m); + void glLoadTransposeMatrixd (GLdouble* m); + void glMultTransposeMatrixf (GLfloat* m); + void glMultTransposeMatrixd (GLdouble* m); + void glCompressedTexImage3D (uint target, int level, uint internalformat, int width, int height, int depth, int border, int imageSize, GLvoid* data); + void glCompressedTexImage2D (uint target, int level, uint internalformat, int width, int height, int border, int imageSize, GLvoid* data); + void glCompressedTexImage1D (uint target, int level, uint internalformat, int width, int border, int imageSize, GLvoid* data); + void glCompressedTexSubImage3D (uint target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, uint format, int imageSize, GLvoid* data); + void glCompressedTexSubImage2D (uint target, int level, int xoffset, int yoffset, int width, int height, uint format, int imageSize, GLvoid* data); + void glCompressedTexSubImage1D (uint target, int level, int xoffset, int width, uint format, int imageSize, GLvoid* data); + void glGetCompressedTexImage (uint target, int lod, GLvoid* img); + void glActiveTexture (uint texture); + void glClientActiveTexture (uint texture); + void glMultiTexCoord1d (uint target, double s); + void glMultiTexCoord1dv (uint target, GLdouble* v); + void glMultiTexCoord1f (uint target, float s); + void glMultiTexCoord1fv (uint target, GLfloat* v); + void glMultiTexCoord1i (uint target, int s); + void glMultiTexCoord1iv (uint target, GLint* v); + void glMultiTexCoord1s (uint target, short s); + void glMultiTexCoord1sv (uint target, GLshort* v); + void glMultiTexCoord2d (uint target, double s, double t); + void glMultiTexCoord2dv (uint target, GLdouble* v); + void glMultiTexCoord2f (uint target, float s, float t); + void glMultiTexCoord2fv (uint target, GLfloat* v); + void glMultiTexCoord2i (uint target, int s, int t); + void glMultiTexCoord2iv (uint target, GLint* v); + void glMultiTexCoord2s (uint target, short s, short t); + void glMultiTexCoord2sv (uint target, GLshort* v); + void glMultiTexCoord3d (uint target, double s, double t, double r); + void glMultiTexCoord3dv (uint target, GLdouble* v); + void glMultiTexCoord3f (uint target, float s, float t, float r); + void glMultiTexCoord3fv (uint target, GLfloat* v); + void glMultiTexCoord3i (uint target, int s, int t, int r); + void glMultiTexCoord3iv (uint target, GLint* v); + void glMultiTexCoord3s (uint target, short s, short t, short r); + void glMultiTexCoord3sv (uint target, GLshort* v); + void glMultiTexCoord4d (uint target, double s, double t, double r, double q); + void glMultiTexCoord4dv (uint target, GLdouble* v); + void glMultiTexCoord4f (uint target, float s, float t, float r, float q); + void glMultiTexCoord4fv (uint target, GLfloat* v); + void glMultiTexCoord4i (uint target, int dummy, int s, int t, int r); + void glMultiTexCoord4iv (uint target, GLint* v); + void glMultiTexCoord4s (uint target, short s, short t, short r, short q); + void glMultiTexCoord4sv (uint target, GLshort* v); + void glFogCoordf (float coord); + void glFogCoordfv (GLfloat* coord); + void glFogCoordd (double coord); + void glFogCoorddv (GLdouble* coord); + void glFogCoordPointer (uint type, int stride, GLvoid* pointer); + void glSecondaryColor3b (byte red, byte green, byte blue); + void glSecondaryColor3bv (char* v); + void glSecondaryColor3d (double red, double green, double blue); + void glSecondaryColor3dv (GLdouble* v); + void glSecondaryColor3f (float red, float green, float blue); + void glSecondaryColor3fv (GLfloat* v); + void glSecondaryColor3i (int red, int green, int blue); + void glSecondaryColor3iv (GLint* v); + void glSecondaryColor3s (short red, short green, short blue); + void glSecondaryColor3sv (GLshort* v); + void glSecondaryColor3ub (ubyte red, ubyte green, ubyte blue); + void glSecondaryColor3ubv (char* v); + void glSecondaryColor3ui (uint red, uint green, uint blue); + void glSecondaryColor3uiv (GLuint* v); + void glSecondaryColor3us (ushort red, ushort green, ushort blue); + void glSecondaryColor3usv (GLushort* v); + void glSecondaryColorPointer (int size, uint type, int stride, GLvoid* pointer); + void glPointParameterf (uint pname, float param); + void glPointParameterfv (uint pname, GLfloat* params); + void glPointParameteri (uint pname, int param); + void glPointParameteriv (uint pname, GLint* params); + void glBlendFuncSeparate (uint srcRGB, uint dstRGB, uint srcAlpha, uint dstAlpha); + void glMultiDrawArrays (uint mode, GLint* first, GLsizei* count, int primcount); + void glMultiDrawElements (uint mode, GLsizei* count, uint type, GLvoid** indices, int primcount); + void glWindowPos2d (double x, double y); + void glWindowPos2dv (GLdouble* v); + void glWindowPos2f (float x, float y); + void glWindowPos2fv (GLfloat* v); + void glWindowPos2i (int x, int y); + void glWindowPos2iv (GLint* v); + void glWindowPos2s (short x, short y); + void glWindowPos2sv (GLshort* v); + void glWindowPos3d (double x, double y, double z); + void glWindowPos3dv (GLdouble* v); + void glWindowPos3f (float x, float y, float z); + void glWindowPos3fv (GLfloat* v); + void glWindowPos3i (int x, int y, int z); + void glWindowPos3iv (GLint* v); + void glWindowPos3s (short x, short y, short z); + void glWindowPos3sv (GLshort* v); + void glGenQueries (int n, GLuint* ids); + void glDeleteQueries (int n, GLuint* ids); + ubyte glIsQuery (uint id); + void glBeginQuery (uint target, uint id); + void glEndQuery (uint target); + void glGetQueryiv (uint target, uint pname, GLint* params); + void glGetQueryObjectiv (uint id, uint pname, GLint* params); + void glGetQueryObjectuiv (uint id, uint pname, GLuint* params); + void glBindBuffer (uint target, uint buffer); + void glDeleteBuffers (int n, GLuint* buffers); + void glGenBuffers (int n, GLuint* buffers); + ubyte glIsBuffer (uint buffer); + void glBufferData (uint target, int size, GLvoid* data, uint usage); + void glBufferSubData (uint target, int offset, int size, GLvoid* data); + void glGetBufferSubData (uint target, int offset, int size, GLvoid* data); + GLvoid* glMapBuffer (uint target, uint access); + ubyte glUnmapBuffer (uint target); + void glGetBufferParameteriv (uint target, uint pname, GLint* params); + void glGetBufferPointerv (uint target, uint pname, GLvoid** params); + void glDrawBuffers (int n, GLenum* bufs); + void glVertexAttrib1d (uint index, double x); + void glVertexAttrib1dv (uint index, GLdouble* v); + void glVertexAttrib1f (uint index, float x); + void glVertexAttrib1fv (uint index, GLfloat* v); + void glVertexAttrib1s (uint index, short x); + void glVertexAttrib1sv (uint index, GLshort* v); + void glVertexAttrib2d (uint index, double x, double y); + void glVertexAttrib2dv (uint index, GLdouble* v); + void glVertexAttrib2f (uint index, float x, float y); + void glVertexAttrib2fv (uint index, GLfloat* v); + void glVertexAttrib2s (uint index, short x, short y); + void glVertexAttrib2sv (uint index, GLshort* v); + void glVertexAttrib3d (uint index, double x, double y, double z); + void glVertexAttrib3dv (uint index, GLdouble* v); + void glVertexAttrib3f (uint index, float x, float y, float z); + void glVertexAttrib3fv (uint index, GLfloat* v); + void glVertexAttrib3s (uint index, short x, short y, short z); + void glVertexAttrib3sv (uint index, GLshort* v); + void glVertexAttrib4Nbv (uint index, char* v); + void glVertexAttrib4Niv (uint index, GLint* v); + void glVertexAttrib4Nsv (uint index, GLshort* v); + void glVertexAttrib4Nub (uint index, ubyte x, ubyte y, ubyte z, ubyte w); + void glVertexAttrib4Nubv (uint index, char* v); + void glVertexAttrib4Nuiv (uint index, GLuint* v); + void glVertexAttrib4Nusv (uint index, GLushort* v); + void glVertexAttrib4bv (uint index, char* v); + void glVertexAttrib4d (uint index, double x, double y, double z, double w); + void glVertexAttrib4dv (uint index, GLdouble* v); + void glVertexAttrib4f (uint index, float x, float y, float z, float w); + void glVertexAttrib4fv (uint index, GLfloat* v); + void glVertexAttrib4iv (uint index, GLint* v); + void glVertexAttrib4s (uint index, short x, short y, short z, short w); + void glVertexAttrib4sv (uint index, GLshort* v); + void glVertexAttrib4ubv (uint index, char* v); + void glVertexAttrib4uiv (uint index, GLuint* v); + void glVertexAttrib4usv (uint index, GLushort* v); + void glVertexAttribPointer (uint index, int size, uint type, ubyte normalized, int stride, GLvoid* pointer); + void glEnableVertexAttribArray (uint index); + void glDisableVertexAttribArray (uint index); + void glGetVertexAttribdv (uint index, uint pname, GLdouble* params); + void glGetVertexAttribfv (uint index, uint pname, GLfloat* params); + void glGetVertexAttribiv (uint index, uint pname, GLint* params); + void glGetVertexAttribPointerv (uint index, uint pname, GLvoid** pointer); + void glDeleteShader (uint shader); + void glDetachShader (uint program, uint shader); + uint glCreateShader (uint type); + void glShaderSource (uint shader, int count, GLchar** string, GLint* length); + void glCompileShader (uint shader); + uint glCreateProgram (); + void glAttachShader (uint program, uint shader); + void glLinkProgram (uint program); + void glUseProgram (uint program); + void glDeleteProgram (uint program); + void glValidateProgram (uint program); + void glUniform1f (int location, float v0); + void glUniform2f (int location, float v0, float v1); + void glUniform3f (int location, float v0, float v1, float v2); + void glUniform4f (int location, float v0, float v1, float v2, float v3); + void glUniform1i (int location, int v0); + void glUniform2i (int location, int v0, int v1); + void glUniform3i (int location, int v0, int v1, int v2); + void glUniform4i (int location, int v0, int v1, int v2, int v3); + void glUniform1fv (int location, int count, GLfloat* value); + void glUniform2fv (int location, int count, GLfloat* value); + void glUniform3fv (int location, int count, GLfloat* value); + void glUniform4fv (int location, int count, GLfloat* value); + void glUniform1iv (int location, int count, GLint* value); + void glUniform2iv (int location, int count, GLint* value); + void glUniform3iv (int location, int count, GLint* value); + void glUniform4iv (int location, int count, GLint* value); + void glUniformMatrix2fv (int location, int count, ubyte transpose, GLfloat* value); + void glUniformMatrix3fv (int location, int count, ubyte transpose, GLfloat* value); + void glUniformMatrix4fv (int location, int count, ubyte transpose, GLfloat* value); + ubyte glIsShader (uint shader); + ubyte glIsProgram (uint program); + void glGetShaderiv (uint shader, uint pname, GLint* params); + void glGetProgramiv (uint program, uint pname, GLint* params); + void glGetAttachedShaders (uint program, int maxCount, GLsizei* count, GLuint* shaders); + void glGetShaderInfoLog (uint shader, int bufSize, GLsizei* length, char* infoLog); + void glGetProgramInfoLog (uint program, int bufSize, GLsizei* length, char* infoLog); + int glGetUniformLocation (uint program, char* name); + void glGetActiveUniform (uint program, uint index, int bufSize, GLsizei* length, GLint* size, GLenum* type, char* name); + void glGetUniformfv (uint program, int location, GLfloat* params); + void glGetUniformiv (uint program, int location, GLint* params); + void glGetShaderSource (uint shader, int bufSize, GLsizei* length, char* source); + void glBindAttribLocation (uint program, uint index, char* name); + void glGetActiveAttrib (uint program, uint index, int bufSize, GLsizei* length, GLint* size, GLenum* type, char* name); + int glGetAttribLocation (uint program, char* name); + void glStencilFuncSeparate (uint face, uint func, int ref_, uint mask); + void glStencilOpSeparate (uint face, uint fail, uint zfail, uint zpass); + void glStencilMaskSeparate (uint face, uint mask); + void glUniformMatrix2x3fv (int location, int count, ubyte transpose, GLfloat* value); + void glUniformMatrix3x2fv (int location, int count, ubyte transpose, GLfloat* value); + void glUniformMatrix2x4fv (int location, int count, ubyte transpose, GLfloat* value); + void glUniformMatrix4x2fv (int location, int count, ubyte transpose, GLfloat* value); + void glUniformMatrix3x4fv (int location, int count, ubyte transpose, GLfloat* value); + void glUniformMatrix4x3fv (int location, int count, ubyte transpose, GLfloat* value); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/opengl/glext.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/opengl/glext.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,393 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.opengl.glext; + +import dstep.opengl.gl; + +alias byte GLcharARB; +alias void* GLhandleARB; +alias int GLintptrARB; +alias int GLsizeiptrARB; + +extern (C) +{ + void glActiveTextureARB (uint dummy); + void glClientActiveTextureARB (uint dummy); + void glMultiTexCoord1dARB (uint dummy, double dummy); + void glMultiTexCoord1dvARB (uint dummy, GLdouble* dummy); + void glMultiTexCoord1fARB (uint dummy, float dummy); + void glMultiTexCoord1fvARB (uint dummy, GLfloat* dummy); + void glMultiTexCoord1iARB (uint dummy, int dummy); + void glMultiTexCoord1ivARB (uint dummy, GLint* dummy); + void glMultiTexCoord1sARB (uint dummy, short dummy); + void glMultiTexCoord1svARB (uint dummy, GLshort* dummy); + void glMultiTexCoord2dARB (uint dummy, double dummy, double dummy); + void glMultiTexCoord2dvARB (uint dummy, GLdouble* dummy); + void glMultiTexCoord2fARB (uint dummy, float dummy, float dummy); + void glMultiTexCoord2fvARB (uint dummy, GLfloat* dummy); + void glMultiTexCoord2iARB (uint dummy, int dummy, int dummy); + void glMultiTexCoord2ivARB (uint dummy, GLint* dummy); + void glMultiTexCoord2sARB (uint dummy, short dummy, short dummy); + void glMultiTexCoord2svARB (uint dummy, GLshort* dummy); + void glMultiTexCoord3dARB (uint dummy, double dummy, double dummy, double dummy); + void glMultiTexCoord3dvARB (uint dummy, GLdouble* dummy); + void glMultiTexCoord3fARB (uint dummy, float dummy, float dummy, float dummy); + void glMultiTexCoord3fvARB (uint dummy, GLfloat* dummy); + void glMultiTexCoord3iARB (uint dummy, int dummy, int dummy, int dummy); + void glMultiTexCoord3ivARB (uint dummy, GLint* dummy); + void glMultiTexCoord3sARB (uint dummy, short dummy, short dummy, short dummy); + void glMultiTexCoord3svARB (uint dummy, GLshort* dummy); + void glMultiTexCoord4dARB (uint dummy, double dummy, double dummy, double dummy, double dummy); + void glMultiTexCoord4dvARB (uint dummy, GLdouble* dummy); + void glMultiTexCoord4fARB (uint dummy, float dummy, float dummy, float dummy, float dummy); + void glMultiTexCoord4fvARB (uint dummy, GLfloat* dummy); + void glMultiTexCoord4iARB (uint dummy, int dummy, int dummy, int dummy, int dummy); + void glMultiTexCoord4ivARB (uint dummy, GLint* dummy); + void glMultiTexCoord4sARB (uint dummy, short dummy, short dummy, short dummy, short dummy); + void glMultiTexCoord4svARB (uint dummy, GLshort* dummy); + void glLoadTransposeMatrixfARB (GLfloat* dummy); + void glLoadTransposeMatrixdARB (GLdouble* dummy); + void glMultTransposeMatrixfARB (GLfloat* dummy); + void glMultTransposeMatrixdARB (GLdouble* dummy); + void glSampleCoverageARB (float dummy, ubyte dummy); + void glSamplePassARB (uint dummy); + void glCompressedTexImage3DARB (uint dummy, int dummy, uint dummy, int dummy, int dummy, int dummy, int dummy, int dummy, GLvoid* dummy); + void glCompressedTexImage2DARB (uint dummy, int dummy, uint dummy, int dummy, int dummy, int dummy, int dummy, GLvoid* dummy); + void glCompressedTexImage1DARB (uint dummy, int dummy, uint dummy, int dummy, int dummy, int dummy, GLvoid* dummy); + void glCompressedTexSubImage3DARB (uint dummy, int dummy, int dummy, int dummy, int dummy, int dummy, int dummy, int dummy, uint dummy, int dummy, GLvoid* dummy); + void glCompressedTexSubImage2DARB (uint dummy, int dummy, int dummy, int dummy, int dummy, int dummy, uint dummy, int dummy, GLvoid* dummy); + void glCompressedTexSubImage1DARB (uint dummy, int dummy, int dummy, int dummy, uint dummy, int dummy, GLvoid* dummy); + void glGetCompressedTexImageARB (uint dummy, int dummy, GLvoid* dummy); + void glWeightbvARB (int dummy, char* dummy); + void glWeightsvARB (int dummy, GLshort* dummy); + void glWeightivARB (int dummy, GLint* dummy); + void glWeightfvARB (int dummy, GLfloat* dummy); + void glWeightdvARB (int dummy, GLdouble* dummy); + void glWeightubvARB (int dummy, char* dummy); + void glWeightusvARB (int dummy, GLushort* dummy); + void glWeightuivARB (int dummy, GLuint* dummy); + void glWeightPointerARB (int dummy, uint dummy, int dummy, GLvoid* dummy); + void glVertexBlendARB (int dummy); + void glWindowPos2dARB (double dummy, double dummy); + void glWindowPos2dvARB (GLdouble* dummy); + void glWindowPos2fARB (float dummy, float dummy); + void glWindowPos2fvARB (GLfloat* dummy); + void glWindowPos2iARB (int dummy, int dummy); + void glWindowPos2ivARB (GLint* dummy); + void glWindowPos2sARB (short dummy, short dummy); + void glWindowPos2svARB (GLshort* dummy); + void glWindowPos3dARB (double dummy, double dummy, double dummy); + void glWindowPos3dvARB (GLdouble* dummy); + void glWindowPos3fARB (float dummy, float dummy, float dummy); + void glWindowPos3fvARB (GLfloat* dummy); + void glWindowPos3iARB (int dummy, int dummy, int dummy); + void glWindowPos3ivARB (GLint* dummy); + void glWindowPos3sARB (short dummy, short dummy, short dummy); + void glWindowPos3svARB (GLshort* dummy); + void glGenQueriesARB (int n, GLuint* ids); + void glDeleteQueriesARB (int n, GLuint* ids); + ubyte glIsQueryARB (uint id); + void glBeginQueryARB (uint target, uint id); + void glEndQueryARB (uint target); + void glGetQueryivARB (uint target, uint pname, GLint* params); + void glGetQueryObjectivARB (uint id, uint pname, GLint* params); + void glGetQueryObjectuivARB (uint id, uint pname, GLuint* params); + void glPointParameterfARB (uint pname, float param); + void glPointParameterfvARB (uint pname, GLfloat* params); + void glBindProgramARB (uint target, uint program); + void glDeleteProgramsARB (int n, GLuint* programs); + void glGenProgramsARB (int n, GLuint* programs); + ubyte glIsProgramARB (uint program); + void glProgramEnvParameter4dARB (uint target, uint index, double x, double y, double z, double w); + void glProgramEnvParameter4dvARB (uint target, uint index, GLdouble* params); + void glProgramEnvParameter4fARB (uint target, uint index, float x, float y, float z, float w); + void glProgramEnvParameter4fvARB (uint target, uint index, GLfloat* params); + void glProgramLocalParameter4dARB (uint target, uint index, double x, double y, double z, double w); + void glProgramLocalParameter4dvARB (uint target, uint index, GLdouble* params); + void glProgramLocalParameter4fARB (uint target, uint index, float x, float y, float z, float w); + void glProgramLocalParameter4fvARB (uint target, uint index, GLfloat* params); + void glGetProgramEnvParameterdvARB (uint target, uint index, GLdouble* params); + void glGetProgramEnvParameterfvARB (uint target, uint index, GLfloat* params); + void glProgramEnvParameters4fvEXT (uint target, uint index, int count, GLfloat* params); + void glProgramLocalParameters4fvEXT (uint target, uint index, int count, GLfloat* params); + void glGetProgramLocalParameterdvARB (uint target, uint index, GLdouble* params); + void glGetProgramLocalParameterfvARB (uint target, uint index, GLfloat* params); + void glProgramStringARB (uint target, uint format, int len, GLvoid* string); + void glGetProgramStringARB (uint target, uint pname, GLvoid* string); + void glGetProgramivARB (uint target, uint pname, GLint* params); + void glVertexAttrib1dARB (uint index, double x); + void glVertexAttrib1dvARB (uint index, GLdouble* v); + void glVertexAttrib1fARB (uint index, float x); + void glVertexAttrib1fvARB (uint index, GLfloat* v); + void glVertexAttrib1sARB (uint index, short x); + void glVertexAttrib1svARB (uint index, GLshort* v); + void glVertexAttrib2dARB (uint index, double x, double y); + void glVertexAttrib2dvARB (uint index, GLdouble* v); + void glVertexAttrib2fARB (uint index, float x, float y); + void glVertexAttrib2fvARB (uint index, GLfloat* v); + void glVertexAttrib2sARB (uint index, short x, short y); + void glVertexAttrib2svARB (uint index, GLshort* v); + void glVertexAttrib3dARB (uint index, double x, double y, double z); + void glVertexAttrib3dvARB (uint index, GLdouble* v); + void glVertexAttrib3fARB (uint index, float x, float y, float z); + void glVertexAttrib3fvARB (uint index, GLfloat* v); + void glVertexAttrib3sARB (uint index, short x, short y, short z); + void glVertexAttrib3svARB (uint index, GLshort* v); + void glVertexAttrib4NbvARB (uint index, char* v); + void glVertexAttrib4NivARB (uint index, GLint* v); + void glVertexAttrib4NsvARB (uint index, GLshort* v); + void glVertexAttrib4NubARB (uint index, ubyte x, ubyte y, ubyte z, ubyte w); + void glVertexAttrib4NubvARB (uint index, char* v); + void glVertexAttrib4NuivARB (uint index, GLuint* v); + void glVertexAttrib4NusvARB (uint index, GLushort* v); + void glVertexAttrib4bvARB (uint index, char* v); + void glVertexAttrib4dARB (uint index, double x, double y, double z, double w); + void glVertexAttrib4dvARB (uint index, GLdouble* v); + void glVertexAttrib4fARB (uint index, float x, float y, float z, float w); + void glVertexAttrib4fvARB (uint index, GLfloat* v); + void glVertexAttrib4ivARB (uint index, GLint* v); + void glVertexAttrib4sARB (uint index, short x, short y, short z, short w); + void glVertexAttrib4svARB (uint index, GLshort* v); + void glVertexAttrib4ubvARB (uint index, char* v); + void glVertexAttrib4uivARB (uint index, GLuint* v); + void glVertexAttrib4usvARB (uint index, GLushort* v); + void glVertexAttribPointerARB (uint index, int size, uint type, ubyte normalized, int stride, GLvoid* pointer); + void glDisableVertexAttribArrayARB (uint index); + void glEnableVertexAttribArrayARB (uint index); + void glGetVertexAttribPointervARB (uint index, uint pname, GLvoid** pointer); + void glGetVertexAttribdvARB (uint index, uint pname, GLdouble* params); + void glGetVertexAttribfvARB (uint index, uint pname, GLfloat* params); + void glGetVertexAttribivARB (uint index, uint pname, GLint* params); + void glDeleteObjectARB (GLhandleARB obj); + GLhandleARB glGetHandleARB (uint pname); + void glDetachObjectARB (GLhandleARB containerObj, GLhandleARB attachedObj); + GLhandleARB glCreateShaderObjectARB (uint shaderType); + void glShaderSourceARB (GLhandleARB shaderObj, int count, GLcharARB** string, GLint* length); + void glCompileShaderARB (GLhandleARB shaderObj); + GLhandleARB glCreateProgramObjectARB (); + void glAttachObjectARB (GLhandleARB containerObj, GLhandleARB obj); + void glLinkProgramARB (GLhandleARB programObj); + void glUseProgramObjectARB (GLhandleARB programObj); + void glValidateProgramARB (GLhandleARB programObj); + void glUniform1fARB (int location, float v0); + void glUniform2fARB (int location, float v0, float v1); + void glUniform3fARB (int location, float v0, float v1, float v2); + void glUniform4fARB (int location, float v0, float v1, float v2, float v3); + void glUniform1iARB (int location, int v0); + void glUniform2iARB (int location, int v0, int v1); + void glUniform3iARB (int location, int v0, int v1, int v2); + void glUniform4iARB (int location, int v0, int v1, int v2, int v3); + void glUniform1fvARB (int location, int count, GLfloat* value); + void glUniform2fvARB (int location, int count, GLfloat* value); + void glUniform3fvARB (int location, int count, GLfloat* value); + void glUniform4fvARB (int location, int count, GLfloat* value); + void glUniform1ivARB (int location, int count, GLint* value); + void glUniform2ivARB (int location, int count, GLint* value); + void glUniform3ivARB (int location, int count, GLint* value); + void glUniform4ivARB (int location, int count, GLint* value); + void glUniformMatrix2fvARB (int location, int count, ubyte transpose, GLfloat* value); + void glUniformMatrix3fvARB (int location, int count, ubyte transpose, GLfloat* value); + void glUniformMatrix4fvARB (int location, int count, ubyte transpose, GLfloat* value); + void glGetObjectParameterfvARB (GLhandleARB obj, uint pname, GLfloat* params); + void glGetObjectParameterivARB (GLhandleARB obj, uint pname, GLint* params); + void glGetInfoLogARB (GLhandleARB obj, int maxLength, GLsizei* length, char* infoLog); + void glGetAttachedObjectsARB (GLhandleARB containerObj, int maxCount, GLsizei* count, GLhandleARB* obj); + int glGetUniformLocationARB (GLhandleARB programObj, char* name); + void glGetActiveUniformARB (GLhandleARB programObj, uint index, int maxLength, GLsizei* length, GLint* size, GLenum* type, char* name); + void glGetUniformfvARB (GLhandleARB programObj, int location, GLfloat* params); + void glGetUniformivARB (GLhandleARB programObj, int location, GLint* params); + void glGetShaderSourceARB (GLhandleARB obj, int maxLength, GLsizei* length, char* source); + void glBindAttribLocationARB (GLhandleARB programObj, uint index, char* name); + void glGetActiveAttribARB (GLhandleARB programObj, uint index, int maxLength, GLsizei* length, GLint* size, GLenum* type, char* name); + int glGetAttribLocationARB (GLhandleARB programObj, char* name); + void glBindBufferARB (uint target, uint buffer); + void glDeleteBuffersARB (int n, GLuint* buffers); + void glGenBuffersARB (int n, GLuint* buffers); + ubyte glIsBufferARB (uint buffer); + void glBufferDataARB (uint target, int size, GLvoid* data, uint usage); + void glBufferSubDataARB (uint target, int offset, int size, GLvoid* data); + void glGetBufferSubDataARB (uint target, int offset, int size, GLvoid* data); + GLvoid* glMapBufferARB (uint target, uint access); + ubyte glUnmapBufferARB (uint target); + void glGetBufferParameterivARB (uint target, uint pname, GLint* params); + void glGetBufferPointervARB (uint target, uint pname, GLvoid** params); + void glDrawBuffersARB (int n, GLenum* bufs); + void glBlendColorEXT (float dummy, float dummy, float dummy, float dummy); + void glBlendEquationEXT (uint dummy); + void glColorTableEXT (uint dummy, uint dummy, int dummy, uint dummy, uint dummy, GLvoid* dummy); + void glColorSubTableEXT (uint dummy, int dummy, int dummy, uint dummy, uint dummy, GLvoid* dummy); + void glGetColorTableEXT (uint dummy, uint dummy, uint dummy, GLvoid* dummy); + void glGetColorTableParameterivEXT (uint dummy, uint dummy, GLint* dummy); + void glGetColorTableParameterfvEXT (uint dummy, uint dummy, GLfloat* dummy); + void glLockArraysEXT (int dummy, int dummy); + void glUnlockArraysEXT (); + void glDrawRangeElementsEXT (uint dummy, uint dummy, uint dummy, int dummy, uint dummy, GLvoid* dummy); + void glSecondaryColor3bEXT (byte dummy, byte dummy, byte dummy); + void glSecondaryColor3bvEXT (char* dummy); + void glSecondaryColor3dEXT (double dummy, double dummy, double dummy); + void glSecondaryColor3dvEXT (GLdouble* dummy); + void glSecondaryColor3fEXT (float dummy, float dummy, float dummy); + void glSecondaryColor3fvEXT (GLfloat* dummy); + void glSecondaryColor3iEXT (int dummy, int dummy, int dummy); + void glSecondaryColor3ivEXT (GLint* dummy); + void glSecondaryColor3sEXT (short dummy, short dummy, short dummy); + void glSecondaryColor3svEXT (GLshort* dummy); + void glSecondaryColor3ubEXT (ubyte dummy, ubyte dummy, ubyte dummy); + void glSecondaryColor3ubvEXT (char* dummy); + void glSecondaryColor3uiEXT (uint dummy, uint dummy, uint dummy); + void glSecondaryColor3uivEXT (GLuint* dummy); + void glSecondaryColor3usEXT (ushort dummy, ushort dummy, ushort dummy); + void glSecondaryColor3usvEXT (GLushort* dummy); + void glSecondaryColorPointerEXT (int dummy, uint dummy, int dummy, GLvoid* dummy); + void glMultiDrawArraysEXT (uint dummy, GLint* dummy, GLsizei* dummy, int dummy); + void glMultiDrawElementsEXT (uint dummy, GLsizei* dummy, uint dummy, GLvoid** dummy, int dummy); + void glFogCoordfEXT (float dummy); + void glFogCoordfvEXT (GLfloat* dummy); + void glFogCoorddEXT (double dummy); + void glFogCoorddvEXT (GLdouble* dummy); + void glFogCoordPointerEXT (uint dummy, int dummy, GLvoid* dummy); + void glBlendFuncSeparateEXT (uint dummy, uint dummy, uint dummy, uint dummy); + void glActiveStencilFaceEXT (uint face); + void glDepthBoundsEXT (double zmin, double zmax); + void glBlendEquationSeparateEXT (uint modeRGB, uint modeAlpha); + ubyte glIsRenderbufferEXT (uint renderbuffer); + void glBindRenderbufferEXT (uint target, uint renderbuffer); + void glDeleteRenderbuffersEXT (int n, GLuint* renderbuffers); + void glGenRenderbuffersEXT (int n, GLuint* renderbuffers); + void glRenderbufferStorageEXT (uint target, uint internalformat, int width, int height); + void glGetRenderbufferParameterivEXT (uint target, uint pname, GLint* params); + ubyte glIsFramebufferEXT (uint framebuffer); + void glBindFramebufferEXT (uint target, uint framebuffer); + void glDeleteFramebuffersEXT (int n, GLuint* framebuffers); + void glGenFramebuffersEXT (int n, GLuint* framebuffers); + uint glCheckFramebufferStatusEXT (uint target); + void glFramebufferTexture1DEXT (uint target, uint attachment, uint textarget, uint texture, int level); + void glFramebufferTexture2DEXT (uint target, uint attachment, uint textarget, uint texture, int level); + void glFramebufferTexture3DEXT (uint target, uint attachment, uint textarget, uint texture, int level, int zoffset); + void glFramebufferRenderbufferEXT (uint target, uint attachment, uint renderbuffertarget, uint renderbuffer); + void glGetFramebufferAttachmentParameterivEXT (uint target, uint attachment, uint pname, GLint* params); + void glGenerateMipmapEXT (uint target); + void glBlitFramebufferEXT (int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1, uint mask, uint filter); + void glRenderbufferStorageMultisampleEXT (uint target, int samples, uint internalformat, int width, int height); + void glProgramParameteriEXT (uint program, uint pname, int value); + void glFramebufferTextureEXT (uint target, uint attachment, uint texture, int level); + void glFramebufferTextureLayerEXT (uint target, uint attachment, uint texture, int level, int layer); + void glFramebufferTextureFaceEXT (uint target, uint attachment, uint texture, int level, uint face); + void glBindBufferRangeEXT (uint target, uint index, uint buffer, int offset, int size); + void glBindBufferOffsetEXT (uint target, uint index, uint buffer, int offset); + void glBindBufferBaseEXT (uint target, uint index, uint buffer); + void glBeginTransformFeedbackEXT (uint primitiveMode); + void glEndTransformFeedbackEXT (); + void glTransformFeedbackVaryingsEXT (uint program, int count, GLchar** varyings, uint bufferMode); + void glGetTransformFeedbackVaryingEXT (uint program, uint index, int bufSize, GLsizei* length, GLsizei* size, GLenum* type, char* name); + void glGetIntegerIndexedvEXT (uint param, uint index, GLint* values); + void glGetBooleanIndexedvEXT (uint param, uint index, char* values); + void glUniformBufferEXT (uint program, int location, uint buffer); + int glGetUniformBufferSizeEXT (uint program, int location); + int glGetUniformOffsetEXT (uint program, int location); + void glClearColorIiEXT (int r, int g, int b, int a); + void glClearColorIuiEXT (uint r, uint g, uint b, uint a); + void glTexParameterIivEXT (uint target, uint pname, GLint* params); + void glTexParameterIuivEXT (uint target, uint pname, GLuint* params); + void glGetTexParameterIivEXT (uint target, uint pname, GLint* params); + void glGetTexParameterIiuvEXT (uint target, uint pname, GLuint* params); + void glVertexAttribI1iEXT (uint index, int x); + void glVertexAttribI2iEXT (uint index, int x, int y); + void glVertexAttribI3iEXT (uint index, int x, int y, int z); + void glVertexAttribI4iEXT (uint index, int x, int y, int z, int w); + void glVertexAttribI1uiEXT (uint index, uint x); + void glVertexAttribI2uiEXT (uint index, uint x, uint y); + void glVertexAttribI3uiEXT (uint index, uint x, uint y, uint z); + void glVertexAttribI4uiEXT (uint index, uint x, uint y, uint z, uint w); + void glVertexAttribI1ivEXT (uint index, GLint* v); + void glVertexAttribI2ivEXT (uint index, GLint* v); + void glVertexAttribI3ivEXT (uint index, GLint* v); + void glVertexAttribI4ivEXT (uint index, GLint* v); + void glVertexAttribI1uivEXT (uint index, GLuint* v); + void glVertexAttribI2uivEXT (uint index, GLuint* v); + void glVertexAttribI3uivEXT (uint index, GLuint* v); + void glVertexAttribI4uivEXT (uint index, GLuint* v); + void glVertexAttribI4bvEXT (uint index, char* v); + void glVertexAttribI4svEXT (uint index, GLshort* v); + void glVertexAttribI4ubvEXT (uint index, char* v); + void glVertexAttribI4usvEXT (uint index, GLushort* v); + void glVertexAttribIPointerEXT (uint index, int size, uint type, int stride, GLvoid* pointer); + void glGetVertexAttribIivEXT (uint index, uint pname, GLint* params); + void glGetVertexAttribIuivEXT (uint index, uint pname, GLuint* params); + void glUniform1uiEXT (int location, uint v0); + void glUniform2uiEXT (int location, uint v0, uint v1); + void glUniform3uiEXT (int location, uint v0, uint v1, uint v2); + void glUniform4uiEXT (int location, uint v0, uint v1, uint v2, uint v3); + void glUniform1uivEXT (int location, int count, GLuint* value); + void glUniform2uivEXT (int location, int count, GLuint* value); + void glUniform3uivEXT (int location, int count, GLuint* value); + void glUniform4uivEXT (int location, int count, GLuint* value); + void glGetUniformuivEXT (uint program, int location, GLuint* params); + void glBindFragDataLocationEXT (uint program, uint colorNumber, char* name); + int glGetFragDataLocationEXT (uint program, char* name); + void glTextureRangeAPPLE (uint target, int length, GLvoid* pointer); + void glGetTexParameterPointervAPPLE (uint target, uint pname, GLvoid** params); + void glVertexArrayRangeAPPLE (int length, GLvoid* pointer); + void glFlushVertexArrayRangeAPPLE (int length, GLvoid* pointer); + void glVertexArrayParameteriAPPLE (uint pname, int param); + void glBindVertexArrayAPPLE (uint id); + void glDeleteVertexArraysAPPLE (int n, GLuint* ids); + void glGenVertexArraysAPPLE (int n, GLuint* ids); + ubyte glIsVertexArrayAPPLE (uint id); + void glGenFencesAPPLE (int n, GLuint* fences); + void glDeleteFencesAPPLE (int n, GLuint* fences); + void glSetFenceAPPLE (uint fence); + ubyte glIsFenceAPPLE (uint fence); + ubyte glTestFenceAPPLE (uint fence); + void glFinishFenceAPPLE (uint fence); + ubyte glTestObjectAPPLE (uint object, uint name); + void glFinishObjectAPPLE (uint object, uint name); + void glElementPointerAPPLE (uint type, GLvoid* pointer); + void glDrawElementArrayAPPLE (uint mode, int first, int count); + void glDrawRangeElementArrayAPPLE (uint mode, uint start, uint end, int first, int count); + void glMultiDrawElementArrayAPPLE (uint mode, GLint* first, GLsizei* count, int primcount); + void glMultiDrawRangeElementArrayAPPLE (uint mode, uint start, uint end, GLint* first, GLsizei* count, int primcount); + void glFlushRenderAPPLE (); + void glFinishRenderAPPLE (); + void glSwapAPPLE (); + void glEnableVertexAttribAPPLE (uint index, uint pname); + void glDisableVertexAttribAPPLE (uint index, uint pname); + ubyte glIsVertexAttribEnabledAPPLE (uint index, uint pname); + void glMapVertexAttrib1dAPPLE (uint index, uint size, double u1, double u2, int stride, int order, GLdouble* points); + void glMapVertexAttrib1fAPPLE (uint index, uint size, float u1, float u2, int stride, int order, GLfloat* points); + void glMapVertexAttrib2dAPPLE (uint index, uint size, double u1, double u2, int ustride, int uorder, double v1, double v2, int vstride, int vorder, GLdouble* points); + void glMapVertexAttrib2fAPPLE (uint index, uint size, float u1, float u2, int ustride, int uorder, float v1, float v2, int vstride, int vorder, GLfloat* points); + void glBufferParameteriAPPLE (uint target, uint pname, int param); + void glFlushMappedBufferRangeAPPLE (uint target, int offset, int size); + uint glObjectPurgeableAPPLE (uint objectType, uint name, uint option); + uint glObjectUnpurgeableAPPLE (uint objectType, uint name, uint option); + void glGetObjectParameterivAPPLE (uint objectType, uint name, uint pname, GLint* params); + void glPNTrianglesiATI (uint pname, int param); + void glPNTrianglesfATI (uint pname, float param); + void glBlendEquationSeparateATI (uint equationRGB, uint equationAlpha); + void glStencilOpSeparateATI (uint face, uint sfail, uint dpfail, uint dppass); + void glStencilFuncSeparateATI (uint frontfunc, uint backfunc, int ref_, uint mask); + void glPNTrianglesiATIX (uint pname, int param); + void glPNTrianglesfATIX (uint pname, float param); + void glCombinerParameterfvNV (uint dummy, GLfloat* dummy); + void glCombinerParameterfNV (uint dummy, float dummy); + void glCombinerParameterivNV (uint dummy, GLint* dummy); + void glCombinerParameteriNV (uint dummy, int dummy); + void glCombinerInputNV (uint dummy, uint dummy, uint dummy, uint dummy, uint dummy, uint dummy); + void glCombinerOutputNV (uint dummy, uint dummy, uint dummy, uint dummy, uint dummy, uint dummy, uint dummy, ubyte dummy, ubyte dummy, ubyte dummy); + void glFinalCombinerInputNV (uint dummy, uint dummy, uint dummy, uint dummy); + void glGetCombinerInputParameterfvNV (uint dummy, uint dummy, uint dummy, uint dummy, GLfloat* dummy); + void glGetCombinerInputParameterivNV (uint dummy, uint dummy, uint dummy, uint dummy, GLint* dummy); + void glGetCombinerOutputParameterfvNV (uint dummy, uint dummy, uint dummy, GLfloat* dummy); + void glGetCombinerOutputParameterivNV (uint dummy, uint dummy, uint dummy, GLint* dummy); + void glGetFinalCombinerInputParameterfvNV (uint dummy, uint dummy, GLfloat* dummy); + void glGetFinalCombinerInputParameterivNV (uint dummy, uint dummy, GLint* dummy); + void glCombinerStageParameterfvNV (uint dummy, uint dummy, GLfloat* dummy); + void glGetCombinerStageParameterfvNV (uint dummy, uint dummy, GLfloat* dummy); + void glPointParameteriNV (uint pname, int param); + void glPointParameterivNV (uint pname, GLint* params); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/opengl/gliContext.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/opengl/gliContext.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,11 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.opengl.gliContext; + +struct __GLIContextRec; + +alias __GLIContextRec* GLIContext; \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/opengl/gliDispatch.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/opengl/gliDispatch.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,173 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.opengl.gliDispatch; + +import dstep.opengl.gl; +import dstep.opengl.glext; +import dstep.opengl.gliContext; + +struct GLIFunctionDispatch +{ + uint op; + uint func; + int n; + GLuint* textures; + uint target; + int width; + int height; + float xorig; + float yorig; + float xmove; + float ymove; + uint sfactor; + uint type; + float red; + float green; + float blue; + uint plane; + uint face; + int size; + int stride; + int x; + int y; + int level; + uint internalFormat; + int xoffset; + int yoffset; + uint list; + double zNear; + uint mode; + int first; + int count; + uint format; + double u; + int i1; + int i2; + int j1; + int i; + uint pname; + double left; + double right; + double bottom; + double top; + uint light; + uint query; + uint map; + uint coord; + int factor; + double u1; + double u2; + int order; + int ustride; + int uorder; + double v1; + double v2; + int vstride; + int vorder; + int un; + int vn; + byte nx; + byte ny; + int mapsize; + float xfactor; + double z; + double x1; + double y1; + double x2; + double angle; + int ref_; + uint fail; + uint zfail; + double s; + double t; + double r; + uint internalformat; + int border; + uint sfactorRGB; + uint dfactorRGB; + uint sfactorAlpha; + int depth; + int imageSize; + int zoffset; + uint start; + uint end; + GLvoid* row; + GLvoid* column; + ubyte reset; + uint stage; + uint portion; + uint variable; + uint input; + uint mapping; + uint abOutput; + uint cdOutput; + uint sumOutput; + uint scale; + uint bias; + ubyte abDotProduct; + ubyte cdDotProduct; + int length; + uint equationRGB; + float value; + uint object; + uint index; + ubyte normalized; + int len; + GLvoid** indices; + uint sfail; + uint dpfail; + uint frontfunc; + uint backfunc; + GLhandleARB containerObj; + GLhandleARB shaderObj; + GLcharARB** string; + int location; + float v0; + ubyte transpose; + GLhandleARB obj; + int maxLength; + int maxCount; + GLhandleARB programObj; + uint id; + GLvoid* data; + int offset; + double zmin; + uint shader; + uint program; + int bufSize; + uint attachment; + uint textarget; + uint texture; + uint renderbuffertarget; + uint objectType; + uint name; + uint program_name; + uint buffer; + GLchar** varyings; + uint param; + int g; + int b; + uint colorNumber; + GLuint* shaders; + uint binaryformat; + GLvoid* binary; + uint shadertype; + uint precisiontype; + GLint* range; + GLint* listofformats; + int srcX0; + int srcY0; + int srcX1; + int srcY1; + int dstX0; + int dstY0; + int dstX1; + int dstY1; + uint mask; + int samples; +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/opengl/glu.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/opengl/glu.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,78 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.opengl.glu; + +import dstep.opengl.gl; + +struct GLUnurbs; +struct GLUquadric; +struct GLUtesselator; + +alias GLUnurbs GLUnurbsObj; +alias GLUquadric GLUquadricObj; +alias GLUtesselator GLUtesselatorObj; +alias GLUtesselator GLUtriangulatorObj; + +extern (C) +{ + void gluBeginCurve (GLUnurbs* nurb); + void gluBeginPolygon (GLUtesselator* tess); + void gluBeginSurface (GLUnurbs* nurb); + void gluBeginTrim (GLUnurbs* nurb); + int gluBuild1DMipmapLevels (uint target, int internalFormat, int width, uint format, uint type, int level, int base, int max, void* data); + int gluBuild1DMipmaps (uint target, int internalFormat, int width, uint format, uint type, void* data); + int gluBuild2DMipmapLevels (uint target, int internalFormat, int width, int height, uint format, uint type, int level, int base, int max, void* data); + int gluBuild2DMipmaps (uint target, int internalFormat, int width, int height, uint format, uint type, void* data); + int gluBuild3DMipmapLevels (uint target, int internalFormat, int width, int height, int depth, uint format, uint type, int level, int base, int max, void* data); + int gluBuild3DMipmaps (uint target, int internalFormat, int width, int height, int depth, uint format, uint type, void* data); + ubyte gluCheckExtension (char* extName, char* extString); + void gluCylinder (GLUquadric* quad, double base, double top, double height, int slices, int stacks); + void gluDeleteNurbsRenderer (GLUnurbs* nurb); + void gluDeleteQuadric (GLUquadric* quad); + void gluDeleteTess (GLUtesselator* tess); + void gluDisk (GLUquadric* quad, double inner, double outer, int slices, int loops); + void gluEndCurve (GLUnurbs* nurb); + void gluEndPolygon (GLUtesselator* tess); + void gluEndSurface (GLUnurbs* nurb); + void gluEndTrim (GLUnurbs* nurb); + char* gluErrorString (uint error); + void gluGetNurbsProperty (GLUnurbs* nurb, uint property, GLfloat* data); + char* gluGetString (uint name); + void gluGetTessProperty (GLUtesselator* tess, uint which, GLdouble* data); + void gluLoadSamplingMatrices (GLUnurbs* nurb, GLfloat* model, GLfloat* perspective, GLint* view); + void gluLookAt (double eyeX, double eyeY, double eyeZ, double centerX, double centerY, double centerZ, double upX, double upY, double upZ); + GLUnurbs* gluNewNurbsRenderer (); + GLUquadric* gluNewQuadric (); + GLUtesselator* gluNewTess (); + void gluNextContour (GLUtesselator* tess, uint type); + void gluNurbsCallbackData (GLUnurbs* nurb, GLvoid* userData); + void gluNurbsCallbackDataEXT (GLUnurbs* nurb, GLvoid* userData); + void gluNurbsCurve (GLUnurbs* nurb, int knotCount, GLfloat* knots, int stride, GLfloat* control, int order, uint type); + void gluNurbsProperty (GLUnurbs* nurb, uint property, float value); + void gluNurbsSurface (GLUnurbs* nurb, int sKnotCount, GLfloat* sKnots, int tKnotCount, GLfloat* tKnots, int sStride, int tStride, GLfloat* control, int sOrder, int tOrder, uint type); + void gluOrtho2D (double left, double right, double bottom, double top); + void gluPartialDisk (GLUquadric* quad, double inner, double outer, int slices, int loops, double start, double sweep); + void gluPerspective (double fovy, double aspect, double zNear, double zFar); + void gluPickMatrix (double x, double y, double delX, double delY, GLint* viewport); + int gluProject (double objX, double objY, double objZ, GLdouble* model, GLdouble* proj, GLint* view, GLdouble* winX, GLdouble* winY, GLdouble* winZ); + void gluPwlCurve (GLUnurbs* nurb, int count, GLfloat* data, int stride, uint type); + void gluQuadricDrawStyle (GLUquadric* quad, uint draw); + void gluQuadricNormals (GLUquadric* quad, uint normal); + void gluQuadricOrientation (GLUquadric* quad, uint orientation); + void gluQuadricTexture (GLUquadric* quad, ubyte texture); + int gluScaleImage (uint format, int wIn, int hIn, uint typeIn, void* dataIn, int wOut, int hOut, uint typeOut, GLvoid* dataOut); + void gluSphere (GLUquadric* quad, double radius, int slices, int stacks); + void gluTessBeginContour (GLUtesselator* tess); + void gluTessBeginPolygon (GLUtesselator* tess, GLvoid* data); + void gluTessEndContour (GLUtesselator* tess); + void gluTessEndPolygon (GLUtesselator* tess); + void gluTessNormal (GLUtesselator* tess, double valueX, double valueY, double valueZ); + void gluTessProperty (GLUtesselator* tess, uint which, double data); + void gluTessVertex (GLUtesselator* tess, GLdouble* location, GLvoid* data); + int gluUnProject (double winX, double winY, double winZ, GLdouble* model, GLdouble* proj, GLint* view, GLdouble* objX, GLdouble* objY, GLdouble* objZ); + int gluUnProject4 (double winX, double winY, double winZ, double clipW, GLdouble* model, GLdouble* proj, GLint* view, double nearPlane, double farPlane, GLdouble* objX, GLdouble* objY, GLdouble* objZ, GLdouble* objW); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/opengl/gluContext.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/opengl/gluContext.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,29 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.opengl.gluContext; + +import dstep.opengl.CGLContext; +import dstep.opengl.gl; +import dstep.opengl.glu; + +extern (C) +{ + int gluBuild1DMipmapsCTX (_CGLContextObject* ctx, uint target, int internalFormat, int width, uint format, uint type, void* data); + int gluBuild2DMipmapsCTX (_CGLContextObject* ctx, uint target, int internalFormat, int width, int height, uint format, uint type, void* data); + int gluBuild3DMipmapsCTX (_CGLContextObject* ctx, uint target, int internalFormat, int width, int height, int depth, uint format, uint type, void* data); + int gluBuild1DMipmapLevelsCTX (_CGLContextObject* ctx, uint target, int internalFormat, int width, uint format, uint type, int level, int base, int max, void* data); + int gluBuild2DMipmapLevelsCTX (_CGLContextObject* ctx, uint target, int internalFormat, int width, int height, uint format, uint type, int level, int base, int max, void* data); + int gluBuild3DMipmapLevelsCTX (_CGLContextObject* ctx, uint target, int internalFormat, int width, int height, int depth, uint format, uint type, int level, int base, int max, void* data); + void gluLookAtCTX (_CGLContextObject* ctx, double eyeX, double eyeY, double eyeZ, double centerX, double centerY, double centerZ, double upX, double upY, double upZ); + GLUnurbs* gluNewNurbsRendererCTX (_CGLContextObject* ctx); + GLUquadric* gluNewQuadricCTX (_CGLContextObject* ctx); + GLUtesselator* gluNewTessCTX (_CGLContextObject* ctx); + void gluOrtho2DCTX (_CGLContextObject* ctx, double left, double right, double bottom, double top); + void gluPerspectiveCTX (_CGLContextObject* ctx, double fovy, double aspect, double zNear, double zFar); + void gluPickMatrixCTX (_CGLContextObject* ctx, double x, double y, double delX, double delY, GLint* viewport); + int gluScaleImageCTX (_CGLContextObject* ctx, uint format, int wIn, int hIn, uint typeIn, void* dataIn, int wOut, int hOut, uint typeOut, void* dataOut); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/opengl/gluMacro.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/opengl/gluMacro.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,11 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.opengl.gluMacro; + +import dstep.opengl.CGLMacro; +import dstep.opengl.gluContext; + diff -r 7ff919f595d5 -r 19885b43130e dstep/qtkit/QTCaptureAudioPreviewOutput.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/qtkit/QTCaptureAudioPreviewOutput.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,39 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 28, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.qtkit.QTCaptureAudioPreviewOutput; + +import dstep.foundation.Foundation; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.qtkit.QTCaptureOutput; +import dstep.qtkit.QTKitDefines; + +class QTCaptureAudioPreviewOutput : QTCaptureOutput +{ + mixin (ObjcWrap); + + NSString outputDeviceUniqueID () + { + return invokeObjcSelf!(NSString, "outputDeviceUniqueID"); + } + + void setOutputDeviceUniqueID (NSString uniqueID) + { + return invokeObjcSelf!(void, "setOutputDeviceUniqueID:", NSString)(uniqueID); + } + + float volume () + { + return invokeObjcSelf!(float, "volume"); + } + + void setVolume (float volume) + { + return invokeObjcSelf!(void, "setVolume:", float)(volume); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/qtkit/QTCaptureConnection.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/qtkit/QTCaptureConnection.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,165 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 28, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.qtkit.QTCaptureConnection; + +import dstep.foundation.Foundation; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.qtkit.QTFormatDescription; +import dstep.qtkit.QTKitDefines; + +import bindings = dstep.qtkit.QTCaptureConnection_bindings; + +private +{ + NSString QTCaptureConnectionFormatDescriptionWillChangeNotification_; + NSString QTCaptureConnectionFormatDescriptionDidChangeNotification_; + NSString QTCaptureConnectionAttributeWillChangeNotification_; + NSString QTCaptureConnectionAttributeDidChangeNotification_; + NSString QTCaptureConnectionChangedAttributeKey_; + NSString QTCaptureConnectionAudioAveragePowerLevelsAttribute_; + NSString QTCaptureConnectionAudioPeakHoldLevelsAttribute_; + NSString QTCaptureConnectionAudioMasterVolumeAttribute_; + NSString QTCaptureConnectionAudioVolumesAttribute_; + NSString QTCaptureConnectionEnabledAudioChannelsAttribute_; +} + +NSString QTCaptureConnectionFormatDescriptionWillChangeNotification () +{ + if (QTCaptureConnectionFormatDescriptionWillChangeNotification_) + return QTCaptureConnectionFormatDescriptionWillChangeNotification_; + + return QTCaptureConnectionFormatDescriptionWillChangeNotification_ = new NSString(bindings.QTCaptureConnectionFormatDescriptionWillChangeNotification); +} + +NSString QTCaptureConnectionFormatDescriptionDidChangeNotification () +{ + if (QTCaptureConnectionFormatDescriptionDidChangeNotification_) + return QTCaptureConnectionFormatDescriptionDidChangeNotification_; + + return QTCaptureConnectionFormatDescriptionDidChangeNotification_ = new NSString(bindings.QTCaptureConnectionFormatDescriptionDidChangeNotification); +} + +NSString QTCaptureConnectionAttributeWillChangeNotification () +{ + if (QTCaptureConnectionAttributeWillChangeNotification_) + return QTCaptureConnectionAttributeWillChangeNotification_; + + return QTCaptureConnectionAttributeWillChangeNotification_ = new NSString(bindings.QTCaptureConnectionAttributeWillChangeNotification); +} + +NSString QTCaptureConnectionAttributeDidChangeNotification () +{ + if (QTCaptureConnectionAttributeDidChangeNotification_) + return QTCaptureConnectionAttributeDidChangeNotification_; + + return QTCaptureConnectionAttributeDidChangeNotification_ = new NSString(bindings.QTCaptureConnectionAttributeDidChangeNotification); +} + +NSString QTCaptureConnectionChangedAttributeKey () +{ + if (QTCaptureConnectionChangedAttributeKey_) + return QTCaptureConnectionChangedAttributeKey_; + + return QTCaptureConnectionChangedAttributeKey_ = new NSString(bindings.QTCaptureConnectionChangedAttributeKey); +} + +NSString QTCaptureConnectionAudioAveragePowerLevelsAttribute () +{ + if (QTCaptureConnectionAudioAveragePowerLevelsAttribute_) + return QTCaptureConnectionAudioAveragePowerLevelsAttribute_; + + return QTCaptureConnectionAudioAveragePowerLevelsAttribute_ = new NSString(bindings.QTCaptureConnectionAudioAveragePowerLevelsAttribute); +} + +NSString QTCaptureConnectionAudioPeakHoldLevelsAttribute () +{ + if (QTCaptureConnectionAudioPeakHoldLevelsAttribute_) + return QTCaptureConnectionAudioPeakHoldLevelsAttribute_; + + return QTCaptureConnectionAudioPeakHoldLevelsAttribute_ = new NSString(bindings.QTCaptureConnectionAudioPeakHoldLevelsAttribute); +} + +NSString QTCaptureConnectionAudioMasterVolumeAttribute () +{ + if (QTCaptureConnectionAudioMasterVolumeAttribute_) + return QTCaptureConnectionAudioMasterVolumeAttribute_; + + return QTCaptureConnectionAudioMasterVolumeAttribute_ = new NSString(bindings.QTCaptureConnectionAudioMasterVolumeAttribute); +} + +NSString QTCaptureConnectionAudioVolumesAttribute () +{ + if (QTCaptureConnectionAudioVolumesAttribute_) + return QTCaptureConnectionAudioVolumesAttribute_; + + return QTCaptureConnectionAudioVolumesAttribute_ = new NSString(bindings.QTCaptureConnectionAudioVolumesAttribute); +} + +NSString QTCaptureConnectionEnabledAudioChannelsAttribute () +{ + if (QTCaptureConnectionEnabledAudioChannelsAttribute_) + return QTCaptureConnectionEnabledAudioChannelsAttribute_; + + return QTCaptureConnectionEnabledAudioChannelsAttribute_ = new NSString(bindings.QTCaptureConnectionEnabledAudioChannelsAttribute); +} + +class QTCaptureConnection : NSObject +{ + mixin (ObjcWrap); + + Object owner () + { + return invokeObjcSelf!(Object, "owner"); + } + + NSString mediaType () + { + return invokeObjcSelf!(NSString, "mediaType"); + } + + QTFormatDescription formatDescription () + { + return invokeObjcSelf!(QTFormatDescription, "formatDescription"); + } + + bool isEnabled () + { + return invokeObjcSelf!(bool, "isEnabled"); + } + + void setEnabled (bool enabled) + { + return invokeObjcSelf!(void, "setEnabled:", bool)(enabled); + } + + NSDictionary connectionAttributes () + { + return invokeObjcSelf!(NSDictionary, "connectionAttributes"); + } + + void setConnectionAttributes (NSDictionary connectionAttributes) + { + return invokeObjcSelf!(void, "setConnectionAttributes:", NSDictionary)(connectionAttributes); + } + + bool attributeIsReadOnly (NSString attributeKey) + { + return invokeObjcSelf!(bool, "attributeIsReadOnly:", NSString)(attributeKey); + } + + Object attributeForKey (NSString attributeKey) + { + return invokeObjcSelf!(Object, "attributeForKey:", NSString)(attributeKey); + } + + void setAttribute (Object attribute, NSString key) + { + return invokeObjcSelf!(void, "setAttribute:forKey:", Object, NSString)(attribute, key); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/qtkit/QTCaptureConnection_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/qtkit/QTCaptureConnection_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,27 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 28, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.qtkit.QTCaptureConnection_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package const id QTCaptureConnectionFormatDescriptionWillChangeNotification; + package const id QTCaptureConnectionFormatDescriptionDidChangeNotification; + package const id QTCaptureConnectionAttributeWillChangeNotification; + package const id QTCaptureConnectionAttributeDidChangeNotification; + package const id QTCaptureConnectionChangedAttributeKey; + package const id QTCaptureConnectionAudioAveragePowerLevelsAttribute; + package const id QTCaptureConnectionAudioPeakHoldLevelsAttribute; + package const id QTCaptureConnectionAudioMasterVolumeAttribute; + package const id QTCaptureConnectionAudioVolumesAttribute; + package const id QTCaptureConnectionEnabledAudioChannelsAttribute; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/qtkit/QTCaptureDecompressedVideoOutput.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/qtkit/QTCaptureDecompressedVideoOutput.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,53 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 28, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.qtkit.QTCaptureDecompressedVideoOutput; + +import dstep.foundation.Foundation; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.qtkit.QTCaptureConnection; +import dstep.qtkit.QTCaptureOutput; +import dstep.qtkit.QTKitDefines; +import dstep.qtkit.QTSampleBuffer; +import dstep.quartzcore.QuartzCore; + +const TQTCaptureDecompressedVideoOutputDelegate = ` + + void captureOutput (QTCaptureOutput captureOutput, CVImageBufferRef videoFrame, QTSampleBuffer sampleBuffer, QTCaptureConnection connection) + { + return invokeObjcSelf!(void, "captureOutput:didOutputVideoFrame:withSampleBuffer:fromConnection:", QTCaptureOutput, CVImageBufferRef, QTSampleBuffer, QTCaptureConnection)(captureOutput, videoFrame, sampleBuffer, connection); + } + + //mixin ObjcBindMethod!(captureOutput, "captureOutput:didOutputVideoFrame:withSampleBuffer:fromConnection:"); + +`; + +class QTCaptureDecompressedVideoOutput : QTCaptureOutput +{ + mixin (ObjcWrap); + + NSDictionary pixelBufferAttributes () + { + return invokeObjcSelf!(NSDictionary, "pixelBufferAttributes"); + } + + void setPixelBufferAttributes (NSDictionary pixelBufferAttributes) + { + return invokeObjcSelf!(void, "setPixelBufferAttributes:", NSDictionary)(pixelBufferAttributes); + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + void setDelegate (Object delegate_) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(delegate_); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/qtkit/QTCaptureDevice.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/qtkit/QTCaptureDevice.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,310 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 28, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.qtkit.QTCaptureDevice; + +import dstep.foundation.Foundation; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.qtkit.QTKitDefines; + +import bindings = dstep.qtkit.QTCaptureDevice_bindings; + +alias NSUInteger QTCaptureDeviceAVCTransportControlsPlaybackMode; +alias NSInteger QTCaptureDeviceAVCTransportControlsSpeed; + +private +{ + NSString QTCaptureDeviceWasConnectedNotification_; + NSString QTCaptureDeviceWasDisconnectedNotification_; + NSString QTCaptureDeviceFormatDescriptionsWillChangeNotification_; + NSString QTCaptureDeviceFormatDescriptionsDidChangeNotification_; + NSString QTCaptureDeviceAttributeWillChangeNotification_; + NSString QTCaptureDeviceAttributeDidChangeNotification_; + NSString QTCaptureDeviceChangedAttributeKey_; + NSString QTCaptureDeviceSuspendedAttribute_; + NSString QTCaptureDeviceLinkedDevicesAttribute_; + NSString QTCaptureDeviceAvailableInputSourcesAttribute_; + NSString QTCaptureDeviceInputSourceIdentifierAttribute_; + NSString QTCaptureDeviceInputSourceIdentifierKey_; + NSString QTCaptureDeviceInputSourceLocalizedDisplayNameKey_; + NSString QTCaptureDeviceAVCTransportControlsAttribute_; + NSString QTCaptureDeviceAVCTransportControlsPlaybackModeKey_; + NSString QTCaptureDeviceAVCTransportControlsSpeedKey_; +} + +NSString QTCaptureDeviceWasConnectedNotification () +{ + if (QTCaptureDeviceWasConnectedNotification_) + return QTCaptureDeviceWasConnectedNotification_; + + return QTCaptureDeviceWasConnectedNotification_ = new NSString(bindings.QTCaptureDeviceWasConnectedNotification); +} + +NSString QTCaptureDeviceWasDisconnectedNotification () +{ + if (QTCaptureDeviceWasDisconnectedNotification_) + return QTCaptureDeviceWasDisconnectedNotification_; + + return QTCaptureDeviceWasDisconnectedNotification_ = new NSString(bindings.QTCaptureDeviceWasDisconnectedNotification); +} + +NSString QTCaptureDeviceFormatDescriptionsWillChangeNotification () +{ + if (QTCaptureDeviceFormatDescriptionsWillChangeNotification_) + return QTCaptureDeviceFormatDescriptionsWillChangeNotification_; + + return QTCaptureDeviceFormatDescriptionsWillChangeNotification_ = new NSString(bindings.QTCaptureDeviceFormatDescriptionsWillChangeNotification); +} + +NSString QTCaptureDeviceFormatDescriptionsDidChangeNotification () +{ + if (QTCaptureDeviceFormatDescriptionsDidChangeNotification_) + return QTCaptureDeviceFormatDescriptionsDidChangeNotification_; + + return QTCaptureDeviceFormatDescriptionsDidChangeNotification_ = new NSString(bindings.QTCaptureDeviceFormatDescriptionsDidChangeNotification); +} + +NSString QTCaptureDeviceAttributeWillChangeNotification () +{ + if (QTCaptureDeviceAttributeWillChangeNotification_) + return QTCaptureDeviceAttributeWillChangeNotification_; + + return QTCaptureDeviceAttributeWillChangeNotification_ = new NSString(bindings.QTCaptureDeviceAttributeWillChangeNotification); +} + +NSString QTCaptureDeviceAttributeDidChangeNotification () +{ + if (QTCaptureDeviceAttributeDidChangeNotification_) + return QTCaptureDeviceAttributeDidChangeNotification_; + + return QTCaptureDeviceAttributeDidChangeNotification_ = new NSString(bindings.QTCaptureDeviceAttributeDidChangeNotification); +} + +NSString QTCaptureDeviceChangedAttributeKey () +{ + if (QTCaptureDeviceChangedAttributeKey_) + return QTCaptureDeviceChangedAttributeKey_; + + return QTCaptureDeviceChangedAttributeKey_ = new NSString(bindings.QTCaptureDeviceChangedAttributeKey); +} + +NSString QTCaptureDeviceSuspendedAttribute () +{ + if (QTCaptureDeviceSuspendedAttribute_) + return QTCaptureDeviceSuspendedAttribute_; + + return QTCaptureDeviceSuspendedAttribute_ = new NSString(bindings.QTCaptureDeviceSuspendedAttribute); +} + +NSString QTCaptureDeviceLinkedDevicesAttribute () +{ + if (QTCaptureDeviceLinkedDevicesAttribute_) + return QTCaptureDeviceLinkedDevicesAttribute_; + + return QTCaptureDeviceLinkedDevicesAttribute_ = new NSString(bindings.QTCaptureDeviceLinkedDevicesAttribute); +} + +NSString QTCaptureDeviceAvailableInputSourcesAttribute () +{ + if (QTCaptureDeviceAvailableInputSourcesAttribute_) + return QTCaptureDeviceAvailableInputSourcesAttribute_; + + return QTCaptureDeviceAvailableInputSourcesAttribute_ = new NSString(bindings.QTCaptureDeviceAvailableInputSourcesAttribute); +} + +NSString QTCaptureDeviceInputSourceIdentifierAttribute () +{ + if (QTCaptureDeviceInputSourceIdentifierAttribute_) + return QTCaptureDeviceInputSourceIdentifierAttribute_; + + return QTCaptureDeviceInputSourceIdentifierAttribute_ = new NSString(bindings.QTCaptureDeviceInputSourceIdentifierAttribute); +} + +NSString QTCaptureDeviceInputSourceIdentifierKey () +{ + if (QTCaptureDeviceInputSourceIdentifierKey_) + return QTCaptureDeviceInputSourceIdentifierKey_; + + return QTCaptureDeviceInputSourceIdentifierKey_ = new NSString(bindings.QTCaptureDeviceInputSourceIdentifierKey); +} + +NSString QTCaptureDeviceInputSourceLocalizedDisplayNameKey () +{ + if (QTCaptureDeviceInputSourceLocalizedDisplayNameKey_) + return QTCaptureDeviceInputSourceLocalizedDisplayNameKey_; + + return QTCaptureDeviceInputSourceLocalizedDisplayNameKey_ = new NSString(bindings.QTCaptureDeviceInputSourceLocalizedDisplayNameKey); +} + +NSString QTCaptureDeviceAVCTransportControlsAttribute () +{ + if (QTCaptureDeviceAVCTransportControlsAttribute_) + return QTCaptureDeviceAVCTransportControlsAttribute_; + + return QTCaptureDeviceAVCTransportControlsAttribute_ = new NSString(bindings.QTCaptureDeviceAVCTransportControlsAttribute); +} + +NSString QTCaptureDeviceAVCTransportControlsPlaybackModeKey () +{ + if (QTCaptureDeviceAVCTransportControlsPlaybackModeKey_) + return QTCaptureDeviceAVCTransportControlsPlaybackModeKey_; + + return QTCaptureDeviceAVCTransportControlsPlaybackModeKey_ = new NSString(bindings.QTCaptureDeviceAVCTransportControlsPlaybackModeKey); +} + +NSString QTCaptureDeviceAVCTransportControlsSpeedKey () +{ + if (QTCaptureDeviceAVCTransportControlsSpeedKey_) + return QTCaptureDeviceAVCTransportControlsSpeedKey_; + + return QTCaptureDeviceAVCTransportControlsSpeedKey_ = new NSString(bindings.QTCaptureDeviceAVCTransportControlsSpeedKey); +} + +enum +{ + QTCaptureDeviceAVCTransportControlsNotPlayingMode = 0, + QTCaptureDeviceAVCTransportControlsPlayingMode = 1 +} + +enum +{ + QTCaptureDeviceAVCTransportControlsFastestReverseSpeed = -19000, + QTCaptureDeviceAVCTransportControlsVeryFastReverseSpeed = -16000, + QTCaptureDeviceAVCTransportControlsFastReverseSpeed = -13000, + QTCaptureDeviceAVCTransportControlsNormalReverseSpeed = -10000, + QTCaptureDeviceAVCTransportControlsSlowReverseSpeed = -7000, + QTCaptureDeviceAVCTransportControlsVerySlowReverseSpeed = -4000, + QTCaptureDeviceAVCTransportControlsSlowestReverseSpeed = -1000, + QTCaptureDeviceAVCTransportControlsStoppedSpeed = 0, + QTCaptureDeviceAVCTransportControlsSlowestForwardSpeed = 1000, + QTCaptureDeviceAVCTransportControlsVerySlowForwardSpeed = 4000, + QTCaptureDeviceAVCTransportControlsSlowForwardSpeed = 7000, + QTCaptureDeviceAVCTransportControlsNormalForwardSpeed = 10000, + QTCaptureDeviceAVCTransportControlsFastForwardSpeed = 13000, + QTCaptureDeviceAVCTransportControlsVeryFastForwardSpeed = 16000, + QTCaptureDeviceAVCTransportControlsFastestForwardSpeed = 19000 +} + +class QTCaptureDevice : NSObject, INSCoding +{ + mixin (ObjcWrap); + + static NSArray inputDevices () + { + return invokeObjcSelfClass!(NSArray, "inputDevices"); + } + + static NSArray inputDevicesWithMediaType (NSString mediaType) + { + return invokeObjcSelfClass!(NSArray, "inputDevicesWithMediaType:", NSString)(mediaType); + } + + static QTCaptureDevice defaultInputDeviceWithMediaType (NSString mediaType) + { + return invokeObjcSelfClass!(QTCaptureDevice, "defaultInputDeviceWithMediaType:", NSString)(mediaType); + } + + static QTCaptureDevice deviceWithUniqueID (NSString deviceUniqueID) + { + return invokeObjcSelfClass!(QTCaptureDevice, "deviceWithUniqueID:", NSString)(deviceUniqueID); + } + + NSString uniqueID () + { + return invokeObjcSelf!(NSString, "uniqueID"); + } + + NSString modelUniqueID () + { + return invokeObjcSelf!(NSString, "modelUniqueID"); + } + + NSString localizedDisplayName () + { + return invokeObjcSelf!(NSString, "localizedDisplayName"); + } + + NSArray formatDescriptions () + { + return invokeObjcSelf!(NSArray, "formatDescriptions"); + } + + bool hasMediaType (NSString mediaType) + { + return invokeObjcSelf!(bool, "hasMediaType:", NSString)(mediaType); + } + + NSDictionary deviceAttributes () + { + return invokeObjcSelf!(NSDictionary, "deviceAttributes"); + } + + void setDeviceAttributes (NSDictionary deviceAttributes) + { + return invokeObjcSelf!(void, "setDeviceAttributes:", NSDictionary)(deviceAttributes); + } + + bool attributeIsReadOnly (NSString attributeKey) + { + return invokeObjcSelf!(bool, "attributeIsReadOnly:", NSString)(attributeKey); + } + + Object attributeForKey (NSString attributeKey) + { + return invokeObjcSelf!(Object, "attributeForKey:", NSString)(attributeKey); + } + + void setAttribute (Object attribute, NSString attributeKey) + { + return invokeObjcSelf!(void, "setAttribute:forKey:", Object, NSString)(attribute, attributeKey); + } + + bool isConnected () + { + return invokeObjcSelf!(bool, "isConnected"); + } + + bool isInUseByAnotherApplication () + { + return invokeObjcSelf!(bool, "isInUseByAnotherApplication"); + } + + bool isOpen () + { + return invokeObjcSelf!(bool, "isOpen"); + } + + bool open (ref NSError errorPtr) + { + id error; + + if (errorPtr) + error = errorPtr.objcObject; + + bool result = invokeObjcSelf!(bool, "open:", id*)(&error); + + if (error) + errorPtr = new NSError(error); + + return result; + } + + void close () + { + return invokeObjcSelf!(void, "close"); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + QTCaptureDevice initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(QTCaptureDevice, "initWithCoder:", NSCoder)(aDecoder); + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/qtkit/QTCaptureDeviceInput.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/qtkit/QTCaptureDeviceInput.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,41 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 28, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.qtkit.QTCaptureDeviceInput; + +import dstep.foundation.Foundation; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.qtkit.QTCaptureDevice; +import dstep.qtkit.QTCaptureInput; +import dstep.qtkit.QTKitDefines; + +class QTCaptureDeviceInput : QTCaptureInput +{ + mixin (ObjcWrap); + + static Object deviceInputWithDevice (QTCaptureDevice device) + { + return invokeObjcSelfClass!(Object, "deviceInputWithDevice:", QTCaptureDevice)(device); + } + + QTCaptureDeviceInput initWithDevice (QTCaptureDevice device) + { + id result = invokeObjcSelf!(id, "initWithDevice:", QTCaptureDevice)(device); + return result is this.objcObject ? this : (result !is null ? new QTCaptureDeviceInput(result) : null); + } + + this (QTCaptureDevice device) + { + super(QTCaptureDeviceInput.alloc.initWithDevice(device).objcObject); + } + + QTCaptureDevice device () + { + return invokeObjcSelf!(QTCaptureDevice, "device"); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/qtkit/QTCaptureDevice_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/qtkit/QTCaptureDevice_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,33 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 28, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.qtkit.QTCaptureDevice_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package const id QTCaptureDeviceWasConnectedNotification; + package const id QTCaptureDeviceWasDisconnectedNotification; + package const id QTCaptureDeviceFormatDescriptionsWillChangeNotification; + package const id QTCaptureDeviceFormatDescriptionsDidChangeNotification; + package const id QTCaptureDeviceAttributeWillChangeNotification; + package const id QTCaptureDeviceAttributeDidChangeNotification; + package const id QTCaptureDeviceChangedAttributeKey; + package const id QTCaptureDeviceSuspendedAttribute; + package const id QTCaptureDeviceLinkedDevicesAttribute; + package const id QTCaptureDeviceAvailableInputSourcesAttribute; + package const id QTCaptureDeviceInputSourceIdentifierAttribute; + package const id QTCaptureDeviceInputSourceIdentifierKey; + package const id QTCaptureDeviceInputSourceLocalizedDisplayNameKey; + package const id QTCaptureDeviceAVCTransportControlsAttribute; + package const id QTCaptureDeviceAVCTransportControlsPlaybackModeKey; + package const id QTCaptureDeviceAVCTransportControlsSpeedKey; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/qtkit/QTCaptureFileOutput.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/qtkit/QTCaptureFileOutput.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,143 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 28, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.qtkit.QTCaptureFileOutput; + +import dstep.foundation.Foundation; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.qtkit.QTCaptureConnection; +import dstep.qtkit.QTCaptureOutput; +import dstep.qtkit.QTCompressionOptions; +import dstep.qtkit.QTKitDefines; +import dstep.qtkit.QTSampleBuffer; +import dstep.qtkit.QTTime; + +alias NSUInteger QTCaptureFileOutputBufferDestination; + +enum +{ + QTCaptureFileOutputBufferDestinationNewFile = 1, + QTCaptureFileOutputBufferDestinationOldFile = 2 +} + +const TQTCaptureFileOutputDelegate = ` + + void captureOutput (QTCaptureFileOutput captureOutput, QTSampleBuffer sampleBuffer, QTCaptureConnection connection) + { + return invokeObjcSelf!(void, "captureOutput:didOutputSampleBuffer:fromConnection:", QTCaptureFileOutput, QTSampleBuffer, QTCaptureConnection)(captureOutput, sampleBuffer, connection); + } + + void captureOutput (QTCaptureFileOutput captureOutput, NSURL fileURL, NSArray connections) + { + return invokeObjcSelf!(void, "captureOutput:willStartRecordingToOutputFileAtURL:forConnections:", QTCaptureFileOutput, NSURL, NSArray)(captureOutput, fileURL, connections); + } + + void captureOutput (QTCaptureFileOutput captureOutput, NSURL fileURL, NSArray connections) + { + return invokeObjcSelf!(void, "captureOutput:didStartRecordingToOutputFileAtURL:forConnections:", QTCaptureFileOutput, NSURL, NSArray)(captureOutput, fileURL, connections); + } + + bool captureOutput (QTCaptureFileOutput captureOutput, NSURL outputFileURL, NSArray connections, NSError error) + { + return invokeObjcSelf!(bool, "captureOutput:shouldChangeOutputFileAtURL:forConnections:dueToError:", QTCaptureFileOutput, NSURL, NSArray, NSError)(captureOutput, outputFileURL, connections, error); + } + + void captureOutput (QTCaptureFileOutput captureOutput, NSURL outputFileURL, NSArray connections, NSError error) + { + return invokeObjcSelf!(void, "captureOutput:mustChangeOutputFileAtURL:forConnections:dueToError:", QTCaptureFileOutput, NSURL, NSArray, NSError)(captureOutput, outputFileURL, connections, error); + } + + void captureOutput (QTCaptureFileOutput captureOutput, NSURL outputFileURL, NSArray connections, NSError error) + { + return invokeObjcSelf!(void, "captureOutput:willFinishRecordingToOutputFileAtURL:forConnections:dueToError:", QTCaptureFileOutput, NSURL, NSArray, NSError)(captureOutput, outputFileURL, connections, error); + } + + void captureOutput (QTCaptureFileOutput captureOutput, NSURL outputFileURL, NSArray connections, NSError error) + { + return invokeObjcSelf!(void, "captureOutput:didFinishRecordingToOutputFileAtURL:forConnections:dueToError:", QTCaptureFileOutput, NSURL, NSArray, NSError)(captureOutput, outputFileURL, connections, error); + } + + //mixin ObjcBindMethod!(captureOutput, "captureOutput:didOutputSampleBuffer:fromConnection:"); + //mixin ObjcBindMethod!(captureOutput, "captureOutput:willStartRecordingToOutputFileAtURL:forConnections:"); + //mixin ObjcBindMethod!(captureOutput, "captureOutput:didStartRecordingToOutputFileAtURL:forConnections:"); + //mixin ObjcBindMethod!(captureOutput, "captureOutput:shouldChangeOutputFileAtURL:forConnections:dueToError:"); + //mixin ObjcBindMethod!(captureOutput, "captureOutput:mustChangeOutputFileAtURL:forConnections:dueToError:"); + //mixin ObjcBindMethod!(captureOutput, "captureOutput:willFinishRecordingToOutputFileAtURL:forConnections:dueToError:"); + //mixin ObjcBindMethod!(captureOutput, "captureOutput:didFinishRecordingToOutputFileAtURL:forConnections:dueToError:"); + +`; + +class QTCaptureFileOutput : QTCaptureOutput +{ + mixin (ObjcWrap); + + NSURL outputFileURL () + { + return invokeObjcSelf!(NSURL, "outputFileURL"); + } + + void recordToOutputFileURL (NSURL url) + { + return invokeObjcSelf!(void, "recordToOutputFileURL:", NSURL)(url); + } + + void recordToOutputFileURL (NSURL url, uint bufferDestination) + { + return invokeObjcSelf!(void, "recordToOutputFileURL:bufferDestination:", NSURL, uint)(url, bufferDestination); + } + + QTCompressionOptions compressionOptionsForConnection (QTCaptureConnection connection) + { + return invokeObjcSelf!(QTCompressionOptions, "compressionOptionsForConnection:", QTCaptureConnection)(connection); + } + + void setCompressionOptions (QTCompressionOptions compressionOptions, QTCaptureConnection connection) + { + return invokeObjcSelf!(void, "setCompressionOptions:forConnection:", QTCompressionOptions, QTCaptureConnection)(compressionOptions, connection); + } + + QTTime recordedDuration () + { + return invokeObjcSelf!(QTTime, "recordedDuration"); + } + + ulong recordedFileSize () + { + return invokeObjcSelf!(ulong, "recordedFileSize"); + } + + QTTime maximumRecordedDuration () + { + return invokeObjcSelf!(QTTime, "maximumRecordedDuration"); + } + + void setMaximumRecordedDuration (QTTime maximumRecordedDuration) + { + return invokeObjcSelf!(void, "setMaximumRecordedDuration:", QTTime)(maximumRecordedDuration); + } + + ulong maximumRecordedFileSize () + { + return invokeObjcSelf!(ulong, "maximumRecordedFileSize"); + } + + void setMaximumRecordedFileSize (ulong maximumRecordedFileSize) + { + return invokeObjcSelf!(void, "setMaximumRecordedFileSize:", ulong)(maximumRecordedFileSize); + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + void setDelegate (Object delegate_) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(delegate_); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/qtkit/QTCaptureInput.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/qtkit/QTCaptureInput.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,24 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 28, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.qtkit.QTCaptureInput; + +import dstep.foundation.Foundation; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.qtkit.QTCaptureSession; +import dstep.qtkit.QTKitDefines; + +class QTCaptureInput : NSObject +{ + mixin (ObjcWrap); + + NSArray connections () + { + return invokeObjcSelf!(NSArray, "connections"); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/qtkit/QTCaptureLayer.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/qtkit/QTCaptureLayer.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,47 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 28, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.qtkit.QTCaptureLayer; + +import dstep.foundation.Foundation; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.qtkit.QTCaptureSession; +import dstep.qtkit.QTKitDefines; +import dstep.quartzcore.CALayer; +import dstep.quartzcore.QuartzCore; + +class QTCaptureLayer : CALayer +{ + mixin (ObjcWrap); + + static Object layerWithSession (QTCaptureSession session) + { + return invokeObjcSelfClass!(Object, "layerWithSession:", QTCaptureSession)(session); + } + + QTCaptureLayer initWithSession (QTCaptureSession session) + { + id result = invokeObjcSelf!(id, "initWithSession:", QTCaptureSession)(session); + return result is this.objcObject ? this : (result !is null ? new QTCaptureLayer(result) : null); + } + + this (QTCaptureSession session) + { + super(QTCaptureLayer.alloc.initWithSession(session).objcObject); + } + + void setSession (QTCaptureSession session) + { + return invokeObjcSelf!(void, "setSession:", QTCaptureSession)(session); + } + + QTCaptureSession session () + { + return invokeObjcSelf!(QTCaptureSession, "session"); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/qtkit/QTCaptureMovieFileOutput.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/qtkit/QTCaptureMovieFileOutput.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,18 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 28, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.qtkit.QTCaptureMovieFileOutput; + +import dstep.foundation.Foundation; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.qtkit.QTCaptureFileOutput; +import dstep.qtkit.QTKitDefines; + +class QTCaptureMovieFileOutput : QTCaptureFileOutput +{ + mixin (ObjcWrap); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/qtkit/QTCaptureOutput.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/qtkit/QTCaptureOutput.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,24 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 28, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.qtkit.QTCaptureOutput; + +import dstep.foundation.Foundation; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.qtkit.QTCaptureSession; +import dstep.qtkit.QTKitDefines; + +class QTCaptureOutput : NSObject +{ + mixin (ObjcWrap); + + NSArray connections () + { + return invokeObjcSelf!(NSArray, "connections"); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/qtkit/QTCaptureSession.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/qtkit/QTCaptureSession.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,120 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 28, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.qtkit.QTCaptureSession; + +import dstep.foundation.Foundation; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.qtkit.QTCaptureConnection; +import dstep.qtkit.QTCaptureInput; +import dstep.qtkit.QTCaptureOutput; +import dstep.qtkit.QTKitDefines; + +import bindings = dstep.qtkit.QTCaptureSession_bindings; + +private +{ + NSString QTCaptureSessionRuntimeErrorNotification_; + NSString QTCaptureSessionErrorKey_; +} + +NSString QTCaptureSessionRuntimeErrorNotification () +{ + if (QTCaptureSessionRuntimeErrorNotification_) + return QTCaptureSessionRuntimeErrorNotification_; + + return QTCaptureSessionRuntimeErrorNotification_ = new NSString(bindings.QTCaptureSessionRuntimeErrorNotification); +} + +NSString QTCaptureSessionErrorKey () +{ + if (QTCaptureSessionErrorKey_) + return QTCaptureSessionErrorKey_; + + return QTCaptureSessionErrorKey_ = new NSString(bindings.QTCaptureSessionErrorKey); +} + +class QTCaptureSession : NSObject, INSCoding +{ + mixin (ObjcWrap); + + NSArray inputs () + { + return invokeObjcSelf!(NSArray, "inputs"); + } + + bool addInput (QTCaptureInput input, ref NSError errorPtr) + { + id error; + + if (errorPtr) + error = errorPtr.objcObject; + + bool result = invokeObjcSelf!(bool, "addInput:error:", QTCaptureInput, id*)(input, &error); + + if (error) + errorPtr = new NSError(error); + + return result; + } + + void removeInput (QTCaptureInput input) + { + return invokeObjcSelf!(void, "removeInput:", QTCaptureInput)(input); + } + + NSArray outputs () + { + return invokeObjcSelf!(NSArray, "outputs"); + } + + bool addOutput (QTCaptureOutput output, ref NSError errorPtr) + { + id error; + + if (errorPtr) + error = errorPtr.objcObject; + + bool result = invokeObjcSelf!(bool, "addOutput:error:", QTCaptureOutput, id*)(output, &error); + + if (error) + errorPtr = new NSError(error); + + return result; + } + + void removeOutput (QTCaptureOutput output) + { + return invokeObjcSelf!(void, "removeOutput:", QTCaptureOutput)(output); + } + + bool isRunning () + { + return invokeObjcSelf!(bool, "isRunning"); + } + + void startRunning () + { + return invokeObjcSelf!(void, "startRunning"); + } + + void stopRunning () + { + return invokeObjcSelf!(void, "stopRunning"); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + QTCaptureSession initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(QTCaptureSession, "initWithCoder:", NSCoder)(aDecoder); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/qtkit/QTCaptureSession_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/qtkit/QTCaptureSession_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,19 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 28, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.qtkit.QTCaptureSession_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package const id QTCaptureSessionRuntimeErrorNotification; + package const id QTCaptureSessionErrorKey; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/qtkit/QTCaptureVideoPreviewOutput.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/qtkit/QTCaptureVideoPreviewOutput.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,52 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 28, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.qtkit.QTCaptureVideoPreviewOutput; + +import dstep.foundation.Foundation; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.qtkit.QTCaptureConnection; +import dstep.qtkit.QTCaptureOutput; +import dstep.qtkit.QTKitDefines; +import dstep.qtkit.QTSampleBuffer; + +const TQTCaptureVideoPreviewOutputDelegate = ` + + void captureOutput (QTCaptureOutput captureOutput, CVImageBufferRef videoFrame, QTSampleBuffer sampleBuffer, QTCaptureConnection connection) + { + return invokeObjcSelf!(void, "captureOutput:didOutputVideoFrame:withSampleBuffer:fromConnection:", QTCaptureOutput, CVImageBufferRef, QTSampleBuffer, QTCaptureConnection)(captureOutput, videoFrame, sampleBuffer, connection); + } + + //mixin ObjcBindMethod!(captureOutput, "captureOutput:didOutputVideoFrame:withSampleBuffer:fromConnection:"); + +`; + +class QTCaptureVideoPreviewOutput : QTCaptureOutput +{ + mixin (ObjcWrap); + + NSDictionary pixelBufferAttributes () + { + return invokeObjcSelf!(NSDictionary, "pixelBufferAttributes"); + } + + void setPixelBufferAttributes (NSDictionary pixelBufferAttributes) + { + return invokeObjcSelf!(void, "setPixelBufferAttributes:", NSDictionary)(pixelBufferAttributes); + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + void setDelegate (Object delegate_) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(delegate_); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/qtkit/QTCaptureView.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/qtkit/QTCaptureView.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,94 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 28, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.qtkit.QTCaptureView; + +import dstep.cocoa.Cocoa; +import dstep.appkit.NSColor; +import dstep.appkit.NSView; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.qtkit.QTCaptureConnection; +import dstep.qtkit.QTCaptureSession; +import dstep.qtkit.QTKitDefines; +import dstep.quartzcore.CIImage; + +const TQTCaptureViewDelegate = ` + + CIImage view (QTCaptureView view, CIImage image) + { + return invokeObjcSelf!(CIImage, "view:willDisplayImage:", QTCaptureView, CIImage)(view, image); + } + + //mixin ObjcBindMethod!(view, "view:willDisplayImage:"); + +`; + +class QTCaptureView : NSView +{ + mixin (ObjcWrap); + + QTCaptureSession captureSession () + { + return invokeObjcSelf!(QTCaptureSession, "captureSession"); + } + + void setCaptureSession (QTCaptureSession captureSession) + { + return invokeObjcSelf!(void, "setCaptureSession:", QTCaptureSession)(captureSession); + } + + NSArray availableVideoPreviewConnections () + { + return invokeObjcSelf!(NSArray, "availableVideoPreviewConnections"); + } + + QTCaptureConnection videoPreviewConnection () + { + return invokeObjcSelf!(QTCaptureConnection, "videoPreviewConnection"); + } + + void setVideoPreviewConnection (QTCaptureConnection videoPreviewConnection) + { + return invokeObjcSelf!(void, "setVideoPreviewConnection:", QTCaptureConnection)(videoPreviewConnection); + } + + NSColor fillColor () + { + return invokeObjcSelf!(NSColor, "fillColor"); + } + + void setFillColor (NSColor fillColor) + { + return invokeObjcSelf!(void, "setFillColor:", NSColor)(fillColor); + } + + bool preservesAspectRatio () + { + return invokeObjcSelf!(bool, "preservesAspectRatio"); + } + + void setPreservesAspectRatio (bool preservesAspectRatio) + { + return invokeObjcSelf!(void, "setPreservesAspectRatio:", bool)(preservesAspectRatio); + } + + NSRect previewBounds () + { + return invokeObjcSelf!(NSRect, "previewBounds"); + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + void setDelegate (Object delegate_) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(delegate_); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/qtkit/QTCompressionOptions.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/qtkit/QTCompressionOptions.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,48 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 28, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.qtkit.QTCompressionOptions; + +import dstep.foundation.Foundation; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.qtkit.QTKitDefines; + +class QTCompressionOptions : NSObject +{ + mixin (ObjcWrap); + + static NSArray compressionOptionsIdentifiersForMediaType (NSString mediaType) + { + return invokeObjcSelfClass!(NSArray, "compressionOptionsIdentifiersForMediaType:", NSString)(mediaType); + } + + static Object compressionOptionsWithIdentifier (NSString identifier) + { + return invokeObjcSelfClass!(Object, "compressionOptionsWithIdentifier:", NSString)(identifier); + } + + NSString mediaType () + { + return invokeObjcSelf!(NSString, "mediaType"); + } + + NSString localizedDisplayName () + { + return invokeObjcSelf!(NSString, "localizedDisplayName"); + } + + NSString localizedCompressionOptionsSummary () + { + return invokeObjcSelf!(NSString, "localizedCompressionOptionsSummary"); + } + + bool isEqualToCompressionOptions (QTCompressionOptions compressionOptions) + { + return invokeObjcSelf!(bool, "isEqualToCompressionOptions:", QTCompressionOptions)(compressionOptions); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/qtkit/QTDataReference.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/qtkit/QTDataReference.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,226 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 28, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.qtkit.QTDataReference; + +import dstep.coreservices.carboncore.MacTypes; +import dstep.foundation.Foundation; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.qtkit.QTKitDefines; + +import bindings = dstep.qtkit.QTDataReference_bindings; + +private +{ + NSString QTDataReferenceTypeFile_; + NSString QTDataReferenceTypeHandle_; + NSString QTDataReferenceTypePointer_; + NSString QTDataReferenceTypeResource_; + NSString QTDataReferenceTypeURL_; +} + +NSString QTDataReferenceTypeFile () +{ + if (QTDataReferenceTypeFile_) + return QTDataReferenceTypeFile_; + + return QTDataReferenceTypeFile_ = new NSString(bindings.QTDataReferenceTypeFile); +} + +NSString QTDataReferenceTypeHandle () +{ + if (QTDataReferenceTypeHandle_) + return QTDataReferenceTypeHandle_; + + return QTDataReferenceTypeHandle_ = new NSString(bindings.QTDataReferenceTypeHandle); +} + +NSString QTDataReferenceTypePointer () +{ + if (QTDataReferenceTypePointer_) + return QTDataReferenceTypePointer_; + + return QTDataReferenceTypePointer_ = new NSString(bindings.QTDataReferenceTypePointer); +} + +NSString QTDataReferenceTypeResource () +{ + if (QTDataReferenceTypeResource_) + return QTDataReferenceTypeResource_; + + return QTDataReferenceTypeResource_ = new NSString(bindings.QTDataReferenceTypeResource); +} + +NSString QTDataReferenceTypeURL () +{ + if (QTDataReferenceTypeURL_) + return QTDataReferenceTypeURL_; + + return QTDataReferenceTypeURL_ = new NSString(bindings.QTDataReferenceTypeURL); +} + +class QTDataReference : NSObject, INSCoding +{ + mixin (ObjcWrap); + + static Object dataReferenceWithDataRef (Handle dataRef, NSString type) + { + return invokeObjcSelfClass!(Object, "dataReferenceWithDataRef:type:", Handle, NSString)(dataRef, type); + } + + static Object dataReferenceWithDataRefData (NSData dataRefData, NSString type) + { + return invokeObjcSelfClass!(Object, "dataReferenceWithDataRefData:type:", NSData, NSString)(dataRefData, type); + } + + static Object dataReferenceWithReferenceToFile (NSString fileName) + { + return invokeObjcSelfClass!(Object, "dataReferenceWithReferenceToFile:", NSString)(fileName); + } + + static Object dataReferenceWithReferenceToURL (NSURL url) + { + return invokeObjcSelfClass!(Object, "dataReferenceWithReferenceToURL:", NSURL)(url); + } + + static Object dataReferenceWithReferenceToData (NSData data) + { + return invokeObjcSelfClass!(Object, "dataReferenceWithReferenceToData:", NSData)(data); + } + + static Object dataReferenceWithReferenceToData (NSData data, NSString name, NSString MIMEType) + { + return invokeObjcSelfClass!(Object, "dataReferenceWithReferenceToData:name:MIMEType:", NSData, NSString, NSString)(data, name, MIMEType); + } + + QTDataReference initWithDataRef (Handle dataRef, NSString type) + { + id result = invokeObjcSelf!(id, "initWithDataRef:type:", Handle, NSString)(dataRef, type); + return result is this.objcObject ? this : (result !is null ? new QTDataReference(result) : null); + } + + this (Handle dataRef, NSString type) + { + super(QTDataReference.alloc.initWithDataRef(dataRef, type).objcObject); + } + + QTDataReference initWithDataRefData (NSData dataRefData, NSString type) + { + id result = invokeObjcSelf!(id, "initWithDataRefData:type:", NSData, NSString)(dataRefData, type); + return result is this.objcObject ? this : (result !is null ? new QTDataReference(result) : null); + } + + this (NSData dataRefData, NSString type) + { + super(QTDataReference.alloc.initWithDataRefData(dataRefData, type).objcObject); + } + + QTDataReference initWithReferenceToFile (NSString fileName) + { + id result = invokeObjcSelf!(id, "initWithReferenceToFile:", NSString)(fileName); + return result is this.objcObject ? this : (result !is null ? new QTDataReference(result) : null); + } + + this (NSString fileName) + { + super(QTDataReference.alloc.initWithReferenceToFile(fileName).objcObject); + } + + QTDataReference initWithReferenceToURL (NSURL url) + { + id result = invokeObjcSelf!(id, "initWithReferenceToURL:", NSURL)(url); + return result is this.objcObject ? this : (result !is null ? new QTDataReference(result) : null); + } + + this (NSURL url) + { + super(QTDataReference.alloc.initWithReferenceToURL(url).objcObject); + } + + QTDataReference initWithReferenceToData (NSData data) + { + id result = invokeObjcSelf!(id, "initWithReferenceToData:", NSData)(data); + return result is this.objcObject ? this : (result !is null ? new QTDataReference(result) : null); + } + + this (NSData data) + { + super(QTDataReference.alloc.initWithReferenceToData(data).objcObject); + } + + QTDataReference initWithReferenceToData (NSData data, NSString name, NSString MIMEType) + { + id result = invokeObjcSelf!(id, "initWithReferenceToData:name:MIMEType:", NSData, NSString, NSString)(data, name, MIMEType); + return result is this.objcObject ? this : (result !is null ? new QTDataReference(result) : null); + } + + this (NSData data, NSString name, NSString MIMEType) + { + super(QTDataReference.alloc.initWithReferenceToData(data, name, MIMEType).objcObject); + } + + Handle dataRef () + { + return invokeObjcSelf!(Handle, "dataRef"); + } + + NSData dataRefData () + { + return invokeObjcSelf!(NSData, "dataRefData"); + } + + NSString dataRefType () + { + return invokeObjcSelf!(NSString, "dataRefType"); + } + + NSString referenceFile () + { + return invokeObjcSelf!(NSString, "referenceFile"); + } + + NSURL referenceURL () + { + return invokeObjcSelf!(NSURL, "referenceURL"); + } + + NSData referenceData () + { + return invokeObjcSelf!(NSData, "referenceData"); + } + + NSString name () + { + return invokeObjcSelf!(NSString, "name"); + } + + NSString MIMEType () + { + return invokeObjcSelf!(NSString, "MIMEType"); + } + + void setDataRef (Handle dataRef) + { + return invokeObjcSelf!(void, "setDataRef:", Handle)(dataRef); + } + + void setDataRefType (NSString type) + { + return invokeObjcSelf!(void, "setDataRefType:", NSString)(type); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + QTDataReference initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(QTDataReference, "initWithCoder:", NSCoder)(aDecoder); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/qtkit/QTDataReference_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/qtkit/QTDataReference_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,22 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 28, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.qtkit.QTDataReference_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package const id QTDataReferenceTypeFile; + package const id QTDataReferenceTypeHandle; + package const id QTDataReferenceTypePointer; + package const id QTDataReferenceTypeResource; + package const id QTDataReferenceTypeURL; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/qtkit/QTError.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/qtkit/QTError.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,93 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 28, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.qtkit.QTError; + +import dstep.foundation.Foundation; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.qtkit.QTKitDefines; + +import bindings = dstep.qtkit.QTError_bindings; + +private +{ + NSString QTKitErrorDomain_; + NSString QTErrorCaptureInputKey_; + NSString QTErrorCaptureOutputKey_; + NSString QTErrorDeviceKey_; + NSString QTErrorExcludingDeviceKey_; + NSString QTErrorRecordingSuccesfullyFinishedKey_; +} + +NSString QTKitErrorDomain () +{ + if (QTKitErrorDomain_) + return QTKitErrorDomain_; + + return QTKitErrorDomain_ = new NSString(bindings.QTKitErrorDomain); +} + +NSString QTErrorCaptureInputKey () +{ + if (QTErrorCaptureInputKey_) + return QTErrorCaptureInputKey_; + + return QTErrorCaptureInputKey_ = new NSString(bindings.QTErrorCaptureInputKey); +} + +NSString QTErrorCaptureOutputKey () +{ + if (QTErrorCaptureOutputKey_) + return QTErrorCaptureOutputKey_; + + return QTErrorCaptureOutputKey_ = new NSString(bindings.QTErrorCaptureOutputKey); +} + +NSString QTErrorDeviceKey () +{ + if (QTErrorDeviceKey_) + return QTErrorDeviceKey_; + + return QTErrorDeviceKey_ = new NSString(bindings.QTErrorDeviceKey); +} + +NSString QTErrorExcludingDeviceKey () +{ + if (QTErrorExcludingDeviceKey_) + return QTErrorExcludingDeviceKey_; + + return QTErrorExcludingDeviceKey_ = new NSString(bindings.QTErrorExcludingDeviceKey); +} + +NSString QTErrorRecordingSuccesfullyFinishedKey () +{ + if (QTErrorRecordingSuccesfullyFinishedKey_) + return QTErrorRecordingSuccesfullyFinishedKey_; + + return QTErrorRecordingSuccesfullyFinishedKey_ = new NSString(bindings.QTErrorRecordingSuccesfullyFinishedKey); +} + +enum +{ + QTErrorUnknown = -1, + QTErrorIncompatibleInput = 1002, + QTErrorIncompatibleOutput = 1003, + QTErrorInvalidInputsOrOutputs = 1100, + QTErrorDeviceAlreadyUsedbyAnotherSession = 1101, + QTErrorNoDataCaptured = 1200, + QTErrorSessionConfigurationChanged = 1201, + QTErrorDiskFull = 1202, + QTErrorDeviceWasDisconnected = 1203, + QTErrorMediaChanged = 1204, + QTErrorMaximumDurationReached = 1205, + QTErrorMaximumFileSizeReached = 1206, + QTErrorMediaDiscontinuity = 1207, + QTErrorDeviceNotConnected = 1300, + QTErrorDeviceInUseByAnotherApplication = 1301, + QTErrorDeviceExcludedByAnotherDevice = 1302 +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/qtkit/QTError_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/qtkit/QTError_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,27 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 28, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.qtkit.QTError_bindings; + +import dstep.foundation.Foundation; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.qtkit.QTKitDefines; + + +extern (C) +{ + extern + { + package const id QTKitErrorDomain; + package const id QTErrorCaptureInputKey; + package const id QTErrorCaptureOutputKey; + package const id QTErrorDeviceKey; + package const id QTErrorExcludingDeviceKey; + package const id QTErrorRecordingSuccesfullyFinishedKey; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/qtkit/QTFormatDescription.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/qtkit/QTFormatDescription.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,108 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 28, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.qtkit.QTFormatDescription; + +import dstep.foundation.Foundation; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.qtkit.QTKitDefines; + +import bindings = dstep.qtkit.QTFormatDescription_bindings; + +private +{ + NSString QTFormatDescriptionAudioStreamBasicDescriptionAttribute_; + NSString QTFormatDescriptionAudioMagicCookieAttribute_; + NSString QTFormatDescriptionAudioChannelLayoutAttribute_; + NSString QTFormatDescriptionVideoCleanApertureDisplaySizeAttribute_; + NSString QTFormatDescriptionVideoProductionApertureDisplaySizeAttribute_; + NSString QTFormatDescriptionVideoEncodedPixelsSizeAttribute_; +} + +NSString QTFormatDescriptionAudioStreamBasicDescriptionAttribute () +{ + if (QTFormatDescriptionAudioStreamBasicDescriptionAttribute_) + return QTFormatDescriptionAudioStreamBasicDescriptionAttribute_; + + return QTFormatDescriptionAudioStreamBasicDescriptionAttribute_ = new NSString(bindings.QTFormatDescriptionAudioStreamBasicDescriptionAttribute); +} + +NSString QTFormatDescriptionAudioMagicCookieAttribute () +{ + if (QTFormatDescriptionAudioMagicCookieAttribute_) + return QTFormatDescriptionAudioMagicCookieAttribute_; + + return QTFormatDescriptionAudioMagicCookieAttribute_ = new NSString(bindings.QTFormatDescriptionAudioMagicCookieAttribute); +} + +NSString QTFormatDescriptionAudioChannelLayoutAttribute () +{ + if (QTFormatDescriptionAudioChannelLayoutAttribute_) + return QTFormatDescriptionAudioChannelLayoutAttribute_; + + return QTFormatDescriptionAudioChannelLayoutAttribute_ = new NSString(bindings.QTFormatDescriptionAudioChannelLayoutAttribute); +} + +NSString QTFormatDescriptionVideoCleanApertureDisplaySizeAttribute () +{ + if (QTFormatDescriptionVideoCleanApertureDisplaySizeAttribute_) + return QTFormatDescriptionVideoCleanApertureDisplaySizeAttribute_; + + return QTFormatDescriptionVideoCleanApertureDisplaySizeAttribute_ = new NSString(bindings.QTFormatDescriptionVideoCleanApertureDisplaySizeAttribute); +} + +NSString QTFormatDescriptionVideoProductionApertureDisplaySizeAttribute () +{ + if (QTFormatDescriptionVideoProductionApertureDisplaySizeAttribute_) + return QTFormatDescriptionVideoProductionApertureDisplaySizeAttribute_; + + return QTFormatDescriptionVideoProductionApertureDisplaySizeAttribute_ = new NSString(bindings.QTFormatDescriptionVideoProductionApertureDisplaySizeAttribute); +} + +NSString QTFormatDescriptionVideoEncodedPixelsSizeAttribute () +{ + if (QTFormatDescriptionVideoEncodedPixelsSizeAttribute_) + return QTFormatDescriptionVideoEncodedPixelsSizeAttribute_; + + return QTFormatDescriptionVideoEncodedPixelsSizeAttribute_ = new NSString(bindings.QTFormatDescriptionVideoEncodedPixelsSizeAttribute); +} + +class QTFormatDescription : NSObject +{ + mixin (ObjcWrap); + + NSString mediaType () + { + return invokeObjcSelf!(NSString, "mediaType"); + } + + uint formatType () + { + return invokeObjcSelf!(uint, "formatType"); + } + + NSString localizedFormatSummary () + { + return invokeObjcSelf!(NSString, "localizedFormatSummary"); + } + + NSDictionary formatDescriptionAttributes () + { + return invokeObjcSelf!(NSDictionary, "formatDescriptionAttributes"); + } + + Object attributeForKey (NSString key) + { + return invokeObjcSelf!(Object, "attributeForKey:", NSString)(key); + } + + bool isEqualToFormatDescription (QTFormatDescription formatDescription) + { + return invokeObjcSelf!(bool, "isEqualToFormatDescription:", QTFormatDescription)(formatDescription); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/qtkit/QTFormatDescription_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/qtkit/QTFormatDescription_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,24 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 28, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.qtkit.QTFormatDescription_bindings; + +import dstep.objc.objc; + + +extern (C) +{ + extern + { + package const id QTFormatDescriptionAudioStreamBasicDescriptionAttribute; + package const id QTFormatDescriptionAudioMagicCookieAttribute; + package const id QTFormatDescriptionAudioChannelLayoutAttribute; + package const id QTFormatDescriptionVideoCleanApertureDisplaySizeAttribute; + package const id QTFormatDescriptionVideoProductionApertureDisplaySizeAttribute; + package const id QTFormatDescriptionVideoEncodedPixelsSizeAttribute; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/qtkit/QTKit.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/qtkit/QTKit.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,39 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 28, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.qtkit.QTKit; + +public: + +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.qtkit.QTCaptureAudioPreviewOutput; +import dstep.qtkit.QTCaptureConnection; +import dstep.qtkit.QTCaptureDecompressedVideoOutput; +import dstep.qtkit.QTCaptureDevice; +import dstep.qtkit.QTCaptureDeviceInput; +import dstep.qtkit.QTCaptureFileOutput; +import dstep.qtkit.QTCaptureInput; +import dstep.qtkit.QTCaptureLayer; +import dstep.qtkit.QTCaptureMovieFileOutput; +import dstep.qtkit.QTCaptureOutput; +import dstep.qtkit.QTCaptureSession; +import dstep.qtkit.QTCaptureVideoPreviewOutput; +import dstep.qtkit.QTCaptureView; +import dstep.qtkit.QTCompressionOptions; +import dstep.qtkit.QTDataReference; +import dstep.qtkit.QTError; +import dstep.qtkit.QTFormatDescription; +import dstep.qtkit.QTKitDefines; +import dstep.qtkit.QTMedia; +import dstep.qtkit.QTMovie; +import dstep.qtkit.QTMovieLayer; +import dstep.qtkit.QTMovieView; +import dstep.qtkit.QTSampleBuffer; +import dstep.qtkit.QTTime; +import dstep.qtkit.QTTimeRange; +import dstep.qtkit.QTTrack; +import dstep.qtkit.QTUtilities; \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/qtkit/QTKitDefines.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/qtkit/QTKitDefines.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,303 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 28, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.qtkit.QTKitDefines; + +import dstep.objc.bridge.TypeEncoding; + +// This is needed otherwise the enums will fail compiling with gdc +version (GNU) +{ + private + { + const __VideoMediaType = getOSType!("vide"); + const __SoundMediaType = getOSType!("soun"); + const __TextMediaType = getOSType!("text"); + const __BaseMediaType = getOSType!("gnrc"); + const __MPEGMediaType = getOSType!("MPEG"); + const __MusicMediaType = getOSType!("musi"); + const __TimeCodeMediaType = getOSType!("tmcd"); + const __SpriteMediaType = getOSType!("sprt"); + const __FlashMediaType = getOSType!("flsh"); + const __MovieMediaType = getOSType!("moov"); + const __TweenMediaType = getOSType!("twen"); + const __ThreeDeeMediaType = getOSType!("qd3d"); + const __SkinMediaType = getOSType!("skin"); + const __HandleDataHandlerSubType = getOSType!("hndl"); + const __PointerDataHandlerSubType = getOSType!("ptr "); + const __NullDataHandlerSubType = getOSType!("null"); + const __ResourceDataHandlerSubType = getOSType!("rsrc"); + const __URLDataHandlerSubType = getOSType!("url "); + const __AliasDataHandlerSubType = getOSType!("alis"); + const __WiredActionHandlerType = getOSType!("wire"); + const __kQTQuartzComposerMediaType = getOSType!("qtz "); + const __TimeCode64MediaType = getOSType!("tc64"); + const __kQTFileTypeAIFF = getOSType!("AIFF"); + const __kQTFileTypeAIFC = getOSType!("AIFC"); + const __kQTFileTypeDVC = getOSType!("dvc!"); + const __kQTFileTypeMIDI = getOSType!("Midi"); + const __kQTFileTypePicture = getOSType!("PICT"); + const __kQTFileTypeMovie = getOSType!("MooV"); + const __kQTFileTypeText = getOSType!("TEXT"); + const __kQTFileTypeWave = getOSType!("WAVE"); + const __kQTFileTypeSystemSevenSound = getOSType!("sfil"); + const __kQTFileTypeMuLaw = getOSType!("ULAW"); + const __kQTFileTypeAVI = getOSType!("VfW "); + const __kQTFileTypeSoundDesignerII = getOSType!("Sd2f"); + const __kQTFileTypeAudioCDTrack = getOSType!("trak"); + const __kQTFileTypePICS = getOSType!("PICS"); + const __kQTFileTypeGIF = getOSType!("GIFf"); + const __kQTFileTypePNG = getOSType!("PNGf"); + const __kQTFileTypeTIFF = getOSType!("TIFF"); + const __kQTFileTypePhotoShop = getOSType!("8BPS"); + const __kQTFileTypeSGIImage = getOSType!(".SGI"); + const __kQTFileTypeBMP = getOSType!("BMPf"); + const __kQTFileTypeJPEG = getOSType!("JPEG"); + const __kQTFileTypeJFIF = getOSType!("JPEG"); + const __kQTFileTypeMacPaint = getOSType!("PNTG"); + const __kQTFileTypeTargaImage = getOSType!("TPIC"); + const __kQTFileTypeQuickDrawGXPicture = getOSType!("qdgx"); + const __kQTFileTypeQuickTimeImage = getOSType!("qtif"); + const __kQTFileType3DMF = getOSType!("3DMF"); + const __kQTFileTypeFLC = getOSType!("FLC "); + const __kQTFileTypeFlash = getOSType!("SWFL"); + const __kQTFileTypeFlashPix = getOSType!("FPix"); + const __kQTFileTypeMP4 = getOSType!("mpg4"); + const __kQTFileTypePDF = getOSType!("PDF "); + const __kQTFileType3GPP = getOSType!("3gpp"); + const __kQTFileTypeAMR = getOSType!("amr "); + const __kQTFileTypeSDV = getOSType!("sdv "); + const __kQTFileType3GP2 = getOSType!("3gp2"); + const __kQTFileTypeAMC = getOSType!("amc "); + const __kQTFileTypeJPEG2000 = getOSType!("jp2 "); + const __kRawCodecType = getOSType!("raw "); + const __kCinepakCodecType = getOSType!("cvid"); + const __kGraphicsCodecType = getOSType!("smc "); + const __kAnimationCodecType = getOSType!("rle "); + const __kVideoCodecType = getOSType!("rpza"); + const __kComponentVideoCodecType = getOSType!("yuv2"); + const __kJPEGCodecType = getOSType!("jpeg"); + const __kMotionJPEGACodecType = getOSType!("mjpa"); + const __kMotionJPEGBCodecType = getOSType!("mjpb"); + const __kSGICodecType = getOSType!(".SGI"); + const __kPlanarRGBCodecType = getOSType!("8BPS"); + const __kMacPaintCodecType = getOSType!("PNTG"); + const __kGIFCodecType = getOSType!("gif "); + const __kPhotoCDCodecType = getOSType!("kpcd"); + const __kQuickDrawGXCodecType = getOSType!("qdgx"); + const __kAVRJPEGCodecType = getOSType!("avr "); + const __kOpenDMLJPEGCodecType = getOSType!("dmb1"); + const __kBMPCodecType = getOSType!("WRLE"); + const __kWindowsRawCodecType = getOSType!("WRAW"); + const __kVectorCodecType = getOSType!("path"); + const __kQuickDrawCodecType = getOSType!("qdrw"); + const __kWaterRippleCodecType = getOSType!("ripl"); + const __kFireCodecType = getOSType!("fire"); + const __kCloudCodecType = getOSType!("clou"); + const __kH261CodecType = getOSType!("h261"); + const __kH263CodecType = getOSType!("h263"); + const __kDVCNTSCCodecType = getOSType!("dvc "); + const __kDVCPALCodecType = getOSType!("dvcp"); + const __kDVCProPALCodecType = getOSType!("dvpp"); + const __kDVCPro50NTSCCodecType = getOSType!("dv5n"); + const __kDVCPro50PALCodecType = getOSType!("dv5p"); + const __kDVCPro100NTSCCodecType = getOSType!("dv1n"); + const __kDVCPro100PALCodecType = getOSType!("dv1p"); + const __kDVCPROHD720pCodecType = getOSType!("dvhp"); + const __kDVCPROHD1080i60CodecType = getOSType!("dvh6"); + const __kDVCPROHD1080i50CodecType = getOSType!("dvh5"); + const __kBaseCodecType = getOSType!("base"); + const __kFLCCodecType = getOSType!("flic"); + const __kTargaCodecType = getOSType!("tga "); + const __kPNGCodecType = getOSType!("png "); + const __kTIFFCodecType = getOSType!("tiff"); + const __kComponentVideoSigned = getOSType!("yuvu"); + const __kComponentVideoUnsigned = getOSType!("yuvs"); + const __kCMYKCodecType = getOSType!("cmyk"); + const __kMicrosoftVideo1CodecType = getOSType!("msvc"); + const __kSorensonCodecType = getOSType!("SVQ1"); + const __kSorenson3CodecType = getOSType!("SVQ3"); + const __kIndeo4CodecType = getOSType!("IV41"); + const __kMPEG4VisualCodecType = getOSType!("mp4v"); + const __k64ARGBCodecType = getOSType!("b64a"); + const __k48RGBCodecType = getOSType!("b48r"); + const __k32AlphaGrayCodecType = getOSType!("b32a"); + const __k16GrayCodecType = getOSType!("b16g"); + const __kMpegYUV420CodecType = getOSType!("myuv"); + const __kYUV420CodecType = getOSType!("y420"); + const __kSorensonYUV9CodecType = getOSType!("syv9"); + const __k422YpCbCr8CodecType = getOSType!("2vuy"); + const __k444YpCbCr8CodecType = getOSType!("v308"); + const __k4444YpCbCrA8CodecType = getOSType!("v408"); + const __k422YpCbCr16CodecType = getOSType!("v216"); + const __k422YpCbCr10CodecType = getOSType!("v210"); + const __k444YpCbCr10CodecType = getOSType!("v410"); + const __k4444YpCbCrA8RCodecType = getOSType!("r408"); + const __kJPEG2000CodecType = getOSType!("mjp2"); + const __kPixletCodecType = getOSType!("pxlt"); + const __kH264CodecType = getOSType!("avc1"); + } +} + +enum +{ + VideoMediaType = getOSType!("vide"), + SoundMediaType = getOSType!("soun"), + TextMediaType = getOSType!("text"), + BaseMediaType = getOSType!("gnrc"), + MPEGMediaType = getOSType!("MPEG"), + MusicMediaType = getOSType!("musi"), + TimeCodeMediaType = getOSType!("tmcd"), + SpriteMediaType = getOSType!("sprt"), + FlashMediaType = getOSType!("flsh"), + MovieMediaType = getOSType!("moov"), + TweenMediaType = getOSType!("twen"), + ThreeDeeMediaType = getOSType!("qd3d"), + SkinMediaType = getOSType!("skin"), + HandleDataHandlerSubType = getOSType!("hndl"), + PointerDataHandlerSubType = getOSType!("ptr "), + NullDataHandlerSubType = getOSType!("null"), + ResourceDataHandlerSubType = getOSType!("rsrc"), + URLDataHandlerSubType = getOSType!("url "), + AliasDataHandlerSubType = getOSType!("alis"), + WiredActionHandlerType = getOSType!("wire"), + kQTQuartzComposerMediaType = getOSType!("qtz "), + TimeCode64MediaType = getOSType!("tc64") +} + +enum +{ + kQTFileTypeAIFF = getOSType!("AIFF"), + kQTFileTypeAIFC = getOSType!("AIFC"), + kQTFileTypeDVC = getOSType!("dvc!"), + kQTFileTypeMIDI = getOSType!("Midi"), + kQTFileTypePicture = getOSType!("PICT"), + kQTFileTypeMovie = getOSType!("MooV"), + kQTFileTypeText = getOSType!("TEXT"), + kQTFileTypeWave = getOSType!("WAVE"), + kQTFileTypeSystemSevenSound = getOSType!("sfil"), + kQTFileTypeMuLaw = getOSType!("ULAW"), + kQTFileTypeAVI = getOSType!("VfW "), + kQTFileTypeSoundDesignerII = getOSType!("Sd2f"), + kQTFileTypeAudioCDTrack = getOSType!("trak"), + kQTFileTypePICS = getOSType!("PICS"), + kQTFileTypeGIF = getOSType!("GIFf"), + kQTFileTypePNG = getOSType!("PNGf"), + kQTFileTypeTIFF = getOSType!("TIFF"), + kQTFileTypePhotoShop = getOSType!("8BPS"), + kQTFileTypeSGIImage = getOSType!(".SGI"), + kQTFileTypeBMP = getOSType!("BMPf"), + kQTFileTypeJPEG = getOSType!("JPEG"), + kQTFileTypeJFIF = getOSType!("JPEG"), + kQTFileTypeMacPaint = getOSType!("PNTG"), + kQTFileTypeTargaImage = getOSType!("TPIC"), + kQTFileTypeQuickDrawGXPicture = getOSType!("qdgx"), + kQTFileTypeQuickTimeImage = getOSType!("qtif"), + kQTFileType3DMF = getOSType!("3DMF"), + kQTFileTypeFLC = getOSType!("FLC "), + kQTFileTypeFlash = getOSType!("SWFL"), + kQTFileTypeFlashPix = getOSType!("FPix"), + kQTFileTypeMP4 = getOSType!("mpg4"), + kQTFileTypePDF = getOSType!("PDF "), + kQTFileType3GPP = getOSType!("3gpp"), + kQTFileTypeAMR = getOSType!("amr "), + kQTFileTypeSDV = getOSType!("sdv "), + kQTFileType3GP2 = getOSType!("3gp2"), + kQTFileTypeAMC = getOSType!("amc "), + kQTFileTypeJPEG2000 = getOSType!("jp2 ") +} + +enum +{ + codecLosslessQuality = 0x00000400, + codecMaxQuality = 0x000003FF, + codecMinQuality = 0x00000000, + codecLowQuality = 0x00000100, + codecNormalQuality = 0x00000200, + codecHighQuality = 0x00000300 +} + +enum +{ + kRawCodecType = getOSType!("raw "), + kCinepakCodecType = getOSType!("cvid"), + kGraphicsCodecType = getOSType!("smc "), + kAnimationCodecType = getOSType!("rle "), + kVideoCodecType = getOSType!("rpza"), + kComponentVideoCodecType = getOSType!("yuv2"), + kJPEGCodecType = getOSType!("jpeg"), + kMotionJPEGACodecType = getOSType!("mjpa"), + kMotionJPEGBCodecType = getOSType!("mjpb"), + kSGICodecType = getOSType!(".SGI"), + kPlanarRGBCodecType = getOSType!("8BPS"), + kMacPaintCodecType = getOSType!("PNTG"), + kGIFCodecType = getOSType!("gif "), + kPhotoCDCodecType = getOSType!("kpcd"), + kQuickDrawGXCodecType = getOSType!("qdgx"), + kAVRJPEGCodecType = getOSType!("avr "), + kOpenDMLJPEGCodecType = getOSType!("dmb1"), + kBMPCodecType = getOSType!("WRLE"), + kWindowsRawCodecType = getOSType!("WRAW"), + kVectorCodecType = getOSType!("path"), + kQuickDrawCodecType = getOSType!("qdrw"), + kWaterRippleCodecType = getOSType!("ripl"), + kFireCodecType = getOSType!("fire"), + kCloudCodecType = getOSType!("clou"), + kH261CodecType = getOSType!("h261"), + kH263CodecType = getOSType!("h263"), + kDVCNTSCCodecType = getOSType!("dvc "), + kDVCPALCodecType = getOSType!("dvcp"), + kDVCProPALCodecType = getOSType!("dvpp"), + kDVCPro50NTSCCodecType = getOSType!("dv5n"), + kDVCPro50PALCodecType = getOSType!("dv5p"), + kDVCPro100NTSCCodecType = getOSType!("dv1n"), + kDVCPro100PALCodecType = getOSType!("dv1p"), + kDVCPROHD720pCodecType = getOSType!("dvhp"), + kDVCPROHD1080i60CodecType = getOSType!("dvh6"), + kDVCPROHD1080i50CodecType = getOSType!("dvh5"), + kBaseCodecType = getOSType!("base"), + kFLCCodecType = getOSType!("flic"), + kTargaCodecType = getOSType!("tga "), + kPNGCodecType = getOSType!("png "), + kTIFFCodecType = getOSType!("tiff"), + kComponentVideoSigned = getOSType!("yuvu"), + kComponentVideoUnsigned = getOSType!("yuvs"), + kCMYKCodecType = getOSType!("cmyk"), + kMicrosoftVideo1CodecType = getOSType!("msvc"), + kSorensonCodecType = getOSType!("SVQ1"), + kSorenson3CodecType = getOSType!("SVQ3"), + kIndeo4CodecType = getOSType!("IV41"), + kMPEG4VisualCodecType = getOSType!("mp4v"), + k64ARGBCodecType = getOSType!("b64a"), + k48RGBCodecType = getOSType!("b48r"), + k32AlphaGrayCodecType = getOSType!("b32a"), + k16GrayCodecType = getOSType!("b16g"), + kMpegYUV420CodecType = getOSType!("myuv"), + kYUV420CodecType = getOSType!("y420"), + kSorensonYUV9CodecType = getOSType!("syv9"), + k422YpCbCr8CodecType = getOSType!("2vuy"), + k444YpCbCr8CodecType = getOSType!("v308"), + k4444YpCbCrA8CodecType = getOSType!("v408"), + k422YpCbCr16CodecType = getOSType!("v216"), + k422YpCbCr10CodecType = getOSType!("v210"), + k444YpCbCr10CodecType = getOSType!("v410"), + k4444YpCbCrA8RCodecType = getOSType!("r408"), + kJPEG2000CodecType = getOSType!("mjp2"), + kPixletCodecType = getOSType!("pxlt"), + kH264CodecType = getOSType!("avc1") +} + +enum +{ + graphicsModeStraightAlpha = 256, + graphicsModePreWhiteAlpha = 257, + graphicsModePreBlackAlpha = 258, + graphicsModeComposition = 259, + graphicsModeStraightAlphaBlend = 260, + graphicsModePreMulColorAlpha = 261, + graphicsModePerComponentAlpha = 272 +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/qtkit/QTMedia.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/qtkit/QTMedia.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,371 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 28, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.qtkit.QTMedia; + +import dstep.foundation.Foundation; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.qtkit.QTKitDefines; +import dstep.qtkit.QTMovie; +import dstep.qtkit.QTTrack; + +import bindings = dstep.qtkit.QTMedia_bindings; + +private +{ + NSString QTMediaTypeVideo_; + NSString QTMediaTypeSound_; + NSString QTMediaTypeText_; + NSString QTMediaTypeBase_; + NSString QTMediaTypeMPEG_; + NSString QTMediaTypeMusic_; + NSString QTMediaTypeTimeCode_; + NSString QTMediaTypeSprite_; + NSString QTMediaTypeFlash_; + NSString QTMediaTypeMovie_; + NSString QTMediaTypeTween_; + NSString QTMediaType3D_; + NSString QTMediaTypeSkin_; + NSString QTMediaTypeQTVR_; + NSString QTMediaTypeHint_; + NSString QTMediaTypeStream_; + NSString QTMediaTypeMuxed_; + NSString QTMediaTypeQuartzComposer_; + NSString QTMediaCharacteristicVisual_; + NSString QTMediaCharacteristicAudio_; + NSString QTMediaCharacteristicCanSendVideo_; + NSString QTMediaCharacteristicProvidesActions_; + NSString QTMediaCharacteristicNonLinear_; + NSString QTMediaCharacteristicCanStep_; + NSString QTMediaCharacteristicHasNoDuration_; + NSString QTMediaCharacteristicHasSkinData_; + NSString QTMediaCharacteristicProvidesKeyFocus_; + NSString QTMediaCharacteristicHasVideoFrameRate_; + NSString QTMediaCreationTimeAttribute_; + NSString QTMediaDurationAttribute_; + NSString QTMediaModificationTimeAttribute_; + NSString QTMediaSampleCountAttribute_; + NSString QTMediaQualityAttribute_; + NSString QTMediaTimeScaleAttribute_; + NSString QTMediaTypeAttribute_; +} + +NSString QTMediaTypeVideo () +{ + if (QTMediaTypeVideo_) + return QTMediaTypeVideo_; + + return QTMediaTypeVideo_ = new NSString(bindings.QTMediaTypeVideo); +} + +NSString QTMediaTypeSound () +{ + if (QTMediaTypeSound_) + return QTMediaTypeSound_; + + return QTMediaTypeSound_ = new NSString(bindings.QTMediaTypeSound); +} + +NSString QTMediaTypeText () +{ + if (QTMediaTypeText_) + return QTMediaTypeText_; + + return QTMediaTypeText_ = new NSString(bindings.QTMediaTypeText); +} + +NSString QTMediaTypeBase () +{ + if (QTMediaTypeBase_) + return QTMediaTypeBase_; + + return QTMediaTypeBase_ = new NSString(bindings.QTMediaTypeBase); +} + +NSString QTMediaTypeMPEG () +{ + if (QTMediaTypeMPEG_) + return QTMediaTypeMPEG_; + + return QTMediaTypeMPEG_ = new NSString(bindings.QTMediaTypeMPEG); +} + +NSString QTMediaTypeMusic () +{ + if (QTMediaTypeMusic_) + return QTMediaTypeMusic_; + + return QTMediaTypeMusic_ = new NSString(bindings.QTMediaTypeMusic); +} + +NSString QTMediaTypeTimeCode () +{ + if (QTMediaTypeTimeCode_) + return QTMediaTypeTimeCode_; + + return QTMediaTypeTimeCode_ = new NSString(bindings.QTMediaTypeTimeCode); +} + +NSString QTMediaTypeSprite () +{ + if (QTMediaTypeSprite_) + return QTMediaTypeSprite_; + + return QTMediaTypeSprite_ = new NSString(bindings.QTMediaTypeSprite); +} + +NSString QTMediaTypeFlash () +{ + if (QTMediaTypeFlash_) + return QTMediaTypeFlash_; + + return QTMediaTypeFlash_ = new NSString(bindings.QTMediaTypeFlash); +} + +NSString QTMediaTypeMovie () +{ + if (QTMediaTypeMovie_) + return QTMediaTypeMovie_; + + return QTMediaTypeMovie_ = new NSString(bindings.QTMediaTypeMovie); +} + +NSString QTMediaTypeTween () +{ + if (QTMediaTypeTween_) + return QTMediaTypeTween_; + + return QTMediaTypeTween_ = new NSString(bindings.QTMediaTypeTween); +} + +NSString QTMediaType3D () +{ + if (QTMediaType3D_) + return QTMediaType3D_; + + return QTMediaType3D_ = new NSString(bindings.QTMediaType3D); +} + +NSString QTMediaTypeSkin () +{ + if (QTMediaTypeSkin_) + return QTMediaTypeSkin_; + + return QTMediaTypeSkin_ = new NSString(bindings.QTMediaTypeSkin); +} + +NSString QTMediaTypeQTVR () +{ + if (QTMediaTypeQTVR_) + return QTMediaTypeQTVR_; + + return QTMediaTypeQTVR_ = new NSString(bindings.QTMediaTypeQTVR); +} + +NSString QTMediaTypeHint () +{ + if (QTMediaTypeHint_) + return QTMediaTypeHint_; + + return QTMediaTypeHint_ = new NSString(bindings.QTMediaTypeHint); +} + +NSString QTMediaTypeStream () +{ + if (QTMediaTypeStream_) + return QTMediaTypeStream_; + + return QTMediaTypeStream_ = new NSString(bindings.QTMediaTypeStream); +} + +NSString QTMediaTypeMuxed () +{ + if (QTMediaTypeMuxed_) + return QTMediaTypeMuxed_; + + return QTMediaTypeMuxed_ = new NSString(bindings.QTMediaTypeMuxed); +} + +NSString QTMediaTypeQuartzComposer () +{ + if (QTMediaTypeQuartzComposer_) + return QTMediaTypeQuartzComposer_; + + return QTMediaTypeQuartzComposer_ = new NSString(bindings.QTMediaTypeQuartzComposer); +} + +NSString QTMediaCharacteristicVisual () +{ + if (QTMediaCharacteristicVisual_) + return QTMediaCharacteristicVisual_; + + return QTMediaCharacteristicVisual_ = new NSString(bindings.QTMediaCharacteristicVisual); +} + +NSString QTMediaCharacteristicAudio () +{ + if (QTMediaCharacteristicAudio_) + return QTMediaCharacteristicAudio_; + + return QTMediaCharacteristicAudio_ = new NSString(bindings.QTMediaCharacteristicAudio); +} + +NSString QTMediaCharacteristicCanSendVideo () +{ + if (QTMediaCharacteristicCanSendVideo_) + return QTMediaCharacteristicCanSendVideo_; + + return QTMediaCharacteristicCanSendVideo_ = new NSString(bindings.QTMediaCharacteristicCanSendVideo); +} + +NSString QTMediaCharacteristicProvidesActions () +{ + if (QTMediaCharacteristicProvidesActions_) + return QTMediaCharacteristicProvidesActions_; + + return QTMediaCharacteristicProvidesActions_ = new NSString(bindings.QTMediaCharacteristicProvidesActions); +} + +NSString QTMediaCharacteristicNonLinear () +{ + if (QTMediaCharacteristicNonLinear_) + return QTMediaCharacteristicNonLinear_; + + return QTMediaCharacteristicNonLinear_ = new NSString(bindings.QTMediaCharacteristicNonLinear); +} + +NSString QTMediaCharacteristicCanStep () +{ + if (QTMediaCharacteristicCanStep_) + return QTMediaCharacteristicCanStep_; + + return QTMediaCharacteristicCanStep_ = new NSString(bindings.QTMediaCharacteristicCanStep); +} + +NSString QTMediaCharacteristicHasNoDuration () +{ + if (QTMediaCharacteristicHasNoDuration_) + return QTMediaCharacteristicHasNoDuration_; + + return QTMediaCharacteristicHasNoDuration_ = new NSString(bindings.QTMediaCharacteristicHasNoDuration); +} + +NSString QTMediaCharacteristicHasSkinData () +{ + if (QTMediaCharacteristicHasSkinData_) + return QTMediaCharacteristicHasSkinData_; + + return QTMediaCharacteristicHasSkinData_ = new NSString(bindings.QTMediaCharacteristicHasSkinData); +} + +NSString QTMediaCharacteristicProvidesKeyFocus () +{ + if (QTMediaCharacteristicProvidesKeyFocus_) + return QTMediaCharacteristicProvidesKeyFocus_; + + return QTMediaCharacteristicProvidesKeyFocus_ = new NSString(bindings.QTMediaCharacteristicProvidesKeyFocus); +} + +NSString QTMediaCharacteristicHasVideoFrameRate () +{ + if (QTMediaCharacteristicHasVideoFrameRate_) + return QTMediaCharacteristicHasVideoFrameRate_; + + return QTMediaCharacteristicHasVideoFrameRate_ = new NSString(bindings.QTMediaCharacteristicHasVideoFrameRate); +} + +NSString QTMediaCreationTimeAttribute () +{ + if (QTMediaCreationTimeAttribute_) + return QTMediaCreationTimeAttribute_; + + return QTMediaCreationTimeAttribute_ = new NSString(bindings.QTMediaCreationTimeAttribute); +} + +NSString QTMediaDurationAttribute () +{ + if (QTMediaDurationAttribute_) + return QTMediaDurationAttribute_; + + return QTMediaDurationAttribute_ = new NSString(bindings.QTMediaDurationAttribute); +} + +NSString QTMediaModificationTimeAttribute () +{ + if (QTMediaModificationTimeAttribute_) + return QTMediaModificationTimeAttribute_; + + return QTMediaModificationTimeAttribute_ = new NSString(bindings.QTMediaModificationTimeAttribute); +} + +NSString QTMediaSampleCountAttribute () +{ + if (QTMediaSampleCountAttribute_) + return QTMediaSampleCountAttribute_; + + return QTMediaSampleCountAttribute_ = new NSString(bindings.QTMediaSampleCountAttribute); +} + +NSString QTMediaQualityAttribute () +{ + if (QTMediaQualityAttribute_) + return QTMediaQualityAttribute_; + + return QTMediaQualityAttribute_ = new NSString(bindings.QTMediaQualityAttribute); +} + +NSString QTMediaTimeScaleAttribute () +{ + if (QTMediaTimeScaleAttribute_) + return QTMediaTimeScaleAttribute_; + + return QTMediaTimeScaleAttribute_ = new NSString(bindings.QTMediaTimeScaleAttribute); +} + +NSString QTMediaTypeAttribute () +{ + if (QTMediaTypeAttribute_) + return QTMediaTypeAttribute_; + + return QTMediaTypeAttribute_ = new NSString(bindings.QTMediaTypeAttribute); +} + +class QTMedia : NSObject +{ + mixin (ObjcWrap); + + QTTrack track () + { + return invokeObjcSelf!(QTTrack, "track"); + } + + NSDictionary mediaAttributes () + { + return invokeObjcSelf!(NSDictionary, "mediaAttributes"); + } + + void setMediaAttributes (NSDictionary attributes) + { + return invokeObjcSelf!(void, "setMediaAttributes:", NSDictionary)(attributes); + } + + Object attributeForKey (NSString attributeKey) + { + return invokeObjcSelf!(Object, "attributeForKey:", NSString)(attributeKey); + } + + void setAttribute (Object value, NSString attributeKey) + { + return invokeObjcSelf!(void, "setAttribute:forKey:", Object, NSString)(value, attributeKey); + } + + bool hasCharacteristic (NSString characteristic) + { + return invokeObjcSelf!(bool, "hasCharacteristic:", NSString)(characteristic); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/qtkit/QTMedia_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/qtkit/QTMedia_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,52 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 28, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.qtkit.QTMedia_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package const id QTMediaTypeVideo; + package const id QTMediaTypeSound; + package const id QTMediaTypeText; + package const id QTMediaTypeBase; + package const id QTMediaTypeMPEG; + package const id QTMediaTypeMusic; + package const id QTMediaTypeTimeCode; + package const id QTMediaTypeSprite; + package const id QTMediaTypeFlash; + package const id QTMediaTypeMovie; + package const id QTMediaTypeTween; + package const id QTMediaType3D; + package const id QTMediaTypeSkin; + package const id QTMediaTypeQTVR; + package const id QTMediaTypeHint; + package const id QTMediaTypeStream; + package const id QTMediaTypeMuxed; + package const id QTMediaTypeQuartzComposer; + package const id QTMediaCharacteristicVisual; + package const id QTMediaCharacteristicAudio; + package const id QTMediaCharacteristicCanSendVideo; + package const id QTMediaCharacteristicProvidesActions; + package const id QTMediaCharacteristicNonLinear; + package const id QTMediaCharacteristicCanStep; + package const id QTMediaCharacteristicHasNoDuration; + package const id QTMediaCharacteristicHasSkinData; + package const id QTMediaCharacteristicProvidesKeyFocus; + package const id QTMediaCharacteristicHasVideoFrameRate; + package const id QTMediaCreationTimeAttribute; + package const id QTMediaDurationAttribute; + package const id QTMediaModificationTimeAttribute; + package const id QTMediaSampleCountAttribute; + package const id QTMediaQualityAttribute; + package const id QTMediaTimeScaleAttribute; + package const id QTMediaTypeAttribute; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/qtkit/QTMovie.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/qtkit/QTMovie.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,2668 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 28, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.qtkit.QTMovie; + +import dstep.cocoa.Cocoa; +import dstep.appkit.NSImage; +import dstep.appkit.NSPasteboard; +import dstep.foundation.NSArray; +import dstep.foundation.NSCoder; +import dstep.foundation.NSData; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSError; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSURL; +import dstep.foundation.NSZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.qtkit.QTDataReference; +import dstep.qtkit.QTKitDefines; +import dstep.qtkit.QTTime; +import dstep.qtkit.QTTimeRange; +import dstep.qtkit.QTTrack; + +import bindings = dstep.qtkit.QTMovie_bindings; + +alias NSInteger QTMovieLoadState; + +private +{ + NSString QTMoviePasteboardType_; + NSString QTMovieEditabilityDidChangeNotification_; + NSString QTMovieEditedNotification_; + NSString QTMovieLoadStateDidChangeNotification_; + NSString QTMovieLoopModeDidChangeNotification_; + NSString QTMovieMessageStringPostedNotification_; + NSString QTMovieRateDidChangeNotification_; + NSString QTMovieSelectionDidChangeNotification_; + NSString QTMovieSizeDidChangeNotification_; + NSString QTMovieStatusStringPostedNotification_; + NSString QTMovieTimeDidChangeNotification_; + NSString QTMovieVolumeDidChangeNotification_; + NSString QTMovieDidEndNotification_; + NSString QTMovieChapterDidChangeNotification_; + NSString QTMovieChapterListDidChangeNotification_; + NSString QTMovieEnterFullScreenRequestNotification_; + NSString QTMovieExitFullScreenRequestNotification_; + NSString QTMovieCloseWindowRequestNotification_; + NSString QTMovieApertureModeDidChangeNotification_; + NSString QTMovieMessageNotificationParameter_; + NSString QTMovieRateDidChangeNotificationParameter_; + NSString QTMovieStatusFlagsNotificationParameter_; + NSString QTMovieStatusCodeNotificationParameter_; + NSString QTMovieStatusStringNotificationParameter_; + NSString QTMovieTargetIDNotificationParameter_; + NSString QTMovieTargetNameNotificationParameter_; + NSString QTMovieExport_; + NSString QTMovieExportType_; + NSString QTMovieFlatten_; + NSString QTMovieExportSettings_; + NSString QTMovieExportManufacturer_; + NSString QTAddImageCodecType_; + NSString QTAddImageCodecQuality_; + NSString QTMovieDataReferenceAttribute_; + NSString QTMoviePasteboardAttribute_; + NSString QTMovieDataAttribute_; + NSString QTMovieFileOffsetAttribute_; + NSString QTMovieResolveDataRefsAttribute_; + NSString QTMovieAskUnresolvedDataRefsAttribute_; + NSString QTMovieOpenAsyncOKAttribute_; + NSString QTMovieApertureModeAttribute_; + NSString QTMovieAutoAlternatesAttribute_; + NSString QTMovieCopyrightAttribute_; + NSString QTMovieCreationTimeAttribute_; + NSString QTMovieCurrentSizeAttribute_; + NSString QTMovieCurrentTimeAttribute_; + NSString QTMovieDataSizeAttribute_; + NSString QTMovieDelegateAttribute_; + NSString QTMovieDisplayNameAttribute_; + NSString QTMovieDontInteractWithUserAttribute_; + NSString QTMovieDurationAttribute_; + NSString QTMovieEditableAttribute_; + NSString QTMovieFileNameAttribute_; + NSString QTMovieHasApertureModeDimensionsAttribute_; + NSString QTMovieHasAudioAttribute_; + NSString QTMovieHasDurationAttribute_; + NSString QTMovieHasVideoAttribute_; + NSString QTMovieIsActiveAttribute_; + NSString QTMovieIsInteractiveAttribute_; + NSString QTMovieIsLinearAttribute_; + NSString QTMovieIsSteppableAttribute_; + NSString QTMovieLoadStateAttribute_; + NSString QTMovieLoopsAttribute_; + NSString QTMovieLoopsBackAndForthAttribute_; + NSString QTMovieModificationTimeAttribute_; + NSString QTMovieMutedAttribute_; + NSString QTMovieNaturalSizeAttribute_; + NSString QTMoviePlaysAllFramesAttribute_; + NSString QTMoviePlaysSelectionOnlyAttribute_; + NSString QTMoviePosterTimeAttribute_; + NSString QTMoviePreferredMutedAttribute_; + NSString QTMoviePreferredRateAttribute_; + NSString QTMoviePreferredVolumeAttribute_; + NSString QTMoviePreviewModeAttribute_; + NSString QTMoviePreviewRangeAttribute_; + NSString QTMovieRateAttribute_; + NSString QTMovieSelectionAttribute_; + NSString QTMovieTimeScaleAttribute_; + NSString QTMovieURLAttribute_; + NSString QTMovieVolumeAttribute_; + NSString QTMovieRateChangesPreservePitchAttribute_; + NSString QTMovieApertureModeClassic_; + NSString QTMovieApertureModeClean_; + NSString QTMovieApertureModeProduction_; + NSString QTMovieApertureModeEncodedPixels_; + NSString QTMovieFrameImageSize_; + NSString QTMovieFrameImageType_; + NSString QTMovieFrameImageTypeNSImage_; + NSString QTMovieFrameImageTypeCGImageRef_; + NSString QTMovieFrameImageTypeCIImage_; + NSString QTMovieFrameImageTypeCVPixelBufferRef_; + NSString QTMovieFrameImageTypeCVOpenGLTextureRef_; + NSString QTMovieFrameImageOpenGLContext_; + NSString QTMovieFrameImagePixelFormat_; + NSString QTMovieFrameImageRepresentationsType_; + NSString QTMovieFrameImageDeinterlaceFields_; + NSString QTMovieFrameImageHighQuality_; + NSString QTMovieFrameImageSingleField_; + NSString QTMovieUneditableException_; + NSString QTMovieChapterName_; + NSString QTMovieChapterStartTime_; + NSString QTMovieChapterTargetTrackAttribute_; +} + +NSString QTMoviePasteboardType () +{ + if (QTMoviePasteboardType_) + return QTMoviePasteboardType_; + + return QTMoviePasteboardType_ = new NSString(bindings.QTMoviePasteboardType); +} + +NSString QTMovieEditabilityDidChangeNotification () +{ + if (QTMovieEditabilityDidChangeNotification_) + return QTMovieEditabilityDidChangeNotification_; + + return QTMovieEditabilityDidChangeNotification_ = new NSString(bindings.QTMovieEditabilityDidChangeNotification); +} + +NSString QTMovieEditedNotification () +{ + if (QTMovieEditedNotification_) + return QTMovieEditedNotification_; + + return QTMovieEditedNotification_ = new NSString(bindings.QTMovieEditedNotification); +} + +NSString QTMovieLoadStateDidChangeNotification () +{ + if (QTMovieLoadStateDidChangeNotification_) + return QTMovieLoadStateDidChangeNotification_; + + return QTMovieLoadStateDidChangeNotification_ = new NSString(bindings.QTMovieLoadStateDidChangeNotification); +} + +NSString QTMovieLoopModeDidChangeNotification () +{ + if (QTMovieLoopModeDidChangeNotification_) + return QTMovieLoopModeDidChangeNotification_; + + return QTMovieLoopModeDidChangeNotification_ = new NSString(bindings.QTMovieLoopModeDidChangeNotification); +} + +NSString QTMovieMessageStringPostedNotification () +{ + if (QTMovieMessageStringPostedNotification_) + return QTMovieMessageStringPostedNotification_; + + return QTMovieMessageStringPostedNotification_ = new NSString(bindings.QTMovieMessageStringPostedNotification); +} + +NSString QTMovieRateDidChangeNotification () +{ + if (QTMovieRateDidChangeNotification_) + return QTMovieRateDidChangeNotification_; + + return QTMovieRateDidChangeNotification_ = new NSString(bindings.QTMovieRateDidChangeNotification); +} + +NSString QTMovieSelectionDidChangeNotification () +{ + if (QTMovieSelectionDidChangeNotification_) + return QTMovieSelectionDidChangeNotification_; + + return QTMovieSelectionDidChangeNotification_ = new NSString(bindings.QTMovieSelectionDidChangeNotification); +} + +NSString QTMovieSizeDidChangeNotification () +{ + if (QTMovieSizeDidChangeNotification_) + return QTMovieSizeDidChangeNotification_; + + return QTMovieSizeDidChangeNotification_ = new NSString(bindings.QTMovieSizeDidChangeNotification); +} + +NSString QTMovieStatusStringPostedNotification () +{ + if (QTMovieStatusStringPostedNotification_) + return QTMovieStatusStringPostedNotification_; + + return QTMovieStatusStringPostedNotification_ = new NSString(bindings.QTMovieStatusStringPostedNotification); +} + +NSString QTMovieTimeDidChangeNotification () +{ + if (QTMovieTimeDidChangeNotification_) + return QTMovieTimeDidChangeNotification_; + + return QTMovieTimeDidChangeNotification_ = new NSString(bindings.QTMovieTimeDidChangeNotification); +} + +NSString QTMovieVolumeDidChangeNotification () +{ + if (QTMovieVolumeDidChangeNotification_) + return QTMovieVolumeDidChangeNotification_; + + return QTMovieVolumeDidChangeNotification_ = new NSString(bindings.QTMovieVolumeDidChangeNotification); +} + +NSString QTMovieDidEndNotification () +{ + if (QTMovieDidEndNotification_) + return QTMovieDidEndNotification_; + + return QTMovieDidEndNotification_ = new NSString(bindings.QTMovieDidEndNotification); +} + +NSString QTMovieChapterDidChangeNotification () +{ + if (QTMovieChapterDidChangeNotification_) + return QTMovieChapterDidChangeNotification_; + + return QTMovieChapterDidChangeNotification_ = new NSString(bindings.QTMovieChapterDidChangeNotification); +} + +NSString QTMovieChapterListDidChangeNotification () +{ + if (QTMovieChapterListDidChangeNotification_) + return QTMovieChapterListDidChangeNotification_; + + return QTMovieChapterListDidChangeNotification_ = new NSString(bindings.QTMovieChapterListDidChangeNotification); +} + +NSString QTMovieEnterFullScreenRequestNotification () +{ + if (QTMovieEnterFullScreenRequestNotification_) + return QTMovieEnterFullScreenRequestNotification_; + + return QTMovieEnterFullScreenRequestNotification_ = new NSString(bindings.QTMovieEnterFullScreenRequestNotification); +} + +NSString QTMovieExitFullScreenRequestNotification () +{ + if (QTMovieExitFullScreenRequestNotification_) + return QTMovieExitFullScreenRequestNotification_; + + return QTMovieExitFullScreenRequestNotification_ = new NSString(bindings.QTMovieExitFullScreenRequestNotification); +} + +NSString QTMovieCloseWindowRequestNotification () +{ + if (QTMovieCloseWindowRequestNotification_) + return QTMovieCloseWindowRequestNotification_; + + return QTMovieCloseWindowRequestNotification_ = new NSString(bindings.QTMovieCloseWindowRequestNotification); +} + +NSString QTMovieApertureModeDidChangeNotification () +{ + if (QTMovieApertureModeDidChangeNotification_) + return QTMovieApertureModeDidChangeNotification_; + + return QTMovieApertureModeDidChangeNotification_ = new NSString(bindings.QTMovieApertureModeDidChangeNotification); +} + +NSString QTMovieMessageNotificationParameter () +{ + if (QTMovieMessageNotificationParameter_) + return QTMovieMessageNotificationParameter_; + + return QTMovieMessageNotificationParameter_ = new NSString(bindings.QTMovieMessageNotificationParameter); +} + +NSString QTMovieRateDidChangeNotificationParameter () +{ + if (QTMovieRateDidChangeNotificationParameter_) + return QTMovieRateDidChangeNotificationParameter_; + + return QTMovieRateDidChangeNotificationParameter_ = new NSString(bindings.QTMovieRateDidChangeNotificationParameter); +} + +NSString QTMovieStatusFlagsNotificationParameter () +{ + if (QTMovieStatusFlagsNotificationParameter_) + return QTMovieStatusFlagsNotificationParameter_; + + return QTMovieStatusFlagsNotificationParameter_ = new NSString(bindings.QTMovieStatusFlagsNotificationParameter); +} + +NSString QTMovieStatusCodeNotificationParameter () +{ + if (QTMovieStatusCodeNotificationParameter_) + return QTMovieStatusCodeNotificationParameter_; + + return QTMovieStatusCodeNotificationParameter_ = new NSString(bindings.QTMovieStatusCodeNotificationParameter); +} + +NSString QTMovieStatusStringNotificationParameter () +{ + if (QTMovieStatusStringNotificationParameter_) + return QTMovieStatusStringNotificationParameter_; + + return QTMovieStatusStringNotificationParameter_ = new NSString(bindings.QTMovieStatusStringNotificationParameter); +} + +NSString QTMovieTargetIDNotificationParameter () +{ + if (QTMovieTargetIDNotificationParameter_) + return QTMovieTargetIDNotificationParameter_; + + return QTMovieTargetIDNotificationParameter_ = new NSString(bindings.QTMovieTargetIDNotificationParameter); +} + +NSString QTMovieTargetNameNotificationParameter () +{ + if (QTMovieTargetNameNotificationParameter_) + return QTMovieTargetNameNotificationParameter_; + + return QTMovieTargetNameNotificationParameter_ = new NSString(bindings.QTMovieTargetNameNotificationParameter); +} + +NSString QTMovieExport () +{ + if (QTMovieExport_) + return QTMovieExport_; + + return QTMovieExport_ = new NSString(bindings.QTMovieExport); +} + +NSString QTMovieExportType () +{ + if (QTMovieExportType_) + return QTMovieExportType_; + + return QTMovieExportType_ = new NSString(bindings.QTMovieExportType); +} + +NSString QTMovieFlatten () +{ + if (QTMovieFlatten_) + return QTMovieFlatten_; + + return QTMovieFlatten_ = new NSString(bindings.QTMovieFlatten); +} + +NSString QTMovieExportSettings () +{ + if (QTMovieExportSettings_) + return QTMovieExportSettings_; + + return QTMovieExportSettings_ = new NSString(bindings.QTMovieExportSettings); +} + +NSString QTMovieExportManufacturer () +{ + if (QTMovieExportManufacturer_) + return QTMovieExportManufacturer_; + + return QTMovieExportManufacturer_ = new NSString(bindings.QTMovieExportManufacturer); +} + +NSString QTAddImageCodecType () +{ + if (QTAddImageCodecType_) + return QTAddImageCodecType_; + + return QTAddImageCodecType_ = new NSString(bindings.QTAddImageCodecType); +} + +NSString QTAddImageCodecQuality () +{ + if (QTAddImageCodecQuality_) + return QTAddImageCodecQuality_; + + return QTAddImageCodecQuality_ = new NSString(bindings.QTAddImageCodecQuality); +} + +NSString QTMovieDataReferenceAttribute () +{ + if (QTMovieDataReferenceAttribute_) + return QTMovieDataReferenceAttribute_; + + return QTMovieDataReferenceAttribute_ = new NSString(bindings.QTMovieDataReferenceAttribute); +} + +NSString QTMoviePasteboardAttribute () +{ + if (QTMoviePasteboardAttribute_) + return QTMoviePasteboardAttribute_; + + return QTMoviePasteboardAttribute_ = new NSString(bindings.QTMoviePasteboardAttribute); +} + +NSString QTMovieDataAttribute () +{ + if (QTMovieDataAttribute_) + return QTMovieDataAttribute_; + + return QTMovieDataAttribute_ = new NSString(bindings.QTMovieDataAttribute); +} + +NSString QTMovieFileOffsetAttribute () +{ + if (QTMovieFileOffsetAttribute_) + return QTMovieFileOffsetAttribute_; + + return QTMovieFileOffsetAttribute_ = new NSString(bindings.QTMovieFileOffsetAttribute); +} + +NSString QTMovieResolveDataRefsAttribute () +{ + if (QTMovieResolveDataRefsAttribute_) + return QTMovieResolveDataRefsAttribute_; + + return QTMovieResolveDataRefsAttribute_ = new NSString(bindings.QTMovieResolveDataRefsAttribute); +} + +NSString QTMovieAskUnresolvedDataRefsAttribute () +{ + if (QTMovieAskUnresolvedDataRefsAttribute_) + return QTMovieAskUnresolvedDataRefsAttribute_; + + return QTMovieAskUnresolvedDataRefsAttribute_ = new NSString(bindings.QTMovieAskUnresolvedDataRefsAttribute); +} + +NSString QTMovieOpenAsyncOKAttribute () +{ + if (QTMovieOpenAsyncOKAttribute_) + return QTMovieOpenAsyncOKAttribute_; + + return QTMovieOpenAsyncOKAttribute_ = new NSString(bindings.QTMovieOpenAsyncOKAttribute); +} + +NSString QTMovieApertureModeAttribute () +{ + if (QTMovieApertureModeAttribute_) + return QTMovieApertureModeAttribute_; + + return QTMovieApertureModeAttribute_ = new NSString(bindings.QTMovieApertureModeAttribute); +} + +NSString QTMovieAutoAlternatesAttribute () +{ + if (QTMovieAutoAlternatesAttribute_) + return QTMovieAutoAlternatesAttribute_; + + return QTMovieAutoAlternatesAttribute_ = new NSString(bindings.QTMovieAutoAlternatesAttribute); +} + +NSString QTMovieCopyrightAttribute () +{ + if (QTMovieCopyrightAttribute_) + return QTMovieCopyrightAttribute_; + + return QTMovieCopyrightAttribute_ = new NSString(bindings.QTMovieCopyrightAttribute); +} + +NSString QTMovieCreationTimeAttribute () +{ + if (QTMovieCreationTimeAttribute_) + return QTMovieCreationTimeAttribute_; + + return QTMovieCreationTimeAttribute_ = new NSString(bindings.QTMovieCreationTimeAttribute); +} + +NSString QTMovieCurrentSizeAttribute () +{ + if (QTMovieCurrentSizeAttribute_) + return QTMovieCurrentSizeAttribute_; + + return QTMovieCurrentSizeAttribute_ = new NSString(bindings.QTMovieCurrentSizeAttribute); +} + +NSString QTMovieCurrentTimeAttribute () +{ + if (QTMovieCurrentTimeAttribute_) + return QTMovieCurrentTimeAttribute_; + + return QTMovieCurrentTimeAttribute_ = new NSString(bindings.QTMovieCurrentTimeAttribute); +} + +NSString QTMovieDataSizeAttribute () +{ + if (QTMovieDataSizeAttribute_) + return QTMovieDataSizeAttribute_; + + return QTMovieDataSizeAttribute_ = new NSString(bindings.QTMovieDataSizeAttribute); +} + +NSString QTMovieDelegateAttribute () +{ + if (QTMovieDelegateAttribute_) + return QTMovieDelegateAttribute_; + + return QTMovieDelegateAttribute_ = new NSString(bindings.QTMovieDelegateAttribute); +} + +NSString QTMovieDisplayNameAttribute () +{ + if (QTMovieDisplayNameAttribute_) + return QTMovieDisplayNameAttribute_; + + return QTMovieDisplayNameAttribute_ = new NSString(bindings.QTMovieDisplayNameAttribute); +} + +NSString QTMovieDontInteractWithUserAttribute () +{ + if (QTMovieDontInteractWithUserAttribute_) + return QTMovieDontInteractWithUserAttribute_; + + return QTMovieDontInteractWithUserAttribute_ = new NSString(bindings.QTMovieDontInteractWithUserAttribute); +} + +NSString QTMovieDurationAttribute () +{ + if (QTMovieDurationAttribute_) + return QTMovieDurationAttribute_; + + return QTMovieDurationAttribute_ = new NSString(bindings.QTMovieDurationAttribute); +} + +NSString QTMovieEditableAttribute () +{ + if (QTMovieEditableAttribute_) + return QTMovieEditableAttribute_; + + return QTMovieEditableAttribute_ = new NSString(bindings.QTMovieEditableAttribute); +} + +NSString QTMovieFileNameAttribute () +{ + if (QTMovieFileNameAttribute_) + return QTMovieFileNameAttribute_; + + return QTMovieFileNameAttribute_ = new NSString(bindings.QTMovieFileNameAttribute); +} + +NSString QTMovieHasApertureModeDimensionsAttribute () +{ + if (QTMovieHasApertureModeDimensionsAttribute_) + return QTMovieHasApertureModeDimensionsAttribute_; + + return QTMovieHasApertureModeDimensionsAttribute_ = new NSString(bindings.QTMovieHasApertureModeDimensionsAttribute); +} + +NSString QTMovieHasAudioAttribute () +{ + if (QTMovieHasAudioAttribute_) + return QTMovieHasAudioAttribute_; + + return QTMovieHasAudioAttribute_ = new NSString(bindings.QTMovieHasAudioAttribute); +} + +NSString QTMovieHasDurationAttribute () +{ + if (QTMovieHasDurationAttribute_) + return QTMovieHasDurationAttribute_; + + return QTMovieHasDurationAttribute_ = new NSString(bindings.QTMovieHasDurationAttribute); +} + +NSString QTMovieHasVideoAttribute () +{ + if (QTMovieHasVideoAttribute_) + return QTMovieHasVideoAttribute_; + + return QTMovieHasVideoAttribute_ = new NSString(bindings.QTMovieHasVideoAttribute); +} + +NSString QTMovieIsActiveAttribute () +{ + if (QTMovieIsActiveAttribute_) + return QTMovieIsActiveAttribute_; + + return QTMovieIsActiveAttribute_ = new NSString(bindings.QTMovieIsActiveAttribute); +} + +NSString QTMovieIsInteractiveAttribute () +{ + if (QTMovieIsInteractiveAttribute_) + return QTMovieIsInteractiveAttribute_; + + return QTMovieIsInteractiveAttribute_ = new NSString(bindings.QTMovieIsInteractiveAttribute); +} + +NSString QTMovieIsLinearAttribute () +{ + if (QTMovieIsLinearAttribute_) + return QTMovieIsLinearAttribute_; + + return QTMovieIsLinearAttribute_ = new NSString(bindings.QTMovieIsLinearAttribute); +} + +NSString QTMovieIsSteppableAttribute () +{ + if (QTMovieIsSteppableAttribute_) + return QTMovieIsSteppableAttribute_; + + return QTMovieIsSteppableAttribute_ = new NSString(bindings.QTMovieIsSteppableAttribute); +} + +NSString QTMovieLoadStateAttribute () +{ + if (QTMovieLoadStateAttribute_) + return QTMovieLoadStateAttribute_; + + return QTMovieLoadStateAttribute_ = new NSString(bindings.QTMovieLoadStateAttribute); +} + +NSString QTMovieLoopsAttribute () +{ + if (QTMovieLoopsAttribute_) + return QTMovieLoopsAttribute_; + + return QTMovieLoopsAttribute_ = new NSString(bindings.QTMovieLoopsAttribute); +} + +NSString QTMovieLoopsBackAndForthAttribute () +{ + if (QTMovieLoopsBackAndForthAttribute_) + return QTMovieLoopsBackAndForthAttribute_; + + return QTMovieLoopsBackAndForthAttribute_ = new NSString(bindings.QTMovieLoopsBackAndForthAttribute); +} + +NSString QTMovieModificationTimeAttribute () +{ + if (QTMovieModificationTimeAttribute_) + return QTMovieModificationTimeAttribute_; + + return QTMovieModificationTimeAttribute_ = new NSString(bindings.QTMovieModificationTimeAttribute); +} + +NSString QTMovieMutedAttribute () +{ + if (QTMovieMutedAttribute_) + return QTMovieMutedAttribute_; + + return QTMovieMutedAttribute_ = new NSString(bindings.QTMovieMutedAttribute); +} + +NSString QTMovieNaturalSizeAttribute () +{ + if (QTMovieNaturalSizeAttribute_) + return QTMovieNaturalSizeAttribute_; + + return QTMovieNaturalSizeAttribute_ = new NSString(bindings.QTMovieNaturalSizeAttribute); +} + +NSString QTMoviePlaysAllFramesAttribute () +{ + if (QTMoviePlaysAllFramesAttribute_) + return QTMoviePlaysAllFramesAttribute_; + + return QTMoviePlaysAllFramesAttribute_ = new NSString(bindings.QTMoviePlaysAllFramesAttribute); +} + +NSString QTMoviePlaysSelectionOnlyAttribute () +{ + if (QTMoviePlaysSelectionOnlyAttribute_) + return QTMoviePlaysSelectionOnlyAttribute_; + + return QTMoviePlaysSelectionOnlyAttribute_ = new NSString(bindings.QTMoviePlaysSelectionOnlyAttribute); +} + +NSString QTMoviePosterTimeAttribute () +{ + if (QTMoviePosterTimeAttribute_) + return QTMoviePosterTimeAttribute_; + + return QTMoviePosterTimeAttribute_ = new NSString(bindings.QTMoviePosterTimeAttribute); +} + +NSString QTMoviePreferredMutedAttribute () +{ + if (QTMoviePreferredMutedAttribute_) + return QTMoviePreferredMutedAttribute_; + + return QTMoviePreferredMutedAttribute_ = new NSString(bindings.QTMoviePreferredMutedAttribute); +} + +NSString QTMoviePreferredRateAttribute () +{ + if (QTMoviePreferredRateAttribute_) + return QTMoviePreferredRateAttribute_; + + return QTMoviePreferredRateAttribute_ = new NSString(bindings.QTMoviePreferredRateAttribute); +} + +NSString QTMoviePreferredVolumeAttribute () +{ + if (QTMoviePreferredVolumeAttribute_) + return QTMoviePreferredVolumeAttribute_; + + return QTMoviePreferredVolumeAttribute_ = new NSString(bindings.QTMoviePreferredVolumeAttribute); +} + +NSString QTMoviePreviewModeAttribute () +{ + if (QTMoviePreviewModeAttribute_) + return QTMoviePreviewModeAttribute_; + + return QTMoviePreviewModeAttribute_ = new NSString(bindings.QTMoviePreviewModeAttribute); +} + +NSString QTMoviePreviewRangeAttribute () +{ + if (QTMoviePreviewRangeAttribute_) + return QTMoviePreviewRangeAttribute_; + + return QTMoviePreviewRangeAttribute_ = new NSString(bindings.QTMoviePreviewRangeAttribute); +} + +NSString QTMovieRateAttribute () +{ + if (QTMovieRateAttribute_) + return QTMovieRateAttribute_; + + return QTMovieRateAttribute_ = new NSString(bindings.QTMovieRateAttribute); +} + +NSString QTMovieSelectionAttribute () +{ + if (QTMovieSelectionAttribute_) + return QTMovieSelectionAttribute_; + + return QTMovieSelectionAttribute_ = new NSString(bindings.QTMovieSelectionAttribute); +} + +NSString QTMovieTimeScaleAttribute () +{ + if (QTMovieTimeScaleAttribute_) + return QTMovieTimeScaleAttribute_; + + return QTMovieTimeScaleAttribute_ = new NSString(bindings.QTMovieTimeScaleAttribute); +} + +NSString QTMovieURLAttribute () +{ + if (QTMovieURLAttribute_) + return QTMovieURLAttribute_; + + return QTMovieURLAttribute_ = new NSString(bindings.QTMovieURLAttribute); +} + +NSString QTMovieVolumeAttribute () +{ + if (QTMovieVolumeAttribute_) + return QTMovieVolumeAttribute_; + + return QTMovieVolumeAttribute_ = new NSString(bindings.QTMovieVolumeAttribute); +} + +NSString QTMovieRateChangesPreservePitchAttribute () +{ + if (QTMovieRateChangesPreservePitchAttribute_) + return QTMovieRateChangesPreservePitchAttribute_; + + return QTMovieRateChangesPreservePitchAttribute_ = new NSString(bindings.QTMovieRateChangesPreservePitchAttribute); +} + +NSString QTMovieApertureModeClassic () +{ + if (QTMovieApertureModeClassic_) + return QTMovieApertureModeClassic_; + + return QTMovieApertureModeClassic_ = new NSString(bindings.QTMovieApertureModeClassic); +} + +NSString QTMovieApertureModeClean () +{ + if (QTMovieApertureModeClean_) + return QTMovieApertureModeClean_; + + return QTMovieApertureModeClean_ = new NSString(bindings.QTMovieApertureModeClean); +} + +NSString QTMovieApertureModeProduction () +{ + if (QTMovieApertureModeProduction_) + return QTMovieApertureModeProduction_; + + return QTMovieApertureModeProduction_ = new NSString(bindings.QTMovieApertureModeProduction); +} + +NSString QTMovieApertureModeEncodedPixels () +{ + if (QTMovieApertureModeEncodedPixels_) + return QTMovieApertureModeEncodedPixels_; + + return QTMovieApertureModeEncodedPixels_ = new NSString(bindings.QTMovieApertureModeEncodedPixels); +} + +NSString QTMovieFrameImageSize () +{ + if (QTMovieFrameImageSize_) + return QTMovieFrameImageSize_; + + return QTMovieFrameImageSize_ = new NSString(bindings.QTMovieFrameImageSize); +} + +NSString QTMovieFrameImageType () +{ + if (QTMovieFrameImageType_) + return QTMovieFrameImageType_; + + return QTMovieFrameImageType_ = new NSString(bindings.QTMovieFrameImageType); +} + +NSString QTMovieFrameImageTypeNSImage () +{ + if (QTMovieFrameImageTypeNSImage_) + return QTMovieFrameImageTypeNSImage_; + + return QTMovieFrameImageTypeNSImage_ = new NSString(bindings.QTMovieFrameImageTypeNSImage); +} + +NSString QTMovieFrameImageTypeCGImageRef () +{ + if (QTMovieFrameImageTypeCGImageRef_) + return QTMovieFrameImageTypeCGImageRef_; + + return QTMovieFrameImageTypeCGImageRef_ = new NSString(bindings.QTMovieFrameImageTypeCGImageRef); +} + +NSString QTMovieFrameImageTypeCIImage () +{ + if (QTMovieFrameImageTypeCIImage_) + return QTMovieFrameImageTypeCIImage_; + + return QTMovieFrameImageTypeCIImage_ = new NSString(bindings.QTMovieFrameImageTypeCIImage); +} + +NSString QTMovieFrameImageTypeCVPixelBufferRef () +{ + if (QTMovieFrameImageTypeCVPixelBufferRef_) + return QTMovieFrameImageTypeCVPixelBufferRef_; + + return QTMovieFrameImageTypeCVPixelBufferRef_ = new NSString(bindings.QTMovieFrameImageTypeCVPixelBufferRef); +} + +NSString QTMovieFrameImageTypeCVOpenGLTextureRef () +{ + if (QTMovieFrameImageTypeCVOpenGLTextureRef_) + return QTMovieFrameImageTypeCVOpenGLTextureRef_; + + return QTMovieFrameImageTypeCVOpenGLTextureRef_ = new NSString(bindings.QTMovieFrameImageTypeCVOpenGLTextureRef); +} + +NSString QTMovieFrameImageOpenGLContext () +{ + if (QTMovieFrameImageOpenGLContext_) + return QTMovieFrameImageOpenGLContext_; + + return QTMovieFrameImageOpenGLContext_ = new NSString(bindings.QTMovieFrameImageOpenGLContext); +} + +NSString QTMovieFrameImagePixelFormat () +{ + if (QTMovieFrameImagePixelFormat_) + return QTMovieFrameImagePixelFormat_; + + return QTMovieFrameImagePixelFormat_ = new NSString(bindings.QTMovieFrameImagePixelFormat); +} + +NSString QTMovieFrameImageRepresentationsType () +{ + if (QTMovieFrameImageRepresentationsType_) + return QTMovieFrameImageRepresentationsType_; + + return QTMovieFrameImageRepresentationsType_ = new NSString(bindings.QTMovieFrameImageRepresentationsType); +} + +NSString QTMovieFrameImageDeinterlaceFields () +{ + if (QTMovieFrameImageDeinterlaceFields_) + return QTMovieFrameImageDeinterlaceFields_; + + return QTMovieFrameImageDeinterlaceFields_ = new NSString(bindings.QTMovieFrameImageDeinterlaceFields); +} + +NSString QTMovieFrameImageHighQuality () +{ + if (QTMovieFrameImageHighQuality_) + return QTMovieFrameImageHighQuality_; + + return QTMovieFrameImageHighQuality_ = new NSString(bindings.QTMovieFrameImageHighQuality); +} + +NSString QTMovieFrameImageSingleField () +{ + if (QTMovieFrameImageSingleField_) + return QTMovieFrameImageSingleField_; + + return QTMovieFrameImageSingleField_ = new NSString(bindings.QTMovieFrameImageSingleField); +} + +NSString QTMovieUneditableException () +{ + if (QTMovieUneditableException_) + return QTMovieUneditableException_; + + return QTMovieUneditableException_ = new NSString(bindings.QTMovieUneditableException); +} + +NSString QTMovieChapterName () +{ + if (QTMovieChapterName_) + return QTMovieChapterName_; + + return QTMovieChapterName_ = new NSString(bindings.QTMovieChapterName); +} + +NSString QTMovieChapterStartTime () +{ + if (QTMovieChapterStartTime_) + return QTMovieChapterStartTime_; + + return QTMovieChapterStartTime_ = new NSString(bindings.QTMovieChapterStartTime); +} + +NSString QTMovieChapterTargetTrackAttribute () +{ + if (QTMovieChapterTargetTrackAttribute_) + return QTMovieChapterTargetTrackAttribute_; + + return QTMovieChapterTargetTrackAttribute_ = new NSString(bindings.QTMovieChapterTargetTrackAttribute); +} + +enum +{ + QTIncludeStillImageTypes = 1 << 0, + QTIncludeTranslatableTypes = 1 << 1, + QTIncludeAggressiveTypes = 1 << 2, + QTIncludeDynamicTypes = 1 << 3, + QTIncludeCommonTypes = 0, + QTIncludeAllTypes = 0xffff +} + +enum +{ + QTMovieOperationBeginPhase = 0, + QTMovieOperationUpdatePercentPhase = 1, + QTMovieOperationEndPhase = 2 +} + +enum +{ + QTMovieLoadStateError = -1L, + QTMovieLoadStateLoading = 1000, + QTMovieLoadStateLoaded = 2000, + QTMovieLoadStatePlayable = 10000, + QTMovieLoadStatePlaythroughOK = 20000, + QTMovieLoadStateComplete = 100000L +} + +const TQTMovieDelegate = ` + + bool movie (QTMovie movie, NSURL url) + { + return invokeObjcSelf!(bool, "movie:linkToURL:", QTMovie, NSURL)(movie, url); + } + + bool movieShouldLoadData (Object sender) + { + return invokeObjcSelf!(bool, "movieShouldLoadData:", Object)(sender); + } + + bool movieShouldTask (Object movie) + { + return invokeObjcSelf!(bool, "movieShouldTask:", Object)(movie); + } + + QTMovie externalMovie (NSDictionary dictionary) + { + return invokeObjcSelf!(QTMovie, "externalMovie:", NSDictionary)(dictionary); + } + + bool movie (QTMovie movie, NSString op, int phase, NSNumber percent, NSDictionary attributes) + { + return invokeObjcSelf!(bool, "movie:shouldContinueOperation:withPhase:atPercent:withAttributes:", QTMovie, NSString, int, NSNumber, NSDictionary)(movie, op, phase, percent, attributes); + } + + //mixin ObjcBindMethod!(movie, "movie:linkToURL:"); + //mixin ObjcBindMethod!(movieShouldLoadData, "movieShouldLoadData:"); + //mixin ObjcBindMethod!(movieShouldTask, "movieShouldTask:"); + //mixin ObjcBindMethod!(externalMovie, "externalMovie:"); + //mixin ObjcBindMethod!(movie, "movie:shouldContinueOperation:withPhase:atPercent:withAttributes:"); + +`; + +const TQTMovieThreading = ` + + static void enterQTKitOnThread () + { + return invokeObjcSelfClass!(void, "enterQTKitOnThread"); + } + + static void enterQTKitOnThreadDisablingThreadSafetyProtection () + { + return invokeObjcSelfClass!(void, "enterQTKitOnThreadDisablingThreadSafetyProtection"); + } + + static void exitQTKitOnThread () + { + return invokeObjcSelfClass!(void, "exitQTKitOnThread"); + } + + bool attachToCurrentThread () + { + return invokeObjcSelf!(bool, "attachToCurrentThread"); + } + + bool detachFromCurrentThread () + { + return invokeObjcSelf!(bool, "detachFromCurrentThread"); + } + + void setIdling (bool state) + { + return invokeObjcSelf!(void, "setIdling:", bool)(state); + } + + bool isIdling () + { + return invokeObjcSelf!(bool, "isIdling"); + } + + //mixin ObjcBindClassMethod!(enterQTKitOnThread, "enterQTKitOnThread"); + //mixin ObjcBindClassMethod!(enterQTKitOnThreadDisablingThreadSafetyProtection, "enterQTKitOnThreadDisablingThreadSafetyProtection"); + //mixin ObjcBindClassMethod!(exitQTKitOnThread, "exitQTKitOnThread"); + //mixin ObjcBindMethod!(attachToCurrentThread, "attachToCurrentThread"); + //mixin ObjcBindMethod!(detachFromCurrentThread, "detachFromCurrentThread"); + //mixin ObjcBindMethod!(setIdling, "setIdling:"); + //mixin ObjcBindMethod!(isIdling, "isIdling"); + +`; + +const TQTMovieInspection = ` + + QTTime currentTime () + { + return invokeObjcSelf!(QTTime, "currentTime"); + } + + float rate () + { + return invokeObjcSelf!(float, "rate"); + } + + float volume () + { + return invokeObjcSelf!(float, "volume"); + } + + bool muted () + { + return invokeObjcSelf!(bool, "muted"); + } + + NSDictionary movieAttributes () + { + return invokeObjcSelf!(NSDictionary, "movieAttributes"); + } + + void setMovieAttributes (NSDictionary attributes) + { + return invokeObjcSelf!(void, "setMovieAttributes:", NSDictionary)(attributes); + } + + Object attributeForKey (NSString attributeKey) + { + return invokeObjcSelf!(Object, "attributeForKey:", NSString)(attributeKey); + } + + void setAttribute (Object value, NSString attributeKey) + { + return invokeObjcSelf!(void, "setAttribute:forKey:", Object, NSString)(value, attributeKey); + } + + NSArray tracks () + { + return invokeObjcSelf!(NSArray, "tracks"); + } + + NSArray tracksOfMediaType (NSString type) + { + return invokeObjcSelf!(NSArray, "tracksOfMediaType:", NSString)(type); + } + + //mixin ObjcBindMethod!(currentTime, "currentTime"); + //mixin ObjcBindMethod!(rate, "rate"); + //mixin ObjcBindMethod!(volume, "volume"); + //mixin ObjcBindMethod!(muted, "muted"); + //mixin ObjcBindMethod!(movieAttributes, "movieAttributes"); + //mixin ObjcBindMethod!(setMovieAttributes, "setMovieAttributes:"); + //mixin ObjcBindMethod!(attributeForKey, "attributeForKey:"); + //mixin ObjcBindMethod!(setAttribute, "setAttribute:forKey:"); + //mixin ObjcBindMethod!(tracks, "tracks"); + //mixin ObjcBindMethod!(tracksOfMediaType, "tracksOfMediaType:"); + +`; + +const TQTMovieChapters = ` + + bool hasChapters () + { + return invokeObjcSelf!(bool, "hasChapters"); + } + + NSInteger chapterCount () + { + return invokeObjcSelf!(NSInteger, "chapterCount"); + } + + NSArray chapters () + { + return invokeObjcSelf!(NSArray, "chapters"); + } + + void addChapters (NSArray chapters, NSDictionary attributes, ref NSError errorPtr) + { + id __arg2; + + if (errorPtr) + __arg2 = errorPtr.objcObject; + + invokeObjcSelf!(void, "addChapters:withAttributes:error:", NSArray, NSDictionary, id*)(chapters, attributes, &__arg2); + + if (__arg2) + errorPtr = new NSError(__arg2); + } + + bool removeChapters () + { + return invokeObjcSelf!(bool, "removeChapters"); + } + + QTTime startTimeOfChapter (NSInteger chapterIndex) + { + return invokeObjcSelf!(QTTime, "startTimeOfChapter:", NSInteger)(chapterIndex); + } + + NSInteger chapterIndexForTime (QTTime time) + { + return invokeObjcSelf!(NSInteger, "chapterIndexForTime:", QTTime)(time); + } + + //mixin ObjcBindMethod!(hasChapters, "hasChapters"); + //mixin ObjcBindMethod!(chapterCount, "chapterCount"); + //mixin ObjcBindMethod!(chapters, "chapters"); + ////mixin ObjcBindMethod!(addChapters, "addChapters:withAttributes:error:"); + //mixin ObjcBindMethod!(removeChapters, "removeChapters"); + //mixin ObjcBindMethod!(startTimeOfChapter, "startTimeOfChapter:"); + //mixin ObjcBindMethod!(chapterIndexForTime, "chapterIndexForTime:"); + +`; + +const TQTMovieVisualSupport = ` + + void generateApertureModeDimensions () + { + return invokeObjcSelf!(void, "generateApertureModeDimensions"); + } + + void removeApertureModeDimensions () + { + return invokeObjcSelf!(void, "removeApertureModeDimensions"); + } + + //mixin ObjcBindMethod!(generateApertureModeDimensions, "generateApertureModeDimensions"); + //mixin ObjcBindMethod!(removeApertureModeDimensions, "removeApertureModeDimensions"); + +`; + +const TQTEditing = ` + + void replaceSelectionWithSelectionFromMovie (Object movie) + { + return invokeObjcSelf!(void, "replaceSelectionWithSelectionFromMovie:", Object)(movie); + } + + void appendSelectionFromMovie (Object movie) + { + return invokeObjcSelf!(void, "appendSelectionFromMovie:", Object)(movie); + } + + void insertSegmentOfMovie (QTMovie movie, QTTimeRange range, QTTime time) + { + return invokeObjcSelf!(void, "insertSegmentOfMovie:timeRange:atTime:", QTMovie, QTTimeRange, QTTime)(movie, range, time); + } + + void insertSegmentOfMovie (QTMovie movie, QTTimeRange srcRange, QTTimeRange dstRange) + { + return invokeObjcSelf!(void, "insertSegmentOfMovie:fromRange:scaledToRange:", QTMovie, QTTimeRange, QTTimeRange)(movie, srcRange, dstRange); + } + + void insertEmptySegmentAt (QTTimeRange range) + { + return invokeObjcSelf!(void, "insertEmptySegmentAt:", QTTimeRange)(range); + } + + void deleteSegment (QTTimeRange segment) + { + return invokeObjcSelf!(void, "deleteSegment:", QTTimeRange)(segment); + } + + void scaleSegment (QTTimeRange segment, QTTime newDuration) + { + return invokeObjcSelf!(void, "scaleSegment:newDuration:", QTTimeRange, QTTime)(segment, newDuration); + } + + void addImage (NSImage image, QTTime duration, NSDictionary attributes) + { + return invokeObjcSelf!(void, "addImage:forDuration:withAttributes:", NSImage, QTTime, NSDictionary)(image, duration, attributes); + } + + QTTrack insertSegmentOfTrack (QTTrack track, QTTimeRange range, QTTime time) + { + return invokeObjcSelf!(QTTrack, "insertSegmentOfTrack:timeRange:atTime:", QTTrack, QTTimeRange, QTTime)(track, range, time); + } + + QTTrack insertSegmentOfTrack (QTTrack track, QTTimeRange srcRange, QTTimeRange dstRange) + { + return invokeObjcSelf!(QTTrack, "insertSegmentOfTrack:fromRange:scaledToRange:", QTTrack, QTTimeRange, QTTimeRange)(track, srcRange, dstRange); + } + + void removeTrack (QTTrack track) + { + return invokeObjcSelf!(void, "removeTrack:", QTTrack)(track); + } + + //mixin ObjcBindMethod!(replaceSelectionWithSelectionFromMovie, "replaceSelectionWithSelectionFromMovie:"); + //mixin ObjcBindMethod!(appendSelectionFromMovie, "appendSelectionFromMovie:"); + //mixin ObjcBindMethod!(insertSegmentOfMovie, "insertSegmentOfMovie:timeRange:atTime:"); + //mixin ObjcBindMethod!(insertSegmentOfMovie, "insertSegmentOfMovie:fromRange:scaledToRange:"); + //mixin ObjcBindMethod!(insertEmptySegmentAt, "insertEmptySegmentAt:"); + //mixin ObjcBindMethod!(deleteSegment, "deleteSegment:"); + //mixin ObjcBindMethod!(scaleSegment, "scaleSegment:newDuration:"); + //mixin ObjcBindMethod!(addImage, "addImage:forDuration:withAttributes:"); + //mixin ObjcBindMethod!(insertSegmentOfTrack, "insertSegmentOfTrack:timeRange:atTime:"); + //mixin ObjcBindMethod!(insertSegmentOfTrack, "insertSegmentOfTrack:fromRange:scaledToRange:"); + //mixin ObjcBindMethod!(removeTrack, "removeTrack:"); + +`; + +const TQTMovieInitialization = ` + + static bool canInitWithPasteboard (NSPasteboard pasteboard) + { + return invokeObjcSelfClass!(bool, "canInitWithPasteboard:", NSPasteboard)(pasteboard); + } + + static bool canInitWithFile (NSString fileName) + { + return invokeObjcSelfClass!(bool, "canInitWithFile:", NSString)(fileName); + } + + static bool canInitWithURL (NSURL url) + { + return invokeObjcSelfClass!(bool, "canInitWithURL:", NSURL)(url); + } + + static bool canInitWithDataReference (QTDataReference dataReference) + { + return invokeObjcSelfClass!(bool, "canInitWithDataReference:", QTDataReference)(dataReference); + } + + static NSArray movieFileTypes (int types) + { + return invokeObjcSelfClass!(NSArray, "movieFileTypes:", int)(types); + } + + static NSArray movieUnfilteredFileTypes () + { + return invokeObjcSelfClass!(NSArray, "movieUnfilteredFileTypes"); + } + + static NSArray movieUnfilteredPasteboardTypes () + { + return invokeObjcSelfClass!(NSArray, "movieUnfilteredPasteboardTypes"); + } + + static NSArray movieTypesWithOptions (int types) + { + return invokeObjcSelfClass!(NSArray, "movieTypesWithOptions:", int)(types); + } + + static Object movie () + { + return invokeObjcSelfClass!(Object, "movie"); + } + + static Object movieWithFile (NSString fileName, ref NSError errorPtr) + { + id __arg1; + + if (errorPtr) + __arg1 = errorPtr.objcObject; + + Object result = invokeObjcSelfClass!(Object, "movieWithFile:error:", NSString, id*)(fileName, &__arg1); + + if (__arg1) + errorPtr = new NSError(__arg1); + + return result; + } + + static Object movieWithURL (NSURL url, ref NSError errorPtr) + { + id __arg1; + + if (errorPtr) + __arg1 = errorPtr.objcObject; + + Object result = invokeObjcSelfClass!(Object, "movieWithURL:error:", NSURL, id*)(url, &__arg1); + + if (__arg1) + errorPtr = new NSError(__arg1); + + return result; + } + + static Object movieWithDataReference (QTDataReference dataReference, ref NSError errorPtr) + { + id __arg1; + + if (errorPtr) + __arg1 = errorPtr.objcObject; + + Object result = invokeObjcSelfClass!(Object, "movieWithDataReference:error:", QTDataReference, id*)(dataReference, &__arg1); + + if (__arg1) + errorPtr = new NSError(__arg1); + + return result; + } + + static Object movieWithPasteboard (NSPasteboard pasteboard, ref NSError errorPtr) + { + id __arg1; + + if (errorPtr) + __arg1 = errorPtr.objcObject; + + Object result = invokeObjcSelfClass!(Object, "movieWithPasteboard:error:", NSPasteboard, id*)(pasteboard, &__arg1); + + if (__arg1) + errorPtr = new NSError(__arg1); + + return result; + } + + static Object movieWithData (NSData data, ref NSError errorPtr) + { + id __arg1; + + if (errorPtr) + __arg1 = errorPtr.objcObject; + + Object result = invokeObjcSelfClass!(Object, "movieWithData:error:", NSData, id*)(data, &__arg1); + + if (__arg1) + errorPtr = new NSError(__arg1); + + return result; + } + + static Object movieWithAttributes (NSDictionary attributes, ref NSError errorPtr) + { + id __arg1; + + if (errorPtr) + __arg1 = errorPtr.objcObject; + + Object result = invokeObjcSelfClass!(Object, "movieWithAttributes:error:", NSDictionary, id*)(attributes, &__arg1); + + if (__arg1) + errorPtr = new NSError(__arg1); + + return result; + } + + static Object movieNamed (NSString name, ref NSError errorPtr) + { + id __arg1; + + if (errorPtr) + __arg1 = errorPtr.objcObject; + + Object result = invokeObjcSelfClass!(Object, "movieNamed:error:", NSString, id*)(name, &__arg1); + + if (__arg1) + errorPtr = new NSError(__arg1); + + return result; + } + + typeof(this) initWithFile (NSString fileName, ref NSError errorPtr) + { + id __arg1; + + if (errorPtr) + __arg1 = errorPtr.objcObject; + + id result = invokeObjcSelf!(id, "initWithFile:error:", NSString, id*)(fileName, &__arg1); + + if (__arg1) + errorPtr = new NSError(__arg1); + + return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); + } + + this (NSString fileName, ref NSError errorPtr) + { + super(typeof(this).alloc.initWithFile(fileName, errorPtr).objcObject); + } + + typeof(this) initWithURL (NSURL url, ref NSError errorPtr) + { + id __arg1; + + if (errorPtr) + __arg1 = errorPtr.objcObject; + + id result = invokeObjcSelf!(id, "initWithURL:error:", NSURL, id*)(url, &__arg1); + + if (__arg1) + errorPtr = new NSError(__arg1); + + return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); + } + + this (NSURL url, ref NSError errorPtr) + { + super(typeof(this).alloc.initWithURL(url, errorPtr).objcObject); + } + + typeof(this) initWithDataReference (QTDataReference dataReference, ref NSError errorPtr) + { + id __arg1; + + if (errorPtr) + __arg1 = errorPtr.objcObject; + + id result = invokeObjcSelf!(id, "initWithDataReference:error:", QTDataReference, id*)(dataReference, &__arg1); + + if (__arg1) + errorPtr = new NSError(__arg1); + + return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); + } + + this (QTDataReference dataReference, ref NSError errorPtr) + { + super(typeof(this).alloc.initWithDataReference(dataReference, errorPtr).objcObject); + } + + typeof(this) initWithPasteboard (NSPasteboard pasteboard, ref NSError errorPtr) + { + id __arg1; + + if (errorPtr) + __arg1 = errorPtr.objcObject; + + id result = invokeObjcSelf!(id, "initWithPasteboard:error:", NSPasteboard, id*)(pasteboard, &__arg1); + + if (__arg1) + errorPtr = new NSError(__arg1); + + return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); + } + + this (NSPasteboard pasteboard, ref NSError errorPtr) + { + super(typeof(this).alloc.initWithPasteboard(pasteboard, errorPtr).objcObject); + } + + typeof(this) initWithData (NSData data, ref NSError errorPtr) + { + id __arg1; + + if (errorPtr) + __arg1 = errorPtr.objcObject; + + id result = invokeObjcSelf!(id, "initWithData:error:", NSData, id*)(data, &__arg1); + + if (__arg1) + errorPtr = new NSError(__arg1); + + return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); + } + + this (NSData data, ref NSError errorPtr) + { + super(typeof(this).alloc.initWithData(data, errorPtr).objcObject); + } + + typeof(this) initWithMovie (QTMovie movie, QTTimeRange range, ref NSError errorPtr) + { + id __arg2; + + if (errorPtr) + __arg2 = errorPtr.objcObject; + + id result = invokeObjcSelf!(id, "initWithMovie:timeRange:error:", QTMovie, QTTimeRange, id*)(movie, range, &__arg2); + + if (__arg2) + errorPtr = new NSError(__arg2); + + return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); + } + + this (QTMovie movie, QTTimeRange range, ref NSError errorPtr) + { + super(typeof(this).alloc.initWithMovie(movie, range, errorPtr).objcObject); + } + + typeof(this) initWithAttributes (NSDictionary attributes, ref NSError errorPtr) + { + id __arg1; + + if (errorPtr) + __arg1 = errorPtr.objcObject; + + id result = invokeObjcSelf!(id, "initWithAttributes:error:", NSDictionary, id*)(attributes, &__arg1); + + if (__arg1) + errorPtr = new NSError(__arg1); + + return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); + } + + this (NSDictionary attributes, ref NSError errorPtr) + { + super(typeof(this).alloc.initWithAttributes(attributes, errorPtr).objcObject); + } + + Object movieWithTimeRange (QTTimeRange range, ref NSError errorPtr) + { + id __arg1; + + if (errorPtr) + __arg1 = errorPtr.objcObject; + + Object result = invokeObjcSelf!(Object, "movieWithTimeRange:error:", QTTimeRange, id*)(range, &__arg1); + + if (__arg1) + errorPtr = new NSError(__arg1); + + return result; + } + + typeof(this) initToWritableFile (NSString filename, ref NSError errorPtr) + { + id __arg1; + + if (errorPtr) + __arg1 = errorPtr.objcObject; + + id result = invokeObjcSelf!(id, "initToWritableFile:error:", NSString, id*)(filename, &__arg1); + + if (__arg1) + errorPtr = new NSError(__arg1); + + return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); + } + + this (NSString filename, ref NSError errorPtr) + { + super(typeof(this).alloc.initToWritableFile(filename, errorPtr).objcObject); + } + + typeof(this) initToWritableData (NSMutableData data, ref NSError errorPtr) + { + id __arg1; + + if (errorPtr) + __arg1 = errorPtr.objcObject; + + id result = invokeObjcSelf!(id, "initToWritableData:error:", NSMutableData, id*)(data, &__arg1); + + if (__arg1) + errorPtr = new NSError(__arg1); + + return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); + } + + this (NSMutableData data, ref NSError errorPtr) + { + super(typeof(this).alloc.initToWritableData(data, errorPtr).objcObject); + } + + typeof(this) initToWritableDataReference (QTDataReference dataReference, ref NSError errorPtr) + { + id __arg1; + + if (errorPtr) + __arg1 = errorPtr.objcObject; + + id result = invokeObjcSelf!(id, "initToWritableDataReference:error:", QTDataReference, id*)(dataReference, &__arg1); + + if (__arg1) + errorPtr = new NSError(__arg1); + + return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); + } + + this (QTDataReference dataReference, ref NSError errorPtr) + { + super(typeof(this).alloc.initToWritableDataReference(dataReference, errorPtr).objcObject); + } + + void invalidate () + { + return invokeObjcSelf!(void, "invalidate"); + } + + //mixin ObjcBindClassMethod!(canInitWithPasteboard, "canInitWithPasteboard:"); + //mixin ObjcBindClassMethod!(canInitWithFile, "canInitWithFile:"); + //mixin ObjcBindClassMethod!(canInitWithURL, "canInitWithURL:"); + //mixin ObjcBindClassMethod!(canInitWithDataReference, "canInitWithDataReference:"); + //mixin ObjcBindClassMethod!(movieFileTypes, "movieFileTypes:"); + //mixin ObjcBindClassMethod!(movieUnfilteredFileTypes, "movieUnfilteredFileTypes"); + //mixin ObjcBindClassMethod!(movieUnfilteredPasteboardTypes, "movieUnfilteredPasteboardTypes"); + //mixin ObjcBindClassMethod!(movieTypesWithOptions, "movieTypesWithOptions:"); + //mixin ObjcBindClassMethod!(movie, "movie"); + /*//mixin ObjcBindClassMethod!(movieWithFile, "movieWithFile:error:"); + //mixin ObjcBindClassMethod!(movieWithURL, "movieWithURL:error:"); + //mixin ObjcBindClassMethod!(movieWithDataReference, "movieWithDataReference:error:"); + //mixin ObjcBindClassMethod!(movieWithPasteboard, "movieWithPasteboard:error:"); + //mixin ObjcBindClassMethod!(movieWithData, "movieWithData:error:"); + //mixin ObjcBindClassMethod!(movieWithAttributes, "movieWithAttributes:error:"); + //mixin ObjcBindClassMethod!(movieNamed, "movieNamed:error:"); + //mixin ObjcBindMethod!(initWithFile, "initWithFile:error:"); + //mixin ObjcBindMethod!(initWithURL, "initWithURL:error:"); + //mixin ObjcBindMethod!(initWithDataReference, "initWithDataReference:error:"); + //mixin ObjcBindMethod!(initWithPasteboard, "initWithPasteboard:error:"); + //mixin ObjcBindMethod!(initWithData, "initWithData:error:"); + //mixin ObjcBindMethod!(initWithMovie, "initWithMovie:timeRange:error:"); + //mixin ObjcBindMethod!(initWithAttributes, "initWithAttributes:error:"); + //mixin ObjcBindMethod!(movieWithTimeRange, "movieWithTimeRange:error:"); + //mixin ObjcBindMethod!(initToWritableFile, "initToWritableFile:error:"); + //mixin ObjcBindMethod!(initToWritableData, "initToWritableData:error:"); + //mixin ObjcBindMethod!(initToWritableDataReference, "initToWritableDataReference:error:");*/ + //mixin ObjcBindMethod!(invalidate, "invalidate"); + +`; + +const TQTMovieImage = ` + + NSImage posterImage () + { + return invokeObjcSelf!(NSImage, "posterImage"); + } + + NSImage currentFrameImage () + { + return invokeObjcSelf!(NSImage, "currentFrameImage"); + } + + NSImage frameImageAtTime (QTTime time) + { + return invokeObjcSelf!(NSImage, "frameImageAtTime:", QTTime)(time); + } + + void* frameImageAtTime (QTTime time, NSDictionary attributes, ref NSError errorPtr) + { + id __arg2; + + if (errorPtr) + __arg2 = errorPtr.objcObject; + + void* result = invokeObjcSelf!(void*, "frameImageAtTime:withAttributes:error:", QTTime, NSDictionary, id*)(time, attributes, &__arg2); + + if (__arg2) + errorPtr = new NSError(__arg2); + + return result; + } + + //mixin ObjcBindMethod!(posterImage, "posterImage"); + //mixin ObjcBindMethod!(currentFrameImage, "currentFrameImage"); + //mixin ObjcBindMethod!(frameImageAtTime, "frameImageAtTime:"); + //mixin ObjcBindMethod!(frameImageAtTime, "frameImageAtTime:withAttributes:error:"); + +`; + +const TQTDelegate = ` + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + void setDelegate (Object delegate_) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(delegate_); + } + + //mixin ObjcBindMethod!(delegate_, "delegate"); + //mixin ObjcBindMethod!(setDelegate, "setDelegate:"); + +`; + +const TQTMovieTime = ` + + void autoplay () + { + return invokeObjcSelf!(void, "autoplay"); + } + + void play () + { + return invokeObjcSelf!(void, "play"); + } + + void stop () + { + return invokeObjcSelf!(void, "stop"); + } + + void setCurrentTime (QTTime time) + { + return invokeObjcSelf!(void, "setCurrentTime:", QTTime)(time); + } + + void gotoBeginning () + { + return invokeObjcSelf!(void, "gotoBeginning"); + } + + void gotoEnd () + { + return invokeObjcSelf!(void, "gotoEnd"); + } + + void gotoNextSelectionPoint () + { + return invokeObjcSelf!(void, "gotoNextSelectionPoint"); + } + + void gotoPreviousSelectionPoint () + { + return invokeObjcSelf!(void, "gotoPreviousSelectionPoint"); + } + + void gotoPosterTime () + { + return invokeObjcSelf!(void, "gotoPosterTime"); + } + + void stepForward () + { + return invokeObjcSelf!(void, "stepForward"); + } + + void stepBackward () + { + return invokeObjcSelf!(void, "stepBackward"); + } + + //mixin ObjcBindMethod!(autoplay, "autoplay"); + //mixin ObjcBindMethod!(play, "play"); + //mixin ObjcBindMethod!(stop, "stop"); + //mixin ObjcBindMethod!(setCurrentTime, "setCurrentTime:"); + //mixin ObjcBindMethod!(gotoBeginning, "gotoBeginning"); + //mixin ObjcBindMethod!(gotoEnd, "gotoEnd"); + //mixin ObjcBindMethod!(gotoNextSelectionPoint, "gotoNextSelectionPoint"); + //mixin ObjcBindMethod!(gotoPreviousSelectionPoint, "gotoPreviousSelectionPoint"); + //mixin ObjcBindMethod!(gotoPosterTime, "gotoPosterTime"); + //mixin ObjcBindMethod!(stepForward, "stepForward"); + //mixin ObjcBindMethod!(stepBackward, "stepBackward"); + +`; + +const TQTMovieFormat = ` + + NSData movieFormatRepresentation () + { + return invokeObjcSelf!(NSData, "movieFormatRepresentation"); + } + + bool writeToFile (NSString fileName, NSDictionary attributes) + { + return invokeObjcSelf!(bool, "writeToFile:withAttributes:", NSString, NSDictionary)(fileName, attributes); + } + + bool writeToFile (NSString fileName, NSDictionary attributes, ref NSError errorPtr) + { + id __arg2; + + if (errorPtr) + __arg2 = errorPtr.objcObject; + + bool result = invokeObjcSelf!(bool, "writeToFile:withAttributes:error:", NSString, NSDictionary, id*)(fileName, attributes, &__arg2); + + if (__arg2) + errorPtr = new NSError(__arg2); + + return result; + } + + bool canUpdateMovieFile () + { + return invokeObjcSelf!(bool, "canUpdateMovieFile"); + } + + bool updateMovieFile () + { + return invokeObjcSelf!(bool, "updateMovieFile"); + } + + //mixin ObjcBindMethod!(movieFormatRepresentation, "movieFormatRepresentation"); + //mixin ObjcBindMethod!(writeToFile, "writeToFile:withAttributes:"); + //mixin ObjcBindMethod!(writeToFile, "writeToFile:withAttributes:error:"); + //mixin ObjcBindMethod!(canUpdateMovieFile, "canUpdateMovieFile"); + //mixin ObjcBindMethod!(updateMovieFile, "updateMovieFile"); + +`; + +const TQTSelection = ` + + void setSelection (QTTimeRange selection) + { + return invokeObjcSelf!(void, "setSelection:", QTTimeRange)(selection); + } + + QTTime selectionStart () + { + return invokeObjcSelf!(QTTime, "selectionStart"); + } + + QTTime selectionEnd () + { + return invokeObjcSelf!(QTTime, "selectionEnd"); + } + + QTTime selectionDuration () + { + return invokeObjcSelf!(QTTime, "selectionDuration"); + } + + //mixin ObjcBindMethod!(setSelection, "setSelection:"); + //mixin ObjcBindMethod!(selectionStart, "selectionStart"); + //mixin ObjcBindMethod!(selectionEnd, "selectionEnd"); + //mixin ObjcBindMethod!(selectionDuration, "selectionDuration"); + +`; + +const TQTMoviePlaybackControl = ` + + void setRate (float rate) + { + return invokeObjcSelf!(void, "setRate:", float)(rate); + } + + void setVolume (float volume) + { + return invokeObjcSelf!(void, "setVolume:", float)(volume); + } + + void setMuted (bool mute) + { + return invokeObjcSelf!(void, "setMuted:", bool)(mute); + } + + //mixin ObjcBindMethod!(setRate, "setRate:"); + //mixin ObjcBindMethod!(setVolume, "setVolume:"); + //mixin ObjcBindMethod!(setMuted, "setMuted:"); + +`; + +class QTMovie : NSObject, INSCoding, INSCopying +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + typeof(this) copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); + } + + QTTime duration () + { + return invokeObjcSelf!(QTTime, "duration"); + } + + // QTMovieThreading + static void enterQTKitOnThread () + { + return invokeObjcSelfClass!(void, "enterQTKitOnThread"); + } + + static void enterQTKitOnThreadDisablingThreadSafetyProtection () + { + return invokeObjcSelfClass!(void, "enterQTKitOnThreadDisablingThreadSafetyProtection"); + } + + static void exitQTKitOnThread () + { + return invokeObjcSelfClass!(void, "exitQTKitOnThread"); + } + + bool attachToCurrentThread () + { + return invokeObjcSelf!(bool, "attachToCurrentThread"); + } + + bool detachFromCurrentThread () + { + return invokeObjcSelf!(bool, "detachFromCurrentThread"); + } + + void setIdling (bool state) + { + return invokeObjcSelf!(void, "setIdling:", bool)(state); + } + + bool isIdling () + { + return invokeObjcSelf!(bool, "isIdling"); + } + + // QTMovieInspection + QTTime currentTime () + { + return invokeObjcSelf!(QTTime, "currentTime"); + } + + float rate () + { + return invokeObjcSelf!(float, "rate"); + } + + float volume () + { + return invokeObjcSelf!(float, "volume"); + } + + bool muted () + { + return invokeObjcSelf!(bool, "muted"); + } + + NSDictionary movieAttributes () + { + return invokeObjcSelf!(NSDictionary, "movieAttributes"); + } + + void setMovieAttributes (NSDictionary attributes) + { + return invokeObjcSelf!(void, "setMovieAttributes:", NSDictionary)(attributes); + } + + Object attributeForKey (NSString attributeKey) + { + return invokeObjcSelf!(Object, "attributeForKey:", NSString)(attributeKey); + } + + void setAttribute (Object value, NSString attributeKey) + { + return invokeObjcSelf!(void, "setAttribute:forKey:", Object, NSString)(value, attributeKey); + } + + NSArray tracks () + { + return invokeObjcSelf!(NSArray, "tracks"); + } + + NSArray tracksOfMediaType (NSString type) + { + return invokeObjcSelf!(NSArray, "tracksOfMediaType:", NSString)(type); + } + + // QTMovieChapters + bool hasChapters () + { + return invokeObjcSelf!(bool, "hasChapters"); + } + + NSInteger chapterCount () + { + return invokeObjcSelf!(NSInteger, "chapterCount"); + } + + NSArray chapters () + { + return invokeObjcSelf!(NSArray, "chapters"); + } + + void addChapters (NSArray chapters, NSDictionary attributes, ref NSError errorPtr) + { + id __arg2; + + if (errorPtr) + __arg2 = errorPtr.objcObject; + + invokeObjcSelf!(void, "addChapters:withAttributes:error:", NSArray, NSDictionary, id*)(chapters, attributes, &__arg2); + + if (__arg2) + errorPtr = new NSError(__arg2); + } + + bool removeChapters () + { + return invokeObjcSelf!(bool, "removeChapters"); + } + + QTTime startTimeOfChapter (NSInteger chapterIndex) + { + return invokeObjcSelf!(QTTime, "startTimeOfChapter:", NSInteger)(chapterIndex); + } + + NSInteger chapterIndexForTime (QTTime time) + { + return invokeObjcSelf!(NSInteger, "chapterIndexForTime:", QTTime)(time); + } + + // QTMovieVisualSupport + void generateApertureModeDimensions () + { + return invokeObjcSelf!(void, "generateApertureModeDimensions"); + } + + void removeApertureModeDimensions () + { + return invokeObjcSelf!(void, "removeApertureModeDimensions"); + } + + // QTEditing + void replaceSelectionWithSelectionFromMovie (Object movie) + { + return invokeObjcSelf!(void, "replaceSelectionWithSelectionFromMovie:", Object)(movie); + } + + void appendSelectionFromMovie (Object movie) + { + return invokeObjcSelf!(void, "appendSelectionFromMovie:", Object)(movie); + } + + void insertSegmentOfMovie (QTMovie movie, QTTimeRange range, QTTime time) + { + return invokeObjcSelf!(void, "insertSegmentOfMovie:timeRange:atTime:", QTMovie, QTTimeRange, QTTime)(movie, range, time); + } + + void insertSegmentOfMovie (QTMovie movie, QTTimeRange srcRange, QTTimeRange dstRange) + { + return invokeObjcSelf!(void, "insertSegmentOfMovie:fromRange:scaledToRange:", QTMovie, QTTimeRange, QTTimeRange)(movie, srcRange, dstRange); + } + + void insertEmptySegmentAt (QTTimeRange range) + { + return invokeObjcSelf!(void, "insertEmptySegmentAt:", QTTimeRange)(range); + } + + void deleteSegment (QTTimeRange segment) + { + return invokeObjcSelf!(void, "deleteSegment:", QTTimeRange)(segment); + } + + void scaleSegment (QTTimeRange segment, QTTime newDuration) + { + return invokeObjcSelf!(void, "scaleSegment:newDuration:", QTTimeRange, QTTime)(segment, newDuration); + } + + void addImage (NSImage image, QTTime duration, NSDictionary attributes) + { + return invokeObjcSelf!(void, "addImage:forDuration:withAttributes:", NSImage, QTTime, NSDictionary)(image, duration, attributes); + } + + QTTrack insertSegmentOfTrack (QTTrack track, QTTimeRange range, QTTime time) + { + return invokeObjcSelf!(QTTrack, "insertSegmentOfTrack:timeRange:atTime:", QTTrack, QTTimeRange, QTTime)(track, range, time); + } + + QTTrack insertSegmentOfTrack (QTTrack track, QTTimeRange srcRange, QTTimeRange dstRange) + { + return invokeObjcSelf!(QTTrack, "insertSegmentOfTrack:fromRange:scaledToRange:", QTTrack, QTTimeRange, QTTimeRange)(track, srcRange, dstRange); + } + + void removeTrack (QTTrack track) + { + return invokeObjcSelf!(void, "removeTrack:", QTTrack)(track); + } + + // QTMovieInitialization + static bool canInitWithPasteboard (NSPasteboard pasteboard) + { + return invokeObjcSelfClass!(bool, "canInitWithPasteboard:", NSPasteboard)(pasteboard); + } + + static bool canInitWithFile (NSString fileName) + { + return invokeObjcSelfClass!(bool, "canInitWithFile:", NSString)(fileName); + } + + static bool canInitWithURL (NSURL url) + { + return invokeObjcSelfClass!(bool, "canInitWithURL:", NSURL)(url); + } + + static bool canInitWithDataReference (QTDataReference dataReference) + { + return invokeObjcSelfClass!(bool, "canInitWithDataReference:", QTDataReference)(dataReference); + } + + static NSArray movieFileTypes (int types) + { + return invokeObjcSelfClass!(NSArray, "movieFileTypes:", int)(types); + } + + static NSArray movieUnfilteredFileTypes () + { + return invokeObjcSelfClass!(NSArray, "movieUnfilteredFileTypes"); + } + + static NSArray movieUnfilteredPasteboardTypes () + { + return invokeObjcSelfClass!(NSArray, "movieUnfilteredPasteboardTypes"); + } + + static NSArray movieTypesWithOptions (int types) + { + return invokeObjcSelfClass!(NSArray, "movieTypesWithOptions:", int)(types); + } + + static Object movie () + { + return invokeObjcSelfClass!(Object, "movie"); + } + + static Object movieWithFile (NSString fileName, ref NSError errorPtr) + { + id __arg1; + + if (errorPtr) + __arg1 = errorPtr.objcObject; + + Object result = invokeObjcSelfClass!(Object, "movieWithFile:error:", NSString, id*)(fileName, &__arg1); + + if (__arg1) + errorPtr = new NSError(__arg1); + + return result; + } + + static Object movieWithURL (NSURL url, ref NSError errorPtr) + { + id __arg1; + + if (errorPtr) + __arg1 = errorPtr.objcObject; + + Object result = invokeObjcSelfClass!(Object, "movieWithURL:error:", NSURL, id*)(url, &__arg1); + + if (__arg1) + errorPtr = new NSError(__arg1); + + return result; + } + + static Object movieWithDataReference (QTDataReference dataReference, ref NSError errorPtr) + { + id __arg1; + + if (errorPtr) + __arg1 = errorPtr.objcObject; + + Object result = invokeObjcSelfClass!(Object, "movieWithDataReference:error:", QTDataReference, id*)(dataReference, &__arg1); + + if (__arg1) + errorPtr = new NSError(__arg1); + + return result; + } + + static Object movieWithPasteboard (NSPasteboard pasteboard, ref NSError errorPtr) + { + id __arg1; + + if (errorPtr) + __arg1 = errorPtr.objcObject; + + Object result = invokeObjcSelfClass!(Object, "movieWithPasteboard:error:", NSPasteboard, id*)(pasteboard, &__arg1); + + if (__arg1) + errorPtr = new NSError(__arg1); + + return result; + } + + static Object movieWithData (NSData data, ref NSError errorPtr) + { + id __arg1; + + if (errorPtr) + __arg1 = errorPtr.objcObject; + + Object result = invokeObjcSelfClass!(Object, "movieWithData:error:", NSData, id*)(data, &__arg1); + + if (__arg1) + errorPtr = new NSError(__arg1); + + return result; + } + + static Object movieWithAttributes (NSDictionary attributes, ref NSError errorPtr) + { + id __arg1; + + if (errorPtr) + __arg1 = errorPtr.objcObject; + + Object result = invokeObjcSelfClass!(Object, "movieWithAttributes:error:", NSDictionary, id*)(attributes, &__arg1); + + if (__arg1) + errorPtr = new NSError(__arg1); + + return result; + } + + static Object movieNamed (NSString name, ref NSError errorPtr) + { + id __arg1; + + if (errorPtr) + __arg1 = errorPtr.objcObject; + + Object result = invokeObjcSelfClass!(Object, "movieNamed:error:", NSString, id*)(name, &__arg1); + + if (__arg1) + errorPtr = new NSError(__arg1); + + return result; + } + + typeof(this) initWithFile (NSString fileName, ref NSError errorPtr) + { + id __arg1; + + if (errorPtr) + __arg1 = errorPtr.objcObject; + + id result = invokeObjcSelf!(id, "initWithFile:error:", NSString, id*)(fileName, &__arg1); + + if (__arg1) + errorPtr = new NSError(__arg1); + + return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); + } + + this (NSString fileName, ref NSError errorPtr) + { + super(typeof(this).alloc.initWithFile(fileName, errorPtr).objcObject); + } + + typeof(this) initWithURL (NSURL url, ref NSError errorPtr) + { + id __arg1; + + if (errorPtr) + __arg1 = errorPtr.objcObject; + + id result = invokeObjcSelf!(id, "initWithURL:error:", NSURL, id*)(url, &__arg1); + + if (__arg1) + errorPtr = new NSError(__arg1); + + return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); + } + + this (NSURL url, ref NSError errorPtr) + { + super(typeof(this).alloc.initWithURL(url, errorPtr).objcObject); + } + + typeof(this) initWithDataReference (QTDataReference dataReference, ref NSError errorPtr) + { + id __arg1; + + if (errorPtr) + __arg1 = errorPtr.objcObject; + + id result = invokeObjcSelf!(id, "initWithDataReference:error:", QTDataReference, id*)(dataReference, &__arg1); + + if (__arg1) + errorPtr = new NSError(__arg1); + + return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); + } + + this (QTDataReference dataReference, ref NSError errorPtr) + { + super(typeof(this).alloc.initWithDataReference(dataReference, errorPtr).objcObject); + } + + typeof(this) initWithPasteboard (NSPasteboard pasteboard, ref NSError errorPtr) + { + id __arg1; + + if (errorPtr) + __arg1 = errorPtr.objcObject; + + id result = invokeObjcSelf!(id, "initWithPasteboard:error:", NSPasteboard, id*)(pasteboard, &__arg1); + + if (__arg1) + errorPtr = new NSError(__arg1); + + return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); + } + + this (NSPasteboard pasteboard, ref NSError errorPtr) + { + super(typeof(this).alloc.initWithPasteboard(pasteboard, errorPtr).objcObject); + } + + typeof(this) initWithData (NSData data, ref NSError errorPtr) + { + id __arg1; + + if (errorPtr) + __arg1 = errorPtr.objcObject; + + id result = invokeObjcSelf!(id, "initWithData:error:", NSData, id*)(data, &__arg1); + + if (__arg1) + errorPtr = new NSError(__arg1); + + return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); + } + + this (NSData data, ref NSError errorPtr) + { + super(typeof(this).alloc.initWithData(data, errorPtr).objcObject); + } + + typeof(this) initWithMovie (QTMovie movie, QTTimeRange range, ref NSError errorPtr) + { + id __arg2; + + if (errorPtr) + __arg2 = errorPtr.objcObject; + + id result = invokeObjcSelf!(id, "initWithMovie:timeRange:error:", QTMovie, QTTimeRange, id*)(movie, range, &__arg2); + + if (__arg2) + errorPtr = new NSError(__arg2); + + return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); + } + + this (QTMovie movie, QTTimeRange range, ref NSError errorPtr) + { + super(typeof(this).alloc.initWithMovie(movie, range, errorPtr).objcObject); + } + + typeof(this) initWithAttributes (NSDictionary attributes, ref NSError errorPtr) + { + id __arg1; + + if (errorPtr) + __arg1 = errorPtr.objcObject; + + id result = invokeObjcSelf!(id, "initWithAttributes:error:", NSDictionary, id*)(attributes, &__arg1); + + if (__arg1) + errorPtr = new NSError(__arg1); + + return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); + } + + this (NSDictionary attributes, ref NSError errorPtr) + { + super(typeof(this).alloc.initWithAttributes(attributes, errorPtr).objcObject); + } + + Object movieWithTimeRange (QTTimeRange range, ref NSError errorPtr) + { + id __arg1; + + if (errorPtr) + __arg1 = errorPtr.objcObject; + + Object result = invokeObjcSelf!(Object, "movieWithTimeRange:error:", QTTimeRange, id*)(range, &__arg1); + + if (__arg1) + errorPtr = new NSError(__arg1); + + return result; + } + + typeof(this) initToWritableFile (NSString filename, ref NSError errorPtr) + { + id __arg1; + + if (errorPtr) + __arg1 = errorPtr.objcObject; + + id result = invokeObjcSelf!(id, "initToWritableFile:error:", NSString, id*)(filename, &__arg1); + + if (__arg1) + errorPtr = new NSError(__arg1); + + return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); + } + + this (NSString filename, ref NSError errorPtr) + { + super(typeof(this).alloc.initToWritableFile(filename, errorPtr).objcObject); + } + + typeof(this) initToWritableData (NSMutableData data, ref NSError errorPtr) + { + id __arg1; + + if (errorPtr) + __arg1 = errorPtr.objcObject; + + id result = invokeObjcSelf!(id, "initToWritableData:error:", NSMutableData, id*)(data, &__arg1); + + if (__arg1) + errorPtr = new NSError(__arg1); + + return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); + } + + this (NSMutableData data, ref NSError errorPtr) + { + super(typeof(this).alloc.initToWritableData(data, errorPtr).objcObject); + } + + typeof(this) initToWritableDataReference (QTDataReference dataReference, ref NSError errorPtr) + { + id __arg1; + + if (errorPtr) + __arg1 = errorPtr.objcObject; + + id result = invokeObjcSelf!(id, "initToWritableDataReference:error:", QTDataReference, id*)(dataReference, &__arg1); + + if (__arg1) + errorPtr = new NSError(__arg1); + + return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); + } + + this (QTDataReference dataReference, ref NSError errorPtr) + { + super(typeof(this).alloc.initToWritableDataReference(dataReference, errorPtr).objcObject); + } + + void invalidate () + { + return invokeObjcSelf!(void, "invalidate"); + } + + // QTMovieImage + NSImage posterImage () + { + return invokeObjcSelf!(NSImage, "posterImage"); + } + + NSImage currentFrameImage () + { + return invokeObjcSelf!(NSImage, "currentFrameImage"); + } + + NSImage frameImageAtTime (QTTime time) + { + return invokeObjcSelf!(NSImage, "frameImageAtTime:", QTTime)(time); + } + + void* frameImageAtTime (QTTime time, NSDictionary attributes, ref NSError errorPtr) + { + id __arg2; + + if (errorPtr) + __arg2 = errorPtr.objcObject; + + void* result = invokeObjcSelf!(void*, "frameImageAtTime:withAttributes:error:", QTTime, NSDictionary, id*)(time, attributes, &__arg2); + + if (__arg2) + errorPtr = new NSError(__arg2); + + return result; + } + + // QTDelegate + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + void setDelegate (Object delegate_) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(delegate_); + } + + // QTMovieTime + void autoplay () + { + return invokeObjcSelf!(void, "autoplay"); + } + + void play () + { + return invokeObjcSelf!(void, "play"); + } + + void stop () + { + return invokeObjcSelf!(void, "stop"); + } + + void setCurrentTime (QTTime time) + { + return invokeObjcSelf!(void, "setCurrentTime:", QTTime)(time); + } + + void gotoBeginning () + { + return invokeObjcSelf!(void, "gotoBeginning"); + } + + void gotoEnd () + { + return invokeObjcSelf!(void, "gotoEnd"); + } + + void gotoNextSelectionPoint () + { + return invokeObjcSelf!(void, "gotoNextSelectionPoint"); + } + + void gotoPreviousSelectionPoint () + { + return invokeObjcSelf!(void, "gotoPreviousSelectionPoint"); + } + + void gotoPosterTime () + { + return invokeObjcSelf!(void, "gotoPosterTime"); + } + + void stepForward () + { + return invokeObjcSelf!(void, "stepForward"); + } + + void stepBackward () + { + return invokeObjcSelf!(void, "stepBackward"); + } + + // QTMovieFormat + NSData movieFormatRepresentation () + { + return invokeObjcSelf!(NSData, "movieFormatRepresentation"); + } + + bool writeToFile (NSString fileName, NSDictionary attributes) + { + return invokeObjcSelf!(bool, "writeToFile:withAttributes:", NSString, NSDictionary)(fileName, attributes); + } + + bool writeToFile (NSString fileName, NSDictionary attributes, ref NSError errorPtr) + { + id __arg2; + + if (errorPtr) + __arg2 = errorPtr.objcObject; + + bool result = invokeObjcSelf!(bool, "writeToFile:withAttributes:error:", NSString, NSDictionary, id*)(fileName, attributes, &__arg2); + + if (__arg2) + errorPtr = new NSError(__arg2); + + return result; + } + + bool canUpdateMovieFile () + { + return invokeObjcSelf!(bool, "canUpdateMovieFile"); + } + + bool updateMovieFile () + { + return invokeObjcSelf!(bool, "updateMovieFile"); + } + + // QTSelection + void setSelection (QTTimeRange selection) + { + return invokeObjcSelf!(void, "setSelection:", QTTimeRange)(selection); + } + + QTTime selectionStart () + { + return invokeObjcSelf!(QTTime, "selectionStart"); + } + + QTTime selectionEnd () + { + return invokeObjcSelf!(QTTime, "selectionEnd"); + } + + QTTime selectionDuration () + { + return invokeObjcSelf!(QTTime, "selectionDuration"); + } + + // QTMoviePlaybackControl + void setRate (float rate) + { + return invokeObjcSelf!(void, "setRate:", float)(rate); + } + + void setVolume (float volume) + { + return invokeObjcSelf!(void, "setVolume:", float)(volume); + } + + void setMuted (bool mute) + { + return invokeObjcSelf!(void, "setMuted:", bool)(mute); + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/qtkit/QTMovieLayer.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/qtkit/QTMovieLayer.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,46 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 28, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.qtkit.QTMovieLayer; + +import dstep.foundation.Foundation; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.qtkit.QTKitDefines; +import dstep.qtkit.QTMovie; +import dstep.quartzcore.CALayer; + +class QTMovieLayer : CALayer +{ + mixin (ObjcWrap); + + static Object layerWithMovie (QTMovie movie) + { + return invokeObjcSelfClass!(Object, "layerWithMovie:", QTMovie)(movie); + } + + QTMovieLayer initWithMovie (QTMovie movie) + { + id result = invokeObjcSelf!(id, "initWithMovie:", QTMovie)(movie); + return result is this.objcObject ? this : (result !is null ? new QTMovieLayer(result) : null); + } + + this (QTMovie movie) + { + super(QTMovieLayer.alloc.initWithMovie(movie).objcObject); + } + + void setMovie (QTMovie movie) + { + return invokeObjcSelf!(void, "setMovie:", QTMovie)(movie); + } + + QTMovie movie () + { + return invokeObjcSelf!(QTMovie, "movie"); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/qtkit/QTMovieView.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/qtkit/QTMovieView.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,350 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 28, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.qtkit.QTMovieView; + +import dstep.cocoa.Cocoa; +import dstep.appkit.NSUserInterfaceValidation; +import dstep.foundation.NSCoder; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.qtkit.QTKitDefines; +import dstep.qtkit.QTMovie; + +import bindings = dstep.qtkit.QTMovieView_bindings; + +private +{ + NSString QTMovieViewMovieBinding_; + NSString QTMovieViewControllerVisibleBinding_; + NSString QTMovieViewPreservesAspectRatioBinding_; + NSString QTMovieViewFillColorBinding_; +} + +NSString QTMovieViewMovieBinding () +{ + if (QTMovieViewMovieBinding_) + return QTMovieViewMovieBinding_; + + return QTMovieViewMovieBinding_ = new NSString(bindings.QTMovieViewMovieBinding); +} + +NSString QTMovieViewControllerVisibleBinding () +{ + if (QTMovieViewControllerVisibleBinding_) + return QTMovieViewControllerVisibleBinding_; + + return QTMovieViewControllerVisibleBinding_ = new NSString(bindings.QTMovieViewControllerVisibleBinding); +} + +NSString QTMovieViewPreservesAspectRatioBinding () +{ + if (QTMovieViewPreservesAspectRatioBinding_) + return QTMovieViewPreservesAspectRatioBinding_; + + return QTMovieViewPreservesAspectRatioBinding_ = new NSString(bindings.QTMovieViewPreservesAspectRatioBinding); +} + +NSString QTMovieViewFillColorBinding () +{ + if (QTMovieViewFillColorBinding_) + return QTMovieViewFillColorBinding_; + + return QTMovieViewFillColorBinding_ = new NSString(bindings.QTMovieViewFillColorBinding); +} + +const TQTMovieViewDelegate = ` + + CIImage view (QTMovieView view, CIImage image) + { + return invokeObjcSelf!(CIImage, "view:willDisplayImage:", QTMovieView, CIImage)(view, image); + } + + //mixin ObjcBindMethod!(view, "view:willDisplayImage:"); + +`; + +class QTMovieView : NSView, INSCoding, INSUserInterfaceValidations +{ + mixin (ObjcWrap); + + bool validateUserInterfaceItem (INSValidatedUserInterfaceItem anItem) + { + return invokeObjcSelf!(bool, "validateUserInterfaceItem:", INSValidatedUserInterfaceItem)(anItem); + } + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + QTMovieView initWithFrame (NSRect frame) + { + id result = invokeObjcSelf!(id, "initWithFrame:", NSRect)(frame); + return result is this.objcObject ? this : (result !is null ? new QTMovieView(result) : null); + } + + this (NSRect frame) + { + super(QTMovieView.alloc.initWithFrame(frame).objcObject); + } + + QTMovie movie () + { + return invokeObjcSelf!(QTMovie, "movie"); + } + + bool isControllerVisible () + { + return invokeObjcSelf!(bool, "isControllerVisible"); + } + + bool isEditable () + { + return invokeObjcSelf!(bool, "isEditable"); + } + + float controllerBarHeight () + { + return invokeObjcSelf!(float, "controllerBarHeight"); + } + + bool preservesAspectRatio () + { + return invokeObjcSelf!(bool, "preservesAspectRatio"); + } + + NSColor fillColor () + { + return invokeObjcSelf!(NSColor, "fillColor"); + } + + NSRect movieBounds () + { + return invokeObjcSelf!(NSRect, "movieBounds"); + } + + NSRect movieControllerBounds () + { + return invokeObjcSelf!(NSRect, "movieControllerBounds"); + } + + void setMovie (QTMovie movie) + { + return invokeObjcSelf!(void, "setMovie:", QTMovie)(movie); + } + + void setControllerVisible (bool controllerVisible) + { + return invokeObjcSelf!(void, "setControllerVisible:", bool)(controllerVisible); + } + + void setPreservesAspectRatio (bool preservesAspectRatio) + { + return invokeObjcSelf!(void, "setPreservesAspectRatio:", bool)(preservesAspectRatio); + } + + void setFillColor (NSColor fillColor) + { + return invokeObjcSelf!(void, "setFillColor:", NSColor)(fillColor); + } + + void setEditable (bool editable) + { + return invokeObjcSelf!(void, "setEditable:", bool)(editable); + } + + void setShowsResizeIndicator (bool show) + { + return invokeObjcSelf!(void, "setShowsResizeIndicator:", bool)(show); + } + + void play (Object sender) + { + return invokeObjcSelf!(void, "play:", Object)(sender); + } + + void pause (Object sender) + { + return invokeObjcSelf!(void, "pause:", Object)(sender); + } + + void gotoBeginning (Object sender) + { + return invokeObjcSelf!(void, "gotoBeginning:", Object)(sender); + } + + void gotoEnd (Object sender) + { + return invokeObjcSelf!(void, "gotoEnd:", Object)(sender); + } + + void gotoNextSelectionPoint (Object sender) + { + return invokeObjcSelf!(void, "gotoNextSelectionPoint:", Object)(sender); + } + + void gotoPreviousSelectionPoint (Object sender) + { + return invokeObjcSelf!(void, "gotoPreviousSelectionPoint:", Object)(sender); + } + + void gotoPosterFrame (Object sender) + { + return invokeObjcSelf!(void, "gotoPosterFrame:", Object)(sender); + } + + void stepForward (Object sender) + { + return invokeObjcSelf!(void, "stepForward:", Object)(sender); + } + + void stepBackward (Object sender) + { + return invokeObjcSelf!(void, "stepBackward:", Object)(sender); + } + + void cut (Object sender) + { + return invokeObjcSelf!(void, "cut:", Object)(sender); + } + + void copy (Object sender) + { + return invokeObjcSelf!(void, "copy:", Object)(sender); + } + + void paste (Object sender) + { + return invokeObjcSelf!(void, "paste:", Object)(sender); + } + + void selectAll (Object sender) + { + return invokeObjcSelf!(void, "selectAll:", Object)(sender); + } + + void selectNone (Object sender) + { + return invokeObjcSelf!(void, "selectNone:", Object)(sender); + } + + void delete_ (Object sender) + { + return invokeObjcSelf!(void, "delete:", Object)(sender); + } + + void add (Object sender) + { + return invokeObjcSelf!(void, "add:", Object)(sender); + } + + void addScaled (Object sender) + { + return invokeObjcSelf!(void, "addScaled:", Object)(sender); + } + + void replace (Object sender) + { + return invokeObjcSelf!(void, "replace:", Object)(sender); + } + + void trim (Object sender) + { + return invokeObjcSelf!(void, "trim:", Object)(sender); + } + + void setBackButtonVisible (bool state) + { + return invokeObjcSelf!(void, "setBackButtonVisible:", bool)(state); + } + + void setCustomButtonVisible (bool state) + { + return invokeObjcSelf!(void, "setCustomButtonVisible:", bool)(state); + } + + void setHotSpotButtonVisible (bool state) + { + return invokeObjcSelf!(void, "setHotSpotButtonVisible:", bool)(state); + } + + void setStepButtonsVisible (bool state) + { + return invokeObjcSelf!(void, "setStepButtonsVisible:", bool)(state); + } + + void setTranslateButtonVisible (bool state) + { + return invokeObjcSelf!(void, "setTranslateButtonVisible:", bool)(state); + } + + void setVolumeButtonVisible (bool state) + { + return invokeObjcSelf!(void, "setVolumeButtonVisible:", bool)(state); + } + + void setZoomButtonsVisible (bool state) + { + return invokeObjcSelf!(void, "setZoomButtonsVisible:", bool)(state); + } + + bool isBackButtonVisible () + { + return invokeObjcSelf!(bool, "isBackButtonVisible"); + } + + bool isCustomButtonVisible () + { + return invokeObjcSelf!(bool, "isCustomButtonVisible"); + } + + bool isHotSpotButtonVisible () + { + return invokeObjcSelf!(bool, "isHotSpotButtonVisible"); + } + + bool areStepButtonsVisible () + { + return invokeObjcSelf!(bool, "areStepButtonsVisible"); + } + + bool isTranslateButtonVisible () + { + return invokeObjcSelf!(bool, "isTranslateButtonVisible"); + } + + bool isVolumeButtonVisible () + { + return invokeObjcSelf!(bool, "isVolumeButtonVisible"); + } + + bool areZoomButtonsVisible () + { + return invokeObjcSelf!(bool, "areZoomButtonsVisible"); + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + void setDelegate (Object delegate_) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(delegate_); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/qtkit/QTMovieView_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/qtkit/QTMovieView_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,21 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 28, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.qtkit.QTMovieView_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package const id QTMovieViewMovieBinding; + package const id QTMovieViewControllerVisibleBinding; + package const id QTMovieViewPreservesAspectRatioBinding; + package const id QTMovieViewFillColorBinding; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/qtkit/QTMovie_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/qtkit/QTMovie_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,119 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 28, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.qtkit.QTMovie_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package const id QTMoviePasteboardType; + package const id QTMovieEditabilityDidChangeNotification; + package const id QTMovieEditedNotification; + package const id QTMovieLoadStateDidChangeNotification; + package const id QTMovieLoopModeDidChangeNotification; + package const id QTMovieMessageStringPostedNotification; + package const id QTMovieRateDidChangeNotification; + package const id QTMovieSelectionDidChangeNotification; + package const id QTMovieSizeDidChangeNotification; + package const id QTMovieStatusStringPostedNotification; + package const id QTMovieTimeDidChangeNotification; + package const id QTMovieVolumeDidChangeNotification; + package const id QTMovieDidEndNotification; + package const id QTMovieChapterDidChangeNotification; + package const id QTMovieChapterListDidChangeNotification; + package const id QTMovieEnterFullScreenRequestNotification; + package const id QTMovieExitFullScreenRequestNotification; + package const id QTMovieCloseWindowRequestNotification; + package const id QTMovieApertureModeDidChangeNotification; + package const id QTMovieMessageNotificationParameter; + package const id QTMovieRateDidChangeNotificationParameter; + package const id QTMovieStatusFlagsNotificationParameter; + package const id QTMovieStatusCodeNotificationParameter; + package const id QTMovieStatusStringNotificationParameter; + package const id QTMovieTargetIDNotificationParameter; + package const id QTMovieTargetNameNotificationParameter; + package const id QTMovieExport; + package const id QTMovieExportType; + package const id QTMovieFlatten; + package const id QTMovieExportSettings; + package const id QTMovieExportManufacturer; + package const id QTAddImageCodecType; + package const id QTAddImageCodecQuality; + package const id QTMovieDataReferenceAttribute; + package const id QTMoviePasteboardAttribute; + package const id QTMovieDataAttribute; + package const id QTMovieFileOffsetAttribute; + package const id QTMovieResolveDataRefsAttribute; + package const id QTMovieAskUnresolvedDataRefsAttribute; + package const id QTMovieOpenAsyncOKAttribute; + package const id QTMovieApertureModeAttribute; + package const id QTMovieAutoAlternatesAttribute; + package const id QTMovieCopyrightAttribute; + package const id QTMovieCreationTimeAttribute; + package const id QTMovieCurrentSizeAttribute; + package const id QTMovieCurrentTimeAttribute; + package const id QTMovieDataSizeAttribute; + package const id QTMovieDelegateAttribute; + package const id QTMovieDisplayNameAttribute; + package const id QTMovieDontInteractWithUserAttribute; + package const id QTMovieDurationAttribute; + package const id QTMovieEditableAttribute; + package const id QTMovieFileNameAttribute; + package const id QTMovieHasApertureModeDimensionsAttribute; + package const id QTMovieHasAudioAttribute; + package const id QTMovieHasDurationAttribute; + package const id QTMovieHasVideoAttribute; + package const id QTMovieIsActiveAttribute; + package const id QTMovieIsInteractiveAttribute; + package const id QTMovieIsLinearAttribute; + package const id QTMovieIsSteppableAttribute; + package const id QTMovieLoadStateAttribute; + package const id QTMovieLoopsAttribute; + package const id QTMovieLoopsBackAndForthAttribute; + package const id QTMovieModificationTimeAttribute; + package const id QTMovieMutedAttribute; + package const id QTMovieNaturalSizeAttribute; + package const id QTMoviePlaysAllFramesAttribute; + package const id QTMoviePlaysSelectionOnlyAttribute; + package const id QTMoviePosterTimeAttribute; + package const id QTMoviePreferredMutedAttribute; + package const id QTMoviePreferredRateAttribute; + package const id QTMoviePreferredVolumeAttribute; + package const id QTMoviePreviewModeAttribute; + package const id QTMoviePreviewRangeAttribute; + package const id QTMovieRateAttribute; + package const id QTMovieSelectionAttribute; + package const id QTMovieTimeScaleAttribute; + package const id QTMovieURLAttribute; + package const id QTMovieVolumeAttribute; + package const id QTMovieRateChangesPreservePitchAttribute; + package const id QTMovieApertureModeClassic; + package const id QTMovieApertureModeClean; + package const id QTMovieApertureModeProduction; + package const id QTMovieApertureModeEncodedPixels; + package const id QTMovieFrameImageSize; + package const id QTMovieFrameImageType; + package const id QTMovieFrameImageTypeNSImage; + package const id QTMovieFrameImageTypeCGImageRef; + package const id QTMovieFrameImageTypeCIImage; + package const id QTMovieFrameImageTypeCVPixelBufferRef; + package const id QTMovieFrameImageTypeCVOpenGLTextureRef; + package const id QTMovieFrameImageOpenGLContext; + package const id QTMovieFrameImagePixelFormat; + package const id QTMovieFrameImageRepresentationsType; + package const id QTMovieFrameImageDeinterlaceFields; + package const id QTMovieFrameImageHighQuality; + package const id QTMovieFrameImageSingleField; + package const id QTMovieUneditableException; + package const id QTMovieChapterName; + package const id QTMovieChapterStartTime; + package const id QTMovieChapterTargetTrackAttribute; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/qtkit/QTSampleBuffer.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/qtkit/QTSampleBuffer.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,179 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 28, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.qtkit.QTSampleBuffer; + +import dstep.coreaudio.CoreAudioTypes; +import dstep.foundation.Foundation; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.qtkit.QTFormatDescription; +import dstep.qtkit.QTKitDefines; +import dstep.qtkit.QTTime; + +import bindings = dstep.qtkit.QTSampleBuffer_bindings; + +alias NSUInteger QTSampleBufferAudioBufferListOptions; + +private +{ + NSString QTSampleBufferSMPTETimeAttribute_; + NSString QTSampleBufferDateRecordedAttribute_; + NSString QTSampleBufferHostTimeAttribute_; + NSString QTSampleBufferSceneChangeTypeAttribute_; + NSString QTSampleBufferExplicitSceneChange_; + NSString QTSampleBufferTimeStampDiscontinuitySceneChange_; +} + +NSString QTSampleBufferSMPTETimeAttribute () +{ + if (QTSampleBufferSMPTETimeAttribute_) + return QTSampleBufferSMPTETimeAttribute_; + + return QTSampleBufferSMPTETimeAttribute_ = new NSString(bindings.QTSampleBufferSMPTETimeAttribute); +} + +NSString QTSampleBufferDateRecordedAttribute () +{ + if (QTSampleBufferDateRecordedAttribute_) + return QTSampleBufferDateRecordedAttribute_; + + return QTSampleBufferDateRecordedAttribute_ = new NSString(bindings.QTSampleBufferDateRecordedAttribute); +} + +NSString QTSampleBufferHostTimeAttribute () +{ + if (QTSampleBufferHostTimeAttribute_) + return QTSampleBufferHostTimeAttribute_; + + return QTSampleBufferHostTimeAttribute_ = new NSString(bindings.QTSampleBufferHostTimeAttribute); +} + +NSString QTSampleBufferSceneChangeTypeAttribute () +{ + if (QTSampleBufferSceneChangeTypeAttribute_) + return QTSampleBufferSceneChangeTypeAttribute_; + + return QTSampleBufferSceneChangeTypeAttribute_ = new NSString(bindings.QTSampleBufferSceneChangeTypeAttribute); +} + +NSString QTSampleBufferExplicitSceneChange () +{ + if (QTSampleBufferExplicitSceneChange_) + return QTSampleBufferExplicitSceneChange_; + + return QTSampleBufferExplicitSceneChange_ = new NSString(bindings.QTSampleBufferExplicitSceneChange); +} + +NSString QTSampleBufferTimeStampDiscontinuitySceneChange () +{ + if (QTSampleBufferTimeStampDiscontinuitySceneChange_) + return QTSampleBufferTimeStampDiscontinuitySceneChange_; + + return QTSampleBufferTimeStampDiscontinuitySceneChange_ = new NSString(bindings.QTSampleBufferTimeStampDiscontinuitySceneChange); +} + +enum +{ + QTSampleBufferAudioBufferListOptionAssure16ByteAlignment = (1L << 0) +} + +const TQTSampleBufferUseCount = ` + + NSUInteger sampleUseCount () + { + return invokeObjcSelf!(NSUInteger, "sampleUseCount"); + } + + void incrementSampleUseCount () + { + return invokeObjcSelf!(void, "incrementSampleUseCount"); + } + + void decrementSampleUseCount () + { + return invokeObjcSelf!(void, "decrementSampleUseCount"); + } + + //mixin ObjcBindMethod!(sampleUseCount, "sampleUseCount"); + //mixin ObjcBindMethod!(incrementSampleUseCount, "incrementSampleUseCount"); + //mixin ObjcBindMethod!(decrementSampleUseCount, "decrementSampleUseCount"); + +`; + +const TQTAudioSampleBuffer = ` + + bool getAudioStreamPacketDescriptions (AudioStreamPacketDescription* audioStreamPacketDescriptions, NSRange range) + { + return invokeObjcSelf!(bool, "getAudioStreamPacketDescriptions:inRange:", AudioStreamPacketDescription*, NSRange)(audioStreamPacketDescriptions, range); + } + + //mixin ObjcBindMethod!(getAudioStreamPacketDescriptions, "getAudioStreamPacketDescriptions:inRange:"); + +`; + +class QTSampleBuffer : NSObject +{ + mixin (ObjcWrap); + + QTFormatDescription formatDescription () + { + return invokeObjcSelf!(QTFormatDescription, "formatDescription"); + } + + QTTime duration () + { + return invokeObjcSelf!(QTTime, "duration"); + } + + QTTime decodeTime () + { + return invokeObjcSelf!(QTTime, "decodeTime"); + } + + QTTime presentationTime () + { + return invokeObjcSelf!(QTTime, "presentationTime"); + } + + NSUInteger numberOfSamples () + { + return invokeObjcSelf!(NSUInteger, "numberOfSamples"); + } + + NSDictionary sampleBufferAttributes () + { + return invokeObjcSelf!(NSDictionary, "sampleBufferAttributes"); + } + + Object attributeForKey (NSString key) + { + return invokeObjcSelf!(Object, "attributeForKey:", NSString)(key); + } + + // QTSampleBufferUseCount + NSUInteger sampleUseCount () + { + return invokeObjcSelf!(NSUInteger, "sampleUseCount"); + } + + void incrementSampleUseCount () + { + return invokeObjcSelf!(void, "incrementSampleUseCount"); + } + + void decrementSampleUseCount () + { + return invokeObjcSelf!(void, "decrementSampleUseCount"); + } + + // QTAudioSampleBuffer + bool getAudioStreamPacketDescriptions (AudioStreamPacketDescription* audioStreamPacketDescriptions, NSRange range) + { + return invokeObjcSelf!(bool, "getAudioStreamPacketDescriptions:inRange:", AudioStreamPacketDescription*, NSRange)(audioStreamPacketDescriptions, range); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/qtkit/QTSampleBuffer_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/qtkit/QTSampleBuffer_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,23 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 28, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.qtkit.QTSampleBuffer_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package const id QTSampleBufferSMPTETimeAttribute; + package const id QTSampleBufferDateRecordedAttribute; + package const id QTSampleBufferHostTimeAttribute; + package const id QTSampleBufferSceneChangeTypeAttribute; + package const id QTSampleBufferExplicitSceneChange; + package const id QTSampleBufferTimeStampDiscontinuitySceneChange; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/qtkit/QTTime.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/qtkit/QTTime.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,134 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 28, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.qtkit.QTTime; + +import dstep.coreaudio.CoreAudioTypes; +import dstep.coreservices.carboncore.MacTypes; +import dstep.foundation.Foundation; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.qtkit.QTKitDefines; + +import bindings = dstep.qtkit.QTTime_bindings; + +extern (C) +{ + extern + { + const QTTime QTZeroTime; + const QTTime QTIndefiniteTime; + } +} + +enum +{ + kQTTimeIsIndefinite = 1 << 0 +} + +struct QTTime +{ + long timeValue; + int timeScale; + int flags; +} + +const TNSValueQTSMPTETimeExtensions = ` + + static NSValue valueWithSMPTETime (SMPTETime time) + { + return invokeObjcSelfClass!(NSValue, "valueWithSMPTETime:", SMPTETime)(time); + } + + SMPTETime SMPTETimeValue () + { + return invokeObjcSelf!(SMPTETime, "SMPTETimeValue"); + } + + //mixin ObjcBindClassMethod!(valueWithSMPTETime, "valueWithSMPTETime:"); + //mixin ObjcBindMethod!(SMPTETimeValue, "SMPTETimeValue"); + +`; + +const TNSQTTimeCoding = ` + + void encodeQTTime (QTTime time, NSString key) + { + return invokeObjcSelf!(void, "encodeQTTime:forKey:", QTTime, NSString)(time, key); + } + + QTTime decodeQTTimeForKey (NSString key) + { + return invokeObjcSelf!(QTTime, "decodeQTTimeForKey:", NSString)(key); + } + + //mixin ObjcBindMethod!(encodeQTTime, "encodeQTTime:forKey:"); + //mixin ObjcBindMethod!(decodeQTTimeForKey, "decodeQTTimeForKey:"); + +`; + +const TNSCoderQTSMPTETimeCoding = ` + + void encodeSMPTETime (SMPTETime time, NSString key) + { + return invokeObjcSelf!(void, "encodeSMPTETime:forKey:", SMPTETime, NSString)(time, key); + } + + SMPTETime decodeSMPTETimeForKey (NSString key) + { + return invokeObjcSelf!(SMPTETime, "decodeSMPTETimeForKey:", NSString)(key); + } + + //mixin ObjcBindMethod!(encodeSMPTETime, "encodeSMPTETime:forKey:"); + //mixin ObjcBindMethod!(decodeSMPTETimeForKey, "decodeSMPTETimeForKey:"); + +`; + +const TNSValueQTTimeExtensions = ` + + static NSValue valueWithQTTime (QTTime time) + { + return invokeObjcSelfClass!(NSValue, "valueWithQTTime:", QTTime)(time); + } + + QTTime QTTimeValue () + { + return invokeObjcSelf!(QTTime, "QTTimeValue"); + } + + //mixin ObjcBindClassMethod!(valueWithQTTime, "valueWithQTTime:"); + //mixin ObjcBindMethod!(QTTimeValue, "QTTimeValue"); + +`; + +NSString QTStringFromTime (QTTime time) +{ + return Bridge.invokeObjcFunction!(NSString, bindings.QTStringFromTime, QTTime)(time); +} + +QTTime QTTimeFromString (NSString string) +{ + return Bridge.invokeObjcFunction!(QTTime, bindings.QTTimeFromString, NSString)(string); +} + +NSString QTStringFromSMPTETime (SMPTETime time) +{ + return Bridge.invokeObjcFunction!(NSString, bindings.QTStringFromSMPTETime, SMPTETime)(time); +} + +extern (C) +{ + QTTime QTMakeTimeWithTimeRecord (TimeRecord timeRecord); + QTTime QTMakeTimeWithTimeInterval (double timeInterval); + QTTime QTMakeTime (long timeValue, int timeScale); + QTTime QTMakeTimeScaled (QTTime time, int timeScale); + bool QTGetTimeRecord (QTTime time, TimeRecord* timeRecord); + bool QTGetTimeInterval (QTTime time, NSTimeInterval* timeInterval); + int QTTimeCompare (QTTime time, QTTime otherTime); + QTTime QTTimeIncrement (QTTime time, QTTime increment); + QTTime QTTimeDecrement (QTTime time, QTTime decrement); + bool QTTimeIsIndefinite (QTTime time); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/qtkit/QTTimeRange.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/qtkit/QTTimeRange.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,75 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 28, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.qtkit.QTTimeRange; + +import dstep.foundation.Foundation; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.qtkit.QTKitDefines; +import dstep.qtkit.QTTime; + +import bindings = dstep.qtkit.QTTimeRange_bindings; + +struct QTTimeRange +{ + QTTime time; + QTTime duration; +} + +const TNSQTTimeRangeCoding = ` + + void encodeQTTimeRange (QTTimeRange range, NSString key) + { + return invokeObjcSelf!(void, "encodeQTTimeRange:forKey:", QTTimeRange, NSString)(range, key); + } + + QTTimeRange decodeQTTimeRangeForKey (NSString key) + { + return invokeObjcSelf!(QTTimeRange, "decodeQTTimeRangeForKey:", NSString)(key); + } + + //mixin ObjcBindMethod!(encodeQTTimeRange, "encodeQTTimeRange:forKey:"); + //mixin ObjcBindMethod!(decodeQTTimeRangeForKey, "decodeQTTimeRangeForKey:"); + +`; + +const TNSValueQTTimeRangeExtensions = ` + + static NSValue valueWithQTTimeRange (QTTimeRange range) + { + return invokeObjcSelfClass!(NSValue, "valueWithQTTimeRange:", QTTimeRange)(range); + } + + QTTimeRange QTTimeRangeValue () + { + return invokeObjcSelf!(QTTimeRange, "QTTimeRangeValue"); + } + + //mixin ObjcBindClassMethod!(valueWithQTTimeRange, "valueWithQTTimeRange:"); + //mixin ObjcBindMethod!(QTTimeRangeValue, "QTTimeRangeValue"); + +`; + +NSString QTStringFromTimeRange (QTTimeRange range) +{ + return Bridge.invokeObjcFunction!(NSString, bindings.QTStringFromTimeRange, QTTimeRange)(range); +} + +QTTimeRange QTTimeRangeFromString (NSString str) +{ + return Bridge.invokeObjcFunction!(QTTimeRange, bindings.QTTimeRangeFromString, NSString)(str); +} + +extern (C) +{ + QTTimeRange QTMakeTimeRange (QTTime time, QTTime duration); + bool QTTimeInTimeRange (QTTime time, QTTimeRange range); + bool QTEqualTimeRanges (QTTimeRange range, QTTimeRange range2); + QTTime QTTimeRangeEnd (QTTimeRange range); + QTTimeRange QTUnionTimeRange (QTTimeRange range1, QTTimeRange range2); + QTTimeRange QTIntersectionTimeRange (QTTimeRange range1, QTTimeRange range2); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/qtkit/QTTimeRange_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/qtkit/QTTimeRange_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,16 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Nov 27, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.qtkit.QTTimeRange_bindings; + +import dstep.objc.objc; +import dstep.qtkit.QTTimeRange; + +package: +extern (C): + +id QTStringFromTimeRange (QTTimeRange range); +QTTimeRange QTTimeRangeFromString (id str); \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/qtkit/QTTime_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/qtkit/QTTime_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,21 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 28, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.qtkit.QTTime_bindings; + +import dstep.coreaudio.CoreAudioTypes; +import dstep.foundation.Foundation; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.qtkit.QTKitDefines; +import dstep.qtkit.QTTime; + +extern (C) +{ + package id QTStringFromTime (QTTime time); + package QTTime QTTimeFromString (id string); + package id QTStringFromSMPTETime (SMPTETime time); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/qtkit/QTTrack.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/qtkit/QTTrack.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,321 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 28, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.qtkit.QTTrack; + +import dstep.appkit.NSImage; +import dstep.foundation.Foundation; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.qtkit.QTKitDefines; +import dstep.qtkit.QTMedia; +import dstep.qtkit.QTMovie; +import dstep.qtkit.QTTime; +import dstep.qtkit.QTTimeRange; + +import bindings = dstep.qtkit.QTTrack_bindings; + +private +{ + NSString QTTrackBoundsAttribute_; + NSString QTTrackCreationTimeAttribute_; + NSString QTTrackDimensionsAttribute_; + NSString QTTrackDisplayNameAttribute_; + NSString QTTrackEnabledAttribute_; + NSString QTTrackFormatSummaryAttribute_; + NSString QTTrackIsChapterTrackAttribute_; + NSString QTTrackHasApertureModeDimensionsAttribute_; + NSString QTTrackIDAttribute_; + NSString QTTrackLayerAttribute_; + NSString QTTrackMediaTypeAttribute_; + NSString QTTrackModificationTimeAttribute_; + NSString QTTrackRangeAttribute_; + NSString QTTrackTimeScaleAttribute_; + NSString QTTrackUsageInMovieAttribute_; + NSString QTTrackUsageInPosterAttribute_; + NSString QTTrackUsageInPreviewAttribute_; + NSString QTTrackVolumeAttribute_; +} + +NSString QTTrackBoundsAttribute () +{ + if (QTTrackBoundsAttribute_) + return QTTrackBoundsAttribute_; + + return QTTrackBoundsAttribute_ = new NSString(bindings.QTTrackBoundsAttribute); +} + +NSString QTTrackCreationTimeAttribute () +{ + if (QTTrackCreationTimeAttribute_) + return QTTrackCreationTimeAttribute_; + + return QTTrackCreationTimeAttribute_ = new NSString(bindings.QTTrackCreationTimeAttribute); +} + +NSString QTTrackDimensionsAttribute () +{ + if (QTTrackDimensionsAttribute_) + return QTTrackDimensionsAttribute_; + + return QTTrackDimensionsAttribute_ = new NSString(bindings.QTTrackDimensionsAttribute); +} + +NSString QTTrackDisplayNameAttribute () +{ + if (QTTrackDisplayNameAttribute_) + return QTTrackDisplayNameAttribute_; + + return QTTrackDisplayNameAttribute_ = new NSString(bindings.QTTrackDisplayNameAttribute); +} + +NSString QTTrackEnabledAttribute () +{ + if (QTTrackEnabledAttribute_) + return QTTrackEnabledAttribute_; + + return QTTrackEnabledAttribute_ = new NSString(bindings.QTTrackEnabledAttribute); +} + +NSString QTTrackFormatSummaryAttribute () +{ + if (QTTrackFormatSummaryAttribute_) + return QTTrackFormatSummaryAttribute_; + + return QTTrackFormatSummaryAttribute_ = new NSString(bindings.QTTrackFormatSummaryAttribute); +} + +NSString QTTrackIsChapterTrackAttribute () +{ + if (QTTrackIsChapterTrackAttribute_) + return QTTrackIsChapterTrackAttribute_; + + return QTTrackIsChapterTrackAttribute_ = new NSString(bindings.QTTrackIsChapterTrackAttribute); +} + +NSString QTTrackHasApertureModeDimensionsAttribute () +{ + if (QTTrackHasApertureModeDimensionsAttribute_) + return QTTrackHasApertureModeDimensionsAttribute_; + + return QTTrackHasApertureModeDimensionsAttribute_ = new NSString(bindings.QTTrackHasApertureModeDimensionsAttribute); +} + +NSString QTTrackIDAttribute () +{ + if (QTTrackIDAttribute_) + return QTTrackIDAttribute_; + + return QTTrackIDAttribute_ = new NSString(bindings.QTTrackIDAttribute); +} + +NSString QTTrackLayerAttribute () +{ + if (QTTrackLayerAttribute_) + return QTTrackLayerAttribute_; + + return QTTrackLayerAttribute_ = new NSString(bindings.QTTrackLayerAttribute); +} + +NSString QTTrackMediaTypeAttribute () +{ + if (QTTrackMediaTypeAttribute_) + return QTTrackMediaTypeAttribute_; + + return QTTrackMediaTypeAttribute_ = new NSString(bindings.QTTrackMediaTypeAttribute); +} + +NSString QTTrackModificationTimeAttribute () +{ + if (QTTrackModificationTimeAttribute_) + return QTTrackModificationTimeAttribute_; + + return QTTrackModificationTimeAttribute_ = new NSString(bindings.QTTrackModificationTimeAttribute); +} + +NSString QTTrackRangeAttribute () +{ + if (QTTrackRangeAttribute_) + return QTTrackRangeAttribute_; + + return QTTrackRangeAttribute_ = new NSString(bindings.QTTrackRangeAttribute); +} + +NSString QTTrackTimeScaleAttribute () +{ + if (QTTrackTimeScaleAttribute_) + return QTTrackTimeScaleAttribute_; + + return QTTrackTimeScaleAttribute_ = new NSString(bindings.QTTrackTimeScaleAttribute); +} + +NSString QTTrackUsageInMovieAttribute () +{ + if (QTTrackUsageInMovieAttribute_) + return QTTrackUsageInMovieAttribute_; + + return QTTrackUsageInMovieAttribute_ = new NSString(bindings.QTTrackUsageInMovieAttribute); +} + +NSString QTTrackUsageInPosterAttribute () +{ + if (QTTrackUsageInPosterAttribute_) + return QTTrackUsageInPosterAttribute_; + + return QTTrackUsageInPosterAttribute_ = new NSString(bindings.QTTrackUsageInPosterAttribute); +} + +NSString QTTrackUsageInPreviewAttribute () +{ + if (QTTrackUsageInPreviewAttribute_) + return QTTrackUsageInPreviewAttribute_; + + return QTTrackUsageInPreviewAttribute_ = new NSString(bindings.QTTrackUsageInPreviewAttribute); +} + +NSString QTTrackVolumeAttribute () +{ + if (QTTrackVolumeAttribute_) + return QTTrackVolumeAttribute_; + + return QTTrackVolumeAttribute_ = new NSString(bindings.QTTrackVolumeAttribute); +} + +const TQTTrackVisualSupport = ` + + NSSize apertureModeDimensionsForMode (NSString mode) + { + return invokeObjcSelf!(NSSize, "apertureModeDimensionsForMode:", NSString)(mode); + } + + void setApertureModeDimensions (NSSize dimensions, NSString mode) + { + return invokeObjcSelf!(void, "setApertureModeDimensions:forMode:", NSSize, NSString)(dimensions, mode); + } + + void generateApertureModeDimensions () + { + return invokeObjcSelf!(void, "generateApertureModeDimensions"); + } + + void removeApertureModeDimensions () + { + return invokeObjcSelf!(void, "removeApertureModeDimensions"); + } + + //mixin ObjcBindMethod!(apertureModeDimensionsForMode, "apertureModeDimensionsForMode:"); + //mixin ObjcBindMethod!(setApertureModeDimensions, "setApertureModeDimensions:forMode:"); + //mixin ObjcBindMethod!(generateApertureModeDimensions, "generateApertureModeDimensions"); + //mixin ObjcBindMethod!(removeApertureModeDimensions, "removeApertureModeDimensions"); + +`; + +class QTTrack : NSObject +{ + mixin (ObjcWrap); + + QTMovie movie () + { + return invokeObjcSelf!(QTMovie, "movie"); + } + + QTMedia media () + { + return invokeObjcSelf!(QTMedia, "media"); + } + + bool isEnabled () + { + return invokeObjcSelf!(bool, "isEnabled"); + } + + void setEnabled (bool enabled) + { + return invokeObjcSelf!(void, "setEnabled:", bool)(enabled); + } + + float volume () + { + return invokeObjcSelf!(float, "volume"); + } + + void setVolume (float volume) + { + return invokeObjcSelf!(void, "setVolume:", float)(volume); + } + + NSDictionary trackAttributes () + { + return invokeObjcSelf!(NSDictionary, "trackAttributes"); + } + + void setTrackAttributes (NSDictionary attributes) + { + return invokeObjcSelf!(void, "setTrackAttributes:", NSDictionary)(attributes); + } + + Object attributeForKey (NSString attributeKey) + { + return invokeObjcSelf!(Object, "attributeForKey:", NSString)(attributeKey); + } + + void setAttribute (Object value, NSString attributeKey) + { + return invokeObjcSelf!(void, "setAttribute:forKey:", Object, NSString)(value, attributeKey); + } + + void insertSegmentOfTrack (QTTrack track, QTTimeRange range, QTTime time) + { + return invokeObjcSelf!(void, "insertSegmentOfTrack:timeRange:atTime:", QTTrack, QTTimeRange, QTTime)(track, range, time); + } + + void insertSegmentOfTrack (QTTrack track, QTTimeRange srcRange, QTTimeRange dstRange) + { + return invokeObjcSelf!(void, "insertSegmentOfTrack:fromRange:scaledToRange:", QTTrack, QTTimeRange, QTTimeRange)(track, srcRange, dstRange); + } + + void insertEmptySegmentAt (QTTimeRange range) + { + return invokeObjcSelf!(void, "insertEmptySegmentAt:", QTTimeRange)(range); + } + + void deleteSegment (QTTimeRange segment) + { + return invokeObjcSelf!(void, "deleteSegment:", QTTimeRange)(segment); + } + + void scaleSegment (QTTimeRange segment, QTTime newDuration) + { + return invokeObjcSelf!(void, "scaleSegment:newDuration:", QTTimeRange, QTTime)(segment, newDuration); + } + + void addImage (NSImage image, QTTime duration, NSDictionary attributes) + { + return invokeObjcSelf!(void, "addImage:forDuration:withAttributes:", NSImage, QTTime, NSDictionary)(image, duration, attributes); + } + + // QTTrackVisualSupport + NSSize apertureModeDimensionsForMode (NSString mode) + { + return invokeObjcSelf!(NSSize, "apertureModeDimensionsForMode:", NSString)(mode); + } + + void setApertureModeDimensions (NSSize dimensions, NSString mode) + { + return invokeObjcSelf!(void, "setApertureModeDimensions:forMode:", NSSize, NSString)(dimensions, mode); + } + + void generateApertureModeDimensions () + { + return invokeObjcSelf!(void, "generateApertureModeDimensions"); + } + + void removeApertureModeDimensions () + { + return invokeObjcSelf!(void, "removeApertureModeDimensions"); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/qtkit/QTTrack_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/qtkit/QTTrack_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,35 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 28, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.qtkit.QTTrack_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package const id QTTrackBoundsAttribute; + package const id QTTrackCreationTimeAttribute; + package const id QTTrackDimensionsAttribute; + package const id QTTrackDisplayNameAttribute; + package const id QTTrackEnabledAttribute; + package const id QTTrackFormatSummaryAttribute; + package const id QTTrackIsChapterTrackAttribute; + package const id QTTrackHasApertureModeDimensionsAttribute; + package const id QTTrackIDAttribute; + package const id QTTrackLayerAttribute; + package const id QTTrackMediaTypeAttribute; + package const id QTTrackModificationTimeAttribute; + package const id QTTrackRangeAttribute; + package const id QTTrackTimeScaleAttribute; + package const id QTTrackUsageInMovieAttribute; + package const id QTTrackUsageInPosterAttribute; + package const id QTTrackUsageInPreviewAttribute; + package const id QTTrackVolumeAttribute; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/qtkit/QTUtilities.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/qtkit/QTUtilities.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,25 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 28, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.qtkit.QTUtilities; + +import dstep.foundation.Foundation; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.qtkit.QTKitDefines; + +import bindings = dstep.qtkit.QTUtilities_bindings; + +NSString QTStringForOSType (uint type) +{ + return Bridge.invokeObjcFunction!(NSString, bindings.QTStringForOSType, uint)(type); +} + +uint QTOSTypeForString (NSString string) +{ + return Bridge.invokeObjcFunction!(uint, bindings.QTOSTypeForString, NSString)(string); +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/qtkit/QTUtilities_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/qtkit/QTUtilities_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,15 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Nov 28, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.qtkit.QTUtilities_bindings; + +import dstep.objc.objc; + +package: +extern (C): + +id QTStringForOSType (uint type); +uint QTOSTypeForString (id string); diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CAAnimation.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CAAnimation.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,841 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CAAnimation; + +import dstep.applicationservices.coregraphics.CGAffineTransform; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.applicationservices.coregraphics.CGColor; +import dstep.applicationservices.coregraphics.CGContext; +import dstep.applicationservices.coregraphics.CGGeometry; +import dstep.foundation.NSArray; +import dstep.foundation.NSCoder; +import dstep.foundation.NSObject; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSString; +import dstep.foundation.NSZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.quartzcore.CALayer; +import dstep.quartzcore.CAMediaTiming; +import dstep.quartzcore.CAMediaTimingFunction; +import dstep.quartzcore.CATransform3D; + +import bindings = dstep.quartzcore.CAAnimation_bindings; + +private +{ + NSString kCAAnimationLinear_; + NSString kCAAnimationDiscrete_; + NSString kCAAnimationPaced_; + NSString kCAAnimationRotateAuto_; + NSString kCAAnimationRotateAutoReverse_; + NSString kCATransitionFade_; + NSString kCATransitionMoveIn_; + NSString kCATransitionPush_; + NSString kCATransitionReveal_; + NSString kCATransitionFromRight_; + NSString kCATransitionFromLeft_; + NSString kCATransitionFromTop_; + NSString kCATransitionFromBottom_; +} + +NSString kCAAnimationLinear () +{ + if (kCAAnimationLinear_) + return kCAAnimationLinear_; + + return kCAAnimationLinear_ = new NSString(bindings.kCAAnimationLinear); +} + +NSString kCAAnimationDiscrete () +{ + if (kCAAnimationDiscrete_) + return kCAAnimationDiscrete_; + + return kCAAnimationDiscrete_ = new NSString(bindings.kCAAnimationDiscrete); +} + +NSString kCAAnimationPaced () +{ + if (kCAAnimationPaced_) + return kCAAnimationPaced_; + + return kCAAnimationPaced_ = new NSString(bindings.kCAAnimationPaced); +} + +NSString kCAAnimationRotateAuto () +{ + if (kCAAnimationRotateAuto_) + return kCAAnimationRotateAuto_; + + return kCAAnimationRotateAuto_ = new NSString(bindings.kCAAnimationRotateAuto); +} + +NSString kCAAnimationRotateAutoReverse () +{ + if (kCAAnimationRotateAutoReverse_) + return kCAAnimationRotateAutoReverse_; + + return kCAAnimationRotateAutoReverse_ = new NSString(bindings.kCAAnimationRotateAutoReverse); +} + +NSString kCATransitionFade () +{ + if (kCATransitionFade_) + return kCATransitionFade_; + + return kCATransitionFade_ = new NSString(bindings.kCATransitionFade); +} + +NSString kCATransitionMoveIn () +{ + if (kCATransitionMoveIn_) + return kCATransitionMoveIn_; + + return kCATransitionMoveIn_ = new NSString(bindings.kCATransitionMoveIn); +} + +NSString kCATransitionPush () +{ + if (kCATransitionPush_) + return kCATransitionPush_; + + return kCATransitionPush_ = new NSString(bindings.kCATransitionPush); +} + +NSString kCATransitionReveal () +{ + if (kCATransitionReveal_) + return kCATransitionReveal_; + + return kCATransitionReveal_ = new NSString(bindings.kCATransitionReveal); +} + +NSString kCATransitionFromRight () +{ + if (kCATransitionFromRight_) + return kCATransitionFromRight_; + + return kCATransitionFromRight_ = new NSString(bindings.kCATransitionFromRight); +} + +NSString kCATransitionFromLeft () +{ + if (kCATransitionFromLeft_) + return kCATransitionFromLeft_; + + return kCATransitionFromLeft_ = new NSString(bindings.kCATransitionFromLeft); +} + +NSString kCATransitionFromTop () +{ + if (kCATransitionFromTop_) + return kCATransitionFromTop_; + + return kCATransitionFromTop_ = new NSString(bindings.kCATransitionFromTop); +} + +NSString kCATransitionFromBottom () +{ + if (kCATransitionFromBottom_) + return kCATransitionFromBottom_; + + return kCATransitionFromBottom_ = new NSString(bindings.kCATransitionFromBottom); +} + +class CAAnimation : NSObject, INSCoding, INSCopying, ICAMediaTiming, ICAAction +{ + mixin (ObjcWrap); + + static Object animation () + { + return invokeObjcSelfClass!(Object, "animation"); + } + + static Object defaultValueForKey (NSString key) + { + return invokeObjcSelfClass!(Object, "defaultValueForKey:", NSString)(key); + } + + bool shouldArchiveValueForKey (NSString key) + { + return invokeObjcSelf!(bool, "shouldArchiveValueForKey:", NSString)(key); + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + void setDelegate (Object arg0) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(arg0); + } + + bool isRemovedOnCompletion () + { + return invokeObjcSelf!(bool, "isRemovedOnCompletion"); + } + + void setRemovedOnCompletion (bool arg0) + { + return invokeObjcSelf!(void, "setRemovedOnCompletion:", bool)(arg0); + } + + double beginTime () + { + return invokeObjcSelf!(double, "beginTime"); + } + + void beginTime (double arg0) + { + return invokeObjcSelf!(void, "setBeginTime:", double)(arg0); + } + + alias beginTime setBeginTime; + + double duration () + { + return invokeObjcSelf!(double, "duration"); + } + + void duration (double arg0) + { + return invokeObjcSelf!(void, "setDuration:", double)(arg0); + } + + alias duration setDuration; + + float speed () + { + return invokeObjcSelf!(float, "speed"); + } + + void speed (float arg0) + { + return invokeObjcSelf!(void, "setSpeed:", float)(arg0); + } + + alias speed setSpeed; + + double timeOffset () + { + return invokeObjcSelf!(double, "timeOffset"); + } + + void timeOffset (double arg0) + { + return invokeObjcSelf!(void, "setTimeOffset:", double)(arg0); + } + + alias timeOffset setTimeOffset; + + float repeatCount () + { + return invokeObjcSelf!(float, "repeatCount"); + } + + void repeatCount (float arg0) + { + return invokeObjcSelf!(void, "setRepeatCount:", float)(arg0); + } + + alias repeatCount setRepeatCount; + + double repeatDuration () + { + return invokeObjcSelf!(double, "repeatDuration"); + } + + void repeatDuration (double arg0) + { + return invokeObjcSelf!(void, "setRepeatDuration:", double)(arg0); + } + + alias repeatDuration setRepeatDuration; + + NSString fillMode () + { + return invokeObjcSelf!(NSString, "fillMode"); + } + + void fillMode (NSString mode) + { + return invokeObjcSelf!(void, "setFillMode:", NSString)(mode); + } + + alias fillMode setFillMode; + + bool autoreverses () + { + return invokeObjcSelf!(bool, "autoreverses"); + } + + void autoreverses (bool arg0) + { + return invokeObjcSelf!(void, "setAutoreverses:", bool)(arg0); + } + + alias autoreverses setAutoreverses; + + static Object layer () + { + return invokeObjcSelfClass!(Object, "layer"); + } + + CAAnimation init () + { + id result = invokeObjcSelf!(id, "init"); + return result is this.objcObject ? this : (result !is null ? new CAAnimation(result) : null); + } + + this () + { + super(CAAnimation.alloc.init.objcObject); + } + + CAAnimation initWithLayer (Object layer) + { + id result = invokeObjcSelf!(id, "initWithLayer:", Object)(layer); + return result is this.objcObject ? this : (result !is null ? new CAAnimation(result) : null); + } + + this (Object layer) + { + super(CAAnimation.alloc.initWithLayer(layer).objcObject); + } + + Object presentationLayer () + { + return invokeObjcSelf!(Object, "presentationLayer"); + } + + Object modelLayer () + { + return invokeObjcSelf!(Object, "modelLayer"); + } + + static Object defaultValueForKey (NSString key) + { + return invokeObjcSelfClass!(Object, "defaultValueForKey:", NSString)(key); + } + + bool shouldArchiveValueForKey (NSString key) + { + return invokeObjcSelf!(bool, "shouldArchiveValueForKey:", NSString)(key); + } + + CGRect bounds () + { + return invokeObjcSelf!(CGRect, "bounds"); + } + + void setBounds (CGRect arg0) + { + return invokeObjcSelf!(void, "setBounds:", CGRect)(arg0); + } + + CGPoint position () + { + return invokeObjcSelf!(CGPoint, "position"); + } + + void setPosition (CGPoint arg0) + { + return invokeObjcSelf!(void, "setPosition:", CGPoint)(arg0); + } + + CGFloat zPosition () + { + return invokeObjcSelf!(CGFloat, "zPosition"); + } + + void setZPosition (CGFloat arg0) + { + return invokeObjcSelf!(void, "setZPosition:", CGFloat)(arg0); + } + + CGPoint anchorPoint () + { + return invokeObjcSelf!(CGPoint, "anchorPoint"); + } + + void setAnchorPoint (CGPoint arg0) + { + return invokeObjcSelf!(void, "setAnchorPoint:", CGPoint)(arg0); + } + + CATransform3D transform () + { + return invokeObjcSelf!(CATransform3D, "transform"); + } + + void setTransform (CATransform3D arg0) + { + return invokeObjcSelf!(void, "setTransform:", CATransform3D)(arg0); + } + + CGAffineTransform affineTransform () + { + return invokeObjcSelf!(CGAffineTransform, "affineTransform"); + } + + void setAffineTransform (CGAffineTransform m) + { + return invokeObjcSelf!(void, "setAffineTransform:", CGAffineTransform)(m); + } + + CGRect frame () + { + return invokeObjcSelf!(CGRect, "frame"); + } + + void setFrame (CGRect arg0) + { + return invokeObjcSelf!(void, "setFrame:", CGRect)(arg0); + } + + bool isHidden () + { + return invokeObjcSelf!(bool, "isHidden"); + } + + void setHidden (bool arg0) + { + return invokeObjcSelf!(void, "setHidden:", bool)(arg0); + } + + bool isDoubleSided () + { + return invokeObjcSelf!(bool, "isDoubleSided"); + } + + void setDoubleSided (bool arg0) + { + return invokeObjcSelf!(void, "setDoubleSided:", bool)(arg0); + } + + void removeFromSuperlayer () + { + return invokeObjcSelf!(void, "removeFromSuperlayer"); + } + + void addSublayer (dstep.quartzcore.CALayer.CALayer layer) + { + return invokeObjcSelf!(void, "addSublayer:", dstep.quartzcore.CALayer.CALayer)(layer); + } + + void insertSublayer (dstep.quartzcore.CALayer.CALayer layer, uint idx) + { + return invokeObjcSelf!(void, "insertSublayer:atIndex:", dstep.quartzcore.CALayer.CALayer, uint)(layer, idx); + } + + void insertSublayer (dstep.quartzcore.CALayer.CALayer layer, dstep.quartzcore.CALayer.CALayer sibling) + { + return invokeObjcSelf!(void, "insertSublayer:below:", dstep.quartzcore.CALayer.CALayer, dstep.quartzcore.CALayer.CALayer)(layer, sibling); + } + + void insertSublayer (dstep.quartzcore.CALayer.CALayer layer, dstep.quartzcore.CALayer.CALayer sibling) + { + return invokeObjcSelf!(void, "insertSublayer:above:", dstep.quartzcore.CALayer.CALayer, dstep.quartzcore.CALayer.CALayer)(layer, sibling); + } + + void replaceSublayer (dstep.quartzcore.CALayer.CALayer layer, dstep.quartzcore.CALayer.CALayer layer2) + { + return invokeObjcSelf!(void, "replaceSublayer:with:", dstep.quartzcore.CALayer.CALayer, dstep.quartzcore.CALayer.CALayer)(layer, layer2); + } + + CATransform3D sublayerTransform () + { + return invokeObjcSelf!(CATransform3D, "sublayerTransform"); + } + + void setSublayerTransform (CATransform3D arg0) + { + return invokeObjcSelf!(void, "setSublayerTransform:", CATransform3D)(arg0); + } + + bool masksToBounds () + { + return invokeObjcSelf!(bool, "masksToBounds"); + } + + void setMasksToBounds (bool arg0) + { + return invokeObjcSelf!(void, "setMasksToBounds:", bool)(arg0); + } + + CGPoint convertPoint (CGPoint p, dstep.quartzcore.CALayer.CALayer l) + { + return invokeObjcSelf!(CGPoint, "convertPoint:fromLayer:", CGPoint, dstep.quartzcore.CALayer.CALayer)(p, l); + } + + CGPoint convertPoint (CGPoint p, dstep.quartzcore.CALayer.CALayer l) + { + return invokeObjcSelf!(CGPoint, "convertPoint:toLayer:", CGPoint, dstep.quartzcore.CALayer.CALayer)(p, l); + } + + CGRect convertRect (CGRect r, dstep.quartzcore.CALayer.CALayer l) + { + return invokeObjcSelf!(CGRect, "convertRect:fromLayer:", CGRect, dstep.quartzcore.CALayer.CALayer)(r, l); + } + + CGRect convertRect (CGRect r, dstep.quartzcore.CALayer.CALayer l) + { + return invokeObjcSelf!(CGRect, "convertRect:toLayer:", CGRect, dstep.quartzcore.CALayer.CALayer)(r, l); + } + + double convertTime (double t, dstep.quartzcore.CALayer.CALayer l) + { + return invokeObjcSelf!(double, "convertTime:fromLayer:", double, dstep.quartzcore.CALayer.CALayer)(t, l); + } + + double convertTime (double t, dstep.quartzcore.CALayer.CALayer l) + { + return invokeObjcSelf!(double, "convertTime:toLayer:", double, dstep.quartzcore.CALayer.CALayer)(t, l); + } + + dstep.quartzcore.CALayer.CALayer hitTest (CGPoint p) + { + return invokeObjcSelf!(dstep.quartzcore.CALayer.CALayer, "hitTest:", CGPoint)(p); + } + + bool containsPoint (CGPoint p) + { + return invokeObjcSelf!(bool, "containsPoint:", CGPoint)(p); + } + + Object contents () + { + return invokeObjcSelf!(Object, "contents"); + } + + void setContents (Object arg0) + { + return invokeObjcSelf!(void, "setContents:", Object)(arg0); + } + + CGRect contentsRect () + { + return invokeObjcSelf!(CGRect, "contentsRect"); + } + + void setContentsRect (CGRect arg0) + { + return invokeObjcSelf!(void, "setContentsRect:", CGRect)(arg0); + } + + bool isOpaque () + { + return invokeObjcSelf!(bool, "isOpaque"); + } + + void setOpaque (bool arg0) + { + return invokeObjcSelf!(void, "setOpaque:", bool)(arg0); + } + + void display () + { + return invokeObjcSelf!(void, "display"); + } + + void setNeedsDisplay () + { + return invokeObjcSelf!(void, "setNeedsDisplay"); + } + + void setNeedsDisplayInRect (CGRect r) + { + return invokeObjcSelf!(void, "setNeedsDisplayInRect:", CGRect)(r); + } + + bool needsDisplayOnBoundsChange () + { + return invokeObjcSelf!(bool, "needsDisplayOnBoundsChange"); + } + + void setNeedsDisplayOnBoundsChange (bool arg0) + { + return invokeObjcSelf!(void, "setNeedsDisplayOnBoundsChange:", bool)(arg0); + } + + void drawInContext (CGContextRef ctx) + { + return invokeObjcSelf!(void, "drawInContext:", CGContextRef)(ctx); + } + + void renderInContext (CGContextRef ctx) + { + return invokeObjcSelf!(void, "renderInContext:", CGContextRef)(ctx); + } + + uint edgeAntialiasingMask () + { + return invokeObjcSelf!(uint, "edgeAntialiasingMask"); + } + + void setEdgeAntialiasingMask (uint arg0) + { + return invokeObjcSelf!(void, "setEdgeAntialiasingMask:", uint)(arg0); + } + + CGColorRef backgroundColor () + { + return invokeObjcSelf!(CGColorRef, "backgroundColor"); + } + + void setBackgroundColor (CGColorRef arg0) + { + return invokeObjcSelf!(void, "setBackgroundColor:", CGColorRef)(arg0); + } + + CGFloat cornerRadius () + { + return invokeObjcSelf!(CGFloat, "cornerRadius"); + } + + void setCornerRadius (CGFloat arg0) + { + return invokeObjcSelf!(void, "setCornerRadius:", CGFloat)(arg0); + } + + CGFloat borderWidth () + { + return invokeObjcSelf!(CGFloat, "borderWidth"); + } + + void setBorderWidth (CGFloat arg0) + { + return invokeObjcSelf!(void, "setBorderWidth:", CGFloat)(arg0); + } + + CGColorRef borderColor () + { + return invokeObjcSelf!(CGColorRef, "borderColor"); + } + + void setBorderColor (CGColorRef arg0) + { + return invokeObjcSelf!(void, "setBorderColor:", CGColorRef)(arg0); + } + + float opacity () + { + return invokeObjcSelf!(float, "opacity"); + } + + void setOpacity (float arg0) + { + return invokeObjcSelf!(void, "setOpacity:", float)(arg0); + } + + Object compositingFilter () + { + return invokeObjcSelf!(Object, "compositingFilter"); + } + + void setCompositingFilter (Object arg0) + { + return invokeObjcSelf!(void, "setCompositingFilter:", Object)(arg0); + } + + CGColorRef shadowColor () + { + return invokeObjcSelf!(CGColorRef, "shadowColor"); + } + + void setShadowColor (CGColorRef arg0) + { + return invokeObjcSelf!(void, "setShadowColor:", CGColorRef)(arg0); + } + + float shadowOpacity () + { + return invokeObjcSelf!(float, "shadowOpacity"); + } + + void setShadowOpacity (float arg0) + { + return invokeObjcSelf!(void, "setShadowOpacity:", float)(arg0); + } + + CGSize shadowOffset () + { + return invokeObjcSelf!(CGSize, "shadowOffset"); + } + + void setShadowOffset (CGSize arg0) + { + return invokeObjcSelf!(void, "setShadowOffset:", CGSize)(arg0); + } + + CGFloat shadowRadius () + { + return invokeObjcSelf!(CGFloat, "shadowRadius"); + } + + void setShadowRadius (CGFloat arg0) + { + return invokeObjcSelf!(void, "setShadowRadius:", CGFloat)(arg0); + } + + uint autoresizingMask () + { + return invokeObjcSelf!(uint, "autoresizingMask"); + } + + void setAutoresizingMask (uint arg0) + { + return invokeObjcSelf!(void, "setAutoresizingMask:", uint)(arg0); + } + + Object layoutManager () + { + return invokeObjcSelf!(Object, "layoutManager"); + } + + void setLayoutManager (Object arg0) + { + return invokeObjcSelf!(void, "setLayoutManager:", Object)(arg0); + } + + CGSize preferredFrameSize () + { + return invokeObjcSelf!(CGSize, "preferredFrameSize"); + } + + void setNeedsLayout () + { + return invokeObjcSelf!(void, "setNeedsLayout"); + } + + void layoutIfNeeded () + { + return invokeObjcSelf!(void, "layoutIfNeeded"); + } + + void layoutSublayers () + { + return invokeObjcSelf!(void, "layoutSublayers"); + } + + void resizeSublayersWithOldSize (CGSize size) + { + return invokeObjcSelf!(void, "resizeSublayersWithOldSize:", CGSize)(size); + } + + void resizeWithOldSuperlayerSize (CGSize size) + { + return invokeObjcSelf!(void, "resizeWithOldSuperlayerSize:", CGSize)(size); + } + + static ICAAction defaultActionForKey (NSString event) + { + return invokeObjcSelfClass!(ICAAction, "defaultActionForKey:", NSString)(event); + } + + ICAAction actionForKey (NSString event) + { + return invokeObjcSelf!(ICAAction, "actionForKey:", NSString)(event); + } + + void addAnimation (CAAnimation anim, NSString key) + { + return invokeObjcSelf!(void, "addAnimation:forKey:", CAAnimation, NSString)(anim, key); + } + + void removeAllAnimations () + { + return invokeObjcSelf!(void, "removeAllAnimations"); + } + + void removeAnimationForKey (NSString key) + { + return invokeObjcSelf!(void, "removeAnimationForKey:", NSString)(key); + } + + CAAnimation animationForKey (NSString key) + { + return invokeObjcSelf!(CAAnimation, "animationForKey:", NSString)(key); + } + + void setDelegate (Object arg0) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(arg0); + } + + alias setDelegate delegate_; + + void runActionForKey (NSString event, Object anObject, NSDictionary dict) + { + return invokeObjcSelf!(void, "runActionForKey:object:arguments:", NSString, Object, NSDictionary)(event, anObject, dict); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + CAAnimation initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(CAAnimation, "initWithCoder:", NSCoder)(aDecoder); + } + + CAAnimation copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(CAAnimation, "copyWithZone:", NSZone*)(zone); + } +} + +class CAPropertyAnimation : CAAnimation +{ + mixin (ObjcWrap); + + static Object animationWithKeyPath (NSString path) + { + return invokeObjcSelfClass!(Object, "animationWithKeyPath:", NSString)(path); + } + + bool isAdditive () + { + return invokeObjcSelf!(bool, "isAdditive"); + } + + void setAdditive (bool arg0) + { + return invokeObjcSelf!(void, "setAdditive:", bool)(arg0); + } + + bool isCumulative () + { + return invokeObjcSelf!(bool, "isCumulative"); + } + + void setCumulative (bool arg0) + { + return invokeObjcSelf!(void, "setCumulative:", bool)(arg0); + } +} + +const TCAAnimationDelegate = ` + + void animationDidStart (CAAnimation anim) + { + return invokeObjcSelf!(void, "animationDidStart:", CAAnimation)(anim); + } + + void animationDidStop (CAAnimation anim, bool flag) + { + return invokeObjcSelf!(void, "animationDidStop:finished:", CAAnimation, bool)(anim, flag); + } + + //mixin ObjcBindMethod!(animationDidStart, "animationDidStart:"); + //mixin ObjcBindMethod!(animationDidStop, "animationDidStop:finished:"); + +`; + diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CAAnimation_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CAAnimation_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,30 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CAAnimation_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package const id kCAAnimationLinear; + package const id kCAAnimationDiscrete; + package const id kCAAnimationPaced; + package const id kCAAnimationRotateAuto; + package const id kCAAnimationRotateAutoReverse; + package const id kCATransitionFade; + package const id kCATransitionMoveIn; + package const id kCATransitionPush; + package const id kCATransitionReveal; + package const id kCATransitionFromRight; + package const id kCATransitionFromLeft; + package const id kCATransitionFromTop; + package const id kCATransitionFromBottom; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CABase.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CABase.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,18 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CABase; + +//import dstep.AvailabilityMacros; +import dstep.applicationservices.ApplicationServices; +import dstep.corefoundation.CoreFoundation; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +extern (C) +{ + double CACurrentMediaTime (); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CACIFilterAdditions.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CACIFilterAdditions.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,40 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CACIFilterAdditions; + +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.quartzcore.CABase; +import dstep.quartzcore.CIFilter; + +const TCACIFilterAdditions = ` + + NSString name () + { + return invokeObjcMethod!(NSString, "name"); + } + + void name (NSString name) + { + return invokeObjcMethod!(void, "setName:", NSString)(name); + } + + alias name setName; + + bool enabled () + { + return invokeObjcMethod!(bool, "enabled"); + } + + void enabled (bool enabled) + { + return invokeObjcMethod!(void, "setEnabled:", bool)(enabled); + } + + alias enabled setEnabled; +`; \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CAConstraintLayoutManager.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CAConstraintLayoutManager.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,93 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CAConstraintLayoutManager; + +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSCoder; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +alias int CAConstraintAttribute; + +enum _CAConstraintAttribute + +{ + kCAConstraintMinX, + kCAConstraintMidX, + kCAConstraintMaxX, + kCAConstraintWidth, + kCAConstraintMinY, + kCAConstraintMidY, + kCAConstraintMaxY, + kCAConstraintHeight +} + +class CAConstraintLayoutManager : NSObject +{ + mixin (ObjcWrap); + + static Object layoutManager () + { + return invokeObjcSelfClass!(Object, "layoutManager"); + } +} + +class CAConstraint : NSObject, INSCoding +{ + mixin (ObjcWrap); + + static Object constraintWithAttribute (int attr, NSString srcId, int srcAttr, CGFloat m, CGFloat c) + { + return invokeObjcSelfClass!(Object, "constraintWithAttribute:relativeTo:attribute:scale:offset:", int, NSString, int, CGFloat, CGFloat)(attr, srcId, srcAttr, m, c); + } + + static Object constraintWithAttribute (int attr, NSString srcId, int srcAttr, CGFloat c) + { + return invokeObjcSelfClass!(Object, "constraintWithAttribute:relativeTo:attribute:offset:", int, NSString, int, CGFloat)(attr, srcId, srcAttr, c); + } + + static Object constraintWithAttribute (int attr, NSString srcId, int srcAttr) + { + return invokeObjcSelfClass!(Object, "constraintWithAttribute:relativeTo:attribute:", int, NSString, int)(attr, srcId, srcAttr); + } + + CAConstraint initWithAttribute (int attr, NSString srcId, int srcAttr, CGFloat m, CGFloat c) + { + id result = invokeObjcSelf!(id, "initWithAttribute:relativeTo:attribute:scale:offset:", int, NSString, int, CGFloat, CGFloat)(attr, srcId, srcAttr, m, c); + return result is this.objcObject ? this : (result !is null ? new CAConstraint(result) : null); + } + + this (int attr, NSString srcId, int srcAttr, CGFloat m, CGFloat c) + { + super(CAConstraint.alloc.initWithAttribute(attr, srcId, srcAttr, m, c).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + CAConstraint initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(CAConstraint, "initWithCoder:", NSCoder)(aDecoder); + } + +} + +const TCAConstraintLayoutManager = ` + + void addConstraint (CAConstraint c) + { + return invokeObjcSelf!(void, "addConstraint:", CAConstraint)(c); + } + + //mixin ObjcBindMethod!(addConstraint, "addConstraint:"); + +`; + diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CALayer.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CALayer.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,980 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CALayer; + +import dstep.applicationservices.coregraphics.CGAffineTransform; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.applicationservices.coregraphics.CGColor; +import dstep.applicationservices.coregraphics.CGContext; +import dstep.applicationservices.coregraphics.CGGeometry; +import dstep.foundation.NSArray; +import dstep.foundation.NSCoder; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSEnumerator; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.quartzcore.CAAnimation; +import dstep.quartzcore.CAConstraintLayoutManager; +import dstep.quartzcore.CAMediaTiming; +import dstep.quartzcore.CAScrollLayer; +import dstep.quartzcore.CATransform3D; + +import bindings = dstep.quartzcore.CALayer_bindings; + +private +{ + NSString kCAGravityCenter_; + NSString kCAGravityTop_; + NSString kCAGravityBottom_; + NSString kCAGravityLeft_; + NSString kCAGravityRight_; + NSString kCAGravityTopLeft_; + NSString kCAGravityTopRight_; + NSString kCAGravityBottomLeft_; + NSString kCAGravityBottomRight_; + NSString kCAGravityResize_; + NSString kCAGravityResizeAspect_; + NSString kCAGravityResizeAspectFill_; + NSString kCAFilterLinear_; + NSString kCAFilterNearest_; + NSString kCAOnOrderIn_; + NSString kCAOnOrderOut_; + NSString kCATransition_; +} + +NSString kCAGravityCenter () +{ + if (kCAGravityCenter_) + return kCAGravityCenter_; + + return kCAGravityCenter_ = new NSString(bindings.kCAGravityCenter); +} + +NSString kCAGravityTop () +{ + if (kCAGravityTop_) + return kCAGravityTop_; + + return kCAGravityTop_ = new NSString(bindings.kCAGravityTop); +} + +NSString kCAGravityBottom () +{ + if (kCAGravityBottom_) + return kCAGravityBottom_; + + return kCAGravityBottom_ = new NSString(bindings.kCAGravityBottom); +} + +NSString kCAGravityLeft () +{ + if (kCAGravityLeft_) + return kCAGravityLeft_; + + return kCAGravityLeft_ = new NSString(bindings.kCAGravityLeft); +} + +NSString kCAGravityRight () +{ + if (kCAGravityRight_) + return kCAGravityRight_; + + return kCAGravityRight_ = new NSString(bindings.kCAGravityRight); +} + +NSString kCAGravityTopLeft () +{ + if (kCAGravityTopLeft_) + return kCAGravityTopLeft_; + + return kCAGravityTopLeft_ = new NSString(bindings.kCAGravityTopLeft); +} + +NSString kCAGravityTopRight () +{ + if (kCAGravityTopRight_) + return kCAGravityTopRight_; + + return kCAGravityTopRight_ = new NSString(bindings.kCAGravityTopRight); +} + +NSString kCAGravityBottomLeft () +{ + if (kCAGravityBottomLeft_) + return kCAGravityBottomLeft_; + + return kCAGravityBottomLeft_ = new NSString(bindings.kCAGravityBottomLeft); +} + +NSString kCAGravityBottomRight () +{ + if (kCAGravityBottomRight_) + return kCAGravityBottomRight_; + + return kCAGravityBottomRight_ = new NSString(bindings.kCAGravityBottomRight); +} + +NSString kCAGravityResize () +{ + if (kCAGravityResize_) + return kCAGravityResize_; + + return kCAGravityResize_ = new NSString(bindings.kCAGravityResize); +} + +NSString kCAGravityResizeAspect () +{ + if (kCAGravityResizeAspect_) + return kCAGravityResizeAspect_; + + return kCAGravityResizeAspect_ = new NSString(bindings.kCAGravityResizeAspect); +} + +NSString kCAGravityResizeAspectFill () +{ + if (kCAGravityResizeAspectFill_) + return kCAGravityResizeAspectFill_; + + return kCAGravityResizeAspectFill_ = new NSString(bindings.kCAGravityResizeAspectFill); +} + +NSString kCAFilterLinear () +{ + if (kCAFilterLinear_) + return kCAFilterLinear_; + + return kCAFilterLinear_ = new NSString(bindings.kCAFilterLinear); +} + +NSString kCAFilterNearest () +{ + if (kCAFilterNearest_) + return kCAFilterNearest_; + + return kCAFilterNearest_ = new NSString(bindings.kCAFilterNearest); +} + +NSString kCAOnOrderIn () +{ + if (kCAOnOrderIn_) + return kCAOnOrderIn_; + + return kCAOnOrderIn_ = new NSString(bindings.kCAOnOrderIn); +} + +NSString kCAOnOrderOut () +{ + if (kCAOnOrderOut_) + return kCAOnOrderOut_; + + return kCAOnOrderOut_ = new NSString(bindings.kCAOnOrderOut); +} + +NSString kCATransition () +{ + if (kCATransition_) + return kCATransition_; + + return kCATransition_ = new NSString(bindings.kCATransition); +} + +enum CAAutoresizingMask + +{ + kCALayerNotSizable = 0, + kCALayerMinXMargin = 1U << 0, + kCALayerWidthSizable = 1U << 1, + kCALayerMaxXMargin = 1U << 2, + kCALayerMinYMargin = 1U << 3, + kCALayerHeightSizable = 1U << 4, + kCALayerMaxYMargin = 1U << 5 +} + +enum CAEdgeAntialiasingMask + +{ + kCALayerLeftEdge = 1U << 0, + kCALayerRightEdge = 1U << 1, + kCALayerBottomEdge = 1U << 2, + kCALayerTopEdge = 1U << 3 +} + +class CALayer : NSObject, INSCoding, ICAMediaTiming +{ + mixin (ObjcWrap); + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + CALayer initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(CALayer, "initWithCoder:", NSCoder)(aDecoder); + } + + static Object layer () + { + return invokeObjcSelfClass!(Object, "layer"); + } + + CALayer init () + { + id result = invokeObjcSelf!(id, "init"); + return result is this.objcObject ? this : (result !is null ? new CALayer(result) : null); + } + + this () + { + super(CALayer.alloc.init.objcObject); + } + + CALayer initWithLayer (Object layer) + { + id result = invokeObjcSelf!(id, "initWithLayer:", Object)(layer); + return result is this.objcObject ? this : (result !is null ? new CALayer(result) : null); + } + + this (Object layer) + { + super(CALayer.alloc.initWithLayer(layer).objcObject); + } + + Object presentationLayer () + { + return invokeObjcSelf!(Object, "presentationLayer"); + } + + Object modelLayer () + { + return invokeObjcSelf!(Object, "modelLayer"); + } + + static Object defaultValueForKey (NSString key) + { + return invokeObjcSelfClass!(Object, "defaultValueForKey:", NSString)(key); + } + + bool shouldArchiveValueForKey (NSString key) + { + return invokeObjcSelf!(bool, "shouldArchiveValueForKey:", NSString)(key); + } + + CGRect bounds () + { + return invokeObjcSelf!(CGRect, "bounds"); + } + + void setBounds (CGRect arg0) + { + return invokeObjcSelf!(void, "setBounds:", CGRect)(arg0); + } + + CGPoint position () + { + return invokeObjcSelf!(CGPoint, "position"); + } + + void setPosition (CGPoint arg0) + { + return invokeObjcSelf!(void, "setPosition:", CGPoint)(arg0); + } + + CGFloat zPosition () + { + return invokeObjcSelf!(CGFloat, "zPosition"); + } + + void setZPosition (CGFloat arg0) + { + return invokeObjcSelf!(void, "setZPosition:", CGFloat)(arg0); + } + + CGPoint anchorPoint () + { + return invokeObjcSelf!(CGPoint, "anchorPoint"); + } + + void setAnchorPoint (CGPoint arg0) + { + return invokeObjcSelf!(void, "setAnchorPoint:", CGPoint)(arg0); + } + + CATransform3D transform () + { + return invokeObjcSelf!(CATransform3D, "transform"); + } + + void setTransform (CATransform3D arg0) + { + return invokeObjcSelf!(void, "setTransform:", CATransform3D)(arg0); + } + + CGAffineTransform affineTransform () + { + return invokeObjcSelf!(CGAffineTransform, "affineTransform"); + } + + void setAffineTransform (CGAffineTransform m) + { + return invokeObjcSelf!(void, "setAffineTransform:", CGAffineTransform)(m); + } + + CGRect frame () + { + return invokeObjcSelf!(CGRect, "frame"); + } + + void setFrame (CGRect arg0) + { + return invokeObjcSelf!(void, "setFrame:", CGRect)(arg0); + } + + bool isHidden () + { + return invokeObjcSelf!(bool, "isHidden"); + } + + void setHidden (bool arg0) + { + return invokeObjcSelf!(void, "setHidden:", bool)(arg0); + } + + bool isDoubleSided () + { + return invokeObjcSelf!(bool, "isDoubleSided"); + } + + void setDoubleSided (bool arg0) + { + return invokeObjcSelf!(void, "setDoubleSided:", bool)(arg0); + } + + void removeFromSuperlayer () + { + return invokeObjcSelf!(void, "removeFromSuperlayer"); + } + + void addSublayer (CALayer layer) + { + return invokeObjcSelf!(void, "addSublayer:", CALayer)(layer); + } + + void insertSublayer (CALayer layer, uint idx) + { + return invokeObjcSelf!(void, "insertSublayer:atIndex:", CALayer, uint)(layer, idx); + } + + void insertSublayer (CALayer layer, CALayer sibling) + { + return invokeObjcSelf!(void, "insertSublayer:below:", CALayer, CALayer)(layer, sibling); + } + + void insertSublayer (CALayer layer, CALayer sibling) + { + return invokeObjcSelf!(void, "insertSublayer:above:", CALayer, CALayer)(layer, sibling); + } + + void replaceSublayer (CALayer layer, CALayer layer2) + { + return invokeObjcSelf!(void, "replaceSublayer:with:", CALayer, CALayer)(layer, layer2); + } + + CATransform3D sublayerTransform () + { + return invokeObjcSelf!(CATransform3D, "sublayerTransform"); + } + + void setSublayerTransform (CATransform3D arg0) + { + return invokeObjcSelf!(void, "setSublayerTransform:", CATransform3D)(arg0); + } + + bool masksToBounds () + { + return invokeObjcSelf!(bool, "masksToBounds"); + } + + void setMasksToBounds (bool arg0) + { + return invokeObjcSelf!(void, "setMasksToBounds:", bool)(arg0); + } + + CGPoint convertPoint (CGPoint p, CALayer l) + { + return invokeObjcSelf!(CGPoint, "convertPoint:fromLayer:", CGPoint, CALayer)(p, l); + } + + CGPoint convertPoint (CGPoint p, CALayer l) + { + return invokeObjcSelf!(CGPoint, "convertPoint:toLayer:", CGPoint, CALayer)(p, l); + } + + CGRect convertRect (CGRect r, CALayer l) + { + return invokeObjcSelf!(CGRect, "convertRect:fromLayer:", CGRect, CALayer)(r, l); + } + + CGRect convertRect (CGRect r, CALayer l) + { + return invokeObjcSelf!(CGRect, "convertRect:toLayer:", CGRect, CALayer)(r, l); + } + + double convertTime (double t, CALayer l) + { + return invokeObjcSelf!(double, "convertTime:fromLayer:", double, CALayer)(t, l); + } + + double convertTime (double t, CALayer l) + { + return invokeObjcSelf!(double, "convertTime:toLayer:", double, CALayer)(t, l); + } + + CALayer hitTest (CGPoint p) + { + id result = invokeObjcSelf!(id, "hitTest:", CGPoint)(p); + return result is this.objcObject ? this : (result !is null ? new CALayer(result) : null); + } + + bool containsPoint (CGPoint p) + { + return invokeObjcSelf!(bool, "containsPoint:", CGPoint)(p); + } + + Object contents () + { + return invokeObjcSelf!(Object, "contents"); + } + + void setContents (Object arg0) + { + return invokeObjcSelf!(void, "setContents:", Object)(arg0); + } + + CGRect contentsRect () + { + return invokeObjcSelf!(CGRect, "contentsRect"); + } + + void setContentsRect (CGRect arg0) + { + return invokeObjcSelf!(void, "setContentsRect:", CGRect)(arg0); + } + + bool isOpaque () + { + return invokeObjcSelf!(bool, "isOpaque"); + } + + void setOpaque (bool arg0) + { + return invokeObjcSelf!(void, "setOpaque:", bool)(arg0); + } + + void display () + { + return invokeObjcSelf!(void, "display"); + } + + void setNeedsDisplay () + { + return invokeObjcSelf!(void, "setNeedsDisplay"); + } + + void setNeedsDisplayInRect (CGRect r) + { + return invokeObjcSelf!(void, "setNeedsDisplayInRect:", CGRect)(r); + } + + bool needsDisplayOnBoundsChange () + { + return invokeObjcSelf!(bool, "needsDisplayOnBoundsChange"); + } + + void setNeedsDisplayOnBoundsChange (bool arg0) + { + return invokeObjcSelf!(void, "setNeedsDisplayOnBoundsChange:", bool)(arg0); + } + + void drawInContext (CGContextRef ctx) + { + return invokeObjcSelf!(void, "drawInContext:", CGContextRef)(ctx); + } + + void renderInContext (CGContextRef ctx) + { + return invokeObjcSelf!(void, "renderInContext:", CGContextRef)(ctx); + } + + uint edgeAntialiasingMask () + { + return invokeObjcSelf!(uint, "edgeAntialiasingMask"); + } + + void setEdgeAntialiasingMask (uint arg0) + { + return invokeObjcSelf!(void, "setEdgeAntialiasingMask:", uint)(arg0); + } + + CGColorRef backgroundColor () + { + return invokeObjcSelf!(CGColorRef, "backgroundColor"); + } + + void setBackgroundColor (CGColorRef arg0) + { + return invokeObjcSelf!(void, "setBackgroundColor:", CGColorRef)(arg0); + } + + CGFloat cornerRadius () + { + return invokeObjcSelf!(CGFloat, "cornerRadius"); + } + + void setCornerRadius (CGFloat arg0) + { + return invokeObjcSelf!(void, "setCornerRadius:", CGFloat)(arg0); + } + + CGFloat borderWidth () + { + return invokeObjcSelf!(CGFloat, "borderWidth"); + } + + void setBorderWidth (CGFloat arg0) + { + return invokeObjcSelf!(void, "setBorderWidth:", CGFloat)(arg0); + } + + CGColorRef borderColor () + { + return invokeObjcSelf!(CGColorRef, "borderColor"); + } + + void setBorderColor (CGColorRef arg0) + { + return invokeObjcSelf!(void, "setBorderColor:", CGColorRef)(arg0); + } + + float opacity () + { + return invokeObjcSelf!(float, "opacity"); + } + + void setOpacity (float arg0) + { + return invokeObjcSelf!(void, "setOpacity:", float)(arg0); + } + + Object compositingFilter () + { + return invokeObjcSelf!(Object, "compositingFilter"); + } + + void setCompositingFilter (Object arg0) + { + return invokeObjcSelf!(void, "setCompositingFilter:", Object)(arg0); + } + + CGColorRef shadowColor () + { + return invokeObjcSelf!(CGColorRef, "shadowColor"); + } + + void setShadowColor (CGColorRef arg0) + { + return invokeObjcSelf!(void, "setShadowColor:", CGColorRef)(arg0); + } + + float shadowOpacity () + { + return invokeObjcSelf!(float, "shadowOpacity"); + } + + void setShadowOpacity (float arg0) + { + return invokeObjcSelf!(void, "setShadowOpacity:", float)(arg0); + } + + CGSize shadowOffset () + { + return invokeObjcSelf!(CGSize, "shadowOffset"); + } + + void setShadowOffset (CGSize arg0) + { + return invokeObjcSelf!(void, "setShadowOffset:", CGSize)(arg0); + } + + CGFloat shadowRadius () + { + return invokeObjcSelf!(CGFloat, "shadowRadius"); + } + + void setShadowRadius (CGFloat arg0) + { + return invokeObjcSelf!(void, "setShadowRadius:", CGFloat)(arg0); + } + + uint autoresizingMask () + { + return invokeObjcSelf!(uint, "autoresizingMask"); + } + + void setAutoresizingMask (uint arg0) + { + return invokeObjcSelf!(void, "setAutoresizingMask:", uint)(arg0); + } + + Object layoutManager () + { + return invokeObjcSelf!(Object, "layoutManager"); + } + + void setLayoutManager (Object arg0) + { + return invokeObjcSelf!(void, "setLayoutManager:", Object)(arg0); + } + + CGSize preferredFrameSize () + { + return invokeObjcSelf!(CGSize, "preferredFrameSize"); + } + + void setNeedsLayout () + { + return invokeObjcSelf!(void, "setNeedsLayout"); + } + + void layoutIfNeeded () + { + return invokeObjcSelf!(void, "layoutIfNeeded"); + } + + void layoutSublayers () + { + return invokeObjcSelf!(void, "layoutSublayers"); + } + + void resizeSublayersWithOldSize (CGSize size) + { + return invokeObjcSelf!(void, "resizeSublayersWithOldSize:", CGSize)(size); + } + + void resizeWithOldSuperlayerSize (CGSize size) + { + return invokeObjcSelf!(void, "resizeWithOldSuperlayerSize:", CGSize)(size); + } + + static ICAAction defaultActionForKey (NSString event) + { + return invokeObjcSelfClass!(ICAAction, "defaultActionForKey:", NSString)(event); + } + + ICAAction actionForKey (NSString event) + { + return invokeObjcSelf!(ICAAction, "actionForKey:", NSString)(event); + } + + void addAnimation (CAAnimation anim, NSString key) + { + return invokeObjcSelf!(void, "addAnimation:forKey:", CAAnimation, NSString)(anim, key); + } + + void removeAllAnimations () + { + return invokeObjcSelf!(void, "removeAllAnimations"); + } + + void removeAnimationForKey (NSString key) + { + return invokeObjcSelf!(void, "removeAnimationForKey:", NSString)(key); + } + + CAAnimation animationForKey (NSString key) + { + return invokeObjcSelf!(CAAnimation, "animationForKey:", NSString)(key); + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + void setDelegate (Object arg0) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(arg0); + } + + double beginTime () + { + return invokeObjcSelf!(double, "beginTime"); + } + + void beginTime (double arg0) + { + return invokeObjcSelf!(void, "setBeginTime:", double)(arg0); + } + + alias beginTime setBeginTime; + + double duration () + { + return invokeObjcSelf!(double, "duration"); + } + + void duration (double arg0) + { + return invokeObjcSelf!(void, "setDuration:", double)(arg0); + } + + alias duration setDuration; + + float speed () + { + return invokeObjcSelf!(float, "speed"); + } + + void speed (float arg0) + { + return invokeObjcSelf!(void, "setSpeed:", float)(arg0); + } + + alias speed setSpeed; + + double timeOffset () + { + return invokeObjcSelf!(double, "timeOffset"); + } + + void timeOffset (double arg0) + { + return invokeObjcSelf!(void, "setTimeOffset:", double)(arg0); + } + + alias timeOffset setTimeOffset; + + float repeatCount () + { + return invokeObjcSelf!(float, "repeatCount"); + } + + void repeatCount (float arg0) + { + return invokeObjcSelf!(void, "setRepeatCount:", float)(arg0); + } + + alias repeatCount setRepeatCount; + + double repeatDuration () + { + return invokeObjcSelf!(double, "repeatDuration"); + } + + void repeatDuration (double arg0) + { + return invokeObjcSelf!(void, "setRepeatDuration:", double)(arg0); + } + + alias repeatDuration setRepeatDuration; + + NSString fillMode () + { + return invokeObjcSelf!(NSString, "fillMode"); + } + + void fillMode (NSString mode) + { + return invokeObjcSelf!(void, "setFillMode:", NSString)(mode); + } + + alias fillMode setFillMode; + + bool autoreverses () + { + return invokeObjcSelf!(bool, "autoreverses"); + } + + void autoreverses (bool arg0) + { + return invokeObjcSelf!(void, "setAutoreverses:", bool)(arg0); + } + + alias autoreverses setAutoreverses; + + // CAConstraintLayoutManager + void addConstraint (CAConstraint c) + { + return invokeObjcSelf!(void, "addConstraint:", CAConstraint)(c); + } + + // CALayerScrolling + void scrollPoint (CGPoint p) + { + return invokeObjcSelf!(void, "scrollPoint:", CGPoint)(p); + } + + void scrollRectToVisible (CGRect r) + { + return invokeObjcSelf!(void, "scrollRectToVisible:", CGRect)(r); + } + + CGRect visibleRect () + { + return invokeObjcSelf!(CGRect, "visibleRect"); + } +} + +interface ICAAction +{ + static Object layer (); + NSObject init (); + NSObject initWithLayer (Object layer); + Object presentationLayer (); + Object modelLayer (); + static Object defaultValueForKey (NSString key); + bool shouldArchiveValueForKey (NSString key); + CGRect bounds (); + void setBounds (CGRect arg0); + CGPoint position (); + void setPosition (CGPoint arg0); + CGFloat zPosition (); + void setZPosition (CGFloat arg0); + CGPoint anchorPoint (); + void setAnchorPoint (CGPoint arg0); + CATransform3D transform (); + void setTransform (CATransform3D arg0); + CGAffineTransform affineTransform (); + void setAffineTransform (CGAffineTransform m); + CGRect frame (); + void setFrame (CGRect arg0); + bool isHidden (); + void setHidden (bool arg0); + bool isDoubleSided (); + void setDoubleSided (bool arg0); + void removeFromSuperlayer (); + void addSublayer (CALayer layer); + void insertSublayer (CALayer layer, uint idx); + void insertSublayer (CALayer layer, CALayer sibling); + void insertSublayer (CALayer layer, CALayer sibling); + void replaceSublayer (CALayer layer, CALayer layer2); + CATransform3D sublayerTransform (); + void setSublayerTransform (CATransform3D arg0); + bool masksToBounds (); + void setMasksToBounds (bool arg0); + CGPoint convertPoint (CGPoint p, CALayer l); + CGPoint convertPoint (CGPoint p, CALayer l); + CGRect convertRect (CGRect r, CALayer l); + CGRect convertRect (CGRect r, CALayer l); + double convertTime (double t, CALayer l); + double convertTime (double t, CALayer l); + CALayer hitTest (CGPoint p); + bool containsPoint (CGPoint p); + Object contents (); + void setContents (Object arg0); + CGRect contentsRect (); + void setContentsRect (CGRect arg0); + bool isOpaque (); + void setOpaque (bool arg0); + void display (); + void setNeedsDisplay (); + void setNeedsDisplayInRect (CGRect r); + bool needsDisplayOnBoundsChange (); + void setNeedsDisplayOnBoundsChange (bool arg0); + void drawInContext (CGContextRef ctx); + void renderInContext (CGContextRef ctx); + uint edgeAntialiasingMask (); + void setEdgeAntialiasingMask (uint arg0); + CGColorRef backgroundColor (); + void setBackgroundColor (CGColorRef arg0); + CGFloat cornerRadius (); + void setCornerRadius (CGFloat arg0); + CGFloat borderWidth (); + void setBorderWidth (CGFloat arg0); + CGColorRef borderColor (); + void setBorderColor (CGColorRef arg0); + float opacity (); + void setOpacity (float arg0); + Object compositingFilter (); + void setCompositingFilter (Object arg0); + CGColorRef shadowColor (); + void setShadowColor (CGColorRef arg0); + float shadowOpacity (); + void setShadowOpacity (float arg0); + CGSize shadowOffset (); + void setShadowOffset (CGSize arg0); + CGFloat shadowRadius (); + void setShadowRadius (CGFloat arg0); + uint autoresizingMask (); + void setAutoresizingMask (uint arg0); + Object layoutManager (); + void setLayoutManager (Object arg0); + CGSize preferredFrameSize (); + void setNeedsLayout (); + void layoutIfNeeded (); + void layoutSublayers (); + void resizeSublayersWithOldSize (CGSize size); + void resizeWithOldSuperlayerSize (CGSize size); + static ICAAction defaultActionForKey (NSString event); + ICAAction actionForKey (NSString event); + void addAnimation (CAAnimation anim, NSString key); + void removeAllAnimations (); + void removeAnimationForKey (NSString key); + CAAnimation animationForKey (NSString key); + Object delegate_ (); + void setDelegate (Object arg0); + void runActionForKey (NSString event, Object anObject, NSDictionary dict); +} + +const TCALayerDelegate = ` + + void displayLayer (CALayer layer) + { + return invokeObjcSelf!(void, "displayLayer:", CALayer)(layer); + } + + void drawLayer (CALayer layer, CGContextRef ctx) + { + return invokeObjcSelf!(void, "drawLayer:inContext:", CALayer, CGContextRef)(layer, ctx); + } + + ICAAction actionForLayer (CALayer layer, NSString event) + { + return invokeObjcSelf!(ICAAction, "actionForLayer:forKey:", CALayer, NSString)(layer, event); + } + + //mixin ObjcBindMethod!(displayLayer, "displayLayer:"); + //mixin ObjcBindMethod!(drawLayer, "drawLayer:inContext:"); + //mixin ObjcBindMethod!(actionForLayer, "actionForLayer:forKey:"); + +`; + +const TCALayoutManager = ` + + CGSize preferredSizeOfLayer (CALayer layer) + { + return invokeObjcSelf!(CGSize, "preferredSizeOfLayer:", CALayer)(layer); + } + + void invalidateLayoutOfLayer (CALayer layer) + { + return invokeObjcSelf!(void, "invalidateLayoutOfLayer:", CALayer)(layer); + } + + void layoutSublayersOfLayer (CALayer layer) + { + return invokeObjcSelf!(void, "layoutSublayersOfLayer:", CALayer)(layer); + } + + //mixin ObjcBindMethod!(preferredSizeOfLayer, "preferredSizeOfLayer:"); + //mixin ObjcBindMethod!(invalidateLayoutOfLayer, "invalidateLayoutOfLayer:"); + //mixin ObjcBindMethod!(layoutSublayersOfLayer, "layoutSublayersOfLayer:"); + +`; + diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CALayer_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CALayer_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,34 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CALayer_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package const id kCAGravityCenter; + package const id kCAGravityTop; + package const id kCAGravityBottom; + package const id kCAGravityLeft; + package const id kCAGravityRight; + package const id kCAGravityTopLeft; + package const id kCAGravityTopRight; + package const id kCAGravityBottomLeft; + package const id kCAGravityBottomRight; + package const id kCAGravityResize; + package const id kCAGravityResizeAspect; + package const id kCAGravityResizeAspectFill; + package const id kCAFilterLinear; + package const id kCAFilterNearest; + package const id kCAOnOrderIn; + package const id kCAOnOrderOut; + package const id kCATransition; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CAMediaTiming.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CAMediaTiming.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,86 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CAMediaTiming; + +import dstep.corefoundation.CFDate; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.quartzcore.CABase; + +import bindings = dstep.quartzcore.CAMediaTiming_bindings; + +private +{ + NSString kCAFillModeForwards_; + NSString kCAFillModeBackwards_; + NSString kCAFillModeBoth_; + NSString kCAFillModeRemoved_; +} + +NSString kCAFillModeForwards () +{ + if (kCAFillModeForwards_) + return kCAFillModeForwards_; + + return kCAFillModeForwards_ = new NSString(bindings.kCAFillModeForwards); +} + +NSString kCAFillModeBackwards () +{ + if (kCAFillModeBackwards_) + return kCAFillModeBackwards_; + + return kCAFillModeBackwards_ = new NSString(bindings.kCAFillModeBackwards); +} + +NSString kCAFillModeBoth () +{ + if (kCAFillModeBoth_) + return kCAFillModeBoth_; + + return kCAFillModeBoth_ = new NSString(bindings.kCAFillModeBoth); +} + +NSString kCAFillModeRemoved () +{ + if (kCAFillModeRemoved_) + return kCAFillModeRemoved_; + + return kCAFillModeRemoved_ = new NSString(bindings.kCAFillModeRemoved); +} + +interface ICAMediaTiming +{ + CFTimeInterval beginTime (); + void beginTime (CFTimeInterval time); + alias beginTime setBeginTime; + + CFTimeInterval duration (); + void duration (CFTimeInterval time); + alias duration setDuration; + + float speed (); + void speed (float f); + alias speed setSpeed; + + CFTimeInterval timeOffset (); + void timeOffset (CFTimeInterval time); + alias timeOffset setTimeOffset; + + float repeatCount (); + void repeatCount (float count); + alias repeatCount setRepeatCount; + + CFTimeInterval repeatDuration (); + void repeatDuration (CFTimeInterval time); + alias repeatDuration setRepeatCount; + + NSString fillMode (); + void fillMode (NSString mode); + alias fillMode setFillMode; +} diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CAMediaTimingFunction.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CAMediaTimingFunction.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,99 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CAMediaTimingFunction; + +import dstep.foundation.NSArray; +import dstep.foundation.NSCoder; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.quartzcore.CAMediaTiming; + +import bindings = dstep.quartzcore.CAMediaTimingFunction_bindings; + +private +{ + NSString kCAMediaTimingFunctionLinear_; + NSString kCAMediaTimingFunctionEaseIn_; + NSString kCAMediaTimingFunctionEaseOut_; + NSString kCAMediaTimingFunctionEaseInEaseOut_; +} + +NSString kCAMediaTimingFunctionLinear () +{ + if (kCAMediaTimingFunctionLinear_) + return kCAMediaTimingFunctionLinear_; + + return kCAMediaTimingFunctionLinear_ = new NSString(bindings.kCAMediaTimingFunctionLinear); +} + +NSString kCAMediaTimingFunctionEaseIn () +{ + if (kCAMediaTimingFunctionEaseIn_) + return kCAMediaTimingFunctionEaseIn_; + + return kCAMediaTimingFunctionEaseIn_ = new NSString(bindings.kCAMediaTimingFunctionEaseIn); +} + +NSString kCAMediaTimingFunctionEaseOut () +{ + if (kCAMediaTimingFunctionEaseOut_) + return kCAMediaTimingFunctionEaseOut_; + + return kCAMediaTimingFunctionEaseOut_ = new NSString(bindings.kCAMediaTimingFunctionEaseOut); +} + +NSString kCAMediaTimingFunctionEaseInEaseOut () +{ + if (kCAMediaTimingFunctionEaseInEaseOut_) + return kCAMediaTimingFunctionEaseInEaseOut_; + + return kCAMediaTimingFunctionEaseInEaseOut_ = new NSString(bindings.kCAMediaTimingFunctionEaseInEaseOut); +} + +class CAMediaTimingFunction : NSObject, INSCoding +{ + mixin (ObjcWrap); + + static Object functionWithName (NSString name) + { + return invokeObjcSelfClass!(Object, "functionWithName:", NSString)(name); + } + + static Object functionWithControlPoints (float c1x, float c1y, float c2x, float c2y) + { + return invokeObjcSelfClass!(Object, "functionWithControlPoints::::", float, float, float, float)(c1x, c1y, c2x, c2y); + } + + CAMediaTimingFunction initWithControlPoints (float c1x, float c1y, float c2x, float c2y) + { + id result = invokeObjcSelf!(id, "initWithControlPoints::::", float, float, float, float)(c1x, c1y, c2x, c2y); + return result is this.objcObject ? this : (result !is null ? new CAMediaTimingFunction(result) : null); + } + + this (float c1x, float c1y, float c2x, float c2y) + { + super(CAMediaTimingFunction.alloc.initWithControlPoints(c1x, c1y, c2x, c2y).objcObject); + } + + /*void getControlPointAtIndex (size_t idx, float[2] ptr) + { + return invokeObjcSelf!(void, "getControlPointAtIndex:values:", size_t, float[2])(idx, ptr.ptr); + }*/ + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + CAMediaTimingFunction initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(CAMediaTimingFunction, "initWithCoder:", NSCoder)(aDecoder); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CAMediaTimingFunction_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CAMediaTimingFunction_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,21 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CAMediaTimingFunction_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package const id kCAMediaTimingFunctionLinear; + package const id kCAMediaTimingFunctionEaseIn; + package const id kCAMediaTimingFunctionEaseOut; + package const id kCAMediaTimingFunctionEaseInEaseOut; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CAMediaTiming_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CAMediaTiming_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,21 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CAMediaTiming_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package const id kCAFillModeForwards; + package const id kCAFillModeBackwards; + package const id kCAFillModeBoth; + package const id kCAFillModeRemoved; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CAOpenGLLayer.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CAOpenGLLayer.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,61 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CAOpenGLLayer; + +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.opengl.OpenGL; +import dstep.quartzcore.CALayer; +import dstep.quartzcore.CVBase; + +class CAOpenGLLayer : CALayer +{ + mixin (ObjcWrap); + + bool isAsynchronous () + { + return invokeObjcSelf!(bool, "isAsynchronous"); + } + + void setAsynchronous (bool arg0) + { + return invokeObjcSelf!(void, "setAsynchronous:", bool)(arg0); + } + + alias setAsynchronous isAsynchronous; + + bool canDrawInCGLContext (CGLContextObj ctx, CGLPixelFormatObj pf, double t, CVTimeStamp* ts) + { + return invokeObjcSelf!(bool, "canDrawInCGLContext:pixelFormat:forLayerTime:displayTime:", CGLContextObj, CGLPixelFormatObj, double, CVTimeStamp*)(ctx, pf, t, ts); + } + + void drawInCGLContext (CGLContextObj ctx, CGLPixelFormatObj pf, double t, CVTimeStamp* ts) + { + return invokeObjcSelf!(void, "drawInCGLContext:pixelFormat:forLayerTime:displayTime:", CGLContextObj, CGLPixelFormatObj, double, CVTimeStamp*)(ctx, pf, t, ts); + } + + CGLPixelFormatObj copyCGLPixelFormatForDisplayMask (uint mask) + { + return invokeObjcSelf!(CGLPixelFormatObj, "copyCGLPixelFormatForDisplayMask:", uint)(mask); + } + + void releaseCGLPixelFormat (CGLPixelFormatObj pf) + { + return invokeObjcSelf!(void, "releaseCGLPixelFormat:", CGLPixelFormatObj)(pf); + } + + CGLContextObj copyCGLContextForPixelFormat (CGLPixelFormatObj pf) + { + return invokeObjcSelf!(CGLContextObj, "copyCGLContextForPixelFormat:", CGLPixelFormatObj)(pf); + } + + void releaseCGLContext (CGLContextObj ctx) + { + return invokeObjcSelf!(void, "releaseCGLContext:", CGLContextObj)(ctx); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CARenderer.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CARenderer.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,70 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CARenderer; + +import dstep.applicationservices.coregraphics.CGGeometry; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.quartzcore.CABase; +import dstep.quartzcore.CALayer; +import dstep.quartzcore.CIContext; +import dstep.quartzcore.CVBase; + +class CARenderer : NSObject +{ + mixin (ObjcWrap); + + static CARenderer rendererWithCGLContext (void* ctx, NSDictionary dict) + { + return invokeObjcSelfClass!(CARenderer, "rendererWithCGLContext:options:", void*, NSDictionary)(ctx, dict); + } + + CGRect bounds () + { + return invokeObjcSelf!(CGRect, "bounds"); + } + + void setBounds (CGRect arg0) + { + return invokeObjcSelf!(void, "setBounds:", CGRect)(arg0); + } + + alias setBounds bounds; + + void beginFrameAtTime (double t, CVTimeStamp* ts) + { + return invokeObjcSelf!(void, "beginFrameAtTime:timeStamp:", double, CVTimeStamp*)(t, ts); + } + + CGRect updateBounds () + { + return invokeObjcSelf!(CGRect, "updateBounds"); + } + + void addUpdateRect (CGRect r) + { + return invokeObjcSelf!(void, "addUpdateRect:", CGRect)(r); + } + + void render () + { + return invokeObjcSelf!(void, "render"); + } + + double nextFrameTime () + { + return invokeObjcSelf!(double, "nextFrameTime"); + } + + void endFrame () + { + return invokeObjcSelf!(void, "endFrame"); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CAScrollLayer.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CAScrollLayer.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,95 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CAScrollLayer; + +import dstep.applicationservices.coregraphics.CGBase; +import dstep.applicationservices.coregraphics.CGGeometry; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.quartzcore.CALayer; + +import bindings = dstep.quartzcore.CAScrollLayer_bindings; + +private +{ + NSString kCAScrollNone_; + NSString kCAScrollVertically_; + NSString kCAScrollHorizontally_; + NSString kCAScrollBoth_; +} + +NSString kCAScrollNone () +{ + if (kCAScrollNone_) + return kCAScrollNone_; + + return kCAScrollNone_ = new NSString(bindings.kCAScrollNone); +} + +NSString kCAScrollVertically () +{ + if (kCAScrollVertically_) + return kCAScrollVertically_; + + return kCAScrollVertically_ = new NSString(bindings.kCAScrollVertically); +} + +NSString kCAScrollHorizontally () +{ + if (kCAScrollHorizontally_) + return kCAScrollHorizontally_; + + return kCAScrollHorizontally_ = new NSString(bindings.kCAScrollHorizontally); +} + +NSString kCAScrollBoth () +{ + if (kCAScrollBoth_) + return kCAScrollBoth_; + + return kCAScrollBoth_ = new NSString(bindings.kCAScrollBoth); +} + +class CAScrollLayer : CALayer +{ + mixin (ObjcWrap); + + void scrollToPoint (CGPoint p) + { + return invokeObjcSelf!(void, "scrollToPoint:", CGPoint)(p); + } + + void scrollToRect (CGRect r) + { + return invokeObjcSelf!(void, "scrollToRect:", CGRect)(r); + } +} + +const TCALayerScrolling = ` + + void scrollPoint (CGPoint p) + { + return invokeObjcSelf!(void, "scrollPoint:", CGPoint)(p); + } + + void scrollRectToVisible (CGRect r) + { + return invokeObjcSelf!(void, "scrollRectToVisible:", CGRect)(r); + } + + CGRect visibleRect () + { + return invokeObjcSelf!(CGRect, "visibleRect"); + } + + //mixin ObjcBindMethod!(scrollPoint, "scrollPoint:"); + //mixin ObjcBindMethod!(scrollRectToVisible, "scrollRectToVisible:"); + //mixin ObjcBindMethod!(visibleRect, "visibleRect"); + +`; + diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CAScrollLayer_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CAScrollLayer_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,21 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CAScrollLayer_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package const id kCAScrollNone; + package const id kCAScrollVertically; + package const id kCAScrollHorizontally; + package const id kCAScrollBoth; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CATextLayer.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CATextLayer.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,100 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CATextLayer; + +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.quartzcore.CALayer; + +import bindings = dstep.quartzcore.CATextLayer_bindings; + +private +{ + NSString kCATruncationNone_; + NSString kCATruncationStart_; + NSString kCATruncationEnd_; + NSString kCATruncationMiddle_; + NSString kCAAlignmentNatural_; + NSString kCAAlignmentLeft_; + NSString kCAAlignmentRight_; + NSString kCAAlignmentCenter_; + NSString kCAAlignmentJustified_; +} + +NSString kCATruncationNone () +{ + if (kCATruncationNone_) + return kCATruncationNone_; + + return kCATruncationNone_ = new NSString(bindings.kCATruncationNone); +} + +NSString kCATruncationStart () +{ + if (kCATruncationStart_) + return kCATruncationStart_; + + return kCATruncationStart_ = new NSString(bindings.kCATruncationStart); +} + +NSString kCATruncationEnd () +{ + if (kCATruncationEnd_) + return kCATruncationEnd_; + + return kCATruncationEnd_ = new NSString(bindings.kCATruncationEnd); +} + +NSString kCATruncationMiddle () +{ + if (kCATruncationMiddle_) + return kCATruncationMiddle_; + + return kCATruncationMiddle_ = new NSString(bindings.kCATruncationMiddle); +} + +NSString kCAAlignmentNatural () +{ + if (kCAAlignmentNatural_) + return kCAAlignmentNatural_; + + return kCAAlignmentNatural_ = new NSString(bindings.kCAAlignmentNatural); +} + +NSString kCAAlignmentLeft () +{ + if (kCAAlignmentLeft_) + return kCAAlignmentLeft_; + + return kCAAlignmentLeft_ = new NSString(bindings.kCAAlignmentLeft); +} + +NSString kCAAlignmentRight () +{ + if (kCAAlignmentRight_) + return kCAAlignmentRight_; + + return kCAAlignmentRight_ = new NSString(bindings.kCAAlignmentRight); +} + +NSString kCAAlignmentCenter () +{ + if (kCAAlignmentCenter_) + return kCAAlignmentCenter_; + + return kCAAlignmentCenter_ = new NSString(bindings.kCAAlignmentCenter); +} + +NSString kCAAlignmentJustified () +{ + if (kCAAlignmentJustified_) + return kCAAlignmentJustified_; + + return kCAAlignmentJustified_ = new NSString(bindings.kCAAlignmentJustified); +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CATextLayer_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CATextLayer_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,26 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CATextLayer_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package const id kCATruncationNone; + package const id kCATruncationStart; + package const id kCATruncationEnd; + package const id kCATruncationMiddle; + package const id kCAAlignmentNatural; + package const id kCAAlignmentLeft; + package const id kCAAlignmentRight; + package const id kCAAlignmentCenter; + package const id kCAAlignmentJustified; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CATiledLayer.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CATiledLayer.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,59 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CATiledLayer; + +import dstep.applicationservices.coregraphics.CGGeometry; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.quartzcore.CALayer; + +class CATiledLayer : CALayer +{ + mixin (ObjcWrap); + + static double fadeDuration () + { + return invokeObjcSelfClass!(double, "fadeDuration"); + } + + uint levelsOfDetail () + { + return invokeObjcSelf!(uint, "levelsOfDetail"); + } + + void setLevelsOfDetail (uint arg0) + { + return invokeObjcSelf!(void, "setLevelsOfDetail:", uint)(arg0); + } + + alias setLevelsOfDetail levelsOfDetail; + + uint levelsOfDetailBias () + { + return invokeObjcSelf!(uint, "levelsOfDetailBias"); + } + + void setLevelsOfDetailBias (uint arg0) + { + return invokeObjcSelf!(void, "setLevelsOfDetailBias:", uint)(arg0); + } + + alias setLevelsOfDetailBias levelsOfDetailBias; + + CGSize tileSize () + { + return invokeObjcSelf!(CGSize, "tileSize"); + } + + void setTileSize (CGSize arg0) + { + return invokeObjcSelf!(void, "setTileSize:", CGSize)(arg0); + } + + alias setTileSize tileSize; +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CATransaction.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CATransaction.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,68 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CATransaction; + +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.quartzcore.CABase; + +import bindings = dstep.quartzcore.CATransaction_bindings; + +private +{ + NSString kCATransactionAnimationDuration_; + NSString kCATransactionDisableActions_; +} + +NSString kCATransactionAnimationDuration () +{ + if (kCATransactionAnimationDuration_) + return kCATransactionAnimationDuration_; + + return kCATransactionAnimationDuration_ = new NSString(bindings.kCATransactionAnimationDuration); +} + +NSString kCATransactionDisableActions () +{ + if (kCATransactionDisableActions_) + return kCATransactionDisableActions_; + + return kCATransactionDisableActions_ = new NSString(bindings.kCATransactionDisableActions); +} + +class CATransaction : NSObject +{ + mixin (ObjcWrap); + + static void begin () + { + return invokeObjcSelfClass!(void, "begin"); + } + + static void commit () + { + return invokeObjcSelfClass!(void, "commit"); + } + + static void flush () + { + return invokeObjcSelfClass!(void, "flush"); + } + + static Object valueForKey (NSString key) + { + return invokeObjcSelfClass!(Object, "valueForKey:", NSString)(key); + } + + static void setValue (Object anObject, NSString key) + { + return invokeObjcSelfClass!(void, "setValue:forKey:", Object, NSString)(anObject, key); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CATransaction_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CATransaction_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,19 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CATransaction_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package const id kCATransactionAnimationDuration; + package const id kCATransactionDisableActions; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CATransform3D.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CATransform3D.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,60 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CATransform3D; + +import dstep.applicationservices.coregraphics.CGAffineTransform; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.applicationservices.coregraphics.CGGeometry; +import dstep.foundation.NSValue; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.quartzcore.CABase; + +extern (C) +{ + extern + { + const CATransform3D CATransform3DIdentity; + } +} + +struct CATransform3D +{ + CGFloat m11; + CGFloat m12; + CGFloat m13; + CGFloat m14; + CGFloat m21; + CGFloat m22; + CGFloat m23; + CGFloat m24; + CGFloat m31; + CGFloat m32; + CGFloat m33; + CGFloat m34; + CGFloat m41; + CGFloat m42; + CGFloat m43; + CGFloat m44; +} + +extern (C) +{ + bool CATransform3DIsIdentity (CATransform3D t); + bool CATransform3DEqualToTransform (CATransform3D a, CATransform3D b); + CATransform3D CATransform3DMakeTranslation (CGFloat tx, CGFloat ty, CGFloat tz); + CATransform3D CATransform3DMakeScale (CGFloat sx, CGFloat sy, CGFloat sz); + CATransform3D CATransform3DMakeRotation (CGFloat angle, CGFloat x, CGFloat y, CGFloat z); + CATransform3D CATransform3DTranslate (CATransform3D t, CGFloat tx, CGFloat ty, CGFloat tz); + CATransform3D CATransform3DScale (CATransform3D t, CGFloat sx, CGFloat sy, CGFloat sz); + CATransform3D CATransform3DRotate (CATransform3D t, CGFloat angle, CGFloat x, CGFloat y, CGFloat z); + CATransform3D CATransform3DConcat (CATransform3D a, CATransform3D b); + CATransform3D CATransform3DInvert (CATransform3D t); + CATransform3D CATransform3DMakeAffineTransform (CGAffineTransform m); + bool CATransform3DIsAffine (CATransform3D t); + CGAffineTransform CATransform3DGetAffineTransform (CATransform3D t); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CIColor.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CIColor.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,121 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CIColor; + +import dstep.applicationservices.coregraphics.CGBase; +import dstep.applicationservices.coregraphics.CGColor; +import dstep.applicationservices.coregraphics.CGColorSpace; +import dstep.foundation.NSCoder; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.quartzcore.CIVector; + +class CIColor : NSObject, INSCoding, INSCopying +{ + mixin (ObjcWrap); + + typeof(this) copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); + } + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + typeof(this) copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); + } + + static CIColor colorWithCGColor (CGColorRef c) + { + return invokeObjcSelfClass!(CIColor, "colorWithCGColor:", CGColorRef)(c); + } + + static CIColor colorWithRed (CGFloat r, CGFloat g, CGFloat b, CGFloat a) + { + return invokeObjcSelfClass!(CIColor, "colorWithRed:green:blue:alpha:", CGFloat, CGFloat, CGFloat, CGFloat)(r, g, b, a); + } + + static CIColor colorWithRed (CGFloat r, CGFloat g, CGFloat b) + { + return invokeObjcSelfClass!(CIColor, "colorWithRed:green:blue:", CGFloat, CGFloat, CGFloat)(r, g, b); + } + + static CIColor colorWithString (NSString representation) + { + return invokeObjcSelfClass!(CIColor, "colorWithString:", NSString)(representation); + } + + CIColor initWithCGColor (CGColorRef c) + { + id result = invokeObjcSelf!(id, "initWithCGColor:", CGColorRef)(c); + return result is this.objcObject ? this : (result !is null ? new CIColor(result) : null); + } + + this (CGColorRef c) + { + super(CIColor.alloc.initWithCGColor(c).objcObject); + } + + uint numberOfComponents () + { + return invokeObjcSelf!(uint, "numberOfComponents"); + } + + CGFloat* components () + { + return invokeObjcSelf!(CGFloat*, "components"); + } + + CGFloat alpha () + { + return invokeObjcSelf!(CGFloat, "alpha"); + } + + CGColorSpaceRef colorSpace () + { + return invokeObjcSelf!(CGColorSpaceRef, "colorSpace"); + } + + CGFloat red () + { + return invokeObjcSelf!(CGFloat, "red"); + } + + CGFloat green () + { + return invokeObjcSelf!(CGFloat, "green"); + } + + CGFloat blue () + { + return invokeObjcSelf!(CGFloat, "blue"); + } + + NSString stringRepresentation () + { + return invokeObjcSelf!(NSString, "stringRepresentation"); + } + +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CIContext.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CIContext.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,112 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CIContext; + +import dstep.appkit.NSOpenGL; +import dstep.applicationservices.coregraphics.CGColorSpace; +import dstep.applicationservices.coregraphics.CGContext; +import dstep.applicationservices.coregraphics.CGGeometry; +import dstep.applicationservices.coregraphics.CGImage; +import dstep.applicationservices.coregraphics.CGLayer; +import dstep.corefoundation.CFDictionary; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.opengl.CGLTypes; +import dstep.quartzcore.CIFilter; +import dstep.quartzcore.CIImage; + +import bindings = dstep.quartzcore.CIContext_bindings; + +private +{ + NSString kCIContextOutputColorSpace_; + NSString kCIContextWorkingColorSpace_; + NSString kCIContextUseSoftwareRenderer_; +} + +NSString kCIContextOutputColorSpace () +{ + if (kCIContextOutputColorSpace_) + return kCIContextOutputColorSpace_; + + return kCIContextOutputColorSpace_ = new NSString(bindings.kCIContextOutputColorSpace); +} + +NSString kCIContextWorkingColorSpace () +{ + if (kCIContextWorkingColorSpace_) + return kCIContextWorkingColorSpace_; + + return kCIContextWorkingColorSpace_ = new NSString(bindings.kCIContextWorkingColorSpace); +} + +NSString kCIContextUseSoftwareRenderer () +{ + if (kCIContextUseSoftwareRenderer_) + return kCIContextUseSoftwareRenderer_; + + return kCIContextUseSoftwareRenderer_ = new NSString(bindings.kCIContextUseSoftwareRenderer); +} + +class CIContext : NSObject +{ + mixin (ObjcWrap); + + static CIContext contextWithCGLContext (CGLContextObj ctx, CGLPixelFormatObj pf, NSDictionary dict) + { + return invokeObjcSelfClass!(CIContext, "contextWithCGLContext:pixelFormat:options:", CGLContextObj, CGLPixelFormatObj, NSDictionary)(ctx, pf, dict); + } + + static CIContext contextWithCGContext (CGContextRef ctx, NSDictionary dict) + { + return invokeObjcSelfClass!(CIContext, "contextWithCGContext:options:", CGContextRef, NSDictionary)(ctx, dict); + } + + void drawImage (CIImage im, CGPoint p, CGRect src) + { + return invokeObjcSelf!(void, "drawImage:atPoint:fromRect:", CIImage, CGPoint, CGRect)(im, p, src); + } + + void drawImage (CIImage im, CGRect dest, CGRect src) + { + return invokeObjcSelf!(void, "drawImage:inRect:fromRect:", CIImage, CGRect, CGRect)(im, dest, src); + } + + CGImageRef createCGImage (CIImage im, CGRect r) + { + return invokeObjcSelf!(CGImageRef, "createCGImage:fromRect:", CIImage, CGRect)(im, r); + } + + CGImageRef createCGImage (CIImage im, CGRect r, int f, CGColorSpaceRef cs) + { + return invokeObjcSelf!(CGImageRef, "createCGImage:fromRect:format:colorSpace:", CIImage, CGRect, int, CGColorSpaceRef)(im, r, f, cs); + } + + CGLayerRef createCGLayerWithSize (CGSize size, CFDictionaryRef d) + { + return invokeObjcSelf!(CGLayerRef, "createCGLayerWithSize:info:", CGSize, CFDictionaryRef)(size, d); + } + + void render (CIImage im, void* data, int rb, CGRect r, int f, CGColorSpaceRef cs) + { + return invokeObjcSelf!(void, "render:toBitmap:rowBytes:bounds:format:colorSpace:", CIImage, void*, int, CGRect, int, CGColorSpaceRef)(im, data, rb, r, f, cs); + } + + void reclaimResources () + { + return invokeObjcSelf!(void, "reclaimResources"); + } + + void clearCaches () + { + return invokeObjcSelf!(void, "clearCaches"); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CIContext_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CIContext_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,20 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CIContext_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package id kCIContextOutputColorSpace; + package id kCIContextWorkingColorSpace; + package id kCIContextUseSoftwareRenderer; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CIFilter.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CIFilter.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,954 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CIFilter; + +import dstep.foundation.NSArray; +import dstep.foundation.NSCoder; +import dstep.foundation.NSData; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSURL; +import dstep.foundation.NSZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.quartzcore.CACIFilterAdditions; +import dstep.quartzcore.CIImage; +import dstep.quartzcore.CIKernel; +import dstep.quartzcore.CIRAWFilter; + +import bindings = dstep.quartzcore.CIFilter_bindings; + +private +{ + NSString kCIAttributeFilterName_; + NSString kCIAttributeFilterDisplayName_; + NSString kCIAttributeDescription_; + NSString kCIAttributeReferenceDocumentation_; + NSString kCIAttributeFilterCategories_; + NSString kCIAttributeClass_; + NSString kCIAttributeType_; + NSString kCIAttributeMin_; + NSString kCIAttributeMax_; + NSString kCIAttributeSliderMin_; + NSString kCIAttributeSliderMax_; + NSString kCIAttributeDefault_; + NSString kCIAttributeIdentity_; + NSString kCIAttributeName_; + NSString kCIAttributeDisplayName_; + NSString kCIUIParameterSet_; + NSString kCIUISetBasic_; + NSString kCIUISetIntermediate_; + NSString kCIUISetAdvanced_; + NSString kCIUISetDevelopment_; + NSString kCIAttributeTypeTime_; + NSString kCIAttributeTypeScalar_; + NSString kCIAttributeTypeDistance_; + NSString kCIAttributeTypeAngle_; + NSString kCIAttributeTypeBoolean_; + NSString kCIAttributeTypeInteger_; + NSString kCIAttributeTypeCount_; + NSString kCIAttributeTypePosition_; + NSString kCIAttributeTypeOffset_; + NSString kCIAttributeTypePosition3_; + NSString kCIAttributeTypeRectangle_; + NSString kCIAttributeTypeOpaqueColor_; + NSString kCIAttributeTypeGradient_; + NSString kCICategoryDistortionEffect_; + NSString kCICategoryGeometryAdjustment_; + NSString kCICategoryCompositeOperation_; + NSString kCICategoryHalftoneEffect_; + NSString kCICategoryColorAdjustment_; + NSString kCICategoryColorEffect_; + NSString kCICategoryTransition_; + NSString kCICategoryTileEffect_; + NSString kCICategoryGenerator_; + NSString kCICategoryReduction_; + NSString kCICategoryGradient_; + NSString kCICategoryStylize_; + NSString kCICategorySharpen_; + NSString kCICategoryBlur_; + NSString kCICategoryVideo_; + NSString kCICategoryStillImage_; + NSString kCICategoryInterlaced_; + NSString kCICategoryNonSquarePixels_; + NSString kCICategoryHighDynamicRange_; + NSString kCICategoryBuiltIn_; + NSString kCICategoryFilterGenerator_; + NSString kCIApplyOptionExtent_; + NSString kCIApplyOptionDefinition_; + NSString kCIApplyOptionUserInfo_; + NSString kCIOutputImageKey_; + NSString kCIInputBackgroundImageKey_; + NSString kCIInputImageKey_; + NSString kCIInputTimeKey_; + NSString kCIInputTransformKey_; + NSString kCIInputScaleKey_; + NSString kCIInputAspectRatioKey_; + NSString kCIInputCenterKey_; + NSString kCIInputRadiusKey_; + NSString kCIInputAngleKey_; + NSString kCIInputRefractionKey_; + NSString kCIInputWidthKey_; + NSString kCIInputSharpnessKey_; + NSString kCIInputIntensityKey_; + NSString kCIInputEVKey_; + NSString kCIInputSaturationKey_; + NSString kCIInputColorKey_; + NSString kCIInputBrightnessKey_; + NSString kCIInputContrastKey_; + NSString kCIInputGradientImageKey_; + NSString kCIInputMaskImageKey_; + NSString kCIInputShadingImageKey_; + NSString kCIInputTargetImageKey_; + NSString kCIInputExtentKey_; +} + +NSString kCIAttributeFilterName () +{ + if (kCIAttributeFilterName_) + return kCIAttributeFilterName_; + + return kCIAttributeFilterName_ = new NSString(bindings.kCIAttributeFilterName); +} + +NSString kCIAttributeFilterDisplayName () +{ + if (kCIAttributeFilterDisplayName_) + return kCIAttributeFilterDisplayName_; + + return kCIAttributeFilterDisplayName_ = new NSString(bindings.kCIAttributeFilterDisplayName); +} + +NSString kCIAttributeDescription () +{ + if (kCIAttributeDescription_) + return kCIAttributeDescription_; + + return kCIAttributeDescription_ = new NSString(bindings.kCIAttributeDescription); +} + +NSString kCIAttributeReferenceDocumentation () +{ + if (kCIAttributeReferenceDocumentation_) + return kCIAttributeReferenceDocumentation_; + + return kCIAttributeReferenceDocumentation_ = new NSString(bindings.kCIAttributeReferenceDocumentation); +} + +NSString kCIAttributeFilterCategories () +{ + if (kCIAttributeFilterCategories_) + return kCIAttributeFilterCategories_; + + return kCIAttributeFilterCategories_ = new NSString(bindings.kCIAttributeFilterCategories); +} + +NSString kCIAttributeClass () +{ + if (kCIAttributeClass_) + return kCIAttributeClass_; + + return kCIAttributeClass_ = new NSString(bindings.kCIAttributeClass); +} + +NSString kCIAttributeType () +{ + if (kCIAttributeType_) + return kCIAttributeType_; + + return kCIAttributeType_ = new NSString(bindings.kCIAttributeType); +} + +NSString kCIAttributeMin () +{ + if (kCIAttributeMin_) + return kCIAttributeMin_; + + return kCIAttributeMin_ = new NSString(bindings.kCIAttributeMin); +} + +NSString kCIAttributeMax () +{ + if (kCIAttributeMax_) + return kCIAttributeMax_; + + return kCIAttributeMax_ = new NSString(bindings.kCIAttributeMax); +} + +NSString kCIAttributeSliderMin () +{ + if (kCIAttributeSliderMin_) + return kCIAttributeSliderMin_; + + return kCIAttributeSliderMin_ = new NSString(bindings.kCIAttributeSliderMin); +} + +NSString kCIAttributeSliderMax () +{ + if (kCIAttributeSliderMax_) + return kCIAttributeSliderMax_; + + return kCIAttributeSliderMax_ = new NSString(bindings.kCIAttributeSliderMax); +} + +NSString kCIAttributeDefault () +{ + if (kCIAttributeDefault_) + return kCIAttributeDefault_; + + return kCIAttributeDefault_ = new NSString(bindings.kCIAttributeDefault); +} + +NSString kCIAttributeIdentity () +{ + if (kCIAttributeIdentity_) + return kCIAttributeIdentity_; + + return kCIAttributeIdentity_ = new NSString(bindings.kCIAttributeIdentity); +} + +NSString kCIAttributeName () +{ + if (kCIAttributeName_) + return kCIAttributeName_; + + return kCIAttributeName_ = new NSString(bindings.kCIAttributeName); +} + +NSString kCIAttributeDisplayName () +{ + if (kCIAttributeDisplayName_) + return kCIAttributeDisplayName_; + + return kCIAttributeDisplayName_ = new NSString(bindings.kCIAttributeDisplayName); +} + +NSString kCIUIParameterSet () +{ + if (kCIUIParameterSet_) + return kCIUIParameterSet_; + + return kCIUIParameterSet_ = new NSString(bindings.kCIUIParameterSet); +} + +NSString kCIUISetBasic () +{ + if (kCIUISetBasic_) + return kCIUISetBasic_; + + return kCIUISetBasic_ = new NSString(bindings.kCIUISetBasic); +} + +NSString kCIUISetIntermediate () +{ + if (kCIUISetIntermediate_) + return kCIUISetIntermediate_; + + return kCIUISetIntermediate_ = new NSString(bindings.kCIUISetIntermediate); +} + +NSString kCIUISetAdvanced () +{ + if (kCIUISetAdvanced_) + return kCIUISetAdvanced_; + + return kCIUISetAdvanced_ = new NSString(bindings.kCIUISetAdvanced); +} + +NSString kCIUISetDevelopment () +{ + if (kCIUISetDevelopment_) + return kCIUISetDevelopment_; + + return kCIUISetDevelopment_ = new NSString(bindings.kCIUISetDevelopment); +} + +NSString kCIAttributeTypeTime () +{ + if (kCIAttributeTypeTime_) + return kCIAttributeTypeTime_; + + return kCIAttributeTypeTime_ = new NSString(bindings.kCIAttributeTypeTime); +} + +NSString kCIAttributeTypeScalar () +{ + if (kCIAttributeTypeScalar_) + return kCIAttributeTypeScalar_; + + return kCIAttributeTypeScalar_ = new NSString(bindings.kCIAttributeTypeScalar); +} + +NSString kCIAttributeTypeDistance () +{ + if (kCIAttributeTypeDistance_) + return kCIAttributeTypeDistance_; + + return kCIAttributeTypeDistance_ = new NSString(bindings.kCIAttributeTypeDistance); +} + +NSString kCIAttributeTypeAngle () +{ + if (kCIAttributeTypeAngle_) + return kCIAttributeTypeAngle_; + + return kCIAttributeTypeAngle_ = new NSString(bindings.kCIAttributeTypeAngle); +} + +NSString kCIAttributeTypeBoolean () +{ + if (kCIAttributeTypeBoolean_) + return kCIAttributeTypeBoolean_; + + return kCIAttributeTypeBoolean_ = new NSString(bindings.kCIAttributeTypeBoolean); +} + +NSString kCIAttributeTypeInteger () +{ + if (kCIAttributeTypeInteger_) + return kCIAttributeTypeInteger_; + + return kCIAttributeTypeInteger_ = new NSString(bindings.kCIAttributeTypeInteger); +} + +NSString kCIAttributeTypeCount () +{ + if (kCIAttributeTypeCount_) + return kCIAttributeTypeCount_; + + return kCIAttributeTypeCount_ = new NSString(bindings.kCIAttributeTypeCount); +} + +NSString kCIAttributeTypePosition () +{ + if (kCIAttributeTypePosition_) + return kCIAttributeTypePosition_; + + return kCIAttributeTypePosition_ = new NSString(bindings.kCIAttributeTypePosition); +} + +NSString kCIAttributeTypeOffset () +{ + if (kCIAttributeTypeOffset_) + return kCIAttributeTypeOffset_; + + return kCIAttributeTypeOffset_ = new NSString(bindings.kCIAttributeTypeOffset); +} + +NSString kCIAttributeTypePosition3 () +{ + if (kCIAttributeTypePosition3_) + return kCIAttributeTypePosition3_; + + return kCIAttributeTypePosition3_ = new NSString(bindings.kCIAttributeTypePosition3); +} + +NSString kCIAttributeTypeRectangle () +{ + if (kCIAttributeTypeRectangle_) + return kCIAttributeTypeRectangle_; + + return kCIAttributeTypeRectangle_ = new NSString(bindings.kCIAttributeTypeRectangle); +} + +NSString kCIAttributeTypeOpaqueColor () +{ + if (kCIAttributeTypeOpaqueColor_) + return kCIAttributeTypeOpaqueColor_; + + return kCIAttributeTypeOpaqueColor_ = new NSString(bindings.kCIAttributeTypeOpaqueColor); +} + +NSString kCIAttributeTypeGradient () +{ + if (kCIAttributeTypeGradient_) + return kCIAttributeTypeGradient_; + + return kCIAttributeTypeGradient_ = new NSString(bindings.kCIAttributeTypeGradient); +} + +NSString kCICategoryDistortionEffect () +{ + if (kCICategoryDistortionEffect_) + return kCICategoryDistortionEffect_; + + return kCICategoryDistortionEffect_ = new NSString(bindings.kCICategoryDistortionEffect); +} + +NSString kCICategoryGeometryAdjustment () +{ + if (kCICategoryGeometryAdjustment_) + return kCICategoryGeometryAdjustment_; + + return kCICategoryGeometryAdjustment_ = new NSString(bindings.kCICategoryGeometryAdjustment); +} + +NSString kCICategoryCompositeOperation () +{ + if (kCICategoryCompositeOperation_) + return kCICategoryCompositeOperation_; + + return kCICategoryCompositeOperation_ = new NSString(bindings.kCICategoryCompositeOperation); +} + +NSString kCICategoryHalftoneEffect () +{ + if (kCICategoryHalftoneEffect_) + return kCICategoryHalftoneEffect_; + + return kCICategoryHalftoneEffect_ = new NSString(bindings.kCICategoryHalftoneEffect); +} + +NSString kCICategoryColorAdjustment () +{ + if (kCICategoryColorAdjustment_) + return kCICategoryColorAdjustment_; + + return kCICategoryColorAdjustment_ = new NSString(bindings.kCICategoryColorAdjustment); +} + +NSString kCICategoryColorEffect () +{ + if (kCICategoryColorEffect_) + return kCICategoryColorEffect_; + + return kCICategoryColorEffect_ = new NSString(bindings.kCICategoryColorEffect); +} + +NSString kCICategoryTransition () +{ + if (kCICategoryTransition_) + return kCICategoryTransition_; + + return kCICategoryTransition_ = new NSString(bindings.kCICategoryTransition); +} + +NSString kCICategoryTileEffect () +{ + if (kCICategoryTileEffect_) + return kCICategoryTileEffect_; + + return kCICategoryTileEffect_ = new NSString(bindings.kCICategoryTileEffect); +} + +NSString kCICategoryGenerator () +{ + if (kCICategoryGenerator_) + return kCICategoryGenerator_; + + return kCICategoryGenerator_ = new NSString(bindings.kCICategoryGenerator); +} + +NSString kCICategoryReduction () +{ + if (kCICategoryReduction_) + return kCICategoryReduction_; + + return kCICategoryReduction_ = new NSString(bindings.kCICategoryReduction); +} + +NSString kCICategoryGradient () +{ + if (kCICategoryGradient_) + return kCICategoryGradient_; + + return kCICategoryGradient_ = new NSString(bindings.kCICategoryGradient); +} + +NSString kCICategoryStylize () +{ + if (kCICategoryStylize_) + return kCICategoryStylize_; + + return kCICategoryStylize_ = new NSString(bindings.kCICategoryStylize); +} + +NSString kCICategorySharpen () +{ + if (kCICategorySharpen_) + return kCICategorySharpen_; + + return kCICategorySharpen_ = new NSString(bindings.kCICategorySharpen); +} + +NSString kCICategoryBlur () +{ + if (kCICategoryBlur_) + return kCICategoryBlur_; + + return kCICategoryBlur_ = new NSString(bindings.kCICategoryBlur); +} + +NSString kCICategoryVideo () +{ + if (kCICategoryVideo_) + return kCICategoryVideo_; + + return kCICategoryVideo_ = new NSString(bindings.kCICategoryVideo); +} + +NSString kCICategoryStillImage () +{ + if (kCICategoryStillImage_) + return kCICategoryStillImage_; + + return kCICategoryStillImage_ = new NSString(bindings.kCICategoryStillImage); +} + +NSString kCICategoryInterlaced () +{ + if (kCICategoryInterlaced_) + return kCICategoryInterlaced_; + + return kCICategoryInterlaced_ = new NSString(bindings.kCICategoryInterlaced); +} + +NSString kCICategoryNonSquarePixels () +{ + if (kCICategoryNonSquarePixels_) + return kCICategoryNonSquarePixels_; + + return kCICategoryNonSquarePixels_ = new NSString(bindings.kCICategoryNonSquarePixels); +} + +NSString kCICategoryHighDynamicRange () +{ + if (kCICategoryHighDynamicRange_) + return kCICategoryHighDynamicRange_; + + return kCICategoryHighDynamicRange_ = new NSString(bindings.kCICategoryHighDynamicRange); +} + +NSString kCICategoryBuiltIn () +{ + if (kCICategoryBuiltIn_) + return kCICategoryBuiltIn_; + + return kCICategoryBuiltIn_ = new NSString(bindings.kCICategoryBuiltIn); +} + +NSString kCICategoryFilterGenerator () +{ + if (kCICategoryFilterGenerator_) + return kCICategoryFilterGenerator_; + + return kCICategoryFilterGenerator_ = new NSString(bindings.kCICategoryFilterGenerator); +} + +NSString kCIApplyOptionExtent () +{ + if (kCIApplyOptionExtent_) + return kCIApplyOptionExtent_; + + return kCIApplyOptionExtent_ = new NSString(bindings.kCIApplyOptionExtent); +} + +NSString kCIApplyOptionDefinition () +{ + if (kCIApplyOptionDefinition_) + return kCIApplyOptionDefinition_; + + return kCIApplyOptionDefinition_ = new NSString(bindings.kCIApplyOptionDefinition); +} + +NSString kCIApplyOptionUserInfo () +{ + if (kCIApplyOptionUserInfo_) + return kCIApplyOptionUserInfo_; + + return kCIApplyOptionUserInfo_ = new NSString(bindings.kCIApplyOptionUserInfo); +} + +NSString kCIOutputImageKey () +{ + if (kCIOutputImageKey_) + return kCIOutputImageKey_; + + return kCIOutputImageKey_ = new NSString(bindings.kCIOutputImageKey); +} + +NSString kCIInputBackgroundImageKey () +{ + if (kCIInputBackgroundImageKey_) + return kCIInputBackgroundImageKey_; + + return kCIInputBackgroundImageKey_ = new NSString(bindings.kCIInputBackgroundImageKey); +} + +NSString kCIInputImageKey () +{ + if (kCIInputImageKey_) + return kCIInputImageKey_; + + return kCIInputImageKey_ = new NSString(bindings.kCIInputImageKey); +} + +NSString kCIInputTimeKey () +{ + if (kCIInputTimeKey_) + return kCIInputTimeKey_; + + return kCIInputTimeKey_ = new NSString(bindings.kCIInputTimeKey); +} + +NSString kCIInputTransformKey () +{ + if (kCIInputTransformKey_) + return kCIInputTransformKey_; + + return kCIInputTransformKey_ = new NSString(bindings.kCIInputTransformKey); +} + +NSString kCIInputScaleKey () +{ + if (kCIInputScaleKey_) + return kCIInputScaleKey_; + + return kCIInputScaleKey_ = new NSString(bindings.kCIInputScaleKey); +} + +NSString kCIInputAspectRatioKey () +{ + if (kCIInputAspectRatioKey_) + return kCIInputAspectRatioKey_; + + return kCIInputAspectRatioKey_ = new NSString(bindings.kCIInputAspectRatioKey); +} + +NSString kCIInputCenterKey () +{ + if (kCIInputCenterKey_) + return kCIInputCenterKey_; + + return kCIInputCenterKey_ = new NSString(bindings.kCIInputCenterKey); +} + +NSString kCIInputRadiusKey () +{ + if (kCIInputRadiusKey_) + return kCIInputRadiusKey_; + + return kCIInputRadiusKey_ = new NSString(bindings.kCIInputRadiusKey); +} + +NSString kCIInputAngleKey () +{ + if (kCIInputAngleKey_) + return kCIInputAngleKey_; + + return kCIInputAngleKey_ = new NSString(bindings.kCIInputAngleKey); +} + +NSString kCIInputRefractionKey () +{ + if (kCIInputRefractionKey_) + return kCIInputRefractionKey_; + + return kCIInputRefractionKey_ = new NSString(bindings.kCIInputRefractionKey); +} + +NSString kCIInputWidthKey () +{ + if (kCIInputWidthKey_) + return kCIInputWidthKey_; + + return kCIInputWidthKey_ = new NSString(bindings.kCIInputWidthKey); +} + +NSString kCIInputSharpnessKey () +{ + if (kCIInputSharpnessKey_) + return kCIInputSharpnessKey_; + + return kCIInputSharpnessKey_ = new NSString(bindings.kCIInputSharpnessKey); +} + +NSString kCIInputIntensityKey () +{ + if (kCIInputIntensityKey_) + return kCIInputIntensityKey_; + + return kCIInputIntensityKey_ = new NSString(bindings.kCIInputIntensityKey); +} + +NSString kCIInputEVKey () +{ + if (kCIInputEVKey_) + return kCIInputEVKey_; + + return kCIInputEVKey_ = new NSString(bindings.kCIInputEVKey); +} + +NSString kCIInputSaturationKey () +{ + if (kCIInputSaturationKey_) + return kCIInputSaturationKey_; + + return kCIInputSaturationKey_ = new NSString(bindings.kCIInputSaturationKey); +} + +NSString kCIInputColorKey () +{ + if (kCIInputColorKey_) + return kCIInputColorKey_; + + return kCIInputColorKey_ = new NSString(bindings.kCIInputColorKey); +} + +NSString kCIInputBrightnessKey () +{ + if (kCIInputBrightnessKey_) + return kCIInputBrightnessKey_; + + return kCIInputBrightnessKey_ = new NSString(bindings.kCIInputBrightnessKey); +} + +NSString kCIInputContrastKey () +{ + if (kCIInputContrastKey_) + return kCIInputContrastKey_; + + return kCIInputContrastKey_ = new NSString(bindings.kCIInputContrastKey); +} + +NSString kCIInputGradientImageKey () +{ + if (kCIInputGradientImageKey_) + return kCIInputGradientImageKey_; + + return kCIInputGradientImageKey_ = new NSString(bindings.kCIInputGradientImageKey); +} + +NSString kCIInputMaskImageKey () +{ + if (kCIInputMaskImageKey_) + return kCIInputMaskImageKey_; + + return kCIInputMaskImageKey_ = new NSString(bindings.kCIInputMaskImageKey); +} + +NSString kCIInputShadingImageKey () +{ + if (kCIInputShadingImageKey_) + return kCIInputShadingImageKey_; + + return kCIInputShadingImageKey_ = new NSString(bindings.kCIInputShadingImageKey); +} + +NSString kCIInputTargetImageKey () +{ + if (kCIInputTargetImageKey_) + return kCIInputTargetImageKey_; + + return kCIInputTargetImageKey_ = new NSString(bindings.kCIInputTargetImageKey); +} + +NSString kCIInputExtentKey () +{ + if (kCIInputExtentKey_) + return kCIInputExtentKey_; + + return kCIInputExtentKey_ = new NSString(bindings.kCIInputExtentKey); +} + +const TCIFilterRegistry = ` + + static CIFilter filterWithName (NSString name) + { + return invokeObjcSelfClass!(CIFilter, "filterWithName:", NSString)(name); + } + + static CIFilter filterWithName_keysAndValues (ARGS...) (NSString name, ARGS args) + { + return invokeObjcSelfClass!(CIFilter, "filterWithName:keysAndValues:", NSString, ARGS)(name, args); + } + + static NSArray filterNamesInCategory (NSString category) + { + return invokeObjcSelfClass!(NSArray, "filterNamesInCategory:", NSString)(category); + } + + static NSArray filterNamesInCategories (NSArray categories) + { + return invokeObjcSelfClass!(NSArray, "filterNamesInCategories:", NSArray)(categories); + } + + static void registerFilterName (NSString name, Object anObject, NSDictionary attributes) + { + return invokeObjcSelfClass!(void, "registerFilterName:constructor:classAttributes:", NSString, Object, NSDictionary)(name, anObject, attributes); + } + + static NSString localizedNameForFilterName (NSString filterName) + { + return invokeObjcSelfClass!(NSString, "localizedNameForFilterName:", NSString)(filterName); + } + + static NSString localizedNameForCategory (NSString category) + { + return invokeObjcSelfClass!(NSString, "localizedNameForCategory:", NSString)(category); + } + + static NSString localizedDescriptionForFilterName (NSString filterName) + { + return invokeObjcSelfClass!(NSString, "localizedDescriptionForFilterName:", NSString)(filterName); + } + + static NSURL localizedReferenceDocumentationForFilterName (NSString filterName) + { + return invokeObjcSelfClass!(NSURL, "localizedReferenceDocumentationForFilterName:", NSString)(filterName); + } + + //mixin ObjcBindClassMethod!(filterWithName, "filterWithName:"); + ////mixin ObjcBindClassMethod!(filterWithName_keysAndValues, "filterWithName:keysAndValues:"); + //mixin ObjcBindClassMethod!(filterNamesInCategory, "filterNamesInCategory:"); + //mixin ObjcBindClassMethod!(filterNamesInCategories, "filterNamesInCategories:"); + //mixin ObjcBindClassMethod!(registerFilterName, "registerFilterName:constructor:classAttributes:"); + //mixin ObjcBindClassMethod!(localizedNameForFilterName, "localizedNameForFilterName:"); + //mixin ObjcBindClassMethod!(localizedNameForCategory, "localizedNameForCategory:"); + //mixin ObjcBindClassMethod!(localizedDescriptionForFilterName, "localizedDescriptionForFilterName:"); + //mixin ObjcBindClassMethod!(localizedReferenceDocumentationForFilterName, "localizedReferenceDocumentationForFilterName:"); + +`; + + +class CIFilter : NSObject, INSCoding, INSCopying +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + typeof(this) copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); + } + + NSArray inputKeys () + { + return invokeObjcSelf!(NSArray, "inputKeys"); + } + + NSArray outputKeys () + { + return invokeObjcSelf!(NSArray, "outputKeys"); + } + + void setDefaults () + { + return invokeObjcSelf!(void, "setDefaults"); + } + + NSDictionary attributes () + { + return invokeObjcSelf!(NSDictionary, "attributes"); + } + + CIImage apply (CIKernel k, NSArray args, NSDictionary dict) + { + return invokeObjcSelf!(CIImage, "apply:arguments:options:", CIKernel, NSArray, NSDictionary)(k, args, dict); + } + + /*CIImage apply (CIKernel apply, ...) + { + return invokeObjcSelf!(CIImage, "apply:", CIKernel)(apply); + }*/ + + // CIRAWFilter + static CIFilter filterWithImageURL (NSURL url, NSDictionary options) + { + return invokeObjcSelfClass!(CIFilter, "filterWithImageURL:options:", NSURL, NSDictionary)(url, options); + } + + static CIFilter filterWithImageData (NSData data, NSDictionary options) + { + return invokeObjcSelfClass!(CIFilter, "filterWithImageData:options:", NSData, NSDictionary)(data, options); + } + + // CACIFilterAdditions + NSString name () + { + return invokeObjcSelf!(NSString, "name"); + } + + void name (NSString name) + { + return invokeObjcSelf!(void, "setName:", NSString)(name); + } + + alias name setName; + + bool enabled () + { + return invokeObjcSelf!(bool, "enabled"); + } + + void enabled (bool enabled) + { + return invokeObjcSelf!(void, "setEnabled:", bool)(enabled); + } + + alias enabled setEnabled; + + // CIFilterRegistry + static CIFilter filterWithName (NSString name) + { + return invokeObjcSelfClass!(CIFilter, "filterWithName:", NSString)(name); + } + + static CIFilter filterWithName_keysAndValues (ARGS...) (NSString name, ARGS args) + { + return invokeObjcSelfClass!(CIFilter, "filterWithName:keysAndValues:", NSString, ARGS)(name, args); + } + + static NSArray filterNamesInCategory (NSString category) + { + return invokeObjcSelfClass!(NSArray, "filterNamesInCategory:", NSString)(category); + } + + static NSArray filterNamesInCategories (NSArray categories) + { + return invokeObjcSelfClass!(NSArray, "filterNamesInCategories:", NSArray)(categories); + } + + static void registerFilterName (NSString name, Object anObject, NSDictionary attributes) + { + return invokeObjcSelfClass!(void, "registerFilterName:constructor:classAttributes:", NSString, Object, NSDictionary)(name, anObject, attributes); + } + + static NSString localizedNameForFilterName (NSString filterName) + { + return invokeObjcSelfClass!(NSString, "localizedNameForFilterName:", NSString)(filterName); + } + + static NSString localizedNameForCategory (NSString category) + { + return invokeObjcSelfClass!(NSString, "localizedNameForCategory:", NSString)(category); + } + + static NSString localizedDescriptionForFilterName (NSString filterName) + { + return invokeObjcSelfClass!(NSString, "localizedDescriptionForFilterName:", NSString)(filterName); + } + + static NSURL localizedReferenceDocumentationForFilterName (NSString filterName) + { + return invokeObjcSelfClass!(NSURL, "localizedReferenceDocumentationForFilterName:", NSString)(filterName); + } +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CIFilterGenerator.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CIFilterGenerator.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,153 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CIFilterGenerator; + +import dstep.foundation.NSCoder; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSURL; +import dstep.foundation.NSZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.quartzcore.CIFilter; + +import bindings = dstep.quartzcore.CIFilterGenerator_bindings; + +private +{ + NSString kCIFilterGeneratorExportedKey_; + NSString kCIFilterGeneratorExportedKeyTargetObject_; + NSString kCIFilterGeneratorExportedKeyName_; +} + +NSString kCIFilterGeneratorExportedKey () +{ + if (kCIFilterGeneratorExportedKey_) + return kCIFilterGeneratorExportedKey_; + + return kCIFilterGeneratorExportedKey_ = new NSString(bindings.kCIFilterGeneratorExportedKey); +} + +NSString kCIFilterGeneratorExportedKeyTargetObject () +{ + if (kCIFilterGeneratorExportedKeyTargetObject_) + return kCIFilterGeneratorExportedKeyTargetObject_; + + return kCIFilterGeneratorExportedKeyTargetObject_ = new NSString(bindings.kCIFilterGeneratorExportedKeyTargetObject); +} + +NSString kCIFilterGeneratorExportedKeyName () +{ + if (kCIFilterGeneratorExportedKeyName_) + return kCIFilterGeneratorExportedKeyName_; + + return kCIFilterGeneratorExportedKeyName_ = new NSString(bindings.kCIFilterGeneratorExportedKeyName); +} + +class CIFilterGenerator : NSObject, INSCoding, INSCopying +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + typeof(this) copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); + } + + static CIFilterGenerator filterGenerator () + { + return invokeObjcSelfClass!(CIFilterGenerator, "filterGenerator"); + } + + static CIFilterGenerator filterGeneratorWithContentsOfURL (NSURL aURL) + { + return invokeObjcSelfClass!(CIFilterGenerator, "filterGeneratorWithContentsOfURL:", NSURL)(aURL); + } + + CIFilterGenerator initWithContentsOfURL (NSURL aURL) + { + id result = invokeObjcSelf!(id, "initWithContentsOfURL:", NSURL)(aURL); + return result is this.objcObject ? this : (result !is null ? new CIFilterGenerator(result) : null); + } + + this (NSURL aURL) + { + super(CIFilterGenerator.alloc.initWithContentsOfURL(aURL).objcObject); + } + + void connectObject (Object sourceObject, NSString sourceKey, Object targetObject, NSString targetKey) + { + return invokeObjcSelf!(void, "connectObject:withKey:toObject:withKey:", Object, NSString, Object, NSString)(sourceObject, sourceKey, targetObject, targetKey); + } + + void disconnectObject (Object sourceObject, NSString key, Object targetObject, NSString targetKey) + { + return invokeObjcSelf!(void, "disconnectObject:withKey:toObject:withKey:", Object, NSString, Object, NSString)(sourceObject, key, targetObject, targetKey); + } + + void exportKey (NSString key, Object targetObject, NSString exportedKeyName) + { + return invokeObjcSelf!(void, "exportKey:fromObject:withName:", NSString, Object, NSString)(key, targetObject, exportedKeyName); + } + + void removeExportedKey (NSString exportedKeyName) + { + return invokeObjcSelf!(void, "removeExportedKey:", NSString)(exportedKeyName); + } + + NSDictionary exportedKeys () + { + return invokeObjcSelf!(NSDictionary, "exportedKeys"); + } + + void setAttributes (NSDictionary attributes, NSString key) + { + return invokeObjcSelf!(void, "setAttributes:forExportedKey:", NSDictionary, NSString)(attributes, key); + } + + NSDictionary classAttributes () + { + return invokeObjcSelf!(NSDictionary, "classAttributes"); + } + + void setClassAttributes (NSDictionary attributes) + { + return invokeObjcSelf!(void, "setClassAttributes:", NSDictionary)(attributes); + } + + CIFilter filter () + { + return invokeObjcSelf!(CIFilter, "filter"); + } + + void registerFilterName (NSString name) + { + return invokeObjcSelf!(void, "registerFilterName:", NSString)(name); + } + + bool writeToURL (NSURL aURL, bool flag) + { + return invokeObjcSelf!(bool, "writeToURL:atomically:", NSURL, bool)(aURL, flag); + } + +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CIFilterGenerator_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CIFilterGenerator_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,20 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CIFilterGenerator_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package const id kCIFilterGeneratorExportedKey; + package const id kCIFilterGeneratorExportedKeyTargetObject; + package const id kCIFilterGeneratorExportedKeyName; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CIFilterShape.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CIFilterShape.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,77 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CIFilterShape; + +import dstep.applicationservices.ApplicationServices; +import dstep.foundation.NSObject; +import dstep.foundation.NSZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class CIFilterShape : NSObject, INSCopying +{ + mixin (ObjcWrap); + + typeof(this) copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); + } + + static Object shapeWithRect (CGRect r) + { + return invokeObjcSelfClass!(Object, "shapeWithRect:", CGRect)(r); + } + + CIFilterShape initWithRect (CGRect r) + { + id result = invokeObjcSelf!(id, "initWithRect:", CGRect)(r); + return result is this.objcObject ? this : (result !is null ? new CIFilterShape(result) : null); + } + + this (CGRect r) + { + super(CIFilterShape.alloc.initWithRect(r).objcObject); + } + + CIFilterShape transformBy (CGAffineTransform m, bool flag) + { + id result = invokeObjcSelf!(id, "transformBy:interior:", CGAffineTransform, bool)(m, flag); + return result is this.objcObject ? this : (result !is null ? new CIFilterShape(result) : null); + } + + CIFilterShape insetByX (int dx, int dy) + { + id result = invokeObjcSelf!(id, "insetByX:Y:", int, int)(dx, dy); + return result is this.objcObject ? this : (result !is null ? new CIFilterShape(result) : null); + } + + CIFilterShape unionWith (CIFilterShape s2) + { + id result = invokeObjcSelf!(id, "unionWith:", CIFilterShape)(s2); + return result is this.objcObject ? this : (result !is null ? new CIFilterShape(result) : null); + } + + CIFilterShape unionWithRect (CGRect r) + { + id result = invokeObjcSelf!(id, "unionWithRect:", CGRect)(r); + return result is this.objcObject ? this : (result !is null ? new CIFilterShape(result) : null); + } + + CIFilterShape intersectWith (CIFilterShape s2) + { + id result = invokeObjcSelf!(id, "intersectWith:", CIFilterShape)(s2); + return result is this.objcObject ? this : (result !is null ? new CIFilterShape(result) : null); + } + + CIFilterShape intersectWithRect (CGRect r) + { + id result = invokeObjcSelf!(id, "intersectWithRect:", CGRect)(r); + return result is this.objcObject ? this : (result !is null ? new CIFilterShape(result) : null); + } + +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CIFilter_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CIFilter_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,98 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CIFilter_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package id kCIAttributeFilterName; + package id kCIAttributeFilterDisplayName; + package id kCIAttributeDescription; + package id kCIAttributeReferenceDocumentation; + package id kCIAttributeFilterCategories; + package id kCIAttributeClass; + package id kCIAttributeType; + package id kCIAttributeMin; + package id kCIAttributeMax; + package id kCIAttributeSliderMin; + package id kCIAttributeSliderMax; + package id kCIAttributeDefault; + package id kCIAttributeIdentity; + package id kCIAttributeName; + package id kCIAttributeDisplayName; + package id kCIUIParameterSet; + package id kCIUISetBasic; + package id kCIUISetIntermediate; + package id kCIUISetAdvanced; + package id kCIUISetDevelopment; + package id kCIAttributeTypeTime; + package id kCIAttributeTypeScalar; + package id kCIAttributeTypeDistance; + package id kCIAttributeTypeAngle; + package id kCIAttributeTypeBoolean; + package id kCIAttributeTypeInteger; + package id kCIAttributeTypeCount; + package id kCIAttributeTypePosition; + package id kCIAttributeTypeOffset; + package id kCIAttributeTypePosition3; + package id kCIAttributeTypeRectangle; + package id kCIAttributeTypeOpaqueColor; + package id kCIAttributeTypeGradient; + package id kCICategoryDistortionEffect; + package id kCICategoryGeometryAdjustment; + package id kCICategoryCompositeOperation; + package id kCICategoryHalftoneEffect; + package id kCICategoryColorAdjustment; + package id kCICategoryColorEffect; + package id kCICategoryTransition; + package id kCICategoryTileEffect; + package id kCICategoryGenerator; + package id kCICategoryReduction; + package id kCICategoryGradient; + package id kCICategoryStylize; + package id kCICategorySharpen; + package id kCICategoryBlur; + package id kCICategoryVideo; + package id kCICategoryStillImage; + package id kCICategoryInterlaced; + package id kCICategoryNonSquarePixels; + package id kCICategoryHighDynamicRange; + package id kCICategoryBuiltIn; + package id kCICategoryFilterGenerator; + package id kCIApplyOptionExtent; + package id kCIApplyOptionDefinition; + package id kCIApplyOptionUserInfo; + package id kCIOutputImageKey; + package id kCIInputBackgroundImageKey; + package id kCIInputImageKey; + package id kCIInputTimeKey; + package id kCIInputTransformKey; + package id kCIInputScaleKey; + package id kCIInputAspectRatioKey; + package id kCIInputCenterKey; + package id kCIInputRadiusKey; + package id kCIInputAngleKey; + package id kCIInputRefractionKey; + package id kCIInputWidthKey; + package id kCIInputSharpnessKey; + package id kCIInputIntensityKey; + package id kCIInputEVKey; + package id kCIInputSaturationKey; + package id kCIInputColorKey; + package id kCIInputBrightnessKey; + package id kCIInputContrastKey; + package id kCIInputGradientImageKey; + package id kCIInputMaskImageKey; + package id kCIInputShadingImageKey; + package id kCIInputTargetImageKey; + package id kCIInputExtentKey; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CIImage.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CIImage.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,334 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CIImage; + +import dstep.applicationservices.ApplicationServices; +import dstep.corevideo.CVImageBuffer; +import dstep.foundation.NSCoder; +import dstep.foundation.NSData; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSURL; +import dstep.foundation.NSZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.quartzcore.CIColor; +import dstep.quartzcore.CIContext; +import dstep.quartzcore.CIFilterShape; +import dstep.quartzcore.CIImageProvider; + +import bindings = dstep.quartzcore.CIImage_bindings; + +alias int CIFormat; + +extern (C) +{ + extern + { + int kCIFormatARGB8; + int kCIFormatRGBA16; + int kCIFormatRGBAf; + } +} + +private +{ + NSString kCIImageColorSpace_; +} + +NSString kCIImageColorSpace () +{ + if (kCIImageColorSpace_) + return kCIImageColorSpace_; + + return kCIImageColorSpace_ = new NSString(bindings.kCIImageColorSpace); +} + +class CIImage : NSObject, INSCoding, INSCopying +{ + mixin (ObjcWrap); + + typeof(this) copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); + } + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + typeof(this) copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); + } + + static CIImage imageWithCGImage (CGImageRef image) + { + return invokeObjcSelfClass!(CIImage, "imageWithCGImage:", CGImageRef)(image); + } + + static CIImage imageWithCGImage (CGImageRef image, NSDictionary d) + { + return invokeObjcSelfClass!(CIImage, "imageWithCGImage:options:", CGImageRef, NSDictionary)(image, d); + } + + static CIImage imageWithCGLayer (CGLayerRef layer) + { + return invokeObjcSelfClass!(CIImage, "imageWithCGLayer:", CGLayerRef)(layer); + } + + static CIImage imageWithCGLayer (CGLayerRef layer, NSDictionary d) + { + return invokeObjcSelfClass!(CIImage, "imageWithCGLayer:options:", CGLayerRef, NSDictionary)(layer, d); + } + + static CIImage imageWithBitmapData (NSData d, uint bpr, CGSize size, int f, CGColorSpaceRef cs) + { + return invokeObjcSelfClass!(CIImage, "imageWithBitmapData:bytesPerRow:size:format:colorSpace:", NSData, uint, CGSize, int, CGColorSpaceRef)(d, bpr, size, f, cs); + } + + static CIImage imageWithTexture (uint name, CGSize size, bool flag, CGColorSpaceRef cs) + { + return invokeObjcSelfClass!(CIImage, "imageWithTexture:size:flipped:colorSpace:", uint, CGSize, bool, CGColorSpaceRef)(name, size, flag, cs); + } + + static CIImage imageWithContentsOfURL (NSURL url) + { + return invokeObjcSelfClass!(CIImage, "imageWithContentsOfURL:", NSURL)(url); + } + + static CIImage imageWithContentsOfURL (NSURL url, NSDictionary d) + { + return invokeObjcSelfClass!(CIImage, "imageWithContentsOfURL:options:", NSURL, NSDictionary)(url, d); + } + + static CIImage imageWithData (NSData data) + { + return invokeObjcSelfClass!(CIImage, "imageWithData:", NSData)(data); + } + + static CIImage imageWithData (NSData data, NSDictionary d) + { + return invokeObjcSelfClass!(CIImage, "imageWithData:options:", NSData, NSDictionary)(data, d); + } + + static CIImage imageWithCVImageBuffer (CVImageBufferRef imageBuffer) + { + return invokeObjcSelfClass!(CIImage, "imageWithCVImageBuffer:", CVImageBufferRef)(imageBuffer); + } + + static CIImage imageWithCVImageBuffer (CVImageBufferRef imageBuffer, NSDictionary dict) + { + return invokeObjcSelfClass!(CIImage, "imageWithCVImageBuffer:options:", CVImageBufferRef, NSDictionary)(imageBuffer, dict); + } + + static CIImage imageWithColor (CIColor color) + { + return invokeObjcSelfClass!(CIImage, "imageWithColor:", CIColor)(color); + } + + static CIImage emptyImage () + { + return invokeObjcSelfClass!(CIImage, "emptyImage"); + } + + CIImage initWithCGImage (CGImageRef image) + { + id result = invokeObjcSelf!(id, "initWithCGImage:", CGImageRef)(image); + return result is this.objcObject ? this : (result !is null ? new CIImage(result) : null); + } + + this (CGImageRef image) + { + super(CIImage.alloc.initWithCGImage(image).objcObject); + } + + CIImage initWithCGImage (CGImageRef image, NSDictionary d) + { + id result = invokeObjcSelf!(id, "initWithCGImage:options:", CGImageRef, NSDictionary)(image, d); + return result is this.objcObject ? this : (result !is null ? new CIImage(result) : null); + } + + this (CGImageRef image, NSDictionary d) + { + super(CIImage.alloc.initWithCGImage(image, d).objcObject); + } + + CIImage initWithCGLayer (CGLayerRef layer) + { + id result = invokeObjcSelf!(id, "initWithCGLayer:", CGLayerRef)(layer); + return result is this.objcObject ? this : (result !is null ? new CIImage(result) : null); + } + + this (CGLayerRef layer) + { + super(CIImage.alloc.initWithCGLayer(layer).objcObject); + } + + CIImage initWithCGLayer (CGLayerRef layer, NSDictionary d) + { + id result = invokeObjcSelf!(id, "initWithCGLayer:options:", CGLayerRef, NSDictionary)(layer, d); + return result is this.objcObject ? this : (result !is null ? new CIImage(result) : null); + } + + this (CGLayerRef layer, NSDictionary d) + { + super(CIImage.alloc.initWithCGLayer(layer, d).objcObject); + } + + CIImage initWithData (NSData data) + { + id result = invokeObjcSelf!(id, "initWithData:", NSData)(data); + return result is this.objcObject ? this : (result !is null ? new CIImage(result) : null); + } + + this (NSData data) + { + super(CIImage.alloc.initWithData(data).objcObject); + } + + CIImage initWithData (NSData data, NSDictionary d) + { + id result = invokeObjcSelf!(id, "initWithData:options:", NSData, NSDictionary)(data, d); + return result is this.objcObject ? this : (result !is null ? new CIImage(result) : null); + } + + this (NSData data, NSDictionary d) + { + super(CIImage.alloc.initWithData(data, d).objcObject); + } + + CIImage initWithBitmapData (NSData d, uint bpr, CGSize size, int f, CGColorSpaceRef c) + { + id result = invokeObjcSelf!(id, "initWithBitmapData:bytesPerRow:size:format:colorSpace:", NSData, uint, CGSize, int, CGColorSpaceRef)(d, bpr, size, f, c); + return result is this.objcObject ? this : (result !is null ? new CIImage(result) : null); + } + + this (NSData d, uint bpr, CGSize size, int f, CGColorSpaceRef c) + { + super(CIImage.alloc.initWithBitmapData(d, bpr, size, f, c).objcObject); + } + + CIImage initWithTexture (uint name, CGSize size, bool flag, CGColorSpaceRef cs) + { + id result = invokeObjcSelf!(id, "initWithTexture:size:flipped:colorSpace:", uint, CGSize, bool, CGColorSpaceRef)(name, size, flag, cs); + return result is this.objcObject ? this : (result !is null ? new CIImage(result) : null); + } + + this (uint name, CGSize size, bool flag, CGColorSpaceRef cs) + { + super(CIImage.alloc.initWithTexture(name, size, flag, cs).objcObject); + } + + CIImage initWithContentsOfURL (NSURL url) + { + id result = invokeObjcSelf!(id, "initWithContentsOfURL:", NSURL)(url); + return result is this.objcObject ? this : (result !is null ? new CIImage(result) : null); + } + + this (NSURL url) + { + super(CIImage.alloc.initWithContentsOfURL(url).objcObject); + } + + CIImage initWithContentsOfURL (NSURL url, NSDictionary d) + { + id result = invokeObjcSelf!(id, "initWithContentsOfURL:options:", NSURL, NSDictionary)(url, d); + return result is this.objcObject ? this : (result !is null ? new CIImage(result) : null); + } + + this (NSURL url, NSDictionary d) + { + super(CIImage.alloc.initWithContentsOfURL(url, d).objcObject); + } + + CIImage initWithCVImageBuffer (CVImageBufferRef imageBuffer) + { + id result = invokeObjcSelf!(id, "initWithCVImageBuffer:", CVImageBufferRef)(imageBuffer); + return result is this.objcObject ? this : (result !is null ? new CIImage(result) : null); + } + + this (CVImageBufferRef imageBuffer) + { + super(CIImage.alloc.initWithCVImageBuffer(imageBuffer).objcObject); + } + + CIImage initWithCVImageBuffer (CVImageBufferRef imageBuffer, NSDictionary dict) + { + id result = invokeObjcSelf!(id, "initWithCVImageBuffer:options:", CVImageBufferRef, NSDictionary)(imageBuffer, dict); + return result is this.objcObject ? this : (result !is null ? new CIImage(result) : null); + } + + this (CVImageBufferRef imageBuffer, NSDictionary dict) + { + super(CIImage.alloc.initWithCVImageBuffer(imageBuffer, dict).objcObject); + } + + CIImage initWithColor (CIColor color) + { + id result = invokeObjcSelf!(id, "initWithColor:", CIColor)(color); + return result is this.objcObject ? this : (result !is null ? new CIImage(result) : null); + } + + this (CIColor color) + { + super(CIImage.alloc.initWithColor(color).objcObject); + } + + CIImage imageByApplyingTransform (CGAffineTransform matrix) + { + id result = invokeObjcSelf!(id, "imageByApplyingTransform:", CGAffineTransform)(matrix); + return result is this.objcObject ? this : (result !is null ? new CIImage(result) : null); + } + + CIImage imageByCroppingToRect (CGRect r) + { + id result = invokeObjcSelf!(id, "imageByCroppingToRect:", CGRect)(r); + return result is this.objcObject ? this : (result !is null ? new CIImage(result) : null); + } + + CGRect extent () + { + return invokeObjcSelf!(CGRect, "extent"); + } + + CIFilterShape definition () + { + return invokeObjcSelf!(CIFilterShape, "definition"); + } + + // CIImageProvider + static CIImage imageWithImageProvider (Object p, size_t width, size_t height, CIFormat f, CGColorSpaceRef cs, NSDictionary dict) + { + return invokeObjcSelfClass!(CIImage, "imageWithImageProvider:size::format:colorSpace:options:", Object, size_t, size_t, CIFormat, CGColorSpaceRef, NSDictionary)(p, width, height, f, cs, dict); + } + + typeof(this) initWithImageProvider (Object p, size_t width, size_t height, CIFormat f, CGColorSpaceRef cs, NSDictionary dict) + { + id result = invokeObjcSelf!(id, "initWithImageProvider:size::format:colorSpace:options:", Object, size_t, size_t, CIFormat, CGColorSpaceRef, NSDictionary)(p, width, height, f, cs, dict); + return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); + } + + this (Object p, size_t width, size_t height, CIFormat f, CGColorSpaceRef cs, NSDictionary dict) + { + super(typeof(this).alloc.initWithImageProvider(p, width, height, f, cs, dict).objcObject); + } + +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CIImageAccumulator.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CIImageAccumulator.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,65 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CIImageAccumulator; + +import dstep.applicationservices.coregraphics.CGGeometry; +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.quartzcore.CIImage; + +class CIImageAccumulator : NSObject +{ + mixin (ObjcWrap); + + static CIImageAccumulator imageAccumulatorWithExtent (CGRect r, int f) + { + return invokeObjcSelfClass!(CIImageAccumulator, "imageAccumulatorWithExtent:format:", CGRect, int)(r, f); + } + + CIImageAccumulator initWithExtent (CGRect r, int f) + { + id result = invokeObjcSelf!(id, "initWithExtent:format:", CGRect, int)(r, f); + return result is this.objcObject ? this : (result !is null ? new CIImageAccumulator(result) : null); + } + + this (CGRect r, int f) + { + super(CIImageAccumulator.alloc.initWithExtent(r, f).objcObject); + } + + CGRect extent () + { + return invokeObjcSelf!(CGRect, "extent"); + } + + int format () + { + return invokeObjcSelf!(int, "format"); + } + + CIImage image () + { + return invokeObjcSelf!(CIImage, "image"); + } + + void setImage (CIImage im) + { + return invokeObjcSelf!(void, "setImage:", CIImage)(im); + } + + void setImage (CIImage im, CGRect r) + { + return invokeObjcSelf!(void, "setImage:dirtyRect:", CIImage, CGRect)(im, r); + } + + void clear () + { + return invokeObjcSelf!(void, "clear"); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CIImageProvider.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CIImageProvider.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,61 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CIImageProvider; + +import dstep.foundation.NSDictionary; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.quartzcore.CIImage; + +import bindings = dstep.quartzcore.CIImageProvider_bindings; + +private +{ + NSString kCIImageProviderTileSize_; + NSString kCIImageProviderUserInfo_; +} + +NSString kCIImageProviderTileSize () +{ + if (kCIImageProviderTileSize_) + return kCIImageProviderTileSize_; + + return kCIImageProviderTileSize_ = new NSString(bindings.kCIImageProviderTileSize); +} + +NSString kCIImageProviderUserInfo () +{ + if (kCIImageProviderUserInfo_) + return kCIImageProviderUserInfo_; + + return kCIImageProviderUserInfo_ = new NSString(bindings.kCIImageProviderUserInfo); +} + +const TCIImageProvider = ` + + static CIImage imageWithImageProvider (Object p, size_t width, size_t height, CIFormat f, CGColorSpaceRef cs, NSDictionary dict) + { + return invokeObjcSelfClass!(CIImage, "imageWithImageProvider:size::format:colorSpace:options:", Object, size_t, size_t, CIFormat, CGColorSpaceRef, NSDictionary)(p, width, height, f, cs, dict); + } + + typeof(this) initWithImageProvider (Object p, size_t width, size_t height, CIFormat f, CGColorSpaceRef cs, NSDictionary dict) + { + id result = invokeObjcSelf!(id, "initWithImageProvider:size::format:colorSpace:options:", Object, size_t, size_t, CIFormat, CGColorSpaceRef, NSDictionary)(p, width, height, f, cs, dict); + return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); + } + + this (Object p, size_t width, size_t height, CIFormat f, CGColorSpaceRef cs, NSDictionary dict) + { + super(typeof(this).alloc.initWithImageProvider(p, width, height, f, cs, dict).objcObject); + } + + //mixin ObjcBindClassMethod!(imageWithImageProvider, "imageWithImageProvider:size::format:colorSpace:options:"); + //mixin ObjcBindMethod!(initWithImageProvider, "initWithImageProvider:size::format:colorSpace:options:"); + +`; + diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CIImageProvider_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CIImageProvider_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,19 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CIImageProvider_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package id kCIImageProviderTileSize; + package id kCIImageProviderUserInfo; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CIImage_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CIImage_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,18 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CIImage_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package id kCIImageColorSpace; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CIKernel.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CIKernel.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,35 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CIKernel; + +import dstep.foundation.NSArray; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.quartzcore.CIImage; + +class CIKernel : NSObject +{ + mixin (ObjcWrap); + + static NSArray kernelsWithString (NSString s) + { + return invokeObjcSelfClass!(NSArray, "kernelsWithString:", NSString)(s); + } + + NSString name () + { + return invokeObjcSelf!(NSString, "name"); + } + + void setROISelector (SEL aMethod) + { + return invokeObjcSelf!(void, "setROISelector:", SEL)(aMethod); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CIPlugIn.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CIPlugIn.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,32 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CIPlugIn; + +import dstep.foundation.Foundation; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class CIPlugIn : NSObject +{ + mixin (ObjcWrap); + + static void loadAllPlugIns () + { + return invokeObjcSelfClass!(void, "loadAllPlugIns"); + } + + static void loadNonExecutablePlugIns () + { + return invokeObjcSelfClass!(void, "loadNonExecutablePlugIns"); + } + + static void loadPlugIn (NSURL url, bool allowNonExecutable) + { + return invokeObjcSelfClass!(void, "loadPlugIn:allowNonExecutable:", NSURL, bool)(url, allowNonExecutable); + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CIPlugInInterface.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CIPlugInInterface.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,11 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CIPlugInInterface;interface ICIPlugInRegistration +{ + bool load (void* host); +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CIRAWFilter.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CIRAWFilter.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,182 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CIRAWFilter; + +import dstep.foundation.NSData; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSString; +import dstep.foundation.NSURL; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.quartzcore.CIRAWFilter_bindings; + +private +{ + NSString kCIInputDecoderVersionKey_; + NSString kCISupportedDecoderVersionsKey_; + NSString kCIInputBoostKey_; + NSString kCIInputNeutralChromaticityXKey_; + NSString kCIInputNeutralChromaticityYKey_; + NSString kCIInputNeutralTemperatureKey_; + NSString kCIInputNeutralTintKey_; + NSString kCIInputNeutralLocationKey_; + NSString kCIInputScaleFactorKey_; + NSString kCIInputAllowDraftModeKey_; + NSString kCIInputIgnoreImageOrientationKey_; + NSString kCIInputImageOrientationKey_; + NSString kCIInputEnableSharpeningKey_; + NSString kCIInputEnableChromaticNoiseTrackingKey_; + NSString kCIInputBoostShadowAmountKey_; + NSString kCIInputBiasKey_; +} + +NSString kCIInputDecoderVersionKey () +{ + if (kCIInputDecoderVersionKey_) + return kCIInputDecoderVersionKey_; + + return kCIInputDecoderVersionKey_ = new NSString(bindings.kCIInputDecoderVersionKey); +} + +NSString kCISupportedDecoderVersionsKey () +{ + if (kCISupportedDecoderVersionsKey_) + return kCISupportedDecoderVersionsKey_; + + return kCISupportedDecoderVersionsKey_ = new NSString(bindings.kCISupportedDecoderVersionsKey); +} + +NSString kCIInputBoostKey () +{ + if (kCIInputBoostKey_) + return kCIInputBoostKey_; + + return kCIInputBoostKey_ = new NSString(bindings.kCIInputBoostKey); +} + +NSString kCIInputNeutralChromaticityXKey () +{ + if (kCIInputNeutralChromaticityXKey_) + return kCIInputNeutralChromaticityXKey_; + + return kCIInputNeutralChromaticityXKey_ = new NSString(bindings.kCIInputNeutralChromaticityXKey); +} + +NSString kCIInputNeutralChromaticityYKey () +{ + if (kCIInputNeutralChromaticityYKey_) + return kCIInputNeutralChromaticityYKey_; + + return kCIInputNeutralChromaticityYKey_ = new NSString(bindings.kCIInputNeutralChromaticityYKey); +} + +NSString kCIInputNeutralTemperatureKey () +{ + if (kCIInputNeutralTemperatureKey_) + return kCIInputNeutralTemperatureKey_; + + return kCIInputNeutralTemperatureKey_ = new NSString(bindings.kCIInputNeutralTemperatureKey); +} + +NSString kCIInputNeutralTintKey () +{ + if (kCIInputNeutralTintKey_) + return kCIInputNeutralTintKey_; + + return kCIInputNeutralTintKey_ = new NSString(bindings.kCIInputNeutralTintKey); +} + +NSString kCIInputNeutralLocationKey () +{ + if (kCIInputNeutralLocationKey_) + return kCIInputNeutralLocationKey_; + + return kCIInputNeutralLocationKey_ = new NSString(bindings.kCIInputNeutralLocationKey); +} + +NSString kCIInputScaleFactorKey () +{ + if (kCIInputScaleFactorKey_) + return kCIInputScaleFactorKey_; + + return kCIInputScaleFactorKey_ = new NSString(bindings.kCIInputScaleFactorKey); +} + +NSString kCIInputAllowDraftModeKey () +{ + if (kCIInputAllowDraftModeKey_) + return kCIInputAllowDraftModeKey_; + + return kCIInputAllowDraftModeKey_ = new NSString(bindings.kCIInputAllowDraftModeKey); +} + +NSString kCIInputIgnoreImageOrientationKey () +{ + if (kCIInputIgnoreImageOrientationKey_) + return kCIInputIgnoreImageOrientationKey_; + + return kCIInputIgnoreImageOrientationKey_ = new NSString(bindings.kCIInputIgnoreImageOrientationKey); +} + +NSString kCIInputImageOrientationKey () +{ + if (kCIInputImageOrientationKey_) + return kCIInputImageOrientationKey_; + + return kCIInputImageOrientationKey_ = new NSString(bindings.kCIInputImageOrientationKey); +} + +NSString kCIInputEnableSharpeningKey () +{ + if (kCIInputEnableSharpeningKey_) + return kCIInputEnableSharpeningKey_; + + return kCIInputEnableSharpeningKey_ = new NSString(bindings.kCIInputEnableSharpeningKey); +} + +NSString kCIInputEnableChromaticNoiseTrackingKey () +{ + if (kCIInputEnableChromaticNoiseTrackingKey_) + return kCIInputEnableChromaticNoiseTrackingKey_; + + return kCIInputEnableChromaticNoiseTrackingKey_ = new NSString(bindings.kCIInputEnableChromaticNoiseTrackingKey); +} + +NSString kCIInputBoostShadowAmountKey () +{ + if (kCIInputBoostShadowAmountKey_) + return kCIInputBoostShadowAmountKey_; + + return kCIInputBoostShadowAmountKey_ = new NSString(bindings.kCIInputBoostShadowAmountKey); +} + +NSString kCIInputBiasKey () +{ + if (kCIInputBiasKey_) + return kCIInputBiasKey_; + + return kCIInputBiasKey_ = new NSString(bindings.kCIInputBiasKey); +} + +const TCIRAWFilter = ` + + static CIFilter filterWithImageURL (NSURL url, NSDictionary options) + { + return invokeObjcSelfClass!(CIFilter, "filterWithImageURL:options:", NSURL, NSDictionary)(url, options); + } + + static CIFilter filterWithImageData (NSData data, NSDictionary options) + { + return invokeObjcSelfClass!(CIFilter, "filterWithImageData:options:", NSData, NSDictionary)(data, options); + } + + //mixin ObjcBindClassMethod!(filterWithImageURL, "filterWithImageURL:options:"); + //mixin ObjcBindClassMethod!(filterWithImageData, "filterWithImageData:options:"); + +`; + diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CIRAWFilter_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CIRAWFilter_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,33 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CIRAWFilter_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package const id kCIInputDecoderVersionKey; + package const id kCISupportedDecoderVersionsKey; + package const id kCIInputBoostKey; + package const id kCIInputNeutralChromaticityXKey; + package const id kCIInputNeutralChromaticityYKey; + package const id kCIInputNeutralTemperatureKey; + package const id kCIInputNeutralTintKey; + package const id kCIInputNeutralLocationKey; + package const id kCIInputScaleFactorKey; + package const id kCIInputAllowDraftModeKey; + package const id kCIInputIgnoreImageOrientationKey; + package const id kCIInputImageOrientationKey; + package const id kCIInputEnableSharpeningKey; + package const id kCIInputEnableChromaticNoiseTrackingKey; + package const id kCIInputBoostShadowAmountKey; + package const id kCIInputBiasKey; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CISampler.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CISampler.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,156 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CISampler; + +import dstep.applicationservices.ApplicationServices; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.quartzcore.CIFilterShape; +import dstep.quartzcore.CIImage; + +import bindings = dstep.quartzcore.CISampler_bindings; + +private +{ + NSString kCISamplerAffineMatrix_; + NSString kCISamplerWrapMode_; + NSString kCISamplerFilterMode_; + NSString kCISamplerWrapBlack_; + NSString kCISamplerWrapClamp_; + NSString kCISamplerFilterNearest_; + NSString kCISamplerFilterLinear_; +} + +NSString kCISamplerAffineMatrix () +{ + if (kCISamplerAffineMatrix_) + return kCISamplerAffineMatrix_; + + return kCISamplerAffineMatrix_ = new NSString(bindings.kCISamplerAffineMatrix); +} + +NSString kCISamplerWrapMode () +{ + if (kCISamplerWrapMode_) + return kCISamplerWrapMode_; + + return kCISamplerWrapMode_ = new NSString(bindings.kCISamplerWrapMode); +} + +NSString kCISamplerFilterMode () +{ + if (kCISamplerFilterMode_) + return kCISamplerFilterMode_; + + return kCISamplerFilterMode_ = new NSString(bindings.kCISamplerFilterMode); +} + +NSString kCISamplerWrapBlack () +{ + if (kCISamplerWrapBlack_) + return kCISamplerWrapBlack_; + + return kCISamplerWrapBlack_ = new NSString(bindings.kCISamplerWrapBlack); +} + +NSString kCISamplerWrapClamp () +{ + if (kCISamplerWrapClamp_) + return kCISamplerWrapClamp_; + + return kCISamplerWrapClamp_ = new NSString(bindings.kCISamplerWrapClamp); +} + +NSString kCISamplerFilterNearest () +{ + if (kCISamplerFilterNearest_) + return kCISamplerFilterNearest_; + + return kCISamplerFilterNearest_ = new NSString(bindings.kCISamplerFilterNearest); +} + +NSString kCISamplerFilterLinear () +{ + if (kCISamplerFilterLinear_) + return kCISamplerFilterLinear_; + + return kCISamplerFilterLinear_ = new NSString(bindings.kCISamplerFilterLinear); +} + +class CISampler : NSObject, INSCopying +{ + mixin (ObjcWrap); + + typeof(this) copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); + } + + static CISampler samplerWithImage (CIImage im) + { + return invokeObjcSelfClass!(CISampler, "samplerWithImage:", CIImage)(im); + } + + static CISampler samplerWithImage_keysAndValues (ARGS...) (CIImage im, ARGS args) + { + return invokeObjcSelfClass!(CISampler, "samplerWithImage:keysAndValues:", CIImage, ARGS)(im, args); + } + + static CISampler samplerWithImage (CIImage im, NSDictionary dict) + { + return invokeObjcSelfClass!(CISampler, "samplerWithImage:options:", CIImage, NSDictionary)(im, dict); + } + + CISampler initWithImage (CIImage im) + { + id result = invokeObjcSelf!(id, "initWithImage:", CIImage)(im); + return result is this.objcObject ? this : (result !is null ? new CISampler(result) : null); + } + + this (CIImage im) + { + super(CISampler.alloc.initWithImage(im).objcObject); + } + + CISampler initWithImage_keysAndValues (ARGS...) (CIImage im, ARGS args) + { + id result = invokeObjcSelf!(id, "initWithImage:keysAndValues:", CIImage)(im, args); + return result is this.objcObject ? this : (result !is null ? new CISampler(result) : null); + } + + this (CIImage im, ...) + { + super(CISampler.alloc.initWithImage(im).objcObject); + } + + CISampler initWithImage (CIImage im, NSDictionary dict) + { + id result = invokeObjcSelf!(id, "initWithImage:options:", CIImage, NSDictionary)(im, dict); + return result is this.objcObject ? this : (result !is null ? new CISampler(result) : null); + } + + this (CIImage im, NSDictionary dict) + { + super(CISampler.alloc.initWithImage(im, dict).objcObject); + } + + CIFilterShape definition () + { + return invokeObjcSelf!(CIFilterShape, "definition"); + } + + CGRect extent () + { + return invokeObjcSelf!(CGRect, "extent"); + } + +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CISampler_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CISampler_bindings.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,24 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CISampler_bindings; + +import dstep.objc.objc; + +extern (C) +{ + extern + { + package id kCISamplerAffineMatrix; + package id kCISamplerWrapMode; + package id kCISamplerFilterMode; + package id kCISamplerWrapBlack; + package id kCISamplerWrapClamp; + package id kCISamplerFilterNearest; + package id kCISamplerFilterLinear; + } +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CIVector.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CIVector.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,173 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CIVector; + +import dstep.applicationservices.ApplicationServices; +import dstep.foundation.NSCoder; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class CIVector : NSObject, INSCopying, INSCoding +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + typeof(this) copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); + } + + static CIVector vectorWithValues (CGFloat* values, uint count) + { + return invokeObjcSelfClass!(CIVector, "vectorWithValues:count:", CGFloat*, uint)(values, count); + } + + static CIVector vectorWithX (CGFloat x) + { + return invokeObjcSelfClass!(CIVector, "vectorWithX:", CGFloat)(x); + } + + static CIVector vectorWithX (CGFloat x, CGFloat y) + { + return invokeObjcSelfClass!(CIVector, "vectorWithX:Y:", CGFloat, CGFloat)(x, y); + } + + static CIVector vectorWithX (CGFloat x, CGFloat y, CGFloat z) + { + return invokeObjcSelfClass!(CIVector, "vectorWithX:Y:Z:", CGFloat, CGFloat, CGFloat)(x, y, z); + } + + static CIVector vectorWithX (CGFloat x, CGFloat y, CGFloat z, CGFloat w) + { + return invokeObjcSelfClass!(CIVector, "vectorWithX:Y:Z:W:", CGFloat, CGFloat, CGFloat, CGFloat)(x, y, z, w); + } + + static CIVector vectorWithString (NSString representation) + { + return invokeObjcSelfClass!(CIVector, "vectorWithString:", NSString)(representation); + } + + CIVector initWithValues (CGFloat* values, uint count) + { + id result = invokeObjcSelf!(id, "initWithValues:count:", CGFloat*, uint)(values, count); + return result is this.objcObject ? this : (result !is null ? new CIVector(result) : null); + } + + this (CGFloat* values, uint count) + { + super(CIVector.alloc.initWithValues(values, count).objcObject); + } + + CIVector initWithX (CGFloat x) + { + id result = invokeObjcSelf!(id, "initWithX:", CGFloat)(x); + return result is this.objcObject ? this : (result !is null ? new CIVector(result) : null); + } + + this (CGFloat x) + { + super(CIVector.alloc.initWithX(x).objcObject); + } + + CIVector initWithX (CGFloat x, CGFloat y) + { + id result = invokeObjcSelf!(id, "initWithX:Y:", CGFloat, CGFloat)(x, y); + return result is this.objcObject ? this : (result !is null ? new CIVector(result) : null); + } + + this (CGFloat x, CGFloat y) + { + super(CIVector.alloc.initWithX(x, y).objcObject); + } + + CIVector initWithX (CGFloat x, CGFloat y, CGFloat z) + { + id result = invokeObjcSelf!(id, "initWithX:Y:Z:", CGFloat, CGFloat, CGFloat)(x, y, z); + return result is this.objcObject ? this : (result !is null ? new CIVector(result) : null); + } + + this (CGFloat x, CGFloat y, CGFloat z) + { + super(CIVector.alloc.initWithX(x, y, z).objcObject); + } + + CIVector initWithX (CGFloat x, CGFloat y, CGFloat z, CGFloat w) + { + id result = invokeObjcSelf!(id, "initWithX:Y:Z:W:", CGFloat, CGFloat, CGFloat, CGFloat)(x, y, z, w); + return result is this.objcObject ? this : (result !is null ? new CIVector(result) : null); + } + + this (CGFloat x, CGFloat y, CGFloat z, CGFloat w) + { + super(CIVector.alloc.initWithX(x, y, z, w).objcObject); + } + + CIVector initWithString (NSString representation) + { + id result = invokeObjcSelf!(id, "initWithString:", NSString)(representation); + return result is this.objcObject ? this : (result !is null ? new CIVector(result) : null); + } + + this (NSString representation) + { + super(CIVector.alloc.initWithString(representation).objcObject); + } + + CGFloat valueAtIndex (uint index) + { + return invokeObjcSelf!(CGFloat, "valueAtIndex:", uint)(index); + } + + uint count () + { + return invokeObjcSelf!(uint, "count"); + } + + CGFloat X () + { + return invokeObjcSelf!(CGFloat, "X"); + } + + CGFloat Y () + { + return invokeObjcSelf!(CGFloat, "Y"); + } + + CGFloat Z () + { + return invokeObjcSelf!(CGFloat, "Z"); + } + + CGFloat W () + { + return invokeObjcSelf!(CGFloat, "W"); + } + + NSString stringRepresentation () + { + return invokeObjcSelf!(NSString, "stringRepresentation"); + } + +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CVBase.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CVBase.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,98 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CVBase; + +import dstep.corevideo.CVBase; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +alias ulong CVOptionFlags; + +extern (C) +{ + extern + { + const CVTime kCVZeroTime; + const CVTime kCVIndefiniteTime; + } +} + +enum +{ + kCVSMPTETimeType24 = 0, + kCVSMPTETimeType25 = 1, + kCVSMPTETimeType30Drop = 2, + kCVSMPTETimeType30 = 3, + kCVSMPTETimeType2997 = 4, + kCVSMPTETimeType2997Drop = 5, + kCVSMPTETimeType60 = 6, + kCVSMPTETimeType5994 = 7 +} + +enum +{ + kCVSMPTETimeValid = (1L << 0), + kCVSMPTETimeRunning = (1L << 1) +} + +enum +{ + kCVTimeIsIndefinite = 1 << 0 +} + +enum +{ + kCVTimeStampVideoTimeValid = (1L << 0), + kCVTimeStampHostTimeValid = (1L << 1), + kCVTimeStampSMPTETimeValid = (1L << 2), + kCVTimeStampVideoRefreshPeriodValid = (1L << 3), + kCVTimeStampRateScalarValid = (1L << 4), + kCVTimeStampTopField = (1L << 16), + kCVTimeStampBottomField = (1L << 17) +} + +enum +{ + kCVTimeStampVideoHostTimeValid = (kCVTimeStampVideoTimeValid | kCVTimeStampHostTimeValid), + kCVTimeStampIsInterlaced = (kCVTimeStampTopField | kCVTimeStampBottomField) +} + +struct CVTime +{ + long timeValue; + int timeScale; + int flags; +} + + +struct CVTimeStamp +{ + uint version_; + int videoTimeScale; + long videoTime; + ulong hostTime; + double rateScalar; + long videoRefreshPeriod; + CVSMPTETime smpteTime; + ulong flags; + ulong reserved; +} + + +struct CVSMPTETime +{ + short subframes; + short subframeDivisor; + uint counter; + uint type; + uint flags; + short hours; + short minutes; + short seconds; + short frames; +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CVBuffer.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CVBuffer.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,49 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CVBuffer; + +import dstep.corefoundation.CFBase; +import dstep.corefoundation.CFDictionary; +import dstep.corevideo.CVBuffer; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +//import bindings = dstep.quartzcore.CVBuffer_bindings; + +alias uint CVAttachmentMode; +alias __CVBuffer* CVBufferRef; + +extern (C) +{ + extern + { + const CFStringRef kCVBufferPropagatedAttachmentsKey; + const CFStringRef kCVBufferNonPropagatedAttachmentsKey; + const CFStringRef kCVBufferMovieTimeKey; + const CFStringRef kCVBufferTimeValueKey; + const CFStringRef kCVBufferTimeScaleKey; + } +} + +enum +{ + kCVAttachmentMode_ShouldNotPropagate = 0, + kCVAttachmentMode_ShouldPropagate = 1 +} + +extern (C) +{ + CVBufferRef CVBufferRetain (CVBufferRef buffer); + void CVBufferRelease (CVBufferRef buffer); + void CVBufferSetAttachment (CVBufferRef buffer, CFStringRef key, CFTypeRef value, uint attachmentMode); + CFTypeRef CVBufferGetAttachment (CVBufferRef buffer, CFStringRef key, CVAttachmentMode* attachmentMode); + void CVBufferRemoveAttachment (CVBufferRef buffer, CFStringRef key); + void CVBufferRemoveAllAttachments (CVBufferRef buffer); + CFDictionaryRef CVBufferGetAttachments (CVBufferRef buffer, uint attachmentMode); + void CVBufferSetAttachments (CVBufferRef buffer, CFDictionaryRef theAttachments, uint attachmentMode); + void CVBufferPropagateAttachments (CVBufferRef sourceBuffer, CVBufferRef destinationBuffer); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CVDisplayLink.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CVDisplayLink.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,44 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CVDisplayLink; + +import dstep.applicationservices.coregraphics.CGDirectDisplay; +import dstep.corevideo.CVBase; +import dstep.corevideo.CVDisplayLink; +import dstep.opengl.CGLTypes; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +alias __CVDisplayLink* CVDisplayLinkRef; + +extern (C) +{ + alias int function (CVDisplayLinkRef, CVTimeStamp*, CVTimeStamp*, ulong, CVOptionFlags*, void*) CVDisplayLinkOutputCallback; +} + +extern (C) +{ + uint CVDisplayLinkGetTypeID (); + int CVDisplayLinkCreateWithCGDisplays (CGDirectDisplayID* displayArray, int count, CVDisplayLinkRef* displayLinkOut); + int CVDisplayLinkCreateWithOpenGLDisplayMask (uint mask, CVDisplayLinkRef* displayLinkOut); + int CVDisplayLinkCreateWithCGDisplay (uint displayID, CVDisplayLinkRef* displayLinkOut); + int CVDisplayLinkCreateWithActiveCGDisplays (CVDisplayLinkRef* displayLinkOut); + int CVDisplayLinkSetCurrentCGDisplay (CVDisplayLinkRef displayLink, uint displayID); + int CVDisplayLinkSetCurrentCGDisplayFromOpenGLContext (CVDisplayLinkRef displayLink, CGLContextObj cglContext, CGLPixelFormatObj cglPixelFormat); + uint CVDisplayLinkGetCurrentCGDisplay (CVDisplayLinkRef displayLink); + int CVDisplayLinkSetOutputCallback (CVDisplayLinkRef displayLink, CVDisplayLinkOutputCallback callback, void* userInfo); + int CVDisplayLinkStart (CVDisplayLinkRef displayLink); + int CVDisplayLinkStop (CVDisplayLinkRef displayLink); + CVTime CVDisplayLinkGetNominalOutputVideoRefreshPeriod (CVDisplayLinkRef displayLink); + CVTime CVDisplayLinkGetOutputVideoLatency (CVDisplayLinkRef displayLink); + double CVDisplayLinkGetActualOutputVideoRefreshPeriod (CVDisplayLinkRef displayLink); + ubyte CVDisplayLinkIsRunning (CVDisplayLinkRef displayLink); + int CVDisplayLinkGetCurrentTime (CVDisplayLinkRef displayLink, CVTimeStamp* outTime); + int CVDisplayLinkTranslateTime (CVDisplayLinkRef displayLink, CVTimeStamp* inTime, CVTimeStamp* outTime); + CVDisplayLinkRef CVDisplayLinkRetain (CVDisplayLinkRef displayLink); + void CVDisplayLinkRelease (CVDisplayLinkRef displayLink); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CVHostTime.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CVHostTime.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,18 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CVHostTime; + +import dstep.corevideo.CVHostTime; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +extern (C) +{ + ulong CVGetCurrentHostTime (); + double CVGetHostClockFrequency (); + uint CVGetHostClockMinimumTimeDelta (); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CVImageBuffer.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CVImageBuffer.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,77 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CVImageBuffer; + +import dstep.applicationservices.coregraphics.CGColorSpace; +import dstep.applicationservices.coregraphics.CGGeometry; +import dstep.corefoundation.CFBase; +import dstep.corevideo.CVBuffer; +import dstep.corevideo.CVImageBuffer; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +alias CVBufferRef CVImageBufferRef; + +extern (C) +{ + extern + { + const CFStringRef kCVImageBufferCGColorSpaceKey; + const CFStringRef kCVImageBufferCleanApertureKey; + const CFStringRef kCVImageBufferCleanApertureWidthKey; + const CFStringRef kCVImageBufferCleanApertureHeightKey; + const CFStringRef kCVImageBufferCleanApertureHorizontalOffsetKey; + const CFStringRef kCVImageBufferCleanApertureVerticalOffsetKey; + const CFStringRef kCVImageBufferPreferredCleanApertureKey; + const CFStringRef kCVImageBufferFieldCountKey; + const CFStringRef kCVImageBufferFieldDetailKey; + const CFStringRef kCVImageBufferFieldDetailTemporalTopFirst; + const CFStringRef kCVImageBufferFieldDetailTemporalBottomFirst; + const CFStringRef kCVImageBufferFieldDetailSpatialFirstLineEarly; + const CFStringRef kCVImageBufferFieldDetailSpatialFirstLineLate; + const CFStringRef kCVImageBufferPixelAspectRatioKey; + const CFStringRef kCVImageBufferPixelAspectRatioHorizontalSpacingKey; + const CFStringRef kCVImageBufferPixelAspectRatioVerticalSpacingKey; + const CFStringRef kCVImageBufferDisplayDimensionsKey; + const CFStringRef kCVImageBufferDisplayWidthKey; + const CFStringRef kCVImageBufferDisplayHeightKey; + const CFStringRef kCVImageBufferGammaLevelKey; + const CFStringRef kCVImageBufferYCbCrMatrixKey; + const CFStringRef kCVImageBufferYCbCrMatrix_ITU_R_709_2; + const CFStringRef kCVImageBufferYCbCrMatrix_ITU_R_601_4; + const CFStringRef kCVImageBufferYCbCrMatrix_SMPTE_240M_1995; + const CFStringRef kCVImageBufferColorPrimariesKey; + const CFStringRef kCVImageBufferColorPrimaries_ITU_R_709_2; + const CFStringRef kCVImageBufferColorPrimaries_EBU_3213; + const CFStringRef kCVImageBufferColorPrimaries_SMPTE_C; + const CFStringRef kCVImageBufferTransferFunctionKey; + const CFStringRef kCVImageBufferTransferFunction_ITU_R_709_2; + const CFStringRef kCVImageBufferTransferFunction_EBU_3213; + const CFStringRef kCVImageBufferTransferFunction_SMPTE_C; + const CFStringRef kCVImageBufferChromaLocationTopFieldKey; + const CFStringRef kCVImageBufferChromaLocationBottomFieldKey; + const CFStringRef kCVImageBufferChromaLocation_Left; + const CFStringRef kCVImageBufferChromaLocation_Center; + const CFStringRef kCVImageBufferChromaLocation_TopLeft; + const CFStringRef kCVImageBufferChromaLocation_Top; + const CFStringRef kCVImageBufferChromaLocation_BottomLeft; + const CFStringRef kCVImageBufferChromaLocation_Bottom; + const CFStringRef kCVImageBufferChromaLocation_DV420; + const CFStringRef kCVImageBufferChromaSubsamplingKey; + const CFStringRef kCVImageBufferChromaSubsampling_420; + const CFStringRef kCVImageBufferChromaSubsampling_422; + const CFStringRef kCVImageBufferChromaSubsampling_411; + } +} + +extern (C) +{ + CGSize CVImageBufferGetEncodedSize (CVImageBufferRef imageBuffer); + CGSize CVImageBufferGetDisplaySize (CVImageBufferRef imageBuffer); + CGRect CVImageBufferGetCleanRect (CVImageBufferRef imageBuffer); + CGColorSpaceRef CVImageBufferGetColorSpace (CVImageBufferRef imageBuffer); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CVOpenGLBuffer.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CVOpenGLBuffer.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,41 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CVOpenGLBuffer; + +import dstep.corefoundation.CFBase; +import dstep.corefoundation.CFDictionary; +import dstep.corevideo.CVOpenGLBuffer; +import dstep.corevideo.CVImageBuffer; +import dstep.opengl.CGLTypes; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +//import bindings = dstep.quartzcore.CVOpenGLBuffer_bindings; + +alias CVImageBufferRef CVOpenGLBufferRef; + +extern (C) +{ + extern + { + const CFStringRef kCVOpenGLBufferWidth; + const CFStringRef kCVOpenGLBufferHeight; + const CFStringRef kCVOpenGLBufferTarget; + const CFStringRef kCVOpenGLBufferInternalFormat; + const CFStringRef kCVOpenGLBufferMaximumMipmapLevel; + } +} + +extern (C) +{ + uint CVOpenGLBufferGetTypeID (); + CVOpenGLBufferRef CVOpenGLBufferRetain (CVOpenGLBufferRef buffer); + void CVOpenGLBufferRelease (CVOpenGLBufferRef buffer); + int CVOpenGLBufferCreate (CFAllocatorRef allocator, uint width, uint height, CFDictionaryRef attributes, CVOpenGLBufferRef* bufferOut); + CFDictionaryRef CVOpenGLBufferGetAttributes (CVOpenGLBufferRef openGLBuffer); + int CVOpenGLBufferAttach (CVOpenGLBufferRef openGLBuffer, CGLContextObj cglContext, uint face, int level, int screen); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CVOpenGLBufferPool.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CVOpenGLBufferPool.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,38 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CVOpenGLBufferPool; + +import dstep.corefoundation.CFBase; +import dstep.corefoundation.CFDictionary; +import dstep.corevideo.CVOpenGLBuffer; +import dstep.corevideo.CVOpenGLBufferPool; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +//import bindings = dstep.quartzcore.CVOpenGLBufferPool_bindings; + +alias __CVOpenGLBufferPool* CVOpenGLBufferPoolRef; + +extern (C) +{ + extern + { + const CFStringRef kCVOpenGLBufferPoolMinimumBufferCountKey; + const CFStringRef kCVOpenGLBufferPoolMaximumBufferAgeKey; + } +} + +extern (C) +{ + uint CVOpenGLBufferPoolGetTypeID (); + CVOpenGLBufferPoolRef CVOpenGLBufferPoolRetain (CVOpenGLBufferPoolRef openGLBufferPool); + void CVOpenGLBufferPoolRelease (CVOpenGLBufferPoolRef openGLBufferPool); + int CVOpenGLBufferPoolCreate (CFAllocatorRef allocator, CFDictionaryRef poolAttributes, CFDictionaryRef openGLBufferAttributes, CVOpenGLBufferPoolRef* poolOut); + CFDictionaryRef CVOpenGLBufferPoolGetAttributes (CVOpenGLBufferPoolRef pool); + CFDictionaryRef CVOpenGLBufferPoolGetOpenGLBufferAttributes (CVOpenGLBufferPoolRef pool); + int CVOpenGLBufferPoolCreateOpenGLBuffer (CFAllocatorRef allocator, CVOpenGLBufferPoolRef openGLBufferPool, CVOpenGLBufferRef* openGLBufferOut); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CVOpenGLTexture.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CVOpenGLTexture.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,25 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CVOpenGLTexture; + +import dstep.corevideo.CVImageBuffer; +import dstep.corevideo.CVOpenGLTexture; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +alias CVImageBufferRef CVOpenGLTextureRef; + +extern (C) +{ + uint CVOpenGLTextureGetTypeID (); + CVOpenGLTextureRef CVOpenGLTextureRetain (CVOpenGLTextureRef texture); + void CVOpenGLTextureRelease (CVOpenGLTextureRef texture); + uint CVOpenGLTextureGetTarget (CVOpenGLTextureRef image); + uint CVOpenGLTextureGetName (CVOpenGLTextureRef image); + ubyte CVOpenGLTextureIsFlipped (CVOpenGLTextureRef image); + void CVOpenGLTextureGetCleanTexCoords (CVOpenGLTextureRef image, float[2] lowerLeft, float[2] lowerRight, float[2] upperRight, float[2] upperLeft); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CVOpenGLTextureCache.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CVOpenGLTextureCache.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,41 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CVOpenGLTextureCache; + +import dstep.corefoundation.CFBase; +import dstep.corefoundation.CFDictionary; +import dstep.corevideo.CVImageBuffer; +import dstep.corevideo.CVOpenGLTexture; +import dstep.corevideo.CVOpenGLTextureCache; +import dstep.opengl.CGLTypes; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +//import bindings = dstep.quartzcore.CVOpenGLTextureCache_bindings; + +alias __CVOpenGLTextureCache* CVOpenGLTextureCacheRef; + +extern (C) +{ + extern + { + const CFStringRef kCVOpenGLTextureCacheChromaSamplingModeKey; + const CFStringRef kCVOpenGLTextureCacheChromaSamplingModeAutomatic; + const CFStringRef kCVOpenGLTextureCacheChromaSamplingModeHighestQuality; + const CFStringRef kCVOpenGLTextureCacheChromaSamplingModeBestPerformance; + } +} + +extern (C) +{ + uint CVOpenGLTextureCacheGetTypeID (); + CVOpenGLTextureCacheRef CVOpenGLTextureCacheRetain (CVOpenGLTextureCacheRef textureCache); + void CVOpenGLTextureCacheRelease (CVOpenGLTextureCacheRef textureCache); + int CVOpenGLTextureCacheCreate (CFAllocatorRef allocator, CFDictionaryRef cacheAttributes, CGLContextObj cglContext, CGLPixelFormatObj cglPixelFormat, CFDictionaryRef textureAttributes, CVOpenGLTextureCacheRef* cacheOut); + int CVOpenGLTextureCacheCreateTextureFromImage (CFAllocatorRef allocator, CVOpenGLTextureCacheRef textureCache, CVImageBufferRef sourceImage, CFDictionaryRef attributes, CVOpenGLTextureRef* textureOut); + void CVOpenGLTextureCacheFlush (CVOpenGLTextureCacheRef textureCache, ulong options); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CVPixelBuffer.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CVPixelBuffer.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,155 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CVPixelBuffer; + +import dstep.corefoundation.CFArray; +import dstep.corefoundation.CFBase; +import dstep.corefoundation.CFDictionary; +import dstep.corevideo.CVImageBuffer; +import dstep.corevideo.CVPixelBuffer; +import dstep.objc.bridge.Bridge; +import dstep.objc.bridge.TypeEncoding; +import dstep.objc.objc; + +//import bindings = dstep.quartzcore.CVPixelBuffer_bindings; + +alias CVImageBufferRef CVPixelBufferRef; + +extern (C) +{ + alias void function (void*, void*, uint, uint, void**) CVPixelBufferReleasePlanarBytesCallback; + alias void function (void*, void*) CVPixelBufferReleaseBytesCallback; +} + +extern (C) +{ + extern + { + const CFStringRef kCVPixelBufferPixelFormatTypeKey; + const CFStringRef kCVPixelBufferMemoryAllocatorKey; + const CFStringRef kCVPixelBufferWidthKey; + const CFStringRef kCVPixelBufferHeightKey; + const CFStringRef kCVPixelBufferExtendedPixelsLeftKey; + const CFStringRef kCVPixelBufferExtendedPixelsTopKey; + const CFStringRef kCVPixelBufferExtendedPixelsRightKey; + const CFStringRef kCVPixelBufferExtendedPixelsBottomKey; + const CFStringRef kCVPixelBufferBytesPerRowAlignmentKey; + const CFStringRef kCVPixelBufferCGBitmapContextCompatibilityKey; + const CFStringRef kCVPixelBufferCGImageCompatibilityKey; + const CFStringRef kCVPixelBufferOpenGLCompatibilityKey; + } +} + +// This is needed otherwise the enums will fail compiling with gdc +version (GNU) +{ + private + { + const __kCVPixelFormatType_16LE555 = getOSType!("L555"); + const __kCVPixelFormatType_16LE5551 = getOSType!("5551"); + const __kCVPixelFormatType_16BE565 = getOSType!("B565"); + const __kCVPixelFormatType_16LE565 = getOSType!("L565"); + const __kCVPixelFormatType_24BGR = getOSType!("24BG"); + const __kCVPixelFormatType_32BGRA = getOSType!("BGRA"); + const __kCVPixelFormatType_32ABGR = getOSType!("ABGR"); + const __kCVPixelFormatType_32RGBA = getOSType!("RGBA"); + const __kCVPixelFormatType_64ARGB = getOSType!("b64a"); + const __kCVPixelFormatType_48RGB = getOSType!("b48r"); + const __kCVPixelFormatType_32AlphaGray = getOSType!("b32a"); + const __kCVPixelFormatType_16Gray = getOSType!("b16g"); + const __kCVPixelFormatType_422YpCbCr8 = getOSType!("2vuy"); + const __kCVPixelFormatType_4444YpCbCrA8 = getOSType!("v408"); + const __kCVPixelFormatType_4444YpCbCrA8R = getOSType!("r408"); + const __kCVPixelFormatType_444YpCbCr8 = getOSType!("v308"); + const __kCVPixelFormatType_422YpCbCr16 = getOSType!("v216"); + const __kCVPixelFormatType_422YpCbCr10 = getOSType!("v210"); + const __kCVPixelFormatType_444YpCbCr10 = getOSType!("v410"); + const __kCVPixelFormatType_420YpCbCr8Planar = getOSType!("y420"); + } +} + +enum +{ + kCVPixelFormatType_1Monochrome = 0x00000001, + kCVPixelFormatType_2Indexed = 0x00000002, + kCVPixelFormatType_4Indexed = 0x00000004, + kCVPixelFormatType_8Indexed = 0x00000008, + kCVPixelFormatType_1IndexedGray_WhiteIsZero = 0x00000021, + kCVPixelFormatType_2IndexedGray_WhiteIsZero = 0x00000022, + kCVPixelFormatType_4IndexedGray_WhiteIsZero = 0x00000024, + kCVPixelFormatType_8IndexedGray_WhiteIsZero = 0x00000028, + kCVPixelFormatType_16BE555 = 0x00000010, + kCVPixelFormatType_16LE555 = getOSType!("L555"), + kCVPixelFormatType_16LE5551 = getOSType!("5551"), + kCVPixelFormatType_16BE565 = getOSType!("B565"), + kCVPixelFormatType_16LE565 = getOSType!("L565"), + kCVPixelFormatType_24RGB = 0x00000018, + kCVPixelFormatType_24BGR = getOSType!("24BG"), + kCVPixelFormatType_32ARGB = 0x00000020, + kCVPixelFormatType_32BGRA = getOSType!("BGRA"), + kCVPixelFormatType_32ABGR = getOSType!("ABGR"), + kCVPixelFormatType_32RGBA = getOSType!("RGBA"), + kCVPixelFormatType_64ARGB = getOSType!("b64a"), + kCVPixelFormatType_48RGB = getOSType!("b48r"), + kCVPixelFormatType_32AlphaGray = getOSType!("b32a"), + kCVPixelFormatType_16Gray = getOSType!("b16g"), + kCVPixelFormatType_422YpCbCr8 = getOSType!("2vuy"), + kCVPixelFormatType_4444YpCbCrA8 = getOSType!("v408"), + kCVPixelFormatType_4444YpCbCrA8R = getOSType!("r408"), + kCVPixelFormatType_444YpCbCr8 = getOSType!("v308"), + kCVPixelFormatType_422YpCbCr16 = getOSType!("v216"), + kCVPixelFormatType_422YpCbCr10 = getOSType!("v210"), + kCVPixelFormatType_444YpCbCr10 = getOSType!("v410"), + kCVPixelFormatType_420YpCbCr8Planar = getOSType!("y420") +} + +struct CVPlanarComponentInfo +{ + int offset; + uint rowBytes; +} + + +struct CVPlanarPixelBufferInfo +{ + CVPlanarComponentInfo* componentInfo; +} + + +struct CVPlanarPixelBufferInfo_YCbCrPlanar +{ + CVPlanarComponentInfo componentInfoY; + CVPlanarComponentInfo componentInfoCb; + CVPlanarComponentInfo componentInfoCr; +} + +extern (C) +{ + uint CVPixelBufferGetTypeID (); + CVPixelBufferRef CVPixelBufferRetain (CVPixelBufferRef texture); + void CVPixelBufferRelease (CVPixelBufferRef texture); + int CVPixelBufferCreateResolvedAttributesDictionary (CFAllocatorRef allocator, CFArrayRef attributes, CFDictionaryRef* resolvedDictionaryOut); + int CVPixelBufferCreate (CFAllocatorRef allocator, uint width, uint height, uint pixelFormatType, CFDictionaryRef pixelBufferAttributes, CVPixelBufferRef* pixelBufferOut); + int CVPixelBufferCreateWithBytes (CFAllocatorRef allocator, uint width, uint height, uint pixelFormatType, void* baseAddress, uint bytesPerRow, CVPixelBufferReleaseBytesCallback releaseCallback, void* releaseRefCon, CFDictionaryRef pixelBufferAttributes, CVPixelBufferRef* pixelBufferOut); + int CVPixelBufferCreateWithPlanarBytes (CFAllocatorRef allocator, uint width, uint height, uint pixelFormatType, void* dataPtr, uint dataSize, uint numberOfPlanes, void** planeBaseAddress, size_t* planeWidth, size_t* planeHeight, size_t* planeBytesPerRow, CVPixelBufferReleasePlanarBytesCallback releaseCallback, void* releaseRefCon, CFDictionaryRef pixelBufferAttributes, CVPixelBufferRef* pixelBufferOut); + int CVPixelBufferLockBaseAddress (CVPixelBufferRef pixelBuffer, ulong lockFlags); + int CVPixelBufferUnlockBaseAddress (CVPixelBufferRef pixelBuffer, ulong unlockFlags); + uint CVPixelBufferGetWidth (CVPixelBufferRef pixelBuffer); + uint CVPixelBufferGetHeight (CVPixelBufferRef pixelBuffer); + uint CVPixelBufferGetPixelFormatType (CVPixelBufferRef pixelBuffer); + void* CVPixelBufferGetBaseAddress (CVPixelBufferRef pixelBuffer); + uint CVPixelBufferGetBytesPerRow (CVPixelBufferRef pixelBuffer); + uint CVPixelBufferGetDataSize (CVPixelBufferRef pixelBuffer); + ubyte CVPixelBufferIsPlanar (CVPixelBufferRef pixelBuffer); + uint CVPixelBufferGetPlaneCount (CVPixelBufferRef pixelBuffer); + uint CVPixelBufferGetWidthOfPlane (CVPixelBufferRef pixelBuffer, uint planeIndex); + uint CVPixelBufferGetHeightOfPlane (CVPixelBufferRef pixelBuffer, uint planeIndex); + void* CVPixelBufferGetBaseAddressOfPlane (CVPixelBufferRef pixelBuffer, uint planeIndex); + uint CVPixelBufferGetBytesPerRowOfPlane (CVPixelBufferRef pixelBuffer, uint planeIndex); + void CVPixelBufferGetExtendedPixels (CVPixelBufferRef pixelBuffer, size_t* extraColumnsOnLeft, size_t* extraColumnsOnRight, size_t* extraRowsOnTop, size_t* extraRowsOnBottom); + int CVPixelBufferFillExtendedPixels (CVPixelBufferRef pixelBuffer); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CVPixelBufferPool.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CVPixelBufferPool.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,36 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CVPixelBufferPool; + +import dstep.corefoundation.CFBase; +import dstep.corefoundation.CFDictionary; +import dstep.corevideo.CVPixelBuffer; +import dstep.corevideo.CVPixelBufferPool; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +alias __CVPixelBufferPool* CVPixelBufferPoolRef; + +extern (C) +{ + extern + { + const CFStringRef kCVPixelBufferPoolMinimumBufferCountKey; + const CFStringRef kCVPixelBufferPoolMaximumBufferAgeKey; + } +} + +extern (C) +{ + uint CVPixelBufferPoolGetTypeID (); + CVPixelBufferPoolRef CVPixelBufferPoolRetain (CVPixelBufferPoolRef pixelBufferPool); + void CVPixelBufferPoolRelease (CVPixelBufferPoolRef pixelBufferPool); + int CVPixelBufferPoolCreate (CFAllocatorRef allocator, CFDictionaryRef poolAttributes, CFDictionaryRef pixelBufferAttributes, CVPixelBufferPoolRef* poolOut); + CFDictionaryRef CVPixelBufferPoolGetAttributes (CVPixelBufferPoolRef pool); + CFDictionaryRef CVPixelBufferPoolGetPixelBufferAttributes (CVPixelBufferPoolRef pool); + int CVPixelBufferPoolCreatePixelBuffer (CFAllocatorRef allocator, CVPixelBufferPoolRef pixelBufferPool, CVPixelBufferRef* pixelBufferOut); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CVPixelFormatDescription.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CVPixelFormatDescription.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,62 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CVPixelFormatDescription; + +import dstep.corefoundation.CFArray; +import dstep.corefoundation.CFBase; +import dstep.corefoundation.CFDictionary; +import dstep.corevideo.CVPixelBuffer; +import dstep.corevideo.CVPixelFormatDescription; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +extern (C) +{ + alias ubyte function (CVPixelBufferRef, void*) CVFillExtendedPixelsCallBack; +} + +extern (C) +{ + extern + { + const CFStringRef kCVPixelFormatName; + const CFStringRef kCVPixelFormatConstant; + const CFStringRef kCVPixelFormatCodecType; + const CFStringRef kCVPixelFormatFourCC; + const CFStringRef kCVPixelFormatPlanes; + const CFStringRef kCVPixelFormatBlockWidth; + const CFStringRef kCVPixelFormatBlockHeight; + const CFStringRef kCVPixelFormatBitsPerBlock; + const CFStringRef kCVPixelFormatBlockHorizontalAlignment; + const CFStringRef kCVPixelFormatBlockVerticalAlignment; + const CFStringRef kCVPixelFormatHorizontalSubsampling; + const CFStringRef kCVPixelFormatVerticalSubsampling; + const CFStringRef kCVPixelFormatOpenGLFormat; + const CFStringRef kCVPixelFormatOpenGLType; + const CFStringRef kCVPixelFormatOpenGLInternalFormat; + const CFStringRef kCVPixelFormatCGBitmapInfo; + const CFStringRef kCVPixelFormatQDCompatibility; + const CFStringRef kCVPixelFormatCGBitmapContextCompatibility; + const CFStringRef kCVPixelFormatCGImageCompatibility; + const CFStringRef kCVPixelFormatOpenGLCompatibility; + const CFStringRef kCVPixelFormatFillExtendedPixelsCallback; + } +} + +struct CVFillExtendedPixelsCallBackData +{ + int version_; + CVFillExtendedPixelsCallBack fillCallBack; + void* refCon; +} + +extern (C) +{ + CFDictionaryRef CVPixelFormatDescriptionCreateWithPixelFormatType (CFAllocatorRef allocator, uint pixelFormat); + CFArrayRef CVPixelFormatDescriptionArrayCreateWithAllPixelFormatTypes (CFAllocatorRef allocator); + void CVPixelFormatDescriptionRegisterDescriptionWithPixelFormatType (CFDictionaryRef description, uint pixelFormat); +} \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CVReturn.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CVReturn.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,34 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CVReturn; + +import dstep.corevideo.CVReturn; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +alias int CVReturn; + +enum _CVReturn +{ + kCVReturnSuccess = 0, + kCVReturnFirst = -6660, + kCVReturnError = kCVReturnFirst, + kCVReturnInvalidArgument = -6661, + kCVReturnAllocationFailed = -6662, + kCVReturnInvalidDisplay = -6670, + kCVReturnDisplayLinkAlreadyRunning = -6671, + kCVReturnDisplayLinkNotRunning = -6672, + kCVReturnDisplayLinkCallbacksNotSet = -6673, + kCVReturnInvalidPixelFormat = -6680, + kCVReturnInvalidSize = -6681, + kCVReturnInvalidPixelBufferAttributes = -6682, + kCVReturnPixelBufferNotOpenGLCompatible = -6683, + kCVReturnPoolAllocationFailed = -6690, + kCVReturnInvalidPoolAttributes = -6691, + kCVReturnLast = -6699 +} + diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CoreAnimation.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CoreAnimation.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,25 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CoreAnimation; + +public: + +import dstep.foundation.Foundation; +import dstep.quartzcore.CAAnimation; +import dstep.quartzcore.CABase; +import dstep.quartzcore.CACIFilterAdditions; +import dstep.quartzcore.CAConstraintLayoutManager; +import dstep.quartzcore.CALayer; +import dstep.quartzcore.CAMediaTiming; +import dstep.quartzcore.CAMediaTimingFunction; +import dstep.quartzcore.CAOpenGLLayer; +import dstep.quartzcore.CARenderer; +import dstep.quartzcore.CAScrollLayer; +import dstep.quartzcore.CATextLayer; +import dstep.quartzcore.CATiledLayer; +import dstep.quartzcore.CATransaction; +import dstep.quartzcore.CATransform3D; \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CoreImage.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CoreImage.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,27 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CoreImage; + +public: + +import dstep.applicationservices.ApplicationServices; +import dstep.foundation.Foundation; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; +import dstep.quartzcore.CIColor; +import dstep.quartzcore.CIContext; +import dstep.quartzcore.CIFilter; +import dstep.quartzcore.CIFilterGenerator; +import dstep.quartzcore.CIFilterShape; +import dstep.quartzcore.CIImage; +import dstep.quartzcore.CIImageAccumulator; +import dstep.quartzcore.CIImageProvider; +import dstep.quartzcore.CIKernel; +import dstep.quartzcore.CIPlugIn; +import dstep.quartzcore.CIRAWFilter; +import dstep.quartzcore.CISampler; +import dstep.quartzcore.CIVector; \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/CoreVideo.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/CoreVideo.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,13 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.CoreVideo; + +public: + +import dstep.corevideo.CoreVideo; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; diff -r 7ff919f595d5 -r 19885b43130e dstep/quartzcore/QuartzCore.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/quartzcore/QuartzCore.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,13 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.quartzcore.QuartzCore; + +public: + +import dstep.quartzcore.CoreAnimation; +import dstep.quartzcore.CoreImage; +import dstep.quartzcore.CoreVideo; \ No newline at end of file diff -r 7ff919f595d5 -r 19885b43130e dstep/security/AuthorizationDB.d --- a/dstep/security/AuthorizationDB.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/security/AuthorizationDB.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,7 +6,9 @@ */ module dstep.security.AuthorizationDB; -import dstep.corefoundation.CoreFoundation; +import dstep.corefoundation.CFBase; +import dstep.corefoundation.CFBundle; +import dstep.corefoundation.CFDictionary; import dstep.security.Authorization; extern (C) diff -r 7ff919f595d5 -r 19885b43130e dstep/security/SecAsn1Coder.d --- a/dstep/security/SecAsn1Coder.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/security/SecAsn1Coder.d Sun Jan 03 22:06:11 2010 +0100 @@ -9,7 +9,6 @@ import dstep.security.SecAsn1Types; import dstep.security.SecBase; import dstep.security.cssmtype; -//import dstep.sys.types; struct SecAsn1Coder; diff -r 7ff919f595d5 -r 19885b43130e dstep/security/SecCertificate.d --- a/dstep/security/SecCertificate.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/security/SecCertificate.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,7 +6,6 @@ */ module dstep.security.SecCertificate; -//import dstep.AvailabilityMacros; import dstep.corefoundation.CFArray; import dstep.corefoundation.CFBase; import dstep.corefoundation.CFDate; diff -r 7ff919f595d5 -r 19885b43130e dstep/security/SecIdentity.d --- a/dstep/security/SecIdentity.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/security/SecIdentity.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,7 +6,6 @@ */ module dstep.security.SecIdentity; -//import dstep.AvailabilityMacros; import dstep.corefoundation.CFArray; import dstep.corefoundation.CFBase; import dstep.security.SecBase; diff -r 7ff919f595d5 -r 19885b43130e dstep/security/SecIdentitySearch.d --- a/dstep/security/SecIdentitySearch.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/security/SecIdentitySearch.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,7 +6,6 @@ */ module dstep.security.SecIdentitySearch; -//import dstep.AvailabilityMacros; import dstep.corefoundation.CFArray; import dstep.corefoundation.CFBase; import dstep.corefoundation.CFDictionary; diff -r 7ff919f595d5 -r 19885b43130e dstep/security/SecImportExport.d --- a/dstep/security/SecImportExport.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/security/SecImportExport.d Sun Jan 03 22:06:11 2010 +0100 @@ -11,7 +11,6 @@ import dstep.security.SecBase; import dstep.security.SecKeychain; import dstep.security.cssmtype; -//import dstep.stdint; alias uint SecExternalFormat; alias uint SecExternalItemType; diff -r 7ff919f595d5 -r 19885b43130e dstep/security/SecTrust.d --- a/dstep/security/SecTrust.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/security/SecTrust.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,7 +6,6 @@ */ module dstep.security.SecTrust; -//import dstep.AvailabilityMacros; import dstep.corefoundation.CoreFoundation; import dstep.coreservices.carboncore.MacTypes : OSStatus; import dstep.security.SecBase; diff -r 7ff919f595d5 -r 19885b43130e dstep/security/SecureTransport.d --- a/dstep/security/SecureTransport.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/security/SecureTransport.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,12 +6,10 @@ */ module dstep.security.SecureTransport; -//import dstep.AvailabilityMacros; import dstep.corefoundation.CFArray; import dstep.corefoundation.CFBase; import dstep.coreservices.carboncore.MacTypes : OSStatus; import dstep.security.CipherSuite; -//import dstep.sys.types; struct SSLContext; diff -r 7ff919f595d5 -r 19885b43130e scripts/dgen.rb --- a/scripts/dgen.rb Mon Aug 03 15:31:48 2009 +0200 +++ b/scripts/dgen.rb Sun Jan 03 22:06:11 2010 +0100 @@ -12,6 +12,7 @@ require "xmlsimple" require "optparse" require "date" +require "stringio" # Extensions to String class String @@ -323,15 +324,17 @@ file << header.function_pointers file << header.c_constants file << header.d_constants + file << header.d_constants_static_this unless header.d_constants_static_this.length == 0 file << header.enums_gnu if header.needs_type_encoding file << header.enums file << header.structs - unless header.d_constants_static_this.length == 0 - file << "static this ()".nl(false) - file << "{".nl(false) - file << header.d_constants_static_this - file << "}".nl(false).nl(false) + # Put the templates/mixins before the classes just to make sure we don't get forward reference errors + templates = get_templates(header.name) + + templates.each do |template, value| + file << value.code.nl(false) + @templates.delete(template) end classes = get_classes(header.name) @@ -348,18 +351,12 @@ @interfaces.delete(interface) end - templates = get_templates(header.name) - - templates.each do |template, value| - file << value.code.nl(false) - @templates.delete(template) - end - file << header.function_wrappers file << header.c_functions end File.open(bindings_file_path, "w") do |file| + file << copyright file << "module " file << mod file << "_bindings;" @@ -390,15 +387,17 @@ file << header.function_pointers file << header.c_constants file << header.d_constants + file << header.d_constants_static_this unless header.d_constants_static_this.nil? file << header.enums_gnu if header.needs_type_encoding file << header.enums file << header.structs - unless header.d_constants_static_this.nil? - file << "static this ()".nl(false) - file << "{".nl(false) - file << header.d_constants_static_this - file << "}".nl(false).nl(false) + # Put the templates/mixins before the classes just to make sure we don't get forward reference errors + templates = get_templates(header.name) + + templates.each do |template, value| + file << value.code.nl(false) + @templates.delete(template) end classes = get_classes(header.name) @@ -414,13 +413,6 @@ file << value.code.nl(false) @interfaces.delete(interface) end - - templates = get_templates(header.name) - - templates.each do |template, value| - file << value.code.nl(false) - @templates.delete(template) - end file << header.function_wrappers file << header.c_functions @@ -548,12 +540,7 @@ end str << "{".nl(false) - str << "mixin ObjcWrap".indent.nl - - templates_for_class(clazz.name).each do |template, value| - str << "mixin #{get_identifier("T" + template)}".indent.nl - end - + str << "mixin (ObjcWrap)".indent.nl str << "\n" str << methods(clazz.method, clazz.name) @@ -567,7 +554,12 @@ str << methods(interface.method, interface.name) str << "\n" unless i == protocols.length - 1 end - end + end + + # Put the mixins at the end of the class just to make sure we don't get any forward reference errors + templates_for_class(clazz.name).each do |template, value| + str << "mixin (#{get_identifier("T" + template)})".indent.nl + end str << "}".nl(false) @@ -633,15 +625,20 @@ # Generates the D code for the templates def templates (templates) templates.each do |template| + methods = methods(template.method, template.name, true) #unless template["class"] == "NSObject" + bindings = bindings(template) + str = StringIO.new - str << "template " + str << "const " str << get_identifier("T" + template.name) - str << " ()".nl(false) - str << "{".nl(false) - str << interface_methods(template.method, template.name) if template["class"] == "NSObject" - str << methods(template.method, template.name) unless template["class"] == "NSObject" - str << "}".nl(false) + str << " = `".nl(false) + str << "".nl(false) + #str << interface_methods(template.method, template.name) if template["class"] == "NSObject" + + str << methods.nl(false) + str << bindings.nl(false) + str << "`".nl @templates[template.name] ||= {} @templates[template.name].code = str.string @@ -652,6 +649,23 @@ end end + def bindings (template) + str = StringIO.new + + template.method.each do |method| + static = method.classMethod == "true" + + str << "mixin ObjcBindMethod!(".indent unless static + str << "mixin ObjcBindClassMethod!(".indent if static + str << get_method_name(method.selector) + str << ', "' + str << method.selector + str << '")'.nl + end + + str.string + end + # Generates the D code for the constants/globals def constants (constants) return "" if constants.length == 0 @@ -722,20 +736,23 @@ str = StringIO.new + str << "private\n{\n" + @d_constants.each do |constant| # Deep copy constant c = constant.dup c.name = c.name.dup c.type = c.type.dup - str << "const " if constant.const - str << get_identifier(constant.type) + #str << "const " if constant.const + str << get_identifier(constant.type).indent str << " " - str << get_identifier(constant.name).nl + str << get_identifier(constant.name) + str << "_".nl @d_constants_static_this << c end - str << "\n" + str << "}\n\n" @d_constants.clear str.string end @@ -747,13 +764,34 @@ str = StringIO.new @d_constants_static_this.each do |constant| - str << constant.name.indent - str << " = new " - str << get_identifier(constant.type) - str << "(" - str << "bindings." - str << get_identifier(constant.name) + # str << constant.name.indent + # str << " = new " + # str << get_identifier(constant.type) + # str << "(" + # str << "bindings." + # str << get_identifier(constant.name) + # str << ")".nl + + str << constant.type + str << " " + str << constant.name + str << " ()".nl(false) + str << "{".nl(false) + str << "if (".indent + str << constant.name + "_" + str << ")".nl(false) + str << "return ".indent(2) + str << constant.name + str << "_".nl + str << "\n" + str << "return ".indent + str << constant.name + str << "_ = new " + str << constant.type + str << "(bindings." + str << constant.name str << ")".nl + str << "}\n\n" end @d_constants_static_this.clear @@ -906,7 +944,7 @@ else return_type = get_type(original_type, function.returnValue[0].type64, function.returnValue[0].declaredType) args(function.arg, variadic) unless function.arg.nil? - end + end str << "static " if static str << return_type @@ -999,7 +1037,7 @@ def functions_helper (function, wrapper_needed) str = StringIO.new - str << ("private " + build_function(function)).indent if wrapper_needed + str << ("package " + build_function(function)).indent if wrapper_needed str << build_function(function).indent unless wrapper_needed str.string @@ -1074,7 +1112,7 @@ if @needs_bridge str << "import dstep.objc.bridge.Bridge".nl str << "import dstep.objc.bridge.TypeEncoding".nl if header.needs_type_encoding - str << "import dstep.objc.objc : id".nl + str << "import dstep.objc.objc".nl end str << "\n\n" @@ -1086,32 +1124,77 @@ end # Generates the D code for the methods - def methods (methods, class_name) + def methods (methods, class_name, template = false) return "" if methods.length == 0 str = StringIO.new - methods.each do |method| + methods.each do |method| + next if method.selector.length >= 5 && get_method_name(method.selector)[0 ... 5] == "alloc" # skip alloc + + name = get_method_name(method.selector) return_type = get_type(method.returnValue[0].type, method.returnValue[0].type64, method.returnValue[0].declaredType) + + if name.length >= 4 && name[0 ... 4] == "init" && name != "initialize" + if template + return_type = "typeof(this)" + else + return_type = class_name + end + + method["returnValue"][0]["declaredType"] = return_type + end + variadic = method.variadic == "true" static = method.classMethod == "true" index = 0 declaration = build_function(method, true, static)[0 ... -2].indent.nl(false) index = declaration.index_of(" ") if static - index = declaration.index_of(" ", index) - name = get_method_name(method.selector) + index = declaration.index_of(" ", index) str << (declaration[0 .. index] + name + declaration[index .. -1]).gsub(/ +/, " ") str << "{".indent.nl(false) + has_ref = false + + method.arg.each_with_index do |arg, i| + if arg.declaredType =~ /NSError\*\*/ || arg.declaredType =~ /NSDictionary\*\*/ + has_ref = true + str << "id __arg#{i};\n".indent(2) + end + end if method.arg + + if has_ref + str << "\n" + + method.arg.each_with_index do |arg, i| + if arg.declaredType =~ /NSError\*\*/ || arg.declaredType =~ /NSDictionary\*\*/ + str << "if (#{arg.name})\n".indent(2) + str << "__arg#{i} = #{arg.name}.objcObject".indent(3).nl.nl(false) + end + end if method.arg + end + if static - str << "return invokeObjcSelfClass!(".indent(2) - str << return_type + if has_ref + str << "#{return_type} result = ".indent(2) unless return_type == "void" + str << "".indent(2) if return_type == "void" + str << "invokeObjcSelf!(" + str << return_type + else + str << "return invokeObjcSelfClass!(".indent(2) + str << return_type + end else if return_type == class_name str << "id result = invokeObjcSelf!(".indent(2) str << "id" + elsif has_ref + str << "#{return_type} result = ".indent(2) unless return_type == "void" + str << "".indent(2) if return_type == "void" + str << "invokeObjcSelf!(" + str << return_type else str << "return invokeObjcSelf!(".indent(2) str << return_type @@ -1124,7 +1207,12 @@ method.arg.each do |arg| str << ", " - str << get_type(arg.type, arg.type, arg.declaredType) + + if arg.declaredType =~ /NSError\*\*/ || arg.declaredType =~ /NSDictionary\*\*/ + str << "id*" + else + str << get_type(arg.type, arg.type, arg.declaredType) + end end unless method.arg.nil? unless method.arg.nil? @@ -1133,39 +1221,65 @@ end method.arg.each_with_index do |arg, i| - str << get_identifier(arg.name) + if arg.declaredType =~ /NSError\*\*/ || arg.declaredType =~ /NSDictionary\*\*/ + str << "&__arg#{i}" + else + str << get_identifier(arg.name) + end + str << ", " unless i == method.arg.length - 1 end unless method.arg.nil? str << ")".nl - str << "return result is this.objcObject ? this : (result !is null ? new #{return_type}(result) : null)".indent(2).nl if return_type == class_name && !static + + if has_ref + str << "\n" + + method.arg.each_with_index do |arg, i| + if arg.declaredType =~ /NSError\*\*/ || arg.declaredType =~ /NSDictionary\*\*/ + str << "if (__arg#{i})\n".indent(2) + argType = get_type(arg.type, arg.type64, arg.declaredType) + argType = argType[4 .. -1] # cut off "ref " + str << "#{arg.name} = new #{argType}(__arg#{i})".indent(3).nl + end + end + + unless return_type == "void" || return_type == class_name || return_type == "typeof(this)" + str << "\n" + str << "return result".indent(2).nl + end + end + + if (return_type == class_name || return_type == "typeof(this)") && !static + str << "\n" + str << "return result is this.objcObject ? this : (result !is null ? new #{return_type}(result) : null)".indent(2).nl + end + str << "}".indent.nl(false).nl(false) if name.length >= 4 && name[0 ... 4] == "init" && name != "initialize" str << ("this" + declaration[index .. -1]).gsub(/ +/, " ").indent str << "{".indent.nl(false) - str << 'objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass)'.indent(2).nl - str << 'id result = Bridge.invokeObjcMethod!(id, "'.indent(2) - str << method.selector - str << '"' - - method.arg.each do |arg| - str << ", " - str << get_type(arg.type, arg.type, arg.declaredType) - end unless method.arg.nil? + str << "super(".indent(2) + str << typeof(this) if template + str << class_name unless template + str << ".alloc." + str << get_method_name(method.selector) - str << ")(objcObject" + unless method.arg.nil? + str << "(" + args = StringIO.new + + method.arg.each do |arg| + args << get_identifier(arg.name) + args << ", " + end + + str << args.string[0 ... -2] + str << ")" + end - method.arg.each do |arg| - str << ", " - str << get_identifier(arg.name) - end unless method.arg.nil? - - str << ")".nl.nl(false) - - str << "if (result)".indent(2).nl(false) - str << "objcObject = ret".indent(3).nl.nl(false) - str << "dObject = this".indent(2).nl + str << ".objcObject)".nl str << "}".indent.nl(false).nl(false) end end @@ -1287,6 +1401,7 @@ when "NSInteger"; return type when "NSUInteger"; return type when "IMP"; return type; + when "size_t"; return type; when "unichar*" when "UniChar*"; return "wchar*" @@ -1294,6 +1409,7 @@ when "CGFloat*"; return type when "NSInteger*"; return type when "NSUInteger*"; return type + when "size_t*"; return type; when "unichar**" when "UniChar**"; return "wchar**" @@ -1301,7 +1417,14 @@ when "CGFloat**"; return type when "NSInteger**"; return type when "NSUInteger**"; return type - else return nil; + when "size_t**"; return type; + + # special case, asume ref parameter + when "NSError**"; return "ref NSError" + when "NSDictionary**"; return "ref NSDictionary" + when "typeof(this)"; return type + else + return nil; end end @@ -1338,13 +1461,13 @@ # get_type("I", "I", "unsigned int") #=> uint # def get_type (type, type64, declared_type) + t = check_declared_type(declared_type) + return t unless t.nil? + declared_type = "I" + $1 if declared_type =~ /\w+\s*<(.+)>/ declared_type.gsub!(/\(|\)/, "") return get_identifier(declared_type) if type.nil? && type64.nil? - - t = check_declared_type(declared_type) - return t unless t.nil? unless type64 == "" || type64.nil? return get_identifier(declared_type) if type != type64 @@ -1424,9 +1547,21 @@ get_identifier(resolved_types) when "^" - t = type[1 .. -1] - t64 = type64.nil? ? t : type64[1 .. -1] - get_identifier(get_type(t, t64, declared_type).dup + "*") + if type == "^@" + t = type[1 .. -1] + t64 = type64.nil? ? t : type64[1 .. -1] + get_identifier(get_type(t, t64, "ref " + declared_type).dup) + + elsif type == "^?" + tmp = cfp_to_dfp(type) + return get_identifier(tmp) unless tmp.nil? + end + # t = type[1 .. -1] + # t64 = type64.nil? ? t : type64[1 .. -1] + # get_identifier(get_type(t, t64, declared_type).dup + "*") + + + # if type == "^@" # return get_identifier(get_type(type[1 .. -1], type64[1 .. -1], declared_type).dup + "*") diff -r 7ff919f595d5 -r 19885b43130e scripts/dstepgen.rb --- a/scripts/dstepgen.rb Mon Aug 03 15:31:48 2009 +0200 +++ b/scripts/dstepgen.rb Sun Jan 03 22:06:11 2010 +0100 @@ -33,6 +33,7 @@ require "builder" require "tmpdir" require "optparse" +require "stringio" include Builder $KCODE = "UTF8" @@ -1825,7 +1826,7 @@ dstep_gen.options << opt end - opts.on("-e", "--extra", "Included extra headers headers") do |opt| + opts.on("-e", "--extra", "Included extra headers") do |opt| dstep_gen.extra = true end