1 module bindbc.cocoa.controls.nstextfield; 2 3 import bindbc.cocoa.controls.nscontrol; 4 import bindbc.cocoa.controls.nscolor; 5 //import bindbc.cocoa.controls.nsimage; 6 //import bindbc.cocoa.controls.nssound; 7 import bindbc.cocoa.runtime; 8 import bindbc.cocoa.foundation; 9 import bindbc.cocoa.appkit; 10 11 struct NSTextField 12 { 13 nothrow @nogc: 14 NSControl parent; 15 alias parent this; 16 17 mixin NSObjectTemplate!(NSTextField, "NSTextField"); 18 19 NSView contentView() 20 { 21 return NSView(_id); 22 } 23 24 NSControl control(){ 25 return NSControl(_id); 26 } 27 28 BOOL isEditable() 29 { 30 alias fun_t = extern(C) BOOL function (id, SEL) nothrow @nogc; 31 return (cast(fun_t)objc_msgSend)(_id, sel!"isEditable"); 32 } 33 34 BOOL isSelectable() 35 { 36 alias fun_t = extern(C) BOOL function (id, SEL) nothrow @nogc; 37 return (cast(fun_t)objc_msgSend)(_id, sel!"isSelectable"); 38 } 39 40 void setEditable(BOOL flag) 41 { 42 alias fun_t = extern(C) void function (id, SEL, BOOL) nothrow @nogc; 43 (cast(fun_t)objc_msgSend)(_id, sel!"setEditable:", flag); 44 } 45 46 void setSelectable(BOOL flag) 47 { 48 alias fun_t = extern(C) void function (id, SEL, BOOL) nothrow @nogc; 49 (cast(fun_t)objc_msgSend)(_id, sel!"setSelectable:", flag); 50 } 51 52 void selectText(id sender) 53 { 54 alias fun_t = extern(C) void function (id, SEL, id) nothrow @nogc; 55 (cast(fun_t)objc_msgSend)(_id, sel!"selectText:", sender); 56 } 57 58 id nextText() 59 { 60 alias fun_t = extern(C) id function (id, SEL) nothrow @nogc; 61 return (cast(fun_t)objc_msgSend)(_id, sel!"nextText"); 62 } 63 64 id previousText() 65 { 66 alias fun_t = extern(C) id function (id, SEL) nothrow @nogc; 67 return (cast(fun_t)objc_msgSend)(_id, sel!"previousText"); 68 } 69 70 void setNextText(id anObject) 71 { 72 alias fun_t = extern(C) void function (id, SEL, id) nothrow @nogc; 73 (cast(fun_t)objc_msgSend)(_id, sel!"setNextText:", anObject); 74 } 75 76 void setPreviousText(id anObject) 77 { 78 alias fun_t = extern(C) void function (id, SEL, id) nothrow @nogc; 79 (cast(fun_t)objc_msgSend)(_id, sel!"setPreviousText:", anObject); 80 } 81 82 /+ 83 // Assigning a Delegate 84 // 85 - (void)setDelegate:(id<NSTextFieldDelegate>)anObject; 86 - (id<NSTextFieldDelegate>)delegate; 87 +/ 88 89 NSColor backgroundColor() 90 { 91 alias fun_t = extern(C) id function (id, SEL) nothrow @nogc; 92 return NSColor((cast(fun_t)objc_msgSend)(_id, sel!"backgroundColor")); 93 } 94 95 BOOL drawsBackground() 96 { 97 alias fun_t = extern(C) BOOL function (id, SEL) nothrow @nogc; 98 return (cast(fun_t)objc_msgSend)(_id, sel!"drawsBackground"); 99 } 100 101 BOOL isBezeled() 102 { 103 alias fun_t = extern(C) BOOL function (id, SEL) nothrow @nogc; 104 return (cast(fun_t)objc_msgSend)(_id, sel!"isBezeled"); 105 } 106 107 BOOL isBordered() 108 { 109 alias fun_t = extern(C) BOOL function (id, SEL) nothrow @nogc; 110 return (cast(fun_t)objc_msgSend)(_id, sel!"isBordered"); 111 } 112 113 void setBackgroundColor(NSColor aColor) 114 { 115 alias fun_t = extern(C) void function (id, SEL, id) nothrow @nogc; 116 (cast(fun_t)objc_msgSend)(_id, sel!"setBackgroundColor:", aColor._id); 117 } 118 119 void setBezeled(BOOL flag) 120 { 121 alias fun_t = extern(C) void function (id, SEL, BOOL) nothrow @nogc; 122 (cast(fun_t)objc_msgSend)(_id, sel!"setBezeled:", flag); 123 } 124 125 void setBordered(BOOL flag) 126 { 127 alias fun_t = extern(C) void function (id, SEL, BOOL) nothrow @nogc; 128 (cast(fun_t)objc_msgSend)(_id, sel!"setBordered:", flag); 129 } 130 131 void setDrawsBackground(BOOL flag) 132 { 133 alias fun_t = extern(C) void function (id, SEL, BOOL) nothrow @nogc; 134 (cast(fun_t)objc_msgSend)(_id, sel!"setDrawsBackground:", flag); 135 } 136 137 void setTextColor(NSColor aColor) 138 { 139 alias fun_t = extern(C) void function (id, SEL, id) nothrow @nogc; 140 (cast(fun_t)objc_msgSend)(_id, sel!"setTextColor:", aColor._id); 141 } 142 143 NSColor textColor() 144 { 145 alias fun_t = extern(C) id function (id, SEL) nothrow @nogc; 146 return NSColor((cast(fun_t)objc_msgSend)(_id, sel!"textColor")); 147 } 148 149 void setPlaceholderString(NSString aString) 150 { 151 alias fun_t = extern(C) void function (id, SEL, id) nothrow @nogc; 152 (cast(fun_t)objc_msgSend)(_id, sel!"setPlaceholderString:", aString._id); 153 } 154 155 NSString placeholderString() 156 { 157 alias fun_t = extern(C) id function (id, SEL) nothrow @nogc; 158 return NSString((cast(fun_t)objc_msgSend)(_id, sel!"placeholderString")); 159 } 160 //- (void) setPlaceholderAttributedString: (NSAttributedString *)string; 161 //- (NSAttributedString *) placeholderAttributedString; 162 } 163 164 /* 165 166 167 168 */