X-Git-Url: http://nitlanguage.org diff --git a/lib/ios/ui/uikit.nit b/lib/ios/ui/uikit.nit index 260237b..e87ffd8 100644 --- a/lib/ios/ui/uikit.nit +++ b/lib/ios/ui/uikit.nit @@ -24,7 +24,7 @@ import ios extern class UIView in "ObjC" `{ UIView * `} super NSObject - new in "ObjC" `{ return [[UIView alloc] initWithFrame: [[UIScreen mainScreen] applicationFrame]]; `} + new in "ObjC" `{ return [[UIView alloc] init]; `} # Wraps: `UIView.addSubview` fun add_subview(view: UIView) in "ObjC" `{ @@ -86,7 +86,7 @@ end extern class UIWindow in "ObjC" `{ UIWindow * `} super UIView - new in "ObjC" `{ return [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]]; `} + new in "ObjC" `{ return [[UIWindow alloc] init]; `} # Wraps: `[self makeKeyAndVisible]` fun make_key_and_visible in "ObjC" `{ @@ -94,7 +94,28 @@ extern class UIWindow in "ObjC" `{ UIWindow * `} `} end -# Base class for contorl objects +# Manages a set of views +extern class UIViewController in "ObjC" `{ UIViewController * `} + super NSObject + + new in "ObjC" `{ + return [[UIViewController alloc]initWithNibName:nil bundle:nil]; + `} + + # Wraps: `self.view` + fun view: UIView in "ObjC" `{ return self.view; `} + + # Wraps: `self.view` + fun view=(view: UIView) in "ObjC" `{ self.view = view; `} + + # Wraps: `self.title` + fun title: NSString in "ObjC" `{ return self.title; `} + + # Wraps: `self.title` + fun title=(title: NSString) in "ObjC" `{ self.title = title; `} +end + +# Base class for control objects extern class UIControl in "ObjC" `{ UIControl * `} super UIView @@ -168,6 +189,11 @@ extern class UILabel in "ObjC" `{ UILabel * `} return [self textColor]; `} + # Wraps: `UILabel.textColor` + fun text_color=(color: UIColor) in "ObjC" `{ + self.textColor = color; + `} + # Wraps: `UILabel.shadowColor` fun shadow_color: UIColor in "ObjC" `{ return [self shadowColor]; @@ -383,6 +409,15 @@ extern class UIColor in "ObjC" `{ UIColor * `} #fun cg_color: CGColorRef in "ObjC" `{ # return [self CGColor]; #`} + + # Wraps: `[UIColor groupTableViewBackgroundColor]` + new group_table_view_background_color in "ObjC" `{ return [UIColor groupTableViewBackgroundColor]; `} + + # Wraps: `[UIColor lightTextColor]` + new light_text_color in "ObjC" `{ return [UIColor lightTextColor]; `} + + # Wraps: `[UIColor darkTextColor]` + new dark_text_color in "ObjC" `{ return [UIColor darkTextColor]; `} end # Wraps: `[UIColor colorWithWhite:(CGFloat)white alpha:(CGFloat)alpha]` @@ -419,7 +454,7 @@ end extern class UITextField in "ObjC" `{ UITextField * `} super UIControl - new in "ObjC" `{ return [[UITextField alloc] initWithFrame: [[UIScreen mainScreen] applicationFrame]]; `} + new in "ObjC" `{ return [[UITextField alloc] init]; `} # Wraps: `UITextField.text` fun text: NSString in "ObjC" `{ @@ -430,6 +465,14 @@ extern class UITextField in "ObjC" `{ UITextField * `} fun text=(text: NSString) in "ObjC" `{ self.text = text; `} + + # Wraps: `UITextField.secureTextEntry` + fun secure_text_entry=(value: Bool) in "ObjC" `{ + self.secureTextEntry = value; + `} + + # Wraps: `UITextField.placeholder` + fun placeholder=(text: NSString) in "ObjC" `{ self.placeholder = text; `} end # Lays out a collection of views in either a column or a row @@ -437,7 +480,7 @@ extern class UIStackView in "ObjC" `{ UIStackView * `} super UIView new in "ObjC" `{ - return [[UIStackView alloc] initWithArrangedSubviews: [NSArray array]]; + return [[UIStackView alloc] init]; `} # Wraps: `[self addArrangedSubview:(UIView)view]` @@ -490,14 +533,24 @@ extern class UIStackView in "ObjC" `{ UIStackView * `} fun spacing=(value: Float) in "ObjC" `{ self.spacing = value; `} # Wraps: `UIStackView.baselineRelativeArrangement` - #fun baseline_relative_arrangement: Bool in "ObjC" `{ - # return [self baselineRelativeArrangement]; - #`} + fun baseline_relative_arrangement: Bool in "ObjC" `{ + return self.baselineRelativeArrangement; + `} + + # Wraps: `UIStackView.baselineRelativeArrangement` + fun baseline_relative_arrangement=(value: Bool) in "ObjC" `{ + self.baselineRelativeArrangement = value; + `} # Wraps: `UIStackView.layoutMarginsRelativeArrangement` - #fun layout_margins_relative_arrangement: Bool in "ObjC" `{ - # return [self layoutMarginsRelativeArrangement]; - #`} + fun layout_margins_relative_arrangement: Bool in "ObjC" `{ + return self.layoutMarginsRelativeArrangement; + `} + + # Wraps: `UIStackView.layoutMarginsRelativeArrangement` + fun layout_margins_relative_arrangement=(value: Bool) in "ObjC" `{ + self.layoutMarginsRelativeArrangement = value; + `} end # Defines the orientation of the arranged views in `UIStackView` @@ -591,3 +644,52 @@ extern class UITableViewStyle in "ObjC" `{ UITableViewStyle* `} new plain in "ObjC" `{ return UITableViewStylePlain; `} new grouped in "ObjC" `{ return UITableViewStyleGrouped; `} end + +# On/Off button +extern class UISwitch in "ObjC" `{ UISwitch * `} + super UIView + + new in "ObjC" `{ return [[UISwitch alloc] init]; `} + + # Wraps: `UISwitch.onTintColor` +# fun on_tint_color: UIColor in "ObjC" `{ +# return [self onTintColor]; +# `} + + # Wraps: `UISwitch.tintColor` +# fun tint_color: UIColor in "ObjC" `{ +# return [self tintColor]; +# `} + + # Wraps: `UISwitch.thumbTintColor` +# fun thumb_tint_color: UIColor in "ObjC" `{ +# return [self thumbTintColor]; +# `} + + # Wraps: `UISwitch.onImage` +# fun on_image: UIImage in "ObjC" `{ +# return [self onImage]; +# `} + + # Wraps: `UISwitch.offImage` +# fun off_image: UIImage in "ObjC" `{ +# return [self offImage]; +# `} + + # Wraps: `UISwitch.on` + fun on: Bool in "ObjC" `{ + return self.on; + `} + + # Wraps: `[self setOn:(BOOL)on animated:(BOOL)animated]` + fun set_on_animated(on: Bool, animated: Bool) in "ObjC" `{ + [self setOn: on animated: animated]; + `} +end + +# Support for displaying content larger than the window +extern class UIScrollView in "ObjC" `{ UIScrollView* `} + super UIView + + new in "ObjC" `{ return [[UIScrollView alloc] init]; `} +end