1 # This file is part of NIT ( http://www.nitlanguage.org ).
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 # File generated by objcwrapper
17 # Partial wrapper of basic UIKit services.
20 import cocoa
::foundation
23 # Rectangular area on the screen
24 extern class UIView in "ObjC" `{ UIView * `}
27 new in "ObjC" `{ return [[UIView alloc] initWithFrame: [[UIScreen mainScreen] applicationFrame]]; `}
29 # Wraps: `UIView.addSubview`
30 fun add_subview
(view
: UIView) in "ObjC" `{
31 [self addSubview: view];
34 # Wraps: `UIView.removeFromSuperview`
35 fun remove_from_superview
in "ObjC" `{
36 [self removeFromSuperview];
39 # Wraps: `UIView.sizeToFit`
40 fun size_to_fit
in "ObjC" `{
44 # Wraps: `UIView.frame =`
45 fun set_frame
(x
, y
, w
, h
: Float) in "ObjC" `{
46 self.frame = CGRectMake(x, y, w, h);
49 # Wraps: `UIView.bounds =`
50 fun set_bounds
(x
, y
, w
, h
: Float) in "ObjC" `{
51 self.bounds = CGRectMake(x, y, w, h);
54 # Wraps: `UIView.center =`
55 fun set_center
(x
, y
: Float) in "ObjC" `{
56 self.center = CGPointMake(x, y);
59 # Wraps: `UIView.userInteractionEnabled =`
60 fun user_interaction_enabled
=(value
: Bool) in "ObjC" `{
61 self.userInteractionEnabled = value;
64 # Wraps: `UIView.translatesAutoresizingMaskIntoConstraints =`
65 fun translates_autoresizing_mask_into_constraits
=(value
: Bool) in "ObjC" `{
66 self.translatesAutoresizingMaskIntoConstraints = value;
69 # Wraps: `UIView.backgroundColor =`
70 fun background_color
=(color
: UIColor) in "ObjC" `{
71 self.backgroundColor = color;
74 # Wraps: `[self viewPrintFormatter]`
75 #fun view_print_formatter: UIViewPrintFormatter in "ObjC" `{
76 #return [self viewPrintFormatter];
79 # Wraps: `[self drawRect:(CGRect)rect forViewPrintFormatter:(UIViewPrintFormatter)formatter]`
80 #fun draw_rect_for_view_print_formatter(rect: CGRect, formatter: UIViewPrintFormatter) in "ObjC" `{
81 # [self drawRect: rect forViewPrintFormatter: formatter];
85 # Coordinates an app displays on a device screen
86 extern class UIWindow in "ObjC" `{ UIWindow * `}
89 new in "ObjC" `{ return [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]]; `}
91 # Wraps: `[self makeKeyAndVisible]`
92 fun make_key_and_visible
in "ObjC" `{
93 [self makeKeyAndVisible];
97 # Base class for contorl objects
98 extern class UIControl in "ObjC" `{ UIControl * `}
101 # Wraps: `self.enabled
`
102 fun enabled: Bool in "ObjC" `{
106 # Wraps: `self.enabled
=`
107 fun enabled=(enabled: Bool) in "ObjC" `{
108 self.enabled
= enabled
;
112 # Button on the touch screen
113 extern class UIButton in "ObjC" `{ UIButton * `}
116 new(kind
: UIButtonType) in "ObjC" `{ return [UIButton buttonWithType: kind]; `}
118 # Wraps: `[self titleLabel
]`
119 fun title_label: UILabel in "ObjC" `{
120 return [self titleLabel
];
123 # Wraps: `[self setTitle forState
]`
124 fun title=(text: NSString) in "ObjC" `{
125 [self setTitle
:text forState
:UIControlStateNormal];
128 # Wraps: `[self currentTitle
]`
129 fun current_title: NSString in "ObjC" `{
130 return [self currentTitle
];
134 # Style of `UIButton`
135 extern class UIButtonType in "ObjC" `{ UIButtonType `}
136 new custom
in "ObjC" `{ return UIButtonTypeCustom; `}
137 new system in "ObjC" `{ return UIButtonTypeSystem; `}
138 new detail_disclosure
in "ObjC" `{ return UIButtonTypeDetailDisclosure; `}
139 new info_light in "ObjC" `{ return UIButtonTypeInfoLight; `}
140 new info_dark
in "ObjC" `{ return UIButtonTypeInfoDark; `}
141 new contact_add in "ObjC" `{ return UIButtonTypeContactAdd; `}
142 new rounded_rect
in "ObjC" `{ return UIButtonTypeRoundedRect; `}
145 # Read-only text view
146 extern class UILabel in "ObjC" `{ UILabel * `}
149 new in "ObjC" `{ return [[UILabel alloc] init]; `}
151 # Wraps: `UILabel.text
`
152 fun text: NSString in "ObjC" `{
156 # Wraps: `UILabel.text
`
157 fun text=(text: NSString) in "ObjC" `{
161 # Wraps: `UILabel.font
`
162 #fun font: UIFont in "ObjC" `{
163 # return [self font];
166 # Wraps: `UILabel.textColor`
167 fun text_color
: UIColor in "ObjC" `{
168 return [self textColor];
171 # Wraps: `UILabel.shadowColor`
172 fun shadow_color
: UIColor in "ObjC" `{
173 return [self shadowColor];
176 # Wraps: `UILabel.shadowOffset`
177 #fun shadow_offset: CGSize in "ObjC" `{
178 # return [self shadowOffset];
181 # Wraps: `UILabel.textAlignment`
182 #fun text_alignment: NSTextAlignment in "ObjC" `{
183 # return [self textAlignment];
186 # Wraps: `UILabel.lineBreakMode`
187 #fun line_break_mode: NSLineBreakMode in "ObjC" `{
188 # return [self lineBreakMode];
191 # Wraps: `UILabel.attributedText`
192 #fun attributed_text: NSAttributedString in "ObjC" `{
193 # return [self attributedText];
196 # Wraps: `UILabel.highlightedTextColor`
197 fun highlighted_text_color
: UIColor in "ObjC" `{
198 return [self highlightedTextColor];
201 # Wraps: `UILabel.highlighted`
202 #fun highlighted: Bool in "ObjC" `{
203 # return [self highlighted];
206 # Wraps: `UILabel.userInteractionEnabled`
207 #fun user_interaction_enabled: Bool in "ObjC" `{
208 # return [self userInteractionEnabled];
211 # Wraps: `UILabel.enabled`
212 #fun enabled: Bool in "ObjC" `{
213 # return [self enabled];
216 # Wraps: `UILabel.numberOfLines`
217 fun number_of_lines
: Int in "ObjC" `{
218 return [self numberOfLines];
221 # Wraps: `UILabel.adjustsFontSizeToFitWidth`
222 fun adjusts_font_size_to_fit_width
: Bool in "ObjC" `{
223 return [self adjustsFontSizeToFitWidth];
226 # Wraps: `UILabel.adjustsLetterSpacingToFitWidth`
228 #fun adjusts_letter_spacing_to_fit_width: Bool in "ObjC" `{
229 # return [self adjustsLetterSpacingToFitWidth];
232 # Wraps: `UILabel.minimumFontSize`
234 #fun minimum_font_size: Float in "ObjC" `{
235 # return [self minimumFontSize];
238 # Wraps: `UILabel.baselineAdjustment`
239 #fun baseline_adjustment: UIBaselineAdjustment in "ObjC" `{
240 # return [self baselineAdjustment];
243 # Wraps: `UILabel.minimumScaleFactor`
244 fun minimum_scale_factor
: Float in "ObjC" `{
245 return [self minimumScaleFactor];
248 # Wraps: `UILabel.preferredMaxLayoutWidth`
249 fun preferred_max_layout_width
: Float in "ObjC" `{
250 return [self preferredMaxLayoutWidth];
253 # Wraps: `[self textRectForBounds:(CGRect)bounds limitedToNumberOfLines:(NSInteger)numberOfLines]`
254 #fun text_rect_for_bounds_limited_to_number_of_lines(bounds: CGRect, number_of_lines: Int): CGRect in "ObjC" `{
255 # return [self textRectForBounds: bounds limitedToNumberOfLines: number_of_lines];
258 # Wraps: `[self drawTextInRect:(CGRect)rect]`
259 #fun draw_text_in_rect(rect: CGRect) in "ObjC" `{
260 # [self drawTextInRect: rect];
264 # Color data with opacity
265 extern class UIColor in "ObjC" `{ UIColor * `}
268 # Wraps: `[self initWithWhite
:(CGFloat)white alpha
:(CGFloat)alpha
]`
269 new init_with_white_alpha(white, alpha: Float) in "ObjC" `{
270 return [[UIColor alloc
] initWithWhite
: white alpha
: alpha
];
273 # Wraps: `[self initWithHue
:(CGFloat)hue saturation
:(CGFloat)saturation brightness
:(CGFloat)brightness alpha
:(CGFloat)alpha
]`
274 new init_with_hue_saturation_brightness_alpha(hue, saturation, brightness, alpha: Float) in "ObjC" `{
275 return [[UIColor alloc
] initWithHue
: hue saturation
: saturation brightness
: brightness alpha
: alpha
];
278 # Wraps: `[self initWithRed
:(CGFloat)red green
:(CGFloat)green blue
:(CGFloat)blue alpha
:(CGFloat)alpha
]`
279 new init_with_red_green_blue_alpha(red, green, blue, alpha: Float) in "ObjC" `{
280 return [[UIColor alloc
] initWithRed
: red green
: green blue
: blue alpha
: alpha
];
283 # Wraps: `[self initWithCGColor
:(CGColorRef)cgColor
]`
284 #new init_with_cg_color(cg_color: CGColorRef) in "ObjC" `{
285 # return [[UIColor alloc] initWithCGColor: cg_color];
288 # Wraps: `[self initWithPatternImage:(UIImage)image]`
289 #new init_with_pattern_image(image: UIImage) in "ObjC" `{
290 # return [[UIColor alloc] initWithPatternImage: image];
293 # Wraps: `[self initWithCIColor:(CIColor)ciColor]`
294 #new init_with_ci_color(ci_color: CIColor) in "ObjC" `{
295 # return [[UIColor alloc] initWithCIColor: ci_color];
298 # Wraps: `[UIColor blackColor]`
299 new black_color
in "ObjC" `{ return [UIColor blackColor]; `}
301 # Wraps: `[UIColor darkGrayColor
]`
302 new dark_gray_color in "ObjC" `{ return [UIColor darkGrayColor]; `}
304 # Wraps: `[UIColor lightGrayColor]`
305 new light_gray_color
in "ObjC" `{ return [UIColor lightGrayColor]; `}
307 # Wraps: `[UIColor whiteColor
]`
308 new white_color in "ObjC" `{ return [UIColor whiteColor]; `}
310 # Wraps: `[UIColor grayColor]`
311 new gray_color
in "ObjC" `{ return [UIColor grayColor]; `}
313 # Wraps: `[UIColor redColor
]`
314 new red_color in "ObjC" `{ return [UIColor redColor]; `}
316 # Wraps: `[UIColor greenColor]`
317 new green_color
in "ObjC" `{ return [UIColor greenColor]; `}
319 # Wraps: `[UIColor blueColor
]`
320 new blue_color in "ObjC" `{ return [UIColor blueColor]; `}
322 # Wraps: `[UIColor cyanColor]`
323 new cyan_color
in "ObjC" `{ return [UIColor cyanColor]; `}
325 # Wraps: `[UIColor yellowColor
]`
326 new yellow_color in "ObjC" `{ return [UIColor yellowColor]; `}
328 # Wraps: `[UIColor magentaColor]`
329 new magenta_color
in "ObjC" `{ return [UIColor magentaColor]; `}
331 # Wraps: `[UIColor orangeColor
]`
332 new orange_color in "ObjC" `{ return [UIColor orangeColor]; `}
334 # Wraps: `[UIColor purpleColor]`
335 new purple_color
in "ObjC" `{ return [UIColor purpleColor]; `}
337 # Wraps: `[UIColor brownColor
]`
338 new brown_color in "ObjC" `{ return [UIColor brownColor]; `}
340 # Wraps: `[UIColor clearColor]`
341 new clear_color
in "ObjC" `{ return [UIColor clearColor]; `}
343 # Wraps: `UIColor.CGColor`
344 #fun cg_color: CGColorRef in "ObjC" `{
345 # return [self CGColor];
348 # Wraps: `UIColor.CIColor`
349 #fun ci_color: CIColor in "ObjC" `{
350 # return [self CIColor];
353 # Wraps: `[self set]`
354 fun set
in "ObjC" `{ [self set]; `}
356 # Wraps: `[self setFill
]`
357 fun set_fill in "ObjC" `{ [self setFill]; `}
359 # Wraps: `[self setStroke]`
360 fun set_stroke
in "ObjC" `{ [self setStroke]; `}
362 # Wraps: `[self getWhite
:(CGFloat)white alpha
:(CGFloat)alpha
]`
363 #fun get_white_alpha(white: Float, alpha: Float): Bool in "ObjC" `{
364 # return [self getWhite: white alpha: alpha];
367 # Wraps: `[self getHue:(CGFloat)hue saturation:(CGFloat)saturation brightness:(CGFloat)brightness alpha:(CGFloat)alpha]`
368 #fun get_hue_saturation_brightness_alpha(hue: Float, saturation: Float, brightness: Float, alpha: Float): Bool in "ObjC" `{
369 # return [self getHue: hue saturation: saturation brightness: brightness alpha: alpha];
372 # Wraps: `[self getRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha]`
373 #fun get_red_green_blue_alpha(red: Float, green: Float, blue: Float, alpha: Float): Bool in "ObjC" `{
374 # return [self getRed: red green: green blue: blue alpha: alpha];
377 # Wraps: `[self colorWithAlphaComponent:(CGFloat)alpha]`
378 fun color_with_alpha_component
(alpha
: Float): UIColor in "ObjC" `{
379 return [self colorWithAlphaComponent: alpha];
382 # Wraps: `[self CGColor]`
383 #fun cg_color: CGColorRef in "ObjC" `{
384 # return [self CGColor];
388 # Wraps: `[UIColor colorWithWhite:(CGFloat)white alpha:(CGFloat)alpha]`
389 #fun ui_color_color_with_white_alpha(white: Float, alpha: Float): UIColor in "ObjC" `{
390 # return [UIColor colorWithWhite: white alpha: alpha];
393 # Wraps: `[UIColor colorWithHue:(CGFloat)hue saturation:(CGFloat)saturation brightness:(CGFloat)brightness alpha:(CGFloat)alpha]`
394 #fun ui_color_color_with_hue_saturation_brightness_alpha(hue: Float, saturation: Float, brightness: Float, alpha: Float): UIColor in "ObjC" `{
395 # return [UIColor colorWithHue: hue saturation: saturation brightness: brightness alpha: alpha];
398 # Wraps: `[UIColor colorWithRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha]`
399 #fun ui_color_color_with_red_green_blue_alpha(red: Float, green: Float, blue: Float, alpha: Float): UIColor in "ObjC" `{
400 # return [UIColor colorWithRed: red green: green blue: blue alpha: alpha];
403 # Wraps: `[UIColor colorWithCGColor:(CGColorRef)cgColor]`
404 #fun ui_color_color_with_cg_color(cg_color: CGColorRef): UIColor in "ObjC" `{
405 # return [UIColor colorWithCGColor: cg_color];
408 # Wraps: `[UIColor colorWithPatternImage:(UIImage)image]`
409 #fun ui_color_color_with_pattern_image(image: UIImage): UIColor in "ObjC" `{
410 # return [UIColor colorWithPatternImage: image];
413 # Wraps: `[UIColor colorWithCIColor:(CIColor)ciColor]`
414 #fun ui_color_color_with_ci_color(ci_color: CIColor): UIColor in "ObjC" `{
415 # return [UIColor colorWithCIColor: ci_color];
419 extern class UITextField in "ObjC" `{ UITextField * `}
422 new in "ObjC" `{ return [[UITextField alloc] initWithFrame: [[UIScreen mainScreen] applicationFrame]]; `}
424 # Wraps: `UITextField.text`
425 fun text
: NSString in "ObjC" `{
429 # Wraps: `UITextField.text`
430 fun text
=(text
: NSString) in "ObjC" `{
435 # Lays out a collection of views in either a column or a row
436 extern class UIStackView in "ObjC" `{ UIStackView * `}
440 return [[UIStackView alloc
] initWithArrangedSubviews
: [NSArray array
]];
443 # Wraps: `[self addArrangedSubview
:(UIView)view
]`
444 fun add_arranged_subview(view: UIView) in "ObjC" `{
445 [self addArrangedSubview
: view
];
448 # Wraps: `[self removeArrangedSubview
:(UIView)view
]`
449 fun remove_arranged_subview(view: UIView) in "ObjC" `{
450 [self removeArrangedSubview
: view
];
453 # Wraps: `[self insertArrangedSubview
:(UIView)view atIndex
:(NSUInteger)stackIndex
]`
454 fun insert_arranged_subview_at_index(view: UIView, stack_index: Int) in "ObjC" `{
455 [self insertArrangedSubview
: view atIndex
: stack_index
];
458 # Wraps: `[self initWithArrangedSubviews
:(NSArray)views
]`
459 #new init_with_arranged_subviews(views: NSArray) in "ObjC" `{
460 # return [[UIStackView alloc] initWithArrangedSubviews: views];
463 # Wraps: `UIStackView.arrangedSubviews`
464 #fun arranged_subviews: NSArray in "ObjC" `{
465 # return [self arrangedSubviews];
468 # Wraps: `UIStackView.axis`
469 fun axis
: UILayoutConstraintAxis in "ObjC" `{ return [self axis]; `}
471 # Wraps: `UIStackView.axis
=`
472 fun axis=(value: UILayoutConstraintAxis) in "ObjC" `{ self.axis = value; `}
474 # Wraps: `UIStackView.distribution`
475 fun distribution
: UIStackViewDistribution in "ObjC" `{ return [self distribution]; `}
477 # Wraps: `UIStackView.distribution
=`
478 fun distribution=(value: UIStackViewDistribution) in "ObjC" `{ self.distribution = value; `}
480 # Wraps: `UIStackView.alignment`
481 fun alignment
: UIStackViewAlignment in "ObjC" `{ return [self alignment]; `}
483 # Wraps: `UIStackView.alignment
=`
484 fun alignment=(value: UIStackViewAlignment) in "ObjC" `{ self.alignment = value; `}
486 # Wraps: `UIStackView.spacing`
487 fun spacing
: Float in "ObjC" `{ return [self spacing]; `}
489 # Wraps: `UIStackView.spacing
=`
490 fun spacing=(value: Float) in "ObjC" `{ self.spacing = value; `}
492 # Wraps: `UIStackView.baselineRelativeArrangement`
493 #fun baseline_relative_arrangement: Bool in "ObjC" `{
494 # return [self baselineRelativeArrangement];
497 # Wraps: `UIStackView.layoutMarginsRelativeArrangement`
498 #fun layout_margins_relative_arrangement: Bool in "ObjC" `{
499 # return [self layoutMarginsRelativeArrangement];
503 # Defines the orientation of the arranged views in `UIStackView`
504 extern class UILayoutConstraintAxis in "ObjC" `{ NSInteger `}
505 new horizontal in "ObjC" `{ return UILayoutConstraintAxisHorizontal; `}
506 new vertical
in "ObjC" `{ return UILayoutConstraintAxisVertical; `}
509 # Defines the size and position of the arranged views along the `UIStackView`'s axis
510 extern class UIStackViewDistribution in "ObjC" `{ NSInteger `}
511 new horizontal
in "ObjC" `{ return UILayoutConstraintAxisHorizontal; `}
512 new fill in "ObjC" `{ return UIStackViewDistributionFill; `}
513 new fill_equally
in "ObjC" `{ return UIStackViewDistributionFillEqually; `}
514 new fill_proportionally in "ObjC" `{ return UIStackViewDistributionFillProportionally; `}
515 new equal_spacing
in "ObjC" `{ return UIStackViewDistributionEqualSpacing; `}
516 new equal_centering in "ObjC" `{ return UIStackViewDistributionEqualCentering; `}
519 # Defines the layout of the arranged views perpendicular to the `UIStackView`'s axis
520 extern class UIStackViewAlignment in "ObjC" `{ NSInteger `}
521 new fill in "ObjC" `{ return UIStackViewAlignmentFill; `}
522 new leading
in "ObjC" `{ return UIStackViewAlignmentLeading; `}
523 new top in "ObjC" `{ return UIStackViewAlignmentTop; `}
524 new baseline
in "ObjC" `{ return UIStackViewAlignmentFirstBaseline; `}
525 new center in "ObjC" `{ return UIStackViewAlignmentCenter; `}
526 new trailing
in "ObjC" `{ return UIStackViewAlignmentTrailing; `}
527 new bottom in "ObjC" `{ return UIStackViewAlignmentBottom; `}
528 new last_baseline
in "ObjC" `{ return UIStackViewAlignmentLastBaseline; `}
531 # View to display and edit hierarchical lists of information
532 extern class UITableView in "ObjC" `{ UITableView * `}
535 # Wraps: `[self initWithFrame:(CGRect)frame style:(UITableViewStyle)style]`
536 new (style
: UITableViewStyle) in "ObjC" `{
537 return [[UITableView alloc] initWithFrame: [[UIScreen mainScreen] bounds] style:style];
540 # Wraps: `[self reloadData]`
541 fun reload_data
in "ObjC" `{ [self reloadData]; `}
543 # Wraps: `self.autoresizingMask
=`
544 fun autoresizing_mask in "ObjC" `{
545 self.autoresizingMask
= UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth;
548 # Wraps: `self.delegate
=`
549 fun delegate=(delegate: UITableViewDelegate) in "ObjC" `{ self.delegate = delegate; `}
551 # Wraps: `self.dataSource =`
552 fun data_source
=(source
: UITableViewDataSource) in "ObjC" `{ self.dataSource = source; `}
554 # Wraps: `[self dequeueReusableCellWithIdentifier
]`
555 fun dequeue_reusable_cell_with_identifier(identifier: NSString): UITableViewCell in "ObjC" `{
556 return [self dequeueReusableCellWithIdentifier
:identifier
];
560 # Delegate for a `UITableView` to configure selection, sections, cells and more
561 extern class UITableViewDelegate in "ObjC" `{ id<UITableViewDelegate> `}
565 # Mediator the data model for a `UITableView`
566 extern class UITableViewDataSource in "ObjC" `{ id<UITableViewDataSource> `}
570 # Cell of a `UITableViewCell`
571 extern class UITableViewCell in "ObjC" `{ UITableViewCell * `}
574 new (identifier
: NSString) in "ObjC" `{
575 return [[UITableViewCell alloc]
576 initWithStyle:UITableViewCellStyleDefault
577 reuseIdentifier:identifier];
580 # Wraps: `[self textLabel]`
581 fun text_label
: UILabel in "ObjC" `{ return [self textLabel]; `}
583 # Wraps: `[self contentView
]`
584 fun content_view: UIView in "ObjC" `{ return [self contentView]; `}
587 # Style of a `UITableView`
588 extern class UITableViewStyle in "ObjC" `{ UITableViewStyle* `}
591 new plain in "ObjC" `{ return UITableViewStylePlain; `}
592 new grouped
in "ObjC" `{ return UITableViewStyleGrouped; `}