Improves Cocoa bindings

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@488 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
sekelsenmat 2008-06-24 02:01:19 +00:00
parent 9cce4454f4
commit 9bd67d8d40
16 changed files with 2291 additions and 211 deletions

View File

@ -15,6 +15,8 @@ unit objc;
{$Packrecords c}
{$linklib objc}
interface
uses ctypes, unix;

View File

@ -80,9 +80,9 @@
#import <AppKit/NSSegmentedControl.h>
#import <AppKit/NSSegmentedCell.h>
#import <AppKit/NSSlider.h>
#import <AppKit/NSSliderCell.h>
#import <AppKit/NSSpellProtocol.h>
#import <AppKit/NSText.h>}
#import <AppKit/NSSliderCell.h>}
{$include NSSpellProtocol.inc}
{$include NSText.inc}
{$include NSTextField.inc}
{#import <AppKit/NSTextFieldCell.h>
#import <AppKit/NSText.h>

View File

@ -72,28 +72,46 @@ type
);
{ An Application's startup function }
//APPKIT_EXTERN int NSApplicationMain(int argc, const char *argv[]);
//APPKIT_EXTERN BOOL NSApplicationLoad(void);
//#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2
{ The startup function to call for a Cocoa bundle }
function NSApplicationLoad(): CBOOL; cdecl; external;
//#endif
{ NSShowsServicesMenuItem() always returns YES. }
//APPKIT_EXTERN BOOL NSShowsServicesMenuItem(NSString * itemName);
{ NSSetShowsServicesMenuItem() has no effect, and always returns 0. }
//APPKIT_EXTERN int NSSetShowsServicesMenuItem(NSString * itemName, BOOL enabled);
//APPKIT_EXTERN void NSUpdateDynamicServices(void);
//APPKIT_EXTERN BOOL NSPerformService(NSString *itemName, NSPasteboard *pboard);
//APPKIT_EXTERN void NSRegisterServicesProvider(id provider, NSString *name); // apps should use -setServicesProvider
//APPKIT_EXTERN void NSUnregisterServicesProvider(NSString *name);
//APPKIT_EXTERN NSString *NSApplicationDidBecomeActiveNotification;
//APPKIT_EXTERN NSString *NSApplicationDidHideNotification;
//APPKIT_EXTERN NSString *NSApplicationDidFinishLaunchingNotification;
//APPKIT_EXTERN NSString *NSApplicationDidResignActiveNotification;
//APPKIT_EXTERN NSString *NSApplicationDidUnhideNotification;
//APPKIT_EXTERN NSString *NSApplicationDidUpdateNotification;
//APPKIT_EXTERN NSString *NSApplicationWillBecomeActiveNotification;
//APPKIT_EXTERN NSString *NSApplicationWillHideNotification;
//APPKIT_EXTERN NSString *NSApplicationWillFinishLaunchingNotification;
//APPKIT_EXTERN NSString *NSApplicationWillResignActiveNotification;
//APPKIT_EXTERN NSString *NSApplicationWillUnhideNotification;
//APPKIT_EXTERN NSString *NSApplicationWillUpdateNotification;
//APPKIT_EXTERN NSString *NSApplicationWillTerminateNotification;
//APPKIT_EXTERN NSString *NSApplicationDidChangeScreenParametersNotification;
{ NSUpdateDynamicServices() causes the services information for the system to be updated. This will only be necessary if your program adds dynamic services to the system (i.e. services not found in macho segments of executables).
}
{APPKIT_EXTERN void NSUpdateDynamicServices(void);
APPKIT_EXTERN BOOL NSPerformService(NSString *itemName, NSPasteboard *pboard);
APPKIT_EXTERN void NSRegisterServicesProvider(id provider, NSString *name); // apps should use -setServicesProvider
APPKIT_EXTERN void NSUnregisterServicesProvider(NSString *name); }
{ Notifications }
{APPKIT_EXTERN NSString *NSApplicationDidBecomeActiveNotification;
APPKIT_EXTERN NSString *NSApplicationDidHideNotification;
APPKIT_EXTERN NSString *NSApplicationDidFinishLaunchingNotification;
APPKIT_EXTERN NSString *NSApplicationDidResignActiveNotification;
APPKIT_EXTERN NSString *NSApplicationDidUnhideNotification;
APPKIT_EXTERN NSString *NSApplicationDidUpdateNotification;
APPKIT_EXTERN NSString *NSApplicationWillBecomeActiveNotification;
APPKIT_EXTERN NSString *NSApplicationWillHideNotification;
APPKIT_EXTERN NSString *NSApplicationWillFinishLaunchingNotification;
APPKIT_EXTERN NSString *NSApplicationWillResignActiveNotification;
APPKIT_EXTERN NSString *NSApplicationWillUnhideNotification;
APPKIT_EXTERN NSString *NSApplicationWillUpdateNotification;
APPKIT_EXTERN NSString *NSApplicationWillTerminateNotification;
APPKIT_EXTERN NSString *NSApplicationDidChangeScreenParametersNotification; }
type
NSRequestUserAttentionType = (
NSCriticalRequest = 0,

View File

@ -1,195 +1,668 @@
{%mainunit appkit.pas}
{
(*
NSControl.h
Application Kit
Copyright (c) 1994-2005, Apple Computer, Inc.
All rights reserved.
}
*)
{$ifdef HEADER}
{$ifndef NSCONTROL_PAS_H}
{$define NSCONTROL_PAS_H}
{ Class and method name strings }
const
Str_NSControl = 'NSControl';
Str_initWithFrame = 'initWithFrame:';
Str_setTarget = 'setTarget:';
Str_setAction = 'setAction:';
Str_setStringValue = 'setStringValue:';
{$include NSView.inc}
{$include NSText.inc}
//APPKIT_EXTERN NSString *NSControlTextDidBeginEditingNotification; // @"NSFieldEditor"
//APPKIT_EXTERN NSString *NSControlTextDidEndEditingNotification; // @"NSFieldEditor"
//APPKIT_EXTERN NSString *NSControlTextDidChangeNotification; // @"NSFieldEditor"
{$endif}
{$endif}
{$ifdef FORWARD}
NSControl = class;
{$endif}
{$endif}
{$ifdef CLASSES}
{$ifndef NSCONTROL_PAS_C}
{$define NSCONTROL_PAS_C}
{$include NSView.inc}
//#import <AppKit/NSText.h>
{$include NSText.inc}
//@class NSCell, NSFont, NSTextView, NSNotification, NSAttributedString, NSFormatter;
{ NSControl }
NSControl = class(NSView)
public
{+ (void)setCellClass:(Class)factoryId;
+ (Class)cellClass;}
constructor initWithFrame(frameRect: NSRect);
{- (void)sizeToFit;
- (void)calcSize;
- (id)cell;
- (void)setCell:(NSCell *)aCell;
- (id)selectedCell;
- (id)target;}
procedure setTarget(anObject: objc.id);
//- (SEL)action;
procedure setAction(aSelector: SEL);
{- (int)tag;
- (void)setTag:(int)anInt;
- (int)selectedTag;
- (void)setIgnoresMultiClick:(BOOL)flag;
- (BOOL)ignoresMultiClick;
- (int)sendActionOn:(int)mask;
- (BOOL)isContinuous;
- (void)setContinuous:(BOOL)flag;
- (BOOL)isEnabled;
- (void)setEnabled:(BOOL)flag;
- (void)setFloatingPointFormat:(BOOL)autoRange left:(unsigned)leftDigits right:(unsigned)rightDigits;
- (NSTextAlignment)alignment;
- (void)setAlignment:(NSTextAlignment)mode;
- (NSFont *)font;
- (void)setFont:(NSFont *)fontObj;
- (void)setFormatter:(NSFormatter *)newFormatter;
- (id)formatter;
- (void)setObjectValue:(id<NSCopying>)obj;}
procedure setStringValue(aString: CFStringRef);
{- (void)setIntValue:(int)anInt;
- (void)setFloatValue:(float)aFloat;
- (void)setDoubleValue:(double)aDouble;
- (id)objectValue;
- (NSString *)stringValue;
- (int)intValue;
- (float)floatValue;
- (double)doubleValue;
- (void)setNeedsDisplay;
- (void)updateCell:(NSCell *)aCell;
- (void)updateCellInside:(NSCell *)aCell;
- (void)drawCellInside:(NSCell *)aCell;
- (void)drawCell:(NSCell *)aCell;
- (void)selectCell:(NSCell *)aCell;
- (BOOL)sendAction:(SEL)theAction to:(id)theTarget;
- (void)takeIntValueFrom:(id)sender;
- (void)takeFloatValueFrom:(id)sender;
- (void)takeDoubleValueFrom:(id)sender;
- (void)takeStringValueFrom:(id)sender;
- (void)takeObjectValueFrom:(id)sender;
- (NSText *)currentEditor;
- (BOOL)abortEditing;
- (void)validateEditing;
- (void)mouseDown:(NSEvent *)theEvent;
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
- (NSWritingDirection)baseWritingDirection;
- (void)setBaseWritingDirection:(NSWritingDirection)writingDirection;
#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 */
@end
@interface NSControl(NSKeyboardUI)
- (void)performClick:sender;
- (void)setRefusesFirstResponder:(BOOL)flag;
- (BOOL)refusesFirstResponder;
@end
@interface NSObject(NSControlSubclassNotifications)
- (void)controlTextDidBeginEditing:(NSNotification *)obj;
- (void)controlTextDidEndEditing:(NSNotification *)obj;
- (void)controlTextDidChange:(NSNotification *)obj;
@end
@interface NSObject(NSControlSubclassDelegate)
// These delegate and notification methods are sent from NSControl subclasses that allow text editing such as NSTextField and NSMatrix. The classes that need to send these have delegates. NSControl does not.
- (BOOL)control:(NSControl *)control textShouldBeginEditing:(NSText *)fieldEditor;
- (BOOL)control:(NSControl *)control textShouldEndEditing:(NSText *)fieldEditor;
- (BOOL)control:(NSControl *)control didFailToFormatString:(NSString *)string errorDescription:(NSString *)error;
- (void)control:(NSControl *)control didFailToValidatePartialString:(NSString *)string errorDescription:(NSString *)error;
- (BOOL)control:(NSControl *)control isValidObject:(id)obj;
- (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)commandSelector;
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
- (NSArray *)control:(NSControl *)control textView:(NSTextView *)textView completions:(NSArray *)words forPartialWordRange:(NSRange)charRange indexOfSelectedItem:(int *)index;
#endif
@end
// userInfo keys:
APPKIT_EXTERN NSString *NSControlTextDidBeginEditingNotification; // @"NSFieldEditor"
APPKIT_EXTERN NSString *NSControlTextDidEndEditingNotification; // @"NSFieldEditor"
APPKIT_EXTERN NSString *NSControlTextDidChangeNotification; // @"NSFieldEditor"
@interface NSControl(NSControlAttributedStringMethods)
- (NSAttributedString *)attributedStringValue;
- (void)setAttributedStringValue:(NSAttributedString *)obj;
@end}
class function getClass: objc.id; override;
// All instance variables are private
class procedure setCellClass(_factoryId: _Class);
class function cellClass: _Class;
constructor initWithFrame(_frameRect: NSRect);
procedure sizeToFit;
procedure calcSize;
function cell: objc.id;
procedure setCell(_aCell: objc.id {NSCell});
function selectedCell: objc.id;
function target: objc.id;
procedure setTarget(_anObject: objc.id);
function action: SEL;
procedure setAction(_aSelector: SEL);
function tag: Integer;
procedure setTag(_anInt: Integer);
function selectedTag: Integer;
procedure setIgnoresMultiClick(_flag: LongBool);
function ignoresMultiClick: LongBool;
function sendActionOn(_mask: Integer): Integer;
function isContinuous: LongBool;
procedure setContinuous(_flag: LongBool);
function isEnabled: LongBool;
procedure setEnabled(_flag: LongBool);
procedure setFloatingPointFormat_left_right(_autoRange: LongBool; _leftDigits: LongWord; _rightDigits: LongWord);
function alignment: NSTextAlignment;
procedure setAlignment(_mode: NSTextAlignment);
function font: objc.id;{NSFont}
procedure setFont(_fontObj: objc.id {NSFont});
procedure setFormatter(_newFormatter: objc.id {NSFormatter});
function formatter: objc.id;
procedure setObjectValue(_obj: objc.id);
procedure setStringValue(_aString: CFStringRef);
procedure setIntValue(_anInt: Integer);
procedure setFloatValue(_aFloat: Single);
procedure setDoubleValue(_aDouble: double);
function objectValue: objc.id;
function stringValue: CFStringRef;
function intValue: Integer;
function floatValue: Single;
function doubleValue: double;
procedure setNeedsDisplay;
procedure updateCell(_aCell: objc.id {NSCell});
procedure updateCellInside(_aCell: objc.id {NSCell});
procedure drawCellInside(_aCell: objc.id {NSCell});
procedure drawCell(_aCell: objc.id {NSCell});
procedure selectCell(_aCell: objc.id {NSCell});
function sendAction_to(_theAction: SEL; _theTarget: objc.id): LongBool;
procedure takeIntValueFrom(_sender: objc.id);
procedure takeFloatValueFrom(_sender: objc.id);
procedure takeDoubleValueFrom(_sender: objc.id);
procedure takeStringValueFrom(_sender: objc.id);
procedure takeObjectValueFrom(_sender: objc.id);
function currentEditor: objc.id;{NSText}
function abortEditing: LongBool;
procedure validateEditing;
procedure mouseDown(_theEvent: objc.id {NSEvent});
{.$ifdef MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4}
function baseWritingDirection: NSWritingDirection;
procedure setBaseWritingDirection(_writingDirection: NSWritingDirection);
{.$endif}
procedure performClick;
procedure setRefusesFirstResponder(_flag: LongBool);
function refusesFirstResponder: LongBool;
function attributedStringValue: objc.id;{NSAttributedString}
procedure setAttributedStringValue(_obj: objc.id {NSAttributedString});
end;
{$endif}
{$endif}
{$ifdef IMPLEMENTATION}
constructor NSControl.initWithFrame(frameRect: NSRect);
{$ifdef IMPLEMENTATION}
const
StrNSControl_NSControl = 'NSControl';
StrNSControl_setCellClass = 'setCellClass:';
StrNSControl_cellClass = 'cellClass';
StrNSControl_initWithFrame = 'initWithFrame:';
StrNSControl_sizeToFit = 'sizeToFit';
StrNSControl_calcSize = 'calcSize';
StrNSControl_cell = 'cell';
StrNSControl_setCell = 'setCell:';
StrNSControl_selectedCell = 'selectedCell';
StrNSControl_target = 'target';
StrNSControl_setTarget = 'setTarget:';
StrNSControl_action = 'action';
StrNSControl_setAction = 'setAction:';
StrNSControl_tag = 'tag';
StrNSControl_setTag = 'setTag:';
StrNSControl_selectedTag = 'selectedTag';
StrNSControl_setIgnoresMultiClick = 'setIgnoresMultiClick:';
StrNSControl_ignoresMultiClick = 'ignoresMultiClick';
StrNSControl_sendActionOn = 'sendActionOn:';
StrNSControl_isContinuous = 'isContinuous';
StrNSControl_setContinuous = 'setContinuous:';
StrNSControl_isEnabled = 'isEnabled';
StrNSControl_setEnabled = 'setEnabled:';
StrNSControl_setFloatingPointFormat_left_right = 'setFloatingPointFormat:left:right:';
StrNSControl_alignment = 'alignment';
StrNSControl_setAlignment = 'setAlignment:';
StrNSControl_font = 'font';
StrNSControl_setFont = 'setFont:';
StrNSControl_setFormatter = 'setFormatter:';
StrNSControl_formatter = 'formatter';
StrNSControl_setObjectValue = 'setObjectValue:';
StrNSControl_setStringValue = 'setStringValue:';
StrNSControl_setIntValue = 'setIntValue:';
StrNSControl_setFloatValue = 'setFloatValue:';
StrNSControl_setDoubleValue = 'setDoubleValue:';
StrNSControl_objectValue = 'objectValue';
StrNSControl_stringValue = 'stringValue';
StrNSControl_intValue = 'intValue';
StrNSControl_floatValue = 'floatValue';
StrNSControl_doubleValue = 'doubleValue';
StrNSControl_setNeedsDisplay = 'setNeedsDisplay';
StrNSControl_updateCell = 'updateCell:';
StrNSControl_updateCellInside = 'updateCellInside:';
StrNSControl_drawCellInside = 'drawCellInside:';
StrNSControl_drawCell = 'drawCell:';
StrNSControl_selectCell = 'selectCell:';
StrNSControl_sendAction_to = 'sendAction:to:';
StrNSControl_takeIntValueFrom = 'takeIntValueFrom:';
StrNSControl_takeFloatValueFrom = 'takeFloatValueFrom:';
StrNSControl_takeDoubleValueFrom = 'takeDoubleValueFrom:';
StrNSControl_takeStringValueFrom = 'takeStringValueFrom:';
StrNSControl_takeObjectValueFrom = 'takeObjectValueFrom:';
StrNSControl_currentEditor = 'currentEditor';
StrNSControl_abortEditing = 'abortEditing';
StrNSControl_validateEditing = 'validateEditing';
StrNSControl_mouseDown = 'mouseDown:';
StrNSControl_baseWritingDirection = 'baseWritingDirection';
StrNSControl_setBaseWritingDirection = 'setBaseWritingDirection:';
StrNSControl_performClick = 'performClick';
StrNSControl_setRefusesFirstResponder = 'setRefusesFirstResponder:';
StrNSControl_refusesFirstResponder = 'refusesFirstResponder';
StrNSControl_attributedStringValue = 'attributedStringValue';
StrNSControl_setAttributedStringValue = 'setAttributedStringValue:';
{ NSControl }
class function NSControl.getClass: objc.id;
begin
Result := objc_getClass(StrNSControl_NSControl);
end;
class procedure NSControl.setCellClass(_factoryId: _Class);
type
initWithFrame_t = function (param1: objc.id; param2: SEL;
param3: NSRect): objc.id; cdecl;
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_factoryId: _Class); cdecl;
var
vmethod: initWithFrame_t;
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(getClass, sel_registerName(PChar(StrNSControl_setCellClass)), _factoryId);
end;
class function NSControl.cellClass: _Class;
begin
Result := _Class(objc_msgSend(getClass, sel_registerName(PChar(StrNSControl_cellClass)), []));
end;
constructor NSControl.initWithFrame(_frameRect: NSRect);
type
TmsgSendWrapper = function (param1: objc.id; param2: SEL;_frameRect: NSRect): objc.id; cdecl;
var
vmethod: TmsgSendWrapper;
begin
ClassID := getClass();
allocbuf := objc_msgSend(ClassId, sel_registerName(PChar(Str_alloc)), []);
vmethod := initWithFrame_t(@objc_msgSend);
Handle := vmethod(allocbuf, sel_registerName(PChar(Str_initWithFrame)), frameRect);
allocbuf := objc_msgSend(ClassID, sel_registerName(PChar(Str_alloc)), []);
vmethod := TmsgSendWrapper(@objc_msgSend);
Handle := vmethod(allocbuf, sel_registerName(PChar(StrNSControl_initWithFrame)), _frameRect);
end;
procedure NSControl.setTarget(anObject: objc.id);
type
setTarget_t = procedure (param1: objc.id; param2: SEL;
param3: objc.id); cdecl;
var
vmethod: setTarget_t;
procedure NSControl.sizeToFit;
begin
vmethod := setTarget_t(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(Str_setTarget)), anObject);
objc_msgSend(Handle, sel_registerName(PChar(StrNSControl_sizeToFit)), []);
end;
procedure NSControl.setAction(aSelector: SEL);
type
setAction_t = procedure (param1: objc.id; param2: SEL;
param3: SEL); cdecl;
var
vmethod: setAction_t;
procedure NSControl.calcSize;
begin
vmethod := setAction_t(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(Str_setAction)), aSelector);
objc_msgSend(Handle, sel_registerName(PChar(StrNSControl_calcSize)), []);
end;
procedure NSControl.setStringValue(aString: CFStringRef);
type
setStringValue_t = procedure (param1: objc.id; param2: SEL;
param3: CFStringRef); cdecl;
var
vmethod: setStringValue_t;
function NSControl.cell: objc.id;
begin
vmethod := setStringValue_t(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(Str_setStringValue)), aString);
Result := objc.id(objc_msgSend(Handle, sel_registerName(PChar(StrNSControl_cell)), []));
end;
procedure NSControl.setCell(_aCell: objc.id {NSCell});
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_aCell: objc.id {NSCell}); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSControl_setCell)), _aCell);
end;
function NSControl.selectedCell: objc.id;
begin
Result := objc.id(objc_msgSend(Handle, sel_registerName(PChar(StrNSControl_selectedCell)), []));
end;
function NSControl.target: objc.id;
begin
Result := objc.id(objc_msgSend(Handle, sel_registerName(PChar(StrNSControl_target)), []));
end;
procedure NSControl.setTarget(_anObject: objc.id);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_anObject: objc.id); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSControl_setTarget)), _anObject);
end;
function NSControl.action: SEL;
begin
Result := SEL(objc_msgSend(Handle, sel_registerName(PChar(StrNSControl_action)), []));
end;
procedure NSControl.setAction(_aSelector: SEL);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_aSelector: SEL); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSControl_setAction)), _aSelector);
end;
function NSControl.tag: Integer;
begin
Result := Integer(objc_msgSend(Handle, sel_registerName(PChar(StrNSControl_tag)), []));
end;
procedure NSControl.setTag(_anInt: Integer);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_anInt: Integer); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSControl_setTag)), _anInt);
end;
function NSControl.selectedTag: Integer;
begin
Result := Integer(objc_msgSend(Handle, sel_registerName(PChar(StrNSControl_selectedTag)), []));
end;
procedure NSControl.setIgnoresMultiClick(_flag: LongBool);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_flag: LongBool); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSControl_setIgnoresMultiClick)), _flag);
end;
function NSControl.ignoresMultiClick: LongBool;
begin
Result := LongBool(objc_msgSend(Handle, sel_registerName(PChar(StrNSControl_ignoresMultiClick)), []));
end;
function NSControl.sendActionOn(_mask: Integer): Integer;
type
TmsgSendWrapper = function (param1: objc.id; param2: SEL;_mask: Integer): Integer; cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
Result := Integer(vmethod(Handle, sel_registerName(PChar(StrNSControl_sendActionOn)), _mask));
end;
function NSControl.isContinuous: LongBool;
begin
Result := LongBool(objc_msgSend(Handle, sel_registerName(PChar(StrNSControl_isContinuous)), []));
end;
procedure NSControl.setContinuous(_flag: LongBool);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_flag: LongBool); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSControl_setContinuous)), _flag);
end;
function NSControl.isEnabled: LongBool;
begin
Result := LongBool(objc_msgSend(Handle, sel_registerName(PChar(StrNSControl_isEnabled)), []));
end;
procedure NSControl.setEnabled(_flag: LongBool);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_flag: LongBool); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSControl_setEnabled)), _flag);
end;
procedure NSControl.setFloatingPointFormat_left_right(_autoRange: LongBool; _leftDigits: LongWord; _rightDigits: LongWord);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_autoRange: LongBool; _leftDigits: LongWord; _rightDigits: LongWord); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSControl_setFloatingPointFormat_left_right)), _autoRange, _leftDigits, _rightDigits);
end;
function NSControl.alignment: NSTextAlignment;
begin
Result := NSTextAlignment(objc_msgSend(Handle, sel_registerName(PChar(StrNSControl_alignment)), []));
end;
procedure NSControl.setAlignment(_mode: NSTextAlignment);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_mode: NSTextAlignment); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSControl_setAlignment)), _mode);
end;
function NSControl.font: objc.id;
begin
Result := objc.id(objc_msgSend(Handle, sel_registerName(PChar(StrNSControl_font)), []));
end;
procedure NSControl.setFont(_fontObj: objc.id {NSFont});
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_fontObj: objc.id {NSFont}); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSControl_setFont)), _fontObj);
end;
procedure NSControl.setFormatter(_newFormatter: objc.id {NSFormatter});
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_newFormatter: objc.id {NSFormatter}); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSControl_setFormatter)), _newFormatter);
end;
function NSControl.formatter: objc.id;
begin
Result := objc.id(objc_msgSend(Handle, sel_registerName(PChar(StrNSControl_formatter)), []));
end;
procedure NSControl.setObjectValue(_obj: objc.id);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_obj: objc.id); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSControl_setObjectValue)), _obj);
end;
procedure NSControl.setStringValue(_aString: CFStringRef);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_aString: CFStringRef); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSControl_setStringValue)), _aString);
end;
procedure NSControl.setIntValue(_anInt: Integer);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_anInt: Integer); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSControl_setIntValue)), _anInt);
end;
procedure NSControl.setFloatValue(_aFloat: Single);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_aFloat: Single); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSControl_setFloatValue)), _aFloat);
end;
procedure NSControl.setDoubleValue(_aDouble: double);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_aDouble: double); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSControl_setDoubleValue)), _aDouble);
end;
function NSControl.objectValue: objc.id;
begin
Result := objc.id(objc_msgSend(Handle, sel_registerName(PChar(StrNSControl_objectValue)), []));
end;
function NSControl.stringValue: CFStringRef;
begin
Result := CFStringRef(objc_msgSend(Handle, sel_registerName(PChar(StrNSControl_stringValue)), []));
end;
function NSControl.intValue: Integer;
begin
Result := Integer(objc_msgSend(Handle, sel_registerName(PChar(StrNSControl_intValue)), []));
end;
function NSControl.floatValue: Single;
begin
Result := Single(objc_msgSend(Handle, sel_registerName(PChar(StrNSControl_floatValue)), []));
end;
function NSControl.doubleValue: double;
begin
Result := objc_msgSend_fpret(Handle, sel_registerName(PChar(StrNSControl_doubleValue)), []);
end;
procedure NSControl.setNeedsDisplay;
begin
objc_msgSend(Handle, sel_registerName(PChar(StrNSControl_setNeedsDisplay)), []);
end;
procedure NSControl.updateCell(_aCell: objc.id {NSCell});
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_aCell: objc.id {NSCell}); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSControl_updateCell)), _aCell);
end;
procedure NSControl.updateCellInside(_aCell: objc.id {NSCell});
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_aCell: objc.id {NSCell}); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSControl_updateCellInside)), _aCell);
end;
procedure NSControl.drawCellInside(_aCell: objc.id {NSCell});
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_aCell: objc.id {NSCell}); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSControl_drawCellInside)), _aCell);
end;
procedure NSControl.drawCell(_aCell: objc.id {NSCell});
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_aCell: objc.id {NSCell}); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSControl_drawCell)), _aCell);
end;
procedure NSControl.selectCell(_aCell: objc.id {NSCell});
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_aCell: objc.id {NSCell}); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSControl_selectCell)), _aCell);
end;
function NSControl.sendAction_to(_theAction: SEL; _theTarget: objc.id): LongBool;
type
TmsgSendWrapper = function (param1: objc.id; param2: SEL;_theAction: SEL; _theTarget: objc.id): LongBool; cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
Result := LongBool(vmethod(Handle, sel_registerName(PChar(StrNSControl_sendAction_to)), _theAction, _theTarget));
end;
procedure NSControl.takeIntValueFrom(_sender: objc.id);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_sender: objc.id); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSControl_takeIntValueFrom)), _sender);
end;
procedure NSControl.takeFloatValueFrom(_sender: objc.id);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_sender: objc.id); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSControl_takeFloatValueFrom)), _sender);
end;
procedure NSControl.takeDoubleValueFrom(_sender: objc.id);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_sender: objc.id); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSControl_takeDoubleValueFrom)), _sender);
end;
procedure NSControl.takeStringValueFrom(_sender: objc.id);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_sender: objc.id); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSControl_takeStringValueFrom)), _sender);
end;
procedure NSControl.takeObjectValueFrom(_sender: objc.id);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_sender: objc.id); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSControl_takeObjectValueFrom)), _sender);
end;
function NSControl.currentEditor: objc.id;
begin
Result := objc.id(objc_msgSend(Handle, sel_registerName(PChar(StrNSControl_currentEditor)), []));
end;
function NSControl.abortEditing: LongBool;
begin
Result := LongBool(objc_msgSend(Handle, sel_registerName(PChar(StrNSControl_abortEditing)), []));
end;
procedure NSControl.validateEditing;
begin
objc_msgSend(Handle, sel_registerName(PChar(StrNSControl_validateEditing)), []);
end;
procedure NSControl.mouseDown(_theEvent: objc.id {NSEvent});
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_theEvent: objc.id {NSEvent}); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSControl_mouseDown)), _theEvent);
end;
{.$ifdef MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4}
function NSControl.baseWritingDirection: NSWritingDirection;
begin
Result := NSWritingDirection(objc_msgSend(Handle, sel_registerName(PChar(StrNSControl_baseWritingDirection)), []));
end;
procedure NSControl.setBaseWritingDirection(_writingDirection: NSWritingDirection);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_writingDirection: NSWritingDirection); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSControl_setBaseWritingDirection)), _writingDirection);
end;
{.$endif}
procedure NSControl.performClick;
begin
objc_msgSend(Handle, sel_registerName(PChar(StrNSControl_performClick)), []);
end;
procedure NSControl.setRefusesFirstResponder(_flag: LongBool);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_flag: LongBool); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSControl_setRefusesFirstResponder)), _flag);
end;
function NSControl.refusesFirstResponder: LongBool;
begin
Result := LongBool(objc_msgSend(Handle, sel_registerName(PChar(StrNSControl_refusesFirstResponder)), []));
end;
function NSControl.attributedStringValue: objc.id;
begin
Result := objc.id(objc_msgSend(Handle, sel_registerName(PChar(StrNSControl_attributedStringValue)), []));
end;
procedure NSControl.setAttributedStringValue(_obj: objc.id {NSAttributedString});
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_obj: objc.id {NSAttributedString}); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSControl_setAttributedStringValue)), _obj);
end;
{$endif}

View File

@ -0,0 +1,21 @@
{%mainunit appkit.pas}
(*
NSSpellProtocol.h
Application Kit
Copyright (c) 1990-2005, Apple Computer, Inc.
All rights reserved.
*)
{$ifdef HEADER}
{$ifndef NSSPELLPROTOCOL_PAS_H}
{$define NSSPELLPROTOCOL_PAS_H}
//@protocol NSChangeSpelling
//- (void)changeSpelling:(id)sender;
//@end
//@protocol NSIgnoreMisspelledWords
//- (void)ignoreSpelling:(id)sender;
//@end
{$endif}
{$endif}

View File

@ -0,0 +1,846 @@
{%mainunit appkit.pas}
(*
NSText.h
Application Kit
Copyright (c) 1994-2005, Apple Computer, Inc.
All rights reserved.
*)
{$ifdef HEADER}
{$ifndef NSTEXT_PAS_H}
{$define NSTEXT_PAS_H}
{$include NSView.inc}
{$include NSSpellProtocol.inc}
// Various important unicodes
const
NSParagraphSeparatorCharacter = $2029;
NSLineSeparatorCharacter = $2028;
NSTabCharacter = $0009;
NSFormFeedCharacter = $000c;
NSNewlineCharacter = $000a;
NSCarriageReturnCharacter = $000d;
NSEnterCharacter = $0003;
NSBackspaceCharacter = $0008;
NSBackTabCharacter = $0019;
NSDeleteCharacter = $007f;
type
NSTextAlignment = (
NSLeftTextAlignment = 0,
NSRightTextAlignment = 1,
NSCenterTextAlignment = 2,
NSJustifiedTextAlignment = 3,
NSNaturalTextAlignment = 4
);
type
NSWritingDirection = (
NSWritingDirectionNatural = 1,
NSWritingDirectionLeftToRight = 0,
NSWritingDirectionRightToLeft
);
// Movement codes for movement between fields; these codes are the intValue of the
// NSTextMovement key in NSTextDidEndEditing notifications, and are used when completions
// change in the NSTextView method insertCompletion:forPartialWordRange:movement:isFinal:.
// Note that the value 0 is used for movements that do not fall under any of the other
// values, hence NSOtherTextMovement is a more appropriate name than the previous NSIllegalTextMovement.
const
NSIllegalTextMovement = 0;
NSReturnTextMovement = $10;
NSTabTextMovement = $11;
NSBacktabTextMovement = $12;
NSLeftTextMovement = $13;
NSRightTextMovement = $14;
NSUpTextMovement = $15;
NSDownTextMovement = $16;
NSCancelTextMovement = $17;
NSOtherTextMovement = 0;
//APPKIT_EXTERN NSString *NSTextDidBeginEditingNotification;
//APPKIT_EXTERN NSString *NSTextDidEndEditingNotification; // userInfo key: @"NSTextMovement"
//APPKIT_EXTERN NSString *NSTextDidChangeNotification;
{$endif}
{$endif}
{$ifdef FORWARD}
NSText = class;
{$endif}
{$ifdef CLASSES}
{$ifndef NSTEXT_PAS_C}
{$define NSTEXT_PAS_C}
{$include NSView.inc}
{$include NSSpellProtocol.inc}
{ NSText }
NSText = class(NSView)
public
class function getClass: objc.id; override;
// All instance variables are private
function string_: CFStringRef;
procedure setString(__string: CFStringRef);
procedure replaceCharactersInRange_withString(_range: NSRange; _aString: CFStringRef);
procedure replaceCharactersInRange_withRTF(_range: NSRange; _rtfData: CFDataRef);
procedure replaceCharactersInRange_withRTFD(_range: NSRange; _rtfdData: CFDataRef);
function RTFFromRange(_range: NSRange): CFDataRef;
function RTFDFromRange(_range: NSRange): CFDataRef;
function writeRTFDToFile_atomically(_path: CFStringRef; _flag: LongBool): LongBool;
function readRTFDFromFile(_path: CFStringRef): LongBool;
function delegate: objc.id;
procedure setDelegate(_anObject: objc.id);
function isEditable: LongBool;
procedure setEditable(_flag: LongBool);
function isSelectable: LongBool;
procedure setSelectable(_flag: LongBool);
function isRichText: LongBool;
procedure setRichText(_flag: LongBool);
// If NO, also clears setImportsGraphics:
function importsGraphics: LongBool;
procedure setImportsGraphics(_flag: LongBool);
// If YES, also sets setRichText:
procedure setBackgroundColor(_color: objc.id {NSColor});
function backgroundColor: objc.id;{NSColor}
procedure setDrawsBackground(_flag: LongBool);
function drawsBackground: LongBool;
procedure setFont(_obj: objc.id {NSFont});
function font: objc.id;{NSFont}
procedure setTextColor(_color: objc.id {NSColor});
function textColor: objc.id;{NSColor}
function alignment: NSTextAlignment;
procedure setAlignment(_mode: NSTextAlignment);
{.$ifdef MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4}
function baseWritingDirection: NSWritingDirection;
procedure setBaseWritingDirection(_writingDirection: NSWritingDirection);
{.$endif}
procedure setFieldEditor(_flag: LongBool);
// A BOOL to indicate whether to end on CR, TAB, etc
function isFieldEditor: LongBool;
procedure setTextColor_range(_color: objc.id {NSColor}; _range: NSRange);
procedure setFont_range(_font: objc.id {NSFont}; _range: NSRange);
function usesFontPanel: LongBool;
procedure setUsesFontPanel(_flag: LongBool);
function maxSize: NSSize;
procedure setMaxSize(_newMaxSize: NSSize);
function minSize: NSSize;
procedure setMinSize(_newMinSize: NSSize);
function isHorizontallyResizable: LongBool;
procedure setHorizontallyResizable(_flag: LongBool);
function isVerticallyResizable: LongBool;
procedure setVerticallyResizable(_flag: LongBool);
procedure sizeToFit;
procedure copy(_sender: objc.id);
procedure copyFont(_sender: objc.id);
procedure copyRuler(_sender: objc.id);
procedure cut(_sender: objc.id);
procedure delete(_sender: objc.id);
procedure paste(_sender: objc.id);
procedure pasteFont(_sender: objc.id);
procedure pasteRuler(_sender: objc.id);
procedure selectAll(_sender: objc.id);
procedure changeFont(_sender: objc.id);
procedure alignLeft(_sender: objc.id);
procedure alignRight(_sender: objc.id);
procedure alignCenter(_sender: objc.id);
procedure subscript(_sender: objc.id);
procedure superscript(_sender: objc.id);
procedure underline(_sender: objc.id);
procedure unscript(_sender: objc.id);
procedure showGuessPanel(_sender: objc.id);
procedure checkSpelling(_sender: objc.id);
procedure toggleRuler(_sender: objc.id);
function isRulerVisible: LongBool;
function selectedRange: NSRange;
procedure setSelectedRange(_range: NSRange);
procedure scrollRangeToVisible(_range: NSRange);
end;
{$endif}
{$endif}
{$ifdef IMPLEMENTATION}
const
StrNSText_NSText = 'NSText';
StrNSText_string = 'string';
StrNSText_setString = 'setString:';
StrNSText_replaceCharactersInRange_withString = 'replaceCharactersInRange:withString:';
StrNSText_replaceCharactersInRange_withRTF = 'replaceCharactersInRange:withRTF:';
StrNSText_replaceCharactersInRange_withRTFD = 'replaceCharactersInRange:withRTFD:';
StrNSText_RTFFromRange = 'RTFFromRange:';
StrNSText_RTFDFromRange = 'RTFDFromRange:';
StrNSText_writeRTFDToFile_atomically = 'writeRTFDToFile:atomically:';
StrNSText_readRTFDFromFile = 'readRTFDFromFile:';
StrNSText_delegate = 'delegate';
StrNSText_setDelegate = 'setDelegate:';
StrNSText_isEditable = 'isEditable';
StrNSText_setEditable = 'setEditable:';
StrNSText_isSelectable = 'isSelectable';
StrNSText_setSelectable = 'setSelectable:';
StrNSText_isRichText = 'isRichText';
StrNSText_setRichText = 'setRichText:';
StrNSText_importsGraphics = 'importsGraphics';
StrNSText_setImportsGraphics = 'setImportsGraphics:';
StrNSText_setBackgroundColor = 'setBackgroundColor:';
StrNSText_backgroundColor = 'backgroundColor';
StrNSText_setDrawsBackground = 'setDrawsBackground:';
StrNSText_drawsBackground = 'drawsBackground';
StrNSText_setFont = 'setFont:';
StrNSText_font = 'font';
StrNSText_setTextColor = 'setTextColor:';
StrNSText_textColor = 'textColor';
StrNSText_alignment = 'alignment';
StrNSText_setAlignment = 'setAlignment:';
StrNSText_baseWritingDirection = 'baseWritingDirection';
StrNSText_setBaseWritingDirection = 'setBaseWritingDirection:';
StrNSText_setFieldEditor = 'setFieldEditor:';
StrNSText_isFieldEditor = 'isFieldEditor';
StrNSText_setTextColor_range = 'setTextColor:range:';
StrNSText_setFont_range = 'setFont:range:';
StrNSText_usesFontPanel = 'usesFontPanel';
StrNSText_setUsesFontPanel = 'setUsesFontPanel:';
StrNSText_maxSize = 'maxSize';
StrNSText_setMaxSize = 'setMaxSize:';
StrNSText_minSize = 'minSize';
StrNSText_setMinSize = 'setMinSize:';
StrNSText_isHorizontallyResizable = 'isHorizontallyResizable';
StrNSText_setHorizontallyResizable = 'setHorizontallyResizable:';
StrNSText_isVerticallyResizable = 'isVerticallyResizable';
StrNSText_setVerticallyResizable = 'setVerticallyResizable:';
StrNSText_sizeToFit = 'sizeToFit';
StrNSText_copy = 'copy:';
StrNSText_copyFont = 'copyFont:';
StrNSText_copyRuler = 'copyRuler:';
StrNSText_cut = 'cut:';
StrNSText_delete = 'delete:';
StrNSText_paste = 'paste:';
StrNSText_pasteFont = 'pasteFont:';
StrNSText_pasteRuler = 'pasteRuler:';
StrNSText_selectAll = 'selectAll:';
StrNSText_changeFont = 'changeFont:';
StrNSText_alignLeft = 'alignLeft:';
StrNSText_alignRight = 'alignRight:';
StrNSText_alignCenter = 'alignCenter:';
StrNSText_subscript = 'subscript:';
StrNSText_superscript = 'superscript:';
StrNSText_underline = 'underline:';
StrNSText_unscript = 'unscript:';
StrNSText_showGuessPanel = 'showGuessPanel:';
StrNSText_checkSpelling = 'checkSpelling:';
StrNSText_toggleRuler = 'toggleRuler:';
StrNSText_isRulerVisible = 'isRulerVisible';
StrNSText_selectedRange = 'selectedRange';
StrNSText_setSelectedRange = 'setSelectedRange:';
StrNSText_scrollRangeToVisible = 'scrollRangeToVisible:';
{ NSText }
class function NSText.getClass: objc.id;
begin
Result := objc_getClass(StrNSText_NSText);
end;
function NSText.string_: CFStringRef;
begin
Result := CFStringRef(objc_msgSend(Handle, sel_registerName(PChar(StrNSText_string)), []));
end;
procedure NSText.setString(__string: CFStringRef);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;__string: CFStringRef); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSText_setString)), __string);
end;
procedure NSText.replaceCharactersInRange_withString(_range: NSRange; _aString: CFStringRef);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_range: NSRange; _aString: CFStringRef); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSText_replaceCharactersInRange_withString)), _range, _aString);
end;
procedure NSText.replaceCharactersInRange_withRTF(_range: NSRange; _rtfData: CFDataRef);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_range: NSRange; _rtfData: CFDataRef); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSText_replaceCharactersInRange_withRTF)), _range, _rtfData);
end;
procedure NSText.replaceCharactersInRange_withRTFD(_range: NSRange; _rtfdData: CFDataRef);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_range: NSRange; _rtfdData: CFDataRef); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSText_replaceCharactersInRange_withRTFD)), _range, _rtfdData);
end;
function NSText.RTFFromRange(_range: NSRange): CFDataRef;
type
TmsgSendWrapper = function (param1: objc.id; param2: SEL;_range: NSRange): CFDataRef; cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
Result := CFDataRef(vmethod(Handle, sel_registerName(PChar(StrNSText_RTFFromRange)), _range));
end;
function NSText.RTFDFromRange(_range: NSRange): CFDataRef;
type
TmsgSendWrapper = function (param1: objc.id; param2: SEL;_range: NSRange): CFDataRef; cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
Result := CFDataRef(vmethod(Handle, sel_registerName(PChar(StrNSText_RTFDFromRange)), _range));
end;
function NSText.writeRTFDToFile_atomically(_path: CFStringRef; _flag: LongBool): LongBool;
type
TmsgSendWrapper = function (param1: objc.id; param2: SEL;_path: CFStringRef; _flag: LongBool): LongBool; cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
Result := LongBool(vmethod(Handle, sel_registerName(PChar(StrNSText_writeRTFDToFile_atomically)), _path, _flag));
end;
function NSText.readRTFDFromFile(_path: CFStringRef): LongBool;
type
TmsgSendWrapper = function (param1: objc.id; param2: SEL;_path: CFStringRef): LongBool; cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
Result := LongBool(vmethod(Handle, sel_registerName(PChar(StrNSText_readRTFDFromFile)), _path));
end;
function NSText.delegate: objc.id;
begin
Result := objc.id(objc_msgSend(Handle, sel_registerName(PChar(StrNSText_delegate)), []));
end;
procedure NSText.setDelegate(_anObject: objc.id);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_anObject: objc.id); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSText_setDelegate)), _anObject);
end;
function NSText.isEditable: LongBool;
begin
Result := LongBool(objc_msgSend(Handle, sel_registerName(PChar(StrNSText_isEditable)), []));
end;
procedure NSText.setEditable(_flag: LongBool);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_flag: LongBool); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSText_setEditable)), _flag);
end;
function NSText.isSelectable: LongBool;
begin
Result := LongBool(objc_msgSend(Handle, sel_registerName(PChar(StrNSText_isSelectable)), []));
end;
procedure NSText.setSelectable(_flag: LongBool);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_flag: LongBool); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSText_setSelectable)), _flag);
end;
function NSText.isRichText: LongBool;
begin
Result := LongBool(objc_msgSend(Handle, sel_registerName(PChar(StrNSText_isRichText)), []));
end;
procedure NSText.setRichText(_flag: LongBool);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_flag: LongBool); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSText_setRichText)), _flag);
end;
function NSText.importsGraphics: LongBool;
begin
Result := LongBool(objc_msgSend(Handle, sel_registerName(PChar(StrNSText_importsGraphics)), []));
end;
procedure NSText.setImportsGraphics(_flag: LongBool);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_flag: LongBool); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSText_setImportsGraphics)), _flag);
end;
procedure NSText.setBackgroundColor(_color: objc.id {NSColor});
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_color: objc.id {NSColor}); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSText_setBackgroundColor)), _color);
end;
function NSText.backgroundColor: objc.id;
begin
Result := objc.id(objc_msgSend(Handle, sel_registerName(PChar(StrNSText_backgroundColor)), []));
end;
procedure NSText.setDrawsBackground(_flag: LongBool);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_flag: LongBool); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSText_setDrawsBackground)), _flag);
end;
function NSText.drawsBackground: LongBool;
begin
Result := LongBool(objc_msgSend(Handle, sel_registerName(PChar(StrNSText_drawsBackground)), []));
end;
procedure NSText.setFont(_obj: objc.id {NSFont});
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_obj: objc.id {NSFont}); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSText_setFont)), _obj);
end;
function NSText.font: objc.id;
begin
Result := objc.id(objc_msgSend(Handle, sel_registerName(PChar(StrNSText_font)), []));
end;
procedure NSText.setTextColor(_color: objc.id {NSColor});
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_color: objc.id {NSColor}); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSText_setTextColor)), _color);
end;
function NSText.textColor: objc.id;
begin
Result := objc.id(objc_msgSend(Handle, sel_registerName(PChar(StrNSText_textColor)), []));
end;
function NSText.alignment: NSTextAlignment;
begin
Result := NSTextAlignment(objc_msgSend(Handle, sel_registerName(PChar(StrNSText_alignment)), []));
end;
procedure NSText.setAlignment(_mode: NSTextAlignment);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_mode: NSTextAlignment); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSText_setAlignment)), _mode);
end;
{.$ifdef MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4}
function NSText.baseWritingDirection: NSWritingDirection;
begin
Result := NSWritingDirection(objc_msgSend(Handle, sel_registerName(PChar(StrNSText_baseWritingDirection)), []));
end;
procedure NSText.setBaseWritingDirection(_writingDirection: NSWritingDirection);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_writingDirection: NSWritingDirection); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSText_setBaseWritingDirection)), _writingDirection);
end;
{.$endif}
procedure NSText.setFieldEditor(_flag: LongBool);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_flag: LongBool); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSText_setFieldEditor)), _flag);
end;
function NSText.isFieldEditor: LongBool;
begin
Result := LongBool(objc_msgSend(Handle, sel_registerName(PChar(StrNSText_isFieldEditor)), []));
end;
procedure NSText.setTextColor_range(_color: objc.id {NSColor}; _range: NSRange);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_color: objc.id {NSColor}; _range: NSRange); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSText_setTextColor_range)), _color, _range);
end;
procedure NSText.setFont_range(_font: objc.id {NSFont}; _range: NSRange);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_font: objc.id {NSFont}; _range: NSRange); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSText_setFont_range)), _font, _range);
end;
function NSText.usesFontPanel: LongBool;
begin
Result := LongBool(objc_msgSend(Handle, sel_registerName(PChar(StrNSText_usesFontPanel)), []));
end;
procedure NSText.setUsesFontPanel(_flag: LongBool);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_flag: LongBool); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSText_setUsesFontPanel)), _flag);
end;
function NSText.maxSize: NSSize;
begin
objc_msgSend_stret(@Result, Handle, sel_registerName(PChar(StrNSText_maxSize)), []);
end;
procedure NSText.setMaxSize(_newMaxSize: NSSize);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_newMaxSize: NSSize); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSText_setMaxSize)), _newMaxSize);
end;
function NSText.minSize: NSSize;
begin
objc_msgSend_stret(@Result, Handle, sel_registerName(PChar(StrNSText_minSize)), []);
end;
procedure NSText.setMinSize(_newMinSize: NSSize);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_newMinSize: NSSize); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSText_setMinSize)), _newMinSize);
end;
function NSText.isHorizontallyResizable: LongBool;
begin
Result := LongBool(objc_msgSend(Handle, sel_registerName(PChar(StrNSText_isHorizontallyResizable)), []));
end;
procedure NSText.setHorizontallyResizable(_flag: LongBool);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_flag: LongBool); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSText_setHorizontallyResizable)), _flag);
end;
function NSText.isVerticallyResizable: LongBool;
begin
Result := LongBool(objc_msgSend(Handle, sel_registerName(PChar(StrNSText_isVerticallyResizable)), []));
end;
procedure NSText.setVerticallyResizable(_flag: LongBool);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_flag: LongBool); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSText_setVerticallyResizable)), _flag);
end;
procedure NSText.sizeToFit;
begin
objc_msgSend(Handle, sel_registerName(PChar(StrNSText_sizeToFit)), []);
end;
procedure NSText.copy(_sender: objc.id);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_sender: objc.id); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSText_copy)), _sender);
end;
procedure NSText.copyFont(_sender: objc.id);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_sender: objc.id); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSText_copyFont)), _sender);
end;
procedure NSText.copyRuler(_sender: objc.id);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_sender: objc.id); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSText_copyRuler)), _sender);
end;
procedure NSText.cut(_sender: objc.id);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_sender: objc.id); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSText_cut)), _sender);
end;
procedure NSText.delete(_sender: objc.id);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_sender: objc.id); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSText_delete)), _sender);
end;
procedure NSText.paste(_sender: objc.id);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_sender: objc.id); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSText_paste)), _sender);
end;
procedure NSText.pasteFont(_sender: objc.id);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_sender: objc.id); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSText_pasteFont)), _sender);
end;
procedure NSText.pasteRuler(_sender: objc.id);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_sender: objc.id); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSText_pasteRuler)), _sender);
end;
procedure NSText.selectAll(_sender: objc.id);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_sender: objc.id); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSText_selectAll)), _sender);
end;
procedure NSText.changeFont(_sender: objc.id);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_sender: objc.id); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSText_changeFont)), _sender);
end;
procedure NSText.alignLeft(_sender: objc.id);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_sender: objc.id); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSText_alignLeft)), _sender);
end;
procedure NSText.alignRight(_sender: objc.id);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_sender: objc.id); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSText_alignRight)), _sender);
end;
procedure NSText.alignCenter(_sender: objc.id);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_sender: objc.id); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSText_alignCenter)), _sender);
end;
procedure NSText.subscript(_sender: objc.id);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_sender: objc.id); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSText_subscript)), _sender);
end;
procedure NSText.superscript(_sender: objc.id);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_sender: objc.id); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSText_superscript)), _sender);
end;
procedure NSText.underline(_sender: objc.id);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_sender: objc.id); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSText_underline)), _sender);
end;
procedure NSText.unscript(_sender: objc.id);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_sender: objc.id); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSText_unscript)), _sender);
end;
procedure NSText.showGuessPanel(_sender: objc.id);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_sender: objc.id); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSText_showGuessPanel)), _sender);
end;
procedure NSText.checkSpelling(_sender: objc.id);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_sender: objc.id); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSText_checkSpelling)), _sender);
end;
procedure NSText.toggleRuler(_sender: objc.id);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_sender: objc.id); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSText_toggleRuler)), _sender);
end;
function NSText.isRulerVisible: LongBool;
begin
Result := LongBool(objc_msgSend(Handle, sel_registerName(PChar(StrNSText_isRulerVisible)), []));
end;
function NSText.selectedRange: NSRange;
begin
objc_msgSend_stret(@Result, Handle, sel_registerName(PChar(StrNSText_selectedRange)), []);
end;
procedure NSText.setSelectedRange(_range: NSRange);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_range: NSRange); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSText_setSelectedRange)), _range);
end;
procedure NSText.scrollRangeToVisible(_range: NSRange);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_range: NSRange); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSText_scrollRangeToVisible)), _range);
end;
{$endif}

View File

@ -3,16 +3,19 @@ cd parser
DEFAULT_INI="default.ini"
APPKIT_INI="../build/appkit.ini"
FRAMEWORK="/System/Library/Frameworks/AppKit.framework/Headers"
./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSApplication.h > ../appkit/NSApplication.inc
./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSBitmapImageRep.h > ../appkit/NSBitmapImageRep.inc
./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSButton.h > ../appkit/NSButton.inc
./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSGraphics.h > ../appkit/NSGraphics.inc
./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSGraphicsContext.h > ../appkit/NSGraphicsContext.inc
./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSImage.h > ../appkit/NSImage.inc
./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSImageRep.h > ../appkit/NSImageRep.inc
./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSMenu.h > ../appkit/NSMenu.inc
./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSMenuItem.h > ../appkit/NSMenuItem.inc
./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSStatusBar.h > ../appkit/NSStatusBar.inc
./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSStatusItem.h > ../appkit/NSStatusItem.inc
./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSUserInterfaceValidation.h > ../appkit/NSUserInterfaceValidation.inc
./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSWindow.h > ../appkit/NSWindow.inc
#./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSApplication.h > ../appkit/NSApplication.inc
#./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSBitmapImageRep.h > ../appkit/NSBitmapImageRep.inc
#./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSButton.h > ../appkit/NSButton.inc
./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSControl.h > ../appkit/NSControl.inc
#./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSGraphics.h > ../appkit/NSGraphics.inc
#./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSGraphicsContext.h > ../appkit/NSGraphicsContext.inc
#./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSImage.h > ../appkit/NSImage.inc
#./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSImageRep.h > ../appkit/NSImageRep.inc
#./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSMenu.h > ../appkit/NSMenu.inc
#./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSMenuItem.h > ../appkit/NSMenuItem.inc
./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSSpellProtocol.h > ../appkit/NSSpellProtocol.inc
#./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSStatusBar.h > ../appkit/NSStatusBar.inc
#./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSStatusItem.h > ../appkit/NSStatusItem.inc
./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSText.h > ../appkit/NSText.inc
#./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSUserInterfaceValidation.h > ../appkit/NSUserInterfaceValidation.inc
#./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSWindow.h > ../appkit/NSWindow.inc

View File

@ -3,5 +3,7 @@ cd parser
DEFAULT_INI="default.ini"
LOCAL_INI="../build/foundation.ini"
FRAMEWORK="/System/Library/Frameworks/Foundation.framework/Headers"
./objcparser -ini=$DEFAULT_INI -ini=$LOCAL_INI $FRAMEWORK/NSObjCRuntime.h > ../foundation/NSObjCRuntime.inc
./objcparser -ini=$DEFAULT_INI -ini=$LOCAL_INI $FRAMEWORK/NSDate.h > ../foundation/NSDate.inc
#./objcparser -ini=$DEFAULT_INI -ini=$LOCAL_INI $FRAMEWORK/NSObjCRuntime.h > ../foundation/NSObjCRuntime.inc
#./objcparser -ini=$DEFAULT_INI -ini=$LOCAL_INI $FRAMEWORK/NSDate.h > ../foundation/NSDate.inc
./objcparser -ini=$DEFAULT_INI -ini=$LOCAL_INI $FRAMEWORK/NSRange.h > ../foundation/NSRange.inc
./objcparser -ini=$DEFAULT_INI -ini=$LOCAL_INI $FRAMEWORK/NSValue.h > ../foundation/NSValue.inc

View File

@ -22,7 +22,6 @@ type
public
{ Extra binding functions }
constructor Create; override;
class function getClass: objc.id; override;
procedure AddMethods; override;
{ Objective-c Methods }
class procedure doShowStatusitem(_self: objc.id; _cmd: SEL; sender: objc.id); cdecl; static;
@ -46,8 +45,6 @@ type
end;
const
Str_TMyController = 'TMyController';
Str_doShowStatusitem = 'doShowStatusitem:';
Str_doHideStatusitem = 'doHideStatusitem:';
Str_doClose = 'doClose:';
@ -91,7 +88,7 @@ var
fileName: CFStringRef;
begin
{ The class is registered on the Objective-C runtime before the NSObject constructor is called }
if not CreateClassDefinition(Str_TMyController, Str_NSObject) then WriteLn('Failed to create objc class');
if not CreateClassDefinition(ClassName(), Str_NSObject) then WriteLn('Failed to create objc class');
inherited Create;
@ -101,11 +98,6 @@ begin
image := NSImage.initWithContentsOfFile(fileName);
end;
class function TMyController.getClass: objc.id;
begin
Result := objc_getClass(Str_TMyController);
end;
{ Objective-c Methods }
class procedure TMyController.doShowStatusitem(_self: objc.id; _cmd: SEL; sender: objc.id); cdecl;

View File

@ -24,6 +24,11 @@
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<RequiredPackages Count="1">
<Item1>
<PackageName Value="cocoa_pkg"/>
</Item1>
</RequiredPackages>
<Units Count="2">
<Unit0>
<Filename Value="statusitem.pas"/>
@ -39,10 +44,6 @@
</ProjectOptions>
<CompilerOptions>
<Version Value="5"/>
<SearchPaths>
<OtherUnitFiles Value="../../appkit/;../../../objc/;../../foundation/;../../applicationservices/coregraphics/"/>
<SrcPath Value="../../appkit/;../../../objc/;../../foundation/;../../applicationservices/coregraphics/"/>
</SearchPaths>
<CodeGeneration>
<Generate Value="Faster"/>
</CodeGeneration>

View File

@ -15,8 +15,11 @@ program statusitem;
{$mode delphi}
{$linkframework Cocoa}
{$linklib objc}
uses
objc, ctypes, FPCMacOSAll, AppKit, Foundation, controller;
objc, ctypes, FPCMacOSAll, AppKit, Foundation, controller, cocoa_pkg;
const
Str_Window_Title = 'StatusItem example project';

View File

@ -68,9 +68,9 @@
#import <Foundation/NSProcessInfo.h>
#import <Foundation/NSPropertyList.h>
#import <Foundation/NSProtocolChecker.h>
#import <Foundation/NSProxy.h>
#import <Foundation/NSRange.h>
#import <Foundation/NSRunLoop.h>
#import <Foundation/NSProxy.h>}
{$include NSRange.inc}
{#import <Foundation/NSRunLoop.h>
#import <Foundation/NSScanner.h>
#import <Foundation/NSSet.h>
#import <Foundation/NSSortDescriptor.h>
@ -84,9 +84,9 @@
#import <Foundation/NSUndoManager.h>
#import <Foundation/NSURL.h>
#import <Foundation/NSURLHandle.h>
#import <Foundation/NSUserDefaults.h>
#import <Foundation/NSValue.h>
#import <Foundation/NSValueTransformer.h>
#import <Foundation/NSUserDefaults.h>}
{$include NSValue.inc}
{#import <Foundation/NSValueTransformer.h>
#import <Foundation/NSXMLDTD.h>
#import <Foundation/NSXMLDTDNode.h>
#import <Foundation/NSXMLDocument.h>

View File

@ -195,8 +195,11 @@ begin
end;
class function NSObject.getClass: objc.id;
var
Str: string;
begin
Result := objc_getClass(Str_NSObject);
Str := ClassName();
Result := objc_getClass(PChar(Str));
end;
{ Defines the appropriate place to register methods in the objective-c runtime }

View File

@ -0,0 +1,50 @@
{%mainunit foundation.pas}
(* NSRange.h
Copyright (c) 1994-2005, Apple, Inc. All rights reserved.
*)
{$ifdef HEADER}
{$ifndef NSRANGE_PAS_H}
{$define NSRANGE_PAS_H}
{$include NSValue.inc}
type
_NSRange = packed record
location : LongWord;
length : LongWord;
end;
NSRange = _NSRange;
type
NSRangePointer = NSRange;
//FOUNDATION_STATIC_INLINE NSRange NSMakeRange(unsigned int loc, unsigned int len) {
//NSRange r;
//r.location = loc;
//r.length = len;
//return r;
//}
//FOUNDATION_STATIC_INLINE unsigned int NSMaxRange(NSRange range) {
//return (range.location + range.length);
//}
//FOUNDATION_STATIC_INLINE BOOL NSLocationInRange(unsigned int loc, NSRange range) {
//return (loc - range.location < range.length);
//}
//FOUNDATION_STATIC_INLINE BOOL NSEqualRanges(NSRange range1, NSRange range2) {
//return (range1.location == range2.location && range1.length == range2.length);
//}
//FOUNDATION_EXPORT NSRange NSUnionRange(NSRange range1, NSRange range2);
//FOUNDATION_EXPORT NSRange NSIntersectionRange(NSRange range1, NSRange range2);
//FOUNDATION_EXPORT NSString *NSStringFromRange(NSRange range);
//FOUNDATION_EXPORT NSRange NSRangeFromString(NSString *aString);
{$endif}
{$endif}
{$ifdef CLASSES}
{$ifndef NSRANGE_PAS_C}
{$define NSRANGE_PAS_C}
{$include NSValue.inc}
{$endif}
{$endif}

View File

@ -0,0 +1,664 @@
{%mainunit foundation.pas}
(* NSValue.h
Copyright (c) 1994-2005, Apple, Inc. All rights reserved.
*)
{$ifdef HEADER}
{$ifndef NSVALUE_PAS_H}
{$define NSVALUE_PAS_H}
{$include NSObject.inc}
{$endif}
{$endif}
{$ifdef FORWARD}
NSValue = class;
NSNumber = class;
{$endif}
{$ifdef CLASSES}
{$ifndef NSVALUE_PAS_C}
{$define NSVALUE_PAS_C}
{$include NSObject.inc}
{ NSValue }
NSValue = class(NSObject)
public
class function getClass: objc.id; override;
procedure getValue(_value: Pointer);
function objCType: PChar;
constructor initWithBytes_objCType(_value: Pointer; __type: PChar);
constructor valueWithBytes_objCType(_value: Pointer; __type: PChar);
constructor value_withObjCType(_value: Pointer; __type: PChar);
constructor valueWithNonretainedObject(_anObject: objc.id);
function nonretainedObjectValue: objc.id;
constructor valueWithPointer(_pointer: Pointer);
function pointerValue: Pointer;
function isEqualToValue(_value: objc.id {NSValue}): LongBool;
end;
{ NSNumber }
NSNumber = class(NSValue)
public
class function getClass: objc.id; override;
function charValue: char;
function unsignedCharValue: byte;
function shortValue: SmallInt;
function unsignedShortValue: Word;
function intValue: Integer;
function unsignedIntValue: LongWord;
function longValue: Integer;
function unsignedLongValue: LongWord;
function longLongValue: Int64;
function unsignedLongLongValue: Int64;
function floatValue: Single;
function doubleValue: double;
function boolValue: LongBool;
function stringValue: CFStringRef;
function compare(_otherNumber: CFNumberRef): NSComparisonResult;
function isEqualToNumber(_number: CFNumberRef): LongBool;
function descriptionWithLocale(_locale: CFDictionaryRef): CFStringRef;
constructor initWithChar(_value: char);
constructor initWithUnsignedChar(_value: byte);
constructor initWithShort(_value: SmallInt);
constructor initWithUnsignedShort(_value: Word);
constructor initWithInt(_value: Integer);
constructor initWithUnsignedInt(_value: LongWord);
constructor initWithLong(_value: Integer);
constructor initWithUnsignedLong(_value: LongWord);
constructor initWithLongLong(_value: Int64);
constructor initWithUnsignedLongLong(_value: Int64);
constructor initWithFloat(_value: Single);
constructor initWithDouble(_value: double);
constructor initWithBool(_value: LongBool);
constructor numberWithChar(_value: char);
constructor numberWithUnsignedChar(_value: byte);
constructor numberWithShort(_value: SmallInt);
constructor numberWithUnsignedShort(_value: Word);
constructor numberWithInt(_value: Integer);
constructor numberWithUnsignedInt(_value: LongWord);
constructor numberWithLong(_value: Integer);
constructor numberWithUnsignedLong(_value: LongWord);
constructor numberWithLongLong(_value: Int64);
constructor numberWithUnsignedLongLong(_value: Int64);
constructor numberWithFloat(_value: Single);
constructor numberWithDouble(_value: double);
constructor numberWithBool(_value: LongBool);
end;
{$endif}
{$endif}
{$ifdef IMPLEMENTATION}
const
StrNSValue_NSValue = 'NSValue';
StrNSValue_getValue = 'getValue:';
StrNSValue_objCType = 'objCType';
StrNSValue_initWithBytes_objCType = 'initWithBytes:objCType:';
StrNSValue_valueWithBytes_objCType = 'valueWithBytes:objCType:';
StrNSValue_value_withObjCType = 'value:withObjCType:';
StrNSValue_valueWithNonretainedObject = 'valueWithNonretainedObject:';
StrNSValue_nonretainedObjectValue = 'nonretainedObjectValue';
StrNSValue_valueWithPointer = 'valueWithPointer:';
StrNSValue_pointerValue = 'pointerValue';
StrNSValue_isEqualToValue = 'isEqualToValue:';
StrNSNumber_NSNumber = 'NSNumber';
StrNSNumber_charValue = 'charValue';
StrNSNumber_unsignedCharValue = 'unsignedCharValue';
StrNSNumber_shortValue = 'shortValue';
StrNSNumber_unsignedShortValue = 'unsignedShortValue';
StrNSNumber_intValue = 'intValue';
StrNSNumber_unsignedIntValue = 'unsignedIntValue';
StrNSNumber_longValue = 'longValue';
StrNSNumber_unsignedLongValue = 'unsignedLongValue';
StrNSNumber_longLongValue = 'longLongValue';
StrNSNumber_unsignedLongLongValue = 'unsignedLongLongValue';
StrNSNumber_floatValue = 'floatValue';
StrNSNumber_doubleValue = 'doubleValue';
StrNSNumber_boolValue = 'boolValue';
StrNSNumber_stringValue = 'stringValue';
StrNSNumber_compare = 'compare:';
StrNSNumber_isEqualToNumber = 'isEqualToNumber:';
StrNSNumber_descriptionWithLocale = 'descriptionWithLocale:';
StrNSNumber_initWithChar = 'initWithChar:';
StrNSNumber_initWithUnsignedChar = 'initWithUnsignedChar:';
StrNSNumber_initWithShort = 'initWithShort:';
StrNSNumber_initWithUnsignedShort = 'initWithUnsignedShort:';
StrNSNumber_initWithInt = 'initWithInt:';
StrNSNumber_initWithUnsignedInt = 'initWithUnsignedInt:';
StrNSNumber_initWithLong = 'initWithLong:';
StrNSNumber_initWithUnsignedLong = 'initWithUnsignedLong:';
StrNSNumber_initWithLongLong = 'initWithLongLong:';
StrNSNumber_initWithUnsignedLongLong = 'initWithUnsignedLongLong:';
StrNSNumber_initWithFloat = 'initWithFloat:';
StrNSNumber_initWithDouble = 'initWithDouble:';
StrNSNumber_initWithBool = 'initWithBool:';
StrNSNumber_numberWithChar = 'numberWithChar:';
StrNSNumber_numberWithUnsignedChar = 'numberWithUnsignedChar:';
StrNSNumber_numberWithShort = 'numberWithShort:';
StrNSNumber_numberWithUnsignedShort = 'numberWithUnsignedShort:';
StrNSNumber_numberWithInt = 'numberWithInt:';
StrNSNumber_numberWithUnsignedInt = 'numberWithUnsignedInt:';
StrNSNumber_numberWithLong = 'numberWithLong:';
StrNSNumber_numberWithUnsignedLong = 'numberWithUnsignedLong:';
StrNSNumber_numberWithLongLong = 'numberWithLongLong:';
StrNSNumber_numberWithUnsignedLongLong = 'numberWithUnsignedLongLong:';
StrNSNumber_numberWithFloat = 'numberWithFloat:';
StrNSNumber_numberWithDouble = 'numberWithDouble:';
StrNSNumber_numberWithBool = 'numberWithBool:';
{ NSValue }
class function NSValue.getClass: objc.id;
begin
Result := objc_getClass(StrNSValue_NSValue);
end;
procedure NSValue.getValue(_value: Pointer);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_value: Pointer); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSValue_getValue)), _value);
end;
function NSValue.objCType: PChar;
begin
Result := PChar(objc_msgSend(Handle, sel_registerName(PChar(StrNSValue_objCType)), []));
end;
constructor NSValue.initWithBytes_objCType(_value: Pointer; __type: PChar);
type
TmsgSendWrapper = function (param1: objc.id; param2: SEL;_value: Pointer; __type: PChar): objc.id; cdecl;
var
vmethod: TmsgSendWrapper;
begin
ClassID := getClass();
allocbuf := objc_msgSend(ClassID, sel_registerName(PChar(Str_alloc)), []);
vmethod := TmsgSendWrapper(@objc_msgSend);
Handle := vmethod(allocbuf, sel_registerName(PChar(StrNSValue_initWithBytes_objCType)), _value, __type);
end;
constructor NSValue.valueWithBytes_objCType(_value: Pointer; __type: PChar);
type
TmsgSendWrapper = function (param1: objc.id; param2: SEL;_value: Pointer; __type: PChar): objc.id; cdecl;
var
vmethod: TmsgSendWrapper;
begin
ClassID := getClass();
vmethod := TmsgSendWrapper(@objc_msgSend);
Handle := vmethod(ClassID, sel_registerName(PChar(StrNSValue_valueWithBytes_objCType)), _value, __type);
end;
constructor NSValue.value_withObjCType(_value: Pointer; __type: PChar);
type
TmsgSendWrapper = function (param1: objc.id; param2: SEL;_value: Pointer; __type: PChar): objc.id; cdecl;
var
vmethod: TmsgSendWrapper;
begin
ClassID := getClass();
vmethod := TmsgSendWrapper(@objc_msgSend);
Handle := vmethod(ClassID, sel_registerName(PChar(StrNSValue_value_withObjCType)), _value, __type);
end;
constructor NSValue.valueWithNonretainedObject(_anObject: objc.id);
type
TmsgSendWrapper = function (param1: objc.id; param2: SEL;_anObject: objc.id): objc.id; cdecl;
var
vmethod: TmsgSendWrapper;
begin
ClassID := getClass();
vmethod := TmsgSendWrapper(@objc_msgSend);
Handle := vmethod(ClassID, sel_registerName(PChar(StrNSValue_valueWithNonretainedObject)), _anObject);
end;
function NSValue.nonretainedObjectValue: objc.id;
begin
Result := objc.id(objc_msgSend(Handle, sel_registerName(PChar(StrNSValue_nonretainedObjectValue)), []));
end;
constructor NSValue.valueWithPointer(_pointer: Pointer);
type
TmsgSendWrapper = function (param1: objc.id; param2: SEL;_pointer: Pointer): objc.id; cdecl;
var
vmethod: TmsgSendWrapper;
begin
ClassID := getClass();
vmethod := TmsgSendWrapper(@objc_msgSend);
Handle := vmethod(ClassID, sel_registerName(PChar(StrNSValue_valueWithPointer)), _pointer);
end;
function NSValue.pointerValue: Pointer;
begin
Result := Pointer(objc_msgSend(Handle, sel_registerName(PChar(StrNSValue_pointerValue)), []));
end;
function NSValue.isEqualToValue(_value: objc.id {NSValue}): LongBool;
type
TmsgSendWrapper = function (param1: objc.id; param2: SEL;_value: objc.id {NSValue}): LongBool; cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
Result := LongBool(vmethod(Handle, sel_registerName(PChar(StrNSValue_isEqualToValue)), _value));
end;
{ NSNumber }
class function NSNumber.getClass: objc.id;
begin
Result := objc_getClass(StrNSNumber_NSNumber);
end;
function NSNumber.charValue: char;
begin
Result := char(objc_msgSend(Handle, sel_registerName(PChar(StrNSNumber_charValue)), []));
end;
function NSNumber.unsignedCharValue: byte;
begin
Result := byte(objc_msgSend(Handle, sel_registerName(PChar(StrNSNumber_unsignedCharValue)), []));
end;
function NSNumber.shortValue: SmallInt;
begin
Result := SmallInt(objc_msgSend(Handle, sel_registerName(PChar(StrNSNumber_shortValue)), []));
end;
function NSNumber.unsignedShortValue: Word;
begin
Result := Word(objc_msgSend(Handle, sel_registerName(PChar(StrNSNumber_unsignedShortValue)), []));
end;
function NSNumber.intValue: Integer;
begin
Result := Integer(objc_msgSend(Handle, sel_registerName(PChar(StrNSNumber_intValue)), []));
end;
function NSNumber.unsignedIntValue: LongWord;
begin
Result := LongWord(objc_msgSend(Handle, sel_registerName(PChar(StrNSNumber_unsignedIntValue)), []));
end;
function NSNumber.longValue: Integer;
begin
Result := Integer(objc_msgSend(Handle, sel_registerName(PChar(StrNSNumber_longValue)), []));
end;
function NSNumber.unsignedLongValue: LongWord;
begin
Result := LongWord(objc_msgSend(Handle, sel_registerName(PChar(StrNSNumber_unsignedLongValue)), []));
end;
function NSNumber.longLongValue: Int64;
begin
objc_msgSend_stret(@Result, Handle, sel_registerName(PChar(StrNSNumber_longLongValue)), []);
end;
function NSNumber.unsignedLongLongValue: Int64;
begin
objc_msgSend_stret(@Result, Handle, sel_registerName(PChar(StrNSNumber_unsignedLongLongValue)), []);
end;
function NSNumber.floatValue: Single;
begin
Result := Single(objc_msgSend(Handle, sel_registerName(PChar(StrNSNumber_floatValue)), []));
end;
function NSNumber.doubleValue: double;
begin
Result := objc_msgSend_fpret(Handle, sel_registerName(PChar(StrNSNumber_doubleValue)), []);
end;
function NSNumber.boolValue: LongBool;
begin
Result := LongBool(objc_msgSend(Handle, sel_registerName(PChar(StrNSNumber_boolValue)), []));
end;
function NSNumber.stringValue: CFStringRef;
begin
Result := CFStringRef(objc_msgSend(Handle, sel_registerName(PChar(StrNSNumber_stringValue)), []));
end;
function NSNumber.compare(_otherNumber: CFNumberRef): NSComparisonResult;
type
TmsgSendWrapper = function (param1: objc.id; param2: SEL;_otherNumber: CFNumberRef): NSComparisonResult; cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
Result := NSComparisonResult(vmethod(Handle, sel_registerName(PChar(StrNSNumber_compare)), _otherNumber));
end;
function NSNumber.isEqualToNumber(_number: CFNumberRef): LongBool;
type
TmsgSendWrapper = function (param1: objc.id; param2: SEL;_number: CFNumberRef): LongBool; cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
Result := LongBool(vmethod(Handle, sel_registerName(PChar(StrNSNumber_isEqualToNumber)), _number));
end;
function NSNumber.descriptionWithLocale(_locale: CFDictionaryRef): CFStringRef;
type
TmsgSendWrapper = function (param1: objc.id; param2: SEL;_locale: CFDictionaryRef): CFStringRef; cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
Result := CFStringRef(vmethod(Handle, sel_registerName(PChar(StrNSNumber_descriptionWithLocale)), _locale));
end;
constructor NSNumber.initWithChar(_value: char);
type
TmsgSendWrapper = function (param1: objc.id; param2: SEL;_value: char): objc.id; cdecl;
var
vmethod: TmsgSendWrapper;
begin
ClassID := getClass();
allocbuf := objc_msgSend(ClassID, sel_registerName(PChar(Str_alloc)), []);
vmethod := TmsgSendWrapper(@objc_msgSend);
Handle := vmethod(allocbuf, sel_registerName(PChar(StrNSNumber_initWithChar)), _value);
end;
constructor NSNumber.initWithUnsignedChar(_value: byte);
type
TmsgSendWrapper = function (param1: objc.id; param2: SEL;_value: byte): objc.id; cdecl;
var
vmethod: TmsgSendWrapper;
begin
ClassID := getClass();
allocbuf := objc_msgSend(ClassID, sel_registerName(PChar(Str_alloc)), []);
vmethod := TmsgSendWrapper(@objc_msgSend);
Handle := vmethod(allocbuf, sel_registerName(PChar(StrNSNumber_initWithUnsignedChar)), _value);
end;
constructor NSNumber.initWithShort(_value: SmallInt);
type
TmsgSendWrapper = function (param1: objc.id; param2: SEL;_value: SmallInt): objc.id; cdecl;
var
vmethod: TmsgSendWrapper;
begin
ClassID := getClass();
allocbuf := objc_msgSend(ClassID, sel_registerName(PChar(Str_alloc)), []);
vmethod := TmsgSendWrapper(@objc_msgSend);
Handle := vmethod(allocbuf, sel_registerName(PChar(StrNSNumber_initWithShort)), _value);
end;
constructor NSNumber.initWithUnsignedShort(_value: Word);
type
TmsgSendWrapper = function (param1: objc.id; param2: SEL;_value: Word): objc.id; cdecl;
var
vmethod: TmsgSendWrapper;
begin
ClassID := getClass();
allocbuf := objc_msgSend(ClassID, sel_registerName(PChar(Str_alloc)), []);
vmethod := TmsgSendWrapper(@objc_msgSend);
Handle := vmethod(allocbuf, sel_registerName(PChar(StrNSNumber_initWithUnsignedShort)), _value);
end;
constructor NSNumber.initWithInt(_value: Integer);
type
TmsgSendWrapper = function (param1: objc.id; param2: SEL;_value: Integer): objc.id; cdecl;
var
vmethod: TmsgSendWrapper;
begin
ClassID := getClass();
allocbuf := objc_msgSend(ClassID, sel_registerName(PChar(Str_alloc)), []);
vmethod := TmsgSendWrapper(@objc_msgSend);
Handle := vmethod(allocbuf, sel_registerName(PChar(StrNSNumber_initWithInt)), _value);
end;
constructor NSNumber.initWithUnsignedInt(_value: LongWord);
type
TmsgSendWrapper = function (param1: objc.id; param2: SEL;_value: LongWord): objc.id; cdecl;
var
vmethod: TmsgSendWrapper;
begin
ClassID := getClass();
allocbuf := objc_msgSend(ClassID, sel_registerName(PChar(Str_alloc)), []);
vmethod := TmsgSendWrapper(@objc_msgSend);
Handle := vmethod(allocbuf, sel_registerName(PChar(StrNSNumber_initWithUnsignedInt)), _value);
end;
constructor NSNumber.initWithLong(_value: Integer);
type
TmsgSendWrapper = function (param1: objc.id; param2: SEL;_value: Integer): objc.id; cdecl;
var
vmethod: TmsgSendWrapper;
begin
ClassID := getClass();
allocbuf := objc_msgSend(ClassID, sel_registerName(PChar(Str_alloc)), []);
vmethod := TmsgSendWrapper(@objc_msgSend);
Handle := vmethod(allocbuf, sel_registerName(PChar(StrNSNumber_initWithLong)), _value);
end;
constructor NSNumber.initWithUnsignedLong(_value: LongWord);
type
TmsgSendWrapper = function (param1: objc.id; param2: SEL;_value: LongWord): objc.id; cdecl;
var
vmethod: TmsgSendWrapper;
begin
ClassID := getClass();
allocbuf := objc_msgSend(ClassID, sel_registerName(PChar(Str_alloc)), []);
vmethod := TmsgSendWrapper(@objc_msgSend);
Handle := vmethod(allocbuf, sel_registerName(PChar(StrNSNumber_initWithUnsignedLong)), _value);
end;
constructor NSNumber.initWithLongLong(_value: Int64);
type
TmsgSendWrapper = function (param1: objc.id; param2: SEL;_value: Int64): objc.id; cdecl;
var
vmethod: TmsgSendWrapper;
begin
ClassID := getClass();
allocbuf := objc_msgSend(ClassID, sel_registerName(PChar(Str_alloc)), []);
vmethod := TmsgSendWrapper(@objc_msgSend);
Handle := vmethod(allocbuf, sel_registerName(PChar(StrNSNumber_initWithLongLong)), _value);
end;
constructor NSNumber.initWithUnsignedLongLong(_value: Int64);
type
TmsgSendWrapper = function (param1: objc.id; param2: SEL;_value: Int64): objc.id; cdecl;
var
vmethod: TmsgSendWrapper;
begin
ClassID := getClass();
allocbuf := objc_msgSend(ClassID, sel_registerName(PChar(Str_alloc)), []);
vmethod := TmsgSendWrapper(@objc_msgSend);
Handle := vmethod(allocbuf, sel_registerName(PChar(StrNSNumber_initWithUnsignedLongLong)), _value);
end;
constructor NSNumber.initWithFloat(_value: Single);
type
TmsgSendWrapper = function (param1: objc.id; param2: SEL;_value: Single): objc.id; cdecl;
var
vmethod: TmsgSendWrapper;
begin
ClassID := getClass();
allocbuf := objc_msgSend(ClassID, sel_registerName(PChar(Str_alloc)), []);
vmethod := TmsgSendWrapper(@objc_msgSend);
Handle := vmethod(allocbuf, sel_registerName(PChar(StrNSNumber_initWithFloat)), _value);
end;
constructor NSNumber.initWithDouble(_value: double);
type
TmsgSendWrapper = function (param1: objc.id; param2: SEL;_value: double): objc.id; cdecl;
var
vmethod: TmsgSendWrapper;
begin
ClassID := getClass();
allocbuf := objc_msgSend(ClassID, sel_registerName(PChar(Str_alloc)), []);
vmethod := TmsgSendWrapper(@objc_msgSend);
Handle := vmethod(allocbuf, sel_registerName(PChar(StrNSNumber_initWithDouble)), _value);
end;
constructor NSNumber.initWithBool(_value: LongBool);
type
TmsgSendWrapper = function (param1: objc.id; param2: SEL;_value: LongBool): objc.id; cdecl;
var
vmethod: TmsgSendWrapper;
begin
ClassID := getClass();
allocbuf := objc_msgSend(ClassID, sel_registerName(PChar(Str_alloc)), []);
vmethod := TmsgSendWrapper(@objc_msgSend);
Handle := vmethod(allocbuf, sel_registerName(PChar(StrNSNumber_initWithBool)), _value);
end;
constructor NSNumber.numberWithChar(_value: char);
type
TmsgSendWrapper = function (param1: objc.id; param2: SEL;_value: char): objc.id; cdecl;
var
vmethod: TmsgSendWrapper;
begin
ClassID := getClass();
vmethod := TmsgSendWrapper(@objc_msgSend);
Handle := vmethod(ClassID, sel_registerName(PChar(StrNSNumber_numberWithChar)), _value);
end;
constructor NSNumber.numberWithUnsignedChar(_value: byte);
type
TmsgSendWrapper = function (param1: objc.id; param2: SEL;_value: byte): objc.id; cdecl;
var
vmethod: TmsgSendWrapper;
begin
ClassID := getClass();
vmethod := TmsgSendWrapper(@objc_msgSend);
Handle := vmethod(ClassID, sel_registerName(PChar(StrNSNumber_numberWithUnsignedChar)), _value);
end;
constructor NSNumber.numberWithShort(_value: SmallInt);
type
TmsgSendWrapper = function (param1: objc.id; param2: SEL;_value: SmallInt): objc.id; cdecl;
var
vmethod: TmsgSendWrapper;
begin
ClassID := getClass();
vmethod := TmsgSendWrapper(@objc_msgSend);
Handle := vmethod(ClassID, sel_registerName(PChar(StrNSNumber_numberWithShort)), _value);
end;
constructor NSNumber.numberWithUnsignedShort(_value: Word);
type
TmsgSendWrapper = function (param1: objc.id; param2: SEL;_value: Word): objc.id; cdecl;
var
vmethod: TmsgSendWrapper;
begin
ClassID := getClass();
vmethod := TmsgSendWrapper(@objc_msgSend);
Handle := vmethod(ClassID, sel_registerName(PChar(StrNSNumber_numberWithUnsignedShort)), _value);
end;
constructor NSNumber.numberWithInt(_value: Integer);
type
TmsgSendWrapper = function (param1: objc.id; param2: SEL;_value: Integer): objc.id; cdecl;
var
vmethod: TmsgSendWrapper;
begin
ClassID := getClass();
vmethod := TmsgSendWrapper(@objc_msgSend);
Handle := vmethod(ClassID, sel_registerName(PChar(StrNSNumber_numberWithInt)), _value);
end;
constructor NSNumber.numberWithUnsignedInt(_value: LongWord);
type
TmsgSendWrapper = function (param1: objc.id; param2: SEL;_value: LongWord): objc.id; cdecl;
var
vmethod: TmsgSendWrapper;
begin
ClassID := getClass();
vmethod := TmsgSendWrapper(@objc_msgSend);
Handle := vmethod(ClassID, sel_registerName(PChar(StrNSNumber_numberWithUnsignedInt)), _value);
end;
constructor NSNumber.numberWithLong(_value: Integer);
type
TmsgSendWrapper = function (param1: objc.id; param2: SEL;_value: Integer): objc.id; cdecl;
var
vmethod: TmsgSendWrapper;
begin
ClassID := getClass();
vmethod := TmsgSendWrapper(@objc_msgSend);
Handle := vmethod(ClassID, sel_registerName(PChar(StrNSNumber_numberWithLong)), _value);
end;
constructor NSNumber.numberWithUnsignedLong(_value: LongWord);
type
TmsgSendWrapper = function (param1: objc.id; param2: SEL;_value: LongWord): objc.id; cdecl;
var
vmethod: TmsgSendWrapper;
begin
ClassID := getClass();
vmethod := TmsgSendWrapper(@objc_msgSend);
Handle := vmethod(ClassID, sel_registerName(PChar(StrNSNumber_numberWithUnsignedLong)), _value);
end;
constructor NSNumber.numberWithLongLong(_value: Int64);
type
TmsgSendWrapper = function (param1: objc.id; param2: SEL;_value: Int64): objc.id; cdecl;
var
vmethod: TmsgSendWrapper;
begin
ClassID := getClass();
vmethod := TmsgSendWrapper(@objc_msgSend);
Handle := vmethod(ClassID, sel_registerName(PChar(StrNSNumber_numberWithLongLong)), _value);
end;
constructor NSNumber.numberWithUnsignedLongLong(_value: Int64);
type
TmsgSendWrapper = function (param1: objc.id; param2: SEL;_value: Int64): objc.id; cdecl;
var
vmethod: TmsgSendWrapper;
begin
ClassID := getClass();
vmethod := TmsgSendWrapper(@objc_msgSend);
Handle := vmethod(ClassID, sel_registerName(PChar(StrNSNumber_numberWithUnsignedLongLong)), _value);
end;
constructor NSNumber.numberWithFloat(_value: Single);
type
TmsgSendWrapper = function (param1: objc.id; param2: SEL;_value: Single): objc.id; cdecl;
var
vmethod: TmsgSendWrapper;
begin
ClassID := getClass();
vmethod := TmsgSendWrapper(@objc_msgSend);
Handle := vmethod(ClassID, sel_registerName(PChar(StrNSNumber_numberWithFloat)), _value);
end;
constructor NSNumber.numberWithDouble(_value: double);
type
TmsgSendWrapper = function (param1: objc.id; param2: SEL;_value: double): objc.id; cdecl;
var
vmethod: TmsgSendWrapper;
begin
ClassID := getClass();
vmethod := TmsgSendWrapper(@objc_msgSend);
Handle := vmethod(ClassID, sel_registerName(PChar(StrNSNumber_numberWithDouble)), _value);
end;
constructor NSNumber.numberWithBool(_value: LongBool);
type
TmsgSendWrapper = function (param1: objc.id; param2: SEL;_value: LongBool): objc.id; cdecl;
var
vmethod: TmsgSendWrapper;
begin
ClassID := getClass();
vmethod := TmsgSendWrapper(@objc_msgSend);
Handle := vmethod(ClassID, sel_registerName(PChar(StrNSNumber_numberWithBool)), _value);
end;
{$endif}

View File

@ -5,6 +5,8 @@ unit foundation;
{$packrecords c}
{$endif}
{$linkframework Cocoa}
interface
uses SysUtils, ctypes, objc, FPCMacOSAll;