
#import "iLimitBar.h"


@implementation b4i_limitbar 


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

- (void)dealloc {
    if (self.bi != nil)
        NSLog(@"Class (b4i_limitbar) instance released.");
}
- (NSString*)  _addtoparent:(B4IPanelWrapper*) _parent :(int) _left :(int) _top :(int) _width :(int) _height :(int) _backgroundcolor :(int) _radius{
 //BA.debugLineNum = 98;BA.debugLine="Public Sub AddToParent(Parent As Panel, Left As In";
 //BA.debugLineNum = 99;BA.debugLine="mWidth = Width";
self._mwidth = _width;
 //BA.debugLineNum = 100;BA.debugLine="mHeight = Max(Height, 30dip)					' limits the hei";
self._mheight = (int) ([self.__c Max:_height :[self.__c DipToCurrent:(int) (30)]]);
 //BA.debugLineNum = 101;BA.debugLine="mHeight = Min(Height, 60)					' limits the height";
self._mheight = (int) ([self.__c Min:_height :60]);
 //BA.debugLineNum = 102;BA.debugLine="mRadius = Min(Radius, Height / 2)	' limits the ma";
self._mradius = (int) ([self.__c Min:_radius :_height/(double)2]);
 //BA.debugLineNum = 103;BA.debugLine="mBackgroundColor = BackgroundColor";
self._mbackgroundcolor = _backgroundcolor;
 //BA.debugLineNum = 106;BA.debugLine="ltbPanelBack.Initialize(\"\")";
[self._ltbpanelback Initialize:self.bi :@""];
 //BA.debugLineNum = 107;BA.debugLine="Parent.AddView(ltbPanelBack, Left, Top, Width, He";
[_parent AddView:(UIView*)((self._ltbpanelback).object) :(float) (_left) :(float) (_top) :(float) (_width) :(float) (_height)];
 //BA.debugLineNum = 109;BA.debugLine="InitClass";
[self _initclass];
 //BA.debugLineNum = 110;BA.debugLine="End Sub";
return @"";
}
- (NSString*)  _base_resize:(double) _width :(double) _height{
 //BA.debugLineNum = 88;BA.debugLine="Private Sub Base_Resize (Width As Double, Height A";
 //BA.debugLineNum = 89;BA.debugLine="mHeight = Height";
self._mheight = (int) (_height);
 //BA.debugLineNum = 90;BA.debugLine="setWidth(Width)";
[self _setwidth:(int) (_width)];
 //BA.debugLineNum = 91;BA.debugLine="End Sub";
return @"";
}
- (NSString*)  _class_globals{
 //BA.debugLineNum = 20;BA.debugLine="Sub Class_Globals";
 //BA.debugLineNum = 21;BA.debugLine="Private mCallback As Object				' calling module";
self._mcallback = [NSObject new];
 //BA.debugLineNum = 22;BA.debugLine="Private mEventName As String			' event name";
self._meventname = @"";
 //BA.debugLineNum = 23;BA.debugLine="Private mWidth, mHeight, mRadius As Int";
self._mwidth = 0;
self._mheight = 0;
self._mradius = 0;
 //BA.debugLineNum = 25;BA.debugLine="Private ltbPanelBack As Panel			' the background";
self._ltbpanelback = [B4IPanelWrapper new];
 //BA.debugLineNum = 26;BA.debugLine="Private ltbPanelFront As Panel		' the foreground";
self._ltbpanelfront = [B4IPanelWrapper new];
 //BA.debugLineNum = 27;BA.debugLine="Private cvsPanelBack As Canvas		' the background";
self._cvspanelback = [B4ICanvas new];
 //BA.debugLineNum = 28;BA.debugLine="Private cvsPanelFront As Canvas		' the foreground";
self._cvspanelfront = [B4ICanvas new];
 //BA.debugLineNum = 29;BA.debugLine="Private rectPanelFront As Rect		' a rectangle for";
self._rectpanelfront = [B4IRect new];
 //BA.debugLineNum = 31;BA.debugLine="Private mBackgroundColor As Int		' color for the";
self._mbackgroundcolor = 0;
 //BA.debugLineNum = 32;BA.debugLine="Private mBackLineColor As Int			' color for the b";
self._mbacklinecolor = 0;
 //BA.debugLineNum = 33;BA.debugLine="Private mFrontLineColor As Int		' color for the f";
self._mfrontlinecolor = 0;
 //BA.debugLineNum = 34;BA.debugLine="Private mMargin = 15dip As Float	' left and right";
self._mmargin = (float) ([self.__c DipToCurrent:(int) (15)]);
 //BA.debugLineNum = 35;BA.debugLine="Private x0, y0, x1, y1, y2 As Int	' backline coor";
self._x0 = 0;
self._y0 = 0;
self._x1 = 0;
self._y1 = 0;
self._y2 = 0;
 //BA.debugLineNum = 36;BA.debugLine="Private mMaxValue = 100 As Int		' value of the Ma";
self._mmaxvalue = (int) (100);
 //BA.debugLineNum = 37;BA.debugLine="Private mScale As Double					' scale between posi";
self._mscale = 0.0;
 //BA.debugLineNum = 38;BA.debugLine="Private mLimit(2) As Int					' values of the limi";
self._mlimit = [[B4IArray alloc]initObjects:@[@((int) (2))] :@0 :nil];
 //BA.debugLineNum = 39;BA.debugLine="Private PositionPixels(2) As Int	' left and right";
self._positionpixels = [[B4IArray alloc]initObjects:@[@((int) (2))] :@0 :nil];
 //BA.debugLineNum = 41;BA.debugLine="Private PosIndex As Int						' current index of t";
self._posindex = 0;
 //BA.debugLineNum = 42;BA.debugLine="Private Paths(2) As Path					' two paths for the";
self._paths = [[B4IArray alloc]initObjects:@[@((int) (2))] :nil :@"B4IPathWrapper"];
 //BA.debugLineNum = 43;BA.debugLine="End Sub";
return @"";
}
- (NSString*)  _designercreateview:(B4IPanelWrapper*) _base :(B4ILabelWrapper*) _lbl :(B4IMap*) _props{
 //BA.debugLineNum = 64;BA.debugLine="Public Sub DesignerCreateView(Base As Panel, Lbl A";
 //BA.debugLineNum = 67;BA.debugLine="ltbPanelBack = Base";
self._ltbpanelback = _base;
 //BA.debugLineNum = 70;BA.debugLine="mWidth = Base.Width";
self._mwidth = (int) ([_base Width]);
 //BA.debugLineNum = 71;BA.debugLine="mHeight = Base.Height";
self._mheight = (int) ([_base Height]);
 //BA.debugLineNum = 73;BA.debugLine="mMaxValue = Props.Get(\"Max\")";
self._mmaxvalue = [self.bi ObjectToNumber:[_props Get:(NSObject*)(@"Max")]].intValue;
 //BA.debugLineNum = 74;BA.debugLine="mLimit(0) = Props.Get(\"LimitLeft\")";
[self._mlimit setObjectFastN:(int) (0):@([self.bi ObjectToNumber:[_props Get:(NSObject*)(@"LimitLeft")]].intValue)];
 //BA.debugLineNum = 75;BA.debugLine="mLimit(0) = Max(0, mLimit(0))";
[self._mlimit setObjectFastN:(int) (0):@((int) ([self.__c Max:0 :((NSNumber*)[self._mlimit getObjectFastN:(int) (0)]).intValue]))];
 //BA.debugLineNum = 77;BA.debugLine="mLimit(1) = Props.Get(\"LimitRight\")";
[self._mlimit setObjectFastN:(int) (1):@([self.bi ObjectToNumber:[_props Get:(NSObject*)(@"LimitRight")]].intValue)];
 //BA.debugLineNum = 78;BA.debugLine="mLimit(1) = Min(mMaxValue, mLimit(1))";
[self._mlimit setObjectFastN:(int) (1):@((int) ([self.__c Min:self._mmaxvalue :((NSNumber*)[self._mlimit getObjectFastN:(int) (1)]).intValue]))];
 //BA.debugLineNum = 80;BA.debugLine="mRadius = Props.Get(\"Radius\")";
self._mradius = [self.bi ObjectToNumber:[_props Get:(NSObject*)(@"Radius")]].intValue;
 //BA.debugLineNum = 81;BA.debugLine="mBackgroundColor = Props.Get(\"BackgroundColor\")";
self._mbackgroundcolor = [self.bi ObjectToNumber:[_props Get:(NSObject*)(@"BackgroundColor")]].intValue;
 //BA.debugLineNum = 82;BA.debugLine="mBackLineColor = Props.Get(\"BackLineColor\")";
self._mbacklinecolor = [self.bi ObjectToNumber:[_props Get:(NSObject*)(@"BackLineColor")]].intValue;
 //BA.debugLineNum = 83;BA.debugLine="mFrontLineColor = Props.Get(\"FrontLineColor\")";
self._mfrontlinecolor = [self.bi ObjectToNumber:[_props Get:(NSObject*)(@"FrontLineColor")]].intValue;
 //BA.debugLineNum = 85;BA.debugLine="InitClass";
[self _initclass];
 //BA.debugLineNum = 86;BA.debugLine="End Sub";
return @"";
}
- (NSString*)  _drawbackground{
 //BA.debugLineNum = 137;BA.debugLine="Private Sub DrawBackGround";
 //BA.debugLineNum = 138;BA.debugLine="cvsPanelBack.Initialize(ltbPanelBack)";
[self._cvspanelback Initialize:(B4IViewWrapper*) [B4IObjectWrapper createWrapper:[B4IViewWrapper new] object:(UIView*)((self._ltbpanelback).object)]];
 //BA.debugLineNum = 139;BA.debugLine="cvsPanelBack.DrawRectRounded(rectPanelFront, mBac";
[self._cvspanelback DrawRectRounded:self._rectpanelfront :self._mbackgroundcolor :[self.__c True] :(float) (1) :(float) (self._mradius)];
 //BA.debugLineNum = 140;BA.debugLine="cvsPanelBack.DrawLine(x0, y0, x1, y0, mBackLineCo";
[self._cvspanelback DrawLine:(float) (self._x0) :(float) (self._y0) :(float) (self._x1) :(float) (self._y0) :self._mbacklinecolor :(float) ([self.__c DipToCurrent:(int) (2)])];
 //BA.debugLineNum = 141;BA.debugLine="cvsPanelBack.Refresh";
[self._cvspanelback Refresh];
 //BA.debugLineNum = 142;BA.debugLine="End Sub";
return @"";
}
- (NSString*)  _drawcursors{
 //BA.debugLineNum = 156;BA.debugLine="Private Sub DrawCursors";
 //BA.debugLineNum = 158;BA.debugLine="cvsPanelFront.DrawRect(rectPanelFront, Colors.Tra";
[self._cvspanelfront DrawRect:self._rectpanelfront :[[self.__c Colors] Transparent] :[self.__c True] :(float) (1)];
 //BA.debugLineNum = 161;BA.debugLine="Paths(0).Initialize(PositionPixels(0), y0)";
[((B4IPathWrapper*)[self._paths getObjectFast:(int) (0)]) Initialize:(float) (((NSNumber*)[self._positionpixels getObjectFastN:(int) (0)]).intValue) :(float) (self._y0)];
 //BA.debugLineNum = 162;BA.debugLine="Paths(0).LineTo(PositionPixels(0), y2)";
[((B4IPathWrapper*)[self._paths getObjectFast:(int) (0)]) LineTo:(float) (((NSNumber*)[self._positionpixels getObjectFastN:(int) (0)]).intValue) :(float) (self._y2)];
 //BA.debugLineNum = 163;BA.debugLine="Paths(0).LineTo(PositionPixels(0) - 12dip, y2)";
[((B4IPathWrapper*)[self._paths getObjectFast:(int) (0)]) LineTo:(float) (((NSNumber*)[self._positionpixels getObjectFastN:(int) (0)]).intValue-[self.__c DipToCurrent:(int) (12)]) :(float) (self._y2)];
 //BA.debugLineNum = 164;BA.debugLine="Paths(0).LineTo(PositionPixels(0) - 12dip, y1)";
[((B4IPathWrapper*)[self._paths getObjectFast:(int) (0)]) LineTo:(float) (((NSNumber*)[self._positionpixels getObjectFastN:(int) (0)]).intValue-[self.__c DipToCurrent:(int) (12)]) :(float) (self._y1)];
 //BA.debugLineNum = 165;BA.debugLine="Paths(0).LineTo(PositionPixels(0), y0)";
[((B4IPathWrapper*)[self._paths getObjectFast:(int) (0)]) LineTo:(float) (((NSNumber*)[self._positionpixels getObjectFastN:(int) (0)]).intValue) :(float) (self._y0)];
 //BA.debugLineNum = 168;BA.debugLine="Paths(1).Initialize(PositionPixels(1), y0)";
[((B4IPathWrapper*)[self._paths getObjectFast:(int) (1)]) Initialize:(float) (((NSNumber*)[self._positionpixels getObjectFastN:(int) (1)]).intValue) :(float) (self._y0)];
 //BA.debugLineNum = 169;BA.debugLine="Paths(1).LineTo(PositionPixels(1), y2)";
[((B4IPathWrapper*)[self._paths getObjectFast:(int) (1)]) LineTo:(float) (((NSNumber*)[self._positionpixels getObjectFastN:(int) (1)]).intValue) :(float) (self._y2)];
 //BA.debugLineNum = 170;BA.debugLine="Paths(1).LineTo(PositionPixels(1) + 12dip, y2)";
[((B4IPathWrapper*)[self._paths getObjectFast:(int) (1)]) LineTo:(float) (((NSNumber*)[self._positionpixels getObjectFastN:(int) (1)]).intValue+[self.__c DipToCurrent:(int) (12)]) :(float) (self._y2)];
 //BA.debugLineNum = 171;BA.debugLine="Paths(1).LineTo(PositionPixels(1) + 12dip, y1)";
[((B4IPathWrapper*)[self._paths getObjectFast:(int) (1)]) LineTo:(float) (((NSNumber*)[self._positionpixels getObjectFastN:(int) (1)]).intValue+[self.__c DipToCurrent:(int) (12)]) :(float) (self._y1)];
 //BA.debugLineNum = 172;BA.debugLine="Paths(1).LineTo(PositionPixels(1), y0)";
[((B4IPathWrapper*)[self._paths getObjectFast:(int) (1)]) LineTo:(float) (((NSNumber*)[self._positionpixels getObjectFastN:(int) (1)]).intValue) :(float) (self._y0)];
 //BA.debugLineNum = 175;BA.debugLine="cvsPanelFront.DrawPath(Paths(0), mFrontLineColor,";
[self._cvspanelfront DrawPath:(UIBezierPath*)((((B4IPathWrapper*)[self._paths getObjectFast:(int) (0)])).object) :self._mfrontlinecolor :[self.__c True] :(float) (1)];
 //BA.debugLineNum = 176;BA.debugLine="cvsPanelFront.DrawPath(Paths(1), mFrontLineColor,";
[self._cvspanelfront DrawPath:(UIBezierPath*)((((B4IPathWrapper*)[self._paths getObjectFast:(int) (1)])).object) :self._mfrontlinecolor :[self.__c True] :(float) (1)];
 //BA.debugLineNum = 177;BA.debugLine="cvsPanelFront.DrawLine(PositionPixels(0), y0, Pos";
[self._cvspanelfront DrawLine:(float) (((NSNumber*)[self._positionpixels getObjectFastN:(int) (0)]).intValue) :(float) (self._y0) :(float) (((NSNumber*)[self._positionpixels getObjectFastN:(int) (1)]).intValue) :(float) (self._y0) :self._mfrontlinecolor :(float) ([self.__c DipToCurrent:(int) (3)])];
 //BA.debugLineNum = 179;BA.debugLine="cvsPanelFront.Refresh";
[self._cvspanelfront Refresh];
 //BA.debugLineNum = 180;BA.debugLine="End Sub";
return @"";
}
- (int)  _getbacklinecolor{
 //BA.debugLineNum = 334;BA.debugLine="Public Sub getBackLineColor As Int";
 //BA.debugLineNum = 335;BA.debugLine="Return mBackLineColor";
if (true) return self._mbacklinecolor;
 //BA.debugLineNum = 336;BA.debugLine="End Sub";
return 0;
}
- (int)  _getfrontinecolor{
 //BA.debugLineNum = 346;BA.debugLine="Public Sub getFrontineColor As Int";
 //BA.debugLineNum = 347;BA.debugLine="Return mFrontLineColor";
if (true) return self._mfrontlinecolor;
 //BA.debugLineNum = 348;BA.debugLine="End Sub";
return 0;
}
- (int)  _getheight{
 //BA.debugLineNum = 313;BA.debugLine="Public Sub getHeight As Int";
 //BA.debugLineNum = 314;BA.debugLine="Return ltbPanelBack.Height";
if (true) return (int) ([self._ltbpanelback Height]);
 //BA.debugLineNum = 315;BA.debugLine="End Sub";
return 0;
}
- (int)  _getleft{
 //BA.debugLineNum = 264;BA.debugLine="Public Sub getLeft As Int";
 //BA.debugLineNum = 265;BA.debugLine="Return ltbPanelBack.Left";
if (true) return (int) ([self._ltbpanelback Left]);
 //BA.debugLineNum = 266;BA.debugLine="End Sub";
return 0;
}
- (int)  _getlimitleft{
 //BA.debugLineNum = 243;BA.debugLine="Public Sub getLimitLeft As Int";
 //BA.debugLineNum = 244;BA.debugLine="Return mLimit(0)";
if (true) return ((NSNumber*)[self._mlimit getObjectFastN:(int) (0)]).intValue;
 //BA.debugLineNum = 245;BA.debugLine="End Sub";
return 0;
}
- (int)  _getlimitright{
 //BA.debugLineNum = 255;BA.debugLine="Public Sub getLimitRight As Int";
 //BA.debugLineNum = 256;BA.debugLine="Return mLimit(1)";
if (true) return ((NSNumber*)[self._mlimit getObjectFastN:(int) (1)]).intValue;
 //BA.debugLineNum = 257;BA.debugLine="End Sub";
return 0;
}
- (int)  _getmax{
 //BA.debugLineNum = 231;BA.debugLine="Public Sub getMax As Int";
 //BA.debugLineNum = 232;BA.debugLine="Return mMaxValue";
if (true) return self._mmaxvalue;
 //BA.debugLineNum = 233;BA.debugLine="End Sub";
return 0;
}
- (int)  _gettop{
 //BA.debugLineNum = 273;BA.debugLine="Public Sub getTop As Int";
 //BA.debugLineNum = 274;BA.debugLine="Return ltbPanelBack.Top";
if (true) return (int) ([self._ltbpanelback Top]);
 //BA.debugLineNum = 275;BA.debugLine="End Sub";
return 0;
}
- (BOOL)  _getvisible{
 //BA.debugLineNum = 322;BA.debugLine="Public Sub getVisible As Boolean";
 //BA.debugLineNum = 323;BA.debugLine="Return ltbPanelBack.Visible";
if (true) return [self._ltbpanelback Visible];
 //BA.debugLineNum = 324;BA.debugLine="End Sub";
return false;
}
- (int)  _getwidth{
 //BA.debugLineNum = 293;BA.debugLine="Public Sub getWidth As Int";
 //BA.debugLineNum = 294;BA.debugLine="Return ltbPanelBack.Width";
if (true) return (int) ([self._ltbpanelback Width]);
 //BA.debugLineNum = 295;BA.debugLine="End Sub";
return 0;
}
- (NSString*)  _initclass{
 //BA.debugLineNum = 112;BA.debugLine="Private Sub InitClass";
 //BA.debugLineNum = 113;BA.debugLine="InitCursors";
[self _initcursors];
 //BA.debugLineNum = 116;BA.debugLine="ltbPanelBack.Color = mBackgroundColor";
[self._ltbpanelback setColor:self._mbackgroundcolor];
 //BA.debugLineNum = 117;BA.debugLine="ltbPanelBack.SetBorder(0, mBackgroundColor, mRadi";
[self._ltbpanelback SetBorder:(float) (0) :self._mbackgroundcolor :(float) (self._mradius)];
 //BA.debugLineNum = 120;BA.debugLine="ltbPanelFront.Initialize(\"ltbPanelFront\")";
[self._ltbpanelfront Initialize:self.bi :@"ltbPanelFront"];
 //BA.debugLineNum = 121;BA.debugLine="ltbPanelBack.AddView(ltbPanelFront, 0, 0, ltbPane";
[self._ltbpanelback AddView:(UIView*)((self._ltbpanelfront).object) :(float) (0) :(float) (0) :[self._ltbpanelback Width] :[self._ltbpanelback Height]];
 //BA.debugLineNum = 124;BA.debugLine="rectPanelFront.Initialize(0, 0, ltbPanelFront.Wid";
[self._rectpanelfront Initialize:(float) (0) :(float) (0) :[self._ltbpanelfront Width] :[self._ltbpanelfront Height]];
 //BA.debugLineNum = 125;BA.debugLine="ltbPanelFront.BringToFront";
[self._ltbpanelfront BringToFront];
 //BA.debugLineNum = 128;BA.debugLine="cvsPanelBack.Initialize(ltbPanelBack)";
[self._cvspanelback Initialize:(B4IViewWrapper*) [B4IObjectWrapper createWrapper:[B4IViewWrapper new] object:(UIView*)((self._ltbpanelback).object)]];
 //BA.debugLineNum = 129;BA.debugLine="DrawBackGround";
[self _drawbackground];
 //BA.debugLineNum = 132;BA.debugLine="cvsPanelFront.Initialize(ltbPanelFront)";
[self._cvspanelfront Initialize:(B4IViewWrapper*) [B4IObjectWrapper createWrapper:[B4IViewWrapper new] object:(UIView*)((self._ltbpanelfront).object)]];
 //BA.debugLineNum = 134;BA.debugLine="setMax(mMaxValue)";
[self _setmax:self._mmaxvalue];
 //BA.debugLineNum = 135;BA.debugLine="End Sub";
return @"";
}
- (NSString*)  _initcursors{
 //BA.debugLineNum = 144;BA.debugLine="Private Sub InitCursors";
 //BA.debugLineNum = 145;BA.debugLine="x0 = mMargin";
self._x0 = (int) (self._mmargin);
 //BA.debugLineNum = 146;BA.debugLine="x1 = mWidth - mMargin";
self._x1 = (int) (self._mwidth-self._mmargin);
 //BA.debugLineNum = 147;BA.debugLine="mScale = (x1 - x0) / mMaxValue";
self._mscale = (self._x1-self._x0)/(double)self._mmaxvalue;
 //BA.debugLineNum = 148;BA.debugLine="PositionPixels(0) = mLimit(0) * mScale + x0";
[self._positionpixels setObjectFastN:(int) (0):@((int) (((NSNumber*)[self._mlimit getObjectFastN:(int) (0)]).intValue*self._mscale+self._x0))];
 //BA.debugLineNum = 149;BA.debugLine="PositionPixels(1) = mLimit(1) * mScale + x0";
[self._positionpixels setObjectFastN:(int) (1):@((int) (((NSNumber*)[self._mlimit getObjectFastN:(int) (1)]).intValue*self._mscale+self._x0))];
 //BA.debugLineNum = 151;BA.debugLine="y0 = 0.2 * mHeight";
self._y0 = (int) (0.2*self._mheight);
 //BA.debugLineNum = 152;BA.debugLine="y1 = y0 + 8dip + 0.05 * mHeight";
self._y1 = (int) (self._y0+[self.__c DipToCurrent:(int) (8)]+0.05*self._mheight);
 //BA.debugLineNum = 153;BA.debugLine="y2 = 0.9 * mHeight";
self._y2 = (int) (0.9*self._mheight);
 //BA.debugLineNum = 154;BA.debugLine="End Sub";
return @"";
}
- (NSString*)  _initialize:(B4I*) _ba :(NSObject*) _callback :(NSString*) _eventname{
[self initializeClassModule];
 //BA.debugLineNum = 50;BA.debugLine="Public Sub Initialize(Callback As Object, EventNam";
 //BA.debugLineNum = 51;BA.debugLine="mCallback = Callback";
self._mcallback = _callback;
 //BA.debugLineNum = 52;BA.debugLine="mEventName = EventName";
self._meventname = _eventname;
 //BA.debugLineNum = 55;BA.debugLine="mBackgroundColor = Colors.Blue";
self._mbackgroundcolor = [[self.__c Colors] Blue];
 //BA.debugLineNum = 56;BA.debugLine="mBackLineColor = Colors.Black";
self._mbacklinecolor = [[self.__c Colors] Black];
 //BA.debugLineNum = 57;BA.debugLine="mFrontLineColor = Colors.RGB(51, 181, 229)";
self._mfrontlinecolor = [[self.__c Colors] RGB:(int) (51) :(int) (181) :(int) (229)];
 //BA.debugLineNum = 58;BA.debugLine="mMargin = 15";
self._mmargin = (float) (15);
 //BA.debugLineNum = 59;BA.debugLine="mMaxValue = 100";
self._mmaxvalue = (int) (100);
 //BA.debugLineNum = 60;BA.debugLine="mLimit(0) = 0";
[self._mlimit setObjectFastN:(int) (0):@((int) (0))];
 //BA.debugLineNum = 61;BA.debugLine="mLimit(1) = mMaxValue";
[self._mlimit setObjectFastN:(int) (1):@(self._mmaxvalue)];
 //BA.debugLineNum = 62;BA.debugLine="End Sub";
return @"";
}
- (NSString*)  _ltbpanelfront_touch:(int) _action :(float) _x :(float) _y{
int _val = 0;
 //BA.debugLineNum = 182;BA.debugLine="Private Sub ltbPanelFront_Touch (Action As Int, X";
 //BA.debugLineNum = 184;BA.debugLine="X = Max(x0, X)";
_x = (float) ([self.__c Max:self._x0 :_x]);
 //BA.debugLineNum = 185;BA.debugLine="X = Min(x1, X)";
_x = (float) ([self.__c Min:self._x1 :_x]);
 //BA.debugLineNum = 188;BA.debugLine="Select Action";
switch (_action) {
case 0: {
 //BA.debugLineNum = 190;BA.debugLine="If X < Abs(PositionPixels(0) + PositionPixels(1";
if (_x<[self.__c Abs:((NSNumber*)[self._positionpixels getObjectFastN:(int) (0)]).intValue+((NSNumber*)[self._positionpixels getObjectFastN:(int) (1)]).intValue]/(double)2) { 
 //BA.debugLineNum = 192;BA.debugLine="PosIndex = 0";
self._posindex = (int) (0);
 }else {
 //BA.debugLineNum = 195;BA.debugLine="PosIndex = 1";
self._posindex = (int) (1);
 };
 //BA.debugLineNum = 197;BA.debugLine="mLimit(PosIndex) = Floor((X - x0) / mScale + .5";
[self._mlimit setObjectFastN:self._posindex:@((int) ([self.__c Floor:(_x-self._x0)/(double)self._mscale+.5]))];
 //BA.debugLineNum = 198;BA.debugLine="PositionPixels(PosIndex) = X";
[self._positionpixels setObjectFastN:self._posindex:@((int) (_x))];
 //BA.debugLineNum = 199;BA.debugLine="DrawCursors";
[self _drawcursors];
 break; }
case 2: {
 //BA.debugLineNum = 201;BA.debugLine="mLimit(PosIndex) = Floor((X - x0) / mScale + .5";
[self._mlimit setObjectFastN:self._posindex:@((int) ([self.__c Floor:(_x-self._x0)/(double)self._mscale+.5]))];
 //BA.debugLineNum = 202;BA.debugLine="PositionPixels(PosIndex) = X";
[self._positionpixels setObjectFastN:self._posindex:@((int) (_x))];
 //BA.debugLineNum = 203;BA.debugLine="DrawCursors";
[self _drawcursors];
 break; }
case 1: {
 //BA.debugLineNum = 207;BA.debugLine="If mLimit(0) > mLimit(1) Then";
if (((NSNumber*)[self._mlimit getObjectFastN:(int) (0)]).intValue>((NSNumber*)[self._mlimit getObjectFastN:(int) (1)]).intValue) { 
 //BA.debugLineNum = 208;BA.debugLine="Private val As Int";
_val = 0;
 //BA.debugLineNum = 209;BA.debugLine="val = mLimit(0)";
_val = ((NSNumber*)[self._mlimit getObjectFastN:(int) (0)]).intValue;
 //BA.debugLineNum = 210;BA.debugLine="mLimit(0) = mLimit(1)";
[self._mlimit setObjectFastN:(int) (0):@(((NSNumber*)[self._mlimit getObjectFastN:(int) (1)]).intValue)];
 //BA.debugLineNum = 211;BA.debugLine="mLimit(1) = val";
[self._mlimit setObjectFastN:(int) (1):@(_val)];
 //BA.debugLineNum = 212;BA.debugLine="PositionPixels(0) = mLimit(0) * mScale + x0";
[self._positionpixels setObjectFastN:(int) (0):@((int) (((NSNumber*)[self._mlimit getObjectFastN:(int) (0)]).intValue*self._mscale+self._x0))];
 //BA.debugLineNum = 213;BA.debugLine="PositionPixels(1) = mLimit(1) * mScale + x0";
[self._positionpixels setObjectFastN:(int) (1):@((int) (((NSNumber*)[self._mlimit getObjectFastN:(int) (1)]).intValue*self._mscale+self._x0))];
 //BA.debugLineNum = 214;BA.debugLine="DrawCursors";
[self _drawcursors];
 };
 break; }
}
;
 //BA.debugLineNum = 219;BA.debugLine="If SubExists(mCallback, mEventName & \"_ValuesChan";
if ([self.__c SubExists:self._mcallback :[@[self._meventname,@"_ValuesChanged"] componentsJoinedByString:@""] :(int) (2)]) { 
 //BA.debugLineNum = 220;BA.debugLine="CallSub3(mCallback, mEventName & \"_ValuesChanged";
[self.__c CallSub3:self.bi :self._mcallback :[@[self._meventname,@"_ValuesChanged"] componentsJoinedByString:@""] :(NSObject*)(@(((NSNumber*)[self._mlimit getObjectFastN:(int) (0)]).intValue)) :(NSObject*)(@(((NSNumber*)[self._mlimit getObjectFastN:(int) (1)]).intValue))];
 };
 //BA.debugLineNum = 222;BA.debugLine="End Sub";
return @"";
}
- (NSString*)  _setbacklinecolor:(int) _backlinecolor{
 //BA.debugLineNum = 327;BA.debugLine="Public Sub setBackLineColor(BackLineColor As Int)";
 //BA.debugLineNum = 328;BA.debugLine="mBackLineColor = BackLineColor";
self._mbacklinecolor = _backlinecolor;
 //BA.debugLineNum = 329;BA.debugLine="If ltbPanelBack.IsInitialized Then";
if ([self._ltbpanelback IsInitialized]) { 
 //BA.debugLineNum = 330;BA.debugLine="DrawBackGround";
[self _drawbackground];
 };
 //BA.debugLineNum = 332;BA.debugLine="End Sub";
return @"";
}
- (NSString*)  _setfrontlinecolor:(int) _frontlinecolor{
 //BA.debugLineNum = 339;BA.debugLine="Public Sub setFrontLineColor(FrontLineColor As Int";
 //BA.debugLineNum = 340;BA.debugLine="mFrontLineColor = FrontLineColor";
self._mfrontlinecolor = _frontlinecolor;
 //BA.debugLineNum = 341;BA.debugLine="If ltbPanelBack.IsInitialized Then";
if ([self._ltbpanelback IsInitialized]) { 
 //BA.debugLineNum = 342;BA.debugLine="DrawCursors";
[self _drawcursors];
 };
 //BA.debugLineNum = 344;BA.debugLine="End Sub";
return @"";
}
- (NSString*)  _setheight:(int) _height{
 //BA.debugLineNum = 298;BA.debugLine="Public Sub setHeight(Height As Int)";
 //BA.debugLineNum = 299;BA.debugLine="mHeight = Max(Height, 30dip)";
self._mheight = (int) ([self.__c Max:_height :[self.__c DipToCurrent:(int) (30)]]);
 //BA.debugLineNum = 300;BA.debugLine="ltbPanelBack.Height = mHeight";
[self._ltbpanelback setHeight:(float) (self._mheight)];
 //BA.debugLineNum = 301;BA.debugLine="ltbPanelFront.Height = mHeight";
[self._ltbpanelfront setHeight:(float) (self._mheight)];
 //BA.debugLineNum = 302;BA.debugLine="cvsPanelBack.Initialize(ltbPanelBack)";
[self._cvspanelback Initialize:(B4IViewWrapper*) [B4IObjectWrapper createWrapper:[B4IViewWrapper new] object:(UIView*)((self._ltbpanelback).object)]];
 //BA.debugLineNum = 303;BA.debugLine="cvsPanelFront.Initialize(ltbPanelFront)";
[self._cvspanelfront Initialize:(B4IViewWrapper*) [B4IObjectWrapper createWrapper:[B4IViewWrapper new] object:(UIView*)((self._ltbpanelfront).object)]];
 //BA.debugLineNum = 306;BA.debugLine="rectPanelFront.Initialize(0, 0, ltbPanelFront.Wid";
[self._rectpanelfront Initialize:(float) (0) :(float) (0) :[self._ltbpanelfront Width] :[self._ltbpanelfront Height]];
 //BA.debugLineNum = 308;BA.debugLine="InitCursors";
[self _initcursors];
 //BA.debugLineNum = 309;BA.debugLine="InitCursors";
[self _initcursors];
 //BA.debugLineNum = 310;BA.debugLine="DrawBackGround";
[self _drawbackground];
 //BA.debugLineNum = 311;BA.debugLine="End Sub";
return @"";
}
- (NSString*)  _setleft:(int) _left{
 //BA.debugLineNum = 260;BA.debugLine="Public Sub setLeft(Left As Int)";
 //BA.debugLineNum = 261;BA.debugLine="ltbPanelBack.Left = Left";
[self._ltbpanelback setLeft:(float) (_left)];
 //BA.debugLineNum = 262;BA.debugLine="End Sub";
return @"";
}
- (NSString*)  _setlimitleft:(int) _pos{
 //BA.debugLineNum = 236;BA.debugLine="Public Sub setLimitLeft(Pos As Int)";
 //BA.debugLineNum = 238;BA.debugLine="mLimit(0) = Max(0, Pos)";
[self._mlimit setObjectFastN:(int) (0):@((int) ([self.__c Max:0 :_pos]))];
 //BA.debugLineNum = 239;BA.debugLine="InitCursors";
[self _initcursors];
 //BA.debugLineNum = 240;BA.debugLine="DrawCursors";
[self _drawcursors];
 //BA.debugLineNum = 241;BA.debugLine="End Sub";
return @"";
}
- (NSString*)  _setlimitright:(int) _pos{
 //BA.debugLineNum = 248;BA.debugLine="Public Sub setLimitRight(Pos As Int)";
 //BA.debugLineNum = 250;BA.debugLine="mLimit(1) = Min(mMaxValue, Pos)";
[self._mlimit setObjectFastN:(int) (1):@((int) ([self.__c Min:self._mmaxvalue :_pos]))];
 //BA.debugLineNum = 251;BA.debugLine="InitCursors";
[self _initcursors];
 //BA.debugLineNum = 252;BA.debugLine="DrawCursors";
[self _drawcursors];
 //BA.debugLineNum = 253;BA.debugLine="End Sub";
return @"";
}
- (NSString*)  _setmax:(int) _maxvalue{
 //BA.debugLineNum = 225;BA.debugLine="Public Sub setMax(MaxValue As Int)";
 //BA.debugLineNum = 226;BA.debugLine="mMaxValue = MaxValue";
self._mmaxvalue = _maxvalue;
 //BA.debugLineNum = 227;BA.debugLine="InitCursors";
[self _initcursors];
 //BA.debugLineNum = 228;BA.debugLine="DrawCursors";
[self _drawcursors];
 //BA.debugLineNum = 229;BA.debugLine="End Sub";
return @"";
}
- (NSString*)  _settop:(int) _top{
 //BA.debugLineNum = 269;BA.debugLine="Public Sub setTop(Top As Int)";
 //BA.debugLineNum = 270;BA.debugLine="ltbPanelBack.Top = Top";
[self._ltbpanelback setTop:(float) (_top)];
 //BA.debugLineNum = 271;BA.debugLine="End Sub";
return @"";
}
- (NSString*)  _setvisible:(BOOL) _isvisible{
 //BA.debugLineNum = 318;BA.debugLine="Public Sub setVisible(IsVisible As Boolean)";
 //BA.debugLineNum = 319;BA.debugLine="ltbPanelBack.Visible = IsVisible";
[self._ltbpanelback setVisible:_isvisible];
 //BA.debugLineNum = 320;BA.debugLine="End Sub";
return @"";
}
- (NSString*)  _setwidth:(int) _width{
 //BA.debugLineNum = 278;BA.debugLine="Public Sub setWidth(Width As Int)";
 //BA.debugLineNum = 279;BA.debugLine="mWidth = Width";
self._mwidth = _width;
 //BA.debugLineNum = 280;BA.debugLine="ltbPanelBack.Width = mWidth";
[self._ltbpanelback setWidth:(float) (self._mwidth)];
 //BA.debugLineNum = 281;BA.debugLine="ltbPanelFront.Width = mWidth";
[self._ltbpanelfront setWidth:(float) (self._mwidth)];
 //BA.debugLineNum = 282;BA.debugLine="cvsPanelBack.Initialize(ltbPanelBack)";
[self._cvspanelback Initialize:(B4IViewWrapper*) [B4IObjectWrapper createWrapper:[B4IViewWrapper new] object:(UIView*)((self._ltbpanelback).object)]];
 //BA.debugLineNum = 283;BA.debugLine="cvsPanelFront.Initialize(ltbPanelFront)";
[self._cvspanelfront Initialize:(B4IViewWrapper*) [B4IObjectWrapper createWrapper:[B4IViewWrapper new] object:(UIView*)((self._ltbpanelfront).object)]];
 //BA.debugLineNum = 286;BA.debugLine="rectPanelFront.Initialize(0, 0, ltbPanelFront.Wid";
[self._rectpanelfront Initialize:(float) (0) :(float) (0) :[self._ltbpanelfront Width] :[self._ltbpanelfront Height]];
 //BA.debugLineNum = 288;BA.debugLine="InitCursors";
[self _initcursors];
 //BA.debugLineNum = 289;BA.debugLine="DrawBackGround";
[self _drawbackground];
 //BA.debugLineNum = 290;BA.debugLine="DrawCursors";
[self _drawcursors];
 //BA.debugLineNum = 291;BA.debugLine="End Sub";
return @"";
}
@end
