Improves Cocoa bindings

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@519 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
sekelsenmat
2008-07-31 17:24:12 +00:00
parent 0bc35fc726
commit 2c5517ee19
6 changed files with 684 additions and 107 deletions

View File

@@ -84,8 +84,8 @@
{$include NSSpellProtocol.inc} {$include NSSpellProtocol.inc}
{$include NSText.inc} {$include NSText.inc}
{$include NSTextField.inc} {$include NSTextField.inc}
{#import <AppKit/NSTextFieldCell.h> {$include NSTextFieldCell.inc}
#import <AppKit/NSText.h> {#import <AppKit/NSText.h>
#import <AppKit/NSTokenField.h> #import <AppKit/NSTokenField.h>
#import <AppKit/NSTokenFieldCell.h>} #import <AppKit/NSTokenFieldCell.h>}
{$include NSView.inc} {$include NSView.inc}

View File

@@ -1,88 +1,359 @@
{%mainunit appkit.pas} {%mainunit appkit.pas}
{ (*
NSTextField.h NSTextField.h
Application Kit Application Kit
Copyright (c) 1994-2005, Apple Computer, Inc. Copyright (c) 1994-2005, Apple Computer, Inc.
All rights reserved. All rights reserved.
} *)
{$ifdef HEADER} {$ifdef HEADER}
{$ifndef NSTEXTFIELD_PAS_H} {$ifndef NSTEXTFIELD_PAS_H}
{$define NSTEXTFIELD_PAS_H} {$define NSTEXTFIELD_PAS_H}
{$include NSControl.inc} {$include NSControl.inc}
{#import <AppKit/NSTextFieldCell.h>} {$include NSTextFieldCell.inc}
{ Class and method name strings }
const
Str_NSTextField = 'NSTextField';
{$endif} {$endif}
{$endif} {$endif}
{$ifdef FORWARD}
NSTextField = class;
{$endif}
{$ifdef CLASSES} {$ifdef CLASSES}
{$ifndef NSTEXTFIELD_PAS_C} {$ifndef NSTEXTFIELD_PAS_C}
{$define NSTEXTFIELD_PAS_C} {$define NSTEXTFIELD_PAS_C}
{$include NSControl.inc} {$include NSControl.inc}
{#import <AppKit/NSTextFieldCell.h>} {$include NSTextFieldCell.inc}
{ NSTextField }
NSTextField = class(NSControl) NSTextField = class(NSControl)
public public
{ Extra binding functions }
class function getClass: objc.id; override; class function getClass: objc.id; override;
public // All instance variables are private
procedure setBackgroundColor(_color: objc.id {NSColor});
{- (void)setBackgroundColor:(NSColor *)color; function backgroundColor: objc.id;{NSColor}
- (NSColor *)backgroundColor; procedure setDrawsBackground(_flag: LongBool);
- (void)setDrawsBackground:(BOOL)flag; function drawsBackground: LongBool;
- (BOOL)drawsBackground; procedure setTextColor(_color: objc.id {NSColor});
- (void)setTextColor:(NSColor *)color; function textColor: objc.id;{NSColor}
- (NSColor *)textColor; function isBordered: LongBool;
- (BOOL)isBordered; procedure setBordered(_flag: LongBool);
- (void)setBordered:(BOOL)flag; function isBezeled: LongBool;
- (BOOL)isBezeled; procedure setBezeled(_flag: LongBool);
- (void)setBezeled:(BOOL)flag; function isEditable: LongBool;
- (BOOL)isEditable; procedure setEditable(_flag: LongBool);
- (void)setEditable:(BOOL)flag; function isSelectable: LongBool;
- (BOOL)isSelectable; procedure setSelectable(_flag: LongBool);
- (void)setSelectable:(BOOL)flag; procedure selectText(_sender: objc.id);
- (void)selectText:(id)sender; function delegate: objc.id;
- (id)delegate; procedure setDelegate(_anObject: objc.id);
- (void)setDelegate:(id)anObject; function textShouldBeginEditing(_textObject: objc.id {NSText}): LongBool;
- (BOOL)textShouldBeginEditing:(NSText *)textObject; function textShouldEndEditing(_textObject: objc.id {NSText}): LongBool;
- (BOOL)textShouldEndEditing:(NSText *)textObject; procedure textDidBeginEditing(_notification: objc.id {NSNotification});
- (void)textDidBeginEditing:(NSNotification *)notification; procedure textDidEndEditing(_notification: objc.id {NSNotification});
- (void)textDidEndEditing:(NSNotification *)notification; procedure textDidChange(_notification: objc.id {NSNotification});
- (void)textDidChange:(NSNotification *)notification; function acceptsFirstResponder: LongBool;
- (BOOL)acceptsFirstResponder; {.$ifdef MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2}
procedure setBezelStyle(_style: NSTextFieldBezelStyle);
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2 function bezelStyle: NSTextFieldBezelStyle;
- (void)setBezelStyle:(NSTextFieldBezelStyle)style; {.$endif}
- (NSTextFieldBezelStyle)bezelStyle; procedure setTitleWithMnemonic(_stringWithAmpersand: CFStringRef);
#endif function allowsEditingTextAttributes: LongBool;
@end procedure setAllowsEditingTextAttributes(_flag: LongBool);
function importsGraphics: LongBool;
@interface NSTextField(NSKeyboardUI) procedure setImportsGraphics(_flag: LongBool);
- (void)setTitleWithMnemonic:(NSString *)stringWithAmpersand;
@end
@interface NSTextField(NSTextFieldAttributedStringMethods)
- (BOOL)allowsEditingTextAttributes;
- (void)setAllowsEditingTextAttributes:(BOOL)flag;
- (BOOL)importsGraphics;
- (void)setImportsGraphics:(BOOL)flag;
@end}
end; end;
{$endif} {$endif}
{$endif} {$endif}
{$ifdef IMPLEMENTATION} {$ifdef IMPLEMENTATION}
const
StrNSTextField_NSTextField = 'NSTextField';
StrNSTextField_setBackgroundColor = 'setBackgroundColor:';
StrNSTextField_backgroundColor = 'backgroundColor';
StrNSTextField_setDrawsBackground = 'setDrawsBackground:';
StrNSTextField_drawsBackground = 'drawsBackground';
StrNSTextField_setTextColor = 'setTextColor:';
StrNSTextField_textColor = 'textColor';
StrNSTextField_isBordered = 'isBordered';
StrNSTextField_setBordered = 'setBordered:';
StrNSTextField_isBezeled = 'isBezeled';
StrNSTextField_setBezeled = 'setBezeled:';
StrNSTextField_isEditable = 'isEditable';
StrNSTextField_setEditable = 'setEditable:';
StrNSTextField_isSelectable = 'isSelectable';
StrNSTextField_setSelectable = 'setSelectable:';
StrNSTextField_selectText = 'selectText:';
StrNSTextField_delegate = 'delegate';
StrNSTextField_setDelegate = 'setDelegate:';
StrNSTextField_textShouldBeginEditing = 'textShouldBeginEditing:';
StrNSTextField_textShouldEndEditing = 'textShouldEndEditing:';
StrNSTextField_textDidBeginEditing = 'textDidBeginEditing:';
StrNSTextField_textDidEndEditing = 'textDidEndEditing:';
StrNSTextField_textDidChange = 'textDidChange:';
StrNSTextField_acceptsFirstResponder = 'acceptsFirstResponder';
StrNSTextField_setBezelStyle = 'setBezelStyle:';
StrNSTextField_bezelStyle = 'bezelStyle';
StrNSTextField_setTitleWithMnemonic = 'setTitleWithMnemonic:';
StrNSTextField_allowsEditingTextAttributes = 'allowsEditingTextAttributes';
StrNSTextField_setAllowsEditingTextAttributes = 'setAllowsEditingTextAttributes:';
StrNSTextField_importsGraphics = 'importsGraphics';
StrNSTextField_setImportsGraphics = 'setImportsGraphics:';
{ NSTextField }
class function NSTextField.getClass: objc.id; class function NSTextField.getClass: objc.id;
begin begin
Result := objc_getClass(Str_NSTextField); Result := objc_getClass(StrNSTextField_NSTextField);
end;
procedure NSTextField.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(StrNSTextField_setBackgroundColor)), _color);
end;
function NSTextField.backgroundColor: objc.id;
begin
Result := objc.id(objc_msgSend(Handle, sel_registerName(PChar(StrNSTextField_backgroundColor)), []));
end;
procedure NSTextField.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(StrNSTextField_setDrawsBackground)), _flag);
end;
function NSTextField.drawsBackground: LongBool;
begin
Result := LongBool(objc_msgSend(Handle, sel_registerName(PChar(StrNSTextField_drawsBackground)), []));
end;
procedure NSTextField.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(StrNSTextField_setTextColor)), _color);
end;
function NSTextField.textColor: objc.id;
begin
Result := objc.id(objc_msgSend(Handle, sel_registerName(PChar(StrNSTextField_textColor)), []));
end;
function NSTextField.isBordered: LongBool;
begin
Result := LongBool(objc_msgSend(Handle, sel_registerName(PChar(StrNSTextField_isBordered)), []));
end;
procedure NSTextField.setBordered(_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(StrNSTextField_setBordered)), _flag);
end;
function NSTextField.isBezeled: LongBool;
begin
Result := LongBool(objc_msgSend(Handle, sel_registerName(PChar(StrNSTextField_isBezeled)), []));
end;
procedure NSTextField.setBezeled(_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(StrNSTextField_setBezeled)), _flag);
end;
function NSTextField.isEditable: LongBool;
begin
Result := LongBool(objc_msgSend(Handle, sel_registerName(PChar(StrNSTextField_isEditable)), []));
end;
procedure NSTextField.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(StrNSTextField_setEditable)), _flag);
end;
function NSTextField.isSelectable: LongBool;
begin
Result := LongBool(objc_msgSend(Handle, sel_registerName(PChar(StrNSTextField_isSelectable)), []));
end;
procedure NSTextField.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(StrNSTextField_setSelectable)), _flag);
end;
procedure NSTextField.selectText(_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(StrNSTextField_selectText)), _sender);
end;
function NSTextField.delegate: objc.id;
begin
Result := objc.id(objc_msgSend(Handle, sel_registerName(PChar(StrNSTextField_delegate)), []));
end;
procedure NSTextField.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(StrNSTextField_setDelegate)), _anObject);
end;
function NSTextField.textShouldBeginEditing(_textObject: objc.id {NSText}): LongBool;
type
TmsgSendWrapper = function (param1: objc.id; param2: SEL;_textObject: objc.id {NSText}): LongBool; cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
Result := LongBool(vmethod(Handle, sel_registerName(PChar(StrNSTextField_textShouldBeginEditing)), _textObject));
end;
function NSTextField.textShouldEndEditing(_textObject: objc.id {NSText}): LongBool;
type
TmsgSendWrapper = function (param1: objc.id; param2: SEL;_textObject: objc.id {NSText}): LongBool; cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
Result := LongBool(vmethod(Handle, sel_registerName(PChar(StrNSTextField_textShouldEndEditing)), _textObject));
end;
procedure NSTextField.textDidBeginEditing(_notification: objc.id {NSNotification});
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_notification: objc.id {NSNotification}); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSTextField_textDidBeginEditing)), _notification);
end;
procedure NSTextField.textDidEndEditing(_notification: objc.id {NSNotification});
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_notification: objc.id {NSNotification}); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSTextField_textDidEndEditing)), _notification);
end;
procedure NSTextField.textDidChange(_notification: objc.id {NSNotification});
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_notification: objc.id {NSNotification}); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSTextField_textDidChange)), _notification);
end;
function NSTextField.acceptsFirstResponder: LongBool;
begin
Result := LongBool(objc_msgSend(Handle, sel_registerName(PChar(StrNSTextField_acceptsFirstResponder)), []));
end;
{.$ifdef MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2}
procedure NSTextField.setBezelStyle(_style: NSTextFieldBezelStyle);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_style: NSTextFieldBezelStyle); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSTextField_setBezelStyle)), _style);
end;
function NSTextField.bezelStyle: NSTextFieldBezelStyle;
begin
Result := NSTextFieldBezelStyle(objc_msgSend(Handle, sel_registerName(PChar(StrNSTextField_bezelStyle)), []));
end;
{.$endif}
procedure NSTextField.setTitleWithMnemonic(_stringWithAmpersand: CFStringRef);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_stringWithAmpersand: CFStringRef); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSTextField_setTitleWithMnemonic)), _stringWithAmpersand);
end;
function NSTextField.allowsEditingTextAttributes: LongBool;
begin
Result := LongBool(objc_msgSend(Handle, sel_registerName(PChar(StrNSTextField_allowsEditingTextAttributes)), []));
end;
procedure NSTextField.setAllowsEditingTextAttributes(_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(StrNSTextField_setAllowsEditingTextAttributes)), _flag);
end;
function NSTextField.importsGraphics: LongBool;
begin
Result := LongBool(objc_msgSend(Handle, sel_registerName(PChar(StrNSTextField_importsGraphics)), []));
end;
procedure NSTextField.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(StrNSTextField_setImportsGraphics)), _flag);
end; end;
{$endif} {$endif}

View File

@@ -0,0 +1,198 @@
{%mainunit appkit.pas}
(*
NSTextFieldCell.h
Application Kit
Copyright (c) 1994-2005, Apple Computer, Inc.
All rights reserved.
*)
{$ifdef HEADER}
{$ifndef NSTEXTFIELDCELL_PAS_H}
{$define NSTEXTFIELDCELL_PAS_H}
{$include NSActionCell.inc}
{.$ifdef MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2}
{.$endif}
{.$ifdef MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2}
{.$endif}
type
NSTextFieldBezelStyle = (
NSTextFieldSquareBezel = 0,
NSTextFieldRoundedBezel = 1
);
{$endif}
{$endif}
{$ifdef FORWARD}
NSTextFieldCell = class;
{$endif}
{$ifdef CLASSES}
{$ifndef NSTEXTFIELDCELL_PAS_C}
{$define NSTEXTFIELDCELL_PAS_C}
{$include NSActionCell.inc}
{.$ifdef MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2}
{.$endif}
{ NSTextFieldCell }
NSTextFieldCell = class(NSActionCell)
public
class function getClass: objc.id; override;
// All instance variables are private
procedure setBackgroundColor(_color: objc.id {NSColor});
function backgroundColor: objc.id;{NSColor}
procedure setDrawsBackground(_flag: LongBool);
function drawsBackground: LongBool;
procedure setTextColor(_color: objc.id {NSColor});
function textColor: objc.id;{NSColor}
function setUpFieldEditorAttributes(_textObj: objc.id {NSText}): objc.id;{NSText}
{.$ifdef MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2}
procedure setBezelStyle(_style: NSTextFieldBezelStyle);
function bezelStyle: NSTextFieldBezelStyle;
{.$endif}
{.$ifdef MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3}
procedure setPlaceholderString(__string: CFStringRef);
function placeholderString: CFStringRef;
procedure setPlaceholderAttributedString(__string: objc.id {NSAttributedString});
function placeholderAttributedString: objc.id;{NSAttributedString}
{.$endif}
end;
{$endif}
{$endif}
{$ifdef IMPLEMENTATION}
const
StrNSTextFieldCell_NSTextFieldCell = 'NSTextFieldCell';
StrNSTextFieldCell_setBackgroundColor = 'setBackgroundColor:';
StrNSTextFieldCell_backgroundColor = 'backgroundColor';
StrNSTextFieldCell_setDrawsBackground = 'setDrawsBackground:';
StrNSTextFieldCell_drawsBackground = 'drawsBackground';
StrNSTextFieldCell_setTextColor = 'setTextColor:';
StrNSTextFieldCell_textColor = 'textColor';
StrNSTextFieldCell_setUpFieldEditorAttributes = 'setUpFieldEditorAttributes:';
StrNSTextFieldCell_setBezelStyle = 'setBezelStyle:';
StrNSTextFieldCell_bezelStyle = 'bezelStyle';
StrNSTextFieldCell_setPlaceholderString = 'setPlaceholderString:';
StrNSTextFieldCell_placeholderString = 'placeholderString';
StrNSTextFieldCell_setPlaceholderAttributedString = 'setPlaceholderAttributedString:';
StrNSTextFieldCell_placeholderAttributedString = 'placeholderAttributedString';
{ NSTextFieldCell }
class function NSTextFieldCell.getClass: objc.id;
begin
Result := objc_getClass(StrNSTextFieldCell_NSTextFieldCell);
end;
procedure NSTextFieldCell.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(StrNSTextFieldCell_setBackgroundColor)), _color);
end;
function NSTextFieldCell.backgroundColor: objc.id;
begin
Result := objc.id(objc_msgSend(Handle, sel_registerName(PChar(StrNSTextFieldCell_backgroundColor)), []));
end;
procedure NSTextFieldCell.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(StrNSTextFieldCell_setDrawsBackground)), _flag);
end;
function NSTextFieldCell.drawsBackground: LongBool;
begin
Result := LongBool(objc_msgSend(Handle, sel_registerName(PChar(StrNSTextFieldCell_drawsBackground)), []));
end;
procedure NSTextFieldCell.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(StrNSTextFieldCell_setTextColor)), _color);
end;
function NSTextFieldCell.textColor: objc.id;
begin
Result := objc.id(objc_msgSend(Handle, sel_registerName(PChar(StrNSTextFieldCell_textColor)), []));
end;
function NSTextFieldCell.setUpFieldEditorAttributes(_textObj: objc.id {NSText}): objc.id;
type
TmsgSendWrapper = function (param1: objc.id; param2: SEL;_textObj: objc.id {NSText}): objc.id; cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
Result := objc.id(vmethod(Handle, sel_registerName(PChar(StrNSTextFieldCell_setUpFieldEditorAttributes)), _textObj));
end;
{.$ifdef MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2}
procedure NSTextFieldCell.setBezelStyle(_style: NSTextFieldBezelStyle);
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_style: NSTextFieldBezelStyle); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSTextFieldCell_setBezelStyle)), _style);
end;
function NSTextFieldCell.bezelStyle: NSTextFieldBezelStyle;
begin
Result := NSTextFieldBezelStyle(objc_msgSend(Handle, sel_registerName(PChar(StrNSTextFieldCell_bezelStyle)), []));
end;
{.$endif}
{.$ifdef MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3}
procedure NSTextFieldCell.setPlaceholderString(__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(StrNSTextFieldCell_setPlaceholderString)), __string);
end;
function NSTextFieldCell.placeholderString: CFStringRef;
begin
Result := CFStringRef(objc_msgSend(Handle, sel_registerName(PChar(StrNSTextFieldCell_placeholderString)), []));
end;
procedure NSTextFieldCell.setPlaceholderAttributedString(__string: objc.id {NSAttributedString});
type
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;__string: objc.id {NSAttributedString}); cdecl;
var
vmethod: TmsgSendWrapper;
begin
vmethod := TmsgSendWrapper(@objc_msgSend);
vmethod(Handle, sel_registerName(PChar(StrNSTextFieldCell_setPlaceholderAttributedString)), __string);
end;
function NSTextFieldCell.placeholderAttributedString: objc.id;
begin
Result := objc.id(objc_msgSend(Handle, sel_registerName(PChar(StrNSTextFieldCell_placeholderAttributedString)), []));
end;
{.$endif}
{$endif}

View File

@@ -17,6 +17,8 @@ FRAMEWORK="/System/Library/Frameworks/AppKit.framework/Headers"
#./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSStatusBar.h > ../appkit/NSStatusBar.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/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/NSText.h > ../appkit/NSText.inc
#./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSTextField.h > ../appkit/NSTextField.inc
./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSTextFieldCell.h > ../appkit/NSTextFieldCell.inc
#./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSUserInterfaceValidation.h > ../appkit/NSUserInterfaceValidation.inc #./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSUserInterfaceValidation.h > ../appkit/NSUserInterfaceValidation.inc
./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSView.h > ../appkit/NSView.inc #./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSView.h > ../appkit/NSView.inc
#./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSWindow.h > ../appkit/NSWindow.inc #./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSWindow.h > ../appkit/NSWindow.inc

View File

@@ -28,24 +28,24 @@
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/> <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local> </local>
</RunParams> </RunParams>
<Units Count="54"> <Units Count="55">
<Unit0> <Unit0>
<Filename Value="simplewindow.pas"/> <Filename Value="simplewindow.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="simplewindow"/> <UnitName Value="simplewindow"/>
<CursorPos X="45" Y="69"/> <CursorPos X="34" Y="64"/>
<TopLine Value="55"/> <TopLine Value="43"/>
<EditorIndex Value="0"/> <EditorIndex Value="0"/>
<UsageCount Value="106"/> <UsageCount Value="110"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit0> </Unit0>
<Unit1> <Unit1>
<Filename Value="../../appkit/appkit.pas"/> <Filename Value="../../appkit/appkit.pas"/>
<UnitName Value="appkit"/> <UnitName Value="appkit"/>
<CursorPos X="102" Y="36"/> <CursorPos X="16" Y="26"/>
<TopLine Value="14"/> <TopLine Value="14"/>
<EditorIndex Value="1"/> <EditorIndex Value="3"/>
<UsageCount Value="42"/> <UsageCount Value="44"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit1> </Unit1>
<Unit2> <Unit2>
@@ -62,10 +62,10 @@
</Unit3> </Unit3>
<Unit4> <Unit4>
<Filename Value="../../appkit/AppKit.inc"/> <Filename Value="../../appkit/AppKit.inc"/>
<CursorPos X="16" Y="89"/> <CursorPos X="7" Y="85"/>
<TopLine Value="82"/> <TopLine Value="70"/>
<EditorIndex Value="3"/> <EditorIndex Value="5"/>
<UsageCount Value="39"/> <UsageCount Value="41"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit4> </Unit4>
<Unit5> <Unit5>
@@ -103,9 +103,9 @@
</Unit9> </Unit9>
<Unit10> <Unit10>
<Filename Value="../../foundation/Foundation.inc"/> <Filename Value="../../foundation/Foundation.inc"/>
<CursorPos X="33" Y="3"/> <CursorPos X="21" Y="130"/>
<TopLine Value="1"/> <TopLine Value="120"/>
<UsageCount Value="6"/> <UsageCount Value="10"/>
</Unit10> </Unit10>
<Unit11> <Unit11>
<Filename Value="../../foundation/Foundation_impl.inc"/> <Filename Value="../../foundation/Foundation_impl.inc"/>
@@ -128,9 +128,11 @@
<Unit14> <Unit14>
<Filename Value="../../foundation/foundation.pas"/> <Filename Value="../../foundation/foundation.pas"/>
<UnitName Value="foundation"/> <UnitName Value="foundation"/>
<CursorPos X="24" Y="7"/> <CursorPos X="15" Y="15"/>
<TopLine Value="6"/> <TopLine Value="5"/>
<UsageCount Value="20"/> <EditorIndex Value="1"/>
<UsageCount Value="22"/>
<Loaded Value="True"/>
</Unit14> </Unit14>
<Unit15> <Unit15>
<Filename Value="/System/Library/Frameworks/Foundation.framework/Versions/C/Headers/NSObject.h"/> <Filename Value="/System/Library/Frameworks/Foundation.framework/Versions/C/Headers/NSObject.h"/>
@@ -141,9 +143,11 @@
</Unit15> </Unit15>
<Unit16> <Unit16>
<Filename Value="../../foundation/NSObject.inc"/> <Filename Value="../../foundation/NSObject.inc"/>
<CursorPos X="48" Y="155"/> <CursorPos X="1" Y="53"/>
<TopLine Value="151"/> <TopLine Value="53"/>
<UsageCount Value="48"/> <EditorIndex Value="2"/>
<UsageCount Value="50"/>
<Loaded Value="True"/>
</Unit16> </Unit16>
<Unit17> <Unit17>
<Filename Value="../../foundation/NSObject_impl.inc"/> <Filename Value="../../foundation/NSObject_impl.inc"/>
@@ -153,10 +157,10 @@
</Unit17> </Unit17>
<Unit18> <Unit18>
<Filename Value="../../appkit/NSApplication.inc"/> <Filename Value="../../appkit/NSApplication.inc"/>
<CursorPos X="14" Y="107"/> <CursorPos X="11" Y="152"/>
<TopLine Value="98"/> <TopLine Value="144"/>
<EditorIndex Value="5"/> <EditorIndex Value="10"/>
<UsageCount Value="46"/> <UsageCount Value="48"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit18> </Unit18>
<Unit19> <Unit19>
@@ -168,10 +172,10 @@
</Unit19> </Unit19>
<Unit20> <Unit20>
<Filename Value="../../appkit/NSWindow.inc"/> <Filename Value="../../appkit/NSWindow.inc"/>
<CursorPos X="14" Y="13"/> <CursorPos X="31" Y="113"/>
<TopLine Value="106"/> <TopLine Value="107"/>
<EditorIndex Value="4"/> <EditorIndex Value="9"/>
<UsageCount Value="45"/> <UsageCount Value="47"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit20> </Unit20>
<Unit21> <Unit21>
@@ -191,7 +195,7 @@
<Filename Value="../../foundation/NSGeometry.inc"/> <Filename Value="../../foundation/NSGeometry.inc"/>
<CursorPos X="1" Y="1"/> <CursorPos X="1" Y="1"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UsageCount Value="53"/> <UsageCount Value="55"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit23> </Unit23>
<Unit24> <Unit24>
@@ -286,8 +290,8 @@
<Filename Value="../../appkit/NSStatusBar.inc"/> <Filename Value="../../appkit/NSStatusBar.inc"/>
<CursorPos X="4" Y="10"/> <CursorPos X="4" Y="10"/>
<TopLine Value="22"/> <TopLine Value="22"/>
<EditorIndex Value="2"/> <EditorIndex Value="4"/>
<UsageCount Value="50"/> <UsageCount Value="52"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit38> </Unit38>
<Unit39> <Unit39>
@@ -319,15 +323,19 @@
</Unit42> </Unit42>
<Unit43> <Unit43>
<Filename Value="../../appkit/NSTextField.inc"/> <Filename Value="../../appkit/NSTextField.inc"/>
<CursorPos X="17" Y="71"/> <CursorPos X="99" Y="5"/>
<TopLine Value="68"/> <TopLine Value="1"/>
<UsageCount Value="48"/> <EditorIndex Value="7"/>
<UsageCount Value="50"/>
<Loaded Value="True"/>
</Unit43> </Unit43>
<Unit44> <Unit44>
<Filename Value="../../appkit/NSControl.inc"/> <Filename Value="../../appkit/NSControl.inc"/>
<CursorPos X="48" Y="144"/> <CursorPos X="51" Y="62"/>
<TopLine Value="142"/> <TopLine Value="57"/>
<UsageCount Value="27"/> <EditorIndex Value="6"/>
<UsageCount Value="29"/>
<Loaded Value="True"/>
</Unit44> </Unit44>
<Unit45> <Unit45>
<Filename Value="/System/Library/Frameworks/AppKit.framework/Versions/C/Headers/NSView.h"/> <Filename Value="/System/Library/Frameworks/AppKit.framework/Versions/C/Headers/NSView.h"/>
@@ -338,10 +346,10 @@
</Unit45> </Unit45>
<Unit46> <Unit46>
<Filename Value="../../appkit/NSView.inc"/> <Filename Value="../../appkit/NSView.inc"/>
<CursorPos X="12" Y="4"/> <CursorPos X="9" Y="1692"/>
<TopLine Value="1"/> <TopLine Value="1687"/>
<EditorIndex Value="6"/> <EditorIndex Value="11"/>
<UsageCount Value="37"/> <UsageCount Value="39"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit46> </Unit46>
<Unit47> <Unit47>
@@ -382,12 +390,20 @@
</Unit52> </Unit52>
<Unit53> <Unit53>
<Filename Value="../../foundation/NSObjCRuntime.inc"/> <Filename Value="../../foundation/NSObjCRuntime.inc"/>
<CursorPos X="16" Y="11"/> <CursorPos X="24" Y="10"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UsageCount Value="10"/> <UsageCount Value="10"/>
</Unit53> </Unit53>
<Unit54>
<Filename Value="../../appkit/NSTextFieldCell.inc"/>
<CursorPos X="20" Y="44"/>
<TopLine Value="33"/>
<EditorIndex Value="8"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit54>
</Units> </Units>
<JumpHistory Count="3" HistoryIndex="2"> <JumpHistory Count="25" HistoryIndex="24">
<Position1> <Position1>
<Filename Value="simplewindow.pas"/> <Filename Value="simplewindow.pas"/>
<Caret Line="67" Column="13" TopLine="45"/> <Caret Line="67" Column="13" TopLine="45"/>
@@ -400,6 +416,94 @@
<Filename Value="simplewindow.pas"/> <Filename Value="simplewindow.pas"/>
<Caret Line="6" Column="63" TopLine="1"/> <Caret Line="6" Column="63" TopLine="1"/>
</Position3> </Position3>
<Position4>
<Filename Value="../../foundation/foundation.pas"/>
<Caret Line="15" Column="15" TopLine="5"/>
</Position4>
<Position5>
<Filename Value="../../foundation/NSObject.inc"/>
<Caret Line="64" Column="16" TopLine="49"/>
</Position5>
<Position6>
<Filename Value="../../foundation/NSObject.inc"/>
<Caret Line="67" Column="21" TopLine="59"/>
</Position6>
<Position7>
<Filename Value="../../foundation/NSObject.inc"/>
<Caret Line="1" Column="1" TopLine="1"/>
</Position7>
<Position8>
<Filename Value="../../foundation/NSObject.inc"/>
<Caret Line="306" Column="1" TopLine="281"/>
</Position8>
<Position9>
<Filename Value="../../foundation/NSObject.inc"/>
<Caret Line="55" Column="1" TopLine="53"/>
</Position9>
<Position10>
<Filename Value="../../foundation/NSObject.inc"/>
<Caret Line="306" Column="1" TopLine="281"/>
</Position10>
<Position11>
<Filename Value="../../appkit/appkit.pas"/>
<Caret Line="26" Column="16" TopLine="14"/>
</Position11>
<Position12>
<Filename Value="../../appkit/AppKit.inc"/>
<Caret Line="91" Column="13" TopLine="68"/>
</Position12>
<Position13>
<Filename Value="../../appkit/NSView.inc"/>
<Caret Line="85" Column="24" TopLine="66"/>
</Position13>
<Position14>
<Filename Value="../../appkit/NSView.inc"/>
<Caret Line="78" Column="18" TopLine="65"/>
</Position14>
<Position15>
<Filename Value="../../appkit/NSView.inc"/>
<Caret Line="285" Column="38" TopLine="272"/>
</Position15>
<Position16>
<Filename Value="../../appkit/NSView.inc"/>
<Caret Line="456" Column="23" TopLine="443"/>
</Position16>
<Position17>
<Filename Value="../../appkit/NSView.inc"/>
<Caret Line="1" Column="1" TopLine="1"/>
</Position17>
<Position18>
<Filename Value="../../appkit/NSWindow.inc"/>
<Caret Line="112" Column="21" TopLine="106"/>
</Position18>
<Position19>
<Filename Value="../../appkit/AppKit.inc"/>
<Caret Line="86" Column="15" TopLine="62"/>
</Position19>
<Position20>
<Filename Value="../../appkit/AppKit.inc"/>
<Caret Line="17" Column="19" TopLine="1"/>
</Position20>
<Position21>
<Filename Value="simplewindow.pas"/>
<Caret Line="22" Column="29" TopLine="9"/>
</Position21>
<Position22>
<Filename Value="simplewindow.pas"/>
<Caret Line="66" Column="39" TopLine="46"/>
</Position22>
<Position23>
<Filename Value="simplewindow.pas"/>
<Caret Line="65" Column="23" TopLine="53"/>
</Position23>
<Position24>
<Filename Value="../../appkit/NSTextField.inc"/>
<Caret Line="71" Column="28" TopLine="63"/>
</Position24>
<Position25>
<Filename Value="../../appkit/NSTextFieldCell.inc"/>
<Caret Line="1" Column="1" TopLine="1"/>
</Position25>
</JumpHistory> </JumpHistory>
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>

View File

@@ -21,8 +21,8 @@ uses
objc, ctypes, FPCMacOSAll, AppKit, Foundation; objc, ctypes, FPCMacOSAll, AppKit, Foundation;
const const
Str_Window_Title = 'This is the title'; Str_Window_Title = 'Pascal Cocoa Example';
Str_Window_Message = 'This is the message'; Str_Window_Message = 'NSTextField Control';
var var
{ classes } { classes }
pool: NSAutoreleasePool; pool: NSAutoreleasePool;
@@ -44,7 +44,7 @@ begin
MainWindowRect.origin.x := 300.0; MainWindowRect.origin.x := 300.0;
MainWindowRect.origin.y := 300.0; MainWindowRect.origin.y := 300.0;
MainWindowRect.size.width := 300.0; MainWindowRect.size.width := 300.0;
MainWindowRect.size.height := 500.0; MainWindowRect.size.height := 100.0;
MainWindow := NSWindow.initWithContentRect_styleMask_backing_defer(MainWindowRect, MainWindow := NSWindow.initWithContentRect_styleMask_backing_defer(MainWindowRect,
NSTitledWindowMask or NSClosableWindowMask or NSMiniaturizableWindowMask or NSResizableWindowMask, NSTitledWindowMask or NSClosableWindowMask or NSMiniaturizableWindowMask or NSResizableWindowMask,
@@ -58,11 +58,13 @@ begin
{ Adds a NSTextField with a string } { Adds a NSTextField with a string }
CFMessage := CFStringCreateWithPascalString(nil, Str_Window_Message, kCFStringEncodingUTF8); CFMessage := CFStringCreateWithPascalString(nil, Str_Window_Message, kCFStringEncodingUTF8);
TextFieldRect.origin.x := 0.0; TextFieldRect.origin.x := 50.0;
TextFieldRect.origin.y := 200.0; TextFieldRect.origin.y := 50.0;
TextFieldRect.size.width := 300.0; TextFieldRect.size.width := 200.0;
TextFieldRect.size.height := 100.0; TextFieldRect.size.height := 25.0;
TextField := NSTextField.initWithFrame(TextFieldRect); TextField := NSTextField.initWithFrame(TextFieldRect);
TextField.setBordered(LongBool(NO));
TextField.setDrawsBackground(LongBool(NO));
TextField.setStringValue(CFMessage); TextField.setStringValue(CFMessage);
MainWindowView := NSView.CreateWithHandle(MainWindow.contentView); MainWindowView := NSView.CreateWithHandle(MainWindow.contentView);
MainWindowView.addSubview(TextField.Handle); MainWindowView.addSubview(TextField.Handle);