1{%mainunit appkit.pas} 2(* 3 NSTextField.h 4 Application Kit 5 Copyright (c) 1994-2005, Apple Computer, Inc. 6 All rights reserved. 7*) 8 9{$ifdef HEADER} 10{$ifndef NSTEXTFIELD_PAS_H} 11{$define NSTEXTFIELD_PAS_H} 12 13{$include NSControl.inc} 14{$include NSTextFieldCell.inc} 15 16{$endif} 17{$endif} 18 19{$ifdef FORWARD} 20 NSTextField = class; 21 22{$endif} 23 24{$ifdef CLASSES} 25{$ifndef NSTEXTFIELD_PAS_C} 26{$define NSTEXTFIELD_PAS_C} 27 28{$include NSControl.inc} 29{$include NSTextFieldCell.inc} 30 31 { NSTextField } 32 33 NSTextField = class(NSControl) 34 public 35 class function getClass: lobjc.id; override; 36 // All instance variables are private 37 procedure setBackgroundColor(_color: lobjc.id {NSColor}); 38 function backgroundColor: lobjc.id;{NSColor} 39 procedure setDrawsBackground(_flag: LongBool); 40 function drawsBackground: LongBool; 41 procedure setTextColor(_color: lobjc.id {NSColor}); 42 function textColor: lobjc.id;{NSColor} 43 function isBordered: LongBool; 44 procedure setBordered(_flag: LongBool); 45 function isBezeled: LongBool; 46 procedure setBezeled(_flag: LongBool); 47 function isEditable: LongBool; 48 procedure setEditable(_flag: LongBool); 49 function isSelectable: LongBool; 50 procedure setSelectable(_flag: LongBool); 51 procedure selectText(_sender: lobjc.id); 52 function delegate: lobjc.id; 53 procedure setDelegate(_anObject: lobjc.id); 54 function textShouldBeginEditing(_textObject: lobjc.id {NSText}): LongBool; 55 function textShouldEndEditing(_textObject: lobjc.id {NSText}): LongBool; 56 procedure textDidBeginEditing(_notification: lobjc.id {NSNotification}); 57 procedure textDidEndEditing(_notification: lobjc.id {NSNotification}); 58 procedure textDidChange(_notification: lobjc.id {NSNotification}); 59 function acceptsFirstResponder: LongBool; 60 {.$ifdef MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2} 61 procedure setBezelStyle(_style: NSTextFieldBezelStyle); 62 function bezelStyle: NSTextFieldBezelStyle; 63 {.$endif} 64 procedure setTitleWithMnemonic(_stringWithAmpersand: CFStringRef); 65 function allowsEditingTextAttributes: LongBool; 66 procedure setAllowsEditingTextAttributes(_flag: LongBool); 67 function importsGraphics: LongBool; 68 procedure setImportsGraphics(_flag: LongBool); 69 end; 70 71{$endif} 72{$endif} 73 74{$ifdef IMPLEMENTATION} 75const 76 StrNSTextField_NSTextField = 'NSTextField'; 77 StrNSTextField_setBackgroundColor = 'setBackgroundColor:'; 78 StrNSTextField_backgroundColor = 'backgroundColor'; 79 StrNSTextField_setDrawsBackground = 'setDrawsBackground:'; 80 StrNSTextField_drawsBackground = 'drawsBackground'; 81 StrNSTextField_setTextColor = 'setTextColor:'; 82 StrNSTextField_textColor = 'textColor'; 83 StrNSTextField_isBordered = 'isBordered'; 84 StrNSTextField_setBordered = 'setBordered:'; 85 StrNSTextField_isBezeled = 'isBezeled'; 86 StrNSTextField_setBezeled = 'setBezeled:'; 87 StrNSTextField_isEditable = 'isEditable'; 88 StrNSTextField_setEditable = 'setEditable:'; 89 StrNSTextField_isSelectable = 'isSelectable'; 90 StrNSTextField_setSelectable = 'setSelectable:'; 91 StrNSTextField_selectText = 'selectText:'; 92 StrNSTextField_delegate = 'delegate'; 93 StrNSTextField_setDelegate = 'setDelegate:'; 94 StrNSTextField_textShouldBeginEditing = 'textShouldBeginEditing:'; 95 StrNSTextField_textShouldEndEditing = 'textShouldEndEditing:'; 96 StrNSTextField_textDidBeginEditing = 'textDidBeginEditing:'; 97 StrNSTextField_textDidEndEditing = 'textDidEndEditing:'; 98 StrNSTextField_textDidChange = 'textDidChange:'; 99 StrNSTextField_acceptsFirstResponder = 'acceptsFirstResponder'; 100 StrNSTextField_setBezelStyle = 'setBezelStyle:'; 101 StrNSTextField_bezelStyle = 'bezelStyle'; 102 103 StrNSTextField_setTitleWithMnemonic = 'setTitleWithMnemonic:'; 104 105 StrNSTextField_allowsEditingTextAttributes = 'allowsEditingTextAttributes'; 106 StrNSTextField_setAllowsEditingTextAttributes = 'setAllowsEditingTextAttributes:'; 107 StrNSTextField_importsGraphics = 'importsGraphics'; 108 StrNSTextField_setImportsGraphics = 'setImportsGraphics:'; 109 110{ NSTextField } 111 112class function NSTextField.getClass: lobjc.id; 113begin 114 Result := objc_getClass(StrNSTextField_NSTextField); 115end; 116 117procedure NSTextField.setBackgroundColor(_color: lobjc.id {NSColor}); 118type 119 TmsgSendWrapper = procedure (param1: lobjc.id; param2: SEL;_color: lobjc.id {NSColor}); cdecl; 120var 121 vmethod: TmsgSendWrapper; 122begin 123 vmethod := TmsgSendWrapper(@objc_msgSend); 124 vmethod(Handle, sel_registerName(PChar(StrNSTextField_setBackgroundColor)), _color); 125end; 126 127function NSTextField.backgroundColor: lobjc.id; 128begin 129 Result := lobjc.id(objc_msgSend(Handle, sel_registerName(PChar(StrNSTextField_backgroundColor)), [])); 130end; 131 132procedure NSTextField.setDrawsBackground(_flag: LongBool); 133type 134 TmsgSendWrapper = procedure (param1: lobjc.id; param2: SEL;_flag: LongBool); cdecl; 135var 136 vmethod: TmsgSendWrapper; 137begin 138 vmethod := TmsgSendWrapper(@objc_msgSend); 139 vmethod(Handle, sel_registerName(PChar(StrNSTextField_setDrawsBackground)), _flag); 140end; 141 142function NSTextField.drawsBackground: LongBool; 143begin 144 Result := {%H-}LongBool(objc_msgSend(Handle, sel_registerName(PChar(StrNSTextField_drawsBackground)), [])); 145end; 146 147procedure NSTextField.setTextColor(_color: lobjc.id {NSColor}); 148type 149 TmsgSendWrapper = procedure (param1: lobjc.id; param2: SEL;_color: lobjc.id {NSColor}); cdecl; 150var 151 vmethod: TmsgSendWrapper; 152begin 153 vmethod := TmsgSendWrapper(@objc_msgSend); 154 vmethod(Handle, sel_registerName(PChar(StrNSTextField_setTextColor)), _color); 155end; 156 157function NSTextField.textColor: lobjc.id; 158begin 159 Result := lobjc.id(objc_msgSend(Handle, sel_registerName(PChar(StrNSTextField_textColor)), [])); 160end; 161 162function NSTextField.isBordered: LongBool; 163begin 164 Result := {%H-}LongBool(objc_msgSend(Handle, sel_registerName(PChar(StrNSTextField_isBordered)), [])); 165end; 166 167procedure NSTextField.setBordered(_flag: LongBool); 168type 169 TmsgSendWrapper = procedure (param1: lobjc.id; param2: SEL;_flag: LongBool); cdecl; 170var 171 vmethod: TmsgSendWrapper; 172begin 173 vmethod := TmsgSendWrapper(@objc_msgSend); 174 vmethod(Handle, sel_registerName(PChar(StrNSTextField_setBordered)), _flag); 175end; 176 177function NSTextField.isBezeled: LongBool; 178begin 179 Result := {%H-}LongBool(objc_msgSend(Handle, sel_registerName(PChar(StrNSTextField_isBezeled)), [])); 180end; 181 182procedure NSTextField.setBezeled(_flag: LongBool); 183type 184 TmsgSendWrapper = procedure (param1: lobjc.id; param2: SEL;_flag: LongBool); cdecl; 185var 186 vmethod: TmsgSendWrapper; 187begin 188 vmethod := TmsgSendWrapper(@objc_msgSend); 189 vmethod(Handle, sel_registerName(PChar(StrNSTextField_setBezeled)), _flag); 190end; 191 192function NSTextField.isEditable: LongBool; 193begin 194 Result := {%H-}LongBool(objc_msgSend(Handle, sel_registerName(PChar(StrNSTextField_isEditable)), [])); 195end; 196 197procedure NSTextField.setEditable(_flag: LongBool); 198type 199 TmsgSendWrapper = procedure (param1: lobjc.id; param2: SEL;_flag: LongBool); cdecl; 200var 201 vmethod: TmsgSendWrapper; 202begin 203 vmethod := TmsgSendWrapper(@objc_msgSend); 204 vmethod(Handle, sel_registerName(PChar(StrNSTextField_setEditable)), _flag); 205end; 206 207function NSTextField.isSelectable: LongBool; 208begin 209 Result := {%H-}LongBool(objc_msgSend(Handle, sel_registerName(PChar(StrNSTextField_isSelectable)), [])); 210end; 211 212procedure NSTextField.setSelectable(_flag: LongBool); 213type 214 TmsgSendWrapper = procedure (param1: lobjc.id; param2: SEL;_flag: LongBool); cdecl; 215var 216 vmethod: TmsgSendWrapper; 217begin 218 vmethod := TmsgSendWrapper(@objc_msgSend); 219 vmethod(Handle, sel_registerName(PChar(StrNSTextField_setSelectable)), _flag); 220end; 221 222procedure NSTextField.selectText(_sender: lobjc.id); 223type 224 TmsgSendWrapper = procedure (param1: lobjc.id; param2: SEL;_sender: lobjc.id); cdecl; 225var 226 vmethod: TmsgSendWrapper; 227begin 228 vmethod := TmsgSendWrapper(@objc_msgSend); 229 vmethod(Handle, sel_registerName(PChar(StrNSTextField_selectText)), _sender); 230end; 231 232function NSTextField.delegate: lobjc.id; 233begin 234 Result := lobjc.id(objc_msgSend(Handle, sel_registerName(PChar(StrNSTextField_delegate)), [])); 235end; 236 237procedure NSTextField.setDelegate(_anObject: lobjc.id); 238type 239 TmsgSendWrapper = procedure (param1: lobjc.id; param2: SEL;_anObject: lobjc.id); cdecl; 240var 241 vmethod: TmsgSendWrapper; 242begin 243 vmethod := TmsgSendWrapper(@objc_msgSend); 244 vmethod(Handle, sel_registerName(PChar(StrNSTextField_setDelegate)), _anObject); 245end; 246 247function NSTextField.textShouldBeginEditing(_textObject: lobjc.id {NSText}): LongBool; 248type 249 TmsgSendWrapper = function (param1: lobjc.id; param2: SEL;_textObject: lobjc.id {NSText}): LongBool; cdecl; 250var 251 vmethod: TmsgSendWrapper; 252begin 253 vmethod := TmsgSendWrapper(@objc_msgSend); 254 Result := LongBool(vmethod(Handle, sel_registerName(PChar(StrNSTextField_textShouldBeginEditing)), _textObject)); 255end; 256 257function NSTextField.textShouldEndEditing(_textObject: lobjc.id {NSText}): LongBool; 258type 259 TmsgSendWrapper = function (param1: lobjc.id; param2: SEL;_textObject: lobjc.id {NSText}): LongBool; cdecl; 260var 261 vmethod: TmsgSendWrapper; 262begin 263 vmethod := TmsgSendWrapper(@objc_msgSend); 264 Result := LongBool(vmethod(Handle, sel_registerName(PChar(StrNSTextField_textShouldEndEditing)), _textObject)); 265end; 266 267procedure NSTextField.textDidBeginEditing(_notification: lobjc.id {NSNotification}); 268type 269 TmsgSendWrapper = procedure (param1: lobjc.id; param2: SEL;_notification: lobjc.id {NSNotification}); cdecl; 270var 271 vmethod: TmsgSendWrapper; 272begin 273 vmethod := TmsgSendWrapper(@objc_msgSend); 274 vmethod(Handle, sel_registerName(PChar(StrNSTextField_textDidBeginEditing)), _notification); 275end; 276 277procedure NSTextField.textDidEndEditing(_notification: lobjc.id {NSNotification}); 278type 279 TmsgSendWrapper = procedure (param1: lobjc.id; param2: SEL;_notification: lobjc.id {NSNotification}); cdecl; 280var 281 vmethod: TmsgSendWrapper; 282begin 283 vmethod := TmsgSendWrapper(@objc_msgSend); 284 vmethod(Handle, sel_registerName(PChar(StrNSTextField_textDidEndEditing)), _notification); 285end; 286 287procedure NSTextField.textDidChange(_notification: lobjc.id {NSNotification}); 288type 289 TmsgSendWrapper = procedure (param1: lobjc.id; param2: SEL;_notification: lobjc.id {NSNotification}); cdecl; 290var 291 vmethod: TmsgSendWrapper; 292begin 293 vmethod := TmsgSendWrapper(@objc_msgSend); 294 vmethod(Handle, sel_registerName(PChar(StrNSTextField_textDidChange)), _notification); 295end; 296 297function NSTextField.acceptsFirstResponder: LongBool; 298begin 299 Result := {%H-}LongBool(objc_msgSend(Handle, sel_registerName(PChar(StrNSTextField_acceptsFirstResponder)), [])); 300end; 301 302{.$ifdef MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2} 303procedure NSTextField.setBezelStyle(_style: NSTextFieldBezelStyle); 304type 305 TmsgSendWrapper = procedure (param1: lobjc.id; param2: SEL;_style: NSTextFieldBezelStyle); cdecl; 306var 307 vmethod: TmsgSendWrapper; 308begin 309 vmethod := TmsgSendWrapper(@objc_msgSend); 310 vmethod(Handle, sel_registerName(PChar(StrNSTextField_setBezelStyle)), _style); 311end; 312 313function NSTextField.bezelStyle: NSTextFieldBezelStyle; 314begin 315 Result := NSTextFieldBezelStyle(objc_msgSend(Handle, sel_registerName(PChar(StrNSTextField_bezelStyle)), [])); 316end; 317 318{.$endif} 319procedure NSTextField.setTitleWithMnemonic(_stringWithAmpersand: CFStringRef); 320type 321 TmsgSendWrapper = procedure (param1: lobjc.id; param2: SEL;_stringWithAmpersand: CFStringRef); cdecl; 322var 323 vmethod: TmsgSendWrapper; 324begin 325 vmethod := TmsgSendWrapper(@objc_msgSend); 326 vmethod(Handle, sel_registerName(PChar(StrNSTextField_setTitleWithMnemonic)), _stringWithAmpersand); 327end; 328 329function NSTextField.allowsEditingTextAttributes: LongBool; 330begin 331 Result := {%H-}LongBool(objc_msgSend(Handle, sel_registerName(PChar(StrNSTextField_allowsEditingTextAttributes)), [])); 332end; 333 334procedure NSTextField.setAllowsEditingTextAttributes(_flag: LongBool); 335type 336 TmsgSendWrapper = procedure (param1: lobjc.id; param2: SEL;_flag: LongBool); cdecl; 337var 338 vmethod: TmsgSendWrapper; 339begin 340 vmethod := TmsgSendWrapper(@objc_msgSend); 341 vmethod(Handle, sel_registerName(PChar(StrNSTextField_setAllowsEditingTextAttributes)), _flag); 342end; 343 344function NSTextField.importsGraphics: LongBool; 345begin 346 Result := {%H-}LongBool(objc_msgSend(Handle, sel_registerName(PChar(StrNSTextField_importsGraphics)), [])); 347end; 348 349procedure NSTextField.setImportsGraphics(_flag: LongBool); 350type 351 TmsgSendWrapper = procedure (param1: lobjc.id; param2: SEL;_flag: LongBool); cdecl; 352var 353 vmethod: TmsgSendWrapper; 354begin 355 vmethod := TmsgSendWrapper(@objc_msgSend); 356 vmethod(Handle, sel_registerName(PChar(StrNSTextField_setImportsGraphics)), _flag); 357end; 358 359{$endif} 360