diff --git a/bindings/pascocoa/appkit/AppKit.inc b/bindings/pascocoa/appkit/AppKit.inc index 9eb782aa0..3cd5345c3 100644 --- a/bindings/pascocoa/appkit/AppKit.inc +++ b/bindings/pascocoa/appkit/AppKit.inc @@ -84,8 +84,8 @@ {$include NSSpellProtocol.inc} {$include NSText.inc} {$include NSTextField.inc} -{#import -#import +{$include NSTextFieldCell.inc} +{#import #import #import } {$include NSView.inc} diff --git a/bindings/pascocoa/appkit/NSTextField.inc b/bindings/pascocoa/appkit/NSTextField.inc index 4772f4bce..4f7f282f9 100644 --- a/bindings/pascocoa/appkit/NSTextField.inc +++ b/bindings/pascocoa/appkit/NSTextField.inc @@ -1,88 +1,359 @@ {%mainunit appkit.pas} -{ +(* NSTextField.h Application Kit Copyright (c) 1994-2005, Apple Computer, Inc. All rights reserved. -} +*) {$ifdef HEADER} {$ifndef NSTEXTFIELD_PAS_H} {$define NSTEXTFIELD_PAS_H} {$include NSControl.inc} -{#import } - -{ Class and method name strings } -const - Str_NSTextField = 'NSTextField'; +{$include NSTextFieldCell.inc} {$endif} {$endif} + +{$ifdef FORWARD} + NSTextField = class; + +{$endif} + {$ifdef CLASSES} {$ifndef NSTEXTFIELD_PAS_C} {$define NSTEXTFIELD_PAS_C} {$include NSControl.inc} -{#import } +{$include NSTextFieldCell.inc} + + { NSTextField } NSTextField = class(NSControl) public - { Extra binding functions } class function getClass: objc.id; override; - public - -{- (void)setBackgroundColor:(NSColor *)color; -- (NSColor *)backgroundColor; -- (void)setDrawsBackground:(BOOL)flag; -- (BOOL)drawsBackground; -- (void)setTextColor:(NSColor *)color; -- (NSColor *)textColor; -- (BOOL)isBordered; -- (void)setBordered:(BOOL)flag; -- (BOOL)isBezeled; -- (void)setBezeled:(BOOL)flag; -- (BOOL)isEditable; -- (void)setEditable:(BOOL)flag; -- (BOOL)isSelectable; -- (void)setSelectable:(BOOL)flag; -- (void)selectText:(id)sender; -- (id)delegate; -- (void)setDelegate:(id)anObject; -- (BOOL)textShouldBeginEditing:(NSText *)textObject; -- (BOOL)textShouldEndEditing:(NSText *)textObject; -- (void)textDidBeginEditing:(NSNotification *)notification; -- (void)textDidEndEditing:(NSNotification *)notification; -- (void)textDidChange:(NSNotification *)notification; -- (BOOL)acceptsFirstResponder; - -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2 -- (void)setBezelStyle:(NSTextFieldBezelStyle)style; -- (NSTextFieldBezelStyle)bezelStyle; -#endif -@end - -@interface NSTextField(NSKeyboardUI) -- (void)setTitleWithMnemonic:(NSString *)stringWithAmpersand; -@end - -@interface NSTextField(NSTextFieldAttributedStringMethods) -- (BOOL)allowsEditingTextAttributes; -- (void)setAllowsEditingTextAttributes:(BOOL)flag; -- (BOOL)importsGraphics; -- (void)setImportsGraphics:(BOOL)flag; -@end} - + // 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 isBordered: LongBool; + procedure setBordered(_flag: LongBool); + function isBezeled: LongBool; + procedure setBezeled(_flag: LongBool); + function isEditable: LongBool; + procedure setEditable(_flag: LongBool); + function isSelectable: LongBool; + procedure setSelectable(_flag: LongBool); + procedure selectText(_sender: objc.id); + function delegate: objc.id; + procedure setDelegate(_anObject: objc.id); + function textShouldBeginEditing(_textObject: objc.id {NSText}): LongBool; + function textShouldEndEditing(_textObject: objc.id {NSText}): LongBool; + procedure textDidBeginEditing(_notification: objc.id {NSNotification}); + procedure textDidEndEditing(_notification: objc.id {NSNotification}); + procedure textDidChange(_notification: objc.id {NSNotification}); + function acceptsFirstResponder: LongBool; + {.$ifdef MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2} + procedure setBezelStyle(_style: NSTextFieldBezelStyle); + function bezelStyle: NSTextFieldBezelStyle; + {.$endif} + procedure setTitleWithMnemonic(_stringWithAmpersand: CFStringRef); + function allowsEditingTextAttributes: LongBool; + procedure setAllowsEditingTextAttributes(_flag: LongBool); + function importsGraphics: LongBool; + procedure setImportsGraphics(_flag: LongBool); end; {$endif} {$endif} + {$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; 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; {$endif} - diff --git a/bindings/pascocoa/appkit/NSTextFieldCell.inc b/bindings/pascocoa/appkit/NSTextFieldCell.inc new file mode 100644 index 000000000..973d7009f --- /dev/null +++ b/bindings/pascocoa/appkit/NSTextFieldCell.inc @@ -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} diff --git a/bindings/pascocoa/build/buildappkit.sh b/bindings/pascocoa/build/buildappkit.sh index 27148963f..a63815f4f 100755 --- a/bindings/pascocoa/build/buildappkit.sh +++ b/bindings/pascocoa/build/buildappkit.sh @@ -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/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/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/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 diff --git a/bindings/pascocoa/examples/simplewindow/simplewindow.lpi b/bindings/pascocoa/examples/simplewindow/simplewindow.lpi index 544410247..6acf34e5c 100644 --- a/bindings/pascocoa/examples/simplewindow/simplewindow.lpi +++ b/bindings/pascocoa/examples/simplewindow/simplewindow.lpi @@ -28,24 +28,24 @@ - + - - + + - + - + - - + + @@ -62,10 +62,10 @@ - - - - + + + + @@ -103,9 +103,9 @@ - - - + + + @@ -128,9 +128,11 @@ - - - + + + + + @@ -141,9 +143,11 @@ - - - + + + + + @@ -153,10 +157,10 @@ - - - - + + + + @@ -168,10 +172,10 @@ - - - - + + + + @@ -191,7 +195,7 @@ - + @@ -286,8 +290,8 @@ - - + + @@ -319,15 +323,19 @@ - - - + + + + + - - - + + + + + @@ -338,10 +346,10 @@ - - - - + + + + @@ -382,12 +390,20 @@ - + + + + + + + + + - + @@ -400,6 +416,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bindings/pascocoa/examples/simplewindow/simplewindow.pas b/bindings/pascocoa/examples/simplewindow/simplewindow.pas index d68b50ab4..361d0b136 100644 --- a/bindings/pascocoa/examples/simplewindow/simplewindow.pas +++ b/bindings/pascocoa/examples/simplewindow/simplewindow.pas @@ -21,8 +21,8 @@ uses objc, ctypes, FPCMacOSAll, AppKit, Foundation; const - Str_Window_Title = 'This is the title'; - Str_Window_Message = 'This is the message'; + Str_Window_Title = 'Pascal Cocoa Example'; + Str_Window_Message = 'NSTextField Control'; var { classes } pool: NSAutoreleasePool; @@ -44,7 +44,7 @@ begin MainWindowRect.origin.x := 300.0; MainWindowRect.origin.y := 300.0; MainWindowRect.size.width := 300.0; - MainWindowRect.size.height := 500.0; + MainWindowRect.size.height := 100.0; MainWindow := NSWindow.initWithContentRect_styleMask_backing_defer(MainWindowRect, NSTitledWindowMask or NSClosableWindowMask or NSMiniaturizableWindowMask or NSResizableWindowMask, @@ -58,11 +58,13 @@ begin { Adds a NSTextField with a string } CFMessage := CFStringCreateWithPascalString(nil, Str_Window_Message, kCFStringEncodingUTF8); - TextFieldRect.origin.x := 0.0; - TextFieldRect.origin.y := 200.0; - TextFieldRect.size.width := 300.0; - TextFieldRect.size.height := 100.0; + TextFieldRect.origin.x := 50.0; + TextFieldRect.origin.y := 50.0; + TextFieldRect.size.width := 200.0; + TextFieldRect.size.height := 25.0; TextField := NSTextField.initWithFrame(TextFieldRect); + TextField.setBordered(LongBool(NO)); + TextField.setDrawsBackground(LongBool(NO)); TextField.setStringValue(CFMessage); MainWindowView := NSView.CreateWithHandle(MainWindow.contentView); MainWindowView.addSubview(TextField.Handle);