
#import "iCustomButton.h"


@implementation b4i_custombutton 


+ (B4I*)createBI {
    return [B4I alloc];
}

- (void)dealloc {
    if (self.bi != nil)
        NSLog(@"Class (b4i_custombutton) instance released.");
}
- (NSString*)  _addtoparent:(B4IPanelWrapper*) _parent :(int) _left :(int) _top :(int) _width :(int) _height :(int) _textcolor :(NSString*) _icon :(NSString*) _text{
 //BA.debugLineNum = 64;BA.debugLine="Public Sub AddToParent(Parent As Panel, Left As In";
 //BA.debugLineNum = 65;BA.debugLine="mLeft = Left";
self._mleft = _left;
 //BA.debugLineNum = 66;BA.debugLine="mTop = Top";
self._mtop = _top;
 //BA.debugLineNum = 67;BA.debugLine="mWidth = Width";
self._mwidth = _width;
 //BA.debugLineNum = 68;BA.debugLine="mHeight = Height";
self._mheight = _height;
 //BA.debugLineNum = 69;BA.debugLine="mParent = Parent";
self._mparent = _parent;
 //BA.debugLineNum = 71;BA.debugLine="mBase.Initialize(\"mBase\")";
[self._mbase Initialize:self.bi :@"mBase"];
 //BA.debugLineNum = 72;BA.debugLine="Parent.AddView(mBase, mLeft, mTop, mWidth, mHeigh";
[_parent AddView:(UIView*)((self._mbase).object) :(float) (self._mleft) :(float) (self._mtop) :(float) (self._mwidth) :(float) (self._mheight)];
 //BA.debugLineNum = 74;BA.debugLine="mIcon = Icon";
self._micon = _icon;
 //BA.debugLineNum = 75;BA.debugLine="mText = Text";
self._mtext = _text;
 //BA.debugLineNum = 76;BA.debugLine="mTextColor = TextColor";
self._mtextcolor = _textcolor;
 //BA.debugLineNum = 78;BA.debugLine="InitClass";
[self _initclass];
 //BA.debugLineNum = 79;BA.debugLine="End Sub";
return @"";
}
- (NSString*)  _base_resize:(double) _width :(double) _height{
 //BA.debugLineNum = 55;BA.debugLine="Private Sub Base_Resize (Width As Double, Height A";
 //BA.debugLineNum = 56;BA.debugLine="mHeight = Height";
self._mheight = (int) (_height);
 //BA.debugLineNum = 57;BA.debugLine="mWidth = Width";
self._mwidth = (int) (_width);
 //BA.debugLineNum = 58;BA.debugLine="End Sub";
return @"";
}
- (NSString*)  _class_globals{
 //BA.debugLineNum = 12;BA.debugLine="Sub Class_Globals";
 //BA.debugLineNum = 13;BA.debugLine="Private mEventName As String";
self._meventname = @"";
 //BA.debugLineNum = 14;BA.debugLine="Private mCallBack As Object";
self._mcallback = [NSObject new];
 //BA.debugLineNum = 15;BA.debugLine="Private mBase As Panel";
self._mbase = [B4IPanelWrapper new];
 //BA.debugLineNum = 17;BA.debugLine="Private mLeft, mTop, mWidth, mHeight As Int";
self._mleft = 0;
self._mtop = 0;
self._mwidth = 0;
self._mheight = 0;
 //BA.debugLineNum = 18;BA.debugLine="Private mText, mIcon As String";
self._mtext = @"";
self._micon = @"";
 //BA.debugLineNum = 19;BA.debugLine="Private mIconFont As Font";
self._miconfont = [B4IFontWrapper new];
 //BA.debugLineNum = 20;BA.debugLine="Private mTextColor As Int";
self._mtextcolor = 0;
 //BA.debugLineNum = 21;BA.debugLine="Private mIconTextSize, mTextSize As Float";
self._micontextsize = 0.0f;
self._mtextsize = 0.0f;
 //BA.debugLineNum = 22;BA.debugLine="Private mTag As Object";
self._mtag = [NSObject new];
 //BA.debugLineNum = 24;BA.debugLine="Private mLabel, mIconLabel As Label";
self._mlabel = [B4ILabelWrapper new];
self._miconlabel = [B4ILabelWrapper new];
 //BA.debugLineNum = 25;BA.debugLine="Private mParent As Panel";
self._mparent = [B4IPanelWrapper new];
 //BA.debugLineNum = 26;BA.debugLine="End Sub";
return @"";
}
- (NSString*)  _designercreateview:(B4IPanelWrapper*) _base :(B4ILabelWrapper*) _lbl :(B4IMap*) _props{
 //BA.debugLineNum = 37;BA.debugLine="Public Sub DesignerCreateView (Base As Panel, Lbl";
 //BA.debugLineNum = 38;BA.debugLine="mLeft = Base.Left";
self._mleft = (int) ([_base Left]);
 //BA.debugLineNum = 39;BA.debugLine="mTop = Base.Top";
self._mtop = (int) ([_base Top]);
 //BA.debugLineNum = 40;BA.debugLine="mWidth = Base.Width";
self._mwidth = (int) ([_base Width]);
 //BA.debugLineNum = 41;BA.debugLine="mHeight = Base.Height";
self._mheight = (int) ([_base Height]);
 //BA.debugLineNum = 42;BA.debugLine="mIcon = Lbl.Text";
self._micon = [_lbl Text];
 //BA.debugLineNum = 43;BA.debugLine="mText = Props.Get(\"Text\")";
self._mtext = [self.bi ObjectToString:[_props Get:(NSObject*)(@"Text")]];
 //BA.debugLineNum = 44;BA.debugLine="mBase.Initialize(\"mBase\")";
[self._mbase Initialize:self.bi :@"mBase"];
 //BA.debugLineNum = 45;BA.debugLine="mParent = Base.Parent";
self._mparent.object = (B4IPanelView*)(([_base Parent]).object);
 //BA.debugLineNum = 46;BA.debugLine="mParent.AddView(mBase, mLeft, mTop, mWidth, mHeig";
[self._mparent AddView:(UIView*)((self._mbase).object) :(float) (self._mleft) :(float) (self._mtop) :(float) (self._mwidth) :(float) (self._mheight)];
 //BA.debugLineNum = 48;BA.debugLine="mTextColor = Lbl.TextColor";
self._mtextcolor = [_lbl TextColor];
 //BA.debugLineNum = 49;BA.debugLine="mIconFont = Lbl.Font";
self._miconfont = [_lbl Font];
 //BA.debugLineNum = 50;BA.debugLine="mTag = Base.Tag";
self._mtag = [_base Tag];
 //BA.debugLineNum = 52;BA.debugLine="InitClass";
[self _initclass];
 //BA.debugLineNum = 53;BA.debugLine="End Sub";
return @"";
}
- (B4IPanelWrapper*)  _getbase{
 //BA.debugLineNum = 60;BA.debugLine="Public Sub GetBase As Panel";
 //BA.debugLineNum = 61;BA.debugLine="Return mBase";
if (true) return self._mbase;
 //BA.debugLineNum = 62;BA.debugLine="End Sub";
return nil;
}
- (NSObject*)  _gettag{
 //BA.debugLineNum = 131;BA.debugLine="Public Sub getTag As Object";
 //BA.debugLineNum = 132;BA.debugLine="Return mTag";
if (true) return self._mtag;
 //BA.debugLineNum = 133;BA.debugLine="End Sub";
return nil;
}
- (NSString*)  _initclass{
int _lblleft = 0;
int _lblwidth = 0;
 //BA.debugLineNum = 81;BA.debugLine="Private Sub InitClass";
 //BA.debugLineNum = 83;BA.debugLine="Private lblLeft, lblWidth  As Int";
_lblleft = 0;
_lblwidth = 0;
 //BA.debugLineNum = 84;BA.debugLine="lblWidth = 2 * mHeight / 3		'icon Label width and";
_lblwidth = (int) (2*self._mheight/(double)3);
 //BA.debugLineNum = 85;BA.debugLine="lblLeft = (mWidth - lblWidth) / 2";
_lblleft = (int) ((self._mwidth-_lblwidth)/(double)2);
 //BA.debugLineNum = 88;BA.debugLine="mIconLabel.Initialize(\"\")";
[self._miconlabel Initialize:self.bi :@""];
 //BA.debugLineNum = 89;BA.debugLine="mIconTextSize = mHeight / 2 / GetDeviceLayoutValu";
self._micontextsize = (float) (self._mheight/(double)2/(double)[[self.__c GetDeviceLayoutValues] Scale]);
 //BA.debugLineNum = 90;BA.debugLine="mIconFont = Font.CreateNew2(mIconFont.Name, mIcon";
self._miconfont = [[self.__c Font] CreateNew2:[self._miconfont Name] :self._micontextsize];
 //BA.debugLineNum = 91;BA.debugLine="mIconLabel.Font = mIconFont";
[self._miconlabel setFont:self._miconfont];
 //BA.debugLineNum = 92;BA.debugLine="mIconLabel.TextAlignment = mIconLabel.ALIGNMENT_C";
[self._miconlabel setTextAlignment:[self._miconlabel ALIGNMENT_CENTER]];
 //BA.debugLineNum = 93;BA.debugLine="mIconLabel.TextColor = mTextColor";
[self._miconlabel setTextColor:self._mtextcolor];
 //BA.debugLineNum = 94;BA.debugLine="mBase.AddView(mIconLabel, lblLeft, 0, lblWidth, l";
[self._mbase AddView:(UIView*)((self._miconlabel).object) :(float) (_lblleft) :(float) (0) :(float) (_lblwidth) :(float) (_lblwidth)];
 //BA.debugLineNum = 95;BA.debugLine="mIconLabel.Text = mIcon";
[self._miconlabel setText:self._micon];
 //BA.debugLineNum = 98;BA.debugLine="mLabel.Initialize(\"\")";
[self._mlabel Initialize:self.bi :@""];
 //BA.debugLineNum = 99;BA.debugLine="mTextSize = lblWidth / 3 / GetDeviceLayoutValues.";
self._mtextsize = (float) (_lblwidth/(double)3/(double)[[self.__c GetDeviceLayoutValues] Scale]);
 //BA.debugLineNum = 100;BA.debugLine="mLabel.Font = Font.CreateNew(mTextSize)";
[self._mlabel setFont:[[self.__c Font] CreateNew:self._mtextsize]];
 //BA.debugLineNum = 101;BA.debugLine="mLabel.TextColor = mTextColor";
[self._mlabel setTextColor:self._mtextcolor];
 //BA.debugLineNum = 102;BA.debugLine="mLabel.TextAlignment = mIconLabel.ALIGNMENT_CENTE";
[self._mlabel setTextAlignment:[self._miconlabel ALIGNMENT_CENTER]];
 //BA.debugLineNum = 103;BA.debugLine="mBase.AddView(mLabel, 0, 2 * mHeight / 3, mWidth,";
[self._mbase AddView:(UIView*)((self._mlabel).object) :(float) (0) :(float) (2*self._mheight/(double)3) :(float) (self._mwidth) :(float) (self._mheight/(double)3)];
 //BA.debugLineNum = 104;BA.debugLine="mLabel.Text = mText";
[self._mlabel setText:self._mtext];
 //BA.debugLineNum = 105;BA.debugLine="End Sub";
return @"";
}
- (NSString*)  _initialize:(B4I*) _ba :(NSObject*) _callback :(NSString*) _eventname{
[self initializeClassModule];
 //BA.debugLineNum = 28;BA.debugLine="Public Sub Initialize (Callback As Object, EventNa";
 //BA.debugLineNum = 29;BA.debugLine="mEventName = EventName";
self._meventname = _eventname;
 //BA.debugLineNum = 30;BA.debugLine="mCallBack = Callback";
self._mcallback = _callback;
 //BA.debugLineNum = 32;BA.debugLine="mIcon = Chr(0xE859)";
self._micon = [self.bi CharToString:[self.__c Chr:(int) (0xe859)]];
 //BA.debugLineNum = 33;BA.debugLine="mText = \"Test\"";
self._mtext = @"Test";
 //BA.debugLineNum = 34;BA.debugLine="mTextColor = Colors.Black";
self._mtextcolor = [[self.__c Colors] Black];
 //BA.debugLineNum = 35;BA.debugLine="End Sub";
return @"";
}
- (NSString*)  _mbase_click{
 //BA.debugLineNum = 107;BA.debugLine="Private Sub mBase_Click";
 //BA.debugLineNum = 108;BA.debugLine="If SubExists(mCallBack, mEventName & \"_Click\", 0)";
if ([self.__c SubExists:self._mcallback :[@[self._meventname,@"_Click"] componentsJoinedByString:@""] :(int) (0)]==[self.__c True]) { 
 //BA.debugLineNum = 109;BA.debugLine="CallSub(mCallBack,  mEventName & \"_Click\")";
[self.__c CallSub:self.bi :self._mcallback :[@[self._meventname,@"_Click"] componentsJoinedByString:@""]];
 };
 //BA.debugLineNum = 111;BA.debugLine="End Sub";
return @"";
}
- (NSString*)  _mbase_longclick{
 //BA.debugLineNum = 113;BA.debugLine="Private Sub mBase_LongClick";
 //BA.debugLineNum = 114;BA.debugLine="If SubExists(mCallBack, mEventName & \"_LongClick\"";
if ([self.__c SubExists:self._mcallback :[@[self._meventname,@"_LongClick"] componentsJoinedByString:@""] :(int) (0)]==[self.__c True]) { 
 //BA.debugLineNum = 115;BA.debugLine="CallSub(mCallBack,  mEventName & \"_LongClick\")";
[self.__c CallSub:self.bi :self._mcallback :[@[self._meventname,@"_LongClick"] componentsJoinedByString:@""]];
 };
 //BA.debugLineNum = 117;BA.debugLine="End Sub";
return @"";
}
- (NSString*)  _seticonfont:(B4IFontWrapper*) _iconfont{
 //BA.debugLineNum = 121;BA.debugLine="Public Sub setIconFont(IconFont As Font)";
 //BA.debugLineNum = 122;BA.debugLine="mIconFont = IconFont";
self._miconfont = _iconfont;
 //BA.debugLineNum = 123;BA.debugLine="End Sub";
return @"";
}
- (NSString*)  _settag:(NSObject*) _tag{
 //BA.debugLineNum = 126;BA.debugLine="Public Sub setTag(Tag As Object)";
 //BA.debugLineNum = 127;BA.debugLine="mTag = Tag";
self._mtag = _tag;
 //BA.debugLineNum = 128;BA.debugLine="mBase.Tag = Tag";
[self._mbase setTag:_tag];
 //BA.debugLineNum = 129;BA.debugLine="End Sub";
return @"";
}
@end
